diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6806793c714925f2e24b24c3c38d16e353d58f23..ad2245aef398916ff17fbeb53712f26e825272e5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -11,7 +11,7 @@ WORKDIR /root RUN yum -y install which sclo-git25 wget tar atlas-devel libuuid-devel texinfo \ python2-pip redhat-lsb-core libX11-devel libXpm-devel libXft-devel \ libXext-devel openssl-devel glibc-devel rpm-build libcurl-devel \ - mesa-libGL-devel && \ + mesa-libGL-devel libaio && \ yum clean all # Set up the ATLAS user, and give it super user rights. diff --git a/Build/AtlasBuildScripts/checkout_atlasexternals.sh b/Build/AtlasBuildScripts/checkout_atlasexternals.sh index ed81eb02514d8766140f0bcbc53f4f72cde5e9ff..0fa33c4f5661dfd04c4a2b8c28e5de65c7ca5dfd 100755 --- a/Build/AtlasBuildScripts/checkout_atlasexternals.sh +++ b/Build/AtlasBuildScripts/checkout_atlasexternals.sh @@ -108,6 +108,20 @@ else echo "${SOURCEDIR} already exists -> assume previous checkout" fi +# check whether the source directory points to the right repository +RECLONE=false +pushd ${SOURCEDIR} +SOURCEURL=$(git remote get-url origin) +if [ "${SOURCEURL}" != "${EXTERNALSURL}" ] ; then + echo "${SOURCEURL} wasn't cloned from ${EXTERNALSURL}, deleting" + RECLONE=true +fi +popd +if [ $RECLONE = true ] ; then + rm -rf ${SOURCEDIR} + _retry_ git clone ${EXTERNALSURL} ${SOURCEDIR} +fi + # Get the appropriate version of it: cd ${SOURCEDIR} _retry_ git fetch --prune origin diff --git a/Calorimeter/CaloCalibHitRec/CMakeLists.txt b/Calorimeter/CaloCalibHitRec/CMakeLists.txt index 3967244aaa3fa2d56bf6305ff07b944b38d7780a..af911c58dec1024241402323c3bd3a8b50ad2936 100644 --- a/Calorimeter/CaloCalibHitRec/CMakeLists.txt +++ b/Calorimeter/CaloCalibHitRec/CMakeLists.txt @@ -32,6 +32,13 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( CLHEP ) +# Component(s) in the package: +atlas_add_library( CaloCalibHitRecLib + src/*.cxx + PUBLIC_HEADERS CaloCalibHitRec + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloDmDetDescr CaloGeoHelpers CaloIdentifier CaloRecLib CaloSimEvent AthenaBaseComps StoreGateLib SGtests Identifier xAODCaloEvent xAODTruth GaudiKernel CaloDetDescrLib CaloEvent AthenaKernel AtlasDetDescr LArRecEvent McParticleEvent TileEvent PathResolver CxxUtils ) + # Component(s) in the package: atlas_add_component( CaloCalibHitRec src/*.cxx diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitIDCheck.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitIDCheck.h index 7b79ceb45969393976f9be8fffd5c8c22025729c..9efc0a97bd3229c069745d61c105c887aca0392b 100755 --- a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitIDCheck.h +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitIDCheck.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //*********************************************************************** diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitToCaloCell.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitToCaloCell.h index d3ab7413a4329f795e796516639d424955d820f3..6182688974af977bfcc307a69c32442c62c06981 100755 --- a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitToCaloCell.h +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitToCaloCell.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitToCaloCellTool.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitToCaloCellTool.h new file mode 100755 index 0000000000000000000000000000000000000000..cc9694dbddc8adb54e99ccdf0bd6be5b0fb77d28 --- /dev/null +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CalibHitToCaloCellTool.h @@ -0,0 +1,95 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// ***************************************************************************** +// CalibHitToCaloCellTool.h +// Ioannis Nomidis <ioannis.nomidis@cern.ch> +// Dec 2016 +// Convert energy deposits from calibration hits to CaloCell, xAOD::CaloCluster +// ***************************************************************************** +#ifndef CalibHitToCaloCellTool_H +#define CalibHitToCaloCellTool_H + +//#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthAlgTool.h" + +#include "xAODCaloEvent/CaloClusterContainer.h" + +#include <string> +#include <vector> + +class CaloCell_ID; +class CaloDM_ID; +class TileID; +class LArEM_ID; +class LArHEC_ID; +class LArFCAL_ID; + +class CaloCell; +class CaloDetDescrManager; +class CaloCellContainer; + +static const InterfaceID IID_CalibHitToCaloCellTool("CalibHitToCaloCellTool", 1, 0); + +namespace CalibHitUtils { + enum EnergyType { EnergyEM=0, EnergyVisible, EnergyTotal, nEnergyTypes }; +} + +class CalibHitToCaloCellTool: virtual public AthAlgTool { + + public: + CalibHitToCaloCellTool(const std::string& t, const std::string& n, const IInterface* p); + ~CalibHitToCaloCellTool(); + StatusCode initialize(); + StatusCode processCalibHitsFromParticle(int barcode=-1) const; + StatusCode finalize(); + + static const InterfaceID& interfaceID() { return IID_CalibHitToCaloCellTool;} + + // inline CaloCellContainer* getTruthCellsCont(CalibHitUtils::EnergyType type) {return m_truthCells[(int)type];} + // inline xAOD::CaloClusterContainer* getTruthClustersCont(CalibHitUtils::EnergyType type) {return m_truthClusters[(int)type];} + + private: + int m_caloGain; + std::vector<std::string> m_calibHitContainerNames; + bool m_writeTruthCellContainers; + bool m_writeTruthClusterContainers; + int m_singleParticleBarcode; + + std::string m_tileActiveHitCnt; + std::string m_tileInactiveHitCnt; + std::string m_tileDMHitCnt; + std::string m_larInactHitCnt; + std::string m_larActHitCnt; + std::string m_larDMHitCnt; + + bool m_store_Tot; + bool m_store_Vis; + bool m_store_Em; + bool m_store_NonEm; + bool m_storeUnknown; + + bool m_doTile; + + std::string m_caloCell_Tot; + std::string m_caloCell_Vis; + std::string m_caloCell_Em; + std::string m_caloCell_NonEm; + + const CaloCell_ID* m_caloCell_ID; + const CaloDM_ID* m_caloDM_ID; + //const TileID* m_tile_ID; + //const LArEM_ID* m_larEm_ID; + //const LArHEC_ID* m_larHec_ID; + //const LArFCAL_ID* m_larFcal_ID; + + const CaloDetDescrManager* m_caloDDMgr; + + std::string m_outputCellContainerName; + std::string m_outputClusterContainerName; + + +}; + +#endif diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibClusterMomentsMaker.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibClusterMomentsMaker.h index e203bf91f2d266598dfd0fb12320e4396107d747..afe4b0a81278fe04644b774126901d4315369282 100644 --- a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibClusterMomentsMaker.h +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibClusterMomentsMaker.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CALOCALIBCLUSTERMOMENTSMAKER_H diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibClusterMomentsMaker2.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibClusterMomentsMaker2.h index 0ade45821d0f377e0866791d53e8b3c00e2aa8b4..84cce4bca2b670f0fcb8e23b98f3468fac8f0d07 100644 --- a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibClusterMomentsMaker2.h +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibClusterMomentsMaker2.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CALOCALIBCLUSTERMOMENTSMAKER2_H diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibDefineTypes.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibDefineTypes.h index 1cb37fd1a0ccc0ea91955767dd456ced5768204d..9c8391d557aaa7d9240bfb26d41308b04072deca 100644 --- a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibDefineTypes.h +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloCalibDefineTypes.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CALOCALIBDEFINETYPES_H diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloDmEnergy.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloDmEnergy.h index f5cca40646f0a8f00c429b290a769c883d864158..77d6c8160b0bd8516d3d6bb816afc88c07930fa2 100644 --- a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloDmEnergy.h +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloDmEnergy.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* **************************************************************************** diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloDmNeighbours.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloDmNeighbours.h index 496a7e13f81357f3c6544ed1d576b5878865b1cc..39f2f794352ce939c4bc24936fe4e52c64a6ea9f 100644 --- a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloDmNeighbours.h +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/CaloDmNeighbours.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* **************************************************************************** diff --git a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/ICaloCalibClusterTruthAttributerTool.h b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/ICaloCalibClusterTruthAttributerTool.h index 34a5c29d37766ddf9eee1e0a5d13af2fdd5535c0..7da4b5bb75829553c701fc2463cfb1a2e4a23586 100644 --- a/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/ICaloCalibClusterTruthAttributerTool.h +++ b/Calorimeter/CaloCalibHitRec/CaloCalibHitRec/ICaloCalibClusterTruthAttributerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ICALOCALIBCLUSTERTRUTHATTRIBUTERTOOL_H diff --git a/Calorimeter/CaloCalibHitRec/src/CalibHitToCaloCellTool.cxx b/Calorimeter/CaloCalibHitRec/src/CalibHitToCaloCellTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3a419b00fe10939c0dcbbcbfde37cc13caed99f --- /dev/null +++ b/Calorimeter/CaloCalibHitRec/src/CalibHitToCaloCellTool.cxx @@ -0,0 +1,311 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "CaloCalibHitRec/CalibHitToCaloCellTool.h" + +//Gaudi Includes +#include "StoreGate/StoreGateSvc.h" + +// Calo include +#include "CaloIdentifier/CaloDM_ID.h" +#include "CaloIdentifier/CaloCell_ID.h" +#include "CaloIdentifier/CaloGain.h" +#include "CaloSimEvent/CaloCalibrationHitContainer.h" +#include "CaloEvent/CaloCellContainer.h" +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloDetDescr/CaloDetDescrElement.h" + +#include "CaloUtils/CaloClusterStoreHelper.h" +#include "xAODCaloEvent/CaloClusterKineHelper.h" + +#include "LArRecEvent/LArCell.h" +#include "TileEvent/TileCell.h" + + +CalibHitToCaloCellTool::CalibHitToCaloCellTool(const std::string& t, const std::string& n, const IInterface* p) + : AthAlgTool(t,n,p), + m_caloGain((int)CaloGain::LARLOWGAIN), + m_store_Tot(false), + m_store_Vis(false), + m_store_Em(false), + m_store_NonEm(false), + m_caloCell_Tot("TotalCalibCell"), m_caloCell_Vis("VisCalibCell"), + m_caloCell_Em(""), m_caloCell_NonEm(""), + m_caloCell_ID(0), + m_caloDM_ID(0), + m_caloDDMgr(0) +{ + declareInterface<CalibHitToCaloCellTool>(this); + + declareProperty("CaloGain", m_caloGain); + declareProperty("CalibHitContainers", m_calibHitContainerNames); + declareProperty("SingleParticleBarcode", m_singleParticleBarcode = 10001); + + declareProperty("CellTotEne", m_caloCell_Tot); + declareProperty("CellVisEne", m_caloCell_Vis); + declareProperty("CellEmEne", m_caloCell_Em); + declareProperty("CellNonEmEne", m_caloCell_NonEm); + declareProperty("DoTile", m_doTile=false); + + declareProperty("OutputCellContainerName", m_outputCellContainerName = "TruthCells"); + declareProperty("OutputClusterContainerName", m_outputClusterContainerName = "TruthClusters"); + declareProperty("WriteTruthCellContainers", m_writeTruthCellContainers=false); + declareProperty("WriteTruthClusterContainers", m_writeTruthClusterContainers=false); + + m_tileActiveHitCnt = "TileCalibHitActiveCell"; + m_tileInactiveHitCnt = "TileCalibHitInactiveCell"; + m_tileDMHitCnt = "TileCalibHitDeadMaterial"; + m_larActHitCnt = "LArCalibrationHitActive"; + m_larInactHitCnt = "LArCalibrationHitInactive"; + m_larDMHitCnt = "LArCalibrationHitDeadMaterial"; + +} + + +CalibHitToCaloCellTool::~CalibHitToCaloCellTool() {} + + +//////////////// INITIALIZE /////////////////////// +StatusCode CalibHitToCaloCellTool::initialize() +{ + // retrieve ID helpers from det store + ATH_MSG_INFO("initialisation ID helpers" ); + + ATH_CHECK( detStore()->retrieve(m_caloCell_ID) ); + ATH_CHECK( detStore()->retrieve(m_caloDM_ID) ); + ATH_CHECK( detStore()->retrieve(m_caloDDMgr, "CaloMgr") ); + + ATH_MSG_INFO("initialisation completed" ); + return StatusCode::SUCCESS; +} + + +///////////////// EXECUTE ////////////////////// +StatusCode CalibHitToCaloCellTool::processCalibHitsFromParticle(int barcode) const +{ + ATH_MSG_DEBUG("in calibHitToCaloCellTool"); + + std::string EnergyTypeToStr[] = {"Eem","Evis","Etot"}; + + //protection - tool should run once per event + if (evtStore()->contains<CaloCellContainer>((m_outputCellContainerName+EnergyTypeToStr[0]).c_str()) && + evtStore()->contains<xAOD::CaloClusterContainer>((m_outputClusterContainerName+EnergyTypeToStr[0]).c_str())) { + ATH_MSG_DEBUG("containers for truth calo cells and truth clusters already exist"); + return StatusCode::SUCCESS; + } + + CaloCellContainer* truthCells[3]; + xAOD::CaloClusterContainer* truthClusters[3]; + + // register containers for cells and clusters + for (unsigned int i=0; i<CalibHitUtils::nEnergyTypes; i++) { + truthCells[i] = new CaloCellContainer(); + truthClusters[i] = CaloClusterStoreHelper::makeContainer(&(*evtStore()),(m_outputClusterContainerName+EnergyTypeToStr[i]).c_str(),msg()); + if (!truthClusters[i]) { + ATH_MSG_FATAL("Cannot make cluster container"); + return StatusCode::FAILURE; + } + } + + // retrieve calibration hit containers + const unsigned int nCont = m_calibHitContainerNames.size(); + std::vector<const CaloCalibrationHitContainer*> calibHitContainers(nCont,0); + for (unsigned int i=0; i<nCont; i++) { + ATH_MSG_DEBUG("Retrieving " << m_calibHitContainerNames[i]); + ATH_CHECK( evtStore()->retrieve(calibHitContainers[i], m_calibHitContainerNames[i].c_str()) ); + ATH_MSG_DEBUG(" Retrieved container " << calibHitContainers[i]->Name() << " with size " << calibHitContainers[i]->Size() ); + if( calibHitContainers[i]->Size() == 0 ) { + ATH_MSG_DEBUG("Container " << calibHitContainers[i]->Name() << " is empty"); + } + } + ATH_MSG_DEBUG("CaloCalibrationHitContainers retrieved successfuly" ); + + //count + int nchan=0; + int em_nchan=0; + int hec_nchan=0; + int fcal_nchan=0; + int tile_nchan=0; + int unknown_nchan = 0 ; + + std::vector<Identifier> ID; + if (barcode<0) barcode = m_singleParticleBarcode; // if no barcode is specified for this event, use the default + + + std::vector<CaloCell*> CellsEtot; + std::vector<CaloCell*> CellsEvis; + std::vector<CaloCell*> CellsEem; + + int nhitsInactive = 0; + + for (unsigned int i=0; i<calibHitContainers.size(); i++) { + for( const auto calibhit: *(calibHitContainers[i])) { + //care only for deposits of the given truth particle + if ((int)calibhit->particleID()!=barcode) continue; + + double Etot = calibhit->energyTotal(); + double Eem = calibhit->energy(0); + double Enonem = calibhit->energy(1); + double Evis = Eem + Enonem; + + Identifier id=calibhit->cellID(); + + //merge inactive and active hits from the same cell together + if (i>0) { + //find if have already created cell.. + bool isNewId = true; + for (int n=0; n<nhitsInactive; n++) { + if( id == ID[n] ) { //found + CellsEtot[n]->addEnergy(Etot); + CellsEvis[n]->addEnergy(Evis); + CellsEem[n]->addEnergy(Eem); + isNewId = false; + break; + } + } + if(!isNewId) continue; //go to next hit, else create new cell for this hit + } + + //check if this ID is LAr or Tile + if(m_caloCell_ID->is_lar(id)) { + ATH_MSG_VERBOSE( "Found LAr cell" ); + const CaloDetDescrElement* caloDDE = m_caloDDMgr->get_element(id); + CellsEtot.push_back(new LArCell(caloDDE, id, Etot, 0., 0, 0, (CaloGain::CaloGain)m_caloGain)) ; + CellsEvis.push_back(new LArCell(caloDDE, id, Evis, 0., 0, 0, (CaloGain::CaloGain)m_caloGain)); + CellsEem.push_back(new LArCell(caloDDE, id, Eem, 0., 0, 0, (CaloGain::CaloGain)m_caloGain)); + ID.push_back(id); + ++nchan; + } + else if(m_caloCell_ID->is_tile(id)) { + ATH_MSG_VERBOSE( "Found Tile cell" ); + const CaloDetDescrElement* caloDDE = m_caloDDMgr->get_element(id); + CellsEtot.push_back(new TileCell(caloDDE, id, Etot, 0., 0, 0, (CaloGain::CaloGain)m_caloGain)) ; + CellsEvis.push_back(new TileCell(caloDDE, id, Evis, 0., 0, 0, (CaloGain::CaloGain)m_caloGain)); + CellsEem.push_back(new TileCell(caloDDE, id, Eem, 0., 0, 0, (CaloGain::CaloGain)m_caloGain)); + ID.push_back(id); + ++nchan; + } + else { //other, DeadMaterial + //// FIXME DeadMaterial deposits not used; need to use m_caloDDMg; + ATH_MSG_VERBOSE( "Found unknown cell" ); + continue; + } + } + if (i==0) nhitsInactive = (int)ID.size(); + } + + //Now, put cells in the containers keeping the order. First goes EM, then HEC and so on + // if(CellsEtot.size()==0) { + // ID.clear(); + // return StatusCode::SUCCESS; + // } + + ATH_MSG_DEBUG("N cells : " << nchan ); + + for(int itr=0; itr!=nchan; itr++) { + if(m_caloCell_ID->is_em(CellsEtot[itr]->ID())) { + truthCells[CalibHitUtils::EnergyTotal]->push_back(CellsEtot[itr]); + truthCells[CalibHitUtils::EnergyVisible]->push_back(CellsEvis[itr]); + truthCells[CalibHitUtils::EnergyEM]->push_back(CellsEem[itr]); + ++em_nchan; + } + } + if(em_nchan) { + for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::LAREM); + } + + for(int itr=0; itr!=nchan; itr++) { + if(m_caloCell_ID->is_hec(CellsEtot[itr]->ID())) { + truthCells[CalibHitUtils::EnergyTotal]->push_back(CellsEtot[itr]); + truthCells[CalibHitUtils::EnergyVisible]->push_back(CellsEvis[itr]); + truthCells[CalibHitUtils::EnergyEM]->push_back(CellsEem[itr]); + ++hec_nchan; + } + } + if(hec_nchan){ + for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::LARHEC); + } + + for(int itr=0; itr!=nchan; itr++) { + if(m_caloCell_ID->is_fcal(CellsEtot[itr]->ID())) { + truthCells[CalibHitUtils::EnergyTotal]->push_back(CellsEtot[itr]); + truthCells[CalibHitUtils::EnergyVisible]->push_back(CellsEvis[itr]); + truthCells[CalibHitUtils::EnergyEM]->push_back(CellsEem[itr]); + ++fcal_nchan; + } + } + if(fcal_nchan) { + for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::LARFCAL); + } + + for(int itr=0; itr!=nchan; itr++) { + if((m_caloCell_ID->is_tile(CellsEtot[itr]->ID()))) { + truthCells[CalibHitUtils::EnergyTotal]->push_back(CellsEtot[itr]); + truthCells[CalibHitUtils::EnergyVisible]->push_back(CellsEvis[itr]); + truthCells[CalibHitUtils::EnergyEM]->push_back(CellsEem[itr]); + ++tile_nchan; + } + } + if(tile_nchan) { + for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::TILE); + } + if(unknown_nchan) { + for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::NOT_VALID); + } + ATH_MSG_DEBUG("--- LAr INFO --- "<<nchan ); + ATH_MSG_DEBUG("LArCells = "<<nchan ); + ATH_MSG_DEBUG("EMCells = "<<em_nchan ); + ATH_MSG_DEBUG("HECCells = "<<hec_nchan ); + ATH_MSG_DEBUG("FCALCells = "<<fcal_nchan ); + ATH_MSG_DEBUG("TileCells = "<<tile_nchan ); + ATH_MSG_DEBUG("NOT_VALID = "<<unknown_nchan ); + + ID.clear(); + + ///.......................................................... + + ATH_MSG_DEBUG("making truth cluster"); + xAOD::CaloCluster* truthCluster[3] = {0,0,0}; + for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) { + truthCluster[i] = CaloClusterStoreHelper::makeCluster(truthClusters[i],truthCells[i]); + if (!truthCluster[i]) { + ATH_MSG_FATAL("makeCluster failed"); + return StatusCode::FAILURE; + } + for (const auto cell: *truthCells[i]) { + if(m_caloCell_ID->is_lar(cell->ID()) || m_caloCell_ID->is_tile(cell->ID())) + truthCluster[i]->addCell( truthCells[i]->findIndex(cell->caloDDE()->calo_hash()) , 1.); + } + + truthCluster[i]->setClusterSize(xAOD::CaloCluster::CSize_Unknown); + CaloClusterKineHelper::calculateKine(truthCluster[i], true, true); + ATH_MSG_INFO("Created truth cluster with " << EnergyTypeToStr[i] <<" " << truthCluster[i]->e()); + } + + // record containers + if (m_writeTruthCellContainers) { + for (int i=0;i<3;i++) { + ATH_MSG_DEBUG("recording truth cells container for " << EnergyTypeToStr[i] <<" deposits, size: " << truthCells[i]->size()); + ATH_CHECK(evtStore()->record(truthCells[i], (m_outputCellContainerName+EnergyTypeToStr[i]).c_str())); + } + } + if (m_writeTruthClusterContainers) { + for (int i=0;i<3;i++) { + ATH_MSG_DEBUG("finalizing truth cluster"); + ATH_CHECK( CaloClusterStoreHelper::finalizeClusters(&*evtStore(), truthClusters[i], (m_outputClusterContainerName+EnergyTypeToStr[i]).c_str(), msg()) ); + } + } + + ATH_MSG_DEBUG("execute() completed successfully" ); + return StatusCode::SUCCESS; +} + + +///////////////// FINALIZE ////////////////////// +StatusCode CalibHitToCaloCellTool::finalize() +{ + ATH_MSG_INFO("finalize() successfully" ); + return StatusCode::SUCCESS; +} + diff --git a/Calorimeter/CaloCalibHitRec/src/components/CaloCalibHitRec_entries.cxx b/Calorimeter/CaloCalibHitRec/src/components/CaloCalibHitRec_entries.cxx index 8393dee680f7bde0aeb22a9561e99f99c0e031dc..4a07247dfda85cd021c08400752d18b4ae131404 100644 --- a/Calorimeter/CaloCalibHitRec/src/components/CaloCalibHitRec_entries.cxx +++ b/Calorimeter/CaloCalibHitRec/src/components/CaloCalibHitRec_entries.cxx @@ -5,6 +5,8 @@ #include "CaloCalibHitRec/CaloCalibClusterTruthAttributerTool.h" #include "../CaloCalibClusterTruthMapMakerAlgorithm.h" #include "../CaloCalibClusterDecoratorAlgorithm.h" +#include "CaloCalibHitRec/CalibHitToCaloCellTool.h" + DECLARE_COMPONENT( CalibHitToCaloCell ) DECLARE_COMPONENT( CalibHitIDCheck ) @@ -14,3 +16,6 @@ DECLARE_COMPONENT( CaloCalibClusterMomentsMaker2 ) DECLARE_COMPONENT( CaloCalibClusterTruthAttributerTool ) DECLARE_COMPONENT( CaloCalibClusterTruthMapMakerAlgorithm ) DECLARE_COMPONENT( CaloCalibClusterDecoratorAlgorithm ) +DECLARE_COMPONENT( CalibHitToCaloCellTool ) + + diff --git a/Calorimeter/CaloConditions/CaloConditions/ToolConstants.h b/Calorimeter/CaloConditions/CaloConditions/ToolConstants.h index 712bb87f6ce2bf14edf282d29606382aca6c3f45..f0bcd25b581e12a0b9ce30a06f308151c1ba662f 100755 --- a/Calorimeter/CaloConditions/CaloConditions/ToolConstants.h +++ b/Calorimeter/CaloConditions/CaloConditions/ToolConstants.h @@ -1,7 +1,7 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: ToolConstants.h,v 1.5 2009-04-09 14:41:17 ssnyder Exp $ @@ -76,11 +76,21 @@ public: const CxxUtils::Arrayrep& rep); + /** + * @brief Set an entry. + * @param key The key of the entry to set. + * @param rep The value of the new entry. + */ + void setrep (const std::string& key, + CxxUtils::Arrayrep&& rep); + + /** * @brief Test to see if a given key is present. */ bool hasrep (const std::string& key) const; + /** * @brief Writes out constants in a python-like format * @param stream Stream to which to write (file or cout) @@ -89,6 +99,13 @@ public: void writeConstants(std::ostream& stream, const std::string& name) const; + /** + * @brief Return the data as a formatted string. + * @param name Name of the Maker-Algorithm. + */ + std::string toString (const std::string& name) const; + + /** * @brief Return the name of the C++ class that operates on these constants. */ @@ -144,4 +161,8 @@ private: CLASS_DEF(CaloRec::ToolConstants,250904980 ,1) + +#include "AthenaKernel/CondCont.h" +CONDCONT_DEF( CaloRec::ToolConstants, 274098 ); + #endif // not CALOREC_TOOLCONSTANTS_H diff --git a/Calorimeter/CaloConditions/src/ToolConstants.cxx b/Calorimeter/CaloConditions/src/ToolConstants.cxx index 13854e5c0ccbd36926cc71655beda4efcb6b4618..8396f99ee5cf67246bd0b0042021d21d20a3fc12 100755 --- a/Calorimeter/CaloConditions/src/ToolConstants.cxx +++ b/Calorimeter/CaloConditions/src/ToolConstants.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: ToolConstants.cxx,v 1.5 2009-04-09 14:41:17 ssnyder Exp $ @@ -79,6 +79,18 @@ void ToolConstants::setrep (const std::string& key, } +/** + * @brief Set an entry. + * @param key The key of the entry to set. + * @param rep The value of the new entry. + */ +void ToolConstants::setrep (const std::string& key, + CxxUtils::Arrayrep&& rep) +{ + m_map[key] = std::move (rep); +} + + /** * @brief Test to see if a given key is present. */ @@ -119,6 +131,18 @@ void ToolConstants::writeConstants(std::ostream& stream, } +/** + * @brief Return the data as a formatted string. + * @param name Name of the Maker-Algorithm. + */ +std::string ToolConstants::toString (const std::string& name) const +{ + std::ostringstream ss; + writeConstants (ss, name); + return ss.str(); +} + + /** * @brief Return the name of the C++ class that operates on these constants. */ diff --git a/Calorimeter/CaloConditions/test/ToolConstants_test.cxx b/Calorimeter/CaloConditions/test/ToolConstants_test.cxx index e3e295c250b8af03f6693211e8a197b56f553d09..3cd43b73888ca22334fc13c0ebf49decaebea861 100755 --- a/Calorimeter/CaloConditions/test/ToolConstants_test.cxx +++ b/Calorimeter/CaloConditions/test/ToolConstants_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: ToolConstants_test.cxx,v 1.4 2009-04-09 14:41:17 ssnyder Exp $ @@ -65,6 +65,17 @@ void test1() Array<0> a4 (tc.getrep ("foo", "fee")); assert (a4 == 1.25); + Arrayrep rep; + rep.m_shape.assign ({3}); + rep.m_data.assign ({1.5, 2.5, 3.5}); + rep.init_sizes(); + + tc.setrep ("bar", std::move (rep)); + Array<1> a5 = tc.getrep ("foo", "bar"); + assert (a5.size() == 3); + assert (a5[0] == 1.5); + assert (rep.m_data.empty()); + assert (tc.clsname() == ""); tc.clsname ("abc"); assert (tc.clsname() == "abc"); @@ -72,6 +83,15 @@ void test1() assert (tc.version() == 0); tc.version (10); assert (tc.version() == 10); + + std::string s = tc.toString ("foo"); + assert (s == "foo.a = 1.25\n" + "foo.b = [\n" + " [1, 2],\n" + " [3, 4]\n" + " ]\n" + "foo.bar = [1.5, 2.5, 3.5]\n" + "foo.fee = 1.25\n\n"); } diff --git a/Calorimeter/CaloExample/CaloTests/CMakeLists.txt b/Calorimeter/CaloExample/CaloTests/CMakeLists.txt index 56901b01727a45293a5ff95bc7628d7a6abec969..a5f2473b8234e7d3671796c38d8043579c265835 100644 --- a/Calorimeter/CaloExample/CaloTests/CMakeLists.txt +++ b/Calorimeter/CaloExample/CaloTests/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC Calorimeter/CaloSimEvent Control/AthenaKernel DetectorDescription/AtlasDetDescr + Generators/AtlasHepMC Generators/GeneratorObjects LArCalorimeter/LArIdentifier LArCalorimeter/LArRawEvent @@ -29,15 +30,14 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( AIDA ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( CaloTests src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} CaloDetDescrLib CaloIdentifier AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel CaloEvent CaloGeoHelpers CaloSimEvent AthenaKernel AtlasDetDescr GeneratorObjects LArIdentifier LArRawEvent LArRawUtilsLib LArSimEvent LArCablingLib ) + INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib CaloDetDescrLib CaloIdentifier AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel CaloEvent CaloGeoHelpers CaloSimEvent AthenaKernel AtlasDetDescr GeneratorObjects LArIdentifier LArRawEvent LArRawUtilsLib LArSimEvent LArCablingLib ) # Install files from the package: atlas_install_headers( CaloTests ) diff --git a/Calorimeter/CaloExample/CaloTests/src/MyAnalysis.cxx b/Calorimeter/CaloExample/CaloTests/src/MyAnalysis.cxx index c4bf2e213dfcd773b08bfdd3c90861faec29dd36..ed1ed34de97db4048ec31a403a9f5b03145e6761 100644 --- a/Calorimeter/CaloExample/CaloTests/src/MyAnalysis.cxx +++ b/Calorimeter/CaloExample/CaloTests/src/MyAnalysis.cxx @@ -28,8 +28,8 @@ #include "LArIdentifier/LArOnlineID.h" #include "GeneratorObjects/McEventCollection.h" #include "StoreGate/ReadHandle.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/ListItem.h" diff --git a/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx b/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx index 8b6e2c5145c5c9320536f253b53d88b2730eca29..c593491334e8ce02362c50076be67c552bf54ce4 100644 --- a/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx +++ b/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx @@ -13,8 +13,8 @@ #include "CaloSimEvent/CaloCalibrationHitContainer.h" #include "GeneratorObjects/McEventCollection.h" #include "StoreGate/ReadHandle.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" diff --git a/Calorimeter/CaloIdentifier/CMakeLists.txt b/Calorimeter/CaloIdentifier/CMakeLists.txt index 1d748db4bcaee43ce73c3e721f22cd0529e8893e..9a645822a8bf6607e1f188082f69ae7039d4cdc7 100644 --- a/Calorimeter/CaloIdentifier/CMakeLists.txt +++ b/Calorimeter/CaloIdentifier/CMakeLists.txt @@ -59,6 +59,11 @@ atlas_add_executable( test_lvl1_id INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloGeoHelpers AthenaKernel AtlasDetDescr IdDict Identifier GaudiKernel TestTools CxxUtils StoreGateLib SGtests IdDictParser PathResolver CaloIdentifier ) +atlas_add_executable( caloCellLookup + utils/caloCellLookup.cxx + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloGeoHelpers AthenaKernel AtlasDetDescr IdDict Identifier GaudiKernel TestTools CxxUtils StoreGateLib SGtests IdDictParser PathResolver CaloIdentifier ) + #atlas_add_test( GTower_ID_test # SOURCES # test/GTower_ID_test.cxx diff --git a/Calorimeter/CaloIdentifier/utils/caloCellLookup.cxx b/Calorimeter/CaloIdentifier/utils/caloCellLookup.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d2e2e6464a34dc8789d371fc44352190b206c05b --- /dev/null +++ b/Calorimeter/CaloIdentifier/utils/caloCellLookup.cxx @@ -0,0 +1,79 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file CaloIdentifier/utils/caloCellLookup.cxx + * @author scott snyder + * @date Apr 2020 + * @brief Command-line utility to decode a calorimeter cell hash. + */ + + +#include "CaloIdentifier/CaloHelpersTest.h" +#include <cstdlib> +#include <iostream> + + +int main (int argc, char** argv) +{ + CaloHelpersTest helpers; + const CaloCell_ID& caloID = helpers.caloID(); + + for (int i=1; i < argc; i++) { + int hash = atoi (argv[i]); + Identifier id = caloID.cell_id (hash); + std::cout << hash << " " << id << " "; + int subcalo = caloID.sub_calo (hash); + switch (subcalo) { + case CaloCell_ID::LAREM: + std::cout << "LAREM " << + "BEC: " << helpers.emID().barrel_ec(id) << " " + "Samp: " << helpers.emID().sampling(id) << " " + "Reg: " << helpers.emID().region(id) << " " + "Eta: " << helpers.emID().eta(id) << " " + "Phi: " << helpers.emID().phi(id) << " " + "SC: " << helpers.emID().is_supercell(id) << std::endl; + break; + case CaloCell_ID::LARHEC: + std::cout << "LARHEC " << + "P/N: " << helpers.hecID().pos_neg(id) << " " + "Samp: " << helpers.hecID().sampling(id) << " " + "Reg: " << helpers.hecID().region(id) << " " + "Eta: " << helpers.hecID().eta(id) << " " + "Phi: " << helpers.hecID().phi(id) << " " + "SC: " << helpers.hecID().is_supercell(id) << std::endl; + break; + case CaloCell_ID::LARFCAL: + std::cout << "LARFCAL " << + "P/N: " << helpers.fcalID().pos_neg(id) << " " + "Mod: " << helpers.fcalID().module(id) << " " + "Eta: " << helpers.fcalID().eta(id) << " " + "Phi: " << helpers.fcalID().phi(id) << " " + "SC: " << helpers.fcalID().is_supercell(id) << std::endl; + break; + case CaloCell_ID::TILE: + std::cout << "TILE " << + "Reg: " << helpers.tileID().region(id) << " " + "Syst: " << helpers.tileID().system(id) << " " + "Sect: " << helpers.tileID().section(id) << " " + "Side: " << helpers.tileID().side(id) << " " + "Mod: " << helpers.tileID().module(id) << " " + "Tow: " << helpers.tileID().tower(id) << " " + "Samp: " << helpers.tileID().sample(id) << " " + "PMT: " << helpers.tileID().pmt(id) << std::endl; + break; + case CaloCell_ID::LARMINIFCAL: + std::cout << "LARMINIFCAL " + "P/N: " << helpers.minifcalID().pos_neg(id) << " " + "Mod: " << helpers.minifcalID().module(id) << " " + "Dep: " << helpers.minifcalID().depth(id) << " " + "Eta: " << helpers.minifcalID().eta(id) << " " + "Phi: " << helpers.minifcalID().phi(id) << std::endl; + break; + default: + std::cout << "UNKNOWN "; + } + } + + return 0; +} diff --git a/Control/AthViews/CMakeLists.txt b/Control/AthViews/CMakeLists.txt index 6714a6636c20a3c567a92ea46fab1a39b41916bc..ed5b2aad306d726cdc6b1d056bd3a629fb01ae38 100644 --- a/Control/AthViews/CMakeLists.txt +++ b/Control/AthViews/CMakeLists.txt @@ -31,7 +31,6 @@ atlas_add_library( AthViews LINK_LIBRARIES ${TBB_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib GaudiKernel CxxUtils AthLinks TrigSteeringEvent ) atlas_add_component( AthViewsAlgs - src/*.cxx src/components/*.cxx INCLUDE_DIRS ${TBB_INCLUDE_DIRS} LINK_LIBRARIES AthViews ) @@ -40,7 +39,7 @@ atlas_add_component( AthViewsDFlow src_dflow/*.cxx src_dflow/components/*.cxx INCLUDE_DIRS ${TBB_INCLUDE_DIRS} - LINK_LIBRARIES AthViews ) + LINK_LIBRARIES AthViews AthExHiveLib ) atlas_add_dictionary( AthViewsAlgsDict AthViews/AthViewsWriteDict.h diff --git a/Control/AthenaConfiguration/python/AtlasSemantics.py b/Control/AthenaConfiguration/python/AtlasSemantics.py index df20918420fd524568ef7e39966ef5a5093a90ee..97ff06f2c0fd9853dd6b1571f186e89150be0587 100644 --- a/Control/AthenaConfiguration/python/AtlasSemantics.py +++ b/Control/AthenaConfiguration/python/AtlasSemantics.py @@ -1,5 +1,6 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from past.builtins import basestring import GaudiConfig2.semantics from GaudiKernel.GaudiHandles import PrivateToolHandleArray import re diff --git a/Control/AthenaConfiguration/python/ComponentAccumulatorTest.py b/Control/AthenaConfiguration/python/ComponentAccumulatorTest.py index b5afb081253ac56e48c437370baa986f8c1d8094..830ba6e9fe0fca4238a653e3e0e34ceb40a2c2ef 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulatorTest.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulatorTest.py @@ -484,7 +484,7 @@ class TestSequencesMerging( unittest.TestCase ): ca2 = OutputStreamCfg(ConfigFlags, "RDO", ItemList = [ "SCT_RDO_Container#SCT_RDOs", "InDetSimDataCollection#SCT_SDO_Map" - ]) + ]) ca2.printConfig() print("after merge") diff --git a/Control/AthenaMonitoring/AthenaMonitoring/AthenaMonManager.h b/Control/AthenaMonitoring/AthenaMonitoring/AthenaMonManager.h index d1a631b0dcc453f4e89837b67953de4aa9e43507..6d9f66fd8f1a282bfcc4be4be3eb5b4e688ac4b8 100755 --- a/Control/AthenaMonitoring/AthenaMonitoring/AthenaMonManager.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/AthenaMonManager.h @@ -125,8 +125,6 @@ class AthenaMonManager : public AthAlgorithm { protected: ToolHandleArray<IMonitorToolBase> m_monTools; - virtual void setEventInfo(); - ITHistSvc* m_THistSvc; private: diff --git a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py index 8fd60183f37c87fb9d63c6a68a396b642cd209d2..6780f16fbc368a805fb60bbaea1b4df6a3cccab4 100644 --- a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py +++ b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py @@ -263,6 +263,18 @@ if DQMonFlags.doMonitoring(): if isinstance(_, AthenaMonManager): toolset.update(_.AthenaMonTools) + # in MT the initialization can be in random order ... force all managers to have common setup + _.FileKey = DQMonFlags.monManFileKey() + _.ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup() + _.DataType = DQMonFlags.monManDataType() + _.Environment = DQMonFlags.monManEnvironment() + _.LBsInLowStatInterval = DQMonFlags.monManLBsInLowStatInterval() + _.LBsInMediumStatInterval = DQMonFlags.monManLBsInMediumStatInterval() + _.LBsInHighStatInterval = DQMonFlags.monManLBsInHighStatInterval() + _.ManualRunLBSetup = DQMonFlags.monManManualRunLBSetup() + _.Run = DQMonFlags.monManRun() + _.LumiBlock = DQMonFlags.monManLumiBlock() + for tool in toolset: # stop lumi access if we're in MC or enableLumiAccess == False if 'EnableLumi' in dir(tool): diff --git a/Control/AthenaMonitoring/src/AthenaMonManager.cxx b/Control/AthenaMonitoring/src/AthenaMonManager.cxx index f8d2f71dda21772448389a7f7e6b74342b9db707..3c2bae6dd60246b55dd85d598220c9bdf8d8564a 100755 --- a/Control/AthenaMonitoring/src/AthenaMonManager.cxx +++ b/Control/AthenaMonitoring/src/AthenaMonManager.cxx @@ -104,10 +104,6 @@ public: bool m_forkedProcess; pid_t m_lastPID; - // Retrieval key - SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey - { "EventInfo" }; - //NB: The LW hist leak checker is now also looking for //inappropriate usage of MonGroup copy constructors (temporary //until we outlaw copy/assignment of MonGroups): @@ -184,6 +180,7 @@ public: static DataType_t s_dataType; static Environment_t s_environment; + static bool s_runLBOverridden; static unsigned int s_lumiBlock; static unsigned int s_run; static unsigned int s_fill; @@ -201,6 +198,7 @@ std::string AthenaMonManager::Imp::s_environmentStr("user") AthenaMonManager::DataType_t AthenaMonManager::Imp::s_dataType(userDefined); AthenaMonManager::Environment_t AthenaMonManager::Imp::s_environment(user); +bool AthenaMonManager::Imp::s_runLBOverridden(false); unsigned int AthenaMonManager::Imp::s_lumiBlock(0); unsigned int AthenaMonManager::Imp::s_run(0); unsigned int AthenaMonManager::Imp::s_fill(0); @@ -363,7 +361,11 @@ unsigned int AthenaMonManager:: lumiBlockNumber() { - return Imp::s_lumiBlock; + if (Imp::s_runLBOverridden) { + return Imp::s_lumiBlock; + } else { + return Gaudi::Hive::currentContext().eventID().lumi_block(); + } } @@ -371,7 +373,11 @@ unsigned int AthenaMonManager:: runNumber() { - return Imp::s_run; + if (Imp::s_runLBOverridden) { + return Imp::s_run; + } else { + return Gaudi::Hive::currentContext().eventID().run_number(); + } } @@ -394,8 +400,6 @@ initialize() if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "AthenaMonManager::initialize():" << endmsg; - ATH_CHECK( m_d->m_EventInfoKey.initialize() ); - if (Imp::s_svcLocator->service("SGAudSvc", m_d->m_sgAudSvc, false/*do not create*/).isFailure()) m_d->m_sgAudSvc=0; @@ -454,6 +458,7 @@ initialize() if( m_d->m_manualRunLBProp ) { Imp::s_run = m_d->m_runProp; Imp::s_lumiBlock = m_d->m_lumiBlockProp; + Imp::s_runLBOverridden = true; if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " --> using run = " << Imp::s_run << ", lumiBlock = " << Imp::s_lumiBlock << endmsg; } else { @@ -545,11 +550,6 @@ execute() StatusCode sc; sc.setChecked(); - if( !m_d->m_manualRunLBProp ) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " --> Calling setEventInfo()" << endmsg; - setEventInfo(); - } - ToolHandleArray<IMonitorToolBase>::iterator monToolsEnd = m_monTools.end(); for( ToolHandleArray<IMonitorToolBase>::iterator i = m_monTools.begin(); i != monToolsEnd; ++i ) { ToolHandle<IMonitorToolBase>& tool = *i; @@ -921,25 +921,6 @@ writeAndDelete( const std::string& key ) // Protected Methods // ********************************************************************* -void -AthenaMonManager:: -setEventInfo() -{ - if( m_d->m_isPrimaryManager ) { - SG::ReadHandle<xAOD::EventInfo> evt(m_d->m_EventInfoKey); - if (! evt.isValid()) { - ATH_MSG_ERROR("!! Unable to retrieve Event from StoreGate !!"); - } - - Imp::s_run = evt->runNumber(); - Imp::s_lumiBlock = evt->lumiBlock(); - - if (msgLvl(MSG::DEBUG)) - msg(MSG::DEBUG) << " --> setEventInfo: run = " << Imp::s_run << ", lumiBlock = " << Imp::s_lumiBlock << endmsg; - - } -} - // ********************************************************************* // Private Methods diff --git a/Control/AthenaServices/src/AthenaOutputStream.cxx b/Control/AthenaServices/src/AthenaOutputStream.cxx index e8c60eae87e741134ac02958343a72869f55cf37..c783303a0de4745448abd6e9c1603af7c092125b 100644 --- a/Control/AthenaServices/src/AthenaOutputStream.cxx +++ b/Control/AthenaServices/src/AthenaOutputStream.cxx @@ -369,92 +369,39 @@ void AthenaOutputStream::handle(const Incident& inc) { EventContext::ContextID_t slot = inc.context().slot(); ATH_MSG_DEBUG("slot " << slot << " handle() incident type: " << inc.type()); + // mutex shared with write() which is called from writeMetaData std::unique_lock<mutex_t> lock(m_mutex); - if( inc.type() == "MetaDataStop" ) { - const std::string outputFN = m_slotRangeMap[ slot ]; - IAthenaOutputStreamTool* streamer = &*m_streamer; - if( m_outSeqSvc->inUse() and m_outSeqSvc->inConcurrentEventsMode() ) { - if( slot == EventContext::INVALID_CONTEXT_ID ) { - // slot is invalid during application stop, but all ranges are closed by that time - ATH_MSG_DEBUG("Ignoring MetaDataStop incident with invalid slot"); - return; - } - streamer = m_streamerMap[outputFN].get(); - } - // Moved preFinalize of helper tools to stop - want to optimize the - // output file in finalize RDS 12/2009 - for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); - iter != m_helperTools.end(); iter++) { - if (!(*iter)->preFinalize().isSuccess()) { - ATH_MSG_ERROR("Cannot finalize helper tool"); - } - } - if( m_metaDataSvc->prepareOutput().isFailure() ) { - ATH_MSG_ERROR("Failed on MetaDataSvc prepareOutput"); - } - // Always force a final commit in stop - mainly applies to AthenaPool - if (m_writeOnFinalize) { - if (write().isFailure()) { // true mean write AND commit - ATH_MSG_ERROR("Cannot write on finalize"); - } - ATH_MSG_INFO("Records written: " << m_events); - } - if (!m_metadataItemList.value().empty()) { - m_currentStore = &m_metadataStore; - StatusCode status = streamer->connectServices(m_metadataStore.type(), m_persName, false); - if (status.isFailure()) { - throw GaudiException("Unable to connect metadata services", name(), StatusCode::FAILURE); - } - m_checkNumberOfWrites = false; - m_outputAttributes = "[OutputCollection=MetaDataHdr][PoolContainerPrefix=MetaData][AttributeListKey=]"; - m_p2BWritten->clear(); - IProperty *pAsIProp(nullptr); - if ((m_p2BWritten.retrieve()).isFailure() || - nullptr == (pAsIProp = dynamic_cast<IProperty*>(&*m_p2BWritten)) || - (pAsIProp->setProperty("ItemList", m_metadataItemList.toString())).isFailure()) { - throw GaudiException("Folder property [metadataItemList] not found", name(), StatusCode::FAILURE); - } - if (write().isFailure()) { // true mean write AND commit - ATH_MSG_ERROR("Cannot write metadata"); - } - m_outputAttributes.clear(); - m_currentStore = &m_dataStore; - status = streamer->connectServices(m_dataStore.type(), m_persName, m_extendProvenanceRecord); - if (status.isFailure()) { - throw GaudiException("Unable to re-connect services", name(), StatusCode::FAILURE); - } - m_p2BWritten->clear(); - if ((pAsIProp->setProperty(m_itemList)).isFailure()) { - throw GaudiException("Folder property [itemList] not found", name(), StatusCode::FAILURE); - } - ATH_MSG_INFO("Records written: " << m_events); - } - } - - // Handle Event Ranges + // Handle Event Ranges for Event Service if( m_outSeqSvc->inUse() and m_outSeqSvc->inConcurrentEventsMode() ) { + if( inc.type() == "MetaDataStop" ) { + // all substreams should be closed by this point + ATH_MSG_DEBUG("Ignoring MetaDataStop incident in ES mode"); + return; + } + if( slot == EventContext::INVALID_CONTEXT_ID ) { + throw GaudiException("Received Incident with invalid slot in ES mode", name(), StatusCode::FAILURE); + } if( inc.type() == IncidentType::BeginProcessing ) { // remember in which output filename this event should be stored m_slotRangeMap[ slot ] = m_outSeqSvc->buildSequenceFileName(m_outputName); ATH_MSG_DEBUG("slot " << slot << " assigned filename: " << m_slotRangeMap[ slot ] ); - return; - } - if( inc.type() == IncidentType::EndProcessing ) { + } else if( inc.type() == IncidentType::EndProcessing ) { std::string rangeFN = m_slotRangeMap[ slot ]; if( !rangeFN.empty() ) { + // check how many events there are still for the given range int n = 0; for( auto& elem : m_slotRangeMap ) { if( elem.second == rangeFN ) n++; } if( n == 1 ) { // this was the last event in this range, finalize it - ATH_MSG_DEBUG("slot " << slot << " starting transition MetaData for " << rangeFN); - if( !m_metaDataSvc->transitionMetaDataFile( m_outSeqSvc->ignoringInputBoundary() ).isSuccess() ) { - ATH_MSG_FATAL("Cannot transition MetaDataSvc"); - } - ATH_MSG_INFO("Finished writing event sequence to " << rangeFN ); + ATH_MSG_DEBUG("slot " << slot << " writing MetaData to " << rangeFN); + // MN: not calling StopMetaDataIncident here - OK for Sim, check others + // metadata tools like CutFlowSvc are not able to handle this yet + writeMetaData( rangeFN ); + ATH_MSG_INFO("Finished writing Event Sequence to " << rangeFN ); auto strm_iter = m_streamerMap.find( rangeFN ); strm_iter->second->finalizeOutput().ignore(); strm_iter->second->finalize().ignore(); @@ -463,14 +410,79 @@ void AthenaOutputStream::handle(const Incident& inc) } m_slotRangeMap[ slot ].clear(); } else { - ATH_MSG_ERROR("Failed to handle EndProcessing incident"); + throw GaudiException("Failed to handle EndProcessing incident - range filename not found", + name(), StatusCode::FAILURE); } } + } else { + // not in Event Service + if( inc.type() == "MetaDataStop" ) { + writeMetaData(); + } } ATH_MSG_DEBUG("Leaving incident handler for " << inc.type()); } +// method to write MetaData for this stream +// in ES mode the range substream is determined by the current Event slot +// called from the incident handler - returns void and throws GaudiExceptions on errors +void AthenaOutputStream::writeMetaData(const std::string outputFN) +{ + // use main stream tool by default, or per outputFile in ES mode + IAthenaOutputStreamTool* streamer = outputFN.empty()? &*m_streamer : m_streamerMap[outputFN].get(); + + // Moved preFinalize of helper tools to stop - want to optimize the + // output file in finalize RDS 12/2009 + for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); + iter != m_helperTools.end(); iter++) { + if (!(*iter)->preFinalize().isSuccess()) { + throw GaudiException("Cannot finalize helper tool", name(), StatusCode::FAILURE); + } + } + if( m_metaDataSvc->prepareOutput().isFailure() ) { + throw GaudiException("Failed on MetaDataSvc prepareOutput", name(), StatusCode::FAILURE); + } + // Always force a final commit in stop - mainly applies to AthenaPool + if (m_writeOnFinalize) { + if (write().isFailure()) { // true mean write AND commit + throw GaudiException("Cannot write on finalize", name(), StatusCode::FAILURE); + } + ATH_MSG_INFO("Records written: " << m_events); + } + ATH_MSG_DEBUG("metadataItemList: " << m_metadataItemList.value() ); + if (!m_metadataItemList.value().empty()) { + m_currentStore = &m_metadataStore; + StatusCode status = streamer->connectServices(m_metadataStore.type(), m_persName, false); + if (status.isFailure()) { + throw GaudiException("Unable to connect metadata services", name(), StatusCode::FAILURE); + } + m_checkNumberOfWrites = false; + m_outputAttributes = "[OutputCollection=MetaDataHdr][PoolContainerPrefix=MetaData][AttributeListKey=]"; + m_p2BWritten->clear(); + IProperty *pAsIProp(nullptr); + if ((m_p2BWritten.retrieve()).isFailure() || + nullptr == (pAsIProp = dynamic_cast<IProperty*>(&*m_p2BWritten)) || + (pAsIProp->setProperty("ItemList", m_metadataItemList.toString())).isFailure()) { + throw GaudiException("Folder property [metadataItemList] not found", name(), StatusCode::FAILURE); + } + if (write().isFailure()) { // true mean write AND commit + throw GaudiException("Cannot write metadata", name(), StatusCode::FAILURE); + } + m_outputAttributes.clear(); + m_currentStore = &m_dataStore; + status = streamer->connectServices(m_dataStore.type(), m_persName, m_extendProvenanceRecord); + if (status.isFailure()) { + throw GaudiException("Unable to re-connect services", name(), StatusCode::FAILURE); + } + m_p2BWritten->clear(); + if ((pAsIProp->setProperty(m_itemList)).isFailure()) { + throw GaudiException("Folder property [itemList] not found", name(), StatusCode::FAILURE); + } + ATH_MSG_INFO("Records written: " << m_events); + } +} + // terminate data writer StatusCode AthenaOutputStream::finalize() { bool failed = false; diff --git a/Control/AthenaServices/src/AthenaOutputStream.h b/Control/AthenaServices/src/AthenaOutputStream.h index 92218ee9b84f159c496b13c97fbb354c46e18b51..6071cefba9841e00e3d9d40708bc4da82d1fc91d 100644 --- a/Control/AthenaServices/src/AthenaOutputStream.h +++ b/Control/AthenaServices/src/AthenaOutputStream.h @@ -197,6 +197,9 @@ private: /// Try to match a DataProxy to a vector of strings bool matchKey(const std::vector<std::string>& key, const SG::DataProxy* proxy) const; + /// Write MetaData for this stream (by default) or for a substream outputFN (in ES mode) + void writeMetaData( const std::string outputFN="" ); + }; #endif // ATHENASERVICES_OUTPUTSTREAM_H diff --git a/Control/CxxUtils/CxxUtils/concepts.h b/Control/CxxUtils/CxxUtils/concepts.h new file mode 100644 index 0000000000000000000000000000000000000000..2aa50223e22a20281e76b524abc172da3b10437e --- /dev/null +++ b/Control/CxxUtils/CxxUtils/concepts.h @@ -0,0 +1,40 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file CxxUtils/concepts.h + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Compatibility helpers for using some pieces of C++20 + * concepts with older compilers. + * + * Use ATH_REQUIRES for a requires clause: + *@code + * template <class T> + * ATH_REQUIRES( std::assignable_from<T, float> ) + * void foo (T x); + @endcode + * + * The body of the ATH_REQUIRES will be hidden for compilers + * that don't support concepts. + */ + + +#ifndef CXXUTILS_CONCEPTS_H +#define CXXUTILS_CONCEPTS_H + + +#ifdef __cpp_concepts + +#include <concepts> +#define ATH_REQUIRES(...) requires __VA_ARGS__ + +#else + +#define ATH_REQUIRES(...) + +#endif + + +#endif // not CXXUTILS_CONCEPTS_H diff --git a/Control/RootUtils/RootUtils/TClassEditRootUtils.h b/Control/RootUtils/RootUtils/TClassEditRootUtils.h index 6537fb5042fde21beba0b67218e79a451c6c09e7..5b9265ecc4784178d30338fdb1c67c3c2d963454 100644 --- a/Control/RootUtils/RootUtils/TClassEditRootUtils.h +++ b/Control/RootUtils/RootUtils/TClassEditRootUtils.h @@ -224,8 +224,8 @@ namespace TClassEdit { return nullptr; } return demangled_name; - } #endif + } char* DemangleTypeIdName(const std::type_info& ti, int& errorCode); diff --git a/DataQuality/DataQualityTools/DataQualityTools/DQTDetSynchMonAlg.h b/DataQuality/DataQualityTools/DataQualityTools/DQTDetSynchMonAlg.h index d1dcfdad28821e39f531394ae8530fc0057f43c3..0c73e5d93230e9c569fb62289d81d2386eabb5db 100644 --- a/DataQuality/DataQualityTools/DataQualityTools/DQTDetSynchMonAlg.h +++ b/DataQuality/DataQualityTools/DataQualityTools/DQTDetSynchMonAlg.h @@ -76,13 +76,13 @@ private: // storegate keys SG::ReadHandleKeyArray<InDetTimeCollection> m_InDetTimeCollectionKeys - { "TRT_BCID", "SCT_BCID", "PixelBCID", "TRT_LVL1ID", "SCT_LVL1ID", "PixelLVL1ID" } ; + { this, "InDetTimeCollectionKeys", {"TRT_BCID", "SCT_BCID", "PixelBCID", "TRT_LVL1ID", "SCT_LVL1ID", "PixelLVL1ID"} } ; SG::ReadHandleKey<LArFebHeaderContainer> m_LArFebHeaderContainerKey - { "LArFebHeader" }; + { this, "LArFebHeaderKey", "LArFebHeader" }; SG::ReadHandleKey<TileDigitsContainer> m_TileDigitsContainerKey - { "TileDigitsFlt" }; + { this, "TileDigitsContainerKey", "TileDigitsFlt" }; SG::ReadHandleKey<RpcPadContainer> m_RpcPadContainerKey - { "RPCPAD" }; + { this, "RpcPadContainerKey", "RPCPAD" }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; diff --git a/DataQuality/GoodRunsLists/python/OfficialGRLs.py b/DataQuality/GoodRunsLists/python/OfficialGRLs.py index 6278b1acc576a7a6ffd5e70dec6354a1e0b6b16c..ac55a4c9ee3f9123f69e2070bc239377ea6ac162 100644 --- a/DataQuality/GoodRunsLists/python/OfficialGRLs.py +++ b/DataQuality/GoodRunsLists/python/OfficialGRLs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## Official collection of GRL maintained and produced by DQ group. ## Last update: 2009-10-21, by Max Baak @@ -8,19 +8,18 @@ class OfficialGRLs: def __init__(self): - self.collection = [ - 'GoodRunsLists.jetetmiss_windet_900GeV', - 'GoodRunsLists.jetetmiss_woindet_900GeV', - 'GoodRunsLists.jetetmiss_woindet_2TeV', - 'GoodRunsLists.jetetmiss_jetmetok_woindet_2TeV', - 'GoodRunsLists.jetetmiss_jetmetok_woindet_900GeV', - 'GoodRunsLists.jetetmiss_jetmetok_windet_900GeV', - 'GoodRunsLists.minbias_2TeV', - 'GoodRunsLists.minbias_900GeV', - 'GoodRunsLists.minbias_solon_900GeV', - 'GoodRunsLists.minbias_solon_windet_900GeV', - 'GoodRunsLists.minbias_solon_2TeV', - 'GoodRunsLists.minbias_stable_900GeV', - 'GoodRunsLists.minbias_windet_900GeV', - ] - + self.collection = [ + 'GoodRunsLists.jetetmiss_windet_900GeV', + 'GoodRunsLists.jetetmiss_woindet_900GeV', + 'GoodRunsLists.jetetmiss_woindet_2TeV', + 'GoodRunsLists.jetetmiss_jetmetok_woindet_2TeV', + 'GoodRunsLists.jetetmiss_jetmetok_woindet_900GeV', + 'GoodRunsLists.jetetmiss_jetmetok_windet_900GeV', + 'GoodRunsLists.minbias_2TeV', + 'GoodRunsLists.minbias_900GeV', + 'GoodRunsLists.minbias_solon_900GeV', + 'GoodRunsLists.minbias_solon_windet_900GeV', + 'GoodRunsLists.minbias_solon_2TeV', + 'GoodRunsLists.minbias_stable_900GeV', + 'GoodRunsLists.minbias_windet_900GeV', + ] diff --git a/DataQuality/GoodRunsLists/python/WZcommon.py b/DataQuality/GoodRunsLists/python/WZcommon.py index afca1c56444f8108b9db0abfe124ebd1e9e93930..73df674a2769be17cbdc368b5713d68efb7f009a 100644 --- a/DataQuality/GoodRunsLists/python/WZcommon.py +++ b/DataQuality/GoodRunsLists/python/WZcommon.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -23,19 +23,19 @@ class WZcommon(GoodRunsListConfig): self.querydict['ptag'] = ["data10_7TeV"] ## See http://atlas-runquery.cern.ch for more user examples. - dqflagsquery = [ 'ATLGL LBSUMM#DetStatus-v03-repro04-01 g', - 'L1CTP LBSUMM#DetStatus-v03-repro04-01 g', - 'ATLSOL LBSUMM#DetStatus-v03-repro04-01 g', - 'ATLTOR LBSUMM#DetStatus-v03-repro04-01 g', - 'L1CAL LBSUMM#DetStatus-v03-repro04-01 g', - 'L1MUE LBSUMM#DetStatus-v03-repro04-01 g', - 'L1MUB LBSUMM#DetStatus-v03-repro04-01 g', - 'cp_eg_electron_endcap LBSUMM#DetStatus-v03-repro04-01 g', - 'cp_eg_electron_barrel LBSUMM#DetStatus-v03-repro04-01 g', - 'cp_mu_mmuidcb LBSUMM#DetStatus-v03-repro04-01 g', - 'cp_mu_mstaco LBSUMM#DetStatus-v03-repro04-01 g', - 'cp_met LBSUMM#DetStatus-v03-repro04-01 g', - ] + dqflagsquery = [ 'ATLGL LBSUMM#DetStatus-v03-repro04-01 g', + 'L1CTP LBSUMM#DetStatus-v03-repro04-01 g', + 'ATLSOL LBSUMM#DetStatus-v03-repro04-01 g', + 'ATLTOR LBSUMM#DetStatus-v03-repro04-01 g', + 'L1CAL LBSUMM#DetStatus-v03-repro04-01 g', + 'L1MUE LBSUMM#DetStatus-v03-repro04-01 g', + 'L1MUB LBSUMM#DetStatus-v03-repro04-01 g', + 'cp_eg_electron_endcap LBSUMM#DetStatus-v03-repro04-01 g', + 'cp_eg_electron_barrel LBSUMM#DetStatus-v03-repro04-01 g', + 'cp_mu_mmuidcb LBSUMM#DetStatus-v03-repro04-01 g', + 'cp_mu_mstaco LBSUMM#DetStatus-v03-repro04-01 g', + 'cp_met LBSUMM#DetStatus-v03-repro04-01 g', + ] ## Set the dqflags query self.querydict['dq'] = dqflagsquery diff --git a/DataQuality/GoodRunsLists/python/Zeechannel_fwd.py b/DataQuality/GoodRunsLists/python/Zeechannel_fwd.py index 2244feb7e743c9457c28418bb557390ca227bb5d..cd854e4ff35dbd3b8bbce533ad3bba8f5336845e 100644 --- a/DataQuality/GoodRunsLists/python/Zeechannel_fwd.py +++ b/DataQuality/GoodRunsLists/python/Zeechannel_fwd.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -29,7 +29,7 @@ class Zeechannel_fwd(GoodRunsListConfig): 'L1CAL LBSUMM#DetStatus-v03-repro04-01 g', 'cp_eg_electron_endcap LBSUMM#DetStatus-v03-repro04-01 g', 'cp_eg_electron_barrel LBSUMM#DetStatus-v03-repro04-01 g', - 'cp_eg_electron_forward LBSUMM#DetStatus-v03-repro04-01 g', + 'cp_eg_electron_forward LBSUMM#DetStatus-v03-repro04-01 g', ] ## Set the dqflags query diff --git a/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_windet_900GeV.py b/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_windet_900GeV.py index 15f2157b4f0fa1e3bf0e3b586bcc33e1283c74d2..8a2bbd80a4f545c5298a7ebc2834d94b5fd59362 100644 --- a/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_windet_900GeV.py +++ b/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_windet_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,10 +25,10 @@ class jetetmiss_jetmetok_windet_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', - 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', - 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', + 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', 'pix LBSUMM#DetStatusLBSUMM-December09-01 g', 'sct LBSUMM#DetStatusLBSUMM-December09-01 g', 'trtb,trte LBSUMM#DetStatusLBSUMM-December09-01 g', diff --git a/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_woindet_2TeV.py b/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_woindet_2TeV.py index 10f78672ac07771aea631eadbd7231fcbd9f3ff0..cc3c353f1eaa031d2047f377013fb5155cc7b38f 100644 --- a/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_woindet_2TeV.py +++ b/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_woindet_2TeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,10 +25,10 @@ class jetetmiss_jetmetok_woindet_2TeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', - 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', - 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', + 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', 'jetb LBSUMM#DetStatusLBSUMM-December09-01 g', 'jetea LBSUMM#DetStatusLBSUMM-December09-01 g', 'jetec LBSUMM#DetStatusLBSUMM-December09-01 g', diff --git a/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_woindet_900GeV.py b/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_woindet_900GeV.py index ffd15a92932b00f1ac5c4ddff2f43ee35f66dd82..877483642af2e93ebe8799e08b6362f2ecf63ebc 100644 --- a/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_woindet_900GeV.py +++ b/DataQuality/GoodRunsLists/python/jetetmiss_jetmetok_woindet_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,10 +25,10 @@ class jetetmiss_jetmetok_woindet_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', - 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', - 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', + 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', 'jetb LBSUMM#DetStatusLBSUMM-December09-01 g', 'jetea LBSUMM#DetStatusLBSUMM-December09-01 g', 'jetec LBSUMM#DetStatusLBSUMM-December09-01 g', diff --git a/DataQuality/GoodRunsLists/python/jetetmiss_windet_900GeV.py b/DataQuality/GoodRunsLists/python/jetetmiss_windet_900GeV.py index 3e8e666bf5e4454da4d6d881de0756e671a07635..aac2af112087403c11d8c491dbbca6310a09e039 100644 --- a/DataQuality/GoodRunsLists/python/jetetmiss_windet_900GeV.py +++ b/DataQuality/GoodRunsLists/python/jetetmiss_windet_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,10 +25,10 @@ class jetetmiss_windet_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', - 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', - 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', + 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', 'pix LBSUMM#DetStatusLBSUMM-December09-01 g', 'sct LBSUMM#DetStatusLBSUMM-December09-01 g', 'trtb,trte LBSUMM#DetStatusLBSUMM-December09-01 g', diff --git a/DataQuality/GoodRunsLists/python/jetetmiss_woindet_2TeV.py b/DataQuality/GoodRunsLists/python/jetetmiss_woindet_2TeV.py index 8f4792e7f24a44f00042dba05d0c0a15040e3fe3..d5dbd30fff0d15b36bad5ad509b1b14a8f41bd03 100644 --- a/DataQuality/GoodRunsLists/python/jetetmiss_woindet_2TeV.py +++ b/DataQuality/GoodRunsLists/python/jetetmiss_woindet_2TeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,10 +25,10 @@ class jetetmiss_woindet_2TeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', - 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', - 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', + 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', ##'jetb yellow+ ', ##'jetea yellow+ ', ##'jetec yellow+ ', diff --git a/DataQuality/GoodRunsLists/python/jetetmiss_woindet_900GeV.py b/DataQuality/GoodRunsLists/python/jetetmiss_woindet_900GeV.py index b589cef33b0f57856a3f482807b63baab65b2d08..5d0b6ffc7f882570086b5172980aafcb8c5261d1 100644 --- a/DataQuality/GoodRunsLists/python/jetetmiss_woindet_900GeV.py +++ b/DataQuality/GoodRunsLists/python/jetetmiss_woindet_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,10 +25,10 @@ class jetetmiss_woindet_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', - 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', - 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'lar LBSUMM#DetStatusLBSUMM-December09-01 g', + 'tile LBSUMM#DetStatusLBSUMM-December09-01 g', ##'jetb yellow+ ', ##'jetea yellow+ ', ##'jetec yellow+ ', diff --git a/DataQuality/GoodRunsLists/python/minbias_2TeV.py b/DataQuality/GoodRunsLists/python/minbias_2TeV.py index b289e5c06ecf0aee25682c807cb0accae7c4ade4..25981c3bc98fa5fe5c68d716bb8301a9a5f71ba7 100644 --- a/DataQuality/GoodRunsLists/python/minbias_2TeV.py +++ b/DataQuality/GoodRunsLists/python/minbias_2TeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,7 +25,7 @@ class minbias_2TeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', ] ## Set the dqflags query diff --git a/DataQuality/GoodRunsLists/python/minbias_900GeV.py b/DataQuality/GoodRunsLists/python/minbias_900GeV.py index 6703961cd41b3549a39d924470209cb27cc1182a..f856b180745fb760e7f268fbb07a710dde11e99e 100644 --- a/DataQuality/GoodRunsLists/python/minbias_900GeV.py +++ b/DataQuality/GoodRunsLists/python/minbias_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,7 +25,7 @@ class minbias_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', ] ## Set the dqflags query diff --git a/DataQuality/GoodRunsLists/python/minbias_solon_2TeV.py b/DataQuality/GoodRunsLists/python/minbias_solon_2TeV.py index fe81cf16d3c346f116138653a1b07d090c6ab3b4..6eb78f4f2408f78ef192888e591d3ea9558b96c3 100644 --- a/DataQuality/GoodRunsLists/python/minbias_solon_2TeV.py +++ b/DataQuality/GoodRunsLists/python/minbias_solon_2TeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,8 +25,8 @@ class minbias_solon_2TeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', ] ## Set the dqflags query diff --git a/DataQuality/GoodRunsLists/python/minbias_solon_900GeV.py b/DataQuality/GoodRunsLists/python/minbias_solon_900GeV.py index 5617306d2d99910f2c7d4fbf5ff2b5343e0b2805..69c116c50b7dc57dc9324b06c0257f8b4afa5de8 100644 --- a/DataQuality/GoodRunsLists/python/minbias_solon_900GeV.py +++ b/DataQuality/GoodRunsLists/python/minbias_solon_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,8 +25,8 @@ class minbias_solon_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', ] ## Set the dqflags query diff --git a/DataQuality/GoodRunsLists/python/minbias_solon_windet_900GeV.py b/DataQuality/GoodRunsLists/python/minbias_solon_windet_900GeV.py index 465432e55ac971886dbed6c7e8b1e4d33bb6acf3..f69f99669e622eadabc35f6e3642ad49f1a6978b 100644 --- a/DataQuality/GoodRunsLists/python/minbias_solon_windet_900GeV.py +++ b/DataQuality/GoodRunsLists/python/minbias_solon_windet_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,8 +25,8 @@ class minbias_solon_windet_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', - 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'atlsol LBSUMM#DetStatusLBSUMM-December09-01 g', 'pix LBSUMM#DetStatusLBSUMM-December09-01 g', 'sct LBSUMM#DetStatusLBSUMM-December09-01 g', 'trtb,trte LBSUMM#DetStatusLBSUMM-December09-01 g', diff --git a/DataQuality/GoodRunsLists/python/minbias_stable_900GeV.py b/DataQuality/GoodRunsLists/python/minbias_stable_900GeV.py index dd62a26b78554ec61ef36c495eb96df7e1e14443..c4da3c6c50f5922878724986a682b6b745d5f3e0 100644 --- a/DataQuality/GoodRunsLists/python/minbias_stable_900GeV.py +++ b/DataQuality/GoodRunsLists/python/minbias_stable_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,7 +25,7 @@ class minbias_stable_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', ] ## Set the dqflags query diff --git a/DataQuality/GoodRunsLists/python/minbias_windet_900GeV.py b/DataQuality/GoodRunsLists/python/minbias_windet_900GeV.py index a0b771fecaeec7c1a10e303de9374ab0ec4f8e17..fdaa270e874b3a6fa769fb3cc07bcef4393fc203 100644 --- a/DataQuality/GoodRunsLists/python/minbias_windet_900GeV.py +++ b/DataQuality/GoodRunsLists/python/minbias_windet_900GeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -25,7 +25,7 @@ class minbias_windet_900GeV(GoodRunsListConfig): self.querydict['st'] = ["physics_MinBias"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatusLBSUMM-December09-01 g', - 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', + 'L1CTP LBSUMM#DetStatusLBSUMM-December09-01 g', 'pix LBSUMM#DetStatusLBSUMM-December09-01 g', 'sct LBSUMM#DetStatusLBSUMM-December09-01 g', 'trtb,trte LBSUMM#DetStatusLBSUMM-December09-01 g', diff --git a/DataQuality/GoodRunsLists/python/muon_7TeV.py b/DataQuality/GoodRunsLists/python/muon_7TeV.py index ac665bacb1d24a344fa70d6ce0667b73c0142650..a34cc0f26f1f98b835639f0d6a728d0a705acebd 100644 --- a/DataQuality/GoodRunsLists/python/muon_7TeV.py +++ b/DataQuality/GoodRunsLists/python/muon_7TeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -30,10 +30,10 @@ class muon_7TeV(GoodRunsListConfig): 'pix SHIFTOFL#HEAD g', 'sct SHIFTOFL#HEAD g', 'trtb,trte SHIFTOFL#HEAD y+', - 'mdt SHIFTOFL#HEAD g', - 'rpc SHIFTOFL#HEAD g', - 'tgc SHIFTOFL#HEAD g', - 'csc SHIFTOFL#HEAD g', + 'mdt SHIFTOFL#HEAD g', + 'rpc SHIFTOFL#HEAD g', + 'tgc SHIFTOFL#HEAD g', + 'csc SHIFTOFL#HEAD g', ] ## Set the dqflags query diff --git a/DataQuality/GoodRunsLists/python/susy_7TeV.py b/DataQuality/GoodRunsLists/python/susy_7TeV.py index 3f85eb99ccd7fed767d7c09d512741503c282909..9a727c5123c7657ad0caef787f30f6f4c8fb6aed 100644 --- a/DataQuality/GoodRunsLists/python/susy_7TeV.py +++ b/DataQuality/GoodRunsLists/python/susy_7TeV.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from GoodRunsLists.GoodRunsListConfig import GoodRunsListConfig @@ -19,21 +19,21 @@ class susy_7TeV(GoodRunsListConfig): self.querydict['ptag'] = ["data10_7TeV"] dqflagsquery = [ 'ATLGL LBSUMM#DetStatus-v03-repro04-01 g', - 'L1CTP LBSUMM#DetStatus-v03-repro04-01 g', - 'CP_MU_MMUIDCB LBSUMM#DetStatus-v03-repro04-01 g', - 'cp_eg_electron_barrel LBSUMM#DetStatus-v03-repro04-01 g', - 'cp_eg_electron_endcap LBSUMM#DetStatus-v03-repro04-01 g', - #'cp_jet_jetb g', - #'cp_jet_jetea g', - #'cp_jet_jetec g', - #'cp_met_metcalo g', - #'cp_met_metmuon g', - #'trmet g', - #'trjet g', - #'trmuo g', - #'trele g', - 'bs LBSUMM#DetStatus-v03-repro04-01 g', - 'lumi LBSUMM#DetStatus-v03-repro04-01 g', + 'L1CTP LBSUMM#DetStatus-v03-repro04-01 g', + 'CP_MU_MMUIDCB LBSUMM#DetStatus-v03-repro04-01 g', + 'cp_eg_electron_barrel LBSUMM#DetStatus-v03-repro04-01 g', + 'cp_eg_electron_endcap LBSUMM#DetStatus-v03-repro04-01 g', + #'cp_jet_jetb g', + #'cp_jet_jetea g', + #'cp_jet_jetec g', + #'cp_met_metcalo g', + #'cp_met_metmuon g', + #'trmet g', + #'trjet g', + #'trmuo g', + #'trele g', + 'bs LBSUMM#DetStatus-v03-repro04-01 g', + 'lumi LBSUMM#DetStatus-v03-repro04-01 g', ] ## Set the dqflags query diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx index b6569d0ce9833a5094489c6fd321bc82c9371757..70b1404e77730d3e0f85e047c9516beed1e774a7 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx @@ -11,22 +11,20 @@ #include "GaudiKernel/ClassID.h" #include "GaudiKernel/FileIncident.h" -#include "GaudiKernel/IChronoStatSvc.h" + #include "GaudiKernel/IOpaqueAddress.h" #include "GaudiKernel/IJobOptionsSvc.h" #include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/AttribStringParser.h" -#include "AthenaKernel/IAthenaIPCTool.h" #include "AthenaKernel/IAthenaSerializeSvc.h" -#include "AthenaKernel/IClassIDSvc.h" #include "AthenaKernel/IAthenaOutputStreamTool.h" #include "AthenaKernel/IMetadataTransition.h" #include "PersistentDataModel/Placement.h" #include "PersistentDataModel/Token.h" #include "PersistentDataModel/TokenAddress.h" #include "PersistentDataModel/DataHeader.h" -#include "PoolSvc/IPoolSvc.h" + #include "StorageSvc/DbReflex.h" @@ -1140,34 +1138,9 @@ void AthenaPoolCnvSvc::handle(const Incident& incident) { } //______________________________________________________________________________ AthenaPoolCnvSvc::AthenaPoolCnvSvc(const std::string& name, ISvcLocator* pSvcLocator) : - ::AthCnvSvc(name, pSvcLocator, POOL_StorageType), - m_dbType(pool::ROOTTREEINDEX_StorageType), - m_lastInputFileName(), - m_poolSvc("PoolSvc", name), - m_chronoStatSvc("ChronoStatSvc", name), - m_clidSvc("ClassIDSvc", name), - m_serializeSvc("AthenaRootSerializeSvc", name), - m_inputStreamingTool("", this), - m_outputStreamingTool(this), - m_streamServer(0), - m_metadataClient(0), - m_domainMaxFileSize(15000000000LL), - m_doChronoStat(true) { - declareProperty("UseDetailChronoStat", m_useDetailChronoStat = false); - declareProperty("PoolContainerPrefix", m_containerPrefixProp = "ROOTTREEINDEX:CollectionTree"); - declareProperty("TopLevelContainerName", m_containerNameHintProp = ""); - declareProperty("SubLevelBranchName", m_branchNameHintProp = "<type>/<key>"); - declareProperty("PoolAttributes", m_poolAttr); - declareProperty("InputPoolAttributes", m_inputPoolAttr); - declareProperty("OutputPoolFileAllocator", m_streamClientFilesProp); - declareProperty("PrintInputAttrPerEvt", m_inputPoolAttrPerEvent); - declareProperty("MaxFileSizes", m_maxFileSizes); - declareProperty("PersSvcPerOutput", m_persSvcPerOutput = true); - declareProperty("SkipFirstChronoCommit", m_skipFirstChronoCommit = false); - declareProperty("InputStreamingTool", m_inputStreamingTool); + ::AthCnvSvc(name, pSvcLocator, POOL_StorageType) { declareProperty("OutputStreamingTool", m_outputStreamingTool); - declareProperty("OutputMetadataContainer", m_metadataContainerProp); -} + } //______________________________________________________________________________ AthenaPoolCnvSvc::~AthenaPoolCnvSvc() { } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h index ae898846295c06d0806079fcdabb2135ab0b1fee..291806cc2762bfb05097a275e060a4125b3455b2 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h @@ -17,17 +17,17 @@ #include "GaudiKernel/ToolHandle.h" #include "StorageSvc/DbType.h" #include "AthenaBaseComps/AthCnvSvc.h" +#include "AthenaKernel/IAthenaIPCTool.h" +#include "GaudiKernel/IChronoStatSvc.h" +#include "PoolSvc/IPoolSvc.h" +#include "AthenaKernel/IClassIDSvc.h" #include <vector> #include <map> #include <mutex> // Forward declarations -class IAthenaIPCTool; class IAthenaSerializeSvc; -class IChronoStatSvc; -class IClassIDSvc; -class IPoolSvc; class Guid; template <class TYPE> class SvcFactory; @@ -42,6 +42,7 @@ class ATLAS_CHECK_THREAD_SAFETY AthenaPoolCnvSvc : public ::AthCnvSvc, friend class SvcFactory<AthenaPoolCnvSvc>; public: + /// Required of all Gaudi Services StatusCode initialize(); /// Required of all Gaudi Services @@ -176,66 +177,68 @@ private: // member functions bool doClear = true) const; private: // data - pool::DbType m_dbType; + pool::DbType m_dbType{pool::ROOTTREEINDEX_StorageType}; std::string m_lastInputFileName; - ServiceHandle<IPoolSvc> m_poolSvc; - ServiceHandle<IChronoStatSvc> m_chronoStatSvc; - ServiceHandle<IClassIDSvc> m_clidSvc; - ServiceHandle<IAthenaSerializeSvc> m_serializeSvc; - ToolHandle<IAthenaIPCTool> m_inputStreamingTool; + ServiceHandle<IPoolSvc> m_poolSvc{this,"PoolSvc","PoolSvc"}; + ServiceHandle<IChronoStatSvc> m_chronoStatSvc{this,"ChronoStatSvc","ChronoStatSvc"}; + ServiceHandle<IClassIDSvc> m_clidSvc{this,"ClassIDSvc","ClassIDSvc"}; + ServiceHandle<IAthenaSerializeSvc> m_serializeSvc{this,"AthenaRootSerializeSvc","AthenaRootSerializeSvc"}; + ToolHandle<IAthenaIPCTool> m_inputStreamingTool{this,"InputStreamingTool"}; ToolHandleArray<IAthenaIPCTool> m_outputStreamingTool; - std::size_t m_streamServer; - int m_metadataClient; + //The following doesn't work because of Gaudi issue #122 + //ToolHandleArray<IAthenaIPCTool> m_outputStreamingTool{this,"OutputStreamingTool", {} }; + std::size_t m_streamServer=0; + int m_metadataClient=0; private: // properties /// UseDetailChronoStat, enable detailed output for time and size statistics for AthenaPOOL: /// default = false. - BooleanProperty m_useDetailChronoStat; + BooleanProperty m_useDetailChronoStat{this,"UseDetailChronoStat",false}; /// PoolContainerPrefix, prefix for top level POOL container: default = "POOLContainer" - StringProperty m_containerPrefixProp; + StringProperty m_containerPrefixProp{this,"PoolContainerPrefix","ROOTTREEINDEX:CollectionTree"}; /// TopLevelContainerName, naming hint policy for top level POOL container: default = "<type>" - StringProperty m_containerNameHintProp; + StringProperty m_containerNameHintProp{this,"TopLevelContainerName",""}; /// SubLevelBranchName, naming hint policy for POOL branching: default = "" (no branching) - StringProperty m_branchNameHintProp; + StringProperty m_branchNameHintProp{this,"SubLevelBranchName", "<type>/<key>"}; /// Output PoolAttributes, vector with names and values of technology specific attributes for POOL - StringArrayProperty m_poolAttr; + StringArrayProperty m_poolAttr{this,"PoolAttributes",{},"Pool Attributes","Set<std::string>"}; std::vector<std::vector<std::string> > m_domainAttr; std::vector<std::vector<std::string> > m_databaseAttr; std::vector<std::vector<std::string> > m_containerAttr; std::vector<unsigned int> m_contextAttr; /// Input PoolAttributes, vector with names and values of technology specific attributes for POOL - StringArrayProperty m_inputPoolAttr; + StringArrayProperty m_inputPoolAttr{this,"InputPoolAttributes",{}}; std::vector<std::vector<std::string> > m_inputAttr; /// Print input PoolAttributes per event, vector with names of technology specific attributes for POOL /// to be printed each event - StringArrayProperty m_inputPoolAttrPerEvent; + StringArrayProperty m_inputPoolAttrPerEvent{this,"PrintInputAttrPerEvt",{}}; std::vector<std::vector<std::string> > m_inputAttrPerEvent; /// Output FileNames to be associated with Stream Clients - StringArrayProperty m_streamClientFilesProp; + StringArrayProperty m_streamClientFilesProp{this,"OutputPoolFileAllocator",{}}; std::vector<std::string> m_streamClientFiles; /// MaxFileSizes, vector with maximum file sizes for Athena POOL output files - StringArrayProperty m_maxFileSizes; - long long m_domainMaxFileSize; + StringArrayProperty m_maxFileSizes{this,"MaxFileSizes",{}}; + long long m_domainMaxFileSize=15000000000LL; std::map<std::string, long long> m_databaseMaxFileSize; /// PersSvcPerOutput,boolean property to use multiple persistency services, one per output stream. /// default = false. - BooleanProperty m_persSvcPerOutput; + BooleanProperty m_persSvcPerOutput{this,"PersSvcPerOutput",true}; unsigned outputContextId(const std::string& outputConnection); std::mutex m_mutex; /// SkipFirstChronoCommit, boolean property to skip the first commit in the chrono stats so the first /// container being committed to disk is not 'tainted' with the POOL overhead - BooleanProperty m_skipFirstChronoCommit; + BooleanProperty m_skipFirstChronoCommit{this,"SkipFirstChronoCommit",false}; /// bool to activate the chrono stats, depending on the m_skipFirstChronoCommit data member - bool m_doChronoStat; + bool m_doChronoStat=true; /// For SharedWriter to use MetadataSvc to merge data placed in a certain container - StringProperty m_metadataContainerProp; + StringProperty m_metadataContainerProp{this,"OutputMetadataContainer",""}; }; #endif diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/CMakeLists.txt b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/CMakeLists.txt index 209ac59f2007fd933c65bf23bf4bd6250bfbd92c..9732a2e3d7e6cb1c324709d2c22c634da91cd508 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/CMakeLists.txt +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/CMakeLists.txt @@ -69,14 +69,14 @@ endfunction( _add_test ) # Write 'Hits', with multistreamand _add_test( AthenaPoolExample_Write "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_WriteJobOptions.py" - IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|DEBUG setAttribute" + IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|DEBUG setAttribute|metadataItemList" PRE_EXEC test/pre_check.sh ) # Read 'Hits' and write 'Tracks' _add_test( AthenaPoolExample_ReWrite "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_RWJobOptions.py" # DEPENDS AthenaPoolExampleAlgorithms_AthenaPoolExample_Append_ctest DEPENDS AthenaPoolExampleAlgorithms_AthenaPoolExample_Write_ctest - IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool" ) + IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|metadataItemList" ) # Read all output _add_test( AthenaPoolExample_Read "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_ReadJobOptions.py" @@ -86,16 +86,16 @@ _add_test( AthenaPoolExample_Read _add_test( AthenaPoolExample_Copy "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_CopyJobOptions.py" DEPENDS AthenaPoolExampleAlgorithms_AthenaPoolExample_Read_ctest - IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool" ) + IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|metadataItemList" ) # Read copied 'Hits' and write 'Tracks' _add_test( AthenaPoolExample_ReWriteAgain "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_ReWriteAgainJobOptions.py" DEPENDS AthenaPoolExampleAlgorithms_AthenaPoolExample_Copy_ctest - IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool" ) + IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|metadataItemList" ) _add_test( AthenaPoolExample_ReWriteNext "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_ReWriteNextJobOptions.py" DEPENDS AthenaPoolExampleAlgorithms_AthenaPoolExample_ReWriteAgain_ctest - IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool" ) + IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|metadataItemList" ) # Read all _add_test( AthenaPoolExample_ReadAgain "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_ReadAgainJobOptions.py" @@ -106,7 +106,7 @@ _add_test( AthenaPoolExample_ReadAgain _add_test( AthenaPoolExample_Concat "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_ConcatJobOptions.py" DEPENDS AthenaPoolExampleAlgorithms_AthenaPoolExample_ReadAgain_ctest - IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|DEBUG setAttribute" + IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|DEBUG setAttribute|metadataItemList" PRE_EXEC test/pre_check.sh ) _add_test( AthenaPoolExample_ReadConcat "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_ReadJobOptions.py" @@ -127,7 +127,7 @@ _add_test( AthenaPoolExample_RCond _add_test( AthenaPoolExample_WMeta "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_WMetaJobOptions.py" DEPENDS AthenaPoolExampleAlgorithms_AthenaPoolExample_RCond_ctest - IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool" + IGNORE "Warning in <TFile::Init>: no StreamerInfo found|BYTES_READ|READ_CALLS|DEBUG lookupPFN|DEBUG registered PFN|XMLCatalog +INFO|Found address:|DEBUG.*ThinningCacheTool|metadataItemList" PRE_EXEC test/pre_check.sh ) _add_test( AthenaPoolExample_RMeta "athena.py AthenaPoolExampleAlgorithms/AthenaPoolExample_RMetaJobOptions.py" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleConverter/CMakeLists.txt b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleConverter/CMakeLists.txt index 3b12264e08169d590ff0cd9024b840a1daabb5f5..2315a986e6df9b2bb388927a31f2a8c2dc9386a0 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleConverter/CMakeLists.txt +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleConverter/CMakeLists.txt @@ -28,7 +28,6 @@ atlas_add_library( AthenaPoolExampleConverter LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolExampleData AthenaPoolUtilities DataModelAthenaPoolLib AthenaPoolCnvSvcLib ) atlas_add_poolcnv_library( AthenaPoolExampleConverterPoolCnv - src/*.cxx FILES AthenaPoolExampleData/ExampleHitContainer.h AthenaPoolExampleData/ExampleTrackContainer.h INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolExampleData AthenaPoolUtilities AthenaPoolCnvSvcLib AthenaPoolExampleConverter ) diff --git a/Database/AthenaRoot/AthenaRootComps/CMakeLists.txt b/Database/AthenaRoot/AthenaRootComps/CMakeLists.txt index 870e79e6e4c40fea8fd99c8a9d638777b27ecda8..9108375ac40b7f4a4e95eda1ae49164cf6a359ab 100644 --- a/Database/AthenaRoot/AthenaRootComps/CMakeLists.txt +++ b/Database/AthenaRoot/AthenaRootComps/CMakeLists.txt @@ -37,7 +37,7 @@ atlas_add_component( AthenaRootComps src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} SGTools AthenaBaseComps AthenaKernel DataModelRoot RootUtils RootUtilsPyROOT StoreGateLib SGtests CollectionBase CollectionUtilities FileCatalog PersistencySvc AthenaRootKernel PersistentDataModel EventInfo GaudiKernel xAODRootAccess xAODEventInfo) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} SGTools AthenaBaseComps AthenaKernel DataModelRoot RootUtils RootUtilsPyROOT StoreGateLib SGtests CollectionBase CollectionUtilities FileCatalog PersistencySvc AthenaRootKernel PersistentDataModel EventInfo GaudiKernel xAODRootAccess xAODEventInfo PoolSvcLib ) # Install files from the package: atlas_install_headers( AthenaRootComps ) diff --git a/Database/RDBAccessSvc/CMakeLists.txt b/Database/RDBAccessSvc/CMakeLists.txt index 79aa169bedc368443526907062c7863b96fa9af2..f97d7b69c4e769af70e5d4416eaf4e7c37c50a96 100644 --- a/Database/RDBAccessSvc/CMakeLists.txt +++ b/Database/RDBAccessSvc/CMakeLists.txt @@ -42,7 +42,7 @@ atlas_add_executable( geomdb2sqlite atlas_add_executable( geomdb2oracle replicator/geomdb2oracle.cpp INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} RDBAccessSvcLib ) + LINK_LIBRARIES ${CORAL_LIBRARIES} RDBAccessSvcLib CxxUtils ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py index 29c474c9096773be1174e9f18f919daa9ba54914..c782c67db42f6a6a8e000dd480b186a16223f70d 100644 --- a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py +++ b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py @@ -327,8 +327,6 @@ if (vp1InputFiles != []): InDetFlags.doPRDFormation = False InDetFlags.doSpacePointFormation = vp1SpacePoints InDetFlags.doNewTracking = False - InDetFlags.doiPatRec = False - InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doLowBetaFinder = False InDetFlags.doBackTracking = False diff --git a/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt index c474b2c6dfd54e7da02862920cf9dc4576accf71..808246c5476f4c7c5711e7a72b303f25049408e9 100644 --- a/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt @@ -32,7 +32,7 @@ atlas_add_component( GeoModelSvc src/RDBMaterialManager.cxx src/components/GeoModelSvc_entries.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests GeoModelUtilities EventInfo GaudiKernel ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests GeoModelUtilities EventInfo GaudiKernel RDBAccessSvcLib EventInfoMgtLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/DetectorDescription/Identifier/Identifier/IdentifierHash.h b/DetectorDescription/Identifier/Identifier/IdentifierHash.h index a44e4e1a417f7431107577172038e46c25cb3c3c..22086b42f6603a64d611a5160326eee63fc48e39 100644 --- a/DetectorDescription/Identifier/Identifier/IdentifierHash.h +++ b/DetectorDescription/Identifier/Identifier/IdentifierHash.h @@ -181,4 +181,19 @@ inline std::ostream& operator << (std::ostream& os, const IdentifierHash& id) return os; } + +// Define a hash functional + +namespace std { +template<> +struct hash<IdentifierHash> +{ + size_t operator()(const IdentifierHash& id) const + { + return static_cast<size_t>(id.value()); + } +}; +} + + #endif // IDENTIFIER_IDENTIFIERHASH_H diff --git a/Event/DumpEventDataToJSON/CMakeLists.txt b/Event/DumpEventDataToJSON/CMakeLists.txt index 98e98ecd88f75e3f41925c1b9e3f18e61b7ec1ae..d83400d14a2cab31b93c9c9d39f67b68ab903aab 100644 --- a/Event/DumpEventDataToJSON/CMakeLists.txt +++ b/Event/DumpEventDataToJSON/CMakeLists.txt @@ -31,8 +31,4 @@ atlas_add_component( DumpEventDataToJSON # Install files from the package: atlas_install_joboptions( share/*.py ) -atlas_install_python_modules( python/*.py ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Event/EventBookkeeperTools/python/CutFlowHelpers.py b/Event/EventBookkeeperTools/python/CutFlowHelpers.py index f0ef0c2fe20e568c3b948c79ae73ad35e503a3b0..6e246a6e802f1437a678894dfd233cbb95504d25 100644 --- a/Event/EventBookkeeperTools/python/CutFlowHelpers.py +++ b/Event/EventBookkeeperTools/python/CutFlowHelpers.py @@ -15,6 +15,7 @@ def GetCurrentStreamName( msg ): msg.info("Couldn't get input stream name from the RecFlags... trying AthFile directly.") from PyUtils.MetaReader import read_metadata + from AthenaCommon.AppMgr import ServiceMgr as svcMgr input_file = svcMgr.EventSelector.InputCollections[0] metadata = read_metadata(input_file) metadata = metadata[input_file] # promote all keys one level up @@ -24,7 +25,7 @@ def GetCurrentStreamName( msg ): return class_name return 'unknownStream' -def CreateCutFlowSvc( svcName="CutFlowSvc", seq=None, addAlgInPlace=False, addMetaDataToAllOutputFiles=True, SGkey="CutBookkeepers" ): +def CreateCutFlowSvc( svcName="CutFlowSvc", seq=None, addMetaDataToAllOutputFiles=True ): """ Helper to create the CutFlowSvc, extract the needed information from the input file, and also schedule all the needed stuff. @@ -40,12 +41,10 @@ def CreateCutFlowSvc( svcName="CutFlowSvc", seq=None, addAlgInPlace=False, addMe inputStreamName = GetCurrentStreamName( msg=msg ) msg.debug("CreateCutFlowSvc: Have inputStreamName = %s" % (inputStreamName) ) - # Create the CutFlowSvc instance(s) + # Create the CutFlowSvc instance import AthenaCommon.CfgMgr as CfgMgr if not hasattr(svcMgr,"CutFlowSvc"): svcMgr += CfgMgr.CutFlowSvc() svcMgr.CutFlowSvc.InputStream = inputStreamName - #if not hasattr(svcMgr,"FileCutFlowSvc"): svcMgr += CfgMgr.FileCutFlowSvc() - #svcMgr.FileCutFlowSvc.InputStream = inputStreamName # Make sure MetaDataSvc is ready if not hasattr(svcMgr,'MetaDataSvc'): @@ -56,32 +55,15 @@ def CreateCutFlowSvc( svcName="CutFlowSvc", seq=None, addAlgInPlace=False, addMe from EventBookkeeperTools.EventBookkeeperToolsConf import BookkeeperTool # Standard event bookkeepers - inname = "CutBookkeepers" - outname = "CutBookkeepers" - cutflowtool = BookkeeperTool(outname+"Tool", - InputCollName = inname, - OutputCollName= outname) + primary_name = "CutBookkeepers" + cutflowtool = BookkeeperTool(primary_name + "Tool", + InputCollName = primary_name, + OutputCollName= primary_name) svcMgr.ToolSvc += cutflowtool # Add tool to MetaDataSvc svcMgr.MetaDataSvc.MetaDataTools += [cutflowtool] - # Add pdf sum of weights counts if appropriate - from AthenaCommon.GlobalFlags import globalflags - if globalflags.DataSource() == 'geant4': - #from PyUtils import AthFile - #afc = AthFile.fopen( svcMgr.EventSelector.InputCollections[0] ) - - # PDF - name = "PDFSumOfWeights" - pdfweighttool = BookkeeperTool(name, - OutputCollName= name, - InputCollName = name) - svcMgr.ToolSvc += pdfweighttool - - # Add tool to MetaDataSvc - svcMgr.MetaDataSvc.MetaDataTools += [pdfweighttool] - # Check if we have a sequence given if not seq : # Fetch the AthAlgSeq, i.e., one of the existing master sequences where one should attach all algorithms @@ -91,22 +73,16 @@ def CreateCutFlowSvc( svcName="CutFlowSvc", seq=None, addAlgInPlace=False, addMe # First of all, schedule EventCounterAlg if not hasattr(seq,"AllExecutedEvents"): if not seq.isLocked(): - if addAlgInPlace: - msg.debug("Adding EventCounterAlg with name AllExecutedEvents to sequence with name %s" % seq.getName()) - seq += CfgMgr.EventCounterAlg("AllExecutedEvents") - pass - else: - # Need to schedule it after the xAODMaker::EventInfoCnvAlg such that xAOD::EventInfo is present - index = 0 - if hasattr( seq, "xAODMaker::EventInfoCnvAlg" ): - for alg in seq: - index += 1 - if alg.getName() == "xAODMaker::EventInfoCnvAlg": break - pass + # Need to schedule it after the xAODMaker::EventInfoCnvAlg such that xAOD::EventInfo is present + index = 0 + if hasattr( seq, "xAODMaker::EventInfoCnvAlg" ): + for alg in seq: + index += 1 + if alg.getName() == "xAODMaker::EventInfoCnvAlg": break pass - msg.debug("Adding EventCounterAlg with name AllExecutedEvents to sequence with name %s at position %i" % (seq.getName(),index)) - seq.insert( index, CfgMgr.EventCounterAlg("AllExecutedEvents") ) pass + msg.debug("Adding EventCounterAlg with name AllExecutedEvents to sequence with name %s at position %i" % (seq.getName(),index)) + seq.insert( index, CfgMgr.EventCounterAlg("AllExecutedEvents") ) pass else : msg.info("Could NOT add EventCounterAlg with name AllExecutedEvents to locked sequence with name %s" % seq.getName()) @@ -119,15 +95,10 @@ def CreateCutFlowSvc( svcName="CutFlowSvc", seq=None, addAlgInPlace=False, addMe from OutputStreamAthenaPool.MultipleStreamManager import MSMgr # Explicitely add file metadata from input and from transient store, # but only the ones that we always create. - MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#"+SGkey ) - MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#"+SGkey+"Aux.*" ) - MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#Incomplete"+SGkey ) - MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#Incomplete"+SGkey+"Aux.*" ) - SGkey = "FileBookkeepers" - MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#"+SGkey ) - MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#"+SGkey+"Aux.*" ) - MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#Incomplete"+SGkey ) - MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#Incomplete"+SGkey+"Aux.*" ) + MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#"+primary_name ) + MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#"+primary_name+"Aux.*" ) + MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#Incomplete"+primary_name ) + MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#Incomplete"+primary_name+"Aux.*" ) pass return diff --git a/Event/EventBookkeeperTools/src/CutFlowSvc.cxx b/Event/EventBookkeeperTools/src/CutFlowSvc.cxx index ed028ec3d97e2f78f72be8e4e952449b0ff1fe3d..5d765b2c6a0b37a064c88dec0a929f5ee29b57c3 100644 --- a/Event/EventBookkeeperTools/src/CutFlowSvc.cxx +++ b/Event/EventBookkeeperTools/src/CutFlowSvc.cxx @@ -127,13 +127,13 @@ CutFlowSvc::setFilterDescription( CutIdentifier cutID, void CutFlowSvc::addEvent( CutIdentifier cutID, double weight) { - ATH_MSG_INFO("Adding event with weight "<< weight << "to cut " << cutID); + ATH_MSG_VERBOSE("Adding event with weight "<< weight << "to cut " << cutID); std::lock_guard<std::recursive_mutex> lock(m_addEventMutex); xAOD::CutBookkeeper* cbk = getCutBookkeeper(cutID); if (cbk == nullptr) { - ATH_MSG_INFO("Could not find CutBookkeeper, creating a new one"); + ATH_MSG_DEBUG("Could not find CutBookkeeper, creating a new one"); // Iterate over the complete bookkeepers and update the cutID-to-bookkeeper map ATH_MSG_DEBUG( "addEvent: Going to re-populate the map. Have " diff --git a/Event/EventBookkeeperTools/src/CutFlowSvc.h b/Event/EventBookkeeperTools/src/CutFlowSvc.h index 7849212a9331ee789638f40bbe89218cd24f3c7d..538f0c79964f3ed62a3c8a7200b37e21fd5b421c 100644 --- a/Event/EventBookkeeperTools/src/CutFlowSvc.h +++ b/Event/EventBookkeeperTools/src/CutFlowSvc.h @@ -20,7 +20,6 @@ #include <mutex> #include <string> #include <unordered_map> -#include <vector> // FrameWork includes #include "GaudiKernel/ISvcLocator.h" diff --git a/Event/EventBookkeeperTools/src/EventCounterAlg.cxx b/Event/EventBookkeeperTools/src/EventCounterAlg.cxx index 6968d07074ab13623aa486bbb334806a276d120e..8dc1d40a930cd9c95847332631008b53d5aff5fa 100644 --- a/Event/EventBookkeeperTools/src/EventCounterAlg.cxx +++ b/Event/EventBookkeeperTools/src/EventCounterAlg.cxx @@ -41,7 +41,7 @@ EventCounterAlg::EventCounterAlg( const std::string& name, // // Property declaration // - declareProperty( "BookkeepOtherMCEventWeights", m_trackOtherMCWeights=false, + declareProperty( "BookkeepOtherMCEventWeights", m_trackOtherMCWeights=true, "If true, the non-nominal MC event weights will be bookkept as well" ); } diff --git a/Event/xAOD/xAODCore/CMakeLists.txt b/Event/xAOD/xAODCore/CMakeLists.txt index b33c2003d626d1213999342d63531898d997470c..33da3a97c20e228eb8d4a947ed3d6e96bd4de726 100644 --- a/Event/xAOD/xAODCore/CMakeLists.txt +++ b/Event/xAOD/xAODCore/CMakeLists.txt @@ -75,11 +75,11 @@ atlas_add_test( ut_xaodcore_safedeepcopy_test atlas_add_test( ut_xaodcore_auxcontainerbase_test SOURCES test/ut_xaodcore_auxcontainerbase_test.cxx - LINK_LIBRARIES AthContainers xAODCore ) + LINK_LIBRARIES AthContainers xAODCore TestTools ) atlas_add_test( ut_xaodcore_auxinfobase_test SOURCES test/ut_xaodcore_auxinfobase_test.cxx - LINK_LIBRARIES AthContainers xAODCore ) + LINK_LIBRARIES AthContainers xAODCore TestTools ) atlas_add_test( ut_xaodcore_shallowcopy_test SOURCES test/ut_xaodcore_shallowcopy.cxx diff --git a/Event/xAOD/xAODEventInfo/CMakeLists.txt b/Event/xAOD/xAODEventInfo/CMakeLists.txt index fec4b88e6f3a3184d2d14f012d9a8a92c56331c3..8d096f0b68e16c1314c01041f37209b63f8e7980 100644 --- a/Event/xAOD/xAODEventInfo/CMakeLists.txt +++ b/Event/xAOD/xAODEventInfo/CMakeLists.txt @@ -47,11 +47,11 @@ atlas_add_test( ut_xaodeventinfo_subevent_test atlas_add_test( ut_xaodeventinfo_eventauxinfo_test SOURCES test/ut_xaodeventinfo_eventauxinfo_test.cxx - LINK_LIBRARIES AthLinks xAODCore xAODEventInfo ) + LINK_LIBRARIES AthLinks xAODCore xAODEventInfo TestTools ) atlas_add_test( ut_xaodeventinfo_eventinfoauxcontainer_v1_test SOURCES test/ut_xaodeventinfo_eventinfoauxcontainer_v1_test.cxx - LINK_LIBRARIES AthLinks xAODCore xAODEventInfo ) + LINK_LIBRARIES AthLinks xAODCore xAODEventInfo TestTools ) atlas_add_test( ut_xaodeventinfo_eventinfo_v1_test SOURCES test/ut_xaodeventinfo_eventinfo_v1_test.cxx diff --git a/Event/xAOD/xAODTruth/CMakeLists.txt b/Event/xAOD/xAODTruth/CMakeLists.txt index b469ec6f34d1661347e4f186379aef0880760a0c..f7804228e3abbcaa96e09f76c36b70b78bd2dc1d 100644 --- a/Event/xAOD/xAODTruth/CMakeLists.txt +++ b/Event/xAOD/xAODTruth/CMakeLists.txt @@ -32,9 +32,16 @@ atlas_add_dictionary( xAODTruthDict LINK_LIBRARIES xAODTruth EXTRA_FILES Root/dict/*.cxx ) + + atlas_generate_cliddb( xAODTruth ) # Test(s) in the package: atlas_add_test( ut_xaodtruth_particle_test SOURCES test/ut_xaodtruth_particle_test.cxx LINK_LIBRARIES xAODTruth ) + +if( XAOD_STANDALONE ) + atlas_add_test( ut_xaodtruth_helpers_test + SCRIPT test/ut_xaodtruth_helpers_test.py ) +endif() diff --git a/Event/xAOD/xAODTruth/Root/TruthMetaDataAuxContainer_v1.cxx b/Event/xAOD/xAODTruth/Root/TruthMetaDataAuxContainer_v1.cxx index 0d1d7a578c1cdbc2ffe0198a42335214d8f9ca6b..08c1142719a6191f74d43ec831e7a7b8b27932bb 100644 --- a/Event/xAOD/xAODTruth/Root/TruthMetaDataAuxContainer_v1.cxx +++ b/Event/xAOD/xAODTruth/Root/TruthMetaDataAuxContainer_v1.cxx @@ -14,6 +14,12 @@ namespace xAOD { AUX_VARIABLE( weightNames ); AUX_VARIABLE( mcChannelNumber ); + AUX_VARIABLE( lhefGenerator ); + AUX_VARIABLE( generators ); + AUX_VARIABLE( evgenProcess ); + AUX_VARIABLE( evgenTune ); + AUX_VARIABLE( hardPDF ); + AUX_VARIABLE( softPDF ); } } // namespace xAOD diff --git a/Event/xAOD/xAODTruth/Root/TruthMetaData_v1.cxx b/Event/xAOD/xAODTruth/Root/TruthMetaData_v1.cxx index 3897c03340dc27adc67ae60ac6b05b922bd51a7f..2cbdbacad3aaf9a1c0daa196975c5616fa61df11 100644 --- a/Event/xAOD/xAODTruth/Root/TruthMetaData_v1.cxx +++ b/Event/xAOD/xAODTruth/Root/TruthMetaData_v1.cxx @@ -17,5 +17,11 @@ namespace xAOD { //Arguments for MACRO are as follows: AUXSTORE_OBJECT/PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER) AUXSTORE_OBJECT_SETTER_AND_GETTER(TruthMetaData_v1, std::vector < std::string >, weightNames, setWeightNames ) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(TruthMetaData_v1, uint32_t, mcChannelNumber, setMcChannelNumber ) + AUXSTORE_OBJECT_SETTER_AND_GETTER(TruthMetaData_v1, std::string, lhefGenerator, setLhefGenerator ) + AUXSTORE_OBJECT_SETTER_AND_GETTER(TruthMetaData_v1, std::string, generators, setGenerators ) + AUXSTORE_OBJECT_SETTER_AND_GETTER(TruthMetaData_v1, std::string, evgenProcess, setEvgenProcess ) + AUXSTORE_OBJECT_SETTER_AND_GETTER(TruthMetaData_v1, std::string, evgenTune, setEvgenTune ) + AUXSTORE_OBJECT_SETTER_AND_GETTER(TruthMetaData_v1, std::string, hardPDF, setHardPDF ) + AUXSTORE_OBJECT_SETTER_AND_GETTER(TruthMetaData_v1, std::string, softPDF, setSoftPDF ) } // diff --git a/Event/xAOD/xAODTruth/Root/TruthParticle_v1.cxx b/Event/xAOD/xAODTruth/Root/TruthParticle_v1.cxx index d3c2c1f30c67a6d1406bce46feb7108e4ba930aa..cd80998bcd5d105aa56fa1ffdb7283c28f37a1f4 100644 --- a/Event/xAOD/xAODTruth/Root/TruthParticle_v1.cxx +++ b/Event/xAOD/xAODTruth/Root/TruthParticle_v1.cxx @@ -17,6 +17,9 @@ // xAOD include(s): #include "xAODCore/AuxStoreAccessorMacros.h" +// Accessor include: +#include "AthContainers/AuxElement.h" + // Local include(s): #include "xAODTruth/versions/TruthParticle_v1.h" #include "xAODTruth/TruthVertexContainer.h" @@ -57,15 +60,15 @@ namespace xAOD { /// Accessor for the production vertex static const SG::AuxElement::Accessor< ElementLink< TruthVertexContainer > > - prodVtxLinkAcc( "prodVtxLink" ); + acc_prodVtxLink( "prodVtxLink" ); /// Accessor for the decay vertex static const SG::AuxElement::Accessor< ElementLink< TruthVertexContainer > > - decayVtxLinkAcc( "decayVtxLink" ); + acc_decayVtxLink( "decayVtxLink" ); bool TruthParticle_v1::hasProdVtx() const { - return ( prodVtxLinkAcc.isAvailable( *this ) && - prodVtxLinkAcc( *this ).isValid() ); + return ( acc_prodVtxLink.isAvailable( *this ) && + acc_prodVtxLink( *this ).isValid() ); } const TruthVertex* TruthParticle_v1::prodVtx() const { @@ -79,8 +82,8 @@ namespace xAOD { bool TruthParticle_v1::hasDecayVtx() const { - return ( decayVtxLinkAcc.isAvailable( *this ) && - decayVtxLinkAcc( *this ).isValid() ); + return ( acc_decayVtxLink.isAvailable( *this ) && + acc_decayVtxLink( *this ).isValid() ); } const TruthVertex* TruthParticle_v1::decayVtx() const { @@ -100,24 +103,50 @@ namespace xAOD { // Direct access to parents and children // - size_t TruthParticle_v1::nParents() const { + // Accessor for links to parents + static const SG::AuxElement::ConstAccessor< std::vector<ElementLink<xAOD::TruthParticleContainer> > > + acc_parentLinks( "parentLinks" ); + // Accessor for links to children + static const SG::AuxElement::ConstAccessor< std::vector<ElementLink<xAOD::TruthParticleContainer> > > + acc_childLinks( "childLinks" ); + // Note that in some conditions the vertex might be saved in a different collection from + // the daughters, causing the vertex to not know how many children or parents the particle has. + // An extra test lets us ensure that we avoid this case. - return hasProdVtx() ? prodVtx()->nIncomingParticles() : 0; + size_t TruthParticle_v1::nParents() const { + if (hasProdVtx() && prodVtx()->nIncomingParticles()>0){ + return prodVtx()->nIncomingParticles(); + } else if ( acc_parentLinks.isAvailable( *this ) ) { + return acc_parentLinks( *this ).size(); + } + return 0; } const TruthParticle_v1* TruthParticle_v1::parent( size_t i ) const { - - return hasProdVtx() ? prodVtx()->incomingParticle( i ) : 0; + if (hasProdVtx() && prodVtx()->nIncomingParticles()>0){ + return prodVtx()->incomingParticle( i ); + } else if ( acc_parentLinks.isAvailable( *this ) && i<acc_parentLinks( *this ).size() ) { + return acc_parentLinks( *this )[i].isValid() ? *(acc_parentLinks( *this )[i]) : nullptr; + } + return nullptr; } size_t TruthParticle_v1::nChildren() const { - - return hasDecayVtx() ? decayVtx()->nOutgoingParticles() : 0; + if (hasDecayVtx() && decayVtx()->nOutgoingParticles()>0){ + return decayVtx()->nOutgoingParticles(); + } else if ( acc_childLinks.isAvailable( *this ) ) { + return acc_childLinks( *this ).size(); + } + return 0; } const TruthParticle_v1* TruthParticle_v1::child( size_t i ) const { - - return hasDecayVtx() ? decayVtx()->outgoingParticle( i ) : 0; + if (hasDecayVtx() && decayVtx()->nOutgoingParticles()>0){ + return decayVtx()->outgoingParticle( i ); + } else if ( acc_childLinks.isAvailable( *this ) && i<acc_childLinks( *this ).size() ) { + return acc_childLinks( *this )[i].isValid() ? *(acc_childLinks( *this )[i]) : nullptr; + } + return nullptr; } // @@ -273,6 +302,7 @@ namespace xAOD { MC_PID_HELPER( bool, isHiggs ) MC_PID_HELPER( bool, isResonance ) MC_PID_HELPER( bool, isGenSpecific ) + MC_PID_HELPER( bool, isBSM ) // Forget about this macro: #undef MC_PID_HELPER @@ -326,7 +356,7 @@ namespace xAOD { return true; } - float TruthParticle_v1::polarizationPatameter( PolParam param ) const { + float TruthParticle_v1::polarizationParameter( PolParam param ) const { // Get the accessor object: const Accessor< float >* acc = polarizationAccessorV1( param ); @@ -355,11 +385,11 @@ namespace xAOD { void TruthParticle_v1::toPersistent() { - if( prodVtxLinkAcc.isAvailableWritable( *this ) ) { - prodVtxLinkAcc( *this ).toPersistent(); + if( acc_prodVtxLink.isAvailableWritable( *this ) ) { + acc_prodVtxLink( *this ).toPersistent(); } - if( decayVtxLinkAcc.isAvailableWritable( *this ) ) { - decayVtxLinkAcc( *this ).toPersistent(); + if( acc_decayVtxLink.isAvailableWritable( *this ) ) { + acc_decayVtxLink( *this ).toPersistent(); } return; } diff --git a/Event/xAOD/xAODTruth/Root/xAODTruthCLIDs.cxx b/Event/xAOD/xAODTruth/Root/xAODTruthCLIDs.cxx index 491a18cd3d169a9884a69cf7adb802278886dab4..9f7e425c4bccbd2b893f5db219917c4fa013edff 100644 --- a/Event/xAOD/xAODTruth/Root/xAODTruthCLIDs.cxx +++ b/Event/xAOD/xAODTruth/Root/xAODTruthCLIDs.cxx @@ -14,4 +14,6 @@ #include "xAODTruth/TruthPileupEventContainer.h" #include "xAODTruth/TruthPileupEventAuxContainer.h" #include "xAODTruth/TruthEventBaseContainer.h" +#include "xAODTruth/TruthMetaDataContainer.h" +#include "xAODTruth/TruthMetaDataAuxContainer.h" diff --git a/Event/xAOD/xAODTruth/test/ut_xaodtruth_helpers_test.py b/Event/xAOD/xAODTruth/test/ut_xaodtruth_helpers_test.py index 4147126363f0779555b4663a4acca857d0c98252..327f904731e1339e1a257fe7924d7f702e374650 100755 --- a/Event/xAOD/xAODTruth/test/ut_xaodtruth_helpers_test.py +++ b/Event/xAOD/xAODTruth/test/ut_xaodtruth_helpers_test.py @@ -2,8 +2,6 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # -# $Id: ut_xaodtruth_helpers_test.py 761304 2016-07-12 12:03:36Z krasznaa $ -# # This is a simple unit test for checking the health of the truth helper # functions in the standalone analysis environment. # @@ -13,11 +11,13 @@ def main(): # Initialise the environment: import ROOT - ROOT.gROOT.Macro( "$ROOTCOREDIR/scripts/load_packages.C" ) + if not ROOT.xAOD.Init().isSuccess(): + print( "Couldn't initialise the xAOD reading environment" ) + return 1 # Open an input xAOD file: import os - FNAME = os.getenv( "ROOTCORE_TEST_FILE", "FileNotSpecifiedInEnvironment" ) + FNAME = os.getenv( "ASG_TEST_FILE_MC", "FileNotSpecifiedInEnvironment" ) f = ROOT.TFile.Open( FNAME, "READ" ) if not f: print( "Couldn't open \"%s\"" % FNAME ) @@ -25,7 +25,7 @@ def main(): print( "Opened: %s" % FNAME ) # Make a transient tree from it: - treeMgr = ROOT.xAOD.TTreeMgr( ROOT.xAOD.TEvent.kAthenaAccess ) + treeMgr = ROOT.xAOD.TTreeMgr() if not treeMgr.readFrom( f ).isSuccess(): print( "Couldn't make a transient tree from the input file!" ) return 1 diff --git a/Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainerFwd.h b/Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainerFwd.h index 95f85d743c19fbaa873dcddcb653cba0c924b41f..7d1fa5bc8c99c97831a02be036ec09557b99cfd3 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainerFwd.h +++ b/Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainerFwd.h @@ -4,7 +4,6 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -// $Id: TruthParticleContainerFwd.h 574253 2013-12-06 15:21:49Z krasznaa $ #ifndef XAODTRUTH_TRUTHPARTICLECONTAINERFWD_H #define XAODTRUTH_TRUTHPARTICLECONTAINERFWD_H @@ -16,7 +15,7 @@ #include "xAODTruth/TruthParticleFwd.h" // Declare that this is a vector of IParticle-derived objects -DATAVECTOR_BASE( xAOD::TruthParticle, xAOD::IParticle ); +DATAVECTOR_BASE_FWD( xAOD::TruthParticle, xAOD::IParticle ); namespace xAOD { /// Provide a forward declaration for TruthParticleContainer diff --git a/Event/xAOD/xAODTruth/xAODTruth/selection.xml b/Event/xAOD/xAODTruth/xAODTruth/selection.xml index 25517183cd939d67197995db6e02cbb2bf6b7d1d..e051ef8fb0f866f65462af97a4e1f519411a35bf 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/selection.xml +++ b/Event/xAOD/xAODTruth/xAODTruth/selection.xml @@ -1,6 +1,22 @@ <!-- $Id: selection.xml 670153 2015-05-27 11:42:29Z tbisanz $ --> <lcgdict> + <typedef name="xAOD::TruthParticle" /> + <typedef name="xAOD::TruthVertex" /> + <typedef name="xAOD::TruthEvent" /> + + <typedef name="xAOD::TruthParticleContainer" /> + <typedef name="xAOD::TruthVertexContainer" /> + <typedef name="xAOD::TruthEventContainer" /> + + <typedef name="xAOD::TruthParticleAuxContainer" /> + <typedef name="xAOD::TruthVertexAuxContainer" /> + <typedef name="xAOD::TruthEventAuxContainer" /> + + <typedef name="xAOD::TruthMetaData" /> + <typedef name="xAOD::TruthMetaDataContainer" /> + + <!-- The TruthParticle_v1 class(es): --> <class name="xAOD::TruthParticle_v1" /> <class name="xAOD::TruthParticle_v1::Polarization" /> diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthEventContainer_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthEventContainer_v1.h index a0f62c9b12d39e954d5c5278f284d8f616772094..17ac7d6994602d1c9bf1a41748b9ca9855d31191 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthEventContainer_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthEventContainer_v1.h @@ -1,10 +1,9 @@ // -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -// $Id: TruthEventContainer_v1.h 622193 2014-10-16 16:08:34Z krasznaa $ #ifndef XAODTRUTH_VERSIONS_TRUTHEVENTCONTAINER_V1_H #define XAODTRUTH_VERSIONS_TRUTHEVENTCONTAINER_V1_H @@ -14,9 +13,6 @@ // Local include(s): #include "xAODTruth/versions/TruthEvent_v1.h" -// Declare the base class of TruthEvent_v1 for DataVector -DATAVECTOR_BASE( xAOD::TruthEvent_v1, xAOD::TruthEventBase_v1 ); - namespace xAOD { /// Alias typedef DataVector< TruthEvent_v1 > TruthEventContainer_v1; diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthEvent_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthEvent_v1.h index 5363f63227e5e5de2d7774f92ed11a6e47979c85..3afcf7aeaba31f168edf0f6565170a764f594abd 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthEvent_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthEvent_v1.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ // $Id: TruthEvent_v1.h 761796 2016-07-14 08:06:02Z krasznaa $ @@ -210,4 +210,8 @@ namespace xAOD { #include "xAODCore/BaseInfo.h" SG_BASE( xAOD::TruthEvent_v1, xAOD::TruthEventBase_v1 ); +#include "AthContainers/DataVector.h" +DATAVECTOR_BASE( xAOD::TruthEvent_v1, xAOD::TruthEventBase_v1 ); + + #endif // XAODTRUTH_VERSIONS_TRUTHEVENT_V1_H diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthMetaDataAuxContainer_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthMetaDataAuxContainer_v1.h index aec914664b52160c49992d4b0ad2ddc5a3d8dce6..8ba72062a2c31b653c76cc5632ce79342b572209 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthMetaDataAuxContainer_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthMetaDataAuxContainer_v1.h @@ -39,6 +39,14 @@ namespace xAOD { std::vector < std::vector < std::string > > weightNames; std::vector < uint32_t > mcChannelNumber; + // Provide access to the other key generator metadata + std::vector < std::string > lhefGenerator; //!< Generator for LHE file events + std::vector < std::string > generators; //!< Generators for this dataset + std::vector < std::string > evgenProcess; //!< Physics process in this dataset + std::vector < std::string > evgenTune; //!< Hadronization and UE tune used for this dataset + std::vector < std::string > hardPDF; //!< PDF used for the hard process + std::vector < std::string > softPDF; //!< PDF used for the tune / shower / hadronization + }; // class TruthMetaDataAuxContainer_v1 } // namespace xAOD diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthMetaData_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthMetaData_v1.h index cd48d625979ab35333d96b32ac8fa0fc85356db1..53d3d478abacc488bfd9b5b5b15caade35793139 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthMetaData_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthMetaData_v1.h @@ -40,6 +40,24 @@ namespace xAOD { const std::vector< std::string >& weightNames() const; void setWeightNames( const std::vector< std::string >& value ); + const std::string& lhefGenerator() const; + void setLhefGenerator( const std::string& value ); + + const std::string& generators() const; + void setGenerators( const std::string& value ); + + const std::string& evgenProcess() const; + void setEvgenProcess( const std::string& value ); + + const std::string& evgenTune() const; + void setEvgenTune( const std::string& value ); + + const std::string& hardPDF() const; + void setHardPDF( const std::string& value ); + + const std::string& softPDF() const; + void setSoftPDF( const std::string& value ); + /// @} private: diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticleContainer_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticleContainer_v1.h index 4bee9879f63ca4729110c988001e81d539a82e1d..bd5d1a977d0580e97435432405d56efd739c454c 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticleContainer_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticleContainer_v1.h @@ -1,10 +1,9 @@ // -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -// $Id: TruthParticleContainer_v1.h 622193 2014-10-16 16:08:34Z krasznaa $ #ifndef XAODTRUTH_VERSIONS_TRUTHPARTICLECONTAINER_V1_H #define XAODTRUTH_VERSIONS_TRUTHPARTICLECONTAINER_V1_H @@ -14,7 +13,6 @@ // Local include(s): #include "xAODTruth/versions/TruthParticle_v1.h" -#include "xAODTruth/TruthParticleContainerFwd.h" // Only as long as this is the most recent version... namespace xAOD { // Alias diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticle_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticle_v1.h index 311c2ec6a536b24a9d2677914ef6730e3917af92..d6fcfe18cdf4d851bfab9302184869a4094c83f7 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticle_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticle_v1.h @@ -20,6 +20,8 @@ // ROOT include(s): #include "Math/Vector4D.h" +#include "xAODTruth/TruthParticleContainerFwd.h" +template struct DataVector_detail::DVLEltBaseInit< xAOD::TruthParticle_v1>; namespace xAOD { @@ -290,6 +292,8 @@ namespace xAOD { bool isResonance() const; /// Check if this is a generator specific (non-physical) particle bool isGenSpecific() const; + /// Check if this is a BSM particle + bool isBSM() const; /// @} @@ -340,7 +344,7 @@ namespace xAOD { /// @param parameter The polarion parameter that we are interested in /// @return The value of the polarization parameter requested /// - float polarizationPatameter( PolParam parameter ) const; + float polarizationParameter( PolParam parameter ) const; /// Single container for full polarization information /// diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthPileupEventContainer_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthPileupEventContainer_v1.h index ded2f41126038d647a442c5367e41709af8b7063..bed3a688df4dc9ad0ce1a65c84f0ded2e93354f5 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthPileupEventContainer_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthPileupEventContainer_v1.h @@ -1,10 +1,9 @@ // -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -// $Id: TruthPileupEventContainer_v1.h 622193 2014-10-16 16:08:34Z krasznaa $ #ifndef XAODTRUTH_VERSIONS_TRUTHPILEUPEVENTCONTAINER_V1_H #define XAODTRUTH_VERSIONS_TRUTHPILEUPEVENTCONTAINER_V1_H @@ -14,8 +13,6 @@ // Local include(s): #include "xAODTruth/versions/TruthPileupEvent_v1.h" -// Declare the base class of TruthEvent_v1 for DataVector -DATAVECTOR_BASE( xAOD::TruthPileupEvent_v1, xAOD::TruthEventBase_v1 ); namespace xAOD { /// Alias declaring the container type diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthPileupEvent_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthPileupEvent_v1.h index a38277cbd93f914752a6bb055ce5c10b835269f4..3bc254384f89d06ba6dca6df6266f6f52ebf036e 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthPileupEvent_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthPileupEvent_v1.h @@ -1,10 +1,9 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -// $Id: TruthPileupEvent_v1.h 622193 2014-10-16 16:08:34Z krasznaa $ #ifndef XAODTRUTH_VERSIONS_TRUTHPILEUPEVENT_V1_H #define XAODTRUTH_VERSIONS_TRUTHPILEUPEVENT_V1_H @@ -40,4 +39,6 @@ namespace xAOD { #include "xAODCore/BaseInfo.h" SG_BASE( xAOD::TruthPileupEvent_v1, xAOD::TruthEventBase_v1 ); +DATAVECTOR_BASE( xAOD::TruthPileupEvent_v1, xAOD::TruthEventBase_v1 ); + #endif // XAODTRUTH_VERSIONS_TRUTHPILEUPEVENT_V1_H diff --git a/Event/xAOD/xAODTruth/xAODTruth/xAODTruthDict.h b/Event/xAOD/xAODTruth/xAODTruth/xAODTruthDict.h index ed88b03a434bccbd99b5a889654c9757b28fbd50..43d481519f4aec026ed1e6f57df97231ae104f07 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/xAODTruthDict.h +++ b/Event/xAOD/xAODTruth/xAODTruth/xAODTruthDict.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ // $Id: xAODTruthDict.h 670153 2015-05-27 11:42:29Z tbisanz $ @@ -27,6 +27,18 @@ #include "xAODTruth/versions/TruthPileupEventAuxContainer_v1.h" #include "xAODTruth/versions/TruthMetaDataContainer_v1.h" #include "xAODTruth/versions/TruthMetaDataAuxContainer_v1.h" + +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthParticleAuxContainer.h" +#include "xAODTruth/TruthVertexContainer.h" +#include "xAODTruth/TruthVertexAuxContainer.h" +#include "xAODTruth/TruthEventBaseContainer.h" +#include "xAODTruth/TruthEventContainer.h" +#include "xAODTruth/TruthEventAuxContainer.h" +#include "xAODTruth/TruthPileupEventContainer.h" +#include "xAODTruth/TruthPileupEventAuxContainer.h" +#include "xAODTruth/TruthMetaDataContainer.h" +#include "xAODTruth/TruthMetaDataAuxContainer.h" #include "xAODTruth/xAODTruthHelpers.h" namespace { diff --git a/Event/xAOD/xAODTruthCnv/src/RedoTruthLinksAlg.cxx b/Event/xAOD/xAODTruthCnv/src/RedoTruthLinksAlg.cxx index 1282c44e40b8b13a033ecff610d02dcf5937b099..a6bdb3ba190839a1047ae4549d294d420ea68d04 100644 --- a/Event/xAOD/xAODTruthCnv/src/RedoTruthLinksAlg.cxx +++ b/Event/xAOD/xAODTruthCnv/src/RedoTruthLinksAlg.cxx @@ -64,7 +64,7 @@ namespace xAODMaker { // Create link between HepMC and xAOD truth //truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink((*par)->barcode(), evt->eventNumber()), par)); /// @todo AB: Truth particle links should only be made to the signal event... hence the 0. Right? - truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink((*par)->barcode(), 0), par)); + truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink((*par)->barcode(), 0, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION), par)); } } diff --git a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx index 56ec124fbf121398b9ccff5e45e443e4469d62c0..36d2fdf9b5518270aa9fac8501565c4215342256 100644 --- a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx +++ b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx @@ -284,7 +284,7 @@ namespace xAODMaker { if (!isSignalProcess) xTruthPileupEvent->addTruthParticleLink(eltp); // Create link between HepMC and xAOD truth - if (isSignalProcess) truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink((*pitr),0), eltp)); + if (isSignalProcess) truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink((*pitr),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION), eltp)); if (!isSignalProcess) truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink((*pitr),genEvt->event_number()), eltp)); // Is this one of the beam particles? diff --git a/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/CMakeLists.txt b/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/CMakeLists.txt index 949344ed5064f68ab80f0d53a4648e1778f530aa..4dd785bd3dd3de1b095597ff08bfbef02e4b4fdb 100644 --- a/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/CMakeLists.txt +++ b/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/CMakeLists.txt @@ -21,18 +21,17 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( tdaq-common ) -# Component(s) in the package: -atlas_add_component( AFP_ByteStream2RawCnv - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps AthContainers AFP_RawEv) - atlas_add_library( AFP_ByteStream2RawCnvLib src/*.cxx PUBLIC_HEADERS AFP_ByteStream2RawCnv INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps AthContainers AFP_RawEv) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps AthContainers AFP_RawEv ByteStreamCnvSvcBaseLib ) + +# Component(s) in the package: +atlas_add_component( AFP_ByteStream2RawCnv + src/components/*.cxx + INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps AthContainers AFP_RawEv AFP_ByteStream2RawCnvLib ) # Install files from the package: atlas_install_headers( AFP_ByteStream2RawCnv ) diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h index 726b223884de3a6a9e0b167ea9f8b33891f3a922..b12b42b015ba521bc16722c125547c2020677857 100644 --- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h +++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h @@ -54,9 +54,9 @@ //for truth particles #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" // xAOD #include "xAODForward/AFPTrackContainer.h" diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h index 17af9482b3f4cf39cd3e42caf7e785d4a9bdfe9e..77de8bd13800fddcc15de676cf922eb2d02394de 100644 --- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h +++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h @@ -50,9 +50,9 @@ //for truth particles #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/CMakeLists.txt b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/CMakeLists.txt index c69b5d1eb636ea86d4f120cd1fe5250ab2b51e96..425585ebbd3e233bb505a5e954135961a71f4b44 100644 --- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/CMakeLists.txt +++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/CMakeLists.txt @@ -17,13 +17,13 @@ atlas_depends_on_subdirs( PUBLIC ForwardDetectors/AFP/AFP_RecoEv/AFP_LocRecoEv GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC Event/xAOD/xAODForward PRIVATE Control/AthLinks) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake @@ -34,8 +34,8 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minui atlas_add_component( AFP_LocReco src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities EventInfo AFP_DigiEv AFP_Geometry AFP_LocRecoEv GaudiKernel GeneratorObjects xAODForward AthLinks) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities EventInfo AFP_DigiEv AFP_Geometry AFP_LocRecoEv GaudiKernel GeneratorObjects xAODForward AthLinks) # Install files from the package: atlas_install_headers( AFP_LocReco ) diff --git a/ForwardDetectors/ALFA/ALFA_BeamTransport/ALFA_BeamTransport/ALFA_BeamTransport.h b/ForwardDetectors/ALFA/ALFA_BeamTransport/ALFA_BeamTransport/ALFA_BeamTransport.h index 0db21d09ef33a611db397cc80440fea22291dc22..f32bd43491a274cdc377c575c7efa38aca2e8283 100644 --- a/ForwardDetectors/ALFA/ALFA_BeamTransport/ALFA_BeamTransport/ALFA_BeamTransport.h +++ b/ForwardDetectors/ALFA/ALFA_BeamTransport/ALFA_BeamTransport/ALFA_BeamTransport.h @@ -19,7 +19,7 @@ #include "TH1.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" //FPTracker #include "FPTracker/Particle.h" diff --git a/ForwardDetectors/ALFA/ALFA_BeamTransport/CMakeLists.txt b/ForwardDetectors/ALFA/ALFA_BeamTransport/CMakeLists.txt index 39b6bea40f8fc1563f0b4aa4c7e4d6c0e3a25d14..7198470f3055e3794d38484313d368e826c30452 100644 --- a/ForwardDetectors/ALFA/ALFA_BeamTransport/CMakeLists.txt +++ b/ForwardDetectors/ALFA/ALFA_BeamTransport/CMakeLists.txt @@ -13,19 +13,20 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE Control/StoreGate Event/EventInfo - Generators/GeneratorObjects ) + Generators/GeneratorObjects + Generators/AtlasHepMC + ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( ALFA_BeamTransport src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps FPTracker GaudiKernel StoreGateLib SGtests EventInfo GeneratorObjects FPTracker ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps FPTracker GaudiKernel StoreGateLib SGtests EventInfo GeneratorObjects FPTracker ) # Install files from the package: atlas_install_headers( ALFA_BeamTransport ) diff --git a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.cxx b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.cxx index d6f6ae92ed728b5d31987a2ba25ed48a1231dd22..299c8768d1677dc215b4ac898e8c317ea265cd6b 100644 --- a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.cxx +++ b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.cxx @@ -29,9 +29,9 @@ #include "EventInfo/EventID.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/SimpleVector.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/SimpleVector.h" +#include "AtlasHepMC/GenParticle.h" //ROOT headers #include "TFile.h" diff --git a/ForwardDetectors/ALFA/ALFA_Digitization/CMakeLists.txt b/ForwardDetectors/ALFA/ALFA_Digitization/CMakeLists.txt index d845ffc73b2859aa3b8245a39cba094cc0f2595d..9fa388cfcef6fd5806f2a4884e8785bab5d769a0 100644 --- a/ForwardDetectors/ALFA/ALFA_Digitization/CMakeLists.txt +++ b/ForwardDetectors/ALFA/ALFA_Digitization/CMakeLists.txt @@ -17,19 +17,19 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE DetectorDescription/Identifier Generators/GeneratorObjects + Generators/AtlasHepMC Tools/PathResolver ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( ALFA_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib ALFA_RawEv ALFA_SimEv GaudiKernel HitManagement Identifier GeneratorObjects PathResolver ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel PileUpToolsLib ALFA_RawEv ALFA_SimEv GaudiKernel HitManagement Identifier GeneratorObjects PathResolver ) # Install files from the package: atlas_install_headers( ALFA_Digitization ) diff --git a/ForwardDetectors/ALFA/ALFA_Digitization/src/ALFA_PileUpTool.cxx b/ForwardDetectors/ALFA/ALFA_Digitization/src/ALFA_PileUpTool.cxx index 730b51b0e3bc996309acda4fbe1cc94ff19bc52d..c2931c4de7898f319331be4844c8bbefb423a800 100644 --- a/ForwardDetectors/ALFA/ALFA_Digitization/src/ALFA_PileUpTool.cxx +++ b/ForwardDetectors/ALFA/ALFA_Digitization/src/ALFA_PileUpTool.cxx @@ -30,12 +30,12 @@ #include <functional> //for truth particles -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Vector/LorentzVector.h" -#include "HepMC/SimpleVector.h" +#include "AtlasHepMC/SimpleVector.h" #include "TTree.h" diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/ALFA_LocRec/ALFA_LocRec.h b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/ALFA_LocRec/ALFA_LocRec.h index de54c27497093e67c0c82d913667148a66729697..8e1b02bf26d28ae6327364430cb17b0732746cbe 100644 --- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/ALFA_LocRec/ALFA_LocRec.h +++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/ALFA_LocRec/ALFA_LocRec.h @@ -56,9 +56,9 @@ //for truth particles #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" typedef struct _USERTRANSFORM { diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/CMakeLists.txt b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/CMakeLists.txt index 74090af3b8099010f004ad7a39cbdf3dac5db77d..5b7f7e1e8bfb0b89cece7220b05c549da005a5ba 100644 --- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/CMakeLists.txt +++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/CMakeLists.txt @@ -16,10 +16,11 @@ atlas_depends_on_subdirs( PUBLIC ForwardDetectors/ALFA/ALFA_RawEv ForwardDetectors/ALFA/ALFA_RecEv/ALFA_LocRecEv GaudiKernel - Generators/GeneratorObjects ) + Generators/GeneratorObjects + Generators/AtlasHepMC + ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake @@ -30,8 +31,8 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minui atlas_add_component( ALFA_LocRec src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities EventInfo ALFA_Geometry ALFA_RawEv ALFA_LocRecEv GaudiKernel GeneratorObjects ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities EventInfo ALFA_Geometry ALFA_RawEv ALFA_LocRecEv GaudiKernel GeneratorObjects ) # Install files from the package: atlas_install_headers( ALFA_LocRec ) diff --git a/ForwardDetectors/ForwardTransport/CMakeLists.txt b/ForwardDetectors/ForwardTransport/CMakeLists.txt index ab28fb3438a1068c096dfa88d54b3a6f8310c7fa..1134d6d01d4905f620922e0bf8a4ae4f309eb70e 100644 --- a/ForwardDetectors/ForwardTransport/CMakeLists.txt +++ b/ForwardDetectors/ForwardTransport/CMakeLists.txt @@ -10,20 +10,21 @@ atlas_depends_on_subdirs( PRIVATE ForwardDetectors/ForwardTracker ForwardDetectors/ForwardTransportSvc GaudiKernel - Simulation/G4Atlas/G4AtlasTools ) + Simulation/G4Atlas/G4AtlasTools + Generators/AtlasHepMC + ) # External dependencies: find_package( CLHEP ) find_package( Geant4 ) -find_package( HepMC ) find_package( XercesC ) # Component(s) in the package: atlas_add_component( ForwardTransport src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ForwardTracker GaudiKernel G4AtlasToolsLib ) + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ForwardTracker GaudiKernel G4AtlasToolsLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/ForwardDetectors/ForwardTransport/src/ForwardTransportModel.cxx b/ForwardDetectors/ForwardTransport/src/ForwardTransportModel.cxx index ace2ee07dbcc837f31c101972d9602e06a14a27d..1bbb8b5313e68b899a0cfabd67b61d64dfbcf1d7 100644 --- a/ForwardDetectors/ForwardTransport/src/ForwardTransportModel.cxx +++ b/ForwardDetectors/ForwardTransport/src/ForwardTransportModel.cxx @@ -14,7 +14,7 @@ #include "G4Gamma.hh" #include "G4Lambda.hh" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" ForwardTransportModel::ForwardTransportModel(const std::string& name, const int verboseLevel, const std::string& FwdTrSvcName) : G4VFastSimulationModel(name) diff --git a/ForwardDetectors/ForwardTransportFast/CMakeLists.txt b/ForwardDetectors/ForwardTransportFast/CMakeLists.txt index d16e5bd24fca18c4d9d7335348155b6f3953bb14..44dd9e68313aa82ebd2b8ee60885f40f6019adb1 100644 --- a/ForwardDetectors/ForwardTransportFast/CMakeLists.txt +++ b/ForwardDetectors/ForwardTransportFast/CMakeLists.txt @@ -12,20 +12,20 @@ atlas_depends_on_subdirs( PUBLIC ForwardDetectors/ForwardTransportSvc GaudiKernel PRIVATE - Generators/GeneratorObjects ) + Generators/GeneratorObjects + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) find_package( Geant4 ) -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( ForwardTransportFast src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${GEANT4_LIBRARIES} AthenaBaseComps ForwardTracker GaudiKernel GeneratorObjects ForwardTracker ) + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} AthenaBaseComps ForwardTracker GaudiKernel GeneratorObjects ForwardTracker ) # Install files from the package: atlas_install_headers( ForwardTransportFast ) diff --git a/ForwardDetectors/ForwardTransportFast/src/ForwardTransportFast.cxx b/ForwardDetectors/ForwardTransportFast/src/ForwardTransportFast.cxx index d7c7296bbb657bbc6fd2e3cb49f079a92f66bafc..4a48377a50ae86b0969bde0ef1a8d0b22ec57331 100644 --- a/ForwardDetectors/ForwardTransportFast/src/ForwardTransportFast.cxx +++ b/ForwardDetectors/ForwardTransportFast/src/ForwardTransportFast.cxx @@ -4,7 +4,7 @@ #include "GeneratorObjects/McEventCollection.h" #include "CLHEP/Units/SystemOfUnits.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "ForwardTransportFast/ForwardTransportFast.h" #include "ForwardTracker/Particle.h" diff --git a/ForwardDetectors/ForwardTransportSvc/CMakeLists.txt b/ForwardDetectors/ForwardTransportSvc/CMakeLists.txt index a6398e229dcbabf5ab26c0e290acd50425bdaac0..ce54b1424631e843ecd30a5f1a5abbb1d59737ee 100644 --- a/ForwardDetectors/ForwardTransportSvc/CMakeLists.txt +++ b/ForwardDetectors/ForwardTransportSvc/CMakeLists.txt @@ -11,12 +11,12 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel PRIVATE Control/AthenaBaseComps - Generators/GeneratorObjects ) + Generators/GeneratorObjects + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) find_package( Geant4 ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) find_package( XercesC ) @@ -24,8 +24,8 @@ find_package( XercesC ) atlas_add_component( ForwardTransportSvc src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ForwardTracker GaudiKernel AthenaBaseComps GeneratorObjects ForwardTracker ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ForwardTracker GaudiKernel AthenaBaseComps GeneratorObjects ForwardTracker ) # Install files from the package: atlas_install_headers( ForwardTransportSvc ) diff --git a/ForwardDetectors/ForwardTransportSvc/ForwardTransportSvc/IForwardTransportSvc.h b/ForwardDetectors/ForwardTransportSvc/ForwardTransportSvc/IForwardTransportSvc.h index ca8c00d0a8858adfa47362283389889ce4617c33..1124fa1ba7b5b4d6880b91c08cae3f19ddfd3654 100755 --- a/ForwardDetectors/ForwardTransportSvc/ForwardTransportSvc/IForwardTransportSvc.h +++ b/ForwardDetectors/ForwardTransportSvc/ForwardTransportSvc/IForwardTransportSvc.h @@ -8,7 +8,7 @@ #include "GaudiKernel/IInterface.h" #include "GaudiKernel/StatusCode.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "ForwardTracker/ConfigData.h" diff --git a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx index 51d5a2c4156e105bcc6dcb1f3448a9fafab8eb1f..ae802360f502e28ce5d1c6524f80d059d6bc359a 100644 --- a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx +++ b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx index df6b13213a23badb3373f66d79f0d22a73dd7214..66709d3eb89385548be1a5520e1db443fe95423c 100644 --- a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx +++ b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx @@ -17,8 +17,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/ForwardDetectors/LUCID/LUCID_G4_SD/CMakeLists.txt b/ForwardDetectors/LUCID/LUCID_G4_SD/CMakeLists.txt index 34e4e450fe2c22848148b0cfefe56695226a0c33..99dd6d2f5f0f76a0d64392396ac69eb86ada7494 100644 --- a/ForwardDetectors/LUCID/LUCID_G4_SD/CMakeLists.txt +++ b/ForwardDetectors/LUCID/LUCID_G4_SD/CMakeLists.txt @@ -24,18 +24,17 @@ find_package( XercesC ) find_package( GTest ) # Component(s) in the package: -atlas_add_component( LUCID_G4_SD - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel StoreGateLib SGtests LUCID_GeoModelLib LUCID_SimEvent G4AtlasToolsLib HitManagement ) - atlas_add_library( LUCID_G4_SDLib src/*.cxx NO_PUBLIC_HEADERS LUCID_G4_SD INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel CxxUtils StoreGateLib SGtests LUCID_GeoModelLib LUCID_SimEvent G4AtlasToolsLib HitManagement ) +atlas_add_component( LUCID_G4_SD + src/components/*.cxx + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel StoreGateLib SGtests LUCID_GeoModelLib LUCID_SimEvent G4AtlasToolsLib HitManagement LUCID_G4_SDLib ) + atlas_add_test( LUCID_SensitiveDetector_gtest SOURCES test/LUCID_SensitiveDetector_gtest.cxx INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} diff --git a/Generators/AtlasHepMC/AtlasHepMC/IO_BaseClass_fwd.h b/Generators/AtlasHepMC/AtlasHepMC/IO_BaseClass_fwd.h new file mode 100644 index 0000000000000000000000000000000000000000..fdff3e8119fda6e4b2a6c74dec49049dc881a6a0 --- /dev/null +++ b/Generators/AtlasHepMC/AtlasHepMC/IO_BaseClass_fwd.h @@ -0,0 +1,7 @@ +/* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Author: Andrii Verbytskyi andrii.verbytskyi@mpp.mpg.de +*/ +#ifndef ATLASHEPMC_IOBASECLASS_FWD_H +#define ATLASHEPMC_IOBASECLASS_FWD_H +namespace HepMC {class IO_BaseClass;} +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/IO_GenEvent_fwd.h b/Generators/AtlasHepMC/AtlasHepMC/IO_GenEvent_fwd.h new file mode 100644 index 0000000000000000000000000000000000000000..e95f174a3c3fdd3d152638d1133a4033ac8cb194 --- /dev/null +++ b/Generators/AtlasHepMC/AtlasHepMC/IO_GenEvent_fwd.h @@ -0,0 +1,8 @@ +/* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Author: Andrii Verbytskyi andrii.verbytskyi@mpp.mpg.de +*/ +#ifndef ATLASHEPMC_IOGENEVENT_FWD_H +#define ATLASHEPMC_IOGENEVENT_FWD_H +namespace HepMC { class IO_GenEvent; } +#endif + diff --git a/Generators/GeneratorFilters/GeneratorFilters/BoostedHadTopAndTopPair.h b/Generators/GeneratorFilters/GeneratorFilters/BoostedHadTopAndTopPair.h index 5c72d214bc571ecb52afea5c1dd5f59d24271bad..94ab2767a654033eeee16a77f04f14976749b716 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/BoostedHadTopAndTopPair.h +++ b/Generators/GeneratorFilters/GeneratorFilters/BoostedHadTopAndTopPair.h @@ -17,9 +17,7 @@ #include <iostream> #include "GeneratorModules/GenFilter.h" -namespace HepMC{ - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" /// Filter events based on presence of charged leptons diff --git a/Generators/GeneratorFilters/GeneratorFilters/TTbarPlusHeavyFlavorFilter.h b/Generators/GeneratorFilters/GeneratorFilters/TTbarPlusHeavyFlavorFilter.h index ceb763b930a14480bf83730078f60343693af8ee..4802aabba2a7521f9e797b3edb9265bc0c75ed88 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/TTbarPlusHeavyFlavorFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/TTbarPlusHeavyFlavorFilter.h @@ -15,9 +15,7 @@ #include "GeneratorModules/GenFilter.h" -namespace HepMC{ - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" class TTbarPlusHeavyFlavorFilter: public GenFilter { public: diff --git a/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h b/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h index f62074daf4d80f8dfa217446d03e6aff271fed11..b6fb73787bbcfc34b7c6285060fa51937bb23a33 100644 --- a/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h +++ b/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h @@ -82,7 +82,7 @@ enum EBC_EVCOLL{ class HepMcParticleLink { public: typedef uint32_t barcode_type; - typedef uint16_t index_type; + typedef uint32_t index_type; enum PositionFlag { diff --git a/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref b/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref index 3b5c108c78eaab7a82dfa60c6a4bc5cfb5502009..b7430df5df9969fb9ce9e54b348f54acc0787a7e 100644 --- a/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref +++ b/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref @@ -1,31 +1,32 @@ -[==========] Running 3 tests from 1 test case. +[==========] Running 4 tests from 1 test case. [----------] Global test environment set-up. ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Tue Feb 19 16:13:51 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on pc-camb05 on Wed Apr 29 13:48:28 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -[----------] 3 tests from HepMcParticleLink_test +[----------] 4 tests from HepMcParticleLink_test [ RUN ] HepMcParticleLink_test.old_test *** HepMcParticleLink_test starts *** -ClassIDSvc INFO getRegistryEntries: read 896 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 817 CLIDRegistry entries for module ALL Testing HepMcParticleLink streamer Event index 0, Barcode 10005, McEventCollection CollectionNotSet(a) --- Event index 1, Barcode 10005, McEventCollection CollectionNotSet(a) HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job *** HepMcParticleLink_test OK *** -[ OK ] HepMcParticleLink_test.old_test (63 ms) +[ OK ] HepMcParticleLink_test.old_test (53 ms) [ RUN ] HepMcParticleLink_test.broken_event_link -ClassIDSvc INFO getRegistryEntries: read 1024 CLIDRegistry entries for module ALL -[ OK ] HepMcParticleLink_test.broken_event_link (5 ms) +ClassIDSvc INFO getRegistryEntries: read 1070 CLIDRegistry entries for module ALL +[ OK ] HepMcParticleLink_test.broken_event_link (1 ms) [ RUN ] HepMcParticleLink_test.truth_event_link [ OK ] HepMcParticleLink_test.truth_event_link (0 ms) -[----------] 3 tests from HepMcParticleLink_test (68 ms total) +[ RUN ] HepMcParticleLink_test.max_event_number +[ OK ] HepMcParticleLink_test.max_event_number (0 ms) +[----------] 4 tests from HepMcParticleLink_test (54 ms total) [----------] Global test environment tear-down -[==========] 3 tests from 1 test case ran. (113 ms total) -[ PASSED ] 3 tests. +[==========] 4 tests from 1 test case ran. (176 ms total) +[ PASSED ] 4 tests. diff --git a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx index 21fd8cdd80b58614b762fba6bedd527f6a69f8d2..5a6aa6abfb9a73a464aee9d64a38362bb4355b54 100644 --- a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx +++ b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx @@ -254,10 +254,11 @@ HepMcParticleLink::getEventPositionInCollection (const IProxyDict* sg) const return 0; } + const int intIndex = static_cast<int>(index); const McEventCollection* coll = retrieveMcEventCollection (sg); size_t sz = coll->size(); for (size_t i = 0; i < sz; i++) { - if ((*coll)[i]->event_number() == index) { + if ((*coll)[i]->event_number() == intIndex) { return i; } } diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx index 9faf8cf0d3d017603b758c266391e59bd5cd76b3..3f33ea31b82122dac032e20f15374fa916bf3ca7 100644 --- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx +++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx @@ -260,18 +260,24 @@ namespace MCTesting { const int process_id1(20); const int event_number1(17); inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); + const HepMcParticleLink::index_type dummyIndex1(0); + const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); const HepMC::GenParticle* particle1 = populateGenEvent(ge1); // Add a second dummy GenEvent const int process_id2(20); const int event_number2(25); inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2)); + const HepMcParticleLink::index_type dummyIndex2(1); + const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2); HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); const HepMC::GenParticle* particle2 = populateGenEvent2(ge2); // Add a third dummy GenEvent (identical to the first) const int process_id3(20); const int event_number3(17); inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3)); + const HepMcParticleLink::index_type dummyIndex3(2); + const HepMcParticleLink::index_type refEvtNum3 = static_cast<HepMcParticleLink::index_type>(event_number3); HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); const HepMC::GenParticle* particle3 = populateGenEvent(ge3); @@ -284,8 +290,8 @@ namespace MCTesting { HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink1a.isValid() ); ASSERT_EQ( particle1->barcode(), testLink1a.barcode()); - ASSERT_EQ( event_number1, testLink1a.eventIndex()); - ASSERT_EQ( 0, testLink1a.getEventPositionInCollection(sg)); + ASSERT_EQ( refEvtNum1, testLink1a.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink1a.getEventPositionInCollection(sg)); ASSERT_EQ(particle1,testLink1a.cptr()); // A HepMcParticleLink built using the barcode and the position of // the GenEvent. @@ -293,26 +299,26 @@ namespace MCTesting { HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink1b.isValid() ); ASSERT_EQ( particle1->barcode(), testLink1b.barcode()); - ASSERT_EQ( event_number1, testLink1b.eventIndex()); - ASSERT_EQ( 0, testLink1b.getEventPositionInCollection(sg)); + ASSERT_EQ( refEvtNum1, testLink1b.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink1b.getEventPositionInCollection(sg)); ASSERT_EQ(*(testLink1a.cptr()),*(testLink1b.cptr())); // HepMcParticleLink built using a GenParticle pointer and the // event_number of the GenEvent. HepMcParticleLink testLink1c(particle1,event_number1); ASSERT_TRUE( testLink1c.isValid() ); ASSERT_EQ( particle1->barcode(), testLink1c.barcode()); - ASSERT_NE( 0, testLink1c.eventIndex()); - ASSERT_EQ( event_number1, testLink1c.eventIndex()); - ASSERT_EQ( 0, testLink1c.getEventPositionInCollection(sg)); + ASSERT_NE( dummyIndex1, testLink1c.eventIndex()); + ASSERT_EQ( refEvtNum1, testLink1c.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink1c.getEventPositionInCollection(sg)); ASSERT_EQ(particle1,testLink1c.cptr()); // A HepMcParticleLink built using the barcode and the event_number of // the GenEvent. HepMcParticleLink testLink1d(particle1->barcode(),event_number1); ASSERT_TRUE( testLink1d.isValid() ); ASSERT_EQ( particle1->barcode(), testLink1d.barcode()); - ASSERT_NE( 0, testLink1d.eventIndex()); - ASSERT_EQ( event_number1, testLink1d.eventIndex()); - ASSERT_EQ( 0, testLink1d.getEventPositionInCollection(sg)); + ASSERT_NE( dummyIndex1, testLink1d.eventIndex()); + ASSERT_EQ( refEvtNum1, testLink1d.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink1d.getEventPositionInCollection(sg)); ASSERT_EQ(particle1,testLink1d.cptr()); //Testing links to the second dummy GenEvent @@ -323,8 +329,8 @@ namespace MCTesting { HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink2a.isValid() ); ASSERT_EQ( particle2->barcode(), testLink2a.barcode()); - ASSERT_EQ( event_number2, testLink2a.eventIndex()); - ASSERT_EQ( 1, testLink2a.getEventPositionInCollection(sg)); + ASSERT_EQ( refEvtNum2, testLink2a.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink2a.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2a.cptr()); // A HepMcParticleLink built using the barcode and the position of // the GenEvent. @@ -332,26 +338,26 @@ namespace MCTesting { HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink2b.isValid() ); ASSERT_EQ( particle2->barcode(), testLink2b.barcode()); - ASSERT_EQ( event_number2, testLink2b.eventIndex()); - ASSERT_EQ( 1, testLink2b.getEventPositionInCollection(sg)); + ASSERT_EQ( refEvtNum2, testLink2b.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink2b.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2b.cptr()); // HepMcParticleLink built using a GenParticle pointer and the // event_number of the GenEvent. HepMcParticleLink testLink2c(particle2,event_number2); ASSERT_TRUE( testLink2c.isValid() ); ASSERT_EQ( particle2->barcode(), testLink2c.barcode()); - ASSERT_NE( 1, testLink2c.eventIndex()); - ASSERT_EQ( event_number2, testLink2c.eventIndex()); - ASSERT_EQ( 1, testLink2c.getEventPositionInCollection(sg)); + ASSERT_NE( dummyIndex2, testLink2c.eventIndex()); + ASSERT_EQ( refEvtNum2, testLink2c.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink2c.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2c.cptr()); // A HepMcParticleLink built using the barcode and the event_number of // the GenEvent. HepMcParticleLink testLink2d(particle2->barcode(),event_number2); ASSERT_TRUE( testLink2d.isValid() ); ASSERT_EQ( particle2->barcode(), testLink2d.barcode()); - ASSERT_NE( 1, testLink2d.eventIndex()); - ASSERT_EQ( event_number2, testLink2d.eventIndex()); - ASSERT_EQ( 1, testLink2d.getEventPositionInCollection(sg)); + ASSERT_NE( dummyIndex2, testLink2d.eventIndex()); + ASSERT_EQ( refEvtNum2, testLink2d.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink2d.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2d.cptr()); //Testing links to the third dummy GenEvent @@ -362,7 +368,7 @@ namespace MCTesting { HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink3a.isValid() ); ASSERT_EQ( particle3->barcode(), testLink3a.barcode()); - ASSERT_EQ( event_number3, testLink3a.eventIndex()); + ASSERT_EQ( refEvtNum3, testLink3a.eventIndex()); ASSERT_EQ(particle3,testLink3a.cptr()); // A HepMcParticleLink built using the barcode and the position of // the GenEvent. @@ -370,23 +376,23 @@ namespace MCTesting { HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink3b.isValid() ); ASSERT_EQ( particle3->barcode(), testLink3b.barcode()); - ASSERT_EQ( event_number3, testLink3b.eventIndex()); + ASSERT_EQ( refEvtNum3, testLink3b.eventIndex()); ASSERT_EQ(particle3,testLink3b.cptr()); // HepMcParticleLink built using a GenParticle pointer and the // event_number of the GenEvent. HepMcParticleLink testLink3c(particle3,event_number3); ASSERT_TRUE( testLink3c.isValid() ); ASSERT_EQ( particle3->barcode(), testLink3c.barcode()); - ASSERT_NE( 2, testLink3c.eventIndex()); - ASSERT_EQ( event_number3, testLink3c.eventIndex()); + ASSERT_NE( dummyIndex3, testLink3c.eventIndex()); + ASSERT_EQ( refEvtNum3, testLink3c.eventIndex()); ASSERT_EQ(particle3,testLink3c.cptr()); // A HepMcParticleLink built using the barcode and the event_number of // the GenEvent. BROKEN HepMcParticleLink testLink3d(particle3->barcode(),event_number3); ASSERT_TRUE( testLink3d.isValid() ); ASSERT_EQ( particle3->barcode(), testLink3d.barcode()); - ASSERT_NE( 2, testLink3d.eventIndex()); - ASSERT_EQ( event_number3, testLink3d.eventIndex()); + ASSERT_NE( dummyIndex3, testLink3d.eventIndex()); + ASSERT_EQ( refEvtNum3, testLink3d.eventIndex()); ASSERT_NE(particle3,testLink3d.cptr()); ASSERT_EQ(particle1,testLink3d.cptr()); //POINTS AT THE IDENTICAL PARTICLE IN FIRST GenEvent!! @@ -395,6 +401,122 @@ namespace MCTesting { pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies } + TEST_F(HepMcParticleLink_test, max_event_number) { + // create dummy input McEventCollection with a name that + // HepMcParticleLink knows about + SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; + inputTestDataHandle = std::make_unique<McEventCollection>(); + + // Add a dummy GenEvent + const int process_id1(20); + const int event_number1(2147483647); + // 2147483647 = 2^31 -1 is the largest supported event number by + // HepMcParticleLink as the 32nd bit of the unsigned int used to + // hold the eventIndex is used to flag whether the it represents the + // position of the GenEvent in the McEventCollection or the + // GenEvent::event_number. + inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); + const HepMcParticleLink::index_type dummyIndex1(0); + const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1); + HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); + const HepMC::GenParticle* particle1 = populateGenEvent(ge1); + // Add a second dummy GenEvent + const int process_id2(20); + const int event_number2(25); + inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2)); + const HepMcParticleLink::index_type dummyIndex2(1); + const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2); + HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); + const HepMC::GenParticle* particle2 = populateGenEvent2(ge2); + // Add a third dummy GenEvent + const int process_id3(20); + const int event_number3(17); + inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3)); + + //Testing links to the first dummy GenEvent + const IProxyDict* sg = SG::CurrentEventStore::store(); + + // HepMcParticleLink built using a GenParticle pointer and the + // position of the GenEvent. + HepMcParticleLink testLink1a(particle1,0, EBC_MAINEVCOLL, + HepMcParticleLink::IS_POSITION); + ASSERT_TRUE( testLink1a.isValid() ); + ASSERT_EQ( particle1->barcode(), testLink1a.barcode()); + ASSERT_EQ( refEvtNum1, testLink1a.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink1a.getEventPositionInCollection(sg)); + ASSERT_EQ(particle1,testLink1a.cptr()); + // A HepMcParticleLink built using the barcode and the position of + // the GenEvent. + HepMcParticleLink testLink1b(particle1->barcode(),0, EBC_MAINEVCOLL, + HepMcParticleLink::IS_POSITION); + ASSERT_TRUE( testLink1b.isValid() ); + ASSERT_EQ( particle1->barcode(), testLink1b.barcode()); + ASSERT_EQ( refEvtNum1, testLink1b.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink1b.getEventPositionInCollection(sg)); + ASSERT_EQ(*(testLink1a.cptr()),*(testLink1b.cptr())); + // HepMcParticleLink built using a GenParticle pointer and the + // event_number of the GenEvent. + HepMcParticleLink testLink1c(particle1,event_number1); + ASSERT_TRUE( testLink1c.isValid() ); + ASSERT_EQ( particle1->barcode(), testLink1c.barcode()); + ASSERT_NE( dummyIndex1, testLink1c.eventIndex()); + ASSERT_EQ( refEvtNum1, testLink1c.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink1c.getEventPositionInCollection(sg)); + ASSERT_EQ(particle1,testLink1c.cptr()); + // A HepMcParticleLink built using the barcode and the event_number of + // the GenEvent. + HepMcParticleLink testLink1d(particle1->barcode(),event_number1); + ASSERT_TRUE( testLink1d.isValid() ); + ASSERT_EQ( particle1->barcode(), testLink1d.barcode()); + ASSERT_NE( dummyIndex1, testLink1d.eventIndex()); + ASSERT_EQ( refEvtNum1, testLink1d.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink1d.getEventPositionInCollection(sg)); + ASSERT_EQ(particle1,testLink1d.cptr()); + + //Testing links to the second dummy GenEvent + + // HepMcParticleLink built using a GenParticle pointer and the + // position of the GenEvent. + HepMcParticleLink testLink2a(particle2,1, EBC_MAINEVCOLL, + HepMcParticleLink::IS_POSITION); + ASSERT_TRUE( testLink2a.isValid() ); + ASSERT_EQ( particle2->barcode(), testLink2a.barcode()); + ASSERT_EQ( refEvtNum2, testLink2a.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink2a.getEventPositionInCollection(sg)); + ASSERT_EQ(particle2,testLink2a.cptr()); + // A HepMcParticleLink built using the barcode and the position of + // the GenEvent. + HepMcParticleLink testLink2b(particle2->barcode(),1, EBC_MAINEVCOLL, + HepMcParticleLink::IS_POSITION); + ASSERT_TRUE( testLink2b.isValid() ); + ASSERT_EQ( particle2->barcode(), testLink2b.barcode()); + ASSERT_EQ( refEvtNum2, testLink2b.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink2b.getEventPositionInCollection(sg)); + ASSERT_EQ(particle2,testLink2b.cptr()); + // HepMcParticleLink built using a GenParticle pointer and the + // event_number of the GenEvent. + HepMcParticleLink testLink2c(particle2,event_number2); + ASSERT_TRUE( testLink2c.isValid() ); + ASSERT_EQ( particle2->barcode(), testLink2c.barcode()); + ASSERT_NE( dummyIndex2, testLink2c.eventIndex()); + ASSERT_EQ( refEvtNum2, testLink2c.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink2c.getEventPositionInCollection(sg)); + ASSERT_EQ(particle2,testLink2c.cptr()); + // A HepMcParticleLink built using the barcode and the event_number of + // the GenEvent. + HepMcParticleLink testLink2d(particle2->barcode(),event_number2); + ASSERT_TRUE( testLink2d.isValid() ); + ASSERT_EQ( particle2->barcode(), testLink2d.barcode()); + ASSERT_NE( dummyIndex2, testLink2d.eventIndex()); + ASSERT_EQ( refEvtNum2, testLink2d.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink2d.getEventPositionInCollection(sg)); + ASSERT_EQ(particle2,testLink2d.cptr()); + + StoreGateSvc* pStore(nullptr); + ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess()); + pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies + } + } // <-- namespace MCTesting diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx index 650c9113db3e39b7cc518ff768757d7324e43c99..a1b0d96df2aef5a70769780df608d0d84733490e 100755 --- a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx @@ -49,7 +49,7 @@ void HepMcParticleLinkCnv_p1::persToTrans( const HepMcParticleLink_p1* persObj, void HepMcParticleLinkCnv_p1::transToPers( const HepMcParticleLink* transObj, HepMcParticleLink_p1* persObj, - MsgStream &/*msg*/ ) + MsgStream &msg ) { // NB This method assumes that there all GenEvents are stored in a // single McEventCollection, as running with split @@ -57,6 +57,9 @@ void HepMcParticleLinkCnv_p1::transToPers( const HepMcParticleLink* transObj, unsigned short index{0}; if (transObj->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) { index = transObj->eventIndex(); + if(transObj->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { + msg << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; + } } persObj->m_mcEvtIndex = index; persObj->m_barcode = transObj->barcode(); diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx index ac9e2258b02e0a9ef631f282e7d0802814b884a2..ea0693b4d5eaf5202228ae1e290f234da2d20fe9 100755 --- a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Framework includes @@ -23,19 +23,39 @@ void HepMcParticleLinkCnv_p2::persToTrans( const HepMcParticleLink_p2* persObj, HepMcParticleLink* transObj, MsgStream &/*msg*/ ) { + HepMcParticleLink::PositionFlag flag = HepMcParticleLink::IS_INDEX; + + if (persObj->m_mcEvtIndex == 0) { + flag = HepMcParticleLink::IS_POSITION; + } + transObj->setExtendedBarCode ( HepMcParticleLink::ExtendedBarCode( persObj->m_barcode, persObj->m_mcEvtIndex, HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persObj->m_evtColl), - HepMcParticleLink::IS_INDEX) ); + flag) ); return; } void HepMcParticleLinkCnv_p2::transToPers( const HepMcParticleLink* transObj, HepMcParticleLink_p2* persObj, - MsgStream &/*msg*/ ) + MsgStream &msg ) { - persObj->m_mcEvtIndex = transObj->eventIndex(); + // In the case that the standard production workflow is being used + // then the first event in the McEventCollection is the only one + // where the eventIndex could exceed the maximum value of unsigned + // short. In this case we can work around the issue by using an + // m_mcEvtIndex of zero as a special case, in which m_mcEvtIndex + // should be interpreted as the position in the McEventCollection + // rather than the value of GenEvent::event_number(). + unsigned short index{0}; + if (transObj->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) { + index = transObj->eventIndex(); + if(transObj->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { + msg << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; + } + } + persObj->m_mcEvtIndex = index; persObj->m_barcode = transObj->barcode(); persObj->m_evtColl = transObj->getEventCollectionAsChar(); return; diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx index e175aabb896c08c500c546d814c769f68b83697e..937f83451d94de4223aad4ec2d2fb5421cba0122 100644 --- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx +++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx @@ -67,8 +67,16 @@ void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPar inputTestDataHandle = std::make_unique<McEventCollection>(); // Add a dummy GenEvent const int process_id1(20); - const int event_number1(17); - const int event_number2(18); + const int event_number1(2147483647); + // 2147483647 = 2^31 -1 is the largest supported event number by + // HepMcParticleLink as the 32nd bit of the unsigned int used to + // hold the eventIndex is used to flag whether the it represents the + // position of the GenEvent in the McEventCollection or the + // GenEvent::event_number. + const int event_number2(std::numeric_limits<unsigned short>::max()); + // 2^16 -1 is the largest event number supported by + // HepMcParticleLink_p2. A workaround is used to suppport larger + // values for the first event in the McEventCollection. const int event_number3(64); inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx index 6936aad210df28c1e5e21d28112dbc68d089552a..b18f98f5770d1728e4a2551c55df274d94fdb627 100644 --- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx +++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx @@ -67,8 +67,16 @@ void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPar inputTestDataHandle = std::make_unique<McEventCollection>(); // Add a dummy GenEvent const int process_id1(20); - const int event_number1(17); - const int event_number2(18); + const int event_number1(2147483647); + // 2147483647 = 2^31 -1 is the largest supported event number by + // HepMcParticleLink as the 32nd bit of the unsigned int used to + // hold the eventIndex is used to flag whether the it represents the + // position of the GenEvent in the McEventCollection or the + // GenEvent::event_number. + const int event_number2(std::numeric_limits<unsigned short>::max()); + // 2^16 -1 is the largest event number supported by + // HepMcParticleLink_p2. A workaround is used to suppport larger + // values for the first event in the McEventCollection. const int event_number3(64); inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); diff --git a/Generators/MadGraphControl/CMakeLists.txt b/Generators/MadGraphControl/CMakeLists.txt index da6c122fc18219e386e81dda07f85bbb574fd11e..8d71874225e881efb94e20a9f5801cef3f2d0b11 100644 --- a/Generators/MadGraphControl/CMakeLists.txt +++ b/Generators/MadGraphControl/CMakeLists.txt @@ -8,13 +8,6 @@ atlas_subdir( MadGraphControl ) # External dependencies: find_package( MadGraph ) -# flake8 setup -set( ATLAS_FLAKE8 "flake8_atlas --select ATL,F,E7,E9,W6 --enable-extension ATL902 --extend-ignore E701,E702,E741" - CACHE STRING "Default flake8 command" ) - -set( ATLAS_PYTHON_CHECKER "${ATLAS_FLAKE8} --filterFiles AthenaConfiguration" - CACHE STRING "Python checker command to run during Python module compilation" ) - # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/common/*.py ) diff --git a/Generators/McEventSelector/python/McEventSelectorConfig.py b/Generators/McEventSelector/python/McEventSelectorConfig.py index a31db701baf878d46f9f8f4fd0c4e670968397bc..a2139a6dee858b119e4b86efde22a04005741154 100644 --- a/Generators/McEventSelector/python/McEventSelectorConfig.py +++ b/Generators/McEventSelector/python/McEventSelectorConfig.py @@ -1,11 +1,11 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/AthenaJobConfigRun3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def McEventSelectorCfg(configFlags): +def McEventSelectorCfg(configFlags, **kw): cfg=ComponentAccumulator() McCnvSvc=CompFactory.McCnvSvc @@ -21,6 +21,9 @@ def McEventSelectorCfg(configFlags): rn = rn[0] evSel.RunNumber = rn evSel.InitialTimeStamp = configFlags.Input.InitialTimeStamp + + for k, v in kw.items(): + setattr (evSel, k, v) cfg.addService(evSel) cfg.setAppProperty("EvtSel",evSel.getFullJobOptName()) diff --git a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx index 5cf7c2c3f15459252a48a2d4a11a49bae13f6a91..cd0625d453e6be6625c977eacfbd253358844f19 100644 --- a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx +++ b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx @@ -676,7 +676,11 @@ bool psc::Psc::prepareWorker (const boost::property_tree::ptree& args) if ( Py_IsInitialized() ) { ERS_DEBUG(1, "Post-fork initialization of Python interpreter"); +#if PY_VERSION_HEX >= 0x03070000 + PyOS_AfterFork_Child(); +#else PyOS_AfterFork(); +#endif /* Release the Python GIL (which we inherited from the mother) to avoid dead-locking on the first call to Python. Only relevant diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/CMakeLists.txt b/InnerDetector/InDetAlignTools/InDetAlignGenTools/CMakeLists.txt index 1bb5dcb381afde07d38ac7d438d305ba889062fa..51b0adc9468cefb9a3f1070a88dd638d8f97ada1 100644 --- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/CMakeLists.txt +++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/CMakeLists.txt @@ -40,21 +40,22 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkRIO_OnTrack Tracking/TrkEvent/TrkTrackSummary Tracking/TrkEvent/TrkTruthData - Tracking/TrkFitter/TrkFitterInterfaces ) + Tracking/TrkFitter/TrkFitterInterfaces + Generators/AtlasHepMC + ) # External dependencies: find_package( CLHEP ) find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) find_package( Eigen ) -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( InDetAlignGenTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives Identifier EventPrimitives InDetAlignTrkInfo InDetPrepRawData TrkEventPrimitives TrkEventUtils TrkTrack TrkExInterfaces TrkToolInterfaces AthenaKernel AthContainers AtlasDetDescr DetDescrConditions GaudiKernel InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry TRT_ReadoutGeometry TrkMeasurementBase TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces EventContainers ) + INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${CORAL_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives Identifier EventPrimitives InDetAlignTrkInfo InDetPrepRawData TrkEventPrimitives TrkEventUtils TrkTrack TrkExInterfaces TrkToolInterfaces AthenaKernel AthContainers AtlasDetDescr DetDescrConditions GaudiKernel InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry TRT_ReadoutGeometry TrkMeasurementBase TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces EventContainers ) # Install files from the package: atlas_install_headers( InDetAlignGenTools ) diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx index 121aa2ed1749837fedfac122aa11a85cdab15d56..9148ea93b01f2dca1d9b83b9e19eecf3f2b0fdf9 100644 --- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx +++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx @@ -45,8 +45,8 @@ #include "InDetAlignGenTools/InDetAlignFillTrack.h" #include "HepPDT/ParticleDataTable.hh" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include <string> diff --git a/InnerDetector/InDetAlignment/InDetAlignNtupleTools/CMakeLists.txt b/InnerDetector/InDetAlignment/InDetAlignNtupleTools/CMakeLists.txt index e3364b4a950f903da54ec9844ee3ee3de78d82e8..77b57a52115646501223f79dffd5021836a1f4e1 100644 --- a/InnerDetector/InDetAlignment/InDetAlignNtupleTools/CMakeLists.txt +++ b/InnerDetector/InDetAlignment/InDetAlignNtupleTools/CMakeLists.txt @@ -14,6 +14,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventPrimitives Event/xAOD/xAODEventInfo Generators/GeneratorObjects + Generators/AtlasHepMC InnerDetector/InDetDetDescr/InDetIdentifier Tracking/TrkAlignment/TrkAlignEvent Tracking/TrkEvent/TrkEventPrimitives @@ -27,15 +28,14 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkTools/TrkToolInterfaces ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( InDetAlignNtupleTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel EventPrimitives xAODEventInfo GeneratorObjects InDetIdentifier TrkAlignEvent TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData TrkVertexOnTrack TrkExInterfaces TrkToolInterfaces ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel EventPrimitives xAODEventInfo GeneratorObjects InDetIdentifier TrkAlignEvent TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData TrkVertexOnTrack TrkExInterfaces TrkToolInterfaces ) # Install files from the package: atlas_install_headers( InDetAlignNtupleTools ) diff --git a/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx b/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx index 2bfba3d0cc8c754197bca91dfcf94d8d524e9718..492211acc5cdd3202e6438b58f5f0a3c03264844 100644 --- a/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx +++ b/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx @@ -21,8 +21,8 @@ #include "TrkTruthData/TrackTruth.h" #include "TrkTruthData/TrackTruthCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "TrkAlignInterfaces/IAlignModuleTool.h" diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CollisionCalibTemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CollisionCalibTemplate.py index ce7451eb7b621362a53e06b81f4797b12f12bab2..009bfd63678037b9c5cd9c8eae0f80a98896d561 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CollisionCalibTemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CollisionCalibTemplate.py @@ -131,8 +131,6 @@ InDetFlags.doTruth = (globalflags.InputFormat() == 'pool' and globalflags. #InDetFlags.doLowPt = False #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CollisionTemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CollisionTemplate.py index 19541e178281cb8c2fb92d32486cdde1f4c83f66..e43857e79134bc59b9217fc644a49b7c0c3d5d10 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CollisionTemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CollisionTemplate.py @@ -135,8 +135,6 @@ InDetFlags.doTruth = (globalflags.InputFormat() == 'pool' and globalflags. #InDetFlags.doLowPt = False #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicCalibTemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicCalibTemplate.py index 053e5d23a96f4047f0dc327f748d90d857c32966..f6dceb0e3c109b9240a943f516adca6c3e28eca1 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicCalibTemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicCalibTemplate.py @@ -122,8 +122,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doVertexFinding = False diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicMCCalibTemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicMCCalibTemplate.py index 2ae56282414fd543de34193f603db0f89d81172d..8e776c2d9caf4efe0ac898c1cd27607d84517f0d 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicMCCalibTemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicMCCalibTemplate.py @@ -117,8 +117,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doVertexFinding = False diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicMCTemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicMCTemplate.py index 5b1cfd0f80725a181548226e0cb452bb7028e3a8..ad030dcad25e6d55bb946f820a38408e8b704b5b 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicMCTemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/CosmicMCTemplate.py @@ -125,8 +125,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doVertexFinding = False diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/ESDCalibTemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/ESDCalibTemplate.py index 0f684d973dbcc91f30fee474ac2e2dab8b93e067..2058489f0ca789fc01f2dd85de32e6328ca71dac 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/ESDCalibTemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/ESDCalibTemplate.py @@ -132,8 +132,6 @@ DetFlags.Print() # --- setup InDetJobProperties from InDetRecExample.InDetJobProperties import InDetFlags InDetFlags.preProcessing = False -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doNewTracking = False InDetFlags.doLowPt = False InDetFlags.doBackTracking = False diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/ESDTemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/ESDTemplate.py index f98b75b89b8a3faae679d7354fcc6dc91da68dcd..057254cd69ac5283c7c2dd6784355b41d219b7f7 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/ESDTemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/ESDTemplate.py @@ -142,8 +142,6 @@ InDetFlags.preProcessing = redoPatternRecoAndTracking InDetFlags.doPRDFormation = False # those two will be (later) automatically false if InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing is false InDetFlags.doNewTracking = redoPatternRecoAndTracking -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doCTBTracking = False InDetFlags.doBackTracking = redoPatternRecoAndTracking diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/RAWHITemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/RAWHITemplate.py index 7b4a078488b0c873dfb9ddc2f4724c6afd9d2a1b..5e6e52226353cd57580e0e4ac9b841dac3381e82 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/RAWHITemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/RAWHITemplate.py @@ -135,8 +135,6 @@ InDetFlags.doTruth = (globalflags.InputFormat() == 'pool' and globalflags. #InDetFlags.doLowPt = False #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = True #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/SingleBeamTemplate.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/SingleBeamTemplate.py index 4e6e6e4fa664543d5ec9a050b4db1fe52bb5182d..5e4a1bc02e95d707a1c6baaa81f181f623155c14 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/SingleBeamTemplate.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/SingleBeamTemplate.py @@ -103,8 +103,6 @@ InDetFlags.doNewTracking = False #InDetFlags.doLowPt = True InDetFlags.doBeamGas = True InDetFlags.doBeamHalo = True -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = True #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/joboptionsFullReco.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/joboptionsFullReco.py index 48da0d9173af385e4d467b4b1ef3b0ba3acca5da..b03f998135e64bda30ef322dda2d909bb576e3f9 100755 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/joboptionsFullReco.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/joboptionsFullReco.py @@ -129,8 +129,6 @@ InDetFlags.doTruth = (globalflags.InputFormat() == 'pool' and globalflags. #InDetFlags.doLowPt = False #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = True #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/joboptionsRefitting.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/joboptionsRefitting.py index 5b766bce8b00fd0b99b0f2c2c2aaf28017d50939..4db4ba371e4b9ff309b176fbf30fb1626feacd04 100644 --- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/joboptionsRefitting.py +++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/joboptionsRefitting.py @@ -122,8 +122,6 @@ InDetFlags.doTruth = (globalflags.InputFormat() == 'pool' and globalflags. #InDetFlags.doLowPt = False #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetConditions/SiLorentzAngleTool/python/PixelLorentzAngleConfig.py b/InnerDetector/InDetConditions/SiLorentzAngleTool/python/PixelLorentzAngleConfig.py index 182b15ce3efab0d71a47cf7e7435ed598f973fe8..0bdc604c483353a743953225666972291745768c 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleTool/python/PixelLorentzAngleConfig.py +++ b/InnerDetector/InDetConditions/SiLorentzAngleTool/python/PixelLorentzAngleConfig.py @@ -1,6 +1,6 @@ -"""Define methods to configure SCTLorentzAngleTool +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +"""Define methods to configure SCTLorentzAngleTool """ from SiPropertiesTool.PixelSiPropertiesConfig import PixelSiPropertiesCfg from AthenaConfiguration.ComponentFactory import CompFactory @@ -13,7 +13,7 @@ from PixelConditionsAlgorithms.PixelConditionsConfig import ( PixelDCSCondStateAlgCfg, PixelDCSCondStatusAlgCfg ) -def PixelLorentzAngleToolCfg(flags, name="PixelLorentzAngleTool", **kwargs): +def PixelLorentzAngleTool(flags, name="PixelLorentzAngleTool", **kwargs): """Return a SiLorentzAngleTool configured for Pixel""" kwargs.setdefault("DetectorName", "Pixel") kwargs.setdefault("SiLorentzAngleCondData", "PixelSiLorentzAngleCondData") @@ -27,7 +27,7 @@ def PixelLorentzAngleCfg(flags, name="PixelSiLorentzAngleCondAlg", **kwargs): SiLorentzAngleTool may be provided in kwargs """ acc = MagneticFieldSvcCfg(flags) - tool = kwargs.get("SiLorentzAngleTool", PixelLorentzAngleToolCfg(flags)) + tool = kwargs.get("SiLorentzAngleTool", PixelLorentzAngleTool(flags)) acc.merge(PixelDCSCondHVAlgCfg(flags)) acc.merge(PixelDCSCondTempAlgCfg(flags)) acc.merge(PixelDCSCondStateAlgCfg(flags)) diff --git a/InnerDetector/InDetConfig/python/ClusterizationConfig.py b/InnerDetector/InDetConfig/python/ClusterizationConfig.py index cb052973e58c1648851ee87f1470b4b26dc9beb5..6600159e2bfd9de4b3efb1c3deb873d4229c4dad 100644 --- a/InnerDetector/InDetConfig/python/ClusterizationConfig.py +++ b/InnerDetector/InDetConfig/python/ClusterizationConfig.py @@ -56,7 +56,7 @@ def InDetClusterizationAlgorithmsCfg(flags, **kwargs) : return top_acc if __name__ == "__main__": - # Run this with python -m InDetConfig.PixelClusterizationConfig + # Run this with python -m InDetConfig.ClusterizationConfig from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=1 diff --git a/InnerDetector/InDetConfig/python/InDetConfigFlags.py b/InnerDetector/InDetConfig/python/InDetConfigFlags.py index 36eaaf1571ca5c86673cc0b8385327a28a61b475..3182f4d5d794377467a87285e5d7aa30bb7cf865 100644 --- a/InnerDetector/InDetConfig/python/InDetConfigFlags.py +++ b/InnerDetector/InDetConfig/python/InDetConfigFlags.py @@ -16,8 +16,6 @@ def createInDetConfigFlags(): icf.addFlag("InDet.doPseudoTracking", False ) # Turn running of the truth seeded pseudo tracking on and off icf.addFlag("InDet.doIdealPseudoTracking", True) # Run pseudoTracking with 100\% hit assignment efficiency icf.addFlag("InDet.doSplitReco", False ) # Turn running of the truth seeded pseudo tracking only for pileup on and off. Only makes sense to run on RDO file where SplitDigi was used! - icf.addFlag("InDet.doxKalman", False) # Turn running of xKalman on and off - icf.addFlag("InDet.doiPatRec", False ) # Turn running of iPatRec on and off icf.addFlag("InDet.preProcessing", True) # Turn running of pre processing on and off icf.addFlag("InDet.doPRDFormation", True) # Turn running of PRD formation on and off icf.addFlag("InDet.doPixelPRDFormation", True) # Turn running of pixel PRD formation on and off diff --git a/InnerDetector/InDetConfig/python/InDetRecToolConfig.py b/InnerDetector/InDetConfig/python/InDetRecToolConfig.py index 4a8af9d83c7031544e9828b4d02e0cc73dd027dc..296f541fa1d68a7d436d3924127c3279a1de3e44 100644 --- a/InnerDetector/InDetConfig/python/InDetRecToolConfig.py +++ b/InnerDetector/InDetConfig/python/InDetRecToolConfig.py @@ -225,9 +225,10 @@ def InDetSCT_ConditionsSummaryToolCfg(flags, name = "InDetSCT_ConditionsSummaryT else : ConditionsTools= [ SCT_ConfigurationConditionsTool, - SCT_FlaggedConditionTool, SCT_MonitorConditionsTool, SCT_ReadCalibDataTool] + if withFlaggedCondTool: + ConditionsTools.append(SCT_FlaggedConditionTool) if flags.InDet.useSctDCS: ConditionsTools += [ SCT_DCSConditionsTool ] diff --git a/InnerDetector/InDetConfig/python/TrackReco.py b/InnerDetector/InDetConfig/python/TrackReco.py index 1bb9b9a5619095d0f60c5c110c90af57dfb5d1fa..3d2c6a8040a471555552a0dbac219430f18dc7d6 100644 --- a/InnerDetector/InDetConfig/python/TrackReco.py +++ b/InnerDetector/InDetConfig/python/TrackReco.py @@ -2,28 +2,25 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -from AthenaConfiguration.UnifyProperties import unifySet,_propsToUnify -_propsToUnify['THistSvc.Output'] = unifySet ##------------------------------------------------------------------------------ def InDetBCM_ZeroSuppressionCfg(flags, **kwargs): - from BCM_ZeroSuppression.BCM_ZeroSuppressionConf import BCM_ZeroSuppression acc = ComponentAccumulator() kwargs.setdefault("BcmContainerName", "BCM_RDOs") - algo = BCM_ZeroSuppression("InDetBCM_ZeroSuppression", **kwargs) + algo = CompFactory.BCM_ZeroSuppression("InDetBCM_ZeroSuppression", **kwargs) acc.addEventAlgo(algo, primary = True) return acc ##------------------------------------------------------------------------------ def InDetPixelClusterizationCfg(flags, **kwargs) : - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator acc = ComponentAccumulator() - from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__PixelClusterization - sub_acc,merged_pixels_tool = InDetMergedPixelsToolCfg(flags, **kwargs) + sub_acc = InDetMergedPixelsToolCfg(flags, **kwargs) + merged_pixels_tool = sub_acc.getPrimary() acc.merge(sub_acc) - sub_acc,ambi_finder = InDetPixelGangedAmbiguitiesFinderCfg(flags) + sub_acc = InDetPixelGangedAmbiguitiesFinderCfg(flags) + ambi_finder=sub_acc.getPrimary() acc.merge(sub_acc) - acc.addEventAlgo( InDet__PixelClusterization( name = "InDetPixelClusterization", + acc.addEventAlgo( CompFactory.InDet.PixelClusterization( name = "InDetPixelClusterization", clusteringTool = merged_pixels_tool, gangedAmbiguitiesFinder = ambi_finder, DataObjectName = "PixelRDOs", @@ -41,22 +38,17 @@ def InDetPixelClusterizationPUCfg(flags, **kwargs) : ##------------------------------------------------------------------------------ def InDet_SCTClusterizationCfg(flags, **kwargs) : - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator acc = ComponentAccumulator() - ##################### - from SCT_ConditionsTools.SCT_ConditionsSummaryToolSetup import SCT_ConditionsSummaryToolSetup - sct_ConditionsSummaryToolSetup = SCT_ConditionsSummaryToolSetup() - sct_ConditionsSummaryToolSetup.setup() - sct_ConditionsSummaryToolSetupWithoutFlagged = SCT_ConditionsSummaryToolSetup("InDetSCT_ConditionsSummaryToolWithoutFlagged") - sct_ConditionsSummaryToolSetupWithoutFlagged.setup() - InDetSCT_ConditionsSummaryToolWithoutFlagged = sct_ConditionsSummaryToolSetupWithoutFlagged.getTool() + # Need to get SCT_ConditionsSummaryTool for e.g. SCT_ClusteringTool + from InDetConfig.InDetRecToolConfig import InDetSCT_ConditionsSummaryToolCfg + InDetSCT_ConditionsSummaryToolWithoutFlagged = acc.popToolsAndMerge(InDetSCT_ConditionsSummaryToolCfg(flags,withFlaggedCondTool=False)) #### Clustering tool ###### - accbuf, InDetClusterMakerTool = InDetClusterMakerToolCfg(flags, **kwargs) + accbuf = InDetClusterMakerToolCfg(flags, **kwargs) + InDetClusterMakerTool = accbuf.getPrimary() acc.merge(accbuf) - from SiClusterizationTool.SiClusterizationToolConf import InDet__SCT_ClusteringTool - InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool( name = "InDetSCT_ClusteringTool", + InDetSCT_ClusteringTool = CompFactory.InDet.SCT_ClusteringTool( name = "InDetSCT_ClusteringTool", globalPosAlg = InDetClusterMakerTool, conditionsTool = InDetSCT_ConditionsSummaryToolWithoutFlagged) if flags.InDet.selectSCTIntimeHits : @@ -65,8 +57,7 @@ def InDet_SCTClusterizationCfg(flags, **kwargs) : else: InDetSCT_ClusteringTool.timeBins = "X1X" - from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__SCT_Clusterization - acc.addEventAlgo( InDet__SCT_Clusterization( name = "InDetSCT_Clusterization", + acc.addEventAlgo( CompFactory.InDet.SCT_Clusterization( name = "InDetSCT_Clusterization", clusteringTool = InDetSCT_ClusteringTool, DataObjectName = 'SCT_RDOs', ##InDetKeys.SCT_RDOs(), ClustersName = 'SCT_Clusters', ##InDetKeys.SCT_Clusters(), @@ -87,17 +78,14 @@ def InDet_SCTClusterizationPUCfg(flags, **kwargs) : ##------------------------------------------------------------------------------ def InDetPixelGangedAmbiguitiesFinderCfg(flags) : - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator acc = ComponentAccumulator() - from SiClusterizationTool.SiClusterizationToolConf import InDet__PixelGangedAmbiguitiesFinder - InDetPixelGangedAmbiguitiesFinder = InDet__PixelGangedAmbiguitiesFinder( name = "InDetPixelGangedAmbiguitiesFinder") - acc.addPublicTool( InDetPixelGangedAmbiguitiesFinder ) - return acc,InDetPixelGangedAmbiguitiesFinder + InDetPixelGangedAmbiguitiesFinder = CompFactory.InDet.PixelGangedAmbiguitiesFinder( name = "InDetPixelGangedAmbiguitiesFinder") + acc.addPublicTool( InDetPixelGangedAmbiguitiesFinder, primary=True) + return acc ##------------------------------------------------------------------------------ def InDetMergedPixelsToolCfg(flags, **kwargs) : - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator acc = ComponentAccumulator() clusterSplitProbTool = None clusterSplitterTool = None @@ -107,20 +95,19 @@ def InDetMergedPixelsToolCfg(flags, **kwargs) : if flags.InDet.pixelClusterSplittingType == 'NeuralNet': useBeamConstraint = flags.InDet.useBeamConstraint - from SiLorentzAngleTool.PixelLorentzAngleConfig import PixelLorentzAngleToolCfg + from SiLorentzAngleTool.PixelLorentzAngleConfig import PixelLorentzAngleTool + # --- new NN prob tool - from SiClusterizationTool.SiClusterizationToolConf import InDet__NnClusterizationFactory - NnClusterizationFactory = InDet__NnClusterizationFactory( name = "NnClusterizationFactory", - PixelLorentzAngleTool = PixelLorentzAngleToolCfg( flags ), + NnClusterizationFactory = CompFactory.InDet.NnClusterizationFactory( name = "NnClusterizationFactory", + PixelLorentzAngleTool = PixelLorentzAngleTool( flags ), useToT = flags.InDet.doNNToTCalibration, NnCollectionReadKey = "PixelClusterNN", NnCollectionWithTrackReadKey = "PixelClusterNNWithTrack") - MultiplicityContent = [1 , 1 , 1] if flags.InDet.doSLHC: - from SiClusterizationTool.SiClusterizationToolConf import InDet__TruthPixelClusterSplitProbTool as PixelClusterSplitProbTool + PixelClusterSplitProbTool=CompFactory.InDet.TruthPixelClusterSplitProbTool else: - from SiClusterizationTool.SiClusterizationToolConf import InDet__NnPixelClusterSplitProbTool as PixelClusterSplitProbTool + PixelClusterSplitProbTool=CompFactory.InDet.NnPixelClusterSplitProbTool NnPixelClusterSplitProbTool=PixelClusterSplitProbTool(name = "NnPixelClusterSplitProbTool", PriorMultiplicityContent = MultiplicityContent, NnClusterizationFactory = NnClusterizationFactory, @@ -129,9 +116,9 @@ def InDetMergedPixelsToolCfg(flags, **kwargs) : clusterSplitProbTool = NnPixelClusterSplitProbTool # --- new NN splitter if flags.InDet.doSLHC : - from SiClusterizationTool.SiClusterizationToolConf import InDet__TruthPixelClusterSplitter as PixelClusterSplitter + PixelClusterSplitter=CompFactory.InDet.TruthPixelClusterSplitter else: - from SiClusterizationTool.SiClusterizationToolConf import InDet__NnPixelClusterSplitter as PixelClusterSplitter + PixelClusterSplitter=CompFactory.InDet.NnPixelClusterSplitter NnPixelClusterSplitter=PixelClusterSplitter( name = "NnPixelClusterSplitter", NnClusterizationFactory = NnClusterizationFactory, ThresholdSplittingIntoTwoClusters = 0.5, ##InDet.pixelClusterSplitProb1, ###0.5, # temp. @@ -142,22 +129,17 @@ def InDetMergedPixelsToolCfg(flags, **kwargs) : clusterSplitterTool = NnPixelClusterSplitter # --- Neutral Network version ? elif flags.InDet.pixelClusterSplittingType == 'AnalogClus': - # new splitter tool - from SiClusterizationTool.SiClusterizationToolConf import InDet__TotPixelClusterSplitter - TotPixelClusterSplitter=InDet__TotPixelClusterSplitter (name = "TotPixelClusterSplitter") - # remember splitter tool - clusterSplitterTool = TotPixelClusterSplitter + # new splitter tool & remember splitter tool + clusterSplitterTool=CompFactory.InDet.TotPixelClusterSplitter (name = "TotPixelClusterSplitter") - # --- now load the framework for the clustering - #from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool - #InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") + #InDetClusterMakerTool = CompFactory.InDet.ClusterMakerTool(name = "InDetClusterMakerTool") #acc.addPublicTool(InDetClusterMakerTool) - accbuf, InDetClusterMakerTool = InDetClusterMakerToolCfg(flags, **kwargs) + accbuf = InDetClusterMakerToolCfg(flags, **kwargs) + InDetClusterMakerTool = accbuf.getPrimary() acc.merge(accbuf) - from SiClusterizationTool.SiClusterizationToolConf import InDet__MergedPixelsTool - InDetMergedPixelsTool = InDet__MergedPixelsTool( name = "InDetMergedPixelsTool", + InDetMergedPixelsTool = CompFactory.InDet.MergedPixelsTool( name = "InDetMergedPixelsTool", globalPosAlg = InDetClusterMakerTool, MinimalSplitSize = 0, MaximalSplitSize = 49, @@ -167,21 +149,16 @@ def InDetMergedPixelsToolCfg(flags, **kwargs) : if not flags.InDet.doTIDE_Ambi and clusterSplitProbTool is not None : InDetMergedPixelsTool.SplitProbTool = clusterSplitProbTool if not flags.InDet.doTIDE_Ambi and clusterSplitterTool is not None : InDetMergedPixelsTool.ClusterSplitter = clusterSplitterTool - sub_acc = ComponentAccumulator() - acc.addPublicTool(InDetMergedPixelsTool) - acc.merge(sub_acc) - return acc,InDetMergedPixelsTool + acc.addPublicTool(InDetMergedPixelsTool, primary=True) + return acc ##------------------------------------------------------------------------------ def InDetClusterMakerToolCfg(flags, **kwargs) : - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator acc = ComponentAccumulator() - from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool - InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") - SiLorentzAngleTool=CompFactory.SiLorentzAngleTool + InDetClusterMakerTool = CompFactory.InDet.ClusterMakerTool(name = "InDetClusterMakerTool") - SCTLorentzAngleTool = SiLorentzAngleTool(name = "SCTLorentzAngleTool", DetectorName="SCT", SiLorentzAngleCondData="SCTSiLorentzAngleCondData") + SCTLorentzAngleTool = CompFactory.SiLorentzAngleTool(name = "SCTLorentzAngleTool", DetectorName="SCT", SiLorentzAngleCondData="SCTSiLorentzAngleCondData") SCTLorentzAngleTool.UseMagFieldCache = True acc.addPublicTool(SCTLorentzAngleTool) - acc.addPublicTool(InDetClusterMakerTool) - return acc,InDetClusterMakerTool + acc.addPublicTool(InDetClusterMakerTool, primary=True) + return acc diff --git a/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx b/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx index b13a9f87abbf1387be89f2dc615321cda64fabae..40821739be5fa40d80d9100024cec72854d55967 100644 --- a/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx @@ -114,7 +114,9 @@ void BCM_DigitizationTool::processSiHit(const SiHit ¤tHit, double eventTim m_enerVect[moduleNo].push_back(enerDep); m_timeVect[moduleNo].push_back(hitTime); // Create new deposit and add to vector - HepMcParticleLink particleLink(currentHit.trackNumber(), evtIndex); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (evtIndex==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink particleLink{HepMcParticleLink(currentHit.trackNumber(), evtIndex, evColl, idxFlag)}; const int barcode = particleLink.barcode(); if (barcode == 0 || barcode == 10001){ return; diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt index 8b683fa51f9cd6c6cdbc422ce34dd583d010c569..4d0791002f9272896ab5c0e849f57f1b9d80e287 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt @@ -38,20 +38,20 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkExtrapolation/TrkExUtils Tracking/TrkDigitization/TrkDigEvent Tracking/TrkDigitization/TrkDigInterfaces - DetectorDescription/GeoPrimitives ) + DetectorDescription/GeoPrimitives + Generators/AtlasHepMC ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( FastSiDigitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib EventPrimitives xAODEventInfo GaudiKernel InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry InDetSimData InDetPrepRawData SiClusterizationToolLib InDetSimEvent HitManagement ISF_FatrasDetDescrModel ISF_FatrasEvent TrkTruthData StoreGateLib SGtests Identifier GeneratorObjects InDetIdentifier TrkDetDescrInterfaces TrkDigEvent TrkGeometry TrkSurfaces TrkExUtils ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel PileUpToolsLib EventPrimitives xAODEventInfo GaudiKernel InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry InDetSimData InDetPrepRawData SiClusterizationToolLib InDetSimEvent HitManagement ISF_FatrasDetDescrModel ISF_FatrasEvent TrkTruthData StoreGateLib SGtests Identifier GeneratorObjects InDetIdentifier TrkDetDescrInterfaces TrkDigEvent TrkGeometry TrkSurfaces TrkExUtils ) # Install files from the package: atlas_install_headers( FastSiDigitization ) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx index b7b0b87df9b66d54236d1922c4c2f6a1bb09408e..4a59f62aad3d53f64b82e15bc8e0624051b1455e 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx @@ -45,7 +45,7 @@ #include "AthenaKernel/IAtRndmGenSvc.h" #include "GeneratorObjects/HepMcParticleLink.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" //Package For New Tracking: // Amg includes diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx index 706125523db95d4ce23a83bf7fef5a8dc9721175..aa8fd1750f7f7fb9cb8a1c1aa91cade076af5716 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx @@ -36,7 +36,7 @@ #include "GaudiKernel/SystemOfUnits.h" #include "GeneratorObjects/HepMcParticleLink.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // CLHEP #include "CLHEP/Random/RandomEngine.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt index 08abafa159422dc92c656dd0de94f5c620a2b154..ffcbb486feeb225131774d58b76cc901bb1ce382 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt @@ -16,6 +16,7 @@ atlas_depends_on_subdirs( PUBLIC Control/StoreGate DetectorDescription/Identifier Generators/GeneratorObjects + Generators/AtlasHepMC InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetConditions/InDetCondTools InnerDetector/InDetConditions/PixelConditionsTools @@ -34,15 +35,14 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Matrix TreePlayer ) # Component(s) in the package: atlas_add_component( PixelDigitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel CommissionEvent AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier GeneratorObjects PixelConditionsData SiPropertiesToolLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiDigitization InDetRawData InDetSimData InDetSimEvent HitManagement PathResolver ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel CommissionEvent AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier GeneratorObjects PixelConditionsData SiPropertiesToolLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiDigitization InDetRawData InDetSimData InDetSimEvent HitManagement PathResolver ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx index 9cf0b01b2fe80cd05da03fd26fce0f7cf0b20fb3..4f108ea9aa254d2054003c515463305c2f2d76a8 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx @@ -14,9 +14,9 @@ #include "InDetIdentifier/PixelID.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "SiPropertiesTool/SiliconProperties.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "PathResolver/PathResolver.h" #include <fstream> @@ -137,10 +137,12 @@ StatusCode EnergyDepositionTool::finalize() { StatusCode EnergyDepositionTool::depositEnergy(const TimedHitPtr<SiHit> &phit, const InDetDD::SiDetectorElement &Module, std::vector<std::pair<double,double> > &trfHitRecord, std::vector<double> &initialConditions, CLHEP::HepRandomEngine *rndmEngine){ ATH_MSG_DEBUG("Deposit energy in sensor volume."); - + //Check if simulated particle or delta ray - const HepMcParticleLink McLink = HepMcParticleLink(phit->trackNumber(),phit.eventId()); - const HepMC::GenParticle* genPart= McLink.cptr(); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (phit.eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink McLink{HepMcParticleLink(phit->trackNumber(), phit.eventId(), evColl, idxFlag)}; + const HepMC::GenParticle* genPart= McLink.cptr(); bool delta_hit = true; if (genPart) delta_hit = false; double sensorThickness = Module.design().thickness(); diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.cxx index 3f733170edde9efaa261775826757bba250ed491..440a2e9f552d1ab3516c0cbb6b0447bde8d50851 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.cxx @@ -15,9 +15,9 @@ #include "InDetIdentifier/PixelID.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "SiPropertiesTool/SiliconProperties.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "PathResolver/PathResolver.h" #include <fstream> diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSim3DTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSim3DTool.cxx index f3a52c36b1502b33aad120c90ab2ab8c016e6d80..2f3474393ed4d5c6cb4438477c904032d92d63b7 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSim3DTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSim3DTool.cxx @@ -11,9 +11,9 @@ #include "GeneratorObjects/HepMcParticleLink.h" #include "SiPropertiesTool/SiliconProperties.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandGaussZiggurat.h" @@ -228,7 +228,9 @@ StatusCode SensorSim3DTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiCharg double pixel_size_y = Module.length()/p_design.columns(); double module_size_x = Module.width(); double module_size_y = Module.length(); - + + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (phit.eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; if (m_doRadDamage && m_fluence>0) { //**************************************// //*** Now diffuse charges to surface *** // @@ -392,7 +394,7 @@ StatusCode SensorSim3DTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiCharg double y_mod = y_pix + yNeighbor + pixel_size_y * extraNPixY - module_size_y / 2.; SiLocalPosition chargePos = Module.hitLocalToLocal(y_mod, x_mod); - SiSurfaceCharge scharge(chargePos, SiCharge(induced_charge, hitTime(phit), SiCharge::track, HepMcParticleLink(phit->trackNumber(), phit.eventId()))); + SiSurfaceCharge scharge(chargePos, SiCharge(induced_charge, hitTime(phit), SiCharge::track, HepMcParticleLink(phit->trackNumber(), phit.eventId(), evColl, idxFlag))); SiCellId diode = Module.cellIdOfPosition(scharge.position()); SiCharge charge = scharge.charge(); if (diode.isValid()) { @@ -486,7 +488,7 @@ StatusCode SensorSim3DTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiCharg double y_mod = y_neighbor + pixel_size_y/2 + pixel_size_y*nPixY -module_size_y/2.; SiLocalPosition chargePos = Module.hitLocalToLocal(y_mod,x_mod); - SiSurfaceCharge scharge(chargePos,SiCharge(ed,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId()))); + SiSurfaceCharge scharge(chargePos,SiCharge(ed,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId(),evColl,idxFlag))); SiCellId diode = Module.cellIdOfPosition(scharge.position()); SiCharge charge = scharge.charge(); if (diode.isValid()) { diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx index 43c50767f4afc297aed9f3d07388a1db0422c3af..985ac58eebcbad5deace49ca5b680f9de8053551 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx @@ -10,9 +10,9 @@ #include "InDetIdentifier/PixelID.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "SiPropertiesTool/SiliconProperties.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandGaussZiggurat.h" @@ -407,6 +407,9 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC double tanLorentz = m_lorentzAngleTool->getTanLorentzAngle(Module.identifyHash()); double coLorentz=sqrt(1+pow(tanLorentz,2)); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (phit.eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + //**************************************// //*** Now diffuse charges to surface *** // //**************************************// @@ -621,8 +624,8 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC SiLocalPosition chargePos = Module.hitLocalToLocal( centreOfPixel_nn.xEta(), centreOfPixel_nn.xPhi() ); //The following lines are adapted from SiDigitization's Inserter class - SiSurfaceCharge scharge_e( chargePos,SiCharge( induced_charge_e,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId()))); - SiSurfaceCharge scharge_h( chargePos,SiCharge( induced_charge_h,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId()))); + SiSurfaceCharge scharge_e( chargePos,SiCharge( induced_charge_e,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId(),evColl,idxFlag))); + SiSurfaceCharge scharge_h( chargePos,SiCharge( induced_charge_h,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId(),evColl,idxFlag))); SiCellId diode = Module.cellIdOfPosition(scharge_e.position()); SiCharge charge_e = scharge_e.charge(); SiCharge charge_h = scharge_h.charge(); @@ -664,7 +667,7 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC } //The following lines are adapted from SiDigitization's Inserter class - SiSurfaceCharge scharge(chargePos,SiCharge(ed,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId()))); + SiSurfaceCharge scharge(chargePos,SiCharge(ed,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId(),evColl,idxFlag))); SiCellId diode = Module.cellIdOfPosition(scharge.position()); diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DetailedSurfaceChargesGenerator.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DetailedSurfaceChargesGenerator.cxx index 287726a9cf67dcd74d3d2633ab38c15e377bd3b6..93c63b2d19ac24a7cf3e64a2f4bad3409b91f1d2 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DetailedSurfaceChargesGenerator.cxx +++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DetailedSurfaceChargesGenerator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_DetailedSurfaceChargesGenerator.h" @@ -324,7 +324,9 @@ void SCT_DetailedSurfaceChargesGenerator::processSiHit(const SiDetectorElement* //check the status of truth information for this SiHit //some Truth information is cut for pile up events - HepMcParticleLink trklink{HepMcParticleLink(phit.trackNumber(), p_eventId)}; + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (p_eventId==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink trklink{HepMcParticleLink(phit.trackNumber(), p_eventId, evColl, idxFlag)}; SiCharge::Process hitproc{SiCharge::track}; if (phit.trackNumber()!=0) { if (not trklink.isValid()) { diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_SurfaceChargesGenerator.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_SurfaceChargesGenerator.cxx index 87dfdab4aef3cab00ad037dc20ce136a61a5d1b3..c1a4d63885f91530eaeec34bf692b7f85f5b88a7 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_SurfaceChargesGenerator.cxx +++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_SurfaceChargesGenerator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_SurfaceChargesGenerator.h" @@ -375,7 +375,9 @@ void SCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* element, // check the status of truth information for this SiHit // some Truth information is cut for pile up events - const HepMcParticleLink trklink{HepMcParticleLink(phit.trackNumber(), p_eventId)}; + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (p_eventId==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink trklink{HepMcParticleLink(phit.trackNumber(), p_eventId, evColl, idxFlag)}; SiCharge::Process hitproc{SiCharge::track}; if (phit.trackNumber() != 0) { if (not trklink.isValid()) { diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx index 2a2f37804a7d19f0c6ea05032ccaaa2125342af2..5063ecfaf8ef2a37cbe19863c7cc87a766647879 100644 --- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx @@ -428,10 +428,11 @@ StatusCode TRTDigitizationTool::processStraws(const EventContext& ctx, // Fill a vector of deposits depositVector.clear(); depositVector.reserve(std::distance(i,e)); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; for (TimedHitCollection<TRTUncompressedHit>::const_iterator hit_iter(i); hit_iter != e; ++hit_iter ) { - + const HepMcParticleLink::PositionFlag idxFlag = (hit_iter->eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; // suspect that we could use evtIndex here rather than hit_iter->eventId() // create a new deposit - InDetSimData::Deposit deposit( HepMcParticleLink((*hit_iter)->GetTrackID(), hit_iter->eventId()), (*hit_iter)->GetEnergyDeposit() ); + InDetSimData::Deposit deposit( HepMcParticleLink((*hit_iter)->GetTrackID(), hit_iter->eventId(), evColl, idxFlag), (*hit_iter)->GetEnergyDeposit() ); if(deposit.first.barcode()==0 || deposit.first.barcode() == m_vetoThisBarcode){ continue; } diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt index d290955864ce0d077518a4973dc28c05b9cdc8ab..fc0ecb7ee87812be31a132c6c2ae76767e0a57e9 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt @@ -29,19 +29,19 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetRecTools/TRT_DriftFunctionTool InnerDetector/InDetSimEvent Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkEvent/TrkTruthData ) + Tracking/TrkEvent/TrkTruthData + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( InDetPrepRawDataToxAOD src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps StoreGateLib SGtests Identifier InDetByteStreamErrors PixelConditionsData xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry TRT_ReadoutGeometry InDetRawData InDetSimData InDetPrepRawData InDetSimEvent TrkSurfaces TrkTruthData ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib GaudiKernel AthenaBaseComps StoreGateLib SGtests Identifier InDetByteStreamErrors PixelConditionsData xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry TRT_ReadoutGeometry InDetRawData InDetSimData InDetPrepRawData InDetSimEvent TrkSurfaces TrkTruthData ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx index 5461e2e0d846604f01560f9f542e6d22e0945068..0b2e20a09ed41311eb8cdf7513104df0072bc915 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx @@ -21,8 +21,8 @@ #include "TrkTruthData/PRD_MultiTruthCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "InDetSimEvent/SiHit.h" #include "InDetSimData/InDetSimDataCollection.h" diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx index 97dc81d6f99386f0d8f0d96b85e3fe7c23defe97..23cb80d4d03e852d5299d1de944333f58cda2a8b 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx @@ -17,7 +17,7 @@ #include "StoreGate/WriteHandle.h" #include "xAODTracking/TrackMeasurementValidationAuxContainer.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "CLHEP/Geometry/Point3D.h" diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx index b9dfee674d6e6ddd1b5d815ed55b0cc09b097bf9..07f4b1c0992ab006f3d53d2720eaa051463ea9b5 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "InDetSimEvent/SiHit.h" @@ -60,7 +60,7 @@ const double SiHitCollectionCnv_p3::m_2bHalfMaximum = pow(2.0, 15.0); const int SiHitCollectionCnv_p3::m_2bMaximum = (unsigned short)(-1); -void SiHitCollectionCnv_p3::transToPers(const SiHitCollection* transCont, SiHitCollection_p3* persCont, MsgStream &/*log*/) +void SiHitCollectionCnv_p3::transToPers(const SiHitCollection* transCont, SiHitCollection_p3* persCont, MsgStream &log) { // Finds hits belonging to a "string" (in which the end point of one hit is the same as the start point of the next) and // persistifies the end point of each hit plus the start point of the first hit in each string. @@ -98,11 +98,18 @@ void SiHitCollectionCnv_p3::transToPers(const SiHitCollection* transCont, SiHitC if ( !lastLink || (siHit->particleLink() != *lastLink) ) { - // store barcode once for set of consecutive hits with same barcode + // store barcode, eventIndex and McEventCollection once for set of consecutive hits with same barcode lastLink = &(siHit->particleLink()); persCont->m_barcode.push_back(lastLink->barcode()); - persCont->m_mcEvtIndex.push_back(lastLink->eventIndex()); + unsigned short index{0}; + if (lastLink->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) { + index = lastLink->eventIndex(); + if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { + log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; + } + } + persCont->m_mcEvtIndex.push_back(index); persCont->m_evtColl.push_back(lastLink->getEventCollectionAsChar()); if (idx > 0) { @@ -299,7 +306,11 @@ void SiHitCollectionCnv_p3::persToTrans(const SiHitCollection_p3* persCont, SiHi HepGeom::Point3D<double> endThis( endLast + r ); - HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), HepMcParticleLink::IS_INDEX ); + HepMcParticleLink::PositionFlag flag = HepMcParticleLink::IS_INDEX; + if (persCont->m_mcEvtIndex[idxBC] == 0) { + flag = HepMcParticleLink::IS_POSITION; + } + HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), flag ); transCont->Emplace( endLast, endThis, eneLoss, meanTime, partLink, persCont->m_id[idxId]); endLast = endThis; diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx index b9f85c1043db021f2654f455032ad3643bd608d8..4fb8405218da3e3f6af9266202ce809274d0977d 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "InDetSimEvent/TRTUncompressedHit.h" @@ -67,7 +67,14 @@ void TRT_HitCollectionCnv_p4::transToPers(const TRTUncompressedHitCollection* tr // store barcode once for set of consecutive hits with same barcode lastLink = &(trtHit->particleLink()); persCont->m_barcode.push_back(lastLink->barcode()); - persCont->m_mcEvtIndex.push_back(lastLink->eventIndex()); + unsigned short index{0}; + if (lastLink->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) { + index = lastLink->eventIndex(); + if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { + log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; + } + } + persCont->m_mcEvtIndex.push_back(index); persCont->m_evtColl.push_back(lastLink->getEventCollectionAsChar()); if ( idx > 0 ) { @@ -481,7 +488,11 @@ void TRT_HitCollectionCnv_p4::persToTrans(const TRT_HitCollection_p4* persCont, // - For charged particles kinEne is *zero*! // - HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), HepMcParticleLink::IS_INDEX ); + HepMcParticleLink::PositionFlag flag = HepMcParticleLink::IS_INDEX; + if (persCont->m_mcEvtIndex[idxBC] == 0) { + flag = HepMcParticleLink::IS_POSITION; + } + HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), flag ); transCont->Emplace( strawId, partLink, persCont->m_id[idxId], kinEne, hitEne, startX, startY, startZ, endX, endY, endZ, meanTime ); diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCnv_p1_test.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCnv_p1_test.cxx index 3ba814891c54543aa996065ee49039e588073f23..ecc75766f7384d1ec0a1d41a38b73282957aad0f 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCnv_p1_test.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" void compare (const HepMcParticleLink& p1, diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCollectionCnv_p2_test.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCollectionCnv_p2_test.cxx index 2729c87fb73d654b7b54d313035edadb8f8b598f..4e6fa39f52f104016cd1b9dc880a2cbe8c1f99cb 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCollectionCnv_p2_test.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCollectionCnv_p2_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" void compare (const HepMcParticleLink& p1, diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCollectionCnv_p3_test.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCollectionCnv_p3_test.cxx index 597f9d21137e85bf4102ea6657168b28029f6183..d66def373f6afb9029afef1cf53a4c78fcbdb050 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCollectionCnv_p3_test.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/SiHitCollectionCnv_p3_test.cxx @@ -17,8 +17,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" void compare (const HepMcParticleLink& p1, diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCnv_p1_test.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCnv_p1_test.cxx index b0947c43205b7f1da710ec821cb98977bfd3f386..172512e34d525988e3e71114cbb4edaf0feeff8c 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCnv_p1_test.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" void compare (const HepMcParticleLink& p1, const HepMcParticleLink& p2) diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p2_test.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p2_test.cxx index de1afb5f4ae4d2e4119e774bba1b08064ba828e8..6eff0faf8819c2ed4f9111baf3d23d07765d108e 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p2_test.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p2_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" void compare (const HepMcParticleLink& p1, const HepMcParticleLink& p2) diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p3_test.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p3_test.cxx index 19d3c099edebc513fdce461c992acf2038671577..4f9b1cdff529201948c0b2f05309c404dbb5de0a 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p3_test.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p3_test.cxx @@ -20,8 +20,8 @@ #include <cmath> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" using Athena_test::isEqual; using std::atan2; diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p4_test.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p4_test.cxx index d57eccd700d56ff85ef989a928bb735fe8f33306..7cd6335bba46c70f4898702628708e1162261c98 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p4_test.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/test/TRT_HitCollectionCnv_p4_test.cxx @@ -20,8 +20,8 @@ #include <cmath> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" using Athena_test::isEqual; using std::atan2; diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/share/PixelFlags.py b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/share/PixelFlags.py index 68e5938d89218fa3e27f5394c818b6ccf4c17301..8f0488671c91024eec52fd55735db67848906667 100644 --- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/share/PixelFlags.py +++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/share/PixelFlags.py @@ -18,8 +18,6 @@ class ConfiguredInDetFlags : self.__AODall = False if self.__AODall: - InDetJobProperties.iPatRec = False - InDetJobProperties.xKalman = False InDetJobProperties.newTracking = False # # -------------------------------------------------------------------- @@ -99,10 +97,6 @@ class ConfiguredInDetFlags : # ---- legacy pattern algorithms plus conversions # -------------------------------------------------------------------- # - # control whether to run xKalman (default=true) - self.__doxKalman = False - # control whether to run iPatRec (default=true) - self.__doiPatRec = False # control if legacy conversion is needed self.__doLegacyConversion = False # @@ -250,8 +244,8 @@ class ConfiguredInDetFlags : def setAODall (self) : self.__AODall = True - if not self.__doxKalman or not self.__doiPatRec or not self.__doNewTracking: - print "ERROR - inconsistent AOD all setup - xkal+ipat+NT needed" + if not self.__doNewTracking: + print "ERROR - inconsistent AOD all setup - NT needed" raise None # ---------------------------------------------------------------------------- @@ -385,13 +379,6 @@ class ConfiguredInDetFlags : def doSpacePointFormation(self) : return self.__doSpacePointFormation - # return - def doxKalman(self) : - return self.__doxKalman - - # return - def doiPatRec(self) : - return self.__doiPatRec # return def doLegacyConversion(self) : @@ -622,10 +609,6 @@ class ConfiguredInDetFlags : print '* TrackFinding:' print '* =============' print '*' - if self.__doxKalman : - print '* - run xKalman' - if self.__doiPatRec : - print '* - run iPatRec' if self.__doLegacyConversion : print '* - convert output to new EDM (TrkTrack)' print '*' diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/share/PixelRec_jobOptions.py b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/share/PixelRec_jobOptions.py index fa1c6d2918d22b31a77b67dd94e560d90f169466..71e9762e6bd38a4b87a3d12f03af79a9ca341f79 100644 --- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/share/PixelRec_jobOptions.py +++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/share/PixelRec_jobOptions.py @@ -78,14 +78,7 @@ if not 'TrackCollectionKeys' in dir(): if not 'TrackCollectionTruthKeys' in dir(): TrackCollectionTruthKeys = [] -# ------------------------------------------------------------ -# -# ----------- now we do legacy pattern if requested -# -# ------------------------------------------------------------ -# -if InDetFlags.doxKalman() or InDetFlags.doiPatRec(): - include ("InDetRecExample/InDetRecXKalIPat.py") + # ------------------------------------------------------------ # @@ -150,16 +143,12 @@ else : # # ------------------------------------------------------------ -if InDetFlags.doxKalman() or InDetFlags.doiPatRec() or InDetFlags.doNewTracking(): +if InDetFlags.doNewTracking(): # # Pick one of the result collections and turn it into tracks # if InDetFlags.doNewTracking(): InputTrackCollection = NewTrackingCollection - elif InDetFlags.doiPatRec(): - InputTrackCollection = "ConvertedIPatTracks" - elif InDetFlags.doxKalman(): - InputTrackCollection = "ConvertedXKalmanTracks" # # --- we either refit or copy the input # diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/ReadInDet_jobOptions.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/ReadInDet_jobOptions.py index 9e9a1eba8d841f481b2f87ec83860fdb6d7251b4..90302fcf6cdedde0367546ea4801c993a64ce4ae 100755 --- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/ReadInDet_jobOptions.py +++ b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/ReadInDet_jobOptions.py @@ -147,8 +147,6 @@ InDetFlags.preProcessing = redoPatternRecoAndTracking InDetFlags.doPRDFormation = False # those two will be (later) automatically false if InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing is false InDetFlags.doNewTracking = redoPatternRecoAndTracking -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doCTBTracking = False InDetFlags.doBackTracking = redoPatternRecoAndTracking diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptions.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptions.py index 153ae1ffd85fa3375039f9212673ebe0c64532f8..97e041aa0804dc2c203f6f7083ff8d35c569ebca 100644 --- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptions.py +++ b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptions.py @@ -125,8 +125,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True #InDetFlags.doTRTStandalone = False @@ -190,8 +188,6 @@ if True: InDetFlags.doPRDFormation = False # those two will be (later) automatically false if InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing is false InDetFlags.doNewTracking = redoPatternRecoAndTracking - InDetFlags.doiPatRec = False - InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doCTBTracking = False InDetFlags.doBackTracking = redoPatternRecoAndTracking diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD.py index cdae51781a6c67cbc68a67c1c22d030d9b3bd330..4ba216425c638c50feb326877e55d741476af4b6 100755 --- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD.py +++ b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD.py @@ -125,8 +125,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True #InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsRAW.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsRAW.py index d06a63e37b1fb3b04f7f5f0309050ba40b04df89..e755feb279d0d00555b91c502c96f33d1ee3edba 100755 --- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsRAW.py +++ b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsRAW.py @@ -152,8 +152,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True #InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py index f7c5909f02fb1130b54d0aa245669bfbd8c24241..9b82a2e40d10ace6c67a3c683a3d7410a7a6e7ab 100644 --- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py +++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py @@ -185,9 +185,6 @@ InDetFlags.doNewTracking = True #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#if not Cosmics: -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True #InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py index fffb555b957ac95e2f007e400929590089b5e3ac..47605ba2dc6a6a0802d2e8a58474e168ce12218a 100644 --- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py +++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py @@ -221,9 +221,6 @@ else: #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -if not loadInDetRec_Options["Cosmics"]: - InDetFlags.doxKalman = False - InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True #InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py index 91801c35b6f9112f4e7d1409342ae0e1274db57d..1571e08b5f9ca2b25bcbcaa5d4d42f9abf0a9e62 100644 --- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py +++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py @@ -236,9 +236,6 @@ else: #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -if not loadInDetRec_Options["Cosmics"]: - InDetFlags.doxKalman = False - InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True #InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py index ba976d5671cb497896a6c02ab831efda3eb13913..76cb38370ed9e374e230571feded706da526e9b5 100644 --- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py +++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py @@ -193,9 +193,7 @@ InDetFlags.doNewTracking = True #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#if not Cosmics: -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False + #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True #InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/share/900GeV-BSToDPDTemplate.py b/InnerDetector/InDetExample/InDetBeamSpotExample/share/900GeV-BSToDPDTemplate.py index a21bd1f73b6715a9795053c12b97db461b9bf672..aad880a1b6f785673b0cbca64bd0db692cd973f0 100755 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/share/900GeV-BSToDPDTemplate.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/share/900GeV-BSToDPDTemplate.py @@ -126,8 +126,6 @@ InDetFlags.doTruth = jobConfig['doTruth'] #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/share/900GeV-FirstData-BSToDPDTemplate.py b/InnerDetector/InDetExample/InDetBeamSpotExample/share/900GeV-FirstData-BSToDPDTemplate.py index d11560b28710e9ebbb64d90df0a1f70c90e06c8e..88c57dd68961d853695d59f54d8295ef33ce44e0 100755 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/share/900GeV-FirstData-BSToDPDTemplate.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/share/900GeV-FirstData-BSToDPDTemplate.py @@ -116,8 +116,6 @@ InDetFlags.doTruth = jobConfig['doTruth'] #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/share/BSToDPDTemplate.py b/InnerDetector/InDetExample/InDetBeamSpotExample/share/BSToDPDTemplate.py index eda4f211e661a9328e491da1f3f2f6b227bb0966..e5c6e9f1d687fefb81c9f255d2eb049d0c27b5b9 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/share/BSToDPDTemplate.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/share/BSToDPDTemplate.py @@ -156,8 +156,6 @@ InDetFlags.doTruth = jobConfig['doTruth'] InDetFlags.doLowPt = jobConfig['doLowPt'] #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = True diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/share/ReadInDetRecFragment.py b/InnerDetector/InDetExample/InDetBeamSpotExample/share/ReadInDetRecFragment.py index 7964b740ccc48d30c6f812dd40026f5e44b398de..b72f51d419133480d6aee3573f81f00268a09484 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/share/ReadInDetRecFragment.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/share/ReadInDetRecFragment.py @@ -213,8 +213,6 @@ InDetFlags.preProcessing = redoPatternRecoAndTracking InDetFlags.doPRDFormation = False # those two will be (later) automatically false if InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing is false InDetFlags.doNewTracking = redoPatternRecoAndTracking -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doLowPt = jobConfig['doLowPt'] if jobConfig['doRobustReco']: try: diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py index 88fac7091b3905d8020bd12b0bf7c204159c5e82..6763a49094d6e71886b3bc727cdbd66dc1b9bd38 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py @@ -138,18 +138,6 @@ class doSplitReco(InDetFlagsJobProperty): statusOn = True allowedTypes = ['bool'] StoredValue = False - -class doxKalman(InDetFlagsJobProperty): - """Turn running of xKalman on and off""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - -class doiPatRec(InDetFlagsJobProperty): - """Turn running of iPatRec on and off""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = False class preProcessing(InDetFlagsJobProperty): """Turn running of pre processing on and off""" @@ -1258,8 +1246,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doTRTPhaseCalculation , False) self.checkThenSet(self.doTRTStandalone , True) self.checkThenSet(self.doForwardTracks , False) - self.checkThenSet(self.doxKalman , False) - self.checkThenSet(self.doiPatRec , False) self.checkThenSet(self.doBackTracking , False) self.checkThenSet(self.doVertexFinding , False) self.checkThenSet(self.doV0Finder , False) @@ -1278,8 +1264,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doSLHCConversionFinding, False) self.checkThenSet(self.doBeamGas , False) self.checkThenSet(self.doBeamHalo , False) - self.checkThenSet(self.doxKalman , False) - self.checkThenSet(self.doiPatRec , False) self.checkThenSet(self.doBackTracking , False) self.checkThenSet(self.doForwardTracks , False) self.checkThenSet(self.doTRTStandalone , True ) # *ME* this is different than 15.4.0 and before @@ -1318,8 +1302,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doForwardTracks , False) self.checkThenSet(self.doBeamGas , False) self.checkThenSet(self.doBeamHalo , False) - self.checkThenSet(self.doxKalman , False) - self.checkThenSet(self.doiPatRec , False) self.checkThenSet(self.doVertexFinding , True) self.checkThenSet(self.primaryVertexSetup , "DefaultFastFinding") self.checkThenSet(self.primaryVertexCutSetup , "HeavyIon") @@ -1347,8 +1329,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doSLHCConversionFinding, True ) self.checkThenSet(self.doBeamGas , False) self.checkThenSet(self.doBeamHalo , False) - self.checkThenSet(self.doxKalman , False) - self.checkThenSet(self.doiPatRec , False) self.checkThenSet(self.doBackTracking , False) self.checkThenSet(self.doTRTStandalone , False) self.checkThenSet(self.doForwardTracks , False) @@ -1380,8 +1360,6 @@ class InDetJobProperties(JobPropertyContainer): #self.checkThenSet(self.doVeryLowPt , False) #self.checkThenSet(self.doBeamGas , False) #self.checkThenSet(self.doBeamHalo , False) - #self.checkThenSet(self.doxKalman , False) - #self.checkThenSet(self.doiPatRec , False) #self.checkThenSet(self.doBackTracking , False) #self.checkThenSet(self.doTRTStandalone , False) #self.checkThenSet(self.doForwardTracks , False) @@ -1408,8 +1386,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doSLHCConversionFinding, False) self.checkThenSet(self.doBeamGas , False) self.checkThenSet(self.doBeamHalo , False) - self.checkThenSet(self.doxKalman , False) - self.checkThenSet(self.doiPatRec , False) self.checkThenSet(self.doBackTracking , False) self.checkThenSet(self.doTRTStandalone , False) self.checkThenSet(self.doForwardTracks , False) @@ -1437,8 +1413,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doSLHCConversionFinding, False) self.checkThenSet(self.doBeamGas , False) self.checkThenSet(self.doBeamHalo , False) - self.checkThenSet(self.doxKalman , False) - self.checkThenSet(self.doiPatRec , False) self.checkThenSet(self.doBackTracking , False) self.checkThenSet(self.doTRTStandalone , False) self.checkThenSet(self.doForwardTracks , False) @@ -1477,8 +1451,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doSLHCConversionFinding, False) self.checkThenSet(self.doBeamGas , False) self.checkThenSet(self.doBeamHalo , False) - self.checkThenSet(self.doxKalman , False) - self.checkThenSet(self.doiPatRec , False) self.checkThenSet(self.doBackTracking , False) self.checkThenSet(self.doTRTStandalone , False) self.checkThenSet(self.doForwardTracks , False) @@ -1517,8 +1489,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doForwardTracks , False ) self.checkThenSet(self.doBeamGas , False ) self.checkThenSet(self.doBeamHalo , False ) - self.checkThenSet(self.doxKalman , False ) - self.checkThenSet(self.doiPatRec , False ) self.checkThenSet(self.doBackTracking , False ) self.checkThenSet(self.doTRTStandalone , False ) self.checkThenSet(self.postProcessing , False ) @@ -1590,9 +1560,6 @@ class InDetJobProperties(JobPropertyContainer): # --- collisions, this is the main one ! elif (jobproperties.Beam.beamType()=="collisions"): - # --- set default track configuration - self.checkThenSet(self.doxKalman , False) - self.checkThenSet(self.doiPatRec , False) # --- enable phase for collisions by default self.checkThenSet(self.doTRTPhaseCalculation , False ) @@ -1708,7 +1675,6 @@ class InDetJobProperties(JobPropertyContainer): # ESD/AOD output options # ------------------------------------------------------------------- if self.AODall() and jobproperties.Beam.beamType()=="collisions": - self.doiPatRec = True self.doNewTracking = True # -------------------------------------------------------------------- @@ -1991,7 +1957,7 @@ class InDetJobProperties(JobPropertyContainer): return self.doTrackSegmentsPixel() or self.doTrackSegmentsSCT() or self.doTrackSegmentsTRT() def doPattern(self): - return self.doNewTrackingPattern() or self.doxKalman() or self.doiPatRec() or self.doNewTrackingSegments() + return self.doNewTrackingPattern() or self.doNewTrackingSegments() def doTRTExtension(self): from AthenaCommon.DetFlags import DetFlags @@ -2051,8 +2017,6 @@ class InDetJobProperties(JobPropertyContainer): self.doLowPtLargeD0 = False self.doHadCaloSeededSSS = False - self.doxKalman = False - self.doiPatRec = False self.doTrackSegmentsPixel = False self.doTrackSegmentsSCT = False @@ -2114,8 +2078,6 @@ class InDetJobProperties(JobPropertyContainer): self.doForwardTracks = False self.doBeamGas = False self.doBeamHalo = False - self.doxKalman = False - self.doiPatRec = False self.doBackTracking = False self.doTRTStandalone = False self.postProcessing = True @@ -2387,13 +2349,9 @@ class InDetJobProperties(JobPropertyContainer): if self.doCaloSeededBrem(): print('* - restrict Brem Recovery to Calo ROIs') # ----------------------------------------- - if self.doxKalman() or self.doiPatRec() or self.doFatras(): + if self.doFatras(): print('*') print('* Alternative trackings:') - if self.doxKalman() : - print('* - run xKalman') - if self.doiPatRec() : - print('* - run iPatRec') if self.doFatras() : print('* - run FATRAS') # ----------------------------------------- @@ -2644,8 +2602,6 @@ _list_InDetJobProperties = [Enabled, doPseudoTracking, doIdealPseudoTracking, doSplitReco, - doxKalman, - doiPatRec, preProcessing, doPRDFormation, doPixelPRDFormation, diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py index c3f8a3840b52fed4ea6454ba63e126a0ae880376..4f8c882d542cdfb7acfb4f97fc1abd4b9f20a0ac 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py @@ -797,72 +797,12 @@ class IPatPrimaryVertices(JobProperty): allowedTypes = ['str'] StoredValue = 'IPatVxPrimaryCandidate' -class IPatParticles(JobProperty): - """StoreGate key for IPatTrackParticles""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'IPatTrackParticleCandidate' - -class IPatParticlesTruth(JobProperty): - """StoreGate key for IPatTrackParticlesTruth""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'IPatTrackParticleTruthCollection' - -class IPatConvertedTracks(JobProperty): - """StoreGate key for converted IPatRec Tracks""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'ConvertedIPatTracks' - -class IPatConvertedTracksTruth(JobProperty): - """StoreGate key for converted IPatRec Tracks truth""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'ConvertedIPatTracksTruth' - -class IPatConvertedTracksDetailedTruth(JobProperty): - """StoreGate key for converted IPatRec Tracks detailed truth""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'ConvertedIPatTracksDetailedTruth' - class XKalPrimaryVertices(JobProperty): """StoreGate key for XKalPrimaryVertices""" statusOn = True allowedTypes = ['str'] StoredValue = 'XKalVxPrimaryCandidate' -class XKalParticles(JobProperty): - """StoreGate key for XKalTrackParticles""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'XKalTrackParticleCandidate' - -class XKalParticlesTruth(JobProperty): - """StoreGate key for XKalTrackParticlesTruth""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'XKalTrackParticleTruthCollection' - -class XKalConvertedTracks(JobProperty): - """StoreGate key for converted XKalman Tracks""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'ConvertedXKalmanTracks' - -class XKalConvertedTracksTruth(JobProperty): - """StoreGate key for converted XKalman Tracks truth""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'ConvertedXKalmanTracksTruth' - -class XKalConvertedTracksDetailedTruth(JobProperty): - """StoreGate key for converted XKalman Tracks detailed truth""" - statusOn = True - allowedTypes = ['str'] - StoredValue = 'ConvertedXKalmanTracksDetailedTruth' - class V0Candidates(JobProperty): """StoreGate key for V0 candidates""" statusOn = True @@ -1209,17 +1149,7 @@ jobproperties.InDetContainerKeys.add_JobProperty(PrimaryVerticesSplitStream) jobproperties.InDetContainerKeys.add_JobProperty(TrackParticles) jobproperties.InDetContainerKeys.add_JobProperty(TrackParticlesTruth) jobproperties.InDetContainerKeys.add_JobProperty(IPatPrimaryVertices) -jobproperties.InDetContainerKeys.add_JobProperty(IPatParticles) -jobproperties.InDetContainerKeys.add_JobProperty(IPatParticlesTruth) -jobproperties.InDetContainerKeys.add_JobProperty(IPatConvertedTracks) -jobproperties.InDetContainerKeys.add_JobProperty(IPatConvertedTracksTruth) -jobproperties.InDetContainerKeys.add_JobProperty(IPatConvertedTracksDetailedTruth) jobproperties.InDetContainerKeys.add_JobProperty(XKalPrimaryVertices) -jobproperties.InDetContainerKeys.add_JobProperty(XKalParticles) -jobproperties.InDetContainerKeys.add_JobProperty(XKalParticlesTruth) -jobproperties.InDetContainerKeys.add_JobProperty(XKalConvertedTracks) -jobproperties.InDetContainerKeys.add_JobProperty(XKalConvertedTracksTruth) -jobproperties.InDetContainerKeys.add_JobProperty(XKalConvertedTracksDetailedTruth) jobproperties.InDetContainerKeys.add_JobProperty(V0Candidates) jobproperties.InDetContainerKeys.add_JobProperty(SimpleV0Candidates) jobproperties.InDetContainerKeys.add_JobProperty(SecVertices) diff --git a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py index 0e04df4fa9341dbf4c89f5733768c85d50ab4c70..069c0230f2036edb90adba9f1f236142d007345c 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py @@ -727,7 +727,6 @@ def getConstPRD_AssociationTool(name='ConstPRD_AssociationTool',**kwargs) : kwargs = setDefaults( kwargs, SetupCorrect = True, - MuonIdHelperTool = "", PRDtoTrackMap = prefix+'PRDtoTrackMap'+suffix) from TrkAssociationTools.TrkAssociationToolsConf import Trk__PRD_AssociationTool diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetInclusiveSecVtx_fromAOD.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetInclusiveSecVtx_fromAOD.py index a5e42f6fde249a67217f51fccb8af9eaa799cfbd..292f7db26bf3df62e052d721736f2691b8cf4c40 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetInclusiveSecVtx_fromAOD.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetInclusiveSecVtx_fromAOD.py @@ -140,8 +140,6 @@ InDetFlags.preProcessing = False InDetFlags.doPRDFormation = False # those two will be (later) automatically false if InDetFlags.doSpacePointFormation = False # preProcessing is false InDetFlags.doNewTracking = False -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoring.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoring.py index ea0ca51d6aee3599dea16fa39cbb5312fc20b1fc..1b9a83faadb79dabf2198b4b895ddfab25d7f60f 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoring.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoring.py @@ -11,7 +11,7 @@ from InDetRecExample.InDetJobProperties import InDetFlags if InDetFlags.doMonitoringGlobal() or InDetFlags.doMonitoringPrimaryVertexingEnhanced(): - include("InDetRecExample/InDetMonitoringGlobalRun3Test.py") + include("InDetRecExample/InDetMonitoringGlobal.py") if InDetFlags.doMonitoringPixel(): include( "InDetRecExample/InDetMonitoringPixel.py") if InDetFlags.doMonitoringSCT(): diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py index 98b9dcc51d4244dc63002c903ba5e0b50cff21a4..a826109ac606f7fb201466dd07131b18d1922b68 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py @@ -339,8 +339,7 @@ if InDetFlags.doPattern(): # Igors propagator needed by Igors tools # from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator as Propagator - InDetPatternPropagator = Propagator(name = 'InDetPatternPropagator', - UseCondObj = False) + InDetPatternPropagator = Propagator(name = 'InDetPatternPropagator') ToolSvc += InDetPatternPropagator if (InDetFlags.doPrintConfigurables()): printfunc ( InDetPatternPropagator) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py index 9f136ae2883a7bbca6360757e9ac03578f05eafd..71500cd3745269bf36244bd2d474faf35e3bc33b 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py @@ -426,23 +426,7 @@ if InDetFlags.doStandardPlots(): InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformanceBtag ] - # selected Good IPatRec tracks - if InDetFlags.doiPatRec(): - InDetStandardPerformanceGoodIPatRec = InDetStandardPerformance (name = "InDetStandardPerformanceGoodIPatRec", - tracksName = "ConvertedIPatTracks", - tracksTruthName = "ConvertedIPatTracksTruth", - SummaryTool = InDetTrackSummaryToolSharedHits, - HoleSearch = InDetHoleSearchTool, - useTrackSelection = True, - TrackSelectorTool = InDetTrackSelectorToolGood, - HistDirectoryName = "SelectedGoodIPatTracks", - TruthToTrackTool = TruthToTrackTool, - DoTruth = InDetFlags.doTruth()) - if (InDetFlags.doPrintConfigurables()): - print( InDetStandardPerformanceGoodIPatRec ) - - InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformanceGoodIPatRec ] diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py index e5eb5c8ed760662fada66caa51b9a863a9b73191..0c4cd6a41b88cbdb0ca5c03c9a0be02968a97de9 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py @@ -46,35 +46,7 @@ if InDetFlags.doForwardTracks(): TrackParticles = InDetKeys.ResolvedForwardTrackParticles(), TrackParticlesTruth = InDetKeys.ResolvedForwardTrackParticlesTruth()) -# ------------------------------------------------------------ -# -# --- do we write Vertices and TrackParticles for all? -# -# ------------------------------------------------------------ -if InDetFlags.AODall(): - if InDetFlags.doiPatRec(): - # - # --- IPatRec post processing - # - InDetPriVtxPartCreation = ConfiguredPriVtxAndPartCreation (extension = "IPat", - InputTrackCollection = InDetKeys.IPatConvertedTracks(), - InputTrackCollectionTruth = InDetKeys.IPatConvertedTracksTruth(), - VxCandidates = InDetKeys.IPatPrimaryVertices(), - TrackParticles = InDetKeys.IPatParticles(), - TrackParticlesTruth = InDetKeys.IPatParticlesTruth()) - - if InDetFlags.doxKalman(): - # - # --- IPatRec post processing - # - InDetPriVtxPartCreation = ConfiguredPriVtxAndPartCreation (extension = "XKal", - InputTrackCollection = InDetKeys.XKalConvertedTracks(), - InputTrackCollectionTruth = InDetKeys.XKalConvertedTracksTruth(), - VxCandidates = InDetKeys.XKalPrimaryVertices(), - TrackParticles = InDetKeys.XKalParticles(), - TrackParticlesTruth = InDetKeys.XKalParticlesTruth()) - # ------------------------------------------------------------ # # --- now load primary vertex setup with no beamconstraint and in split mode for enhanced monitoring diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecXKalIPat.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecXKalIPat.py deleted file mode 100755 index 0375d65897b5f0b5d4f1c96439721cd49f64e840..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecXKalIPat.py +++ /dev/null @@ -1,232 +0,0 @@ -# ------------------------------------------------------------ -# -# ----------- now we do legacy pattern if requested -# -# ------------------------------------------------------------ -# -# ----------- iPat -# -if InDetFlags.doiPatRec(): - include ( "iPatRecExample/iPatRec_jobOptions.py" ) - iPatRec.maxSecondaryImpact = InDetNewTrackingCuts.maxSecondaryImpact() - iPatRec.minPt = InDetNewTrackingCuts.minPT() - # - # ---- handle converted iPatRec tracks - # - if InDetFlags.doTruth(): - # - # set up the truth info for this container - # - include ("InDetRecExample/ConfiguredInDetTrackTruth.py") - InDetIPatRecTruth = ConfiguredInDetTrackTruth(InDetKeys.IPatConvertedTracks(), - InDetKeys.IPatConvertedTracksDetailedTruth(), - InDetKeys.IPatConvertedTracksTruth()) - # - # add to keys lists for statistics - # - TrackCollectionKeys += [ InDetIPatRecTruth.Tracks() ] - TrackCollectionTruthKeys += [ InDetIPatRecTruth.TracksTruth() ] - else: - TrackCollectionKeys += [ InDetKeys.IPatConvertedTracks() ] - -# -# ----------- xKalman -# -if InDetFlags.doxKalman(): - - # - # xKlaman magnetic field service - # - from xKalman.xKalmanConf import XKaMField - XKaMField = XKaMField(name = 'XKaMField' , - MagneticFieldService = 4 , - MagneticField = [0.,0.,-14.,700.] ) - - topSequence += XKaMField - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaMField) - - # - # xKalman geomodel service - # - from xKalman.xKalmanConf import XKaDetectorBuilder - XKaDetectorBuilder = XKaDetectorBuilder(name = 'XKaDetectorBuilder' , - SilDescrManageLocation = 'SCT' , - PixDescrManageLocation = 'Pixel' , - TrtDescrManageLocation = "TRT" , - PixelClustesContainer = InDetKeys.PixelClusters(), - SCT_ClustesContainer = InDetKeys.SCT_Clusters(), - TRT_ClustesContainer = InDetKeys.TRT_DriftCircles(), - TruthNamePixel = InDetKeys.PixelClustersTruth(), - TruthNameSCT = InDetKeys.SCT_ClustersTruth(), - TruthNameTRT = InDetKeys.TRT_DriftCirclesTruth(), - DetectorLocation = "xKalman" , - Pixel = DetFlags.haveRIO.pixel_on(), - SCT = DetFlags.haveRIO.SCT_on(), - TRT = DetFlags.haveRIO.TRT_on(), - TruthInformation = InDetFlags.doTruth() , - PrintLevelDetector = 3 ) - - topSequence += XKaDetectorBuilder - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaDetectorBuilder) - - # - # xKalman seeds service - # - from xKalman.xKalmanConf import XKaSeedsManager - XKaSeedsManager = XKaSeedsManager(name = 'XKaSeedsManager', - RoadsLocation = 'XKEvent' ) - - topSequence += XKaSeedsManager - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaSeedsManager) - - # - # xKalman seed for full event reconstruction - # - from xKalman.xKalmanConf import XKaSeedALL - XKaSeedALL = XKaSeedALL(name = 'XKaSeedALL', - RoadsLocation = 'XKEvent' , - RoadParameters = [InDetNewTrackingCuts.minPT(),3.2,2.6,240.,InDetNewTrackingCuts.maxPrimaryImpact()]) - topSequence += XKaSeedALL - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaSeedALL) - - # - # xKalman reconstruction menager - # - from xKalman.xKalmanConf import XKalMan - XKalMan = XKalMan(name = 'XKalMan' , - PrintLevelInformation = 3 , - ReconstructionStrategy = 4 , - Selectivity = 2 , - PrimaryVertexSearch = False , - SimpleTracksProduction = True , - PrintMemoryManager = False , - TrackModel = 0 , - MinNumberOfSilClusters = 7 , - MinNumberOfUniqueSilClusters = 5 , - MinNumberOfTRTClusters = 9 , - MaxNumberHoles = 22 , - Xi2forPrecisionClusters = 15. , - TRTClusterRatio = .5 , - TRTTimeStrawRatio = .5 , - TRTuseDriftTime = True , - DetectorLocation ='xKalman' , - RoadsLocation ='XKEvent' , - ConditionLocation ='xKCondition' , - TracksLocation ='xKalman' , - VerticesLocation ='xKalman' , - SimpleTracksLocation ='Tracks_xKalman', - BeamConditions ='BeamCondSvc' , - ExtraInformation = 2 ) - topSequence += XKalMan - if (InDetFlags.doPrintConfigurables()): - printfunc (XKalMan) - - # - # xKalman clusters production - # - from xKalman.xKalmanConf import XKaClustersProduction - XKaClustersProduction = XKaClustersProduction(name = 'XKaClustersProduction', - DetectorLocation = 'xKalman' , - ConditionLocation = 'xKCondition' , - TracksLocation = 'xKalman' , - PrintLevelClusters = -1 , - PrintLevelDetector = -1 ) - topSequence += XKaClustersProduction - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaClustersProduction) - - # - # xKalman space points production - # - from xKalman.xKalmanConf import XKaSpacePointsProduction - XKaSpacePointsProduction = XKaSpacePointsProduction(name = 'XKaSpacePointsProduction', - ConditionLocation = 'xKCondition' , - TracksLocation = 'xKalman' , - PrintLevelSpoints = -1 , - PrintLevelDetector = -1 ) - topSequence += XKaSpacePointsProduction - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaSpacePointsProduction) - - # - # xKalman reconstruction started from space points seeds - # - from xKalman.xKalmanConf import XKaSILReconstruction - XKaSILReconstruction = XKaSILReconstruction (name = 'XKaSILReconstruction', - ConditionLocation = 'xKCondition' , - TracksLocation = 'xKalman' , - PrintLevelTracks = [-1,1] ) - topSequence += XKaSILReconstruction - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaSILReconstruction) - - # - # xKalman reconstruction using only TRT information - # - from xKalman.xKalmanConf import XKaTRTReconstruction - XKaTRTReconstruction = XKaTRTReconstruction (name = 'XKaTRTReconstruction', - ConditionLocation = 'xKCondition' , - TracksLocation = 'xKalman' , - PrintLevelTracks = [-1,1] ) - topSequence += XKaTRTReconstruction - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaTRTReconstruction) - - # - # xKalman ambiguity solving - # - from xKalman.xKalmanConf import XKaTracksComparison - XKaTracksComparison = XKaTracksComparison (name = 'XKaTracksComparison', - ConditionLocation = 'xKCondition' , - TracksLocation = 'xKalman' , - PrintLevelTracks = [-1,1] ) - topSequence += XKaTracksComparison - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaTracksComparison) - - # - # xKalman track extension to TRT - # - from xKalman.xKalmanConf import XKaTrackTRTExtension - XKaTrackTRTExtension = XKaTrackTRTExtension(name = 'XKaTrackTRTExtension', - ConditionLocation = 'xKCondition' , - TracksLocation = 'xKalman' , - PrintLevelTracks = [-1,1] ) - topSequence += XKaTrackTRTExtension - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaTrackTRTExtension) - # - # xKalman simple tracks production - # - from xKalman.xKalmanConf import XKaSimpleTracksProduction - XKaSimpleTracksProduction =XKaSimpleTracksProduction(name = 'XKaSimpleTracksProduction', - ConditionLocation = 'xKCondition' , - TracksLocation = 'xKalman' , - TrackUnits = 1 , - PrimaryVertex = False , - PrintLevelTracks = -1 , - ConvertToTracks = True , - RIOonTrackTool = InDetRotCreator ) - topSequence += XKaSimpleTracksProduction - if (InDetFlags.doPrintConfigurables()): - printfunc (XKaSimpleTracksProduction) - - if InDetFlags.doTruth(): - # - # set up the truth info for this container - # - include ("InDetRecExample/ConfiguredInDetTrackTruth.py") - InDetXKalmanTruth = ConfiguredInDetTrackTruth(InDetKeys.XKalConvertedTracks(), - InDetKeys.XKalConvertedTracksDetailedTruth(), - InDetKeys.XKalConvertedTracksTruth()) - # - # add to keys lists for statistics - # - TrackCollectionKeys += [ InDetXKalmanTruth.Tracks() ] - TrackCollectionTruthKeys += [ InDetXKalmanTruth.TracksTruth() ] - else: - TrackCollectionKeys += [ InDetKeys.XKalConvertedTracks() ] diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py index 40b0a02531d71f0925ce0d359df1d48b6f6c0fd9..ae62f8be9eca073cafc75472fdf938f6cd2e035a 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py @@ -352,8 +352,6 @@ else: # # ------------------------------------------------------------ - if InDetFlags.doxKalman() or InDetFlags.doiPatRec(): - include ("InDetRecExample/InDetRecXKalIPat.py") # # --- TRT track segment finding @@ -1078,10 +1076,6 @@ else: InputTrackCollection = InDetKeys.UnslimmedTracks() elif InDetFlags.doPseudoTracking(): InputTrackCollection = InDetKeys.PseudoTracks() - elif InDetFlags.doiPatRec(): - InputTrackCollection = InDetKeys.IPatConvertedTracks() - elif InDetFlags.doxKalman(): - InputTrackCollection = InDetKeys.XKalConvertedTracks() else: # --- in case of reading from ESD, so we just set the Collection and truth InputTrackCollection = InDetKeys.Tracks() diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ReadInDet_jobOptions.py b/InnerDetector/InDetExample/InDetRecExample/share/ReadInDet_jobOptions.py index 680393b67e59f4754a58454e286b2404ec3d071f..509a0d793c10be47e4853c94e6b8dced71cb200b 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/ReadInDet_jobOptions.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/ReadInDet_jobOptions.py @@ -134,8 +134,6 @@ InDetFlags.preProcessing = redoPatternRecoAndTracking InDetFlags.doPRDFormation = False # those two will be (later) automatically false if InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing is false InDetFlags.doNewTracking = redoPatternRecoAndTracking -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doBackTracking = redoPatternRecoAndTracking InDetFlags.doTRTStandalone = redoPatternRecoAndTracking diff --git a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetBS_jobOptions.py b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetBS_jobOptions.py index cb0402d78b5879e539bd8a096670551c7eebb0e9..5d657e7f79fb1f447866bdb70ff9ea4d63cfbfe6 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetBS_jobOptions.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetBS_jobOptions.py @@ -73,8 +73,6 @@ InDetFlags.preProcessing = False InDetFlags.doNewTracking = False InDetFlags.doLowPt = False InDetFlags.doBeamGas = False -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False InDetFlags.postProcessing = False diff --git a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_900gev.py b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_900gev.py index dcd2db307d38a04b8539c3ef1392314a742af281..fa060218acc67c5d32b8eff73a1da5966033c0d3 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_900gev.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_900gev.py @@ -117,8 +117,6 @@ InDetFlags.doTruth = (globalflags.InputFormat() == 'pool' and globalflags. #InDetFlags.doLowPt = False #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_HeavyIons.py b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_HeavyIons.py index 92b14fc473e6a2381e6679f45a3bd82ae2a94261..c493afaf45d6966a85159a215af46999c79b069a 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_HeavyIons.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_HeavyIons.py @@ -91,8 +91,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = True -#InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = False #InDetFlags.doTRTStandalone = False #InDetFlags.doV0Finder = False diff --git a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_Standalone.py b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_Standalone.py index 88b316b8983206cbbe686a256a4832ed123957d1..e33a2d96aa585caed945603bb9a3012ad12b5b81 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_Standalone.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_Standalone.py @@ -118,9 +118,7 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I # --- special setup for Beate # InDetFlags.doVtxLumi = True -# --- enable xKalman and iPatRec -# InDetFlags.doxKalman = True -# InDetFlags.doiPatRec = True + # --- uncomment to change the default of one of the following options: #InDetFlags.doNewTracking = False diff --git a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_cosmic.py b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_cosmic.py index 59ac5ae19072961e648618d6e48fdcbe1a9a69b4..5ef5698c484f4a16d5e722932c16b28a2c76b5c6 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_cosmic.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_cosmic.py @@ -118,8 +118,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -##InDetFlags.doxKalman = False -##InDetFlags.doiPatRec = False #InDetFlags.doBackTracking = True #InDetFlags.doTRTStandalone = True ##InDetFlags.doVertexFinding=False diff --git a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_singlebeam.py b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_singlebeam.py index 7c3e2ed6f59054826790c66edfa874a8a183e410..42e0ac153ebf244ada721eecbb0e6b440d53524d 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_singlebeam.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/jobOptions_singlebeam.py @@ -98,8 +98,7 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.InputFo #InDetFlags.preProcessing = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -##InDetFlags.doxKalman = False -##InDetFlags.doiPatRec = False + # --- possibility to run tracking on subdetectors separately (and independent from each other) #InDetFlags.doTrackSegmentsPixel = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/FatrasReconstruction.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/FatrasReconstruction.py index bc8da088e8c12f8f6347a6cf9b8c4126a30adeb2..6f94f50c205bb70424bb7d3136d22ef72105078e 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/FatrasReconstruction.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/FatrasReconstruction.py @@ -52,8 +52,6 @@ class FatrasReconstruction : # --- setup InDetFlags according to InDetFlagsJobProperty from InDetRecExample.InDetJobProperties import InDetFlags # the different pattern components - InDetFlags.doxKalman = False - InDetFlags.doiPatRec = False InDetFlags.doNewTracking = True InDetFlags.doBackTracking = True InDetFlags.doTruth = True diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_IBL.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_IBL.py index 12b7db1d386cefc0adffa8241d4bf2be76accca1..78ab2ec1416b26dc53e5b2d1e0ebe46f0640d4e2 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_IBL.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_IBL.py @@ -97,8 +97,6 @@ InDetFlags.doTrackSegmentsTRT = False InDetFlags.doNewTracking = True InDetFlags.doLowPt = False -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_SLHC.py index 8c7e8da9710debbb2adf2ee98deb66fad8be56bd..a69d30234d3d16e118b60cecab3f47e40ca034fb 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_SLHC.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_SLHC.py @@ -113,8 +113,6 @@ InDetFlags.doTrackSegmentsTRT = False InDetFlags.doNewTracking = True InDetFlags.doLowPt = False -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetRec_jobOptions_refit.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetRec_jobOptions_refit.py index 0d4428395332d4921eeba6ca36d530f78391bdb1..30b0ce8951d57783c9b30597182ca6397c6dae5d 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetRec_jobOptions_refit.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetRec_jobOptions_refit.py @@ -194,10 +194,6 @@ else: # InputTrackCollection = InDetKeys.UnslimmedTracks() #elif InDetFlags.doCTBTracking(): #InputTrackCollection = InDetKeys.UnslimmedTracks_CTB() - #elif InDetFlags.doiPatRec(): - #InputTrackCollection = InDetKeys.IPatConvertedTracks() - #elif InDetFlags.doxKalman(): - #InputTrackCollection = InDetKeys.XKalConvertedTracks() #else: # --- in case of reading from ESD, so we just set the Collection and truth #InputTrackCollection = InDetKeys.Tracks() diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC.py index 740175cd560d4cf92946dff3d71a85ab6260205e..148c50f865169b50500b19a7ddc85bad39fb8b60 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC.py @@ -137,8 +137,6 @@ InDetFlags.doTrackSegmentsTRT = False InDetFlags.doNewTracking = True InDetFlags.doLowPt = False -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC_refit.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC_refit.py index d82946160fd2d09209515f9d7411a11e5ac5ac68..3b8553068152abeb845a321c74b7ffb06030c52f 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC_refit.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC_refit.py @@ -138,8 +138,6 @@ InDetFlags.doTrackSegmentsTRT = False InDetFlags.doNewTracking = False InDetFlags.doLowPt = False -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC.py index 9e563d3c7ce11835a4f4bce8c1d256ce66a89e92..39abc1064ff5667feab609d2bcc91607f8ee98a9 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC.py @@ -102,8 +102,6 @@ InDetFlags.doTrackSegmentsTRT = False InDetFlags.doNewTracking = True InDetFlags.doLowPt = False -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf.py index 52bff82c852d5cb08c0fc33717f46e1a6c44bb06..8bbd49389dbdf50d99b979950188c55b30f8e369 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf.py @@ -130,8 +130,6 @@ if ( rec.OutputFileNameForRecoStep() == 'ESDtoAOD' or else: printfunc ('setting flags for RAWtoESD') InDetFlags.doLowPt = False - InDetFlags.doxKalman = False - InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_UtopiaTest.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_UtopiaTest.py index 2a686c01d63decc480bdde0714f0e5e0d5017e15..ec94074bfdba9972b37fa2545fcdd7f6935fae9e 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_UtopiaTest.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_UtopiaTest.py @@ -124,8 +124,6 @@ if ( rec.OutputFileNameForRecoStep() == 'ESDtoAOD' or else: printfunc ('setting flags for RAWtoESD') InDetFlags.doLowPt = False - InDetFlags.doxKalman = False - InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_splitOn.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_splitOn.py index 3f4ebd942bc2630086bfc37fae7cb31d323273cd..939782e9aff2d39ea8c85cd1a37644f1b330e73c 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_splitOn.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_splitOn.py @@ -116,8 +116,6 @@ InDetFlags.doTrackSegmentsTRT = False InDetFlags.doNewTracking = True InDetFlags.doLowPt = False -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_pileup_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_pileup_SLHC.py index cf0f5fde2dee47189d7783b6b7d680263da7ef3c..c8ba94c1d0600ff44eb959bd7403315b82e0ad55 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_pileup_SLHC.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_pileup_SLHC.py @@ -100,8 +100,6 @@ InDetFlags.doTrackSegmentsTRT = False InDetFlags.doNewTracking = True InDetFlags.doLowPt = False -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False #InDetFlags.doSingleSpBackTracking = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC_Rec.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC_Rec.py index e284bed06c1ed6679dab8d3c64937221b5f5758d..53183c73009e5777b89c0fb42a952ee581841c0a 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC_Rec.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC_Rec.py @@ -47,9 +47,6 @@ if rec.doWriteESD() or rec.doWriteAOD() or ('doWriteESD' in dir() and doWriteESD InDetFlags.doTRTStandalone = False InDetFlags.loadTRTSeededSPFinder = False #InDetFlags.doSingleSpBackTracking.set_Value_and_Lock(False) - # --- turn off alternatives - InDetFlags.doxKalman = False - InDetFlags.doiPatRec = False # --- no special tracking InDetFlags.doBeamGas = False InDetFlags.doBeamHalo = False diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/share/InDetTrigRec_jobOptions.py b/InnerDetector/InDetExample/InDetTrigRecExample/share/InDetTrigRec_jobOptions.py index 3f29c771a3bf7e0563f27dbb1312bc24ee4cd527..f5627a5d66ce5210d01fe6072657ede28af7daad 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/share/InDetTrigRec_jobOptions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/share/InDetTrigRec_jobOptions.py @@ -20,7 +20,6 @@ if not 'InDetTrigFlags' in dir(): #InDetTrigFlags.InDet25nsec = True #autoconfig and runHLT_standalone setting for BS InDetTrigFlags.primaryVertexSetup = "IterativeFinding" #InDetTrigFlags.primaryVertexSetup = "DefaultFastFinding" - InDetTrigFlags.doiPatRec = False InDetTrigFlags.doRefit = True # switched on for ATR-12226 (z0 uncertainties in bjets) InDetTrigFlags.doPixelClusterSplitting = False InDetTrigFlags.doPrintConfigurables = False # diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/share/WriteInDetTrigBS_jobOptions.py b/InnerDetector/InDetExample/InDetTrigRecExample/share/WriteInDetTrigBS_jobOptions.py index 58b6a1632eb961ff32de5f8e305efd72055f92b1..2e79c8d8500126aa0bc490d5c5da48d0408570a4 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/share/WriteInDetTrigBS_jobOptions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/share/WriteInDetTrigBS_jobOptions.py @@ -28,8 +28,6 @@ doVP1 = False from InDetRecExample.InDetJobProperties import InDetFlagsJobProperty InDetFlagsJobProperty.preProcessing = False -InDetFlagsJobProperty.iPatRec = False -InDetFlagsJobProperty.xKalman = False InDetFlagsJobProperty.newTracking = False InDetFlagsJobProperty.postProcessing = False InDetFlagsJobProperty.doTruth = False diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptionsNewSteering.py b/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptionsNewSteering.py index e986d0b01c0811eb400c9dcc0408b2b37360bf33..ccdc6bd88e7e91a16e7a7b62d601b7fb28f91334 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptionsNewSteering.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptionsNewSteering.py @@ -53,7 +53,6 @@ else: from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags InDetTrigFlags.doTruth = doTruth InDetTrigFlags.doNewTracking = True -InDetTrigFlags.doiPatRec = False #-------------------------------------------------------------- # load Global Flags and set defaults diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample.py b/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample.py index a35bc8c90432394bda8e2c3a648a37e4f9e624b0..fd431e1cc36e9d2c82c6421e782e4b333e0023ee 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample.py @@ -52,7 +52,6 @@ else: from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags InDetTrigFlags.doTruth = doTruth InDetTrigFlags.doNewTracking = True -InDetTrigFlags.doiPatRec = False diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample_backTracking.py b/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample_backTracking.py index ff9dacd07aa94cd556b91b4ba0148b48d8d639f3..150efdf99ba1f20a3db1166a2f567680175a1571 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample_backTracking.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample_backTracking.py @@ -51,7 +51,6 @@ else: from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags InDetTrigFlags.doTruth = doTruth InDetTrigFlags.doNewTracking = True -InDetTrigFlags.doiPatRec = False #-------------------------------------------------------------- diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample_doReadBS.py b/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample_doReadBS.py index 9dd07da536eade565126056903f7b51b50f1bbad..bdc04982b5545ba9a42bfa10f012d55713915c84 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample_doReadBS.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/share/jobOptions_RTT_InDetTrigRecExample_doReadBS.py @@ -56,7 +56,6 @@ else: from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags InDetTrigFlags.doTruth = doTruth InDetTrigFlags.doNewTracking = True -InDetTrigFlags.doiPatRec = False #-------------------------------------------------------------- diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/share/testEFID_basic.py b/InnerDetector/InDetExample/InDetTrigRecExample/share/testEFID_basic.py index dad9eec21253d438e86e55b80c9590ffd34a5fc8..c066ca1f1d4907368cdab89d5006b0c2b99150ee 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/share/testEFID_basic.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/share/testEFID_basic.py @@ -107,7 +107,6 @@ from RecExConfig.RecFlags import rec InDetTrigFlags.doTruth = rec.doTruth() InDetTrigFlags.doNewTracking = True InDetTrigFlags.doBackTracking = False -InDetTrigFlags.doiPatRec = False InDetTrigFlags.trackFitterType = 'GlobalChi2Fitter' #InDetTrigFlags.trackFitterType = 'GaussianSumFilter' #InDetTrigFlags.trackFitterType = 'KalmanFitter' diff --git a/InnerDetector/InDetG4/BLM_G4_SD/test/BLMSensorSD_gtest.cxx b/InnerDetector/InDetG4/BLM_G4_SD/test/BLMSensorSD_gtest.cxx index 5868544defe7bbed8f97a6649fb8fcd626a12b03..3ea9496eee45660685c5b156d008547055b0afc9 100644 --- a/InnerDetector/InDetG4/BLM_G4_SD/test/BLMSensorSD_gtest.cxx +++ b/InnerDetector/InDetG4/BLM_G4_SD/test/BLMSensorSD_gtest.cxx @@ -28,7 +28,7 @@ #include "MCTruth/TrackHelper.h" #include "MCTruth/TrackInformation.h" #include "MCTruth/VTrackInformation.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" //set environment class GaudiEnvironment : public ::testing::Environment { diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt index f467b3ccdd928f839193a8fe2f65b9b0c987262a..a309f350ed1c4d6f6875da8f3afd99e18387f648 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt @@ -45,18 +45,19 @@ atlas_depends_on_subdirs( Tracking/TrkEvent/VxVertex Tracking/TrkExtrapolation/TrkExInterfaces Tracking/TrkTools/TrkToolInterfaces - Tracking/TrkVertexFitter/TrkVertexFitterInterfaces ) + Tracking/TrkVertexFitter/TrkVertexFitterInterfaces + Generators/AtlasHepMC + ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO MathMore Gpad Matrix ) # Component(s) in the package: atlas_add_component( InDetAlignmentMonitoring src/*.h src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib GaudiKernel CommissionEvent AthenaBaseComps AthenaMonitoringLib AthContainers AtlasDetDescr Identifier EventPrimitives xAODEventInfo xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx index fa5efd5ad364f81299d99d4fbb8ac46d6cfc4c18..17e12ba82beb21c86bdc534e4f1d31b4e0ae15e5 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx @@ -26,8 +26,8 @@ #include "InDetRIO_OnTrack/SiClusterOnTrack.h" #include "InDetPrepRawData/SiCluster.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "TrkEventPrimitives/FitQuality.h" #include "TrkEventPrimitives/LocalParameters.h" diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx index fd1764f9a7b125182bbb23f8fa68d0c78427e49a..f2552ab3d9a0dfc0260c0fa6fbbffee9f342e329 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx @@ -18,7 +18,7 @@ #include "GaudiKernel/IJobOptionsSvc.h" #include "GaudiKernel/MsgStream.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkTruthData/TrackTruth.h" #include "InDetRIO_OnTrack/SiClusterOnTrack.h" diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalMotherTrigMonTool.h b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalMotherTrigMonTool.h index 04c55b3add251ffbc857de3815f5fd91285eb8bb..944499086047fa63d454c8a35fe8675c9fc05751 100755 --- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalMotherTrigMonTool.h +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalMotherTrigMonTool.h @@ -69,7 +69,7 @@ class InDetGlobalMotherTrigMonTool : public InDetGlobalMotherMonTool private: int m_firedTriggers[8]; std::vector<unsigned int> m_activeMenuItems; - SG::ReadHandleKey<EventInfo> m_eventInfoKey{this,"EventInfoKey","BysteStreamEventInfo","Event Info Key for Global Trigger Montioring"}; + SG::ReadHandleKey<EventInfo> m_eventInfoKey{this,"EventInfoKey","ByteStreamEventInfo","Event Info Key for Global Trigger Montioring"}; }; #endif diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/CMakeLists.txt index 4397b16852a941a7b7938974fd3d6ec8ffded78d..ea7d73ffbf34082254ea6b9b0778a2c1e0e3b545 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/CMakeLists.txt @@ -21,6 +21,7 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODTruth GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetDetDescr/TRT_ReadoutGeometry InnerDetector/InDetRecEvent/InDetRIO_OnTrack @@ -47,7 +48,6 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) # Component(s) in the package: @@ -55,15 +55,15 @@ atlas_add_library( InDetPerformanceMonitoringLib src/*.cxx PUBLIC_HEADERS InDetPerformanceMonitoring INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODTracking xAODTruth GaudiKernel GeneratorObjects InDetReadoutGeometry TRT_ReadoutGeometry InDetRIO_OnTrack JetInterface ITrackToVertex egammaEvent LWHists TrkParameters TrkParticleBase TrkTrack AthenaMonitoringLib StoreGateLib SGtests ElectronPhotonSelectorToolsLib TrkVertexAnalysisUtilsLib TrigDecisionToolLib - PRIVATE_LINK_LIBRARIES ${HEPMC_LIBRARIES} IdDictDetDescr xAODEventInfo EventPrimitives InDetIdentifier InDetPrepRawData TrkEventPrimitives TrkTrackSummary TrkTruthData TrkV0Vertex ) + PRIVATE_LINK_LIBRARIES AtlasHepMCLib IdDictDetDescr xAODEventInfo EventPrimitives InDetIdentifier InDetPrepRawData TrkEventPrimitives TrkTrackSummary TrkTruthData TrkV0Vertex ) atlas_add_component( InDetPerformanceMonitoring src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib StoreGateLib SGtests xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODTracking xAODTruth GaudiKernel GeneratorObjects InDetReadoutGeometry TRT_ReadoutGeometry InDetRIO_OnTrack ElectronPhotonSelectorToolsLib JetInterface ITrackToVertex egammaEvent LWHists TrkParameters TrkParticleBase TrkTrack IdDictDetDescr xAODEventInfo EventPrimitives InDetIdentifier InDetPrepRawData TrkEventPrimitives TrkTrackSummary TrkTruthData TrkV0Vertex TrkVertexAnalysisUtilsLib TrigDecisionToolLib InDetPerformanceMonitoringLib ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel AthenaMonitoringLib StoreGateLib SGtests xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODTracking xAODTruth GaudiKernel GeneratorObjects InDetReadoutGeometry TRT_ReadoutGeometry InDetRIO_OnTrack ElectronPhotonSelectorToolsLib JetInterface ITrackToVertex egammaEvent LWHists TrkParameters TrkParticleBase TrkTrack IdDictDetDescr xAODEventInfo EventPrimitives InDetIdentifier InDetPrepRawData TrkEventPrimitives TrkTrackSummary TrkTruthData TrkV0Vertex TrkVertexAnalysisUtilsLib TrigDecisionToolLib InDetPerformanceMonitoringLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx index dbead826723bd5a5ef88d29de7a22727c8d7efc6..f8387747a3c09b6e01a2a8c59454d594e589c99b 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx @@ -29,8 +29,8 @@ // ATLAS headers #include "GaudiKernel/IInterface.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "TrkTruthData/TrackTruthCollection.h" #include "TrkTruthData/TrackTruthKey.h" diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/TRTMonitoringRun3/TRTMonitoringRun3RAW_Alg.h b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/TRTMonitoringRun3/TRTMonitoringRun3RAW_Alg.h index 0acf199689fded25d0884d1207ce18db0de1d7a0..f16252aa690b27fbb425956374a3b465ffae2e5b 100644 --- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/TRTMonitoringRun3/TRTMonitoringRun3RAW_Alg.h +++ b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/TRTMonitoringRun3/TRTMonitoringRun3RAW_Alg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRTMONITORINGRUN3RAW_ALG_H @@ -81,7 +81,6 @@ private: bool m_ArgonXenonSplitter; int m_totalEvents; - int m_evtLumiBlock; float m_longToTCut; int m_min_si_hits; diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx index 9be8d14417b6ae50512390c50f6658fb861f12c4..a72d9e18adcb29eb486b637fcef2cb2fbc417627 100644 --- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx +++ b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TRTMonitoringRun3/TRTMonitoringRun3RAW_Alg.h" @@ -1035,7 +1035,8 @@ HitAWMapC_passed = 1.0; for (int iside = 0; iside < 2; iside++) { for (int i = 1; i <= numberOfStacks_b[ibe]; i++) { - int index_tmp, modulenum_tmp; + int index_tmp = 0; + int modulenum_tmp = 0; if (iside == 0) { index_tmp = i - 1; diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/share/jobOptions_artest.py b/InnerDetector/InDetMonitoring/TRT_Monitoring/share/jobOptions_artest.py index 906bb0627d3ead223766d58ab3bdbca9d821008b..b6759d2610db2abf1653dfbf87cc3c1373fea2a3 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/share/jobOptions_artest.py +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/share/jobOptions_artest.py @@ -46,8 +46,6 @@ DetFlags.Muon_setOff() DetFlags.Print() from InDetRecExample.InDetJobProperties import InDetFlags InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool') -InDetFlags.doxKalman = False -InDetFlags.doiPatRec = False InDetFlags.doNewTracking = True InDetFlags.doMonitoringGlobal = True InDetFlags.doMonitoringPixel = False diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/src/TRTOverlay.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/src/TRTOverlay.cxx index d338c9535786b8715b109f59ba6f9cb78cf98dee..c7b73f5877aeb62cc718c56c574ca69049d46308 100644 --- a/InnerDetector/InDetRawAlgs/InDetOverlay/src/TRTOverlay.cxx +++ b/InnerDetector/InDetRawAlgs/InDetOverlay/src/TRTOverlay.cxx @@ -5,7 +5,7 @@ #include "AthenaKernel/RNGWrapper.h" #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/Random/RandFlat.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "InDetIdentifier/TRT_ID.h" #include "InDetOverlay/TRTOverlay.h" diff --git a/InnerDetector/InDetRecTools/InDetSVWithMuonTool/python/SecVrtWithMuonFinder.py b/InnerDetector/InDetRecTools/InDetSVWithMuonTool/python/SecVrtWithMuonFinder.py index 4c2cbebabbce91db60951dbf5209f69a1b26aa03..8e966843e7990c6b38412dd5a17e79df09651dca 100644 --- a/InnerDetector/InDetRecTools/InDetSVWithMuonTool/python/SecVrtWithMuonFinder.py +++ b/InnerDetector/InDetRecTools/InDetSVWithMuonTool/python/SecVrtWithMuonFinder.py @@ -22,10 +22,7 @@ class SecVrtWithMuonFinder( InDet__InDetSVWithMuonTool ): # from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter MuonVertexFitterTool = Trk__TrkVKalVrtFitter(name="MuonVertexFitterTool", - Extrapolator="Trk::Extrapolator/AtlasExtrapolator", - AtlasMagFieldSvc = "AtlasFieldSvc" - #AtlasMagFieldSvc = "Default", - #Extrapolator = "DefaultVKalPropagator" + Extrapolator="Trk::Extrapolator/AtlasExtrapolator" ) ToolSvc += MuonVertexFitterTool #---------------------- diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/CMakeLists.txt index 8b5df0b44a78347dd5db4f4a17a3a602e311dcec..d56baf5538c9fc5fb8322b147cd1b72969676572 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/CMakeLists.txt @@ -54,11 +54,12 @@ atlas_install_headers( InDetVKalVxInJetTool ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.txt ) - -atlas_add_test( InDetTrkInJetType_test - SOURCES test/InDetTrkInJetType_test.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking PathResolver GaudiKernel - InDetRecToolInterfaces Particle TrkVKalVrtFitterLib GeoPrimitives AnalysisUtilsLib TrkNeutralParameters MVAUtils - TrkParticleBase TrkTrackSummary VxSecVertex VxVertex TrkToolInterfaces TrkVertexFitterInterfaces PathResolver - LOG_IGNORE_PATTERN "Booking|AtlasFieldSvc|weight file|create data set info" ) +#This test is temporarily commented in order not to slow down magnetic field migration to condition data. +#Will be restored later +#atlas_add_test( InDetTrkInJetType_test +# SOURCES test/InDetTrkInJetType_test.cxx +# INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} +# LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking PathResolver GaudiKernel +# InDetRecToolInterfaces Particle TrkVKalVrtFitterLib GeoPrimitives AnalysisUtilsLib TrkNeutralParameters MVAUtils +# TrkParticleBase TrkTrackSummary VxSecVertex VxVertex TrkToolInterfaces TrkVertexFitterInterfaces PathResolver +# LOG_IGNORE_PATTERN "Booking|AtlasFieldSvc|weight file|create data set info" ) diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/python/InDetVKalVxInJetFinder.py b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/python/InDetVKalVxInJetFinder.py index c16ce1b58eec1d29f23d61b1bcdd4a7e08ff6639..3a6d71ddcc68be5808f9ff199cc8f7f37d487483 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/python/InDetVKalVxInJetFinder.py +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/python/InDetVKalVxInJetFinder.py @@ -22,10 +22,7 @@ class InDetVKalVxInJetFinder( InDet__InDetVKalVxInJetTool ): # from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter SVertexFitterTool = Trk__TrkVKalVrtFitter(name="SVertexFitterTool", - Extrapolator="Trk::Extrapolator/AtlasExtrapolator", - AtlasMagFieldSvc = "AtlasFieldSvc" - #AtlasMagFieldSvc = "Default", - #Extrapolator = "DefaultVKalPropagator" + Extrapolator="Trk::Extrapolator/AtlasExtrapolator" ) ToolSvc += SVertexFitterTool #---------------------- @@ -65,10 +62,6 @@ class AtlasVKalVxInJetFinder( InDet__InDetVKalVxInJetTool ): from __main__ import ToolSvc mlog = logging.getLogger( 'AtlasVKalVxInJetFinder::__init__ ' ) mlog.info("entering") - #----------------- ATLAS magnetic field - from AthenaCommon.AppMgr import ServiceMgr - from MagFieldServices.MagFieldServicesConf import MagField__AtlasFieldSvc - ServiceMgr += MagField__AtlasFieldSvc("myAtlasFieldSvc"); #----------------- ATLAS extrapolator from TrkExTools.AtlasExtrapolator import AtlasExtrapolator SVAtlasExtrapolator=AtlasExtrapolator() @@ -94,8 +87,7 @@ class AtlasVKalVxInJetFinder( InDet__InDetVKalVxInJetTool ): # from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter SVertexFitterTool = Trk__TrkVKalVrtFitter(name="SVertexFitterTool", - Extrapolator=SVAtlasExtrapolator, - AtlasMagFieldSvc = "myAtlasFieldSvc" + Extrapolator=SVAtlasExtrapolator ) ToolSvc += SVertexFitterTool #---------------------- diff --git a/InnerDetector/InDetRecTools/InDetZVTOPVxFinder/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetZVTOPVxFinder/CMakeLists.txt index 57d941d8d2b83b05bc08457bf11e2bfbdcbc0098..25ac53811b24da7cb37c69ca78d19568ea24283c 100644 --- a/InnerDetector/InDetRecTools/InDetZVTOPVxFinder/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetZVTOPVxFinder/CMakeLists.txt @@ -23,17 +23,17 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkVertexFitter/TrkVertexFitterInterfaces Tracking/TrkEvent/VxSecVertex - Event/EventPrimitives) + Event/EventPrimitives + Generators/AtlasHepMC ) # External dependencies -find_package( HepMC ) # Component(s) in the package: atlas_add_component( InDetZVTOPVxFinder src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel InDetRecToolInterfaces VxVertex Particle TrkParticleBase TrkParameters xAODTracking AthContainers TrkExInterfaces TrkSurfaces TrkVertexFitterInterfaces VxSecVertex EventPrimitives ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps GaudiKernel InDetRecToolInterfaces VxVertex Particle TrkParticleBase TrkParameters xAODTracking AthContainers TrkExInterfaces TrkSurfaces TrkVertexFitterInterfaces VxSecVertex EventPrimitives ) # Install files from the package: atlas_install_headers( InDetZVTOPVxFinder ) diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthClusterizationFactory.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthClusterizationFactory.cxx index d7be686382c24395289b4ae6bdf0e7022bb0aeb7..95126f93a58867fb12f74290bb99f6e6a38763aa 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthClusterizationFactory.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthClusterizationFactory.cxx @@ -22,7 +22,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/Incident.h" #include "InDetSimData/InDetSimData.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkEventPrimitives/ParamDefs.h" diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx index 9bd497dde5c801b2a3dc9b7049d44511635a648b..4633fcab2437544244da77042256e59569b8cd82 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx +++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx @@ -819,13 +819,13 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::buildFrameWork() if (m_diversss < m_diver ) m_diversss = m_diver; if (m_divermax < m_diversss) m_divermax = m_diversss; - if (std::abs(m_etamin) < .1) m_etamin = -m_etamax; + if (fabs(m_etamin) < .1) m_etamin = -m_etamax; m_dzdrmax0 = 1./tan(2.*atan(exp(-m_etamax))); m_dzdrmin0 = 1./tan(2.*atan(exp(-m_etamin))); m_r3max = m_r_rmax; m_COF = 134*.05*9.; - m_ipt = 1./std::abs(.9*m_ptmin); + m_ipt = 1./fabs(.9*m_ptmin); m_ipt2 = m_ipt*m_ipt; // Build radius sorted containers @@ -978,7 +978,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::buildBeamFrameWork(EventData& data) co double ty = tan(beamSpotHandle->beamTilt(1)); double ph = atan2(ty,tx); - double th = acos(1./std::sqrt(1.+tx*tx+ty*ty)); + double th = acos(1./sqrt(1.+tx*tx+ty*ty)); double sint = sin(th); double cost = cos(th); double sinp = sin(ph); @@ -1196,7 +1196,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production2Sp(EventData& data) const if (UR == 0.) continue; float A = Vt*R/UR; float B = Vt-A*Ut; - if (std::abs(B*data.K) > m_ipt*std::sqrt(1.+A*A)) continue; + if (fabs(B*data.K) > m_ipt*sqrt(1.+A*A)) continue; ++nseed; newSeed(data, (*r), (*r0), Zo); } @@ -1391,7 +1391,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp float x = dx*ax+dy*ay; float y = dy*ax-dx*ay; float r2 = 1./(x*x+y*y); - float dr = std::sqrt(r2); + float dr = sqrt(r2); float tz = dz*dr; if (i < Nb) tz = -tz; @@ -1420,7 +1420,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp float Vb = data.V [b]; float Ub = data.U [b]; float Tzb2 = (1.+Tzb*Tzb); - float sTzb2 = std::sqrt(Tzb2); + float sTzb2 = sqrt(Tzb2); float CSA = Tzb2*COFK; float ICSA = Tzb2*ipt2C; float imax = imaxp; @@ -1439,16 +1439,13 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp float B2 = B*B; if (B2 > ipt2K*S2 || dT*S2 > B2*CSA) continue; - float y0=1./(2*B); - float x0=-A*y0; - float rTrack = std::sqrt(S2/B2)/2 ; - float Im = std::abs(-rTrack + std::sqrt(rTrack*rTrack +2*x0*R +R*R)); + float Im = fabs((A-B*R)*R); if (Im <= imax) { float dr = data.R[b]; if (data.R[t] < data.R[b]) dr = data.R[t]; - Im+=std::abs((Tzb-data.Tz[t])/(dr*sTzb2)); - data.CmSp.emplace_back(std::make_pair(B/std::sqrt(S2), data.SP[t])); + Im+=fabs((Tzb-data.Tz[t])/(dr*sTzb2)); + data.CmSp.emplace_back(std::make_pair(B/sqrt(S2), data.SP[t])); data.SP[t]->setParam(Im); } @@ -1590,7 +1587,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3SpTrigger float x = dx*ax+dy*ay; float y = dy*ax-dx*ay; float r2 = 1./(x*x+y*y); - float dr = std::sqrt(r2); + float dr = sqrt(r2); float tz = dz*dr; if (i < Nb) tz = -tz; @@ -1634,17 +1631,17 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3SpTrigger float B2 = B*B; if (B2 > ipt2K*S2 || dT*S2 > B2*CSA) continue; - float Im = std::abs((A-B*R)*R); + float Im = fabs((A-B*R)*R); if (Im > imax) continue; // Azimuthal angle test // float y = 1.; float x = 2.*B*R-A; - float df = std::abs(atan2(ay*y-ax*x,ax*y+ay*x)-data.ftrig); + float df = fabs(atan2(ay*y-ax*x,ax*y+ay*x)-data.ftrig); if (df > M_PI) df = pi2-df; if (df > data.ftrigW) continue; - data.CmSp.emplace_back(std::make_pair(B/std::sqrt(S2), data.SP[t])); + data.CmSp.emplace_back(std::make_pair(B/sqrt(S2), data.SP[t])); data.SP[t]->setParam(Im); } if (!data.CmSp.empty()) { @@ -1732,7 +1729,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::newOneSeedWithCurvaturesComparison if ( (*j).second->sur()==Sui) continue; float Rj = (*j).second->radius(); - if (std::abs(Rj-Ri) < m_drmin) continue; + if (fabs(Rj-Ri) < m_drmin) continue; u -= 200.; break; } @@ -1819,12 +1816,12 @@ bool InDet::SiSpacePointsSeedMaker_ATLxk::isZCompatible float dZmin = std::numeric_limits<float>::max(); for (const float& v: data.l_vertex) { - float dZ = std::abs(v-Zv); + float dZ = fabs(v-Zv); if (dZ >= dZmin) break; dZmin = dZ; } - //return dZmin < (m_dzver+m_dzdrver*R)*std::sqrt(1.+T*T); + //return dZmin < (m_dzver+m_dzdrver*R)*sqrt(1.+T*T); //(Minor) speed-up: Avoid calculation of sqrt, compare squares return dZmin*dZmin < (m_dzver+m_dzdrver*R)*(m_dzver+m_dzdrver*R)*(1.+T*T); } @@ -1842,7 +1839,7 @@ InDet::SiSpacePointForSeed* InDet::SiSpacePointsSeedMaker_ATLxk::newSpacePoint convertToBeamFrameWork(data, sp, r); if (data.checketa) { - float z = (std::abs(r[2])+m_zmax); + float z = (fabs(r[2])+m_zmax); float x = r[0]*data.dzdrmin; float y = r[1]*data.dzdrmin; if ((z*z )<(x*x+y*y)) return sps; diff --git a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/share/trt_eff_jobOptions.auto.py b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/share/trt_eff_jobOptions.auto.py index faa853cf39eca90bfe80898a999ec1bb40e1b148..642da63f2f58f7892110776be55b95edbd28570f 100644 --- a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/share/trt_eff_jobOptions.auto.py +++ b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/share/trt_eff_jobOptions.auto.py @@ -168,8 +168,6 @@ InDetFlags.doNewTracking = True #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -#InDetFlags.doxKalman = True -#InDetFlags.doiPatRec = True #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/share/trt_eff_jobOptions.data.raw.py b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/share/trt_eff_jobOptions.data.raw.py index b71ef36dd99dbb1650ac112015066dd4c0072c2e..d36ea305ee958d24b3e7c745a26617eaa6efddf1 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/share/trt_eff_jobOptions.data.raw.py +++ b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/share/trt_eff_jobOptions.data.raw.py @@ -116,8 +116,6 @@ InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.I #InDetFlags.doLowPt = True #InDetFlags.doBeamGas = True #InDetFlags.doBeamHalo = True -InDetFlags.doxKalman = True -InDetFlags.doiPatRec = True #InDetFlags.doBackTracking = False #InDetFlags.doSingleSpBackTracking = True #InDetFlags.doTRTStandalone = False diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx index 8cb40f6b7a2f8eee5e7c949f61399f018ca9e0f1..80bf11ab3c058ace3658020462b62bb9c56fd307 100644 --- a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx +++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx @@ -38,11 +38,32 @@ StatusCode TrackVertexAssociationTool::initialize() ATH_CHECK( m_eventInfo.initialize() ); + // WPs which are obsoleted in Run 2 and remapped to new values: const std::map<std::string, std::string> remap_wps = {{"Loose", "SV_Reject"}, {"Nominal", "SV_Reject"}, {"Tight", "PU_SV_Reject"}}; - auto it = remap_wps.find(m_wp); - if (it != remap_wps.end()) { - ATH_MSG_WARNING("TVA working part '" << m_wp << "' is not recommended for use and will eventually be obsoleted. Automatically remapping to '" << it->second << "' instead."); - m_wp = it->second; + std::string str_of_remapped_wps = "["; + for (auto it = remap_wps.begin(); it != remap_wps.end(); it++) { + str_of_remapped_wps += ("'" + it->first + "',"); + } + str_of_remapped_wps += "]"; + + // If we specify to use an old (Run 2) WP, include special handling + if (m_wp.find("Old_") == 0) { + std::string wp_suffix = m_wp.substr(m_wp.find("_") + 1); + auto it = remap_wps.find(wp_suffix); + if (it != remap_wps.end()) { + m_wp = wp_suffix; + } + else { + ATH_MSG_FATAL("TVA working point '" << wp_suffix << "' was prefixed by 'Old_', but it is not matched to any of " << str_of_remapped_wps << "!"); + } + } + // Else, automatically remap old WPs to new ones + else { + auto it = remap_wps.find(m_wp); + if (it != remap_wps.end()) { + ATH_MSG_WARNING("TVA working point '" << m_wp << "' is not recommended for use and will eventually be obsoleted. Automatically remapping to '" << it->second << "' instead."); + m_wp = it->second; + } } if ( m_wp == "PU_Reject" ) { diff --git a/InnerDetector/InDetTruth/InDetTruthTools/CMakeLists.txt b/InnerDetector/InDetTruth/InDetTruthTools/CMakeLists.txt index e8908cae65c84e67de8e67128f5805b842432afe..dfe02508759bc63028c909a539d5d9bc9f1662ce 100644 --- a/InnerDetector/InDetTruth/InDetTruthTools/CMakeLists.txt +++ b/InnerDetector/InDetTruth/InDetTruthTools/CMakeLists.txt @@ -19,17 +19,17 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetRawEvent/InDetSimData InnerDetector/InDetRecEvent/InDetPrepRawData Tracking/TrkEvent/TrkPrepRawData - Tracking/TrkEvent/TrkTruthData ) + Tracking/TrkEvent/TrkTruthData + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_component( InDetTruthTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthenaBaseComps TrkEventPrimitives AtlasDetDescr GaudiKernel InDetIdentifier InDetReadoutGeometry InDetSimData InDetPrepRawData TrkPrepRawData TrkTruthData ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps TrkEventPrimitives AtlasDetDescr GaudiKernel InDetIdentifier InDetReadoutGeometry InDetSimData InDetPrepRawData TrkPrepRawData TrkTruthData ) # Install files from the package: atlas_install_headers( InDetTruthTools ) diff --git a/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_TruthTrajectoryManipulatorID.cxx b/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_TruthTrajectoryManipulatorID.cxx index 8d4e6df50a6316e354ac6daa3a218ffd2d1b123c..154423ff0e0632a2d48a48aa76e8cb9c3e2d6115 100644 --- a/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_TruthTrajectoryManipulatorID.cxx +++ b/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_TruthTrajectoryManipulatorID.cxx @@ -13,7 +13,7 @@ // DetectorDescription #include "AtlasDetDescr/AtlasDetectorID.h" // HepMC -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" InDet::PRD_TruthTrajectoryManipulatorID::PRD_TruthTrajectoryManipulatorID(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p) diff --git a/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_TruthTrajectorySelectorID.cxx b/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_TruthTrajectorySelectorID.cxx index 348417f7294e870d9e106295a9d81f53deedb521..80e7bb29a1c0a517aae60229a2d15455b44c5244 100644 --- a/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_TruthTrajectorySelectorID.cxx +++ b/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_TruthTrajectorySelectorID.cxx @@ -13,7 +13,7 @@ // DetectorDescription #include "AtlasDetDescr/AtlasDetectorID.h" // HepMC -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" InDet::PRD_TruthTrajectorySelectorID::PRD_TruthTrajectorySelectorID(const std::string& t, const std::string& n, const IInterface* p) : diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/CMakeLists.txt b/InnerDetector/InDetValidation/InDetPerformanceRTT/CMakeLists.txt index 9d0b4787ad1620bad95b6c8e83ebf341ce7f8340..195360370b45b535ca2ccf7b90049edf8b7c0cf5 100644 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/CMakeLists.txt @@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODEventInfo GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetDetDescr/PixelReadoutGeometry @@ -34,7 +35,6 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( Eigen ) -find_package( HepMC ) find_package( HepPDT ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) @@ -42,8 +42,8 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minui atlas_add_component( InDetPerformanceRTT src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaMonitoringLib StoreGateLib AtlasDetDescr xAODEventInfo GaudiKernel GeneratorObjects InDetIdentifier InDetReadoutGeometry SCT_ReadoutGeometry TRT_ReadoutGeometry PixelReadoutGeometry TrkTrack TrkToolInterfaces SGtests GeoPrimitives IdDictDetDescr EventPrimitives InDetPrepRawData InDetRIO_OnTrack JetEvent TrkEventPrimitives TrkTrackSummary TrkTruthData ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${EIGEN_LIBRARIES} AtlasHepMCLib AthenaMonitoringLib StoreGateLib AtlasDetDescr xAODEventInfo GaudiKernel GeneratorObjects InDetIdentifier InDetReadoutGeometry SCT_ReadoutGeometry TRT_ReadoutGeometry PixelReadoutGeometry TrkTrack TrkToolInterfaces SGtests GeoPrimitives IdDictDetDescr EventPrimitives InDetPrepRawData InDetRIO_OnTrack JetEvent TrkEventPrimitives TrkTrackSummary TrkTruthData ) # Install files from the package: atlas_install_headers( InDetPerformanceRTT ) diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions.py b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions.py index 462c9f529775ee703a4e5e68045b5f70297fa45d..63aa74a53fcef39cbf7d4e3dfe8cda85c9a3c285 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions.py +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions.py @@ -193,7 +193,6 @@ InDetFlags.doMonitoringAlignment.set_Value_and_Lock (False) # activate the print InDetXYZAlgorithm statements InDetFlags.doPrintConfigurables.set_Value_and_Lock (True) -#InDetFlags.doiPatRec.set_Value_and_Lock (True) # --- possibility to run tracking on subdetectors separately (and independent from each other) # --- Si track segments incompatible with TIDE setup, which is now default diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_DNA.py b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_DNA.py index 5e8b6d9a5ce809f687199875d0e878d66f1eb2f9..d50c13b4af9c87dc0a49aefecb72ca6e51a63d57 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_DNA.py +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_DNA.py @@ -184,7 +184,6 @@ InDetFlags.doMonitoringAlignment.set_Value_and_Lock (False) # activate the print InDetXYZAlgorithm statements InDetFlags.doPrintConfigurables.set_Value_and_Lock (True) -InDetFlags.doiPatRec.set_Value_and_Lock (True) # --- possibility to run tracking on subdetectors separately (and independent from each other) # --- Si track segments incompatible with TIDE setup, which is now default diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_For20.7Digi.py b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_For20.7Digi.py index e69cdb0c3b4d511062fc303a68580d2fe1d2210b..73d0a0e30fd3a0b2d85ca7d8c1d106bfdd81aa37 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_For20.7Digi.py +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_For20.7Digi.py @@ -193,7 +193,6 @@ InDetFlags.doMonitoringAlignment.set_Value_and_Lock (False) # activate the print InDetXYZAlgorithm statements InDetFlags.doPrintConfigurables.set_Value_and_Lock (True) -#InDetFlags.doiPatRec.set_Value_and_Lock (True) # --- possibility to run tracking on subdetectors separately (and independent from each other) # --- Si track segments incompatible with TIDE setup, which is now default diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_GSF.py b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_GSF.py index ea5d8dd22d8e71cd282db914614f1ea8326e3cd3..793485600d90c87d024a26360edc2aeb8626954d 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_GSF.py +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_GSF.py @@ -189,7 +189,6 @@ InDetFlags.doMonitoringAlignment.set_Value_and_Lock (False) # activate the print InDetXYZAlgorithm statements InDetFlags.doPrintConfigurables.set_Value_and_Lock (True) -#InDetFlags.doiPatRec.set_Value_and_Lock (True) # --- possibility to run tracking on subdetectors separately (and independent from each other) # --- Si track segments incompatible with TIDE setup, which is now default diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_IBL.py b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_IBL.py index 838a67ce7b50d000399f36cd58b8d4f6fb3521fe..0ab69f7740edbe10c45aebec49add8c847496a14 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_IBL.py +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_IBL.py @@ -191,7 +191,6 @@ InDetFlags.doMonitoringAlignment.set_Value_and_Lock (False) # activate the print InDetXYZAlgorithm statements InDetFlags.doPrintConfigurables.set_Value_and_Lock (True) -InDetFlags.doiPatRec.set_Value_and_Lock (False) # --- possibility to run tracking on subdetectors separately (and independent from each other) # --- Si track segments incompatible with TIDE setup, which is now default diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_LowPtTracking.py b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_LowPtTracking.py index 06d0cfa2ddb63e7e54efbc4a6c6c1fd92603cb9c..f86d7ba0471b4d86b0e44d4c30ca46daa8f511ff 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_LowPtTracking.py +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/share/InDetPerformanceRTT_jobOptions_LowPtTracking.py @@ -193,7 +193,6 @@ InDetFlags.doMonitoringAlignment.set_Value_and_Lock (False) # activate the print InDetXYZAlgorithm statements InDetFlags.doPrintConfigurables.set_Value_and_Lock (True) -#InDetFlags.doiPatRec.set_Value_and_Lock (True) # --- possibility to run tracking on subdetectors separately (and independent from each other) # --- Si track segments incompatible with TIDE setup, which is now default diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx b/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx index c8bccb7b3615ffa1eb01df11af38db5ce83bbe94..8ce4c712c7fae9314070180f1ec9eaac85413184 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx @@ -22,8 +22,8 @@ #include "StoreGate/ReadHandle.h" #include "HepPDT/ParticleData.hh" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" #include "HepPDT/ParticleDataTable.hh" #include "IdDictDetDescr/IdDictManager.h" diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py index 254a7107996ac46f1e57a6613f6fde8484c801d5..67e6470c76682c4bab7ccd0b8cd4a2eb4cc826c9 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py @@ -85,6 +85,11 @@ class doExpertOutput(InDetPhysValFlagsJobProperty) : allowedTypes = ['bool'] StoredValue = False +class setTruthStrategy(InDetPhysValFlagsJobProperty) : + statusOn = True + allowedTypes = ['string'] + StoredValue = 'HardScatter' + from InDetRecExample.InDetJobProperties import Enabled ##----------------------------------------------------------------------------- @@ -146,7 +151,8 @@ _list_InDetPhysValJobProperties = [ doValidateTracksInJets, validateExtraTrackCollections, doPhysValOutput, - doExpertOutput + doExpertOutput, + setTruthStrategy ] for j in _list_InDetPhysValJobProperties: diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py index 1ab0e8e70f92b6d016bc2a36a7e6303df974e7f6..e337d1a2b23ea6a262be441380c052e4b160e1e9 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py @@ -63,6 +63,21 @@ def getInDetPhysValMonitoringTool(**kwargs) : kwargs=setDefaults(kwargs, useVertexTruthMatchTool = True, VertexTruthMatchTool = toolFactory(InDetVertexTruthMatchTool) ) + + #Options for Truth Strategy : Requires full pile-up truth containers for some + if InDetPhysValFlags.setTruthStrategy() == 'All' or InDetPhysValFlags.setTruthStrategy() == 'PileUp' : + from RecExConfig.AutoConfiguration import IsInInputFile + if IsInInputFile('xAOD::TruthPileupEventContainer','TruthPileupEvents') : + kwargs=setDefaults(kwargs, + PileupSwitch = InDetPhysValFlags.setTruthStrategy()) + else : + print ('WARNING Truth Strategy for InDetPhysValMonitoring set to %s but TruthPileupEvents are missing in the input; resetting to HardScatter only' % (InDetPhysValFlags.setTruthStrategy())) + elif InDetPhysValFlags.setTruthStrategy() != 'HardScatter' : + print ('WARNING Truth Strategy for for InDetPhysValMonitoring set to invalid option %s; valid flags are ["HardScatter", "All", "PileUp"]' % (InDetPhysValFlags.setTruthStrategy())) + + + + else : # disable truth monitoring for data diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml index 6c428a7233b565e3a6e5ed22f0655a87f435393f..cf1822536e12ae1c5e49058da8d78138b69d6415 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml @@ -935,204 +935,204 @@ <y title="Number of Entries"/> </h> -<h id="resHelpereta_d0" type="TH2F" title="residual vs #eta for d_{0}"> +<h id="resHelper_eta_d0" type="TH2F" title="residual vs #eta for d_{0}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="reco_{d_{0}} - truth_{d_{0}} [mm]" n="3000" lo="-&D0RES;" hi="&D0RES;"/> </h> -<h id="resHelpereta_z0" type="TH2F" title="residual vs #eta for z_{0}"> +<h id="resHelper_eta_z0" type="TH2F" title="residual vs #eta for z_{0}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="reco_{z_{0}} - truth_{z_{0}} [mm]" n="2000" lo="-&Z0RES;" hi="&Z0RES;"/> </h> -<h id="resHelpereta_qoverp" type="TH2F" title="residual vs #eta for qoverp"> +<h id="resHelper_eta_qoverp" type="TH2F" title="residual vs #eta for qoverp"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="reco_{qoverp} - truth_{qoverp} [MeV^{-1}]" n="2000" lo="-2.5e-5" hi="2.5e-5"/> </h> -<h id="resHelpereta_ptqopt" type="TH2F" title="residual vs #eta for p_{T} #times q/p_{T}"> +<h id="resHelper_eta_ptqopt" type="TH2F" title="residual vs #eta for p_{T} #times q/p_{T}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="reco_{p_{T} #times q/p_{T}} - truth_{p_{T} #times q/p_{T}}" n="2000" lo="-&PTQOPTRES;" hi="&PTQOPTRES;"/> </h> -<h id="resHelpereta_theta" type="TH2F" title="residual vs #eta for #theta"> +<h id="resHelper_eta_theta" type="TH2F" title="residual vs #eta for #theta"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="reco_{#theta} - truth_{#theta} [rads]" n="1000" lo="-&THETARES;" hi="&THETARES;"/> </h> -<h id="resHelpereta_phi" type="TH2F" title="residual vs #eta for #phi"> +<h id="resHelper_eta_phi" type="TH2F" title="residual vs #eta for #phi"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="reco_{#phi} - truth_{#phi} [rads]" n="1000" lo="-&PHIRES;" hi="&PHIRES;"/> </h> -<h id="resHelpereta_pt" type="TH2F" title="residual vs #eta for pt"> +<h id="resHelper_eta_pt" type="TH2F" title="residual vs #eta for pt"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="reco_{pt} - truth_{pt} [GeV]" n="1000" lo="-100.0" hi="100.0"/> </h> -<h id="resHelpereta_z0sin" type="TH2F" title="residual vs #eta for z0 #times sin"> +<h id="resHelper_eta_z0sin" type="TH2F" title="residual vs #eta for z0 #times sin"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="reco_{z0 #times sin} - truth_{z0 #times sin} [mm]" n="1000" lo="-&Z0SINRES;" hi="&Z0SINRES;"/> </h> -<h id="resHelperpt_d0" type="TH2F" title="residual vs p_{T} for d_{0}"> +<h id="resHelper_pt_d0" type="TH2F" title="residual vs p_{T} for d_{0}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="reco_{d_{0}} - truth_{d_{0}} [mm]" n="1000" lo="-&D0RES;" hi="&D0RES;"/> </h> -<h id="resHelperpt_z0" type="TH2F" title="residual vs p_{T} for z_{0}"> +<h id="resHelper_pt_z0" type="TH2F" title="residual vs p_{T} for z_{0}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="reco_{z_{0}} - truth_{z_{0}} [mm]" n="2000" lo="-&Z0RES;" hi="&Z0RES;"/> </h> -<h id="resHelperpt_qoverp" type="TH2F" title="residual vs pT for qoverp"> +<h id="resHelper_pt_qoverp" type="TH2F" title="residual vs pT for qoverp"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="reco_{qoverp} - truth_{qoverp} [MeV^{-1}]" n="2000" lo="-2.5e-5" hi="2.5e-5"/> </h> -<h id="resHelperpt_ptqopt" type="TH2F" title="residual vs p_{T} for p_{T} #times q/p_{T}"> +<h id="resHelper_pt_ptqopt" type="TH2F" title="residual vs p_{T} for p_{T} #times q/p_{T}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="reco_{pT #times q/pT} - truth_{pT #times q/pT}" n="2000" lo="-&PTQOPTRES;" hi="&PTQOPTRES;"/> </h> -<h id="resHelperpt_theta" type="TH2F" title="residual vs p_{T} for #theta"> +<h id="resHelper_pt_theta" type="TH2F" title="residual vs p_{T} for #theta"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="reco_{#theta} - truth_{#theta} [rads]" n="1000" lo="-&THETARES;" hi="&THETARES;"/> </h> -<h id="resHelperpt_phi" type="TH2F" title="residual vs p_{T} for #phi"> +<h id="resHelper_pt_phi" type="TH2F" title="residual vs p_{T} for #phi"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="reco_{#phi} - truth_{#phi} [rads]" n="1000" lo="-&PHIRES;" hi="&PHIRES;"/> </h> -<h id="resHelperpt_pt" type="TH2F" title="residual vs pT for pt"> +<h id="resHelper_pt_pt" type="TH2F" title="residual vs pT for pt"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="reco_{pt} - truth_{pt} [GeV]" n="1000" lo="-100.0" hi="100.0"/> </h> -<h id="resHelperpt_z0sin" type="TH2F" title="residual vs p_{T} for z_{0} #times sin"> +<h id="resHelper_pt_z0sin" type="TH2F" title="residual vs p_{T} for z_{0} #times sin"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="reco_{z_{0} #times sin} - truth_{z_{0} #times sin} [mm]" n="1000" lo="-&Z0SINRES;" hi="&Z0SINRES;"/> </h> -<h id="pullHelpereta_d0" type="TH2F" title="pull vs #eta for d_{0}"> +<h id="pullHelper_eta_d0" type="TH2F" title="pull vs #eta for d_{0}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="(reco_{d_{0}} - truth_{d_{0}}) / #sigma(d_{0})" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelpereta_z0" type="TH2F" title="pull vs #eta for z_{0}"> +<h id="pullHelper_eta_z0" type="TH2F" title="pull vs #eta for z_{0}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="(reco_{z_{0}} - truth_{z_{0}}) / #sigma(z_{0})" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelpereta_qoverp" type="TH2F" title="pull vs #eta for qoverp"> +<h id="pullHelper_eta_qoverp" type="TH2F" title="pull vs #eta for qoverp"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="(reco_{qoverp} - truth_{qoverp}) / #sigma(qoverp)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelpereta_ptqopt" type="TH2F" title="pull vs #eta for p_{T} #times q/p_{T}"> +<h id="pullHelper_eta_ptqopt" type="TH2F" title="pull vs #eta for p_{T} #times q/p_{T}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="(reco_{q/p_{T}} - truth_{q/p_{T}) / #sigma(q/p_{T})" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelpereta_theta" type="TH2F" title="pull vs #eta for #theta"> +<h id="pullHelper_eta_theta" type="TH2F" title="pull vs #eta for #theta"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="(reco_{#theta} - truth_{#theta}) / #sigma(#theta)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelpereta_phi" type="TH2F" title="pull vs #eta for #phi"> +<h id="pullHelper_eta_phi" type="TH2F" title="pull vs #eta for #phi"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="(reco_{#phi} - truth_{#phi}) / #sigma(#phi)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelpereta_pt" type="TH2F" title="pull vs #eta for pt"> +<h id="pullHelper_eta_pt" type="TH2F" title="pull vs #eta for pt"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="(reco_{pt} - truth_{pt}) / #sigma(pt)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelpereta_z0sin" type="TH2F" title="pull vs #eta for z_{0} #times sin"> +<h id="pullHelper_eta_z0sin" type="TH2F" title="pull vs #eta for z_{0} #times sin"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="(reco_{z_{0} #times sin} - truth_{z_{0} #times sin}) / #sigma(z_{0} #times sin)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelperpt_d0" type="TH2F" title="pull vs p_{T} for d_{0}"> +<h id="pullHelper_pt_d0" type="TH2F" title="pull vs p_{T} for d_{0}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="(reco_{d_{0}} - truth_{d_{0}}) / #sigma(d_{0})" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelperpt_z0" type="TH2F" title="pull vs p_{T} for z_{0}"> +<h id="pullHelper_pt_z0" type="TH2F" title="pull vs p_{T} for z_{0}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="(reco_{z_{0}} - truth_{z_{0}}) / #sigma(z_{0})" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelperpt_qoverp" type="TH2F" title="pull vs pT for qoverp"> +<h id="pullHelper_pt_qoverp" type="TH2F" title="pull vs pT for qoverp"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="(reco_{qoverp} - truth_{qoverp}) / #sigma(qoverp)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelperpt_ptqopt" type="TH2F" title="pull vs p_{T} for p_{T} #times q/p_{T}"> +<h id="pullHelper_pt_ptqopt" type="TH2F" title="pull vs p_{T} for p_{T} #times q/p_{T}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="(reco_{q/p_{T}} - truth_{q/p_{T}}) / #sigma(q/p_{T})" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelperpt_theta" type="TH2F" title="pull vs p_{T} for #theta"> +<h id="pullHelper_pt_theta" type="TH2F" title="pull vs p_{T} for #theta"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="(reco_{#theta} - truth_{#theta}) / #sigma(#theta)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelperpt_phi" type="TH2F" title="pull vs p_{T} for #phi"> +<h id="pullHelper_pt_phi" type="TH2F" title="pull vs p_{T} for #phi"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="(reco_{#phi} - truth_{#phi}) / #sigma(#phi)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelperpt_pt" type="TH2F" title="pull vs pT for pt"> +<h id="pullHelper_pt_pt" type="TH2F" title="pull vs pT for pt"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="(reco_{pt} - truth_{pt}) / #sigma(pt)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="pullHelperpt_z0sin" type="TH2F" title="pull vs p_{T} for z_{0} #times sin"> +<h id="pullHelper_pt_z0sin" type="TH2F" title="pull vs p_{T} for z_{0} #times sin"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="(reco_{z_{0} #times sin} - truth_{z_{0} #times sin}) / #sigma(z_{0} #times sin)" n="100" lo="-10.0" hi="10.0"/> </h> -<h id="reswidth_vs_eta_d0" type="TH1F" title="resolution vs #eta for d_{0}"> +<h id="resolution_vs_eta_d0" type="TH1F" title="resolution vs #eta for d_{0}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="width of resolution for d_{0}"/> </h> -<h id="reswidth_vs_eta_z0" type="TH1F" title="resolution vs #eta for z_{0}"> +<h id="resolution_vs_eta_z0" type="TH1F" title="resolution vs #eta for z_{0}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="width of resolution for z_{0}"/> </h> -<h id="reswidth_vs_eta_qoverp" type="TH1F" title="resolution vs #eta for qoverp"> +<h id="resolution_vs_eta_qoverp" type="TH1F" title="resolution vs #eta for qoverp"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="qoverp resolution"/> </h> -<h id="reswidth_vs_eta_ptqopt" type="TH1F" title="resolution vs #eta for p_{T} #times q/p_{T}"> +<h id="resolution_vs_eta_ptqopt" type="TH1F" title="resolution vs #eta for p_{T} #times q/p_{T}"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="width of resolution for p_{T} #times q/p_{T}"/> </h> -<h id="reswidth_vs_eta_pt" type="TH1F" title="resolution vs #eta for pt"> +<h id="resolution_vs_eta_pt" type="TH1F" title="resolution vs #eta for pt"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="pt resolution"/> </h> -<h id="reswidth_vs_eta_theta" type="TH1F" title="resolution vs #eta for #theta"> +<h id="resolution_vs_eta_theta" type="TH1F" title="resolution vs #eta for #theta"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="width of resolution for #theta"/> </h> -<h id="reswidth_vs_eta_phi" type="TH1F" title="resolution vs #eta for #phi"> +<h id="resolution_vs_eta_phi" type="TH1F" title="resolution vs #eta for #phi"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="width of resolution for #phi"/> </h> -<h id="reswidth_vs_eta_z0sin" type="TH1F" title="resolution vs #eta for z_{0} #times sin"> +<h id="resolution_vs_eta_z0sin" type="TH1F" title="resolution vs #eta for z_{0} #times sin"> <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/> <y title="width of resolution for z_{0} #times sin"/> </h> @@ -1179,42 +1179,42 @@ <y title="mean of resolution for z_{0} #times sin"/> </h> -<h id="reswidth_vs_pt_d0" type="TH1F" title="resolution vs p_{T} for d_{0}"> +<h id="resolution_vs_pt_d0" type="TH1F" title="resolution vs p_{T} for d_{0}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="width of resolution for d_{0}"/> </h> -<h id="reswidth_vs_pt_z0" type="TH1F" title="resolution vs p_{T} for z_{0}"> +<h id="resolution_vs_pt_z0" type="TH1F" title="resolution vs p_{T} for z_{0}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="width of resolution for z0"/> </h> -<h id="reswidth_vs_pt_qoverp" type="TH1F" title="resolution vs pT for qoverp"> +<h id="resolution_vs_pt_qoverp" type="TH1F" title="resolution vs pT for qoverp"> <x title="p_{T}" n="100" lo="0." hi="100"/> <y title="qoverp resolution"/> </h> -<h id="reswidth_vs_pt_ptqopt" type="TH1F" title="resolution vs p_{T} for p_{T} #times q/p_{T}"> +<h id="resolution_vs_pt_ptqopt" type="TH1F" title="resolution vs p_{T} for p_{T} #times q/p_{T}"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="width of resolution for p_{T} #times q/p_{T}"/> </h> -<h id="reswidth_vs_pt_pt" type="TH1F" title="resolution vs pT for pt"> +<h id="resolution_vs_pt_pt" type="TH1F" title="resolution vs pT for pt"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="pt resolution"/> </h> -<h id="reswidth_vs_pt_theta" type="TH1F" title="resolution vs p_{T} for #theta"> +<h id="resolution_vs_pt_theta" type="TH1F" title="resolution vs p_{T} for #theta"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="width of resolution for #theta"/> </h> -<h id="reswidth_vs_pt_phi" type="TH1F" title="resolution vs p_{T} for #phi"> +<h id="resolution_vs_pt_phi" type="TH1F" title="resolution vs p_{T} for #phi"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="width of resolution for #phi"/> </h> -<h id="reswidth_vs_pt_z0sin" type="TH1F" title="resolution vs p_{T} for z_{0} #times sin"> +<h id="resolution_vs_pt_z0sin" type="TH1F" title="resolution vs p_{T} for z_{0} #times sin"> <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/> <y title="width of resolution for z_{0} #times sin"/> </h> diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx index 9b46ad66093b97fc760817170fb7636e5c7e630f..b39e0b77b14a678584a1ae23b1d4e37ca9a46efa 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx @@ -80,10 +80,6 @@ InDetPerfPlot_Resolution::InDetPerfPlot_Resolution(InDetPlotBase* pParent, const m_allTrk = true; } - // Using globally defined bin limits - for (int ieta = 0; ieta <= m_nEtaBins; ieta++) { - m_EtaBins[ieta] = m_etaMin + ((m_etaMax - m_etaMin) / m_nEtaBins) * ieta; - } std::vector<double> ptBins = IDPVM::logLinearBinning(m_nPtBins, m_ptMin, m_ptMax, false); @@ -111,18 +107,18 @@ InDetPerfPlot_Resolution::initializePlots() { // //2D Distributions to evaluate resolutions vs eta and pT // - book(m_resHelpereta[iparam], "resHelpereta_" + m_paramProp[iparam]); - book(m_resHelperpt[iparam], "resHelperpt_" + m_paramProp[iparam]); - book(m_pullHelpereta[iparam], "pullHelpereta_" + m_paramProp[iparam]); - book(m_pullHelperpt[iparam], "pullHelperpt_" + m_paramProp[iparam]); + book(m_resHelpereta[iparam], "resHelper_eta_" + m_paramProp[iparam]); + book(m_resHelperpt[iparam], "resHelper_pt_" + m_paramProp[iparam]); + book(m_pullHelpereta[iparam], "pullHelper_eta_" + m_paramProp[iparam]); + book(m_pullHelperpt[iparam], "pullHelper_pt_" + m_paramProp[iparam]); m_resHelperpt[iparam]->GetXaxis()->Set(m_nPtBins,m_PtBins); m_pullHelperpt[iparam]->GetXaxis()->Set(m_nPtBins,m_PtBins); // //1D Histograms for the final resolution and means // - book(m_reswidth_vs_eta[iparam], "reswidth_vs_eta_" + m_paramProp[iparam]); + book(m_reswidth_vs_eta[iparam], "resolution_vs_eta_" + m_paramProp[iparam]); book(m_resmean_vs_eta[iparam], "resmean_vs_eta_" + m_paramProp[iparam]); - book(m_reswidth_vs_pt[iparam], "reswidth_vs_pt_" + m_paramProp[iparam]); + book(m_reswidth_vs_pt[iparam], "resolution_vs_pt_" + m_paramProp[iparam]); book(m_resmean_vs_pt[iparam], "resmean_vs_pt_" + m_paramProp[iparam]); book(m_pullwidth_vs_eta[iparam], "pullwidth_vs_eta_" + m_paramProp[iparam]); @@ -151,25 +147,25 @@ InDetPerfPlot_Resolution::initializePlots() { //Detailed histograms // if(m_iDetailLevel >= 200){ - book(m_resHelpereta_pos[iparam], "resHelpereta_pos" + m_paramProp[iparam]); - book(m_resHelpereta_neg[iparam], "resHelpereta_neg" + m_paramProp[iparam]); - book(m_resHelperpt_pos[iparam], "resHelperpt_pos" + m_paramProp[iparam]); - book(m_resHelperpt_neg[iparam], "resHelperpt_neg" + m_paramProp[iparam]); + book(m_resHelpereta_pos[iparam], "resHelper_eta_" + m_paramProp[iparam], "resHelper_eta_" + m_paramProp[iparam]+"_posQ"); + book(m_resHelpereta_neg[iparam], "resHelper_eta_" + m_paramProp[iparam], "resHelper_eta_" + m_paramProp[iparam]+"_negQ"); + book(m_resHelperpt_pos[iparam], "resHelper_pt_" + m_paramProp[iparam], "resHelper_pt_" + m_paramProp[iparam]+"_posQ"); + book(m_resHelperpt_neg[iparam], "resHelper_pt_" + m_paramProp[iparam], "resHelper_pt_" + m_paramProp[iparam]+"_negQ"); //Add log binning m_resHelperpt_pos[iparam]->GetXaxis()->Set(m_nPtBins,m_PtBins); m_resHelperpt_neg[iparam]->GetXaxis()->Set(m_nPtBins,m_PtBins); //Resolution, Resolution Mean, Pull, Pull Mean - book(m_reswidth_vs_eta_pos[iparam], "reswidth_vs_eta_" + m_paramProp[iparam] + "_pos"); - book(m_reswidth_vs_eta_neg[iparam], "reswidth_vs_eta_" + m_paramProp[iparam] + "_neg"); - book(m_resmean_vs_eta_pos[iparam], "resmean_vs_eta_" + m_paramProp[iparam] + "_pos"); - book(m_resmean_vs_eta_neg[iparam], "resmean_vs_eta_" + m_paramProp[iparam] + "_neg"); - - book(m_reswidth_vs_pt_pos[iparam], "reswidth_vs_pt_" + m_paramProp[iparam] + "_pos"); - book(m_reswidth_vs_pt_neg[iparam], "reswidth_vs_pt_" + m_paramProp[iparam] + "_neg"); - book(m_resmean_vs_pt_pos[iparam], "resmean_vs_pt_" + m_paramProp[iparam] + "_pos"); - book(m_resmean_vs_pt_neg[iparam], "resmean_vs_pt_" + m_paramProp[iparam] + "_neg"); + book(m_reswidth_vs_eta_pos[iparam], "resolution_vs_eta_" + m_paramProp[iparam], "resolution_vs_eta_" + m_paramProp[iparam] + "_posQ"); + book(m_reswidth_vs_eta_neg[iparam], "resolution_vs_eta_" + m_paramProp[iparam], "resolution_vs_eta_" + m_paramProp[iparam] + "_negQ"); + book(m_resmean_vs_eta_pos[iparam], "resmean_vs_eta_" + m_paramProp[iparam], "resmean_vs_eta_" + m_paramProp[iparam] + "_posQ"); + book(m_resmean_vs_eta_neg[iparam], "resmean_vs_eta_" + m_paramProp[iparam], "resmean_vs_eta_" + m_paramProp[iparam] + "_negQ"); + + book(m_reswidth_vs_pt_pos[iparam], "resolution_vs_pt_" + m_paramProp[iparam], "resolution_vs_pt_" + m_paramProp[iparam] + "_posQ"); + book(m_reswidth_vs_pt_neg[iparam], "resolution_vs_pt_" + m_paramProp[iparam], "resolution_vs_pt_" + m_paramProp[iparam] + "_negQ"); + book(m_resmean_vs_pt_pos[iparam], "resmean_vs_pt_" + m_paramProp[iparam], "resmean_vs_pt_" + m_paramProp[iparam] + "_posQ"); + book(m_resmean_vs_pt_neg[iparam], "resmean_vs_pt_" + m_paramProp[iparam], "resmean_vs_pt_" + m_paramProp[iparam] + "_negQ"); m_reswidth_vs_pt_pos[iparam]->GetXaxis()->Set(m_nPtBins, m_PtBins); m_resmean_vs_pt_pos[iparam]->GetXaxis()->Set(m_nPtBins, m_PtBins); @@ -177,37 +173,37 @@ InDetPerfPlot_Resolution::initializePlots() { m_resmean_vs_pt_neg[iparam]->GetXaxis()->Set(m_nPtBins, m_PtBins); std::string tmpName, tmpTitle; - float paramResBins[NPARAMS] = { 1000, 2000, 2000, 1000, 1000, 1000, 1000 }; - float paramRes[NPARAMS] = { 1.5, 10.0, 2.5e-5, 0.01, 0.01, 100.0, 0.2 }; + + int nPtBins = m_pullHelperpt[iparam]->GetNbinsX(); + int nEtaBins = m_pullHelpereta[iparam]->GetNbinsX(); + + std::shared_ptr<TH1D> refHistEta { m_pullHelpereta[iparam]->ProjectionY("refEta")}; + std::shared_ptr<TH1D> refHistPt { m_pullHelperpt[iparam]->ProjectionY("refPt")}; //Projections - for (unsigned int ibins = 0; ibins < m_nPtBins; ibins++) { - tmpName = "PtProjections_pullProjection_" + m_paramProp[iparam] + std::to_string(ibins + 1); + for (int ibins = 0; ibins < nPtBins; ibins++) { + tmpName = "pullProjection_pt_" + m_paramProp[iparam] +"_bin_"+ std::to_string(ibins + 1); tmpTitle = tmpName + "; (" + m_paramProp[iparam] + "^{reco}-" + m_paramProp[iparam] + "^{true})/#sigma_{" + m_paramProp[iparam] + "}"; - m_pullProjections_vs_pt[iparam][ibins] = Book1D(tmpName, tmpTitle, 200, -10.0, 10.0, false); - } + m_pullProjections_vs_pt[iparam][ibins] = Book1D(tmpName, refHistPt.get(), tmpTitle , false); + + + tmpName = "resProjection_pt_" + m_paramProp[iparam] +"_bin_"+ std::to_string(ibins + 1); + tmpTitle = tmpName + "; " + m_paramProp[iparam] + "^{reco}-" + m_paramProp[iparam] + "^{true} "; + m_resProjections_vs_pt[iparam][ibins] = Book1D(tmpName, refHistPt.get(), tmpTitle , false); - for (unsigned int ibins = 0; ibins < m_nEtaBins; ibins++) { - tmpName = "EtaProjections_pullProjection_" + m_paramProp[iparam] + std::to_string(ibins + 1); + } + for (int ibins = 0; ibins < nEtaBins; ibins++) { + tmpName = "pullProjection_eta_" + m_paramProp[iparam] +"_bin_"+ std::to_string(ibins + 1); tmpTitle = tmpName + "; (" + m_paramProp[iparam] + "^{reco}-" + m_paramProp[iparam] + "^{true})/#sigma_{" + m_paramProp[iparam] + "}"; - m_pullProjections_vs_eta[iparam][ibins] = Book1D(tmpName, tmpTitle, 200, -10.0, 10.0, false); - } - for (unsigned int ibins = 0; ibins < m_nPtBins; ibins++) { - tmpName = "PtProjections_resProjection_" + m_paramProp[iparam] + std::to_string(ibins + 1); - tmpTitle = tmpName + "; " + m_paramProp[iparam] + "^{reco}-" + m_paramProp[iparam] + - "^{true} "; - m_resProjections_vs_pt[iparam][ibins] = - Book1D(tmpName, tmpTitle, paramResBins[iparam], -paramRes[iparam], paramRes[iparam], false); - } - for (unsigned int ibins = 0; ibins < m_nEtaBins; ibins++) { - tmpName = "EtaProjections_resProjection_" + m_paramProp[iparam] + std::to_string(ibins + 1); - tmpTitle = "resProjection_" + m_paramProp[iparam] + std::to_string(ibins + 1) + "; " + - m_paramProp[iparam] + "^{reco}-" + m_paramProp[iparam] + "^{true} "; - m_resProjections_vs_eta[iparam][ibins] = - Book1D(tmpName, tmpTitle, paramResBins[iparam], -paramRes[iparam], paramRes[iparam], false); - } + m_pullProjections_vs_eta[iparam][ibins] = Book1D(tmpName, refHistEta.get(), tmpTitle , false); + + + tmpName = "resProjection_eta_" + m_paramProp[iparam] +"_bin_"+ std::to_string(ibins + 1); + tmpTitle = tmpName + "; " + m_paramProp[iparam] + "^{reco}-" + m_paramProp[iparam] + "^{true} "; + m_resProjections_vs_eta[iparam][ibins] = Book1D(tmpName, refHistEta.get(), tmpTitle , false); + } } // //End of saving resolution and pull residual binnings @@ -261,9 +257,9 @@ InDetPerfPlot_Resolution::getPlots() { m_pull[iparam]->Fill(m_pullP[iparam]); m_res[iparam]->Fill(m_resP[iparam]); if(iparam == QOVERPT){ - m_sigma[iparam]->Fill(m_trkP[PT] * m_sigP[iparam]); - m_sigma_vs_eta[iparam]->Fill(eta, m_trkP[PT] * m_sigP[iparam]); - m_sigma_vs_pt[iparam]->Fill(m_truetrkP[PT], m_trkP[PT] * m_sigP[iparam]); + m_sigma[iparam]->Fill(m_sigP[iparam]); + m_sigma_vs_eta[iparam]->Fill(eta, m_sigP[iparam]); + m_sigma_vs_pt[iparam]->Fill(m_truetrkP[PT], m_sigP[iparam]); } else { m_sigma[iparam]->Fill(m_sigP[iparam]); m_sigma_vs_eta[iparam]->Fill(eta, m_sigP[iparam]); @@ -297,8 +293,8 @@ InDetPerfPlot_Resolution::getPlotParameters() { m_sigP[iparam] = m_trkErrP[iparam]; (m_sigP[iparam] != 0) ? m_pullP[iparam] = m_resP[iparam] / m_sigP[iparam] : m_pullP[iparam] = -9999.; } - m_resP[QOVERPT] = m_trkP[PT] * (m_trkP[QOVERPT] - m_truetrkP[QOVERPT]) * (1 / m_truetrkP[QOVERPT]); - m_sigP[QOVERPT] *= m_trkP[PT]; + m_resP[QOVERPT] = (m_trkP[QOVERPT] - m_truetrkP[QOVERPT]) * (1 / m_truetrkP[QOVERPT]); // relative q/pt resolution + m_sigP[QOVERPT] *= m_trkP[PT]; // relative q/pt error } void diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.h index 5276b309ca7d1797b2b402bfb561490debdeab30..608abd5e894d87483a0f2ed4c4c9af46e1a6a09d 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.h @@ -56,15 +56,14 @@ private: static const int m_nResHist = 4; static const int m_nEtaBins = 64; - const double m_etaMin = -4.0; - const double m_etaMax = 4.0; + //const double m_etaMin = -4.0; + //const double m_etaMax = 4.0; // Settings for log-linear binning in pt (matching previous IDPVM definition) static const int m_nPtBins = 49; const double m_ptMin = 0.745; const double m_ptMax = 1000.0; - float m_EtaBins[m_nEtaBins + 1]; float m_PtBins[m_nPtBins + 1]; std::string m_paramProp[NPARAMS] = { "d0", "z0", "ptqopt", "theta", "phi", "pt", "z0sin" }; diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx index 329c298b81e7e6b006dc5ab0dd248052a860f51e..7c873dc9e911721684092be5aee6cc76794bf5f9 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx @@ -78,7 +78,7 @@ namespace { // utility functions used here bool passJetCuts(const xAOD::Jet& jet) { const float absEtaMax = 2.5; - const float jetPtMin = 10.0; // in GeV + const float jetPtMin = 100.0; // in GeV const float jetPtMax = 1000.0; // in GeV const float jetPt = jet.pt() / Gaudi::Units::GeV; // GeV const float jetEta = jet.eta(); @@ -137,7 +137,7 @@ InDetPhysValMonitoringTool::InDetPhysValMonitoringTool(const std::string& type, declareProperty("maxTrkJetDR", m_maxTrkJetDR = 0.4); declareProperty("DirName", m_dirName = "SquirrelPlots/"); declareProperty("SubFolder", m_folder); - declareProperty("PileupSwitch", m_pileupSwitch = "All"); + declareProperty("PileupSwitch", m_pileupSwitch = "HardScatter"); declareProperty("LowProb", m_lowProb=0.50); declareProperty("HighProb", m_highProb=0.80); declareProperty("SkillLevel", m_detailLevel=10); @@ -497,10 +497,11 @@ const std::vector<const xAOD::TruthParticle*> InDetPhysValMonitoringTool::getTruthParticles() { // truthParticles.clear(); std::vector<const xAOD::TruthParticle*> tempVec {}; - if (m_truthParticleName.key().empty()) { - return tempVec; - } if (m_pileupSwitch == "All") { + + if (m_truthParticleName.key().empty()) { + return tempVec; + } SG::ReadHandle<xAOD::TruthParticleContainer> truthParticleContainer( m_truthParticleName); if (not truthParticleContainer.isValid()) { return tempVec; @@ -518,7 +519,9 @@ InDetPhysValMonitoringTool::getTruthParticles() { const auto& links = event->truthParticleLinks(); tempVec.reserve(event->nTruthParticles()); for (const auto& link : links) { - tempVec.push_back(*link); + if (link.isValid()){ + tempVec.push_back(*link); + } } } } else if (m_pileupSwitch == "PileUp") { diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPlotBase.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPlotBase.cxx index 02935038eed4dd57ab8bbace0a21cf0f06cb26b5..87d169b485f7ee8b748d650e79c7f7be9a731a4e 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPlotBase.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPlotBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -60,8 +60,8 @@ InDetPlotBase::book(TProfile*& pHisto, const SingleHistogramDefinition& hd) { } void -InDetPlotBase::book(TH1*& pHisto, const std::string& histoIdentifier, const std::string& folder) { - const SingleHistogramDefinition hd = retrieveDefinition(histoIdentifier, folder); +InDetPlotBase::book(TH1*& pHisto, const std::string& histoIdentifier, const std::string & nameOverride, const std::string& folder) { + const SingleHistogramDefinition hd = retrieveDefinition(histoIdentifier, folder, nameOverride); if (hd.empty()) { ATH_MSG_WARNING("Histogram definition is empty for identifier " << histoIdentifier); @@ -71,8 +71,8 @@ InDetPlotBase::book(TH1*& pHisto, const std::string& histoIdentifier, const std: } void -InDetPlotBase::book(TProfile*& pHisto, const std::string& histoIdentifier, const std::string& folder) { - const SingleHistogramDefinition hd = retrieveDefinition(histoIdentifier, folder); +InDetPlotBase::book(TProfile*& pHisto, const std::string& histoIdentifier, const std::string & nameOverride, const std::string& folder) { + const SingleHistogramDefinition hd = retrieveDefinition(histoIdentifier, folder, nameOverride); if (hd.empty()) { ATH_MSG_WARNING("Histogram definition is empty for identifier " << histoIdentifier); @@ -82,8 +82,8 @@ InDetPlotBase::book(TProfile*& pHisto, const std::string& histoIdentifier, const } void -InDetPlotBase::book(TH2*& pHisto, const std::string& histoIdentifier, const std::string& folder) { - const SingleHistogramDefinition hd = retrieveDefinition(histoIdentifier, folder); +InDetPlotBase::book(TH2*& pHisto, const std::string& histoIdentifier, const std::string & nameOverride, const std::string& folder) { + const SingleHistogramDefinition hd = retrieveDefinition(histoIdentifier, folder, nameOverride); if (hd.empty()) { ATH_MSG_WARNING("Histogram definition is empty for identifier " << histoIdentifier); @@ -111,8 +111,8 @@ InDetPlotBase::book(TEfficiency*& pHisto, const SingleHistogramDefinition& hd) { } void -InDetPlotBase::book(TEfficiency*& pHisto, const std::string& histoIdentifier, const std::string& folder) { - const SingleHistogramDefinition hd = retrieveDefinition(histoIdentifier, folder); +InDetPlotBase::book(TEfficiency*& pHisto, const std::string& histoIdentifier, const std::string & nameOverride, const std::string& folder) { + const SingleHistogramDefinition hd = retrieveDefinition(histoIdentifier, folder, nameOverride); if (hd.empty()) { ATH_MSG_WARNING("Histogram definition is empty for identifier " << histoIdentifier); @@ -167,7 +167,7 @@ InDetPlotBase::fillHisto(TEfficiency* pTeff, const float value, const bool acce /**/ SingleHistogramDefinition -InDetPlotBase::retrieveDefinition(const std::string& histoIdentifier, const std::string& folder) { +InDetPlotBase::retrieveDefinition(const std::string& histoIdentifier, const std::string& folder, const std::string & nameOverride) { SingleHistogramDefinition s; // invalid result if (not m_histoDefSvc) { @@ -189,5 +189,8 @@ InDetPlotBase::retrieveDefinition(const std::string& histoIdentifier, const std: if (s.empty()) { ATH_MSG_WARNING("Histogram definition is empty for identifier " << histoIdentifier); } + if (!nameOverride.empty()){ + s.name = nameOverride; + } return s; } diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPlotBase.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPlotBase.h index 030f3b09baa7962738ed6ae4df8fecd2b4f3450a..bdc44e8ea9866ec8c9594b5bfa57d339f3fc596c 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPlotBase.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPlotBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETPHYSVALMONITORING_INDETPLOTBASE @@ -36,26 +36,35 @@ public: /// Retrieve a single histogram definition, given the unique string identifier SingleHistogramDefinition retrieveDefinition(const std::string& histoIdentifier, - const std::string& folder = "default"); + const std::string& folder = "default", + const std::string& nameOverride=""); /// Book a TH1 histogram void book(TH1*& pHisto, const SingleHistogramDefinition& hd); - /// Book a TH1 histogram with optional folder name - void book(TH1*& pHisto, const std::string& histoIdentifier, const std::string& folder = "default"); + /// Book a TH1 histogram with optional folder name. The name_override argument allows to assign a different + /// name to the created histogram than the one looked up from the XML. This can be used to instantiate + /// multiple, identically binned plots from a single entry in the XML. + void book(TH1*& pHisto, const std::string& histoIdentifier, const std::string & nameOverride="", const std::string& folder = "default"); /// Book a TProfile histogram void book(TProfile*& pHisto, const SingleHistogramDefinition& hd); - /// Book a TH1 histogram with optional folder name - void book(TProfile*& pHisto, const std::string& histoIdentifier, const std::string& folder = "default"); + /// Book a TProfile histogram with optional folder name. The name_override argument allows to assign a different + /// name to the created histogram than the one looked up from the XML. This can be used to instantiate + /// multiple, identically binned plots from a single entry in the XML. + void book(TProfile*& pHisto, const std::string& histoIdentifier, const std::string & nameOverride="", const std::string& folder = "default"); /// Book a 2D histogram (TH2) void book(TH2*& pHisto, const SingleHistogramDefinition& hd); - /// Book a 2D histogram (TH2) with optional folder name - void book(TH2*& pHisto, const std::string& histoIdentifier, const std::string& folder = "default"); + /// Book a 2D histogram (TH2) with optional folder name. The name_override argument allows to assign a different + /// name to the created histogram than the one looked up from the XML. This can be used to instantiate + /// multiple, identically binned plots from a single entry in the XML. + void book(TH2*& pHisto, const std::string& histoIdentifier, const std::string & nameOverride="", const std::string& folder = "default"); /// Book a (1-D) TEfficiency void book(TEfficiency*& pHisto, const SingleHistogramDefinition& hd); - /// Book a TEfficiency with optional folder name - void book(TEfficiency*& pHisto, const std::string& histoIdentifier, const std::string& folder = "default"); + /// Book a TEfficiency with optional folder name. The name_override argument allows to assign a different + /// name to the created histogram than the one looked up from the XML. This can be used to instantiate + /// multiple, identically binned plots from a single entry in the XML. + void book(TEfficiency*& pHisto, const std::string& histoIdentifier, const std::string & nameOverride="", const std::string& folder = "default"); // void fillHisto(TProfile* pTprofile, const float bin, const float weight); // diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx index b98d12d91d8b5cd2df1311c8a6856d81e8b5938a..c9b438103fb9972086375b4efda7fb8e167e1d7c 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx @@ -23,27 +23,27 @@ InDetRttPlots::InDetRttPlots(InDetPlotBase* pParent, const std::string& sDir) : m_fakePlots(this, "Tracks/FakeRate"), m_missingTruthFakePlots(this, "Tracks/Unlinked/FakeRate"), m_resolutionPlotPrim(this, "Tracks/Matched/Resolutions/Primary"), - m_resolutionPlotSecd(nullptr), m_hitsRecoTracksPlots(this, "Tracks/Selected/HitsOnTracks"), m_effPlots(this, "Tracks/Efficiency"), m_verticesVsMuPlots(this, "Vertices/AllPrimaryVertices"), m_vertexPlots(this, "Vertices/AllPrimaryVertices"), m_hardScatterVertexPlots(this, "Vertices/HardScatteringVertex"), m_hardScatterVertexTruthMatchingPlots(this, "Vertices/HardScatteringVertex"), + m_resolutionPlotSecd(nullptr), m_doTrackInJetPlots(true) //FIX CONFIGURATION - { +{ m_trackParticleTruthProbKey = "truthMatchProbability"; m_truthProbLowThreshold = 0.5; if(m_iDetailLevel >= 200){ - m_resolutionPlotSecd = new InDetPerfPlot_Resolution(this, "Tracks/Matched/Resolutions/Secondary"); - m_hitsMatchedTracksPlots = new InDetPerfPlot_Hits(this, "Tracks/Matched/HitsOnTracks"); - m_vertexTruthMatchingPlots = new InDetPerfPlot_VertexTruthMatching(this, "Vertices/AllPrimaryVertices"); + m_resolutionPlotSecd = std::unique_ptr<InDetPerfPlot_Resolution>(new InDetPerfPlot_Resolution(this, "Tracks/Matched/Resolutions/Secondary")); + m_hitsMatchedTracksPlots = std::unique_ptr<InDetPerfPlot_Hits>(new InDetPerfPlot_Hits(this, "Tracks/Matched/HitsOnTracks")); + m_vertexTruthMatchingPlots = std::unique_ptr<InDetPerfPlot_VertexTruthMatching>(new InDetPerfPlot_VertexTruthMatching(this, "Vertices/AllPrimaryVertices")); } //A lot of Jets... do we need these at all??? if(m_doTrackInJetPlots){ - m_trkInJetPlots = new InDetPerfPlot_TrkInJet(this, "TracksInJets/Tracks"); + m_trkInJetPlots = std::unique_ptr<InDetPerfPlot_TrkInJet>(new InDetPerfPlot_TrkInJet(this, "TracksInJets/Tracks")); } } diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h index 0280b5ddc1c6d4acdb567aee4355fc181fe6cba2..fd1bb3e8ed3ab138cffbcf4ce55cfd21ed4bfde4 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h @@ -13,6 +13,8 @@ // std includes #include <string> +#include <memory> + // local includes #include "InDetPlotBase.h" #include "InDetBasicPlot.h" @@ -82,20 +84,18 @@ private: InDetPerfPlot_FakeRate m_fakePlots; InDetPerfPlot_FakeRate m_missingTruthFakePlots; InDetPerfPlot_Resolution m_resolutionPlotPrim; - InDetPerfPlot_Resolution* m_resolutionPlotSecd; - InDetPerfPlot_Hits *m_hitsMatchedTracksPlots; InDetPerfPlot_Hits m_hitsRecoTracksPlots; InDetPerfPlot_Efficiency m_effPlots; - InDetPerfPlot_VerticesVsMu m_verticesVsMuPlots; InDetPerfPlot_Vertex m_vertexPlots; InDetPerfPlot_Vertex m_hardScatterVertexPlots; - InDetPerfPlot_VertexTruthMatching *m_vertexTruthMatchingPlots; InDetPerfPlot_VertexTruthMatching m_hardScatterVertexTruthMatchingPlots; + std::unique_ptr<InDetPerfPlot_Resolution> m_resolutionPlotSecd; + std::unique_ptr<InDetPerfPlot_Hits> m_hitsMatchedTracksPlots; + std::unique_ptr<InDetPerfPlot_VertexTruthMatching> m_vertexTruthMatchingPlots; bool m_doTrackInJetPlots; - - InDetPerfPlot_TrkInJet *m_trkInJetPlots; + std::unique_ptr<InDetPerfPlot_TrkInJet> m_trkInJetPlots; std::string m_trackParticleTruthProbKey; float m_truthProbLowThreshold; diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/util/postProcessIDPVMHistos.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/util/postProcessIDPVMHistos.cxx index 6106a975537c8f034d085ff24ef0dc805f51b62b..abd1132b18e6ddcf812eaf55dcefb389ddf94e69 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/util/postProcessIDPVMHistos.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/util/postProcessIDPVMHistos.cxx @@ -41,10 +41,10 @@ bool isResolutionHelper(TObject* entry){ // Relies on the conventions within IDPVM std::pair<std::string, std::string> getObservableAndReso(const TObject* resHelper){ const std::string name{resHelper->GetName()}; - const std::string keyWord {"Helper"}; + const std::string keyWord {"Helper_"}; const size_t offset = keyWord.size(); auto start = name.find(keyWord)+offset; - auto sep = name.find("_"); + auto sep = name.find("_",start); return {name.substr(start, sep-start), name.substr(sep+1)}; } @@ -69,7 +69,20 @@ TH1* cloneExisting(const std::string & name){ return ret; // will also catch ret == nullptr } -// so far, we only support the 2D --> 1D case. 3D --> 2D is not used in IDPVM to date. +// get the names of the 1D histograms following IDPVM conventions. +std::pair<std::string, std::string> getPullAndResoNames(const std::string & type){ + if (type == "res"){ + return {"resolution","resmean"}; + } + else if (type == "pull"){ + return {"pullwidth","pullmean"}; + } + else { + std::cerr << " Not able to identify the histogram names for a resolution type "<<type<<" - supported are 'res' and 'pull'. "<<std::endl; + } + return {"",""}; +} + int postProcessHistos(TObject* resHelper, IDPVM::ResolutionHelper & theHelper){ // here we have to rely on the naming conventions of IDPVM to identify what we are looking at auto vars = getObservableAndReso(resHelper); @@ -80,9 +93,10 @@ int postProcessHistos(TObject* resHelper, IDPVM::ResolutionHelper & theHelper){ std::cerr <<"Unable to reduce the histogram "<<resHelper->GetName()<<" to a TH2 - this histo can not yet be postprocessed! " <<std::endl; return 1; } + const auto & oneDimNames = getPullAndResoNames(type); // get the corresponding 1D histos by cloning the existing ones in the same folder - TH1* h_width = cloneExisting(type + "width_vs_"+vars.first+"_"+vars.second); - TH1* h_mean = cloneExisting(type + "mean_vs_"+vars.first+"_"+vars.second); + TH1* h_width = cloneExisting(oneDimNames.first+"_vs_"+vars.first+"_"+vars.second); + TH1* h_mean = cloneExisting(oneDimNames.second+"_vs_"+vars.first+"_"+vars.second); // then call the resolution helper as done in "online" IDPVM theHelper.makeResolutions(resHelper2D, h_width, h_mean); // update our 1D histos diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/CMakeLists.txt b/InnerDetector/InDetValidation/InDetRecStatistics/CMakeLists.txt index 423daa43e1ad0e793b34a4353a927bb16fb83973..33e712d32184b9efd619b94b6f421c271cde4c13 100644 --- a/InnerDetector/InDetValidation/InDetRecStatistics/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetRecStatistics/CMakeLists.txt @@ -11,6 +11,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/Identifier GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTrackSummary PRIVATE @@ -31,15 +32,14 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( InDetRecStatistics src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps Identifier GaudiKernel GeneratorObjects TrkTrack TrkTrackSummary AtlasDetDescr IdDictDetDescr TruthHelper InDetIdentifier InDetRIO_OnTrack TrkSurfaces TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkParameters TrkRIO_OnTrack TrkTruthData VxVertex TrkToolInterfaces ) + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps Identifier GaudiKernel GeneratorObjects TrkTrack TrkTrackSummary AtlasDetDescr IdDictDetDescr TruthHelper InDetIdentifier InDetRIO_OnTrack TrkSurfaces TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkParameters TrkRIO_OnTrack TrkTruthData VxVertex TrkToolInterfaces ) # Install files from the package: atlas_install_headers( InDetRecStatistics ) diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h b/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h index cd4d17ff6c8271ae6b83dfbb28f0a52a2517002e..def8ec0b7811576f108262fa49369494911851cf 100755 --- a/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h +++ b/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h @@ -17,7 +17,7 @@ #include "TrkTrack/TrackInfo.h" #include "TrkTrackSummary/TrackSummary.h" // needed by Trk::numberOfTrackSummaryTypes #include "TrkTrack/TrackCollection.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" #include "TrkToolInterfaces/IPRDtoTrackMapTool.h" diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx index 50a2c2afe36350ab83e77ccc310382b56dce8151..282d736b5bbd0463ec0621a4b8671f095ecfc69c 100755 --- a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx +++ b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx @@ -65,7 +65,7 @@ #include "InDetRecStatistics/InDetRecStatisticsAlg.h" #include "InDetRecStatistics/TrackStatHelper.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TruthHelper/PileUpType.h" #include "IdDictDetDescr/IdDictManager.h" diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/src/TrackStatHelper.cxx b/InnerDetector/InDetValidation/InDetRecStatistics/src/TrackStatHelper.cxx index 1ddfad33204ca764499074340748ce8f9aeae81a..1f9d5946e2021f86942667d7808aa21c72f20054 100755 --- a/InnerDetector/InDetValidation/InDetRecStatistics/src/TrackStatHelper.cxx +++ b/InnerDetector/InDetValidation/InDetRecStatistics/src/TrackStatHelper.cxx @@ -25,7 +25,7 @@ #include "InDetIdentifier/SCT_ID.h" #include "TrkTruthData/TrackTruth.h" #include "TrkTruthData/TrackTruthCollection.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" #include <iostream> #include <sstream> #include <vector> diff --git a/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/CMakeLists.txt b/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/CMakeLists.txt index cec6f51ead4bc1a40c59cd6b50858bc0364ac63a..a48fa89d6ad5cdca4216c22fac46ef26b21364bf 100644 --- a/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/CMakeLists.txt @@ -16,18 +16,18 @@ atlas_depends_on_subdirs( PUBLIC Control/StoreGate InnerDetector/InDetRecEvent/InDetRIO_OnTrack Tracking/TrkEvent/TrkPseudoMeasurementOnTrack - Tracking/TrkEvent/TrkTrack ) + Tracking/TrkEvent/TrkTrack + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( InDetSegmentDriftCircleAssValidation src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData TrkSegment TrkTruthData InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkTrack ) + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel InDetPrepRawData TrkSegment TrkTruthData InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkTrack ) # Install files from the package: atlas_install_headers( InDetSegmentDriftCircleAssValidation ) diff --git a/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/InDetSegmentDriftCircleAssValidation/SegmentDriftCircleAssValidation.h b/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/InDetSegmentDriftCircleAssValidation/SegmentDriftCircleAssValidation.h index 9a4016334efca0aa6f731638cd5631ee4e2995f3..c87724505e8b479667130ec751088bcd33c5f7fd 100644 --- a/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/InDetSegmentDriftCircleAssValidation/SegmentDriftCircleAssValidation.h +++ b/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/InDetSegmentDriftCircleAssValidation/SegmentDriftCircleAssValidation.h @@ -9,7 +9,7 @@ #include <map> #include "AthenaBaseComps/AthAlgorithm.h" #include "InDetPrepRawData/TRT_DriftCircleContainer.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "HepPDT/ParticleDataTable.hh" #include "TrkTruthData/PRD_MultiTruthCollection.h" diff --git a/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/src/SegmentDriftCircleAssValidation.cxx b/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/src/SegmentDriftCircleAssValidation.cxx index 988783d4463c8485b292bc64072981184d309a47..e354d9d331f1775888f3cb4e4d8dd5629e57684d 100644 --- a/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/src/SegmentDriftCircleAssValidation.cxx +++ b/InnerDetector/InDetValidation/InDetSegmentDriftCircleAssValidation/src/SegmentDriftCircleAssValidation.cxx @@ -15,7 +15,7 @@ #include "InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h" #include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" #include "InDetSegmentDriftCircleAssValidation/SegmentDriftCircleAssValidation.h" // ReadHandle diff --git a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/CMakeLists.txt b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/CMakeLists.txt index 6b364e7135757e0150a62a83d5c74f7a1276adbb..68fb9ca29890175c4ecfd39289285ab1903f587b 100644 --- a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/CMakeLists.txt @@ -15,18 +15,18 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE GaudiKernel Tracking/TrkEvent/TrkRIO_OnTrack - Tracking/TrkEvent/TrkTrack ) + Tracking/TrkEvent/TrkTrack + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( InDetTrackClusterAssValidation src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps StoreGateLib SGtests InDetPrepRawData TrkSpacePoint TrkTruthData GaudiKernel TrkRIO_OnTrack TrkTrack ) + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps StoreGateLib SGtests InDetPrepRawData TrkSpacePoint TrkTruthData GaudiKernel TrkRIO_OnTrack TrkTrack ) # Install files from the package: atlas_install_headers( InDetTrackClusterAssValidation ) diff --git a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/src/TrackClusterAssValidation.cxx b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/src/TrackClusterAssValidation.cxx index 7390ae89d70308737d7303b61997b4707802c932..2d5dc5811744c577c8700539bb9fd7459142ee41 100755 --- a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/src/TrackClusterAssValidation.cxx +++ b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/src/TrackClusterAssValidation.cxx @@ -4,7 +4,7 @@ #include "GaudiKernel/IPartPropSvc.h" #include "GaudiKernel/ServiceHandle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" #include "TrkTrack/TrackCollection.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "InDetPrepRawData/SCT_ClusterContainer.h" @@ -12,7 +12,7 @@ #include "InDetTrackClusterAssValidation/TrackClusterAssValidation.h" #include "StoreGate/ReadHandle.h" #include "HepPDT/ParticleDataTable.hh" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <cmath> /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/CMakeLists.txt b/InnerDetector/InDetValidation/InDetTrackValidation/CMakeLists.txt index b8b72a607df67e1d5bac23a0083341c658c79180..360596cf8666f3380675a8f595a6024aa1606aed 100644 --- a/InnerDetector/InDetValidation/InDetTrackValidation/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetTrackValidation/CMakeLists.txt @@ -26,6 +26,7 @@ atlas_depends_on_subdirs( DetectorDescription/GeoModel/GeoModelInterfaces Event/EventPrimitives Generators/GeneratorObjects + Generators/AtlasHepMC InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetConditions/PixelConditionsTools @@ -46,14 +47,13 @@ atlas_depends_on_subdirs( # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore ) # Component(s) in the package: atlas_add_component( InDetTrackValidation InDetTrackValidation/*.h src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel StoreGateLib SGtests xAODEventInfo GaudiKernel InDetRawData InDetPrepRawData InDetSimEvent TrkParameters TrkSpacePoint TrkTrack TrkValInterfaces AthContainers AtlasDetDescr EventPrimitives GeneratorObjects TRT_ConditionsData diff --git a/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx b/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx index 600242b170ed5c09077318adcd4c385abfebe03b..99380ae1d99a95b7d3e259702500a0eb9296448e 100644 --- a/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx +++ b/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "InDetTruthVertexValidation/InDetVertexTruthMatchTool.h" @@ -136,7 +136,11 @@ InDetVertexTruthMatchTool::findTrackParticleContainer( const xAOD::VertexContain StatusCode InDetVertexTruthMatchTool::matchVertices( const xAOD::VertexContainer & vxContainer ) { ATH_MSG_DEBUG("Start vertex matching"); - + if (vxContainer.empty() || // reject empty vertex containers + (vxContainer.size() == 1 && vxContainer.at(0)->vertexType() == xAOD::VxType::NoVtx)){ // as well as containers containing only a dummy vertex + ATH_MSG_DEBUG("No vertices to match."); + return StatusCode::SUCCESS; + } // Identify MC vertices to match to -- this is the collection for hard scatter const xAOD::TruthEventBaseContainer * truthEvents = nullptr; if ( evtStore()->contains<xAOD::TruthEventBaseContainer>( "TruthEvents" ) ) diff --git a/LArCalorimeter/LArCafJobs/CMakeLists.txt b/LArCalorimeter/LArCafJobs/CMakeLists.txt index f82c111450904e5d78ca7b96ace22cf4373b2d36..76918f736c954c2af79115e9f2384c63cc72708a 100644 --- a/LArCalorimeter/LArCafJobs/CMakeLists.txt +++ b/LArCalorimeter/LArCafJobs/CMakeLists.txt @@ -39,12 +39,12 @@ atlas_depends_on_subdirs( PUBLIC LArCalorimeter/LArElecCalib LArCalorimeter/LArRecEvent Trigger/TrigConfiguration/TrigConfHLTData - Trigger/TrigT1/TrigT1Result ) + Trigger/TrigT1/TrigT1Result + Generators/AtlasHepMC ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( ROOT COMPONENTS Matrix Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) -find_package( HepMC ) # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake @@ -70,19 +70,19 @@ atlas_add_library( LArCafJobsLib src/LArNoiseBursts.cxx src/LArHECNoise.cxx PUBLIC_HEADERS LArCafJobs - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES CaloIdentifier AthenaBaseComps AthenaKernel GaudiKernel LArIdentifier LArRawConditions LArRawEvent egammaEvent TrigSteeringEvent McParticleEvent StoreGateLib SGtests LArToolsLib TrigDecisionToolLib CaloDetDescrLib - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result ${HEPMC_LIBRARIES} ) + PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result AtlasHepMCLib ) atlas_add_component( LArCafJobs src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloIdentifier AthenaBaseComps StoreGateLib SGtests GaudiKernel LArIdentifier LArRawConditions LArRawEvent egammaEvent LArToolsLib TrigDecisionToolLib TrigSteeringEvent CaloDetDescrLib DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result LArCafJobsLib ) atlas_add_dictionary( LArCafJobsDict LArCafJobs/LArCafJobsDict.h LArCafJobs/selection.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloIdentifier AthenaBaseComps StoreGateLib SGtests GaudiKernel LArIdentifier LArRawConditions LArRawEvent LArToolsLib TrigDecisionToolLib TrigSteeringEvent CaloDetDescrLib DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result LArCafJobsLib ) atlas_add_executable( LArQuickHistMerge diff --git a/LArCalorimeter/LArCellRec/CMakeLists.txt b/LArCalorimeter/LArCellRec/CMakeLists.txt index 0ee130f143086301a30d500c3c5c747d3899115b..8bd8478b945db4f6f251daf289329951e985fa53 100644 --- a/LArCalorimeter/LArCellRec/CMakeLists.txt +++ b/LArCalorimeter/LArCellRec/CMakeLists.txt @@ -37,11 +37,11 @@ atlas_depends_on_subdirs( PUBLIC LArCalorimeter/LArCabling LArCalorimeter/LArCOOLConditions Trigger/TrigT1/TrigT1CaloCalibConditions - Trigger/TrigT1/TrigT1CaloCondSvc ) + Trigger/TrigT1/TrigT1CaloCondSvc + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) find_package( TBB ) @@ -49,8 +49,8 @@ find_package( TBB ) atlas_add_component( LArCellRec src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${TBB_LIBRARIES} CaloConditions CaloDetDescrLib CaloEvent CaloIdentifier CaloRecLib CaloUtilsLib AthAllocators AthenaBaseComps AthenaKernel StoreGateLib SGtests AtlasDetDescr Identifier GaudiKernel LArIdentifier LArRawEvent LArRecConditions LArCOOLConditions LArSimEvent CaloTriggerToolLib AthenaPoolUtilities xAODEventInfo xAODTrigL1Calo GeneratorObjects LArRecEvent LArCablingLib TrigT1CaloCalibConditions TrigT1CaloCondSvcLib ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${TBB_LIBRARIES} CaloConditions CaloDetDescrLib CaloEvent CaloIdentifier CaloRecLib CaloUtilsLib AthAllocators AthenaBaseComps AthenaKernel StoreGateLib SGtests AtlasDetDescr Identifier GaudiKernel LArIdentifier LArRawEvent LArRecConditions LArCOOLConditions LArSimEvent CaloTriggerToolLib AthenaPoolUtilities xAODEventInfo xAODTrigL1Calo GeneratorObjects LArRecEvent LArCablingLib TrigT1CaloCalibConditions TrigT1CaloCondSvcLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/LArCalorimeter/LArDigitization/CMakeLists.txt b/LArCalorimeter/LArDigitization/CMakeLists.txt index 6029001d1e2944ef2aed286e6ca519015f76f8c2..8bc6e121421a5f2a7f163dea372bd155ba2ffd67 100644 --- a/LArCalorimeter/LArDigitization/CMakeLists.txt +++ b/LArCalorimeter/LArDigitization/CMakeLists.txt @@ -25,29 +25,29 @@ atlas_depends_on_subdirs( PUBLIC LArCalorimeter/LArRawConditions Event/EventInfoUtils PRIVATE - Generators/GeneratorObjects ) + Generators/GeneratorObjects + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) # Component(s) in the package: atlas_add_library( LArDigitizationLib src/*.cxx PUBLIC_HEADERS LArDigitization - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES CaloIdentifier AthenaBaseComps AthenaKernel Identifier xAODEventInfo GaudiKernel LArIdentifier LArRawEvent LArSimEvent LArRecConditions LArRawConditions CaloDetDescrLib PileUpToolsLib StoreGateLib SGtests LArCablingLib EventInfoUtils - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GeneratorObjects ) + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib GeneratorObjects ) atlas_add_component( LArDigitization src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES LArDigitizationLib ) # Install files from the package: diff --git a/LArCalorimeter/LArDigitization/src/LArHitEMap.cxx b/LArCalorimeter/LArDigitization/src/LArHitEMap.cxx index 89f49b3186ab8f446fca2cfa8d28c0dae7b52ac8..50c707e6b56d2f624840a5cc150a4d57903e99d4 100644 --- a/LArCalorimeter/LArDigitization/src/LArHitEMap.cxx +++ b/LArCalorimeter/LArDigitization/src/LArHitEMap.cxx @@ -17,8 +17,8 @@ #include "StoreGate/StoreGateSvc.h" #include "StoreGate/StoreGate.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include "GaudiKernel/Bootstrap.h" #include "AthenaKernel/getMessageSvc.h" diff --git a/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt index f2d2aab1200e2c249d2dcbb9f4633cd67862eeda..82616394dbf17011562414b67418e7adf92b113f 100644 --- a/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt +++ b/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt @@ -8,20 +8,20 @@ atlas_subdir( LArG4FastSimSvc ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps - GaudiKernel ) + GaudiKernel + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) find_package( Geant4 ) -find_package( HepMC ) find_package( XercesC ) # Component(s) in the package: atlas_add_component( LArG4FastSimSvc src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps ) + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps ) # Install files from the package: atlas_install_headers( LArG4FastSimSvc ) diff --git a/LArCalorimeter/LArG4/LArG4FastSimSvc/LArG4FastSimSvc/ILArG4FastSimSvc.h b/LArCalorimeter/LArG4/LArG4FastSimSvc/LArG4FastSimSvc/ILArG4FastSimSvc.h index 6b41f3a77c4bda5a06407917ea807c9f0524bf8d..3e20df78bcc212d5a6da04ade0fdd8c5aef31016 100644 --- a/LArCalorimeter/LArG4/LArG4FastSimSvc/LArG4FastSimSvc/ILArG4FastSimSvc.h +++ b/LArCalorimeter/LArG4/LArG4FastSimSvc/LArG4FastSimSvc/ILArG4FastSimSvc.h @@ -8,9 +8,7 @@ #include "GaudiKernel/IInterface.h" #include "G4ParticleDefinition.hh" -namespace HepMC { - class GenEvent; -} +#include "AtlasHepMC/GenEvent_fwd.h" // Declaration of the interface ID ( interface id, major version, minor version) static const InterfaceID IID_ILArG4FastSimSvc("ILArG4FastSimSvc", 0 , 0); diff --git a/LArCalorimeter/LArG4/LArG4FastSimSvc/LArG4FastSimSvc/LArG4FastSimSvc.h b/LArCalorimeter/LArG4/LArG4FastSimSvc/LArG4FastSimSvc/LArG4FastSimSvc.h index d7db102b987839750b9ef41335010d6a85f799e6..4b38112f63f99b59eab3357240cd3f4acb223053 100644 --- a/LArCalorimeter/LArG4/LArG4FastSimSvc/LArG4FastSimSvc/LArG4FastSimSvc.h +++ b/LArCalorimeter/LArG4/LArG4FastSimSvc/LArG4FastSimSvc/LArG4FastSimSvc.h @@ -26,9 +26,7 @@ template <class TYPE> class SvcFactory; -namespace HepMC { - class IO_GenEvent; -} +#include "AtlasHepMC/IO_GenEvent_fwd.h" /** diff --git a/LArCalorimeter/LArG4/LArG4FastSimSvc/src/LArG4FastSimSvc.cxx b/LArCalorimeter/LArG4/LArG4FastSimSvc/src/LArG4FastSimSvc.cxx index 8f9cd16c0b24e3dfbb29909fae695f3f3089467a..3ef1596cd2a9686042eb7bf902a761ac1e9bd80a 100644 --- a/LArCalorimeter/LArG4/LArG4FastSimSvc/src/LArG4FastSimSvc.cxx +++ b/LArCalorimeter/LArG4/LArG4FastSimSvc/src/LArG4FastSimSvc.cxx @@ -12,8 +12,8 @@ #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Units/PhysicalConstants.h" -#include "HepMC/IO_GenEvent.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/IO_GenEvent.h" +#include "AtlasHepMC/GenEvent.h" // default constructor LArG4FastSimSvc::LArG4FastSimSvc(const std::string& name, ISvcLocator* sl) diff --git a/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt index 5f36763599035fe2793ad91feebc6d60264df5f6..057d893d84393d40ceb4473186f1fad510373b53 100644 --- a/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt +++ b/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt @@ -16,12 +16,12 @@ atlas_depends_on_subdirs( PUBLIC LArCalorimeter/LArG4/LArG4ShowerLibSvc LArCalorimeter/LArGeoModel/LArReadoutGeometry LArCalorimeter/LArSimEvent - Simulation/G4Atlas/G4AtlasTools ) + Simulation/G4Atlas/G4AtlasTools + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) find_package( Geant4 ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) find_package( XercesC ) find_package( GeoModelCore ) @@ -34,8 +34,8 @@ find_package( GeoModelCore ) atlas_add_component( LArG4FastSimulation src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${GEOMODELCORE_LIBRARIES} GaudiKernel StoreGateLib SGtests GeoSpecialShapes LArG4Code LArReadoutGeometry LArSimEvent G4AtlasToolsLib GeoPrimitives ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEOMODELCORE_LIBRARIES} GaudiKernel StoreGateLib SGtests GeoSpecialShapes LArG4Code LArReadoutGeometry LArSimEvent G4AtlasToolsLib GeoPrimitives ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.cxx b/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.cxx index 2d508dd2a2cfff2034830f71afb667c825ea8fdb..442c6d12bd16596786bb14114b376c0e60a2807b 100644 --- a/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.cxx +++ b/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.cxx @@ -8,8 +8,8 @@ #include "GaudiKernel/ISvcLocator.h" #include "LArG4Code/EnergySpot.h" -#include "HepMC/GenEvent.h" -#include "HepMC/IO_GenEvent.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/IO_GenEvent.h" #include <stdexcept> diff --git a/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.h b/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.h index 541532e5bd3aa650692adb876f44a936782eb604..f8d4a87abcd3cd5916df8a3331b2dab9cd992c65 100644 --- a/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.h +++ b/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.h @@ -16,10 +16,9 @@ #include "FastShowerConfigStruct.h" // Forward declarations -namespace HepMC { - class GenEvent; - class IO_GenEvent; -} +#include "AtlasHepMC/GenEvent_fwd.h" +#include "AtlasHepMC/IO_GenEvent_fwd.h" + class IFastSimDedicatedSD; class ILArG4ShowerLibSvc; diff --git a/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/LArG4GenShowerLib.h b/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/LArG4GenShowerLib.h index 2c400ae5c8f0a6428a35ec1a71414c294c42abaf..a832b092149c228ad22385ac0a70838d1874a034 100644 --- a/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/LArG4GenShowerLib.h +++ b/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/LArG4GenShowerLib.h @@ -22,9 +22,7 @@ namespace ShowerLib { class StepInfo; typedef std::list<StepInfo*> StepInfoList; } -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" /** diff --git a/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/TestActionShowerLib.h b/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/TestActionShowerLib.h index cc1d38314e0f38060dd96a06ca6dfba71398c8bb..53cbc3100a37a36ac80fb6f7611ee84cfaa081ca 100644 --- a/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/TestActionShowerLib.h +++ b/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/TestActionShowerLib.h @@ -20,9 +20,7 @@ namespace ShowerLib { class StepInfoCollection; } -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" // forward declarations in global namespace class EnergyCalculator; class G4VSolid; diff --git a/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt index 8bfdefe35237c6e949dfd96dee8d250e712bb3f1..26673276dba29e0183aca437f65f601cc5618d14 100644 --- a/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt +++ b/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt @@ -30,14 +30,14 @@ atlas_depends_on_subdirs( PUBLIC Simulation/HitManagement Simulation/G4Sim/MCTruth TestBeam/TBEvent - Tools/PathResolver ) + Tools/PathResolver + Generators/AtlasHepMC ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) find_package( Geant4 ) -find_package( HepMC ) find_package( XercesC ) # Component(s) in the package: @@ -45,8 +45,8 @@ atlas_add_component( LArG4H6SD src/*.cxx src/*.cc src/components/*.cxx - INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${GEANT4_LIBRARIES} GaudiKernel CaloG4SimLib CaloSimEvent AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoModelUtilities Identifier GeneratorObjects LArG4Code LArG4RunControl LArG4TBSimEvent LArReadoutGeometry LArSimEvent G4AtlasInterfaces G4AtlasToolsLib SimHelpers HitManagement MCTruth TBEvent PathResolver ) + INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + LINK_LIBRARIES ${CORAL_LIBRARIES} ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} GaudiKernel CaloG4SimLib CaloSimEvent AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoModelUtilities Identifier GeneratorObjects LArG4Code LArG4RunControl LArG4TBSimEvent LArReadoutGeometry LArSimEvent G4AtlasInterfaces G4AtlasToolsLib SimHelpers HitManagement MCTruth TBEvent PathResolver ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/LArCalorimeter/LArG4/LArG4H6SD/src/RadLenNtuple.cc b/LArCalorimeter/LArG4/LArG4H6SD/src/RadLenNtuple.cc index 2d2532bc52585164ef3b9b8aa2333a12a052bdbb..3aad0fdc4e9883e41718f80566235238242366dd 100644 --- a/LArCalorimeter/LArG4/LArG4H6SD/src/RadLenNtuple.cc +++ b/LArCalorimeter/LArG4/LArG4H6SD/src/RadLenNtuple.cc @@ -4,7 +4,7 @@ #include "RadLenNtuple.h" #include "LArG4RunControl/LArGeoTBH1GeoOptions.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include <iostream> #include "GaudiKernel/IService.h" #include "GaudiKernel/ISvcLocator.h" diff --git a/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt index eb60f39d0ae76c8a994bab7832fe89d95a32114b..89ad3036474994120ca905847d8ccd11d3c38580 100644 --- a/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt +++ b/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt @@ -8,12 +8,12 @@ atlas_subdir( LArG4ShowerLib ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC Control/AthContainers - LArCalorimeter/LArG4/LArG4Code ) + LArCalorimeter/LArG4/LArG4Code + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) find_package( Geant4 ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) find_package( XercesC ) @@ -21,8 +21,8 @@ find_package( XercesC ) atlas_add_library( LArG4ShowerLib src/*.cxx PUBLIC_HEADERS LArG4ShowerLib - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES AthContainers LArG4Code - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ) + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ) diff --git a/LArCalorimeter/LArG4/LArG4ShowerLib/LArG4ShowerLib/IShowerLib.h b/LArCalorimeter/LArG4/LArG4ShowerLib/LArG4ShowerLib/IShowerLib.h index 8e2cbb611183287d8d3ce38af7b145d244058dbc..81534967b0aeecf5bd1944e93df5ac411602f469 100755 --- a/LArCalorimeter/LArG4/LArG4ShowerLib/LArG4ShowerLib/IShowerLib.h +++ b/LArCalorimeter/LArG4/LArG4ShowerLib/LArG4ShowerLib/IShowerLib.h @@ -18,9 +18,7 @@ class G4Track; class TFile; class TTree; -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" // Namespace for the ShowerLib related classes namespace ShowerLib { diff --git a/LArCalorimeter/LArG4/LArG4ShowerLib/LArG4ShowerLib/TestShowerLib.h b/LArCalorimeter/LArG4/LArG4ShowerLib/LArG4ShowerLib/TestShowerLib.h index a77c57aaed9b068fb3de6449bb4d35079b08441c..6c6d50ba71763292eca9f2067753d5c53e9dfa20 100644 --- a/LArCalorimeter/LArG4/LArG4ShowerLib/LArG4ShowerLib/TestShowerLib.h +++ b/LArCalorimeter/LArG4/LArG4ShowerLib/LArG4ShowerLib/TestShowerLib.h @@ -15,9 +15,7 @@ // G4 forward declarations class G4Track; // forward declarations in namespace -namespace HepMC { - class FourVector; -} +#include "AtlasHepMC/SimpleVector.h" // Namespace for the ShowerLib related classes namespace ShowerLib { diff --git a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/Other/RadLenNtuple.cc b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/Other/RadLenNtuple.cc index 1272ae323ade4962e083f64be5df1cd229f8cd47..abe32438ef3fc2bb3a5753e8f8901ef66caa3ded 100755 --- a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/Other/RadLenNtuple.cc +++ b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/Other/RadLenNtuple.cc @@ -4,7 +4,7 @@ #include "LArGeoH62004Algs/RadLenNtuple.h" #include "LArG4RunControl/LArGeoTBH1GeoOptions.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "GeneratorObjects/McEventCollection.h" #include <iostream> #include "GaudiKernel/IService.h" diff --git a/LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.cxx b/LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.cxx index 544677bed44ec78365973639d4c6f02cb1359d81..4a563e57e10ae32929a0c59aad4a628fa2a2f102 100644 --- a/LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.cxx +++ b/LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.cxx @@ -160,6 +160,9 @@ LArNoiseCorrelationMon::initialize() /** Retrieve pedestals container*/ ATH_CHECK(m_keyPedestal.initialize()); + /** Configure event info */ + ATH_CHECK(m_eventInfoKey.initialize()); + /** get the trigger list from the 'm_triggerChainProp'*/ m_triggers.clear(); if(m_isCalibrationRun) { @@ -236,8 +239,12 @@ LArNoiseCorrelationMon::fillHistograms() bool passTrig = m_isCalibrationRun; if(!m_isCalibrationRun) { /**EventID is a part of EventInfo, search event informations:*/ - const xAOD::EventInfo* thisEvent; - ATH_CHECK(evtStore()->retrieve(thisEvent)); + SG::ReadHandle<xAOD::EventInfo> thisEvent{m_eventInfoKey}; + + if (!thisEvent.isValid()) { + ATH_MSG_ERROR("xAOD::EventInfo retrieval failed"); + return StatusCode::FAILURE; + } m_evtId = thisEvent->eventNumber(); ATH_MSG_DEBUG("Event nb " << m_evtId ); diff --git a/LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.h b/LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.h index 5c0681a450e0cfd380c0843a03228b35c44dd8d2..cec7901843e1fd864d117feea5fc8398bcd8d4f5 100644 --- a/LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.h +++ b/LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.h @@ -19,6 +19,7 @@ #include "LArElecCalib/ILArPedestal.h" #include "LArRecConditions/ILArBadChannelMasker.h" #include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/ReadHandleKey.h" #include "LArCabling/LArOnOffIdMapping.h" @@ -69,6 +70,9 @@ protected: /** Handle to pedestal */ SG::ReadCondHandleKey<ILArPedestal> m_keyPedestal{this,"LArPedestalKey","LArPedestal","SG key of LArPedestal CDO"}; + + /** Handle to event info */ + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo"}; private: diff --git a/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py index 77f68bcc81f6dc22ef119571659ecf184c0dc203..8db75938f1fc788ac12c54086ebe12d2aa0fa69c 100644 --- a/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py @@ -34,7 +34,17 @@ def LArAffectedRegionsConfigCore(helper, algoinstance, inputFlags): # Edit properties of a algorithm larAffectedRegAlg.AffectedRegionsGroupName=affectedRegGroupName - larAffectedRegAlg.IsOnline = inputFlags.Common.isOnline + isOnline=False + from AthenaConfiguration.ComponentFactory import isRun3Cfg + if isRun3Cfg(): + if inputFlags.DQ.Environment == 'online': + isOnline=True + else: + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + if athenaCommonFlags.isOnline: + isOnline=True + + larAffectedRegAlg.IsOnline = isOnline from LArMonitoring.GlobalVariables import lArDQGlobals #to define the ranges diff --git a/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py b/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py index 12ccd826b1cfddb64120f256ddf8997e600f0419..a798195448c30e620c99334dc03a4bfd81675a38 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py @@ -38,7 +38,7 @@ def LArCoverageConfig(inputFlags): cfg=ComponentAccumulator() from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg#,LArBadChannelCfg acc= LArBadChannelMaskerCfg(inputFlags,problemsToMask=["highNoiseHG","highNoiseMG","highNoiseLG","deadReadout","deadPhys"],ToolName="BadLArRawChannelMask") - helper.monSeq.LArCoverageAlg.LArBadChannelMask=acc.popPrivateTools() + CompFactory.LArCoverageAlg.LArBadChannelMask=acc.popPrivateTools() cfg.merge(acc) cfg.merge(helper.result()) @@ -91,42 +91,18 @@ def LArCoverageConfigCore(helper, algoinstance,inputFlags): badChannelToolArrayBarrel = helper.addArray([lArDQGlobals.Sides],larCoverageAlg,badChannelsGroupName,'/LAr/','lb') badChannelToolArrayEndcap = helper.addArray([lArDQGlobals.Sides],larCoverageAlg,badChannelsGroupName,'/LAr/','lb') - #-- CoverageHW groups -- - coverageHWToolArrayBarrel = helper.addArray([partitionsBarrel],larCoverageAlg,coverageHWGroupName,'/LAr/','run') - coverageHWToolArrayEndcap = helper.addArray([partitionsEndcap],larCoverageAlg,coverageHWGroupName,'/LAr/','run') + #-- CoverageHW groups -- + availErrCode = larCoverageAlg.AvailableErrorCodes #-- Coverage groups (eta-phi plots) -- - coverageGroupEMBA0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBA0','/LAr/','run') - coverageGroupEMBA1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBA1','/LAr/','run') - coverageGroupEMBA2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBA2','/LAr/','run') - coverageGroupEMBA3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBA3','/LAr/','run') - coverageGroupEMBC0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBC0','/LAr/','run') - coverageGroupEMBC1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBC1','/LAr/','run') - coverageGroupEMBC2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBC2','/LAr/','run') - coverageGroupEMBC3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBC3','/LAr/','run') - coverageGroupEMECA0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECA0','/LAr/','run') - coverageGroupEMECA1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECA1','/LAr/','run') - coverageGroupEMECA2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECA2','/LAr/','run') - coverageGroupEMECA3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECA3','/LAr/','run') - coverageGroupEMECC0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECC0','/LAr/','run') - coverageGroupEMECC1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECC1','/LAr/','run') - coverageGroupEMECC2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECC2','/LAr/','run') - coverageGroupEMECC3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECC3','/LAr/','run') - coverageGroupHECA0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECA0','/LAr/','run') - coverageGroupHECA1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECA1','/LAr/','run') - coverageGroupHECA2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECA2','/LAr/','run') - coverageGroupHECA3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECA3','/LAr/','run') - coverageGroupHECC0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECC0','/LAr/','run') - coverageGroupHECC1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECC1','/LAr/','run') - coverageGroupHECC2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECC2','/LAr/','run') - coverageGroupHECC3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECC3','/LAr/','run') - coverageGroupFCalA1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalA1','/LAr/','run') - coverageGroupFCalA2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalA2','/LAr/','run') - coverageGroupFCalA3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalA3','/LAr/','run') - coverageGroupFCalC1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalC1','/LAr/','run') - coverageGroupFCalC2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalC2','/LAr/','run') - coverageGroupFCalC3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalC3','/LAr/','run') - + coverageToolArrayEMBA = helper.addArray([availErrCode],larCoverageAlg,coverageHWGroupName+"EMBA",'/LAr/','run') + coverageToolArrayEMECA = helper.addArray([availErrCode],larCoverageAlg,coverageHWGroupName+"EMECA",'/LAr/','run') + coverageToolArrayHECA = helper.addArray([availErrCode],larCoverageAlg,coverageHWGroupName+"HECA",'/LAr/','run') + coverageToolArrayFCalA = helper.addArray([availErrCode],larCoverageAlg,coverageHWGroupName+"FCalA",'/LAr/','run') + coverageToolArrayEMBC = helper.addArray([availErrCode],larCoverageAlg,coverageHWGroupName+"EMBC",'/LAr/','run') + coverageToolArrayEMECC = helper.addArray([availErrCode],larCoverageAlg,coverageHWGroupName+"EMECC",'/LAr/','run') + coverageToolArrayHECC = helper.addArray([availErrCode],larCoverageAlg,coverageHWGroupName+"HECC",'/LAr/','run') + coverageToolArrayFCalC = helper.addArray([availErrCode],larCoverageAlg,coverageHWGroupName+"FCalC",'/LAr/','run') ### Configure histograms @@ -161,8 +137,7 @@ def LArCoverageConfigCore(helper, algoinstance,inputFlags): # -- badChannels histograms -- badChannels_path='Coverage/BadChannels/' - for side in lArDQGlobals.Sides: - badChannelToolArrayBarrel.defineHistogram('mon_FtSlot,single_channel;DBBadChannelsBarrel', + badChannelToolArrayBarrel.defineHistogram('mon_FtSlot,single_channel;DBBadChannelsBarrel', type='TH2I', path=badChannels_path, title='Known Bad Channels - Barrel;Feedthrough(+Slot increasing);Channel', @@ -173,8 +148,9 @@ def LArCoverageConfigCore(helper, algoinstance,inputFlags): ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels-0.5, - xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel) - badChannelToolArrayEndcap.defineHistogram('mon_FtSlot,single_channel;DBBadChannelsEndcap', + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel, + merge='weightedAverage') + badChannelToolArrayEndcap.defineHistogram('mon_FtSlot,single_channel;DBBadChannelsEndcap', type='TH2I', path=badChannels_path, title='Known Bad Channels - Endcap '+side+';Feedthrough(+Slot increasing);Channel', @@ -185,281 +161,350 @@ def LArCoverageConfigCore(helper, algoinstance,inputFlags): ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels-0.5, - xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap, + merge='weightedAverage') #--coverageHW histograms coverage_path='CoverageNewAlg/perPartition/' - coverageHWToolArrayBarrel.defineHistogram('mon_FtSlot,mon_Channels;CoverageHW', - type='TH2I', - path=coverage_path, - title='Coverage;Feedthrough(+Slot increasing);Channel', - weight='mon_coverage', - xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMBA"], #used also for EMBC - xmin=lArDQGlobals.Feedthrough_Slot_range["EMBA"][0], #used also for EMBC - xmax=lArDQGlobals.Feedthrough_Slot_range["EMBA"][1], #used also for EMBC - ybins=lArDQGlobals.FEB_N_channels, - ymin=-0.5, - ymax=lArDQGlobals.FEB_N_channels-0.5, - xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel) - - coverageHWToolArrayEndcap.defineHistogram('mon_FtSlot,mon_Channels;CoverageHW', - type='TH2I', - path=coverage_path, - title='Coverage;Feedthrough(+Slot increasing);Channel', - weight='mon_coverage', - xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMECA"], #used also for HEC, FCAL and C side - xmin=lArDQGlobals.Feedthrough_Slot_range["EMECA"][0], #used also for HEC, FCAL and C side - xmax=lArDQGlobals.Feedthrough_Slot_range["EMECA"][1], #used also for HEC, FCAL and C side - ybins=lArDQGlobals.FEB_N_channels, - ymin=-0.5, - ymax=lArDQGlobals.FEB_N_channels-0.5, - xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) - - - coverageGroupEMBA0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMBA', - type='TH2I', + coverageToolArrayEMBA.defineHistogram('mon_ChanFtSlot,mon_Channels;CoverageHW_EMBA_statusCode', + type='TH2I', + path=coverage_path, + title='Coverage - EMBA - statusCode={0};Feedthrough(+Slot increasing);Channel', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMBA"], + xmin=lArDQGlobals.Feedthrough_Slot_range["EMBA"][0], + xmax=lArDQGlobals.Feedthrough_Slot_range["EMBA"][1], + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel) + + coverageToolArrayEMBC.defineHistogram('mon_ChanFtSlot,mon_Channels;CoverageHW_EMBC_statusCode', + type='TH2I', + path=coverage_path, + title='Coverage - EMBC - statusCode={0};Feedthrough(+Slot increasing);Channel', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMBC"], + xmin=lArDQGlobals.Feedthrough_Slot_range["EMBC"][0], + xmax=lArDQGlobals.Feedthrough_Slot_range["EMBC"][1], + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel) + + coverageToolArrayEMECA.defineHistogram('mon_ChanFtSlot,mon_Channels;CoverageHW_EMECA_statusCode', + type='TH2I', + path=coverage_path, + title='Coverage - EMECA - statusCode={0};Feedthrough(+Slot increasing);Channel', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMECA"], + xmin=lArDQGlobals.Feedthrough_Slot_range["EMECA"][0], + xmax=lArDQGlobals.Feedthrough_Slot_range["EMECA"][1], + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + + coverageToolArrayEMECC.defineHistogram('mon_ChanFtSlot,mon_Channels;CoverageHW_EMECA_statusCode', + type='TH2I', + path=coverage_path, + title='Coverage - EMECC - statusCode={0};Feedthrough(+Slot increasing);Channel', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMECC"], + xmin=lArDQGlobals.Feedthrough_Slot_range["EMECC"][0], + xmax=lArDQGlobals.Feedthrough_Slot_range["EMECC"][1], + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + + coverageToolArrayHECA.defineHistogram('mon_ChanFtSlot,mon_Channels;CoverageHW_HECA_statusCode', + type='TH2I', + path=coverage_path, + title='Coverage - HECA - statusCode={0};Feedthrough(+Slot increasing);Channel', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["HECA"], + xmin=lArDQGlobals.Feedthrough_Slot_range["HECA"][0], + xmax=lArDQGlobals.Feedthrough_Slot_range["HECA"][1], + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + + coverageToolArrayHECC.defineHistogram('mon_ChanFtSlot,mon_Channels;CoverageHW_HECA_statusCode', + type='TH2I', + path=coverage_path, + title='Coverage - HECC - statusCode={0};Feedthrough(+Slot increasing);Channel', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["HECC"], + xmin=lArDQGlobals.Feedthrough_Slot_range["HECC"][0], + xmax=lArDQGlobals.Feedthrough_Slot_range["HECC"][1], + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + + coverageToolArrayFCalA.defineHistogram('mon_ChanFtSlot,mon_Channels;CoverageHW_FCalA_statusCode', + type='TH2I', + path=coverage_path, + title='Coverage - FCalA - statusCode={0};Feedthrough(+Slot increasing);Channel', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["FCalA"], + xmin=lArDQGlobals.Feedthrough_Slot_range["FCalA"][0], + xmax=lArDQGlobals.Feedthrough_Slot_range["FCalA"][1], + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + + coverageToolArrayFCalC.defineHistogram('mon_ChanFtSlot,mon_Channels;CoverageHW_FCalC_statusCode', + type='TH2I', + path=coverage_path, + title='Coverage - FCalC - statusCode={0};Feedthrough(+Slot increasing);Channel', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["FCalC"], + xmin=lArDQGlobals.Feedthrough_Slot_range["FCalC"][0], + xmax=lArDQGlobals.Feedthrough_Slot_range["FCalC"][1], + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + + + coverageToolArrayEMBA.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMBA_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 0 - EMBA;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 0 - EMBA;#eta;#phi', + cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["0"]) - coverageGroupEMBA1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMBA', - type='TH2I', + coverageToolArrayEMBA.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMBA_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 1 - EMBA;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 1 - EMBA;#eta;#phi', + cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["1"]) - coverageGroupEMBA2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMBA', - type='TH2I', + coverageToolArrayEMBA.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMBA_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 2 - EMBA;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 2 - EMBA;#eta;#phi', + cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["2"]) - - coverageGroupEMBA3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMBA', - type='TH2I', + + coverageToolArrayEMBA.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMBA_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 3 - EMBA;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 3 - EMBA;#eta;#phi', + cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["3"]) - - coverageGroupEMBC0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMBC', - type='TH2I', + coverageToolArrayEMBC.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMBC_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 0 - EMBC;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 0 - EMBC;#eta;#phi', + cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["0"]) - coverageGroupEMBC1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMBC', - type='TH2I', + coverageToolArrayEMBC.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMBC_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 1 - EMBC;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 1 - EMBC;#eta;#phi', + cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["1"]) - coverageGroupEMBC2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMBC', - type='TH2I', + coverageToolArrayEMBC.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMBC_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 2 - EMBC;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 2 - EMBC;#eta;#phi', + cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["2"]) - coverageGroupEMBC3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMBC', - type='TH2I', + coverageToolArrayEMBC.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMBC_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 3 - EMBC;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 3 - EMBC;#eta;#phi', + cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["3"]) - - coverageGroupEMECA0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMECA', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 0 - EMECA;#eta;#phi', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["0"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["0"]) - - coverageGroupEMECA1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMECA', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 1 - EMECA;#eta;#phi', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["1"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["1"]) - - coverageGroupEMECA2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMECA', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 2 - EMECA;#eta;#phi', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["2"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["2"]) - - coverageGroupEMECA3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMECA', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 3 - EMECA;#eta;#phi', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["3"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["3"]) - - coverageGroupEMECC0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMECC', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 0 - EMECC;#eta;#phi', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["0"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["0"]) - - coverageGroupEMECC1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMECC', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 1 - EMECC;#eta;#phi', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["1"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["1"]) - - coverageGroupEMECC2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMECC', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 2 - EMECC;#eta;#phi', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["2"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["2"]) - - coverageGroupEMECC3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMECC', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 3 - EMECC;#eta;#phi', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["3"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["3"]) - coverageGroupHECA0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0HECA', - type='TH2I', + coverageToolArrayEMECA.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMECA_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 0 - EMECA;#eta;#phi', + cutmask='isSampl0', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["0"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["0"]) + + coverageToolArrayEMECA.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMECA_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 1 - EMECA;#eta;#phi', + cutmask='isSampl1', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["1"]) + + coverageToolArrayEMECA.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMECA_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 2 - EMECA;#eta;#phi', + cutmask='isSampl2', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["2"]) + + coverageToolArrayEMECA.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMECA_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 3 - EMECA;#eta;#phi', + cutmask='isSampl3', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["3"]) + + coverageToolArrayEMECC.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMECC_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 0 - EMECC;#eta;#phi', + cutmask='isSampl0', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["0"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["0"]) + + coverageToolArrayEMECC.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMECC_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 1 - EMECC;#eta;#phi', + cutmask='isSampl1', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["1"]) + + coverageToolArrayEMECC.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMECC_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 2 - EMECC;#eta;#phi', + cutmask='isSampl2', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["2"]) + + coverageToolArrayEMECC.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMECC_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 3 - EMECC;#eta;#phi', + cutmask='isSampl3', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["3"]) + + coverageToolArrayHECA.defineHistogram('mon_Eta,mon_Phi;CoverSampling0HECA_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 0 - HECA;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 0 - HECA;#eta;#phi', + cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["0"]) - coverageGroupHECA1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1HECA', - type='TH2I', + coverageToolArrayHECA.defineHistogram('mon_Eta,mon_Phi;CoverSampling1HECA_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 1 - HECA;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 1 - HECA;#eta;#phi', + cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["1"]) - coverageGroupHECA2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2HECA', - type='TH2I', + coverageToolArrayHECA.defineHistogram('mon_Eta,mon_Phi;CoverSampling2HECA_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 2 - HECA;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 2 - HECA;#eta;#phi', + cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["2"]) - - coverageGroupHECA3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3HECA', - type='TH2I', + + coverageToolArrayHECA.defineHistogram('mon_Eta,mon_Phi;CoverSampling3HECA_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 3 - HECA;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 3 - HECA;#eta;#phi', + cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["3"]) - coverageGroupHECC0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0HECC', - type='TH2I', + coverageToolArrayHECC.defineHistogram('mon_Eta,mon_Phi;CoverSampling0HECC_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 0 - HECC;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 0 - HECC;#eta;#phi', + cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["0"]) - coverageGroupHECC1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1HECC', - type='TH2I', + coverageToolArrayHECC.defineHistogram('mon_Eta,mon_Phi;CoverSampling1HECC_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 1 - HECC;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 1 - HECC;#eta;#phi', + cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["1"]) - coverageGroupHECC2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2HECC', - type='TH2I', + coverageToolArrayHECC.defineHistogram('mon_Eta,mon_Phi;CoverSampling2HECC_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 2 - HECC;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 2 - HECC;#eta;#phi', + cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["2"]) - - coverageGroupHECC3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3HECC', - type='TH2I', + + coverageToolArrayHECC.defineHistogram('mon_Eta,mon_Phi;CoverSampling3HECC_StatusCode', + type='TH2I', path=coverage_path, - title='Coverage - Sampling 3 - HECC;#eta;#phi', - weight='mon_coverage', + title='Coverage status code={0} - Sampling 3 - HECC;#eta;#phi', + cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["3"]) - - coverageGroupFCalA1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1FCalA', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 1 - FCalA;cell number (from outside to inside);sector number (#phi)', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["1"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["1"]) - - coverageGroupFCalA2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2FCalA', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 2 - FCalA;cell number (from outside to inside);sector number (#phi)', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["2"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["2"]) - - coverageGroupFCalA3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3FCalA', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 3 - FCalA;cell number (from outside to inside);sector number (#phi)', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["3"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["3"]) - - coverageGroupFCalC1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1FCalC', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 1 - FCalC;cell number (from outside to inside);sector number (#phi)', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["1"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["1"]) - - coverageGroupFCalC2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2FCalC', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 2 - FCalC;cell number (from outside to inside);sector number (#phi)', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["2"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["2"]) - - coverageGroupFCalC3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3FCalC', - type='TH2I', - path=coverage_path, - title='Coverage - Sampling 3 - FCalC;cell number (from outside to inside);sector number (#phi)', - weight='mon_coverage', - xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["3"], - ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["3"]) - + coverageToolArrayFCalA.defineHistogram('mon_Eta,mon_Phi;CoverSampling1FCalA_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 1 - FCalA;#eta;#phi', + cutmask='isSampl1', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["1"]) + + coverageToolArrayFCalA.defineHistogram('mon_Eta,mon_Phi;CoverSampling2FCalA_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 2 - FCalA;#eta;#phi', + cutmask='isSampl2', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["2"]) + + coverageToolArrayFCalA.defineHistogram('mon_Eta,mon_Phi;CoverSampling3FCalA_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 3 - FCalA;#eta;#phi', + cutmask='isSampl3', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["3"]) + + coverageToolArrayFCalC.defineHistogram('mon_Eta,mon_Phi;CoverSampling1FCalC_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 1 - FCalC;#eta;#phi', + cutmask='isSampl1', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["1"]) + + coverageToolArrayFCalC.defineHistogram('mon_Eta,mon_Phi;CoverSampling2FCalC_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 2 - FCalC;#eta;#phi', + cutmask='isSampl2', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["2"]) + + coverageToolArrayFCalC.defineHistogram('mon_Eta,mon_Phi;CoverSampling3FCalC_StatusCode', + type='TH2I', + path=coverage_path, + title='Coverage status code={0} - Sampling 3 - FCalC;#eta;#phi', + cutmask='isSampl3', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["3"]) + if __name__=='__main__': @@ -493,7 +538,7 @@ if __name__=='__main__': cfg.merge(larCoverageAcc) ConfigFlags.dump() - f=open("CoverageMaker.pkl","wb") + f=open("CoverageMaker.pkl","w") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py index 760c448b1fc659689263c4360c20bca98cf91696..2a1fef90b0972b86c9446cffd2ef01fd698c70f7 100644 --- a/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py @@ -40,8 +40,8 @@ def LArDigitMonConfigCore(helper, algoinstance,inputFlags): larDigitMonAlg.LArDigitsNslots=nslots # adding BadChan masker private tool - from AthenaCommon.Configurable import Configurable - if Configurable.configurableRun3Behavior : + from AthenaConfiguration.ComponentFactory import isRun3Cfg + if isRun3Cfg() : from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() @@ -138,7 +138,7 @@ def LArDigitMonConfigCore(helper, algoinstance,inputFlags): title='% chan/FEB/events with max=4095 ADC - Med/High Gain - All Stream', type='TH2I', path=hist_path, - weight='weight', + weight='Saturweight', xbins=crates_n,xmin=crates_low,xmax=crates_up, ybins=chan_n, ymin=chan_low, ymax=chan_up) @@ -146,7 +146,6 @@ def LArDigitMonConfigCore(helper, algoinstance,inputFlags): title='% chan/FEB/events with max=4095 ADC ', type='TH2I', path=hist_path, - weight='weight', xbins=int(slot_n),xmin=slot_low,xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram('SaturLowslot,SaturLowFT,SaturLowweight;SaturationLow', @@ -155,11 +154,11 @@ def LArDigitMonConfigCore(helper, algoinstance,inputFlags): path=hist_path, xbins=int(slot_n),xmin=slot_low,xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) - array.defineHistogram('SaturLowcrate,SaturLowchan;SaturationLowChan', + array.defineHistogram('SaturLowcrate,SaturLowchan;SaturationChanLow', title='% chan/FEB/events with max=4095 ADC - Low Gain - All Stream', type='TH2I', path=hist_path, - weight='weight', + weight='SaturLowweight', xbins=crates_n,xmin=crates_low,xmax=crates_up, ybins=chan_n, ymin=chan_low, ymax=chan_up) @@ -180,7 +179,6 @@ def LArDigitMonConfigCore(helper, algoinstance,inputFlags): title='% chan/FEB/events with min=0 ADC - All Gain - All Stream', type='TH2I', path=hist_path, - weight='weight', xbins=crates_n,xmin=crates_low,xmax=crates_up, ybins=chan_n, ymin=chan_low, ymax=chan_up) @@ -200,7 +198,6 @@ def LArDigitMonConfigCore(helper, algoinstance,inputFlags): title='Energy vs max sample ', type='TH2F', path=hist_path, - weight='weight', xbins=lArDQGlobals.Samples_Bins,xmin=lArDQGlobals.Samples_Min,xmax=lArDQGlobals.Samples_Max, ybins=lArDQGlobals.Energy_Bins, ymin=lArDQGlobals.Energy_Min, ymax=lArDQGlobals.Energy_Max) @@ -219,7 +216,7 @@ def LArDigitMonConfigCore(helper, algoinstance,inputFlags): - if Configurable.configurableRun3Behavior : + if isRun3Cfg(): cfg.merge(helper.result()) return cfg else: diff --git a/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py index 447167121bfa66660a37ec116aab77ebe2f50a15..513447a42d1d6c7e391b6a1c0fd82f66415a4df6 100644 --- a/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py @@ -38,8 +38,8 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu larFEBMonAlg.Streams=lArDQGlobals.defaultStreamNames isCOMP200=False - from AthenaCommon.Configurable import Configurable - if Configurable.configurableRun3Behavior: + from AthenaConfiguration.ComponentFactory import isRun3Cfg + if isRun3Cfg(): if "COMP200" in inputFlags.IOVDb.DatabaseInstance: isCOMP200=True else: @@ -51,7 +51,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu dbString="<db>COOLONL_LAR/CONDBR2</db>" persClass="AthenaAttributeList" fld="/LAR/Configuration/DSPThresholdFlat/Thresholds" - if Configurable.configurableRun3Behavior: + if isRun3Cfg(): iovDbSvc=helper.resobj.getService("IOVDbSvc") condLoader=helper.resobj.getCondAlgo("CondInputLoader") else: @@ -68,15 +68,14 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu fld='/LAR/Configuration/DSPThreshold/Thresholds' db='LAR_ONL' obj='LArDSPThresholdsComplete' - if Configurable.configurableRun3Behavior: + if isRun3Cfg(): helper.resobj.addFolderList(inputFlags,[(fld,db,obj)]) else: conddb.addFolder (db, fld, className=obj) larFEBMonAlg.Run1DSPThresholdsKey = 'LArDSPThresholds' # adding LArFebErrorSummary algo - from AthenaCommon.Configurable import Configurable - if Configurable.configurableRun3Behavior : + if isRun3Cfg() : from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg acc = LArFebErrorSummaryMakerCfg(inputFlags) helper.resobj.merge(acc) @@ -93,7 +92,12 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu #Summary histos summary_hist_path='Summary/' - + #-- TTree for corrupted events timestamp + Group.defineTree('timestamp,time_ns,febHwId,febError;LArCorrupted', + path=summary_hist_path, + title='Timestamps of corrupted LAr events', + treedef='timestamp/i:time_ns/i:febHwId/vector<int>:febErrorType/vector<int>') + Group.defineHistogram('nbFEB;NbOfReadoutFEBGlobal', title='# of readout FEB/DSP header', type='TH1I', @@ -107,7 +111,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5, ylabels=lArDQGlobals.Partitions ) - Group.defineHistogram('febError,part;NbOfLArFEBMonAlgErrors_dE', + Group.defineHistogram('febError,part;NbOfLArFEBMonErrors_dE', title='# of data corruption errors', type='TH2I', path=summary_hist_path, @@ -146,18 +150,18 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu path=summary_hist_path, xbins=lArDQGlobals.EvtRej_Bins, xmin=lArDQGlobals.EvtRej_Min, xmax=lArDQGlobals.EvtRej_Max, xlabels=lArDQGlobals.EvtRej_labels) - Group.defineHistogram('EvtRej,EvtRejYield;EventsRejectedYield', + Group.defineHistogram('EvtRej,EvtRejYield1D;EventsRejectedYield', title='Data corruption yield:Corruption type:Yield(%)', type='TProfile', path=summary_hist_path, xbins=lArDQGlobals.EvtRej_Bins-1, xmin=lArDQGlobals.EvtRej_Min, xmax=lArDQGlobals.EvtRej_Max-1, xlabels=lArDQGlobals.EvtRejYield_labels) - Group.defineHistogram('LB,EvtRejYield;YieldOfRejectedEventsVsLB', + Group.defineHistogram('LB0,EvtRejYield;YieldOfRejectedEventsVsLB', title='Yield of corrupted events (DATACORRUPTED):Luminosity Block:Yield(%)', type='TProfile', path=summary_hist_path, xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max) - Group.defineHistogram('LB,EvtRejYieldOut;YieldOfRejectedEventsVsLBout', + Group.defineHistogram('LB0,EvtRejYieldOut;YieldOfRejectedEventsVsLBout', title='Yield of corrupted events (DATACORRUPTED) not vetoed by time window:Luminosity Block:Yield(%)', type='TProfile', path=summary_hist_path, @@ -167,12 +171,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu type='TH1I', path=summary_hist_path, xbins=lArDQGlobals.rejBits_Bins, xmin=-0.5, xmax=lArDQGlobals.rejBits_Bins-0.5) - Group.defineHistogram('LB;NbOfEventsVsLB', - title='Nb of events per LB:Luminosity Block', - type='TH1I', - path=summary_hist_path, - xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max) - Group.defineHistogram('LB;NbOfEventsVsLB', + Group.defineHistogram('LB0;NbOfEventsVsLB', title='Nb of events per LB:Luminosity Block', type='TH1I', path=summary_hist_path, @@ -182,7 +181,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu type='TH1I', path=summary_hist_path, xbins=int(lArDQGlobals.N_Cells/10), xmin=-1000, xmax=lArDQGlobals.N_Cells-1000) - Group.defineHistogram('LB,LArEvSize;eventSizeVsLB', + Group.defineHistogram('LB0,LArEvSize;eventSizeVsLB', title='LAr event size (w/o ROS headers):Luminosity Block:Megabytes', type='TProfile', path=summary_hist_path, @@ -194,7 +193,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu xbins=lArDQGlobals.Samples_Bins, xmin=lArDQGlobals.Samples_Min, xmax=lArDQGlobals.Samples_Max) isOnline=False - if Configurable.configurableRun3Behavior : + if isRun3Cfg() : if inputFlags.DQ.Environment == 'online': isOnline=True else: @@ -320,20 +319,13 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu xbins=slot_n,xmin=slot_low,xmax=slot_up, ybins=ft_n, ymin=ft_low, ymax=ft_up) - darray.defineHistogram('slotabs,FTabs;LArFEBMonAlgErrorsAbsolute', + darray.defineHistogram('slotabs,FTabs;LArFEBMonErrorsAbsolute', title='Nb of events with at least one error :Slot:FT', type='TH2I', path=hist_path, xbins=slot_n,xmin=slot_low,xmax=slot_up, ybins=ft_n, ymin=ft_low, ymax=ft_up) - darray.defineHistogram('slotabs,FTabs,erryield;LArFEBMonAlgErrors', - title='% of events with at least one error :Slot:FT', - type='TProfile2D', - path=hist_path, - xbins=slot_n,xmin=slot_low,xmax=slot_up, - ybins=ft_n, ymin=ft_low, ymax=ft_up) - darray.defineHistogram('slotmist,FTmist;missingTriggerType', title='LVL1 trigger type missing or different from event type :Slot:FT', type='TH2I', @@ -348,19 +340,17 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu xbins=slot_n,xmin=slot_low,xmax=slot_up, ybins=ft_n, ymin=ft_low, ymax=ft_up) - darray.defineHistogram('slotnb,FTnb;NbOfSweet1PerFEB', + darray.defineHistogram('slotnb,FTnb,weightsweet1;NbOfSweet1PerFEB', title='Average # of cells with (qfactor+time) readout :Slot:FT', - type='TH2I', + type='TProfile2D', path=hist_path, - weight='weightsweet1', xbins=slot_n,xmin=slot_low,xmax=slot_up, ybins=ft_n, ymin=ft_low, ymax=ft_up) - darray.defineHistogram('slotnb,FTnb;NbOfSweet2PerFEB', + darray.defineHistogram('slotnb,FTnb,weightsweet2;NbOfSweet2PerFEB', title='Average # of cells with samples readout :Slot:FT', - type='TH2I', + type='TProfile2D', path=hist_path, - weight='weightsweet2', xbins=slot_n,xmin=slot_low,xmax=slot_up, ybins=ft_n, ymin=ft_low, ymax=ft_up) diff --git a/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py index 520ad91cacfd0365380bfcdefb89842aefaf4604..103d305206f08acec80ef922ad6310e56fba5aba 100644 --- a/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py @@ -49,8 +49,8 @@ def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, MNBLooseFEBDefStr=""): # first configure known bad FEBs - from AthenaCommon.Configurable import Configurable - if Configurable.configurableRun3Behavior: + from AthenaConfiguration.ComponentFactory import isRun3Cfg + if isRun3Cfg(): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() from LArBadChannelTool.LArBadFebsConfig import LArKnownBadFebCfg, LArKnownMNBFebCfg @@ -67,8 +67,8 @@ def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, larNoisyROMonAlg.SubDetNames=lArDQGlobals.SubDet[0:2] larNoisyROMonAlg.PartitionNames=lArDQGlobals.Partitions[0:4] - #FIXME: only for testing - larNoisyROMonAlg.storeLooseMNBFEBs=True + #FIXME: True only for testing + larNoisyROMonAlg.storeLooseMNBFEBs=False if inKey != "": larNoisyROMonAlg.inputKey=inKey @@ -105,7 +105,7 @@ def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, "L1_XE70" ] doTrigger=False - if Configurable.configurableRun3Behavior: + if isRun3Cfg(): if inputFlags.Trigger.doHLT or LArNoisyROMonForceTrigger: doTrigger=True else: @@ -163,7 +163,7 @@ def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, xbins=slot_n,xmin=slot_low,xmax=slot_up, ybins=ft_n, ymin=ft_low, ymax=ft_up) - darray.defineHistogram('slotMNB,FTMNB;KnownMNBFEB', title='Known MNB FEBs {0} ; Slot ; FT', + darray.defineHistogram('slotMNB,FTMNB;MNBKnownFEB', title='Known MNB FEBs {0} ; Slot ; FT', type='TH2I', xbins=slot_n,xmin=slot_low,xmax=slot_up, ybins=ft_n, ymin=ft_low, ymax=ft_up) @@ -262,7 +262,7 @@ def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, pass - if Configurable.configurableRun3Behavior: + if isRun3Cfg(): cfg.merge(helper.result()) return cfg diff --git a/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py index 47a8896c9a197c8cf52824096ccea4f6fba1890a..db9f96b31a37975617c92ebdc56c3c3024fdf978 100644 --- a/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py @@ -62,8 +62,8 @@ def LArRODMonConfigCore(helper, algoinstance,inputFlags, cellDebug=False, dspDeb #from AthenaCommon.Constants import VERBOSE #larRODMonAlg.OutputLevel=VERBOSE - from AthenaCommon.Configurable import Configurable - if Configurable.configurableRun3Behavior : + from AthenaConfiguration.ComponentFactory import isRun3Cfg + if isRun3Cfg() : # adding BadChan masker private tool from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg acc= LArBadChannelMaskerCfg(inputFlags,problemsToMask=["highNoiseHG","highNoiseMG","highNoiseLG","deadReadout","deadPhys","almostDead","short","sporadicBurstNoise"],ToolName="BadLArChannelMask") diff --git a/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py b/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py index 44223f9c775ad97b0aa884d8f6a8a83dae17d998..c0e3c203ad25ae739c4685599b4604b0dd8851ea 100644 --- a/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py +++ b/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py @@ -3,19 +3,24 @@ include.block("LArMonitoring/LArMonitoring_jobOption.py") #Create the set of flags from AthenaMonitoring.DQMonFlags import DQMonFlags +from AthenaCommon.GlobalFlags import globalflags #Add colltime algo to sequence from LumiBlockComps.BunchCrossingCondAlgDefault import BunchCrossingCondAlgDefault BunchCrossingCondAlgDefault() -from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfigOld -topSequence +=LArCollisionTimeMonConfigOld(DQMonFlags) + +if DQMonFlags.monManEnvironment() == 'tier0ESD': + from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfigOld + topSequence +=LArCollisionTimeMonConfigOld(DQMonFlags) + if globalflags.DataSource()=='data': + from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfigOld + topSequence +=LArAffectedRegionsConfigOld(DQMonFlags) if DQMonFlags.monManEnvironment() == 'tier0Raw': from LArMonitoring.LArNoisyROMonAlg import LArNoisyROMonConfigOld topSequence += LArNoisyROMonConfigOld(DQMonFlags) -from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource == 'data': from LArMonitoring.LArHVCorrMonAlg import LArHVCorrMonConfigOld topSequence += LArHVCorrMonConfigOld(DQMonFlags) diff --git a/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.cxx index 743da8c480ebb9ed2c94bbefbc0deac10c1ff0f2..6acb2818d1f24116ace060c1e39e2d555bc57c9f 100755 --- a/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.cxx +++ b/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.cxx @@ -70,7 +70,7 @@ LArCoverageAlg::initialize() if(m_NphiBinsHEC[1]!=64) warn_binning="NphiBinsHEC[1]!=64 "; if(m_NphiBinsHEC[2]!=64) warn_binning="NphiBinsHEC[2]!=64 "; if(m_NphiBinsHEC[3]!=64) warn_binning="NphiBinsHEC[3]!=64 "; - if(warn_binning!="") ATH_MSG_WARNING(warn_binning+"Did you remember to adjust the white bin filling? The algorithm fills in white eta-phi bins in EMB1, EMEC2 and HEC coverage plots: this expects 256 phi bins. If you change the number of bins, you should change the white bin filling as well. Tip: look at the fill() call where deltaPhi is not zero"); + /** Retrieve ID helpers */ ATH_CHECK( detStore()->retrieve( m_caloIdMgr ) ); @@ -98,8 +98,15 @@ LArCoverageAlg::initialize() m_CaloNoiseGroupArrEM = Monitored::buildToolMap<int>(m_tools,m_CaloNoiseToolGroupName+"EM",m_Nsample); m_CaloNoiseGroupArrHEC = Monitored::buildToolMap<int>(m_tools,m_CaloNoiseToolGroupName+"HEC",m_Nsample); m_CaloNoiseGroupArrFCAL = Monitored::buildToolMap<int>(m_tools,m_CaloNoiseToolGroupName+"FCAL",m_Nsample); - m_CoverageHWToolArrayBarrel = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName,m_CoverageBarrelPartitions); - m_CoverageHWToolArrayEndcap = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName,m_CoverageEndcapPartitions); + + m_CoverageToolArrayEMBA = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName+"EMBA",m_availableErrorCodes); + m_CoverageToolArrayEMECA = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName+"EMECA",m_availableErrorCodes); + m_CoverageToolArrayHECA = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName+"HECA",m_availableErrorCodes); + m_CoverageToolArrayFCalA = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName+"FCalA",m_availableErrorCodes); + m_CoverageToolArrayEMBC = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName+"EMBC",m_availableErrorCodes); + m_CoverageToolArrayEMECC = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName+"EMECC",m_availableErrorCodes); + m_CoverageToolArrayHECC = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName+"HECC",m_availableErrorCodes); + m_CoverageToolArrayFCalC = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName+"FCalC",m_availableErrorCodes); m_BadChannelToolArrayBarrel = Monitored::buildToolMap<int>(m_tools,m_BadChannelsGroupName,m_Sides); m_BadChannelToolArrayEndcap = Monitored::buildToolMap<int>(m_tools,m_BadChannelsGroupName,m_Sides); @@ -129,34 +136,31 @@ LArCoverageAlg::fillHistograms( const EventContext& ctx ) const auto mon_FtSlot = Monitored::Scalar<int>("mon_FtSlot",-1); std::vector<LArChanHelp> the_coverageMap(0); //Note for when we'll have the proper histogram class: the feedthrough-slot coverage plot must be filled with the latest value, the eta-phi coverage plot must be filled with the maximum value - auto mon_coverage = Monitored::Collection("mon_coverage",the_coverageMap,[](const LArChanHelp ch){return ch.getChStatus();}); + auto mon_ChanFtSlot = Monitored::Collection("mon_ChanFtSlot",the_coverageMap,[](const LArChanHelp ch){return ch.getChFtSlot();}); auto mon_Channels = Monitored::Collection("mon_Channels",the_coverageMap,[](const LArChanHelp ch){return ch.getChNumber();}); auto mon_Eta = Monitored::Collection("mon_Eta",the_coverageMap,[](const LArChanHelp ch){return ch.getChEta();}); - double deltaPhi=0; - auto mon_Phi = Monitored::Collection("mon_Phi",the_coverageMap,[&deltaPhi](const LArChanHelp ch){return ch.getChPhi()+deltaPhi;}); + auto mon_Phi = Monitored::Collection("mon_Phi",the_coverageMap,[](const LArChanHelp ch){return ch.getChPhi();}); - /** lambda functions and arrays for manipulating the_coverageMap when filling the white bins, defined here since they will be called twice */ - auto etaRangeEMB1_lambda = [](const LArChanHelp ch){return !(std::abs(ch.getChEta())<1.4);}; - const int n_binSteps = 3; - int binStepsEM_A[n_binSteps] = {-1,+1,+2}; - int binStepsEM_C[n_binSteps] = {-2,-1,+1}; - auto etaRangeEMEC2andHEC_lambda = [](const LArChanHelp ch){return !(std::abs(ch.getChEta())>2.5);}; - int binStepsHEC = -1; + //cutmasks for filling the proper partition + auto mon_isSampling0 = Monitored::Collection("isSampl0",the_coverageMap,[](const LArChanHelp ch){return (ch.getChSampling()==0);}); + auto mon_isSampling1 = Monitored::Collection("isSampl1",the_coverageMap,[](const LArChanHelp ch){return (ch.getChSampling()==1);}); + auto mon_isSampling2 = Monitored::Collection("isSampl2",the_coverageMap,[](const LArChanHelp ch){return (ch.getChSampling()==2);}); + auto mon_isSampling3 = Monitored::Collection("isSampl3",the_coverageMap,[](const LArChanHelp ch){return (ch.getChSampling()==3);}); /** Coverage map * each line is a FEB, each column a sampling (needed for eta-phi plots): coverageMapHWEMBA[ft*(Nslot)+slot-1][sampling]=channelStatus. * NOTE the -1 with the slot, needed because slots counts from 1 and vectors want 0. * also: GlobalVariables::slotEMBA=[1,14]-->Nslot=14 (index=slot-1 from 0 to 13), while feedthroughEMBS=[0,31]-->Nfeedthrough=32. */ - std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapEMBA(m_NftEMB*m_NslotEMB,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); - std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapEMBC(m_NftEMB*m_NslotEMB,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); - std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapEMECA(m_NftEMEC*m_NslotEMEC,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); - std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapEMECC(m_NftEMEC*m_NslotEMEC,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); - std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapHECA(m_NftHEC*m_NslotHEC,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); - std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapHECC(m_NftHEC*m_NslotHEC,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); - std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapFCALA(m_NftFCAL*m_NslotFCAL,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); - std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapFCALC(m_NftFCAL*m_NslotFCAL,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + std::map<std::string,std::map<std::string,std::vector<LArChanHelp> > > coverageMap; + for(auto code : m_availableErrorCodes) { + for(auto part : m_CoverageBarrelPartitions) coverageMap[code][part] = std::vector<LArChanHelp>(0); + for(auto part : m_CoverageEndcapPartitions) coverageMap[code][part] = std::vector<LArChanHelp>(0); + } + /** known problematic FEB array, used to avoid retrieving FEB information for each channel*/ + std::vector<long> knownDeadFEBs(0); + std::vector<long> knownErrorFEBs(0); /** retrieve det. description manager */ const CaloDetDescrManager* ddman = nullptr; @@ -186,6 +190,21 @@ LArCoverageAlg::fillHistograms( const EventContext& ctx ) const fill(m_CaloNoiseToolGroupName,lb1,lb1_x); } + + ATH_MSG_DEBUG( "collect known faulty FEBs" ); + SG::ReadCondHandle<LArBadFebCont> bf{m_BFKey,ctx}; + const LArBadFebCont* mfCont{*bf}; + if(!mfCont) ATH_MSG_WARNING( "Do not have Missing FEBs container !!" ); + else { + for (std::vector<HWIdentifier>::const_iterator allFeb = m_LArOnlineIDHelper->feb_begin();allFeb != m_LArOnlineIDHelper->feb_end(); ++allFeb) { + HWIdentifier febid = HWIdentifier(*allFeb); + const LArBadFeb febStatus = mfCont->status(febid); + if (febStatus.deadAll() || febStatus.deadReadout()) knownDeadFEBs.push_back(febid.get_compact()); + if(febStatus.inError()) knownErrorFEBs.push_back(febid.get_compact()); + } + } + + ATH_MSG_DEBUG( "now loop on channels" ); /** Loop over LArRawChannels */ for (const LArRawChannel& pRawChannel : *pRawChannelsContainer) { @@ -241,8 +260,6 @@ LArCoverageAlg::fillHistograms( const EventContext& ctx ) const } - /*THIS WILL BE MODIFIED ONCE WE HAVE FILL SOLUTION FOR 'SETBINCONTENT' PROBLEM, FROM CENTRAL MONITORING*/ - /** Fill Bad Channels histograms */ flag = DBflag(id); if (flag!=0) {//only fill bad channels @@ -262,8 +279,8 @@ LArCoverageAlg::fillHistograms( const EventContext& ctx ) const // Compute cells status // - int cellContent = 0; - + int cellContent = 0; + /** Cell is connected and in the Readout * Select raw channels properly reconstructed, with all calib constants available * provenance&0x00ff == 0x00a5 : raw channels from OFC iteration, all calib constants found in DB @@ -273,540 +290,117 @@ LArCoverageAlg::fillHistograms( const EventContext& ctx ) const if(m_badChannelMask->cellShouldBeMasked(id)) cellContent=2; else if(energyChan != 0) cellContent=3; - } + } + /** Now check if it's known issue + * Known missing FEB: set content to 1 + * Known missing FEB but cells actually readout: set content to 4 + * Known FEB with error: set content to 0 (CaloCells not produced) + */ + if(knownDeadFEBs.size()>0 && std::find(knownDeadFEBs.begin(), knownDeadFEBs.end(), febID.get_compact())!=knownDeadFEBs.end()) { + if(cellContent==0) cellContent=1; + else cellContent=4; + } + if(knownErrorFEBs.size()>0 && std::find(knownErrorFEBs.begin(), knownErrorFEBs.end(), febID.get_compact())!=knownErrorFEBs.end())cellContent=1; + std::string cellStatusCode=Form("%d",cellContent); /** Fill Coverage maps */ - /** A-Side */ - if(etaChan >= 0){ - /** EM Barrel */ - if(m_LArOnlineIDHelper->isEMBchannel(id) ) { - int sampling = m_LArEM_IDHelper->sampling(offlineID); - coverageMapEMBA[ft*m_NslotEMB+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); - } - /** EM Endcap */ - if(m_LArOnlineIDHelper->isEMECchannel(id)) { - int sampling = m_LArEM_IDHelper->sampling(offlineID); - coverageMapEMECA[ft*m_NslotEMEC+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); - } - /** HEC */ - if (m_LArOnlineIDHelper->isHECchannel(id)) { - int sampling = m_LArHEC_IDHelper->sampling(offlineID); - coverageMapHECA[ft*m_NslotHEC+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); - } - /** FCAL */ - if (m_LArOnlineIDHelper->isFCALchannel(id)) { - int sampling = m_LArFCAL_IDHelper->module(offlineID); - double etaFCal = m_LArFCAL_IDHelper->eta(offlineID); - double phiFCal = m_LArFCAL_IDHelper->phi(offlineID); - coverageMapFCALA[ft*m_NslotFCAL+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaFCal,phiFCal)); - } - /** C-Side */ - }else{ + if(std::find(m_availableErrorCodes.begin(),m_availableErrorCodes.end(),cellStatusCode)!=m_availableErrorCodes.end()) { + std::string part; + int sampling=-1; + int i_ftslot=-1; + double etaFCal=0.; + double phiFCal=0.; + //set the variables for partition, sampling etc. + /** EM Barrel */ if(m_LArOnlineIDHelper->isEMBchannel(id) ) { - int sampling = m_LArEM_IDHelper->sampling(offlineID); - coverageMapEMBC[ft*m_NslotEMB+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + part="EMB"; + sampling = m_LArEM_IDHelper->sampling(offlineID); + i_ftslot=ft*m_NslotEMB+slot-1; } /** EM Endcap */ if(m_LArOnlineIDHelper->isEMECchannel(id)) { - int sampling = m_LArEM_IDHelper->sampling(offlineID); - coverageMapEMECC[ft*m_NslotEMEC+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + part="EMEC"; + sampling = m_LArEM_IDHelper->sampling(offlineID); + i_ftslot=ft*m_NslotEMEC+slot-1; } /** HEC */ if (m_LArOnlineIDHelper->isHECchannel(id)) { - int sampling = m_LArHEC_IDHelper->sampling(offlineID); - coverageMapHECC[ft*m_NslotHEC+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + part="HEC"; + sampling = m_LArHEC_IDHelper->sampling(offlineID); + i_ftslot=ft*m_NslotHEC+slot-1; } /** FCAL */ if (m_LArOnlineIDHelper->isFCALchannel(id)) { - int sampling = m_LArFCAL_IDHelper->module(offlineID); - double etaFCal = m_LArFCAL_IDHelper->eta(offlineID); - double phiFCal = m_LArFCAL_IDHelper->phi(offlineID); - coverageMapFCALC[ft*m_NslotFCAL+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaFCal,phiFCal)); + part="FCal"; + sampling = m_LArFCAL_IDHelper->module(offlineID); + i_ftslot=ft*m_NslotFCAL+slot-1; + etaFCal = m_LArFCAL_IDHelper->eta(offlineID); + phiFCal = m_LArFCAL_IDHelper->phi(offlineID); } - } - }// end Raw Channels Loop - - /** now correct for missing febs and pass the coverage maps to the fill() method. */ - - SG::ReadCondHandle<LArBadFebCont> bf{m_BFKey,ctx}; - const LArBadFebCont* mfCont{*bf}; - ATH_MSG_DEBUG( "now check missing FEBS"); - if(!mfCont) { - ATH_MSG_WARNING( "Do not have Missing FEBs container !!" ); - /** simply fill in what you have */ - //EMB - for(int i_feb=0;i_feb<m_NftEMB*m_NslotEMB;i_feb++) { - mon_FtSlot=i_feb; - for(int i_sam=0;i_sam<m_Nsample;i_sam++) { - the_coverageMap.clear(); - the_coverageMap=coverageMapEMBA[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayBarrel.at("EMBA")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"EMBA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - if(i_sam==1) { - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMB1_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - for(int i_step=0;i_step<n_binSteps;i_step++) { - deltaPhi=(2*TMath::Pi()/m_NphiBinsEMB1)*binStepsEM_A[i_step]; - fill(m_CoverageHWGroupName+"EMBA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } //done filling the white bins - the_coverageMap.clear(); - the_coverageMap=coverageMapEMBC[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayBarrel.at("EMBC")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"EMBC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - if(i_sam==1) { - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMB1_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - for(int i_step=0;i_step<n_binSteps;i_step++) { - deltaPhi=(2*TMath::Pi()/m_NphiBinsEMB1)*binStepsEM_C[i_step]; - fill(m_CoverageHWGroupName+"EMBC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } //done filling the white bins - } - } - //EMEC - for(int i_feb=0;i_feb<m_NftEMEC*m_NslotEMEC;i_feb++) { - mon_FtSlot=i_feb; - for(int i_sam=0;i_sam<m_Nsample;i_sam++) { - the_coverageMap.clear(); - the_coverageMap=coverageMapEMECA[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("EMECA")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"EMECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - if(i_sam==2) { - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - for(int i_step=0;i_step<n_binSteps;i_step++) { - deltaPhi=(2*TMath::Pi()/m_NphiBinsEMEC2)*binStepsEM_A[i_step]; - fill(m_CoverageHWGroupName+"EMECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } //done filling the white bins - the_coverageMap.clear(); - the_coverageMap=coverageMapEMECC[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("EMECC")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"EMECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - if(i_sam==2) { - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - for(int i_step=0;i_step<n_binSteps;i_step++) { - deltaPhi=(2*TMath::Pi()/m_NphiBinsEMEC2)*binStepsEM_C[i_step]; - fill(m_CoverageHWGroupName+"EMECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } //done filling the white bins - } - } - //HEC - for(int i_feb=0;i_feb<m_NftHEC*m_NslotHEC;i_feb++) { - mon_FtSlot=i_feb; - for(int i_sam=0;i_sam<m_Nsample;i_sam++) { - the_coverageMap.clear(); - the_coverageMap=coverageMapHECA[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("HECA")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"HECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - deltaPhi=(2*TMath::Pi()/m_NphiBinsHEC[i_sam])*binStepsHEC; - fill(m_CoverageHWGroupName+"HECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //done filling the white bins - - the_coverageMap.clear(); - the_coverageMap=coverageMapHECC[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("HECC")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"HECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); -//fill in white bins - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - deltaPhi=(2*TMath::Pi()/m_NphiBinsHEC[i_sam])*binStepsHEC; - fill(m_CoverageHWGroupName+"HECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //done filling the white bins - } - } - //FCAL - for(int i_feb=0;i_feb<m_NftFCAL*m_NslotFCAL;i_feb++) { - mon_FtSlot=i_feb; - for(int i_sam=1;i_sam<m_Nsample;i_sam++) { //starting from 1 in fcal - the_coverageMap=coverageMapFCALA[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("FCalA")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"FCalA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - the_coverageMap=coverageMapFCALC[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("FCalC")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"FCalC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } - return StatusCode::SUCCESS; -} - - /** since you have the missing FEB information, apply the correction */ - for (std::vector<HWIdentifier>::const_iterator allFeb = m_LArOnlineIDHelper->feb_begin();allFeb != m_LArOnlineIDHelper->feb_end(); ++allFeb) { - HWIdentifier febid = HWIdentifier(*allFeb); - - /** - * Known missing FEB: set content to 1 - * Known missing FEB but cells actually readout: set content to 4 - * Known FEB with error: set content to 0 (CaloCells not produced) - */ - - int barrel_ec = m_LArOnlineIDHelper->barrel_ec(febid); - int pos_neg = m_LArOnlineIDHelper->pos_neg(febid); - int ft = m_LArOnlineIDHelper->feedthrough(febid); - int slot = m_LArOnlineIDHelper->slot(febid); - const LArBadFeb febStatus = mfCont->status(febid); - - //Barrel - if (barrel_ec==0) { - int i_feb=ft*m_NslotEMB+slot-1; - mon_FtSlot=i_feb; - - // EMBA - if (pos_neg==1){ - //check for replacement - int replace=-100; - bool isMapEmpty=true; - for(uint i_sam=0;i_sam<coverageMapEMBA[i_feb].size();i_sam++) { - if(coverageMapEMBA[i_feb][i_sam].size()>0) { - ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapEMBA[i_feb][i_sam][1]).getChNumber() ); - replace = CheckReplacement((coverageMapEMBA[i_feb][i_sam][1]).getChStatus(),febStatus); - isMapEmpty=false; - break; - } - } - if(isMapEmpty) continue; - - /** replace content if you have to */ - bool doReplace=(replace>-100); - for(uint i_sam=0;i_sam<coverageMapEMBA[i_feb].size();i_sam++) { - if(doReplace) { - for (auto chanElement : coverageMapEMBA[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place - } - - /** now that everything is set, fill */ - the_coverageMap.clear(); - the_coverageMap=coverageMapEMBA[i_feb][i_sam]; - ATH_MSG_DEBUG( "fill EMBA: i_feb=" << i_feb << " i_sam=" << i_sam << " size="<< the_coverageMap.size()); - fill(m_tools[m_CoverageHWToolArrayBarrel.at("EMBA")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"EMBA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - if(i_sam==1) { - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMB1_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - for(int i_step=0;i_step<n_binSteps;i_step++) { - deltaPhi=(2*TMath::Pi()/m_NphiBinsEMB1)*binStepsEM_A[i_step]; - fill(m_CoverageHWGroupName+"EMBA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } //done filling the white bins - } - } + //set A-C side + if(etaChan >= 0) part+="A"; + else part+="C"; - // EMBC - if (pos_neg==0){ - - //check for replacement - int replace=-100; - bool isMapEmpty=true; - for(uint i_sam=0;i_sam<coverageMapEMBC[i_feb].size();i_sam++) { - if(coverageMapEMBC[i_feb][i_sam].size()>0) { - replace = CheckReplacement((coverageMapEMBC[i_feb][i_sam][1]).getChStatus(),febStatus); - isMapEmpty=false; - break; - } - } - if(isMapEmpty) continue; - - /** replace content if you have to */ - bool doReplace=(replace>-100); - for(uint i_sam=0;i_sam<coverageMapEMBC[i_feb].size();i_sam++) { - if(doReplace) { - for (auto chanElement : coverageMapEMBC[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place - } - - /** now that everything is set, fill */ - the_coverageMap.clear(); - the_coverageMap=coverageMapEMBC[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayBarrel.at("EMBC")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"EMBC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - if(i_sam==1) { - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMB1_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - for(int i_step=0;i_step<n_binSteps;i_step++) { - deltaPhi=(2*TMath::Pi()/m_NphiBinsEMB1)*binStepsEM_C[i_step]; - fill(m_CoverageHWGroupName+"EMBC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } //done filling the white bins - } - } - } - //Endcap - if (barrel_ec==1) { - // First find out if it's EMEC, HEC or FCAL ! - HWIdentifier test_chid = m_LArOnlineIDHelper->channel_Id(febid,1); - - //EMEC - if(m_LArOnlineIDHelper->isEMECchannel(test_chid)) { - int i_feb=ft*m_NslotEMEC+slot-1; - mon_FtSlot=i_feb; - - // EMECA - if (pos_neg==1){ - - //check for replacement - int replace=-100; - bool isMapEmpty=true; - for(uint i_sam=0;i_sam<coverageMapEMECA[i_feb].size();i_sam++) { - if(coverageMapEMECA[i_feb][i_sam].size()>0) { - ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapEMECA[i_feb][i_sam][1]).getChNumber() ); - replace = CheckReplacement((coverageMapEMECA[i_feb][i_sam][1]).getChStatus(),febStatus); - isMapEmpty=false; - break; - } - } - if(isMapEmpty) continue; - - /** replace content if you have to */ - bool doReplace=(replace>-100); - for(uint i_sam=0;i_sam<coverageMapEMECA[i_feb].size();i_sam++) { - if(doReplace) { - for (auto chanElement : coverageMapEMECA[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place - } - - /** now that everything is set, fill */ - the_coverageMap.clear(); - the_coverageMap=coverageMapEMECA[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("EMECA")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"EMECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - if(i_sam==2) { - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - for(int i_step=0;i_step<n_binSteps;i_step++) { - deltaPhi=(2*TMath::Pi()/m_NphiBinsEMEC2)*binStepsEM_A[i_step]; - fill(m_CoverageHWGroupName+"EMECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } //done filling the white bins - } - } + if(part.find("FCal") != std::string::npos) coverageMap[cellStatusCode][part].push_back(LArChanHelp(single_channel,i_ftslot,sampling,etaFCal,phiFCal)); + else coverageMap[cellStatusCode][part].push_back(LArChanHelp(single_channel,i_ftslot,sampling,etaChan,phiChan)); + }//end of 'if cellContent in availableErrors' + }// end Raw Channels Loop - // EMECC - if (pos_neg==0){ - - //check for replacement - int replace=-100; - bool isMapEmpty=true; - for(uint i_sam=0;i_sam<coverageMapEMECC[i_feb].size();i_sam++) { - if(coverageMapEMECC[i_feb][i_sam].size()>0) { - ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapEMECC[i_feb][i_sam][1]).getChNumber() ); - replace = CheckReplacement((coverageMapEMECC[i_feb][i_sam][1]).getChStatus(),febStatus); - isMapEmpty=false; - break; - } - } - if(isMapEmpty) continue; - - /** replace content if you have to */ - bool doReplace=(replace>-100); - for(uint i_sam=0;i_sam<coverageMapEMECC[i_feb].size();i_sam++) { - if(doReplace) { - for (auto chanElement : coverageMapEMECC[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place - } - - //now that everything is set, fill - the_coverageMap.clear(); - the_coverageMap=coverageMapEMECC[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("EMECC")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"EMECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - if(i_sam==2) { - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - for(int i_step=0;i_step<n_binSteps;i_step++) { - deltaPhi=(2*TMath::Pi()/m_NphiBinsEMEC2)*binStepsEM_C[i_step]; - fill(m_CoverageHWGroupName+"EMECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } //done filling the white bins - } - } - } - //HEC - if(m_LArOnlineIDHelper->isHECchannel(test_chid)){ - int i_feb=ft*m_NslotHEC+slot-1; - mon_FtSlot=i_feb; - - // HECA - if (pos_neg==1){ - - //check for replacement - int replace=-100; - bool isMapEmpty=true; - for(uint i_sam=0;i_sam<coverageMapHECA[i_feb].size();i_sam++) { - if(coverageMapHECA[i_feb][i_sam].size()>0) { - ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapHECA[i_feb][i_sam][1]).getChNumber() ); - replace = CheckReplacement((coverageMapHECA[i_feb][i_sam][1]).getChStatus(),febStatus); - isMapEmpty=false; - break; - } - } - if(isMapEmpty) continue; - - /** replace content if you have to */ - bool doReplace=(replace>-100); - for(uint i_sam=0;i_sam<coverageMapHECA[i_feb].size();i_sam++) { - if(doReplace) { - for (auto chanElement : coverageMapHECA[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place - } - - //now that everything is set, fill - the_coverageMap.clear(); - the_coverageMap=coverageMapHECA[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("HECA")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"HECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - deltaPhi=(2*TMath::Pi()/m_NphiBinsHEC[i_sam])*binStepsHEC; - fill(m_CoverageHWGroupName+"HECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //done filling the white bins - } - } + /** now fill the plots */ - // HECC - if (pos_neg==0){ - - //check for replacement - int replace=-100; - bool isMapEmpty=true; - for(uint i_sam=0;i_sam<coverageMapHECC[i_feb].size();i_sam++) { - if(coverageMapHECC[i_feb][i_sam].size()>0) { - ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapHECC[i_feb][i_sam][1]).getChNumber() ); - replace = CheckReplacement((coverageMapHECC[i_feb][i_sam][1]).getChStatus(),febStatus); - isMapEmpty=false; - break; - } - } - if(isMapEmpty) continue; - - /** replace content if you have to */ - bool doReplace=(replace>-100); - for(uint i_sam=0;i_sam<coverageMapHECC[i_feb].size();i_sam++) { - if(doReplace) { - for (auto chanElement : coverageMapHECC[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place - } - - //now that everything is set, fill - the_coverageMap.clear(); - the_coverageMap=coverageMapHECC[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("HECC")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"HECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //fill in white bins - the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill - deltaPhi=(2*TMath::Pi()/m_NphiBinsHEC[i_sam])*binStepsHEC; - fill(m_CoverageHWGroupName+"HECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - //done filling the white bins - } - } - } + ATH_MSG_DEBUG( "now fill coverage plots"); - //FCAL - if(m_LArOnlineIDHelper->isFCALchannel(test_chid)){ - int i_feb=ft*m_NslotFCAL+slot-1; - mon_FtSlot=i_feb; - - // FCALA - if (pos_neg==1){ - - //check for replacement - int replace=-100; - bool isMapEmpty=true; - for(uint i_sam=0;i_sam<coverageMapFCALA[i_feb].size();i_sam++) { - if(coverageMapFCALA[i_feb][i_sam].size()>0) { - ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapFCALA[i_feb][i_sam][1]).getChNumber() ); - replace = CheckReplacement((coverageMapFCALA[i_feb][i_sam][1]).getChStatus(),febStatus); - isMapEmpty=false; - break; - } - } - if(isMapEmpty) continue; - - /** replace content if you have to */ - bool doReplace=(replace>-100); - for(uint i_sam=1;i_sam<coverageMapFCALA[i_feb].size();i_sam++) { //starting from 1 in FCal - if(doReplace) { - for (auto chanElement : coverageMapFCALA[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place - } - - //now that everything is set, fill - the_coverageMap.clear(); - the_coverageMap=coverageMapFCALA[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("FCalA")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"FCalA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } + for (auto chanStatusCode : m_availableErrorCodes) { + //EMBA + the_coverageMap.clear(); + the_coverageMap=coverageMap[chanStatusCode]["EMBA"]; + if(the_coverageMap.size()!=0) fill(m_tools[m_CoverageToolArrayEMBA.at(chanStatusCode)],mon_Channels,mon_ChanFtSlot,mon_Eta,mon_Phi,mon_isSampling0,mon_isSampling1,mon_isSampling2,mon_isSampling3); + //EMBC + the_coverageMap.clear(); + the_coverageMap=coverageMap[chanStatusCode]["EMBC"]; + if(the_coverageMap.size()!=0) fill(m_tools[m_CoverageToolArrayEMBC.at(chanStatusCode)],mon_Channels,mon_ChanFtSlot,mon_Eta,mon_Phi,mon_isSampling0,mon_isSampling1,mon_isSampling2,mon_isSampling3); + + //EMECA + the_coverageMap.clear(); + the_coverageMap=coverageMap[chanStatusCode]["EMECA"]; + if(the_coverageMap.size()!=0) fill(m_tools[m_CoverageToolArrayEMECA.at(chanStatusCode)],mon_Channels,mon_ChanFtSlot,mon_Eta,mon_Phi,mon_isSampling0,mon_isSampling1,mon_isSampling2,mon_isSampling3); + + //EMECC + the_coverageMap.clear(); + the_coverageMap=coverageMap[chanStatusCode]["EMECC"]; + if(the_coverageMap.size()!=0) fill(m_tools[m_CoverageToolArrayEMECC.at(chanStatusCode)],mon_Channels,mon_ChanFtSlot,mon_Eta,mon_Phi,mon_isSampling0,mon_isSampling1,mon_isSampling2,mon_isSampling3); + + //HECA + the_coverageMap.clear(); + the_coverageMap=coverageMap[chanStatusCode]["HECA"]; + if(the_coverageMap.size()!=0) fill(m_tools[m_CoverageToolArrayHECA.at(chanStatusCode)],mon_Channels,mon_ChanFtSlot,mon_Eta,mon_Phi,mon_isSampling0,mon_isSampling1,mon_isSampling2,mon_isSampling3); + + //HECC + the_coverageMap.clear(); + the_coverageMap=coverageMap[chanStatusCode]["HECC"]; + if(the_coverageMap.size()!=0) fill(m_tools[m_CoverageToolArrayHECC.at(chanStatusCode)],mon_Channels,mon_ChanFtSlot,mon_Eta,mon_Phi,mon_isSampling0,mon_isSampling1,mon_isSampling2,mon_isSampling3); + + //FCalA + the_coverageMap.clear(); + the_coverageMap=coverageMap[chanStatusCode]["FCalA"]; + if(the_coverageMap.size()!=0) fill(m_tools[m_CoverageToolArrayFCalA.at(chanStatusCode)],mon_Channels,mon_ChanFtSlot,mon_Eta,mon_Phi,mon_isSampling0,mon_isSampling1,mon_isSampling2,mon_isSampling3); - // FCALC - if (pos_neg==0){ - - //check for replacement - int replace=-100; - bool isMapEmpty=true; - for(uint i_sam=0;i_sam<coverageMapFCALC[i_feb].size();i_sam++) { - if(coverageMapFCALC[i_feb][i_sam].size()>0) { - ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapFCALC[i_feb][i_sam][1]).getChNumber() ); - replace = CheckReplacement((coverageMapFCALC[i_feb][i_sam][1]).getChStatus(),febStatus); - isMapEmpty=false; - break; - } - } - if(isMapEmpty) continue; - - /** replace content if you have to */ - bool doReplace=(replace>-100); - //set content - for(uint i_sam=1;i_sam<coverageMapFCALC[i_feb].size();i_sam++) { //starting from 1 in fcal - if(doReplace) { - for (auto chanElement : coverageMapFCALC[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place - } - - //now that everything is set, fill - the_coverageMap.clear(); - the_coverageMap=coverageMapFCALC[i_feb][i_sam]; - fill(m_tools[m_CoverageHWToolArrayEndcap.at("FCalC")],mon_Channels,mon_FtSlot,mon_coverage); - deltaPhi=0; - fill(m_CoverageHWGroupName+"FCalC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); - } - } - } - } - }// end of FEB loop + //FCalC + the_coverageMap.clear(); + the_coverageMap=coverageMap[chanStatusCode]["FCalC"]; + if(the_coverageMap.size()!=0) fill(m_tools[m_CoverageToolArrayFCalC.at(chanStatusCode)],mon_Channels,mon_ChanFtSlot,mon_Eta,mon_Phi,mon_isSampling0,mon_isSampling1,mon_isSampling2,mon_isSampling3); + + } return StatusCode::SUCCESS; } -/*---------------------------------------------------------*/ -int LArCoverageAlg::CheckReplacement(int content,LArBadFeb febStatus) const -{ - /** check if this FEB needs replacement */ - int replace=-100; - if (febStatus.deadAll() || febStatus.deadReadout()) { - if(content==0 || content==1) replace=1; - else replace=4; - } - if(febStatus.inError()) { - replace=1; - } - return replace; -} + /*---------------------------------------------------------*/ int LArCoverageAlg::DBflag(HWIdentifier onID) const diff --git a/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.h b/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.h index 0af62973ca94c6b0d56c76f3191c62bbd9efb6a5..37dbe435f515429bd9874b978df343105206a93c 100644 --- a/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.h +++ b/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.h @@ -55,22 +55,22 @@ class LArCoverageAlg: public AthMonitorAlgorithm class LArChanHelp { public: - LArChanHelp(int chan=-1,int status=-100,double eta=-100,double phi=-100): m_channelNumber(chan), m_channelStatus(status), m_channelEta(eta), m_channelPhi(phi) {}; + LArChanHelp(int chan=-1,int ft_slot=-100,int sampling=-1,double eta=-100,double phi=-100): m_channelNumber(chan), m_channelFtSlot(ft_slot), m_channelSampling(sampling), m_channelEta(eta), m_channelPhi(phi) {}; ~LArChanHelp() {}; - void setChanStatus(int status){m_channelStatus=status;}; void setChanPhi(double phi){m_channelPhi=phi;}; int getChNumber() const { return m_channelNumber; }; - int getChStatus() const { return m_channelStatus; }; + int getChFtSlot() const { return m_channelFtSlot; }; + int getChSampling() const { return m_channelSampling; }; double getChEta() const { return m_channelEta; }; double getChPhi() const { return m_channelPhi; }; private: int m_channelNumber; - int m_channelStatus; + int m_channelFtSlot; + int m_channelSampling; double m_channelEta; double m_channelPhi; - }; const LArOnlineID* m_LArOnlineIDHelper; @@ -97,9 +97,6 @@ class LArCoverageAlg: public AthMonitorAlgorithm /** To retrieve bad channel DB keywords */ int DBflag(HWIdentifier) const; - /** To check if FEB status in map needs to be replaced */ - int CheckReplacement(int ,LArBadFeb) const; - /** Properties */ Gaudi::Property<EventContext::ContextEvt_t> m_nevents {this,"Nevents",50}; Gaudi::Property<int> m_Nchannels {this,"Nchannels",128}; @@ -123,13 +120,22 @@ class LArCoverageAlg: public AthMonitorAlgorithm Gaudi::Property< std::vector<std::string> > m_CoverageBarrelPartitions {this, "CoverageBarrelPartitions", {"EMBA","EMBC"}}; Gaudi::Property< std::vector<std::string> > m_CoverageEndcapPartitions {this, "CoverageEndcapPartitions", {"EMECA","EMECC","HECA","HECC","FCalA","FCalC"}}; Gaudi::Property< std::vector<std::string> > m_Sides {this, "Sides", {"A","C"}}; + Gaudi::Property< std::vector<std::string> > m_availableErrorCodes {this, "AvailableErrorCodes", {"0","1","2","3","4"}}; /** for tools array */ std::vector<int> m_CaloNoiseGroupArrEM; std::vector<int> m_CaloNoiseGroupArrHEC; std::vector<int> m_CaloNoiseGroupArrFCAL; - std::map<std::string,int> m_CoverageHWToolArrayBarrel; - std::map<std::string,int> m_CoverageHWToolArrayEndcap; + + std::map<std::string,int> m_CoverageToolArrayEMBA; + std::map<std::string,int> m_CoverageToolArrayEMECA; + std::map<std::string,int> m_CoverageToolArrayHECA; + std::map<std::string,int> m_CoverageToolArrayFCalA; + std::map<std::string,int> m_CoverageToolArrayEMBC; + std::map<std::string,int> m_CoverageToolArrayEMECC; + std::map<std::string,int> m_CoverageToolArrayHECC; + std::map<std::string,int> m_CoverageToolArrayFCalC; + std::map<std::string,int> m_BadChannelToolArrayBarrel; std::map<std::string,int> m_BadChannelToolArrayEndcap; diff --git a/LArCalorimeter/LArMonitoring/src/LArFEBMonAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArFEBMonAlg.cxx index d6f49f5a0636e8f5edb1fcff8ddd63fcfa71c2c7..ca69e2a5bf0131340e06ba4525c560f95d24b873 100755 --- a/LArCalorimeter/LArMonitoring/src/LArFEBMonAlg.cxx +++ b/LArCalorimeter/LArMonitoring/src/LArFEBMonAlg.cxx @@ -11,15 +11,11 @@ #include "LArFEBMonAlg.h" #include "LArRecEvent/LArEventBitInfo.h" -#include "LArRawEvent/LArFebHeaderContainer.h" -#include "LArRawEvent/LArFebErrorSummary.h" #include "LArRawConditions/LArDSPThresholdsComplete.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "LArCOOLConditions/LArDSPThresholdsFlat.h" -#include "TTree.h" - #include "LArTrigStreamMatching.h" #include <algorithm> @@ -72,6 +68,9 @@ StatusCode LArFEBMonAlg::initialize() { ATH_MSG_DEBUG( "Missing FEBs key" << m_BFKey.key() << " initialized" ); } + ATH_CHECK( m_hdrContKey.initialize() ); + ATH_CHECK( m_lArFebErrorSummaryKey.initialize() ); + m_histoGroups.reserve(m_SubDetNames.size()); for (unsigned i=0; i<m_SubDetNames.size(); ++i) { std::vector<std::string> part; @@ -91,11 +90,9 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { bool eventRejected = false; std::bitset<13> rejectionBits; - // these will be needed once TTRee is implemented: - //m_febInErrorTree.clear(); - //m_febErrorTypeTree.clear(); - // for the moment use local variable: - std::vector<int> febInErrorTree; + // for TTree + std::vector<int> febInErrorTree(0); + std::vector<int> febErrorTypeTree(0); // Retrieve event info to get event time,trigger type... // Retrieved at beg of method now to get the LVL1 type @@ -107,30 +104,28 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { auto l1 = Monitored::Scalar<int>("LVL1Trig",l1Trig); fill(m_monGroupName,l1); - //m_eventTime=thisEvent->timeStamp(); - //m_eventTime_ns=thisEvent->timeStampNSOffset(); - + auto eventTime = Monitored::Scalar<int>("timestamp",thisEvent->timeStamp()); + auto eventTime_ns = Monitored::Scalar<int>("time_ns",thisEvent->timeStampNSOffset()); + unsigned lumi_block = thisEvent->lumiBlock(); bool lar_inerror = (thisEvent->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error) ? true : false; ATH_MSG_DEBUG( "LArFEBMonAlg Lumi block: "<<lumi_block); - const LArFebHeaderContainer* hdrCont; - const LArFebErrorSummary* lArFebErrorSummary; - StatusCode sc = evtStore()->retrieve(hdrCont); - if (sc.isFailure() || !hdrCont) { - ATH_MSG_WARNING( "No LArFebHeaderContainer found in TDS" ); - return sc; + SG::ReadHandle<LArFebHeaderContainer> hdrCont(m_hdrContKey, ctx); + SG::ReadHandle<LArFebErrorSummary> lArFebErrorSummary(m_lArFebErrorSummaryKey, ctx); + if (!hdrCont.isValid()) { + ATH_MSG_ERROR( "No LArFebHeaderContainer found in TDS" ); + return StatusCode::FAILURE; } if (hdrCont->size()==0) { - ATH_MSG_WARNING( "Got empty LArFebHeaderContainer. Do nothing" ); + ATH_MSG_ERROR( "Got empty LArFebHeaderContainer. Do nothing" ); return StatusCode::FAILURE; } - sc=evtStore()->retrieve( lArFebErrorSummary, "LArFebErrorSummary"); - if (sc.isFailure()) { - ATH_MSG_WARNING( "No LArFebErrorSummary found in TDS" ); + if (!lArFebErrorSummary.isValid()) { + ATH_MSG_ERROR( "No LArFebErrorSummary found in TDS" ); return StatusCode::FAILURE; } @@ -166,10 +161,8 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { std::lock_guard<std::mutex> lock(m_mut); if (!m_dspThrDone && firstEventType == 4) { - //dspThresholds_ADC->SetTitle(Form("DSP thresholds for ADC-sample transmission (only in physics) - LB %4d",lumi_block)); - //dspThresholds_qtime->SetTitle(Form("DSP thresholds for qfactor+time calculation (only in physics) - LB %4d",lumi_block)); - auto dspADC = Monitored::Scalar<int>("dspThrADC",-1); - auto dspQT = Monitored::Scalar<int>("dspThrQT",-1); + auto dspADC = Monitored::Scalar<unsigned int>("dspThrADC",-1); + auto dspQT = Monitored::Scalar<unsigned int>("dspThrQT",-1); if (!m_run1DSPThresholdsKey.empty()) { ATH_MSG_DEBUG("Loading run1 version of LAr DSP Thresholds"); SG::ReadCondHandle<LArDSPThresholdsComplete> dspThresh (m_run1DSPThresholdsKey, ctx); @@ -270,7 +263,7 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { // Loop over all febs to plot the error from statusword // This is mandatory to also monitor the FEBs with missing headers - //bool anyfebIE = false; + bool anyfebIE = false; for (std::vector<HWIdentifier>::const_iterator allFeb = m_onlineHelper->feb_begin(); allFeb != m_onlineHelper->feb_end(); ++allFeb) { HWIdentifier febid = HWIdentifier(*allFeb); @@ -293,10 +286,10 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { if (currentFebStatus && febInErrorTree.size()<33){ febInErrorTree.push_back(febid.get_identifier32().get_compact()); - //m_febErrorTypeTree.push_back(rejectionBits.to_ulong()); + febErrorTypeTree.push_back(rejectionBits.to_ulong()); } } - //if(currentFebStatus) anyfebIE = currentFebStatus; + if(currentFebStatus) anyfebIE = currentFebStatus; } //Fill general data histos @@ -321,8 +314,10 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { auto nbfebpart = Monitored::Scalar<int>("nbFEBpart",-1); for(unsigned i=0; i<m_partitions.size(); ++i) { part=i; + unsigned subdet = i / 2; nbfebpart=nfeb[i]; fill(m_monGroupName,part,nbfebpart); + fill(m_tools[m_histoGroups.at(subdet).at(m_partitions[i])],nbfebpart); } // If the nb of DSP headers is lower than the maximum, this means that there are some missing FEBs, probably @@ -331,12 +326,13 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { // ATH_MSG_ERROR( "ICI" << nbOfFeb << " " << m_nbOfFebBlocksTotal->GetBinLowEdge(m_nbOfFebBlocksTotal->GetMaximumBin()) ); auto evtrej = Monitored::Scalar<int>("EvtRej",-1); + float evt_yield=-1; auto evtyield = Monitored::Scalar<float>("EvtRejYield",-1); + auto evtyield1D = Monitored::Scalar<float>("EvtRejYield1D",-1); auto evtoneyield = Monitored::Scalar<float>("EvtOneYield",-1); - auto evtyieldout = Monitored::Scalar<float>("EvtOneYieldOut",-1); - auto lb = Monitored::Scalar<int>("LB",lumi_block); + auto evtyieldout = Monitored::Scalar<float>("EvtRejYieldOut",-1); if (febInErrorTree.size()>=1 || newHighWaterMarkNFebBlocksTotal || nbOfFeb < m_nbOfFebBlocksTotal ){ - evtrej=1; evtyield = 100.; evtoneyield =100.; + evtrej=1; evt_yield = 100.; evtoneyield =100.; if (febInErrorTree.size()>=4) evtrej=2; } else{ evtoneyield=0.; @@ -344,24 +340,26 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { if (thisEvent->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error || nbOfFeb != m_nbOfFebBlocksTotal || nbOfFeb < m_nFEBnominal){ // Event in error (whatever is the cause) if (thisEvent->isEventFlagBitSet(xAOD::EventInfo::LAr,LArEventBitInfo::DATACORRUPTED) || nbOfFeb != m_nbOfFebBlocksTotal){ // Event corrupted (>=1/4 FEBs in error) - evtrej=3; evtyield = 100.; + evtrej=3; evt_yield = 100.; if (thisEvent->isEventFlagBitSet(xAOD::EventInfo::LAr,LArEventBitInfo::DATACORRUPTEDVETO)) evtyieldout=0.; // Vetoed else evtyieldout=100.; // not vetoed auto rbits = Monitored::Scalar<unsigned long>("rejBits", rejectionBits.to_ulong()); fill(m_monGroupName, rbits); } else{ // Event in error but not corrupted - evtyield = 50.; evtyieldout=100.; + evt_yield = 50.; evtyieldout=100.; } - if (thisEvent->isEventFlagBitSet(xAOD::EventInfo::LAr,LArEventBitInfo::DATACORRUPTEDVETO)) evtrej=4; if (thisEvent->isEventFlagBitSet(xAOD::EventInfo::LAr,LArEventBitInfo::NOISEBURSTVETO)) evtrej=5; + evtyield1D=evt_yield; } else{ // The event is NOT in error. Fill per LB TProfile - evtrej=6; evtyield = 0.; evtyieldout=0.; + evtrej=6; evt_yield = 0.; evtyield1D=100; evtyieldout=0.; } + evtyield=evt_yield; auto evSize = Monitored::Scalar<float>("LArEvSize",larEventSize/262144); auto sweet2 = Monitored::Scalar<int>("NbOfSweet2",totNbOfSweet2); - fill(m_monGroupName,evtrej,evtyield,evtoneyield, evSize, sweet2, lb); + auto lb0 = Monitored::Scalar<int>("LB0",lumi_block); //to avoid 'NbOfEventsVSLB' being filled multiple times + fill(m_monGroupName,evtrej,evtyieldout,evtyield,evtyield1D,evtoneyield,evSize, sweet2, lb0); evtrej=7; fill(m_monGroupName,evtrej); if(environment() == Environment_t::online) { @@ -369,9 +367,15 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { fill(m_monGroupName,evtyield,lbfake); } - //if(anyfebIE) { /* m_CorruptTree->Fill() FIXME once available in DQ*/; } - + if(anyfebIE) { + //Fill LArCorrupted tree + auto mon_febInErrorTree = Monitored::Collection("febHwId", febInErrorTree); + auto mon_febErrorTypeTree = Monitored::Collection("febErrorType", febErrorTypeTree); + fill(m_monGroupName,mon_febInErrorTree,mon_febErrorTypeTree,eventTime,eventTime_ns); + } + // Now we could fill the event size + auto lb = Monitored::Scalar<int>("LB",lumi_block); auto evsize=Monitored::Scalar<float>("LArEvSizePart",-1); if(environment() == Environment_t::online && m_streams.size() > 0) { std::vector<unsigned int> streamsThisEvent=LArMon::trigStreamMatching(m_streams,thisEvent->streamTags()); @@ -411,7 +415,7 @@ StatusCode LArFEBMonAlg::fillHistograms(const EventContext& ctx) const { } - return sc; + return StatusCode::SUCCESS; } @@ -574,8 +578,7 @@ void LArFEBMonAlg::fillErrorsSummary(unsigned int partitNb_2,int ft,int slot,uin unsigned subdet = partitNb_2 / 2; auto sl = Monitored::Scalar<int>("slotabs",slot); auto ftmon = Monitored::Scalar<int>("FTabs",ft); - auto err = Monitored::Scalar<float>("erryield",100.); - fill(m_tools[m_histoGroups.at(subdet).at(m_partitions[partitNb_2])],sl,ftmon,err); + fill(m_tools[m_histoGroups.at(subdet).at(m_partitions[partitNb_2])],sl,ftmon); float ferr=0.; if (lar_inerror) {// LArinError eventRejected = true; diff --git a/LArCalorimeter/LArMonitoring/src/LArFEBMonAlg.h b/LArCalorimeter/LArMonitoring/src/LArFEBMonAlg.h index 7c4adf8a8c0ffdbbcc118c30d55adaec50741001..8dfe63c1785283926fb30f39791c21cc48c4150a 100755 --- a/LArCalorimeter/LArMonitoring/src/LArFEBMonAlg.h +++ b/LArCalorimeter/LArMonitoring/src/LArFEBMonAlg.h @@ -12,6 +12,8 @@ #include "StoreGate/ReadCondHandleKey.h" #include "LArRecConditions/LArBadChannelCont.h" #include "LArRawConditions/LArDSPThresholdsComplete.h" +#include "LArRawEvent/LArFebHeaderContainer.h" +#include "LArRawEvent/LArFebErrorSummary.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "TrigDecisionTool/TrigDecisionTool.h" @@ -22,7 +24,6 @@ #include<mutex> -class LArFebErrorSummary; class TTree; class LArFEBMonAlg : public AthMonitorAlgorithm { @@ -43,6 +44,8 @@ private: {this, "Run1DSPThresholdsKey", "", "SG key for DSP thresholds, run1"}; SG::ReadCondHandleKey<AthenaAttributeList> m_run2DSPThresholdsKey {this, "Run2DSPThresholdsKey", "", "SG key for DSP thresholds, run2"}; + SG::ReadHandleKey<LArFebHeaderContainer> m_hdrContKey{this, "LArFebHeaderKey", "LArFebHeader"}; + SG::ReadHandleKey<LArFebErrorSummary> m_lArFebErrorSummaryKey{this, "LArFebErrorSummaryKey", "LArFebErrorSummary"}; Gaudi::Property<bool> m_ignoreMissingHeaderEMB{this, "IgnoreMissingHeaderEMB", false}; Gaudi::Property<bool> m_ignoreMissingHeaderPS{this, "IgnoreMissingHeaderPS", false}; Gaudi::Property<int> m_nFEBnominal{this,"NominalFEBNumber",1524}; diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/scripts/plotCorr.C b/MuonSpectrometer/MuonAlignment/MuonAlignExample/scripts/plotCorr.C index 48eafc8338b51811a26c55898ac1e2978c65f8fa..0d210ff4fa0f287c0182a4244a28bc31c2f215fa 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/scripts/plotCorr.C +++ b/MuonSpectrometer/MuonAlignment/MuonAlignExample/scripts/plotCorr.C @@ -151,12 +151,13 @@ int main() for (int ibec=0;ibec<NBEC;ibec++) { yVVar[ivar][ibec]=new TH2F**[NPHI]; for (int iphi=0;iphi<NPHI;iphi++) { - std::stringstream phiss; phiss<<iphi+1; - std::string histname=histnames[ivar]+becStr[ibec]+phiss.str(); - std::string histtitle=histtitles[ivar]+"_" - yVVAr[ivar][ibec][iphi]=new TH2F(histname.c_str(),histtitles.c_str(), - histnbins[ivar],histlimits[ivar][0],histlimits[ivar][1]); - + std::stringstream phiss; phiss<<iphi+1; + std::string histname=histnames[ivar]+becStr[ibec]+phiss.str(); + std::string histtitle=histtitles[ivar]+"_" + yVVAr[ivar][ibec][iphi]=new TH2F(histname.c_str(),histtitles.c_str(),histnbins[ivar],histlimits[ivar][0],histlimits[ivar][1]); + } + } + } TH2F* yVMatlA=new TH2F("yVMatlA","yVMatlA",30,140.,260.,100,-50.,50.); TH2F* yVCaloEnergyA =new TH2F("yVCaloEnergyA", "yVCaloEnergyA", diff --git a/MuonSpectrometer/MuonCablings/MuonCablingServers/python/MuonCablingServersConfig.py b/MuonSpectrometer/MuonCablings/MuonCablingServers/python/MuonCablingServersConfig.py index f6a74aaf6cd2fb188493ea037cdf9b94ee11b100..bf3cb2a5ca55e020e2d8ee53cb2d3ea115bba44b 100755 --- a/MuonSpectrometer/MuonCablings/MuonCablingServers/python/MuonCablingServersConfig.py +++ b/MuonSpectrometer/MuonCablings/MuonCablingServers/python/MuonCablingServersConfig.py @@ -39,13 +39,13 @@ class TgcCablingServerConfig (TGCcablingServerSvc): # make default Atlas # *TODO* How do we handle the case of old CSC data? Is new DetDescrVersion CSC too? EJWM self.Atlas = True - if ( globalflags.DetDescrVersion().startswith('DC1') or \ - globalflags.DetDescrVersion().startswith('DC2') or \ + if ( globalflags.DetDescrVersion().startswith('DC1') or + globalflags.DetDescrVersion().startswith('DC2') or globalflags.DetDescrVersion().startswith('DC3')) : self.Atlas = False print ("DC") - if (muonByteStreamFlags.TgcDataType()=='m3' or \ + if (muonByteStreamFlags.TgcDataType()=='m3' or muonByteStreamFlags.TgcDataType()=='oldSimulation') : self.Atlas = False if (muonByteStreamFlags.TgcDataType()=='m3'): @@ -65,14 +65,14 @@ class TgcCablingServerConfig (TGCcablingServerSvc): self.forcedUse = True # if we run from RDO (overlay or other jobs) we must use the call-back, - # even if we have hits to digitize + # even if we have hits to digitize if DetFlags.haveRDO.TGC_on() and not DetFlags.digitize.TGC_on(): self.forcedUse = False - + #use the call-back in the overlay job that has no bytestream data as input if globalflags.isOverlay(): self.forcedUse = False - + # superseed the previos configuration if we run from Atlas data if globalflags.DataSource.is_data(): self.forcedUse = True diff --git a/MuonSpectrometer/MuonCablings/MuonRPC_Cabling/src/MuonRPC_CablingSvc.cxx b/MuonSpectrometer/MuonCablings/MuonRPC_Cabling/src/MuonRPC_CablingSvc.cxx index 21ddaadf5d76b6fe5fdda192b45fca7797ff253e..d7b1705d5a5fa61bbf0f637f955f27bd92e3908c 100644 --- a/MuonSpectrometer/MuonCablings/MuonRPC_Cabling/src/MuonRPC_CablingSvc.cxx +++ b/MuonSpectrometer/MuonCablings/MuonRPC_Cabling/src/MuonRPC_CablingSvc.cxx @@ -61,7 +61,6 @@ StatusCode MuonRPC_CablingSvc::initialize() StoreGateSvc * detStore=nullptr; ATH_CHECK(service("DetectorStore",detStore)); ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_MSG_DEBUG("Found the MuonIdHelperTool"); RDOindex::setRpcIdHelper(&m_idHelperSvc->rpcIdHelper()); bool tryRecoveringByReadingFromFile = false; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt index 51b5c06b8c6b74fb0739aaf929c164274f003dbd..c6ecbab52ec16eb4adb9ddf70e2c4820880905b9 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt +++ b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt @@ -35,26 +35,26 @@ atlas_depends_on_subdirs( PUBLIC TileCalorimeter/TileEvent TileCalorimeter/TileIdentifier Tracking/TrkEvent/TrkEventPrimitives - Trigger/TrigT1/TrigT1Result ) + Trigger/TrigT1/TrigT1Result + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) find_package( Eigen ) -find_package( HepMC ) # Component(s) in the package: atlas_add_library( MuonCalibAlgsLib src/*.cxx PUBLIC_HEADERS MuonCalibAlgs - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES AthenaBaseComps GaudiKernel MuonCalibEventBase StoreGateLib SGtests MuonIdHelpersLib CscClusterizationLib - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} GeoPrimitives EventInfo xAODEventInfo GeneratorObjects LArRecEvent MuonCalibEvent MuonCalibITools MuonCalibIdentifier MuonCalibNtuple MuonReadoutGeometry MuonDigitContainer MuonRDO MuonPrepRawData MuonTrigCoinData MuonSimData TileEvent TileIdentifier TrkEventPrimitives TrigT1Result ) + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} GeoPrimitives EventInfo xAODEventInfo GeneratorObjects LArRecEvent MuonCalibEvent MuonCalibITools MuonCalibIdentifier MuonCalibNtuple MuonReadoutGeometry MuonDigitContainer MuonRDO MuonPrepRawData MuonTrigCoinData MuonSimData TileEvent TileIdentifier TrkEventPrimitives TrigT1Result ) atlas_add_component( MuonCalibAlgs src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel MuonCalibEventBase StoreGateLib SGtests GeoPrimitives EventInfo xAODEventInfo GeneratorObjects LArRecEvent MuonCalibEvent MuonCalibITools MuonCalibIdentifier MuonCalibNtuple MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO CscClusterizationLib MuonPrepRawData MuonTrigCoinData MuonSimData TileEvent TileIdentifier TrkEventPrimitives TrigT1Result MuonCalibAlgsLib ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel MuonCalibEventBase StoreGateLib SGtests GeoPrimitives EventInfo xAODEventInfo GeneratorObjects LArRecEvent MuonCalibEvent MuonCalibITools MuonCalibIdentifier MuonCalibNtuple MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO CscClusterizationLib MuonPrepRawData MuonTrigCoinData MuonSimData TileEvent TileIdentifier TrkEventPrimitives TrigT1Result MuonCalibAlgsLib ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx index 0db2ae6bd54f3fb5b7991def2ed845042eb66341..e47b2ff9b65e3b970be671bb075c72138681d0f9 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx @@ -23,7 +23,7 @@ #include "MuonSimData/MuonSimDataCollection.h" #include "MuonSimData/CscSimDataCollection.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "CLHEP/Vector/LorentzVector.h" #include "GeoPrimitives/GeoPrimitives.h" diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt index 746243e438cd863dcab598b9e61aa872664b2e0b..0ff9c728305d059fb65e6bfa43aa2dd88968da5b 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt @@ -11,7 +11,8 @@ atlas_depends_on_subdirs( PUBLIC DataQuality/GoodRunsLists DetectorDescription/GeoPrimitives GaudiKernel - MagneticField/MagFieldInterfaces + MagneticField/MagFieldElements + MagneticField/MagFieldConditions MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase @@ -41,22 +42,22 @@ atlas_add_library( CalibNtupleAnalysisAlgLib INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MagFieldInterfaces MdtCalibData GoodRunsListsLib MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MagFieldElements MagFieldConditions MdtCalibData GoodRunsListsLib MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} EventInfo MdtCalibFitters MdtCalibRt MuonCalibEventBase MuonCalibITools MuonCalibIdentifier CalibNtupleReader MuonReadoutGeometry ) atlas_add_component( CalibNtupleAnalysisAlg src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GoodRunsListsLib GeoPrimitives GaudiKernel MagFieldInterfaces MdtCalibData MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests EventInfo MdtCalibFitters MdtCalibRt MuonCalibEventBase MuonCalibITools MuonCalibIdentifier CalibNtupleReader MuonReadoutGeometry CalibNtupleAnalysisAlgLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GoodRunsListsLib GeoPrimitives GaudiKernel MagFieldElements MagFieldConditions MdtCalibData MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests EventInfo MdtCalibFitters MdtCalibRt MuonCalibEventBase MuonCalibITools MuonCalibIdentifier CalibNtupleReader MuonReadoutGeometry CalibNtupleAnalysisAlgLib ) atlas_add_dictionary( CalibNtupleAnalysisAlgDict CalibNtupleAnalysisAlg/GeoDraw.h CalibNtupleAnalysisAlg/selection.xml INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GoodRunsListsLib GeoPrimitives GaudiKernel MagFieldInterfaces MdtCalibData MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests EventInfo MdtCalibFitters MdtCalibRt MuonCalibEventBase MuonCalibITools MuonCalibIdentifier CalibNtupleReader MuonReadoutGeometry CalibNtupleAnalysisAlgLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GoodRunsListsLib GeoPrimitives GaudiKernel MagFieldElements MagFieldConditions MdtCalibData MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests EventInfo MdtCalibFitters MdtCalibRt MuonCalibEventBase MuonCalibITools MuonCalibIdentifier CalibNtupleReader MuonReadoutGeometry CalibNtupleAnalysisAlgLib ) # Install files from the package: -atlas_install_python_modules( python/*.py OST_BUILD_CMD ${ATLAS_FLAKE8} ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_add_test( flake8_share diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/UpdateBField.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/UpdateBField.h index 25174fb03a4b030d3370ec989724bb536a0d1c84..83bd001e61c9f3bcca3fe99b5e8783b82d5f42bb 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/UpdateBField.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/UpdateBField.h @@ -1,38 +1,27 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonCalib_UpdateBField_h #define MuonCalib_UpdateBField_h -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -//MuonCalibStandAloneBase #include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" #include "AthenaBaseComps/AthAlgTool.h" - -//BFieldAth -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" namespace MuonCalib { -class UpdateBField: public AthAlgTool, virtual public CalibSegmentPreparationTool { + class UpdateBField: public AthAlgTool, virtual public CalibSegmentPreparationTool { public: //===========================constructor - destructor=========================== UpdateBField(const std::string &t, const std::string &n, const IInterface *p); - inline ~UpdateBField() {} + ~UpdateBField()=default; //===========================public member functions============================ - //initialize and finalize - StatusCode initialize(void); - inline StatusCode finalize(void) { - return StatusCode :: SUCCESS; - } - //update b-field + StatusCode initialize(); void prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments); private: -//==========================private data======================================== - //handle of b-field service - job option - ServiceHandle<MagField::IMagFieldSvc> m_fieldServiceHandle; + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj"}; }; //class } //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleAnalysisConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleAnalysisConfig.py index f84114602731e68dd69b3c9afb8e6f035ea3323e..dc3c551565c35911b70360ec8c98083a29a93adf 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleAnalysisConfig.py +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleAnalysisConfig.py @@ -2,20 +2,28 @@ from __future__ import print_function -from CalibNtupleAnalysisAlg.CalibNtupleAnalysisAlgConf import * -from MuonCalibStandAloneBase.MuonCalibStandAloneBaseConf import * -from MdtCalibIOSvc.MdtCalibIOSvcConf import * -from MuonCalibStandAloneTools.MuonCalibStandAloneToolsConf import * -from MuonCalibStandAloneTools.MuonCalibStandAloneToolsConfig import * +from CalibNtupleAnalysisAlg.CalibNtupleAnalysisAlgConf import (MuonCalib__ApplyRawTimes, + MuonCalib__CalibNtupleAnalysisAlg2, + MuonCalib__CalibNtupleLoader, + MuonCalib__UpdateBField, + MuonCalib__GoodRunListFilter, + MuonCalib__InitialDqFilter, + MuonCalib__BarrelSecondCoordinatePreparationTool, + MuonCalib__SegmentRawdataSelector, + MuonCalib__SegmentRefitter, + MuonCalib__SegmentRecalibration, + MuonCalib__SegmentRegionSelector) + +from MuonCalibStandAloneBase.MuonCalibStandAloneBaseConf import MuonCalib__CalibrationTeeIOTool, RegionSelectionSvc +from MdtCalibIOSvc.MdtCalibIOSvcConf import MdtCalibOutputDbSvc, MdtCalibInputSvc, MuonCalib__CalibrationFileIOTool from MuonCalibDbOperations.MuonCalibDbOperationsConf import MuonCalib__CalibrationDbIOTool from AthenaCommon.AppMgr import ServiceMgr, ToolSvc from AthenaCommon.AlgSequence import AlgSequence -from CalibNtupleAnalysisAlg.CalibNtupleMetaData import * +from CalibNtupleAnalysisAlg.CalibNtupleMetaData import CalibNtupleMetaData +import MuonCalibStandAloneTools.MuonCalibStandAloneToolsConfig as calibtools import sys -#ToolSvc = Service( "ToolSvc" ) - class CalibNtupleAnalysisConfig: #--------------------------------------user settings---------------------------- @@ -31,9 +39,9 @@ class CalibNtupleAnalysisConfig: # event display Display # rpc timing RpcTiming # control histograms ControlHistograms - + CalibrationAlgorithm = "RunScan" - + #file list FileList="fl.txt" @@ -49,7 +57,7 @@ class CalibNtupleAnalysisConfig: #select segment author - 3=MuonBoy 4=Moore - Unused if SegmentsFromRawdata=True SegmentAuthor=4 - + #first and last event to analyse FirstEvent=0 LastEvent=-1 @@ -71,7 +79,7 @@ class CalibNtupleAnalysisConfig: MaxSegmentHits = -1 #perform a segment refit - not for algorithms likr MTT0, Integration, RunScan.. - SegmentRefit=False; + SegmentRefit=False #segment refit parameters RefineT0=False @@ -80,7 +88,7 @@ class CalibNtupleAnalysisConfig: RefitTimeOut=2 RefitMinSegmentHits=4 RefitMaxSegmentHits=-1 - + #calibrate with b-field BFieldCorrection=False @@ -103,25 +111,25 @@ class CalibNtupleAnalysisConfig: #output to database - MP/RM/MI/NONE CalibDB=None - + #initial data quality list - suppress Tubes InitialDQList = None - + #if set to true no segment recalibraiton will be done, independent on the tool SuppressRecalibration=False - + #use good run list to filter events GoodRunList=None - + #apply time slewing corrections ApplyTimeSlewingCorrections=False - + #apply multilayer rt-scaling ApplyRtScaling=True sToolSvc= ToolSvc sServiceMgr = ServiceMgr - + SegmentRecalibration={} SegmentRefitter={} @@ -151,6 +159,7 @@ class CalibNtupleAnalysisConfig: self._initial_DQ_list() #apply RPC Timing Correction if self.RPCTimingCorr: + from CalibNtupleAnalysisAlg.CalibNtupleAnalysisAlgConf import MuonCalib__RpcTimingCorr self.RpcTiming=MuonCalib__RpcTimingCorr() self.sToolSvc += self.RpcTiming self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append(self.RpcTiming) @@ -172,13 +181,13 @@ class CalibNtupleAnalysisConfig: self._config_calibIO() #create tool self._create_calib_tool() - + #-----------------------protected functions------------------------------------ def _create_CalibNtupleAnalysisAlg(self): topSequence = AlgSequence() self.CalibNtupleAnalysisAlg = MuonCalib__CalibNtupleAnalysisAlg2() self.CalibNtupleAnalysisAlg.NumberOfSegments = self.NumberOfSegments - if self.CalibrationAlgorithm in LimitSegmentsFor: + if self.CalibrationAlgorithm in calibtools.LimitSegmentsFor: self.CalibNtupleAnalysisAlg.NumberOfSegments = self.AutoLimitSegments topSequence += self.CalibNtupleAnalysisAlg @@ -195,7 +204,7 @@ class CalibNtupleAnalysisConfig: self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.__good_run_list_filter ) # self.__good_run_list_tool.EventSelectorMode = True self.__good_run_list_tool.PassThrough = False - + def _initial_DQ_list(self): if self.InitialDQList: if self.InitialDQList.upper()=="NONE": @@ -204,7 +213,7 @@ class CalibNtupleAnalysisConfig: self.InitialDqFilter.InitialDqFile = self.InitialDQList self.sToolSvc += self.InitialDqFilter self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.InitialDqFilter) - + def _region_selection(self): if self.SegmentsFromRawdata: self.RegionSelection = MuonCalib__SegmentRawdataSelector() @@ -226,10 +235,10 @@ class CalibNtupleAnalysisConfig: self.BarrelSecondCoordinatePreparationTool = MuonCalib__BarrelSecondCoordinatePreparationTool() self.sToolSvc += self.BarrelSecondCoordinatePreparationTool self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.BarrelSecondCoordinatePreparationTool) - + def _configure_segment_recalibration(self, ToolName=""): #tools that do not need segment recalibration - if self.CalibrationAlgorithm in NoRecalibration: + if self.CalibrationAlgorithm in calibtools.NoRecalibration: return if ToolName: self.SegmentRecalibration[ToolName] = MuonCalib__SegmentRecalibration(ToolName) @@ -243,39 +252,39 @@ class CalibNtupleAnalysisConfig: else: self.SegmentRecalibration[ToolName].TimeSlewingSwitch='UNAPPLY' #tools that revert all calibrations - if self.CalibrationAlgorithm in RevertT0: + if self.CalibrationAlgorithm in calibtools.RevertT0: self.SegmentRecalibration[ToolName].T0Switch = "UNAPPLY" self.SegmentRecalibration[ToolName].BSwitch = "LEAVE" self.SegmentRecalibration[ToolName].RecalcR = False - if self.CalibrationAlgorithm in RecalibT0 : + if self.CalibrationAlgorithm in calibtools.RecalibT0 : self.SegmentRecalibration[ToolName].T0Switch = "FILE" self.SegmentRecalibration[ToolName].BSwitch = "LEAVE" self.SegmentRecalibration[ToolName].RecalcR = False - if self.CalibrationAlgorithm in RecalibAll: + if self.CalibrationAlgorithm in calibtools.RecalibAll: self.SegmentRecalibration[ToolName].T0Switch = "FILE" self.SegmentRecalibration[ToolName].BSwitch = "LEAVE" self.SegmentRecalibration[ToolName].RecalcR = True #id b-field should be corrected, set BSwitch either to "UNAPPLY" or to "FILE" - if self.CalibrationAlgorithm in RevertRtScaling: + if self.CalibrationAlgorithm in calibtools.RevertRtScaling: self.SegmentRecalibration[ToolName].RtMultilayerScaling = "UNAPPLY" - if self.CalibrationAlgorithm in ApplRtScaling and self.ApplyRtScaling: + if self.CalibrationAlgorithm in calibtools.ApplRtScaling and self.ApplyRtScaling: self.SegmentRecalibration[ToolName].RtMultilayerScaling = "FILE" if self.BFieldCorrection: if self.SegmentRecalibration[ToolName].RecalcR: self.SegmentRecalibration[ToolName].BSwitch = "FILE" # else: # self.SegmentRecalibration[ToolName].BSwitch = "UNAPPLY" - + def _config_UpdateBField(self): - if self.UpdateBField in NoSegmentRefit: + if self.UpdateBField in calibtools.NoSegmentRefit: self.UpdateBField = None return self.UpdateBField = MuonCalib__UpdateBField() self.sToolSvc += self.UpdateBField self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.UpdateBField ) - + def _config_segment_refitter(self, ToolName=""): - if self.CalibrationAlgorithm in NoSegmentRefit: + if self.CalibrationAlgorithm in calibtools.NoSegmentRefit: return if ToolName: self.SegmentRefitter[ToolName] = MuonCalib__SegmentRefitter(ToolName) @@ -290,7 +299,7 @@ class CalibNtupleAnalysisConfig: self.SegmentRefitter[ToolName].TimeOut = self.RefitTimeOut self.SegmentRefitter[ToolName].MinSegmentHits = self.RefitMinSegmentHits self.SegmentRefitter[ToolName].MaxSegmentHits = self.RefitMaxSegmentHits - + def _config_calibIO(self): if self.CalibDir: self.CalibrationFileIOTool = MuonCalib__CalibrationFileIOTool() @@ -302,7 +311,7 @@ class CalibNtupleAnalysisConfig: if not self.__set_db(): print ("Unknown database location " + str(self.CalibOutputDB)) sys.exit(1) - + self.MdtCalibOutputDbSvc = MdtCalibOutputDbSvc() self.MdtCalibOutputDbSvc.PostprocessCalibration = True self.sServiceMgr += self.MdtCalibOutputDbSvc @@ -332,16 +341,16 @@ class CalibNtupleAnalysisConfig: self.MdtCalibInputSvc.CalibrationInputTool = self.CalibrationFileIOTool def _create_calib_tool(self): - self.CalibrationTool=CreateCalibTool(self.CalibrationAlgorithm) + self.CalibrationTool=calibtools.CreateCalibTool(self.CalibrationAlgorithm) if self.CalibrationTool: self.sToolSvc += self.CalibrationTool self.CalibNtupleAnalysisAlg.CalibrationTool = self.CalibrationTool - + #------------------------------------------------------------ def __set_db(self): self.DbIoTool.SiteName = self.CalibDB - self.DbIoTool.UseValidaedT0 = self.CalibrationAlgorithm in ValidatedT0 - self.DbIoTool.UseValidaedRt = self.CalibrationAlgorithm in ValidatedRt + self.DbIoTool.UseValidaedT0 = self.CalibrationAlgorithm in calibtools.ValidatedT0 + self.DbIoTool.UseValidaedRt = self.CalibrationAlgorithm in calibtools.ValidatedRt if (self.CalibDB == "MP"): self.DbIoTool.ConnectionString = "oracle://oracle01.mppmu.mpg.de/ATLMPI.mppmu.mpg.de/ATLAS_MUONCALIB_MPI" self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_MPI" diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleMetaData.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleMetaData.py index 0779e06a37c9195e42558f8b6f8352e535474f02..f90f08ba3c647aa9e31e85fa6b83046fdd7f97ab 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleMetaData.py +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleMetaData.py @@ -2,11 +2,11 @@ from __future__ import print_function -from ROOT import TFile, TTree +from ROOT import TFile import sys class CalibNtupleMetaData: - + def __init__(self, filelist): self.MetaData={} fl=file(filelist) @@ -27,16 +27,16 @@ class CalibNtupleMetaData: if not inf: sys.stderr.write("CalibNtupleMetaData WARNING: cannot open first file in filelist\n") continue - + if not inf: sys.stderr.write("CalibNtupleMetaData WARNING: find an input file in filelist\n") return - + tree=inf.Get("meta_data") if not tree: sys.stderr.write("CalibNtupleMetaData WARNING: input file does not contain meta_data\n") return - + i=0 while tree.GetEntry(i): i+=1 diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/UpdateBField.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/UpdateBField.cxx index 04f299be061f4202e38743887193a597128d7bcf..2819ec2108b069c4ee4a149729cf50550eda24df 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/UpdateBField.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/UpdateBField.cxx @@ -1,35 +1,42 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//this #include "CalibNtupleAnalysisAlg/UpdateBField.h" - +#include <TString.h> // for Form namespace MuonCalib { -UpdateBField::UpdateBField(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p), -m_fieldServiceHandle("AtlasFieldSvc",n) { - declareProperty("MagFieldSvc", m_fieldServiceHandle); +UpdateBField::UpdateBField(const std::string &t, const std::string &n, const IInterface *p) : + AthAlgTool(t, n, p) { declareInterface< CalibSegmentPreparationTool >(this); } -StatusCode UpdateBField::initialize(void) { - ATH_CHECK( m_fieldServiceHandle.retrieve() ); +StatusCode UpdateBField::initialize() { + ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK(m_fieldCondObjInputKey.initialize()); return StatusCode::SUCCESS; } void UpdateBField::prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments) { + /// magnetic field + MagField::AtlasFieldCache fieldCache; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (!fieldCondObj) { + throw std::runtime_error(Form("File: %s, Line: %d\nUpdateBField::prepareSegments() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (m_fieldCondObjInputKey.key()).c_str())); + } + fieldCondObj->getInitializedCache(fieldCache); + for(std::map<NtupleStationId, MuonCalibSegment *>::iterator it = segments.begin(); it!=segments.end(); it++) { for(unsigned int j=0; j<it->second->mdtHitsOnTrack(); j++) { MdtCalibHitBase *hit = it->second->mdtHOT()[j]; -// const MuonFixedId & id(hit->identify()); Amg::Transform3D gToStation= it->second->localToGlobal().inverse(); double XYZ[3], BGXYZ[3]; XYZ[0] = hit->globalPosition().x(); XYZ[1] = hit->globalPosition().y(); XYZ[2] = hit->globalPosition().z(); - m_fieldServiceHandle->getField(XYZ,BGXYZ); + fieldCache.getField(XYZ,BGXYZ); Amg::Vector3D B_global(BGXYZ[0], BGXYZ[1], BGXYZ[2]); Amg::Vector3D B_loc(gToStation.linear()*B_global); hit->setBFieldPara(B_loc.x()); diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/CMakeLists.txt b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/CMakeLists.txt index cd6677c572be97e1fec73304912618dce48d0240..571b13feffd811e8ca692eee682c5ecb6c913f76 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/CMakeLists.txt @@ -10,8 +10,9 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData MuonSpectrometer/MuonIdHelpers + MagneticField/MagFieldElements + MagneticField/MagFieldConditions PRIVATE - MagneticField/MagFieldInterfaces MuonSpectrometer/MuonRDO Control/AthenaBaseComps ) @@ -23,7 +24,7 @@ atlas_add_library( NSWCalibToolsLib src/*.cxx PUBLIC_HEADERS NSWCalibTools PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES GaudiKernel MuonPrepRawData + LINK_LIBRARIES GaudiKernel MuonPrepRawData MagFieldElements MagFieldConditions PRIVATE_LINK_LIBRARIES AthenaBaseComps MuonIdHelpersLib ) @@ -32,7 +33,7 @@ atlas_add_component(NSWCalibTools src/components/*.cxx PUBLIC_HEADERS NSWCalibTools PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES GaudiKernel MuonPrepRawData MuonIdHelpersLib NSWCalibToolsLib + LINK_LIBRARIES GaudiKernel MuonPrepRawData MuonIdHelpersLib NSWCalibToolsLib MagFieldElements MagFieldConditions PRIVATE_LINK_LIBRARIES AthenaBaseComps ) atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibSmearingTool.cxx b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibSmearingTool.cxx index 7066764ac07edbe68ad075a0b29cf5bb46f7b60b..cd974eb8ba99efa0a02e6f1a4e111192ce38c3ef 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibSmearingTool.cxx +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibSmearingTool.cxx @@ -29,12 +29,10 @@ Muon::NSWCalibSmearingTool::NSWCalibSmearingTool(const std::string& t, StatusCode Muon::NSWCalibSmearingTool::initialize() { ATH_MSG_DEBUG("In initialize()"); - - // initialize the MuonIdHelperTool and check the configuration ATH_CHECK(m_idHelperSvc.retrieve()); if ( !(m_idHelperSvc->hasMM() && m_idHelperSvc->hasSTgc() ) ) { - ATH_MSG_ERROR("MuonIdHelperTool not properly configured, missing MM or STGC"); + ATH_MSG_ERROR("MM or STGC not part of initialized detector layout"); return StatusCode::FAILURE; } diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx index 3a654aebebc7ea89504bfd165e97bcf1e88b50bd..9aea1734791b1989332b282544400556510ad0a9 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx @@ -15,12 +15,10 @@ namespace { Muon::NSWCalibTool::NSWCalibTool(const std::string& t, const std::string& n, const IInterface* p ) : - AthAlgTool(t,n,p), - m_magFieldSvc("AtlasFieldSvc",n) + AthAlgTool(t,n,p) { declareInterface<INSWCalibTool>(this); - declareProperty("MagFieldSvc", m_magFieldSvc, "Magnetic Field Service"); declareProperty("DriftVelocity", m_vDrift = 0.047, "Drift Velocity"); declareProperty("TimeResolution", m_timeRes = 25., "Time Resolution"); declareProperty("longDiff",m_longDiff=0.019); //mm/mm @@ -34,16 +32,14 @@ StatusCode Muon::NSWCalibTool::initialize() { ATH_MSG_DEBUG("In initialize()"); - ATH_CHECK(m_magFieldSvc.retrieve()); ATH_CHECK(m_idHelperSvc.retrieve()); - if ( !(m_idHelperSvc->hasMM() && m_idHelperSvc->hasSTgc() ) ) { - ATH_MSG_ERROR("MuonIdHelperTool not properly configured, missing MM or STGC"); + ATH_MSG_ERROR("MM or STGC not part of initialized detector layout"); return StatusCode::FAILURE; } - m_lorentzAngleFunction = new TF1("lorentzAngleFunction","[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x",0,2); - m_lorentzAngleFunction->SetParameters(0,58.87, -2.983, -10.62, 2.818); - + ATH_CHECK(m_fieldCondObjInputKey.initialize()); + m_lorentzAngleFunction = new TF1("lorentzAngleFunction","[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x",0,2); + m_lorentzAngleFunction->SetParameters(0,58.87, -2.983, -10.62, 2.818); return StatusCode::SUCCESS; } @@ -58,8 +54,17 @@ StatusCode Muon::NSWCalibTool::calibrate( const Muon::MM_RawData* mmRawData, con calibStrip.identifier = mmRawData->identify(); /// magnetic field + MagField::AtlasFieldCache fieldCache; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (!fieldCondObj) { + ATH_MSG_ERROR("doDigitization: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key()); + return StatusCode::FAILURE; + } + fieldCondObj->getInitializedCache(fieldCache); + Amg::Vector3D magneticField; - m_magFieldSvc->getField(&globalPos,&magneticField); + fieldCache.getField(globalPos.data(), magneticField.data()); /// get the component parallel to to the eta strips (same used in digitization) double phi = globalPos.phi(); diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.h b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.h index 66ee31142bd7e7d21de30fa0f36b25377c9b2ba9..c12c56d17b93e37cac7f008677defacf704483a5 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.h +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.h @@ -6,17 +6,14 @@ #include "NSWCalibTools/INSWCalibTool.h" - -#include "GaudiKernel/ITHistSvc.h" -#include "GaudiKernel/ServiceHandle.h" - #include "AthenaBaseComps/AthAlgTool.h" - -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonPrepRawData/MMPrepData.h" #include "MuonRDO/MM_RawData.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "TRandom3.h" #include "TTree.h" @@ -41,9 +38,7 @@ namespace Muon { private: ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; - + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj"}; TF1* m_lorentzAngleFunction; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx index 5ff518fb39e72a34955933438a83578b67f63461..75c4583ee7cbf06f5ac76b4887d5e04870ecaf77 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx @@ -1,13 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonCacheCreator.h" -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" #include "AthViews/View.h" /// Constructor @@ -25,16 +21,12 @@ MuonCacheCreator::MuonCacheCreator(const std::string &name,ISvcLocator *pSvcLoca declareProperty("TgcCacheKey", m_TgcCacheKey); } -MuonCacheCreator::~MuonCacheCreator() { - -} - StatusCode MuonCacheCreator::initialize() { ATH_CHECK( m_MdtCsmCacheKey.initialize(!m_MdtCsmCacheKey.key().empty()) ); ATH_CHECK( m_CscCacheKey.initialize(!m_CscCacheKey.key().empty()) ); ATH_CHECK( m_RpcCacheKey.initialize(!m_RpcCacheKey.key().empty()) ); ATH_CHECK( m_TgcCacheKey.initialize(!m_TgcCacheKey.key().empty()) ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -55,21 +47,26 @@ StatusCode MuonCacheCreator::execute (const EventContext& ctx) const { m_disableWarningCheck = true; //only check once } // Create the MDT cache container - auto maxHashMDTs = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME") != -1 ? m_muonIdHelperTool->mdtIdHelper().detectorElement_hash_max() : m_muonIdHelperTool->mdtIdHelper().module_hash_max(); - ATH_CHECK(createContainer(m_MdtCsmCacheKey, maxHashMDTs, ctx)); + int maxHashMDTs = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME") != -1 ? m_idHelperSvc->mdtIdHelper().detectorElement_hash_max() : m_idHelperSvc->mdtIdHelper().module_hash_max(); + if (!m_MdtCsmCacheKey.key().empty()) { + ATH_CHECK(createContainer(m_MdtCsmCacheKey, maxHashMDTs, ctx)); + ATH_MSG_DEBUG("Created cache container " << m_MdtCsmCacheKey); + } // Create the CSC cache container - ATH_CHECK(createContainer(m_CscCacheKey, m_muonIdHelperTool->cscIdHelper().module_hash_max(), ctx)); + if (!m_CscCacheKey.key().empty()) { + ATH_CHECK(createContainer(m_CscCacheKey, m_idHelperSvc->cscIdHelper().module_hash_max(), ctx)); + ATH_MSG_DEBUG("Created cache container " << m_CscCacheKey); + } // Create the RPC cache container // Max should match 600 (hardcoded in RPC_RawDataProviderTool) - ATH_CHECK(createContainer(m_RpcCacheKey, m_muonIdHelperTool->rpcIdHelper().module_hash_max(), ctx)); + if (!m_RpcCacheKey.key().empty()) { + ATH_CHECK(createContainer(m_RpcCacheKey, m_idHelperSvc->rpcIdHelper().module_hash_max(), ctx)); + ATH_MSG_DEBUG("Created cache container " << m_RpcCacheKey); + } // Create the TGC cache container - ATH_CHECK(createContainer(m_TgcCacheKey, m_muonIdHelperTool->tgcIdHelper().module_hash_max(), ctx)); - - ATH_MSG_DEBUG("Created cache container " << m_MdtCsmCacheKey); - ATH_MSG_DEBUG("Created cache container " << m_CscCacheKey); - ATH_MSG_DEBUG("Created cache container " << m_RpcCacheKey); - ATH_MSG_DEBUG("Created cache container " << m_TgcCacheKey); - - + if (!m_TgcCacheKey.key().empty()) { + ATH_CHECK(createContainer(m_TgcCacheKey, m_idHelperSvc->tgcIdHelper().module_hash_max(), ctx)); + ATH_MSG_DEBUG("Created cache container " << m_TgcCacheKey); + } return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.h b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.h index 99be4d3e2131631f6bab62e00858d4c7ea36890f..6af3df5db9a73f6889aca0c6ab6d9c3a2a6ed67c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.h @@ -1,17 +1,16 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #pragma once #include "AthenaBaseComps/AthReentrantAlgorithm.h" - +#include "GaudiKernel/ServiceHandle.h" #include "MuonRDO/MdtCsm_Cache.h" #include "MuonRDO/CscRawDataCollection_Cache.h" #include "MuonRDO/RpcPad_Cache.h" #include "MuonRDO/TgcRdo_Cache.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <atomic> @@ -21,7 +20,7 @@ class MuonCacheCreator : public AthReentrantAlgorithm { /// Constructor MuonCacheCreator(const std::string &name,ISvcLocator *pSvcLocator); /// Destructor - virtual ~MuonCacheCreator() ; + virtual ~MuonCacheCreator()=default; /// Initialize the algorithm virtual StatusCode initialize () override; @@ -39,9 +38,7 @@ protected: SG::WriteHandleKey<CscRawDataCollection_Cache> m_CscCacheKey; SG::WriteHandleKey<RpcPad_Cache> m_RpcCacheKey; SG::WriteHandleKey<TgcRdo_Cache> m_TgcCacheKey; - /// ID helpers - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; BooleanProperty m_disableWarning{this,"DisableViewWarning",false}; mutable std::atomic_bool m_disableWarningCheck; bool isInsideView(const EventContext&) const; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_Hid2RESrcID.cxx index b5b4e5d53e6c93ec14cb16a967a765c54d8ffb73..6882c2ffbb0e4103fbee578428c740e3245ccfae 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_Hid2RESrcID.cxx @@ -1,9 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CSC_Hid2RESrcID.h" #include "MuonRDO/CscRawDataCollection.h" +#include "MuonIdHelpers/CscIdHelper.h" #include "eformat/SourceIdentifier.h" @@ -39,8 +40,8 @@ uint32_t CSC_Hid2RESrcID::getRodID(uint16_t subDetectorId, uint16_t rodId) const uint32_t CSC_Hid2RESrcID::getRodID(const Identifier& offlineId) const { - int eta = m_muonIdHelperTool->cscIdHelper().stationEta(offlineId); - int phi = m_muonIdHelperTool->cscIdHelper().stationPhi(offlineId); + int eta = m_cscIdHelper->stationEta(offlineId); + int phi = m_cscIdHelper->stationPhi(offlineId); uint16_t subDetectorId = (eta == -1) ? eformat::MUON_CSC_ENDCAP_C_SIDE : eformat::MUON_CSC_ENDCAP_A_SIDE ; uint16_t rodId = uint16_t (phi-1); //if(offlineId >= 0x10 && offlineId <= 0x1F) rodId = 0x10 + diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_Hid2RESrcID.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_Hid2RESrcID.h index be60dbbe755ebd7ec03dbc8fc54e51df47c0914f..203d5c6d14159c4f6845d3163f7712eb13df0cdd 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_Hid2RESrcID.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_Hid2RESrcID.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCSC_CNVTOOLS_CSC_HID2RESRCID @@ -7,9 +7,9 @@ #include <inttypes.h> #include "CSCcabling/CSCcablingSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" class Identifier; +class CscIdHelper; class CscRawDataCollection; /* this class provides conversion between CSC RDO Id and RESrcID. @@ -27,11 +27,11 @@ public: /** default constrcutor you must then use the set method to set the cabling service and the id helper */ - CSC_Hid2RESrcID () { m_cabling = 0; m_muonIdHelperTool = 0; m_isCosmic=false; m_isOldCosmic = false; m_robIDs.clear(); } + CSC_Hid2RESrcID () { m_cabling = nullptr; m_cscIdHelper = nullptr; m_isCosmic=false; m_isOldCosmic = false; m_robIDs.clear(); } /** the full constructor */ - CSC_Hid2RESrcID (CSCcablingSvc * p_cabling, const Muon::MuonIdHelperTool* muonIdHelperTool) { this->set(p_cabling, muonIdHelperTool); } + CSC_Hid2RESrcID (CSCcablingSvc * p_cabling, const CscIdHelper* cscId) { this->set(p_cabling, cscId); } /** destructor */ @@ -40,9 +40,9 @@ public: /** initialize the identifier helper */ - void set(CSCcablingSvc * p_cabling, const Muon::MuonIdHelperTool* muonIdHelperTool) { + void set(CSCcablingSvc * p_cabling, const CscIdHelper* cscId) { m_cabling = p_cabling; - m_muonIdHelperTool = muonIdHelperTool; + m_cscIdHelper = cscId; m_isCosmic=false; m_isOldCosmic = false; this->fillAllRobIds(); @@ -85,11 +85,10 @@ private: void fillAllRobIds(); private: - - const Muon::MuonIdHelperTool * m_muonIdHelperTool; bool m_isCosmic; bool m_isOldCosmic; CSCcablingSvc * m_cabling; + const CscIdHelper* m_cscIdHelper; std::vector<uint32_t> m_robIDs; }; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolCore.cxx index 8b01b5d4d80b5552207f5ec7d845c3dae3fec090..90266c0f3fb81da0775a71e12593476717d21194 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolCore.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -18,7 +18,6 @@ #include "GaudiKernel/IJobOptionsSvc.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" @@ -40,11 +39,6 @@ Muon::CSC_RawDataProviderToolCore::CSC_RawDataProviderToolCore(const std::string } -//================ Destructor ================================================= - -Muon::CSC_RawDataProviderToolCore::~CSC_RawDataProviderToolCore() -{} - //================ Initialisation ================================================= StatusCode Muon::CSC_RawDataProviderToolCore::initialize() @@ -55,15 +49,12 @@ StatusCode Muon::CSC_RawDataProviderToolCore::initialize() ATH_CHECK( m_robDataProvider.retrieve() ); ATH_MSG_INFO ( "Retrieved service " << m_robDataProvider ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - m_hid2re.set( &(*m_cabling), m_muonIdHelperTool.get() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); + m_hid2re.set( &(*m_cabling), &m_idHelperSvc->cscIdHelper() ); // Retrieve decoder - if (m_decoder.retrieve().isFailure()) { - ATH_MSG_FATAL ( "Failed to retrieve tool " << m_decoder ); - return StatusCode::FAILURE; - } else - ATH_MSG_INFO ( "Retrieved tool " << m_decoder ); + ATH_CHECK(m_decoder.retrieve()); + ATH_MSG_INFO ( "Retrieved tool " << m_decoder ); ATH_MSG_INFO ( "The Muon Geometry version is " << m_muonMgr->geometryVersion() ); @@ -74,13 +65,6 @@ StatusCode Muon::CSC_RawDataProviderToolCore::initialize() return StatusCode::SUCCESS; } -//================ Finalisation ================================================= - -StatusCode Muon::CSC_RawDataProviderToolCore::finalize() -{ - return StatusCode::SUCCESS; -} - //============================================================================================ StatusCode diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolCore.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolCore.h index 5e4e95a7f5534f589dae76d1dea8d21dd4d450fb..db52fd0091a3883876854812596a6b9f5f0a64f8 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolCore.h @@ -1,16 +1,13 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// CSC_RawDataProviderToolCore.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONCSC_CNVTOOLS_CSC_RAWDATAPROVIDERTOOLCORE_H #define MUONCSC_CNVTOOLS_CSC_RAWDATAPROVIDERTOOLCORE_H #include "AthenaBaseComps/AthAlgTool.h" #include "ByteStreamData/RawEvent.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "MuonCSC_CnvTools/ICSC_ROD_Decoder.h" #include "MuonRDO/CscRawDataContainer.h" @@ -18,9 +15,8 @@ #include "CSC_Hid2RESrcID.h" #include "StoreGate/WriteHandleKey.h" #include "StoreGate/ReadHandleKey.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class IROBDataProviderSvc; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" namespace MuonGM { @@ -36,12 +32,10 @@ public: CSC_RawDataProviderToolCore(const std::string& t, const std::string& n, const IInterface* p); /** default destructor */ - virtual ~CSC_RawDataProviderToolCore(); + virtual ~CSC_RawDataProviderToolCore()=default; /** standard Athena-Algorithm method */ virtual StatusCode initialize() override; - /** standard Athena-Algorithm method */ - virtual StatusCode finalize() override; protected: @@ -56,8 +50,7 @@ protected: const MuonGM::MuonDetectorManager* m_muonMgr; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::WriteHandleKey<CscRawDataContainer> m_containerKey{ this, "RdoLocation", "CSCRDO", "Name of the CSCRDO produced by RawDataProvider"}; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.h index 83319a800d2ba2a5ef76e759c7e812c58eef872c..22b9f55db1178128a25614e1b7a257a29a955837 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -55,9 +55,6 @@ private: /// CSC container cache key SG::UpdateHandleKey<CscRawDataCollection_Cache> m_rdoContainerCacheKey ; - - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscDigitToCscRDOTool.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscDigitToCscRDOTool.cxx index f6e5d12ee996fdaf427f3f85b2ec2e47b7bc663e..e2a81339732e975d0485d5f96e07b718b86f5476 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscDigitToCscRDOTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscDigitToCscRDOTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/ISvcLocator.h" @@ -18,7 +18,7 @@ #include "CscDigitToCscRDOTool.h" -#include <math.h> +#include <cmath> #include <cassert> const uint16_t MAX_AMPL = 4095; // 12-bit ADC @@ -44,7 +44,7 @@ StatusCode CscDigitToCscRDOTool::initialize() ATH_CHECK( m_cscCablingSvc.retrieve() ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_MSG_DEBUG ( " Found the CscIdHelper. " ); /** CSC calibration tool for the Condtiions Data base access */ @@ -97,7 +97,7 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() // initialization but it will be updated per channel later 12/03/2009 WP // m_startTime is not related to rodReadOut at all but doesn't matter it's not used....by resetting later... - rodReadOut.set(m_muonIdHelperTool.get()); + rodReadOut.set(&m_idHelperSvc->cscIdHelper()); rodReadOut.setChamberBitVaue(1); @@ -163,20 +163,20 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() // Where address is made, onlineId should be used...... Identifier offlineChannelId = cscDigit->identify(); IdentifierHash cscOfflineChannelHashId; - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().channel_context(); - if (!m_muonIdHelperTool->cscIdHelper().get_hash(offlineChannelId, cscOfflineChannelHashId, &cscContext)) { + IdContext cscContext = m_idHelperSvc->cscIdHelper().channel_context(); + if (!m_idHelperSvc->cscIdHelper().get_hash(offlineChannelId, cscOfflineChannelHashId, &cscContext)) { ATH_MSG_DEBUG ( "HashId for CscDigit (offline) is " << cscOfflineChannelHashId - << " for " << m_muonIdHelperTool->cscIdHelper().show_to_string(offlineChannelId,&cscContext) ); + << " for " << m_idHelperSvc->cscIdHelper().show_to_string(offlineChannelId,&cscContext) ); } - int currentStrip = m_muonIdHelperTool->cscIdHelper().strip(offlineChannelId); + int currentStrip = m_idHelperSvc->cscIdHelper().strip(offlineChannelId); /** the RDO collection or create it if it does not exits */ - int currentLayer = m_muonIdHelperTool->cscIdHelper().wireLayer(offlineChannelId); - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(offlineChannelId); - int eta = m_muonIdHelperTool->cscIdHelper().stationEta(offlineChannelId); - int phi = m_muonIdHelperTool->cscIdHelper().stationPhi(offlineChannelId); - int stationId = m_muonIdHelperTool->cscIdHelper().stationName(offlineChannelId); + int currentLayer = m_idHelperSvc->cscIdHelper().wireLayer(offlineChannelId); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(offlineChannelId); + int eta = m_idHelperSvc->cscIdHelper().stationEta(offlineChannelId); + int phi = m_idHelperSvc->cscIdHelper().stationPhi(offlineChannelId); + int stationId = m_idHelperSvc->cscIdHelper().stationName(offlineChannelId); uint16_t subDetectorId = (eta==-1) ? 0x6A : 0x69; uint16_t rodId = 0xFFFF; if(m_cscCablingSvc->nROD()==16){ @@ -247,7 +247,7 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() int afterstrip = beforestrip - width + 1; Identifier newOnlineChannelId - = m_muonIdHelperTool->cscIdHelper().channelID(istat,zEta,phisector,chamLayer,wlayer,mphi,afterstrip); + = m_idHelperSvc->cscIdHelper().channelID(istat,zEta,phisector,chamLayer,wlayer,mphi,afterstrip); address = rodReadOut.address(newOnlineChannelId,zEta,phisector); } @@ -261,7 +261,7 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() } /** station identifier to calcuate the SPU ID */ - int stationName = m_muonIdHelperTool->cscIdHelper().stationName(offlineChannelId); + int stationName = m_idHelperSvc->cscIdHelper().stationName(offlineChannelId); /** there 10 SPU - Sparsifier Processing Units, one for each gas layer, except for the non-precision strips where all the layers map to one SPU note that the "-50" is because stationName = 50 (CSS) or 51 (CSL) */ @@ -275,20 +275,20 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() // Let's make online hashId first and then convert it into online identifier.... Identifier onlineChannelId =offlineChannelId; // onlineChannelId is only needed to get address.... if (eta > 0 && measuresPhi == 1) { - int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(offlineChannelId); // Either 1 or 2 (but always 1) + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(offlineChannelId); // Either 1 or 2 (but always 1) int strip = 49 -currentStrip; - onlineChannelId = m_muonIdHelperTool->cscIdHelper().channelID(stationName,eta,phi,chamberLayer,currentLayer,measuresPhi,strip); + onlineChannelId = m_idHelperSvc->cscIdHelper().channelID(stationName,eta,phi,chamberLayer,currentLayer,measuresPhi,strip); } /** The strip online address */ // this registers the first one... address = rodReadOut.address(onlineChannelId,eta,phi); /** Strip hash identifier is from offline convention for CscRawData first strip...*/ - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().channel_context(); - if (!m_muonIdHelperTool->cscIdHelper().get_hash(offlineChannelId, cscRawDataOfflineHashId, &cscContext)) { + IdContext cscContext = m_idHelperSvc->cscIdHelper().channel_context(); + if (!m_idHelperSvc->cscIdHelper().get_hash(offlineChannelId, cscRawDataOfflineHashId, &cscContext)) { ATH_MSG_DEBUG ( "HashId off CscRawData (still offline hashId) is " << cscRawDataOfflineHashId - << " for " << m_muonIdHelperTool->cscIdHelper().show_to_string(offlineChannelId,&cscContext) ); + << " for " << m_idHelperSvc->cscIdHelper().show_to_string(offlineChannelId,&cscContext) ); } /** clear for the next CscRawData */ @@ -297,16 +297,16 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() } /** simulation data conversion to ADC counts */ - ATH_MSG_DEBUG ( "CSC Digit->RDO: Digit offline info " << m_muonIdHelperTool->cscIdHelper().show_to_string(offlineChannelId) + ATH_MSG_DEBUG ( "CSC Digit->RDO: Digit offline info " << m_idHelperSvc->cscIdHelper().show_to_string(offlineChannelId) << " " << cscDigit->charge() ); - int zsec = m_muonIdHelperTool->cscIdHelper().stationEta(offlineChannelId); - int phisec = m_muonIdHelperTool->cscIdHelper().stationPhi(offlineChannelId); - int istation = m_muonIdHelperTool->cscIdHelper().stationName(offlineChannelId) - 49; + int zsec = m_idHelperSvc->cscIdHelper().stationEta(offlineChannelId); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(offlineChannelId); + int istation = m_idHelperSvc->cscIdHelper().stationName(offlineChannelId) - 49; int sector = zsec*(2*phisec-istation+1); - int wlay = m_muonIdHelperTool->cscIdHelper().wireLayer(offlineChannelId); - int measphi = m_muonIdHelperTool->cscIdHelper().measuresPhi(offlineChannelId); - int istrip = m_muonIdHelperTool->cscIdHelper().strip(offlineChannelId); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(offlineChannelId); + int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(offlineChannelId); + int istrip = m_idHelperSvc->cscIdHelper().strip(offlineChannelId); // false will return value in ADC counts - true in number of electrons // double noise = m_cscCalibTool->stripNoise( cscOfflineChannelHashId, true ); @@ -328,17 +328,8 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() if ( charge_to_adcCount > MAX_AMPL ) charge_to_adcCount = MAX_AMPL-1.0; if ( charge_to_adcCount < 0 ) charge_to_adcCount = 0; - // if (m_addNoise) { - // ampl = ampl + theNoise + pedestal; - // } - // if (ampl < 0) ampl = 0.0; + uint16_t adcCount = (uint16_t) rint(charge_to_adcCount); - // if (ampl > (1.0*MAX_AMPL)) { - // ATH_MSG_WARNING ( "value out of range: " << ampl << " " - // << " Setting it to max value = " << MAX_AMPL - // << " Identifier is " << m_muonIdHelperTool->cscIdHelper().show_to_string(offlineChannelId) ); - // adcCount = MAX_AMPL; - // } samples.push_back(adcCount); @@ -363,18 +354,8 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() if ( ampl > MAX_AMPL ) ampl = MAX_AMPL-1.0; - // if (m_addNoise) { - // ampl = charge_to_adcCount*rawAmpl + theNoise + pedestal; - // } - // if (ampl < 0) ampl = 0.0; uint16_t adcCount = (uint16_t) rint(ampl); - // if (ampl > (1.0*MAX_AMPL)) { - // ATH_MSG_WARNING ( "value out of range: " << ampl << " " - // << " Setting it to max value = " << MAX_AMPL - // << " Identifier is " << m_muonIdHelperTool->cscIdHelper().show_to_string(offlineChannelId) ); - // adcCount = MAX_AMPL; - // } - + samples.push_back(adcCount); ATH_MSG_DEBUG ( "amplitude :: index = " << (i+1) @@ -383,40 +364,20 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() << " amplitude (double) = " << ampl << " raw amplitude (double) = " << rawAmpl << " theNoise (double) = " << theNoise ); - - // DEBUG purpose.... - // samplesOrig.push_back(float(adcCount)); - // uint16_t adcNoMix =(uint16_t) rint(charge_to_adcCount*rawAmpl); - // uint16_t adcPlusPed =(uint16_t) rint(charge_to_adcCount*rawAmpl+pedestal); - // samplesNoMix.push_back(float(adcNoMix)); - // samplesPlusPed.push_back(float(adcPlusPed)); + } - // DEBUG -> - // int error0, error1, error2; - // double charge0, time0, charge1, time1, charge2, time2; - - // error0 = m_cscCalibTool->findCharge(float(samplingTime), phase, samplesOrig, charge0, time0); - // error1 = m_cscCalibTool->findCharge(float(samplingTime), phase, samplesNoMix, charge1, time1); - // error2 = m_cscCalibTool->findCharge(float(samplingTime), phase, samplesPlusPed, charge2, time2); - } // isNewEDM ATH_MSG_DEBUG ( "CSC Digit zsec:phisec:station:sector:measphi:wlay:istrip:charge " - // << run << " " << evt << " " << zsec << " " << phisec << " " << istation << " " << sector << " " << measphi << " " << wlay << " " << istrip << " " - // << int (cscDigit->charge()+1) << " " << charge_to_adcCount << " " - // << charge0-pedestal << " " << charge1 << " " << charge2-pedestal - // << pedestal << " " << samples[0] << " " << samples[1] << " " << samples[2] << " " << samples[3] << " " ) ; - // DEBUG <-// - /** increase the width and the currentStrip */ width++; @@ -449,7 +410,7 @@ StatusCode CscDigitToCscRDOTool::fill_CSCdata() int afterstrip = beforestrip - width + 1; Identifier newOnlineChannelId - = m_muonIdHelperTool->cscIdHelper().channelID(istat,zEta,phisector,chamLayer,wlayer,mphi,afterstrip); + = m_idHelperSvc->cscIdHelper().channelID(istat,zEta,phisector,chamLayer,wlayer,mphi,afterstrip); address = rodReadOut.address(newOnlineChannelId,zEta,phisector); } diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscDigitToCscRDOTool.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscDigitToCscRDOTool.h index 62613cc3ac789e0d35167bdf637db0fbab545ede..ea97e26dc1e21f529c24f23cb564917747a83c2f 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscDigitToCscRDOTool.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscDigitToCscRDOTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CSCDIGITTOCSCRDOTOOL_H @@ -8,6 +8,7 @@ #include <map> #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "CLHEP/Random/RandomEngine.h" @@ -16,7 +17,7 @@ #include "MuonRDO/CscRawDataCollection.h" #include "MuonDigitContainer/CscDigitContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "CSCcabling/CSCcablingSvc.h" #include "AthenaKernel/IAthRNGSvc.h" @@ -58,11 +59,9 @@ class CscDigitToCscRDOTool final : public extends<AthAlgTool, IMuonDigitizationT SG::WriteHandleKey<CscRawDataContainer> m_rdoContainerKey{this,"OutputObjectName","CSCRDO","WriteHandleKey for Output CswRawDataContainer"}; SG::ReadHandleKey<CscDigitContainer> m_digitContainerKey{this,"InputObjectName","CSC_DIGITS","ReadHandleKey for Input CscDigitContainer"}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<CSCcablingSvc> m_cscCablingSvc{this, "CSCcablingSvc", "CSCcablingSvc", ""}; ToolHandle<ICscCalibTool> m_cscCalibTool{this, "cscCalibTool", "CscCalibTool", ""}; - ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; //!< Random number service }; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRDO_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRDO_Decoder.cxx index 052c33c2a5813d540a39ec400c0a57cd5c923207..c045fb798bc2f9bb32d0a97fcc83b52b2ce712e7 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRDO_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRDO_Decoder.cxx @@ -14,39 +14,18 @@ Muon::CscRDO_Decoder::CscRDO_Decoder { } -StatusCode Muon::CscRDO_Decoder::initialize() -{ - - ATH_MSG_DEBUG ( "CscRDO_Decoder::initialize"); - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - - // get the cabling service - if ( m_cabling.retrieve().isFailure() ) { - ATH_MSG_ERROR ( " Cannot get CablingSvc " ); - return StatusCode::FAILURE; - } - // get cscCalibTool - if (m_cscCalibTool.retrieve().isFailure()){ - ATH_MSG_ERROR ( "Can't get handle on CSC calibration tools" ); - return StatusCode::FAILURE; - } - - - +StatusCode Muon::CscRDO_Decoder::initialize() { + ATH_MSG_DEBUG ("CscRDO_Decoder::initialize"); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_cabling.retrieve()); + ATH_CHECK(m_cscCalibTool.retrieve()); ATH_MSG_DEBUG (" Parameters are from CscCalibTool ") ; - m_samplingTime = m_cscCalibTool->getSamplingTime(); m_signalWidth = m_cscCalibTool->getSignalWidth(); m_timeOffset = m_cscCalibTool->getTimeOffset(); - ATH_MSG_DEBUG (" Initialization is done!"); - - /** initialize CSC Id Helper :: it is needed now! */ - m_rodReadOut.set(m_muonIdHelperTool.get()); + m_rodReadOut.set(&m_idHelperSvc->cscIdHelper()); m_rodReadOut.setChamberBitVaue(1); - - return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRDO_Decoder.h index 510483137dbfb6b7c0f70725c48fce099a42c4bf..405c511f94ac79ea9a193b3f4f4a0e7437021991 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRDO_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRDO_Decoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCSC_CNVTOOLS_CSCRDO_DECODER_H @@ -9,6 +9,7 @@ #include "CscCalibTools/ICscCalibTool.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "CSCcabling/CSCcablingSvc.h" @@ -16,7 +17,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "CSCcabling/CSCcablingSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <inttypes.h> #include <vector> @@ -56,8 +57,7 @@ namespace Muon { private: std::string m_detdescr; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<CSCcablingSvc> m_cabling{this, "CSCcablingSvc", "CSCcablingSvc", "CSC cabling service handle"}; ToolHandle<ICscCalibTool> m_cscCalibTool{this, "cscCalibTool", "CscCalibTool", "CSC calibration tool handle"}; double m_timeOffset ; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRODReadOut.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRODReadOut.cxx index 18564b9d4804c981dbcf7f6002b175982ab32190..3f4415bb193ceb4420446515273a756ae34b02c7 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRODReadOut.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRODReadOut.cxx @@ -1,11 +1,11 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CscRODReadOut.h" // constructor -CscRODReadOut::CscRODReadOut() : m_muonIdHelperTool(0), m_sourceID(0), +CscRODReadOut::CscRODReadOut() : m_cscIdHelper(nullptr), m_sourceID(0), m_moduleType(0), m_rodId(0), m_subDetectorId(0), m_amp1(0), m_amp2(0), m_address(0), m_chamberBitValue(0) { @@ -48,7 +48,7 @@ CscRODReadOut::CscRODReadOut() : m_muonIdHelperTool(0), m_sourceID(0), CscRODReadOut::CscRODReadOut(double startTime, uint16_t samplingTime, double signalWidth, uint16_t numIntegration) - : m_muonIdHelperTool(0), m_sourceID(0), m_moduleType(0), m_rodId(0), + : m_cscIdHelper(nullptr), m_sourceID(0), m_moduleType(0), m_rodId(0), m_subDetectorId(0), m_amp1(0), m_amp2(0), m_address(0), m_chamberBitValue(0) { m_TIME_OFFSET = startTime; // ns @@ -70,10 +70,6 @@ CscRODReadOut::CscRODReadOut(double startTime, uint16_t samplingTime, } -// destructor -CscRODReadOut::~CscRODReadOut() -{} - void CscRODReadOut::encodeFragments(const std::vector<uint16_t> amplitude, std::vector<uint32_t>& v) const { diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRODReadOut.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRODReadOut.h index 543ed0ef69f23a9e6577bfced38a8dfdd5b8eccd..efebb1b38ab14b5f836e61aa4fd774dbc8986feb 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRODReadOut.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRODReadOut.h @@ -1,12 +1,11 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCSC_CNVTOOL_CSCRODREADOUT_H #define MUONCSC_CNVTOOL_CSCRODREADOUT_H #include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include <stdint.h> #include <vector> @@ -26,7 +25,7 @@ public: CscRODReadOut(); CscRODReadOut(double startTime, uint16_t samplingTime, double signalWidth, uint16_t numIntegration); - ~CscRODReadOut(); + ~CscRODReadOut()=default; // more static header/footer information uint32_t getHeaderSize() {return ROD_HEADER_SIZE;} @@ -57,7 +56,7 @@ public: std::vector<uint32_t>& v) const; // initialize helper - void set (const Muon::MuonIdHelperTool* muonIdHelperTool) { m_muonIdHelperTool = muonIdHelperTool; } + void set (const CscIdHelper* cscIdHelper) { m_cscIdHelper = cscIdHelper; } void setChamberBitVaue( uint32_t value ) { m_chamberBitValue = value; } @@ -98,11 +97,7 @@ public: uint32_t address() const {return m_address;} private: - const CscIdHelper& cscHelper() const { - return m_muonIdHelperTool->cscIdHelper(); - } - - const Muon::MuonIdHelperTool* m_muonIdHelperTool; + const CscIdHelper* m_cscIdHelper; uint16_t m_sourceID; uint16_t m_moduleType; uint16_t m_rodId; @@ -222,7 +217,7 @@ inline Identifier CscRODReadOut::decodeAddress() { int stationEta = ( ((m_address & 0x00001000) >> 12 ) == 0x0) ? -1 : 1; int stationPhi = ( ( m_address & 0x0000E000) >> 13 ) + 1; - return cscHelper().elementID(stationName,stationEta,stationPhi); + return m_cscIdHelper->elementID(stationName,stationEta,stationPhi); } @@ -245,28 +240,12 @@ inline Identifier CscRODReadOut::decodeAddress(const Identifier& moduleId) { int stationEta = ( ((m_address & 0x00001000) >> 12 ) == 0x0) ? -1 : 1; - // To Validate it.. This is decodeAddress called often by CscRDO_Decoder.... - // std::cout << " #################### >> " << m_address << " " - // << stationEta << " " << measuresPhi << " " - // << strip << " "; - // Added to Online -> Offline id in A side number is opposite bug#56002 if (measuresPhi) { if (stationEta>0) strip = 49-strip; } - // std::cout << strip << " shown string for strip " << strip-1 << " " << strip << " " << strip+1 << std::endl; - // std::cout << " ##################### >> " << - // cscHelper().show_to_string( cscHelper().channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip-1)) - // << std::endl; - // std::cout << " ##################### >> " << - // cscHelper().show_to_string( cscHelper().channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip)) - // << std::endl; - // std::cout << " ##################### >> " << - // cscHelper().show_to_string( cscHelper().channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip+1)) - // << std::endl; - - return cscHelper().channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip); + return m_cscIdHelper->channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip); } // module Id is given and strip is from address. @@ -285,7 +264,7 @@ inline Identifier CscRODReadOut::decodeAddress(const Identifier& moduleId, int j if (stationEta>0) strip = 49-strip; } - return cscHelper().channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip); + return m_cscIdHelper->channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip); } // module Id is given and strip is from address. @@ -305,10 +284,10 @@ inline uint32_t CscRODReadOut::hashIdentifier(const Identifier& moduleId) { } - Identifier id = cscHelper().channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip); - IdContext context = cscHelper().channel_context(); + Identifier id = m_cscIdHelper->channelID(moduleId,chamberLayer,wireLayer,measuresPhi,strip); + IdContext context = m_cscIdHelper->channel_context(); IdentifierHash hash; - cscHelper().get_hash(id, hash, &context ); + m_cscIdHelper->get_hash(id, hash, &context ); return (uint32_t) hash; } @@ -317,7 +296,7 @@ inline uint32_t CscRODReadOut::numberOfStrips(const uint32_t fragment) { decodeAddress(fragment); Identifier moduleId = decodeAddress(); Identifier channelId = decodeAddress(moduleId); - return uint32_t(cscHelper().stripMax(channelId)); + return uint32_t(m_cscIdHelper->stripMax(channelId)); } // get the signal amplitude for a given sampling time (ns) @@ -345,13 +324,13 @@ inline uint32_t CscRODReadOut::address (const Identifier& channelId, int& eta, int& phi) const { // unpack the strip identifier - int name = cscHelper().stationName(channelId); - eta = cscHelper().stationEta(channelId); - phi = cscHelper().stationPhi(channelId); - int chamberLayer = cscHelper().chamberLayer(channelId); - int wireLayer = cscHelper().wireLayer(channelId); - int orientation = cscHelper().measuresPhi(channelId); - int strip = cscHelper().strip(channelId); + int name = m_cscIdHelper->stationName(channelId); + eta = m_cscIdHelper->stationEta(channelId); + phi = m_cscIdHelper->stationPhi(channelId); + int chamberLayer = m_cscIdHelper->chamberLayer(channelId); + int wireLayer = m_cscIdHelper->wireLayer(channelId); + int orientation = m_cscIdHelper->measuresPhi(channelId); + int strip = m_cscIdHelper->strip(channelId); // NOPE. Don't flip it!! This strip is for CscDigitToCscRdoTool online address @@ -378,9 +357,4 @@ inline uint32_t CscRODReadOut::address (const Identifier& channelId, return address; } - - - #endif // MUONCSC_CNVTOOL_CSCRODREADOUT_H - - diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Decoder.cxx index bf47e58ab4d3f05b001ed1d4a7a7f7219c5e7fc2..a1fa29c49b378a70ae1c5e4c8216c695cf9639b5 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Decoder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CscROD_Decoder.h" @@ -8,7 +8,6 @@ #include "MuonRDO/CscRawDataCollection.h" #include "MuonRDO/CscRawDataContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "eformat/Issue.h" @@ -19,49 +18,24 @@ using OFFLINE_FRAGMENTS_NAMESPACE::PointerType ; using eformat::helper::SourceIdentifier; /** constructor */ -Muon::CscROD_Decoder::CscROD_Decoder -( const std::string& type, const std::string& name,const IInterface* parent ) -: base_class(type,name,parent), - m_cabling( "CSCcablingSvc" ,name) +Muon::CscROD_Decoder::CscROD_Decoder(const std::string& type, const std::string& name, const IInterface* parent) : + base_class(type,name,parent), + m_cabling( "CSCcablingSvc" ,name) { declareProperty("IsCosmics", m_isCosmic = false); declareProperty("IsOldCosmics", m_isOldCosmic = false); } -/** destructor -*/ -Muon::CscROD_Decoder::~CscROD_Decoder() -{} - StatusCode Muon::CscROD_Decoder::initialize() { - - IMessageSvc* msgSvc = 0; - ISvcLocator* svcLocator = Gaudi::svcLocator(); - StatusCode status = svcLocator->service("MessageSvc", msgSvc); - if ( status.isFailure() ) { - ATH_MSG_ERROR ( "Failed to find MessageSvc " ); - return status; - } - - MsgStream log(msgSvc, "CscROD_Decoder::initialize"); - // get the cabling service - if ( m_cabling.retrieve().isFailure() ) - { - ATH_MSG_ERROR ( " Cannot get CablingSvc " ); - return StatusCode::FAILURE; - } - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - - m_hid2re.set( &(*m_cabling), m_muonIdHelperTool.get() ); - + ATH_CHECK(m_cabling.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); + m_hid2re.set( &(*m_cabling), &m_idHelperSvc->cscIdHelper() ); if ( m_isCosmic ) { m_hid2re.set_isCosmic(); if ( m_isOldCosmic ) m_hid2re.set_isOldCosmic(); } - return StatusCode::SUCCESS; } @@ -119,7 +93,7 @@ void Muon::CscROD_Decoder::fillCollection(const xAOD::EventInfo& eventInfo, uint32_t Muon::CscROD_Decoder::getHashId(const uint32_t word, std::string /*detdescr*/) const { CscRODReadOut rodReadOut; /** set the CSC Id Helper */ - rodReadOut.set(m_muonIdHelperTool.get()); + rodReadOut.set(&m_idHelperSvc->cscIdHelper()); rodReadOut.setChamberBitVaue(1); rodReadOut.decodeAddress( word ); @@ -132,7 +106,7 @@ uint32_t Muon::CscROD_Decoder::getHashId(const uint32_t word, std::string /*detd Identifier Muon::CscROD_Decoder::getChannelId(const uint32_t word, std::string /*detdescr*/) const { CscRODReadOut rodReadOut; /** set the CSC Id Helper */ - rodReadOut.set(m_muonIdHelperTool.get()); + rodReadOut.set(&m_idHelperSvc->cscIdHelper()); rodReadOut.setChamberBitVaue(1); rodReadOut.decodeAddress( word ); @@ -144,7 +118,7 @@ Identifier Muon::CscROD_Decoder::getChannelId(const uint32_t word, std::string / void Muon::CscROD_Decoder::getSamples(const std::vector<uint32_t>& words, std::vector<uint16_t>& samples) const { CscRODReadOut rodReadOut; /** set the CSC Id Helper */ - rodReadOut.set(m_muonIdHelperTool.get()); + rodReadOut.set(&m_idHelperSvc->cscIdHelper()); rodReadOut.setChamberBitVaue(1); for (unsigned int j=0; j<words.size(); ++j) { @@ -167,8 +141,7 @@ void Muon::CscROD_Decoder::rodVersion2(const ROBFragment& robFrag, CscRawDataCo CscRODReadOut rodReadOut; - /** set the CSC Id Helper */ - rodReadOut.set(m_muonIdHelperTool.get()); + rodReadOut.set(&m_idHelperSvc->cscIdHelper()); rodReadOut.setChamberBitVaue(1); /** get some information */ @@ -387,10 +360,10 @@ void Muon::CscROD_Decoder::rodVersion2(const ROBFragment& robFrag, CscRawDataCo rodReadOut.decodeAddress( address ); Identifier moduleId = rodReadOut.decodeAddress(); Identifier channelId = rodReadOut.decodeAddress(moduleId); - int stationId = m_muonIdHelperTool->cscIdHelper().stationName(channelId); - int currentLayer = m_muonIdHelperTool->cscIdHelper().wireLayer(channelId); - int orientation = m_muonIdHelperTool->cscIdHelper().measuresPhi(channelId); - int stripId = m_muonIdHelperTool->cscIdHelper().strip(channelId); + int stationId = m_idHelperSvc->cscIdHelper().stationName(channelId); + int currentLayer = m_idHelperSvc->cscIdHelper().wireLayer(channelId); + int orientation = m_idHelperSvc->cscIdHelper().measuresPhi(channelId); + int stripId = m_idHelperSvc->cscIdHelper().strip(channelId); counter += 1; @@ -440,7 +413,7 @@ void Muon::CscROD_Decoder::rodVersion2(const ROBFragment& robFrag, CscRawDataCo << idColl << " " << hashId << " " << spuID << " " << stationId << " :: measphi" << orientation << " L" << currentLayer << " strId " << stripId << " nStr " << width << " T" << time << " nSampWords " << totalSampleWords << " " - << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) ); + << m_idHelperSvc->cscIdHelper().show_to_string(channelId) ); } ATH_MSG_DEBUG ( "****Total Cluster count = " << clusterCount diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Decoder.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Decoder.h index 08f8365cc8a8f27c9314f6520c014d0bb84a915d..f9349feb005d53e693ab50b0cb8b295e502a4ac2 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Decoder.h @@ -1,11 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCSC_CNVTOOL_CSCROD_DECODER_H #define MUONCSC_CNVTOOL_CSCROD_DECODER_H -// MuonCSC_CnvTool includes #include "MuonCSC_CnvTools/ICSC_ROD_Decoder.h" #include "CscRODReadOut.h" #include "CscRODReadOutV0.h" @@ -15,19 +14,15 @@ #include <inttypes.h> #include "AthenaBaseComps/AthAlgTool.h" -#include "Identifier/Identifier.h" - +#include "GaudiKernel/ServiceHandle.h" #include "ByteStreamData/RawEvent.h" #include "eformat/SourceIdentifier.h" #include "eformat/Version.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "CSCcabling/CSCcablingSvc.h" class CscRawDataContainer; -//using namespace OFFLINE_FRAGMENTS_NAMESPACE ; -//using eformat::helper::SourceIdentifier; - namespace Muon { /** This class provides conversion from ROD data to CSC RDO @@ -43,13 +38,9 @@ public: */ CscROD_Decoder(const std::string& type, const std::string& name, const IInterface* parent ) ; - - /** destructor - */ - virtual ~CscROD_Decoder(); + virtual ~CscROD_Decoder()=default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override { return StatusCode::SUCCESS; } virtual void fillCollection(const xAOD::EventInfo& eventInfo, const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag, CscRawDataContainer& rdoIDC) const override; @@ -70,12 +61,9 @@ private: void rodVersion2(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag, CscRawDataContainer& rdoIDC) const; private: - CSC_Hid2RESrcID m_hid2re; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<CSCcablingSvc> m_cabling; - bool m_isCosmic; bool m_isOldCosmic; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Encoder.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Encoder.cxx index 7e193c9fcd565860c7e9f06dc4d2a0b8d87d5e31..0b7ab38f01bd657227c7dda06159c95287da8b82 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Encoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Encoder.cxx @@ -20,12 +20,6 @@ CscROD_Encoder::CscROD_Encoder() : m_cscRdo(0) {} - -/** destructor -*/ -CscROD_Encoder::~CscROD_Encoder() {} - - /** convert CSC RDO to a vector of 32bit words */ StatusCode CscROD_Encoder::fillROD(std::vector<uint32_t>& v, MsgStream& mLog) @@ -37,7 +31,7 @@ StatusCode CscROD_Encoder::fillROD(std::vector<uint32_t>& v, MsgStream& mLog) CscRODReadOut rodReadOut; // initialize the identifier helper - rodReadOut.set(m_muonIdHelperTool); + rodReadOut.set(m_cscIdHelper); // first group the pads into their RPUs typedef std::vector<const CscRawData*> rpu; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Encoder.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Encoder.h index 984519e2464fbe9ac8178303d30a05c6618a4e8e..2f6d221e5bb79b5a0169d962825d501cd39b7328 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Encoder.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscROD_Encoder.h @@ -9,7 +9,7 @@ #include "ByteStreamData/RawEvent.h" #include "CSC_Hid2RESrcID.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/CscIdHelper.h" #include "MuonRDO/CscRawDataCollection.h" class CscRawDataCollection; @@ -30,9 +30,7 @@ public: */ CscROD_Encoder(); - /** destructor - */ - ~CscROD_Encoder(); + ~CscROD_Encoder()=default; /** set CscRawDataCollection */ @@ -45,11 +43,11 @@ public: /** setIdHelper */ - void setIdHelper ( const Muon::MuonIdHelperTool * muonIdHelperTool) { m_muonIdHelperTool = muonIdHelperTool; } + void setIdHelper (const CscIdHelper* cscIdHelper) { m_cscIdHelper = cscIdHelper; } private: const CscRawDataCollection * m_cscRdo; - const Muon::MuonIdHelperTool * m_muonIdHelperTool; + const CscIdHelper* m_cscIdHelper; }; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoContByteStreamTool.cxx index b6c4fee7c9e76559f2bd24c107b75573dce7c9e0..93553f4e3fd3e9b33ad1db295e75597bf084c1e6 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoContByteStreamTool.cxx @@ -1,12 +1,11 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CscRdoContByteStreamTool.h" #include "CscROD_Encoder.h" #include "MuonRDO/CscRawDataContainer.h" -#include "MuonIdHelpers/CscIdHelper.h" #include "StoreGate/StoreGate.h" #include "AthenaKernel/CLASS_DEF.h" @@ -14,71 +13,41 @@ #include <map> // contructor -Muon::CscRdoContByteStreamTool::CscRdoContByteStreamTool -(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type,name,parent) +Muon::CscRdoContByteStreamTool::CscRdoContByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type,name,parent) { - // declareInterface<Muon::CscRdoContByteStreamTool>(this); declareInterface<Muon::ICSC_RDOtoByteStreamTool>(this); - declareProperty("EventType", m_eventType=0x0); declareProperty("RODVersion", m_rodVersion=0x0200); declareProperty("IsCosmicData", m_isCosmic=false); declareProperty("IsOldCosmicData", m_isOldCosmic=false); - } - -// destructor -Muon::CscRdoContByteStreamTool::~CscRdoContByteStreamTool() -{} - - // initialize StatusCode Muon::CscRdoContByteStreamTool::initialize() { - // StatusCode status = AthAlgTool::initialize(); - ATH_MSG_DEBUG ("Muon::CscRdoContByteStreamTool::initialize()"); + ATH_CHECK(AthAlgTool::initialize()); + ATH_MSG_DEBUG ("Muon::CscRdoContByteStreamTool::initialize()"); // get the cabling service - if (StatusCode::SUCCESS != serviceLocator()->service("CSCcablingSvc", m_cabling)) { - ATH_MSG_ERROR ( "Can't get CSCcablingSvc " ); - return StatusCode::FAILURE; - } - - if ( m_muonIdHelperTool.retrieve().isFailure()) { - ATH_MSG_FATAL ( "Could not get CscIdHelper !" ); - return StatusCode::FAILURE; - } - else { - ATH_MSG_DEBUG ( " Found the CscIdHelper. " ); - } + ATH_CHECK(serviceLocator()->service("CSCcablingSvc", m_cabling)); + ATH_CHECK(m_idHelperSvc.retrieve()); // create CSC RDO ID to source ID mapper - m_hid2re.set( m_cabling, m_muonIdHelperTool.get() ); + m_hid2re.set(m_cabling, &m_idHelperSvc->cscIdHelper()); if ( m_isCosmic ) { m_hid2re.set_isCosmic(); if ( m_isOldCosmic ) m_hid2re.set_isOldCosmic(); } - return StatusCode::SUCCESS; } - -// finalize -StatusCode Muon::CscRdoContByteStreamTool::finalize() -{ - // return AthAlgTool::finalize(); - return StatusCode::SUCCESS; -} - - // convert CSC RDO to ByteStream StatusCode Muon::CscRdoContByteStreamTool::convert(const CONTAINER* cont, RawEventWrite* re, MsgStream& log) { m_fea.clear(); - m_fea.idMap().set( m_cabling, m_muonIdHelperTool.get() ); + m_fea.idMap().set(m_cabling, &m_idHelperSvc->cscIdHelper()); if(m_cabling->nROD()==16) m_fea.setRodMinorVersion(0x400); else m_fea.setRodMinorVersion(m_rodVersion); @@ -109,7 +78,7 @@ StatusCode Muon::CscRdoContByteStreamTool::convert(const CONTAINER* cont, RawEve // map the RDO onto Encoder mapEncoder[rodId].setRdo(*it_col); - mapEncoder[rodId].setIdHelper(m_muonIdHelperTool.get()); + mapEncoder[rodId].setIdHelper(&m_idHelperSvc->cscIdHelper()); } // loop over map and fill all ROD Data Blocks diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoContByteStreamTool.h index e5ae0bf87df49aa48e275289817596c047b54dd9..a0efa484e90918b2dd68b07bde0614086dc8447b 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoContByteStreamTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCSC_CNVTOOLS_CSCRDOCONTRAWEVENTTOOL_H @@ -9,18 +9,15 @@ #include "MuonCSC_CnvTools/ICSC_RDOtoByteStreamTool.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" #include "CSC_Hid2RESrcID.h" #include "ByteStreamData/RawEvent.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <string> -class Identifier; class CSCcablingSvc; -class CscRawDataCollection; - namespace Muon { /* @@ -37,19 +34,11 @@ namespace Muon { /** constructor */ - CscRdoContByteStreamTool (const std::string& type, const std::string& name, - const IInterface* parent); - - /** destructor - */ - virtual ~CscRdoContByteStreamTool(); - - /** AlgTool InterfaceID - */ - // static const InterfaceID& interfaceID( ) ; - + CscRdoContByteStreamTool (const std::string& type, const std::string& name, const IInterface* parent); + + virtual ~CscRdoContByteStreamTool()=default; + virtual StatusCode initialize(); - virtual StatusCode finalize(); /** to read the cosmic data */ bool isCosmic () const { return m_isCosmic; } @@ -58,13 +47,10 @@ namespace Muon { bool isOldCosmic () const { return m_isOldCosmic; } StatusCode convert(const CONTAINER* cont, RawEventWrite* re, MsgStream& log); - //StatusCode convert(const RawEvent* re, CONTAINER* cont, MsgStream& log); private: - CSC_Hid2RESrcID m_hid2re; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // event assembler FullEventAssembler<CSC_Hid2RESrcID> m_fea; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataTool.cxx index 9b2b0ecd6a2078797c495eebca81a0ba53e1333b..85562dfd945ea4d10151bdca5556cc76b711dcb8 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /// Author: Ketevi A. Assamagan, Woochun Park @@ -7,7 +7,6 @@ /// algorithm to decode RDO into PrepRawData -#include "MuonIdHelpers/CscIdHelper.h" #include "MuonReadoutGeometry/CscReadoutElement.h" #include "MuonRDO/CscRawData.h" #include "MuonRDO/CscRawDataCollection.h" @@ -34,8 +33,6 @@ CscRdoToCscPrepDataTool::CscRdoToCscPrepDataTool : CscRdoToCscPrepDataToolCore(type, name, parent) { } -CscRdoToCscPrepDataTool::~CscRdoToCscPrepDataTool(){} - StatusCode CscRdoToCscPrepDataTool::initialize(){ ATH_MSG_VERBOSE("Starting init"); ATH_CHECK( CscRdoToCscPrepDataToolCore::initialize() ); @@ -43,11 +40,6 @@ StatusCode CscRdoToCscPrepDataTool::initialize(){ return StatusCode::SUCCESS; } -StatusCode CscRdoToCscPrepDataTool::finalize() { - return CscRdoToCscPrepDataToolCore::finalize(); -} - - StatusCode CscRdoToCscPrepDataTool::decode(std::vector<IdentifierHash>& givenIdhs, std::vector<IdentifierHash>& decodedIdhs) { // WARNING : Trigger Part is not finished. unsigned int sizeVectorRequested = givenIdhs.size(); @@ -60,9 +52,9 @@ StatusCode CscRdoToCscPrepDataTool::decode(std::vector<IdentifierHash>& givenIdh if (!evtStore()->contains<Muon::CscStripPrepDataContainer>(m_outputCollectionKey.key())) { /// record the container in storeGate SG::WriteHandle< Muon::CscStripPrepDataContainer > outputHandle (m_outputCollectionKey); - StatusCode status = outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(m_muonMgr->cscIdHelper()->module_hash_max())); + ATH_CHECK(outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(m_idHelperSvc->cscIdHelper().module_hash_max()))); - if (status.isFailure() || !outputHandle.isValid() ) { + if (!outputHandle.isValid()) { ATH_MSG_FATAL("Could not record container of CSC PrepData Container at " << m_outputCollectionKey.key()); return StatusCode::FAILURE; } diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataTool.h index 3cd22d883717c6f2092d5de803d9d4600ad6a046..1b17a57de7b53f26200cdde5d237fb4b2ad69cfa 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCSC_CNVTOOLS_CSCRDOTOCSCPREPDATATOOL_H @@ -31,12 +31,10 @@ namespace Muon { /** destructor */ - virtual ~CscRdoToCscPrepDataTool(); + virtual ~CscRdoToCscPrepDataTool()=default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - using CscRdoToCscPrepDataToolCore::decode; virtual StatusCode decode(std::vector<IdentifierHash>& givenIdhs, std::vector<IdentifierHash>& decodedIdhs) override; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx index f0c0942c57d4ccd6ba943e313a968fa6a14d2712..e9777821626d034152e98fbb012ddb46924aef83 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx @@ -18,10 +18,6 @@ #include "TrkSurfaces/SurfaceBounds.h" #include "EventPrimitives/EventPrimitives.h" -#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" -#include "CscCalibTools/ICscCalibTool.h" -#include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h" - #include "GaudiKernel/ThreadLocalContext.h" using namespace MuonGM; @@ -39,7 +35,7 @@ const InterfaceID& CscRdoToCscPrepDataToolCore::interfaceID() CscRdoToCscPrepDataToolCore::CscRdoToCscPrepDataToolCore (const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), - m_muonMgr(0), + m_muonMgr(nullptr), m_cscCalibTool( "CscCalibTool/CscCalibTool", this), m_cscRdoDecoderTool ("Muon::CscRDO_Decoder/CscRDO_Decoder", this), m_cabling( "CSCcablingSvc" ,name), @@ -56,57 +52,19 @@ CscRdoToCscPrepDataToolCore::CscRdoToCscPrepDataToolCore declareProperty("OutputCollection", m_outputCollectionKey = std::string("CSC_Measurements"),"Muon::CscStripPrepDataContainer to record"); } -// destructor -CscRdoToCscPrepDataToolCore::~CscRdoToCscPrepDataToolCore(){} - -StatusCode CscRdoToCscPrepDataToolCore::finalize() { - - ATH_MSG_DEBUG("in finalize()"); - - - return StatusCode::SUCCESS; - -} - StatusCode CscRdoToCscPrepDataToolCore::initialize(){ - ATH_MSG_DEBUG(" in initialize()"); - - /// get the detector descriptor manager - if (detStore()->retrieve( m_muonMgr ).isFailure()) { - ATH_MSG_ERROR(" Cannot retrieve MuonGeoModel "); - return StatusCode::FAILURE; - } - + ATH_CHECK(detStore()->retrieve( m_muonMgr )); ATH_MSG_INFO("The Geometry version is " << m_muonMgr->get_DBMuonVersion()); - // get cscCalibTool - if (m_cscCalibTool.retrieve().isFailure()){ - ATH_MSG_ERROR ( "Can't get handle on CSC calibration tools" ); - return StatusCode::FAILURE; - } - - // get cscCalibTool - if (m_cscRdoDecoderTool.retrieve().isFailure()){ - ATH_MSG_ERROR ( "Can't get handle on CSC RDO Decoder tool" ); - return StatusCode::FAILURE; - } - - /// create an empty CSC cluster container for filling - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - - - if ( m_cabling.retrieve().isFailure() ) - { - ATH_MSG_ERROR ( " Cannot get CSCcablingSvc " ); - return StatusCode::FAILURE; - } + ATH_CHECK(m_cscCalibTool.retrieve()); + ATH_CHECK(m_cscRdoDecoderTool.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_cabling.retrieve()); // check if initializing of DataHandle objects success ATH_CHECK( m_rdoContainerKey.initialize() ); - ATH_CHECK( m_outputCollectionKey.initialize() ); - return StatusCode::SUCCESS; } @@ -117,12 +75,8 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(std::vector<IdentifierHash>&, std //***************************************** //************** Process for the givenId EF Filter case... -StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoContainer, IdentifierHash givenHashId, std::vector<IdentifierHash>& decodedIdhs) { - - - //typedef CscRawDataContainer::const_iterator collection_iterator; - - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); +StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoContainer, IdentifierHash givenHashId, std::vector<IdentifierHash>& decodedIdhs) { + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); // if CSC decoding is switched off stop here if( !m_decodeData ) { @@ -195,7 +149,7 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon << " Width = " << width << " Samples = " << totalSamples << " stationId : " << stationId << " hashOffset : " << hashOffset); - if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { ATH_MSG_WARNING ( "Unable to get CSC digiti collection hash id " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -230,24 +184,18 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId); //calculate local positions on the strip planes if ( !descriptor ) { - ATH_MSG_WARNING ( "Invalid descriptor for " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + ATH_MSG_WARNING ( "Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " Skipping channel " ); continue; } else if (!descriptor->containsId(channelId)) { ATH_MSG_WARNING ("Identifier from the cabling service <" - <<m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + <<m_idHelperSvc->cscIdHelper().show_to_string(channelId) <<"> inconsistent with the geometry of detector element <" - <<m_muonIdHelperTool->cscIdHelper().show_to_string(descriptor->identify()) + <<m_idHelperSvc->cscIdHelper().show_to_string(descriptor->identify()) <<"> =>>ignore this hit"); continue; } - // if(!(m_muonIdHelperTool->cscIdHelper().valid(channelId))) { - // ATH_MSG_WARNING ( "CscRdoToCscPrepDataToolCore::decode Invalid CSC Identifier " << channelId - // << " most likely due to old RDO sample generated in 15.X"); - // continue; - // } - float timeOfFirstSample = 0.0; bool extractSamples = data->samples(j, numSamples, samples); if (!extractSamples) { @@ -260,7 +208,7 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon // uint32_t stripHash = hashOffset+j; IdentifierHash stripHash; - if (m_muonIdHelperTool->cscIdHelper().get_channel_hash(channelId, stripHash)) { + if (m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, stripHash)) { ATH_MSG_WARNING ( "Unable to get CSC strip hash id"); channelId.show(); } @@ -272,81 +220,16 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon continue; } if ( samples.size() >=4 ) - ATH_MSG_DEBUG ( "ADC: " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + ATH_MSG_DEBUG ( "ADC: " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " " << samples[0] << " " << samples[1] << " " << samples[2] << " " << samples[3] << " Charges: " << " " << charges[0] << " " << charges[1] << " " << charges[2] << " " << charges[3] ); - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(channelId); - - /* moving to manage these local (tracking wise) strip position in CscReadoutElement - HepGeom::Point3D<double> globalStripPosition = descriptor->stripPos(channelId); // position on strip planes - - // get local position on wire plane, here we have to use a tolarance as the wire plane is located 2.5 mm - // from the strip plane - double tolerance = 3.; - const Trk::LocalPosition * localWirePos = descriptor->surface(channelId).globalToLocal(globalStripPosition,tolerance); - - // the globalToLocal should not fail with the 3 mm tolerance, if it does produce a WARNING - if( !localWirePos ){ - ATH_MSG_WARNING ( " globalToLocal failed!!!, trying simple transform " ); - HepGeom::Point3D<double> localStripPos = descriptor->surface(channelId).transform().inverse()*globalStripPosition; - Trk::LocalPosition *lp = new Trk::LocalPosition(); - (*lp)[Trk::locX] = localStripPos.x(); - (*lp)[Trk::locY] = localStripPos.y(); - ATH_MSG_WARNING ( " local position in measurement frame (" << localStripPos.x() - << "," << localStripPos.y() << "," << localStripPos.z() << ") " ); - localWirePos = lp; - } - if (measuresPhi==1){ - if (descriptor->getStationEta()>0) ATH_MSG_INFO( "PHI-side A current ... local position: " << localWirePos->x() << " " << localWirePos->y()); - else ATH_MSG_INFO( "PHI-side C current ... local position: " << localWirePos->x() << " " << localWirePos->y()); - } - else { - if (descriptor->getStationEta()>0) ATH_MSG_INFO( "ETA-side A current ... local position: " << localWirePos->x() << " " << localWirePos->y()); - else ATH_MSG_INFO( "ETA-side C current ... local position: " << localWirePos->x() << " " << localWirePos->y()); - } - */ - // Amg::Vector3D localStripPosNew = descriptor->stripPosOnTrackingSurface(channelId); - // Amg::Vector2D localWirePos1(localStripPosNew.x(), localStripPosNew.y()); - // double locX = descriptor->xCoordinateInTrackingFrame(channelId ); - // if( fabs(locX-localWirePos1.x()) > 1e-6 || fabs(localWirePos1.y()) > 1e-6 ){ - // ATH_MSG_WARNING(" bad loc pos: fast " << locX << " slow " << localWirePos1.x() << " " << localWirePos1.y()); - // }else ATH_MSG_INFO(" loc pos: fast " << locX << " slow " << localWirePos1.x() << " " << localWirePos1.y()); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(channelId); Amg::Vector2D localWirePos1( descriptor->xCoordinateInTrackingFrame(channelId ),0.); - // if (measuresPhi==1){ - // if (descriptor->getStationEta()>0) ATH_MSG_DEBUG( "PHI-side A new ... local position: " << localWirePos1.x() << " " << localWirePos1.y()); - // else ATH_MSG_DEBUG( "PHI-side C new ... local position: " << localWirePos1.x() << " " << localWirePos1.y()); - // } - // else { - // if (descriptor->getStationEta()>0) ATH_MSG_DEBUG( "ETA-side A new ... local position: " << localWirePos1.x() << " " << localWirePos1.y()); - // else ATH_MSG_DEBUG( "ETA-side C new ... local position: " << localWirePos1.x() << " " << localWirePos1.y()); - // } - /* the following is the way local cluster positions are computed in the clusterization; the reason for doing that is that 17/06/2011 - there are no methods like clusterPosOnTrackingSurface() yet in CscReadoutElement - HepGeom::Point3D<double> localStripPosN = descriptor->nominalLocalStripPos(channelId); - Trk::LocalPosition *localWirePos2; - if (measuresPhi==1) localWirePos2 = new Trk::LocalPosition(localStripPosN.y(), localStripPosN.z()); - else localWirePos2 = new Trk::LocalPosition(localStripPosN.z(), localStripPosN.y()); - if (measuresPhi==1){ - if (descriptor->getStationEta()>0) ATH_MSG_INFO( "PHI-side A as-clus ... local position: " << localWirePos2->x() << " " << localWirePos2->y()); - else ATH_MSG_INFO( "PHI-side C as-clus ... local position: " << localWirePos2->x() << " " << localWirePos2->y()); - } - else { - if (descriptor->getStationEta()>0) ATH_MSG_INFO( "ETA-side A as-clus ... local position: " << localWirePos2->x() << " " << localWirePos2->y()); - else ATH_MSG_INFO( "ETA-side C as-clus ... local position: " << localWirePos2->x() << " " << localWirePos2->y()); - } - const GlobalPosition* globalWirePos = descriptor->surface(channelId).localToGlobal( *localWirePos ); - if (!(descriptor->surface(channelId).isOnSurface( *globalWirePos,true ) ) ) - ATH_MSG_WARNING ("Measurement at ("<<localWirePos->x()<<","<< localWirePos->y() - <<") does not appear to be on wire plane surface! (which has bounds" - <<descriptor->surface().bounds()<<")"); //sanity check - delete globalWirePos; - */ - - int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(channelId); + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(channelId); float stripWidth = descriptor->cathodeReadoutPitch( chamberLayer, measuresPhi ); double errPos = stripWidth / sqrt(12.0); @@ -383,7 +266,7 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon typedef CscRawDataContainer::const_iterator collection_iterator; - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); // if CSC decoding is switched off stop here if( !m_decodeData ) { @@ -432,7 +315,7 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon << " Width = " << width << " Samples = " << totalSamples << " stationId : " << stationId << " hashOffset : " << hashOffset); - if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { ATH_MSG_WARNING ( "Unable to get CSC digiti collection hash id " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -466,24 +349,19 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon for (unsigned int j=0; j<width; ++j) { const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, j); ATH_MSG_DEBUG ( "DecodeAll**LOOP over width " << j << " " << channelId ); - // if(!(m_muonIdHelperTool->cscIdHelper().valid(channelId))) { - // ATH_MSG_WARNING ( "CscRdoToCscPrepDataToolCore::decode Invalid CSC Identifier " << channelId - // << " most likely due to old RDO sample generated in 15.X"); - // continue; - // } const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId); //calculate local positions on the strip planes if ( !descriptor ) { - ATH_MSG_WARNING ( "Invalid descriptor for " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + ATH_MSG_WARNING ( "Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " Skipping channel " ); continue; } else if (!descriptor->containsId(channelId)) { ATH_MSG_WARNING ("Identifier from the cabling service <" - <<m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + <<m_idHelperSvc->cscIdHelper().show_to_string(channelId) <<"> inconsistent with the geometry of detector element <" - <<m_muonIdHelperTool->cscIdHelper().show_to_string(descriptor->identify()) + <<m_idHelperSvc->cscIdHelper().show_to_string(descriptor->identify()) <<"> =>>ignore this hit"); continue; } @@ -498,17 +376,15 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon continue; } - - // uint32_t stripHash = hashOffset+j; IdentifierHash stripHash; - if (m_muonIdHelperTool->cscIdHelper().get_channel_hash(channelId, stripHash)) { + if (m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, stripHash)) { ATH_MSG_WARNING ( "Unable to get CSC strip hash id"); channelId.show(); } Identifier channelIdFromHash; - m_muonIdHelperTool->cscIdHelper().get_id(stripHash, channelIdFromHash, &cscContext); + m_idHelperSvc->cscIdHelper().get_id(stripHash, channelIdFromHash, &cscContext); bool adctocharge = m_cscCalibTool->adcToCharge(samples, stripHash, charges); @@ -518,13 +394,13 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon continue; } if ( samples.size() >=4 ) - ATH_MSG_DEBUG ( "DecodeAll*** ADC: " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) << " " + ATH_MSG_DEBUG ( "DecodeAll*** ADC: " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " " << (int) stripHash << " " - << m_muonIdHelperTool->cscIdHelper().show_to_string(channelIdFromHash) + << m_idHelperSvc->cscIdHelper().show_to_string(channelIdFromHash) << " " << samples[0] << " " << samples[1] << " " << samples[2] << " " << samples[3] << " Charges: " << " " << charges[0] << " " << charges[1] << " " << charges[2] << " " << charges[3] ); - if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { ATH_MSG_WARNING ( "Unable to get CSC hash id from CSC RDO collection " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -545,74 +421,11 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon } if (IsThisStripDecoded) continue; - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(channelId); - /* moving to manage these local (tracking wise) strip position in CscReadoutElement - HepGeom::Point3D<double> globalStripPosition = descriptor->stripPos(channelId); // position on strip planes - - // get local position on wire plane, here we have to use a tolarance as the wire plane is located 2.5 mm - // from the strip plane - double tolerance = 3.; - const Trk::LocalPosition * localWirePos = descriptor->surface(channelId).globalToLocal(globalStripPosition,tolerance); - - // the globalToLocal should not fail with the 3 mm tolerance, if it does produce a WARNING - if( !localWirePos ){ - ATH_MSG_WARNING ( " globalToLocal failed!!!, trying simple transform " ); - HepGeom::Point3D<double> localStripPos = descriptor->surface(channelId).transform().inverse()*globalStripPosition; - Trk::LocalPosition *lp = new Trk::LocalPosition(); - (*lp)[Trk::locX] = localStripPos.x(); - (*lp)[Trk::locY] = localStripPos.y(); - ATH_MSG_WARNING ( " local position in measurement frame (" << localStripPos.x() - << "," << localStripPos.y() << "," << localStripPos.z() << ") " ); - localWirePos = lp; - } - if (measuresPhi==1){ - if (descriptor->getStationEta()>0) ATH_MSG_INFO( "PHI-side A current ... local position: " << localWirePos->x() << " " << localWirePos->y()); - else ATH_MSG_INFO( "PHI-side C current ... local position: " << localWirePos->x() << " " << localWirePos->y()); - } - else { - if (descriptor->getStationEta()>0) ATH_MSG_INFO( "ETA-side A current ... local position: " << localWirePos->x() << " " << localWirePos->y()); - else ATH_MSG_INFO( "ETA-side C current ... local position: " << localWirePos->x() << " " << localWirePos->y()); - } - */ - // Amg::Vector3D localStripPosNew = descriptor->stripPosOnTrackingSurface(channelId); - // Amg::Vector2D localWirePos1(localStripPosNew.x(), localStripPosNew.y()); - // double locX =; - // if( fabs(locX-localWirePos1.x()) > 1e-6 || fabs(localWirePos1.y()) > 1e-6 ){ - // ATH_MSG_WARNING( m_muonIdHelperTool->cscIdHelper().print_to_string(channelId) << " bad loc pos: fast " << locX << " slow " << localWirePos1.x() << " " << localWirePos1.y()); - // }else ATH_MSG_INFO(m_muonIdHelperTool->cscIdHelper().print_to_string(channelId) << " loc pos: fast " << locX << " slow " << localWirePos1.x() << " " << localWirePos1.y()); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(channelId); + Amg::Vector2D localWirePos1( descriptor->xCoordinateInTrackingFrame(channelId ),0.); - // if (measuresPhi==1){ - // if (descriptor->getStationEta()>0) ATH_MSG_DEBUG( "PHI-side A new ... local position: " << localWirePos1.x() << " " << localWirePos1.y()); - // else ATH_MSG_DEBUG( "PHI-side C new ... local position: " << localWirePos1.x() << " " << localWirePos1.y()); - // } - // else { - // if (descriptor->getStationEta()>0) ATH_MSG_DEBUG( "ETA-side A new ... local position: " << localWirePos1.x() << " " << localWirePos1.y()); - // else ATH_MSG_DEBUG( "ETA-side C new ... local position: " << localWirePos1.x() << " " << localWirePos1.y()); - // } - /* the following is the way local cluster positions are computed in the clusterization; the reason for doing that is that 17/06/2011 - there are no methods like clusterPosOnTrackingSurface() yet in CscReadoutElement - HepGeom::Point3D<double> localStripPosN = descriptor->nominalLocalStripPos(channelId); - Trk::LocalPosition *localWirePos2; - if (measuresPhi==1) localWirePos2 = new Trk::LocalPosition(localStripPosN.y(), localStripPosN.z()); - else localWirePos2 = new Trk::LocalPosition(localStripPosN.z(), localStripPosN.y()); - if (measuresPhi==1){ - if (descriptor->getStationEta()>0) ATH_MSG_INFO( "PHI-side A as-clus ... local position: " << localWirePos2->x() << " " << localWirePos2->y()); - else ATH_MSG_INFO( "PHI-side C as-clus ... local position: " << localWirePos2->x() << " " << localWirePos2->y()); - } - else { - if (descriptor->getStationEta()>0) ATH_MSG_INFO( "ETA-side A as-clus ... local position: " << localWirePos2->x() << " " << localWirePos2->y()); - else ATH_MSG_INFO( "ETA-side C as-clus ... local position: " << localWirePos2->x() << " " << localWirePos2->y()); - } - - const GlobalPosition* globalWirePos = descriptor->surface(channelId).localToGlobal( *localWirePos ); - if (!(descriptor->surface(channelId).isOnSurface( *globalWirePos,true ) ) ) - ATH_MSG_WARNING ("Measurement at ("<<localWirePos->x()<<","<< localWirePos->y() - <<") does not appear to be on wire plane surface! (which has bounds" - <<descriptor->surface().bounds()<<")"); //sanity check - delete globalWirePos; - */ - int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(channelId); + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(channelId); float stripWidth = descriptor->cathodeReadoutPitch( chamberLayer, measuresPhi ); double errPos = stripWidth / sqrt(12.0); @@ -665,7 +478,7 @@ void CscRdoToCscPrepDataToolCore::printPrepData() if ( cscColl->size() <= 0 ) continue; - ATH_MSG_INFO ("PrepData Collection ID " << m_muonIdHelperTool->cscIdHelper().show_to_string(cscColl->identify()) + ATH_MSG_INFO ("PrepData Collection ID " << m_idHelperSvc->cscIdHelper().show_to_string(cscColl->identify()) <<" with size = "<<cscColl->size()); CscStripPrepDataCollection::const_iterator it_cscStripPrepData; int icc = 0; @@ -674,13 +487,13 @@ void CscRdoToCscPrepDataToolCore::printPrepData() for (it_cscStripPrepData=cscColl->begin(); it_cscStripPrepData != cscColl->end(); ++it_cscStripPrepData) { icc++; ict++; - if (m_muonIdHelperTool->cscIdHelper().measuresPhi((*it_cscStripPrepData)->identify())) + if (m_idHelperSvc->cscIdHelper().measuresPhi((*it_cscStripPrepData)->identify())) iccphi++; else icceta++; ATH_MSG_INFO ( ict <<" in this coll. " << icc << " prepData id = " - << m_muonIdHelperTool->cscIdHelper().show_to_string((*it_cscStripPrepData)->identify()) ); + << m_idHelperSvc->cscIdHelper().show_to_string((*it_cscStripPrepData)->identify()) ); } ncoll++; ATH_MSG_INFO ( "*** Collection " << ncoll << " Summary: " diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h index e7e4be4887922a5dc0891ea93d1cfab86210f58f..b2938aecb068204cd966f71a6a8f4b16a3204b3c 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h @@ -1,25 +1,26 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCSC_CNVTOOLS_CSCRDOTOCSCPREPDATATOOLCORE_H #define MUONCSC_CNVTOOLS_CSCRDOTOCSCPREPDATATOOLCORE_H #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "MuonPrepRawData/CscStripPrepDataContainer.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" #include "CSCcabling/CSCcablingSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "CscCalibTools/ICscCalibTool.h" +#include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h" #include <string> namespace MuonGM { class MuonDetectorManager; } -class ICscCalibTool; class CscRawDataContainer; //////////////////////////////////////////////////////////////////////////////////////// /// Author: Ketevi A. Assamagan @@ -34,19 +35,13 @@ class CscRawDataContainer; //////////////////////////////////////////////////////////////////////////////////////// namespace Muon { - class IMuonRawDataProviderTool; - class ICSC_RDO_Decoder; class CscRdoToCscPrepDataToolCore : public AthAlgTool, virtual public IMuonRdoToPrepDataTool { public: - CscRdoToCscPrepDataToolCore(const std::string& type, const std::string& name, - const IInterface* parent); - - - /** destructor - */ - virtual ~CscRdoToCscPrepDataToolCore(); + CscRdoToCscPrepDataToolCore(const std::string& type, const std::string& name, const IInterface* parent); + + virtual ~CscRdoToCscPrepDataToolCore()=default; /** AlgTool InterfaceID */ @@ -54,7 +49,6 @@ namespace Muon { StatusCode initialize(); - StatusCode finalize(); virtual StatusCode decode(std::vector<IdentifierHash>& givenIdhs, std::vector<IdentifierHash>& decodedIdhs); //debugging void printPrepData(); @@ -70,11 +64,9 @@ namespace Muon { virtual StatusCode decode( const std::vector<uint32_t>& ) {return StatusCode::FAILURE;} /// Muon Detector Descriptor - const MuonGM::MuonDetectorManager * m_muonMgr; + const MuonGM::MuonDetectorManager* m_muonMgr; - /// CSC identifier helper - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /// CscStripPrepRawData containers Muon::CscStripPrepDataContainer* m_outputCollection; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx index a5bdab2fd641473e62f9f2f7764229ba8e543d1d..7abce82cec54115763c007eaa9a80a23c7cec85d 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx @@ -7,7 +7,6 @@ /// algorithm to decode RDO into PrepRawData -#include "MuonIdHelpers/CscIdHelper.h" #include "MuonReadoutGeometry/CscReadoutElement.h" #include "MuonRDO/CscRawData.h" #include "MuonRDO/CscRawDataCollection.h" @@ -135,7 +134,7 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(std::vector<IdentifierHash>& givenI StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoContainer, IdentifierHash givenHashId, std::vector<IdentifierHash>& decodedIdhs) { - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); // if CSC decoding is switched off stop here if( !m_decodeData ) { @@ -191,7 +190,7 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta ATH_MSG_DEBUG("CSC RDO ID " << rawCollection->identify() << " with hashID " << rawCollection->identifyHash() ); // Just use the first iterator entry as stationID does not change between data inside a single container Identifier stationId = m_cscRdoDecoderTool->stationIdentifier( (const CscRawData *)(*itD) ); - if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { ATH_MSG_WARNING ( "Unable to get CSC digiti collection hash id " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -230,14 +229,14 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId); //calculate local positions on the strip planes if ( !descriptor ) { - ATH_MSG_WARNING ( "Invalid descriptor for " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + ATH_MSG_WARNING ( "Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " Skipping channel " ); continue; } else if (!descriptor->containsId(channelId)) { ATH_MSG_WARNING ("Identifier from the cabling service <" - <<m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + <<m_idHelperSvc->cscIdHelper().show_to_string(channelId) <<"> inconsistent with the geometry of detector element <" - <<m_muonIdHelperTool->cscIdHelper().show_to_string(descriptor->identify()) + <<m_idHelperSvc->cscIdHelper().show_to_string(descriptor->identify()) <<"> =>>ignore this hit"); continue; } @@ -253,7 +252,7 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta } IdentifierHash stripHash; - if (m_muonIdHelperTool->cscIdHelper().get_channel_hash(channelId, stripHash)) { + if (m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, stripHash)) { ATH_MSG_WARNING ( "Unable to get CSC strip hash id"); channelId.show(); } @@ -265,16 +264,16 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta continue; } if ( samples.size() >=4 ) - ATH_MSG_DEBUG ( "ADC: " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + ATH_MSG_DEBUG ( "ADC: " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " " << samples[0] << " " << samples[1] << " " << samples[2] << " " << samples[3] << " Charges: " << " " << charges[0] << " " << charges[1] << " " << charges[2] << " " << charges[3] ); - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(channelId); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(channelId); Amg::Vector2D localWirePos1( descriptor->xCoordinateInTrackingFrame(channelId ),0.); - int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(channelId); + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(channelId); float stripWidth = descriptor->cathodeReadoutPitch( chamberLayer, measuresPhi ); double errPos = stripWidth / sqrt(12.0); @@ -317,7 +316,7 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta typedef CscRawDataContainer::const_iterator collection_iterator; - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); // if CSC decoding is switched off stop here if( !m_decodeData ) { @@ -359,7 +358,7 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta ATH_MSG_DEBUG("CSC RDO ID " << (*rdoColl)->identify() << " with hashID " << (*rdoColl)->identifyHash() ); // Just use the first iterator entry as stationID does not change between data inside a single container Identifier stationId = m_cscRdoDecoderTool->stationIdentifier( (const CscRawData *)(*itD) ); - if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { ATH_MSG_WARNING ( "Unable to get CSC digiti collection hash id " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -398,15 +397,15 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId); //calculate local positions on the strip planes if ( !descriptor ) { - ATH_MSG_WARNING ( "Invalid descriptor for " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + ATH_MSG_WARNING ( "Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " Skipping channel " ); continue; } else if (!descriptor->containsId(channelId)) { ATH_MSG_WARNING ("Identifier from the cabling service <" - <<m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + <<m_idHelperSvc->cscIdHelper().show_to_string(channelId) <<"> inconsistent with the geometry of detector element <" - <<m_muonIdHelperTool->cscIdHelper().show_to_string(descriptor->identify()) + <<m_idHelperSvc->cscIdHelper().show_to_string(descriptor->identify()) <<"> =>>ignore this hit"); continue; } @@ -422,14 +421,14 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta } IdentifierHash stripHash; - if (m_muonIdHelperTool->cscIdHelper().get_channel_hash(channelId, stripHash)) { + if (m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, stripHash)) { ATH_MSG_WARNING ( "Unable to get CSC strip hash id"); channelId.show(); } Identifier channelIdFromHash; - m_muonIdHelperTool->cscIdHelper().get_id(stripHash, channelIdFromHash, &cscContext); + m_idHelperSvc->cscIdHelper().get_id(stripHash, channelIdFromHash, &cscContext); bool adctocharge = m_cscCalibTool->adcToCharge(samples, stripHash, charges); @@ -439,13 +438,13 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta continue; } if ( samples.size() >=4 ) - ATH_MSG_DEBUG ( "DecodeAll*** ADC: " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) << " " + ATH_MSG_DEBUG ( "DecodeAll*** ADC: " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " " << (int) stripHash << " " - << m_muonIdHelperTool->cscIdHelper().show_to_string(channelIdFromHash) + << m_idHelperSvc->cscIdHelper().show_to_string(channelIdFromHash) << " " << samples[0] << " " << samples[1] << " " << samples[2] << " " << samples[3] << " Charges: " << " " << charges[0] << " " << charges[1] << " " << charges[2] << " " << charges[3] ); - if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { ATH_MSG_WARNING ( "Unable to get CSC hash id from CSC RDO collection " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -466,12 +465,12 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta } if (IsThisStripDecoded) continue; - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(channelId); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(channelId); Amg::Vector2D localWirePos1( descriptor->xCoordinateInTrackingFrame(channelId ),0.); - int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(channelId); + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(channelId); float stripWidth = descriptor->cathodeReadoutPitch( chamberLayer, measuresPhi ); double errPos = stripWidth / sqrt(12.0); diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCnv_p1_test.cxx index dad2128062fda600e02e0ab591cf399656eb0969..870a33a2998fcf5b5ce5a3bdc4e2b07413148586 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCnv_p2_test.cxx index 1a30c5f76f99ff0b98fc6c9b2f41e0a112162e0c..b5ce72e597d9bbb057262c5bf2f62c1d308e1010 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCnv_p2_test.cxx @@ -19,8 +19,8 @@ #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCollectionCnv_p1_test.cxx index 6f48a617c144f61f86299a8b2e233280eab15ae2..5198de86e1ad459f58d748510aa3850ea9a6e807 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCollectionCnv_p1_test.cxx @@ -19,8 +19,8 @@ #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCollectionCnv_p2_test.cxx index 8a6a88634795450af30f0ffe57f2c9e44f23ab5b..67e4810d18a965ef533dab479b29c1ac3a011380 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscSimDataCollectionCnv_p2_test.cxx @@ -19,8 +19,8 @@ #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCnv_p1_test.cxx index 4013457cc4bf96a9a5f166ac841fcb8c75ae4a6c..2906f2f7cb7d28453e7085c43ce247116fe86f85 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCnv_p1_test.cxx @@ -19,8 +19,8 @@ #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCnv_p2_test.cxx index b5a8e95a730541e634c5a679c40afac0e08d18e2..f5d5414379f823210e9ef1439124a03556026172 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCnv_p2_test.cxx @@ -19,8 +19,8 @@ #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCollectionCnv_p1_test.cxx index 0cbe905b0efa439541f8fcc0105ceeb2d3ecb959..0322e37738cf2129ba5f66ab2ad29bee7bee933d 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCollectionCnv_p1_test.cxx @@ -19,8 +19,8 @@ #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCollectionCnv_p2_test.cxx index bda5460d5a6955d3938048b668486b3fe992d584..254f3d286e67292f5847725815b8d465ec3b4e19 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MuonSimDataCollectionCnv_p2_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/CMakeLists.txt index 81e369cf1de4208572c7f31803beb3de770bfe93..6649809bc859bce1909d521aeaf1d41383070cc2 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/CMakeLists.txt @@ -21,16 +21,16 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces MuonSpectrometer/MuonSimData Tracking/TrkEvent/TrkEventPrimitives - Tracking/TrkTools/TrkToolInterfaces ) + Tracking/TrkTools/TrkToolInterfaces + Generators/AtlasHepMC ) # External dependencies: find_package( Eigen ) -find_package( HepMC ) # Component(s) in the package: atlas_add_component( MuonPrepRawDataToxAOD src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps GeoPrimitives Identifier EventPrimitives xAODTracking MuonIdHelpersLib MuonRDO MuonPrepRawData MuonRIO_OnTrack MuonRecToolInterfaces MuonSimData TrkEventPrimitives TrkToolInterfaces ) + INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${EIGEN_LIBRARIES} AtlasHepMCLib GaudiKernel AthenaBaseComps GeoPrimitives Identifier EventPrimitives xAODTracking MuonIdHelpersLib MuonRDO MuonPrepRawData MuonRIO_OnTrack MuonRecToolInterfaces MuonSimData TrkEventPrimitives TrkToolInterfaces ) diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/MuonPrepDataToxAOD.h b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/MuonPrepDataToxAOD.h index 009e7d487a91511b2c720755b918c24773af0420..03c77cebecd45e2419382610c5f3c15a562ae616 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/MuonPrepDataToxAOD.h +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/MuonPrepDataToxAOD.h @@ -24,7 +24,7 @@ #include "EventPrimitives/EventPrimitives.h" #include "EventPrimitives/EventPrimitivesHelpers.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "Identifier/Identifier.h" #include "Identifier/IdentifierHash.h" diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.cxx index 8b12361c8ea2691e66a4be40be58a8a6319d3b9e..42ffd08feaec314090775c851eba1926e1ead9cb 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.cxx @@ -19,10 +19,6 @@ Muon::sTgcRdoToPrepDataTool::sTgcRdoToPrepDataTool(const std::string& t, { } -Muon::sTgcRdoToPrepDataTool::~sTgcRdoToPrepDataTool() -{ -} - StatusCode Muon::sTgcRdoToPrepDataTool::initialize() { ATH_MSG_VERBOSE("Starting init"); @@ -31,11 +27,6 @@ StatusCode Muon::sTgcRdoToPrepDataTool::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::sTgcRdoToPrepDataTool::finalize() -{ - return sTgcRdoToPrepDataToolCore::finalize(); -} - Muon::sTgcRdoToPrepDataToolCore::SetupSTGC_PrepDataContainerStatus Muon::sTgcRdoToPrepDataTool::setupSTGC_PrepDataContainer() { @@ -43,7 +34,7 @@ Muon::sTgcRdoToPrepDataToolCore::SetupSTGC_PrepDataContainerStatus Muon::sTgcRdo m_fullEventDone=false; SG::WriteHandle< Muon::sTgcPrepDataContainer > handle(m_stgcPrepDataContainerKey); - StatusCode status = handle.record(std::make_unique<Muon::sTgcPrepDataContainer>(m_muonIdHelperTool->stgcIdHelper().module_hash_max())); + StatusCode status = handle.record(std::make_unique<Muon::sTgcPrepDataContainer>(m_idHelperSvc->stgcIdHelper().module_hash_max())); if (status.isFailure() || !handle.isValid() ) { ATH_MSG_FATAL("Could not record container of STGC PrepData Container at " << m_stgcPrepDataContainerKey.key()); diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.h index 1d6501bb2c817cb373ab9b924e409f9f08d0d278..20efd765bad9cebe55544c994a3d15e4a8d8ffa8 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.h @@ -1,39 +1,14 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// sTgcRdoToPrepDataTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef MUONTGC_CNVTOOLS_STGCRDOTOPREPDATATOOL #define MUONTGC_CNVTOOLS_STGCRDOTOPREPDATATOOL #include "sTgcRdoToPrepDataToolCore.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" -#include <string> - -#include "GaudiKernel/ToolHandle.h" -#include "MuonRDO/STGC_RawDataContainer.h" -#include "MuonPrepRawData/sTgcPrepDataContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class AtlasDetectorID; -class Identifier; - -class ITGCcablingSvc; - -namespace MuonGM -{ - class TgcReadoutElement; -} - namespace Muon { - class IMuonRawDataProviderTool; - class ISTgcClusterBuilderTool; - /** @class STGC_RawDataToPrepDataTool * This is the algorithm that convert STGC Raw data To STGC PRD as a tool. */ @@ -45,12 +20,10 @@ namespace Muon sTgcRdoToPrepDataTool(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~sTgcRdoToPrepDataTool(); + virtual ~sTgcRdoToPrepDataTool()=default; /** Standard AthAlgTool initialize method */ virtual StatusCode initialize() override; - /** Standard AthAlgTool finalize method */ - virtual StatusCode finalize() override; protected: virtual SetupSTGC_PrepDataContainerStatus setupSTGC_PrepDataContainer() override; diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx index c960e52c783fcac433061a12f75ee6337805f3fa..e653acafb4468a9bbf72340efdf6cf45f1e72a9a 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx @@ -3,12 +3,7 @@ */ #include "sTgcRdoToPrepDataToolCore.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/PropertyMgr.h" -#include "MuonIdHelpers/sTgcIdHelper.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/MuonIdHelper.h" + #include "MuonReadoutGeometry/MuonStation.h" #include "MuonReadoutGeometry/sTgcReadoutElement.h" @@ -18,7 +13,7 @@ using namespace Muon; Muon::sTgcRdoToPrepDataToolCore::sTgcRdoToPrepDataToolCore(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_muonMgr(0), + m_muonMgr(nullptr), m_fullEventDone(false), m_stgcPrepDataContainer(0), m_clusterBuilderTool("Muon::SimpleSTgcClusterBuilderTool/SimpleSTgcClusterBuilderTool",this) @@ -37,32 +32,17 @@ Muon::sTgcRdoToPrepDataToolCore::sTgcRdoToPrepDataToolCore(const std::string& t, StatusCode Muon::sTgcRdoToPrepDataToolCore::initialize() { ATH_MSG_DEBUG(" in initialize()"); - /// get the detector descriptor manager - StatusCode sc = detStore()->retrieve( m_muonMgr ); - if (sc.isFailure()) { - ATH_MSG_FATAL(" Cannot retrieve MuonReadoutGeometry "); - return sc; - } - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(detStore()->retrieve(m_muonMgr)); + ATH_CHECK( m_idHelperSvc.retrieve() ); // check if the initialization of the data container is success ATH_CHECK(m_stgcPrepDataContainerKey.initialize()); - ATH_CHECK(m_rdoContainerKey.initialize()); - - ATH_MSG_INFO("initialize() successful in " << name()); return StatusCode::SUCCESS; } -StatusCode Muon::sTgcRdoToPrepDataToolCore::finalize() -{ - return StatusCode::SUCCESS; - -} - StatusCode Muon::sTgcRdoToPrepDataToolCore::processCollection(const STGC_RawDataCollection *rdoColl, std::vector<IdentifierHash>& idWithDataVect) { @@ -83,9 +63,9 @@ StatusCode Muon::sTgcRdoToPrepDataToolCore::processCollection(const STGC_RawData idWithDataVect.push_back(hash); // set the offline identifier of the collection Id - IdContext context = m_muonIdHelperTool->stgcIdHelper().module_context(); + IdContext context = m_idHelperSvc->stgcIdHelper().module_context(); Identifier moduleId; - int getId = m_muonIdHelperTool->stgcIdHelper().get_id(hash,moduleId,&context); + int getId = m_idHelperSvc->stgcIdHelper().get_id(hash,moduleId,&context); if ( getId != 0 ) { ATH_MSG_ERROR("Could not convert the hash Id: " << hash << " to identifier"); } @@ -126,8 +106,8 @@ StatusCode Muon::sTgcRdoToPrepDataToolCore::processCollection(const STGC_RawData } // get the resolution from strip width - const int gasGap = m_muonIdHelperTool->stgcIdHelper().gasGap(rdoId); - const int channel = m_muonIdHelperTool->stgcIdHelper().channel(rdoId); + const int gasGap = m_idHelperSvc->stgcIdHelper().gasGap(rdoId); + const int channel = m_idHelperSvc->stgcIdHelper().channel(rdoId); const int charge = (int) rdo->charge(); const int rdoTime = (int) rdo->time(); @@ -137,7 +117,7 @@ StatusCode Muon::sTgcRdoToPrepDataToolCore::processCollection(const STGC_RawData // next update double width = 0.; - int channelType = m_muonIdHelperTool->stgcIdHelper().channelType(rdoId); + int channelType = m_idHelperSvc->stgcIdHelper().channelType(rdoId); ATH_MSG_DEBUG("Adding a new STGC PRD, gasGap: " << gasGap << " channel: " << channel << " type: " << channelType ); @@ -281,7 +261,7 @@ Muon::sTgcRdoToPrepDataToolCore::SetupSTGC_PrepDataContainerStatus Muon::sTgcRdo m_fullEventDone=false; SG::WriteHandle< Muon::sTgcPrepDataContainer > handle(m_stgcPrepDataContainerKey); - StatusCode status = handle.record(std::make_unique<Muon::sTgcPrepDataContainer>(m_muonIdHelperTool->stgcIdHelper().module_hash_max())); + StatusCode status = handle.record(std::make_unique<Muon::sTgcPrepDataContainer>(m_idHelperSvc->stgcIdHelper().module_hash_max())); if (status.isFailure() || !handle.isValid() ) { ATH_MSG_FATAL("Could not record container of STGC PrepData Container at " << m_stgcPrepDataContainerKey.key()); diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.h index d246c9618fe31a3aff58bd339265d0c38864a1d8..92544584ef1016a7023fb0b65a21daeeec1f7540 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.h @@ -6,19 +6,16 @@ #define MUONTGC_CNVTOOLS_STGCRDOTOPREPDATATOOLCORE #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" -#include <string> -#include "GaudiKernel/ToolHandle.h" #include "MuonRDO/STGC_RawDataContainer.h" #include "MuonPrepRawData/sTgcPrepDataContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "STgcClusterization/ISTgcClusterBuilderTool.h" -class AtlasDetectorID; -class Identifier; - -class ITGCcablingSvc; +#include <string> namespace MuonGM { @@ -43,8 +40,6 @@ namespace Muon /** Standard AthAlgTool initialize method */ virtual StatusCode initialize() override; - /** Standard AthAlgTool finalize method */ - virtual StatusCode finalize() override; /** Decode RDO to PRD * A vector of IdentifierHash are passed in, and the data corresponding to this list (i.e. in a Region of Interest) are converted. @@ -79,11 +74,9 @@ namespace Muon void processRDOContainer(std::vector<IdentifierHash>& idWithDataVect); /** muon detector manager */ - const MuonGM::MuonDetectorManager * m_muonMgr; + const MuonGM::MuonDetectorManager* m_muonMgr; - /** TGC identifier helper */ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; bool m_fullEventDone; diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx index c0f744e0ecb67a7492a6c1ed6fc54a878aa7f63d..56181c8d941a59aaa3bf1dabeda1e36f6120c3a7 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx @@ -19,10 +19,6 @@ Muon::sTgcRdoToPrepDataToolMT::sTgcRdoToPrepDataToolMT(const std::string& t, { } -Muon::sTgcRdoToPrepDataToolMT::~sTgcRdoToPrepDataToolMT() -{ -} - StatusCode Muon::sTgcRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); @@ -31,11 +27,6 @@ StatusCode Muon::sTgcRdoToPrepDataToolMT::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::sTgcRdoToPrepDataToolMT::finalize() -{ - return sTgcRdoToPrepDataToolCore::finalize(); -} - Muon::sTgcRdoToPrepDataToolCore::SetupSTGC_PrepDataContainerStatus Muon::sTgcRdoToPrepDataToolMT::setupSTGC_PrepDataContainer() { @@ -43,7 +34,7 @@ Muon::sTgcRdoToPrepDataToolCore::SetupSTGC_PrepDataContainerStatus Muon::sTgcRdo m_fullEventDone=false; SG::WriteHandle< Muon::sTgcPrepDataContainer > handle(m_stgcPrepDataContainerKey); - StatusCode status = handle.record(std::make_unique<Muon::sTgcPrepDataContainer>(m_muonIdHelperTool->stgcIdHelper().module_hash_max())); + StatusCode status = handle.record(std::make_unique<Muon::sTgcPrepDataContainer>(m_idHelperSvc->stgcIdHelper().module_hash_max())); if (status.isFailure() || !handle.isValid() ) { ATH_MSG_FATAL("Could not record container of STGC PrepData Container at " << m_stgcPrepDataContainerKey.key()); diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.h index 786cd133730f47e773bc56adfaa8ea5b818a4afd..002f58410bfa16e544c7c92630a97598d7101663 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.h @@ -1,40 +1,14 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// sTgcRdoToPrepDataToolMT.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef MUONTGC_CNVTOOLS_STGCRDOTOPREPDATATOOLMT #define MUONTGC_CNVTOOLS_STGCRDOTOPREPDATATOOLMT #include "sTgcRdoToPrepDataToolCore.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" -#include <string> - -#include "GaudiKernel/ToolHandle.h" -#include "MuonRDO/STGC_RawDataContainer.h" -#include "MuonPrepRawData/sTgcPrepDataContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class AtlasDetectorID; -class Identifier; - -class ITGCcablingSvc; - -namespace MuonGM -{ - class MuonDetectorManager; - class TgcReadoutElement; -} - namespace Muon { - class IMuonRawDataProviderTool; - class ISTgcClusterBuilderTool; - /** @class STGC_RawDataToPrepDataTool * This is the algorithm that convert STGC Raw data To STGC PRD as a tool. */ @@ -46,12 +20,10 @@ namespace Muon sTgcRdoToPrepDataToolMT(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~sTgcRdoToPrepDataToolMT(); + virtual ~sTgcRdoToPrepDataToolMT()=default; /** Standard AthAlgTool initialize method */ virtual StatusCode initialize() override; - /** Standard AthAlgTool finalize method */ - virtual StatusCode finalize() override; protected: virtual SetupSTGC_PrepDataContainerStatus setupSTGC_PrepDataContainer() override; diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx index eab8744c11246e9b8dfdab8ede3fbaa3ca6dbaa2..74581857e190053df5061eea0e70514030ab43d1 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx index 5b16c50c5bdc9b196fe9322169f4a8dd4780e922..d34e3181f178c75b87c5304534462371c7762684 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx index 25addc7f0293e85dee192c53f84a885504f09059..d51aceac5cbb8f8c94e0666b252f1b1978d874c6 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx index c6af7c665391ad7bc2a838fbf92a7becd4f823eb..b589febcc606cd79c74f1b8438f5c985c5db0690 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p2_test.cxx index ca40dd29e9b50ec18ad32f4ee100d5e8312d1bd7..bdbc5fea4a4178471cfce0d7d422c229265cb1db 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p2_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, const HepMcParticleLink& p2) diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx index ca4d16d12f6f725f9049a08ee284183edd511434..6974a3d2d7690a5b7d19f41ba3a76e2b69cc97c9 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx index a5ff003523f4b5e509a7e7336ab7499fbcf11b15..707804a41465c8c30bc50b4e40be22fe20b03181 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx index 9aaea2e3d299cd64d256a7194e6c8cc039d71149..f950056fef192bdbb3a701178bd1480ddd5dc584 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p1_test.cxx index 70345e4854a4f0248c1d4de16253d6271c953366..e603cdd6dac158af75be82fc9328658bde27dd32 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p1_test.cxx @@ -9,8 +9,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p2_test.cxx index 6a34ed6d855eb5e7663a2d7b208879728af2372d..61e692d54997052c6f0278dd0ef61768bc61d7d0 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p2_test.cxx @@ -9,8 +9,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, const HepMcParticleLink& p2) diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx index b674908b80536f89444593590371f5f454b08028..75bff7a15b74d7ad237c54218e4143eccf5ef86a 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx index d4d4a66e1a6397cdf2508076c82d20ff79f1bd16..c6405032b2ada47e60c034dc1a18870f3695330e 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx index f9e0b39b12329ad48071489467948a2870d6a9b5..d29f0905b5de2a765de6745ded524be328c864a5 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx index 88da4f2b7b12f27ea751a162aba06c1b01081dd5..ca1b9ed7cb6b9dc5fc95b0e9de50145c3c9eb41b 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx index 9a75089345e8d48adb8d09b8e0eb9b9309af0762..8e14145a1e51e67da76df430f6a89f372a0b53bd 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx index e81dceff1a47057a602fd16ab08232c711fac8e8..5193bd46e0472a481d2dd1cb67b2d93f8268608e 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx index d2994015bcb234fee30d2f71c737a714eb6a42d8..3e4d844d365aaa02301e7e8644b5e6450e28c78c 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx index 7db92b3901bb47ee400bee2684c29d1135c11cf7..cf56cf2bdaf04b0b7e2e6caa006aed4b66625ff8 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, const HepMcParticleLink& p2) diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx index 0fbca4423c99526b4118f93cc2847e5e1d79ebcf..b72c98bad9e32963ddd72969ab09d3b74fce15b9 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx @@ -26,8 +26,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" void compare (const HepMcParticleLink& p1, const HepMcParticleLink& p2) diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/share/TgcPrepDataReplicationAlg_jopOptions.py b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/share/TgcPrepDataReplicationAlg_jopOptions.py index a7d0060b7f82be350598dfd5bbffaacc1681dac6..bafb2dd00bf947af125bd5b22cd26931c0f6dfad 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/share/TgcPrepDataReplicationAlg_jopOptions.py +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/share/TgcPrepDataReplicationAlg_jopOptions.py @@ -1,11 +1,12 @@ include.block ("MuonTGC_CnvTools/TgcPrepDataReplicationAlg_jopOptions.py") # Muon::TgcPrepDataReplicationTool -from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcPrepDataReplicationTool -TgcPrepDataReplicationTool = Muon__TgcPrepDataReplicationTool("Muon::TgcPrepDataReplicationTool") -ToolSvc += TgcPrepDataReplicationTool +from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcPrepDataReplicationToolAllBCto3BC +TgcPrepDataReplicationToolAllBCto3BC = Muon__TgcPrepDataReplicationToolAllBCto3BC("Muon::TgcPrepDataReplicationTool") +ToolSvc += TgcPrepDataReplicationToolAllBCto3BC # Muon::TgcPrepDataReplicationAlg from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcPrepDataReplicationAlg TgcPrepDataReplicationAlg = Muon__TgcPrepDataReplicationAlg("Muon::TgcPrepDataReplicationAlg") +TgcPrepDataReplicationAlg.Tool = TgcPrepDataReplicationToolAllBCto3BC topSequence += TgcPrepDataReplicationAlg diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStreamData.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStreamData.h index 825709399017a6526d65a30707c1766c54fdf73f..d722b8ae22f2ea9060bdaa2f0382cb1af2174463 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStreamData.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStreamData.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONTGC_CNVTOOLS_TGCBYTESTREAMDATA_H @@ -181,6 +181,140 @@ struct TGC_BYTESTREAM_SL TGC_BYTESTREAM_SL() { memset(this, 0, sizeof(*this)); } }; +/**********************/ +/** structs for NewSL */ +/**********************/ + +struct TGC_BYTESTREAM_NSL_ROI +{ + unsigned roi: 8; + unsigned pt: 4; + unsigned charge: 1; + unsigned nswcoin: 3; + unsigned flags: 4; + unsigned fill1: 2; + unsigned bcBitmap: 2; + unsigned sector: 4; + unsigned fwd: 1; + unsigned type: 3; + + TGC_BYTESTREAM_NSL_ROI() { memset(this, 0, sizeof(*this)); } +}; + +struct TGC_BYTESTREAM_NSW_POS +{ + unsigned monitor: 1; + unsigned eta: 8; + unsigned phi: 6; + unsigned fill1: 2; + unsigned input: 3; + unsigned cand: 2; + unsigned fill2: 2; + unsigned sector: 4; + unsigned fwd: 1; + unsigned type: 3; + + TGC_BYTESTREAM_NSW_POS() { memset(this, 0, sizeof(*this)); } +}; + +struct TGC_BYTESTREAM_NSW_ANG +{ + unsigned angle: 5; + unsigned phires: 1; + unsigned lowres: 1; + unsigned fill1: 2; + unsigned nswid: 4; + unsigned bcid: 4; + unsigned input: 3; + unsigned cand: 2; + unsigned bcBitmap: 2; + unsigned sector: 4; + unsigned fwd: 1; + unsigned type: 3; + + TGC_BYTESTREAM_NSW_ANG() { memset(this, 0, sizeof(*this)); } +}; + +struct TGC_BYTESTREAM_RPCBIS78_POS +{ + unsigned eta: 6; + unsigned phi: 6; + unsigned fill1: 8; + unsigned cand: 2; + unsigned fill2: 2; + unsigned sector: 4; + unsigned fwd: 1; + unsigned type: 3; + + TGC_BYTESTREAM_RPCBIS78_POS() { memset(this, 0, sizeof(*this)); } +}; +struct TGC_BYTESTREAM_RPCBIS78_COIN +{ + unsigned fill1: 4; + unsigned flag: 2; + unsigned dphi: 3; + unsigned deta: 3; + unsigned fill2: 1; + unsigned bcid: 4; + unsigned fill3: 3; + unsigned cand: 2; + unsigned bcBitmap: 2; + unsigned sector: 4; + unsigned fwd: 1; + unsigned type: 3; + + TGC_BYTESTREAM_RPCBIS78_COIN() { memset(this, 0, sizeof(*this)); } +}; + +struct TGC_BYTESTREAM_NSL_EIFI +{ + unsigned ei: 8; + unsigned fi: 8; + unsigned fill1: 6; + unsigned bcBitmap: 2; + unsigned sector: 4; + unsigned fwd: 1; + unsigned type: 3; + + TGC_BYTESTREAM_NSL_EIFI() { memset(this, 0, sizeof(*this)); } +}; + +struct TGC_BYTESTREAM_NSL_HIPT +{ + signed delta: 5; + unsigned sub: 1; + unsigned hitId: 3; + unsigned hipt: 1; + unsigned cand: 1; + unsigned chip: 2; + unsigned strip: 1; + unsigned fill1: 8; + unsigned bcBitmap: 2; + unsigned sector: 4; + unsigned fwd: 1; + unsigned type: 3; + + TGC_BYTESTREAM_NSL_HIPT() { memset(this, 0, sizeof(*this)); } +}; + +struct TGC_BYTESTREAM_NSL_TMDB +{ + unsigned module: 12; + unsigned bcid: 4; + unsigned fill1: 6; + unsigned bcBitmap: 2; + unsigned sector: 4; + unsigned fwd: 1; + unsigned type: 3; + + TGC_BYTESTREAM_NSL_TMDB() { memset(this, 0, sizeof(*this)); } +}; + +/*****************************/ +/** end of structs for NewSL */ +/*****************************/ + + template <typename DEST, typename SRC> DEST* my_pointer_cast(SRC* src) { void* ptr = src; return reinterpret_cast<DEST*>(ptr); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.cxx index 6321d4e7d9702155db84f6b607217c66589172e9..bc0116977eeebd31622e0a7e39abef61802bbfb2 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.cxx @@ -7,7 +7,7 @@ namespace Muon { TgcPrepDataReplicationAlg::TgcPrepDataReplicationAlg(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), m_tool("Muon::TgcPrepDataReplicationTool") + : AthAlgorithm(name, pSvcLocator) { } diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.h index c6554ad88804d2f853a2c84085afdc472e05ddd7..513e6b2070b2876d505627f68f20846bb5a4317e 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.h @@ -23,7 +23,7 @@ namespace Muon private: /** ITgcPrepDataReplicationTool.h */ - ToolHandle<ITgcPrepDataReplicationTool> m_tool; + ToolHandle<ITgcPrepDataReplicationTool> m_tool{this, "Tool", "Muon::TgcPrepDataReplicationTool"}; }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx index 5199e30dfc8d62745600a1bb4f6e810b075be9c3..667196766c12f5c6c4bc9fc8da5f61f70ed14121 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx @@ -55,7 +55,7 @@ StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::initialize() } ATH_CHECK(m_3BCKeys.initialize()); - + ATH_CHECK(m_AllBCKey.initialize()); return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx index 0edffc60e250783f4ae080facdc7380de94021b8..5aa8854c9237f3364eb6d04acc54508ee5ff8cd5 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx @@ -4,7 +4,6 @@ #include "RPC_CondCabling/RpcCablingCondAlg.h" - RpcCablingCondAlg::RpcCablingCondAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_ConfMapPString(nullptr), @@ -14,30 +13,25 @@ RpcCablingCondAlg::RpcCablingCondAlg(const std::string& name, ISvcLocator* pSvcL m_condSvc("CondSvc",name) { declareProperty( "CosmicConfiguration", m_cosmic_configuration=false ); - declareProperty("ApplyFeetPadThresholds", m_ApplyFeetPadThresholds=true, - "map 3 low pt thresholds from special feet pads on standard 6 (3low+3high)"); - // declareProperty( "RPCTriggerRoadsfromCool",m_RPCTriggerRoadsfromCool=false) + declareProperty("ApplyFeetPadThresholds", m_ApplyFeetPadThresholds=true, "map 3 low pt thresholds from special feet pads on standard 6 (3low+3high)"); declareProperty("ForceFeetPadThresholdsFromJO", m_ForceFeetPadThresholdsFromJO=false, "JO override db setting"); } StatusCode RpcCablingCondAlg::initialize() { ATH_MSG_DEBUG( "initializing" << name() ); - // CondSvc ATH_CHECK( m_condSvc.retrieve() ); - // Read CondHandles ATH_CHECK( m_readKey_map_schema.initialize() ); ATH_CHECK( m_readKey_map_schema_corr.initialize() ); ATH_CHECK( m_readKey_cm_thr_eta.initialize() ); ATH_CHECK( m_readKey_cm_thr_phi.initialize() ); - // Register write CondHandle ATH_CHECK( m_writeKey.initialize() ); if(m_condSvc->regHandle(this, m_writeKey).isFailure()) { ATH_MSG_ERROR("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc"); return StatusCode::FAILURE; } - ATH_CHECK(m_idHelperSvc.retrieve()); + RDOindex::setRpcIdHelper(&m_idHelperSvc->rpcIdHelper()); return StatusCode::SUCCESS; } @@ -259,8 +253,10 @@ StatusCode RpcCablingCondAlg::ReadConf() ATH_MSG_DEBUG("--- ReadConf: map has size " << m_ConfMapPString->size() ); ATH_MSG_DEBUG("--- ReadConf: m_MaxType of types is " << m_MaxType ); - if(m_ConfMapPString==nullptr) + if(!m_ConfMapPString) { + ATH_MSG_ERROR("Pointer to cabling map not set"); return StatusCode::FAILURE; + } std::stringstream MAP; MAP.str(*m_ConfMapPString); @@ -500,7 +496,10 @@ StatusCode RpcCablingCondAlg::buildRDOmap(RpcCablingCondData* writeCdo) ++hashID; // get pointer to RDOindex class writeCdo->m_HashVec.push_back(pRDOindex); - if( writeCdo->m_HashVec.size() != pRDOindex->hash()+1 ) return StatusCode::FAILURE; + if( writeCdo->m_HashVec.size() != pRDOindex->hash()+1 ) { + ATH_MSG_ERROR("Size of hash vector and RDO hash does not match"); + return StatusCode::FAILURE; + } // calculate m_fullListOfRobIds const unsigned short int rob_id = pRDOindex->ROBid(); @@ -526,8 +525,10 @@ StatusCode RpcCablingCondAlg::buildRDOmap(RpcCablingCondData* writeCdo) std::pair < RpcCablingCondData::OfflineOnlineMap::iterator, bool> ins = writeCdo->m_RDOmap.insert( RpcCablingCondData::OfflineOnlineMap::value_type(id,pRDOindex)); ATH_MSG_DEBUG("OfflineOnlineMap new entry: value "<< m_idHelperSvc ->rpcIdHelper().show_to_string(id) << "hash of the RDOindex (key) = " << pRDOindex->hash()); - if(!ins.second) return StatusCode::FAILURE; - + if(!ins.second) { + ATH_MSG_ERROR("RpcCablingCondData::OfflineOnlineMap is false for value "<< m_idHelperSvc->rpcIdHelper().show_to_string(id) << " and hash of the RDOindex (key) = " << pRDOindex->hash()); + return StatusCode::FAILURE; + } //build the PRD->RDO and PRD->ROB maps ATH_MSG_VERBOSE("Looking for PRDs corresponding to this RDO"); @@ -682,28 +683,27 @@ StatusCode RpcCablingCondAlg::buildRDOmap(RpcCablingCondData* writeCdo) // record if (writeCdo->m_RDOs.empty()) { - ATH_MSG_DEBUG("Could not read any map configuration"); + ATH_MSG_ERROR("Could not read any map configuration"); return StatusCode::FAILURE; } if (writeCdo->m_HashVec.empty()) { - ATH_MSG_DEBUG("Could not read any HashID"); + ATH_MSG_ERROR("Could not read any HashID"); return StatusCode::FAILURE; } if (writeCdo->m_SectorType.empty()) { - ATH_MSG_DEBUG("Could not read any m_SectorMap"); + ATH_MSG_ERROR("Could not read any m_SectorMap"); return StatusCode::FAILURE; } if (writeCdo->m_int2id.empty()) { - ATH_MSG_DEBUG("Could not read any HashID"); + ATH_MSG_ERROR("Could not read any HashID"); return StatusCode::FAILURE; } if (writeCdo->m_lookup.empty()) { - ATH_MSG_DEBUG("Could not read any HashID"); + ATH_MSG_ERROR("Could not read any HashID"); return StatusCode::FAILURE; } - if (writeCdo->m_fullListOfRobIds.empty()) { - ATH_MSG_DEBUG("Could not read any HashID"); + ATH_MSG_ERROR("Could not read any HashID"); return StatusCode::FAILURE; } return StatusCode::SUCCESS; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/SectorLogicSetup.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/SectorLogicSetup.cxx index c4b89c774eea06d729ed3f579eaa5c36597bd518..edd6bf13164aac8596aca1ecd4d5d6c3b4006aaf 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/SectorLogicSetup.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/SectorLogicSetup.cxx @@ -1017,40 +1017,31 @@ std::ostream& operator<<(std::ostream& stream,const SectorLogicSetup& setup) bool -SectorLogicSetup::operator+=(RPCchamberdata& data) -{ - while(RPCchamber* cham = data.give_rpc()) - { +SectorLogicSetup::operator+=(RPCchamberdata& data) { + while(RPCchamber* cham = data.give_rpc()) { int key = data.station()*100; - std::pair < RPCmap::iterator, bool> ins = - m_RPCs.insert(RPCmap::value_type(key + cham->number(),*cham)); + std::pair < RPCmap::iterator, bool> ins = m_RPCs.insert(RPCmap::value_type(key + cham->number(),*cham)); - RPCmap::iterator lower = m_RPCs.lower_bound(key); - RPCmap::iterator upper = m_RPCs.upper_bound(key+99); + RPCmap::iterator lower = m_RPCs.lower_bound(key); + RPCmap::iterator upper = m_RPCs.upper_bound(key+99); RPCmap::iterator current = (ins.first); - if (ins.second) - { - if (current != lower ) --current; - while (current != upper ) - { - int div = ((*current).second.number())? 1 : 2; - int eta_st = (*current).second.eta_strips()/div; + if (ins.second) { + if (current != lower ) --current; + while (current != upper ) { + int div = ((*current).second.number())? 1 : 2; + int eta_st = (*current).second.eta_strips()/div; int eta_st_of = (*current).second.eta_strip_global()/div; int eta_co = (*current).second.eta_connectors()/div; int eta_co_of = (*current).second.eta_conn_global()/div; - - current++; - if (current != m_RPCs.end()) - { - (*current).second.set_eta_st_global(eta_st + eta_st_of); + current++; + if (current != m_RPCs.end()) { + (*current).second.set_eta_st_global(eta_st + eta_st_of); (*current).second.set_eta_co_global(eta_co + eta_co_of); - } - } - } - else - { - DISP <<"Error in inserting chamber:" << std::endl + } + } + } else { + DISP <<"Error in inserting chamber:" << std::endl << *cham << std::endl << "in "; PrintElement(m_message->message(),data.station(),"RPC",0,false); DISP_ERROR; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h index c264859c8df753de7d92f1ccea1412c18f2b468e..368c2accc66261eb7c2356175bae2569215f767c 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h @@ -36,18 +36,20 @@ public: private: - StatusCode loadDataHv (EventIDRange &, CscCondDbData*, const EventContext&) const; - - StatusCode loadData (EventIDRange &, CscCondDbData*, SG::ReadCondHandle<CondAttrListCollection>, const std::string, bool = false) const; - - StatusCode loadDataF001 (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode loadDataNoise (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode loadDataPed (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode loadDataPSlope (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode loadDataRMS (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode loadDataStatus (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode loadDataT0Base (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode loadDataT0Phase(EventIDRange &, CscCondDbData*, const EventContext&) const; + typedef SG::WriteCondHandle<CscCondDbData> writeHandle_t; + + StatusCode loadDataHv (writeHandle_t &, CscCondDbData*, const EventContext&) const; + + StatusCode loadData (CscCondDbData*, const CondAttrListCollection*, const std::string, bool = false) const; + + StatusCode loadDataF001 (writeHandle_t &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataNoise (writeHandle_t &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataPed (writeHandle_t &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataPSlope (writeHandle_t &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataRMS (writeHandle_t &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataStatus (writeHandle_t &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataT0Base (writeHandle_t &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataT0Phase(writeHandle_t &, CscCondDbData*, const EventContext&) const; StatusCode cache (std::string , CscCondDbData*, const std::string) const; StatusCode cacheASM(std::string , CscCondDbData*, const std::string) const; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx index 5d2d982975f52bcf2bcf170db052cd07d9caa4f8..acf4c08579875f783f2896b82e6c1de9b989a55e 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx @@ -75,33 +75,31 @@ CscCondDbAlg::execute(const EventContext& ctx) const { writeCdo->loadParameters(&m_idHelperSvc->cscIdHelper()); writeCdo->setParameters(m_onlineOfflinePhiFlip); - //Start with an infinite range and narrow it down as needed - EventIDRange rangeW=IOVInfiniteRange::infiniteMixed(); // data only if(m_isData) { - //ATH_CHECK(loadDataHv(rangeW, writeCdo.get(), ctx)); // keep for future development + //ATH_CHECK(loadDataHv(writeHandle, writeCdo.get(), ctx)); // keep for future development } // both data and MC - ATH_CHECK(loadDataF001 (rangeW, writeCdo.get(), ctx)); - ATH_CHECK(loadDataNoise (rangeW, writeCdo.get(), ctx)); - ATH_CHECK(loadDataPed (rangeW, writeCdo.get(), ctx)); - if (m_pslopeFromDB) ATH_CHECK(loadDataPSlope (rangeW, writeCdo.get(), ctx)); - ATH_CHECK(loadDataRMS (rangeW, writeCdo.get(), ctx)); - ATH_CHECK(loadDataStatus (rangeW, writeCdo.get(), ctx)); + ATH_CHECK(loadDataF001 (writeHandle, writeCdo.get(), ctx)); + ATH_CHECK(loadDataNoise (writeHandle, writeCdo.get(), ctx)); + ATH_CHECK(loadDataPed (writeHandle, writeCdo.get(), ctx)); + if (m_pslopeFromDB) ATH_CHECK(loadDataPSlope (writeHandle, writeCdo.get(), ctx)); + ATH_CHECK(loadDataRMS (writeHandle, writeCdo.get(), ctx)); + ATH_CHECK(loadDataStatus (writeHandle, writeCdo.get(), ctx)); if(!m_isOnline) { - ATH_CHECK(loadDataT0Base (rangeW, writeCdo.get(), ctx)); - ATH_CHECK(loadDataT0Phase(rangeW, writeCdo.get(), ctx)); + ATH_CHECK(loadDataT0Base (writeHandle, writeCdo.get(), ctx)); + ATH_CHECK(loadDataT0Phase(writeHandle, writeCdo.get(), ctx)); } - if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { + if (writeHandle.record(std::move(writeCdo)).isFailure()) { ATH_MSG_FATAL("Could not record CscCondDbData " << writeHandle.key() - << " with EventRange " << rangeW - << " into Conditions Store"); + << " with EventRange " << writeHandle.getRange() + << " into Conditions Store"); return StatusCode::FAILURE; } - ATH_MSG_DEBUG("Recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store"); + ATH_MSG_DEBUG("Recorded new " << writeHandle.key() << " with range " << writeHandle.getRange() << " into Conditions Store"); return StatusCode::SUCCESS; } @@ -109,7 +107,7 @@ CscCondDbAlg::execute(const EventContext& ctx) const { // loadDataHv StatusCode -CscCondDbAlg::loadDataHv(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { +CscCondDbAlg::loadDataHv(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_hv, ctx}; const CondAttrListCollection* readCdo{*readHandle}; @@ -117,18 +115,10 @@ CscCondDbAlg::loadDataHv(EventIDRange & rangeW, CscCondDbData* writeCdo, const E ATH_MSG_ERROR("Null pointer to the read conditions object"); return StatusCode::FAILURE; } - - EventIDRange range; - if ( !readHandle.range(range) ) { - ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key()); - return StatusCode::FAILURE; - } - - //intersect validity range of this obj with the validity of already-loaded objs - rangeW = EventIDRange::intersect(range, rangeW); - + writeHandle.addDependency(readHandle); + ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size()); - ATH_MSG_DEBUG("Range of input is " << range << ", range of output is " << rangeW); + ATH_MSG_DEBUG("Range of input is " << readHandle.getRange() << ", range of output is " << writeHandle.getRange()); CondAttrListCollection::const_iterator itr; std::map<Identifier, int> layerMap; @@ -199,84 +189,73 @@ CscCondDbAlg::loadDataHv(EventIDRange & rangeW, CscCondDbData* writeCdo, const E // loadDataF001 StatusCode -CscCondDbAlg::loadDataF001(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { +CscCondDbAlg::loadDataF001(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_f001, ctx}; - return loadData(rangeW, writeCdo, readHandle, "f001"); + writeHandle.addDependency(readHandle); + return loadData(writeCdo, *readHandle, "f001"); } // loadDataNoise StatusCode -CscCondDbAlg::loadDataNoise(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { +CscCondDbAlg::loadDataNoise(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_noise, ctx}; - return loadData(rangeW, writeCdo, readHandle, "noise"); + writeHandle.addDependency(readHandle); + return loadData(writeCdo, *readHandle, "noise"); } // loadDataPed StatusCode -CscCondDbAlg::loadDataPed(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { - SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_ped, ctx}; - return loadData(rangeW, writeCdo, readHandle, "ped"); +CscCondDbAlg::loadDataPed(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_ped, ctx}; + writeHandle.addDependency(readHandle); + return loadData(writeCdo, *readHandle, "ped"); } // loadDataPSlope StatusCode -CscCondDbAlg::loadDataPSlope(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { +CscCondDbAlg::loadDataPSlope(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_pslope, ctx}; - return loadData(rangeW, writeCdo, readHandle, "pslope"); + writeHandle.addDependency(readHandle); + return loadData(writeCdo, *readHandle, "pslope"); } // loadDataRMS StatusCode -CscCondDbAlg::loadDataRMS(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { +CscCondDbAlg::loadDataRMS(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_rms, ctx}; - return loadData(rangeW, writeCdo, readHandle, "rms"); + writeHandle.addDependency(readHandle); + return loadData(writeCdo, *readHandle, "rms"); } // loadDataStatus StatusCode -CscCondDbAlg::loadDataStatus(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { +CscCondDbAlg::loadDataStatus(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_status, ctx}; - return loadData(rangeW, writeCdo, readHandle, "status"); + writeHandle.addDependency(readHandle); + return loadData(writeCdo, *readHandle, "status"); } // loadDataT0Base StatusCode -CscCondDbAlg::loadDataT0Base(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { - SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_t0base, ctx}; - return loadData(rangeW, writeCdo, readHandle, "t0base"); +CscCondDbAlg::loadDataT0Base(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_t0base, ctx}; + writeHandle.addDependency(readHandle); + return loadData(writeCdo, *readHandle, "t0base"); } // loadDataT0Phase StatusCode -CscCondDbAlg::loadDataT0Phase(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { - SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_t0phase, ctx}; - return loadData(rangeW, writeCdo, readHandle, "t0phase", true); +CscCondDbAlg::loadDataT0Phase(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_t0phase, ctx}; + writeHandle.addDependency(readHandle); + return loadData(writeCdo, *readHandle, "t0phase", true); } // loadData StatusCode -CscCondDbAlg::loadData(EventIDRange & rangeW, CscCondDbData* writeCdo, SG::ReadCondHandle<CondAttrListCollection> readHandle, const std::string parName, bool parAsm) const { - - const CondAttrListCollection* readCdo{*readHandle}; +CscCondDbAlg::loadData(CscCondDbData* writeCdo, const CondAttrListCollection* readCdo, const std::string parName, bool parAsm) const { - if(readCdo==0){ - ATH_MSG_ERROR("Null pointer to the read conditions object"); - return StatusCode::FAILURE; - } - - EventIDRange range; - if ( !readHandle.range(range) ) { - ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key()); - return StatusCode::FAILURE; - } - - // intersect validity range of thsi obj with the validity of already-loaded objs - rangeW = EventIDRange::intersect(range, rangeW); - - ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size()); - ATH_MSG_DEBUG("Range of input is " << range << ", range of output is " << rangeW); - CondAttrListCollection::const_iterator itr; for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) { @@ -678,7 +657,7 @@ keep for future development: // loadDataDeadChambers StatusCode -CscCondDbAlg::loadDataDeadChambers(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { +CscCondDbAlg::loadDataDeadChambers(writeHandle_t & writeHandle, CscCondDbData* writeCdo, const EventContext& ctx) const { ATH_CHECK(m_readKey_folder_da_chambers.initialize()); SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_chambers, ctx}; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/NSWCondUtils.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/NSWCondUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..31552f810e8c5e2de235caeb19a2395407c85d59 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/NSWCondUtils.h @@ -0,0 +1,22 @@ +/* + Copyright (C) 2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONCONDSVC_NSWCONDUTILS_H +#define MUONCONDSVC_NSWCONDUTILS_H + +#include "MuonAlignmentData/CorrContainer.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/sTgcIdHelper.h" +#include "MuonIdHelpers/MmIdHelper.h" +#include <string> + +namespace MuonCalib { +class NSWCondUtils { + public: + static void setNSWABLinesFromAscii(const std::string& filename,ALineMapContainer& writeALines, BLineMapContainer& writeBLines, const sTgcIdHelper* stgcHelper, const MmIdHelper* mmHelper); + + }; +} + +#endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/NSWCondUtils.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/NSWCondUtils.cxx new file mode 100644 index 0000000000000000000000000000000000000000..efb5fe3edd696d79dc19726a79fe232b21ebd5a2 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/NSWCondUtils.cxx @@ -0,0 +1,155 @@ +/* + Copyright (C) 2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <string> +#include <map> +#include <fstream> +#include <vector> +#include <iostream> + +#include "MuonCondSvc/MdtStringUtils.h" +#include "MuonCondSvc/NSWCondUtils.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" + +namespace MuonCalib{ + void NSWCondUtils::setNSWABLinesFromAscii(const std::string& filename, ALineMapContainer& writeALines, BLineMapContainer& writeBLines, const sTgcIdHelper* stgcHelper, const MmIdHelper* mmHelper) + { + std::ifstream inputFile; + inputFile.open(filename); + int nLines = 1; + int nNewALines = 0; + int nNewBLines = 0; + std::string line; + std::string type; + std::string since_str; + std::string till_str; + + while(std::getline(inputFile,line)){ + + ++nLines; + + std::vector<std::string> tokens; + std::string delimiter = ":"; + MuonCalib::MdtStringUtils::tokenize(line, tokens, delimiter); + + type = tokens[0]; + + if(type.find("#") == 0){ + continue; + } + + if(type.find("Header") == 0){ + std::string delimiter = "|"; + std::vector<std::string> tokens; + MuonCalib::MdtStringUtils::tokenize(line, tokens, delimiter); + since_str = tokens[1]; + till_str = tokens[2]; + } + + if(type.find("IOV") == 0){ + std::string delimiter = " "; + MuonCalib::MdtStringUtils::tokenize(line, tokens, delimiter); + int ival = 1; + long int iovThisBlob = 0; + std::string str_iovThisBlob = tokens[ival]; + sscanf(str_iovThisBlob.c_str(), "%80ld", &iovThisBlob); + } + + if(type.find("Corr") == 0){ + std::string delimiter = " "; + std::vector<std::string> tokens; + MuonCalib::MdtStringUtils::tokenize(line, tokens, delimiter); + + if(tokens.size() != 25){ + MsgStream log(Athena::getMessageSvc(), "NSWCondUtils"); + log<<MSG::WARNING<<"Invalid length in string retrieved from the test file "<< filename << "String length is "<< tokens.size()<< endmsg; + break; + } + + int ival =1; + int phi, eta, mult; + std::string stationType = tokens[ival++]; + + std::string phi_str = tokens[ival++]; + sscanf(phi_str.c_str(),"%80d",&phi); + + std::string eta_str = tokens[ival++]; + sscanf(eta_str.c_str(),"%80d",&eta); + + std::string mult_str = tokens[ival++]; + sscanf(mult_str.c_str(),"%80d",&mult); + + float s, z, t, rots, rotz, rott; + + std::string s_str = tokens[ival++]; + sscanf(s_str.c_str(),"%80f",&s); + + std::string z_str = tokens[ival++]; + sscanf(z_str.c_str(),"%80f",&z); + + std::string t_str = tokens[ival++]; + sscanf(t_str.c_str(),"%80f",&t); + + std::string rots_str = tokens[ival++]; + sscanf(rots_str.c_str(),"%80f",&rots); + + std::string rotz_str = tokens[ival++]; + sscanf(rotz_str.c_str(),"%80f",&rotz); + + std::string rott_str = tokens[ival++]; + sscanf(rott_str.c_str(),"%80f",&rott); + + float bz, bp, bn, sp, sn, tw, pg, tr, eg, ep, en; + std::string tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&bz); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&bp); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&bn); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&sp); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&sn); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&tw); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&pg); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&tr); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&eg); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&ep); + tmp_str = tokens[ival++]; + sscanf(tmp_str.c_str(),"%80f",&en); + + Identifier id, id_mult; + if(stationType == "MML" || stationType == "MMS"){ + id = mmHelper->elementID(stationType, eta, phi); + id_mult = mmHelper->multilayerID(id, mult); + } + + else if(stationType == "STL" || stationType == "STS"){ + id = stgcHelper->elementID(stationType, eta, phi); + id_mult = stgcHelper->multilayerID(id, mult); + } + + ALinePar newALine; + newALine.setAmdbId(stationType, eta, phi, mult); + newALine.setParameters(s, z, t, rots, rotz, rott); + newALine.isNew(true); + writeALines.insert(std::make_pair(id_mult, newALine)); + ++nNewALines; + + BLinePar newBLine; + newBLine.setAmdbId(stationType, eta, phi, mult); + newBLine.setParameters(bz, bp, bn, sp, sn, tw, pg, tr, eg, ep, en); + newBLine.isNew(true); + writeBLines.insert(std::make_pair(id_mult, newBLine)); + ++nNewBLines; + } + } + } +} diff --git a/MuonSpectrometer/MuonConfig/CMakeLists.txt b/MuonSpectrometer/MuonConfig/CMakeLists.txt index 8332243cf891eef0d1c4ca43d7cc96a2c1fc5140..c24cbba5884b477dfc02ffdb5c8f08737fa03591 100644 --- a/MuonSpectrometer/MuonConfig/CMakeLists.txt +++ b/MuonSpectrometer/MuonConfig/CMakeLists.txt @@ -6,7 +6,7 @@ atlas_subdir( MuonConfig ) # Install files from the package: -atlas_install_python_modules( python/*.py test/MdtRdoToPrepDataTool_test.py test/MdtIntersectGeometry_test.py ) +atlas_install_python_modules( python/*.py test/MdtRdoToPrepDataTool_test.py test/MdtIntersectGeometry_test.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_install_data( share/*.ref ) @@ -50,8 +50,4 @@ if( NOT SIMULATIONBASE ) atlas_add_test( MuonSegmentFindingConfigTest SCRIPT python -m MuonConfig.MuonSegmentFindingConfig --run POST_EXEC_SCRIPT nopost.sh ) - - atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) endif() diff --git a/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py index d1191f21402c8367a0857263700c7867a030bc6c..3f7d08d8082fca6ce1170a2540cc7700fecb44a9 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py @@ -66,13 +66,7 @@ def MuonSeededSegmentFinderCfg(flags,name="MuonSeededSegmentFinder", **kwargs): def MuonSegmentMomentumFromFieldCfg(flags, name="MuonSegmentMomentumFromField", **kwargs): MuonSegmentMomentumFromField=CompFactory.MuonSegmentMomentumFromField - from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg - result = ComponentAccumulator() - acc = MagneticFieldSvcCfg(flags) - magfieldsvc = acc.getPrimary() - result.merge(acc) - kwargs.setdefault("MagFieldSvc", magfieldsvc) navigator_ca = MuonNavigatorCfg(flags) navigator = navigator_ca.popPrivateTools() @@ -84,9 +78,6 @@ def MuonSegmentMomentumFromFieldCfg(flags, name="MuonSegmentMomentumFromField", muon_prop = acc.getPrimary() result.merge(acc) kwargs.setdefault("PropagatorTool", muon_prop) - - kwargs.setdefault("HasCSC", flags.Detector.GeometryCSC) - kwargs.setdefault("HasSTgc", flags.Detector.GeometrysTGC) muon_seg_mom_from_field = MuonSegmentMomentumFromField(name=name, **kwargs) result.setPrivateTools(muon_seg_mom_from_field) diff --git a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py index bab91aac709c6782777b2dd23cc5c9f653ecc90e..5b9fd569662189f20e8463494c4e79c494171585 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py @@ -182,24 +182,20 @@ def MooTrackBuilderCfg(flags, name="MooTrackBuilderTemplate", **kwargs): # Not bothering with MuonSegmentMatchingToolTight - just pass in TightSegmentMatching=True def MuonSegmentMatchingToolCfg(flags, name="MuonSegmentMatchingTool", **kwargs): Muon__MuonSegmentMatchingTool=CompFactory.Muon.MuonSegmentMatchingTool - from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg kwargs.setdefault( "doThetaMatching", flags.Muon.useSegmentMatching) kwargs.setdefault( "doPhiMatching", False ) if flags.Beam.Type == 'cosmics': kwargs.setdefault("OverlapMatchAveragePhiHitPullCut", 200.) - + kwargs.setdefault( "ToroidOn", False ) # Was "not jobproperties.BField.allToroidOn()" but do not have access to Field here. + # There are two tools which this depends on which aren't properties and which weren't defined in old configuration # Ignore for now, but FIXME one day # m_overlapResolvingTool("Muon::MuonSegmentInOverlapResolvingTool/MuonSegmentInOverlapResolvingTool"), # m_pairMatchingTool("Muon::MuonSegmentPairMatchingTool/MuonSegmentPairMatchingTool"), # Also, residual pull calculator not yet configured. #FIXME - result = MagneticFieldSvcCfg(flags) - magfieldsvc = result.getPrimary() - - kwargs.setdefault( "MagFieldSvc", magfieldsvc ) - + result = ComponentAccumulator() matching = Muon__MuonSegmentMatchingTool(name, **kwargs) result.setPrivateTools(matching) return result diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt index 98a781525d1869c49fa9479ad047bce1711ebb34..390ed295ddaa5b2c6c7f71b10a32485ea9f233f0 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt @@ -5,6 +5,14 @@ # Declare the package name: atlas_subdir( MuonReadoutGeometry ) +# Extra dependencies, based on the environment (no MuonCondSvc needed in AthSimulation): +set( extra_deps ) +set( extra_libs ) +if( NOT SIMULATIONBASE ) + set( extra_deps MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc ) + set( extra_libs MuonCondSvcLib ) +endif() + # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC Control/CxxUtils @@ -18,6 +26,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkDetDescr/TrkDetElementBase Tracking/TrkDetDescr/TrkDistortedSurfaces Tracking/TrkDetDescr/TrkSurfaces + ${extra_deps} PRIVATE Control/StoreGate DetectorDescription/AGDD/AGDDModel @@ -33,7 +42,7 @@ atlas_add_library( MuonReadoutGeometry src/*.c* PUBLIC_HEADERS MuonReadoutGeometry INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel MuonAlignmentData TrkDetElementBase TrkDistortedSurfaces TrkSurfaces MuonIdHelpersLib StoreGateLib GeoModelUtilities CxxUtils + LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel MuonAlignmentData TrkDetElementBase TrkDistortedSurfaces TrkSurfaces MuonIdHelpersLib StoreGateLib GeoModelUtilities CxxUtils ${extra_libs} PRIVATE_LINK_LIBRARIES AGDDModel MuonAGDDDescription ) diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h index ae64d383e8c9a004def288ead8bfc75755ca57c9..94d9e628ef2eae734a55456c586f17783da5fb48 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h @@ -2,29 +2,16 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - MM Readout Element properties - ----------------------------------------- -***************************************************************************/ - #ifndef MUONGEOMODEL_MMREADOUTELEMENT_H -# define MUONGEOMODEL_MMREADOUTELEMENT_H +#define MUONGEOMODEL_MMREADOUTELEMENT_H #include "MuonReadoutGeometry/MuonClusterReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MuonChannelDesign.h" #include <cmath> -class StoreGateSvc; - class BLinePar; -namespace Trk{ - class RectangleBounds; - class PlaneSurface; -} - - namespace MuonGM { /** An MMReadoutElement corresponds to a single STGC module; therefore @@ -58,7 +45,7 @@ namespace MuonGM { If the strip number is outside the range of valid strips, the function will return false */ virtual bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const override; bool stripGlobalPosition( const Identifier& id, Amg::Vector3D& gpos ) const; - + double stripLength( const Identifier& id) const; /** number of layers in phi/eta projection */ @@ -68,6 +55,10 @@ namespace MuonGM { virtual int numberOfStrips( const Identifier& layerId ) const override; virtual int numberOfStrips( int , bool measuresPhi ) const override; + /** Number of missing bottom and top strips (not read out) */ + int numberOfMissingTopStrips( const Identifier& layerId ) const; + int numberOfMissingBottomStrips( const Identifier& layerId ) const; + /** space point position for a given pair of phi and eta identifiers The LocalPosition is expressed in the reference frame of the phi surface. If one of the identifiers is outside the valid range, the function will return false */ @@ -252,6 +243,20 @@ namespace MuonGM { else return -1; } + inline int MMReadoutElement::numberOfMissingTopStrips( const Identifier& id ) const { + const MuonChannelDesign* design = getDesign(id); + if( !design ) return -1; + int nStrips = design->sAngle == 0 ? design->nMissedTopEta : design->nMissedTopStereo; + return nStrips; + } + + inline int MMReadoutElement::numberOfMissingBottomStrips( const Identifier& id ) const { + const MuonChannelDesign* design = getDesign(id); + if( !design ) return -1; + int nStrips = design->sAngle == 0 ? design->nMissedBottomEta : design->nMissedBottomStereo; + return nStrips; + } + inline bool MMReadoutElement::spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const { Amg::Vector2D phiPos; Amg::Vector2D etaPos; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonChannelDesign.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonChannelDesign.h index 70757a64ad9e697b22f96393d383a34b83aa2ffe..309d09b738efc34f91224a837fff0b446cf052de 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonChannelDesign.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonChannelDesign.h @@ -311,12 +311,9 @@ namespace MuonGM { else if (detType==MuonChannelDesign::DetType::MM) { //its a MM eta layer | for MM the strips indices start from 0 to reflect the electronics channels numbering - if( st < 0 ) return false; - if( st > totalStrips ) return false; + if( st < nMissedBottomEta ) return false; + if( st > totalStrips-nMissedTopEta ) return false; - if(st<nMissedBottomEta || st>=(totalStrips-nMissedTopEta) || st == 1023 || st == 1024 || st == 2047 || st == 2048 || st == 3071 || st == 3072 || st == 4095 || st == 4096) return false; - - else{ pos[0] = firstPos + inputPitch*(st-nMissedBottomEta); pos[1] = 0; @@ -333,10 +330,9 @@ namespace MuonGM { } else if (sAngle!=0. && detType==MuonChannelDesign::DetType::MM) { //its a MM stereo layer - if( st < 0 ) return false; - if( st > totalStrips ) return false; + if( st < nMissedBottomStereo ) return false; + if( st > totalStrips-nMissedTopStereo ) return false; - if(st<nMissedBottomStereo || st>=(totalStrips-nMissedTopStereo) || st == 1023 || st == 1024 || st == 2047 || st == 2048 || st == 3071 || st == 3072 || st == 4095 || st == 4096) return false; else{ pos[0] = firstPos + inputPitch*(st-nMissedBottomStereo); pos[1] = 0; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h index ccf3e96c56cc549d332e1be2a4d3423d2f992e96..8f9621b0578743b3d0d5596ea0bd8b5b0c81dede 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h @@ -218,6 +218,10 @@ namespace MuonGM { inline void setCacheFillingFlag(int value); inline int cacheFillingFlag() const; + inline void setNSWABLinesAsciiSideA(const std::string& str); + inline void setNSWABLinesAsciiSideC(const std::string& str); + + inline void setMinimalGeoFlag (int flag); inline int MinimalGeoFlag () const; inline void setCutoutsFlag (int flag); @@ -399,6 +403,9 @@ namespace MuonGM { std::string m_geometryVersion;//generic name of the Layout std::string m_DBMuonVersion; //name of the MuonVersion table-collection in Oracle + std::string m_NSWABLinesAsciiSideA; + std::string m_NSWABLinesAsciiSideC; + // pointers to IdHelpers const MdtIdHelper* m_mdtIdHelper; const CscIdHelper* m_cscIdHelper; @@ -572,6 +579,9 @@ namespace MuonGM { void MuonDetectorManager::setCachingFlag(int value){m_cachingFlag = value;} int MuonDetectorManager::cacheFillingFlag() const {return m_cacheFillingFlag;} int MuonDetectorManager::cachingFlag() const {return m_cachingFlag;} + void MuonDetectorManager::setNSWABLinesAsciiSideA(const std::string& str) {m_NSWABLinesAsciiSideA = str;} + void MuonDetectorManager::setNSWABLinesAsciiSideC(const std::string& str) {m_NSWABLinesAsciiSideC = str;} + } // namespace MuonGM diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx index d21d212ddca89cec390d8525a86ce3361af0e5b3..11784751c4dd13f9436bee54fae3a44df29abe7e 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx @@ -165,7 +165,7 @@ namespace MuonGM { char side = getStationEta() < 0 ? 'C' : 'A'; char sector_l = getStationName().substr(2,1)=="L" ? 'L' : 'S'; MMDetectorHelper aHelper; - MMDetectorDescription* mm = aHelper.Get_MMDetector(sector_l, abs(getStationEta()), getStationPhi(), m_ml, side); + MMDetectorDescription* mm = aHelper.Get_MMDetector(sector_l, std::abs(getStationEta()), getStationPhi(), m_ml, side); MMReadoutParameters roParam = mm->GetReadoutParameters(); @@ -198,69 +198,47 @@ namespace MuonGM { m_etaDesign[il].minYPhiR = roParam.minYPhiR; m_etaDesign[il].maxYPhi = roParam.maxYPhi; m_etaDesign[il].totalStrips = roParam.tStrips; - - - if (m_ml == 1) m_etaDesign[il].sAngle = (roParam.stereoAngle).at(il); - else if (m_ml == 2){ m_etaDesign[il].sAngle = (roParam.stereoAngle).at(il); } - else { + m_etaDesign[il].sAngle = (roParam.stereoAngle).at(il); + if (m_ml < 1 || m_ml > 2) { MsgStream log(Athena::getMessageSvc(),"MMReadoutElement"); log << MSG::WARNING <<"MMReadoutElement -- Unexpected Multilayer: m_ml= " << m_ml <<endmsg; } if (m_etaDesign[il].sAngle == 0.) { // eta layers - - m_etaDesign[il].firstPos = -0.5*m_etaDesign[il].xSize; - m_etaDesign[il].signY = 1 ; - - m_etaDesign[il].nch = ((int) std::round( (m_etaDesign[il].xSize/pitch))) + 1; - if (m_etaDesign[il].nch > chMax) { // never enters in this if statement - // fix with help of dead zone - - double dead = 0.5*(m_etaDesign[il].xSize - chMax*pitch); - m_etaDesign[il].deadO = dead; - m_etaDesign[il].deadI = dead; - m_etaDesign[il].firstPos += dead; - m_etaDesign[il].nch = chMax; - } + m_etaDesign[il].firstPos = -0.5*m_etaDesign[il].xSize; + m_etaDesign[il].signY = 1 ; + m_etaDesign[il].nch = ((int) std::round( (m_etaDesign[il].xSize/pitch))) + 1; // Total number of active strips } else { // stereo layers - m_etaDesign[il].signY = il==2? 1 : -1 ; - - // define the distance from the frame till the point that the first and last active stereo strips cross the center of the chamber (low_swift & up_swift) - // in order to derive the total number of active strips for the stereo layer + m_etaDesign[il].signY = il==2? 1 : -1 ; - - double low_swift=( m_minHalfY -m_etaDesign[il].dlStereoBottom)*fabs(tan(m_etaDesign[il].sAngle)); - double up_swift = (m_maxHalfY - m_etaDesign[il].dlStereoTop)*fabs(tan(m_etaDesign[il].sAngle)); - - double lm1_swift =0; - if(sector_l=='L' && (abs(getStationEta()))==1){ - lm1_swift = (m_etaDesign[il].minYPhiR - m_etaDesign[il].minYPhiL)/2 + m_etaDesign[il].minYPhiL; - low_swift = 0; - } - - double fPos = -0.5*m_etaDesign[il].xSize - low_swift + lm1_swift; - double lPos = 0.5*m_etaDesign[il].xSize + up_swift; - - m_etaDesign[il].nch = ((int)std::round( (lPos - fPos)/pitch )) + 1; - - m_etaDesign[il].firstPos = ( -0.5*m_etaDesign[il].xSize + (m_etaDesign[il].nMissedBottomStereo + m_etaDesign[il].nRoutedBottom - m_etaDesign[il].nMissedBottomEta)*pitch) - m_etaDesign[il].nRoutedBottom*pitch; + // define the distance from the frame till the point that the first and last active stereo strips cross the center of the chamber (low_swift & up_swift) + // in order to derive the total number of active strips for the stereo layer + double low_swift=( m_minHalfY -m_etaDesign[il].dlStereoBottom)*std::abs(std::tan(m_etaDesign[il].sAngle)); + double up_swift = (m_maxHalfY - m_etaDesign[il].dlStereoTop)*std::abs(std::tan(m_etaDesign[il].sAngle)); - if (m_etaDesign[il].nch > chMax) { - // dead zone does not help here - just limit number of channels - m_etaDesign[il].nch = chMax; - } + double lm1_swift =0; + if(sector_l=='L' && (std::abs(getStationEta()))==1){ + lm1_swift = (m_etaDesign[il].minYPhiR - m_etaDesign[il].minYPhiL)/2 + m_etaDesign[il].minYPhiL; + low_swift = 0; + } + + double fPos = -0.5*m_etaDesign[il].xSize - low_swift + lm1_swift; + double lPos = 0.5*m_etaDesign[il].xSize + up_swift; + + m_etaDesign[il].nch = ((int)std::round( (lPos - fPos)/pitch )) + 1; + + m_etaDesign[il].firstPos = ( -0.5*m_etaDesign[il].xSize + (m_etaDesign[il].nMissedBottomStereo - m_etaDesign[il].nMissedBottomEta)*pitch); + + } + m_nStrips.push_back(m_etaDesign[il].totalStrips); - } - - m_nStrips.push_back(m_etaDesign[il].nch); -#ifndef NDEBUG MsgStream log(Athena::getMessageSvc(),"MMReadoutElement"); if (log.level()<=MSG::DEBUG) log << MSG::DEBUG <<"initDesign:" << getStationName()<< " layer " << il << ", strip pitch " << m_etaDesign[il].inputPitch << ", nstrips " << m_etaDesign[il].nch << " stereo " << m_etaDesign[il].sAngle << endmsg; -#endif + } } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx index 940bb07aabc246f1eb4882a07f2bd9b4eed71ef4..ece408a00bdc8a1bf839aac3fc748710d28b647a 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx @@ -30,6 +30,10 @@ #include "AthenaKernel/getMessageSvc.h" #include <TString.h> // for Form +#ifndef SIMULATIONBASE +#include "MuonCondSvc/NSWCondUtils.h" +#endif + namespace MuonGM { MuonDetectorManager::MuonDetectorManager() { @@ -1194,6 +1198,47 @@ MuonDetectorManager::initABlineContainers() m_aLineContainer.emplace(id, std::move(newALine)); if (log.level()<=MSG::DEBUG) log<<MSG::DEBUG<<"<Filling A-line container with entry for key >"<<m_mdtIdHelper->show_to_string(id)<<endmsg; } + +#ifndef SIMULATIONBASE + if(m_stgcIdHelper && m_mmIdHelper && !(m_NSWABLinesAsciiSideA.empty())){ + + ALineMapContainer writeALines; + BLineMapContainer writeBLines; + MuonCalib::NSWCondUtils::setNSWABLinesFromAscii(m_NSWABLinesAsciiSideA, writeALines, writeBLines, m_stgcIdHelper, m_mmIdHelper); + for(auto it = writeALines.cbegin(); it != writeALines.cend(); ++it){ + Identifier id = it->first; + ALinePar aline = it->second; + m_aLineContainer.emplace(id, std::move(aline)); + } + + for(auto it = writeBLines.cbegin(); it != writeBLines.cend(); ++it){ + Identifier id = it->first; + BLinePar bline = it->second; + m_bLineContainer.emplace(id, std::move(bline)); + } + + if(!m_cscIdHelper && !(m_NSWABLinesAsciiSideC.empty())){ + ALineMapContainer writeALines; + BLineMapContainer writeBLines; + MuonCalib::NSWCondUtils::setNSWABLinesFromAscii(m_NSWABLinesAsciiSideC, writeALines, writeBLines, m_stgcIdHelper, m_mmIdHelper); + + for(auto it = writeALines.cbegin(); it != writeALines.cend(); ++it) + { + Identifier id = it->first; + ALinePar aline = it->second; + m_aLineContainer.emplace(id, std::move(aline)); + } + + for(auto it = writeBLines.cbegin(); it != writeBLines.cend(); ++it) + { + Identifier id = it->first; + BLinePar bline = it->second; + m_bLineContainer.emplace(id, std::move(bline)); + } + } + } +#endif + log << MSG::INFO << "Init A/B Line Containers - done - size is respectively " << m_aLineContainer.size() << "/" << m_bLineContainer.size() << endmsg; } diff --git a/MuonSpectrometer/MuonDetDescr/MuonRegionSelector/CMakeLists.txt b/MuonSpectrometer/MuonDetDescr/MuonRegionSelector/CMakeLists.txt index bbd48c67f079e4dbeba968b0e34027be5c83ff72..26b202427f4fdd61f33d7e33ae29f3d73604f624 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonRegionSelector/CMakeLists.txt +++ b/MuonSpectrometer/MuonDetDescr/MuonRegionSelector/CMakeLists.txt @@ -25,6 +25,12 @@ atlas_depends_on_subdirs( PUBLIC find_package( CLHEP ) find_package( Eigen ) +atlas_add_library( MuonRegionSelectorLib + MuonRegionSelector/*.h + INTERFACE + PUBLIC_HEADERS MuonRegionSelector + LINK_LIBRARIES RegSelLUT AthenaBaseComps GaudiKernel GeoPrimitives ) + # Component(s) in the package: atlas_add_component( MuonRegionSelector src/*.cxx @@ -36,9 +42,8 @@ atlas_add_component( MuonRegionSelector MuonMDT_CablingLib MuonTGC_CablingLib RPCcablingInterfaceLib MuonReadoutGeometry - MuonAGDDDescription ) + MuonAGDDDescription MuonRegionSelectorLib ) # Install files from the package: -atlas_install_headers( MuonRegionSelector ) atlas_install_joboptions( share/*.py ) diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/CSC_Digitization/CMakeLists.txt index 74b338bb3d5dc898ae6f5ad8579b2f2e60278380..9671268224cd20d019e16e44eff8d23c7bee1f9a 100755 --- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/CMakeLists.txt @@ -20,18 +20,18 @@ atlas_depends_on_subdirs( PUBLIC Simulation/HitManagement PRIVATE Control/StoreGate - Generators/GeneratorObjects ) + Generators/GeneratorObjects + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) # Component(s) in the package: atlas_add_component( CSC_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib GaudiKernel MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData MuonSimEvent HitManagement StoreGateLib SGtests GeneratorObjects ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel PileUpToolsLib GaudiKernel MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData MuonSimEvent HitManagement StoreGateLib SGtests GeneratorObjects ) # Install files from the package: atlas_install_headers( CSC_Digitization ) diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CSC_Digitizer.cxx b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CSC_Digitizer.cxx index 8cb15191d0174bf77f86e1b4d698d8f3313c609f..1645e2b788f92be0030b005cf1f53079837e1444 100644 --- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CSC_Digitizer.cxx +++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CSC_Digitizer.cxx @@ -8,7 +8,7 @@ #include "GaudiKernel/ISvcLocator.h" #include "StoreGate/StoreGateSvc.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "MuonReadoutGeometry/CscReadoutElement.h" diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx index 364d4f1fa5db3cc1628da5615cbe310278d49c93..2504cfe9c99f1b3c7e94c06707f7d00a2f981ff1 100644 --- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Author: Ketevi A. Assamagan @@ -7,7 +7,7 @@ // Digitization algorithm for the CSC hits #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "StoreGate/StoreGate.h" @@ -169,6 +169,7 @@ StatusCode CscDigitizationTool::CoreDigitization(CscDigitContainer* cscDigits,Cs return StatusCode::FAILURE; } + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; // get the iterator pairs for this DetEl while( m_thpcCSC->nextDetectorElement(i, e) ) { @@ -203,7 +204,6 @@ StatusCode CscDigitizationTool::CoreDigitization(CscDigitContainer* cscDigits,Cs std::vector<IdentifierHash>::const_iterator vecBeg = hashVec.begin(); std::vector<IdentifierHash>::const_iterator vecEnd = hashVec.end(); - //const HepMcParticleLink & particleLink = hit.particleLink(); // Fetch the energy deposit. const double energy = hit.energyDeposit(); // Determine where hit crosses the wire plane (x=0). @@ -229,9 +229,10 @@ StatusCode CscDigitizationTool::CoreDigitization(CscDigitContainer* cscDigits,Cs hashVec.clear(); continue; } - + const HepMcParticleLink::PositionFlag idxFlag = (phit.eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink trackLink(phit->trackNumber(), phit.eventId(), evColl, idxFlag); for (; vecBeg != vecEnd; vecBeg++) { - CscSimData::Deposit deposit(HepMcParticleLink(phit->trackNumber(),phit.eventId()), CscMcData(energy, ypos, zpos)); + CscSimData::Deposit deposit(trackLink, CscMcData(energy, ypos, zpos)); myDeposits[(*vecBeg)].push_back(deposit); } hashVec.clear(); diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt index a55101722c0843c9f9cb483e40e729b9808cb902..e6b9c3ab0d1e2b16ea6c6b1faab07cda02832895 100755 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODEventInfo GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface @@ -33,14 +34,13 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( CLHEP ) -find_package( HepMC ) # Component(s) in the package: atlas_add_component( MDT_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier xAODEventInfo GaudiKernel GeneratorObjects MdtCalibData MdtCalibSvcLib MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MDT_Response MuonIdHelpersLib MuonSimData MuonSimEvent HitManagement PathResolver TrkDetDescrUtils EventPrimitives ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier xAODEventInfo GaudiKernel GeneratorObjects MdtCalibData MdtCalibSvcLib MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MDT_Response MuonIdHelpersLib MuonSimData MuonSimEvent HitManagement PathResolver TrkDetDescrUtils EventPrimitives ) # Install files from the package: atlas_install_headers( MDT_Digitization ) diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/chargeCalculator.h b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/chargeCalculator.h index 278e2f8722f7fa07c9deb8dc08531bce911d23f8..11b1235138e2e7613e24cb1b935faae30737525e 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/chargeCalculator.h +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/chargeCalculator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MDT_DIGITIZATION_CHARGECALCULATOR_H @@ -44,11 +44,13 @@ to the third digit of decimal number of the pdgid. #include <iostream> // SB -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // -double chargeCalculator(const MDTSimHit& hit){ +double chargeCalculator(const MDTSimHit& hit, unsigned short eventId=0){ - const HepMcParticleLink& trkParticle = hit.particleLink(); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (eventId==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink trkParticle(hit.trackNumber(),eventId,evColl,idxFlag); const HepMC::GenParticle* genParticle = trkParticle.cptr(); double qcharge=1.; if (genParticle){ diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/chargeCalculator_PileUp.h b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/chargeCalculator_PileUp.h index 5750fa024c734afc0ede742de89272c745fc84f9..3bb032a48041ce6010ec7eba1b0aa016404b8f55 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/chargeCalculator_PileUp.h +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/chargeCalculator_PileUp.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MDT_DIGITIZATION_CHARGECALCULATOR2_H @@ -47,12 +47,14 @@ to the third digit of decimal number of the pdgid. #include <iostream> // SB -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // -double chargeCalculator_PileUp(const MDTSimHit& hit){ +double chargeCalculator_PileUp(const MDTSimHit& hit, unsigned short eventId=0){ - const HepMcParticleLink& trkParticle = hit.particleLink(); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (eventId==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink trkParticle(hit.trackNumber(),eventId,evColl,idxFlag); const HepMC::GenParticle* genParticle = trkParticle.cptr(); double qcharge=1.; if (genParticle){ diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/particleGamma.h b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/particleGamma.h index a8578433d22c17df32d9c30326652cbf6c0592be..bbca95f9fbfaa03fc7359909ddb3725e66418fa7 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/particleGamma.h +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/particleGamma.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MDT_DIGITIZATION_PARTICLEGAMMA_H @@ -40,14 +40,15 @@ Function particleGamma returns the value of gamma factor for Qball particle. #include <iostream> // SB -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // -double particleGamma(const MDTSimHit& hit){ +double particleGamma(const MDTSimHit& hit, unsigned short eventId=0){ - double QGamma=-9999.; - - const HepMcParticleLink& trkParticle = hit.particleLink(); + double QGamma=-9999.; + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (eventId==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink trkParticle(hit.trackNumber(),eventId,evColl,idxFlag); const HepMC::GenParticle* genParticle = trkParticle.cptr(); if (genParticle){ diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/particleGamma_PileUp.h b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/particleGamma_PileUp.h index 88a475a3f9a1e74da50459d42c6c9668bc8006dc..9a5690fc5b61e262e3d7c7c02a77eac650a77e7a 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/particleGamma_PileUp.h +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/particleGamma_PileUp.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MDT_DIGITIZATION_PARTICLEGAMMA2_H @@ -40,14 +40,15 @@ Function particleGamma returns the value of gamma factor for Qball particle. #include <iostream> // SB -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // -double particleGamma_PileUp(const MDTSimHit& hit){ +double particleGamma_PileUp(const MDTSimHit& hit, unsigned short eventId=0){ - double QGamma=-9999.; - - const HepMcParticleLink& trkParticle = hit.particleLink(); + double QGamma=-9999.; + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (eventId==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink trkParticle(hit.trackNumber(),eventId,evColl,idxFlag); const HepMC::GenParticle* genParticle = trkParticle.cptr(); if (genParticle){ diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx index 4dc72ed32fdc2fb02cfea217fd89c967a3f2c9de..59971a65df0aaf7e53382fd4e83148fe4adbf4c8 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ //Truth #include "GeneratorObjects/HepMcParticleLink.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" //Random Numbers #include "AthenaKernel/RNGWrapper.h" @@ -503,8 +503,8 @@ bool MdtDigitizationTool::handleMDTSimhit(const TimedHitPtr<MDTSimHit>& phit, CL if(m_DoQballCharge == true ) { // chargeCalculator returns the value of electric charge for Qball particle. // particleGamma returns the value of gamma for Qball particle. - qgamma=particleGamma(hit); - qcharge=chargeCalculator(hit); + qgamma=particleGamma(hit, phit.eventId()); + qcharge=chargeCalculator(hit, phit.eventId()); MdtDigiToolInput digiInput1(fabs(driftRadius),distRO,0.,0.,qcharge,qgamma); digiInput = digiInput1; @@ -903,7 +903,9 @@ bool MdtDigitizationTool::createDigits(MdtDigitContainer* digitContainer, MuonSi } //Create the Deposit for MuonSimData - MuonSimData::Deposit deposit(HepMcParticleLink(phit->trackNumber(),phit.eventId()), MuonMCData((float)driftRadius,localZPos)); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (phit.eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + MuonSimData::Deposit deposit(HepMcParticleLink(phit->trackNumber(),phit.eventId(),evColl,idxFlag), MuonMCData((float)driftRadius,localZPos)); //Record the SDO collection in StoreGate std::vector<MuonSimData::Deposit> deposits; diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/MM_Digitization/CMakeLists.txt index b3a70b58abec7db61494c945886fbf5ae72642db..02f3c6374f2afd66ef34b5ee67b26a9e708d852a 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/CMakeLists.txt @@ -15,14 +15,15 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel MagneticField/MagFieldElements MagneticField/MagFieldConditions + MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces MuonSpectrometer/MuonSimEvent Simulation/HitManagement PRIVATE Control/StoreGate Generators/GeneratorObjects + Generators/AtlasHepMC MuonSpectrometer/MuonDetDescr/MuonAGDDDescription - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonDigitContainer MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonSimData @@ -37,7 +38,6 @@ atlas_depends_on_subdirs( PUBLIC find_package( AIDA ) find_package( CLHEP ) find_package( Eigen ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake @@ -49,15 +49,15 @@ atlas_add_library( MM_DigitizationLib src/*.cxx PUBLIC_HEADERS MM_Digitization INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel MagFieldInterfaces MuonSimEvent HitManagement PileUpToolsLib StoreGateLib SGtests MuonIdHelpersLib NSWCalibToolsLib MagFieldElements MagFieldConditions - PRIVATE_LINK_LIBRARIES ${HEPMC_LIBRARIES} GeneratorObjects MuonAGDDDescription MuonReadoutGeometry MuonDigitContainer MuonSimData AtlasCLHEP_RandomGenerators PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel MagFieldInterfaces MuonSimEvent HitManagement PileUpToolsLib StoreGateLib SGtests MuonIdHelpersLib NSWCalibToolsLib MagFieldElements MagFieldConditions MuonReadoutGeometry + PRIVATE_LINK_LIBRARIES AtlasHepMCLib GeneratorObjects MuonAGDDDescription MuonDigitContainer MuonSimData AtlasCLHEP_RandomGenerators PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives ) atlas_add_component( MM_Digitization src/components/*.cxx - INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib GeoPrimitives Identifier GaudiKernel MagFieldInterfaces MuonSimEvent HitManagement StoreGateLib SGtests GeneratorObjects MuonAGDDDescription MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData AtlasCLHEP_RandomGenerators PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives MM_DigitizationLib NSWCalibToolsLib MagFieldElements MagFieldConditions ) + INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib GeoPrimitives Identifier GaudiKernel MagFieldInterfaces MuonSimEvent HitManagement StoreGateLib SGtests GeneratorObjects MuonAGDDDescription MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData AtlasCLHEP_RandomGenerators PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives MM_DigitizationLib NSWCalibToolsLib MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_DigitToolInput.h b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_DigitToolInput.h index f44273073e791faff72665784482c66de8fb7cf5..ed3bae9741f113f4b849e0db213f794c1344df91 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_DigitToolInput.h +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_DigitToolInput.h @@ -25,13 +25,14 @@ Class to store input needed for the MM_Digitization tools: class MM_DigitToolInput { public: - MM_DigitToolInput(int stripIdLocal, double posx, double incomingAngleXZ, double incomingAngleYZ, const Amg::Vector3D& magneticField, int stripMaxId, int gasgap, float eventTime) + MM_DigitToolInput(int stripIdLocal, double posx, double incomingAngleXZ, double incomingAngleYZ, const Amg::Vector3D& magneticField, int stripMinId, int stripMaxId, int gasgap, float eventTime) : m_stripIDLocal(stripIdLocal), m_xpos(posx), m_incomingAngleXZ(incomingAngleXZ), m_incomingAngleYZ(incomingAngleYZ), m_magneticField(magneticField), + m_stripMinId(stripMinId), m_stripMaxId(stripMaxId), m_gasgap(gasgap), m_eventTime(eventTime) @@ -45,6 +46,7 @@ class MM_DigitToolInput { double incomingAngleXZ() const { return m_incomingAngleXZ; } double incomingAngleYZ() const { return m_incomingAngleYZ; } const Amg::Vector3D& magneticField() const { return m_magneticField; } // kT unit, local cordinate + int stripMinID() const { return m_stripMinId; } int stripMaxID() const { return m_stripMaxId; } int gasgap() const { return m_gasgap; } Identifier getHitID() const { return m_hitID; } @@ -56,6 +58,7 @@ class MM_DigitToolInput { double m_incomingAngleXZ; double m_incomingAngleYZ; Amg::Vector3D m_magneticField; + int m_stripMinId; int m_stripMaxId; int m_gasgap; Identifier m_hitID; diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripResponse.h b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripResponse.h index a2bddb14e5d0fa125dd0ac83deb5c0abcd18e790..f3b5d1612d697bc4cd54d4e2ffe9f2c6ac794fd7 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripResponse.h +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripResponse.h @@ -22,7 +22,7 @@ class MM_StripResponse { public: MM_StripResponse(); - MM_StripResponse(std::vector<MM_IonizationCluster> IonizationClusters, float timeResolution, float stripPitch, int stripID, int maxstripID); + MM_StripResponse(std::vector<MM_IonizationCluster> IonizationClusters, float timeResolution, float stripPitch, int stripID, int minstripID, int maxstripID); void timeOrderElectrons(); void calculateTimeSeries(float thetaD, int gasgap); // void calculateTimeSeries(); @@ -47,6 +47,7 @@ class MM_StripResponse { float m_timeResolution; float m_stripPitch; int m_stripID; + int m_minstripID; int m_maxstripID; std::vector<MM_Electron*> m_Electrons; diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripsResponseSimulation.h b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripsResponseSimulation.h index 691dfb62f3411e4ef6d4c9f7c400ae71b5d27c59..aacdb0d6f7be61e69b65cbc5398711205b464e6e 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripsResponseSimulation.h +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripsResponseSimulation.h @@ -70,7 +70,7 @@ public : void initHistos (); void clearValues (); void initFunctions (); - void whichStrips(const float & hitx, const int & stripOffest, const float & incidentAngleXZ, const float & incidentAngleYZ, const int & stripMaxID, const MM_DigitToolInput & digiInput); + void whichStrips(const float & hitx, const int & stripOffest, const float & incidentAngleXZ, const float & incidentAngleYZ, const int & stripMinID, const int & stripMaxID, const MM_DigitToolInput & digiInput); inline void setQThreshold (float val) { m_qThreshold = val; }; inline void setTransverseDiffusionSigma (float val) { m_transverseDiffusionSigma = val; }; diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx index 87657fdeee7d89cc93082b09ec9e9993aaeeb5df..630bd3fc6e5a1c32f0eff1383dab087db7ee5956 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx @@ -60,7 +60,7 @@ //Truth #include "CLHEP/Units/PhysicalConstants.h" #include "GeneratorObjects/HepMcParticleLink.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" //Random Numbers #include "AthenaKernel/IAtRndmGenSvc.h" @@ -648,7 +648,9 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) { continue; } } - + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (phit.eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink particleLink(phit->trackNumber(),phit.eventId(),evColl,idxFlag); // Read the information about the Micro Megas hit ATH_MSG_DEBUG ( "> hitID " << hitID @@ -665,7 +667,7 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) { << " z " << globalHitPosition.z() << " mclink " - << hit.particleLink() + << particleLink << " station eta " << m_idHelperSvc->mmIdHelper().stationEta(layerID) << " station phi " @@ -683,7 +685,7 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) { hit.kineticEnergy(), hit.globalDirection(), hit.depositEnergy(), - hit.trackNumber() + particleLink ); inputSimHitColl->Insert(*copyHit); @@ -892,23 +894,23 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) { Amg::Vector2D tmp (stripLayerPosition.x(), stripLayerPosition.y()); if( stripNumber == -1 ){ - ATH_MSG_WARNING("!!! Failed to obtain strip number " - << m_idHelperSvc->mmIdHelper().print_to_string(layerID) - << "\n\t\t with pos " - << positionOnSurface - << " z " - << stripLayerPosition.z() - << " eKin: " - << hit.kineticEnergy() - << " eDep: " - << hit.depositEnergy() - << " unprojectedStrip: " - << detectorReadoutElement->stripNumber(positionOnSurfaceUnprojected, layerID) - ); - m_exitcode = 2; - if(m_writeOutputFile) m_ntuple->Fill(); - ATH_MSG_DEBUG( "m_exitcode = 2 " ); - continue; + ATH_MSG_WARNING("!!! Failed to obtain strip number " + << m_idHelperSvc->mmIdHelper().print_to_string(layerID) + << "\n\t\t with pos " + << positionOnSurface + << " z " + << stripLayerPosition.z() + << " eKin: " + << hit.kineticEnergy() + << " eDep: " + << hit.depositEnergy() + << " unprojectedStrip: " + << detectorReadoutElement->stripNumber(positionOnSurfaceUnprojected, layerID) + ); + m_exitcode = 2; + if(m_writeOutputFile) m_ntuple->Fill(); + ATH_MSG_DEBUG( "m_exitcode = 2 " ); + continue; } // Re-definition Of ID @@ -975,18 +977,17 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) { // //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// // // Strip Response Simulation For This Hit // - const MM_DigitToolInput stripDigitInput( stripNumber, distToChannel, inAngle_XZ, inAngle_YZ, localMagneticField, - detectorReadoutElement->numberOfStrips(layerID), + detectorReadoutElement->numberOfMissingBottomStrips(layerID), + detectorReadoutElement->numberOfStrips(layerID)-detectorReadoutElement->numberOfMissingTopStrips(layerID), m_idHelperSvc->mmIdHelper().gasGap(layerID), m_eventTime+m_globalHitTime ); @@ -999,7 +1000,7 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) { // // digitize input for strip response - MuonSimData::Deposit deposit(hit.particleLink(), MuonMCData(hitOnSurface.x(),hitOnSurface.y())); + MuonSimData::Deposit deposit(particleLink, MuonMCData(hitOnSurface.x(),hitOnSurface.y())); //Record the SDO collection in StoreGate std::vector<MuonSimData::Deposit> deposits; @@ -1022,26 +1023,23 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) { MM_ElectronicsToolInput stripDigitOutput( tmpStripOutput.NumberOfStripsPos(), tmpStripOutput.chipCharge(), tmpStripOutput.chipTime(), digitID , hit.kineticEnergy()); // This block is purely validation - if (stripNumber!=1){ // Extra if statement from quick fix from deadstrip = #1 - for(size_t i = 0; i<tmpStripOutput.NumberOfStripsPos().size(); i++){ - int tmpStripID = tmpStripOutput.NumberOfStripsPos().at(i); - bool isValid; - Identifier cr_id = m_idHelperSvc->mmIdHelper().channelID(stName, m_idHelperSvc->mmIdHelper().stationEta(layerID), m_idHelperSvc->mmIdHelper().stationPhi(layerID), m_idHelperSvc->mmIdHelper().multilayer(layerID), m_idHelperSvc->mmIdHelper().gasGap(layerID), tmpStripID, true, &isValid); - if (!isValid) { - ATH_MSG_WARNING( "MicroMegas digitization: failed to create a valid ID for (chip response) strip n. " << tmpStripID << "; associated positions will be set to 0.0." ); - } else { - Amg::Vector2D cr_strip_pos(0., 0.); - if ( !detectorReadoutElement->stripPosition(cr_id,cr_strip_pos) ) { - ATH_MSG_WARNING("MicroMegas digitization: failed to associate a valid local position for (chip response) strip n. " - << tmpStripID - << "; associated positions will be set to 0.0." - ); - } - } - } + for(size_t i = 0; i<tmpStripOutput.NumberOfStripsPos().size(); i++){ + int tmpStripID = tmpStripOutput.NumberOfStripsPos().at(i); + bool isValid; + Identifier cr_id = m_idHelperSvc->mmIdHelper().channelID(stName, m_idHelperSvc->mmIdHelper().stationEta(layerID), m_idHelperSvc->mmIdHelper().stationPhi(layerID), m_idHelperSvc->mmIdHelper().multilayer(layerID), m_idHelperSvc->mmIdHelper().gasGap(layerID), tmpStripID, true, &isValid); + if (!isValid) { + ATH_MSG_WARNING( "MicroMegas digitization: failed to create a valid ID for (chip response) strip n. " << tmpStripID << "; associated positions will be set to 0.0." ); + } else { + Amg::Vector2D cr_strip_pos(0., 0.); + if ( !detectorReadoutElement->stripPosition(cr_id,cr_strip_pos) ) { + ATH_MSG_WARNING("MicroMegas digitization: failed to associate a valid local position for (chip response) strip n. " + << tmpStripID + << "; associated positions will be set to 0.0." + ); + } + } } - v_stripDigitOutput.push_back(stripDigitOutput); // diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripResponse.cxx b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripResponse.cxx index 8530e5c84fa02a9874c159719f4123de42a47559..2ab98c8e481eb2e1b4dd27681695a1d6f35433de 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripResponse.cxx +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripResponse.cxx @@ -6,7 +6,7 @@ MM_StripResponse::MM_StripResponse() {} -MM_StripResponse::MM_StripResponse(std::vector<MM_IonizationCluster> IonizationClusters, float timeResolution, float stripPitch, int stripID, int maxstripID) : m_timeResolution(timeResolution), m_stripPitch(stripPitch), m_stripID(stripID), m_maxstripID(maxstripID) { +MM_StripResponse::MM_StripResponse(std::vector<MM_IonizationCluster> IonizationClusters, float timeResolution, float stripPitch, int stripID, int minstripID, int maxstripID) : m_timeResolution(timeResolution), m_stripPitch(stripPitch), m_stripID(stripID), m_minstripID(minstripID), m_maxstripID(maxstripID) { for (auto& IonizationCluster : IonizationClusters) for (auto& Electron : IonizationCluster.getElectrons()) @@ -35,7 +35,7 @@ void MM_StripResponse::calculateTimeSeries(float /*thetaD*/, int /*gasgap*/) { // m_stripID defines the initial strip where the muon entered the gas gap int stripVal = 0; - if(fabs(Electron->getX())>m_stripPitch/2){ + if(std::abs(Electron->getX())>m_stripPitch/2){ if(Electron->getX()>0.0) stripVal = m_stripID + int( (Electron->getX()-m_stripPitch/2)/m_stripPitch ) + 1 ; else @@ -43,8 +43,10 @@ void MM_StripResponse::calculateTimeSeries(float /*thetaD*/, int /*gasgap*/) { } else stripVal = m_stripID; - if (stripVal < 0 || stripVal > m_maxstripID) stripVal = -1; - (m_stripCharges[timeBin])[stripVal] += Electron->getCharge(); + // Only add the strips that are either read out, or can cross talk to the read out strips + if (stripVal < m_minstripID-2 || stripVal > m_maxstripID+1) stripVal = -1; + if (stripVal > 0) + (m_stripCharges[timeBin])[stripVal] += Electron->getCharge(); } } @@ -68,14 +70,16 @@ void MM_StripResponse::simulateCrossTalk(float crossTalk1, float crossTalk2) { if (stripChargeVal==0.) continue; - if (stripVal-1 > -1) (m_stripCharges[timeBin])[stripVal-1] += stripChargeVal * crossTalk1; - if (stripVal+1 > -1) (m_stripCharges[timeBin])[stripVal+1] += stripChargeVal * crossTalk1; - (m_stripCharges[timeBin])[stripVal] -= stripChargeVal * crossTalk1 * ( (stripVal-1 > -1) + (stripVal+1 > -1) ); + // Allow crosstalk between strips that exist. + // Will check for read out strips in calculateSummaries function + if (stripVal-1 > 0) (m_stripCharges[timeBin])[stripVal-1] += stripChargeVal * crossTalk1; + if (stripVal+1 < m_maxstripID) (m_stripCharges[timeBin])[stripVal+1] += stripChargeVal * crossTalk1; + (m_stripCharges[timeBin])[stripVal] -= stripChargeVal * crossTalk1 * ( (stripVal-1 > 0) + (stripVal+1 < m_maxstripID) ); if (crossTalk2 > 0.){ - if (stripVal-2 > -1) (m_stripCharges[timeBin])[stripVal-2] += stripChargeVal * crossTalk2; - if (stripVal+2 > -1) (m_stripCharges[timeBin])[stripVal+2] += stripChargeVal * crossTalk2; - (m_stripCharges[timeBin])[stripVal] -= stripChargeVal * crossTalk2 * ( (stripVal-2 > -1) + (stripVal+2 > -1) ); + if (stripVal-2 > 0) (m_stripCharges[timeBin])[stripVal-2] += stripChargeVal * crossTalk2; + if (stripVal+2 < m_maxstripID) (m_stripCharges[timeBin])[stripVal+2] += stripChargeVal * crossTalk2; + (m_stripCharges[timeBin])[stripVal] -= stripChargeVal * crossTalk2 * ( (stripVal-2 > 0) + (stripVal+2 < m_maxstripID) ); } } } @@ -90,6 +94,12 @@ void MM_StripResponse::calculateSummaries(float chargeThreshold) { int timeBin = stripTimeSeries.first; for (auto & stripCharge : stripTimeSeries.second ){ int stripVal = stripCharge.first; + // remove dead (missing) strips + // First active strip starts at m_minstripID + // Last active strip numbrer is maxStripID-1 + if (stripVal < m_minstripID || stripVal > m_maxstripID-1) continue; + // remove PCB gap strips + if (stripVal == 1023 || stripVal == 1024 || stripVal == 2047 || stripVal == 2048 || stripVal == 3071 || stripVal == 3072 || stripVal == 4095 || stripVal == 4096) continue; float stripChargeVal = stripCharge.second; if(stripChargeVal < chargeThreshold) continue; @@ -103,13 +113,13 @@ void MM_StripResponse::calculateSummaries(float chargeThreshold) { } } if(!found){ // // strip not in vector, add new entry - m_v_strip.push_back(stripVal); - std::vector<float> qTemp; - qTemp.push_back(stripChargeVal); - m_v_stripTotalCharge.push_back(qTemp); - std::vector<float> tTemp; - tTemp.push_back(timeBin*m_timeResolution); - m_v_stripTimeThreshold.push_back(tTemp); + m_v_strip.push_back(stripVal); + std::vector<float> qTemp; + qTemp.push_back(stripChargeVal); + m_v_stripTotalCharge.push_back(qTemp); + std::vector<float> tTemp; + tTemp.push_back(timeBin*m_timeResolution); + m_v_stripTimeThreshold.push_back(tTemp); } } } diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripsResponseSimulation.cxx b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripsResponseSimulation.cxx index b1f4ad09c1223e2f135eedd92b7a1076d243a1b4..381917cf66840c0347af091165abcaed030c23ec 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripsResponseSimulation.cxx +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripsResponseSimulation.cxx @@ -151,6 +151,7 @@ MM_StripToolOutput MM_StripsResponseSimulation::GetResponseFrom(const MM_DigitTo digiInput.stripIDLocal(), digiInput.incomingAngleXZ(), //degrees digiInput.incomingAngleYZ(), //degrees + digiInput.stripMinID(), digiInput.stripMaxID(), digiInput ); @@ -171,6 +172,7 @@ void MM_StripsResponseSimulation::whichStrips( const float & hitx, const int & stripID, const float & incidentAngleXZ, const float & incidentAngleYZ, + const int & stripMinID, const int & stripMaxID, const MM_DigitToolInput & digiInput) { @@ -283,7 +285,7 @@ void MM_StripsResponseSimulation::whichStrips( const float & hitx, float timeresolution = 0.01; //ns - MM_StripResponse stripResponseObject(m_IonizationClusters, timeresolution, m_pitch, stripID, stripMaxID); + MM_StripResponse stripResponseObject(m_IonizationClusters, timeresolution, m_pitch, stripID, stripMinID, stripMaxID); stripResponseObject.timeOrderElectrons(); stripResponseObject.calculateTimeSeries(incidentAngleXZ, digiInput.gasgap()); stripResponseObject.simulateCrossTalk( m_crossTalk1, m_crossTalk2); diff --git a/MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces/CMakeLists.txt index f2edb7c1e7122befac645e71e3f441a7d6d2a80e..a2171e00a6237b487783436dbe3f803b31a3f350 100644 --- a/MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces/CMakeLists.txt @@ -9,6 +9,8 @@ atlas_subdir( MuonDigToolInterfaces ) atlas_depends_on_subdirs( PUBLIC GaudiKernel ) -# Install files from the package: -atlas_install_headers( MuonDigToolInterfaces ) - +atlas_add_library( MuonDigToolInterfacesLib + MuonDigToolInterfaces/*.h + INTERFACE + PUBLIC_HEADERS MuonDigToolInterfaces + LINK_LIBRARIES GaudiKernel ) diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt index b31fe01e9887a97ff34ef9996df6931dc1c351be..0e19bfe4d68161eefc47942f362fc6b415d33fe0 100755 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt @@ -22,6 +22,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventInfo Event/EventInfoMgt Generators/GeneratorObjects + Generators/AtlasHepMC MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry @@ -34,14 +35,13 @@ find_package( AIDA ) find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) -find_package( HepMC ) # Component(s) in the package: atlas_add_component( RPC_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps PileUpToolsLib xAODEventInfo GaudiKernel MuonSimData MuonSimEvent HitManagement AthenaKernel EventInfo GeneratorObjects MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib PathResolver ) + INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps PileUpToolsLib xAODEventInfo GaudiKernel MuonSimData MuonSimEvent HitManagement AthenaKernel EventInfo GeneratorObjects MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib PathResolver ) # Install files from the package: atlas_install_headers( RPC_Digitization ) diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/RPC_Digitization/RpcDigitizationTool.h b/MuonSpectrometer/MuonDigitization/RPC_Digitization/RPC_Digitization/RpcDigitizationTool.h index ef3348c714d7682b6423a2c37f61517ad9cb2119..fa8b740b62fc623c71c00b66fe38d3bb10d47a82 100644 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/RPC_Digitization/RpcDigitizationTool.h +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/RPC_Digitization/RpcDigitizationTool.h @@ -1,7 +1,7 @@ /* -*- C++ -*- */ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RPC_DIGITIZATIONTOOL_H @@ -157,7 +157,7 @@ private: /** Average calibration methods and parameters */ StatusCode PrintCalibrationVector(); /** Evaluate detection efficiency */ - StatusCode DetectionEfficiency(const EventContext& ctx, const Identifier* ideta, const Identifier* idphi, bool& undefinedPhiStripStatus, CLHEP::HepRandomEngine* rndmEngine, const RPCSimHit& thehit); + StatusCode DetectionEfficiency(const EventContext& ctx, const Identifier* ideta, const Identifier* idphi, bool& undefinedPhiStripStatus, CLHEP::HepRandomEngine* rndmEngine, const HepMcParticleLink& trkParticle); double FCPEfficiency(const HepMC::GenParticle* genParticle); /** */ int ClusterSizeEvaluation(const EventContext& ctx, const Identifier* id, float xstripnorm, CLHEP::HepRandomEngine* rndmEngine); diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx index 9365c9a16275f8e1ca97a975125f0fe2561b5d53..314c150ef5d94e8f978303756ce680c62d3c3c23 100644 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx @@ -33,7 +33,7 @@ //Truth #include "GeneratorObjects/HepMcParticleLink.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" //Random Numbers #include "AthenaKernel/RNGWrapper.h" @@ -604,8 +604,11 @@ StatusCode RpcDigitizationTool::doDigitization(const EventContext& ctx, RpcDigit doubletZ, doubletPhi,gasGap, 1, pcsphi[1] ); const RpcReadoutElement* ele= m_GMmgr->getRpcReadoutElement(atlasRpcIdeta);// first add time jitter to the time: + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (phit.eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const HepMcParticleLink particleLink(phit->trackNumber(),phit.eventId(),evColl,idxFlag); - if (DetectionEfficiency(ctx, &atlasRpcIdeta,&atlasRpcIdphi, undefPhiStripStat, rndmEngine, hit).isFailure()) return StatusCode::FAILURE ; + ATH_CHECK(DetectionEfficiency(ctx, &atlasRpcIdeta,&atlasRpcIdphi, undefPhiStripStat, rndmEngine, particleLink)); ATH_MSG_DEBUG ( "SetPhiOn " << m_SetPhiOn << " SetEtaOn " << m_SetEtaOn ); for( int imeasphi=0 ; imeasphi!=2; ++imeasphi){ @@ -658,7 +661,7 @@ StatusCode RpcDigitizationTool::doDigitization(const EventContext& ctx, RpcDigit // ME unused: const HepMcParticleLink & particleLink = hit.particleLink(); // MuonMCData first word is the packing of : proptime, bunchTime, posy, posz // MuonMCData second word is the total hit time: bunchcTime+tof+proptime+correlatedJitter / ns - MuonSimData::Deposit deposit(HepMcParticleLink(phit->trackNumber(),phit.eventId()), + MuonSimData::Deposit deposit(particleLink, MuonMCData((*b),time)); // store tof+strip_propagation+corr.jitter // MuonMCData((*b),G4Time+bunchTime+proptime )); // store tof+strip_propagation @@ -1686,7 +1689,7 @@ StatusCode RpcDigitizationTool::readParameters(){ } //-------------------------------------------- -StatusCode RpcDigitizationTool::DetectionEfficiency(const EventContext& ctx, const Identifier* IdEtaRpcStrip, const Identifier* IdPhiRpcStrip, bool& undefinedPhiStripStatus, CLHEP::HepRandomEngine* rndmEngine, const RPCSimHit& thehit) { +StatusCode RpcDigitizationTool::DetectionEfficiency(const EventContext& ctx, const Identifier* IdEtaRpcStrip, const Identifier* IdPhiRpcStrip, bool& undefinedPhiStripStatus, CLHEP::HepRandomEngine* rndmEngine, const HepMcParticleLink& trkParticle) { ATH_MSG_DEBUG ( "RpcDigitizationTool::in DetectionEfficiency" ); @@ -2039,7 +2042,6 @@ StatusCode RpcDigitizationTool::DetectionEfficiency(const EventContext& ctx, con //Efficiency correction factor for fractional-charged particles(added by Quanyin Li: quli@cern.ch) //link to truth particles and calculate the charge and betagamma - const HepMcParticleLink& trkParticle = thehit.particleLink(); const HepMC::GenParticle* genparticle = trkParticle.cptr(); if(genparticle){ const int particlePdgId = genparticle->pdg_id(); diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx index 3dacd198f7ada4aef58bfea230adcbfc04a485c0..4416a237901b0f8f118c573ecba7d30bddecc85a 100644 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx @@ -383,7 +383,9 @@ StatusCode TgcDigitizationTool::digitizeCore(const EventContext& ctx) const { // link to MC info //const HepMcParticleLink & particleLink = hit.particleLink(); // create here deposit for MuonSimData, link and tof - MuonSimData::Deposit deposit(HepMcParticleLink(phit->trackNumber(), phit.eventId()), MuonMCData(tof, 0)); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (phit.eventId()==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + MuonSimData::Deposit deposit(HepMcParticleLink(phit->trackNumber(), phit.eventId(), evColl, idxFlag), MuonMCData(tof, 0)); std::vector<MuonSimData::Deposit> deposits; deposits.push_back(deposit); diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/CMakeLists.txt index d6fe06d514ce9c7700eb0f6978fa4935411ef3bb..e92320687657c1f8369f351eed6485511cb2fad7 100644 --- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/CMakeLists.txt @@ -23,6 +23,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventInfo Event/EventInfoMgt Generators/GeneratorObjects + Generators/AtlasHepMC MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonDigitContainer MuonSpectrometer/MuonSimData @@ -35,7 +36,6 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( AIDA ) find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake @@ -46,8 +46,8 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minui atlas_add_component( sTGC_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel AthContainers PileUpToolsLib Identifier xAODEventInfo GaudiKernel MuonSimEvent HitManagement StoreGateLib SGtests EventInfo GeneratorObjects MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives NSWCalibToolsLib ) + INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel AthContainers PileUpToolsLib Identifier xAODEventInfo GaudiKernel MuonSimEvent HitManagement StoreGateLib SGtests EventInfo GeneratorObjects MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives NSWCalibToolsLib ) # Install files from the package: atlas_install_headers( sTGC_Digitization ) diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx index 55b1368d76930dc7ebf75c7cc801d5a06280a8aa..36b207538b8f12df4ebd7db8c9c43f1c63d07b56 100644 --- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx @@ -37,7 +37,7 @@ //Truth #include "CLHEP/Units/PhysicalConstants.h" #include "GeneratorObjects/HepMcParticleLink.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" //Random Numbers #include "AthenaKernel/IAtRndmGenSvc.h" @@ -519,13 +519,17 @@ StatusCode sTgcDigitizationTool::doDigitization(const EventContext& ctx) { ATH_MSG_DEBUG("sTgcDigitizationTool::doDigitization hits mapped"); - const sTGCSimHit temp_hit(hit.sTGCId(), hit.globalTime(), - G_HITONSURFACE_WIRE, - hit.particleEncoding(), - hit.globalDirection(), - hit.depositEnergy(), - hit.particleLink() - ); + const EBC_EVCOLL evColl = EBC_MAINEVCOLL; + const HepMcParticleLink::PositionFlag idxFlag = (eventId==0) ? HepMcParticleLink::IS_POSITION: HepMcParticleLink::IS_INDEX; + const int barcode = hit.particleLink().barcode(); + const HepMcParticleLink particleLink(barcode, eventId, evColl, idxFlag); + const sTGCSimHit temp_hit(hit.sTGCId(), hit.globalTime(), + G_HITONSURFACE_WIRE, + hit.particleEncoding(), + hit.globalDirection(), + hit.depositEnergy(), + particleLink + ); float globalHitTime = temp_hit.globalTime() + eventTime; @@ -590,7 +594,7 @@ StatusCode sTgcDigitizationTool::doDigitization(const EventContext& ctx) { ATH_MSG_VERBOSE(" charge = " << newDigit->charge()) ; // Create a MuonSimData (SDO) corresponding to the digit - MuonSimData::Deposit deposit(hit.particleLink(), MuonMCData(hit.depositEnergy(), tof)); + MuonSimData::Deposit deposit(particleLink, MuonMCData(hit.depositEnergy(), tof)); std::vector<MuonSimData::Deposit> deposits; deposits.push_back(deposit); MuonSimData simData(deposits, hit.particleEncoding()); diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorFactory001.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorFactory001.h index 23b931d1ed4274af9fdb16f5a441f5efd9fece4a..0fddbc2cf6a43cf4c195bba69072e15f982929b0 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorFactory001.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorFactory001.h @@ -65,6 +65,8 @@ public: inline void hasCSC(bool value); inline void hasSTgc(bool value); inline void hasMM(bool value); + inline void setABLinesAsciiSideA(const std::string& ); + inline void setABLinesAsciiSideC(const std::string& ); private: @@ -95,6 +97,9 @@ private: bool m_hasSTgc; bool m_hasMM; + std::string m_NSWABLinesSideA; + std::string m_NSWABLinesSideC; + std::vector<std::string> m_selectedStations; std::vector<int> m_selectedStEta; std::vector<int> m_selectedStPhi; @@ -142,6 +147,9 @@ void MuonDetectorFactory001::setFineClashFixingFlag(int value){m_enableFineClash void MuonDetectorFactory001::hasCSC(bool value){m_hasCSC = value;} void MuonDetectorFactory001::hasSTgc(bool value){m_hasSTgc = value;} void MuonDetectorFactory001::hasMM(bool value){m_hasMM = value;} +void MuonDetectorFactory001::setABLinesAsciiSideA(const std::string& str) {m_NSWABLinesSideA = str; } +void MuonDetectorFactory001::setABLinesAsciiSideC(const std::string& str) {m_NSWABLinesSideC = str; } + } // namespace MuonGM diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h index 8249fe2b80f6f1dfc03aba96949a2f577da4ec35..f996f5e7e21901f0673bfff3b62b255aa81a1016 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h @@ -63,6 +63,9 @@ private: bool m_useCscIntAlinesFromGM; std::string m_altCscIntAlinesFile; Gaudi::Property<int> m_cachingFlag { this, "CachingFlag", 1, "Turn on/off caching of ReadoutElement surfaces etc. (i.e. for MDTs)" }; + //the following two properties are for local validation, not for production + Gaudi::Property<std::string> m_NSWABLinesAsciiSideA { this, "NSWABLinesAsciiSideA", "", "Pass A/B Lines for NSW from Ascii file" }; + Gaudi::Property<std::string> m_NSWABLinesAsciiSideC { this, "NSWABLinesAsciiSideC", "", "Pass A/B Lines for NSW from Ascii file" }; int m_enableMdtDeformations; int m_enableMdtAsBuiltParameters; std::string m_altMdtAsBuiltFile; diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx index 473b3305e8a6d0e485a4d39d01331045aa4e00fe..cd0d59d0b4d796b67f0555f2f11bce62e2b7a2f7 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx @@ -323,6 +323,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) theFactory.setDBMuonVersion(MuonVersion); theFactory.setDBkey( detectorKey ); theFactory.setDBnode(detectorNode); + theFactory.setABLinesAsciiSideA(m_NSWABLinesAsciiSideA); + theFactory.setABLinesAsciiSideC(m_NSWABLinesAsciiSideC); theFactory.setLayout(m_layout); //theFactory.setIncludeInertMats(m_includeInertMaterials); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/RpcClusterization/RpcClusterBuilderPRD.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/RpcClusterization/RpcClusterBuilderPRD.h index 46919f86edd6c693b0bb28b17283fbd0383e5775..250c711e25b51c63a65b7bde3405f90130da9b56 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/RpcClusterization/RpcClusterBuilderPRD.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/RpcClusterization/RpcClusterBuilderPRD.h @@ -19,6 +19,8 @@ #include "MuonDigitContainer/RpcDigit.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "EventPrimitives/EventPrimitives.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" class RpcIdHelper; @@ -46,11 +48,9 @@ private: std::vector<Muon::RpcPrepDataCollection*> m_coll_vect; Muon::RpcPrepDataCollection* m_temp_coll; - std::string m_colKey; - std::string m_colKeyIn; typedef std::map<int, Muon::RpcPrepData*> pattern; std::map<Identifier,pattern> m_digits; - StatusCode retrieve_rpcClusterContainer() const; + // StatusCode retrieve_rpcClusterContainer() const; float m_timeSpread; protected: @@ -62,7 +62,8 @@ protected: "Key of input MuonDetectorManager condition data"}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - + SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_colKeyIn {this, "InputCollectionName", "RPC_Measurements"}; + SG::WriteHandleKey<Muon::RpcPrepDataContainer> m_colKey {this, "CollectionName", "rpcClusters"}; }; #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/src/RpcClusterBuilderPRD.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/src/RpcClusterBuilderPRD.cxx index 288f4aae74f828f43791816d60cb5e4696d7bb72..d58e61c971ff195c399650b4831179cb52d32565 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/src/RpcClusterBuilderPRD.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/src/RpcClusterBuilderPRD.cxx @@ -29,8 +29,6 @@ RpcClusterBuilderPRD::RpcClusterBuilderPRD(const std::string& name, ISvcLocator* { // Declare the properties - declareProperty("InputCollectionName", m_colKeyIn = "RPC_Measurements"); // StoreGate key for RPC clusters - declareProperty("CollectionName", m_colKey = "rpcClusters"); // StoreGate key for RPC clusters declareProperty("ClusterTimeSpread", m_timeSpread = 15.); } @@ -41,6 +39,9 @@ StatusCode RpcClusterBuilderPRD::initialize(){ ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_colKeyIn.initialize()); + ATH_CHECK(m_colKey.initialize()); + // Create an empty cluster container // m_rpcClusterContainer = new Muon::RpcPrepDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); // m_rpcClusterContainer->addRef(); @@ -51,10 +52,11 @@ StatusCode RpcClusterBuilderPRD::initialize(){ StatusCode RpcClusterBuilderPRD::execute() { - m_rpcClusterContainer = new Muon::RpcPrepDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); + SG::WriteHandle<Muon::RpcPrepDataContainer> clusterContainer(m_colKey); + ATH_CHECK(clusterContainer.record(std::make_unique<Muon::RpcPrepDataContainer>(m_idHelperSvc->rpcIdHelper().module_hash_max()))); + m_rpcClusterContainer = clusterContainer.ptr(); // m_rpcClusterContainer->cleanup(); - ATH_CHECK( evtStore()->record(m_rpcClusterContainer,m_colKey) ); StatusCode sc=fill_rpcClusterContainer(); @@ -85,10 +87,9 @@ StatusCode RpcClusterBuilderPRD::fill_rpcClusterContainer() { return StatusCode::FAILURE; } - const Muon::RpcPrepDataContainer* container; - StatusCode sc = evtStore()->retrieve(container,m_colKeyIn); - if (sc.isFailure()) { - ATH_MSG_WARNING(" Cannot retrieve RPC Digit Container with key " << m_colKeyIn.c_str() ); + SG::ReadHandle<Muon::RpcPrepDataContainer> container(m_colKeyIn); + if (!container.isValid()) { + ATH_MSG_WARNING(" Cannot retrieve RPC Digit Container with key " << m_colKeyIn ); return StatusCode::SUCCESS; } @@ -141,7 +142,7 @@ StatusCode RpcClusterBuilderPRD::fill_rpcClusterContainer() { for(unsigned int k=0;k<m_coll_vect.size();k++){ - sc = m_rpcClusterContainer->addCollection(m_coll_vect[k], m_coll_vect[k]->identifyHash()); + StatusCode sc = m_rpcClusterContainer->addCollection(m_coll_vect[k], m_coll_vect[k]->identifyHash()); if (sc.isFailure()) ATH_MSG_ERROR("Couldn't record RpcPrepDataCollection with key=" << m_colKey << " in StoreGate!"); @@ -458,39 +459,39 @@ void RpcClusterBuilderPRD::push_back(Muon::RpcPrepData *& newCluster){ // } } -StatusCode RpcClusterBuilderPRD::retrieve_rpcClusterContainer() const { - - typedef Muon::RpcPrepDataCollection::const_iterator cluster_iterator; - - const Muon::RpcPrepDataContainer* PRDcontainer; - ATH_CHECK( evtStore()->retrieve(PRDcontainer,m_colKey) ); - - for (Muon::RpcPrepDataContainer::const_iterator container_iterator=PRDcontainer->begin(); - container_iterator != PRDcontainer->end(); - ++container_iterator) { - - const Muon::RpcPrepDataCollection* collection = *container_iterator; - ATH_MSG_INFO("Size of the collection is " << collection->size() ); - if (collection->size() > 0) { - ATH_MSG_INFO("**************************************************************"); - cluster_iterator beginCluster = collection->begin(); - cluster_iterator endCluster = collection->end(); - for ( ; beginCluster!=endCluster; ++beginCluster) { - const Muon::RpcPrepData* cluster = *beginCluster; - Amg::Vector3D position = cluster->globalPosition(); - ATH_MSG_INFO("RPC Cluster ID, Position (mm), size = " - << m_idHelperSvc->rpcIdHelper().show_to_string(cluster->identify()) << " [" - << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.x() - << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.y() - << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.z() - // << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << cluster->width() - << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << cluster->rdoList().size() - << " ]"); - } - ATH_MSG_INFO("Number of Clusters in the collection is " << collection->size() ); - ATH_MSG_INFO("**************************************************************"); - } - } - - return StatusCode::SUCCESS; -} +// StatusCode RpcClusterBuilderPRD::retrieve_rpcClusterContainer() const { + +// typedef Muon::RpcPrepDataCollection::const_iterator cluster_iterator; + +// const Muon::RpcPrepDataContainer* PRDcontainer; +// ATH_CHECK( evtStore()->retrieve(PRDcontainer,m_colKey) ); + +// for (Muon::RpcPrepDataContainer::const_iterator container_iterator=PRDcontainer->begin(); +// container_iterator != PRDcontainer->end(); +// ++container_iterator) { + +// const Muon::RpcPrepDataCollection* collection = *container_iterator; +// ATH_MSG_INFO("Size of the collection is " << collection->size() ); +// if (collection->size() > 0) { +// ATH_MSG_INFO("**************************************************************"); +// cluster_iterator beginCluster = collection->begin(); +// cluster_iterator endCluster = collection->end(); +// for ( ; beginCluster!=endCluster; ++beginCluster) { +// const Muon::RpcPrepData* cluster = *beginCluster; +// Amg::Vector3D position = cluster->globalPosition(); +// ATH_MSG_INFO("RPC Cluster ID, Position (mm), size = " +// << m_idHelperSvc->rpcIdHelper().show_to_string(cluster->identify()) << " [" +// << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.x() +// << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.y() +// << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.z() +// // << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << cluster->width() +// << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << cluster->rdoList().size() +// << " ]"); +// } +// ATH_MSG_INFO("Number of Clusters in the collection is " << collection->size() ); +// ATH_MSG_INFO("**************************************************************"); +// } +// } + +// return StatusCode::SUCCESS; +// } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/CMakeLists.txt index f9617ed08ea3831a2269bf7c4221d80cbb2f3453..a123e4f9c03243f652773568d2827956002e2080 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/CMakeLists.txt @@ -30,11 +30,11 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkEvent/TrkTruthData ) + Tracking/TrkEvent/TrkTruthData + Generators/AtlasHepMC ) # External dependencies: find_package( Eigen ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: @@ -42,12 +42,12 @@ atlas_add_library( MuonHoughPatternToolsLib src/*.cxx PUBLIC_HEADERS MuonHoughPatternTools INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MuonDetDescrUtils MuonHoughPatternEvent MuonPattern MuonPrepRawData MuonSegment MuonRecToolInterfaces MuonLayerHough TrkDriftCircleMath MuonIdHelpersLib MuonClusterizationLib MuonRecHelperToolsLib StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${HEPMC_LIBRARIES} CxxUtils EventPrimitives xAODMuon xAODTruth MuonReadoutGeometry MuonRIO_OnTrack TrkSurfaces TrkTruthData ) + PRIVATE_LINK_LIBRARIES AtlasHepMCLib CxxUtils EventPrimitives xAODMuon xAODTruth MuonReadoutGeometry MuonRIO_OnTrack TrkSurfaces TrkTruthData ) atlas_add_component( MuonHoughPatternTools src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MuonDetDescrUtils MuonIdHelpersLib MuonClusterizationLib MuonHoughPatternEvent MuonPattern MuonPrepRawData MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLayerHough TrkDriftCircleMath CxxUtils StoreGateLib SGtests EventPrimitives xAODMuon xAODTruth MuonReadoutGeometry MuonRIO_OnTrack TrkSurfaces TrkTruthData MuonHoughPatternToolsLib ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AtlasHepMCLib AthenaBaseComps GeoPrimitives GaudiKernel MuonDetDescrUtils MuonIdHelpersLib MuonClusterizationLib MuonHoughPatternEvent MuonPattern MuonPrepRawData MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLayerHough TrkDriftCircleMath CxxUtils StoreGateLib SGtests EventPrimitives xAODMuon xAODTruth MuonReadoutGeometry MuonRIO_OnTrack TrkSurfaces TrkTruthData MuonHoughPatternToolsLib ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx index 0ef5eb14d9f7a73338ad317117fbdbdbb3aea8ef..96392fc3ce72e70b5fe40309ef3c4b94fae019a3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx @@ -11,7 +11,7 @@ #include "MuonPattern/MuonPatternChamberIntersect.h" #include "TFile.h" #include "TTree.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "GaudiKernel/ConcurrencyFlags.h" #include "CxxUtils/sincos.h" #include "xAODTruth/TruthParticle.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py index cc388d67f2a98e73bd962bfa203c6c6e5cf44dbb..dc60454c09e787f4951d93974da1dc759dcaf75f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py @@ -288,6 +288,7 @@ class MuonSegmentMatchingTool(CfgMgr.Muon__MuonSegmentMatchingTool): def __init__(self,name='MuonSegmentMatchingTool',**kwargs): kwargs.setdefault( "doThetaMatching", muonStandaloneFlags.useSegmentMatching() ) kwargs.setdefault( "doPhiMatching", False ) + kwargs.setdefault( "ToroidOn", jobproperties.BField.allToroidOn() ) if beamFlags.beamType() == 'cosmics': # switch off cut of phi hit pulls kwargs.setdefault("OverlapMatchAveragePhiHitPullCut", 200. ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py index 198e44c885d7652019d36d1ea486574036437804..fca36cb879047561dbe7385108ef2dd6a58b5cfe 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py @@ -62,7 +62,7 @@ addTool("MuonRecExample.MuonRecTools.MuonStraightLineExtrapolator", "MuonStraigh addTool("Trk::KalmanUpdator", "MuonMeasUpdator") -addService("Muon::MuonIdHelperSvc", "MuonIdHelperSvc", HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=(CommonGeometryFlags.Run() in ["RUN3", "RUN4"]), HasMM=(CommonGeometryFlags.Run() in ["RUN3", "RUN4"])) +addService("Muon::MuonIdHelperSvc", "MuonIdHelperSvc", HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=MuonGeometryFlags.hasSTGC(), HasMM=MuonGeometryFlags.hasMM()) addTool("Muon::MuonIdHelperTool", "MuonIdHelperTool") addTool("Muon::MuonTrackTruthTool", "MuonTrackTruthTool") @@ -85,7 +85,7 @@ addTool( "MuonRecExample.MuonRecTools.MuonChi2TrackFitter", "MuonChi2TrackFitter addTool( "MuonRecExample.MuonRecTools.MuonChi2TrackFitter", "MuonChi2SLTrackFitter", StraightLine=True ) addTool( "MuonRecExample.MuonRecTools.MuonSegmentMomentum", "MuonSegmentMomentum" ) -addTool( "MuonRecExample.MuonRecTools.MuonSegmentMomentumFromField", "MuonSegmentMomentumFromField", HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=(CommonGeometryFlags.Run() in ["RUN3", "RUN4"])) +addTool( "MuonRecExample.MuonRecTools.MuonSegmentMomentumFromField", "MuonSegmentMomentumFromField") addTool( "MuonRecExample.MuonRecTools.MuonPhiHitSelector", "MuonPhiHitSelector" ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackTruthTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackTruthTool.h index 2248a83df751d3fa0b9d641394a19b3573c99bcb..0421d00f3543d5a19ce632cbcf6c7e20c53b63de 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackTruthTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackTruthTool.h @@ -130,15 +130,15 @@ namespace Muon { /// returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory /// It traces the decay chain until if finds the first particle that is different flavor from the starting one. - virtual const HepMC::GenParticle& getMother( const TruthTrajectory& traj, const int barcodeIn ) const = 0; + virtual const HepMC::GenParticle* getMother( const TruthTrajectory& traj, const int barcodeIn ) const = 0; /// Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory. /// Ancestor here means the last particle at generator level that has a status code different from final state, e.g. Z - virtual const HepMC::GenParticle& getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const = 0; + virtual const HepMC::GenParticle* getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const = 0; /// Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. /// For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. - virtual const HepMC::GenParticle& getInitial( const TruthTrajectory& traj, const int barcodeIn ) const = 0; + virtual const HepMC::GenParticle* getInitial( const TruthTrajectory& traj, const int barcodeIn ) const = 0; /// Returns the number of steps a particle took while maintaining its PDG ID virtual unsigned int getNumberOfScatters( const TruthTrajectory& traj, const int barcodeIn ) const = 0; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/CMakeLists.txt index e52fed964abeb2fcff1041f33626439f9b5d51c1..077eae0f42d98df17f1c45e22afc59b4cc94f0dd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/CMakeLists.txt @@ -35,17 +35,17 @@ atlas_depends_on_subdirs( Tracking/TrkEvent/TrkTruthData Tracking/TrkExtrapolation/TrkExInterfaces Tracking/TrkFitter/TrkFitterInterfaces - Tracking/TrkTruthTracks/TrkTruthTrackInterfaces ) + Tracking/TrkTruthTracks/TrkTruthTrackInterfaces + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree ) # Component(s) in the package: atlas_add_component( MuonTruthTools src/*.h src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GeoPrimitives Identifier EventPrimitives GaudiKernel MuonIdHelpersLib MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonTrackMakerUtils MuonSimData TrkDetElementBase diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthSummaryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthSummaryTool.cxx index 02f2345c4784233836d765be5c1a42f6203ddf1e..d7fc6b9432e6a88f30bf15a290860ae0100816bd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthSummaryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthSummaryTool.cxx @@ -6,7 +6,7 @@ #include "MuonSegment/MuonSegment.h" #include "TrkTrack/Track.h" #include "TrkMeasurementBase/MeasurementBase.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <iostream> #include "TTree.h" #include "GaudiKernel/ITHistSvc.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthTrackBuilder.cxx index d49a6f30dee71abd89fa533c91622912091cf2b8..14057327b4b86fd3e905304e1d6fa9965d2a96c9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthTrackBuilder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthTrackBuilder.cxx @@ -33,7 +33,7 @@ #include "MuonPrepRawData/MuonCluster.h" #include "MuonSegment/MuonSegment.h" // HepMC -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" #include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt index 34042568373e7b196c0a55f1cb4965af2adb3d02..60ca416ad36c64018253222d12626fa9053b95f3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt @@ -35,16 +35,16 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkEvent/TrkTruthData Tracking/TrkExtrapolation/TrkExInterfaces Tracking/TrkFitter/TrkFitterInterfaces - Tracking/TrkTools/TrkToolInterfaces ) + Tracking/TrkTools/TrkToolInterfaces + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( MooSegmentCombinationFinder src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonChamberT0s MuonPattern MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils MuonEDM_AssociationObjects TrkSurfaces TrkEventPrimitives TrkParameters TrkSegment TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonChamberT0s MuonPattern MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils MuonEDM_AssociationObjects TrkSurfaces TrkEventPrimitives TrkParameters TrkSegment TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/CMakeLists.txt index 3eaf98460b333e9d68ae9b01dc56061309d9ce0d..77ae819bb4290782a9d3db54f7a5102aaea2b7a7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/CMakeLists.txt @@ -26,16 +26,16 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTruthData Tracking/TrkFitter/TrkFitterInterfaces - Tracking/TrkTools/TrkToolInterfaces ) + Tracking/TrkTools/TrkToolInterfaces + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( MuonClusterSegmentMakerTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps MuonPrepRawDataProviderToolsLib MuonDetDescrUtils MuonIdHelpersLib MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils TrkParameters TrkTrack TrkTruthData TrkFitterInterfaces TrkToolInterfaces ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib GaudiKernel AthenaBaseComps MuonPrepRawDataProviderToolsLib MuonDetDescrUtils MuonIdHelpersLib MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils TrkParameters TrkTrack TrkTruthData TrkFitterInterfaces TrkToolInterfaces ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx index 524d17be55948119ef8444e5f4f9d2a639f5661d..cc1979ee18e5d0002b72d662972dd4b30c5cbf99 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx @@ -16,7 +16,7 @@ // EDM #include "MuonPrepRawData/MdtPrepDataCollection.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" // interfaces #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/CMakeLists.txt index 90081cc38802ac831dd2fcc169cc7ab8a63aa181..a40dc0792785ebd84f731a9aca70ffc02b9d439a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/CMakeLists.txt @@ -10,7 +10,6 @@ atlas_depends_on_subdirs( PRIVATE Control/AthenaBaseComps DetectorDescription/GeoPrimitives GaudiKernel - MagneticField/MagFieldInterfaces MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack @@ -34,5 +33,5 @@ atlas_add_component( MuonSegmentMatchingTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MagFieldInterfaces MuonReadoutGeometry MuonIdHelpersLib MuonRIO_OnTrack MuonCompetingRIOsOnTrack MuonSegment MuonRecHelperToolsLib TrkDetDescrUtils TrkGeometry TrkEventPrimitives TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonRIO_OnTrack MuonCompetingRIOsOnTrack MuonSegment MuonRecHelperToolsLib TrkDetDescrUtils TrkGeometry TrkEventPrimitives TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.cxx index dd704556cd55492eac535c3a26f658f8034ce435..e2cf6904e149367bd37c485d3d4501e0bc681255 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.cxx @@ -1,31 +1,21 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonSegmentMatchingTool.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" - -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentPairMatchingTool.h" #include "MuonSegment/MuonSegment.h" #include <cmath> #include <iostream> - namespace Muon { MuonSegmentMatchingTool::MuonSegmentMatchingTool(const std::string& ty,const std::string& na,const IInterface* pa) : AthAlgTool(ty,na,pa), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_overlapResolvingTool("Muon::MuonSegmentInOverlapResolvingTool/MuonSegmentInOverlapResolvingTool"), m_pairMatchingTool("Muon::MuonSegmentPairMatchingTool/MuonSegmentPairMatchingTool"), - m_magFieldSvc("AtlasFieldSvc",na), m_straightLineMatches(0),m_straightLineMatchesGood(0), m_overlapMatches(0),m_overlapMatchesGood(0), m_curvedMatches(0),m_curvedMatchesGood(0) @@ -76,49 +66,16 @@ namespace Muon { declareProperty("DrExtrapolationRMS", m_drExtrapRMS = 10 ); declareProperty("DThetaExtrapolationRMS", m_dthetaExtrapRMS = 0.01*2 ); declareProperty("DrExtrapolationAlignementOffset", m_drExtrapAlignmentOffset = 50 ); - declareProperty("MagFieldSvc", m_magFieldSvc ); } - - MuonSegmentMatchingTool::~MuonSegmentMatchingTool(){} - - StatusCode MuonSegmentMatchingTool::initialize() { - if( AthAlgTool::initialize().isFailure() ) { - return StatusCode::FAILURE; - } - - if (m_magFieldSvc.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_magFieldSvc); - return StatusCode::FAILURE; - } - - if( m_edmHelperSvc.retrieve().isFailure() ){ - ATH_MSG_ERROR("Could not get " << m_edmHelperSvc ); - return StatusCode::FAILURE; - } - - if( m_printer.retrieve().isFailure() ){ - ATH_MSG_ERROR("Could not get " << m_printer ); - return StatusCode::FAILURE; - } - - if( m_idHelperTool.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_idHelperTool ); - return StatusCode::FAILURE; - } - - if( m_pairMatchingTool.retrieve().isFailure() ){ - ATH_MSG_ERROR("Could not find "<<m_pairMatchingTool); - return StatusCode::FAILURE; - } - - if( m_overlapResolvingTool.retrieve().isFailure() ){ - ATH_MSG_ERROR("Could not find "<<m_overlapResolvingTool); - return StatusCode::FAILURE; - } - + ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK(m_edmHelperSvc.retrieve()); + ATH_CHECK(m_printer.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_pairMatchingTool.retrieve()); + ATH_CHECK(m_overlapResolvingTool.retrieve()); return StatusCode::SUCCESS; } @@ -152,21 +109,21 @@ namespace Muon { Identifier chid2 = m_edmHelperSvc->chamberId(seg2); if( chid1 == chid2 ) return false; - MuonStationIndex::StIndex stIndex1 = m_idHelperTool->stationIndex(chid1); - MuonStationIndex::StIndex stIndex2 = m_idHelperTool->stationIndex(chid2); + MuonStationIndex::StIndex stIndex1 = m_idHelperSvc->stationIndex(chid1); + MuonStationIndex::StIndex stIndex2 = m_idHelperSvc->stationIndex(chid2); if( isSLMatch(chid1,chid2) ){ - if( !m_idHelperTool->isMdt(chid1) || !m_idHelperTool->isMdt(chid2)) return false; + if( !m_idHelperSvc->isMdt(chid1) || !m_idHelperSvc->isMdt(chid2)) return false; // if there is a stereo angle match using overlap matching tool if( stIndex1 == stIndex2 ){ if( hasStereoAngle(chid1,chid2) ){ if( !m_doOverlapMatch ) return true; - int eta1 = m_idHelperTool->mdtIdHelper().stationEta(chid1); - int eta2 = m_idHelperTool->mdtIdHelper().stationEta(chid2); - int phi1 = m_idHelperTool->sector(chid1); - int phi2 = m_idHelperTool->sector(chid2); + int eta1 = m_idHelperSvc->mdtIdHelper().stationEta(chid1); + int eta2 = m_idHelperSvc->mdtIdHelper().stationEta(chid2); + int phi1 = m_idHelperSvc->sector(chid1); + int phi2 = m_idHelperSvc->sector(chid2); // require that the two segments are close in eta AND are in adjecent sectors if( (eta1==eta2||eta1==eta2-1||eta1==eta2+1) && @@ -248,8 +205,8 @@ namespace Muon { } if (segDist > m_maxDistSegments) return false; - if( !m_idHelperTool->isMdt(chid) ) { - ATH_MSG_DEBUG(" not a mdt segment " << m_idHelperTool->toString(chid)); + if( !m_idHelperSvc->isMdt(chid) ) { + ATH_MSG_DEBUG(" not a mdt segment " << m_idHelperSvc->toString(chid)); return true; } @@ -294,10 +251,10 @@ namespace Muon { bool MuonSegmentMatchingTool::isSLMatch( const Identifier& chid1, const Identifier& chid2 ) const { // check whether there is field - if( !m_magFieldSvc->toroidOn() ) return true; + if(!m_toroidOn) return true; - MuonStationIndex::StIndex stIndex1 = m_idHelperTool->stationIndex(chid1); - MuonStationIndex::StIndex stIndex2 = m_idHelperTool->stationIndex(chid2); + MuonStationIndex::StIndex stIndex1 = m_idHelperSvc->stationIndex(chid1); + MuonStationIndex::StIndex stIndex2 = m_idHelperSvc->stationIndex(chid2); // check whether segments in same station if( stIndex1 == stIndex2 ) return true; @@ -313,14 +270,14 @@ namespace Muon { bool MuonSegmentMatchingTool::hasStereoAngle( const Identifier& id1, const Identifier& id2 ) const { // check whether same phi, else stereo angle (need correction for cosmic up-down tracks) - int phi1 = m_idHelperTool->mdtIdHelper().stationPhi(id1); - int phi2 = m_idHelperTool->mdtIdHelper().stationPhi(id2); + int phi1 = m_idHelperSvc->mdtIdHelper().stationPhi(id1); + int phi2 = m_idHelperSvc->mdtIdHelper().stationPhi(id2); if( phi1!=phi2) return true; // check whether there is a small/large overlap - bool isSmallChamber1 = m_idHelperTool->isSmallChamber(id1); - bool isSmallChamber2 = m_idHelperTool->isSmallChamber(id2); + bool isSmallChamber1 = m_idHelperSvc->isSmallChamber(id1); + bool isSmallChamber2 = m_idHelperSvc->isSmallChamber(id2); return isSmallChamber1 != isSmallChamber2; } @@ -334,23 +291,23 @@ namespace Muon { // calculate matching variables IMuonSegmentPairMatchingTool::SegmentMatchResult result = m_pairMatchingTool->matchResult(seg1,seg2); - MuonStationIndex::StIndex station_a = m_idHelperTool->stationIndex( result.chid_a ); - MuonStationIndex::StIndex station_b = m_idHelperTool->stationIndex( result.chid_b ); + MuonStationIndex::StIndex station_a = m_idHelperSvc->stationIndex( result.chid_a ); + MuonStationIndex::StIndex station_b = m_idHelperSvc->stationIndex( result.chid_b ); - bool isEndcap_a = m_idHelperTool->isEndcap( result.chid_a ); - bool isCSC_a = m_idHelperTool->isCsc( result.chid_a ); + bool isEndcap_a = m_idHelperSvc->isEndcap( result.chid_a ); + bool isCSC_a = m_idHelperSvc->isCsc( result.chid_a ); bool isBEE_a = station_a == MuonStationIndex::BE; - bool isEndcap_b = m_idHelperTool->isEndcap( result.chid_b ); - bool isCSC_b = m_idHelperTool->isCsc( result.chid_b ); + bool isEndcap_b = m_idHelperSvc->isEndcap( result.chid_b ); + bool isCSC_b = m_idHelperSvc->isCsc( result.chid_b ); bool isBEE_b = station_a == MuonStationIndex::BE; if ( m_dumpAngles ) { std::cout << "SegmentPositionChange " - << " " << m_idHelperTool->chamberNameString(result.chid_a) - << " " << m_idHelperTool->chamberNameString(result.chid_b) + << " " << m_idHelperSvc->chamberNameString(result.chid_a) + << " " << m_idHelperSvc->chamberNameString(result.chid_b) << " " << result.phiSector_a << " " << result.phiSector_b << " " << result.deltaTheta_a @@ -363,8 +320,8 @@ namespace Muon { // return true; // to get the maximum statistics and not be hindered by current cuts } - ATH_MSG_VERBOSE( "matching " << m_idHelperTool->chamberNameString(result.chid_a) - << " " << m_idHelperTool->chamberNameString(result.chid_b) + ATH_MSG_VERBOSE( "matching " << m_idHelperSvc->chamberNameString(result.chid_a) + << " " << m_idHelperSvc->chamberNameString(result.chid_b) << " phis " << result.phiSector_a << " " << result.phiSector_b << " thetas " << result.deltaTheta_a @@ -706,17 +663,17 @@ namespace Muon { // calculate matching variables IMuonSegmentPairMatchingTool::SegmentMatchResult result = m_pairMatchingTool->matchResult(seg1,seg2); - MuonStationIndex::StIndex station_a = m_idHelperTool->stationIndex( result.chid_a ); - MuonStationIndex::StIndex station_b = m_idHelperTool->stationIndex( result.chid_b ); + MuonStationIndex::StIndex station_a = m_idHelperSvc->stationIndex( result.chid_a ); + MuonStationIndex::StIndex station_b = m_idHelperSvc->stationIndex( result.chid_b ); - bool isEndcap_a = m_idHelperTool->isEndcap( result.chid_a ); + bool isEndcap_a = m_idHelperSvc->isEndcap( result.chid_a ); - bool isEndcap_b = m_idHelperTool->isEndcap( result.chid_b ); + bool isEndcap_b = m_idHelperSvc->isEndcap( result.chid_b ); if ( m_dumpAngles ) { std::cout << "SegmentPositionChange Phi" - << " " << m_idHelperTool->chamberNameString(result.chid_a) - << " " << m_idHelperTool->chamberNameString(result.chid_b) + << " " << m_idHelperSvc->chamberNameString(result.chid_a) + << " " << m_idHelperSvc->chamberNameString(result.chid_b) << " deltaPhipos " << result.deltaPhipos << " deltaPhidir " << result.deltaPhidir << " phiposerr_a " << result.phiposerr_a @@ -1064,8 +1021,8 @@ namespace Muon { Identifier chid2 = m_edmHelperSvc->chamberId(seg2); if( chid1 == chid2 ) return false; - MuonStationIndex::StIndex stIndex1 = m_idHelperTool->stationIndex(chid1); - MuonStationIndex::StIndex stIndex2 = m_idHelperTool->stationIndex(chid2); + MuonStationIndex::StIndex stIndex1 = m_idHelperSvc->stationIndex(chid1); + MuonStationIndex::StIndex stIndex2 = m_idHelperSvc->stationIndex(chid2); if( stIndex1 == stIndex2 ) return false; const MuonSegment* segInner = 0; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.h index 5a15c7f0b35ad211f62226eb9a0df9bfe877d324..823994d5486487f5d60dd603e5ede15d5906a5b4 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONSEGMENTMATCHINGTOOL_H @@ -10,19 +10,15 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" -#include "TrkGeometry/MagneticFieldProperties.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include <atomic> -class Identifier; +#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentPairMatchingTool.h" +#include "TrkGeometry/MagneticFieldProperties.h" -namespace Muon { - class MuonIdHelperTool; - class MuonEDMPrinterTool; - class IMuonSegmentInOverlapResolvingTool; - class IMuonSegmentPairMatchingTool; -} +#include <atomic> namespace Muon { @@ -42,7 +38,7 @@ namespace Muon { MuonSegmentMatchingTool(const std::string&,const std::string&,const IInterface*); /** @brief destructor */ - virtual ~MuonSegmentMatchingTool (); + virtual ~MuonSegmentMatchingTool()=default; /** @brief AlgTool initilize */ StatusCode initialize(); @@ -86,14 +82,15 @@ namespace Muon { /** @brief match an endcap middle or outer segment with an inner segment using a simple analytic extrapolation model */ bool endcapExtrapolationMatch( const MuonSegment& seg1, const MuonSegment& seg2, bool useTightCuts ) const; - ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; //!< IdHelper tool + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< EDM Helper tool ToolHandle<Muon::MuonEDMPrinterTool> m_printer; //!< EDM printer tool ToolHandle<Muon::IMuonSegmentInOverlapResolvingTool> m_overlapResolvingTool; //!< matching tool to handle the overlaps ToolHandle<Muon::IMuonSegmentPairMatchingTool> m_pairMatchingTool; //!< matching tool to handle the pairs of segments - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + + Gaudi::Property<bool> m_toroidOn { this, "ToroidOn", true, "Status of toroidal B-Field" }; mutable std::atomic_uint m_straightLineMatches; mutable std::atomic_uint m_straightLineMatchesGood; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/CMakeLists.txt index b51509a05d41312953b3c78360d03b990b96399f..2bfbd9ffafbb3e02df01e0c492a8471ebe2f41e3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/CMakeLists.txt @@ -9,7 +9,8 @@ atlas_subdir( MuonSegmentMomentum ) atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps GaudiKernel - MagneticField/MagFieldInterfaces + MagneticField/MagFieldElements + MagneticField/MagFieldConditions MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces PRIVATE DetectorDescription/GeoPrimitives @@ -30,11 +31,13 @@ atlas_add_library( MuonSegmentMomentumLib src/*.cxx NO_PUBLIC_HEADERS PRIVATE_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES AthenaBaseComps GaudiKernel MagFieldInterfaces MuonRecToolInterfaces MuonIdHelpersLib + LINK_LIBRARIES AthenaBaseComps GaudiKernel MagFieldElements MagFieldConditions + MuonRecToolInterfaces MuonIdHelpersLib PRIVATE_LINK_LIBRARIES ${EIGEN_LIBRARIES} GeoPrimitives MuonSegment TrkGeometry TrkCompetingRIOsOnTrack TrkParameters TrkRIO_OnTrack TrkExInterfaces TrkExUtils ) atlas_add_component( MuonSegmentMomentum src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel MagFieldInterfaces MuonRecToolInterfaces GeoPrimitives MuonIdHelpersLib MuonSegment TrkGeometry TrkCompetingRIOsOnTrack TrkParameters TrkRIO_OnTrack TrkExInterfaces TrkExUtils MuonSegmentMomentumLib ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel MagFieldElements MagFieldConditions + MuonRecToolInterfaces GeoPrimitives MuonIdHelpersLib MuonSegment TrkGeometry TrkCompetingRIOsOnTrack TrkParameters TrkRIO_OnTrack TrkExInterfaces TrkExUtils MuonSegmentMomentumLib ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.cxx index 76a12e754a312e4392768cd666e6d2a24122c4a8..876c063c79113019cd359607653a6b255a6083ff 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonSegmentMomentumFromField.h" @@ -14,12 +14,8 @@ #include "TrkGeometry/TrackingVolume.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" - -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" -#include "MuonIdHelpers/sTgcIdHelper.h" #include "GeoPrimitives/GeoPrimitivesToStringConverter.h" +#include <TString.h> // for Form MuonSegmentMomentumFromField::MuonSegmentMomentumFromField(const std::string& type,const std::string& name,const IInterface* parent):AthAlgTool(type,name,parent) @@ -29,33 +25,16 @@ MuonSegmentMomentumFromField::MuonSegmentMomentumFromField(const std::string& ty StatusCode MuonSegmentMomentumFromField::initialize() { - ATH_MSG_VERBOSE(" MuonSegmentMomentumFromField::Initializing "); - - ATH_CHECK( m_magFieldSvc.retrieve() ); - - ATH_CHECK( m_propagator.retrieve() ); - - ATH_CHECK( m_navigator.retrieve() ); - - if (m_hasCSC) ATH_CHECK( detStore()->retrieve( m_cscid ) ); - - ATH_CHECK( detStore()->retrieve( m_rpcid ) ); - - ATH_CHECK( detStore()->retrieve( m_tgcid ) ); - - if (m_hasSTgc) ATH_CHECK( detStore()->retrieve( m_stgcid ) ); - + ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK(m_propagator.retrieve()); + ATH_CHECK(m_navigator.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_fieldCondObjInputKey.initialize()); ATH_MSG_VERBOSE("End of Initializing"); - return StatusCode::SUCCESS; } -StatusCode MuonSegmentMomentumFromField::finalize() -{ - return StatusCode::SUCCESS; -} - void MuonSegmentMomentumFromField::fitMomentumVectorSegments( const std::vector <const Muon::MuonSegment*> segments, double & signedMomentum ) const { @@ -81,14 +60,9 @@ void MuonSegmentMomentumFromField::fitMomentumVectorSegments( const std::vector it++; it2++; } - - ATH_MSG_DEBUG( " Estimated signed momentum " << signedMomentum ); - } - - double MuonSegmentMomentumFromField::fieldIntegralEstimate( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const { @@ -104,13 +78,21 @@ double MuonSegmentMomentumFromField::fieldIntegralEstimate( const Muon::MuonSegm Amg::Vector3D point2=pos1+.5*posdiff; Amg::Vector3D point3=pos1+.75*posdiff; Amg::Vector3D field1,field2,field3; - m_magFieldSvc->getField(point1.data(),field1.data()); // field in kiloTesla - m_magFieldSvc->getField(point2.data(),field2.data()); - m_magFieldSvc->getField(point3.data(),field3.data()); + + MagField::AtlasFieldCache fieldCache; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (!fieldCondObj) { + throw std::runtime_error(Form("File: %s, Line: %d\nMuonSegmentMomentumFromField::fieldIntegralEstimate() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (m_fieldCondObjInputKey.key()).c_str())); + } + fieldCondObj->getInitializedCache(fieldCache); + + fieldCache.getField(point1.data(),field1.data()); // field in kiloTesla + fieldCache.getField(point2.data(),field2.data()); + fieldCache.getField(point3.data(),field3.data()); ATH_MSG_DEBUG("Mid Point " << Amg::toString(point2) << " field " << Amg::toString(field2) ); field1[2]=field2[2]=field3[2]=0; Amg::Vector3D fieldsum=field1+field2+field3; - //double averageBcrossl=(field1.cross(posdiff.unit()).mag()+field2.cross(posdiff.unit()).mag()+field3.cross(posdiff.unit()).mag())/3; Amg::Vector3D crossvec=posdiff.unit().cross(field1+field2+field3); Amg::Vector2D rphidir(-posdiff.y(),posdiff.x()); double averagelcrossB=crossvec.mag()/3; @@ -158,8 +140,8 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment if (!rot) continue; Identifier id=rot->identify(); - if ((m_rpcid->is_rpc(id) && m_rpcid->measuresPhi(id)) || (m_cscid && m_cscid->is_csc(id) && m_cscid->measuresPhi(id)) || (m_tgcid->is_tgc(id) && m_tgcid->isStrip(id)) - || (m_stgcid && m_stgcid->is_stgc(id) && m_stgcid->measuresPhi(id) ) ){ + if ((m_idHelperSvc->isRpc(id) && m_idHelperSvc->rpcIdHelper().measuresPhi(id)) || (m_idHelperSvc->isCsc(id) && m_idHelperSvc->cscIdHelper().measuresPhi(id)) || (m_idHelperSvc->isTgc(id) && m_idHelperSvc->tgcIdHelper().isStrip(id)) + || (m_idHelperSvc->issTgc(id) && m_idHelperSvc->stgcIdHelper().measuresPhi(id) ) ){ if (!firstphi1) firstphi1=rot; lastphi1=rot; } @@ -172,15 +154,15 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment } if (!rot) continue; Identifier id=rot->identify(); - if ((m_rpcid->is_rpc(id) && m_rpcid->measuresPhi(id)) || (m_cscid && m_cscid->is_csc(id) && m_cscid->measuresPhi(id)) || (m_tgcid->is_tgc(id) && m_tgcid->isStrip(id)) - || (m_stgcid && m_stgcid->is_stgc(id) && m_stgcid->measuresPhi(id) ) ){ + if ((m_idHelperSvc->isRpc(id) && m_idHelperSvc->rpcIdHelper().measuresPhi(id)) || (m_idHelperSvc->isCsc(id) && m_idHelperSvc->cscIdHelper().measuresPhi(id)) || (m_idHelperSvc->isTgc(id) && m_idHelperSvc->tgcIdHelper().isStrip(id)) + || (m_idHelperSvc->issTgc(id) && m_idHelperSvc->stgcIdHelper().measuresPhi(id) ) ){ if (!firstphi2) firstphi2=rot; lastphi2=rot; } } bool flip = false; - if (firstphi1) dist1=fabs((firstphi1->globalPosition()-lastphi1->globalPosition()).dot(myseg1->globalDirection())); - if (firstphi2) dist2=fabs((firstphi2->globalPosition()-lastphi2->globalPosition()).dot(myseg2->globalDirection())); + if (firstphi1) dist1=std::abs((firstphi1->globalPosition()-lastphi1->globalPosition()).dot(myseg1->globalDirection())); + if (firstphi2) dist2=std::abs((firstphi2->globalPosition()-lastphi2->globalPosition()).dot(myseg2->globalDirection())); if (dist2>dist1) { flip = true; bestseg=myseg2; @@ -201,7 +183,7 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment } signedMomentum =-.3e3*fieldintegral/deltatheta; - if(fabs(signedMomentum)<1000.) signedMomentum = 1e6; + if(std::abs(signedMomentum)<1000.) signedMomentum = 1e6; ATH_MSG_DEBUG("integral: " << fieldintegral << " deltatheta: " << deltatheta << " signedmomentum : " << signedMomentum); double residual = 9999.; double resi[4],qoverp[4]; @@ -225,20 +207,20 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment if(qoverp[i]!=qoverp[i-1]) { double derivative = -(resi[i]-resi[i-1])/(qoverp[i]-qoverp[i-1]); ATH_MSG_DEBUG(" numerical derivative " << derivative << " derivative from track " << (*jac)(1,4) << " der_simple " << der_simple); - if(fabs(derivative)>fabs((*jac)(1,4))) { + if(std::abs(derivative)>std::abs((*jac)(1,4))) { ATH_MSG_DEBUG(" use numerical derivative " << derivative << " derivative from track " << (*jac)(1,4)); delta_qoverp = residual/derivative; } } } else { - if(fabs(der_simple)>fabs((*jac)(1,4))) { + if(std::abs(der_simple)>std::abs((*jac)(1,4))) { ATH_MSG_DEBUG(" use simple numerical derivative " << der_simple << " derivative from track " << (*jac)(1,4)); delta_qoverp = residual/der_simple; } } ATH_MSG_DEBUG("residual: " << residual << " jac " << (*jac)(1,4) << " signedmomentum: " << signedMomentum << " delta_qoverp " << delta_qoverp); double signedMomentum_updated = signedMomentum/(1+signedMomentum*delta_qoverp); - if(fabs(signedMomentum_updated)<1000.) { + if(std::abs(signedMomentum_updated)<1000.) { ATH_MSG_DEBUG("Too low signed momentum " << signedMomentum_updated ); // protect against too low momenta as propagation will fail signedMomentum = signedMomentum_updated>0? 1000.:-1000; @@ -251,7 +233,7 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment if (std::abs(residual)<1) break; } } - if(fabs(residual)>10.) { + if(std::abs(residual)>10.) { ATH_MSG_DEBUG("NOT converged residual: " << residual << " itry " << itry); if(itry==1) ATH_MSG_DEBUG("NOT converged residual after two trials "); } else break; @@ -274,9 +256,18 @@ double MuonSegmentMomentumFromField::fieldIntegralEstimate_old( const Muon::Muon Amg::Vector3D point2=pos1+.5*posdiff; Amg::Vector3D point3=pos1+.75*posdiff; Amg::Vector3D field1,field2,field3; - m_magFieldSvc->getField((double*)&point1,(double*)&field1); // field in kiloTesla - m_magFieldSvc->getField((double*)&point2,(double*)&field2); - m_magFieldSvc->getField((double*)&point3,(double*)&field3); + + MagField::AtlasFieldCache fieldCache; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (!fieldCondObj) { + throw std::runtime_error(Form("File: %s, Line: %d\nMuonSegmentMomentumFromField::fieldIntegralEstimate_old() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (m_fieldCondObjInputKey.key()).c_str())); + } + fieldCondObj->getInitializedCache(fieldCache); + + fieldCache.getField(point1.data(),field1.data()); // field in kiloTesla + fieldCache.getField(point2.data(),field2.data()); + fieldCache.getField(point3.data(),field3.data()); ATH_MSG_DEBUG("Mid Point " << Amg::toString(point2) << " field " << Amg::toString(field2) ); double averageBcrossl=(field1.cross(posdiff.unit()).mag()+field2.cross(posdiff.unit()).mag()+field3.cross(posdiff.unit()).mag())/3; ATH_MSG_DEBUG("field integral " << averageBcrossl << "dist " << posdiff.mag() << " tot " << averageBcrossl*posdiff.mag()); @@ -322,8 +313,8 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments_old( const Muon::MuonSeg if (!rot) continue; Identifier id=rot->identify(); - if ((m_rpcid->is_rpc(id) && m_rpcid->measuresPhi(id)) || (m_cscid && m_cscid->is_csc(id) && m_cscid->measuresPhi(id)) || - (m_tgcid->is_tgc(id) && m_tgcid->isStrip(id))){ + if ((m_idHelperSvc->isRpc(id) && m_idHelperSvc->rpcIdHelper().measuresPhi(id)) || (m_idHelperSvc->isCsc(id) && m_idHelperSvc->cscIdHelper().measuresPhi(id)) || + (m_idHelperSvc->isTgc(id) && m_idHelperSvc->tgcIdHelper().isStrip(id))){ if (!firstphi1) firstphi1=rot; lastphi1=rot; } @@ -336,21 +327,20 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments_old( const Muon::MuonSeg } if (!rot) continue; Identifier id=rot->identify(); - if ((m_rpcid->is_rpc(id) && m_rpcid->measuresPhi(id)) || (m_cscid && m_cscid->is_csc(id) && m_cscid->measuresPhi(id)) || - (m_tgcid->is_tgc(id) && m_tgcid->isStrip(id))){ + if ((m_idHelperSvc->isRpc(id) && m_idHelperSvc->rpcIdHelper().measuresPhi(id)) || (m_idHelperSvc->isCsc(id) && m_idHelperSvc->cscIdHelper().measuresPhi(id)) || + (m_idHelperSvc->isTgc(id) && m_idHelperSvc->tgcIdHelper().isStrip(id))){ if (!firstphi2) firstphi2=rot; lastphi2=rot; } } - if (firstphi1) dist1=fabs((firstphi1->globalPosition()-lastphi1->globalPosition()).dot(myseg1->globalDirection())); - if (firstphi2) dist2=fabs((firstphi2->globalPosition()-lastphi2->globalPosition()).dot(myseg2->globalDirection())); + if (firstphi1) dist1=std::abs((firstphi1->globalPosition()-lastphi1->globalPosition()).dot(myseg1->globalDirection())); + if (firstphi2) dist2=std::abs((firstphi2->globalPosition()-lastphi2->globalPosition()).dot(myseg2->globalDirection())); if (dist2>dist1) { bestseg=myseg2; worstseg=myseg1; } signedMomentum =-.3e3*fieldintegral/deltatheta; - //std::cout << "integral: " << fieldintegral << " deltatheta: " << deltatheta << " signedmomentum : " << signedMomentum << std::endl; ATH_MSG_DEBUG("integral: " << fieldintegral << " deltatheta: " << deltatheta << " signedmomentum : " << signedMomentum); for (int i=0;i<3;i++){ Trk::AtaPlane startpar(bestseg->globalPosition(),bestseg->globalDirection().phi(),bestseg->globalDirection().theta(), @@ -364,7 +354,6 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments_old( const Muon::MuonSeg double delta_qoverp=residual/(*jac)(1,4); signedMomentum=1/(1/signedMomentum+delta_qoverp); ATH_MSG_DEBUG("residual: " << residual << " jac " << (*jac)(1,4) << " dp " << delta_qoverp << " signedmomentum: " << signedMomentum); - //std::cout << "residual: " << residual << " signedmomentum: " << signedMomentum << std::endl; delete par; delete jac; if (std::abs(residual)<1) break; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.h index cce19fbf0e4ed0580192764e6ea0cc537871c108..84fe76202c3ec12890bf8a8ebb6e82923aca16ab 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonSegmentMomentumFromField_MuonSegmentMomentumFromField_H @@ -7,15 +7,14 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "MuonRecToolInterfaces/IMuonSegmentMomentumEstimator.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "TrkExInterfaces/IPropagator.h" #include "TrkExInterfaces/INavigator.h" - -class RpcIdHelper; -class CscIdHelper; -class TgcIdHelper; -class sTgcIdHelper; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" namespace Muon { class MuonSegment; @@ -30,8 +29,6 @@ class MuonSegmentMomentumFromField : public AthAlgTool, virtual public Muon::IMu /** to initiate private members */ virtual StatusCode initialize(); - /** to delete private members */ - virtual StatusCode finalize(); /** fits a momentum to 2 segments */ virtual void fitMomentum2Segments( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const; @@ -43,19 +40,14 @@ class MuonSegmentMomentumFromField : public AthAlgTool, virtual public Muon::IMu double fieldIntegralEstimate(const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const; double fieldIntegralEstimate_old(const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc {this, "MagFieldSvc", "AtlasFieldSvc"}; ToolHandle<Trk::IPropagator> m_propagator{this, "PropagatorTool", "Trk::STEP_Propagator/MuonPropagator"}; ToolHandle<Trk::INavigator> m_navigator {this, "NavigatorTool", "Trk::Navigator/MuonNavigator"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj"}; - const RpcIdHelper* m_rpcid {nullptr}; - const TgcIdHelper* m_tgcid {nullptr}; - const CscIdHelper* m_cscid {nullptr}; - const sTgcIdHelper* m_stgcid {nullptr}; Gaudi::Property<bool> m_doOld {this, "DoOld", false, "Use old fitMomentum2Segments"}; - Gaudi::Property<bool> m_hasCSC {this, "HasCSC", true, "Is CSC available?"}; - Gaudi::Property<bool> m_hasSTgc {this, "HasSTgc", true, "is sTGC available?"}; }; #endif // MuonSegmentMomentumFromField_H diff --git a/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt b/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt index 44e8dc1fd8ed101aa6cb091ba3f5660e83fdcdf9..17fd949e4842dc53c2b35e13700e3cc358e29402 100644 --- a/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt +++ b/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt @@ -51,17 +51,17 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkRIO_OnTrack Tracking/TrkEvent/TrkSegment Tracking/TrkExtrapolation/TrkExInterfaces - Tracking/TrkFitter/TrkFitterInterfaces ) + Tracking/TrkFitter/TrkFitterInterfaces + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_component( MuonTruthAlgs src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} StoreGateLib SGtests Identifier GaudiKernel MuonPrepRawData MuonRecToolInterfaces MuonSimData TrkTrack TrkTruthData TrkToolInterfaces AthenaBaseComps AthLinks AthContainers AtlasDetDescr EventPrimitives xAODMuon xAODTracking xAODTruth GeneratorObjects MuonReadoutGeometry MuonGeoModelLib MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPattern MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MCTruthClassifierLib Particle ParticleTruth TrkDetElementBase TrkGeometry TrkSurfaces TrkCompetingRIOsOnTrack TrkEventUtils TrkMeasurementBase TrkParameters TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkExInterfaces TrkFitterInterfaces ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib StoreGateLib SGtests Identifier GaudiKernel MuonPrepRawData MuonRecToolInterfaces MuonSimData TrkTrack TrkTruthData TrkToolInterfaces AthenaBaseComps AthLinks AthContainers AtlasDetDescr EventPrimitives xAODMuon xAODTracking xAODTruth GeneratorObjects MuonReadoutGeometry MuonGeoModelLib MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPattern MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MCTruthClassifierLib Particle ParticleTruth TrkDetElementBase TrkGeometry TrkSurfaces TrkCompetingRIOsOnTrack TrkEventUtils TrkMeasurementBase TrkParameters TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkExInterfaces TrkFitterInterfaces ) # Install files from the package: atlas_install_headers( MuonTruthAlgs ) diff --git a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h index a3402457145cf056ee31eaa0660a151ab019a75c..63b6c0c53aa3350f39689f06155451940725bb80 100644 --- a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h +++ b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h @@ -95,16 +95,16 @@ namespace Muon { /// Returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory. /// It traces the decay chain until if finds the first particle that is different flavor from the starting one. - const HepMC::GenParticle& getMother( const TruthTrajectory& traj, const int barcodeIn ) const; + const HepMC::GenParticle* getMother( const TruthTrajectory& traj, const int barcodeIn ) const; /// Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory. /// Ancestor here means the last particle at generator level that has a status code different from final state, e.g. Z - const HepMC::GenParticle& getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const; + const HepMC::GenParticle* getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const; /// Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. /// For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. /// This interface calls the method getInitialPair. - const HepMC::GenParticle& getInitial( const TruthTrajectory& traj, const int barcodeIn ) const; + const HepMC::GenParticle* getInitial( const TruthTrajectory& traj, const int barcodeIn ) const; /// Returns the number of steps a particle took while maintaining its PDG ID. /// This method calls getInitialPair for calculating this number. diff --git a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx index 7c951ba40259bfde1efd9f9508f885b1c15fd44c..69e3e795536b96481113e84c2162d2c1f6243c0b 100755 --- a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx @@ -14,8 +14,8 @@ #include "TrkTruthData/DetailedSegmentTruth.h" #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "AthContainers/DataVector.h" @@ -60,7 +60,7 @@ #include "MuonPrepRawData/MuonCluster.h" #include "MuonSegment/MuonSegment.h" // HepMC -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" #include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx index 3596323e1edb03f7b325b1bc195d904028ebc129..23e7803fa86b155661fba73baef77ebce9b9da59 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx @@ -8,8 +8,8 @@ #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "AthContainers/DataVector.h" diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.h b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.h index 1c293e8b50d985728ed4ffd754a66fe24d89f6a7..0aecc456146e649dd326d52bf93d029a24e41090 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.h +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.h @@ -10,7 +10,7 @@ #include "TrkToolInterfaces/ITruthTrajectoryBuilder.h" #include "AthenaBaseComps/AthAlgTool.h" -namespace HepMC { class GenVertex; } +#include "AtlasHepMC/GenVertex.h" namespace Muon { diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx index 627410c4b3f6d4c38855e0b5af38997e12233e3f..aabb23eef5f3b3c0916cd9def39d40727f2a68ec 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx @@ -8,8 +8,8 @@ #include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "TrkToolInterfaces/ITruthTrajectoryBuilder.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkTruthData/TruthTrajectory.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" @@ -741,57 +741,49 @@ namespace Muon { m_truthTrajectoriesToBeDeleted.clear(); } - const HepMC::GenParticle& MuonTrackTruthTool::getMother( const TruthTrajectory& traj, const int barcodeIn ) const { - std::vector<HepMcParticleLink>::const_iterator pit = traj.begin(); - std::vector<HepMcParticleLink>::const_iterator pit_end = traj.end(); + const HepMC::GenParticle* MuonTrackTruthTool::getMother( const TruthTrajectory& traj, const int barcodeIn ) const { ATH_MSG_DEBUG( "getMother() : size = " << traj.size() ); - const HepMC::GenParticle* theMother = 0; - int pdgFinal = (*pit)->pdg_id(); + int pdgFinal = ( (traj.size()==0)? -999 : traj.front()->pdg_id()); bool foundBC = false; - for( ;pit!=pit_end;++pit ){ - if ((*pit)->barcode()==barcodeIn || foundBC){ + for( auto pit: traj){ + if (!pit) continue; + if (pit->barcode()==barcodeIn || foundBC){ foundBC = true; - ATH_MSG_DEBUG( "getMother() : pdg = " << (*pit)->pdg_id() << " barcode = " << (*pit)->barcode () ); - if( (*pit)->pdg_id() != pdgFinal ) { // the first case a track had a different flavour - theMother = *pit; + ATH_MSG_DEBUG( "getMother() : pdg = " << pit->pdg_id() << " barcode = " << pit->barcode () ); + if( pit->pdg_id() != pdgFinal ) { // the first case a track had a different flavour + if (pit->pdg_id()==pdgFinal) ATH_MSG_ERROR( "Wrong pdgId association in getMother() " ); + return pit; break; } } } - - // sanity check - if (theMother && theMother->pdg_id()==pdgFinal) ATH_MSG_ERROR( "Wrong pdgId association in getMother() " ); - return *theMother; + return nullptr; } - const HepMC::GenParticle& MuonTrackTruthTool::getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const { - std::vector<HepMcParticleLink>::const_iterator pit = traj.begin(); - std::vector<HepMcParticleLink>::const_iterator pit_end = traj.end(); - const HepMC::GenParticle* theAncestor = 0; + const HepMC::GenParticle* MuonTrackTruthTool::getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const { bool foundBC = false; - for( ;pit!=pit_end;++pit ){ - if ((*pit)->barcode()==barcodeIn || foundBC){ + for(auto pit: traj){ + if (!pit) continue; + if (pit->barcode()==barcodeIn || foundBC){ foundBC = true; - if( (*pit)->status() > 1 ) {//first non final state particle - theAncestor = *pit; + if( pit->status() > 1 ) {//first non final state particle + return pit; break; } } } - return *theAncestor; + return nullptr; } const std::pair<const HepMC::GenParticle*, unsigned int> MuonTrackTruthTool::getInitialPair( const TruthTrajectory& traj, const int barcodeIn ) const { - std::pair<const HepMC::GenParticle*,unsigned int> thePair; + std::pair<const HepMC::GenParticle*,unsigned int> thePair(nullptr,0); unsigned int scat = 0; ATH_MSG_DEBUG( "getFirst() : size = " << traj.size() ); - std::vector<HepMcParticleLink>::const_iterator pit = traj.begin(); - std::vector<HepMcParticleLink>::const_iterator pit_end = traj.end(); - const HepMC::GenParticle* theFirst = 0; bool foundBC = false; int pdgFinal = 0; double ePrev = 0.; - for( ;pit!=pit_end;++pit ){ + const HepMC::GenParticle* theFirst=nullptr; + for(auto pit=traj.begin();pit!=traj.end();++pit){ if ((*pit)->barcode()==barcodeIn || foundBC){ if (!foundBC){ foundBC = true; @@ -799,7 +791,7 @@ namespace Muon { pdgFinal = (*pit)->pdg_id(); } else { if( (*pit)->pdg_id() == pdgFinal ) { - const HepMC::GenParticle* pit_p = *pit; + auto pit_p = *pit; if ( (theFirst != pit_p) && ((*pit)->momentum().t()!=ePrev) ) ++scat; // if the particle has not changed pdgid after the first step count as scatter. also avoid counting pure interface changes as scatter } else { // the first time this particle appears --pit; @@ -820,8 +812,8 @@ namespace Muon { return thePair; } - const HepMC::GenParticle& MuonTrackTruthTool::getInitial( const TruthTrajectory& traj, const int barcodeIn ) const { - return *((getInitialPair( traj, barcodeIn )).first); + const HepMC::GenParticle* MuonTrackTruthTool::getInitial( const TruthTrajectory& traj, const int barcodeIn ) const { + return getInitialPair( traj, barcodeIn ).first; } unsigned int MuonTrackTruthTool::getNumberOfScatters( const TruthTrajectory& traj, const int barcodeIn ) const { diff --git a/MuonSpectrometer/MuonTruthAlgs/src/TrackParticleTruthMaker.cxx b/MuonSpectrometer/MuonTruthAlgs/src/TrackParticleTruthMaker.cxx index cc0a5f2aeae3345d3666a2d707148f456ee74619..ceb8c218aa48c742deaac2e2ccf2643696785137 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/TrackParticleTruthMaker.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/TrackParticleTruthMaker.cxx @@ -15,7 +15,7 @@ #include "ParticleTruth/TrackParticleTruthCollection.h" #include "TrkTrack/TrackCollection.h" #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <map> #include "AthLinks/ElementLink.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/python/MuonDQAMonitoringConfig.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/python/MuonDQAMonitoringConfig.py index 9fcfb2aa7a2df0a36a7d14350ed680808dfcd454..3120285fc856a7e4604a3a7b316e026f7e1e02e9 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/python/MuonDQAMonitoringConfig.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/python/MuonDQAMonitoringConfig.py @@ -1,21 +1,25 @@ # # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # - def MuonDQAMonitoringConfig(flags): + print("entering muon daq") + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator result = ComponentAccumulator() - if flags.DQ.Steering.Muon.doRawMon: + if flags.DQ.Steering.Muon.doRawMon and False: # do not run in RAW->ESD, or AOD-only if flags.DQ.Environment not in ('tier0Raw', 'AOD'): from MdtRawDataMonitoring.MDTMonitorAlgorithm import MdtMonitoringConfig from RpcRawDataMonitoring.RpcMonitorAlgorithm import RpcMonitoringConfig - from TgcRawDataMonitoring.TgcRawDataMonitorAlgorithm import TgcRawDataMonitoringConfig - result.merge(MdtMonitoringConfig(flags)) result.merge(RpcMonitoringConfig(flags)) - result.merge(TgcRawDataMonitoringConfig(flags)) - + + from TgcRawDataMonitoring.TgcRawDataMonitorAlgorithm import TgcRawDataMonitoringConfig + result.merge(TgcRawDataMonitoringConfig(flags)) + + if flags.DQ.Steering.Muon.doTrackMon: + from MuonTrackMonitoring.MuonTrackMonitorAlgorithm import MuonTrackConfig + result.merge(MuonTrackConfig(flags)) return result diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/share/MuonDetMonitoring.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/share/MuonDetMonitoring.py index 931f239562691bc2a772d40b23e6a3dc20b05172..ae01ee5ff721c392090f227db20b86cfc7cc54a1 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/share/MuonDetMonitoring.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/share/MuonDetMonitoring.py @@ -161,17 +161,6 @@ if DQMonFlags.doMuonSegmentMon(): except Exception: treatException("DataQualitySteering_jobOptions.py: exception when setting up Muon CSC segment monitoring") -#------------- ---------# -# Muon track monitoring # -#------------- ---------# -if DQMonFlags.doMuonTrackMon(): - try: - if MuonDQADetFlags.doMuonTrackMon(): - include ("MuonTrackMonitoring/MuonTrackDQA_options.py") - # if MuonDQADetFlags.MuonTrkMonDoTrigger() and DQMonFlags.useTrigger(): ## monitoring tool cannot have a dependence on TrigDecisionTool if DQMonFlags.useTrigger==False (ATLASRECTS-3549) - # include ("MuonTrackMonitoring/MuonTrigTrackDQA_options.py") - except Exception: - treatException("DataQualitySteering_jobOptions.py: exception when setting up Muon track monitoring") #-------------------------# # Muon physics monitoring # diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/python/RpcMonitorAlgorithm.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/python/RpcMonitorAlgorithm.py index 4fe7d1f1df8721d99b149b645aa08d875df9ba33..bb84ded649a341438729dcf01046646af3ee0b54 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/python/RpcMonitorAlgorithm.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/python/RpcMonitorAlgorithm.py @@ -25,12 +25,12 @@ def RpcMonitoringConfig(inputFlags): myGroup.defineHistogram('run;Run', title='Run Number;run;Events', type='TH1I', - path='PlotCand', + path='PlotCand', xbins=1000000,xmin=-0.5,xmax=999999.5) myGroup.defineHistogram('nMu;NMuon', title='Number of Muons;nMuons;Events', type='TH1I', - path='PlotCand', + path='PlotCand', xbins=10,xmin=-0.5,xmax=9.5) myGroup.defineHistogram('nMuBarrel;NMuonBarrel', title='Number of Barrel Muons;nMuons;Events', @@ -41,22 +41,22 @@ def RpcMonitoringConfig(inputFlags): myGroup.defineHistogram('muPtCollection;MuonPt', title='muon Pt;Pt[MeV];Muons', type='TH1D', - path='PlotCand', + path='PlotCand', xbins=200,xmin=0,xmax=1000e3) myGroup.defineHistogram('roiEtaCollection;roiEta', title='roi eta;roi #eta;rois', type='TH1D', - path='PlotCand', + path='PlotCand', xbins=50,xmin=-2.5,xmax=2.5) myGroup.defineHistogram('roiBarrelEtaCollection;roiBarrelEta', title='Barrel roi eta;roi #eta;rois', type='TH1D', - path='PlotCand', + path='PlotCand', xbins=50,xmin=-2.5,xmax=2.5) myGroup.defineHistogram('roiBarrelThrCollection;roiBarrelThrs', title='Barrel roi threshold;roi threshold;rois', type='TH1I', - path='PlotCand', + path='PlotCand', xbins=6,xmin=0.5,xmax=6.5) myGroup.defineHistogram('ptDen;Pt', title='muon Pt;Pt[MeV];Muons', type='TH1D', path='TriggerEff/Denominator', diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/CMakeLists.txt b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/CMakeLists.txt index dad09c983fc2506e5681f6d1f199c31a1b9ff560..788cdaa1d065027272466aa76e2e39413965efc3 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/CMakeLists.txt +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/CMakeLists.txt @@ -46,5 +46,5 @@ atlas_add_component( MuonTrackMonitoring # Install files from the package: atlas_install_headers( MuonTrackMonitoring ) -atlas_install_joboptions( share/*.py ) +atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h deleted file mode 100644 index ce99eebbe1680755799b4be10adf9242993072f6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRKPHYSMONITORING_MUONGENERICTRACKSMON_H -#define MUONTRKPHYSMONITORING_MUONGENERICTRACKSMON_H - -// MuonGenericTracksMon.cxx -// AUTHORS: N. Benekos, E. Christidi, A. Eppig, Tony Liss - -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/ToolHandle.h" -#include "StoreGate/StoreGate.h" - -#include "AthenaMonitoring/ManagedMonitorToolBase.h" - -#include "MuonTrackMonitoring/RecoMuonPlots.h" -#include "MuonTrackMonitoring/RecoMuonSegmentPlots.h" -#include "MuonTrackMonitoring/RecoMuonTrackPlots.h" -#include "MuonTrackMonitoring/RecoMuonIDTrackPlots.h" -#include "MuonTrackMonitoring/RecoLumiPlots.h" -#include "MuonTrackMonitoring/RecoPhysPlots.h" -#include "MuonTrackMonitoring/RecoVertexPlots.h" -#include "MuonHistUtils/MuonEnumDefs.h" - -#include "TrigConfL1Data/TriggerItem.h" - -#include "TrkTrack/Track.h" -#include "TrkTrack/TrackCollection.h" -#include "TrkToolInterfaces/IResidualPullCalculator.h" -#include "TrkToolInterfaces/ITrackSelectorTool.h" - -#include "xAODTracking/TrackParticle.h" - -#include "GeoPrimitives/GeoPrimitives.h" -#include "EventPrimitives/EventPrimitives.h" -#include "EventPrimitives/EventPrimitivesHelpers.h" -#include "FourMomUtils/P4Helpers.h" - -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonAnalysisInterfaces/IMuonSelectionTool.h" -#include "MuonResonanceTools/IMuonResonanceSelectionTool.h" -#include "MuonResonanceTools/IMuonResonancePairingTool.h" - -#include "xAODMuon/MuonContainer.h" -#include "xAODMuon/Muon.h" -#include "xAODMuon/MuonSegment.h" -#include "xAODMuon/MuonSegmentContainer.h" -#include "xAODEventInfo/EventInfo.h" - -#include <vector> -#include <string> -#include <algorithm> - -class MuonGenericTracksMon : public ManagedMonitorToolBase -{ - - public: - - MuonGenericTracksMon( const std::string & type, const std::string & name, const IInterface* parent ); - virtual ~MuonGenericTracksMon()=default; - - virtual StatusCode initialize(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); - - //second argument is the souce type - void plot_lumi( std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > resonances_Z, - std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > resonances_jpsi, - const xAOD::MuonContainer* Muons, - const xAOD::TrackParticleContainer* tracksMS, - const xAOD::MuonSegmentContainer* MuonSegments); - void plot_lumi_notrig(const xAOD::MuonContainer* Muons, - const xAOD::TrackParticleContainer* tracksMS, - const xAOD::MuonSegmentContainer* MuonSegments); - //other plots - void plot_muon( const xAOD::Muon& muon, int source); - void plot_muon_notrig(const xAOD::Muon& muon, int source); - void plot_segment(const xAOD::MuonSegment& segment, int source); - void plot_track( const xAOD::TrackParticle& track, int source); - void plot_vertex( const xAOD::Vertex& aVx, int source); - void plot_resonances(std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > resonances, int source); - - void FillPullResid(RecoMuonTrackPlots *, const xAOD::TrackParticle*); - - float m_inst_lumi_bcid; - float m_inst_lumi_lb; - int m_current_lb; - - TH1* m_hNEvent;//a sample histogram to count the number of events - - // plot classes in vectors (one class per selection: Z, JPsi, all) - std::vector<RecoLumiPlots*> m_oRecoLumiPlots; - std::vector<RecoMuonSegmentPlots*> m_oRecoMuonSegmentPlots; - std::vector<RecoMuonTrackPlots*> m_oRecoMuonMSTrackPlots; - std::vector<RecoMuonTrackPlots*> m_oRecoMuonMETrackPlots; - std::vector<RecoMuonIDTrackPlots*> m_oRecoMuonIDTrackPlots; - std::vector<RecoMuonPlots*> m_oRecoMuonPlots; - std::vector<RecoPhysPlots*> m_oRecoPhysPlots; - std::vector<RecoVertexPlots*> m_oRecoVertexPlots; - - private: - - std::string m_muonsName; - std::string m_muonSegmentsName; - std::string m_muonTracksName; - std::string m_msVertexCollection; - std::string m_muonExtrapTracksName; - std::string m_innerTracksName; - - StatusCode setupTools(); - StatusCode bookInMongroup(TH1* hist, MonGroup& mongroup); - StatusCode bookInMongroup(HistData& hist, MonGroup& mongroup, std::string source); - StatusCode bookInMongroup(PlotBase& valPlots, MonGroup& mongroup, std::string source); - StatusCode bookInMongroup(PlotBase& valPlots, MonGroup& mongroup, std::string source, TString Montype); - - // define the different classes of plots; - enum SOURCE {Z = 0, JPSI, CBMUONS, NONCBMUONS, CONTAINER, N_SOURCE}; - std::string m_sources[SOURCE::N_SOURCE + 1] = {"Z", "Jpsi", "CBMuons", "NonCBMuons", "Container", "N_SOURCE"}; - enum MUON_COMPONENT {TRACK_MS=0, TRACK_ME, TRACK_ID, N_COMPONENTS}; - // Trigger items - bool m_useTrigger; - std::string m_MuonTriggerChainName; - std::vector<std::string> m_muon_triggers; - - // ATLAS Detector Description - // Handle for the trig decision tool - ToolHandle<Trig::ITrigDecisionTool> m_trigDecTool; - // MCP muon quality tool - ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool; - // MCP T&P helpers - ToolHandle<IMuonResonanceSelectionTool> m_ZmumuResonanceSelectionTool; - ToolHandle<IMuonResonancePairingTool> m_ZmumuResonancePairingTool; - ToolHandle<IMuonResonanceSelectionTool> m_JpsimumuResonanceSelectionTool; - ToolHandle<IMuonResonancePairingTool> m_JpsimumuResonancePairingTool; - - std::string pathToHistName(std::string str){ - std::replace( str.begin(), str.end(), '/', '_'); - return str; - } - // isMC required by MCP tools. - // only matters for scalefactors, i.e., keep isMC=false for SF=1. - bool m_isMC; - -}; - -#endif - - - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..2787d39214e1b6f78fbbc1605ba5da87e2ddaaca --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + 2020 Matthias Schott - Uni Mainz +*/ + +#ifndef MUON_TRACKALGORITHM_H +#define MUON_TRACKALGORITHM_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" + +#include "xAODMuon/MuonContainer.h" +#include <vector> +#include <string> +#include "StoreGate/ReadHandleKey.h" + +// AthMonitorAlgorithm +class MuonTrackMonitorAlgorithm : public AthMonitorAlgorithm +{ + + public: + + MuonTrackMonitorAlgorithm(const std::string& name, ISvcLocator* pSvcLocator); + + virtual ~MuonTrackMonitorAlgorithm() {}; + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + private: + + SG::ReadHandleKey<xAOD::MuonContainer> m_MuonContainerKey { this, "MuonContainerKey", "Muons", "Key for Muon Containers" }; + + // Toolds + /// Fills data-quality information (e.g. pt, eta, phi..) to histograms for given selection of muons + /// std::string sIdentifier = "CB","ZBoson","JPsi": String which is used to match the histogramming + /// variables that are defined by the Python script + /// std::vector<const xAOD::Muon*> &vecMuons: Vector of muons for which performance plots should be created + StatusCode FillMuonInformation(std::string sIdentifier, std::vector<const xAOD::Muon*> &vecMuons) const; + + /// Function to create performance plots for muon standalone tracks with some detailed informatiom + StatusCode analyseLowLevelMuonFeatures(const xAOD::MuonContainer* Muons, int lumiBlockID) const; + + /// Function to create performance plots for all combined muons + StatusCode analyseCombinedTracks(const xAOD::MuonContainer* Muons, int lumiBlockID) const; + + /// Function to create performance plots for all combined muons that lead to a Z Boson Candidate event + StatusCode analyseZBosonCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const; + + /// Function to create performance plots for all combined muons that lead to a JPsi Meson Candidate event + StatusCode analyseJPsiCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const; + + Gaudi::Property< std::vector<std::string> > m_hltchainList{ this, "HLTTriggerList", {"HLT_2mu14", "HLT_mu26_ivarmedium"}, "High-level triggers used" }; + + Gaudi::Property< float > m_CBmuons_minPt{ this, "CBmuons_minPt", 20000., "Minimal muon pt used for CB muons" }; + + Gaudi::Property< float > m_ZBosonSelection_minPt{ this, "ZBosonSelection_minPt", 20000., "Minimal muon pt used for Z analysis" }; + Gaudi::Property< float > m_ZBosonSelection_maxEta{ this, "ZBosonSelection_maxEta", 2.5, "Maximal muon eta used for Z analysis" }; + Gaudi::Property< float > m_ZBosonSelection_trkIsolation{ this, "ZBosonSelection_trkIsolation", 0.2, "Track DeltaR isolation criteria" }; + Gaudi::Property< float > m_ZBosonSelection_D0Cut{ this, "ZBosonSelection_D0Cut", 100., "D0 cut applied for Z boson analysis" }; + Gaudi::Property< float > m_ZBosonSelection_Z0Cut{ this, "ZBosonSelection_Z0Cut", 100., "Z0 cut applied for Z boson analysis" }; + Gaudi::Property< float > m_ZBosonSelection_minMass{ this, "ZBosonSelection_minMass", 76000., "Minimal accepted Z boson mass" }; + Gaudi::Property< float > m_ZBosonSelection_maxMass{ this, "ZBosonSelection_maxMass", 106000., "Maximal accepted Z boson mass" }; + + Gaudi::Property< float > m_JPsiSelection_minPt{ this, "JPsiSelection_minPt", 4000., "Minimal muon pt used for JPsi analysis" }; + Gaudi::Property< float > m_JPsiSelection_maxEta{ this, "JPsiSelection_maxEta", 2.5, "Maximal muon eta used for JPsi analysis" }; + Gaudi::Property< float > m_JPsiSelection_trkIsolation{ this, "JPsiSelection_trkIsolation", 1.0, "JPsi track DeltaR isolation criteria" }; + Gaudi::Property< float > m_JPsiSelection_D0Cut{ this, "JPsiSelection_D0Cut", 100., "D0 cut applied for JPsi analysis" }; + Gaudi::Property< float > m_JPsiSelection_Z0Cut{ this, "JPsiSelection_Z0Cut", 100., "Z0 cut applied for JPsi analysis" }; + Gaudi::Property< float > m_JPsiSelection_minMass{ this, "JPsiSelection_minMass", 2600., "Minimal accepted JPsi mass" }; + Gaudi::Property< float > m_JPsiSelection_maxMass{ this, "JPsiSelection_maxMass", 3600., "Maximal accepted JPsi mass" }; +}; + + +#endif + diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotMuons.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotMuons.h deleted file mode 100644 index 4372fdbd3d436d9f77ae8913f8c99e06553095b6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotMuons.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRACKMONITORING_PLOTMUONS_H -#define MUONTRACKMONITORING_PLOTMUONS_H - -#include "TrkValHistUtils/PlotBase.h" -#include "TrkValHistUtils/ParamPlots.h" -#include "MuonHistUtils/RecoInfoPlots.h" -#include "MuonHistUtils/MomentumPullPlots.h" -#include "MuonHistUtils/MuonHitSummaryPlots.h" -#include "xAODMuon/Muon.h" - -class PlotMuons:public PlotBase{ - - public: - - PlotMuons(PlotBase* pParent, std::string sDir); - - void fill(const xAOD::Muon& muon); - - Trk::ParamPlots m_plots_All; - Muon::RecoInfoPlots m_plots_RecoInfo; - Muon::MomentumPullPlots m_plots_MomentumPull; - Muon::MuonHitSummaryPlots m_plots_MuonHitSummary; -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotSegments.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotSegments.h deleted file mode 100644 index 5ecfe695dceeb4a1f64aa394336c3ea974928b21..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotSegments.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRACKMONITORING_PLOTSEGMENTS_H -#define MUONTRACKMONITORING_PLOTSEGMENTS_H - -#include "TrkValHistUtils/PlotBase.h" -#include "MuonHistUtils/MuonSegmentPlots.h" - -#include "xAODMuon/Muon.h" -#include "xAODMuon/MuonSegment.h" - -class PlotSegments:public PlotBase{ - - public: - - PlotSegments(PlotBase* pParent, std::string sDir); - - void fill(const xAOD::Muon& muon); - void fill(const xAOD::MuonSegment& segment); - - Muon::MuonSegmentPlots m_plots_Segments; - -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotTracks.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotTracks.h deleted file mode 100644 index 409deee7ee8f479a23497ec32c7a446a9e1f899a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/PlotTracks.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRACKMONITORING_PLOTTRACKS_H -#define MUONTRACKMONITORING_PLOTTRACKS_H - -#include "TrkValHistUtils/PlotBase.h" -#include "TrkValHistUtils/MSHitPlots.h" -#include "TrkValHistUtils/RecoInfoPlots.h" -#include "TrkValHistUtils/ImpactPlots.h" - -#include "xAODMuon/Muon.h" -#include "xAODTracking/TrackParticle.h" - -class PlotTracks:public PlotBase{ - - public: - - PlotTracks(PlotBase* pParent, std::string sDir); - - void fill(const xAOD::Muon& muon); - void fill(const xAOD::TrackParticle& track); - - Trk::ImpactPlots m_plots_Impact; - Trk::RecoInfoPlots m_plots_TrkRecoInfo; - Trk::MSHitPlots m_plots_MSHit; - -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoLumiPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoLumiPlots.h deleted file mode 100644 index ff6e605ba529dab62a986145d4dcd1fe6f572bd0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoLumiPlots.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRACKMONITORING_RECOLUMIPLOTS_H -#define MUONTRACKMONITORING_RECOLUMIPLOTS_H - -#include "TrkValHistUtils/PlotBase.h" - - -#include "MuonPrepRawData/MuonPrepDataContainer.h" -#include "xAODMuon/MuonSegmentContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODMuon/MuonContainer.h" - -class RecoLumiPlots:public PlotBase { - - public: - RecoLumiPlots(PlotBase* pParent, std::string sDir, std::string recObj); - - void fill(const xAOD::MuonSegmentContainer* MuonSegments, int current_lb, float inst_lumi_bcid, float inst_lumi_lb); - void fill(const xAOD::TrackParticleContainer* MSTracks, int current_lb, float inst_lumi_bcid, float inst_lumi_lb); - void fill_CB(const xAOD::MuonContainer* Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb); - void fill_Other(const xAOD::MuonContainer* Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb); - void fill(std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > resonances, int current_lb, float inst_lumi_bcid, float inst_lumi_lb); - - TH1* m_hNSegment_LB_1D; - TH1* m_hNMuonTrack_LB_1D; - TH1* m_hNMuon_LB_1D; - TH1* m_hNResonance_LB_1D; - - TH2* m_hNSegment_LB; - TH2* m_hNMuonTrack_LB; - TH2* m_hNMuon_LB; - TH2* m_hNResonance_LB; - - int n_lbs; - - //for locating Z and Jpsi - std::string type; - std::string name; - - private: - void initializePlots(); - -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonIDTrackPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonIDTrackPlots.h deleted file mode 100644 index 120005dbf4e56177c1aab7285cb0c202a224f2b6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonIDTrackPlots.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRACKMONITORING_RECOMUONIDTRACKPLOTS_H -#define MUONTRACKMONITORING_RECOMUONIDTRACKPLOTS_H - -#include "xAODMuon/Muon.h" -#include "xAODMuon/MuonContainer.h" -#include "xAODTracking/TrackParticle.h" -//#include "TrkEventPrimitives/ResidualPull.h" - -#include "TrkValHistUtils/PlotBase.h" -#include "TrkValHistUtils/ParamPlots.h" -#include "TrkValHistUtils/RecoInfoPlots.h" -#include "TrkValHistUtils/ImpactPlots.h" -#include "TrkValHistUtils/IDHitPlots.h" - - -class RecoMuonIDTrackPlots:public PlotBase { - public: - RecoMuonIDTrackPlots(PlotBase* pParent, std::string sDir); - - // Reco only information - Trk::ParamPlots m_oAllPlots; - Trk::ImpactPlots m_oImpactPlots; - Trk::RecoInfoPlots m_oTrkRecoInfoPlots; - Trk::IDHitPlots m_oIDHitPlots; - - TH1* m_pt_broad; - TH2* m_eta_phi_broad; - - //fill methods - void fill(const xAOD::Muon& mu, int component); - void fill(const xAOD::TrackParticle& muTP); - //void fill(const xAOD::TrackParticle& muTP, int LB_number, float LB_instant); - //void fill(const Trk::ResidualPull& resPull, int stationPhi, Muon::MuonStationIndex::TechnologyIndex techid, bool measuresPhi); - private: - void initializePlots(); - -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonPlots.h deleted file mode 100644 index a00bdfa1c064e466b4225548fefbfa5573f801f8..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonPlots.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRACKMONITORING_RECOMUONPLOTS_H -#define MUONTRACKMONITORING_RECOMUONPLOTS_H - -#include "TrkValHistUtils/PlotBase.h" -#include "TrkValHistUtils/ParamPlots.h" -#include "TrkValHistUtils/MSHitPlots.h" -#include "TrkValHistUtils/ImpactPlots.h" -#include "MuonHistUtils/RecoInfoPlots.h" -#include "MuonHistUtils/MomentumPullPlots.h" -#include "MuonHistUtils/MuonHitSummaryPlots.h" -#include "MuonHistUtils/MuonIsolationPlots.h" -#include "MuonHistUtils/MuonParamPlots.h" - -#include "xAODMuon/Muon.h" -#include "xAODMuon/MuonContainer.h" -#include "xAODTracking/TrackingPrimitives.h" - -class RecoMuonPlots:public PlotBase { - public: - RecoMuonPlots(PlotBase* pParent, std::string sDir, bool detail=false); - void fill(const xAOD::Muon& mu); - void fill(const xAOD::Muon& mu, xAOD::Muon::Quality my_quality); - - // Reco only information - Trk::ParamPlots m_oAllPlots; - Muon::RecoInfoPlots m_oMuRecoInfoPlots; - Trk::ImpactPlots m_oImpactPlots; - Muon::MomentumPullPlots m_oMomentumPullPlots; - - //extra monitoring efficiency plots; filled in post processing - TH2* m_origin_eta_phi; - TH2* m_eff_tight; - TH2* m_eff_medium; - TH2* m_tight_eta_phi; - TH2* m_medium_eta_phi; - TH1* m_pt_broad; - TH2* m_eta_phi_broad; - - //extra monitoring efficiency plots, normalized in post processing - TH2* m_eff_nPrec; - TH2* m_eff_nPhi; - TH2* m_eff_nTrigEta; - TH2* m_eff_ndof; - TH2* m_eff_chi2; - TH2* m_ID_eff_ndof; - TH2* m_ID_eff_chi2; - TH2* m_MS_eff_ndof; - TH2* m_MS_eff_chi2; - - TH2* m_avg_hits_precision_inner; - TH2* m_avg_hits_precision_middle; - TH2* m_avg_hits_precision_outer; - TH2* m_avg_hits_precision_extended; - - TH2* m_avg_hits_trigger_layer1; - TH2* m_avg_hits_trigger_layer2; - TH2* m_avg_hits_trigger_layer3; - TH2* m_avg_hits_trigger_layer4; - - TH2* m_avg_hits_ibl; - TH2* m_avg_hits_pix; - TH2* m_avg_hits_sct; - TH2* m_avg_hits_trt; - - TH2* m_avg_ddpt_idme; - TH2* m_avg_dptsignif; - - // overview layers - uint8_t hitval_numberOfPrecisionLayers = 0; - uint8_t hitval_numberOfPhiLayers = 0; - uint8_t hitval_numberOfTriggerEtaLayers = 0; - - // precision hits - uint8_t hitval_innerSmallHits = 0; - uint8_t hitval_innerLargeHits = 0; - uint8_t hitval_middleSmallHits = 0; - uint8_t hitval_middleLargeHits = 0; - uint8_t hitval_outerSmallHits = 0; - uint8_t hitval_outerLargeHits = 0; - uint8_t hitval_extendedSmallHits = 0; - uint8_t hitval_extendedLargeHits = 0; - - // trigger hits - uint8_t hitval_etaLayer1Hits = 0; - uint8_t hitval_etaLayer2Hits = 0; - uint8_t hitval_etaLayer3Hits = 0; - uint8_t hitval_etaLayer4Hits = 0; - - // ID hits - uint8_t hitval_numberOfBLayerHits = 0; - uint8_t hitval_numberOfPixelHits = 0; - uint8_t hitval_numberOfSCTHits = 0; - uint8_t hitval_numberOfTRTHits = 0; - - // momentum balance - float ddpt_idme = 0; - float qoverp_diff = 0; - float qoverp_sigma = 0; - float qoverp_signif = 0; - - bool Detail; - - private: - void initializePlots(); -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonSegmentPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonSegmentPlots.h deleted file mode 100644 index ee6bdc504927388256310458d3fc0dfa9a4cb9ed..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonSegmentPlots.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRACKMONITORING_RECOMUONSEGMENTPLOTS_H -#define MUONTRACKMONITORING_RECOMUONSEGMENTPLOTS_H - -#include "TrkValHistUtils/PlotBase.h" -#include "MuonHistUtils/MuonSegmentPlots.h" -#include "MuonHistUtils/MuonSegmentSlimPlots.h" - -#include "xAODMuon/Muon.h" -#include "xAODMuon/MuonContainer.h" -#include "xAODMuon/MuonSegment.h" -#include "xAODMuon/MuonSegmentContainer.h" -#include "xAODTracking/TrackParticleContainer.h" - -namespace Muon { - class IMuonSegmentTrackBuilder; -} - -class RecoMuonSegmentPlots:public PlotBase { - public: - RecoMuonSegmentPlots(PlotBase* pParent, std::string sDir, bool detail=false); - - //fill methods - void fill(const xAOD::MuonContainer& muContainer); - void fill(const xAOD::Muon& mu); - void fill(const std::vector<ElementLink<DataVector<xAOD::MuonSegment_v1>>> Mu_Segments); - void fill(const xAOD::MuonSegment& muonSeg); - - //generic plots from MuonHistUtils - Muon::MuonSegmentPlots *m_oMuonSegmentPlots; - Muon::MuonSegmentSlimPlots *m_oMuonSegmentSlimPlots; - - //Monitoring justification plots - bool Detail; - - - private: - void initializePlots(); - - -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonTrackPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonTrackPlots.h deleted file mode 100644 index 6aae71f53c97f1bb6d6e0ec807dfd9fa8ae53ac6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonTrackPlots.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRACKMONITORING_RECOMUONTRACKPLOTS_H -#define MUONTRACKMONITORING_RECOMUONTRACKPLOTS_H - -#include "xAODMuon/Muon.h" -#include "xAODMuon/MuonContainer.h" -#include "xAODTracking/TrackParticle.h" -#include "TrkEventPrimitives/ResidualPull.h" - -#include "TrkValHistUtils/PlotBase.h" -#include "TrkValHistUtils/ParamPlots.h" -#include "TrkValHistUtils/MSHitPlots.h" -#include "TrkValHistUtils/RecoInfoPlots.h" -#include "TrkValHistUtils/ImpactPlots.h" - -#include "MuonHistUtils/MuonHitResidualPlots.h" -#include "TrkTrack/TrackStateOnSurface.h" -#include "TrkTrack/TrackCollection.h" -#include "TrkParameters/TrackParameters.h" - - -class RecoMuonTrackPlots:public PlotBase { - public: - RecoMuonTrackPlots(PlotBase* pParent, std::string sDir); - - // Reco only information - Trk::ParamPlots m_oAllPlots; - Trk::ImpactPlots m_oImpactPlots; - Trk::RecoInfoPlots m_oTrkRecoInfoPlots; - - TH1* m_pt_broad; - TH2* m_eta_phi_broad; - - //fill methods - void fill(const xAOD::Muon& mu, int component); - void fill(const xAOD::TrackParticle& muTP); - void fill(const xAOD::TrackParticle& muTP, int LB_number, float LB_instant); - private: - void initializePlots(); - -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoPhysPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoPhysPlots.h deleted file mode 100644 index effc089b25488233053b8100167efa45e1024419..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoPhysPlots.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRKPHYSMONITORING_RECOPHYSPLOTS_H -#define MUONTRKPHYSMONITORING_RECOPHYSPLOTS_H - -#include "TrkValHistUtils/PlotBase.h" -#include "xAODMuon/Muon.h" - - -class RecoPhysPlots:public PlotBase { - public: - RecoPhysPlots(PlotBase *pParent, std::string sDir, std::string recObj); - - void fill(std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > mumucandidates); - void fill(const float eta_mu_plus, const float eta_mu_minus, const float invariant_mass); - - float EtaRegionFine(double eta); - float EtaRegionCoarse(double eta); - bool LabelLargeEtaRegions(TAxis * axis); - bool LabelCombinedEtaRegions(TAxis * axis); - bool LabelSectorAxis(TAxis * axis); - - TH1* m_Mass; - TH1* m_occupancy; - TH1* m_2occupancy; - - // TH2* m_Efficiency; - // TH2* m_EffNumerator; - // TH2* m_EffDenominator; - - // TH1* m_Efficiency_eta; - // TH1* m_EffNumerator_eta; - // TH1* m_EffDenominator_eta; - - TH1* m_M_Mean; - TH1* m_M_Sigma; - - TH1* m_M_EA_EA; - TH1* m_M_EA_BA; - TH1* m_M_EA_BC; - TH1* m_M_EA_EC; - - TH1* m_M_BA_EA; - TH1* m_M_BA_BA; - TH1* m_M_BA_BC; - TH1* m_M_BA_EC; - - TH1* m_M_BC_EA; - TH1* m_M_BC_BA; - TH1* m_M_BC_BC; - TH1* m_M_BC_EC; - - TH1* m_M_EC_EA; - TH1* m_M_EC_BA; - TH1* m_M_EC_BC; - TH1* m_M_EC_EC; - - std::string type; - - void finalizeRecoPlots(); - private: - void SetResultsBin(int iBin, TH1* pInputHist); - void initializePlots(); - -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoVertexPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoVertexPlots.h deleted file mode 100644 index ac11ba8e963c5e4d9def52aac8e0cb14c4154be3..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoVertexPlots.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONTRKPHYSMONITORING_RecoVertexPLOTS_H -#define MUONTRKPHYSMONITORING_RecoVertexPLOTS_H - -#include "TrkValHistUtils/PlotBase.h" -#include "xAODTracking/VertexContainer.h" - - -class RecoVertexPlots:public PlotBase { - public: - RecoVertexPlots(PlotBase *pParent, std::string sDir); - - void fill(const xAOD::Vertex& msVx); - - TH1* m_nMDT; - TH1* m_nRPC; - TH1* m_nTGC; - TH1* m_nTracklets; - TH2* m_VertexEtaPhi; - - private: - void initializePlots(); - -}; - -#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/python/MuonTrackMonitorAlgorithm.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/python/MuonTrackMonitorAlgorithm.py new file mode 100644 index 0000000000000000000000000000000000000000..d5076493f3e724b5c025356f18479decb617cde9 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/python/MuonTrackMonitorAlgorithm.py @@ -0,0 +1,111 @@ +""" + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + 2020 Matthias Schott - Uni Mainz +""" + + +def MuonTrackConfig(inputFlags): + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(inputFlags, "MuonTrackMonitoringConfig") + + from AthenaConfiguration.ComponentFactory import CompFactory + MuonTrackMonitorAlgorithm = CompFactory.MuonTrackMonitorAlgorithm + muonTrackAlg = helper.addAlgorithm(MuonTrackMonitorAlgorithm, "MuonTrackMonitorAlgorithmAlg") + + myGroup = helper.addGroup(muonTrackAlg, "MuonTrackMonitorAlgorithm", "MuonPhysics/") + + myGroup.defineHistogram('JPsiMuonEta,JPsiMuonPhi;Muons_Jpsi_Origin_eta_phi', title='Muons_Jpsi_Origin_eta_phi;eta;phi', type='TH2F', path='Muons/Jpsi', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('JPsiMuonEtaTight,JPsiMuonPhiTight;Muons_Jpsi_Tight_eff', title='Muons_Jpsi_Tight_eff;eta;phi', type='TH2F', path='Muons/Jpsi', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('JPsiMuonEtaMedium,JPsiMuonPhiMedium;Muons_Jpsi_Medium_eff', title='Muons_Jpsi_Medium_eff;eta;phi', type='TH2F', path='Muons/Jpsi', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('JPsiMuonD0;Muons_Jpsi_d0', title='Muons_Jpsi_d0;d0;Entries', type='TH1F', path='Muons/Jpsi', xbins=40, xmin=-1, xmax=1) + myGroup.defineHistogram('JPsiMuonDPTIDME;Muons_Jpsi_ddpt_idme', title='Muons_Jpsi_ddpt_idme;(ptID-ptME)/ptID;Entries', type='TH1F', path='Muons/Jpsi', xbins=40, xmin=-0.5, xmax=0.5) + myGroup.defineHistogram('JPsiMuonPt;Muons_Jpsi_pt', title='Muons_Jpsi_pt; pT[GeV];Entries', type='TH1F', path='Muons/Jpsi', xbins=50, xmin=0, xmax=50000) + myGroup.defineHistogram('JPsiMuonPt;Muons_Jpsi_pt_broad', title='Muons_Jpsi_pt_broad;pT[GeV];Entries', type='TH1F', path='Muons/Jpsi', xbins=50, xmin=0, xmax=1000000) + myGroup.defineHistogram('JPsiMuonLumiBlock;Overview_Jpsi_nJpsi_LB', title='Overview_Jpsi_nJpsi_LB;LumiBlock;NumberOfJPsis', type='TH1F', path='Overview/Jpsi', xbins=50, xmin=0, xmax=2500) + myGroup.defineHistogram('JPsiMuonNBHits;TracksID_Jpsi_HitContent_NBlayerHits', title='TracksID_Jpsi_HitContent_NBlayerHits;NumberOfBLayerHits;Entries', type='TH1F', path='TracksID/Jpsi', xbins=5, xmin=0, xmax=5) + myGroup.defineHistogram('JPsiMuonNPixHits;TracksID_Jpsi_HitContent_NPixelHits', title='TracksID_Jpsi_HitContent_NPixelHits;NumberOfPixelHits;Entries', type='TH1F', path='TracksID/Jpsi', xbins=10, xmin=0, xmax=10) + myGroup.defineHistogram('JPsiMuonNSCTHits;TracksID_Jpsi_HitContent_NSCTHits', title='TracksID_Jpsi_HitContent_NSCTHits;NumberOfSCTHits;Entries', type='TH1F', path='TracksID/Jpsi', xbins=20, xmin=0, xmax=20) + myGroup.defineHistogram('JPsiMuonNTRTHits;TracksID_Jpsi_HitContent_NTRTHits', title='TracksID_Jpsi_HitContent_NTRTHits;NumberOfTRTHits;Entries', type='TH1F', path='TracksID/Jpsi', xbins=50, xmin=0, xmax=50) + myGroup.defineHistogram('JPsiMuonIDChi2NDF;TracksID_Jpsi_chi2ndof', title='TracksID_Jpsi_chi2ndof;TrackFitChi2NDF;Entries', type='TH1F', path='TracksID/Jpsi', xbins=20, xmin=0, xmax=5) + myGroup.defineHistogram('JPsiMuonMEChi2NDF;TracksME_Jpsi_chi2ndof', title='TracksME_Jpsi_chi2ndof;TrackFitChi2NDF;Entries', type='TH1F', path='TracksME/Jpsi', xbins=20, xmin=0, xmax=5) + myGroup.defineHistogram('JPsiMass2D,JPsiEta2D;JPsiMassAverage', title='JPsiMassAverage;mass;eta', type='TH2F', path='Muons/Jpsi', xbins=27, xmin=2600., xmax=3600, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('JPsiMass;m_Jpsi_Mass', title='m_Jpsi_Mass;M_{#mu#mu};Entries', type='TH1F', path='MuonTrkPhys/Jpsi', xbins=50, xmin=2600, xmax=3600) + + myGroup.defineHistogram('ZMuonEta,ZMuonPhi;Muons_Z_Origin_eta_phi', title='Muons_Z_Origin_eta_phi;eta;phi', type='TH2F', path='Muons/Z', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('ZMuonEtaTight,ZMuonPhiTight;Muons_Z_Tight_eff', title='Muons_Z_Tight_eff;eta;phi', type='TH2F', path='Muons/Z', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('ZMuonEtaMedium,ZMuonPhiMedium;Muons_Z_Medium_eff', title='Muons_Z_Medium_eff;eta;phi', type='TH2F', path='Muons/Z', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('ZMuonD0;Muons_Z_d0', title='Muons_Z_d0;d0;Entries', type='TH1F', path='Muons/Z', xbins=40, xmin=-1, xmax=1) + myGroup.defineHistogram('ZMuonZ0;Muons_Z_z0', title='Muons_Z_z0;z0;Entries', type='TH1F', path='Muons/Z', xbins=50, xmin=-1000, xmax=1000) + myGroup.defineHistogram('ZMuonDPTIDME;Muons_Z_ddpt_idme', title='Muons_Z_ddpt_idme;(ptID-ptME)/ptID;Entries', type='TH1F', path='Muons/Z', xbins=40, xmin=-0.5, xmax=0.5) + myGroup.defineHistogram('ZMuonPt;Muons_Z_pt', title='Muons_Z_pt; pT[GeV];Entries', type='TH1F', path='Muons/Z', xbins=50, xmin=0, xmax=50000) + myGroup.defineHistogram('ZMuonPt;Muons_Z_pt_broad', title='Muons_Z_pt_broad;pT[GeV];Entries', type='TH1F', path='Muons/Z', xbins=50, xmin=0, xmax=1000000) + myGroup.defineHistogram('ZMuonLumiBlock;Overview_Z_nZ_LB', title='Overview_Z_nJpsi_LB;LumiBlock;NumberOfZs', type='TH1F', path='Overview/Z', xbins=50, xmin=0, xmax=2500) + myGroup.defineHistogram('ZMuonNBHits;TracksID_Z_HitContent_NBlayerHits', title='TracksID_Z_HitContent_NBlayerHits;NumberOfBLayerHits;Entries', type='TH1F', path='TracksID/Z', xbins=5, xmin=0, xmax=5) + myGroup.defineHistogram('ZMuonNPixHits;TracksID_Z_HitContent_NPixelHits', title='TracksID_Z_HitContent_NPixelHits;NumberOfPixelHits;Entries', type='TH1F', path='TracksID/Z', xbins=10, xmin=0, xmax=10) + myGroup.defineHistogram('ZMuonNSCTHits;TracksID_Z_HitContent_NSCTHits', title='TracksID_Z_HitContent_NSCTHits;NumberOfSCTHits;Entries', type='TH1F', path='TracksID/Z', xbins=20, xmin=0, xmax=20) + myGroup.defineHistogram('ZMuonNTRTHits;TracksID_Z_HitContent_NTRTHits', title='TracksID_Z_HitContent_NTRTHits;NumberOfTRTHits;Entries', type='TH1F', path='TracksID/Z', xbins=50, xmin=0, xmax=50) + myGroup.defineHistogram('ZMuonIDChi2NDF;TracksID_Z_chi2ndof', title='TracksID_Z_chi2ndof;TrackFitChi2NDF;Entries', type='TH1F', path='TracksID/Z', xbins=20, xmin=0, xmax=5) + myGroup.defineHistogram('ZMuonMEChi2NDF;TracksME_Z_chi2ndof', title='TracksME_Z_chi2ndof;TrackFitChi2NDF;Entries', type='TH1F', path='TracksME/Z', xbins=20, xmin=0, xmax=5) + myGroup.defineHistogram('ZMass2D,ZEta2D;ZMassAverage', title='ZMassAverage;mass;eta', type='TH2F', path='Muons/Z', xbins=27, xmin=76000., xmax=106000., ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('ZMass;m_Z_Mass', title='m_Z_Mass;M_{#mu#mu};Entries', type='TH1F', path='MuonTrkPhys/Z', xbins=50, xmin=76000., xmax=106000.) + + myGroup.defineHistogram('CBMuonEta,CBMuonPhi;Muons_CBMuons_eta_phi', title='Muons_CBMuons_eta_phi;eta;phi', type='TH2F', path='Muons/CBMuons', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('CBMuonEtaTight,CBMuonPhiTight;Muons_CBMuons_eta_phi_tight', title='Muons_CBMuons_eta_phi_tight;eta;phi', type='TH2F', path='Muons/CBMuons', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('CBMuonEtaMedium,CBMuonPhiMedium;Muons_CBMuons_eta_phi_medium', title='Muons_CBMuons_eta_phi_medium;eta;phi', type='TH2F', path='Muons/CBMuons', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('CBMuonD0;Muons_CBMuons_d0', title='Muons_CBMuons_d0;d0;Entries', type='TH1F', path='Muons/CBMuons', xbins=40, xmin=-1, xmax=1) + myGroup.defineHistogram('CBMuonZ0;Muons_CBMuons_z0', title='Muons_CBMuons_z0;z0;Entries', type='TH1F', path='Muons/CBMuons', xbins=50, xmin=-1000, xmax=1000) + myGroup.defineHistogram('CBMuonDPTIDME;Muons_CB_ddpt_idme', title='Muons_CB_ddpt_idme;(ptID-ptME)/ptID;Entries', type='TH1F', path='Muons/CBMuons', xbins=40, xmin=-0.5, xmax=0.5) + myGroup.defineHistogram('CBMuonPt;Muons_CBMuons_pt', title='Muons_CBMuons_pt;pT[GeV];Entries', type='TH1F', path='Muons/CBMuons', xbins=50, xmin=0, xmax=50000) + myGroup.defineHistogram('CBMuonPt;Muons_CBMuons_pt_broad', title='Muons_CBMuons_pt_broad;pT[GeV];Entries', type='TH1F', path='Muons/CBMuons', xbins=50, xmin=0, xmax=1000000) + myGroup.defineHistogram('CBMuonLumiBlock;Overview_CBMuons_nMuon_LB', title='Overview_CBMuons_nMuon_LB;LumiBlock;NumberOfCBMuons', type='TH1F', path='Overview/CBMuons', xbins=2500, xmin=0, xmax=2500) + myGroup.defineHistogram('CBMuonNBHits;TracksID_CBMuons_HitContent_NBlayerHits', title='TracksID_CBMuons_HitContent_NBlayerHits;NumberOfBLayerHits;Entries', type='TH1F', path='TracksID/CBMuons', xbins=5, xmin=0, xmax=5) + myGroup.defineHistogram('CBMuonNPixHits;TracksID_CBMuons_HitContent_NPixelHits', title='TracksID_CBMuons_HitContent_NPixelHits;NumberOfPixelHits;Entries', type='TH1F', path='TracksID/CBMuons', xbins=10, xmin=0, xmax=10) + myGroup.defineHistogram('CBMuonNSCTHits;TracksID_CBMuons_HitContent_NSCTHits', title='TracksID_CBMuons_HitContent_NSCTHits;NumberOfSCTHits;Entries', type='TH1F', path='TracksID/CBMuons', xbins=20, xmin=0, xmax=20) + myGroup.defineHistogram('CBMuonNTRTHits;TracksID_CBMuons_HitContent_NTRTHits', title='TracksID_CBMuons_HitContent_NTRTHits;NumberOfTRTHits;Entries', type='TH1F', path='TracksID/CBMuons', xbins=50, xmin=0, xmax=50) + myGroup.defineHistogram('CBMuonIDChi2NDF;TracksID_CBMuons_chi2ndof', title='TracksID_CBMuons_chi2ndof;TrackFitChi2NDF;Entries', type='TH1F', path='TracksID/CBMuons', xbins=20, xmin=0, xmax=5) + myGroup.defineHistogram('CBMuonMEChi2NDF;TracksME_CBMuons_chi2ndof', title='TracksME_CBMuons_chi2ndof;TrackFitChi2NDF;Entries', type='TH1F', path='TracksME/CBMuons', xbins=20, xmin=0, xmax=5) + + myGroup.defineHistogram('CBMuonAuthor;Muons_CBMuons_Author', title='Muons_CBMuons_Author;Author;Entries', type='TH1F', path='Muons/CBMuons', xbins=20, xmin=0, xmax=20) + myGroup.defineHistogram('CBMuonEtaMedium,CBMuonPhiMedium;Muons_CBMuons_Medium_eff', title='Muons_CBMuons_Medium_eff;eta;phi', type='TH2F', path='Muons/CBMuons', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('CBMuonEta1Triggered,CBMuonPhi1Triggered;Muons_CBMuons_1Triggered_eta_phi', title='Muons_CBMuons_eta_phi_1Triggered;eta;phi', type='TH2F', path='Muons/CBMuons', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('CBMuonEta1All,CBMuonPhi1All;Muons_CBMuons_1All_eta_phi', title='Muons_CBMuons_eta_phi_1All;eta;phi', type='TH2F', path='Muons/CBMuons', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('NonCBMuonEta,NonCBMuonPhi;Muons_NonCBMuons_Origin_eta_phi', title='Muons_NonCBMuons_Origin_eta_phi;eta;phi;', type='TH2F', path='Muons/NonCBMuons', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('CBMuonSector,CBMuonCIndex;Segments_CBMuons_chamberIndex_perSector', title='Segments_CBMuons_chamberIndex_perSector;Sector;ChamberIndex', type='TH2F', path='Segments/CBMuons', xbins=30, xmin=-15, xmax=15, ybins=17, ymin=0, ymax=17) + + myGroup.defineHistogram('MSAuthor;MSAuthor', title='MSAuthor;MS-Author;Entries', type='TH1F', path='TracksMS/Container', xbins=15, xmin=0, xmax=15) + myGroup.defineHistogram('MSQuality;MSQuality', title='MSQuality;MS-Quality;Entries', type='TH1F', path='TracksMS/Container', xbins=15, xmin=0, xmax=15) + myGroup.defineHistogram('MSType;MSType', title='MSType;MS-Type;Entries', type='TH1F', path='TracksMS/Container', xbins=15, xmin=0, xmax=15) + myGroup.defineHistogram('MSLumiBlockNumberOfMuonTracks;Overview_Container_nMuonTrack_LB', title='Overview_Container_nMuonTrack_LB;LumiBlock;NumberOfMuonTracks', type='TH1F', path='Overview/Container', xbins=50, xmin=0, xmax=2500) + myGroup.defineHistogram('MSLumiBlockNumberOfSegments;Overview_Container_nSegment_LB', title='Overview_Container_nSegment_LB;LumiBlock;NumberOfMuonSegments', type='TH1F', path='Overview/Container', xbins=50, xmin=0, xmax=2500) + myGroup.defineHistogram('MSLargeSectorR,MSLargeSectorZ;Segments_Container_rzpos_sectorLarge', title='Segments_Container_rzpos_sectorLarge;zPos[mm];r[mm]', type='TH2F', path='Segments/Container', xbins=220, xmin=-22000, xmax=22000, ybins=100, ymin=0, ymax=15000) + myGroup.defineHistogram('MSSmallSectorR,MSSmallSectorZ;Segments_Container_rzpos_sectorSmall', title='Segments_Container_rzpos_sectorSmall;zPos[mm];r[mm]', type='TH2F', path='Segments/Container', xbins=220, xmin=-22000, xmax=22000, ybins=100, ymin=0, ymax=15000) + myGroup.defineHistogram('MSEta,MSPhi;TracksMS_Container_eta_phi', title='TracksMS_Container_eta_phi;eta;phi', type='TH2F', path='TracksMS/Container', xbins=27, xmin=-2.7, xmax=2.7, ybins=31, ymin=-3.1415, ymax=3.1415) + myGroup.defineHistogram('MSPt;TracksMS_Container_pt', title='TracksMS_Container_pt;pT[GeV];Entries', type='TH1F', path='TracksMS/Container', xbins=50, xmin=0, xmax=50000) + myGroup.defineHistogram('MSPt;TracksMS_Container_pt_broad', title='TracksMS_Container_pt_broad;pT[GeV];Entries', type='TH1F', path='TracksMS/Container', xbins=50, xmin=0, xmax=1000000) + return helper.result() + +if __name__=="__main__": + # Setup the RunIII behavior + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + + # Setup logs + from AthenaCommon.Logging import log + from AthenaCommon.Constants import INFO + log.setLevel(INFO) + # Set the Athena configuration flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + TestFiles = ['/eos/atlas/atlascerngroupdisk/det-rpc/data/DESDM_MCP/data18_13TeV.00358615.physics_Main.merge.DESDM_MCP.f961_m2024/data18_13TeV.00358615.physics_Main.merge.DESDM_MCP.f961_m2024._0084.1'] + ConfigFlags.Input.Files = TestFiles + ConfigFlags.Output.HISTFileName = 'TestOutput.root' + ConfigFlags.lock() + # Initialize configuration object, add accumulator, merge and run. + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + cfg = MainServicesSerialCfg() + cfg.merge(PoolReadCfg(ConfigFlags)) + acc = MuonTrackConfig(ConfigFlags) + cfg.merge(acc) + cfg.printConfig(withDetails=False) + cfg.run(20) + diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrackDQA_options.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrackDQA_options.py deleted file mode 100755 index 139ee5c378beace9f3839456ed5d826e6420a957..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrackDQA_options.py +++ /dev/null @@ -1,95 +0,0 @@ -#====================================================================== -# JobOptions for MuonTrackMonitoring -#====================================================================== - -muTrackMonMan = AthenaMonManager(name="MuonTrackMonManager", - FileKey = DQMonFlags.monManFileKey(), - Environment = DQMonFlags.monManEnvironment(), - DataType = DQMonFlags.monManDataType(), - OutputLevel = WARNING) - -from RecExConfig.RecFlags import rec as recFlags -from MuonRecExample import MuonRecTools -from MuonTrackMonitoring.MuonTrackMonitoringConf import MuonGenericTracksMon -from AthenaCommon.AppMgr import ToolSvc - -############TriggerAware Trk Monitoring####################### -# set to true in case you would like to use trigger-aware monitoring -# only do trigger-aware monitoring if monTrigDecTool known by ToolSvc -# NoTrig requirement part is intended to run on all streams -MuonGenericTracksMon_NoTrig = MuonGenericTracksMon(name = "MuonGenericTracksMon_NoTrig", - MuonTriggerChainName = "NoTrig/", - OutputLevel = WARNING, - ) -#ToolSvc += MuonGenericTracksMon_NoTrig -muTrackMonMan.AthenaMonTools += [MuonGenericTracksMon_NoTrig] - -# L1_Trig part is intended to only select events passing L1_MU triggers -MuonGenericTracksMon_L1Trig = MuonGenericTracksMon(name = "MuonGenericTracksMon_L1Trig", - MuonTriggerChainName = "", - OutputLevel = WARNING, - ) - -if not DQMonFlags.useTrigger(): - printfunc ("MuonTrigTrackDQA_options.py: trigger decision tool not found: don't run trigger-aware monitoring") -else: - MuonGenericTracksMon_L1Trig.TriggerChain = "L1_MU4, L1_MU6, L1_MU10, L1_MU11, L1_MU15, L1_MU20, L1_2MU4, L1_2MU6, L1_2MU10" - MuonGenericTracksMon_L1Trig.MuonTriggerChainName = "" - MuonGenericTracksMon_L1Trig.TrigDecisionTool = monTrigDecTool - #ToolSvc += MuonGenericTracksMon_L1Trig - muTrackMonMan.AthenaMonTools += [MuonGenericTracksMon_L1Trig] - -#for Muon Quality Selection -if not hasattr(ToolSvc,"MuonSelectorTool"): - from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool - ToolSvc += CP__MuonSelectionTool("MuonSelectorTool", OutputLevel = ERROR) - ToolSvc.MuonSelectorTool.MaxEta = 2.5 - -#for Muon Resonance Selection -from MuonResonanceTools.MuonResonanceToolsConf import MuonResonanceSelectionTool -from MuonResonanceTools.MuonResonanceToolsConf import MuonResonancePairingTool - -ToolSvc += MuonResonanceSelectionTool("ZmumuResonanceSelectionTool") -ToolSvc += MuonResonancePairingTool("ZmumuResonancePairingTool") -ToolSvc.ZmumuResonanceSelectionTool.OutputLevel = ERROR -ToolSvc.ZmumuResonanceSelectionTool.PtCut = 20000.0 -ToolSvc.ZmumuResonanceSelectionTool.EtaCut = 2.5 -ToolSvc.ZmumuResonanceSelectionTool.IsoCaloCut = 0.2 -ToolSvc.ZmumuResonanceSelectionTool.IsoTrkCut = 0.2 -ToolSvc.ZmumuResonanceSelectionTool.z0Cut = 100 #to overwrite Z0 cut -ToolSvc.ZmumuResonanceSelectionTool.Max_d0 = 100 -ToolSvc.ZmumuResonanceSelectionTool.Calibrate = False -ToolSvc.ZmumuResonanceSelectionTool.EfficiencyCorr = False -ToolSvc.ZmumuResonanceSelectionTool.MuonSelectionTool.OutputLevel = ERROR -ToolSvc.ZmumuResonancePairingTool.OutputLevel = ERROR -ToolSvc.ZmumuResonancePairingTool.HighMassWindow = 106000.0 -ToolSvc.ZmumuResonancePairingTool.LowMassWindow = 76000.0 - -# J/psi configuration -ToolSvc += MuonResonanceSelectionTool("JpsimumuResonanceSelectionTool") -ToolSvc += MuonResonancePairingTool("JpsimumuResonancePairingTool") -ToolSvc.JpsimumuResonanceSelectionTool.OutputLevel = ERROR -### loose selections for J/psi ### -ToolSvc.JpsimumuResonanceSelectionTool.PtCut = 4000.0 -ToolSvc.JpsimumuResonanceSelectionTool.EtaCut = 2.5 -ToolSvc.JpsimumuResonanceSelectionTool.IsoCaloCut = 1 -ToolSvc.JpsimumuResonanceSelectionTool.IsoTrkCut = 1 -ToolSvc.JpsimumuResonanceSelectionTool.z0Cut = 100 -ToolSvc.JpsimumuResonanceSelectionTool.Max_d0 = 100 -ToolSvc.JpsimumuResonanceSelectionTool.Calibrate = False #no calibration on data -ToolSvc.JpsimumuResonanceSelectionTool.EfficiencyCorr = False #no efficiency correction on data -ToolSvc.JpsimumuResonanceSelectionTool.MuonSelectionTool.OutputLevel = ERROR -ToolSvc.JpsimumuResonancePairingTool.OutputLevel = ERROR -ToolSvc.JpsimumuResonancePairingTool.HighMassWindow = 3600.0 -ToolSvc.JpsimumuResonancePairingTool.LowMassWindow = 2600.0 - - -MuonGenericTracksMon_NoTrig.JpsimumuResonanceSelectionTool = ToolSvc.JpsimumuResonanceSelectionTool -MuonGenericTracksMon_NoTrig.ZmumuResonanceSelectionTool = ToolSvc.ZmumuResonanceSelectionTool -MuonGenericTracksMon_L1Trig.JpsimumuResonanceSelectionTool = ToolSvc.JpsimumuResonanceSelectionTool -MuonGenericTracksMon_L1Trig.ZmumuResonanceSelectionTool = ToolSvc.ZmumuResonanceSelectionTool - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += muTrackMonMan - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrackMonitoring_options.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrackMonitoring_options.py deleted file mode 100755 index 87802adc996ba64a9ed386ea5eba1ee2160423df..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrackMonitoring_options.py +++ /dev/null @@ -1,214 +0,0 @@ -#====================================================================== -# TOP JobOptions to run on MuonTrackMonitoring -#====================================================================== -from MuonDQAMonFlags.MuonDQAFlags import MuonDQAFlags as MuonDQAFlags -#############TriggerAware Trk Monitoring####################### -if MuonDQAFlags.MuonTrkMonDoTrigger or MuonDQAFlags.doMDTTGC: - from TrigDecisionMaker.TrigDecisionMakerConfig import TrigDecisionMaker - trigDecMaker = TrigDecisionMaker() - topSequence += trigDecMaker - #from TrigDecision.TrigDecisionConf import TrigDec__TrigDecisionTool - #tdt = TrigDec__TrigDecisionTool() - #ToolSvc += tdt - tdt = monTrigDecTool -############################################################### -#----------------------# -# Trk Level Monitoring # -#----------------------# -### Which Track Collections to read (set array element to 0 or 1): -# 1-> Moore, 2->MuonBoy -############################################################### -#############MuonSelectedTracksMon############# -from MuonTrackMonitoring.MuonTrackMonitoringConf import MuonSelectedTracksMon -#############MuonGenericTracksMon############# -from MuonTrackMonitoring.MuonTrackMonitoringConf import MuonGenericTracksMon -#############MuonGenericTracksMon############# -from MuonTrackMonitoring.MuonTrackMonitoringConf import TGCStandaloneTracksMon -############# NO TriggerAware Trk Monitoring ####################### -if MuonDQAFlags.doMuonTrackMon: - - #############MuonSelectedTracksMon############# - MuonSelectedTracksMon = MuonSelectedTracksMon(name = "MuonSelectedTracksMon", - WhichTrackCollections = [0,1,1], - MuonTrackCollections = ["ExtrapolatedMuonSpectrometerTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - NPhiBins = 360, - UseTriggerVector = False, - MuonTriggerChainName = "NoMuonTriggerSelection" ) - #############MuonGenericTracksMon############# - MuonGenericTracksMon = MuonGenericTracksMon(name = "MuonGenericTracksMon", - WhichTrackCollections = [0,1,1], - MuonTrackCollections = ["ExtrapolatedMuonSpectrometerTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - NPhiBins = 360, - UseTriggerVector = False, - MuonTriggerChainName = "NoMuonTriggerSelection" ) - #############TGCStandaloneTracksMon_Trig############ - TGCStandaloneTracksMon_NoTrig = TGCStandaloneTracksMon(name = "TGCStandaloneTracksMon", - TriggerAware = False, - MuonTriggerChainName = "TriggersInChain") - #ToolSvc += MuonSelectedTracksMon - #ToolSvc += MuonGenericTracksMon - #ToolSvc += TGCStandaloneTracksMon - monMan.AthenaMonTools += [ MuonSelectedTracksMon ] - monMan.AthenaMonTools += [ MuonGenericTracksMon ] - monMan.AthenaMonTools += [ TGCStandaloneTracksMon ] - ###enable lumi tool - #MuonSelectedTracksMon.EnableLumi = True - #MuonGenericTracksMon.EnableLumi = True - #TGCStandaloneTracksMon.EnableLumi = True - -#############TriggerAware Trk Monitoring####################### -## set to true in case you would like to use trigger-aware monitoring -## only do trigger-aware monitoring if DQMonFlags.useTrigger is true -if not DQMonFlags.useTrigger(): - print "IDPerfMon_jobOptions.py: trigger decision tool not found: don't run trigger-aware monitoring" -else: - if MuonDQAFlags.MuonTrkMonDoTrigger and MuonDQAFlags.doMuonTrackMon: - #############MuonSelectedTracksMon_Trig############# - MuonSelectedTracksMon_Trig = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_Trig", - WhichTrackCollections = [0,1,1], - MuonTrackCollections = ["MooreTracks","ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - NPhiBins = 360, - UseTriggerVector = True, - MuonTriggerDecisionTool = "TrigDec::TrigDecisionTool", - Muon_Trigger_Items = ["EF_2mu10", "EF_2mu4", "EF_2mu6", "EF_mu10", "EF_mu20", "EF_mu40"], - MuonTriggerChainName = "TriggersInChain") - #############MuonGenericTracksMon_Trig############ - MuonGenericTracksMon_Trig = MuonGenericTracksMon(name = "MuonGenericTracksMon_Trig", - WhichTrackCollections = [0,1,1], - MuonTrackCollections = ["MooreTracks","ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - NPhiBins = 360, - UseTriggerVector = True, - MuonTriggerDecisionTool = "TrigDec::TrigDecisionTool", - Muon_Trigger_Items = ["EF_2mu10", "EF_2mu4", "EF_2mu6", "EF_mu10", "EF_mu20", "EF_mu40"], - MuonTriggerChainName = "TriggersInChain") - #############TGCStandaloneTracksMon_Trig############ - TGCStandaloneTracksMon_Trig = TGCStandaloneTracksMon(name = "TGCStandaloneTracksMon_Trig", - TriggerAware = False, - MuonTriggerDecisionTool = "TrigDec::TrigDecisionTool", - Muon_Trigger_Items = ["MU0", "MU4", "MU6", "MU10", "MU11", "MU15", "MU20", "MU40", "MU0_TGC", "MU6_TGC", "MU0_TGC_HALO" ], - MuonTriggerChainName = "TriggersInChain") - #ToolSvc += MuonSelectedTracksMon_Trig - #ToolSvc += MuonGenericTracksMon_Trig - #ToolSvc += TGCStandaloneTracksMon_Trig - monMan.AthenaMonTools += [ MuonSelectedTracksMon_Trig ] - monMan.AthenaMonTools += [ MuonGenericTracksMon_Trig] - monMan.AthenaMonTools += [ TGCStandaloneTracksMon_Trig] - ###enable lumi tool - #MuonSelectedTracksMon_Trig.EnableLumi = True - #MuonGenericTracksMon_Trig.EnableLumi = True - #TGCStandaloneTracksMon_Trig.EnableLumi = True - #############MuonSelectedTracksMon_Trig############# - MuonSelectedTracksMon_trig2mu4 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trig2mu4", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False ) - MuonSelectedTracksMon_trig2mu6 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trig2mu6", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False ) - MuonSelectedTracksMon_trigmu10 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trigmu10", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False ) - MuonSelectedTracksMon_trigmu20 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trigmu20", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False ) - MuonSelectedTracksMon_trigmu40 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trigmu40", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False ) - MuonSelectedTracksMon_trig2mu10 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trig2mu10", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False ) - #############MuonGenericTracksMon_Trig############# - MuonGenericTracksMon_trig2mu4 = MuonSelectedTracksMon(name = "MuonGenericTracksMon_trig2mu4", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False ) - MuonGenericTracksMon_trig2mu6 = MuonSelectedTracksMon(name = "MuonGenericTracksMon_trig2mu6", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False ) - MuonGenericTracksMon_trigmu10 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trigmu10", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False) - MuonGenericTracksMon_trigmu20 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trigmu20", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False) - MuonGenericTracksMon_trigmu40 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trigmu40", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False) - MuonGenericTracksMon_trig2mu10 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trig2mu10", - WhichTrackCollections = [0,1,1], EnableLumi = True, - MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks", "MuidExtrapolatedTracks" ], - UseTriggerVector = False) - MuonSelectedTracksMon_trig2mu4.TrigDecisionTool = tdt - MuonSelectedTracksMon_trig2mu6.TrigDecisionTool = tdt - MuonSelectedTracksMon_trigmu10.TrigDecisionTool = tdt - MuonSelectedTracksMon_trigmu20.TrigDecisionTool = tdt - MuonSelectedTracksMon_trigmu40.TrigDecisionTool = tdt - MuonSelectedTracksMon_trig2mu10.TrigDecisionTool = tdt - MuonGenericTracksMon_trig2mu4.TrigDecisionTool = tdt - MuonGenericTracksMon_trig2mu6.TrigDecisionTool = tdt - MuonGenericTracksMon_trigmu10.TrigDecisionTool = tdt - MuonGenericTracksMon_trigmu20.TrigDecisionTool = tdt - MuonGenericTracksMon_trigmu40.TrigDecisionTool = tdt - MuonGenericTracksMon_trig2mu10.TrigDecisionTool = tdt - ##############Trigger Items for Muons############### - ##############MuonSelectedTracksMon################# - MuonSelectedTracksMon_trig2mu4.TriggerChain = "EF_2mu4" - MuonSelectedTracksMon_trig2mu6.TriggerChain = "EF_2mu6" - MuonSelectedTracksMon_trigmu10.TriggerChain = "EF_mu10" - MuonSelectedTracksMon_trigmu20.TriggerChain = "EF_mu20" - MuonSelectedTracksMon_trigmu40.TriggerChain = "EF_mu40" - MuonSelectedTracksMon_trig2mu10.TriggerChain = "EF_2mu10" - MuonSelectedTracksMon_trig2mu4.MuonTriggerChainName = "EF_2mu4" - MuonSelectedTracksMon_trig2mu6.MuonTriggerChainName = "EF_2mu6" - MuonSelectedTracksMon_trigmu10.MuonTriggerChainName = "EF_mu10" - MuonSelectedTracksMon_trigmu20.MuonTriggerChainName = "EF_mu20" - MuonSelectedTracksMon_trigmu40.MuonTriggerChainName = "EF_mu40" - MuonSelectedTracksMon_trig2mu10.MuonTriggerChainName = "EF_2mu10" - ##############MuonGenericTracksMon################# - MuonGenericTracksMon_trig2mu4.TriggerChain = "EF_2mu4" - MuonGenericTracksMon_trig2mu6.TriggerChain = "EF_2mu6" - MuonGenericTracksMon_trigmu10.TriggerChain = "EF_mu10" - MuonGenericTracksMon_trigmu20.TriggerChain = "EF_mu20" - MuonGenericTracksMon_trigmu40.TriggerChain = "EF_mu40" - MuonGenericTracksMon_trig2mu10.TriggerChain = "EF_2mu10" - MuonGenericTracksMon_trig2mu4.MuonTriggerChainName = "EF_2mu4" - MuonGenericTracksMon_trig2mu6.MuonTriggerChainName = "EF_2mu6" - MuonGenericTracksMon_trigmu10.MuonTriggerChainName = "EF_mu10" - MuonGenericTracksMon_trigmu20.MuonTriggerChainName = "EF_mu20" - MuonGenericTracksMon_trigmu40.MuonTriggerChainName = "EF_mu40" - MuonGenericTracksMon_trig2mu10.MuonTriggerChainName = "EF_2mu10" - ################################################### - #ToolSvc += MuonSelectedTracksMon_trig2mu4 - #ToolSvc += MuonSelectedTracksMon_trig2mu6 - #ToolSvc += MuonSelectedTracksMon_trigmu10 - #ToolSvc += MuonSelectedTracksMon_trigmu20 - #ToolSvc += MuonSelectedTracksMon_trigmu40 - #ToolSvc += MuonSelectedTracksMon_trig2mu10 - #ToolSvc += MuonGenericTracksMon_trig2mu4 - #ToolSvc += MuonGenericTracksMon_trig2mu6 - #ToolSvc += MuonGenericTracksMon_trigmu10 - #ToolSvc += MuonGenericTracksMon_trigmu20 - #ToolSvc += MuonGenericTracksMon_trigmu40 - #ToolSvc += MuonGenericTracksMon_trig2mu10 - ################################################### - monMan.AthenaMonTools += [ MuonSelectedTracksMon_trig2mu4 ] - monMan.AthenaMonTools += [ MuonSelectedTracksMon_trig2mu6 ] - monMan.AthenaMonTools += [ MuonSelectedTracksMon_trigmu10 ] - monMan.AthenaMonTools += [ MuonSelectedTracksMon_trigmu20 ] - monMan.AthenaMonTools += [ MuonSelectedTracksMon_trigmu40 ] - monMan.AthenaMonTools += [ MuonSelectedTracksMon_trig2mu10 ] - monMan.AthenaMonTools += [ MuonGenericTracksMon_trig2mu4 ] - monMan.AthenaMonTools += [ MuonGenericTracksMon_trig2mu6 ] - monMan.AthenaMonTools += [ MuonGenericTracksMon_trigmu10 ] - monMan.AthenaMonTools += [ MuonGenericTracksMon_trigmu20 ] - monMan.AthenaMonTools += [ MuonGenericTracksMon_trigmu40 ] - monMan.AthenaMonTools += [ MuonGenericTracksMon_trig2mu10 ] diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrigTrackDQA_options.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrigTrackDQA_options.py deleted file mode 100644 index 749b2ba637826b900ff6057921903deac2b96c7a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/share/MuonTrigTrackDQA_options.py +++ /dev/null @@ -1,187 +0,0 @@ -## #====================================================================== -# # top JobOptions to run on TriggerAware MuonTrackMonitoring -# #====================================================================== -# ## #--------------------------# -# ## # MuonTrack Monitoring # -# ## #--------------------------# -# print '\n****************************************************************************************\n' -# print " ******** Welcome to the Offline MuonTrackMonitoring package. ******** " -# print " ******** Documentation may be found at:******** " -# print " **** https://twiki.cern.ch/twiki/bin/view/Atlas/MuonOfflineDQA ***** " -# print '\n****************************************************************************************\n' - -# #muTrackMonMan = AthenaMonManager(name="MuonTrackMonManager", -# # FileKey = DQMonFlags.monManFileKey(), -# # Environment = DQMonFlags.monManEnvironment(), -# # OutputLevel = muonOutputLevel) - - -# from MuonRecExample import MuonRecTools -# from MuonTrackMonitoring.MuonTrackMonitoringConf import MuonSelectedTracksMon -# from MuonTrackMonitoring.MuonTrackMonitoringConf import MuonGenericTracksMon -# from MuonTrackMonitoring.MuonTrackMonitoringConf import TGCStandaloneTracksMon -# from MuonTrackMonitoring.MuonTrackMonitoringConf import RPCStandaloneTracksMon - -# ############TriggerAware Trk Monitoring####################### -# # set to true in case you would like to use trigger-aware monitoring -# # only do trigger-aware monitoring if monTrigDecTool known by ToolSvc -# if not hasattr(ToolSvc, 'monTrigDecTool'): -# print "MuonTrigTrackDQA_options.py: trigger decision tool not found: don't run trigger-aware monitoring" -# else: -# #############MuonSelectedTracksMon_Trig############# -# MuonSelectedTracksMon_Trig = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_Trig", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks","ConvertedMBoyTracks" ], -# NPhiBins = 360, -# UseTriggerVector = True, -# Muon_Trigger_Items = ["EF_2mu10", "EF_2mu4", "EF_2mu6", "EF_mu10", "EF_mu20", "EF_mu40"], -# MuonTriggerChainName = "TriggersInChain", -# OutputLevel = INFO) -# ###########MuonGenericTracksMon_Trig############ -# MuonGenericTracksMon_Trig = MuonGenericTracksMon(name = "MuonGenericTracksMon_Trig", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks","ConvertedMBoyTracks" ], -# NPhiBins = 360, -# UseTriggerVector = True, -# Muon_Trigger_Items = ["EF_2mu10", "EF_2mu4", "EF_2mu6", "EF_mu10", "EF_mu20", "EF_mu40"], -# MuonTriggerChainName = "TriggersInChain", -# OutputLevel = INFO) -# ###########TGCStandaloneTracksMon_Trig############ -# # TGCStandaloneTracksMon_Trig = TGCStandaloneTracksMon(name = "TGCStandaloneTracksMon_Trig", -# # TriggerAware = True, -# # TriggerDecisionTool = monTrigDecTool, -# # Muon_Trigger_Items = ["MU0", "MU4", "MU6", "MU10", "MU11", "MU15", "MU20", "MU40", "MU0_TGC", "MU6_TGC", "MU0_TGC_HALO" ], -# # OutputLevel = INFO) -# ############################################################ -# ToolSvc += MuonSelectedTracksMon_Trig -# ToolSvc += MuonGenericTracksMon_Trig -# # ToolSvc += TGCStandaloneTracksMon_Trig -# muTrackMonMan.AthenaMonTools += [ MuonSelectedTracksMon_Trig ] -# muTrackMonMan.AthenaMonTools += [ MuonGenericTracksMon_Trig] -# # muTgcTrackMonMan.AthenaMonTools += [ TGCStandaloneTracksMon_Trig] -# print muTrackMonMan -# # print muTgcTrackMonMan -# ###########MuonSelectedTracksMon_Trig - Specific############# -# MuonSelectedTracksMon_trigmu10 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trigmu10", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonSelectedTracksMon_trigmu20 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trigmu20", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonSelectedTracksMon_trigmu40 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trigmu40", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonSelectedTracksMon_trig2mu10 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trig2mu10", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonSelectedTracksMon_trig2mu4 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trig2mu4", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonSelectedTracksMon_trig2mu6 = MuonSelectedTracksMon(name = "MuonSelectedTracksMon_trig2mu6", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonSelectedTracksMon_trigmu10.TrigDecisionTool = monTrigDecTool -# MuonSelectedTracksMon_trigmu20.TrigDecisionTool = monTrigDecTool -# MuonSelectedTracksMon_trigmu40.TrigDecisionTool = monTrigDecTool -# MuonSelectedTracksMon_trig2mu10.TrigDecisionTool = monTrigDecTool -# MuonSelectedTracksMon_trig2mu4.TrigDecisionTool = monTrigDecTool -# MuonSelectedTracksMon_trig2mu6.TrigDecisionTool = monTrigDecTool -# MuonSelectedTracksMon_trigmu10.TriggerChain = "EF_mu10" -# MuonSelectedTracksMon_trigmu20.TriggerChain = "EF_mu20" -# MuonSelectedTracksMon_trigmu40.TriggerChain = "EF_mu40" -# MuonSelectedTracksMon_trig2mu10.TriggerChain = "EF_2mu10" -# MuonSelectedTracksMon_trig2mu4.TriggerChain = "EF_2mu4" -# MuonSelectedTracksMon_trig2mu6.TriggerChain = "EF_2mu6" -# MuonSelectedTracksMon_trigmu10.MuonTriggerChainName = "EF_mu10" -# MuonSelectedTracksMon_trigmu20.MuonTriggerChainName = "EF_mu20" -# MuonSelectedTracksMon_trigmu40.MuonTriggerChainName = "EF_mu40" -# MuonSelectedTracksMon_trig2mu10.MuonTriggerChainName = "EF_2mu10" -# MuonSelectedTracksMon_trig2mu4.MuonTriggerChainName = "EF_2mu4" -# MuonSelectedTracksMon_trig2mu6.MuonTriggerChainName = "EF_2mu6" -# ToolSvc += MuonSelectedTracksMon_trigmu10 -# ToolSvc += MuonSelectedTracksMon_trigmu20 -# ToolSvc += MuonSelectedTracksMon_trigmu40 -# ToolSvc += MuonSelectedTracksMon_trig2mu10 -# ToolSvc += MuonSelectedTracksMon_trig2mu4 -# ToolSvc += MuonSelectedTracksMon_trig2mu6 -# muTrackMonMan.AthenaMonTools += [ MuonSelectedTracksMon_trigmu10] -# muTrackMonMan.AthenaMonTools += [ MuonSelectedTracksMon_trigmu20] -# muTrackMonMan.AthenaMonTools += [ MuonSelectedTracksMon_trigmu40] -# muTrackMonMan.AthenaMonTools += [ MuonSelectedTracksMon_trig2mu10] -# muTrackMonMan.AthenaMonTools += [ MuonSelectedTracksMon_trig2mu4] -# muTrackMonMan.AthenaMonTools += [ MuonSelectedTracksMon_trig2mu6] -# print muTrackMonMan -# ###########MuonGenericTracksMon_Trig - Specific############# -# MuonGenericTracksMon_trigmu10 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trigmu10", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonGenericTracksMon_trigmu20 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trigmu20", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonGenericTracksMon_trigmu40 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trigmu40", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonGenericTracksMon_trig2mu10 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trig2mu10", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonGenericTracksMon_trig2mu4 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trig2mu4", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonGenericTracksMon_trig2mu6 = MuonGenericTracksMon(name = "MuonGenericTracksMon_trig2mu6", -# WhichTrackCollections = [1,1], -# MuonTrackCollections = ["MooreTracks" ,"ConvertedMBoyTracks" ], -# UseTriggerVector = False, -# OutputLevel = INFO) -# MuonGenericTracksMon_trigmu10.TrigDecisionTool = monTrigDecTool -# MuonGenericTracksMon_trigmu20.TrigDecisionTool = monTrigDecTool -# MuonGenericTracksMon_trigmu40.TrigDecisionTool = monTrigDecTool -# MuonGenericTracksMon_trig2mu10.TrigDecisionTool = monTrigDecTool -# MuonGenericTracksMon_trig2mu4.TrigDecisionTool = monTrigDecTool -# MuonGenericTracksMon_trig2mu6.TrigDecisionTool = monTrigDecTool -# MuonGenericTracksMon_trigmu10.TriggerChain = "EF_mu10" -# MuonGenericTracksMon_trigmu20.TriggerChain = "EF_mu20" -# MuonGenericTracksMon_trigmu40.TriggerChain = "EF_mu40" -# MuonGenericTracksMon_trig2mu10.TriggerChain = "EF_2mu10" -# MuonGenericTracksMon_trig2mu4.TriggerChain = "EF_2mu4" -# MuonGenericTracksMon_trig2mu6.TriggerChain = "EF_2mu6" -# MuonGenericTracksMon_trigmu10.MuonTriggerChainName = "EF_mu10" -# MuonGenericTracksMon_trigmu20.MuonTriggerChainName = "EF_mu20" -# MuonGenericTracksMon_trigmu40.MuonTriggerChainName = "EF_mu40" -# MuonGenericTracksMon_trig2mu10.MuonTriggerChainName = "EF_2mu10" -# MuonGenericTracksMon_trig2mu4.MuonTriggerChainName = "EF_2mu4" -# MuonGenericTracksMon_trig2mu6.MuonTriggerChainName = "EF_2mu6" -# ToolSvc += MuonGenericTracksMon_trigmu10 -# ToolSvc += MuonGenericTracksMon_trigmu20 -# ToolSvc += MuonGenericTracksMon_trigmu40 -# ToolSvc += MuonGenericTracksMon_trig2mu10 -# ToolSvc += MuonGenericTracksMon_trig2mu4 -# ToolSvc += MuonGenericTracksMon_trig2mu6 -# muTrackMonMan.AthenaMonTools += [ MuonGenericTracksMon_trigmu10] -# muTrackMonMan.AthenaMonTools += [ MuonGenericTracksMon_trigmu20] -# muTrackMonMan.AthenaMonTools += [ MuonGenericTracksMon_trigmu40] -# muTrackMonMan.AthenaMonTools += [ MuonGenericTracksMon_trig2mu10] -# muTrackMonMan.AthenaMonTools += [ MuonGenericTracksMon_trig2mu4] -# muTrackMonMan.AthenaMonTools += [ MuonGenericTracksMon_trig2mu6] -# print muTrackMonMan diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx deleted file mode 100755 index 27af512b2d6fe47b1d19edc35f3b00b621a391d9..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx +++ /dev/null @@ -1,639 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// ================================================================================ -// MuonGenericTracksMon.cxx -// ------------------------------ -// AUTHORS: N. Benekos, E. Christidi, A. Cortes, A. Eppig, I. Nomidis, T. Liss -// B. Tong, Y. Liu, G. Cree -// created: November 2007 -// modified June 2008: for Trigger Aware monitoring : A. Cortes (UIUC) -// modified March 2015: XAOD migration and combination of track / segment / muon -// description: Implementation code for the MuonGenericTracksMon -// ============================================================================== - -#include "MuonTrackMonitoring/MuonGenericTracksMon.h" -#include "xAODEventInfo/EventInfo.h" -#include "TrkMultiComponentStateOnSurface/MultiComponentStateOnSurface.h" -#include "TrkMultiComponentStateOnSurface/MultiComponentState.h" -#include "TrkEventPrimitives/ResidualPull.h" -#include "TrkMeasurementBase/MeasurementBase.h" -#include "TrkTrack/TrackStateOnSurface.h" -#include "TrkTrack/TrackCollection.h" -//include Root dependencies -#include <TH1F.h> - -// ********************************************************************* -// Public Methods -// ********************************************************************* - -MuonGenericTracksMon::MuonGenericTracksMon( const std::string & type, const std::string & name, const IInterface* parent ) - :ManagedMonitorToolBase( type, name, parent ), - m_inst_lumi_bcid(0.0), - m_inst_lumi_lb(0.0), - m_current_lb(-1), - m_hNEvent(NULL), - m_oRecoLumiPlots(0), - m_oRecoMuonSegmentPlots(0), - m_oRecoMuonMSTrackPlots(0), - m_oRecoMuonMETrackPlots(0), - m_oRecoMuonIDTrackPlots(0), - m_oRecoMuonPlots(0), - m_oRecoPhysPlots(0), - m_oRecoVertexPlots(0), - m_useTrigger(true), - m_muonSelectionTool("CP::MuonSelectionTool/MuonSelectionTool"), - m_ZmumuResonanceSelectionTool("MuonResonanceSelectionTool/ZmumuResonanceSelectionTool"), - m_ZmumuResonancePairingTool("MuonResonancePairingTool/ZmumuResonancePairingTool"), - m_JpsimumuResonanceSelectionTool("MuonResonanceSelectionTool/JpsimumuResonanceSelectionTool"), - m_JpsimumuResonancePairingTool("MuonResonancePairingTool/JpsimumuResonancePairingTool"), - m_isMC(false) -{ - - declareProperty("UseTriggerVector", m_useTrigger); - declareProperty("MuonTriggerChainName", m_MuonTriggerChainName); - declareProperty("Muon_Trigger_Items", m_muon_triggers); - declareProperty("TriggerDecisionTool", m_trigDecTool); - declareProperty("MuonCollection", m_muonsName = "Muons"); - declareProperty("MuonSegmentCollection", m_muonSegmentsName = "MuonSegments"); - declareProperty("MuonTrackCollection", m_muonTracksName = "MuonSpectrometerTrackParticles"); - declareProperty("MuonExtrapolatedTrackCollection", m_muonExtrapTracksName = "ExtrapolatedMuonTrackParticles"); - declareProperty("InDetTrackParticles", m_innerTracksName = "InDetTrackParticles"); - declareProperty("MuonSelectorTool", m_muonSelectionTool); - declareProperty("ZmumuResonanceSelectionTool", m_ZmumuResonanceSelectionTool); - declareProperty("JpsimumuResonanceSelectionTool", m_JpsimumuResonanceSelectionTool); - declareProperty("MSVertexCollection", m_msVertexCollection = "MSDisplacedVertex"); -} - -StatusCode MuonGenericTracksMon::initialize() { - ATH_CHECK(ManagedMonitorToolBase::initialize()); - ATH_CHECK(setupTools()); - return StatusCode::SUCCESS; -} - -//======================================================================================// -StatusCode MuonGenericTracksMon::bookHistograms() -//======================================================================================// -{ - ATH_MSG_DEBUG("In bookHistograms()"); - - if(!(m_environment == AthenaMonManager::tier0 || - m_environment == AthenaMonManager::tier0ESD || - m_environment == AthenaMonManager::online || - m_environment == AthenaMonManager::AOD)){ - - return StatusCode::SUCCESS; - } - - MgmtAttr_t attr = ATTRIB_MANAGED; - - //set the path with trigger chain name - std::string rootpath = "MuonPhysics/"; - - if(newRunFlag()) { - - //example of how to register a new histogram - m_hNEvent = new TH1F("Overview_nEvent", "Number of Events;LumiBlock;Nevents", 2000, -0.5, 1999.5); - - std::string dirpath; - dirpath = rootpath + m_MuonTriggerChainName + "/Overview"; - - MonGroup mongroup_gen_overview(this, dirpath, run, attr ); - bookInMongroup(m_hNEvent, mongroup_gen_overview).ignore(); - - if (m_MuonTriggerChainName != ""){ - - //book lumi associated info - dirpath = m_MuonTriggerChainName + "Overview/" + m_sources[SOURCE::CBMUONS];//redefine for hist name - MonGroup mongroup_overview2(this, rootpath + dirpath, run, attr); - m_oRecoLumiPlots.push_back(new RecoLumiPlots(0, dirpath + "_", m_sources[SOURCE::CBMUONS])); - bookInMongroup(*m_oRecoLumiPlots[0], mongroup_overview2, m_sources[SOURCE::CBMUONS]).ignore(); - - dirpath = m_MuonTriggerChainName + "Overview/" + m_sources[SOURCE::NONCBMUONS];//redefine for hist name - MonGroup mongroup_overview3(this, rootpath + dirpath, run, attr); - m_oRecoLumiPlots.push_back(new RecoLumiPlots(0, dirpath + "_", m_sources[SOURCE::NONCBMUONS])); - bookInMongroup(*m_oRecoLumiPlots[1], mongroup_overview3, m_sources[SOURCE::NONCBMUONS]).ignore(); - - dirpath = m_MuonTriggerChainName + "Overview/" + m_sources[SOURCE::CONTAINER];//redefine for hist name - MonGroup mongroup_overview(this, rootpath + dirpath, run, attr); - m_oRecoLumiPlots.push_back(new RecoLumiPlots(0, dirpath + "_", m_sources[SOURCE::CONTAINER])); - bookInMongroup(*m_oRecoLumiPlots[2], mongroup_overview, m_sources[SOURCE::CONTAINER]).ignore(); - //book segments - dirpath = m_MuonTriggerChainName + "Segments/" + m_sources[SOURCE::CBMUONS]; - MonGroup mongroup_segments2(this, rootpath + dirpath, run, attr); - m_oRecoMuonSegmentPlots.push_back(new RecoMuonSegmentPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonSegmentPlots[0], mongroup_segments2, m_sources[SOURCE::CBMUONS]).ignore(); - - dirpath = m_MuonTriggerChainName + "Segments/" + m_sources[SOURCE::NONCBMUONS]; - MonGroup mongroup_segments3(this, rootpath + dirpath, run, attr); - m_oRecoMuonSegmentPlots.push_back(new RecoMuonSegmentPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonSegmentPlots[1], mongroup_segments3, m_sources[SOURCE::NONCBMUONS]).ignore(); - - dirpath = m_MuonTriggerChainName + "Segments/" + m_sources[SOURCE::CONTAINER]; - MonGroup mongroup_segments(this, rootpath + dirpath, run, attr); - m_oRecoMuonSegmentPlots.push_back(new RecoMuonSegmentPlots(0, dirpath, true)); - bookInMongroup(*m_oRecoMuonSegmentPlots[2], mongroup_segments, m_sources[SOURCE::CONTAINER]).ignore(); - //book MS tracks - dirpath = m_MuonTriggerChainName + "TracksMS/" + m_sources[SOURCE::CONTAINER]; - MonGroup mongroup_mstracks(this, rootpath + dirpath, run, attr); - m_oRecoMuonMSTrackPlots.push_back(new RecoMuonTrackPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonMSTrackPlots[0], mongroup_mstracks, m_sources[SOURCE::CONTAINER], "MS").ignore(); - //book muons - dirpath = m_MuonTriggerChainName + "Muons/" + m_sources[SOURCE::CBMUONS]; - MonGroup mongroup_mutracks(this, rootpath + dirpath, run, attr); - m_oRecoMuonPlots.push_back(new RecoMuonPlots(0, dirpath, true)); - bookInMongroup(*m_oRecoMuonPlots[0], mongroup_mutracks, m_sources[SOURCE::CBMUONS], "").ignore(); - - dirpath = m_MuonTriggerChainName + "Muons/" + m_sources[SOURCE::NONCBMUONS]; - MonGroup mongroup_mutracks2(this, rootpath + dirpath, run, attr); - m_oRecoMuonPlots.push_back(new RecoMuonPlots(0, dirpath, false)); - bookInMongroup(*m_oRecoMuonPlots[1], mongroup_mutracks2, m_sources[SOURCE::NONCBMUONS], "NonCB").ignore(); - //book id tracks - dirpath = m_MuonTriggerChainName + "TracksID/" + m_sources[SOURCE::CBMUONS]; - MonGroup mongroup_idtracks(this, rootpath + dirpath, run, attr); - m_oRecoMuonIDTrackPlots.push_back(new RecoMuonIDTrackPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonIDTrackPlots[0], mongroup_idtracks, m_sources[SOURCE::CBMUONS], "ID").ignore(); - - dirpath = m_MuonTriggerChainName + "TracksID/" + m_sources[SOURCE::NONCBMUONS]; - MonGroup mongroup_idtracks2(this, rootpath + dirpath, run, attr); - m_oRecoMuonIDTrackPlots.push_back(new RecoMuonIDTrackPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonIDTrackPlots[1], mongroup_idtracks2, m_sources[SOURCE::NONCBMUONS], "ID").ignore(); - - dirpath = m_MuonTriggerChainName + "TracksME/" + m_sources[SOURCE::CBMUONS]; - MonGroup mongroup_metracks(this, rootpath + dirpath, run, attr); - m_oRecoMuonMETrackPlots.push_back(new RecoMuonTrackPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonMETrackPlots[0], mongroup_metracks, m_sources[SOURCE::CBMUONS], "ME").ignore(); - - dirpath = m_MuonTriggerChainName + "TracksME/" + m_sources[SOURCE::NONCBMUONS]; - MonGroup mongroup_metracks2(this, rootpath + dirpath, run, attr); - m_oRecoMuonMETrackPlots.push_back(new RecoMuonTrackPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonMETrackPlots[1], mongroup_metracks2, m_sources[SOURCE::NONCBMUONS], "ME").ignore(); - - dirpath = m_MuonTriggerChainName + "MSVertices/"; - MonGroup mongroup_msvertices(this, rootpath + dirpath, run, attr); - m_oRecoVertexPlots.push_back(new RecoVertexPlots(0, dirpath)); - bookInMongroup(*m_oRecoVertexPlots[0], mongroup_msvertices, m_sources[SOURCE::CONTAINER]).ignore(); - - } - else{ - for (int i = 0; i < SOURCE::N_SOURCE; i++) { - - dirpath = "Overview/" + m_sources[i];//redefine for hist name - MonGroup mongroup_overview(this, rootpath + dirpath, run, attr); - m_oRecoLumiPlots.push_back(new RecoLumiPlots(0, dirpath + "_", m_sources[i])); - bookInMongroup(*m_oRecoLumiPlots[i], mongroup_overview, m_sources[i]).ignore(); - - dirpath = "Segments/" + m_sources[i]; - MonGroup mongroup_segments(this, rootpath + dirpath, run, attr); - if(i == SOURCE::CBMUONS || i == SOURCE::CONTAINER) m_oRecoMuonSegmentPlots.push_back(new RecoMuonSegmentPlots(0, dirpath, true)); - else m_oRecoMuonSegmentPlots.push_back(new RecoMuonSegmentPlots(0, dirpath, false)); - bookInMongroup(*m_oRecoMuonSegmentPlots[i], mongroup_segments, m_sources[i]).ignore(); - - if(i > SOURCE::CBMUONS){//for MS tracks, only do not CB muons, since it overlaps with ME - dirpath = "TracksMS/" + m_sources[i]; - MonGroup mongroup_mstracks(this, rootpath + dirpath, run, attr); - m_oRecoMuonMSTrackPlots.push_back(new RecoMuonTrackPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonMSTrackPlots[i - 3], mongroup_mstracks, m_sources[i], "MS").ignore(); - } - - if(i != SOURCE::CONTAINER){//for IDME tracks and Muon, do not do container - dirpath = "Muons/" + m_sources[i]; - MonGroup mongroup_mutracks(this, rootpath + dirpath, run, attr); - if(i > SOURCE::CBMUONS) m_oRecoMuonPlots.push_back(new RecoMuonPlots(0, dirpath, false)); - else m_oRecoMuonPlots.push_back(new RecoMuonPlots(0, dirpath, true)); - bookInMongroup(*m_oRecoMuonPlots[i], mongroup_mutracks, m_sources[i], "").ignore(); - - dirpath = "TracksME/" + m_sources[i]; - MonGroup mongroup_metracks(this, rootpath + dirpath, run, attr); - m_oRecoMuonMETrackPlots.push_back(new RecoMuonTrackPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonMETrackPlots[i], mongroup_metracks, m_sources[i], "ME").ignore(); - - dirpath = "TracksID/" + m_sources[i]; - MonGroup mongroup_idtracks(this, rootpath + dirpath, run, attr); - m_oRecoMuonIDTrackPlots.push_back(new RecoMuonIDTrackPlots(0, dirpath)); - bookInMongroup(*m_oRecoMuonIDTrackPlots[i], mongroup_idtracks, m_sources[i], "ID").ignore(); - } - - if(i == SOURCE::Z){ - dirpath = rootpath + "/MuonTrkPhys/" + m_sources[i]; - MonGroup mongroup_Zsignal(this, dirpath, run, attr); - m_oRecoPhysPlots.push_back(new RecoPhysPlots(0, "", m_sources[i]));//the naming for res is slightly diff - bookInMongroup(*m_oRecoPhysPlots[i], mongroup_Zsignal, m_sources[i]).ignore(); - } - if(i == SOURCE::JPSI){ - dirpath = rootpath + "/MuonTrkPhys/" + m_sources[i]; - MonGroup mongroup_Jpsisignal(this, dirpath, run, attr); - m_oRecoPhysPlots.push_back(new RecoPhysPlots(0, "", m_sources[i]));//the naming for res is slightly diff - bookInMongroup(*m_oRecoPhysPlots[i], mongroup_Jpsisignal, m_sources[i]).ignore(); - } - }//end of loopoing over different m_sources - }//end of different trigger situations - }//end of new run condition - - return StatusCode::SUCCESS; -} - -StatusCode MuonGenericTracksMon::bookInMongroup(TH1* hist, MonGroup& mongroup) -{ - ATH_MSG_DEBUG ("Initializing " << hist << " " << hist->GetName() << "..."); - return (mongroup.regHist(hist)); -} - -StatusCode MuonGenericTracksMon::bookInMongroup(HistData& hist, MonGroup& mongroup, std::string source) -{ - ATH_MSG_INFO ("Initializing " << hist.first << " " << hist.first->GetName() << " " << hist.second << "..."); - //change hist title - TString sHistTitle = hist.first->GetTitle(); - source = m_MuonTriggerChainName + source;//add trig titles here - std::replace( source.begin(), source.end(), '/', ' ');//name clean - sHistTitle = sHistTitle.Insert(0, (source + ": ").c_str()); - hist.first->SetTitle(sHistTitle); - - ATH_CHECK(mongroup.regHist(hist.first)); - return StatusCode::SUCCESS; -} - -StatusCode MuonGenericTracksMon::bookInMongroup(PlotBase& valPlots, MonGroup& mongroup, std::string source) -{ - valPlots.initialize(); - std::vector<HistData> hists = valPlots.retrieveBookedHistograms(); // HistData -> std::pair<TH1*, std::string> - for (auto hist: hists){ - bookInMongroup(hist, mongroup, source).ignore(); - } - return StatusCode::SUCCESS; -} - -StatusCode MuonGenericTracksMon::bookInMongroup(PlotBase& valPlots, MonGroup& mongroup, std::string source, TString Montype) -{ - valPlots.initialize(); - std::vector<HistData> hists = valPlots.retrieveBookedHistograms(); // HistData -> std::pair<TH1*, std::string> - for (auto hist: hists) { - - TString sHistName = hist.first->GetName(); - TString sHistTitle = hist.first->GetTitle(); - - // rebin and/or change the axis range label - // move rebin of all 2D eta_phi plots to post processing - - if (sHistName.Contains("_eta_phi")){ - hist.first->GetXaxis()->SetTitle("#eta"); - hist.first->GetYaxis()->SetTitle("#phi"); - } - else if (sHistName.EndsWith("_eta_pt")){ - hist.first->GetYaxis()->SetTitle("p_{T} [GeV]"); - hist.first->GetXaxis()->SetTitle("#eta"); - } - else if (sHistName.EndsWith("_eta")){ - hist.first->RebinX(2); - hist.first->GetXaxis()->SetTitle("#eta"); - } - else if (sHistName.EndsWith("_phi")){ - hist.first->RebinX(2); - hist.first->GetXaxis()->SetTitle("#phi"); - } - else if (sHistName.EndsWith("_pt")){ - hist.first->RebinX(2); - hist.first->GetXaxis()->SetLimits(0, 100);//consider repace with SetLimits(0, 100) - hist.first->GetXaxis()->SetTitle("p_{T} [GeV]"); - } - else if (sHistName.EndsWith("_ddpt")){ - hist.first->RebinX(3); - } - else if (sHistName.EndsWith("_z0")){ - hist.first->RebinX(2); - } - else if (sHistName.EndsWith("_d0")){ - hist.first->RebinX(2); - } - - // for ID track hits, special treatment - if (sHistName.Contains("HitContent")){ - hist.first->SetName(pathToHistName(m_MuonTriggerChainName) + "Tracks" + Montype + "_" + source + "_" + sHistName); - } - - // change histogram title - if (Montype != ""){//do this only for tracks - if (sHistTitle.Contains("Track")) { - sHistTitle = sHistTitle.Replace(0, 6, Montype + " Track "); - hist.first->SetTitle(sHistTitle); - } - else if (sHistTitle.Contains("Reco Muon")) { - sHistTitle = sHistTitle.Replace(0, 9, Montype + " Track "); - hist.first->SetTitle(sHistTitle); - } - else hist.first->SetTitle(Montype + " Track " + sHistTitle); - } - - bookInMongroup(hist, mongroup, source).ignore(); - } - return StatusCode::SUCCESS; -} - -//======================================================================================// -StatusCode MuonGenericTracksMon::fillHistograms() -{ - ATH_MSG_DEBUG("In fillHistograms()"); - - const xAOD::EventInfo* eventInfo=nullptr; - ATH_CHECK(evtStore()->retrieve(eventInfo)); - - if(!(m_environment == AthenaMonManager::tier0 || - m_environment == AthenaMonManager::tier0ESD || - m_environment == AthenaMonManager::online || - m_environment == AthenaMonManager::AOD)){ - - return StatusCode::SUCCESS; - } - - ATH_MSG_DEBUG("LB " << eventInfo->lumiBlock() << - " instant " << ManagedMonitorToolBase::lbLuminosityPerBCID() << - " average " << ManagedMonitorToolBase::lbAverageLuminosity() << - " duration " << ManagedMonitorToolBase::lbDuration() << - " lbint " << ManagedMonitorToolBase::lbInteractionsPerCrossing() - ); - m_current_lb = eventInfo->lumiBlock(); - m_hNEvent->Fill(m_current_lb, 1); - - m_inst_lumi_bcid = ManagedMonitorToolBase::lbLuminosityPerBCID(); - if(m_inst_lumi_bcid < 0){ - ATH_MSG_DEBUG("Weird instantaneous luminosity per bcid. Setting to 0."); - m_inst_lumi_bcid = 0; - } - m_inst_lumi_lb = ManagedMonitorToolBase::lbAverageLuminosity(); - if(m_inst_lumi_lb < 0){ - ATH_MSG_DEBUG("Weird instantaneous luminosity per lb. Setting to 0."); - m_inst_lumi_lb = 0; - } - - // retrieve containers - const xAOD::MuonSegmentContainer* MuonSegments=nullptr; - ATH_CHECK(evtStore()->retrieve(MuonSegments, m_muonSegmentsName)); - const xAOD::TrackParticleContainer* tracksMS=nullptr; - ATH_CHECK(evtStore()->retrieve(tracksMS, m_muonTracksName)); - const xAOD::MuonContainer* Muons=nullptr; - ATH_CHECK(evtStore()->retrieve(Muons, m_muonsName)); - const xAOD::VertexContainer* MSVertices=nullptr; - ATH_CHECK(evtStore()->retrieve(MSVertices, m_msVertexCollection)); - - // check validity - if (!MuonSegments){ - ATH_MSG_WARNING ("Couldn't retrieve MuonSegments container: " << m_muonSegmentsName); - return StatusCode::SUCCESS; - } - if (!tracksMS) { - ATH_MSG_WARNING ("Couldn't retrieve MS tracks container: " << m_muonTracksName); - return StatusCode::SUCCESS; - } - if (!Muons){ - ATH_MSG_WARNING ("Couldn't retrieve Muons container: " << m_muonsName); - return StatusCode::SUCCESS; - } - if (!MSVertices){ - ATH_MSG_WARNING ("Couldn't retrieve MS vertex container: " << m_msVertexCollection); - return StatusCode::SUCCESS; - } - - // fill the histograms - if (m_MuonTriggerChainName != ""){ - // plot luminosity related plots - plot_lumi_notrig(Muons, tracksMS, MuonSegments); - - // plot segments container - for (const xAOD::MuonSegment* segment : *MuonSegments) - { - plot_segment(*segment, 2);//be consistent! - } - - // plot tracks (MS) container - for (const xAOD::TrackParticle* track: *tracksMS) - { - plot_track(*track, 0); - } - - // plot Muon container - for (const xAOD::Muon* muon: *Muons) - { - if(muon->muonType() == xAOD::Muon::Combined) { - plot_muon_notrig(*muon, 0); - } - else { - plot_muon_notrig(*muon, 1); - } - } - // plot ms vertices - for (const xAOD::Vertex* aVx: *MSVertices) - { - plot_vertex(*aVx, 0); - } - } - else{ - // select muons from Jpsi & Z - auto muons_jpsi = m_JpsimumuResonanceSelectionTool->selectMuons(Muons, m_isMC, CP::SystematicSet()); - auto muons_Z = m_ZmumuResonanceSelectionTool->selectMuons(Muons, m_isMC, CP::SystematicSet()); - - // find J/psi & Z candidates - auto resonances_jpsi = m_JpsimumuResonancePairingTool->buildPairs(muons_jpsi); - auto resonances_Z = m_ZmumuResonancePairingTool->buildPairs(muons_Z); - // plot luminosity related plots - plot_lumi(resonances_Z, resonances_jpsi, Muons, tracksMS, MuonSegments); - - // plot muons, Z and Jpsi, only for collisions - if (m_dataType != AthenaMonManager::cosmics){ - for (auto resonance: resonances_Z) - { - plot_muon(*resonance.first, SOURCE::Z); - plot_muon(*resonance.second, SOURCE::Z); - } - plot_resonances(resonances_Z, SOURCE::Z); - - // plot muons, J/Psi - for (auto resonance: resonances_jpsi) - { - plot_muon(*resonance.first, SOURCE::JPSI); - plot_muon(*resonance.second, SOURCE::JPSI); - } - plot_resonances(resonances_jpsi, SOURCE::JPSI); - } - - // plot muons, all - for (const xAOD::Muon* muon: *Muons) - { - if(muon->muonType() == xAOD::Muon::Combined) { - plot_muon(*muon, SOURCE::CBMUONS); - } - else { - plot_muon(*muon, SOURCE::NONCBMUONS); - } - } - - // plot segments container - for (const xAOD::MuonSegment* segment : *MuonSegments) - { - plot_segment(*segment, SOURCE::CONTAINER); - } - - // plot tracks (MS) container - for (const xAOD::TrackParticle* track: *tracksMS) - { - plot_track(*track, SOURCE::CONTAINER - 3); - } - //clean the resonance candidates - for (const xAOD::Muon* muon : muons_jpsi.first) delete muon; - for (const xAOD::Muon* muon : muons_jpsi.second) delete muon; - for (const xAOD::Muon* muon : muons_Z.first) delete muon; - for (const xAOD::Muon* muon : muons_Z.second) delete muon; - }//end of different trigger situations - //finish all the plotting - return StatusCode::SUCCESS; -} - -//======================================================================================// -void MuonGenericTracksMon::plot_lumi( - std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > resonances_Z, - std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > resonances_jpsi, - const xAOD::MuonContainer* Muons, - const xAOD::TrackParticleContainer* tracksMS, - const xAOD::MuonSegmentContainer* MuonSegments) -//======================================================================================// -{ - //fill all the luminoisty related plot - m_oRecoLumiPlots[SOURCE::Z]->fill(resonances_Z, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); - m_oRecoLumiPlots[SOURCE::JPSI]->fill(resonances_jpsi, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); - m_oRecoLumiPlots[SOURCE::CBMUONS]->fill_CB(Muons, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); - m_oRecoLumiPlots[SOURCE::NONCBMUONS]->fill_Other(Muons, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); - m_oRecoLumiPlots[SOURCE::CONTAINER]->fill(tracksMS, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); - m_oRecoLumiPlots[SOURCE::CONTAINER]->fill(MuonSegments, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); -} - - -//======================================================================================// -void MuonGenericTracksMon::plot_lumi_notrig( - const xAOD::MuonContainer* Muons, - const xAOD::TrackParticleContainer* tracksMS, - const xAOD::MuonSegmentContainer* MuonSegments) -//======================================================================================// -{ - //fill all the luminoisty related plot - m_oRecoLumiPlots[0]->fill_CB(Muons, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); - m_oRecoLumiPlots[1]->fill_Other(Muons, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); - m_oRecoLumiPlots[2]->fill(tracksMS, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); - m_oRecoLumiPlots[2]->fill(MuonSegments, m_current_lb, m_inst_lumi_bcid, m_inst_lumi_lb); -} - -//======================================================================================// -void MuonGenericTracksMon::plot_muon(const xAOD::Muon& muon, int source) -//======================================================================================// -{ - - - xAOD::Muon::Quality my_quality = m_muonSelectionTool->getQuality(muon); - ATH_MSG_DEBUG ("Muon quality value: " << my_quality << " default value " << muon.quality()); - - m_oRecoMuonPlots[source]->fill(muon); - if (source == SOURCE::NONCBMUONS) m_oRecoMuonMSTrackPlots[source - 3]->fill(muon, MUON_COMPONENT::TRACK_MS); - m_oRecoMuonMETrackPlots[source]->fill(muon, MUON_COMPONENT::TRACK_ME); - m_oRecoMuonIDTrackPlots[source]->fill(muon, MUON_COMPONENT::TRACK_ID); - m_oRecoMuonSegmentPlots[source]->fill(muon); - m_oRecoMuonPlots[source]->fill(muon, my_quality); -} - -//======================================================================================// -void MuonGenericTracksMon::plot_muon_notrig(const xAOD::Muon& muon, int source) -//======================================================================================// -{ - xAOD::Muon::Quality my_quality = m_muonSelectionTool->getQuality(muon); - ATH_MSG_DEBUG ("Muon quality value: " << my_quality << " default value " << muon.quality()); - - m_oRecoMuonPlots[source]->fill(muon); - m_oRecoMuonPlots[source]->fill(muon, my_quality); - m_oRecoMuonIDTrackPlots[source]->fill(muon, MUON_COMPONENT::TRACK_ID); - m_oRecoMuonMETrackPlots[source]->fill(muon, MUON_COMPONENT::TRACK_ME); - m_oRecoMuonSegmentPlots[source]->fill(muon); -} - -//======================================================================================// -void MuonGenericTracksMon::plot_segment(const xAOD::MuonSegment& segment, int source) -//======================================================================================// -{ - - m_oRecoMuonSegmentPlots[source]->fill(segment); -} - -//======================================================================================// -void MuonGenericTracksMon::plot_track(const xAOD::TrackParticle& track, int source) -//======================================================================================// -{ - - m_oRecoMuonMSTrackPlots[source]->fill(track); -} -//======================================================================================// -void MuonGenericTracksMon::plot_vertex(const xAOD::Vertex& aVx, int source) -//======================================================================================// -{ - - m_oRecoVertexPlots[source]->fill(aVx); -} - -//======================================================================================// -void MuonGenericTracksMon::plot_resonances(std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > resonances, int source) -//======================================================================================// -{ - m_oRecoPhysPlots[source]->fill(resonances); - -} - -//======================================================================================// -StatusCode MuonGenericTracksMon::procHistograms() -//======================================================================================// -{ - if(!(m_environment == AthenaMonManager::tier0 || - m_environment == AthenaMonManager::tier0ESD || - m_environment == AthenaMonManager::online || - m_environment == AthenaMonManager::AOD)){ - - return StatusCode::SUCCESS; - } - - ATH_MSG_DEBUG("MuonTrackMonitoring procHistograms()"); - - if(endOfRunFlag()) { - - //finish the post processing - - //remove all the pointers - for (auto plots : m_oRecoLumiPlots) delete plots; - for (auto plots : m_oRecoMuonSegmentPlots) delete plots; - for (auto plots : m_oRecoMuonMSTrackPlots) delete plots; - for (auto plots : m_oRecoMuonMETrackPlots) delete plots; - for (auto plots : m_oRecoMuonIDTrackPlots) delete plots; - for (auto plots : m_oRecoMuonPlots) delete plots; - for (auto plots : m_oRecoPhysPlots) delete plots; - for (auto plots : m_oRecoVertexPlots) delete plots; - - } - - return StatusCode::SUCCESS; -} - -//======================================================================================// -StatusCode MuonGenericTracksMon::setupTools() -//======================================================================================// -{ - ATH_CHECK(m_ZmumuResonanceSelectionTool.retrieve()); - ATH_MSG_DEBUG( "Retrieved " << m_ZmumuResonanceSelectionTool ); - - ATH_CHECK(m_ZmumuResonancePairingTool.retrieve()); - ATH_MSG_DEBUG( "Retrieved " << m_ZmumuResonancePairingTool ); - - ATH_CHECK(m_JpsimumuResonanceSelectionTool.retrieve()); - ATH_MSG_DEBUG( "Retrieved " << m_JpsimumuResonanceSelectionTool ); - - ATH_CHECK(m_JpsimumuResonancePairingTool.retrieve()); - ATH_MSG_DEBUG( "Retrieved " << m_JpsimumuResonancePairingTool ); - - ATH_CHECK(m_muonSelectionTool.retrieve()); - ATH_MSG_DEBUG( "Retrieved " << m_muonSelectionTool ); - - return StatusCode::SUCCESS; -} diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a3d50de4a89eeb792c9021cac919858303768ca4 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx @@ -0,0 +1,420 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + 2020 Matthias Schott - Uni Mainz +*/ + +#include "MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h" + +MuonTrackMonitorAlgorithm::MuonTrackMonitorAlgorithm (const std::string& name, ISvcLocator* pSvcLocator) + :AthMonitorAlgorithm(name,pSvcLocator){} + + +StatusCode MuonTrackMonitorAlgorithm::initialize() +{ + ATH_CHECK(m_MuonContainerKey.initialize()); + return AthMonitorAlgorithm::initialize(); +} + +StatusCode MuonTrackMonitorAlgorithm::FillMuonInformation(std::string sIdentifier, std::vector<const xAOD::Muon*> &vecMuons) const +{ + /// Declaring all variables that are initialized via Python will be plotted + using namespace Monitored; + auto tool = getGroup("MuonTrackMonitorAlgorithm"); + auto MuonEta = Monitored::Scalar<float>((sIdentifier+"MuonEta").c_str(), 0); + auto MuonPhi = Monitored::Scalar<float>((sIdentifier+"MuonPhi").c_str(), 0); + auto MuonEtaTight = Monitored::Scalar<float>((sIdentifier+"MuonEtaTight").c_str(), 0); + auto MuonPhiTight = Monitored::Scalar<float>((sIdentifier+"MuonPhiTight").c_str(), 0); + auto MuonEtaMedium = Monitored::Scalar<float>((sIdentifier+"MuonEtaMedium").c_str(), 0); + auto MuonPhiMedium = Monitored::Scalar<float>((sIdentifier+"MuonPhiMedium").c_str(), 0); + auto MuonD0 = Monitored::Scalar<float>((sIdentifier+"MuonD0").c_str(), 0); + auto MuonZ0 = Monitored::Scalar<float>((sIdentifier+"MuonZ0").c_str(), 0); + auto MuonPt = Monitored::Scalar<float>((sIdentifier+"MuonPt").c_str(), 0); + auto MuonDPTIDME = Monitored::Scalar<float>((sIdentifier+"MuonDPTIDME").c_str(), 0); + auto MuonsNBHits = Monitored::Scalar<float>((sIdentifier+"MuonNBHits").c_str(), 0); + auto MuonsNPixHits = Monitored::Scalar<float>((sIdentifier+"MuonNPixHits").c_str(), 0); + auto MuonsNSCTHits = Monitored::Scalar<float>((sIdentifier+"MuonNSCTHits").c_str(), 0); + auto MuonsNTRTHits = Monitored::Scalar<float>((sIdentifier+"MuonNTRTHits").c_str(), 0); + auto MuonsIDChi2NDF = Monitored::Scalar<float>((sIdentifier+"MuonIDChi2NDF").c_str(), 0); + auto MuonsMEChi2NDF = Monitored::Scalar<float>((sIdentifier+"MuonMEChi2NDF").c_str(), 0); + + /// Loop over all Muons + for(unsigned int n=0; n<vecMuons.size(); n++) { + const xAOD::Muon* muon = vecMuons[n]; + xAOD::Muon::MuonType muonType = muon->muonType(); + xAOD::Muon::Quality muonQuality = muon->quality(); + + if (muonType==xAOD::Muon::Combined) { + const xAOD::TrackParticle *cbtp = nullptr; + const xAOD::TrackParticle *idtp = nullptr; + const xAOD::TrackParticle *mstp = nullptr; + + ElementLink<xAOD::TrackParticleContainer> cbtpLink = muon->combinedTrackParticleLink(); + if (cbtpLink.isValid()) cbtp = *cbtpLink; + if (cbtp) { + uint8_t hitval_numberOfBLayerHits, hitval_numberOfPixelHits, hitval_numberOfSCTHits, hitval_numberOfTRTHits; + // uint8_t hitval_innerSmallHits, hitval_innerLargeHits, hitval_middleSmallHits, hitval_middleLargeHits, hitval_outerSmallHits, hitval_outerLargeHits; + cbtp->summaryValue(hitval_numberOfBLayerHits, xAOD::SummaryType::numberOfInnermostPixelLayerHits); + cbtp->summaryValue(hitval_numberOfPixelHits, xAOD::SummaryType::numberOfPixelHits); + cbtp->summaryValue(hitval_numberOfSCTHits, xAOD::SummaryType::numberOfSCTHits); + cbtp->summaryValue(hitval_numberOfTRTHits, xAOD::SummaryType::numberOfTRTHits); + + /// Basic kinematic Information + MuonEta = cbtp->eta(); + MuonPhi = cbtp->phi(); + MuonPt = cbtp->pt(); + MuonZ0 = cbtp->z0(); + fill(tool, MuonEta, MuonPhi, MuonPt, MuonZ0); + + /// Hit Information of the ID + MuonsNBHits = static_cast<unsigned int>(hitval_numberOfBLayerHits); + MuonsNPixHits = static_cast<unsigned int>(hitval_numberOfPixelHits); + MuonsNSCTHits = static_cast<unsigned int>(hitval_numberOfSCTHits); + MuonsNTRTHits = static_cast<unsigned int>(hitval_numberOfTRTHits); + fill(tool, MuonsNBHits, MuonsNPixHits, MuonsNSCTHits, MuonsNTRTHits); + + /// Save Eta/Phi Information for medium and tight muons, + /// to be used for lates efficiency studies + if (muonQuality==xAOD::Muon::Medium) { + MuonEtaMedium = cbtp->eta(); + MuonPhiMedium = cbtp->phi(); + fill(tool, MuonEtaMedium, MuonPhiMedium); + } + if (muonQuality==xAOD::Muon::Tight) { + MuonEtaTight = cbtp->eta(); + MuonPhiTight = cbtp->phi(); + fill(tool, MuonEtaTight, MuonPhiTight); + } + + /// Momentum Resolution and chi2 studies of MS and ID only tracks + ElementLink<xAOD::TrackParticleContainer> idtpLink = muon->inDetTrackParticleLink(); + ElementLink<xAOD::TrackParticleContainer> mstpLink = muon->muonSpectrometerTrackParticleLink(); + if (idtpLink.isValid()) idtp = *idtpLink; + if (mstpLink.isValid()) mstp = *mstpLink; + if (idtp && mstp) { + MuonDPTIDME = (idtp->pt() - mstp->pt()) / idtp->pt(); + MuonsIDChi2NDF = idtp->chiSquared()/idtp->numberDoF(); + MuonsMEChi2NDF = mstp->chiSquared()/mstp->numberDoF(); + fill(tool, MuonDPTIDME, MuonsIDChi2NDF, MuonsMEChi2NDF); + } + } + } + } + return StatusCode::SUCCESS; +} + +//======================================================================================================== +StatusCode MuonTrackMonitorAlgorithm::analyseLowLevelMuonFeatures(const xAOD::MuonContainer* Muons, int lumiBlockID) const +{ + using namespace Monitored; + /// Declaring all variables that are initialized via Python will be plotted + auto tool = getGroup("MuonTrackMonitorAlgorithm"); + auto MSAuthor = Monitored::Scalar<float>("MSAuthor", 0); + auto MSQuality = Monitored::Scalar<float>("MSQuality", 0); + auto MSType = Monitored::Scalar<float>("MSType", 0); + auto MSLargeSectorR = Monitored::Scalar<float>("MSLargeSectorR", 0); + auto MSLargeSectorZ = Monitored::Scalar<float>("MSLargeSectorZ", 0); + auto MSSmallSectorR = Monitored::Scalar<float>("MSSmallSectorR", 0); + auto MSSmallSectorZ = Monitored::Scalar<float>("MSSmallSectorZ", 0); + auto MSEta = Monitored::Scalar<float>("MSEta", 0); + auto MSPhi = Monitored::Scalar<float>("MSPhi", 0); + auto MSPt = Monitored::Scalar<float>("MSPt", 0); + auto NonCBMuonEta = Monitored::Scalar<float>("NonCBMuonEta", 0); + auto NonCBMuonPhi = Monitored::Scalar<float>("NonCBMuonPhi", 0); + auto CBMuonAuthor = Monitored::Scalar<float>("CBMuonAuthor", 0); + auto MSLumiBlockNumberOfMuonTracks = Monitored::Scalar<float>("MSLumiBlockNumberOfMuonTracks", 0); + auto MSLumiBlockNumberOfSegments = Monitored::Scalar<float>("MSLumiBlockNumberOfSegments", 0); + + /// Loop over all muons + for(const auto& muon : *Muons) { + xAOD::Muon::Quality muonQuality = muon->quality(); + xAOD::Muon::MuonType muonType = muon->muonType(); + xAOD::Muon::Author muonAuthor = muon->author(); + + /// General Muon Control Plots + MSAuthor = muonAuthor; + MSQuality = muonQuality; + MSType = muonType; + MSEta = muon->eta(); + MSPhi = muon->phi(); + MSPt = muon->pt(); + MSLumiBlockNumberOfMuonTracks = lumiBlockID; + fill(tool, MSAuthor, MSQuality, MSType, MSEta, MSPhi, MSPt, MSLumiBlockNumberOfMuonTracks); + + /// Do Muon Segments Plots + for (size_t nSeg=0; nSeg<muon->nMuonSegments();nSeg++) { + MSLumiBlockNumberOfSegments = lumiBlockID; + fill(tool, MSLumiBlockNumberOfSegments); + const xAOD::MuonSegment* muonSegment = muon->muonSegment(nSeg); + if (!muonSegment) { + continue; + } + MSLargeSectorR = sqrt(muonSegment->x()*muonSegment->x() + muonSegment->y()*muonSegment->y()); + MSLargeSectorZ = muonSegment->z(); + MSSmallSectorR = sqrt(muonSegment->x()*muonSegment->x() + muonSegment->y()*muonSegment->y()); + MSSmallSectorZ = muonSegment->z(); + int sector = muonSegment->sector(); + if(sector % 2 == 0) { + fill(tool, MSLargeSectorZ, MSLargeSectorR); + } else { + fill(tool, MSSmallSectorZ, MSSmallSectorR); + } + } + CBMuonAuthor = muonAuthor; + NonCBMuonEta = muon->eta(); + NonCBMuonPhi = muon->phi(); + fill(tool, CBMuonAuthor, NonCBMuonEta, NonCBMuonPhi); + } + + return StatusCode::SUCCESS; +} + + + +//======================================================================================================== +StatusCode MuonTrackMonitorAlgorithm::analyseCombinedTracks(const xAOD::MuonContainer* Muons, int lumiBlockID) const { + using namespace Monitored; + + /// Declaring all variables that are initialized via Python will be plotted + auto tool = getGroup("MuonTrackMonitorAlgorithm"); + auto CBMuonSector = Monitored::Scalar<float>("CBMuonSector", 0); + auto CBMuonCIndex = Monitored::Scalar<float>("CBMuonCIndex", 0); + auto CBMuonEta1Triggered = Monitored::Scalar<float>("CBMuonEta1Triggered", 0); + auto CBMuonPhi1Triggered = Monitored::Scalar<float>("CBMuonPhi1Triggered", 0); + auto CBMuonEta1All = Monitored::Scalar<float>("CBMuonEta1All", 0); + auto CBMuonPhi1All = Monitored::Scalar<float>("CBMuonPhi1All", 0); + auto CBMuonLumiBlock = Monitored::Scalar<float>("CBMuonLumiBlock", 0); + + /// Select Combined Muons + std::vector<const xAOD::Muon*> vecCombinedMuonsHighPT; + std::vector<const xAOD::Muon*> vecCombinedMuons; + + for(const auto& muon : *Muons) { + xAOD::Muon::MuonType muonType = muon->muonType(); + if (muonType==xAOD::Muon::Combined) { + CBMuonLumiBlock = lumiBlockID; + fill(tool, CBMuonLumiBlock); + + vecCombinedMuons.push_back(muon); + if (muon->pt() > m_CBmuons_minPt) vecCombinedMuonsHighPT.push_back(muon); + + /// Provide Segment and Sector Plots + for (size_t nSeg=0; nSeg<muon->nMuonSegments();nSeg++) { + const xAOD::MuonSegment* muonSegment = muon->muonSegment(nSeg); + if (!muonSegment) { + continue; + } + CBMuonSector = muonSegment->sector(); + CBMuonCIndex = muonSegment->chamberIndex(); + fill(tool, CBMuonSector,CBMuonCIndex); + } + } + } + + /// Fill the relevant Muon Information for each Combined Muon + + ATH_CHECK (FillMuonInformation("CB", vecCombinedMuons) ); + + /// Trigger Studies + if (vecCombinedMuonsHighPT.size()==1) { + CBMuonEta1All = vecCombinedMuonsHighPT[0]->eta(); + CBMuonPhi1All = vecCombinedMuonsHighPT[0]->phi(); + fill(tool, CBMuonEta1All, CBMuonPhi1All); + + bool isTriggered = false; + for(const auto& chain : m_hltchainList){ + if(getTrigDecisionTool()->isPassed( chain ) ){ + isTriggered = true; + } + } + + if (isTriggered) { + CBMuonEta1Triggered = vecCombinedMuonsHighPT[0]->eta(); + CBMuonPhi1Triggered = vecCombinedMuonsHighPT[0]->phi(); + fill(tool, CBMuonEta1Triggered, CBMuonPhi1Triggered); + } + } + + return StatusCode::SUCCESS; +} + + +//======================================================================================================== +StatusCode MuonTrackMonitorAlgorithm::analyseZBosonCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const { + using namespace Monitored; + + /// Declaring all variables that are initialized via Python will be plotted + auto tool = getGroup("MuonTrackMonitorAlgorithm"); + auto ZSector = Monitored::Scalar<float>("ZSector", 0); + auto ZChamber = Monitored::Scalar<float>("ZChamber", 0); + auto ZSectorEff = Monitored::Scalar<float>("ZSectorEff", 0); + auto ZChamberEff = Monitored::Scalar<float>("ZChamberEff", 0); + auto ZMass2D = Monitored::Scalar<float>("ZMass2D", 0); + auto ZEta2D = Monitored::Scalar<float>("ZEta2D", 0); + auto ZMass = Monitored::Scalar<float>("ZMass", 0); + auto ZMuonLumiBlock = Monitored::Scalar<float>("ZMuonLumiBlock", 0); + + std::vector<const xAOD::Muon*> vecMuons_ZBoson; + std::vector<const xAOD::Muon*> vecMuons_ZBoson_Candidates; + + /// Select Muons Relevant for Z + for(const auto& muon : *Muons) { + xAOD::Muon::MuonType muonType = muon->muonType(); + if (muonType==xAOD::Muon::Combined) { + const xAOD::TrackParticle *cbtp = nullptr; + ElementLink<xAOD::TrackParticleContainer> cbtpLink = muon->combinedTrackParticleLink(); + if (cbtpLink.isValid()) cbtp = *cbtpLink; + + /// Select Z Boson + if (cbtp) { + float trkiso = muon->isolation(xAOD::Iso::ptcone30)/muon->pt(); + if (muonType==xAOD::Muon::Combined && + cbtp && + muon->pt()>m_ZBosonSelection_minPt && + std::abs(muon->eta())<m_ZBosonSelection_maxEta && + trkiso<m_ZBosonSelection_trkIsolation && + std::abs(cbtp->z0())<m_ZBosonSelection_Z0Cut && + std::abs(cbtp->d0())<m_ZBosonSelection_D0Cut ) + vecMuons_ZBoson_Candidates.push_back(muon); + } + } + } + + /// Z Boson related plots + std::map<int, int> mapTagged_ZBoson; + for (unsigned int n=0; n<vecMuons_ZBoson_Candidates.size(); n++) + mapTagged_ZBoson[n]=0; + for (unsigned int n=0; n<vecMuons_ZBoson_Candidates.size(); n++) + for (unsigned int m=n+1; m<vecMuons_ZBoson_Candidates.size(); m++) { + TLorentzVector tVec1, tVec2; + tVec1.SetPtEtaPhiM(vecMuons_ZBoson_Candidates[n]->pt(), vecMuons_ZBoson_Candidates[n]->eta(), vecMuons_ZBoson_Candidates[n]->phi(), 0.0); + tVec2.SetPtEtaPhiM(vecMuons_ZBoson_Candidates[m]->pt(), vecMuons_ZBoson_Candidates[m]->eta(), vecMuons_ZBoson_Candidates[m]->phi(), 0.0); + if (vecMuons_ZBoson_Candidates[n]->charge()==vecMuons_ZBoson_Candidates[m]->charge()) continue; + if ((tVec1+tVec2).M()<m_ZBosonSelection_minMass) continue; + if ((tVec1+tVec2).M()>m_ZBosonSelection_maxMass) continue; + + if (mapTagged_ZBoson[n]!=1) vecMuons_ZBoson.push_back(vecMuons_ZBoson_Candidates[n]); + mapTagged_ZBoson[n]=1; + if (mapTagged_ZBoson[m]!=1) vecMuons_ZBoson.push_back(vecMuons_ZBoson_Candidates[m]); + mapTagged_ZBoson[m]=1; + + ZMass2D = (tVec1+tVec2).M(); + ZEta2D = tVec1.Eta(); + fill(tool, ZMass2D, ZEta2D); + ZEta2D = tVec2.Eta(); + fill(tool, ZMass2D, ZEta2D); + ZMass = (tVec1+tVec2).M(); + fill(tool, ZMass); + + ZMuonLumiBlock = lumiBlockID; + fill(tool, ZMuonLumiBlock); + } + + /// Fill the relevant Muon Information for each Z Boson Candidate Muon + ATH_CHECK( FillMuonInformation("Z", vecMuons_ZBoson) ); + + return StatusCode::SUCCESS; +} + + + +//======================================================================================================== +StatusCode MuonTrackMonitorAlgorithm::analyseJPsiCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const { + using namespace Monitored; + + /// Declaring all variables that are initialized via Python will be plotted + auto tool = getGroup("MuonTrackMonitorAlgorithm"); + auto JPsiSector = Monitored::Scalar<float>("JPsiSector", 0); + auto JPsiChamber = Monitored::Scalar<float>("JPsiChamber", 0); + auto JPsiSectorEff = Monitored::Scalar<float>("JPsiSectorEff", 0); + auto JPsiChamberEff = Monitored::Scalar<float>("JPsiChamberEff", 0); + auto JPsiMass2D = Monitored::Scalar<float>("JPsiMass2D", 0); + auto JPsiEta2D = Monitored::Scalar<float>("JPsiEta2D", 0); + auto JPsiMass = Monitored::Scalar<float>("JPsiMass", 0); + auto JPsiMuonLumiBlock = Monitored::Scalar<float>("JPsiMuonLumiBlock", 0); + + std::vector<const xAOD::Muon*> vecMuons_JPsi; + std::vector<const xAOD::Muon*> vecMuons_JPsi_Candidates; + + /// JPsi Muon Selection + for(const auto& muon : *Muons) { + xAOD::Muon::MuonType muonType = muon->muonType(); + if (muonType==xAOD::Muon::Combined) { + const xAOD::TrackParticle *cbtp = nullptr; + ElementLink<xAOD::TrackParticleContainer> cbtpLink = muon->combinedTrackParticleLink(); + if (cbtpLink.isValid()) cbtp = *cbtpLink; + + /// Do Combined Muon Plots + if (cbtp) { + float trkiso = muon->isolation(xAOD::Iso::ptcone30)/muon->pt(); + if (muonType==xAOD::Muon::Combined && + cbtp && + muon->pt()>m_JPsiSelection_minPt && + std::abs(muon->eta())<m_JPsiSelection_maxEta && + trkiso<m_JPsiSelection_trkIsolation && + std::abs(cbtp->z0())<m_JPsiSelection_Z0Cut && + std::abs(cbtp->d0())<m_JPsiSelection_D0Cut ) + vecMuons_JPsi_Candidates.push_back(muon); + } + } + } + + /// JPsi related plots + std::map<int, int> mapTagged_JPsi; + for (unsigned int n=0; n<vecMuons_JPsi_Candidates.size(); n++) + mapTagged_JPsi[n]=0; + for (unsigned int n=0; n<vecMuons_JPsi_Candidates.size(); n++) + for (unsigned int m=n+1; m<vecMuons_JPsi_Candidates.size(); m++) { + TLorentzVector tVec1, tVec2; + tVec1.SetPtEtaPhiM(vecMuons_JPsi_Candidates[n]->pt(), vecMuons_JPsi_Candidates[n]->eta(), vecMuons_JPsi_Candidates[n]->phi(), 0.0); + tVec2.SetPtEtaPhiM(vecMuons_JPsi_Candidates[m]->pt(), vecMuons_JPsi_Candidates[m]->eta(), vecMuons_JPsi_Candidates[m]->phi(), 0.0); + if (vecMuons_JPsi_Candidates[n]->charge()==vecMuons_JPsi_Candidates[m]->charge()) continue; + if ((tVec1+tVec2).M()<m_JPsiSelection_minMass) continue; + if ((tVec1+tVec2).M()>m_JPsiSelection_maxMass) continue; + + if (mapTagged_JPsi[n]!=1) vecMuons_JPsi.push_back(vecMuons_JPsi_Candidates[n]); + mapTagged_JPsi[n]=1; + if (mapTagged_JPsi[m]!=1) vecMuons_JPsi.push_back(vecMuons_JPsi_Candidates[m]); + mapTagged_JPsi[m]=1; + + JPsiMass2D = (tVec1+tVec2).M(); + JPsiEta2D = tVec1.Eta(); + fill(tool, JPsiMass2D, JPsiEta2D); + JPsiEta2D = tVec2.Eta(); + fill(tool, JPsiMass2D, JPsiEta2D); + JPsiMass = (tVec1+tVec2).M(); + fill(tool, JPsiMass); + + JPsiMuonLumiBlock = lumiBlockID; + fill(tool, JPsiMuonLumiBlock ); + } + + /// Fill the relevant Muon Information for each JPsi Boson Candidate Muon + ATH_CHECK( FillMuonInformation("JPsi", vecMuons_JPsi) ); + + return StatusCode::SUCCESS; +} + + +//======================================================================================================== +StatusCode MuonTrackMonitorAlgorithm::fillHistograms(const EventContext& ctx) const +{ + using namespace Monitored; + + //Declare the quantities which should be monitored + auto run = Monitored::Scalar<int>("run", 0); + run = GetEventInfo(ctx)->runNumber(); + + const xAOD::EventInfo* eventInfo = nullptr; + ATH_CHECK(evtStore()->retrieve(eventInfo)); + int lumiBlockID = (int)eventInfo->lumiBlock(); + + const xAOD::MuonContainer* Muons = nullptr; + ATH_CHECK(evtStore()->retrieve(Muons, "Muons")); + + ATH_CHECK( analyseLowLevelMuonFeatures(Muons, lumiBlockID) ); + ATH_CHECK( analyseCombinedTracks(Muons, lumiBlockID) ); + ATH_CHECK( analyseZBosonCandidates(Muons, lumiBlockID) ); + ATH_CHECK( analyseJPsiCandidates(Muons, lumiBlockID) ); + + return StatusCode::SUCCESS; +} diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotMuons.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotMuons.cxx deleted file mode 100644 index aac1750363de0876525399c7dab98d58c0a793f4..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotMuons.cxx +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/PlotMuons.h" - -PlotMuons::PlotMuons(PlotBase* pParent, std::string sDir):PlotBase(pParent, sDir), - m_plots_All(this, "/", "Plot Muons"), - m_plots_RecoInfo(this, "/"), - m_plots_MomentumPull(this, "/"), - m_plots_MuonHitSummary(this, "/") -{} - -void PlotMuons::fill(const xAOD::Muon& muon){ - - m_plots_All.fill(muon); - m_plots_RecoInfo.fill(muon); - m_plots_MomentumPull.fill(muon); - m_plots_MuonHitSummary.fill(muon); - -} diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotSegments.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotSegments.cxx deleted file mode 100644 index 94ad68e1c9c0a92218157ccf4a06554c4ca3495e..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotSegments.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/PlotSegments.h" - -PlotSegments::PlotSegments(PlotBase* pParent, std::string sDir):PlotBase(pParent, sDir), - m_plots_Segments(this, "/") -{} - -void PlotSegments::fill(const xAOD::Muon& muon){ - - std::cout << muon.pt() << std::endl; - // segments = get_associated_segments(muon) - // for segment in segments: - // fill_segments(segment) - -} - -void PlotSegments::fill(const xAOD::MuonSegment& segment){ - - std::cout << segment.sector() << std::endl; - // m_plots_Segments.fill(segment); - -} - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotTracks.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotTracks.cxx deleted file mode 100644 index eed9569c759299417938740093b3657c88c37d13..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/PlotTracks.cxx +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/PlotTracks.h" - -PlotTracks::PlotTracks(PlotBase* pParent, std::string sDir):PlotBase(pParent, sDir), - m_plots_Impact(this, "/"), - m_plots_TrkRecoInfo(this, "/"), - m_plots_MSHit(this, "/") -{} - -void PlotTracks::fill(const xAOD::Muon& muon){ - - std::cout << muon.pt() << std::endl; - // tracksID = get_associated_tracks_ID(muon) - // for trackID in tracksID: - // fill(trackID) - // - // tracksMS = get_associated_tracks_MS(muon) - // for trackMS in tracksMS: - // fill(trackMS) - // - // tracksEX = get_associated_tracks_EX(muon) - // for trackEX in tracksEX: - // fill(trackEX) - -} - -void PlotTracks::fill(const xAOD::TrackParticle& track){ - - std::cout << track.pt() << std::endl; - // m_plots_Tracks.fill(track); - -} - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoLumiPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoLumiPlots.cxx deleted file mode 100644 index 1702367aac79fdb70304733a8d19d96b2a17114e..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoLumiPlots.cxx +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/RecoLumiPlots.h" - -RecoLumiPlots::RecoLumiPlots(PlotBase* pParent, std::string sDir, std::string recObj):PlotBase(pParent, sDir), - - m_hNSegment_LB_1D(NULL), - m_hNMuonTrack_LB_1D(NULL), - m_hNMuon_LB_1D(NULL), - m_hNResonance_LB_1D(NULL), - - m_hNSegment_LB(NULL), - m_hNMuonTrack_LB(NULL), - m_hNMuon_LB(NULL), - m_hNResonance_LB(NULL), - - type(recObj), - name("other") -{} - -void RecoLumiPlots::initializePlots() -{ - - //Specify the names for different resonances - std::string Zsig("Z"); - std::string Jsig("Jpsi"); - std::string CBMuons("CBMuons"); - std::string OtherMuons("NonCBMuons"); - - if (!type.compare(Zsig)) {name = "Z"; } - else if (!type.compare(Jsig)) {name = "J/#psi"; } - else if (!type.compare(CBMuons)) {name = "CBMuons"; } - else if (!type.compare(OtherMuons)) {name = "NonCBMuons";} - else {name = "other"; } - - n_lbs = 2500; - - //Make sure the 1D hists has the same dimension as the 2D! - if (name == "other"){ - m_hNSegment_LB = Book2D("nSegment_LB_2D", "Number of Muon Segments Per LumiBlock;LumiBlock;Number of Segments", n_lbs, -0.5, (float)(n_lbs)-0.5, 100, 0.5, 101.5); - m_hNMuonTrack_LB = Book2D("nMuonTrack_LB_2D", "Number of Muon MS Tracks Per LumiBlock;LumiBlock;Number of Tracks", n_lbs, -0.5, (float)(n_lbs)-0.5, 21, 0.5, 21.5); - m_hNSegment_LB_1D = Book1D("nSegment_LB", "Number of Muon Segments Per LumiBlock;LumiBlock;Number of Segments", n_lbs, -0.5, (float)(n_lbs)-0.5); - m_hNMuonTrack_LB_1D = Book1D("nMuonTrack_LB", "Number of Muon MS Tracks Per LumiBlock;LumiBlock;Number of Tracks", n_lbs, -0.5, (float)(n_lbs)-0.5); - } - else if (name == "CBMuons"){ - m_hNMuon_LB = Book2D("nMuon_LB_2D", "Number of Muons Per LumiBlock;LumiBlock;Nmuons", n_lbs, -0.5, (float)(n_lbs)-0.5, 21, 0.5, 21.5); - m_hNMuon_LB_1D = Book1D("nMuon_LB", "Number of Muons Per LumiBlock;LumiBlock;Nmuons", n_lbs, -0.5, (float)(n_lbs)-0.5); - } - else if (name == "NonCBMuons"){ - m_hNMuon_LB = Book2D("nMuon_LB_2D", "Number of non-CB Muons Per LumiBlock;LumiBlock;Nmuons", n_lbs, -0.5, (float)(n_lbs)-0.5, 21, 0.5, 21.5); - m_hNMuon_LB_1D = Book1D("nMuon_LB", "Number of non-CB Muons Per LumiBlock;LumiBlock;Nmuons", n_lbs, -0.5, (float)(n_lbs)-0.5); - } - else if (name == "Z" || name == "J/#psi"){ - m_hNResonance_LB = Book2D("n" + type + "_LB_2D", "Number of " + name + " Per LumiBlock;LumiBlock;Number of " + name, n_lbs, -0.5, (float)(n_lbs)-0.5, 5, 0.5, 5.5); - m_hNResonance_LB_1D = Book1D("n" + type + "_LB", "Number of " + name + " Per LumiBlock;LumiBlock;Number of " + name, n_lbs, -0.5, (float)(n_lbs)-0.5); - } - -} - -//fill Segment related lb plots -void RecoLumiPlots::fill(const xAOD::MuonSegmentContainer* MuonSegments, int current_lb, float inst_lumi_bcid, float inst_lumi_lb) { - - m_hNSegment_LB->Fill(current_lb, MuonSegments->size() + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb); - -} - -//fill Track related plots -void RecoLumiPlots::fill(const xAOD::TrackParticleContainer* MSTracks, int current_lb, float inst_lumi_bcid, float inst_lumi_lb){ - - m_hNMuonTrack_LB->Fill(current_lb, MSTracks->size() + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb); - -} - -//fill CB muon related plots -void RecoLumiPlots::fill_CB(const xAOD::MuonContainer* Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb){ - - int NMuIDco = 0; - - for(const auto mu : *Muons) { - - //do a muon quality cut: 0 tight, 1 medium, 2 loss - if(mu->muonType() == xAOD::Muon::Combined){NMuIDco++;} - - } - - //only do this for combined muons - m_hNMuon_LB->Fill(current_lb, NMuIDco + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb); - -} - -//fill other muon related plots -void RecoLumiPlots::fill_Other(const xAOD::MuonContainer* Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb){ - - int NMuIDco = 0; - - for(const auto mu : *Muons) { - - //do a muon quality cut: 0 tight, 1 medium, 2 loss - if(mu->muonType() != xAOD::Muon::Combined){NMuIDco++;} - - } - - //only do this for combined muons - m_hNMuon_LB->Fill(current_lb, NMuIDco + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb); - -} - -//fill muon related plots -void RecoLumiPlots::fill(std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > resonances, int current_lb, float inst_lumi_bcid, float inst_lumi_lb){ - - int Nresonance = resonances.size(); - - //only do this for combined muons - m_hNResonance_LB->Fill(current_lb, Nresonance + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb);//playing really dumb here - -} - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonIDTrackPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonIDTrackPlots.cxx deleted file mode 100644 index 97b7cfb918920fcc0d6a8c3bc6a05d63bed53ea5..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonIDTrackPlots.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/RecoMuonIDTrackPlots.h" - -RecoMuonIDTrackPlots::RecoMuonIDTrackPlots(PlotBase* pParent, std::string sDir):PlotBase(pParent, sDir), -m_oAllPlots(this, "/", "Reco Muon"), -m_oImpactPlots(this, "/"), -m_oTrkRecoInfoPlots(this, "/"), -m_oIDHitPlots(this,"/"), -m_pt_broad(NULL), -m_eta_phi_broad(NULL) -{} - -void RecoMuonIDTrackPlots::initializePlots(){ - //booking histograms - m_pt_broad = Book1D("_pt_broad", "High p_{T} Distribution", 70, 100, 1500); - m_eta_phi_broad = Book2D("_eta_phi_broad", "High p_{T} Muon #eta #phi Distribution;;#eta;#phi", 52, -2.6, 2.6, 64, -3.2, 3.2); -} - -//when the plot function called with a Muon Container -//loop through each muon, get the corresponding link and fill it - -//when the plot function called with a Muon -//get's the corresponding link and fill it -void RecoMuonIDTrackPlots::fill(const xAOD::Muon& mu, int component){ - if (component == 2 ){ - ElementLink<xAOD::TrackParticleContainer> Mu_idtrack = mu.inDetTrackParticleLink(); - if(Mu_idtrack.isValid()){ - //std::cout<<"Plot base test ID track"<<std::endl; - const xAOD::TrackParticle* trk = *Mu_idtrack; - fill(*trk); - } - } -} - - -void RecoMuonIDTrackPlots::fill(const xAOD::TrackParticle& muTP){ - m_oAllPlots.fill(muTP); - m_oImpactPlots.fill(muTP); - m_oTrkRecoInfoPlots.fill(muTP); - m_oIDHitPlots.fill(muTP); - if (muTP.pt()/1000.0 > 100) {//ony for high pt muons - m_pt_broad->Fill(muTP.pt()/1000.0); - m_eta_phi_broad->Fill(muTP.eta(), muTP.phi()); - } - -} - - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonPlots.cxx deleted file mode 100644 index bc100aadc2e2a50407cb9dee743b3f081b43b2c2..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonPlots.cxx +++ /dev/null @@ -1,218 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/RecoMuonPlots.h" -#include "MuonHistUtils/MuonEnumDefs.h" -typedef ElementLink< xAOD::TrackParticleContainer > TrackLink; -typedef ElementLink< xAOD::MuonContainer > MuonLink; - -RecoMuonPlots::RecoMuonPlots(PlotBase* pParent, std::string sDir, bool detail):PlotBase(pParent, sDir) - -, m_oAllPlots(this, "/", "Reco Muon") -, m_oMuRecoInfoPlots(this, "/") -, m_oImpactPlots(this, "/") -, m_oMomentumPullPlots(this, "/") -//, m_oMSHitPlots(this,"/") -//, m_oMuonHitSummaryPlots(this,"/") -//, m_oMuonIsolationPlots(this,"/") -//, m_oMuonParamPlots(this,"/") -//, m_oAllPlots_tight(this, "/Tight/", "Tight") -//, m_oAllPlots_medium(this, "/Medium/", "Medium") -//, m_oAllPlots_loose(this, "/Loose/", "Loose") -//, m_oAllPlots_veryloose(this, "/Veryloose/", "Veryloose") -, m_origin_eta_phi(NULL) -, m_eff_tight(NULL) -, m_eff_medium(NULL) -, m_tight_eta_phi(NULL) -, m_medium_eta_phi(NULL) -//, m_eff_loose(NULL) -//, m_eff_veryloose(NULL) -, m_pt_broad(NULL) -, m_eta_phi_broad(NULL) -, m_eff_nPrec(NULL) -, m_eff_nPhi(NULL) -, m_eff_nTrigEta(NULL) -, m_eff_ndof(NULL) -, m_eff_chi2(NULL) -, m_ID_eff_ndof(NULL) -, m_ID_eff_chi2(NULL) -, m_MS_eff_ndof(NULL) -, m_MS_eff_chi2(NULL) -{ - Detail = detail; -} - -void RecoMuonPlots::initializePlots(){ - //be very careful here, bin size is the same as the defult value - std::vector<HistData> hists = m_oAllPlots.retrieveBookedHistograms(); // HistData -> std::pair<TH1*, std::string> - int xbins = 52; - int ybins = 64; - float xmin = -2.6; - float xmax = 2.6; - float ymin = -3.2; - float ymax = 3.2; - // for (auto hist: hists) { - // TString sHistName = hist.first->GetName(); - // TString sHistTitle = hist.first->GetTitle(); - // //change the axis get label - // if (sHistName.Contains("_eta_phi")){ - // xmin = hist.first->GetXaxis()->GetXmin(); - // xmax = hist.first->GetXaxis()->GetXmax(); - // ymin = hist.first->GetYaxis()->GetXmin(); - // ymax = hist.first->GetYaxis()->GetXmax(); - // xbins = hist.first->GetXaxis()->GetNbins(); - // ybins = hist.first->GetXaxis()->GetNbins(); - // } - // } - - //now register! - m_origin_eta_phi= Book2D("_Origin_eta_phi", "Original Distribution;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_eff_tight = Book2D("_Tight_eff", "Tight Quality Efficiency;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_eff_medium = Book2D("_Medium_eff", "Medium Quality Efficiency;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_tight_eta_phi = Book2D("_Tight_eta_phi", "Tight Muon #eta #phi Distribution;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_medium_eta_phi = Book2D("_Medium_eta_phi", "Medium Muon #eta #phi Distribution;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - //m_eff_loose = Book2D("_Loose_eff", "Loose Quality Efficiency;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - //m_eff_veryloose = Book2D("_Veryloose_eff", "Very Loose Quality Efficiency;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - if (Detail){ - m_pt_broad = Book1D("_pt_broad", "High p_{T} Distribution;p_{T} [GeV]", 70, 100, 1500); - m_eta_phi_broad = Book2D("_eta_phi_broad", "High p_{T} Muon #eta #phi Distribution;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - - m_eff_nPrec = Book2D("_eff_nPrec", "average number of Precision Layers;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_eff_nPhi = Book2D("_eff_nPhi", "average number of Phi Layers;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_eff_nTrigEta = Book2D("_eff_nTrigEta","average number of Trigger Eta Layers;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_eff_ndof = Book2D("_eff_ndof", "average number of hits;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_eff_chi2 = Book2D("_eff_chi2", "average #chi^{2} per DOF;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_ID_eff_ndof = Book2D("_ID_eff_ndof", "ID track average number of hits;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_ID_eff_chi2 = Book2D("_ID_eff_chi2", "ID track average #chi^{2} per DOF;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_MS_eff_ndof = Book2D("_MS_eff_ndof", "MS track average number of hits;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_MS_eff_chi2 = Book2D("_MS_eff_chi2", "MS track average #chi^{2} per DOF;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - - m_avg_hits_precision_inner = Book2D("_avg_hits_precision_inner", "avg. precision hits, inner;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_precision_middle = Book2D("_avg_hits_precision_middle", "avg. precision hits, middle;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_precision_outer = Book2D("_avg_hits_precision_outer", "avg. precision hits, outer;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_precision_extended = Book2D("_avg_hits_precision_extended", "avg. precision hits, extended;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - - m_avg_hits_trigger_layer1 = Book2D("_avg_hits_trigger_layer1", "avg. trigger hits, layer 1;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_trigger_layer2 = Book2D("_avg_hits_trigger_layer2", "avg. trigger hits, layer 2;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_trigger_layer3 = Book2D("_avg_hits_trigger_layer3", "avg. trigger hits, layer 3;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_trigger_layer4 = Book2D("_avg_hits_trigger_layer4", "avg. trigger hits, layer 4;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - - m_avg_hits_ibl = Book2D("_avg_hits_ibl", "avg. IBL hits;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_pix = Book2D("_avg_hits_pix", "avg. Pix hits;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_sct = Book2D("_avg_hits_sct", "avg. SCT hits;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_hits_trt = Book2D("_avg_hits_trt", "avg. TRT hits;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - - m_avg_ddpt_idme = Book2D("_avg_ddpt_idme", "avg. |pt_{ID} - pt_{ME}| / pt_{CB};#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - m_avg_dptsignif = Book2D("_avg_dptsignif", "avg. momentum diff. signif.;#eta;#phi", xbins, xmin, xmax, ybins, ymin, ymax); - - } -} - -void RecoMuonPlots::fill(const xAOD::Muon& mu){ - //General Plots - m_oAllPlots.fill(mu); - m_oMuRecoInfoPlots.fill(mu); - m_oMomentumPullPlots.fill(mu); - //m_oMuonHitSummaryPlots.fill(mu); - //m_oMuonIsolationPlots.fill(mu); - //m_oMuonParamPlots.fill(mu); - - const xAOD::TrackParticle* primaryTrk = mu.trackParticle(xAOD::Muon::Primary); - // tracking related plots - if (!primaryTrk) return; - m_oImpactPlots.fill(*primaryTrk); - //m_oMSHitPlots.fill(*primaryTrk); - -} - -void RecoMuonPlots::fill(const xAOD::Muon& mu, xAOD::Muon::Quality my_quality){ - - //always fill the origin plot - m_origin_eta_phi->Fill(mu.eta(), mu.phi()); - - //General Plots; inclusive - if (my_quality <= xAOD::Muon::Tight) m_tight_eta_phi->Fill(mu.eta(), mu.phi()); - if (my_quality <= xAOD::Muon::Medium) m_medium_eta_phi->Fill(mu.eta(), mu.phi()); - //if (my_quality <= xAOD::Muon::Loose) m_oAllPlots_loose.fill(mu); - //if (my_quality <= xAOD::Muon::VeryLoose) m_oAllPlots_veryloose.fill(mu); - - if(!Detail) return; - if (mu.pt()/1000.0 > 100) {//ony for high pt muons - m_pt_broad->Fill(mu.pt()/1000.0); - m_eta_phi_broad->Fill(mu.eta(), mu.phi()); - } - const xAOD::TrackParticle* primaryTrk = mu.trackParticle(xAOD::Muon::Primary); - const xAOD::TrackParticle* inDetTrk = mu.trackParticle(xAOD::Muon::InnerDetectorTrackParticle); - int correctEnum = (int) xAOD::Muon::MuonSpectrometerTrackParticle; - if (mu.isAvailable< ElementLink<xAOD::TrackParticleContainer> >("extrapolatedMuonSpectrometerTrackParticleLink") && (mu.auxdata< ElementLink<xAOD::TrackParticleContainer> >("extrapolatedMuonSpectrometerTrackParticleLink")).isValid()) correctEnum+=2; //check correct numbering in Muon.h - const xAOD::TrackParticle* msExtrapTrk = mu.trackParticle((xAOD::Muon::TrackParticleType) correctEnum); - - //fill the ndof and chi2 as eta phi map; to calculate efficiencies in post processing - //if necessary, can use a quality cut here - if (primaryTrk) { - m_eff_ndof->Fill(primaryTrk->eta(), primaryTrk->phi(), primaryTrk->numberDoF()); - m_eff_chi2->Fill(primaryTrk->eta(), primaryTrk->phi(), primaryTrk->chiSquared()/(primaryTrk->numberDoF() * 1.0)); - } - if (inDetTrk) { - m_ID_eff_ndof->Fill(inDetTrk->eta(), inDetTrk->phi(), inDetTrk->numberDoF()); - m_ID_eff_chi2->Fill(inDetTrk->eta(), inDetTrk->phi(), inDetTrk->chiSquared()/(inDetTrk->numberDoF() * 1.0)); - } - if (msExtrapTrk) { - m_MS_eff_ndof->Fill(msExtrapTrk->eta(), msExtrapTrk->phi(), msExtrapTrk->numberDoF()); - m_MS_eff_chi2->Fill(msExtrapTrk->eta(), msExtrapTrk->phi(), msExtrapTrk->chiSquared()/(msExtrapTrk->numberDoF() * 1.0)); - } - - if (!primaryTrk->summaryValue(hitval_numberOfPrecisionLayers, xAOD::numberOfPrecisionLayers)) return; - if (!primaryTrk->summaryValue(hitval_numberOfPhiLayers, xAOD::numberOfPhiLayers)) return; - if (!primaryTrk->summaryValue(hitval_numberOfTriggerEtaLayers, xAOD::numberOfTriggerEtaLayers)) return; - - if (!mu.summaryValue(hitval_innerSmallHits, xAOD::MuonSummaryType::innerSmallHits)) return; - if (!mu.summaryValue(hitval_innerLargeHits, xAOD::MuonSummaryType::innerLargeHits)) return; - if (!mu.summaryValue(hitval_middleSmallHits, xAOD::MuonSummaryType::middleSmallHits)) return; - if (!mu.summaryValue(hitval_middleLargeHits, xAOD::MuonSummaryType::middleLargeHits)) return; - if (!mu.summaryValue(hitval_outerSmallHits, xAOD::MuonSummaryType::outerSmallHits)) return; - if (!mu.summaryValue(hitval_outerLargeHits, xAOD::MuonSummaryType::outerLargeHits)) return; - if (!mu.summaryValue(hitval_extendedSmallHits, xAOD::MuonSummaryType::extendedSmallHits)) return; - if (!mu.summaryValue(hitval_extendedLargeHits, xAOD::MuonSummaryType::extendedLargeHits)) return; - - if (!mu.summaryValue(hitval_etaLayer1Hits, xAOD::MuonSummaryType::etaLayer1Hits)) return; - if (!mu.summaryValue(hitval_etaLayer2Hits, xAOD::MuonSummaryType::etaLayer2Hits)) return; - if (!mu.summaryValue(hitval_etaLayer3Hits, xAOD::MuonSummaryType::etaLayer3Hits)) return; - if (!mu.summaryValue(hitval_etaLayer4Hits, xAOD::MuonSummaryType::etaLayer4Hits)) return; - - if (!mu.summaryValue(hitval_numberOfBLayerHits, xAOD::SummaryType::numberOfInnermostPixelLayerHits)) return; - if (!mu.summaryValue(hitval_numberOfPixelHits, xAOD::SummaryType::numberOfPixelHits)) return; - if (!mu.summaryValue(hitval_numberOfSCTHits, xAOD::SummaryType::numberOfSCTHits)) return; - if (!mu.summaryValue(hitval_numberOfTRTHits, xAOD::SummaryType::numberOfTRTHits)) return; - - m_eff_nPrec -> Fill(mu.eta(), mu.phi(), hitval_numberOfPrecisionLayers); - m_eff_nPhi -> Fill(mu.eta(), mu.phi(), hitval_numberOfPhiLayers); - m_eff_nTrigEta -> Fill(mu.eta(), mu.phi(), hitval_numberOfTriggerEtaLayers); - - m_avg_hits_precision_inner -> Fill(mu.eta(), mu.phi(), hitval_innerSmallHits + hitval_innerLargeHits); - m_avg_hits_precision_middle -> Fill(mu.eta(), mu.phi(), hitval_middleSmallHits + hitval_middleLargeHits); - m_avg_hits_precision_outer -> Fill(mu.eta(), mu.phi(), hitval_outerSmallHits + hitval_outerLargeHits); - m_avg_hits_precision_extended -> Fill(mu.eta(), mu.phi(), hitval_extendedSmallHits + hitval_extendedLargeHits); - - m_avg_hits_trigger_layer1 -> Fill(mu.eta(), mu.phi(), hitval_etaLayer1Hits); - m_avg_hits_trigger_layer2 -> Fill(mu.eta(), mu.phi(), hitval_etaLayer2Hits); - m_avg_hits_trigger_layer3 -> Fill(mu.eta(), mu.phi(), hitval_etaLayer3Hits); - m_avg_hits_trigger_layer4 -> Fill(mu.eta(), mu.phi(), hitval_etaLayer4Hits); - - m_avg_hits_ibl -> Fill(mu.eta(), mu.phi(), hitval_numberOfBLayerHits); - m_avg_hits_pix -> Fill(mu.eta(), mu.phi(), hitval_numberOfPixelHits); - m_avg_hits_sct -> Fill(mu.eta(), mu.phi(), hitval_numberOfSCTHits); - m_avg_hits_trt -> Fill(mu.eta(), mu.phi(), hitval_numberOfTRTHits); - - if (primaryTrk && inDetTrk && msExtrapTrk) { - qoverp_diff = fabs(inDetTrk->qOverP() - msExtrapTrk->qOverP()); - qoverp_sigma = sqrt(inDetTrk->definingParametersCovMatrix()(4,4) + msExtrapTrk->definingParametersCovMatrix()(4,4)); - qoverp_signif = (qoverp_sigma > 0) ? (qoverp_diff / qoverp_sigma) : -999; - ddpt_idme = (primaryTrk->pt() > 0) ? fabs(inDetTrk->pt() - msExtrapTrk->pt()) / primaryTrk->pt() : -999; - - m_avg_ddpt_idme -> Fill(mu.eta(), mu.phi(), ddpt_idme); - m_avg_dptsignif -> Fill(mu.eta(), mu.phi(), qoverp_signif); - } - -} diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonSegmentPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonSegmentPlots.cxx deleted file mode 100644 index 61a837b7ffcbf99f6dd68c38cc5acf3a6b466325..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonSegmentPlots.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/RecoMuonSegmentPlots.h" - -RecoMuonSegmentPlots::RecoMuonSegmentPlots(PlotBase* pParent, std::string sDir, bool detail):PlotBase(pParent, sDir) - , m_oMuonSegmentPlots(NULL) - , m_oMuonSegmentSlimPlots(NULL) - //declare the histograms -{ - Detail = detail; - if(Detail) m_oMuonSegmentPlots = new Muon::MuonSegmentPlots(this,"/"); - else m_oMuonSegmentSlimPlots = new Muon::MuonSegmentSlimPlots(this,"/"); -} - -//when the plot function called with a Muon Container -//loop through each muon, get the corresponding link and fill it -void RecoMuonSegmentPlots::fill(const xAOD::MuonContainer& muContainer){ - for (const auto mu : muContainer) { - fill(*mu); - } -} - -//when the plot function called with a Muon -//get's the corresponding link and fill it -//Tony 2015.9.21: fix to go around the segment link problem for now -void RecoMuonSegmentPlots::fill(const xAOD::Muon& mu){ - const std::vector<ElementLink<DataVector<xAOD::MuonSegment_v1>>> Mu_Segments = mu.muonSegmentLinks(); - fill(Mu_Segments); -} - -//use the link to fill -void RecoMuonSegmentPlots::fill(const std::vector<ElementLink<DataVector<xAOD::MuonSegment_v1>>> Mu_Segments){ - - for(const auto Mu_Segment : Mu_Segments){ - const ElementLink<DataVector<xAOD::MuonSegment_v1>> Mu_seg = Mu_Segment; - if(Mu_seg.isValid()){ - const xAOD::MuonSegment* seg = *Mu_seg; - fill(*seg); - } - } -} - - -void RecoMuonSegmentPlots::fill(const xAOD::MuonSegment& muonSeg) { - //General Plots - if (Detail) m_oMuonSegmentPlots->fill(muonSeg); - else m_oMuonSegmentSlimPlots->fill(muonSeg); -} - -void RecoMuonSegmentPlots::initializePlots() -{ - //initialize temp plots -} - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonTrackPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonTrackPlots.cxx deleted file mode 100644 index eff83b9efd7771aee0babdfefae9cf27fb418c97..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonTrackPlots.cxx +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/RecoMuonTrackPlots.h" - -RecoMuonTrackPlots::RecoMuonTrackPlots(PlotBase* pParent, std::string sDir):PlotBase(pParent, sDir), -m_oAllPlots(this, "/", "Reco Muon"), -m_oImpactPlots(this, "/"), -m_oTrkRecoInfoPlots(this, "/"), -m_pt_broad(NULL), -m_eta_phi_broad(NULL) -{} - -void RecoMuonTrackPlots::initializePlots(){ - //booking histograms - m_pt_broad = Book1D("_pt_broad", "High p_{T} Distribution", 70, 100, 1500); - m_eta_phi_broad = Book2D("_eta_phi_broad", "High p_{T} Muon #eta #phi Distribution;#eta;#phi", 52, -2.6, 2.6, 64, -3.2, 3.2); -} - -//when the plot function called with a Muon Container -//loop through each muon, get the corresponding link and fill it - -//when the plot function called with a Muon -//get's the corresponding link and fill it -void RecoMuonTrackPlots::fill(const xAOD::Muon& mu, int component){ - - if (component == 0 ) { - ElementLink<xAOD::TrackParticleContainer> Mu_MStrack = mu.muonSpectrometerTrackParticleLink(); - if(Mu_MStrack.isValid()){ - const xAOD::TrackParticle* trk = *Mu_MStrack; - fill(*trk); - } - } - - if (component == 1 ){ - - ElementLink<xAOD::TrackParticleContainer> Mu_metrack = mu.trackParticleLink(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle); - if(Mu_metrack.isValid()){ - const xAOD::TrackParticle* trk = *Mu_metrack; - fill(*trk); - } - } -} - - -void RecoMuonTrackPlots::fill(const xAOD::TrackParticle& muTP){ - m_oAllPlots.fill(muTP); - m_oImpactPlots.fill(muTP); - m_oTrkRecoInfoPlots.fill(muTP); - - if (muTP.pt()/1000.0 > 100) {//ony for high pt muons - m_pt_broad->Fill(muTP.pt()/1000.0); - m_eta_phi_broad->Fill(muTP.eta(), muTP.phi()); - } - -} - - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoPhysPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoPhysPlots.cxx deleted file mode 100644 index 66871a698b2de3468180119ff558ecd69569c99d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoPhysPlots.cxx +++ /dev/null @@ -1,290 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/RecoPhysPlots.h" - - -RecoPhysPlots::RecoPhysPlots(PlotBase *pParent, std::string sDir, std::string recObj):PlotBase(pParent, sDir), - m_Mass(0), - m_occupancy(0), - m_2occupancy(0), - // m_Efficiency(0), - // m_EffNumerator(0), - // m_EffDenominator(0), - // m_Efficiency_eta(0), - // m_EffNumerator_eta(0), - // m_EffDenominator_eta(0), - m_M_Mean(0), - m_M_Sigma(0), - m_M_EA_EA(0), - m_M_EA_BA(0), - m_M_EA_BC(0), - m_M_EA_EC(0), - m_M_BA_EA(0), - m_M_BA_BA(0), - m_M_BA_BC(0), - m_M_BA_EC(0), - m_M_BC_EA(0), - m_M_BC_BA(0), - m_M_BC_BC(0), - m_M_BC_EC(0), - m_M_EC_EA(0), - m_M_EC_BA(0), - m_M_EC_BC(0), - m_M_EC_EC(0), - type(recObj) -{} - -void RecoPhysPlots::initializePlots(){ - - std::string Zsig("Z"); - std::string Jsig("Jpsi"); - std::string name; - bool doZ = false; bool doJ = false; - - if (!type.compare(Zsig)) { name="Z"; doZ = true; } - else if (!type.compare(Jsig)) { name="J/#psi"; doJ = true; } - else { name="other"; } - - int nBins = 100; - double minBin = 0.0; - double maxBin = 1000.0; - - /// Error check for doZ and doJ both true here; - - if (doZ) { - nBins = 100; - minBin = 60.0; - maxBin = 120.0; - } - else if (doJ) { - nBins = 30; - minBin = 2.5; - maxBin = 3.5; - } - //resonance mass distributuioin - m_Mass = Book1D("m_"+type+"_Mass", "m_Mass: M_{"+name+"} Mass;Mass [GeV];", nBins, minBin, maxBin); - //resonance two muon distribution - m_occupancy = Book1D("m_"+type+"_occupancy", "m_occupancy: M_{"+name+"} Track Occupancy;;N_{#mu}", 8, 0.0, 8.0); - m_2occupancy = Book1D("m_"+type+"_2occupancy", "m_2occupancy: M_{"+name+"} Two Track Occupancy;;N_{#mu}", 16, 0.5, 16.5); - // //for resonance efficiency calculations - // m_Efficiency = Book2D("m_"+type+"_Efficiency", "m_Efficiency: M_{"+name+"} Efficiency", 8, 0.0, 8.0, 16, 1.0, 17.0); - // m_EffNumerator = Book2D("m_"+type+"_EffNumerator", "m_EffNumerator: M_Efficiency Numerator", 8, 0.0, 8.0, 16, 1.0, 17.0); - // m_EffDenominator = Book2D("m_"+type+"_EffDenominator", "m_EffDenominator: M_Efficiency Denominator", 8, 0.0, 8.0, 16, 1.0, 17.0); - // //for resonance efficiency calculations in eta bins, 1D plots - // m_Efficiency_eta = Book1D("m_"+type+"_Efficiency_eta", "m_Efficiency_eta: M_{"+name+"} Efficiency;#eta", 20, -2.5, 2.5); - // m_EffNumerator_eta = Book1D("m_"+type+"_EffNumerator_eta", "m_EffNumerator_eta: M_Efficiency Numerator;#eta", 20, -2.5, 2.5); - // m_EffDenominator_eta = Book1D("m_"+type+"_EffDenominator_eta", "m_EffDenominator_eta: M_Efficiency Denominator;#eta", 20, -2.5, 2.5); - //resonance mass distribution in each mass range - m_M_EA_EA = Book1D("m_"+type+"_M_EA_EA", "m_M_EA_EAM_{"+name+"} EA_{+} - EA_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_EA_BA = Book1D("m_"+type+"_M_EA_BA", "m_M_EA_BAM_{"+name+"} EA_{+} - BA_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_EA_BC = Book1D("m_"+type+"_M_EA_BC", "m_M_EA_BCM_{"+name+"} EA_{+} - BC_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_EA_EC = Book1D("m_"+type+"_M_EA_EC", "m_M_EA_ECM_{"+name+"} EA_{+} - EC_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_BA_EA = Book1D("m_"+type+"_M_BA_EA", "m_M_BA_EAM_{"+name+"} BA_{+} - EA_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_BA_BA = Book1D("m_"+type+"_M_BA_BA", "m_M_BA_BAM_{"+name+"} BA_{+} - BA_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_BA_BC = Book1D("m_"+type+"_M_BA_BC", "m_M_BA_BCM_{"+name+"} BA_{+} - BC_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_BA_EC = Book1D("m_"+type+"_M_BA_EC", "m_M_BA_ECM_{"+name+"} BA_{+} - EC_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_BC_EA = Book1D("m_"+type+"_M_BC_EA", "m_M_BC_EAM_{"+name+"} BC_{+} - EA_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_BC_BA = Book1D("m_"+type+"_M_BC_BA", "m_M_BC_BAM_{"+name+"} BC_{+} - BA_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_BC_BC = Book1D("m_"+type+"_M_BC_BC", "m_M_BC_BCM_{"+name+"} BC_{+} - BC_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_BC_EC = Book1D("m_"+type+"_M_BC_EC", "m_M_BC_ECM_{"+name+"} BC_{+} - EC_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_EC_EA = Book1D("m_"+type+"_M_EC_EA", "m_M_EC_EAM_{"+name+"} EC_{+} - EA_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_EC_BA = Book1D("m_"+type+"_M_EC_BA", "m_M_EC_BAM_{"+name+"} EC_{+} - BA_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_EC_BC = Book1D("m_"+type+"_M_EC_BC", "m_M_EC_BCM_{"+name+"} EC_{+} - BC_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - m_M_EC_EC = Book1D("m_"+type+"_M_EC_EC", "m_M_EC_ECM_{"+name+"} EC_{+} - EC_{-}; M_{"+name+"}[GeV];", nBins, minBin, maxBin); - //for compare mass mean and sigma, done in post processing - m_M_Mean = Book1D("m_"+type+"_M_Mean", "m_M_Mean: M_{"+name+"} Mean;;M_{"+name+"}[GeV]", 16, 1.0, 17.0); - m_M_Sigma = Book1D("m_"+type+"_M_Sigma", "m_M_Sigma: #sigma(M_{"+name+"});;#sigma(M_{"+name+"})[GeV]", 16, 1.0, 17.0); - - //label the plots - LabelCombinedEtaRegions(m_M_Mean->GetXaxis()); - LabelCombinedEtaRegions(m_M_Sigma->GetXaxis()); - LabelCombinedEtaRegions(m_2occupancy->GetXaxis()); - LabelLargeEtaRegions(m_occupancy->GetXaxis()); - - // LabelLargeEtaRegions(m_EffNumerator->GetXaxis()); - // LabelSectorAxis(m_EffDenominator->GetYaxis()); - // LabelLargeEtaRegions(m_EffNumerator->GetXaxis()); - // LabelSectorAxis(m_EffDenominator->GetYaxis()); - // LabelLargeEtaRegions(m_Efficiency->GetXaxis()); - // LabelSectorAxis(m_Efficiency->GetYaxis()); -} - -void RecoPhysPlots::fill(std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > mumucandidates){ - for (auto mumu: mumucandidates){ - const float invariant_mass = (mumu.first->p4() + mumu.second->p4()).M(); - fill(mumu.first->eta(), mumu.second->eta(), invariant_mass); - } -} - -void RecoPhysPlots::fill(const float eta_mu_plus, const float eta_mu_minus, const float invariant_mass){ - - float etaRegionCoarsePlus = EtaRegionCoarse(eta_mu_plus); - float etaRegionCoarseMinus = EtaRegionCoarse(eta_mu_minus); - float etaRegionFinePlus = EtaRegionFine(eta_mu_plus); - float etaRegionFineMinus = EtaRegionFine(eta_mu_minus); - - if((etaRegionCoarsePlus == 3.5 && etaRegionCoarseMinus == 3.5)) {m_M_EA_EA->Fill(invariant_mass/1000.0); m_2occupancy->Fill(16);} - if((etaRegionCoarsePlus == 3.5 && etaRegionCoarseMinus == 2.5)) {m_M_EA_BA->Fill(invariant_mass/1000.0); m_2occupancy->Fill(15);} - if((etaRegionCoarsePlus == 3.5 && etaRegionCoarseMinus == 1.5)) {m_M_EA_BC->Fill(invariant_mass/1000.0); m_2occupancy->Fill(14);} - if((etaRegionCoarsePlus == 3.5 && etaRegionCoarseMinus == 0.5)) {m_M_EA_EC->Fill(invariant_mass/1000.0); m_2occupancy->Fill(13);} - - if((etaRegionCoarsePlus == 2.5 && etaRegionCoarseMinus == 3.5)) {m_M_BA_EA->Fill(invariant_mass/1000.0); m_2occupancy->Fill(12);} - if((etaRegionCoarsePlus == 2.5 && etaRegionCoarseMinus == 2.5)) {m_M_BA_BA->Fill(invariant_mass/1000.0); m_2occupancy->Fill(11);} - if((etaRegionCoarsePlus == 2.5 && etaRegionCoarseMinus == 1.5)) {m_M_BA_BC->Fill(invariant_mass/1000.0); m_2occupancy->Fill(10);} - if((etaRegionCoarsePlus == 2.5 && etaRegionCoarseMinus == 0.5)) {m_M_BA_EC->Fill(invariant_mass/1000.0); m_2occupancy->Fill(9);} - - if((etaRegionCoarsePlus == 1.5 && etaRegionCoarseMinus == 3.5)) {m_M_BC_EA->Fill(invariant_mass/1000.0); m_2occupancy->Fill(8);} - if((etaRegionCoarsePlus == 1.5 && etaRegionCoarseMinus == 2.5)) {m_M_BC_BA->Fill(invariant_mass/1000.0); m_2occupancy->Fill(7);} - if((etaRegionCoarsePlus == 1.5 && etaRegionCoarseMinus == 1.5)) {m_M_BC_BC->Fill(invariant_mass/1000.0); m_2occupancy->Fill(6);} - if((etaRegionCoarsePlus == 1.5 && etaRegionCoarseMinus == 0.5)) {m_M_BC_EC->Fill(invariant_mass/1000.0); m_2occupancy->Fill(5);} - - if((etaRegionCoarsePlus == 0.5 && etaRegionCoarseMinus == 3.5)) {m_M_EC_EA->Fill(invariant_mass/1000.0); m_2occupancy->Fill(4);} - if((etaRegionCoarsePlus == 0.5 && etaRegionCoarseMinus == 2.5)) {m_M_EC_BA->Fill(invariant_mass/1000.0); m_2occupancy->Fill(3);} - if((etaRegionCoarsePlus == 0.5 && etaRegionCoarseMinus == 1.5)) {m_M_EC_BC->Fill(invariant_mass/1000.0); m_2occupancy->Fill(2);} - if((etaRegionCoarsePlus == 0.5 && etaRegionCoarseMinus == 0.5)) {m_M_EC_EC->Fill(invariant_mass/1000.0); m_2occupancy->Fill(1);} - - m_Mass->Fill(invariant_mass/1000.0); - m_occupancy->Fill(etaRegionFinePlus); - m_occupancy->Fill(etaRegionFineMinus); - -} - -void RecoPhysPlots::finalizeRecoPlots(){ - - // for(int bin = 1; bin < m_Efficiency->GetXaxis()->GetNbins(); bin++){ - // if(m_EffDenominator->GetBinContent(bin) > 0){ - // m_Efficiency->SetBinContent(bin, (m_EffNumerator->GetBinContent(bin)) / (m_EffDenominator->GetBinContent(bin))); - // } - // } - - // for(int bin = 1; bin < m_Efficiency_eta->GetXaxis()->GetNbins(); bin++){ - // if(m_EffDenominator_eta->GetBinContent(bin) > 0){ - // m_Efficiency_eta->SetBinContent(bin, (m_EffNumerator_eta->GetBinContent(bin)) / (m_EffDenominator_eta->GetBinContent(bin))); - // } - // } - - SetResultsBin( 1, m_M_EC_EC); - SetResultsBin( 2, m_M_EC_BC); - SetResultsBin( 3, m_M_EC_BA); - SetResultsBin( 4, m_M_EC_EA); - SetResultsBin( 5, m_M_BC_EC); - SetResultsBin( 6, m_M_BC_BC); - SetResultsBin( 7, m_M_BC_BA); - SetResultsBin( 8, m_M_BC_EA); - SetResultsBin( 9, m_M_BA_EC); - SetResultsBin(10, m_M_BA_BC); - SetResultsBin(11, m_M_BA_BA); - SetResultsBin(12, m_M_BA_EA); - SetResultsBin(13, m_M_EA_EC); - SetResultsBin(14, m_M_EA_BC); - SetResultsBin(15, m_M_EA_BA); - SetResultsBin(16, m_M_EA_EA); -} - -float RecoPhysPlots::EtaRegionFine(double eta) -{ - if (eta < -2.50) {return -1.;} // underflow - if (eta < -2.00) {return 0.5;} // CSC C - if (eta < -1.70) {return 1.5;} // ENDCAP C - if (eta < -1.05) {return 2.5;} // Trans C - if (eta < 0.00) {return 3.5;} // Barrel C - if (eta > 2.50) {return 8.5;} // OverFlow - if (eta > 2.00) {return 7.5;} // CSC A - if (eta > 1.70) {return 6.5;} // ENDCAP A - if (eta > 1.05) {return 5.5;} // Trans A - if (eta > 0.00) {return 4.5;} // Barrel A - return -1.; -} - -float RecoPhysPlots::EtaRegionCoarse(double eta) -{ - - if(eta < -2.50) {return -1.;} // underflow - if(eta < -1.05) {return 0.5;} // EC - if(eta < 0.00) {return 1.5;} // BC - if(eta < 1.05) {return 2.5;} // BA - if(eta < 2.50) {return 3.5;} // BC - return 4.5; // Overflow - -} -bool RecoPhysPlots::LabelLargeEtaRegions(TAxis * axis) -{ - axis->SetBinLabel(1, "CSC C"); - axis->SetBinLabel(2, "EC C"); - axis->SetBinLabel(3, "TRANS C"); - axis->SetBinLabel(4, "BARR C"); - axis->SetBinLabel(5, "BARR A"); - axis->SetBinLabel(6, "TRANS A"); - axis->SetBinLabel(7, "EC A"); - axis->SetBinLabel(8," CSC A"); - axis->SetTitle("Detector #eta Regions"); - - return true; -} - -bool RecoPhysPlots::LabelCombinedEtaRegions(TAxis * axis) -{ - axis->SetBinLabel( 1, "EC-EC"); - axis->SetBinLabel( 2, "EC-BC"); - axis->SetBinLabel( 3, "EC-BA"); - axis->SetBinLabel( 4, "EC-EA"); - axis->SetBinLabel( 5, "BC-EC"); - axis->SetBinLabel( 6, "BC-BC"); - axis->SetBinLabel( 7, "BC-BA"); - axis->SetBinLabel( 8, "BC-EA"); - axis->SetBinLabel( 9, "BA-EC"); - axis->SetBinLabel(10, "BA-BC"); - axis->SetBinLabel(11, "BA-BA"); - axis->SetBinLabel(12, "BA-EA"); - axis->SetBinLabel(13, "EA-EC"); - axis->SetBinLabel(14, "EA-BC"); - axis->SetBinLabel(15, "EA-BA"); - axis->SetBinLabel(16, "EA-EA"); - - axis->SetTitle("#eta Region Permutations [+#mu, -#mu]"); - - return true; -} - -bool RecoPhysPlots::LabelSectorAxis(TAxis * axis){ - - axis->SetTitle("#phi Sectors 1-16"); - if(axis->GetNbins() == 16) axis->CenterLabels(kTRUE); - - if(axis->GetNbins()%16){ - std::cout << "Sector Axis Label Error, not a multiple of 16 bins!\n"; - return false; - } - - int nSectorDevisions = axis->GetNbins()/16; - int skip_counter = 1; - - axis->SetNdivisions(16,nSectorDevisions,0,kFALSE); - - - for (int i = 1; i <= axis->GetNbins(); i++) { - - if (skip_counter == nSectorDevisions) { - axis->SetBinLabel(i,Form("%d",i/nSectorDevisions)); - skip_counter = 1; - }else { - axis->SetBinLabel(i," "); - skip_counter++; - } - - } - - return true; -} - -void RecoPhysPlots::SetResultsBin(int iBin, TH1* pInputHist){ - - m_M_Mean-> SetBinContent(iBin, pInputHist->GetMean(1)); - m_M_Mean-> SetBinError( iBin, pInputHist->GetMeanError(1)); - m_M_Sigma->SetBinContent(iBin, pInputHist->GetRMS(1)); - -} - - diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoVertexPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoVertexPlots.cxx deleted file mode 100644 index c836af8b7baa26d5b2605443bc1c1a64bb8fe16f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoVertexPlots.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonTrackMonitoring/RecoVertexPlots.h" - - -RecoVertexPlots::RecoVertexPlots(PlotBase *pParent, std::string sDir):PlotBase(pParent, sDir), - m_nMDT(NULL), - m_nRPC(NULL), - m_nTGC(NULL), - m_nTracklets(NULL), - m_VertexEtaPhi(NULL) -{} - -void RecoVertexPlots::initializePlots(){ - - m_nMDT = Book1D("m_MSVx_nMDT", "m MSVx nMDT: M MSVx MDT Hits;;N_{MDT}", 100, 0.0, 3000.); - m_nRPC = Book1D("m_MSVx_nRPC", "m MSVx nRPC: M MSVx RPC Hits;;N_{RPC}", 100, 0.0, 1000.); - m_nTGC = Book1D("m_MSVx_nTGC", "m MSVx nTGC: M MSVx TGC Hits;;N_{TGC}", 100, 0.0, 1000.); - - m_nTracklets = Book1D("m_MSVx_nTracklets", "MSVx nTracklets: M MSVx Number of Tracklets; N_{trackletS}", 20, 0.0, 20.); - m_VertexEtaPhi = Book2D("m_VertexEtaPhi", "Vertex Eta Phi: M MSVx #eta vs. #phi; #eta; #phi", 25, -2.5, 25, 32, -3.2, 3.2); - -} - -void RecoVertexPlots::fill(const xAOD::Vertex& msVx){ - TVector3 tmp_vx; tmp_vx.SetXYZ(msVx.x(),msVx.y(),msVx.z()); - m_nMDT->Fill(msVx.auxdata< int >( "nMDT" )); - m_nRPC->Fill(msVx.auxdata< int >( "nRPC" )); - m_nTGC->Fill(msVx.auxdata< int >( "nTGC" )); - m_nTracklets->Fill(msVx.numberDoF()+1.); - m_VertexEtaPhi->Fill(tmp_vx.Eta(),tmp_vx.Phi()); -} diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/components/MuonTrackMonitoring_entries.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/components/MuonTrackMonitoring_entries.cxx index ed8169f875e7483f9c14d8a1492a967546dfbbb7..725709de61b4f2b7b8ec97689c76b53a7b357e41 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/components/MuonTrackMonitoring_entries.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/components/MuonTrackMonitoring_entries.cxx @@ -1,4 +1,8 @@ -#include "MuonTrackMonitoring/MuonGenericTracksMon.h" - -DECLARE_COMPONENT( MuonGenericTracksMon ) - +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + 2020 Matthias Schott - Uni Mainz +*/ + +#include "MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h" +DECLARE_COMPONENT( MuonTrackMonitorAlgorithm ) + diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/CMakeLists.txt b/MuonSpectrometer/MuonValidation/MuonPRDTest/CMakeLists.txt index 6ce602db7db40d8def8fa38eebc9eb95afcf5980..cba3e58160b7a063ba2431cb0011ca2c8d15d1bf 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/CMakeLists.txt +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/Identifier Event/xAOD/xAODEventInfo Generators/GeneratorObjects + Generators/AtlasHepMC MuonSpectrometer/MuonDetDescr/MuonAGDDDescription MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonDigitContainer @@ -32,15 +33,14 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkExtrapolation/TrkExInterfaces ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( MuonPRDTest src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier xAODEventInfo GeneratorObjects MuonAGDDDescription MuonReadoutGeometry MuonDigitContainer MuonRDO MuonIdHelpersLib MuonPrepRawData MuonRIO_OnTrack MuonRecToolInterfaces MuonSimData MuonSimEvent TrkGeometry TrkSurfaces TrkParameters TrkExInterfaces ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier xAODEventInfo GeneratorObjects MuonAGDDDescription MuonReadoutGeometry MuonDigitContainer MuonRDO MuonIdHelpersLib MuonPrepRawData MuonRIO_OnTrack MuonRecToolInterfaces MuonSimData MuonSimEvent TrkGeometry TrkSurfaces TrkParameters TrkExInterfaces ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx index c85599a77e065323adda48d2f1ed265d2fd0ccc6..4ed6536d860f83af105dfee3955e7c2c59e8afc9 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx @@ -14,7 +14,7 @@ #include "Identifier/Identifier.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrackRecord/TrackRecordCollection.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx index fa3a51980f9f62a00948bec22561e21f878304f6..807ba187e898b378c1dc63c0bbc7d2c79401ced5 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx @@ -9,7 +9,7 @@ #include "MuonSimEvent/MdtHitIdHelper.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TTree.h" diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx index 34273f34ff51f529b7ba4d504b6033357ecf7f1c..8c809ca0a19fa1f54a47e84a900ae124ed6935bb 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx @@ -119,13 +119,13 @@ StatusCode MMDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu //retrieve the detailed identifier for the strip form the chip response Identifier cr_id = m_MmIdHelper->channelID(stationName, stationEta, stationPhi, multiplet, gas_gap, cr_strip, true, &isValid); if (!isValid) { - ATH_MSG_WARNING("MicroMegas digitization: failed to create a valid ID for (chip response) strip n. " << cr_strip + ATH_MSG_WARNING("MMDigitVariables: failed to create a valid ID for (chip response) strip n. " << cr_strip << "; associated positions will be set to 0.0."); } else { // asking the detector element to get local position of strip Amg::Vector2D cr_strip_pos(0., 0.); if ( !rdoEl->stripPosition(cr_id,cr_strip_pos) ) { - ATH_MSG_WARNING("MicroMegas digitization: failed to associate a valid local position for (chip response) strip n. " << cr_strip + ATH_MSG_WARNING("MMDigitVariables: failed to associate a valid local position for (chip response) strip n. " << cr_strip << "; associated positions will be set to 0.0."); } else { localPosX.at(i) = cr_strip_pos.x(); @@ -168,13 +168,13 @@ StatusCode MMDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu //retrieve the detailed identifier for the strip form the strip response Identifier sr_id = m_MmIdHelper->channelID(stationName, stationEta, stationPhi, multiplet, gas_gap, sr_strip, true, &isValid); if (!isValid) { - ATH_MSG_WARNING("MicroMegas digitization: failed to create a valid ID for (chip response) strip n. " << sr_strip + ATH_MSG_WARNING("MMDigitVariables: failed to create a valid ID for (chip response) strip n. " << sr_strip << "; associated positions will be set to 0.0."); } else { // asking the detector element to transform this local to the global position Amg::Vector2D sr_strip_pos(0., 0.); if ( !rdoEl->stripPosition(sr_id,sr_strip_pos) ) { - ATH_MSG_WARNING("MicroMegas digitization: failed to associate a valid local position for (chip response) strip n. " << sr_strip + ATH_MSG_WARNING("MMDigitVariables: failed to associate a valid local position for (chip response) strip n. " << sr_strip << "; associated positions will be set to 0.0."); } else { sr_localPosX.at(i) = sr_strip_pos.x(); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx index 654aaec604f576e0a1f769a1506796a7aa348a81..cf8281f6f697b0ca25b660acb681c752000fc34c 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx @@ -9,7 +9,7 @@ #include "MuonSimEvent/RpcHitIdHelper.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TTree.h" diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.cxx index 40ea1897af07ad075c274835200152c0d7037310..c93e1db106c6ab294d3874245304c83da80bee8e 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.cxx @@ -6,8 +6,8 @@ #include "AthenaKernel/errorcheck.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" #include "TTree.h" diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/CMakeLists.txt b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/CMakeLists.txt index c85ca77e66ca54d69d50ae46537d45f947306453..cd344f53d157590d7c12d3684ba3a4db861ce9a1 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/CMakeLists.txt +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/CMakeLists.txt @@ -43,15 +43,14 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkExtrapolation/TrkExInterfaces ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( MuonTrackPerformance src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps xAODEventInfo GaudiKernel MuonIdHelpersLib MuonStationIndexLib MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces TrkParameters TrkTrack TrkTrackSummary TrkTruthData TrkToolInterfaces StoreGateLib SGtests Identifier EventPrimitives xAODMuon xAODTracking xAODTruth MuonReadoutGeometry MuonClusterizationLib MuonCompetingRIOsOnTrack MuonLayerEvent MuonPrepRawData MuonRIO_OnTrack MuonLayerHough MuonRecValidationNtuples MuonCombinedEvent TrkMeasurementBase TrkPrepRawData TrkExInterfaces ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps xAODEventInfo GaudiKernel MuonIdHelpersLib MuonStationIndexLib MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces TrkParameters TrkTrack TrkTrackSummary TrkTruthData TrkToolInterfaces StoreGateLib SGtests Identifier EventPrimitives xAODMuon xAODTracking xAODTruth MuonReadoutGeometry MuonClusterizationLib MuonCompetingRIOsOnTrack MuonLayerEvent MuonPrepRawData MuonRIO_OnTrack MuonLayerHough MuonRecValidationNtuples MuonCombinedEvent TrkMeasurementBase TrkPrepRawData TrkExInterfaces ) # Install files from the package: atlas_install_headers( MuonTrackPerformance ) diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h index 51f23844aa43b4181bd6e1bd2e6881aacdc01b4d..29f9ff37fd9ce1d5f6614ad5ec20b36feb987436 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h @@ -39,9 +39,7 @@ class TFile; class TruthTrajectory; -namespace HepMC{ - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { class Track; diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx index 3cc23625cd9f15479bbec988051b3623e4006253..a6073b0869c7339cc4ba075213a1eaa4f586c2c4 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx @@ -6,8 +6,8 @@ #include "MuonSegment/MuonSegmentCombination.h" #include "MuonSegment/MuonSegment.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include <iostream> #include <fstream> diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx index 3f9ab492c04f643a40adbd8d96292564d7a49450..d924661a7d0ebae6424408b59a315af574bb692c 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx @@ -11,7 +11,7 @@ #include "MuonTrackPerformance/MuonTrackStatisticsTool.h" #include "TString.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkTrackSummary/TrackSummary.h" #include "TrkTrackSummary/MuonTrackSummary.h" diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..4a4318995cb2168c360ec4e132266ac6f86326d3 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithmsDict.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_ANALYSIS_ALGORITHMS_DICT_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_ANALYSIS_ALGORITHMS_DICT_H + +#include <AsgAnalysisAlgorithms/AsgFlagSelectionTool.h> +#include <AsgAnalysisAlgorithms/AsgPtEtaSelectionTool.h> +#include <AsgAnalysisAlgorithms/AsgCutBookkeeperAlg.h> +#include <AsgAnalysisAlgorithms/AsgEventScaleFactorAlg.h> +#include <AsgAnalysisAlgorithms/AsgLeptonTrackSelectionAlg.h> +#include <AsgAnalysisAlgorithms/AsgOriginalObjectLinkAlg.h> +#include <AsgAnalysisAlgorithms/AsgSelectionAlg.h> +#include <AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h> +#include <AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h> +#include <AsgAnalysisAlgorithms/EventFlagSelectionAlg.h> +#include <AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h> +#include <AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h> +#include <AsgAnalysisAlgorithms/KinematicHistAlg.h> +#include <AsgAnalysisAlgorithms/ObjectCutFlowHistAlg.h> +#include <AsgAnalysisAlgorithms/OverlapRemovalAlg.h> +#include <AsgAnalysisAlgorithms/PileupReweightingAlg.h> +#include <AsgAnalysisAlgorithms/PMGTruthWeightAlg.h> +#include <AsgAnalysisAlgorithms/SysListDumperAlg.h> +#include <AsgAnalysisAlgorithms/SysListLoaderAlg.h> +#include <AsgAnalysisAlgorithms/TreeFillerAlg.h> +#include <AsgAnalysisAlgorithms/TreeMakerAlg.h> + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgCutBookkeeperAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgCutBookkeeperAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..037aa61a2846f7ef7bcdbb03bc4596d3282fa9a4 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgCutBookkeeperAlg.h @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_CUT_BOOKKEEPER_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_CUT_BOOKKEEPER_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <PMGAnalysisInterfaces/IPMGTruthWeightTool.h> + +namespace CP +{ + /// \brief an algorithm for dumping the CutBookkeeper metadata + /// into a histogram + + class AsgCutBookkeeperAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + AsgCutBookkeeperAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + public: + /// \brief initialize + StatusCode initialize () override; + + public: + /// \brief run once on each file + StatusCode fileExecute () override; + + public: + /// \brief finalize + StatusCode finalize () override; + + /// \brief flag to enable systematics + private: + bool m_enableSystematics{false}; + + /// \brief the truth weight tool + private: + ToolHandle<PMGTools::IPMGTruthWeightTool> m_truthWeightTool; + + /// \brief run number we are processing + private: + uint32_t m_runNumber {}; + + /// \brief MC channel number we are processing + private: + uint32_t m_mcChannelNumber {}; + + /// \brief weights helper struct + private: + struct WeightsGroup + { + float nEventsProcessed {}; + float sumOfWeights {}; + float sumOfWeightsSquared {}; + }; + + /// \brief weights map + private: + std::unordered_map<size_t, WeightsGroup> m_weights; + + /// \brief the pattern for histogram names + private: + std::string m_histPattern {"CutBookkeeper_%DSID%_%RUN%_%SYS%"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgEventScaleFactorAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgEventScaleFactorAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..9d856927f482199795c8075226b73ca85a5aebdc --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgEventScaleFactorAlg.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_EVENT_SCALE_FACTOR_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_EVENT_SCALE_FACTOR_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODBase/IParticleContainer.h> +#include <xAODEventInfo/EventInfo.h> + +namespace CP +{ + /// \brief an algorithm for calculating per-event scale factors + + class AsgEventScaleFactorAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + AsgEventScaleFactorAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the event info we run on (empty by default) + private: + SysCopyHandle<xAOD::EventInfo> m_eventInfoHandle { + this, "eventInfo", "EventInfo", "the event info object to run on"}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::IParticleContainer> m_particleHandle { + this, "particles", "", "the particle collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the decoration for reading the scale factor + private: + SysDecorationHandle<float> m_scaleFactorInputDecoration { + this, "scaleFactorInputDecoration", "", "the decoration for the input efficiency scale factor"}; + + /// \brief the decoration for writing the scale factor + private: + SysDecorationHandle<float> m_scaleFactorOutputDecoration { + this, "scaleFactorOutputDecoration", "", "the decoration for the output efficiency scale factor"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgFlagSelectionTool.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgFlagSelectionTool.h new file mode 100644 index 0000000000000000000000000000000000000000..77eb764d24a38526627dc00dd82a5ff8cc050ba6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgFlagSelectionTool.h @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + */ + +/// @author Teng Jian Khoo + + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_FLAG_SELECTION_TOOL_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_FLAG_SELECTION_TOOL_H + +#include <AsgTools/AsgTool.h> +#include <PATCore/IAsgSelectionTool.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <xAODBase/IParticle.h> +#include <memory> +#include <string> +#include <vector> + +namespace CP +{ + /// \brief an \ref IAsgSelectionTool that cuts on char decorations + /// + /// For ROOT I/O reasons, chars are commonly used to store boolean + /// properties, such as flags indicating whether particular criteria + /// have been passed. This tool provides a conversion of a list + /// of such decorations, interpreted as bools, into the SelectionType + /// encoding of TAccept, for use in AnaAlgSequence. + /// + /// A list of flags may be provided to the tool, and the output will + /// simply concatenate them into the TAccept. Each selection criterion + /// must be passed (no OR behaviour), but the flag logic may be + /// inverted, such that flags may be encoded as "passX" or !"failX". + + class AsgFlagSelectionTool final + : public asg::AsgTool, virtual public IAsgSelectionTool + { + // + // public interface + // + + // Create a proper constructor for Athena + ASG_TOOL_CLASS( AsgFlagSelectionTool, IAsgSelectionTool ) + + + /// \brief standard constructor + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory II + public: + AsgFlagSelectionTool (const std::string& name); + + + + + // + // inherited interface + // + + virtual StatusCode initialize () override; + + virtual const Root::TAccept& getTAccept( ) const override; + + virtual const Root::TAccept& accept( const xAOD::IParticle* /*part*/ ) const override; + + + + // + // private interface + // + + /// tool properties + /// \{ + + std::vector<std::string> m_selFlags; + std::vector<bool> m_invertFlags; + std::vector<std::unique_ptr<ISelectionAccessor> > m_acc_selFlags; + + /// \} + + + /// \brief the \ref TAccept we are using + private: + mutable Root::TAccept m_accept; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgLeptonTrackSelectionAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgLeptonTrackSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..db25eee5813c6371294fc41a4518c4ceedc4f22d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgLeptonTrackSelectionAlg.h @@ -0,0 +1,91 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_LEPTON_TRACK_SELECTION_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_LEPTON_TRACK_SELECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <PATCore/IAsgSelectionTool.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for performing track-vertex selection on + /// leptons + /// + /// Originally I meant to implement this as an \ref + /// IAsgSelectionTool, but since this needs other objects besides + /// the lepton itself, I made it into an algorithm. Technically + /// this could also be addressed by retrieving those extra objects + /// in the seleciton tool, but this seemed like potential overkill, + /// given that the selection tools may be called very frequently and + /// are not really doing any form of heavy lifting at all. Still, + /// at some point we may decide to change this into a selection tool + /// instead (06 Aug 18). + + class AsgLeptonTrackSelectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + AsgLeptonTrackSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + /// algorithm properties + /// \{ + + private: + float m_maxD0Significance {0}; + float m_maxDeltaZ0SinTheta {0}; + int m_nMinPixelHits{-1}; + int m_nMaxPixelHits{-1}; + int m_nMinSCTHits{-1}; + int m_nMaxSCTHits{-1}; + std::string m_selectionDecoration {"trackSelection"}; + std::string m_eventInfo {"EventInfo"}; + std::string m_primaryVertices {"PrimaryVertices"}; + + /// \} + + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the particle continer we run on + private: + SysCopyHandle<xAOD::IParticleContainer> m_particlesHandle { + this, "particles", "", "the asg collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the accessor for \ref m_selectionDecoration + private: + std::unique_ptr<ISelectionAccessor> m_selectionAccessor; + + + /// \brief the \ref TAccept we are using + private: + Root::TAccept m_accept; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgOriginalObjectLinkAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgOriginalObjectLinkAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..a69f19ca7f2ac8f91fae573ef566a19fdf8ace69 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgOriginalObjectLinkAlg.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_ORIGINAL_OBJECT_LINK_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_ORIGINAL_OBJECT_LINK_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODBase/IParticleContainer.h> + + +namespace CP +{ + /// \brief an algorithm for relinking a shallow copy with it's base container + /// when this was not done originally + /// + /// In some cases we work with shallow copy containers that originally did + /// not have proper original object linking done when created. + /// Currently the client are b-tagging calibration shallow copies. + + class AsgOriginalObjectLinkAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + AsgOriginalObjectLinkAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + /// \brief base container name + private: + std::string m_baseContainerName {""}; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the particle container we run on + private: + SysCopyHandle<xAOD::IParticleContainer> m_particleHandle { + this, "particles", "", "the particle container to run on"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgPtEtaSelectionTool.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgPtEtaSelectionTool.h new file mode 100644 index 0000000000000000000000000000000000000000..f1cd65e237c9b906dc8dc06e0c3419fb5a926445 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgPtEtaSelectionTool.h @@ -0,0 +1,130 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_PT_ETA_SELECTION_TOOL_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_PT_ETA_SELECTION_TOOL_H + +#include <AsgTools/AsgTool.h> +#include <PATCore/IAsgSelectionTool.h> +#include <atomic> + +namespace CP +{ + /// \brief an \ref IAsgSelectionTool that performs basic pt and eta + /// cut (with an optional eta gap) + /// + /// This is a very basic selection that needs to happen on all + /// object types to some degree. Instead of doing this separately + /// for each type, it is just one basic tool for all \ref IParticle + /// implementations. Also, this is a tool, not an algorithm, + /// because we already have an algorithm wrapping generic selection + /// tools and there is no benefit to making it an algorithm. + /// + /// There may be some overlap with the individual selectors for the + /// given object types, but having a tool for this allows to apply + /// it at any point in the algorithm sequence. + + class AsgPtEtaSelectionTool final + : public asg::AsgTool, virtual public IAsgSelectionTool + { + // + // public interface + // + + // Create a proper constructor for Athena + ASG_TOOL_CLASS( AsgPtEtaSelectionTool, IAsgSelectionTool ) + + + /// \brief standard constructor + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory II + public: + AsgPtEtaSelectionTool (const std::string& name); + + + + + // + // inherited interface + // + + virtual StatusCode initialize () override; + + virtual const Root::TAccept& getTAccept( ) const override; + + virtual const Root::TAccept& accept( const xAOD::IParticle* /*part*/ ) const override; + + + + // + // private interface + // + + /// tool properties + /// \{ + + private: + float m_minPt {0}; + float m_maxPt {0}; + float m_maxEta {0}; + float m_etaGapLow {0}; + float m_etaGapHigh {0}; + bool m_useClusterEta {false}; + bool m_printCastWarning {true}; + bool m_printClusterWarning {true}; + + /// \} + + /// Index for the minimum pT selection + int m_minPtCutIndex{ -1 }; + /// Index for the maximum pT selection + int m_maxPtCutIndex{ -1 }; + /// Index for the maximum eta selection + int m_maxEtaCutIndex{ -1 }; + /// Index for the eta gap selection + int m_etaGapCutIndex{ -1 }; + /// Index for the e/gamma casting + int m_egammaCastCutIndex{ -1 }; + /// Index for the e/gamma calo-cluster + int m_egammaClusterCutIndex{ -1 }; + + /// \brief a version of \ref m_printCastWarning that we modify + /// once we printed the warning + /// + /// I don't like modifying property values in the tool itself, so + /// I copy it over here and then modify once I print out. + /// + /// Technically this tool isn't thread-safe due to the use of + /// TAccept, but once we move to master this will be fixed, so + /// this member is already made thread-safe so that we don't trip + /// up on that later. + private: + mutable std::atomic<bool> m_shouldPrintCastWarning {true}; + + /// \brief a version of \ref m_printClusterWarning that we modify + /// once we printed the warning + /// + /// I don't like modifying property values in the tool itself, so + /// I copy it over here and then modify once I print out. + /// + /// Technically this tool isn't thread-safe due to the use of + /// TAccept, but once we move to master this will be fixed, so + /// this member is already made thread-safe so that we don't trip + /// up on that later. + private: + mutable std::atomic<bool> m_shouldPrintClusterWarning {true}; + + /// \brief the \ref TAccept we are using + private: + mutable Root::TAccept m_accept; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgSelectionAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..5af9efe89ae17fd821b103f74e9357444af8b3b2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgSelectionAlg.h @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_SELECTION_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_SELECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <PATCore/IAsgSelectionTool.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IAsgSelectionTool + /// + /// There are two ways to implement this: The way I chose is to call + /// the IAsgSelectionTool on the members of an IParticleContainer. + /// Among several issues this has some inefficiencies, because it + /// relies on dynamic_cast inside the IAsgSelectionTool. Also, + /// currently \ref CopyHandle only supports specific xAOD types for + /// IParticleContainer (though in practice this only matters if + /// systematics are applied in this algorithm). + /// + /// The alternative would be to implement this as a template, with + /// one template argument for the tool interface type and a second + /// template argument for the container type to run on. Besides + /// improving some of the efficiences, it would also allow using + /// selector tools that don't implement the \ref IAsgSelectionTool + /// interface (though arguably they should support the + /// IAsgSelectionTool interface). The main downside of that + /// approach would be the need to support a templated algorithm, + /// which I'm not even sure we have dual-use support for at the + /// moment (19 Mar 18). + + class AsgSelectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + AsgSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IAsgSelectionTool> m_selectionTool; + + /// \brief the smearing tool cast to an ISystematicsTool + /// + /// Normally selection tools don't have systematics, but I believe + /// I have seen one or two with systematics, so I added that + /// possibility in. + private: + ISystematicsTool *m_systematicsTool {nullptr}; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the particle continer we run on + private: + SysCopyHandle<xAOD::IParticleContainer> m_particlesHandle { + this, "particles", "", "the asg collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the decoration for the asg selection + private: + std::string m_selectionDecoration; + + /// \brief the accessor for \ref m_selectionDecoration + private: + std::unique_ptr<ISelectionAccessor> m_selectionAccessor; + + /// \brief the bits to set for an object failing the preselection + private: + SelectionType m_setOnFail; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..117b6223351c8447381623b87b9e643fd72ebde2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ASG_VIEW_FROM_SELECTION_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__ASG_VIEW_FROM_SELECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <xAODBase/IParticleContainer.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <SystematicsHandles/SysWriteHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <limits> + +namespace CP +{ + /// \brief create a view container based on selection decorations + /// + /// This is a generic algorithm that works for all object types to + /// read our standard selection decorations and create a view + /// container. This avoids the need for the algorithm/tool to read + /// the selection decoration on the input, instead it can just + /// assume that all its input objects are meant to be processed. + + class AsgViewFromSelectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + AsgViewFromSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the input collection we run on + private: + SysReadHandle<xAOD::IParticleContainer> m_inputHandle { + this, "input", "", "the input collection to run on"}; + + /// \brief the output view container we produce + private: + SysWriteHandle<xAOD::IParticleContainer> m_outputHandle { + this, "output", "", "the output view container to produce"}; + + private: + std::vector<std::string> m_selection; + + private: + std::vector<SelectionType> m_ignore; + + /// \brief Sort the output (view) container by pT + private: + bool m_sortPt {false}; + + /// \brief Allow the input container to be missing + private: + bool m_allowMissing {false}; + + /// \brief Perform a deep copy for creating the output container + private: + bool m_deepCopy {false}; + + private: + std::size_t m_sizeLimit {std::numeric_limits<std::size_t>::max()}; + + /// the list of accessors and cut ignore list + private: + std::vector<std::pair<std::unique_ptr<ISelectionAccessor>,SelectionType> > m_accessors; + + /// \brief the templated version of execute for a single systematic + private: + template<typename Type> StatusCode + executeTemplate (const CP::SystematicSet& sys); + + /// \brief the version of execute to find the type + private: + StatusCode executeFindType (const CP::SystematicSet& sys); + + /// \brief The version of execute for missing input containers + private: + StatusCode executeMissing (const CP::SystematicSet& sys); + + private: + StatusCode (AsgViewFromSelectionAlg::* m_function) (const CP::SystematicSet& sys) {&AsgViewFromSelectionAlg::executeFindType}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..50df447893fa03b765a021bac14a4d08ee35fba9 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h @@ -0,0 +1,368 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +// +#ifndef ASGANALYSISALGORITHMS_ASGXAODNTUPLEMAKERALG_H +#define ASGANALYSISALGORITHMS_ASGXAODNTUPLEMAKERALG_H + +// System include(s): +#include <unordered_map> +#include <string> +#include <vector> +#include <memory> +#include <list> + +// Framework include(s): +#include "AsgTools/AsgMessaging.h" +#include "AnaAlgorithm/AnaAlgorithm.h" +#include "SystematicsHandles/SysListHandle.h" + +// EDM include(s): +#include "AthContainersInterfaces/IAuxTypeVector.h" +#include "AthContainers/AuxElement.h" + +// Forward declaration(s): +class TClass; +class TTree; +class TVirtualCollectionProxy; +namespace SG { + class AuxVectorBase; + class IAuxTypeVectorFactory; +} + +namespace CP { + + /// Algorithm that can write a simple ntuple from xAOD objects/variables + /// + /// This is meant as a simple tool for creating small ntuples in analyses, + /// using a simple job configuration. It can create branches from any xAOD + /// variables that are possible to write as an "xAOD variable" to begin with. + /// + /// It is *not* meant as a general purpose DAOD -> NTuple dumper however. + /// It should only be used to create small ntuples, with highly processed + /// variables. + /// + /// It's "main" property ("Branches") can be filled with entries of the form: + /// + /// <code> + /// writer = ...<br/> + /// writer.Branches = [ "<SG key>.<aux variable> -> <branch name>", ... ] + /// </code> + /// + /// , where each entry sets up one branch for the output tree. + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class AsgxAODNTupleMakerAlg : public EL::AnaAlgorithm { + + public: + /// Algorithm constructor + AsgxAODNTupleMakerAlg( const std::string& name, ISvcLocator* svcLoc ); + + /// @name Functions inherited from @c EL::AnaAlgorithm + /// @{ + + /// Function executed as part of the job initialisation + StatusCode initialize() override; + + /// Function executed once per event + StatusCode execute() override; + + /// Function executed as part of the job finalisation + StatusCode finalize() override; + + /// @} + + private: + /// Function setting up the internal data structures on the first event + StatusCode setupTree(); + + /// Function setting up an individual branch on the first event + StatusCode setupBranch( const std::string &branchDecl, + const CP::SystematicSet &sys ); + + /// @name Algorithm properties + /// @{ + + /// The name of the output tree to write + std::string m_treeName; + /// The branches to write into this output tree + std::vector< std::string > m_branches; + + /// @} + + /// Class writing all variables from one standalone object + /// + /// It is designed to work with any type inheriting from + /// @c SG::AuxElement. Like @c xAOD::EventInfo. Which is its main user + /// at the moment... + /// + class ElementProcessor : public asg::AsgMessaging { + + public: + /// Default constructor + /// + /// We have to have a default constructor to initialise the + /// @c asg::AsgMessaging base class correctly. Members of this class + /// would not need an explicit constructor themselves. + /// + ElementProcessor(); + + /// Process the object + /// + /// This function is called during the event processing to extract + /// all configured variables from a standalone xAOD object into the + /// output variables set up using @c ElementProcessor::addBranch. + /// + /// @param element The xAOD (interface) object to process + /// @return The usual @c StatusCode values + /// + StatusCode process( const SG::AuxElement& element ); + + /// Add one branch to the output tree + /// + /// This function is used during the setup of the output tree to create + /// one branch in it, from one specific auxiliary variable. The type of + /// the variable is figured out at runtime using the auxiliary store + /// infrastructure. + /// + /// @param tree The tree to create the branch in + /// @param auxName Name of the auxiliary variable to create the branch + /// from + /// @param branchName The name of the branch to create in the tree + /// @param allowMissing Set to @c true to print an error message in case + /// of a failure + /// @param created Used to store if the branch was actually created + /// @return The usual @c StatusCode values + /// + StatusCode addBranch( TTree& tree, const std::string& auxName, + const std::string& branchName, + bool allowMissing, + bool &created ); + + private: + /// Class writing one variable from an xAOD object into a branch + /// + /// It is used for both setting up the branch in the outut @c TTree + /// during the setup of the tree, and then to fill the "output + /// variable" with the right payload during the event processing. + /// + /// Note that since we may have a *lot* of such objects, I didn't want + /// to make it inherit from @c asg::AsgMessaging. Which means that all + /// of the class's functions need to receive its parent's message + /// stream object to be able to log error messages "nicely". + /// + /// Also note that since this is very much an internal class, all of + /// its members are public. Since the owner of such objects should know + /// perfectly well how they behave. + /// + class BranchProcessor { + + public: + /// Function setting up the object, and the branch + /// + /// This is pretty much the constructor of the class. I just decided + /// to implement it as a regular function and not a "real" + /// constructor, to be able to return a @c StatusCode value from the + /// call. Since the setup of the object may very well fail. + /// + /// @param tree The tree to set up the new branch in + /// @param auxName The name of the auxiliary variable to create + /// a branch from + /// @param branchName Name of the branch to create in the tree + /// @param msg Reference to the parent's @c MsgStream object + /// @return The usual @c StatusCode values + /// + StatusCode setup( TTree& tree, const std::string& auxName, + const std::string& branchName, + MsgStream& msg ); + + /// Function processing the object, filling the variable + /// + /// This function is called by @c ElementProcessor, to extract one + /// variable from the standalone object, and move its payload into + /// the memory address from which the output tree is writing its + /// branch. + /// + /// @param element The standalone object to get the auxiliary + /// variable from + /// @param msg Reference to the parent's @c MsgStream object + /// @return The usual @c StatusCode values + /// + StatusCode process( const SG::AuxElement& element, + MsgStream& msg ); + + /// Name of the branch being written + std::string m_branchName; + /// Object accessing the variable in question + std::unique_ptr< SG::AuxElement::TypelessConstAccessor > m_acc; + /// Pointer to the helper object that handles this variable + const SG::IAuxTypeVectorFactory* m_factory = nullptr; + /// The object managing the memory of the written variable + std::unique_ptr< SG::IAuxTypeVector > m_data; + /// Helper variable, pointing at the object to be written + void* m_dataPtr = nullptr; + + }; // class BranchProcessor + + /// List of branch processors set up for this xAOD object + /// + /// Note that when we set up a branch, we tell @c TTree to remember a + /// physical address in memory. To make sure that the address of the + /// object held by the branch processors are not moved in memory after + /// their construction, we have to use an @c std::list container here. + /// @c std::vector would not work. (As it can relocate objects when + /// increasing the size of the container.) + /// + std::list< BranchProcessor > m_branches; + + }; // class ElementProcessor + + /// Class writing all variables from one @c DataVector container + /// + /// It is designed to work with *any* @c DataVector<SG::AuxElement> type, + /// it doesn't have to be an @c xAOD::IParticleContainer. But of course + /// that is the main use case for it... + /// + /// It expects an @c SG::AuxVectorBase object from the caller, iterates + /// over the elements of that container using the ROOT dictionary of the + /// type, and writes individual variables from the elements of the + /// container using the same machinery that @c ElementProcessor employs. + /// + class ContainerProcessor : public asg::AsgMessaging { + + public: + /// Default constructor + /// + /// We have to have a default constructor to initialise the + /// @c asg::AsgMessaging base class correctly. Members of this class + /// would not need an explicit constructor themselves. + /// + ContainerProcessor(); + + /// Process the container + /// + /// This function is called during the event processing to extract + /// all configured variables from an xAOD container into the + /// output variables set up using @c ContainerProcessor::addBranch. + /// + /// @param container The xAOD (interface) container to process + /// @return The usual @c StatusCode values + /// + StatusCode process( const SG::AuxVectorBase& container ); + + /// Add one branch to the output tree + /// + /// This function is used during the setup of the output tree to create + /// one branch in it, from one specific auxiliary variable. The type of + /// the variable is figured out at runtime using the auxiliary store + /// infrastructure. + /// + /// @param tree The tree to create the branch in + /// @param auxName Name of the auxiliary variable to create the branch + /// from + /// @param branchName The name of the branch to create in the tree + /// @param allowMissing Set to @c true to print an error message in case + /// of a failure + /// @param created Used to store if the branch was actually created + /// @return The usual @c StatusCode values + /// + StatusCode addBranch( TTree& tree, const std::string& auxName, + const std::string& branchName, + bool allowMissing, + bool &created ); + + private: + /// Class writing one variable from an xAOD object into a branch + /// + /// It is used for both setting up the branch in the outut @c TTree + /// during the setup of the tree, and then to fill the "output + /// variable" with the right payload during the event processing. + /// + /// Note that since we may have a *lot* of such objects, I didn't want + /// to make it inherit from @c asg::AsgMessaging. Which means that all + /// of the class's functions need to receive its parent's message + /// stream object to be able to log error messages "nicely". + /// + /// Also note that since this is very much an internal class, all of + /// its members are public. Since the owner of such objects should know + /// perfectly well how they behave. + /// + /// Finally, note that it is more complicated than the + /// @c ElementProcessor::BranchProcessor class. Since in this case we + /// need to explicitly deal with @c std::vector types, which we need to + /// fill explicitly when extracting the variables from the xAOD + /// objects. + /// + class BranchProcessor { + + public: + /// Function setting up the object, and the branch + StatusCode setup( TTree& tree, const std::string& auxName, + const std::string& branchName, + MsgStream& msg ); + /// Function (re)sizing the variable for a new event + StatusCode resize( size_t size, MsgStream& msg ); + /// Function processing the object, filling the variable + StatusCode process( const SG::AuxElement& element, size_t index, + MsgStream& msg ); + + /// Name of the branch being written + std::string m_branchName; + /// Object accessing the variable in question + std::unique_ptr< SG::AuxElement::TypelessConstAccessor > m_acc; + /// Pointer to the helper object that handles this variable + const SG::IAuxTypeVectorFactory* m_factory = nullptr; + /// The object managing the memory of the written variable + std::unique_ptr< SG::IAuxTypeVector > m_data; + /// Helper variable, pointing at the object to be written + void* m_dataPtr = nullptr; + + }; // class BranchProcessor + + /// List of branch processors set up for this xAOD object + /// + /// Note that when we set up a branch, we tell @c TTree to remember a + /// physical address in memory. To make sure that the address of the + /// object held by the branch processors are not moved in memory after + /// their construction, we have to use an @c std::list container here. + /// @c std::vector would not work. (As it can relocate objects when + /// increasing the size of the container.) + /// + std::list< BranchProcessor > m_branches; + /// Collection proxy used for iterating over the container + TVirtualCollectionProxy* m_collProxy = nullptr; + /// Offset of the element type to @c SG::AuxElement + int m_auxElementOffset = -1; + + }; // class ContainerProcessor + + /// @name Variables used for the TTree filling + /// @{ + + /// The tree being written + TTree* m_tree = nullptr; + + /// Objects to write branches from + std::unordered_map< std::string, ElementProcessor > m_elements; + /// Containers to write branches from + std::unordered_map< std::string, ContainerProcessor > m_containers; + + /// Internal status flag, showing whether the algorithm is initialised + /// + /// This is necessary because we can only set up the output @c TTree while + /// processing the first event, we can't do it in + /// @c CP::AsgxAODNTupleMakerAlg::initialize. + /// + bool m_isInitialized = false; + + /// The systematic list to consider during execution + SysListHandle m_systematicsList{ this }; + + /// @} + + }; // class AsgxAODNTupleMakerAlg + +} // namespace CP + +#endif // ASGANALYSISALGORITHMS_ASGXAODNTUPLEMAKERALG_H diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/EventFlagSelectionAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/EventFlagSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..3d75ba62d7c485f872c4a87596283344ef846d80 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/EventFlagSelectionAlg.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + +#ifndef ASG_ANALYSIS_ALGORITHMS__EVENT_FLAG_SELECTION_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__EVENT_FLAG_SELECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AnaAlgorithm/FilterReporterParams.h> +#include <SelectionHelpers/ISelectionAccessor.h> + +namespace CP +{ + /// \brief an algorithm for selecting events by flag + class EventFlagSelectionAlg final : public EL::AnaAlgorithm + { + public: + EventFlagSelectionAlg(const std::string &name, + ISvcLocator *svcLoc = nullptr); + + virtual StatusCode initialize() final; + virtual StatusCode execute() final; + virtual StatusCode finalize() final; + + private: + /// \brief flags that we want to select events with + std::vector<std::string> m_selFlags; + + /// \brief invert flags + std::vector<bool> m_invertFlags; + + /// \brief a vector of accessors to read the flags + std::vector<std::unique_ptr<ISelectionAccessor>> m_accessors; + + /// \brief the filter reporter parameters + EL::FilterReporterParams m_filterParams {this, "event flag selection"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..671020270bc1d123dcb59fd9a3c672ed05b9dc34 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Miha Muskinja + +#ifndef ASG_ANALYSIS_ALGORITHMS__EVENT_SELECTION_BY_OBJECT_FLAG_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__EVENT_SELECTION_BY_OBJECT_FLAG_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysFilterReporterParams.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <xAODBase/IParticleContainer.h> +#include <xAODEventInfo/EventInfo.h> + +namespace CP { +/// \brief an algorithm for selecting events based on object flags +/// (e.g. bad muon veto or b-jet veto) +class EventSelectionByObjectFlagAlg final : public EL::AnaAlgorithm { + public: + EventSelectionByObjectFlagAlg(const std::string &name, + ISvcLocator *svcLoc = nullptr); + + public: + StatusCode initialize() override; + + public: + StatusCode execute() override; + + public: + StatusCode finalize() override; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList{this}; + + /// \brief the filter reporter + private: + SysFilterReporterParams m_filterParams {this, "object flag selection"}; + + /// \brief the particle collection we run on + private: + SysReadHandle<xAOD::IParticleContainer> m_particleHandle{ + this, "particles", "", "the particle collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection{this, "preselection", "", "the preselection to apply"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_veto{this, "veto", "", "selection upon which events are vetoed"}; +}; + +} // namespace CP + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..670aeaa975af9cbbd0959833bfbd816af29bb316 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ASG_ANALYSIS_ALGORITHMS__ISOLATION_CLOSE_BY_CORRECTION_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__ISOLATION_CLOSE_BY_CORRECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <IsolationSelection/IIsolationCloseByCorrectionTool.h> +#include <SelectionHelpers/OutOfValidityEventHelper.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IIsolationCloseByCorrectionTool + + class IsolationCloseByCorrectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + IsolationCloseByCorrectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// The OR toolbox + private: + ToolHandle<IIsolationCloseByCorrectionTool> m_isolationCorrectionTool { + "CP::IsolationCloseByCorrectionTool", this}; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + private: + SysCopyHandle<xAOD::ElectronContainer> m_electronsHandle { + this, "electrons", "", "the electrons container to use"}; + SysCopyHandle<xAOD::MuonContainer> m_muonsHandle { + this, "muons", "", "the muons container to use"}; + SysCopyHandle<xAOD::PhotonContainer> m_photonsHandle { + this, "photons", "", "the photons container to use"}; + + private: + int m_topoEtConeModel {IIsolationCloseByCorrectionTool::TopoConeCorrectionModel::DirectCaloClusters}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityEventHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/KinematicHistAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/KinematicHistAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..c9c1598f7027050c5e0eb67c34f32a1886f61c8a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/KinematicHistAlg.h @@ -0,0 +1,83 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ASG_ANALYSIS_ALGORITHMS__KINEMATIC_HIST_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__KINEMATIC_HIST_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODBase/IParticleContainer.h> + +namespace CP +{ + /// \brief an algorithm for dumping the kinematics of an IParticle + /// container into histograms + /// + /// This is mostly meant as a temporary helper algorithm to debug + /// the common CP algorithms as they get developed. + + class KinematicHistAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + KinematicHistAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysReadHandle<xAOD::IParticleContainer> m_inputHandle { + this, "input", "", "the input collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the pattern for histogram names + private: + std::string m_histPattern {"%VAR%_%SYS%"}; + + + /// \brief the histograms we fill per systematic and object + private: + struct HistSubgroup + { + TH1 *pt = nullptr; + TH1 *eta = nullptr; + TH1 *phi = nullptr; + }; + + + /// \brief the histograms we fill per systematic + private: + struct HistGroup + { + TH1 *multiplicity = nullptr; + std::vector<HistSubgroup> perObject; + }; + + /// \brief the created histograms + private: + std::unordered_map<CP::SystematicSet,HistGroup> m_hist; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/ObjectCutFlowHistAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/ObjectCutFlowHistAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..426f79cd003e470e914e4b647d62359b1a5e7b21 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/ObjectCutFlowHistAlg.h @@ -0,0 +1,85 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ASG_ANALYSIS_ALGORITHMS__OBJECT_CUT_FLOW_HIST_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__OBJECT_CUT_FLOW_HIST_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODBase/IParticleContainer.h> + +namespace CP +{ + /// \brief an algorithm for dumping the kinematics of an IParticle + /// container into histograms + /// + /// This is mostly meant as a temporary helper algorithm to debug + /// the common CP algorithms as they get developed. + + class ObjectCutFlowHistAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + ObjectCutFlowHistAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysReadHandle<xAOD::IParticleContainer> m_inputHandle { + this, "input", "", "the input collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the pattern for histogram names + private: + std::string m_histPattern {"cutflow_%SYS%"}; + + + private: + std::vector<std::string> m_selection; + + private: + std::vector<unsigned> m_selectionNCuts; + + /// the list of accessors and cut ignore list + private: + std::vector<std::pair<std::unique_ptr<ISelectionAccessor>,unsigned> > m_accessors; + + /// \brief the total number of cuts configured (needed to + /// configure histograms) + private: + unsigned m_allCutsNum = 0; + + /// \brief the created histograms + private: + std::unordered_map<CP::SystematicSet,TH1*> m_hist; + + /// \brief histogram bin labels + private: + std::vector<std::string> m_labels; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/OverlapRemovalAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/OverlapRemovalAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..10274653e53253077d4fa66027a33fceaa3c8fd5 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/OverlapRemovalAlg.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ASG_ANALYSIS_ALGORITHMS__OVERLAP_REMOVAL_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__OVERLAP_REMOVAL_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AssociationUtils/ToolBox.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IPileupReweightingTool + + class OverlapRemovalAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + OverlapRemovalAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// The OR toolbox + private: + ToolHandle<ORUtils::IOverlapRemovalTool> m_overlapTool { + "ORUtils::OverlapRemovalTool", this}; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + private: + SysCopyHandle<xAOD::ElectronContainer> m_electronsHandle { + this, "electrons", "", "the electrons container to use"}; + SysCopyHandle<xAOD::MuonContainer> m_muonsHandle { + this, "muons", "", "the muons container to use"}; + SysCopyHandle<xAOD::JetContainer> m_jetsHandle { + this, "jets", "", "the jets container to use"}; + SysCopyHandle<xAOD::TauJetContainer> m_tausHandle { + this, "taus", "", "the taus container to use"}; + SysCopyHandle<xAOD::PhotonContainer> m_photonsHandle { + this, "photons", "", "the photons container to use"}; + SysCopyHandle<xAOD::JetContainer> m_fatJetsHandle { + this, "fatJets", "", "the fat jets container to use"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/PMGTruthWeightAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/PMGTruthWeightAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..d053643e9aca303af920e20f79d12ca759ab08c0 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/PMGTruthWeightAlg.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef ASG_ANALYSIS_ALGORITHMS__PMG_TRUTH_WEIGHT_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__PMG_TRUTH_WEIGHT_ALG_H + +#include <xAODEventInfo/EventInfo.h> +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <PMGAnalysisInterfaces/IPMGTruthWeightTool.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IPMGTruthWeightTool + class PMGTruthWeightAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + PMGTruthWeightAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + /// \brief the tool + private: + ToolHandle<PMGTools::IPMGTruthWeightTool> m_truthWeightTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the event info we decorate + private: + SysCopyHandle<xAOD::EventInfo> m_eventInfoHandle { + this, "eventInfo", "EventInfo", "the event info object to run on"}; + + /// \brief the decoration for the truth weights + private: + SysDecorationHandle<float> m_decoration { + this, "decoration", "", "the decoration for the truth weights"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/PileupReweightingAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/PileupReweightingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..57846bf217a5c4014b044c68c54fa8f0ca911cca --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/PileupReweightingAlg.h @@ -0,0 +1,81 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ASG_ANALYSIS_ALGORITHMS__PILEUP_REWEIGHTING_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__PILEUP_REWEIGHTING_ALG_H + +#include <xAODEventInfo/EventInfo.h> +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgAnalysisInterfaces/IPileupReweightingTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IPileupReweightingTool + + class PileupReweightingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + PileupReweightingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IPileupReweightingTool> m_pileupReweightingTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::EventInfo> m_eventInfoHandle { + this, "eventInfo", "EventInfo", "the event info object to run on"}; + + /// \brief the decoration for the corrected and scaled average interactions per crossing + private: + std::string m_correctedScaledAverageMuDecoration; + + /// \brief the decoration for the corrected actual interactions per crossing + private: + std::string m_correctedActualMuDecoration; + + /// \brief the decoration for the corrected and scaled actual interactions per crossing + private: + std::string m_correctedScaledActualMuDecoration; + + /// \brief the accessor for \ref m_correctedScaledAverageMuDecoration + private: + std::unique_ptr<const SG::AuxElement::Accessor<float> > m_correctedScaledAverageMuAccessor; + + /// \brief the accessor for \ref m_correctedActualMuDecoration + private: + std::unique_ptr<const SG::AuxElement::Accessor<float> > m_correctedActualMuAccessor; + + /// \brief the accessor for \ref m_correctedScaledAverageMuDecoration + private: + std::unique_ptr<const SG::AuxElement::Accessor<float> > m_correctedScaledActualMuAccessor; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListDumperAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListDumperAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..6b0f3d775ac5beda2ddff8213a69963ca549a301 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListDumperAlg.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef ASG_ANALYSIS_ALGORITHMS__SYS_LIST_DUMPER_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__SYS_LIST_DUMPER_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief Dump systematics names into a histogram + + class SysListDumperAlg final : public EL::AnaAlgorithm + { + /// \brief standard constructor + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory II + public: + SysListDumperAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + public: + virtual ::StatusCode initialize () override; + + public: + virtual ::StatusCode execute () override; + + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the name of the histogram to use + private: + std::string m_histogramName {sysListDefaultName()}; + + /// \brief whether the next event will be the first event + private: + bool m_firstEvent = true; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListLoaderAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListLoaderAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..aa6beb74e7dc94eeb4c9180d44704e4b04c446f7 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListLoaderAlg.h @@ -0,0 +1,84 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ASG_ANALYSIS_ALGORITHMS__SYS_LIST_LOADER_ALG_H +#define ASG_ANALYSIS_ALGORITHMS__SYS_LIST_LOADER_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <PATInterfaces/SystematicSet.h> +#include <SystematicsHandles/SysListType.h> + +namespace CP +{ + /// \todo add documentation + + class SysListLoaderAlg final : public EL::AnaAlgorithm + { + // + // public interface + // + + /// \brief standard constructor + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory II + public: + SysListLoaderAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + + // + // inherited interface + // + + public: + virtual ::StatusCode initialize () override; + + public: + virtual ::StatusCode execute () override; + + + + // + // private interface + // + + /// \brief the name under which to store the systematics in the + /// event store + private: + std::string m_systematicsName {sysListDefaultName()}; + + /// \brief the names of the systematics to request + private: + std::vector<std::string> m_systematicsList; + + /// \brief the regular expression for filterinf systematics + private: + std::string m_systematicsRegex {"(.*)"}; + + /// \brief load all recommended systematics at the given number of + /// sigmas + /// + /// The idea here is that this allows to run a simple analysis by + /// itself without having to generate the list of systematics + /// manually. + private: + float m_sigmaRecommended = 0; + + /// \brief the list of actual systematics + private: + std::vector<CP::SystematicSet> m_systematicsVector; + + /// \brief whether the next event will be the first event + private: + bool m_firstEvent = true; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/TreeFillerAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/TreeFillerAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..d845bedb3bf74b782b01b4e77b790ade1ddf70b6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/TreeFillerAlg.h @@ -0,0 +1,84 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +// +#ifndef ASGANALYSISALGORITHMS_TREEFILLERALG_H +#define ASGANALYSISALGORITHMS_TREEFILLERALG_H + +// System include(s): +#include <unordered_map> +#include <string> +#include <vector> +#include <memory> +#include <list> + +// Framework include(s): +#include "AsgTools/AsgMessaging.h" +#include "AnaAlgorithm/AnaAlgorithm.h" +#include "SystematicsHandles/SysListHandle.h" + +// EDM include(s): +#include "AthContainersInterfaces/IAuxTypeVector.h" +#include "AthContainers/AuxElement.h" + +// Forward declaration(s): +class TClass; +class TTree; +class TVirtualCollectionProxy; +namespace SG { + class AuxVectorBase; + class IAuxTypeVectorFactory; +} + +namespace CP { + + /// Algorithm that writes events to a tree filled by preceding + /// algorithms to fill + /// + /// This is meant in conjunction with \ref TreeMakerAlg and one or + /// more of tree-variable filler algorithms in-between. The idea + /// behind this specific design is that it allows multiple + /// implementations of tree-variable filler algorithms to work + /// together in filling different variables in the same tree, as + /// well as making the configuration for each tree-variable filler + /// algorithm simpler. + /// + /// @author Nils Krumnack <Nils.Erik.Krumnack@cern.ch> + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + + class TreeFillerAlg : public EL::AnaAlgorithm { + + public: + /// Algorithm constructor + TreeFillerAlg( const std::string& name, ISvcLocator* svcLoc ); + + /// @name Functions inherited from @c EL::AnaAlgorithm + /// @{ + + /// Function executed once per event + StatusCode execute() override; + + /// @} + + private: + /// @name Algorithm properties + /// @{ + + /// The name of the output tree to write + std::string m_treeName; + + /// @} + + /// @name Variables used for the TTree filling + /// @{ + + /// The tree being written + TTree* m_tree = nullptr; + + /// @} + + }; // class TreeFillerAlg + +} // namespace CP + +#endif // ASGANALYSISALGORITHMS_TREEFILLERALG_H diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/TreeMakerAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/TreeMakerAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..a5b4a671d52e43c7ccf621b135c69a6601f8ecae --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/TreeMakerAlg.h @@ -0,0 +1,68 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +// +#ifndef ASGANALYSISALGORITHMS_TREEMAKERALG_H +#define ASGANALYSISALGORITHMS_TREEMAKERALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> + +class TTree; + +namespace CP { + + /// Algorithm that creates an empty tree for subsequent algorithms + /// to fill + /// + /// This is meant in conjunction with \ref TreeFillerAlg and one or + /// more of tree-variable filler algorithms in-between. The idea + /// behind this specific design is that it allows multiple + /// implementations of tree-variable filler algorithms to work + /// together in filling different variables in the same tree, as + /// well as making the configuration for each tree-variable filler + /// algorithm simpler. + /// + /// @author Nils Krumnack <Nils.Erik.Krumnack@cern.ch> + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class TreeMakerAlg : public EL::AnaAlgorithm { + + public: + /// Algorithm constructor + TreeMakerAlg( const std::string& name, ISvcLocator* svcLoc ); + + /// @name Functions inherited from @c EL::AnaAlgorithm + /// @{ + + /// Function executed once per event + StatusCode execute() override; + + /// @} + + private: + /// Function setting up the internal data structures on the first event + StatusCode setupTree(); + + /// @name Algorithm properties + /// @{ + + /// The name of the output tree to write + std::string m_treeName; + /// Flust setting for the output tree + int m_treeAutoFlush; + + /// @} + + /// @name Helper variables + /// @{ + + /// Configured tree status + bool m_treeConfigured{false}; + + /// @} + + }; // class TreeMakerAlg + +} // namespace CP + +#endif // ASGANALYSISALGORITHMS_TREEMAKERALG_H diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..bd28958853419777730a150fa06ad7a694ca698d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/selection.xml @@ -0,0 +1,26 @@ +<lcgdict> + + <class name="CP::AsgFlagSelectionTool" /> + <class name="CP::AsgPtEtaSelectionTool" /> + + <class name="CP::AsgCutBookkeeperAlg" /> + <class name="CP::AsgEventScaleFactorAlg" /> + <class name="CP::AsgLeptonTrackSelectionAlg" /> + <class name="CP::AsgOriginalObjectLinkAlg" /> + <class name="CP::AsgSelectionAlg" /> + <class name="CP::AsgViewSelectionAlg" /> + <class name="CP::AsgxAODNTupleMakerAlg" /> + <class name="CP::EventFlagSelectionAlg" /> + <class name="CP::EventSelectionByObjectFlagAlg" /> + <class name="CP::IsolationCloseByCorrectionAlg" /> + <class name="CP::KinematicHistAlg" /> + <class name="CP::ObjectCutFlowHistAlg" /> + <class name="CP::OverlapRemovalAlg" /> + <class name="CP::PileupReweightingAlg" /> + <class name="CP::PMGTruthWeightAlg" /> + <class name="CP::SysListDumperAlg" /> + <class name="CP::SysListLoaderAlg" /> + <class name="CP::TreeFillerAlg" /> + <class name="CP::TreeMakerAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a14cc76e80c0a01fc95a4c66032042d4e071b02 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,113 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +atlas_subdir( AsgAnalysisAlgorithms ) + +atlas_depends_on_subdirs( + PUBLIC + Control/AthContainers + Control/AthContainersInterfaces + Control/AthToolSupport/AsgTools + Event/xAOD/xAODBase + Event/xAOD/xAODCutFlow + Event/xAOD/xAODEventInfo + Event/xAOD/xAODMetaData + PhysicsAnalysis/Algorithms/SelectionHelpers + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/AnalysisCommon/PATCore + PhysicsAnalysis/AnalysisCommon/PATInterfaces + PhysicsAnalysis/AnalysisCommon/IsolationSelection + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces + PhysicsAnalysis/Interfaces/PMGAnalysisInterfaces + PRIVATE + Event/xAOD/xAODCore + Event/xAOD/xAODJet + Event/xAOD/xAODMuon + Event/xAOD/xAODTau + Event/xAOD/xAODEgamma + Event/xAOD/xAODTracking + Event/xAOD/xAODTruth + PhysicsAnalysis/D3PDTools/RootCoreUtils ) + +atlas_add_library( AsgAnalysisAlgorithmsLib + AsgAnalysisAlgorithms/*.h AsgAnalysisAlgorithms/*.icc Root/*.cxx + PUBLIC_HEADERS AsgAnalysisAlgorithms + LINK_LIBRARIES AthContainers AthContainersInterfaces AsgTools xAODBase + xAODEventInfo SelectionHelpersLib SystematicsHandlesLib PATCoreLib + PATInterfaces AnaAlgorithmLib AsgAnalysisInterfaces AssociationUtilsLib + IsolationSelectionLib + PRIVATE_LINK_LIBRARIES xAODCore xAODCutFlow xAODMetaData xAODJet xAODMuon xAODTau xAODEgamma xAODTracking xAODTruth + RootCoreUtils ) + +atlas_add_dictionary( AsgAnalysisAlgorithmsDict + AsgAnalysisAlgorithms/AsgAnalysisAlgorithmsDict.h + AsgAnalysisAlgorithms/selection.xml + LINK_LIBRARIES AsgAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( AsgAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel AsgAnalysisAlgorithmsLib ) +endif() + +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*_jobOptions.py ) +atlas_install_scripts( share/*_eljob.py ) + +if( XAOD_STANDALONE ) + atlas_add_test( EventAlgsTestJobData + SCRIPT EventAlgorithmsTest_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( EventAlgsTestJobFullSim + SCRIPT EventAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( EventAlgsTestJobFastSim + SCRIPT EventAlgorithmsTest_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( OverlapRemovalTestJobData + SCRIPT OverlapAlgorithmsTest_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( OverlapRemovalTestJobFullSim + SCRIPT OverlapAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( OverlapRemovalTestJobFastSim + SCRIPT OverlapAlgorithmsTest_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( GeneratorAlgsTestJobFullSim + SCRIPT GeneratorAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) +else() + atlas_add_test( EventAlgsTestJobData + SCRIPT athena.py + AsgAnalysisAlgorithms/EventAlgorithmsTest_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( EventAlgsTestJobFullSim + SCRIPT athena.py + AsgAnalysisAlgorithms/EventAlgorithmsTest_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( EventAlgsTestJobFastSim + SCRIPT athena.py + AsgAnalysisAlgorithms/EventAlgorithmsTest_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) + atlas_add_test( GeneratorAlgsTestJob + SCRIPT athena.py + AsgAnalysisAlgorithms/GeneratorAlgorithmsTest_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + + if( NOT "${CMAKE_PROJECT_NAME}" STREQUAL "AthDerivation" ) + atlas_add_test( OverlapRemovalTestJobData + SCRIPT athena.py + AsgAnalysisAlgorithms/OverlapAlgorithmsTest_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( OverlapRemovalTestJobFullSim + SCRIPT athena.py + AsgAnalysisAlgorithms/OverlapAlgorithmsTest_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( OverlapRemovalTestJobFastSim + SCRIPT athena.py + AsgAnalysisAlgorithms/OverlapAlgorithmsTest_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) + endif() +endif() diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgCutBookkeeperAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgCutBookkeeperAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..129c116eed7e4985ac8cade819cab5f88f427cfd --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgCutBookkeeperAlg.cxx @@ -0,0 +1,218 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + +// +// includes +// + +#include <AsgAnalysisAlgorithms/AsgCutBookkeeperAlg.h> +#include <SystematicsHandles/Helpers.h> + +#include <RootCoreUtils/StringUtil.h> +#include <TH1.h> + +#include <xAODCutFlow/CutBookkeeper.h> +#include <xAODCutFlow/CutBookkeeperContainer.h> +#include <xAODMetaData/FileMetaData.h> +#include <xAODTruth/TruthMetaData.h> +#include <xAODTruth/TruthMetaDataContainer.h> + +#include <regex> + +// +// method implementations +// + +namespace CP +{ + AsgCutBookkeeperAlg :: + AsgCutBookkeeperAlg (const std::string &name, + ISvcLocator *pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_truthWeightTool ("PMGTools::PMGTruthWeightTool", this) + { + declareProperty ("runNumber", m_runNumber, "the run number we are processing"); + declareProperty ("histPattern", m_histPattern, "the pattern for histogram names"); + declareProperty ("truthWeightTool", m_truthWeightTool, "the truth weight tool"); + declareProperty ("enableSystematics", m_enableSystematics, "enable systematics"); + } + + + + StatusCode AsgCutBookkeeperAlg :: + initialize () + { + if (m_runNumber == 0) + { + ANA_MSG_ERROR ("Run number should be set"); + return StatusCode::FAILURE; + } + + ANA_CHECK (requestFileExecute ()); + + // Read the channel number from FileMetaData + const xAOD::FileMetaData *fmd{}; + ANA_CHECK (inputMetaStore()->retrieve(fmd, "FileMetaData")); + + float _flt_channel_number{}; + if (fmd->value(xAOD::FileMetaData::mcProcID, _flt_channel_number)) + { + m_mcChannelNumber = static_cast<uint32_t>(_flt_channel_number); + } + if (m_mcChannelNumber == 0) + { + ANA_MSG_WARNING ("MC channel number could not be read from the FileMetaData."); + + // Try also TruthMetaData + const xAOD::TruthMetaDataContainer *tmd{}; + if (inputMetaStore()->contains<xAOD::TruthMetaDataContainer>("TruthMetaData")) + { + ATH_CHECK (inputMetaStore()->retrieve(tmd, "TruthMetaData")); + ATH_MSG_DEBUG("Loaded xAOD::TruthMetaDataContainer"); + + // If we only have one metadata item take MC channel from there if needed + if (tmd->size() == 1) { + m_mcChannelNumber = tmd->at(0)->mcChannelNumber(); + ATH_MSG_WARNING("... MC channel number taken from the metadata as " << m_mcChannelNumber); + } + } + } + + // Prepare for systematics + ANA_CHECK (m_truthWeightTool.retrieve()); + + return StatusCode::SUCCESS; + } + + + + StatusCode AsgCutBookkeeperAlg :: + fileExecute () + { + ANA_MSG_DEBUG ("Updating CutBookkeeper information"); + + // Update MC channel number if needed + if (m_mcChannelNumber == 0) + { + const xAOD::FileMetaData *fmd{}; + ANA_CHECK (inputMetaStore()->retrieve(fmd, "FileMetaData")); + + float _flt_channel_number{}; + if (fmd->value(xAOD::FileMetaData::mcProcID, _flt_channel_number)) { + m_mcChannelNumber = static_cast<uint32_t>(_flt_channel_number); + } + } + + // Retrieve complete CutBookkeeperContainer + const xAOD::CutBookkeeperContainer *completeCBC{}; + ANA_CHECK (inputMetaStore()->retrieve(completeCBC, "CutBookkeepers")); + + // Find the max cycle + int maxCycle{-1}; + const xAOD::CutBookkeeper *allEvents{}; + for (const xAOD::CutBookkeeper *cbk : *completeCBC) + { + ANA_MSG_DEBUG ("Complete cbk name: " << cbk->name() << " - stream: " << cbk->inputStream()); + + if (cbk->cycle() > maxCycle && cbk->name() == "AllExecutedEvents" && cbk->inputStream() == "StreamAOD") + { + allEvents = cbk; + maxCycle = cbk->cycle(); + } + } + + if (allEvents == nullptr) + { + ANA_MSG_ERROR ("Could not find AllExecutedEvents CutBookkeeper information."); + return StatusCode::FAILURE; + } + + size_t counter{}; + for (const xAOD::CutBookkeeper *cbk : *completeCBC) + { + if (cbk->cycle() == maxCycle && cbk->name().find("AllExecutedEvents") == 0 && cbk->inputStream() == "StreamAOD") + { + static const std::regex re ("AllExecutedEvents.*_([0-9]+)"); + // Get the CBK index + size_t index{0}; + std::smatch match; + if (std::regex_match(cbk->name(), match, re)) + { + index = std::stoi(match[1]); + } + + uint64_t nEventsProcessed = cbk->nAcceptedEvents(); + double sumOfWeights = cbk->sumOfEventWeights(); + double sumOfWeightsSquared = cbk->sumOfEventWeightsSquared(); + + // Write CutBookkeeper information to the info + ANA_MSG_VERBOSE ("CutBookkeeper information from the current file for index " << index << ":"); + ANA_MSG_VERBOSE ("Initial events = " << nEventsProcessed); + ANA_MSG_VERBOSE ("Initial sum of weights = " << sumOfWeights); + ANA_MSG_VERBOSE ("Initial sum of weights squared = " << sumOfWeightsSquared); + + auto it = m_weights.emplace(index, WeightsGroup()).first; + it->second.nEventsProcessed += nEventsProcessed; + it->second.sumOfWeights += sumOfWeights; + it->second.sumOfWeightsSquared += sumOfWeightsSquared; + + counter++; + } + } + + if (counter == 1 && m_enableSystematics) { + ANA_MSG_WARNING ("This sample does not support CutBookkeeper systematics. Disabling..."); + m_enableSystematics = false; + } + + return StatusCode::SUCCESS; + } + + + + StatusCode AsgCutBookkeeperAlg :: + finalize () + { + // Temporarily handle systematics directly here + std::vector<CP::SystematicSet> systematics; + systematics.emplace_back(); + if (m_enableSystematics) + { + for (const CP::SystematicVariation &variation : m_truthWeightTool->affectingSystematics()) + { + systematics.emplace_back(CP::SystematicSet({variation})); + } + } + + for (const CP::SystematicSet &sys : systematics) + { + std::string name = RCU::substitute(m_histPattern, "%DSID%", std::to_string(m_mcChannelNumber)); + name = RCU::substitute(name, "%RUN%", std::to_string(m_runNumber)); + name = makeSystematicsName (name, sys); + + ANA_CHECK (book(TH1F(name.c_str(), "CutBookkeeper Information", 3, 0.5, 3.5))); + TH1 *h = hist(name); + assert(h != nullptr); + + h->GetXaxis()->SetBinLabel (1, "Initial events"); + h->GetXaxis()->SetBinLabel (2, "Initial sum of weights"); + h->GetXaxis()->SetBinLabel (3, "Initial sum of weights squared"); + + ANA_MSG_INFO ("CutBookkeeper information will be stored in " << name); + + ANA_CHECK (m_truthWeightTool->applySystematicVariation (sys)); + + ANA_MSG_VERBOSE ("Running systematics " << sys.name() << " with index " << m_truthWeightTool->getSysWeightIndex()); + + const WeightsGroup &weights = m_weights.at (m_truthWeightTool->getSysWeightIndex()); + h->SetBinContent (1, weights.nEventsProcessed); + h->SetBinContent (2, weights.sumOfWeights); + h->SetBinContent (3, weights.sumOfWeightsSquared); + } + + return StatusCode::SUCCESS; + } +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgEventScaleFactorAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgEventScaleFactorAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..58a9cb24f8d710f83a1d062146f940b6777dd1a8 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgEventScaleFactorAlg.cxx @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/AsgEventScaleFactorAlg.h> + +// #include <SelectionHelpers/SelectionHelpers.h> + +// +// method implementations +// + +namespace CP +{ + AsgEventScaleFactorAlg :: + AsgEventScaleFactorAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + } + + + + StatusCode AsgEventScaleFactorAlg :: + initialize () + { + if (m_scaleFactorInputDecoration.empty() || m_scaleFactorOutputDecoration.empty()) + { + ANA_MSG_ERROR ("no scale factor decoration name set"); + return StatusCode::FAILURE; + } + + m_systematicsList.addHandle (m_particleHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + + return StatusCode::SUCCESS; + } + + + + StatusCode AsgEventScaleFactorAlg :: + execute () + { + ANA_CHECK (m_scaleFactorOutputDecoration.preExecute (m_systematicsList)); + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::EventInfo *eventInfo = nullptr; + ANA_CHECK (m_eventInfoHandle.getCopy (eventInfo, sys)); + + xAOD::IParticleContainer *particles = nullptr; + ANA_CHECK (m_particleHandle.getCopy (particles, sys)); + + float scaleFactor = 1; + for (xAOD::IParticle *particle : *particles) + { + if (m_preselection.getBool (*particle)) + { + scaleFactor *= m_scaleFactorInputDecoration.get (*particle, sys); + } + } + + m_scaleFactorOutputDecoration.set (*eventInfo, scaleFactor, sys); + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgFlagSelectionTool.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgFlagSelectionTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ac9c2aab0f408f2becebc509a276dc2d23ee861a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgFlagSelectionTool.cxx @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + */ + +/// @author Teng Jian Khoo + + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/AsgFlagSelectionTool.h> + +#include <cmath> + +// +// method implementations +// + +namespace CP +{ + AsgFlagSelectionTool :: + AsgFlagSelectionTool (const std::string& name) + : AsgTool (name) + { + declareProperty ("selectionFlags", m_selFlags, "list of flags to use as selection criteria"); + declareProperty ("invertFlags", m_invertFlags, "toggles for inverting the selection (index-parallel to selectionFlags)"); + } + + + + StatusCode AsgFlagSelectionTool :: + initialize () + { + if(m_invertFlags.size()!=m_selFlags.size() && !m_invertFlags.empty()) { + ATH_MSG_ERROR("Property invertFlags has different size to selectionFlags. Please check your configuration"); + return StatusCode::FAILURE; + } + // Could also warn if there are fewer values, but we don't have to force users to set where irrelevant. + // Maybe warn unless the size is 0, in which case assume all default? + + for(size_t index=0; index<m_selFlags.size(); ++index) { + const std::string& thisflag = m_selFlags[index]; + if (thisflag.empty()) { + ATH_MSG_ERROR("Empty string passed as selection flag!"); + return StatusCode::FAILURE; + } else { + // Extend m_invertFlags until the size matches m_selectionFlags + // Only done in the case that m_invert was empty + if(m_invertFlags.size()<index+1) {m_invertFlags.push_back(false);} + std::string doInvertStr = m_invertFlags[index] ? "!" : ""; + m_accept.addCut (doInvertStr + thisflag, doInvertStr + thisflag); + std::unique_ptr<ISelectionAccessor> accessor; + ATH_CHECK (makeSelectionAccessor (thisflag, accessor, true)); + m_acc_selFlags.push_back (std::move (accessor)); + } + } + + return StatusCode::SUCCESS; + } + + + + const Root::TAccept& AsgFlagSelectionTool :: + getTAccept () const + { + return m_accept; + } + + + + const Root::TAccept& AsgFlagSelectionTool :: + accept (const xAOD::IParticle *particle) const + { + m_accept.clear(); + for(std::size_t cutIndex=0; cutIndex<m_accept.getNCuts(); ++cutIndex) { + // Test against the opposite of the invert value + bool testval = !m_invertFlags[cutIndex]; + ATH_MSG_VERBOSE("Now testing flag \"" << m_selFlags[cutIndex] << "\" requiring value " << testval); + m_accept.setCutResult (cutIndex, m_acc_selFlags[cutIndex]->getBool (*particle)==testval); + } + ATH_MSG_VERBOSE(" Result: " << m_accept); + + return m_accept; + } +} + diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgLeptonTrackSelectionAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgLeptonTrackSelectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..57f4fed9f244d93ae04b458c80891a1592ca927f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgLeptonTrackSelectionAlg.cxx @@ -0,0 +1,194 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/AsgLeptonTrackSelectionAlg.h> + +#include <xAODEgamma/Electron.h> +#include <xAODEventInfo/EventInfo.h> +#include <xAODMuon/Muon.h> +#include <xAODTracking/TrackParticlexAODHelpers.h> +#include <xAODTracking/VertexContainer.h> + +// +// method implementations +// + +namespace CP +{ + AsgLeptonTrackSelectionAlg :: + AsgLeptonTrackSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("maxD0Significance", m_maxD0Significance, "maximum d0 significance (or 0 for no cut)"); + declareProperty ("maxDeltaZ0SinTheta", m_maxDeltaZ0SinTheta, "maximum Delta z0 sin theta (or 0 for no cut)"); + declareProperty ("nMinPixelHits", m_nMinPixelHits, "minimum number of required Pixel hits (or -1 for no cut)"); + declareProperty ("nMaxPixelHits", m_nMaxPixelHits, "minimum number of required Pixel hits (or -1 for no cut)"); + declareProperty ("nMinSCTHits", m_nMinSCTHits, "minimum number of required SCT hits (or -1 for no cut)"); + declareProperty ("nMaxSCTHits", m_nMaxSCTHits, "minimum number of required SCT hits (or -1 for no cut)"); + declareProperty ("selectionDecoration", m_selectionDecoration, "the decoration for the asg selection"); + declareProperty ("eventInfo", m_eventInfo, "the name of the EventInfo object to retrieve"); + declareProperty ("primaryVertices", m_primaryVertices, "the name of the PrimaryVertex container to retrieve"); + } + + + + StatusCode AsgLeptonTrackSelectionAlg :: + initialize () + { + if (m_selectionDecoration.empty()) + { + ANA_MSG_ERROR ("no selection decoration name set"); + return StatusCode::FAILURE; + } + ANA_CHECK (makeSelectionAccessor (m_selectionDecoration, m_selectionAccessor)); + + if (m_maxD0Significance < 0 || !std::isfinite (m_maxD0Significance)) + { + ATH_MSG_ERROR ("invalid value of maxD0Significance: " << m_maxD0Significance); + return StatusCode::FAILURE; + } + if (m_maxDeltaZ0SinTheta < 0 || !std::isfinite (m_maxDeltaZ0SinTheta)) + { + ATH_MSG_ERROR ("invalid value of maxDeltaZ0SinTheta: " << m_maxDeltaZ0SinTheta); + return StatusCode::FAILURE; + } + + m_accept.addCut ("trackRetrieval", "whether the track retrieval failed"); + if (m_maxD0Significance > 0) + m_accept.addCut ("maxD0Significance", "maximum D0 significance cut"); + if (m_maxDeltaZ0SinTheta > 0) + m_accept.addCut ("maxDeltaZ0SinTheta", "maximum Delta z0 sin theta cut"); + if (m_nMinPixelHits != -1 || m_nMaxPixelHits != -1) + m_accept.addCut ("numPixelHits", "Minimum and/or maxiumum Pixel hits"); + if (m_nMinSCTHits != -1 || m_nMaxSCTHits != -1) + m_accept.addCut ("numSCTHits", "Minimum and/or maxiumum SCT hits"); + + m_systematicsList.addHandle (m_particlesHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode AsgLeptonTrackSelectionAlg :: + execute () + { + const xAOD::EventInfo *eventInfo {nullptr}; + if (m_maxD0Significance > 0) + ANA_CHECK (evtStore()->retrieve (eventInfo, m_eventInfo)); + + const xAOD::Vertex *primaryVertex {nullptr}; + if (m_maxDeltaZ0SinTheta > 0) + { + const xAOD::VertexContainer *vertices {nullptr}; + ANA_CHECK (evtStore()->retrieve (vertices, m_primaryVertices)); + for (const xAOD::Vertex *vertex : *vertices) + { + if (vertex->vertexType() == xAOD::VxType::PriVtx) + { + // The default "PrimaryVertex" container is ordered in + // sum-pt, and the tracking group recommends to pick the one + // with the maximum sum-pt, so this will do the right thing. + // If the user needs a different primary vertex, he needs to + // provide a reordered primary vertex container and point + // this algorithm to it. Currently there is no central + // algorithm to do that, so users will have to write their + // own (15 Aug 18). + if (primaryVertex == nullptr) + { + primaryVertex = vertex; + break; + } + } + } + } + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::IParticleContainer *particles = nullptr; + ANA_CHECK (m_particlesHandle.getCopy (particles, sys)); + for (xAOD::IParticle *particle : *particles) + { + m_accept.clear(); + + if (m_preselection.getBool (*particle)) + { + std::size_t cutIndex {0}; + + const xAOD::TrackParticle *track {nullptr}; + if (const xAOD::Muon *muon = dynamic_cast<xAOD::Muon*>(particle)) + track = muon->primaryTrackParticle(); + else if (const xAOD::Electron *electron = dynamic_cast<xAOD::Electron*>(particle)) + track = electron->trackParticle(); + else + { + ANA_MSG_ERROR ("failed to cast input to electron or muon"); + return StatusCode::FAILURE; + } + + m_accept.setCutResult (cutIndex ++, track != nullptr); + if (track != nullptr) + { + if (m_maxD0Significance > 0) + { + try + { + const float d0sig = xAOD::TrackingHelpers::d0significance + (track, eventInfo->beamPosSigmaX(), eventInfo->beamPosSigmaY(), + eventInfo->beamPosSigmaXY()); + m_accept.setCutResult (cutIndex ++, fabs( d0sig ) < m_maxD0Significance); + } catch (const std::runtime_error &) { + m_accept.setCutResult (cutIndex ++, false); + } + } + if (m_maxDeltaZ0SinTheta > 0) + { + const double vertex_z = primaryVertex ? primaryVertex->z() : 0; + const float deltaZ0SinTheta + = (track->z0() + track->vz() - vertex_z) * sin (particle->p4().Theta()); + m_accept.setCutResult (cutIndex ++, fabs (deltaZ0SinTheta) < m_maxDeltaZ0SinTheta); + } + if (m_nMinPixelHits != -1 || m_nMaxPixelHits != -1) { + uint8_t nPixelHits; + track->summaryValue(nPixelHits, xAOD::numberOfPixelHits); + bool accept = true; + if(m_nMinPixelHits != -1) { + accept &= nPixelHits >= m_nMinPixelHits; + } + if(m_nMaxPixelHits != -1) { + accept &= nPixelHits <= m_nMaxPixelHits; + } + m_accept.setCutResult (cutIndex++, accept); + } + if (m_nMinSCTHits != -1 || m_nMaxSCTHits != -1) { + uint8_t nSCTHits; + track->summaryValue(nSCTHits, xAOD::numberOfSCTHits); + bool accept = true; + if(m_nMinSCTHits != -1) { + accept &= nSCTHits >= m_nMinSCTHits; + } + if(m_nMaxSCTHits != -1) { + accept &= nSCTHits <= m_nMaxSCTHits; + } + m_accept.setCutResult (cutIndex++, accept); + } + } + } + + m_selectionAccessor->setBits + (*particle, selectionFromAccept (m_accept)); + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgOriginalObjectLinkAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgOriginalObjectLinkAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fa93b7f58c4d500225a7f5b97724da559143f904 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgOriginalObjectLinkAlg.cxx @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/AsgOriginalObjectLinkAlg.h> + +// +// method implementations +// + +namespace CP +{ + AsgOriginalObjectLinkAlg :: + AsgOriginalObjectLinkAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("baseContainerName", m_baseContainerName, "base particle container name"); + } + + + + StatusCode AsgOriginalObjectLinkAlg :: + initialize () + { + if (m_baseContainerName.empty()) + { + ANA_MSG_ERROR ("Base particle container name should not be empty."); + return StatusCode::FAILURE; + } + + m_systematicsList.addHandle (m_particleHandle); + ANA_CHECK (m_systematicsList.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode AsgOriginalObjectLinkAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::IParticleContainer *particles = nullptr; + ANA_CHECK (m_particleHandle.getCopy (particles, sys)); + + const xAOD::IParticleContainer *baseParticles = nullptr; + ANA_CHECK (evtStore()->retrieve(baseParticles, m_baseContainerName)); + + if (!xAOD::setOriginalObjectLink (*baseParticles, *particles)) + { + ATH_MSG_ERROR ("Cannot set original object links for container named " << m_baseContainerName); + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgPtEtaSelectionTool.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgPtEtaSelectionTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..32f936c0242b08979bdc41bdde7575b6a1a496b2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgPtEtaSelectionTool.cxx @@ -0,0 +1,174 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/AsgPtEtaSelectionTool.h> + +#include <xAODEgamma/Egamma.h> +#include <xAODBase/IParticle.h> +#include <cmath> + +// +// method implementations +// + +namespace CP +{ + AsgPtEtaSelectionTool :: + AsgPtEtaSelectionTool (const std::string& name) + : AsgTool (name) + { + declareProperty ("minPt", m_minPt, "minimum pt to require (or 0 for no pt cut)"); + declareProperty ("maxPt", m_maxPt, "maximum pt to require (or 0 for no pt cut)"); + declareProperty ("maxEta", m_maxEta, "maximum abs(eta) to allow (or 0 for no eta cut)"); + declareProperty ("etaGapLow", m_etaGapLow, "low end of the eta gap"); + declareProperty ("etaGapHigh", m_etaGapHigh, "high end of the eta gap (or 0 for no eta gap)"); + declareProperty ("useClusterEta", m_useClusterEta, "whether to use the cluster eta (for electrons only)"); + declareProperty ("printCastWarning", m_printCastWarning, "whether to print a warning/error when the cast fails"); + declareProperty ("printClusterWarning", m_printClusterWarning, "whether to print a warning/error when the cluster is missing"); + } + + + + StatusCode AsgPtEtaSelectionTool :: + initialize () + { + if (m_minPt < 0 || !std::isfinite (m_minPt)) + { + ATH_MSG_ERROR ("invalid value of minPt: " << m_minPt); + return StatusCode::FAILURE; + } + if (m_maxPt < 0 || !std::isfinite (m_maxPt)) + { + ATH_MSG_ERROR ("invalid value of m_maxPt: " << m_maxPt); + return StatusCode::FAILURE; + } + if (m_maxEta < 0 || !std::isfinite (m_maxEta)) + { + ATH_MSG_ERROR ("invalid value of maxEta: " << m_maxEta); + return StatusCode::FAILURE; + } + if (m_etaGapLow < 0 || !std::isfinite (m_etaGapLow)) + { + ATH_MSG_ERROR ("invalid value of etaGapLow: " << m_etaGapLow); + return StatusCode::FAILURE; + } + if (m_etaGapHigh < 0 || !std::isfinite (m_etaGapHigh)) + { + ATH_MSG_ERROR ("invalid value of etaGapHigh: " << m_etaGapHigh); + return StatusCode::FAILURE; + } + if (m_etaGapHigh > 0 && m_etaGapLow >= m_etaGapHigh) + { + ATH_MSG_ERROR ("invalid eta gap: " << m_etaGapLow << " to " << m_etaGapHigh); + return StatusCode::FAILURE; + } + if (m_etaGapHigh > 0 && m_maxEta > 0 && m_etaGapHigh >= m_maxEta) + { + ATH_MSG_ERROR ("etaGapHigh=" << m_etaGapHigh << " >= maxEta=" << m_maxEta); + return StatusCode::FAILURE; + } + + if (m_minPt > 0) { + ATH_MSG_DEBUG( "Performing pt >= " << m_minPt << " MeV selection" ); + m_minPtCutIndex = m_accept.addCut ("minPt", "minimum pt cut"); + } + if (m_maxPt > 0) { + ATH_MSG_DEBUG( "Performing pt < " << m_maxPt << " MeV selection" ); + m_maxPtCutIndex = m_accept.addCut ("maxPt", "maximum pt cut"); + } + if (m_useClusterEta) { + ATH_MSG_DEBUG( "Performing eta cut on the e/gamma cluster" ); + m_egammaCastCutIndex = m_accept.addCut ("castEgamma", "cast to egamma"); + m_egammaClusterCutIndex = m_accept.addCut ("caloCluster", "egamma object has cluster"); + } + if (m_maxEta > 0) { + ATH_MSG_DEBUG( "Performing |eta| < " << m_maxEta << " selection" ); + m_maxEtaCutIndex = m_accept.addCut ("maxEta", "maximum eta cut"); + } + if (m_etaGapHigh > 0) { + ATH_MSG_DEBUG( "Performing !( " << m_etaGapLow << " < |eta| < " + << m_etaGapHigh << " ) selection" ); + m_etaGapCutIndex = m_accept.addCut ("etaGap", "eta gap cut"); + } + m_shouldPrintCastWarning = m_printCastWarning; + m_shouldPrintClusterWarning = m_printClusterWarning; + + return StatusCode::SUCCESS; + } + + + + const Root::TAccept& AsgPtEtaSelectionTool :: + getTAccept () const + { + return m_accept; + } + + + + const Root::TAccept& AsgPtEtaSelectionTool :: + accept (const xAOD::IParticle *particle) const + { + m_accept.clear(); + + // Perform the tranverse momentum cuts. + if (m_minPtCutIndex >= 0) { + m_accept.setCutResult (m_minPtCutIndex, particle->pt() >= m_minPt); + } + if (m_maxPtCutIndex >= 0) { + m_accept.setCutResult (m_maxPtCutIndex, particle->pt() < m_maxPt); + } + + // Perform the eta cut(s). + if (m_maxEtaCutIndex >= 0 || m_etaGapCutIndex >= 0) + { + float absEta = 0; + + if (m_useClusterEta == true) + { + const xAOD::Egamma *egamma + = dynamic_cast<const xAOD::Egamma*>(particle); + if (egamma == nullptr) + { + if (m_shouldPrintCastWarning) + ANA_MSG_ERROR ("failed to cast input particle to electron"); + m_shouldPrintCastWarning = false; + return m_accept; + } + m_accept.setCutResult (m_egammaCastCutIndex, true); + const xAOD::CaloCluster *const caloCluster {egamma->caloCluster()}; + if (!caloCluster) + { + if (m_shouldPrintClusterWarning) + ANA_MSG_ERROR ("no calo-cluster associated with e-gamma object"); + m_shouldPrintClusterWarning = false; + return m_accept; + } + m_accept.setCutResult (m_egammaClusterCutIndex, true); + absEta = std::abs (caloCluster->etaBE(2)); + } else + { + absEta = std::abs (particle->eta()); + } + + if (m_maxEtaCutIndex >= 0) { + m_accept.setCutResult (m_maxEtaCutIndex, absEta <= m_maxEta); + } + if (m_etaGapCutIndex >= 0) { + m_accept.setCutResult (m_etaGapCutIndex, (absEta < m_etaGapLow || + absEta > m_etaGapHigh)); + } + } + + return m_accept; + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgSelectionAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgSelectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..80951862530a149f949932585731d0577a9b2e46 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgSelectionAlg.cxx @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/AsgSelectionAlg.h> + +#include <PATInterfaces/ISystematicsTool.h> + +// +// method implementations +// + +namespace CP +{ + AsgSelectionAlg :: + AsgSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_selectionTool ("", this) + { + declareProperty ("selectionTool", m_selectionTool, "the selection tool we apply"); + declareProperty ("selectionDecoration", m_selectionDecoration, "the decoration for the asg selection"); + } + + + + StatusCode AsgSelectionAlg :: + initialize () + { + if (m_selectionDecoration.empty()) + { + ANA_MSG_ERROR ("no selection decoration name set"); + return StatusCode::FAILURE; + } + ANA_CHECK (makeSelectionAccessor (m_selectionDecoration, m_selectionAccessor)); + + ANA_CHECK (m_selectionTool.retrieve()); + m_systematicsTool = dynamic_cast<ISystematicsTool*>(&*m_selectionTool); + if (m_systematicsTool) + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_systematicsTool->affectingSystematics())); + + m_systematicsList.addHandle (m_particlesHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + + Root::TAccept blankAccept = m_selectionTool->getTAccept(); + // Just in case this isn't initially set up as a failure clear it this one + // time. This only calls reset on the bitset + blankAccept.clear(); + m_setOnFail = selectionFromAccept(blankAccept); + + return StatusCode::SUCCESS; + } + + + + StatusCode AsgSelectionAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + if (m_systematicsTool) + ANA_CHECK (m_systematicsTool->applySystematicVariation (sys)); + + xAOD::IParticleContainer *particles = nullptr; + ANA_CHECK (m_particlesHandle.getCopy (particles, sys)); + for (xAOD::IParticle *particle : *particles) + { + if (m_preselection.getBool (*particle)) + { + m_selectionAccessor->setBits + (*particle, selectionFromAccept (m_selectionTool->accept (particle))); + } + else + { + m_selectionAccessor->setBits(*particle, m_setOnFail); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgViewFromSelectionAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgViewFromSelectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..07f99decf502c5e6019aefc62d1f55cbb072048d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgViewFromSelectionAlg.cxx @@ -0,0 +1,228 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h> + +#include <CxxUtils/fpcompare.h> +#include <xAODCore/AuxContainerBase.h> +#include <xAODEgamma/PhotonContainer.h> +#include <xAODEgamma/ElectronContainer.h> +#include <xAODJet/JetContainer.h> +#include <xAODMuon/MuonContainer.h> +#include <xAODTau/TauJetContainer.h> +#include <xAODTau/DiTauJetContainer.h> +#include <xAODTracking/TrackParticleContainer.h> +#include <xAODTruth/TruthParticleContainer.h> + +// +// method implementations +// + +namespace CP +{ + template<typename Type> StatusCode AsgViewFromSelectionAlg :: + executeTemplate (const CP::SystematicSet& sys) + { + const Type *input = nullptr; + ANA_CHECK (evtStore()->retrieve (input, m_inputHandle.getName (sys))); + auto viewCopy = std::make_unique<Type> (SG::VIEW_ELEMENTS); + for (const auto particle : *input) + { + bool keep = true; + for (const auto& accessor : m_accessors) + { + if ((accessor.first->getBits (*particle) | accessor.second) != selectionAccept()) + { + keep = false; + break; + } + } + if (keep) + { + typename Type::value_type particleNC = + const_cast<typename Type::value_type>(particle); + viewCopy->push_back (particleNC); + } + } + + if (m_sortPt) + { + std::sort (viewCopy->begin(), viewCopy->end(), [] (const xAOD::IParticle *a, const xAOD::IParticle *b) {return CxxUtils::fpcompare::greater (a->pt(), b->pt());}); + } + + // If anyone might be concerned about efficiency here, this will + // add/sort a couple more entries than needed only to remove them + // from the vector afterwards, so there is a slight efficiency + // loss. However, this option is not expected to be used very + // often and the algorithm is still expected to run quickly, so I + // decided to keep the code above simpler and just do this as a + // separate step, instead of trying to optimize this by + // integrating it with the code above. + if (viewCopy->size() > m_sizeLimit) + viewCopy->resize (m_sizeLimit); + + // In case we want to output a view copy, do that here. + if (!m_deepCopy) + { + ANA_CHECK (evtStore()->record (viewCopy.release(), + m_outputHandle.getName (sys))); + return StatusCode::SUCCESS; + } + + // Apparently we want to make a deep copy. So set that one up. + auto deepCopy = std::make_unique<Type> (); + auto aux = std::make_unique<xAOD::AuxContainerBase> (); + deepCopy->setStore (aux.get()); + deepCopy->reserve (viewCopy->size()); + for (auto particle : *viewCopy) + { + typename Type::value_type pcopy = new typename Type::base_value_type(); + deepCopy->push_back (pcopy); + *pcopy = *particle; + } + + // Record the deep copy into the event store. + ANA_CHECK (evtStore()->record (deepCopy.release(), + m_outputHandle.getName (sys))); + ANA_CHECK (evtStore()->record (aux.release(), + m_outputHandle.getName (sys) + "Aux.")); + + return StatusCode::SUCCESS; + } + + + + + StatusCode AsgViewFromSelectionAlg :: + executeFindType (const CP::SystematicSet& sys) + { + if( m_allowMissing ) { + const std::string& name = m_inputHandle.getName( sys ); + if( ! evtStore()->contains< xAOD::IParticleContainer >( name ) ) { + m_function = &AsgViewFromSelectionAlg::executeMissing; + return StatusCode::SUCCESS; + } + } + + const xAOD::IParticleContainer *input = nullptr; + ANA_CHECK (m_inputHandle.retrieve (input, sys)); + + if (dynamic_cast<const xAOD::ElectronContainer*> (input)) + { + m_function = + &AsgViewFromSelectionAlg::executeTemplate<xAOD::ElectronContainer>; + } + else if (dynamic_cast<const xAOD::PhotonContainer*> (input)) + { + m_function = + &AsgViewFromSelectionAlg::executeTemplate<xAOD::PhotonContainer>; + } + else if (dynamic_cast<const xAOD::JetContainer*> (input)) + { + m_function = + &AsgViewFromSelectionAlg::executeTemplate<xAOD::JetContainer>; + } + else if (dynamic_cast<const xAOD::MuonContainer*> (input)) { + m_function = + &AsgViewFromSelectionAlg::executeTemplate<xAOD::MuonContainer>; + } + else if (dynamic_cast<const xAOD::TauJetContainer*> (input)) + { + m_function = + &AsgViewFromSelectionAlg::executeTemplate<xAOD::TauJetContainer>; + } + else if (dynamic_cast<const xAOD::DiTauJetContainer*> (input)) + { + m_function = + &AsgViewFromSelectionAlg::executeTemplate<xAOD::DiTauJetContainer>; + } + else if (dynamic_cast<const xAOD::TrackParticleContainer*> (input)) + { + m_function = + &AsgViewFromSelectionAlg::executeTemplate<xAOD::TrackParticleContainer>; + } + else if (dynamic_cast<const xAOD::TruthParticleContainer*> (input)) + { + m_function = + &AsgViewFromSelectionAlg::executeTemplate<xAOD::TruthParticleContainer>; + } + else + { + ANA_MSG_ERROR ("unknown type contained in AsgViewFromSelectionAlg, please extend it"); + return StatusCode::FAILURE; + } + + return (this->*m_function) (sys); + } + + + + StatusCode AsgViewFromSelectionAlg :: + executeMissing (const CP::SystematicSet&) + { + return StatusCode::SUCCESS; + } + + + + AsgViewFromSelectionAlg :: + AsgViewFromSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + /// \todo this would probably better be an std::map, but this + /// isn't supported as a property type for AnaAlgorithm right now + declareProperty ("selection", m_selection, "the list of selection decorations"); + declareProperty ("ignore", m_ignore, "the list of cuts to *ignore* for each selection"); + declareProperty ("sortPt", m_sortPt, "whether to sort objects in pt"); + declareProperty ("allowMissing", m_allowMissing, + "Allow the input container to be missing"); + declareProperty ("sizeLimit", m_sizeLimit, "the limit on the size of the output container"); + declareProperty ("deepCopy", m_deepCopy, "perform a deep copy"); + } + + + + StatusCode AsgViewFromSelectionAlg :: + initialize () + { + m_systematicsList.addHandle (m_inputHandle); + m_systematicsList.addHandle (m_outputHandle); + ANA_CHECK (m_systematicsList.initialize()); + + if (m_ignore.size() > m_selection.size()) + { + ANA_MSG_ERROR ("ignore property can't have more properties than selection property"); + return StatusCode::FAILURE; + } + for (std::size_t iter = 0, end = m_selection.size(); iter != end; ++ iter) + { + SelectionType ignore = 0; + if (iter < m_ignore.size()) + ignore = m_ignore[iter]; + std::unique_ptr<ISelectionAccessor> accessor; + ANA_CHECK (makeSelectionAccessor (m_selection[iter], accessor)); + m_accessors.push_back (std::make_pair (std::move (accessor), ignore)); + } + + return StatusCode::SUCCESS; + } + + + + StatusCode AsgViewFromSelectionAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + return (this->*m_function) (sys);}); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgxAODNTupleMakerAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgxAODNTupleMakerAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8ff21f3eeecd24a876c44798e1f557379efa5026 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/AsgxAODNTupleMakerAlg.cxx @@ -0,0 +1,953 @@ +// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +// Local include(s): +#include "AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h" + +// EDM include(s): +#include "AthContainersInterfaces/IAuxTypeVectorFactory.h" +#include "AthContainers/AuxElement.h" +#include "AthContainers/AuxVectorBase.h" +#include "AthContainers/normalizedTypeinfoName.h" + +// Framework include(s): +#include "SystematicsHandles/Helpers.h" + +// ROOT include(s): +#include <TClass.h> +#include <TTree.h> +#include <TBranch.h> +#include <TVirtualCollectionProxy.h> + +// System include(s): +#include <regex> +#include <algorithm> +#include <functional> +#include <sstream> + +namespace { + +#ifdef XAOD_STANDALONE + + /// Get an xAOD container from the event store + /// + /// This is the "standalone implementation" of the function. + /// + /// @param key The name of the container in the event store + /// @param evtStore The value of evtStore() from the algorithm + /// @param allowMissing Set to @c true to print an error message in case + /// of a failure + /// @param msg Reference to the caller's @c MsgStream object + /// @return A pointer to the container if successful, @c nullptr if not + /// + const SG::AuxVectorBase* getVector( const std::string& key, + asg::SgTEvent& evtStore, + bool allowMissing, + MsgStream& msg ) { + if( allowMissing && + ( ! evtStore.contains< const SG::AuxVectorBase >( key ) ) ) { + return nullptr; + } + const SG::AuxVectorBase* c = nullptr; + if( ! evtStore.retrieve( c, key ).isSuccess() ) { + msg << MSG::ERROR << "Couldn't retrieve container with key \"" << key + << "\"" << endmsg; + return nullptr; + } + return c; + } + + /// Get a standalone xAOD object from the event store + /// + /// This is the "standalone implementation" of the function. + /// + /// @param key The name of the container in the event store + /// @param evtStore The value of evtStore() from the algorithm + /// @param allowMissing Set to @c true to print an error message in case + /// of a failure + /// @param msg Reference to the caller's @c MsgStream object + /// @return A pointer to the container if successful, @c nullptr if not + /// + const SG::AuxElement* getElement( const std::string& key, + asg::SgTEvent& evtStore, + bool allowMissing, + MsgStream& msg ) { + if( allowMissing && + ( ! evtStore.contains< const SG::AuxElement >( key ) ) ) { + return nullptr; + } + const SG::AuxElement* e = nullptr; + if( ! evtStore.retrieve( e, key ).isSuccess() ) { + msg << MSG::ERROR << "Couldn't retrieve object with key \"" << key + << "\"" << endmsg; + return nullptr; + } + return e; + } + +#else + + /// Predicate for finding a proxy with a given name + class ProxyWithName { + public: + /// Type of the predicate's argument + typedef const SG::DataProxy* argument_type; + /// Constructor with key/name + ProxyWithName( const std::string& name ) : m_name( name ) {} + /// Operator evaluating whether this is a good proxy or not + bool operator()( argument_type proxy ) const { + return ( proxy->name() == m_name ); + } + private: + std::string m_name; ///< Name for the proxy to find + }; // class ProxyWithName + + /// Get an xAOD container from the event store + /// + /// This is the "Athena implementation" of the function. + /// + /// @param key The name of the container in the event store + /// @param evtStore The value of evtStore() from the algorithm + /// @param allowMissing Set to @c true to print an error message in case + /// of a failure + /// @param msg Reference to the caller's @c MsgStream object + /// @return A pointer to the container if successful, @c nullptr if not + /// + const SG::AuxVectorBase* getVector( const std::string& key, + IProxyDict& evtStore, + bool allowMissing, + MsgStream& msg ) { + + // Find all proxies with this key: + auto proxies = evtStore.proxies(); + proxies.erase( std::remove_if( proxies.begin(), proxies.end(), + std::not1( ProxyWithName( key ) ) ), + proxies.end() ); + // Now iterate over them: + for( const SG::DataProxy* proxy : proxies ) { + // We need a non-const version of it... :-( + SG::DataProxy* proxy_nc = const_cast< SG::DataProxy* >( proxy ); + // Try to get the right object out of it. + DataBucketBase* bucket = + dynamic_cast< DataBucketBase* >( proxy_nc->accessData() ); + if( ! bucket ) { + // This is a big problem in the job. Return right away. + msg << MSG::ERROR + << "Couldn't access data object as a data bucket?!?" << endmsg; + return nullptr; + } + // Get the dictionary for the type: + TClass* cl = TClass::GetClass( bucket->tinfo() ); + if( ! cl ) { + if( msg.level() <= MSG::VERBOSE ) { + msg << MSG::VERBOSE << "No dictionary found for: " + << bucket->tinfo().name() << endmsg; + } + continue; + } + // Check whether the object inherits from AuxVectorBase: + if( ! cl->InheritsFrom( "SG::AuxVectorBase" ) ) { + if( msg.level() <= MSG::VERBOSE ) { + msg << MSG::VERBOSE << "Object \"" << key << "/" << cl->GetName() + << "\" does not inherit from SG::AuxVectorBase" << endmsg; + } + continue; + } + // If all is well, just assume that the inheritance is direct/simple: + const SG::AuxVectorBase* result = + reinterpret_cast< const SG::AuxVectorBase* >( bucket->object() ); + return result; + } + + // Apparently we failed... + if( ! allowMissing ) { + msg << MSG::ERROR << "Couldn't retrieve object \"" << key + << "\" as SG::AuxVectorBase" << endmsg; + } + return nullptr; + } + + /// Get a standalone xAOD object from the event store + /// + /// This is the "Athena implementation" of the function. + /// + /// @param key The name of the container in the event store + /// @param evtStore The value of evtStore() from the algorithm + /// @param allowMissing Set to @c true to print an error message in case + /// of a failure + /// @param msg Reference to the caller's @c MsgStream object + /// @return A pointer to the container if successful, @c nullptr if not + /// + const SG::AuxElement* getElement( const std::string& key, + IProxyDict& evtStore, + bool allowMissing, + MsgStream& msg ) { + + // Find all proxies with this key: + auto proxies = evtStore.proxies(); + proxies.erase( std::remove_if( proxies.begin(), proxies.end(), + std::not1( ProxyWithName( key ) ) ), + proxies.end() ); + // Now iterate over them: + for( const SG::DataProxy* proxy : proxies ) { + // We need a non-const version of it... :-( + SG::DataProxy* proxy_nc = const_cast< SG::DataProxy* >( proxy ); + // Try to get the right object out of it. + DataBucketBase* bucket = + dynamic_cast< DataBucketBase* >( proxy_nc->accessData() ); + if( ! bucket ) { + // This is a big problem in the job. Return right away. + msg << MSG::ERROR + << "Couldn't access data object as a data bucket?!?" << endmsg; + return nullptr; + } + // Get the dictionary for the type: + TClass* cl = TClass::GetClass( bucket->tinfo() ); + if( ! cl ) { + if( msg.level() <= MSG::VERBOSE ) { + msg << MSG::VERBOSE << "No dictionary found for: " + << bucket->tinfo().name() << endmsg; + } + continue; + } + // Check whether the object inherits from AuxVectorBase: + if( ! cl->InheritsFrom( "SG::AuxElement" ) ) { + if( msg.level() <= MSG::VERBOSE ) { + msg << MSG::VERBOSE << "Object \"" << key << "/" << cl->GetName() + << "\" does not inherit from SG::AuxElement" << endmsg; + } + continue; + } + // If all is well, just assume that the inheritance is direct/simple: + return reinterpret_cast< const SG::AuxElement* >( bucket->object() ); + } + + // Apparently we failed... + if( ! allowMissing ) { + msg << MSG::ERROR << "Couldn't retrieve object \"" << key + << "\" as SG::AuxElement" << endmsg; + } + return nullptr; + } +#endif // XAOD_STANDALONE + + /// This function is used internally in the code when creating primitive + /// branches. I just took the code from xAODRootAccess, which itself too it + /// from SFrame... :-P + /// + /// @param typeidType The type name coming from typeid(...).name() + /// @param msg The caller's @c MsgStream object + /// @return The character describing this type for @c TTree::Branch + /// + char rootType( char typeidType, MsgStream& msg ) { + + // Do the hard-coded translation: + switch( typeidType ) { + + case 'c': + return 'B'; + break; + case 'h': + return 'b'; + break; + case 's': + return 'S'; + break; + case 't': + return 's'; + break; + case 'i': + return 'I'; + break; + case 'j': + return 'i'; + break; + case 'f': + return 'F'; + break; + case 'd': + return 'D'; + break; + case 'x': + return 'L'; + break; + case 'y': + case 'm': // Not sure how platform-independent this one is... + return 'l'; + break; + case 'b': + return 'O'; + break; + default: + // If we didn't find this type: + msg << MSG::ERROR << "Received an unknown type: " << typeidType + << endmsg; + return '\0'; + break; + } + } + + /// Check if an aux item exists in the aux store + /// + /// @param key The name of the container in the event store + /// @return True if branch exists, false if not + /// + bool auxItemExists( const std::string& key ) { + // Get a pointer to the vector factory. + const SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); + + // Try to find the aux item + return reg.findAuxID( key ) != SG::null_auxid; + } +} // private namespace + +namespace CP { + + AsgxAODNTupleMakerAlg::AsgxAODNTupleMakerAlg( const std::string& name, + ISvcLocator* svcLoc ) + : EL::AnaAlgorithm( name, svcLoc ) { + + // Declare the algorithm's properties. + declareProperty( "TreeName", m_treeName = "physics", + "Name of the tree to write" ); + declareProperty( "Branches", m_branches, + "Branches to write to the output tree" ); + } + + StatusCode AsgxAODNTupleMakerAlg::initialize() { + + // Check that at least one branch is configured. + if( m_branches.empty() ) { + ATH_MSG_ERROR( "No branches set up for writing" ); + return StatusCode::FAILURE; + } + + // Set up the systematics list. + ATH_CHECK( m_systematicsList.initialize() ); + + // Reset the initialisation flag: + m_isInitialized = false; + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::execute() { + + // Initialise the processor objects on the first event. + if( ! m_isInitialized ) { + // Initialise the output tree. + m_tree = tree( m_treeName ); + if( ! m_tree ) { + ATH_MSG_ERROR( "Could not find output tree \"" << m_treeName + << "\"" ); + return StatusCode::FAILURE; + } + // Call the setup function. + ATH_CHECK( setupTree() ); + // The processor objects are now set up. + m_isInitialized = true; + } + + // Process the standalone objects: + for( auto& element_itr : m_elements ) { + // Retrieve the object: + static const bool ALLOW_MISSING = false; + const SG::AuxElement* el = getElement( element_itr.first, + *( evtStore() ), + ALLOW_MISSING, msg() ); + if( ! el ) { + ATH_MSG_ERROR( "Failed to retrieve object \"" << element_itr.first + << "\"" ); + return StatusCode::FAILURE; + } + // Process it: + ATH_CHECK( element_itr.second.process( *el ) ); + } + + // Process the container objects: + for( auto& container_itr : m_containers ) { + // Retrieve the container: + static const bool ALLOW_MISSING = false; + const SG::AuxVectorBase* vec = getVector( container_itr.first, + *( evtStore() ), + ALLOW_MISSING, msg() ); + if( ! vec ) { + ATH_MSG_ERROR( "Failed to retrieve container \"" + << container_itr.first << "\"" ); + return StatusCode::FAILURE; + } + // Process it. + ATH_CHECK( container_itr.second.process( *vec ) ); + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::finalize() { + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::setupTree() { + + // First process nominal + CP::SystematicSet nominal{}; + for( const std::string& branchDecl : m_branches ) { + ATH_CHECK( setupBranch( branchDecl, nominal ) ); + } + + // Consider all systematics but skip the nominal one + for( const auto& sys : m_systematicsList.systematicsVector() ) { + // Nominal already processed + if( sys.empty() ) { + continue; + } + + // Iterate over the branch specifications. + for( const std::string& branchDecl : m_branches ) { + ATH_CHECK( setupBranch( branchDecl, sys ) ); + } + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::setupBranch( const std::string &branchDecl, + const CP::SystematicSet &sys ) { + + // The regular expression used to extract the needed info. The logic + // is supposed to be: + // + // (match[1]).(match[2])<any whitespace>-><any whitespace>(match[3]) + // + // Like: + // "Electrons.eta -> el_eta" + // + // , where we would pick up "Electrons", "eta" and "el_eta" as the + // three words using this regexp. + static const std::regex + re( "\\s*([\\w%]+)\\.([\\w%]+)\\s*->\\s*([\\w%]+)" ); + + // Interpret this branch declaration. + std::smatch match; + if( ! std::regex_match( branchDecl, match, re ) ) { + ATH_MSG_ERROR( "Expression \"" << branchDecl + << "\" doesn't match \"<object>.<variable> ->" + " <branch>\"" ); + return StatusCode::FAILURE; + } + + // Check if we are running nominal + bool nominal = sys.empty(); + + // Event store key for the object under consideration. + const std::string key = makeSystematicsName( match[ 1 ], sys ); + // Auxiliary variable name for the object under consideration. + const std::string auxName = makeSystematicsName( match[ 2 ], + sys ); + // Branch name for the variable. + const std::string brName = makeSystematicsName( match[ 3 ], + sys ); + + // If the %SYS% pattern was not used in this setup, then stop + // on non-nominal systematic. + if( ! nominal && + ( key == match[ 1 ] ) && ( auxName == match[ 2 ] ) && + ( brName == match[ 3 ] ) ) { + return StatusCode::SUCCESS; + } + + // Check that we use the %SYS% pattern reasonably in the names. + if( ( ( key == match[ 1 ] ) && ( auxName == match[ 2 ] ) && + ( brName != match[ 3 ] ) ) || + ( ( ( key != match[ 1 ] ) || ( auxName != match[ 2 ] ) ) && + ( brName == match[ 3 ] ) ) ) { + ATH_MSG_ERROR( "The systematic variation pattern is used " + "inconsistently in: \"" << branchDecl + << "\"" ); + return StatusCode::FAILURE; + } + + // Flag keeping track whether any branch was set up for this rule. + bool branchCreated = false; + + // Decide whether the specified key belongs to a container or + // a standalone object. + static const bool ALLOW_MISSING = true; + if( getVector( key, *( evtStore() ), ALLOW_MISSING, + msg() ) ) { + bool created = false; + ATH_CHECK( m_containers[ key ].addBranch( *m_tree, + auxName, + brName, + ALLOW_MISSING, + created ) ); + if( created ) { + ATH_MSG_DEBUG( "Writing branch \"" << brName + << "\" from container/variable \"" << key + << "." << auxName << "\"" ); + branchCreated = true; + } else { + ATH_MSG_DEBUG( "Skipping branch \"" << brName + << "\" from container/variable \"" << key + << "." << auxName << "\"" ); + } + } else if( getElement( key, *( evtStore() ), + ALLOW_MISSING, msg() ) ) { + bool created = false; + ATH_CHECK( m_elements[ key ].addBranch( *m_tree, + auxName, + brName, + ALLOW_MISSING, + created ) ); + if( created ) { + ATH_MSG_DEBUG( "Writing branch \"" << brName + << "\" from object/variable \"" << key + << "." << auxName << "\"" ); + branchCreated = true; + } else { + ATH_MSG_DEBUG( "Skipping branch \"" << brName + << "\" from object/variable \"" << key + << "." << auxName << "\"" ); + } + } else { + ATH_MSG_DEBUG( "Container \"" << key + << "\" not readable for expression: \"" + << branchDecl << "\"" ); + } + + // Check if the rule was meaningful or not: + if( nominal && ! branchCreated && key == match[ 1 ] ) { + ATH_MSG_ERROR( "No branch was created for rule: \"" + << branchDecl << "\"" ); + return StatusCode::FAILURE; + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + AsgxAODNTupleMakerAlg::ElementProcessor::ElementProcessor() + : asg::AsgMessaging( "CP::AsgxAODNTupleMakerAlg::ElementProcessor" ) { + + } + + StatusCode AsgxAODNTupleMakerAlg::ElementProcessor:: + process( const SG::AuxElement& element ) { + + // Process all branches. + for( BranchProcessor& p : m_branches ) { + ATH_CHECK( p.process( element, msg() ) ); + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::ElementProcessor:: + addBranch( TTree& tree, const std::string& auxName, + const std::string& branchName, + bool allowMissing, + bool &created ) { + + /// Helper class for finding an already existing branch processor. + class BranchFinder { + public: + /// Type of the predicate's argument + typedef const BranchProcessor& argument_type; + /// Constructor with key/name + BranchFinder( const std::string& branchName ) : m_name( branchName ) {} + /// Operator evaluating whether this is the branch we're looking for + bool operator()( argument_type bp ) const { + return ( bp.m_branchName == m_name ); + } + private: + std::string m_name; ///< Name of the branch + }; // class BranchFinder + + // Check if the corresponding aux item exists + bool validAuxItem = auxItemExists( auxName ); + if( ! validAuxItem ) { + if( allowMissing ) { + // Return gracefully. + ATH_MSG_DEBUG( "Aux item \"" << auxName + << "\" not readable for branch \"" + << branchName << "\"" ); + return StatusCode::SUCCESS; + } else { + // Return gracefully. + ATH_MSG_ERROR( "Aux item \"" << auxName + << "\" not readable for branch \"" + << branchName << "\"" ); + return StatusCode::FAILURE; + } + } + + // Check whether this branch is already set up: + auto itr = std::find_if( m_branches.begin(), m_branches.end(), + BranchFinder( branchName ) ); + if( itr != m_branches.end() ) { + ATH_MSG_WARNING( "Duplicate setup received for branch: " << branchName ); + return StatusCode::SUCCESS; + } + + created = true; + + // Set up the new branch. + m_branches.emplace_back(); + ATH_CHECK( m_branches.back().setup( tree, auxName, branchName, msg() ) ); + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode + AsgxAODNTupleMakerAlg::ElementProcessor::BranchProcessor:: + setup( TTree& tree, const std::string& auxName, + const std::string& branchName, MsgStream& msg ) { + + // Remember the branch name. + m_branchName = branchName; + + // Create the accessor. + m_acc.reset( new SG::AuxElement::TypelessConstAccessor( auxName ) ); + + // Get a pointer to the vector factory. + const SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); + const std::type_info* ti = reg.getType( m_acc->auxid() ); + if( ! ti ) { + msg << MSG::ERROR + << "No std::type_info available for auxiliary variable: " + << auxName << endmsg; + return StatusCode::FAILURE; + } + m_factory = reg.getFactory( *ti ); + if( ! m_factory ) { + msg << MSG::ERROR << "No factory found for auxiliary variable: " + << auxName << endmsg; + return StatusCode::FAILURE; + } + + // Create the data object. + m_data.reset( m_factory->create( 1, 1 ) ); + + // Pointer to the branch, to be created. + TBranch* br = nullptr; + + // Decide whether we're dealing with a "primitive" or an "object" branch. + if( strlen( ti->name() ) == 1 ) { + + // This is a "primitive" variable... + + // Get the type identifier for it that ROOT will understand. + const char rType = rootType( ti->name()[ 0 ], msg ); + if( rType == '\0' ) { + msg << MSG::ERROR << "Type not recognised for variable: " + << branchName << endmsg; + return StatusCode::FAILURE; + } + + // Construct the type description. + std::ostringstream typeDesc; + typeDesc << branchName << "/" << rType; + + // Create the primitive branch. + br = tree.Branch( branchName.c_str(), m_data->toPtr(), + typeDesc.str().c_str() ); + + } else { + + // This is an "object" variable... + + // Get a proper type name for the variable. + const std::string typeName = SG::normalizedTypeinfoName( *ti ); + + // Access the dictionary for the type. + TClass* cl = TClass::GetClass( *ti ); + if( ! cl ) { + cl = TClass::GetClass( typeName.c_str() ); + } + if( ! cl ) { + msg << MSG::ERROR << "Couldn't find dictionary for type: " + << typeName << endmsg; + return StatusCode::FAILURE; + } + if( ! cl->GetStreamerInfo() ) { + msg << MSG::ERROR << "No streamer info available for type: " + << cl->GetName() << endmsg; + return StatusCode::FAILURE; + } + + // Create the object branch. + m_dataPtr = m_data->toPtr(); + br = tree.Branch( branchName.c_str(), cl->GetName(), &m_dataPtr ); + + } + + // Check that the branch creation succeeded. + if( ! br ) { + msg << MSG::ERROR << "Failed to create branch: " << branchName + << endmsg; + return StatusCode::FAILURE; + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode + AsgxAODNTupleMakerAlg::ElementProcessor::BranchProcessor:: + process( const SG::AuxElement& element, MsgStream& msg ) { + + // A security check. + if( ( ! m_acc ) || ( ! m_factory ) || ( ! m_data ) ) { + msg << MSG::FATAL << "Internal logic error detected" << endmsg; + return StatusCode::FAILURE; + } + + // Get the data out of the xAOD object. + const void* auxData = ( *m_acc )( element ); + + // Copy it into the output variable. + m_factory->copy( m_data->toPtr(), 0, auxData, 0 ); + + // Return gracefully. + return StatusCode::SUCCESS; + } + + AsgxAODNTupleMakerAlg::ContainerProcessor::ContainerProcessor() + : asg::AsgMessaging( "CP::AsgxAODNTupleMakerAlg::ContainerProcessor" ) { + + } + + StatusCode AsgxAODNTupleMakerAlg::ContainerProcessor:: + process( const SG::AuxVectorBase& container ) { + + // Get the collection proxy for the type if it's not available yet. + if( ! m_collProxy ) { + + // Try to get the dictionary for the type. + TClass* cl = TClass::GetClass( typeid( container ) ); + if( ! cl ) { + ATH_MSG_ERROR( "No dictionary found for container" ); + return StatusCode::FAILURE; + } + + // Get the collection proxy from the dictionary. + m_collProxy = cl->GetCollectionProxy(); + if( ! m_collProxy ) { + ATH_MSG_ERROR( "No collection proxy provided by type: " + << cl->GetName() ); + return StatusCode::FAILURE; + } + + // Get the offset that one needs to use to get from the element + // pointers to SG::AuxElement pointers. + static const TClass* auxElementClass = + TClass::GetClass( typeid( SG::AuxElement ) ); + m_auxElementOffset = + m_collProxy->GetValueClass()->GetBaseClassOffset( auxElementClass ); + if( m_auxElementOffset < 0 ) { + ATH_MSG_ERROR( "Vector element type \"" + << m_collProxy->GetValueClass()->GetName() + << "\" doesn't seem to inherit from \"" + << auxElementClass->GetName() << "\"" ); + return StatusCode::FAILURE; + } + } + + // Set up the iteration over the elements of the container. In a really + // low level / ugly way... + void* cPtr = + const_cast< void* >( static_cast< const void* >( &container ) ); + TVirtualCollectionProxy::TPushPop helper( m_collProxy, cPtr ); + const UInt_t cSize = m_collProxy->Size(); + + // Tell all branch processors to resize their variables. + for( BranchProcessor& p : m_branches ) { + ATH_CHECK( p.resize( cSize, msg() ) ); + } + + // Now iterate over the container. + for( UInt_t i = 0; i < cSize; ++i ) { + + // Get the element. + char* elPtr = static_cast< char* >( m_collProxy->At( i ) ); + if( ! elPtr ) { + ATH_MSG_ERROR( "Failed to get element " << i << " from container" ); + return StatusCode::FAILURE; + } + const SG::AuxElement* element = + reinterpret_cast< const SG::AuxElement* >( elPtr + + m_auxElementOffset ); + + // Execute all branch processors on this element. + for( BranchProcessor& p : m_branches ) { + ATH_CHECK( p.process( *element, i, msg() ) ); + } + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::ContainerProcessor:: + addBranch( TTree& tree, const std::string& auxName, + const std::string& branchName, + bool allowMissing, + bool &created ) { + + /// Helper class for finding an already existing branch processor. + class BranchFinder { + public: + /// Type of the predicate's argument + typedef const BranchProcessor& argument_type; + /// Constructor with key/name + BranchFinder( const std::string& branchName ) : m_name( branchName ) {} + /// Operator evaluating whether this is the branch we're looking for + bool operator()( argument_type bp ) const { + return ( bp.m_branchName == m_name ); + } + private: + std::string m_name; ///< Name of the branch + }; // class BranchFinder + + // Check if the corresponding aux item exists + bool validAuxItem = auxItemExists( auxName ); + if( ! validAuxItem ) { + if( allowMissing ) { + // Return gracefully. + ATH_MSG_DEBUG( "Aux item \"" << auxName + << "\" not readable for branch \"" + << branchName << "\"" ); + return StatusCode::SUCCESS; + } else { + // Return gracefully. + ATH_MSG_ERROR( "Aux item \"" << auxName + << "\" not readable for branch \"" + << branchName << "\"" ); + return StatusCode::FAILURE; + } + } + + // Check whether this branch is already set up: + auto itr = std::find_if( m_branches.begin(), m_branches.end(), + BranchFinder( branchName ) ); + if( itr != m_branches.end() ) { + ATH_MSG_WARNING( "Duplicate setup received for branch: " << branchName ); + return StatusCode::SUCCESS; + } + + created = true; + + // Set up the new branch. + m_branches.emplace_back(); + ATH_CHECK( m_branches.back().setup( tree, auxName, branchName, msg() ) ); + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::ContainerProcessor::BranchProcessor:: + setup( TTree& tree, const std::string& auxName, + const std::string& branchName, MsgStream& msg ) { + + // Remember the branch name. + m_branchName = branchName; + + // Create the accessor. + m_acc.reset( new SG::AuxElement::TypelessConstAccessor( auxName ) ); + + // Get a pointer to the vector factory. + const SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); + const std::type_info* ti = reg.getType( m_acc->auxid() ); + const std::type_info* vecTi = reg.getVecType( m_acc->auxid() ); + if( ( ! ti ) || ( ! vecTi ) ) { + msg << MSG::ERROR + << "No std::type_info available for auxiliary variable: " + << auxName << endmsg; + return StatusCode::FAILURE; + } + m_factory = reg.getFactory( *ti ); + if( ! m_factory ) { + msg << MSG::ERROR << "No factory found for auxiliary variable: " + << auxName << endmsg; + return StatusCode::FAILURE; + } + + // Create the data object. + m_data.reset( m_factory->create( 0, 0 ) ); + + // Get a proper type name for the variable. + const std::string typeName = SG::normalizedTypeinfoName( *vecTi ); + + // Access the dictionary for the type. + TClass* cl = TClass::GetClass( *vecTi ); + if( ! cl ) { + cl = TClass::GetClass( typeName.c_str() ); + } + if( ! cl ) { + msg << MSG::ERROR << "Couldn't find dictionary for type: " + << typeName << endmsg; + return StatusCode::FAILURE; + } + if( ! cl->GetStreamerInfo() ) { + msg << MSG::ERROR << "No streamer info available for type: " + << cl->GetName() << endmsg; + return StatusCode::FAILURE; + } + + // Create the branch. + m_dataPtr = m_data->toVector(); + TBranch* br = tree.Branch( branchName.c_str(), cl->GetName(), + &m_dataPtr ); + if( ! br ) { + msg << MSG::ERROR << "Failed to create branch: " << branchName + << endmsg; + return StatusCode::FAILURE; + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::ContainerProcessor::BranchProcessor:: + resize( size_t size, MsgStream& msg ) { + + // A security check. + if( ! m_data ) { + msg << MSG::FATAL << "Internal logic error detected" << endmsg; + return StatusCode::FAILURE; + } + + // Do the deed. + m_data->resize( 0 ); + m_data->resize( size ); + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode AsgxAODNTupleMakerAlg::ContainerProcessor::BranchProcessor:: + process( const SG::AuxElement& element, size_t index, MsgStream& msg ) { + + // A security check. + if( ( ! m_acc ) || ( ! m_factory ) || ( ! m_data ) ) { + msg << MSG::FATAL << "Internal logic error detected" << endmsg; + return StatusCode::FAILURE; + } + + // Get the data out of the xAOD object. + const void* auxData = ( *m_acc )( element ); + + // Copy it into the output variable. + m_factory->copy( m_data->toPtr(), index, auxData, 0 ); + + // Return gracefully. + return StatusCode::SUCCESS; + } + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/EventFlagSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/EventFlagSelectorAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c2a3b94c59205c0ccbf270b4a79c9db155a21cab --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/EventFlagSelectorAlg.cxx @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + +#include "AnaAlgorithm/FilterReporter.h" +#include <AsgAnalysisAlgorithms/EventFlagSelectionAlg.h> +#include <xAODEventInfo/EventInfo.h> + +CP::EventFlagSelectionAlg::EventFlagSelectionAlg(const std::string &name, + ISvcLocator *svcLoc) + : EL::AnaAlgorithm(name, svcLoc) +{ + declareProperty ("selectionFlags", m_selFlags, "list of flags to use as selection criteria"); + declareProperty ("invertFlags", m_invertFlags, "toggles for inverting the selection (index-parallel to selectionFlags)"); +} + +StatusCode CP::EventFlagSelectionAlg::initialize() +{ + if (m_invertFlags.size() != m_selFlags.size() && !m_invertFlags.empty()) { + ATH_MSG_ERROR("Property invertFlags has different size to selectionFlags. Please check your configuration"); + return StatusCode::FAILURE; + } + + for (size_t index = 0; index < m_selFlags.size(); ++index) { + const std::string& thisflag = m_selFlags[index]; + if (thisflag.empty()) { + ATH_MSG_ERROR("Empty string passed as selection flag!"); + return StatusCode::FAILURE; + } else { + // Extend m_invertFlags until the size matches m_selectionFlags + // Only done in the case that m_invert was empty + if (m_invertFlags.size() < index + 1) { m_invertFlags.push_back(false); } + + std::unique_ptr<ISelectionAccessor> accessor; + ANA_CHECK (makeSelectionAccessor (m_selFlags[index], accessor)); + m_accessors.push_back(std::move(accessor)); + } + } + + return StatusCode::SUCCESS; +} + +StatusCode CP::EventFlagSelectionAlg::execute() +{ + EL::FilterReporter filter (m_filterParams, false); + + const xAOD::EventInfo *evtInfo = 0; + ANA_CHECK(evtStore()->retrieve(evtInfo, "EventInfo")); + + for (size_t index = 0; index < m_selFlags.size(); ++index) { + // Test against the opposite of the invert value + bool testval = !m_invertFlags[index]; + ATH_MSG_VERBOSE("Now testing flag \"" << m_selFlags[index] << "\" requiring value " << testval); + + if (m_accessors[index]->getBool(*evtInfo) != testval) { + ATH_MSG_VERBOSE("Event failed."); + filter.setPassed(false); + return StatusCode::SUCCESS; + } + } + + ATH_MSG_VERBOSE("Event passed all flags."); + filter.setPassed(true); + + return StatusCode::SUCCESS; +} + +StatusCode CP::EventFlagSelectionAlg::finalize() +{ + ANA_CHECK (m_filterParams.finalize()); + + return StatusCode::SUCCESS; +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/EventSelectionByObjectFlagAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/EventSelectionByObjectFlagAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..22ff1923a18952297f4e8b94b39b9a90a4e98086 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/EventSelectionByObjectFlagAlg.cxx @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Miha Muskinja + +// +// includes +// + +#include <AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h> +#include <SystematicsHandles/SysFilterReporter.h> +#include <SystematicsHandles/SysFilterReporterCombiner.h> + +// +// method implementations +// + +namespace CP { + +EventSelectionByObjectFlagAlg ::EventSelectionByObjectFlagAlg( + const std::string &name, ISvcLocator *pSvcLocator) + : AnaAlgorithm(name, pSvcLocator) {} + +StatusCode EventSelectionByObjectFlagAlg ::initialize() { + + m_systematicsList.addHandle(m_particleHandle); + ANA_CHECK(m_systematicsList.initialize()); + ANA_CHECK(m_preselection.initialize()); + ANA_CHECK(m_veto.initialize()); + ANA_CHECK(m_filterParams.initialize()); + + return StatusCode::SUCCESS; +} + +StatusCode EventSelectionByObjectFlagAlg ::execute() { + + SysFilterReporterCombiner filterCombiner (m_filterParams, m_systematicsList, true); + + // loop over systematics + return m_systematicsList.foreach ([&](const CP::SystematicSet &sys) -> StatusCode { + SysFilterReporter filter (filterCombiner, sys); + + // particle container + const xAOD::IParticleContainer *particles = nullptr; + ANA_CHECK(m_particleHandle.retrieve(particles, sys)); + + // reject events with any particle passing the input selection + for (const xAOD::IParticle *particle : *particles) { + if (m_preselection.getBool(*particle)) { + if (m_veto.getBool(*particle)) { + ATH_MSG_VERBOSE("Event failed."); + filter.setPassed (false); + break; + } + } + } + + return StatusCode::SUCCESS; + }); +} + +StatusCode EventSelectionByObjectFlagAlg ::finalize() { + ANA_CHECK (m_filterParams.finalize()); + return StatusCode::SUCCESS; +} + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/IsolationCloseByCorrectionAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/IsolationCloseByCorrectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..70335657f4b1e656cbd36c8c3d27c2575d12005c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/IsolationCloseByCorrectionAlg.cxx @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h> + +// +// method implementations +// + +namespace CP +{ + IsolationCloseByCorrectionAlg :: + IsolationCloseByCorrectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("isolationCorrectionTool", m_isolationCorrectionTool); + declareProperty ("topoEtConeModel", m_topoEtConeModel); + } + + + + StatusCode IsolationCloseByCorrectionAlg :: + initialize () + { + ANA_CHECK (m_isolationCorrectionTool.retrieve()); + if (m_electronsHandle) m_systematicsList.addHandle (m_electronsHandle); + if (m_muonsHandle) m_systematicsList.addHandle (m_muonsHandle); + if (m_photonsHandle) m_systematicsList.addHandle (m_photonsHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode IsolationCloseByCorrectionAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::ElectronContainer *electrons {nullptr}; + if (m_electronsHandle) + ANA_CHECK (m_electronsHandle.getCopy (electrons, sys)); + xAOD::MuonContainer *muons {nullptr}; + if (m_muonsHandle) + ANA_CHECK (m_muonsHandle.getCopy (muons, sys)); + xAOD::PhotonContainer *photons {nullptr}; + if (m_photonsHandle) + ANA_CHECK (m_photonsHandle.getCopy (photons, sys)); + + ANA_CHECK_CORRECTION_EVENT + (m_outOfValidity, m_isolationCorrectionTool->getCloseByIsoCorrection + (electrons, muons, photons, m_topoEtConeModel)); + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/KinematicHistAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/KinematicHistAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ab71365c73ad04500a6f0125388b29a7167da4c5 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/KinematicHistAlg.cxx @@ -0,0 +1,110 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/KinematicHistAlg.h> + +#include <RootCoreUtils/StringUtil.h> +#include <TH1.h> + +// +// method implementations +// + +namespace CP +{ + KinematicHistAlg :: + KinematicHistAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("histPattern", m_histPattern, "the pattern for histogram names"); + } + + + + StatusCode KinematicHistAlg :: + initialize () + { + m_systematicsList.addHandle (m_inputHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode KinematicHistAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + const xAOD::IParticleContainer *input = nullptr; + ANA_CHECK (m_inputHandle.retrieve (input, sys)); + + auto histIter = m_hist.find (sys); + if (histIter == m_hist.end()) + { + std::string name; + HistGroup group; + + name = RCU::substitute (m_histPattern, "%VAR%", "multiplicity"); + name = makeSystematicsName (name, sys); + ANA_CHECK (book (TH1F (name.c_str(), "multiplicity", 20, 0, 20))); + group.multiplicity = hist (name); + + m_hist.insert (std::make_pair (sys, group)); + histIter = m_hist.find (sys); + assert (histIter != m_hist.end()); + } + + std::size_t count = 0; + for (std::size_t iter = 0; iter != input->size(); ++ iter) + { + const xAOD::IParticle *particle = (*input)[iter]; + if (m_preselection.getBool (*particle)) + { + while (histIter->second.perObject.size() <= count) + { + std::string name; + HistSubgroup group; + + name = RCU::substitute (m_histPattern, "%VAR%", "pt" + std::to_string(histIter->second.perObject.size())); + name = makeSystematicsName (name, sys); + ANA_CHECK (book (TH1F (name.c_str(), "pt", 20, 0, 200e3))); + group.pt = hist (name); + + name = RCU::substitute (m_histPattern, "%VAR%", "eta" + std::to_string(histIter->second.perObject.size())); + name = makeSystematicsName (name, sys); + ANA_CHECK (book (TH1F (name.c_str(), "eta", 20, -5, 5))); + group.eta = hist (name); + + name = RCU::substitute (m_histPattern, "%VAR%", "phi" + std::to_string(histIter->second.perObject.size())); + name = makeSystematicsName (name, sys); + ANA_CHECK (book (TH1F (name.c_str(), "phi", 20, -M_PI, M_PI))); + group.phi = hist (name); + + histIter->second.perObject.push_back (group); + } + + HistSubgroup& group = histIter->second.perObject[count]; + + group.pt->Fill (particle->pt()); + group.eta->Fill (particle->eta()); + group.phi->Fill (particle->phi()); + count += 1; + } + } + + histIter->second.multiplicity->Fill (count); + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/ObjectCutFlowHistAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/ObjectCutFlowHistAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ff58bd5a78a3b99531c6db0ad20650459665f350 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/ObjectCutFlowHistAlg.cxx @@ -0,0 +1,136 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/ObjectCutFlowHistAlg.h> + +#include <RootCoreUtils/StringUtil.h> +#include <TH1.h> + +// +// method implementations +// + +namespace CP +{ + ObjectCutFlowHistAlg :: + ObjectCutFlowHistAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("histPattern", m_histPattern, "the pattern for histogram names"); + + declareProperty ("selection", m_selection, "the list of selection decorations"); + declareProperty ("selectionNCuts", m_selectionNCuts, "the number of cuts for each selection decoration"); + } + + + + StatusCode ObjectCutFlowHistAlg :: + initialize () + { + m_systematicsList.addHandle (m_inputHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + + if (m_selectionNCuts.size() != m_selection.size()) + { + ANA_MSG_ERROR ("selection and selectionNCuts properties need to be the same size"); + return StatusCode::FAILURE; + } + + // Total label + m_labels.push_back ("total"); + + for (std::size_t iter = 0, end = m_selection.size(); iter != end; ++ iter) + { + const unsigned ncuts = m_selectionNCuts[iter]; + if (ncuts == 0) + { + ANA_MSG_ERROR ("all entries of selectionNCuts need to be greater than 0"); + return StatusCode::FAILURE; + } + if (ncuts > 8 * sizeof (SelectionType)) + { + ANA_MSG_ERROR ("entries in selectionNCuts need to be less or equal to " << (8 * sizeof (SelectionType))); + return StatusCode::FAILURE; + } + std::unique_ptr<ISelectionAccessor> accessor; + ANA_CHECK (makeSelectionAccessor (m_selection[iter], accessor)); + m_accessors.push_back (std::make_pair (std::move (accessor), ncuts)); + for (unsigned i = 1; i <= ncuts; i++) + { + m_labels.push_back (m_accessors.back().first->label() + std::to_string(i)); + } + m_allCutsNum += ncuts; + } + + return StatusCode::SUCCESS; + } + + + + StatusCode ObjectCutFlowHistAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + const xAOD::IParticleContainer *input = nullptr; + ANA_CHECK (m_inputHandle.retrieve (input, sys)); + + auto histIter = m_hist.find (sys); + if (histIter == m_hist.end()) + { + const std::string name + = makeSystematicsName (m_histPattern, sys); + + ANA_CHECK (book (TH1F (name.c_str(), "object cut flow", m_allCutsNum+1, 0, m_allCutsNum+1))); + + m_hist.insert (std::make_pair (sys, hist (name))); + histIter = m_hist.find (sys); + assert (histIter != m_hist.end()); + + for (unsigned i = 0; i < m_allCutsNum+1; i++) + { + histIter->second->GetXaxis()->SetBinLabel(i + 1, m_labels[i].c_str()); + } + } + + for (const xAOD::IParticle *particle : *input) + { + if (m_preselection.getBool (*particle)) + { + bool keep = true; + unsigned cutIndex = 1; + histIter->second->Fill (0); + for (const auto& accessor : m_accessors) + { + const auto selection = accessor.first->getBits (*particle); + for (unsigned index = 0, end = accessor.second; + index != end; ++ index, ++ cutIndex) + { + if (selection & (1 << index)) + { + histIter->second->Fill (cutIndex); + } else + { + keep = false; + break; + } + } + if (!keep) + break; + } + } + } + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/OverlapRemovalAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/OverlapRemovalAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..02d98dedbdcb07034df655447e8d0ee10b1197df --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/OverlapRemovalAlg.cxx @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/OverlapRemovalAlg.h> + +// +// method implementations +// + +namespace CP +{ + OverlapRemovalAlg :: + OverlapRemovalAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("overlapTool", m_overlapTool); + } + + + + StatusCode OverlapRemovalAlg :: + initialize () + { + ANA_CHECK (m_overlapTool.retrieve()); + if (m_electronsHandle) m_systematicsList.addHandle (m_electronsHandle); + if (m_muonsHandle) m_systematicsList.addHandle (m_muonsHandle); + if (m_jetsHandle) m_systematicsList.addHandle (m_jetsHandle); + if (m_tausHandle) m_systematicsList.addHandle (m_tausHandle); + if (m_photonsHandle) m_systematicsList.addHandle (m_photonsHandle); + if (m_fatJetsHandle) m_systematicsList.addHandle (m_fatJetsHandle); + ANA_CHECK (m_systematicsList.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode OverlapRemovalAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::ElectronContainer *electrons {nullptr}; + if (m_electronsHandle) + ANA_CHECK (m_electronsHandle.getCopy (electrons, sys)); + xAOD::MuonContainer *muons {nullptr}; + if (m_muonsHandle) + ANA_CHECK (m_muonsHandle.getCopy (muons, sys)); + xAOD::JetContainer *jets {nullptr}; + if (m_jetsHandle) + ANA_CHECK (m_jetsHandle.getCopy (jets, sys)); + xAOD::TauJetContainer *taus {nullptr}; + if (m_tausHandle) + ANA_CHECK (m_tausHandle.getCopy (taus, sys)); + xAOD::PhotonContainer *photons {nullptr}; + if (m_photonsHandle) + ANA_CHECK (m_photonsHandle.getCopy (photons, sys)); + xAOD::JetContainer *fatJets {nullptr}; + if (m_fatJetsHandle) + ANA_CHECK (m_fatJetsHandle.getCopy (fatJets, sys)); + + ATH_CHECK (m_overlapTool->removeOverlaps (electrons, muons, jets, taus, + photons, fatJets)); + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PMGTruthWeightAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PMGTruthWeightAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a3ee593b8d970b947eb06ba477386506e215bec6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PMGTruthWeightAlg.cxx @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/PMGTruthWeightAlg.h> + +// +// method implementations +// + +namespace CP +{ + PMGTruthWeightAlg :: + PMGTruthWeightAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_truthWeightTool ("PMGTools::PMGTruthWeightTool", this) + { + declareProperty ("truthWeightTool", m_truthWeightTool, "the truth weight tool"); + } + + + + StatusCode PMGTruthWeightAlg :: + initialize () + { + if (m_decoration.empty()) + { + ANA_MSG_ERROR ("no decoration name set"); + return StatusCode::FAILURE; + } + + ANA_CHECK (m_truthWeightTool.retrieve()); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_truthWeightTool->affectingSystematics())); + m_systematicsList.addHandle (m_eventInfoHandle); + ANA_CHECK (m_systematicsList.initialize()); + + return StatusCode::SUCCESS; + } + + + StatusCode PMGTruthWeightAlg :: + execute () + { + ANA_CHECK (m_decoration.preExecute (m_systematicsList)); + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode + { + ANA_CHECK (m_truthWeightTool->applySystematicVariation (sys)); + xAOD::EventInfo *eventInfo = nullptr; + ANA_CHECK (m_eventInfoHandle.getCopy (eventInfo, sys)); + + m_decoration.set (*eventInfo, m_truthWeightTool->getSysWeight (), sys); + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PileupReweightingAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PileupReweightingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..76432c7b31c9dd8c3e3d8590f1e234d995cdf9da --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PileupReweightingAlg.cxx @@ -0,0 +1,119 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/PileupReweightingAlg.h> + +// +// method implementations +// + +namespace CP +{ + PileupReweightingAlg :: + PileupReweightingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_pileupReweightingTool ("CP::PileupReweightingTool", this) + { + declareProperty ("pileupReweightingTool", m_pileupReweightingTool, "the pileup reweighting tool we apply"); + declareProperty ("correctedScaledAverageMuDecoration", m_correctedScaledAverageMuDecoration, "the decoration for the corrected and scaled average interactions per crossing"); + declareProperty ("correctedActualMuDecoration", m_correctedActualMuDecoration, "the decoration for the corrected actual interactions per crossing"); + declareProperty ("correctedScaledActualMuDecoration", m_correctedScaledActualMuDecoration, "the decoration for the corrected and scaled actual interactions per crossing"); + } + + + + StatusCode PileupReweightingAlg :: + initialize () + { + if (!m_correctedScaledAverageMuDecoration.empty()) + { + m_correctedScaledAverageMuAccessor = std::make_unique<SG::AuxElement::Accessor<float> > (m_correctedScaledAverageMuDecoration); + } + if (!m_correctedActualMuDecoration.empty()) + { + m_correctedActualMuAccessor = std::make_unique<SG::AuxElement::Accessor<float> > (m_correctedActualMuDecoration); + } + if (!m_correctedScaledActualMuDecoration.empty()) + { + m_correctedScaledActualMuAccessor = std::make_unique<SG::AuxElement::Accessor<float> > (m_correctedScaledActualMuDecoration); + } + + ANA_CHECK (m_pileupReweightingTool.retrieve()); + m_systematicsList.addHandle (m_eventInfoHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_pileupReweightingTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode PileupReweightingAlg :: + execute () + { + unsigned int nominalRandomRunNumber{}; + + ANA_CHECK (m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_pileupReweightingTool->applySystematicVariation (sys)); + xAOD::EventInfo *eventInfo = nullptr; + ANA_CHECK (m_eventInfoHandle.getCopy (eventInfo, sys)); + + ATH_CHECK (m_pileupReweightingTool->apply (*eventInfo)); + + // Add additional decorations + if (m_correctedScaledAverageMuAccessor) + { + (*m_correctedScaledAverageMuAccessor) (*eventInfo) + = m_pileupReweightingTool->getCorrectedAverageInteractionsPerCrossing (*eventInfo, true); + } + + if (m_correctedActualMuAccessor) + { + (*m_correctedActualMuAccessor) (*eventInfo) + = m_pileupReweightingTool->getCorrectedActualInteractionsPerCrossing (*eventInfo); + } + + if (m_correctedScaledActualMuAccessor) + { + (*m_correctedScaledActualMuAccessor) (*eventInfo) + = m_pileupReweightingTool->getCorrectedActualInteractionsPerCrossing (*eventInfo, true); + } + + //--- PRWHash to recalculate PU weights using analysis ntuples + //--- https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ExtendedPileupReweighting#Using_PRWHash_to_change_pileup_w + + if (eventInfo->eventType (xAOD::EventInfo::IS_SIMULATION)) + { + eventInfo->auxdata<ULong64_t>("PRWHash") + = m_pileupReweightingTool->getPRWHash (*eventInfo); + } + + // In the case of nominal systematics store the RandomRunNumber for + // later. Event info can not be decorated at this point as the + // decoration will then also be present in subsequent shallow copies. + if (sys.empty()) + { + nominalRandomRunNumber = eventInfo->auxdecor<unsigned int> ("RandomRunNumber"); + } + + return StatusCode::SUCCESS; + })); + + // Must decorate the actual instance in the event store for + // the electron tool to work. The decoration is done out of the loop + // to avoid it being present in all subsequent shallow copies. + evtStore()->retrieve<const xAOD::EventInfo>("EventInfo") + ->auxdecor<unsigned int>("RandomRunNumber") = nominalRandomRunNumber; + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListDumperAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListDumperAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5ed2c57b46ac4e98bcc4d4512fbe9c83b68f745e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListDumperAlg.cxx @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +// +// includes +// + +#include <AsgAnalysisAlgorithms/SysListDumperAlg.h> +#include <SystematicsHandles/Helpers.h> +#include <TH1.h> + +// +// method implementations +// + +namespace CP +{ + SysListDumperAlg :: + SysListDumperAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("histogramName", m_histogramName, "the name of the output histogram"); + } + + + + StatusCode SysListDumperAlg :: + initialize () + { + if (m_histogramName.empty()) + { + ANA_MSG_ERROR ("histogram name should not be empty"); + return StatusCode::FAILURE; + } + + ANA_CHECK (m_systematicsList.initialize()); + + return StatusCode::SUCCESS; + } + + + + StatusCode SysListDumperAlg :: + execute () + { + if (!m_firstEvent) + { + return StatusCode::SUCCESS; + } + + m_firstEvent = false; + + const std::unordered_set<CP::SystematicSet> systematics = m_systematicsList.systematicsVector(); + + ANA_CHECK (book (TH1F (m_histogramName.c_str(), "systematics", systematics.size(), 0, systematics.size()))); + TH1 *histogram = hist (m_histogramName); + + int i = 1; + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode + { + std::string name = sys.name(); + if (name.empty()) + name = nominalSystematicsName(); + + histogram->GetXaxis()->SetBinLabel(i, name.c_str()); + i++; + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListLoaderAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListLoaderAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..068697fa1fb374f1216c17e5d169b00576b85d35 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListLoaderAlg.cxx @@ -0,0 +1,137 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <regex> + +#include <AsgAnalysisAlgorithms/SysListLoaderAlg.h> + +#include <AsgTools/MessageCheck.h> +#include <PATInterfaces/MakeSystematicsVector.h> +#include <PATInterfaces/SystematicRegistry.h> + +// +// method implementations +// + +namespace CP +{ + SysListLoaderAlg :: + SysListLoaderAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("systematicsName", m_systematicsName, "the name of the systematics in the event store"); + declareProperty ("systematicsList", m_systematicsList, "the list of systematics to run"); + declareProperty ("systematicsRegex", m_systematicsRegex, "systematics filter regex"); + declareProperty ("sigmaRecommended", m_sigmaRecommended, "the sigma with which to run recommended systematics"); + } + + + + StatusCode SysListLoaderAlg :: + initialize () + { + if (m_systematicsName.empty()) + { + ANA_MSG_ERROR ("no name configured for the systematics list"); + return StatusCode::FAILURE; + } + + if (!std::isfinite (m_sigmaRecommended) || + m_sigmaRecommended < 0) + { + ANA_MSG_ERROR ("invalid value for sigmaRecommended: " << m_sigmaRecommended); + return StatusCode::FAILURE; + } + + if (m_sigmaRecommended != 0) + { + if (!m_systematicsList.empty()) + { + ANA_MSG_ERROR ("can't specify both sigmaRecommended and systematicsList"); + return StatusCode::FAILURE; + } + } else if (m_systematicsList.empty()) + { + // take an empty property as running just the central + // systematics set. implication is that you can't really run + // doing nothing, but that ought to be Ok. + m_systematicsVector.push_back (CP::SystematicSet ()); + } else + { + for (const std::string& sysName : m_systematicsList) + m_systematicsVector.push_back (CP::SystematicSet (sysName)); + } + return StatusCode::SUCCESS; + } + + + + StatusCode SysListLoaderAlg :: + execute () + { + if (m_firstEvent) + { + m_firstEvent = false; + const CP::SystematicSet recommended + = CP::SystematicRegistry::getInstance().recommendedSystematics(); + const CP::SystematicSet affecting + = CP::SystematicRegistry::getInstance().globalSystematics(); + + for (const CP::SystematicVariation& mysys : affecting) + { + // this logic checks whether a systematic is recommended and + // affecting, or only affecting. if it is only the later, it + // reports the systematic in parenthesis to set it apart. + if (recommended.find (mysys) == recommended.end()) + ANA_MSG_INFO ("found systematic: (" << mysys << ")"); + else + ANA_MSG_INFO ("found systematic: " << mysys); + } + bool error = false; + for (const CP::SystematicVariation& mysys : recommended) + { + if (affecting.find (mysys) == affecting.end()) + { + ANA_MSG_ERROR ("systematic is only registered as recommended, not affecting: " << mysys); + error = true; + } + } + if (error) + return StatusCode::FAILURE; + + + if (m_systematicsVector.empty()) + { + assert (m_sigmaRecommended > 0); + CP::MakeSystematicsVector sys; + sys.setSigma (m_sigmaRecommended); + sys.calc (recommended); + + std::regex expr (m_systematicsRegex); + for (const CP::SystematicSet& mysys : sys.result("")) + { + if (!regex_match (mysys.name(), expr)) + { + ANA_MSG_INFO ("skipping systematic: " << mysys.name()); + } else { + ANA_MSG_INFO ("configuring systematic: " << mysys.name()); + m_systematicsVector.push_back (mysys); + } + } + } + } + + std::unique_ptr<SysListType> list (new SysListType (m_systematicsVector)); + ANA_CHECK (evtStore()->record (list.release(), m_systematicsName)); + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/TreeFillerAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/TreeFillerAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a91a87021a62d3aa58519789d503de0f7fbbac00 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/TreeFillerAlg.cxx @@ -0,0 +1,60 @@ +// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +// Local include(s): +#include "AsgAnalysisAlgorithms/TreeFillerAlg.h" + +// EDM include(s): +#include "AthContainersInterfaces/IAuxTypeVectorFactory.h" +#include "AthContainers/AuxElement.h" +#include "AthContainers/AuxVectorBase.h" +#include "AthContainers/normalizedTypeinfoName.h" + +// Framework include(s): +#include "SystematicsHandles/Helpers.h" + +// ROOT include(s): +#include <TClass.h> +#include <TTree.h> +#include <TBranch.h> +#include <TVirtualCollectionProxy.h> + +// System include(s): +#include <regex> +#include <algorithm> +#include <functional> +#include <sstream> + +namespace CP { + + TreeFillerAlg::TreeFillerAlg( const std::string& name, + ISvcLocator* svcLoc ) + : EL::AnaAlgorithm( name, svcLoc ) { + + // Declare the algorithm's properties. + declareProperty( "TreeName", m_treeName = "physics", + "Name of the tree to write" ); + } + + StatusCode TreeFillerAlg::execute() { + // get the output tree for the first time + if( ! m_tree ) { + m_tree = tree( m_treeName ); + } + + if( ! m_tree ) { + ATH_MSG_ERROR( "Could not find output tree \"" << m_treeName + << "\"" ); + return StatusCode::FAILURE; + } + + // Fill the tree. + if( m_tree->Fill() < 0 ) { + ATH_MSG_ERROR( "Error while filling TTree" ); + return StatusCode::FAILURE; + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/TreeMakerAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/TreeMakerAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3e41601569439c009ad521ac17cd9e5a3061828d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/TreeMakerAlg.cxx @@ -0,0 +1,44 @@ +// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +// Local include(s): +#include "AsgAnalysisAlgorithms/TreeMakerAlg.h" + +// ROOT include(s): +#include <TTree.h> + +namespace CP { + + TreeMakerAlg::TreeMakerAlg( const std::string& name, + ISvcLocator* svcLoc ) + : EL::AnaAlgorithm( name, svcLoc ) { + + // Declare the algorithm's properties. + declareProperty( "TreeName", m_treeName = "physics", + "Name of the tree to write" ); + declareProperty( "TreeAutoFlush", m_treeAutoFlush = 200, + "AutoFlush value for the output tree" ); + } + + StatusCode TreeMakerAlg::execute() { + if( m_treeConfigured ) { + return StatusCode::SUCCESS; + } + + // Create the output tree. + ATH_CHECK( book( TTree( m_treeName.c_str(), "xAOD->NTuple tree" ) ) ); + TTree *mytree { tree( m_treeName ) }; + if( ! mytree ) { + ATH_MSG_ERROR( "Could not create output tree \"" << m_treeName + << "\"" ); + return StatusCode::FAILURE; + } + mytree->SetAutoFlush( m_treeAutoFlush ); + ATH_MSG_INFO( "Created xAOD->NTuple tree: " << m_treeName ); + + m_treeConfigured = true; + + // Return gracefully. + return StatusCode::SUCCESS; + } + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..5d99638fa074f9ba76fab67d9d16cbeafeff43da --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py @@ -0,0 +1,217 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack +# @author Tadej Novak + +from AnaAlgorithm.AlgSequence import AlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm + +def makeOverlapSequence (dataType) : + algSeq = AlgSequence() + + # Skip events with no primary vertex: + algSeq += createAlgorithm( 'CP::VertexSelectionAlg', + 'PrimaryVertexSelectorAlg' ) + algSeq.PrimaryVertexSelectorAlg.VertexContainer = 'PrimaryVertices' + algSeq.PrimaryVertexSelectorAlg.MinVertices = 1 + + # Set up the systematics loader/handler algorithm: + algSeq += createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + algSeq.SysLoaderAlg.sigmaRecommended = 1 + + # Include, and then set up the pileup analysis sequence: + from AsgAnalysisAlgorithms.PileupAnalysisSequence import \ + makePileupAnalysisSequence + pileupSequence = makePileupAnalysisSequence( dataType ) + pileupSequence.configure( inputName = 'EventInfo', outputName = 'EventInfo_%SYS%' ) + algSeq += pileupSequence + + # Include, and then set up the electron analysis sequence: + from EgammaAnalysisAlgorithms.ElectronAnalysisSequence import \ + makeElectronAnalysisSequence + electronSequence = makeElectronAnalysisSequence( dataType, 'LooseLHElectron.GradientLoose', + recomputeLikelihood = True ) + electronSequence.configure( inputName = 'Electrons', + outputName = 'AnalysisElectrons_%SYS%' ) + algSeq += electronSequence + + # Include, and then set up the photon analysis sequence: + from EgammaAnalysisAlgorithms.PhotonAnalysisSequence import \ + makePhotonAnalysisSequence + photonSequence = makePhotonAnalysisSequence( dataType, 'Tight.FixedCutTight', recomputeIsEM = True ) + photonSequence.configure( inputName = 'Photons', + outputName = 'AnalysisPhotons_%SYS%' ) + algSeq += photonSequence + + # Include, and then set up the muon analysis algorithm sequence: + from MuonAnalysisAlgorithms.MuonAnalysisSequence import makeMuonAnalysisSequence + muonSequence = makeMuonAnalysisSequence( dataType, 'Tight.Iso' ) + muonSequence.configure( inputName = 'Muons', + outputName = 'AnalysisMuons_%SYS%' ) + algSeq += muonSequence + + # Include, and then set up the jet analysis algorithm sequence: + jetContainer = 'AntiKt4EMPFlowJets' + from JetAnalysisAlgorithms.JetAnalysisSequence import makeJetAnalysisSequence + jetSequence = makeJetAnalysisSequence( dataType, jetContainer ) + jetSequence.configure( inputName = jetContainer, + outputName = 'AnalysisJets_%SYS%' ) + algSeq += jetSequence + + # Include, and then set up the tau analysis algorithm sequence: + from TauAnalysisAlgorithms.TauAnalysisSequence import makeTauAnalysisSequence + tauSequence = makeTauAnalysisSequence( dataType, 'Tight' ) + tauSequence.configure( inputName = 'TauJets', + outputName = 'AnalysisTauJets_%SYS%' ) + algSeq += tauSequence + + # Include, and then set up the overlap analysis algorithm sequence: + from AsgAnalysisAlgorithms.OverlapAnalysisSequence import \ + makeOverlapAnalysisSequence + overlapSequence = makeOverlapAnalysisSequence( dataType, doMuPFJetOR=True, enableCutflow=True ) + overlapSequence.configure( + inputName = { + 'electrons' : 'AnalysisElectrons_%SYS%', + 'photons' : 'AnalysisPhotons_%SYS%', + 'muons' : 'AnalysisMuons_%SYS%', + 'jets' : 'AnalysisJets_%SYS%', + 'taus' : 'AnalysisTauJets_%SYS%' }, + outputName = { + 'electrons' : 'AnalysisElectronsOR_%SYS%', + 'photons' : 'AnalysisPhotonsOR_%SYS%', + 'muons' : 'AnalysisMuonsOR_%SYS%', + 'jets' : 'AnalysisJetsOR_%SYS%', + 'taus' : 'AnalysisTauJetsOR_%SYS%' }, + affectingSystematics = { + 'electrons' : electronSequence.affectingSystematics(), + 'photons' : photonSequence.affectingSystematics(), + 'muons' : muonSequence.affectingSystematics(), + 'jets' : jetSequence.affectingSystematics(), + 'taus' : tauSequence.affectingSystematics() } ) + algSeq += overlapSequence + + # Set up an ntuple to check the job with: + treeMaker = createAlgorithm( 'CP::TreeMakerAlg', 'TreeMaker' ) + treeMaker.TreeName = 'particles' + algSeq += treeMaker + ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMaker' ) + ntupleMaker.TreeName = 'particles' + ntupleMaker.Branches = [ + 'EventInfo.runNumber -> runNumber', + 'EventInfo.eventNumber -> eventNumber', + 'AnalysisElectrons_%SYS%.eta -> el_%SYS%_eta', + 'AnalysisElectrons_%SYS%.phi -> el_%SYS%_phi', + 'AnalysisElectrons_%SYS%.pt -> el_%SYS%_pt', + 'AnalysisElectronsOR_%SYS%.eta -> el_OR_%SYS%_eta', + 'AnalysisElectronsOR_%SYS%.phi -> el_OR_%SYS%_phi', + 'AnalysisElectronsOR_%SYS%.pt -> el_OR_%SYS%_pt', + 'AnalysisPhotons_%SYS%.eta -> ph_%SYS%_eta', + 'AnalysisPhotons_%SYS%.phi -> ph_%SYS%_phi', + 'AnalysisPhotons_%SYS%.pt -> ph_%SYS%_pt', + 'AnalysisPhotonsOR_%SYS%.eta -> ph_OR_%SYS%_eta', + 'AnalysisPhotonsOR_%SYS%.phi -> ph_OR_%SYS%_phi', + 'AnalysisPhotonsOR_%SYS%.pt -> ph_OR_%SYS%_pt', + 'AnalysisMuons_%SYS%.eta -> mu_%SYS%_eta', + 'AnalysisMuons_%SYS%.phi -> mu_%SYS%_phi', + 'AnalysisMuons_%SYS%.pt -> mu_%SYS%_pt', + 'AnalysisMuonsOR_%SYS%.eta -> mu_OR_%SYS%_eta', + 'AnalysisMuonsOR_%SYS%.phi -> mu_OR_%SYS%_phi', + 'AnalysisMuonsOR_%SYS%.pt -> mu_OR_%SYS%_pt', + 'AnalysisJets_%SYS%.eta -> jet_%SYS%_eta', + 'AnalysisJets_%SYS%.phi -> jet_%SYS%_phi', + 'AnalysisJets_%SYS%.pt -> jet_%SYS%_pt', + 'AnalysisJetsOR_%SYS%.eta -> jet_OR_%SYS%_eta', + 'AnalysisJetsOR_%SYS%.phi -> jet_OR_%SYS%_phi', + 'AnalysisJetsOR_%SYS%.pt -> jet_OR_%SYS%_pt', + 'AnalysisTauJets_%SYS%.eta -> tau_%SYS%_eta', + 'AnalysisTauJets_%SYS%.phi -> tau_%SYS%_phi', + 'AnalysisTauJets_%SYS%.pt -> tau_%SYS%_pt', + 'AnalysisTauJetsOR_%SYS%.eta -> tau_OR_%SYS%_eta', + 'AnalysisTauJetsOR_%SYS%.phi -> tau_OR_%SYS%_phi', + 'AnalysisTauJetsOR_%SYS%.pt -> tau_OR_%SYS%_pt' ] + ntupleMaker.systematicsRegex = '.*' + algSeq += ntupleMaker + treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' ) + treeFiller.TreeName = 'particles' + algSeq += treeFiller + + return algSeq + + +def makeEventAlgorithmsSequence (dataType) : + + # Config: + GRLFiles = ['GoodRunsLists/data16_13TeV/20180129/data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml'] + + algSeq = AlgSequence() + + # Set up the systematics loader/handler algorithm: + algSeq += createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + algSeq.SysLoaderAlg.sigmaRecommended = 1 + + # Include, and then set up the pileup analysis sequence: + from AsgAnalysisAlgorithms.EventSelectionAnalysisSequence import \ + makeEventSelectionAnalysisSequence + eventSelectionSequence = \ + makeEventSelectionAnalysisSequence( dataType, userGRLFiles=GRLFiles ) + algSeq += eventSelectionSequence + + # Set up an ntuple to check the job with: + treeMaker = createAlgorithm( 'CP::TreeMakerAlg', 'TreeMaker' ) + treeMaker.TreeName = 'events' + algSeq += treeMaker + ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMaker' ) + ntupleMaker.TreeName = 'events' + ntupleMaker.Branches = [ + 'EventInfo.runNumber -> runNumber', + 'EventInfo.eventNumber -> eventNumber', + ] + ntupleMaker.systematicsRegex = '.*' + algSeq += ntupleMaker + treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' ) + treeFiller.TreeName = 'events' + algSeq += treeFiller + + return algSeq + + +def makeGeneratorAlgorithmsSequence (dataType) : + + algSeq = AlgSequence() + + # Set up the systematics loader/handler algorithm: + algSeq += createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + algSeq.SysLoaderAlg.sigmaRecommended = 1 + + # Include, and then set up the pileup analysis sequence (to make a copy): + from AsgAnalysisAlgorithms.PileupAnalysisSequence import \ + makePileupAnalysisSequence + pileupSequence = makePileupAnalysisSequence( dataType ) + pileupSequence.configure( inputName = 'EventInfo', outputName = 'EventInfo_%SYS%' ) + algSeq += pileupSequence + + # Include, and then set up the generator analysis sequence: + from AsgAnalysisAlgorithms.GeneratorAnalysisSequence import \ + makeGeneratorAnalysisSequence + generatorSequence = makeGeneratorAnalysisSequence( dataType, saveCutBookkeepers=True, runNumber=284500, cutBookkeepersSystematics=True ) + generatorSequence.configure( inputName = 'EventInfo_%SYS%', outputName = {} ) + algSeq += generatorSequence + + # Set up an ntuple to check the job with: + treeMaker = createAlgorithm( 'CP::TreeMakerAlg', 'TreeMaker' ) + treeMaker.TreeName = 'events' + algSeq += treeMaker + ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMaker' ) + ntupleMaker.TreeName = 'events' + ntupleMaker.Branches = [ + 'EventInfo_NOSYS.runNumber -> runNumber', + 'EventInfo_NOSYS.eventNumber -> eventNumber', + 'EventInfo_NOSYS.generatorWeight_%SYS% -> generatorWeight_%SYS%', + ] + ntupleMaker.systematicsRegex = '.*' + algSeq += ntupleMaker + treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' ) + treeFiller.TreeName = 'events' + algSeq += treeFiller + + return algSeq diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/EventSelectionAnalysisSequence.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/EventSelectionAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..94f78652dea7d12a7272b787194301822d63fe79 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/EventSelectionAnalysisSequence.py @@ -0,0 +1,56 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + + +def makeEventSelectionAnalysisSequence( dataType, + runPrimaryVertexSelection = True, + runEventCleaning = False, + userGRLFiles = []): + """Create a basic event selection analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + runPrimaryVertexSelection -- whether to run primary vertex selection + runEventCleaning -- wether to run event cleaning + userGRLFiles -- a list of GRL files to select data from + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "EventSelectionAnalysisSequence" ) + + if dataType == 'data': + grlFiles = userGRLFiles[:] + + # Set up the GRL selection: + alg = createAlgorithm( 'GRLSelectorAlg', 'GRLSelectorAlg' ) + addPrivateTool( alg, 'Tool', 'GoodRunsListSelectionTool' ) + alg.Tool.GoodRunsListVec = grlFiles + + seq.append( alg, inputPropName = None ) + + # Skip events with no primary vertex: + if runPrimaryVertexSelection: + alg = createAlgorithm( 'CP::VertexSelectionAlg', + 'PrimaryVertexSelectorAlg' ) + alg.VertexContainer = 'PrimaryVertices' + alg.MinVertices = 1 + + seq.append( alg, inputPropName = None ) + + # Set up the event cleaning selection: + if runEventCleaning: + alg = createAlgorithm( 'CP::EventFlagSelectionAlg', 'EventFlagSelectorAlg' ) + alg.selectionFlags = ['DFCommonJets_eventClean_LooseBad,as_char'] + + seq.append( alg, inputPropName = None ) + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/GeneratorAnalysisSequence.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/GeneratorAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..0a8e7ca75176b5147c1f78f1f34fd19b229f9b52 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/GeneratorAnalysisSequence.py @@ -0,0 +1,47 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + +def makeGeneratorAnalysisSequence( dataType, + saveCutBookkeepers=False, + runNumber=0, + cutBookkeepersSystematics=False ): + """Create a generator analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("mc" or "afii") + saveCutBookkeepers -- save cut bokkeepers information into output file + runNumber -- MC run number + cutBookkeepersSystematics -- store CutBookkeepers systematics + """ + + if dataType not in ["mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + if saveCutBookkeepers and not runNumber: + raise ValueError ("invalid run number: " + 0) + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "GeneratorAnalysisSequence" ) + + # Set up the CutBookkeepers algorithm: + if saveCutBookkeepers: + alg = createAlgorithm('CP::AsgCutBookkeeperAlg', 'CutBookkeeperAlg') + alg.runNumber = runNumber + alg.enableSystematics = cutBookkeepersSystematics + addPrivateTool( alg, 'truthWeightTool', 'PMGTools::PMGTruthWeightTool' ) + seq.append( alg, inputPropName = None ) + + # Set up the weights algorithm: + alg = createAlgorithm( 'CP::PMGTruthWeightAlg', 'PMGTruthWeightAlg' ) + addPrivateTool( alg, 'truthWeightTool', 'PMGTools::PMGTruthWeightTool' ) + alg.decoration = 'generatorWeight_%SYS%' + alg.decorationRegex = '(^GEN_.*)' + + seq.append( alg, inputPropName = 'eventInfo', + affectingSystematics = '(^GEN_.*)' ) + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/OverlapAnalysisSequence.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/OverlapAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..d530ba9bb34aa136f2d2de60dea624f0211cfcb0 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/OverlapAnalysisSequence.py @@ -0,0 +1,287 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + +def makeOverlapAnalysisSequence( dataType, + inputLabel = '', outputLabel = 'passesOR', + linkOverlapObjects = False, doMuPFJetOR=False, + doEleEleOR = False, doElectrons = True, + doMuons = True, doJets = True, doTaus = True, + doPhotons = True, doFatJets = False, + bJetLabel = '', + boostedLeptons = False, + postfix = '', + enableCutflow = False ): + """Function creating the overlap removal algorithm sequence + + The function sets up a multi-input/multi-output analysis algorithm sequnce, + which needs to be used in a quite particular way. First off you need to set + the arguments of this function correctly. + + Then, you need to call the configure(...) method on the algorithm sequence + returned by this function in the following way: + + overlapSequence.configure( + inputName = { + 'electrons' : 'AnalysisElectrons_%SYS%', + 'photons' : 'AnalysisPhotons_%SYS%', + 'muons' : 'AnalysisMuons_%SYS%', + 'jets' : 'AnalysisJets_%SYS%', + 'taus' : 'AnalysisTauJets_%SYS%' }, + outputName = { + 'electrons' : 'AnalysisElectronsOR_%SYS%', + 'photons' : 'AnalysisPhotonsOR_%SYS%', + 'muons' : 'AnalysisMuonsOR_%SYS%', + 'jets' : 'AnalysisJetsOR_%SYS%', + 'taus' : 'AnalysisTauJetsOR_%SYS%' }, + affectingSystematics = { + 'electrons' : '(^$)|(^EG_.*)|(^EL_.*)', + 'photons' : '(^$)|(^EG_.*)|(^PH_.*)', + 'muons' : '(^$)|(^MUON_.*)', + 'jets' : '(^$)|(^JET_.*)', + 'taus' : '(^$)|(^TAUS_.*)' } ) + + Where: + - You need to provide input and output names in pairs, you must not skip + specifying an output name if you specified an input name, and vice + versa. + - You only define inputs/outputs that your analysis uses. The "labels" of + the possible inputs/outputs are: "electrons", "photons", "muons", + "jets", "taus" and "fatJets". + - You have to define with affectingSystematics which systematic variations + are affecting the containers you passed to the sequence as inputs. If + left empty, the configuration assumes that no systematic variation is + affecting the input(s). + + Function keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + inputLabel -- Any possible label to pick up the selected objects with. If + left empty, all objects from the input containers are + considered. + outputLabel -- Decoration put on the output variables. Set to "true" for + objects passing the overlap removal. + linkOverlapObjects -- Set up an element link between overlapping objects + doMuPFJetOR -- Set up overlap removal for PFlow jets that are acutally muons + doEleEleOR -- Set up electron-electron overlap removal + doXXXX -- these flags enable/disable object types to + configure tools for: doElectrons, doMuons, + doJets, doTaus, doPhotons, doFatJets. + bJetLabel -- Flag to select b-jets with. If left empty, no b-jets are used + in the overlap removal. + boostedLeptons -- Set to True to enable boosted lepton overlap removal + enableCutflow -- Whether or not to dump the cutflow + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( 'OverlapAnalysisSequence' + postfix ) + + # Create the overlap removal algorithm: + alg = createAlgorithm( 'CP::OverlapRemovalAlg', 'OverlapRemovalAlg' + postfix ) + + # Create its main tool, and set its basic properties: + addPrivateTool( alg, 'overlapTool', 'ORUtils::OverlapRemovalTool' ) + alg.overlapTool.InputLabel = inputLabel + alg.overlapTool.OutputLabel = outputLabel + + # By default the OverlapRemovalTool would flag objects that need to be + # suppressed, with a "true" value. But since the analysis algorithms expect + # the opposite behaviour from selection flags, we need to tell the tool + # explicitly to use the "true" flag on objects that pass the overlap + # removal. + alg.overlapTool.OutputPassValue = True + + # Set up overlap removal for PFlow jets that are acutally muons, if requested. + if doMuPFJetOR: + addPrivateTool( alg, 'overlapTool.MuPFJetORT', + 'ORUtils::MuPFJetOverlapTool' ) + alg.overlapTool.MuPFJetORT.InputLabel = inputLabel + alg.overlapTool.MuPFJetORT.OutputLabel = outputLabel + alg.overlapTool.MuPFJetORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.MuPFJetORT.OutputPassValue = True + pass + + # Set up the electron-electron overlap removal, if requested. + if doElectrons and doEleEleOR: + addPrivateTool( alg, 'overlapTool.EleEleORT', + 'ORUtils::EleEleOverlapTool' ) + alg.overlapTool.EleEleORT.InputLabel = inputLabel + alg.overlapTool.EleEleORT.OutputLabel = outputLabel + alg.overlapTool.EleEleORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.EleEleORT.OutputPassValue = True + pass + + # Set up the electron-muon overlap removal. + if doElectrons and doMuons: + addPrivateTool( alg, 'overlapTool.EleMuORT', + 'ORUtils::EleMuSharedTrkOverlapTool' ) + alg.overlapTool.EleMuORT.InputLabel = inputLabel + alg.overlapTool.EleMuORT.OutputLabel = outputLabel + alg.overlapTool.EleMuORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.EleMuORT.OutputPassValue = True + pass + + # Set up the electron-(narrow-)jet overlap removal. + if doElectrons and doJets: + addPrivateTool( alg, 'overlapTool.EleJetORT', + 'ORUtils::EleJetOverlapTool' ) + alg.overlapTool.EleJetORT.InputLabel = inputLabel + alg.overlapTool.EleJetORT.OutputLabel = outputLabel + alg.overlapTool.EleJetORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.EleJetORT.BJetLabel = bJetLabel + alg.overlapTool.EleJetORT.UseSlidingDR = boostedLeptons + alg.overlapTool.EleJetORT.OutputPassValue = True + pass + + # Set up the muon-(narrow-)jet overlap removal. + if doMuons and doJets: + addPrivateTool( alg, 'overlapTool.MuJetORT', + 'ORUtils::MuJetOverlapTool' ) + alg.overlapTool.MuJetORT.InputLabel = inputLabel + alg.overlapTool.MuJetORT.OutputLabel = outputLabel + alg.overlapTool.MuJetORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.MuJetORT.BJetLabel = bJetLabel + alg.overlapTool.MuJetORT.UseSlidingDR = boostedLeptons + alg.overlapTool.MuJetORT.OutputPassValue = True + pass + + # Set up the tau-electron overlap removal. + if doTaus and doElectrons: + addPrivateTool( alg, 'overlapTool.TauEleORT', + 'ORUtils::DeltaROverlapTool' ) + alg.overlapTool.TauEleORT.InputLabel = inputLabel + alg.overlapTool.TauEleORT.OutputLabel = outputLabel + alg.overlapTool.TauEleORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.TauEleORT.DR = 0.2 + alg.overlapTool.TauEleORT.OutputPassValue = True + pass + + # Set up the tau-muon overlap removal. + if doTaus and doMuons: + addPrivateTool( alg, 'overlapTool.TauMuORT', + 'ORUtils::DeltaROverlapTool' ) + alg.overlapTool.TauMuORT.InputLabel = inputLabel + alg.overlapTool.TauMuORT.OutputLabel = outputLabel + alg.overlapTool.TauMuORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.TauMuORT.DR = 0.2 + alg.overlapTool.TauMuORT.OutputPassValue = True + pass + + # Set up the tau-(narrow-)jet overlap removal. + if doTaus and doJets: + addPrivateTool( alg, 'overlapTool.TauJetORT', + 'ORUtils::DeltaROverlapTool' ) + alg.overlapTool.TauJetORT.InputLabel = inputLabel + alg.overlapTool.TauJetORT.OutputLabel = outputLabel + alg.overlapTool.TauJetORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.TauJetORT.DR = 0.2 + alg.overlapTool.TauJetORT.OutputPassValue = True + pass + + # Set up the photon-electron overlap removal. + if doPhotons and doElectrons: + addPrivateTool( alg, 'overlapTool.PhoEleORT', + 'ORUtils::DeltaROverlapTool' ) + alg.overlapTool.PhoEleORT.InputLabel = inputLabel + alg.overlapTool.PhoEleORT.OutputLabel = outputLabel + alg.overlapTool.PhoEleORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.PhoEleORT.OutputPassValue = True + pass + + # Set up the photon-muon overlap removal. + if doPhotons and doMuons: + addPrivateTool( alg, 'overlapTool.PhoMuORT', + 'ORUtils::DeltaROverlapTool' ) + alg.overlapTool.PhoMuORT.InputLabel = inputLabel + alg.overlapTool.PhoMuORT.OutputLabel = outputLabel + alg.overlapTool.PhoMuORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.PhoMuORT.OutputPassValue = True + pass + + # Set up the photon-(narrow-)jet overlap removal. + if doPhotons and doJets: + addPrivateTool( alg, 'overlapTool.PhoJetORT', + 'ORUtils::DeltaROverlapTool' ) + alg.overlapTool.PhoJetORT.InputLabel = inputLabel + alg.overlapTool.PhoJetORT.OutputLabel = outputLabel + alg.overlapTool.PhoJetORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.PhoJetORT.OutputPassValue = True + pass + + # Set up the electron-fat-jet overlap removal. + if doElectrons and doFatJets: + addPrivateTool( alg, 'overlapTool.EleFatJetORT', + 'ORUtils::DeltaROverlapTool' ) + alg.overlapTool.EleFatJetORT.InputLabel = inputLabel + alg.overlapTool.EleFatJetORT.OutputLabel = outputLabel + alg.overlapTool.EleFatJetORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.EleFatJetORT.DR = 1.0 + alg.overlapTool.EleFatJetORT.OutputPassValue = True + pass + + # Set up the (narrow-)jet-fat-jet overlap removal. + if doJets and doFatJets: + addPrivateTool( alg, 'overlapTool.JetFatJetORT', + 'ORUtils::DeltaROverlapTool' ) + alg.overlapTool.JetFatJetORT.InputLabel = inputLabel + alg.overlapTool.JetFatJetORT.OutputLabel = outputLabel + alg.overlapTool.JetFatJetORT.LinkOverlapObjects = linkOverlapObjects + alg.overlapTool.JetFatJetORT.DR = 1.0 + alg.overlapTool.JetFatJetORT.OutputPassValue = True + pass + + # Add the algorithm to the analysis sequence. + seq.append( alg, + inputPropName = { 'electrons' : 'electrons', + 'muons' : 'muons', + 'jets' : 'jets', + 'taus' : 'taus', + 'photons' : 'photons', + 'fatJets' : 'fatJets' }, + outputPropName = { 'electrons' : 'electronsOut', + 'muons' : 'muonsOut', + 'jets' : 'jetsOut', + 'taus' : 'tausOut', + 'photons' : 'photonsOut', + 'fatJets' : 'fatJetsOut' } ) + + # Add view container creation algorithms for all types. + for container in [ ( 'electrons', doElectrons ), + ( 'muons', doMuons ), + ( 'jets', doJets ), + ( 'taus', doTaus ), + ( 'photons', doPhotons ), + ( 'fatJets', doFatJets ) ]: + + # Skip setting up a view container if the type is not being processed. + if not container[ 1 ]: + continue + + # Set up a cutflow alg. + if enableCutflow: + alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg', + 'OverlapRemovalCutFlowDumperAlg_%s' % container[ 0 ] + postfix ) + alg.histPattern = container[ 0 ] + postfix + '_OR_cflow_%SYS%' + if inputLabel: + alg.selection = [ '%s,as_char' % inputLabel, + '%s,as_char' % outputLabel ] + alg.selectionNCuts = [1, 1] + else: + alg.selection = [ '%s,as_char' % outputLabel ] + alg.selectionNCuts = [1] + seq.append( alg, inputPropName = { container[ 0 ] : 'input' } ) + + # Set up a view container for the type. + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'OverlapRemovalViewMaker_%s' % container[ 0 ] + postfix ) + alg.selection = [ '%s,as_char' % outputLabel ] + seq.append( alg, inputPropName = { container[ 0 ] : 'input' }, + outputPropName = { container[ 0 ] : 'output' } ) + pass + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/PileupAnalysisSequence.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/PileupAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..2198606ef20ae549b3ecf38a304b1d413341ef78 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/PileupAnalysisSequence.py @@ -0,0 +1,51 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + +def makePileupAnalysisSequence( dataType, userPileupConfigs=[], userLumicalcFiles=[] , autoConfig=False ): + """Create a PRW analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "PileupAnalysisSequence" ) + + muMcFiles = userPileupConfigs[:] + if autoConfig: + from PileupReweighting.AutoconfigurePRW import getLumiCalcFiles,getMCMuFiles + userLumicalcFiles = getLumiCalcFiles() + if len(muMcFiles)==0: + muMcFiles = getMCMuFiles() + else: + from AthenaCommon import Logging + prwlog = Logging.logging.getLogger('makePileupAnalysisSequence') + prwlog.warning('Sent autoconfig and userPileupConfigs='+str(userPileupConfigs)) + prwlog.warning('Ignoring autoconfig and keeping user-specified files') + + if userLumicalcFiles==[]: + muDataFiles = ["GoodRunsLists/data15_13TeV/20170619/PHYS_StandardGRL_All_Good_25ns_276262-284484_OflLumi-13TeV-008.root", + "GoodRunsLists/data16_13TeV/20180129/PHYS_StandardGRL_All_Good_25ns_297730-311481_OflLumi-13TeV-009.root", + "GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.lumicalc.OflLumi-13TeV-010.root", + "GoodRunsLists/data18_13TeV/20190708/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root" ] + else: + muDataFiles = userLumicalcFiles[:] + + # Set up the only algorithm of the sequence: + alg = createAlgorithm( 'CP::PileupReweightingAlg', 'PileupReweightingAlg' ) + addPrivateTool( alg, 'pileupReweightingTool', 'CP::PileupReweightingTool' ) + alg.pileupReweightingTool.ConfigFiles = muMcFiles + alg.pileupReweightingTool.LumiCalcFiles = muDataFiles + + seq.append( alg, inputPropName = 'eventInfo', + outputPropName = 'eventInfoOut', + affectingSystematics = '(^PRW_.*)' ) + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/SequencePostConfiguration.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/SequencePostConfiguration.py new file mode 100644 index 0000000000000000000000000000000000000000..4069de29a5a68e5b5aab0304df633c1bc09c693d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/SequencePostConfiguration.py @@ -0,0 +1,32 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +def sequencePostConfiguration (sequence, inputContainer) : + currentContainer = inputContainer + inputRegex = "(^$)" + nextTemp = 0 + for alg in sequence : + config = alg["alg"] + config.__setattr__ (alg["in"], currentContainer) + config.__setattr__ (alg["in"] + "Regex", inputRegex) + + # need to make a shallow copy if we add systematics, or if this is + # the first algorithm, of if we are explicitly asked for an output + if "out" in alg and (inputContainer == currentContainer or "sys" in alg or ("needOut" in alg and alg["needOut"])) : + currentContainer = inputContainer + "_tmp" + str (nextTemp) + "_%SYS%" + nextTemp = nextTemp + 1 + config.__setattr__ (alg["out"], currentContainer) + if "sys" in alg : + inputRegex = inputRegex + "|" + alg["sys"] + pass + pass + + if "sys" in alg : + config.systematicsRegex = alg["sys"] + pass + + pass + + pass diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5ccb446532599c01cc3844e5b1b18db06f721002 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +__version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..efd9a38e6f085e11fe37c43afbd85b069226766a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_eljob.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +sample.add (os.getenv (inputfile[dataType])) +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeEventAlgorithmsSequence +algSeq = makeEventAlgorithmsSequence (dataType) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Set up an output file for the job: +job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) ) + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'evenTest_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..348981c7f08479e492930eaedd2fd99c565ecdf7 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak + +# User options, which can be set from command line after a "-" character +# athena EventAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "mc", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeEventAlgorithmsSequence +algSeq = makeEventAlgorithmsSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='EventAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..2fff23fdec478b3167b3b0ead5892173ec57ce78 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_eljob.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'mc', + help = 'Type of data to run over. Valid options are mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +inputfile = {"mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +if dataType not in ["mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +sample.add (os.getenv (inputfile[dataType])) +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeGeneratorAlgorithmsSequence +algSeq = makeGeneratorAlgorithmsSequence (dataType) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Set up an output file for the job: +job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) ) + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'genTest_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..f1c19a2b1063fb4dfac78a1721bcc8c5a0293b98 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py @@ -0,0 +1,43 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak + +# User options, which can be set from command line after a "-" character +# athena OverlapAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "mc", + help = "Type of input to run over. Valid options are 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeGeneratorAlgorithmsSequence +algSeq = makeGeneratorAlgorithmsSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='GeneratorAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" +] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..a213be63996c107fb5039dd723c5701a854ca331 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_eljob.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +sample.add (os.getenv (inputfile[dataType])) +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeOverlapSequence +algSeq = makeOverlapSequence (dataType) +print algSeq # For debugging +for alg in algSeq : + job.algsAdd( alg ) + pass + + +# Set up an output file for the job: +job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) ) + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'overlapTest_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..4e753b0d13576c1254c1e9c9eb84720854d8d647 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +# User options, which can be set from command line after a "-" character +# athena OverlapAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeOverlapSequence +algSeq = makeOverlapSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='OverlapAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/src/components/AsgAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/src/components/AsgAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..14e40a32afaa936d47565f72dcec16591008ebaf --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/src/components/AsgAnalysisAlgorithms_entries.cxx @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#include <GaudiKernel/DeclareFactoryEntries.h> + +#include <AsgAnalysisAlgorithms/AsgFlagSelectionTool.h> +#include <AsgAnalysisAlgorithms/AsgPtEtaSelectionTool.h> +#include <AsgAnalysisAlgorithms/AsgCutBookkeeperAlg.h> +#include <AsgAnalysisAlgorithms/AsgEventScaleFactorAlg.h> +#include <AsgAnalysisAlgorithms/AsgLeptonTrackSelectionAlg.h> +#include <AsgAnalysisAlgorithms/AsgOriginalObjectLinkAlg.h> +#include <AsgAnalysisAlgorithms/AsgSelectionAlg.h> +#include <AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h> +#include <AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h> +#include <AsgAnalysisAlgorithms/EventFlagSelectionAlg.h> +#include <AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h> +#include <AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h> +#include <AsgAnalysisAlgorithms/KinematicHistAlg.h> +#include <AsgAnalysisAlgorithms/ObjectCutFlowHistAlg.h> +#include <AsgAnalysisAlgorithms/OverlapRemovalAlg.h> +#include <AsgAnalysisAlgorithms/PileupReweightingAlg.h> +#include <AsgAnalysisAlgorithms/PMGTruthWeightAlg.h> +#include <AsgAnalysisAlgorithms/SysListDumperAlg.h> +#include <AsgAnalysisAlgorithms/SysListLoaderAlg.h> +#include <AsgAnalysisAlgorithms/TreeFillerAlg.h> +#include <AsgAnalysisAlgorithms/TreeMakerAlg.h> + +DECLARE_NAMESPACE_TOOL_FACTORY (CP, AsgFlagSelectionTool) +DECLARE_NAMESPACE_TOOL_FACTORY (CP, AsgPtEtaSelectionTool) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgCutBookkeeperAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgEventScaleFactorAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgLeptonTrackSelectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgOriginalObjectLinkAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgSelectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgViewFromSelectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgxAODNTupleMakerAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EventFlagSelectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EventSelectionByObjectFlagAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, IsolationCloseByCorrectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, KinematicHistAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, ObjectCutFlowHistAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, OverlapRemovalAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, PileupReweightingAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, PMGTruthWeightAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, SysListDumperAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, SysListLoaderAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, TreeFillerAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, TreeMakerAlg) + +DECLARE_FACTORY_ENTRIES(AsgAnalysisAlgorithms) { + DECLARE_NAMESPACE_ALGTOOL (CP, AsgFlagSelectionTool) + DECLARE_NAMESPACE_ALGTOOL (CP, AsgPtEtaSelectionTool) + DECLARE_NAMESPACE_ALGORITHM (CP, AsgCutBookkeeperAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, AsgEventScaleFactorAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, AsgLeptonTrackSelectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, AsgOriginalObjectLinkAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, AsgSelectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, AsgViewFromSelectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, AsgxAODNTupleMakerAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, EventFlagSelectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, EventSelectionByObjectFlagAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, IsolationCloseByCorrectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, KinematicHistAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, ObjectCutFlowHistAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, OverlapRemovalAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, PileupReweightingAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, PMGTruthWeightAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, SysListDumperAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, SysListLoaderAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, TreeFillerAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, TreeMakerAlg) +} diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/src/components/AsgAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/src/components/AsgAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d9df74517d2afe019c514713e128a740f6e8a25c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/src/components/AsgAnalysisAlgorithms_load.cxx @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(AsgAnalysisAlgorithms) diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..61b27027550c137b8154b169727b8ad21f38e5b0 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,65 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# The name of the package: +atlas_subdir( EgammaAnalysisAlgorithms ) + +# The package's dependencies: +atlas_depends_on_subdirs( + PUBLIC + Event/xAOD/xAODEgamma + PhysicsAnalysis/Algorithms/SelectionHelpers + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/AnalysisCommon/IsolationSelection + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PhysicsAnalysis/ElectronPhotonID/IsolationCorrections + PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces ) + +atlas_add_library( EgammaAnalysisAlgorithmsLib + EgammaAnalysisAlgorithms/*.h EgammaAnalysisAlgorithms/*.icc Root/*.cxx + PUBLIC_HEADERS EgammaAnalysisAlgorithms + LINK_LIBRARIES xAODEgamma SelectionHelpersLib SystematicsHandlesLib + IsolationSelectionLib AnaAlgorithmLib IsolationCorrectionsLib + EgammaAnalysisInterfacesLib ) + +atlas_add_dictionary( EgammaAnalysisAlgorithmsDict + EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h + EgammaAnalysisAlgorithms/selection.xml + LINK_LIBRARIES EgammaAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( EgammaAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel EgammaAnalysisAlgorithmsLib ) +endif() + +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*_jobOptions.py ) +atlas_install_scripts( share/*_eljob.py ) + +if( XAOD_STANDALONE ) + atlas_add_test( testJobData + SCRIPT EgammaAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT EgammaAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT EgammaAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) +else() + atlas_add_test( testJobData + SCRIPT athena.py + EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsTest_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT athena.py + EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsTest_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT athena.py + EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsTest_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) +endif() diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/CopyHelpers.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/CopyHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..fecb243d040131fba2678ef4931c7c33e1ec6124 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/CopyHelpers.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef EGAMMA_ANALYSIS_ALGORITHMS__COPY_HELPERS_H +#define EGAMMA_ANALYSIS_ALGORITHMS__COPY_HELPERS_H + +#include <SystematicsHandles/CopyHelpers.h> + +#include <xAODEgamma/EgammaContainer.h> + +namespace CP +{ + namespace detail + { + template<> + struct ShallowCopy<xAOD::EgammaContainer> + { + /// \brief the type of the event store we use + public: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type StoreType; + + static StatusCode + getCopy (MsgStream& msgStream, StoreType& store, + xAOD::EgammaContainer*& object, + const xAOD::EgammaContainer *inputObject, + const std::string& outputName, const std::string& auxName) + { + const auto msg = [&] (MSG::Level lvl) -> MsgStream& {msgStream << lvl; return msgStream;}; + + xAOD::IParticleContainer *subobject = nullptr; + if (!ShallowCopy<xAOD::IParticleContainer>::getCopy (msgStream, store, subobject, inputObject, outputName, auxName).isSuccess()) + return StatusCode::FAILURE; + if (!(object = dynamic_cast<xAOD::EgammaContainer*>(subobject))) + { + ANA_MSG_ERROR ("copy of EgammaContainer is not an EgammaContainer"); + ANA_MSG_ERROR ("check logic in CopyHelpers"); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; + } + }; + } +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..6873d4560ca86ef2efaab2098ba4405ec1a43e7a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef EGAMMA_ANALYSIS_ALGORITHMS__EGAMMA_ANALYSIS_ALGORITHMS_DICT_H +#define EGAMMA_ANALYSIS_ALGORITHMS__EGAMMA_ANALYSIS_ALGORITHMS_DICT_H + +#include <EgammaAnalysisAlgorithms/EgammaCalibrationAndSmearingAlg.h> +#include <EgammaAnalysisAlgorithms/EgammaIsGoodOQSelectionTool.h> +#include <EgammaAnalysisAlgorithms/EgammaIsolationCorrectionAlg.h> +#include <EgammaAnalysisAlgorithms/EgammaIsolationSelectionAlg.h> +#include <EgammaAnalysisAlgorithms/ElectronEfficiencyCorrectionAlg.h> +#include <EgammaAnalysisAlgorithms/PhotonEfficiencyCorrectionAlg.h> +#include <EgammaAnalysisAlgorithms/PhotonShowerShapeFudgeAlg.h> + +#endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaCalibrationAndSmearingAlg.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaCalibrationAndSmearingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..bd361e9a53652ce0bd72ee5af02693decd908399 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaCalibrationAndSmearingAlg.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef EGAMMA_ANALYSIS_ALGORITHMS__EGAMMA_CALIBRATION_AND_SMEARING_ALG_H +#define EGAMMA_ANALYSIS_ALGORITHMS__EGAMMA_CALIBRATION_AND_SMEARING_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <EgammaAnalysisInterfaces/IEgammaCalibrationAndSmearingTool.h> +#include <EgammaAnalysisAlgorithms/CopyHelpers.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref + /// CP::IEgammaCalibrationAndSmearingTool + + class EgammaCalibrationAndSmearingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + EgammaCalibrationAndSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<CP::IEgammaCalibrationAndSmearingTool> m_calibrationAndSmearingTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the egamma collection we run on + private: + SysCopyHandle<xAOD::EgammaContainer> m_egammaHandle { + this, "egammas", "Electrons", "the egamma collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsGoodOQSelectionTool.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsGoodOQSelectionTool.h new file mode 100644 index 0000000000000000000000000000000000000000..179e9b7fac68d5b9f26c772302b8722e880533eb --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsGoodOQSelectionTool.h @@ -0,0 +1,71 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// +#ifndef EGAMMAANALYSISALGORITHMS_EGAMMAISGOODOQSELECTIONTOOL_H +#define EGAMMAANALYSISALGORITHMS_EGAMMAISGOODOQSELECTIONTOOL_H + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "PATCore/IAsgSelectionTool.h" + +namespace CP { + + /// Tool selecting e/gamma objects based on their object quality flags + /// + /// This tool can be used in tandem with @c CP::AsgSelectionAlg to flag which + /// e/gamma objects pass a given object quality requirement. The idea is that + /// the mask to use by the tool should be taken from xAODEgamma's dictionary, + /// ideally using a PyROOT configuration. + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class EgammaIsGoodOQSelectionTool final : + public asg::AsgTool, virtual public IAsgSelectionTool { + + public: + /// Declare the tool's interface to Gaudi + ASG_TOOL_CLASS( EgammaIsGoodOQSelectionTool, IAsgSelectionTool ) + + /// AsgTool constructor + EgammaIsGoodOQSelectionTool( const std::string& name ); + + /// @name Interface inherited from @c IAsgSelectionTool + /// @{ + + /// Get the results for the last object processed + virtual const Root::TAccept& getTAccept() const override; + + /// Get the results for a given particle + virtual const Root::TAccept& + accept( const xAOD::IParticle* part ) const override; + + /// @} + + /// @name Interface inherited from @c asg::AsgTool + /// @{ + + /// Function initialising the tool + virtual StatusCode initialize() override; + + /// @} + + private: + /// @name Tool properties + /// @{ + + /// The mask to require good object quality with + int m_mask; + + /// @} + + /// Object handling the e/gamma selection decision + mutable Root::TAccept m_accept{ "EgammaOQ" }; + /// Index of the object quality cut + int m_oqCutIndex{ -1 }; + + }; // class EgammaIsGoodOQSelectionTool + +} // namespace CP + +#endif // EGAMMAANALYSISALGORITHMS_EGAMMAISGOODOQSELECTIONTOOL_H diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsolationCorrectionAlg.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsolationCorrectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..9c193c8a20e48f3a9d2be66c37386d808e96745c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsolationCorrectionAlg.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef EGAMMA_ANALYSIS_ALGORITHMS__EGAMMA_ISOLATION_CORRECTION_ALG_H +#define EGAMMA_ANALYSIS_ALGORITHMS__EGAMMA_ISOLATION_CORRECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <EgammaAnalysisAlgorithms/CopyHelpers.h> +#include <IsolationCorrections/IIsolationCorrectionTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref + /// CP::IIsolationCorrectionTool + + class EgammaIsolationCorrectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + EgammaIsolationCorrectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<CP::IIsolationCorrectionTool> m_isolationCorrectionTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the egamma collection we run on + private: + SysCopyHandle<xAOD::EgammaContainer> m_egammaHandle { + this, "egammas", "Electrons", "the egamma collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsolationSelectionAlg.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsolationSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..8b4503a8387eefb40355db16b27deb5a0d1e338a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaIsolationSelectionAlg.h @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef EGAMMA_ANALYSIS_ALGORITHMS__EGAMMA_ISOLATION_SELECTION_ALG_H +#define EGAMMA_ANALYSIS_ALGORITHMS__EGAMMA_ISOLATION_SELECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <IsolationSelection/IIsolationSelectionTool.h> +#include <EgammaAnalysisAlgorithms/CopyHelpers.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IIsolationSelectionTool + + class EgammaIsolationSelectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + EgammaIsolationSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the selection tool + private: + ToolHandle<IIsolationSelectionTool> m_selectionTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the particle continer we run on + private: + SysCopyHandle<xAOD::EgammaContainer> m_egammasHandle { + this, "egammas", "Electrons", "the egamma collection to run on"}; + + /// \brief the decoration for the asg selection + private: + std::string m_selectionDecoration {"isolated"}; + + /// \brief the accessor for \ref m_selectionDecoration + private: + std::unique_ptr<ISelectionAccessor> m_selectionAccessor; + + /// \brief the bits to set for an object failing the preselection + private: + SelectionType m_setOnFail; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/ElectronEfficiencyCorrectionAlg.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/ElectronEfficiencyCorrectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..a1fb77b32462b4c632533e83cc7a2da4178b712b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/ElectronEfficiencyCorrectionAlg.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ELECTRON_ANALYSIS_ALGORITHMS__ELECTRON_EFFICIENCY_SCALE_FACTOR_ALG_H +#define ELECTRON_ANALYSIS_ALGORITHMS__ELECTRON_EFFICIENCY_SCALE_FACTOR_ALG_H + +#include <xAODEgamma/ElectronContainer.h> +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IElectronEfficiencyCorrectionTool + + class ElectronEfficiencyCorrectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + ElectronEfficiencyCorrectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_efficiencyCorrectionTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the electron collection we run on + private: + SysCopyHandle<xAOD::ElectronContainer> m_electronHandle { + this, "electrons", "Electrons", "the electron collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + + /// \brief the decoration for the electron scale factor + private: + SysDecorationHandle<float> m_scaleFactorDecoration { + this, "scaleFactorDecoration", "", "the decoration for the electron efficiency scale factor"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/PhotonEfficiencyCorrectionAlg.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/PhotonEfficiencyCorrectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..c9006d39dedce31c01046a1b7bd70237b65b337d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/PhotonEfficiencyCorrectionAlg.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef ELECTRON_ANALYSIS_ALGORITHMS__PHOTON_EFFICIENCY_SCALE_FACTOR_ALG_H +#define ELECTRON_ANALYSIS_ALGORITHMS__PHOTON_EFFICIENCY_SCALE_FACTOR_ALG_H + +#include <xAODEgamma/PhotonContainer.h> +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <EgammaAnalysisInterfaces/IAsgPhotonEfficiencyCorrectionTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IPhotonEfficiencyCorrectionTool + + class PhotonEfficiencyCorrectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + PhotonEfficiencyCorrectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IAsgPhotonEfficiencyCorrectionTool> m_efficiencyCorrectionTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the photon collection we run on + private: + SysCopyHandle<xAOD::PhotonContainer> m_photonHandle { + this, "photons", "Photons", "the photon collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + + /// \brief the decoration for the photon scale factor + private: + std::string m_scaleFactorDecoration; + + /// \brief the accessor for \ref m_scaleFactorDecoration + private: + std::unique_ptr<const SG::AuxElement::Accessor<float> > m_scaleFactorAccessor; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/PhotonShowerShapeFudgeAlg.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/PhotonShowerShapeFudgeAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..7ca1165f1840f13e239eef56612784db273de5c9 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/PhotonShowerShapeFudgeAlg.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef EGAMMA_ANALYSIS_ALGORITHMS__ELECTRON_PHOTON_SHOWER_SHAPE_FUDGE_ALG_H +#define EGAMMA_ANALYSIS_ALGORITHMS__ELECTRON_PHOTON_SHOWER_SHAPE_FUDGE_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h> +#include <EgammaAnalysisAlgorithms/CopyHelpers.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODEgamma/PhotonContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref + /// IElectronPhotonShowerShapeFudgeTool for photons + + class PhotonShowerShapeFudgeAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + PhotonShowerShapeFudgeAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_showerShapeFudgeTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the photon collection we run on + private: + SysCopyHandle<xAOD::PhotonContainer> m_photonHandle { + this, "photons", "Photons", "the photon collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..b6f50af36ba3d4d12c880a2f9e86b1a08c9a9534 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml @@ -0,0 +1,11 @@ +<lcgdict> + + <class name="CP::EgammaCalibrationAndSmearingAlg" /> + <class name="CP::EgammaIsGoodOQSelectionTool" /> + <class name="CP::EgammaIsolationCorrectionAlg" /> + <class name="CP::EgammaIsolationSelectionAlg" /> + <class name="CP::ElectronEfficiencyCorrectionAlg" /> + <class name="CP::PhotonEfficiencyCorrectionAlg" /> + <class name="CP::PhotonShowerShapeFudgeAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/CopyHelpers.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/CopyHelpers.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0158e1bfd2511120625a6d2a0ec2971940d751a6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/CopyHelpers.cxx @@ -0,0 +1,21 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <EgammaAnalysisAlgorithms/CopyHelpers.h> + +// +// method implementations +// + +namespace CP +{ +} diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaCalibrationAndSmearingAlg.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaCalibrationAndSmearingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8fe486133a4d01c7165ceed397e53ccaff71f3c0 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaCalibrationAndSmearingAlg.cxx @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <EgammaAnalysisAlgorithms/EgammaCalibrationAndSmearingAlg.h> + +// +// method implementations +// + +namespace CP +{ + EgammaCalibrationAndSmearingAlg :: + EgammaCalibrationAndSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_calibrationAndSmearingTool ("CP::EgammaCalibrationAndSmearingTool", this) + { + declareProperty ("calibrationAndSmearingTool", m_calibrationAndSmearingTool, "the smearing tool we apply"); + } + + + + StatusCode EgammaCalibrationAndSmearingAlg :: + initialize () + { + ANA_CHECK (m_calibrationAndSmearingTool.retrieve()); + m_systematicsList.addHandle (m_egammaHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_calibrationAndSmearingTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode EgammaCalibrationAndSmearingAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_calibrationAndSmearingTool->applySystematicVariation (sys)); + xAOD::EgammaContainer *egammas = nullptr; + ANA_CHECK (m_egammaHandle.getCopy (egammas, sys)); + for (xAOD::Egamma *egamma : *egammas) + { + if (m_preselection.getBool (*egamma)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *egamma, m_calibrationAndSmearingTool->applyCorrection (*egamma)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsGoodOQSelectionTool.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsGoodOQSelectionTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ba2b504cecca8274120b29dfc87096794860d222 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsGoodOQSelectionTool.cxx @@ -0,0 +1,67 @@ +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// + +// Local include(s): +#include "EgammaAnalysisAlgorithms/EgammaIsGoodOQSelectionTool.h" + +// EDM include(s): +#include "xAODEgamma/Egamma.h" +#include "xAODEgamma/EgammaDefs.h" + +// System include(s): +#include <iomanip> + +namespace CP { + + EgammaIsGoodOQSelectionTool:: + EgammaIsGoodOQSelectionTool( const std::string& name ) + : asg::AsgTool( name ) { + + // Declare the tool's properties. + declareProperty( "Mask", m_mask = xAOD::EgammaParameters::ALLOQ, + "Mask to require passing object quality bits with" ); + } + + const Root::TAccept& EgammaIsGoodOQSelectionTool::getTAccept() const { + + // Return the internal object. + return m_accept; + } + + const Root::TAccept& EgammaIsGoodOQSelectionTool:: + accept( const xAOD::IParticle* part ) const { + + // Reset the decision object. + m_accept.clear(); + + // Cast the particle to an e/gamma type. + const xAOD::Egamma* eg = nullptr; + if( ( part->type() != xAOD::Type::Electron ) && + ( part->type() != xAOD::Type::Photon ) ) { + ATH_MSG_WARNING( "Non-e/gamma object received" ); + return m_accept; + } + eg = static_cast< const xAOD::Egamma* >( part ); + + // Calculate the decision. + m_accept.setCutResult( m_oqCutIndex, eg->isGoodOQ( m_mask ) ); + + // Return the internal object. + return m_accept; + } + + StatusCode EgammaIsGoodOQSelectionTool::initialize() { + + // Tell the user what is going to happen. + ATH_MSG_INFO( "Selecting e/gamma objects with OQ mask: 0x" + << std::hex << m_mask ); + + // Set up the TAccept object. + m_oqCutIndex = m_accept.addCut( "EgammaOQ", "Egamma object quality cut" ); + + // Return gracefully. + return StatusCode::SUCCESS; + } + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsolationCorrectionAlg.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsolationCorrectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c9497dec62c32ed8f7843e6c7d328afba9b9e638 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsolationCorrectionAlg.cxx @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <EgammaAnalysisAlgorithms/EgammaIsolationCorrectionAlg.h> + +// +// method implementations +// + +namespace CP +{ + EgammaIsolationCorrectionAlg :: + EgammaIsolationCorrectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_isolationCorrectionTool ("CP::IsolationCorrectionTool", this) + { + declareProperty ("isolationCorrectionTool", m_isolationCorrectionTool, "the smearing tool we apply"); + } + + + + StatusCode EgammaIsolationCorrectionAlg :: + initialize () + { + ANA_CHECK (m_isolationCorrectionTool.retrieve()); + m_systematicsList.addHandle (m_egammaHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_isolationCorrectionTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode EgammaIsolationCorrectionAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_isolationCorrectionTool->applySystematicVariation (sys)); + xAOD::EgammaContainer *egammas = nullptr; + ANA_CHECK (m_egammaHandle.getCopy (egammas, sys)); + for (xAOD::Egamma *egamma : *egammas) + { + if (m_preselection.getBool (*egamma)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *egamma, m_isolationCorrectionTool->applyCorrection (*egamma)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsolationSelectionAlg.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsolationSelectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..35a77e1e63ecc64bfcec4f7ab610e842cf215e0e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaIsolationSelectionAlg.cxx @@ -0,0 +1,78 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <EgammaAnalysisAlgorithms/EgammaIsolationSelectionAlg.h> + +// +// method implementations +// + +namespace CP +{ + EgammaIsolationSelectionAlg :: + EgammaIsolationSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_selectionTool ("", this) + { + declareProperty ("selectionTool", m_selectionTool, "the selection tool we apply"); + declareProperty ("selectionDecoration", m_selectionDecoration, "the decoration for the asg selection"); + } + + + + StatusCode EgammaIsolationSelectionAlg :: + initialize () + { + if (m_selectionDecoration.empty()) + { + ANA_MSG_ERROR ("no selection decoration name set"); + return StatusCode::FAILURE; + } + ANA_CHECK (makeSelectionAccessor (m_selectionDecoration, m_selectionAccessor)); + ANA_CHECK (m_selectionTool.retrieve()); + + m_systematicsList.addHandle (m_egammasHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + + Root::TAccept blankAccept = m_selectionTool->getObjTAccept(); + // Just in case this isn't initially set up as a failure clear it this one + // time. This only calls reset on the bitset + blankAccept.clear(); + m_setOnFail = selectionFromAccept(blankAccept); + + return StatusCode::SUCCESS; + } + + + + StatusCode EgammaIsolationSelectionAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::EgammaContainer *egammas = nullptr; + ANA_CHECK (m_egammasHandle.getCopy (egammas, sys)); + for (xAOD::Egamma *egamma : *egammas) + { + if (m_preselection.getBool (*egamma)) + { + m_selectionAccessor->setBits + (*egamma, selectionFromAccept (m_selectionTool->accept (*egamma))); + } else { + m_selectionAccessor->setBits (*egamma, m_setOnFail); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/ElectronEfficiencyCorrectionAlg.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/ElectronEfficiencyCorrectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bf2d404d9386f964e857d5b3da632f2d07b6f005 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/ElectronEfficiencyCorrectionAlg.cxx @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <EgammaAnalysisAlgorithms/ElectronEfficiencyCorrectionAlg.h> + +// +// method implementations +// + +namespace CP +{ + ElectronEfficiencyCorrectionAlg :: + ElectronEfficiencyCorrectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_efficiencyCorrectionTool ("AsgElectronEfficiencyCorrectionTool", this) + { + declareProperty ("efficiencyCorrectionTool", m_efficiencyCorrectionTool, "the calibration and smearing tool we apply"); + } + + + + StatusCode ElectronEfficiencyCorrectionAlg :: + initialize () + { + if (m_scaleFactorDecoration.empty()) + { + ANA_MSG_ERROR ("no scale factor decoration name set"); + return StatusCode::FAILURE; + } + + ANA_CHECK (m_efficiencyCorrectionTool.retrieve()); + m_systematicsList.addHandle (m_electronHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyCorrectionTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + + return StatusCode::SUCCESS; + } + + + + StatusCode ElectronEfficiencyCorrectionAlg :: + execute () + { + ANA_CHECK (m_scaleFactorDecoration.preExecute (m_systematicsList)); + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_efficiencyCorrectionTool->applySystematicVariation (sys)); + xAOD::ElectronContainer *electrons = nullptr; + ANA_CHECK (m_electronHandle.getCopy (electrons, sys)); + for (xAOD::Electron *electron : *electrons) + { + if (m_preselection.getBool (*electron)) + { + double sf = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *electron, m_efficiencyCorrectionTool->getEfficiencyScaleFactor (*electron, sf)); + m_scaleFactorDecoration.set (*electron, sf, sys); + } else { + m_scaleFactorDecoration.set (*electron, invalidScaleFactor(), sys); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/PhotonEfficiencyCorrectionAlg.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/PhotonEfficiencyCorrectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..163a27762e0e0011f956b8072b6065ffd0309327 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/PhotonEfficiencyCorrectionAlg.cxx @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <EgammaAnalysisAlgorithms/PhotonEfficiencyCorrectionAlg.h> + +// +// method implementations +// + +namespace CP +{ + PhotonEfficiencyCorrectionAlg :: + PhotonEfficiencyCorrectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_efficiencyCorrectionTool ("AsgPhotonEfficiencyCorrectionTool", this) + { + declareProperty ("efficiencyCorrectionTool", m_efficiencyCorrectionTool, "the calibration and smearing tool we apply"); + declareProperty ("scaleFactorDecoration", m_scaleFactorDecoration, "the decoration for the photon scale factor"); + } + + + + StatusCode PhotonEfficiencyCorrectionAlg :: + initialize () + { + if (m_scaleFactorDecoration.empty()) + { + ANA_MSG_ERROR ("no scale factor decoration name set"); + return StatusCode::FAILURE; + } + m_scaleFactorAccessor = std::make_unique<SG::AuxElement::Accessor<float> > (m_scaleFactorDecoration); + + ANA_CHECK (m_efficiencyCorrectionTool.retrieve()); + m_systematicsList.addHandle (m_photonHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyCorrectionTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode PhotonEfficiencyCorrectionAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_efficiencyCorrectionTool->applySystematicVariation (sys)); + xAOD::PhotonContainer *photons = nullptr; + ANA_CHECK (m_photonHandle.getCopy (photons, sys)); + for (xAOD::Photon *photon : *photons) + { + if (m_preselection.getBool (*photon)) + { + double sf = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *photon, m_efficiencyCorrectionTool->getEfficiencyScaleFactor (*photon, sf)); + (*m_scaleFactorAccessor) (*photon) = sf; + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/PhotonShowerShapeFudgeAlg.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/PhotonShowerShapeFudgeAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b7b9a8a4126f5b7a0d0b2a2e0abeaed307f77b2c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/PhotonShowerShapeFudgeAlg.cxx @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <EgammaAnalysisAlgorithms/PhotonShowerShapeFudgeAlg.h> + +// +// method implementations +// + +namespace CP +{ + PhotonShowerShapeFudgeAlg :: + PhotonShowerShapeFudgeAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_showerShapeFudgeTool ("ElectronPhotonShowerShapeFudgeTool", this) + { + declareProperty ("showerShapeFudgeTool", m_showerShapeFudgeTool, "the smearing tool we apply"); + } + + + + StatusCode PhotonShowerShapeFudgeAlg :: + initialize () + { + ANA_CHECK (m_showerShapeFudgeTool.retrieve()); + m_systematicsList.addHandle (m_photonHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode PhotonShowerShapeFudgeAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::PhotonContainer *photons = nullptr; + ANA_CHECK (m_photonHandle.getCopy (photons, sys)); + for (xAOD::Photon *photon : *photons) + { + if (m_preselection.getBool (*photon)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *photon, m_showerShapeFudgeTool->applyCorrection (*photon)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/EgammaAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/EgammaAnalysisAlgorithmsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..eb8e4b901bcc38ab674d98db8b8ca17fb080f5df --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/EgammaAnalysisAlgorithmsTest.py @@ -0,0 +1,40 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AnaAlgorithm.AlgSequence import AlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm + +def makeSequence (dataType) : + algSeq = AlgSequence() + + # Create the algorithm's configuration. Note that we'll be able to add + # algorithm property settings here later on. + alg = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + alg.sigmaRecommended = 1 + algSeq += alg + + # Include, and then set up the pileup analysis sequence: + from AsgAnalysisAlgorithms.PileupAnalysisSequence import \ + makePileupAnalysisSequence + pileupSequence = makePileupAnalysisSequence( dataType ) + pileupSequence.configure( inputName = 'EventInfo', outputName = 'EventInfo_%SYS%' ) + algSeq += pileupSequence + + # Include, and then set up the electron analysis sequence: + from EgammaAnalysisAlgorithms.ElectronAnalysisSequence import \ + makeElectronAnalysisSequence + electronSequence = makeElectronAnalysisSequence( dataType, 'LooseLHElectron.GradientLoose', postfix = 'loose', + recomputeLikelihood=True, enableCutflow=True, enableKinematicHistograms=True ) + electronSequence.configure( inputName = 'Electrons', + outputName = 'AnalysisElectrons_%SYS%' ) + algSeq += electronSequence + + # Include, and then set up the photon analysis sequence: + from EgammaAnalysisAlgorithms.PhotonAnalysisSequence import \ + makePhotonAnalysisSequence + photonSequence = makePhotonAnalysisSequence( dataType, 'Tight.FixedCutTight', postfix = 'tight', + recomputeIsEM=True, enableCutflow=True, enableKinematicHistograms=True ) + photonSequence.configure( inputName = 'Photons', + outputName = 'AnalysisPhotons_%SYS%' ) + algSeq += photonSequence + + return algSeq diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisSequence.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..a831079c6f4a83ec155f6a7d64c11b5aab21e87e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisSequence.py @@ -0,0 +1,284 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# Framework import(s): +import ROOT + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + +def makeElectronAnalysisSequence( dataType, workingPoint, + deepCopyOutput = False, + shallowViewOutput = True, + postfix = '', + recomputeLikelihood = False, + chargeIDSelection = False, + isolationCorrection = False, + crackVeto = False, + ptSelectionOutput = False, + enableCutflow = False, + enableKinematicHistograms = False ): + """Create an electron analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + workingPoint -- The working point to use + deepCopyOutput -- If set to 'True', the output containers will be + standalone, deep copies (slower, but needed for xAOD + output writing) + shallowViewOutput -- Create a view container if required + postfix -- a postfix to apply to decorations and algorithm + names. this is mostly used/needed when using this + sequence with multiple working points to ensure all + names are unique. + recomputeLikelihood -- Whether to rerun the LH. If not, use derivation flags + chargeIDSelection -- Whether or not to perform charge ID/flip selection + isolationCorrection -- Whether or not to perform isolation correction + crackVeto -- Whether or not to perform eta crack veto + ptSelectionOutput -- Whether or not to apply pt selection when creating + output containers. + enableCutflow -- Whether or not to dump the cutflow + enableKinematicHistograms -- Whether or not to dump the kinematic histograms + """ + + # Make sure we received a valid data type. + if dataType not in [ 'data', 'mc', 'afii' ]: + raise ValueError( 'Invalid data type: %' % dataType ) + + if postfix != '' : + postfix = '_' + postfix + pass + + # Make sure selection options make sense + if deepCopyOutput and shallowViewOutput: + raise ValueError ("deepCopyOutput and shallowViewOutput can't both be true!") + + splitWP = workingPoint.split ('.') + if len (splitWP) != 2 : + raise ValueError ('working point should be of format "likelihood.isolation", not ' + workingPoint) + + likelihoodWP = splitWP[0] + isolationWP = splitWP[1] + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "ElectronAnalysisSequence" + postfix ) + + # Variables keeping track of the selections being applied. + selectionDecorNames = [] + selectionDecorCount = [] + + # Set up the eta-cut on all electrons prior to everything else + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronEtaCutAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.selectionDecoration = 'selectEta' + postfix + ',as_bits' + addPrivateTool( alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool' ) + alg.selectionTool.maxEta = 2.47 + if crackVeto: + alg.selectionTool.etaGapLow = 1.37 + alg.selectionTool.etaGapHigh = 1.52 + alg.selectionTool.useClusterEta = True + seq.append( alg, inputPropName = 'particles', + outputPropName = 'particlesOut', + stageName = 'calibration' ) + selectionDecorNames.append( alg.selectionDecoration ) + if crackVeto : + selectionDecorCount.append( 5 ) + else : + selectionDecorCount.append( 4 ) + + # Set up the track selection algorithm: + alg = createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', + 'ElectronTrackSelectionAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits' + alg.maxD0Significance = 5 + alg.maxDeltaZ0SinTheta = 0.5 + seq.append( alg, inputPropName = 'particles', + stageName = 'selection' ) + selectionDecorNames.append( alg.selectionDecoration ) + selectionDecorCount.append( 3 ) + + # Set up the likelihood ID selection algorithm + # It is safe to do this before calibration, as the cluster E is used + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronLikelihoodAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.selectionDecoration = 'selectLikelihood' + postfix + ',as_bits' + selectionDecorNames.append( alg.selectionDecoration ) + if recomputeLikelihood: + # Rerun the likelihood ID + addPrivateTool( alg, 'selectionTool', 'AsgElectronLikelihoodTool' ) + alg.selectionTool.primaryVertexContainer = 'PrimaryVertices' + alg.selectionTool.WorkingPoint = likelihoodWP + selectionDecorCount.append( 7 ) + else: + # Select from Derivation Framework flags + addPrivateTool( alg, 'selectionTool', 'CP::AsgFlagSelectionTool' ) + dfFlag = "DFCommonElectronsLH" + likelihoodWP.split('LH')[0] + alg.selectionTool.selectionFlags = [dfFlag] + selectionDecorCount.append( 1 ) + seq.append( alg, inputPropName = 'particles', + stageName = 'selection' ) + + # Select electrons only with good object quality. + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronObjectQualityAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.selectionDecoration = 'goodOQ' + postfix + ',as_bits' + addPrivateTool( alg, 'selectionTool', 'CP::EgammaIsGoodOQSelectionTool' ) + alg.selectionTool.Mask = ROOT.xAOD.EgammaParameters.BADCLUSELECTRON + seq.append( alg, inputPropName = 'particles', + stageName = 'calibration' ) + selectionDecorNames.append( alg.selectionDecoration ) + selectionDecorCount.append( 1 ) + + # Set up the calibration and smearing algorithm: + alg = createAlgorithm( 'CP::EgammaCalibrationAndSmearingAlg', + 'ElectronCalibrationAndSmearingAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + addPrivateTool( alg, 'calibrationAndSmearingTool', + 'CP::EgammaCalibrationAndSmearingTool' ) + alg.calibrationAndSmearingTool.ESModel = 'es2018_R21_v0' + alg.calibrationAndSmearingTool.decorrelationModel = '1NP_v1' + if dataType == 'afii': + alg.calibrationAndSmearingTool.useAFII = 1 + else: + alg.calibrationAndSmearingTool.useAFII = 0 + pass + seq.append( alg, inputPropName = 'egammas', outputPropName = 'egammasOut', + affectingSystematics = '(^EG_RESOLUTION_.*)|(^EG_SCALE_.*)', + stageName = 'calibration' ) + + # Set up the the pt selection + ptSelectionDecoration = 'selectPt' + postfix + ',as_bits' + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronPtCutAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.selectionDecoration = ptSelectionDecoration + addPrivateTool( alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool' ) + alg.selectionTool.minPt = 4.5e3 + seq.append( alg, inputPropName = 'particles', + stageName = 'selection' ) + selectionDecorNames.append( alg.selectionDecoration ) + selectionDecorCount.append( 2 ) + + # Set up the isolation correction algorithm: + if isolationCorrection: + alg = createAlgorithm( 'CP::EgammaIsolationCorrectionAlg', + 'ElectronIsolationCorrectionAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + addPrivateTool( alg, 'isolationCorrectionTool', + 'CP::IsolationCorrectionTool' ) + if dataType == 'data': + alg.isolationCorrectionTool.IsMC = 0 + else: + alg.isolationCorrectionTool.IsMC = 1 + pass + seq.append( alg, inputPropName = 'egammas', outputPropName = 'egammasOut', + stageName = 'calibration' ) + + # Set up the isolation selection algorithm: + if isolationWP != 'NonIso' : + alg = createAlgorithm( 'CP::EgammaIsolationSelectionAlg', + 'ElectronIsolationSelectionAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.selectionDecoration = 'isolated' + postfix + ',as_bits' + addPrivateTool( alg, 'selectionTool', 'CP::IsolationSelectionTool' ) + alg.selectionTool.ElectronWP = isolationWP + seq.append( alg, inputPropName = 'egammas', + stageName = 'selection' ) + selectionDecorNames.append( alg.selectionDecoration ) + selectionDecorCount.append( 1 ) + + # Select electrons only if they don't appear to have flipped their charge. + if chargeIDSelection: + alg = createAlgorithm( 'CP::AsgSelectionAlg', + 'ElectronChargeIDSelectionAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.selectionDecoration = 'chargeID' + postfix + ',as_bits' + addPrivateTool( alg, 'selectionTool', + 'AsgElectronChargeIDSelectorTool' ) + alg.selectionTool.TrainingFile = \ + 'ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root' + alg.selectionTool.WorkingPoint = 'Loose' + alg.selectionTool.CutOnBDT = -0.337671 # Loose 97% + seq.append( alg, inputPropName = 'particles', + stageName = 'selection' ) + selectionDecorNames.append( alg.selectionDecoration ) + selectionDecorCount.append( 1 ) + pass + + # Set up an algorithm used for decorating baseline electron selection: + alg = createAlgorithm( 'CP::AsgSelectionAlg', + 'ElectronSelectionSummary' + postfix ) + addPrivateTool( alg, 'selectionTool', 'CP::AsgFlagSelectionTool' ) + alg.selectionTool.selectionFlags = selectionDecorNames[ : ] + alg.selectionDecoration = 'baselineSelection' + postfix + ',as_char' + seq.append( alg, inputPropName = 'particles', + stageName = 'selection' ) + + # Set up an algorithm used to create electron selection cutflow: + if enableCutflow: + alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg', 'ElectronCutFlowDumperAlg' + postfix ) + alg.histPattern = 'electron_cflow_%SYS%' + postfix + alg.selection = selectionDecorNames[ : ] + alg.selectionNCuts = selectionDecorCount[ : ] + seq.append( alg, inputPropName = 'input', stageName = 'selection' ) + + # Set up an algorithm dumping the kinematic properties of the electrons: + if enableKinematicHistograms: + alg = createAlgorithm( 'CP::KinematicHistAlg', 'ElectronKinematicDumperAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.histPattern = 'electron_%VAR%_%SYS%' + postfix + seq.append( alg, inputPropName = 'input', stageName = 'selection' ) + + # Set up the output selection + if shallowViewOutput or deepCopyOutput: + selectionDecorNamesOutput = selectionDecorNames[ : ] + if not ptSelectionOutput: + selectionDecorNamesOutput.remove(ptSelectionDecoration) + + # Set up an algorithm that makes a view container using the selections + # performed previously: + if shallowViewOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'ElectronViewFromSelectionAlg' + postfix ) + alg.selection = selectionDecorNamesOutput[ : ] + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + pass + + # Set up the electron efficiency correction algorithm: + alg = createAlgorithm( 'CP::ElectronEfficiencyCorrectionAlg', + 'ElectronEfficiencyCorrectionAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + addPrivateTool( alg, 'efficiencyCorrectionTool', + 'AsgElectronEfficiencyCorrectionTool' ) + alg.scaleFactorDecoration = 'effSF' + postfix + '_%SYS%' + alg.scaleFactorDecorationRegex = '(^EL_EFF_Reco.*)' + alg.efficiencyCorrectionTool.RecoKey = "Reconstruction" + alg.efficiencyCorrectionTool.CorrelationModel = "TOTAL" + if dataType == 'afii': + alg.efficiencyCorrectionTool.ForceDataType = \ + ROOT.PATCore.ParticleDataType.Fast + elif dataType == 'mc': + alg.efficiencyCorrectionTool.ForceDataType = \ + ROOT.PATCore.ParticleDataType.Full + pass + alg.outOfValidity = 2 #silent + alg.outOfValidityDeco = 'bad_eff' + postfix + if dataType != 'data': + seq.append( alg, inputPropName = 'electrons', + affectingSystematics = '(^EL_EFF_Reco.*)', + stageName = 'efficiency' ) + pass + + # Set up a final deep copy making algorithm if requested: + if deepCopyOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'ElectronDeepCopyMaker' + postfix ) + alg.selection = selectionDecorNamesOutput[:] + alg.deepCopy = True + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + pass + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/PhotonAnalysisSequence.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/PhotonAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..85583acf4453d5607083075e7b1e48e0a615daba --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/PhotonAnalysisSequence.py @@ -0,0 +1,219 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +# Framework import(s): +import ROOT + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + +def makePhotonAnalysisSequence( dataType, workingPoint, + deepCopyOutput = False, + postfix = '', + recomputeIsEM = False, + enableCutflow = False, + enableKinematicHistograms = False ): + """Create a photon analysis algorithm sequence + + Keywrod arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + workingPoint -- The working point to use + deepCopyOutput -- If set to 'True', the output containers will be + standalone, deep copies (slower, but needed for xAOD + output writing) + postfix -- a postfix to apply to decorations and algorithm + names. this is mostly used/needed when using this + sequence with multiple working points to ensure all + names are unique. + recomputeIsEM -- Whether to rerun the cut-based selection. If not, use derivation flags + enableCutflow -- Whether or not to dump the cutflow + enableKinematicHistograms -- Whether or not to dump the kinematic histograms + """ + + # Make sure we received a valid data type. + if dataType not in [ 'data', 'mc', 'afii' ]: + raise ValueError( 'Invalid data type: %' % dataType ) + + if postfix != '' : + postfix = '_' + postfix + pass + + splitWP = workingPoint.split ('.') + if len (splitWP) != 2 : + raise ValueError ('working point should be of format "quality.isolation", not ' + workingPoint) + + qualityWP = splitWP[0] + isolationWP = splitWP[1] + + if qualityWP == 'Tight' : + quality = ROOT.egammaPID.PhotonTight + pass + elif qualityWP == 'Loose' : + quality = ROOT.egammaPID.PhotonLoose + pass + else : + raise Exception ('unknown photon quality working point "' + qualityWP + '" should be Tight or Loose') + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "PhotonAnalysisSequence" + postfix ) + + # Variables keeping track of the selections being applied. + selectionDecorNames = [] + selectionDecorCount = [] + + # Set up the photon selection algorithm: + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'PhotonIsEMSelectorAlg' + postfix ) + alg.selectionDecoration = 'selectEM' + selectionDecorNames.append( alg.selectionDecoration ) + if recomputeIsEM: + # Rerun the cut-based ID + addPrivateTool( alg, 'selectionTool', 'AsgPhotonIsEMSelector' ) + alg.selectionTool.isEMMask = quality + alg.selectionTool.ConfigFile = \ + 'ElectronPhotonSelectorTools/offline/20180116/PhotonIsEMTightSelectorCutDefs.conf' + selectionDecorCount.append( 32 ) + else: + # Select from Derivation Framework flags + addPrivateTool( alg, 'selectionTool', 'CP::AsgFlagSelectionTool' ) + dfFlag = 'DFCommonPhotonsIsEM' + qualityWP + alg.selectionTool.selectionFlags = [ dfFlag ] + selectionDecorCount.append( 1 ) + pass + seq.append( alg, inputPropName = 'particles', + outputPropName = 'particlesOut', + stageName = 'calibration' ) + + # Select electrons only with good object quality. + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'PhotonObjectQualityAlg' + postfix ) + alg.selectionDecoration = 'goodOQ' + addPrivateTool( alg, 'selectionTool', 'CP::EgammaIsGoodOQSelectionTool' ) + alg.selectionTool.Mask = ROOT.xAOD.EgammaParameters.BADCLUSPHOTON + seq.append( alg, inputPropName = 'particles', + outputPropName = 'particlesOut', + stageName = 'calibration' ) + selectionDecorNames.append( alg.selectionDecoration ) + selectionDecorCount.append( 1 ) + + # Only run subsequent processing on the objects passing all of these cuts. + # Since these are independent of the photon calibration, and this speeds + # up the job. + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'PhotonPreSelViewFromSelectionAlg' + postfix ) + alg.selection = selectionDecorNames[ : ] + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'calibration' ) + + # Set up the calibration ans smearing algorithm. + alg = createAlgorithm( 'CP::EgammaCalibrationAndSmearingAlg', + 'PhotonCalibrationAndSmearingAlg' + postfix ) + addPrivateTool( alg, 'calibrationAndSmearingTool', + 'CP::EgammaCalibrationAndSmearingTool' ) + alg.calibrationAndSmearingTool.ESModel = 'es2018_R21_v0' + alg.calibrationAndSmearingTool.decorrelationModel = '1NP_v1' + if dataType == 'afii': + alg.calibrationAndSmearingTool.useAFII = 1 + else : + alg.calibrationAndSmearingTool.useAFII = 0 + pass + seq.append( alg, inputPropName = 'egammas', outputPropName = 'egammasOut', + affectingSystematics = '(^EG_RESOLUTION_.*)|(^EG_SCALE_.*)', + stageName = 'calibration' ) + + # should this be applied to data? or to AFII? + alg = createAlgorithm( 'CP::PhotonShowerShapeFudgeAlg', + 'PhotonShowerShapeFudgeAlg' + postfix ) + addPrivateTool( alg, 'showerShapeFudgeTool', + 'ElectronPhotonShowerShapeFudgeTool' ) + alg.showerShapeFudgeTool.Preselection = 21 # 21 = MC15 + alg.showerShapeFudgeTool.FFCalibFile = \ + 'ElectronPhotonShowerShapeFudgeTool/v1/PhotonFudgeFactors.root' #only for rel21 + seq.append( alg, inputPropName = 'photons', outputPropName = 'photonsOut', + stageName = 'calibration' ) + + # Set up the isolation correction algorithm. + alg = createAlgorithm( 'CP::EgammaIsolationCorrectionAlg', + 'PhotonIsolationCorrectionAlg' + postfix ) + addPrivateTool( alg, 'isolationCorrectionTool', + 'CP::IsolationCorrectionTool' ) + if dataType == 'data': + alg.isolationCorrectionTool.IsMC = 0 + else: + alg.isolationCorrectionTool.IsMC = 1 + pass + seq.append( alg, inputPropName = 'egammas', outputPropName = 'egammasOut', + stageName = 'selection' ) + + # Set up the isolation selection algorithm: + alg = createAlgorithm( 'CP::EgammaIsolationSelectionAlg', + 'PhotonIsolationSelectionAlg' + postfix ) + alg.selectionDecoration = 'isolated' + postfix + addPrivateTool( alg, 'selectionTool', 'CP::IsolationSelectionTool' ) + alg.selectionTool.PhotonWP = isolationWP + seq.append( alg, inputPropName = 'egammas', outputPropName = 'egammasOut', + stageName = 'selection' ) + selectionDecorNames.append( alg.selectionDecoration ) + selectionDecorCount.append( 1 ) + + # Set up the photon efficiency correction algorithm. + alg = createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg', + 'PhotonEfficiencyCorrectionAlg' + postfix ) + addPrivateTool( alg, 'efficiencyCorrectionTool', + 'AsgPhotonEfficiencyCorrectionTool' ) + alg.scaleFactorDecoration = 'effSF' + postfix + alg.efficiencyCorrectionTool.MapFilePath = \ + 'PhotonEfficiencyCorrection/2015_2017/rel21.2/Winter2018_Prerec_v1/map0.txt' + if dataType == 'afii': + alg.efficiencyCorrectionTool.ForceDataType = \ + ROOT.PATCore.ParticleDataType.Fast + elif dataType == 'mc': + alg.efficiencyCorrectionTool.ForceDataType = \ + ROOT.PATCore.ParticleDataType.Full + pass + alg.outOfValidity = 2 #silent + alg.outOfValidityDeco = 'bad_eff' + postfix + if dataType != 'data': + seq.append( alg, inputPropName = 'photons', + outputPropName = 'photonsOut', + affectingSystematics = '(^PH_EFF_.*)', + stageName = 'efficiency' ) + selectionDecorNames.append( alg.outOfValidityDeco ) + selectionDecorCount.append( 1 ) + pass + + # Set up an algorithm used to create photon selection cutflow: + if enableCutflow: + alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg', + 'PhotonCutFlowDumperAlg' + postfix ) + alg.histPattern = 'photon_cflow_%SYS%' + postfix + alg.selection = selectionDecorNames[ : ] + alg.selectionNCuts = selectionDecorCount[ : ] + seq.append( alg, inputPropName = 'input', + stageName = 'selection' ) + + # Set up an algorithm that makes a view container using the selections + # performed previously: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'PhotonViewFromSelectionAlg' + postfix ) + alg.selection = selectionDecorNames[ : ] + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + + # Set up an algorithm dumping the kinematic properties of the photons: + if enableKinematicHistograms: + alg = createAlgorithm( 'CP::KinematicHistAlg', 'PhotonKinematicDumperAlg' + postfix ) + alg.preselection = "&&".join (selectionDecorNames) + alg.histPattern = 'photon_%VAR%_%SYS%' + postfix + seq.append( alg, inputPropName = 'input', + stageName = 'selection' ) + + # Set up a final deep copy making algorithm if requested: + if deepCopyOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'PhotonDeepCopyMaker' + postfix ) + alg.deepCopy = True + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + pass + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5ccb446532599c01cc3844e5b1b18db06f721002 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +__version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..bbf680455ce301c37cc9a1900daa50095b940a88 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_eljob.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +if dataType == "data" : + sample.add (os.getenv ('ASG_TEST_FILE_DATA')) + pass +if dataType == "mc" : + sample.add (os.getenv ('ASG_TEST_FILE_MC')) + pass +if dataType == "afii" : + sample.add (os.getenv ('ASG_TEST_FILE_MC_AFII')) + pass +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +from EgammaAnalysisAlgorithms.EgammaAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging +for alg in algSeq : + job.algsAdd( alg ) + pass + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'egammaTest_'+dataType+'_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..f8b7e433b4d611c234ecd511a73266c034321549 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +# User options, which can be set from command line after a "-" character +# athena EgammaAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from EgammaAnalysisAlgorithms.EgammaAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='EgammaAnalysisAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d4ed8c1679c72c2f347d148ce09da4d9c9483072 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_entries.cxx @@ -0,0 +1,29 @@ +// AsgExampleTools_entries.cxx + +#include <GaudiKernel/DeclareFactoryEntries.h> + +#include <EgammaAnalysisAlgorithms/EgammaCalibrationAndSmearingAlg.h> +#include <EgammaAnalysisAlgorithms/EgammaIsGoodOQSelectionTool.h> +#include <EgammaAnalysisAlgorithms/EgammaIsolationCorrectionAlg.h> +#include <EgammaAnalysisAlgorithms/EgammaIsolationSelectionAlg.h> +#include <EgammaAnalysisAlgorithms/ElectronEfficiencyCorrectionAlg.h> +#include <EgammaAnalysisAlgorithms/PhotonEfficiencyCorrectionAlg.h> +#include <EgammaAnalysisAlgorithms/PhotonShowerShapeFudgeAlg.h> + +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EgammaCalibrationAndSmearingAlg) +DECLARE_NAMESPACE_TOOL_FACTORY (CP, EgammaIsGoodOQSelectionTool) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EgammaIsolationCorrectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EgammaIsolationSelectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, ElectronEfficiencyCorrectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, PhotonEfficiencyCorrectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, PhotonShowerShapeFudgeAlg) + +DECLARE_FACTORY_ENTRIES(EgammaAnalysisAlgorithms) { + DECLARE_NAMESPACE_ALGORITHM (CP, EgammaCalibrationAndSmearingAlg) + DECLARE_NAMESPACE_TOOL (CP, EgammaIsGoodOQSelectionTool) + DECLARE_NAMESPACE_ALGORITHM (CP, EgammaIsolationCorrectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, EgammaIsolationSelectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, ElectronEfficiencyCorrectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, PhotonEfficiencyCorrectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, PhotonShowerShapeFudgeAlg) +} diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fe3d2b768fca0948d9adf76951bedfd880d2ee68 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_load.cxx @@ -0,0 +1,3 @@ +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(EgammaAnalysisAlgorithms) diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..fce4b747c7714639128fabc463373253b38e06fc --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,61 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# The name of the package: +atlas_subdir( FTagAnalysisAlgorithms ) + +atlas_depends_on_subdirs( + PUBLIC + Event/xAOD/xAODJet + PhysicsAnalysis/Algorithms/SelectionHelpers + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PhysicsAnalysis/Interfaces/FTagAnalysisInterfaces ) + +atlas_add_library( FTagAnalysisAlgorithmsLib + FTagAnalysisAlgorithms/*.h FTagAnalysisAlgorithms/*.icc Root/*.cxx + PUBLIC_HEADERS FTagAnalysisAlgorithms + LINK_LIBRARIES xAODJet SelectionHelpersLib SystematicsHandlesLib + AnaAlgorithmLib FTagAnalysisInterfacesLib ) + +atlas_add_dictionary( FTagAnalysisAlgorithmsDict + FTagAnalysisAlgorithms/FTagAnalysisAlgorithmsDict.h + FTagAnalysisAlgorithms/selection.xml + LINK_LIBRARIES FTagAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( FTagAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel FTagAnalysisAlgorithmsLib ) +endif() + +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*_jobOptions.py ) +atlas_install_scripts( share/*_eljob.py ) + +if( XAOD_STANDALONE ) + atlas_add_test( testJobData + SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) +elseif( NOT "${CMAKE_PROJECT_NAME}" STREQUAL "AthDerivation" ) + atlas_add_test( testJobData + SCRIPT athena.py + FTagAnalysisAlgorithms/FTagAnalysisAlgorithmsTest_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT athena.py + FTagAnalysisAlgorithms/FTagAnalysisAlgorithmsTest_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT athena.py + FTagAnalysisAlgorithms/FTagAnalysisAlgorithmsTest_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) +endif() diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/BTaggingEfficiencyAlg.h b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/BTaggingEfficiencyAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..d19d19630f2ee6f2e9a2848f856bcb671f3c1985 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/BTaggingEfficiencyAlg.h @@ -0,0 +1,81 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef F_TAG_ANALYSIS_ALGORITHMS__B_TAGGING_EFFICIENCY_ALG_H +#define F_TAG_ANALYSIS_ALGORITHMS__B_TAGGING_EFFICIENCY_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <FTagAnalysisInterfaces/IBTaggingEfficiencyTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <xAODJet/JetContainer.h> +#include <memory> + +namespace CP +{ + /// \brief an algorithm for calling \ref IBTaggingEfficiencyTool + + class BTaggingEfficiencyAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + BTaggingEfficiencyAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IBTaggingEfficiencyTool> m_efficiencyTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "Jets", "the jet collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + + /// \brief the decoration for the b-tagging scale factor + private: + SysDecorationHandle<float> m_scaleFactorDecoration { + this, "scaleFactorDecoration", "", "the decoration for the b-tagging efficiency scale factor"}; + + /// \brief the decoration for the b-tagging selection + private: + SelectionReadHandle m_selectionHandle { + this, "selectionDecoration", "", "the decoration for the asg selection"}; + + /// \brief only run the inefficency for all jets + private: + bool m_onlyInefficiency {false}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..dd476fc0233a6b4f8d9152aef636a20b22ef4d23 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithmsDict.h @@ -0,0 +1,13 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef F_TAG_ANALYSIS_ALGORITHMS__F_TAG_ANALYSIS_ALGORITHMS_DICT_H +#define F_TAG_ANALYSIS_ALGORITHMS__F_TAG_ANALYSIS_ALGORITHMS_DICT_H + +#include <FTagAnalysisAlgorithms/BTaggingEfficiencyAlg.h> + +#endif diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..ebaebc249669d3cb1748e62ae3a5d348181eaa47 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/FTagAnalysisAlgorithms/selection.xml @@ -0,0 +1,5 @@ +<lcgdict> + + <class name="CP::BTaggingEfficiencyAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/Root/BTaggingEfficiencyAlg.cxx b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/Root/BTaggingEfficiencyAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0e901cbe8a437e068889e2ff3a52601f6bbb2245 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/Root/BTaggingEfficiencyAlg.cxx @@ -0,0 +1,101 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <FTagAnalysisAlgorithms/BTaggingEfficiencyAlg.h> + +// +// method implementations +// + +namespace CP +{ + BTaggingEfficiencyAlg :: + BTaggingEfficiencyAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_efficiencyTool ("BTaggingEfficiencyTool", this) + { + declareProperty ("efficiencyTool", m_efficiencyTool, "the calibration and smearing tool we apply"); + declareProperty ("onlyInefficiency", m_onlyInefficiency, "whether only to calculate inefficiencies"); + } + + + + StatusCode BTaggingEfficiencyAlg :: + initialize () + { + if (m_onlyInefficiency && m_selectionHandle) + { + ANA_MSG_ERROR ("can't specify both onlyInefficiency and selectionDecoration"); + return StatusCode::FAILURE; + } + + if (m_scaleFactorDecoration.empty()) + { + ANA_MSG_ERROR ("no scale factor decoration name set"); + return StatusCode::FAILURE; + } + + ANA_CHECK (m_efficiencyTool.retrieve()); + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_selectionHandle.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + + return StatusCode::SUCCESS; + } + + + + StatusCode BTaggingEfficiencyAlg :: + execute () + { + ANA_CHECK (m_scaleFactorDecoration.preExecute (m_systematicsList)); + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_efficiencyTool->applySystematicVariation (sys)); + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + for (xAOD::Jet *jet : *jets) + { + if (m_preselection.getBool (*jet)) + { + float sf = 0; + + // The efficiency tool can calculate both efficiencies and + // inefficiencies. This setup can calculate either, or + // both; in the case of the later a selection decoration is + // used to decide whether to calculate efficiencies or + // inefficiencies. + // + // Note that if you want to exclude jets from processing, + // this selection accessor/decoration has nothing to do with + // it. You do the pre-selection via a view container like + // for all the other CP algorithms. + if (!m_onlyInefficiency && m_selectionHandle.getBool (*jet)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_efficiencyTool->getScaleFactor (*jet, sf)); + } else + { + ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_efficiencyTool->getInefficiencyScaleFactor (*jet, sf)); + } + m_scaleFactorDecoration.set (*jet, sf, sys); + } else { + m_scaleFactorDecoration.set (*jet, invalidScaleFactor(), sys); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisAlgorithmsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..7e0c9e5bb4e118d9b4f92d246e4d0c1169113c3e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisAlgorithmsTest.py @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +from AnaAlgorithm.AlgSequence import AlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm + +def makeSequence (dataType, jetContainer="AntiKt4EMPFlowJets") : + + algSeq = AlgSequence() + + # Set up the systematics loader/handler algorithm: + sysLoader = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + sysLoader.sigmaRecommended = 1 + algSeq += sysLoader + + # Include, and then set up the jet analysis algorithm sequence: + from JetAnalysisAlgorithms.JetAnalysisSequence import makeJetAnalysisSequence + jetSequence = makeJetAnalysisSequence( dataType, jetContainer, + enableCutflow=True, enableKinematicHistograms=True ) + from FTagAnalysisAlgorithms.FTagAnalysisSequence import makeFTagAnalysisSequence + makeFTagAnalysisSequence( jetSequence, dataType, jetContainer, noEfficiency = True, legacyRecommendations = True, + enableCutflow=True ) + jetSequence.configure( inputName = jetContainer, outputName = 'AnalysisJets_%SYS%' ) + + # Add the sequence to the job: + algSeq += jetSequence + + return algSeq diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisSequence.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..505ac45816cf086f226afd79c22edf8bd2b358c0 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisSequence.py @@ -0,0 +1,112 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + +def makeFTagAnalysisSequence( seq, dataType, jetCollection, + btagWP = "FixedCutBEff_77", + btagger = "MV2c10", + postfix = "", + preselection=None, + kinematicSelection = False, + noEfficiency = False, + legacyRecommendations = False, + enableCutflow = False ): + """Create a ftag analysis algorithm sequence + + for now the sequence is passed in, I'm unsure if I can concatenate + two sequences at the moment, or if that blows things up horribly + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + jetCollection -- Jet container to run on + btagWP -- Flavour tagging working point + btagger -- Flavour tagger + kinematicSelection -- Wether to run kinematic selection + noEfficiency -- Wether to run efficiencies calculation + legacyRecommendations -- Use legacy recommendations without shallow copied containers + enableCutflow -- Whether or not to dump the cutflow + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + if legacyRecommendations: + # Remove b-tagging calibration from the container name + btIndex = jetCollection.find('_BTagging') + if btIndex != -1: + jetCollection = jetCollection[:btIndex] + + bTagCalibFile = "xAODBTaggingEfficiency/13TeV/2017-21-13TeV-MC16-CDI-2019-07-30_v1.root" + else: + bTagCalibFile = "xAODBTaggingEfficiency/13TeV/2019-21-13TeV-MC16-CDI-2019-10-07_v1.root" + + # # Create the analysis algorithm sequence object: + # seq = AnaAlgSequence( "FTagAnalysisSequence" ) + + if kinematicSelection: + # Set up the ftag kinematic selection algorithm(s): + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'FTagKinSelectionAlg'+postfix ) + addPrivateTool( alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool' ) + alg.selectionTool.minPt = 20e3 + alg.selectionTool.maxEta = 2.5 + alg.selectionDecoration = 'ftag_kin_select' + seq.append( alg, inputPropName = 'particles', + outputPropName = 'particlesOut' ) + + # Set up an algorithm that makes a view container using the selections + # performed previously: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'FTagKinViewFromSelectionAlg'+postfix ) + alg.selection = [ 'ftag_kin_select' ] + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + + # Set up the ftag selection algorithm(s): + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'FTagSelectionAlg' + btagger + btagWP + postfix ) + addPrivateTool( alg, 'selectionTool', 'BTaggingSelectionTool' ) + alg.selectionTool.TaggerName = btagger + alg.selectionTool.OperatingPoint = btagWP + alg.selectionTool.JetAuthor = jetCollection + alg.selectionTool.FlvTagCutDefinitionsFileName = bTagCalibFile + if preselection is not None: + alg.preselection = preselection + alg.selectionDecoration = 'ftag_select_' + btagger + '_' + btagWP + ',as_char' + seq.append( alg, inputPropName = 'particles', + outputPropName = 'particlesOut', + stageName = 'selection' ) + + if not noEfficiency and dataType != 'data': + # Set up the efficiency calculation algorithm: + alg = createAlgorithm( 'CP::BTaggingEfficiencyAlg', + 'FTagEfficiencyScaleFactorAlg' + btagger + btagWP + postfix ) + addPrivateTool( alg, 'efficiencyTool', + 'BTaggingEfficiencyTool' ) + alg.efficiencyTool.TaggerName = btagger + alg.efficiencyTool.OperatingPoint = btagWP + alg.efficiencyTool.JetAuthor = jetCollection + alg.efficiencyTool.ScaleFactorFileName = bTagCalibFile + alg.efficiencyTool.SystematicsStrategy = "Envelope" + alg.scaleFactorDecoration = 'ftag_effSF_' + btagger + '_' + btagWP + '_%SYS%' + alg.scaleFactorDecorationRegex = '(^FT_EFF_.*)' + alg.selectionDecoration = 'ftag_select_' + btagger + '_' + btagWP + ',as_char' + alg.outOfValidity = 2 + alg.outOfValidityDeco = 'no_ftag_' + btagger + '_' + btagWP + if preselection is not None: + alg.preselection = preselection + seq.append( alg, inputPropName = 'jets', + affectingSystematics = '(^FT_EFF_.*)', + stageName = 'efficiency' ) + pass + + # Set up an algorithm used to create f-tag selection cutflow: + if enableCutflow: + alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg', 'FTagCutFlowDumperAlg' + btagger + btagWP + postfix ) + alg.histPattern = 'ftag_cflow_' + btagger + '_' + btagWP + '_%SYS%' + alg.selection = ['ftag_select_' + btagger + '_' + btagWP + ',as_char'] + alg.selectionNCuts = [1] # really we have 4 cuts, but we use char + seq.append( alg, inputPropName = 'input', + stageName = 'selection' ) + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5ccb446532599c01cc3844e5b1b18db06f721002 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +__version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..44a9e6a3d26cdb1bdce0684174e80b171480ddac --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_eljob.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# this forces the jet algorithms dictionary to be loaded before +# anything else, which works around some strange dictionary issues I +# don't understand. +ROOT.CP.JetCalibrationAlg ("dummy", None) + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +sample.add (os.getenv (inputfile[dataType])) +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +from FTagAnalysisAlgorithms.FTagAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'jetTest_'+dataType+'_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..91d0e0056a66e05ec5a52715da308929552e0d31 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +# User options, which can be set from command line after a "-" character +# athena EgammaAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from FTagAnalysisAlgorithms.FTagAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='JetAnalysisAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/src/components/FTagAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/src/components/FTagAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..05df68d48072e4f484febf42f5d33811d2051381 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/src/components/FTagAnalysisAlgorithms_entries.cxx @@ -0,0 +1,11 @@ +// AsgExampleTools_entries.cxx + +#include <GaudiKernel/DeclareFactoryEntries.h> + +#include <FTagAnalysisAlgorithms/BTaggingEfficiencyAlg.h> + +DECLARE_ALGORITHM_FACTORY (CP::BTaggingEfficiencyAlg) + +DECLARE_FACTORY_ENTRIES(FTagAnalysisAlgorithms) { + DECLARE_ALGORITHM (CP::BTaggingEfficiencyAlg) +} diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/src/components/FTagAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/src/components/FTagAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7542cfe5a54de55a238454183dfac20fa8e6af9c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/src/components/FTagAnalysisAlgorithms_load.cxx @@ -0,0 +1,5 @@ +// AsgExampleTools_load.cxx + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(FTagAnalysisAlgorithms) diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..44c39deb7c52c37b440dd9c9dd84cf7cf6955052 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,88 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# The name of the package: +atlas_subdir( JetAnalysisAlgorithms ) + +atlas_depends_on_subdirs( + PUBLIC + Event/xAOD/xAODJet + PhysicsAnalysis/Algorithms/SelectionHelpers + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/D3PDTools/AnaAlgorithm + Reconstruction/Jet/JetCalibTools + Reconstruction/Jet/JetCPInterfaces + Reconstruction/Jet/JetInterface + Reconstruction/Jet/JetJvtEfficiency + Reconstruction/Jet/JetResolution + Reconstruction/MET/METUtilities ) + +atlas_add_library( JetAnalysisAlgorithmsLib + JetAnalysisAlgorithms/*.h JetAnalysisAlgorithms/*.icc Root/*.cxx + PUBLIC_HEADERS JetAnalysisAlgorithms + LINK_LIBRARIES xAODJet SelectionHelpersLib SystematicsHandlesLib + AnaAlgorithmLib JetCalibToolsLib JetInterface JetResolutionLib + JetCPInterfaces JetJvtEfficiencyLib JetAnalysisInterfacesLib METUtilitiesLib ) + +atlas_add_dictionary( JetAnalysisAlgorithmsDict + JetAnalysisAlgorithms/JetAnalysisAlgorithmsDict.h + JetAnalysisAlgorithms/selection.xml + LINK_LIBRARIES JetAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( JetAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel JetAnalysisAlgorithmsLib ) +endif() + +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*_jobOptions.py ) +atlas_install_scripts( share/*_eljob.py ) + +if( XAOD_STANDALONE ) + atlas_add_test( testJobDataEMTopo + SCRIPT JetAnalysisAlgorithmsTest_EMTopo_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobDataPFlow + SCRIPT JetAnalysisAlgorithmsTest_PFlow_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSimEMTopo + SCRIPT JetAnalysisAlgorithmsTest_EMTopo_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSimPFlow + SCRIPT JetAnalysisAlgorithmsTest_PFlow_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSimEMTopo + SCRIPT JetAnalysisAlgorithmsTest_EMTopo_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSimPFlow + SCRIPT JetAnalysisAlgorithmsTest_PFlow_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) +else() + atlas_add_test( testJobDataEMTopo + SCRIPT athena.py + JetAnalysisAlgorithms/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobDataPFlow + SCRIPT athena.py + JetAnalysisAlgorithms/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSimEMTopo + SCRIPT athena.py + JetAnalysisAlgorithms/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSimPFlow + SCRIPT athena.py + JetAnalysisAlgorithms/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSimEMTopo + SCRIPT athena.py + JetAnalysisAlgorithms/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSimPFlow + SCRIPT athena.py + JetAnalysisAlgorithms/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) +endif() diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..3f2128c28272d43e761db7c4fb7aeee482afcea6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithmsDict.h @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef JET_ANALYSIS_ALGORITHMS__JET_ANALYSIS_ALGORITHMS_DICT_H +#define JET_ANALYSIS_ALGORITHMS__JET_ANALYSIS_ALGORITHMS_DICT_H + +#include <JetAnalysisAlgorithms/JetCalibrationAlg.h> +#include <JetAnalysisAlgorithms/JetGhostMuonAssociationAlg.h> +#include <JetAnalysisAlgorithms/JetModifierAlg.h> +#include <JetAnalysisAlgorithms/JetSelectionAlg.h> +#include <JetAnalysisAlgorithms/JetSmearingAlg.h> +#include <JetAnalysisAlgorithms/JetUncertaintiesAlg.h> +#include <JetAnalysisAlgorithms/JvtEfficiencyAlg.h> +#include <JetAnalysisAlgorithms/JvtUpdateAlg.h> + +#endif diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetCalibrationAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetCalibrationAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..61a745b581ca356d5ddba1d5cff8cc38e5de5a5a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetCalibrationAlg.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef JET_ANALYSIS_ALGORITHMS__JET_CALIBRATION_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JET_CALIBRATION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <JetCalibTools/IJetCalibrationTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IJetCalibrationTool + + class JetCalibrationAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JetCalibrationAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the calibration tool + private: + ToolHandle<IJetCalibrationTool> m_calibrationTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "AntiKt4EMTopoJets", "the jet collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetGhostMuonAssociationAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetGhostMuonAssociationAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..66951ced52797c91cb2d83a64fd81dfeb807b47f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetGhostMuonAssociationAlg.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef JET_ANALYSIS_ALGORITHMS__JET_GHOST_MUON_ASSOCIATION_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JET_GHOST_MUON_ASSOCIATION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODJet/JetContainer.h> + +namespace CP +{ + /// \brief an algorithm for adding ghost muons to jets + + class JetGhostMuonAssociationAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JetGhostMuonAssociationAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "AntiKt4EMTopoJets", "the jet collection to run on"}; + }; +} + +#endif // JET_ANALYSIS_ALGORITHMS__JET_GHOST_MUON_ASSOCIATION_ALG_H diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetModifierAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetModifierAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..548e29202b20e43bcf490fe4f78265e15720ad75 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetModifierAlg.h @@ -0,0 +1,56 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef JET_ANALYSIS_ALGORITHMS__JET_MODIFIER_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JET_MODIFIER_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <JetInterface/IJetModifier.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IJetModifierTool + + class JetModifierAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JetModifierAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the modifier tool + private: + ToolHandle<IJetModifier> m_modifierTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "AntiKt4EMTopoJets", "the jet collection to run on"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetSelectionAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..14e727242a5c770df989c32222ebc705d9029ff1 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetSelectionAlg.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef JET_ANALYSIS_ALGORITHMS__JET_SELECTION_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JET_SELECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <JetInterface/IJetSelector.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODJet/JetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IJetSelector + + class JetSelectionAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JetSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the selection tool + private: + ToolHandle<IJetSelector> m_selectionTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "AntiKt4EMTopoJets", "the jet collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the decoration for the jet selection + private: + std::string m_selectionDecoration {"clean_jet"}; + + /// \brief the accessor for \ref m_selectionDecoration + private: + std::unique_ptr<ISelectionAccessor> m_selectionAccessor; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetSmearingAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetSmearingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..ef56cf1848191122ce48b1dcc1e1baa3753690d5 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetSmearingAlg.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef JET_ANALYSIS_ALGORITHMS__JET_SMEARING_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JET_SMEARING_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <JetResolution/IJERSmearingTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODJet/JetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IJERSmearingTool + + class JetSmearingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JetSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IJERSmearingTool> m_smearingTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "AntiKt4EMTopoJets", "the jet collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetUncertaintiesAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetUncertaintiesAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..70efa430e4a30bc401e42ed4ef42e8eb1b50fa58 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetUncertaintiesAlg.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef JET_ANALYSIS_ALGORITHMS__JET_UNCERTAINTIES_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JET_UNCERTAINTIES_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <JetCPInterfaces/ICPJetUncertaintiesTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref ICPJetUncertaintiesTool + + class JetUncertaintiesAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JetUncertaintiesAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the uncertainties tool + private: + ToolHandle<ICPJetUncertaintiesTool> m_uncertaintiesTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "AntiKt4EMTopoJets", "the jet collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JvtEfficiencyAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JvtEfficiencyAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..e4850b108274b8e8c8410c59079b1478e794b707 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JvtEfficiencyAlg.h @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef JET_ANALYSIS_ALGORITHMS__JVT_EFFICIENCY_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JVT_EFFICIENCY_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <JetAnalysisInterfaces/IJetJvtEfficiency.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODJet/JetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IJEREfficiencyTool + + class JvtEfficiencyAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JvtEfficiencyAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the efficiency tool + private: + ToolHandle<CP::IJetJvtEfficiency> m_efficiencyTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "AntiKt4EMTopoJets", "the jet collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the truth jet collection to use + private: + std::string m_truthJetsName; + + /// \brief differenciate between JVT and fJVT + private: + bool m_dofJVT = false; + + /// \brief the decoration for the fJVT selection + private: + std::string m_fJVTStatus; + + /// \brief the accessor for \ref m_fJVTStatus + private: + std::unique_ptr<ISelectionAccessor> m_fJVTStatusAccessor; + + /// \brief the decoration for the JVT selection + private: + std::string m_selection; + + /// \brief the accessor for \ref m_selection + private: + std::unique_ptr<ISelectionAccessor> m_selectionAccessor; + + /// \brief the decoration for the JVT scale factor + private: + SysDecorationHandle<float> m_scaleFactorDecoration { + this, "scaleFactorDecoration", "", "the decoration for the JVT efficiency scale factor"}; + + /// \brief whether to skip efficiency calculation if the selection failed + private: + bool m_skipBadEfficiency = false; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JvtUpdateAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JvtUpdateAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..bc3b8c1c8fd4936259fe342c50a1763e71644528 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JvtUpdateAlg.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef JET_ANALYSIS_ALGORITHMS__JVT_UPDATE_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JVT_UPDATE_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <JetInterface/IJetUpdateJvt.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODJet/JetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IJetUpdateJvt + + class JvtUpdateAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JvtUpdateAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the update tool + private: + ToolHandle<IJetUpdateJvt> m_jvtTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the jet collection we run on + private: + SysCopyHandle<xAOD::JetContainer> m_jetHandle { + this, "jets", "AntiKt4EMTopoJets", "the jet collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the name of the decoration we create + private: + std::string m_decorationName {"Jvt"}; + + /// \brief the decoration accessor we use + private: + std::unique_ptr<SG::AuxElement::Accessor<float> > m_decorationAccessor; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..a851d1f967b420f8c737f111984a2d02834e751c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/selection.xml @@ -0,0 +1,12 @@ +<lcgdict> + + <class name="CP::JetCalibrationAlg" /> + <class name="CP::JetGhostMuonAssociationAlg" /> + <class name="CP::JetModifierAlg" /> + <class name="CP::JetSelectionAlg" /> + <class name="CP::JetSmearingAlg" /> + <class name="CP::JetUncertaintiesAlg" /> + <class name="CP::JvtEfficiencyAlg" /> + <class name="CP::JvtUpdateAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetCalibrationAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetCalibrationAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3f820c72a55a216a44e3f77cf45ce9cf7631d353 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetCalibrationAlg.cxx @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <JetAnalysisAlgorithms/JetCalibrationAlg.h> + +// +// method implementations +// + +namespace CP +{ + JetCalibrationAlg :: + JetCalibrationAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_calibrationTool ("JetCalibrationTool", this) + { + declareProperty ("calibrationTool", m_calibrationTool, "the calibration tool we apply"); + } + + + + StatusCode JetCalibrationAlg :: + initialize () + { + ANA_CHECK (m_calibrationTool.retrieve()); + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode JetCalibrationAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + for (xAOD::Jet *jet : *jets) + { + if (m_preselection.getBool (*jet)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_calibrationTool->applyCorrection (*jet)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetGhostMuonAssociationAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetGhostMuonAssociationAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..278eac5c369a0ce868e484a6b68ceb0a37823fb8 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetGhostMuonAssociationAlg.cxx @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + +// +// includes +// + +#include <JetAnalysisAlgorithms/JetGhostMuonAssociationAlg.h> +#include <METUtilities/METHelpers.h> +#include <xAODMuon/MuonContainer.h> + +// +// method implementations +// + +namespace CP +{ + JetGhostMuonAssociationAlg :: + JetGhostMuonAssociationAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + } + + + StatusCode JetGhostMuonAssociationAlg :: + initialize () + { + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.initialize()); + return StatusCode::SUCCESS; + } + + + StatusCode JetGhostMuonAssociationAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + + // associate the ghost muons to the jets (needed by MET muon-jet OR later) + const xAOD::MuonContainer* muons = nullptr; + ATH_CHECK( evtStore()->retrieve(muons, "Muons") ); + met::addGhostMuonsToJets(*muons, *jets); + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetModifierAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetModifierAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9ebd150c9db8794bb8d5d8130e23e32fb5c2e596 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetModifierAlg.cxx @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <JetAnalysisAlgorithms/JetModifierAlg.h> + +// +// method implementations +// + +namespace CP +{ + JetModifierAlg :: + JetModifierAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_modifierTool ("JetForwardJvtTool", this) + { + declareProperty ("modifierTool", m_modifierTool, "the modifier tool we apply"); + } + + + + StatusCode JetModifierAlg :: + initialize () + { + ANA_CHECK (m_modifierTool.retrieve()); + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode JetModifierAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + if (m_modifierTool->modify (*jets) != 0) + { + ANA_MSG_ERROR ("Failed to call \"m_modifierTool->modify (*jets)\""); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetSelectionAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetSelectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..575adc9b7d29baa6467cc0bb5690de358094bad0 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetSelectionAlg.cxx @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <JetAnalysisAlgorithms/JetSelectionAlg.h> + +#include <SelectionHelpers/SelectionHelpers.h> + +// +// method implementations +// + +namespace CP +{ + JetSelectionAlg :: + JetSelectionAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_selectionTool ("", this) + { + declareProperty ("selectionTool", m_selectionTool, "the selection tool we apply"); + declareProperty ("selectionDecoration", m_selectionDecoration, "the decoration for the jet selection"); + } + + + + StatusCode JetSelectionAlg :: + initialize () + { + ANA_CHECK (m_selectionTool.retrieve()); + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + + if (m_selectionDecoration.empty()) + { + ANA_MSG_ERROR ("no selection decoration name set"); + return StatusCode::FAILURE; + } + ANA_CHECK (makeSelectionAccessor (m_selectionDecoration, m_selectionAccessor)); + + return StatusCode::SUCCESS; + } + + + + StatusCode JetSelectionAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + for (xAOD::Jet *jet : *jets) + { + if (m_preselection.getBool (*jet)) + { + m_selectionAccessor->setBool + (*jet, m_selectionTool->keep(*jet)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetSmearingAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetSmearingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..55438e290a57f925ac07b9b2c8814eb6c95bdc63 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetSmearingAlg.cxx @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <JetAnalysisAlgorithms/JetSmearingAlg.h> + +// +// method implementations +// + +namespace CP +{ + JetSmearingAlg :: + JetSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_smearingTool ("JERSmearingTool", this) + { + declareProperty ("smearingTool", m_smearingTool, "the smearing tool we apply"); + } + + + + StatusCode JetSmearingAlg :: + initialize () + { + ANA_CHECK (m_smearingTool.retrieve()); + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_smearingTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode JetSmearingAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_smearingTool->applySystematicVariation (sys)); + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + for (xAOD::Jet *jet : *jets) + { + if (m_preselection.getBool (*jet)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_smearingTool->applyCorrection (*jet)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetUncertaintiesAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetUncertaintiesAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ed1f72889d6956a90ea0cda6f58ef1da5c518fff --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetUncertaintiesAlg.cxx @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <JetAnalysisAlgorithms/JetUncertaintiesAlg.h> + +// +// method implementations +// + +namespace CP +{ + JetUncertaintiesAlg :: + JetUncertaintiesAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_uncertaintiesTool ("JetUncertaintiesTool", this) + { + declareProperty ("uncertaintiesTool", m_uncertaintiesTool, "the uncertainties tool we apply"); + } + + + + StatusCode JetUncertaintiesAlg :: + initialize () + { + ANA_CHECK (m_uncertaintiesTool.retrieve()); + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_uncertaintiesTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode JetUncertaintiesAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_uncertaintiesTool->applySystematicVariation (sys)); + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + for (xAOD::Jet *jet : *jets) + { + if (m_preselection.getBool (*jet)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_uncertaintiesTool->applyCorrection (*jet)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JvtEfficiencyAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JvtEfficiencyAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..765a6f635149c3fc7262926af512e207c100cb69 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JvtEfficiencyAlg.cxx @@ -0,0 +1,114 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <JetAnalysisAlgorithms/JvtEfficiencyAlg.h> + +#include <SelectionHelpers/SelectionHelpers.h> + +// +// method implementations +// + +namespace CP +{ + JvtEfficiencyAlg :: + JvtEfficiencyAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_efficiencyTool ("", this) + , m_truthJetsName("AntiKt4TruthJets") + { + declareProperty ("efficiencyTool", m_efficiencyTool, "the efficiency tool we apply"); + declareProperty ("dofJVT", m_dofJVT, "differenciate between JVT and fJVT"); + declareProperty ("fJVTStatus", m_fJVTStatus, "the decoration for the fJVT status"); + declareProperty ("selection", m_selection, "the decoration for the JVT selection"); + declareProperty ("skipBadEfficiency", m_skipBadEfficiency, "whether to skip efficiency calculation if the selection failed"); + declareProperty ("truthJetCollection", m_truthJetsName, "the truth jet collection to use for truth tagging"); + } + + + + StatusCode JvtEfficiencyAlg :: + initialize () + { + if (m_dofJVT && m_fJVTStatus.empty()) + { + ANA_MSG_ERROR ("fJVTStatus decoration needs to be configured when running fJVT"); + return StatusCode::FAILURE; + } + + ANA_CHECK (m_efficiencyTool.retrieve()); + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + + if (m_dofJVT && !m_fJVTStatus.empty()) + ANA_CHECK (makeSelectionAccessor (m_fJVTStatus, m_fJVTStatusAccessor)); + + if (!m_selection.empty()) + ANA_CHECK (makeSelectionAccessor (m_selection, m_selectionAccessor)); + + return StatusCode::SUCCESS; + } + + + + StatusCode JvtEfficiencyAlg :: + execute () + { + ANA_CHECK (m_scaleFactorDecoration.preExecute (m_systematicsList)); + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_efficiencyTool->applySystematicVariation (sys)); + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + + const xAOD::JetContainer *truthjets = nullptr; + if(!m_truthJetsName.empty()) { + ANA_CHECK(evtStore()->retrieve(truthjets,m_truthJetsName)); + ANA_CHECK(m_efficiencyTool->tagTruth(jets,truthjets)); + } + + for (xAOD::Jet *jet : *jets) + { + if (m_preselection.getBool (*jet)) + { + bool goodJet = true; + if (m_selectionAccessor || m_skipBadEfficiency) + { + goodJet = m_dofJVT ? m_fJVTStatusAccessor->getBool (*jet) : m_efficiencyTool->passesJvtCut (*jet); + if (m_selectionAccessor) + m_selectionAccessor->setBool (*jet, goodJet); + } + if (m_scaleFactorDecoration) + { + float sf = 1; + if (goodJet) { + ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_efficiencyTool->getEfficiencyScaleFactor (*jet, sf)); + } else if (!m_skipBadEfficiency) { + ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_efficiencyTool->getInefficiencyScaleFactor (*jet, sf)); + } + m_scaleFactorDecoration.set (*jet, sf, sys); + } + } else { + if (m_selectionAccessor) + m_selectionAccessor->setBool (*jet, false); + + if (m_scaleFactorDecoration) + m_scaleFactorDecoration.set (*jet, invalidScaleFactor(), sys); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JvtUpdateAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JvtUpdateAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..15df9bf8c98a34454cbf952b3e7d99e8b75bb094 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JvtUpdateAlg.cxx @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <JetAnalysisAlgorithms/JvtUpdateAlg.h> + +// +// method implementations +// + +namespace CP +{ + JvtUpdateAlg :: + JvtUpdateAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_jvtTool ("", this) + { + declareProperty ("jvtTool", m_jvtTool, "the jvt tool we apply"); + declareProperty ("decorationName", m_decorationName, "the decoration name to use"); + } + + + + StatusCode JvtUpdateAlg :: + initialize () + { + if (m_decorationName.empty()) + { + ANA_MSG_ERROR ("decoration name set to empty string, not allowed"); + return StatusCode::FAILURE; + } + m_decorationAccessor = std::make_unique + <SG::AuxElement::Accessor<float> > (m_decorationName); + + ANA_CHECK (m_jvtTool.retrieve()); + m_systematicsList.addHandle (m_jetHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode JvtUpdateAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::JetContainer *jets = nullptr; + ANA_CHECK (m_jetHandle.getCopy (jets, sys)); + for (xAOD::Jet *jet : *jets) + { + if (m_preselection.getBool (*jet)) + { + // manually update jvt decoration using the tool + const float jvt = m_jvtTool->updateJvt (*jet); + (*m_decorationAccessor) (*jet) = jvt; + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisAlgorithmsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..6d04dd9bd5da853a4c566f00de62dca09a75343b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisAlgorithmsTest.py @@ -0,0 +1,71 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +from AnaAlgorithm.AlgSequence import AlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm + +def makeSequence (dataType, jetContainer="AntiKt4EMPFlowJets") : + + # config + + + algSeq = AlgSequence() + + # Set up the systematics loader/handler algorithm: + sysLoader = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + sysLoader.sigmaRecommended = 1 + algSeq += sysLoader + + # Include, and then set up the pileup analysis sequence: + from AsgAnalysisAlgorithms.PileupAnalysisSequence import \ + makePileupAnalysisSequence + pileupSequence = makePileupAnalysisSequence( dataType ) + pileupSequence.configure( inputName = 'EventInfo', outputName = 'EventInfo_%SYS%' ) + print( pileupSequence ) # For debugging + + # Include, and then set up the jet analysis algorithm sequence: + from JetAnalysisAlgorithms.JetAnalysisSequence import makeJetAnalysisSequence + jetSequence = makeJetAnalysisSequence( dataType, jetContainer, enableCutflow=True, enableKinematicHistograms=True ) + jetSequence.configure( inputName = jetContainer, outputName = 'AnalysisJetsBase_%SYS%' ) + print( jetSequence ) # For debugging + + # Include, and then set up the jet analysis algorithm sequence: + from JetAnalysisAlgorithms.JetJvtAnalysisSequence import makeJetJvtAnalysisSequence + jvtSequence = makeJetJvtAnalysisSequence( dataType, jetContainer, enableCutflow=True ) + jvtSequence.configure( inputName = { 'eventInfo' : 'EventInfo_%SYS%', + 'jets' : 'AnalysisJetsBase_%SYS%' }, + outputName = { 'jets' : 'AnalysisJets_%SYS%' }, + affectingSystematics = { 'jets' : jetSequence.affectingSystematics() } ) + print( jvtSequence ) # For debugging + + # Add the sequences to the job: + algSeq += pileupSequence + algSeq += jetSequence + algSeq += jvtSequence + + # Set up an ntuple to check the job with: + treeMaker = createAlgorithm( 'CP::TreeMakerAlg', 'TreeMaker' ) + treeMaker.TreeName = 'jets' + algSeq += treeMaker + ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMaker' ) + ntupleMaker.TreeName = 'jets' + ntupleMaker.Branches = [ + 'EventInfo.runNumber -> runNumber', + 'EventInfo.eventNumber -> eventNumber', + 'AnalysisJets_%SYS%.pt -> jet_%SYS%_pt', + ] + if dataType != 'data': + ntupleMaker.Branches += [ + # 'EventInfo.jvt_effSF_%SYS% -> jvtSF_%SYS%', + # 'EventInfo.fjvt_effSF_%SYS% -> fjvtSF_%SYS%', + 'AnalysisJets_%SYS%.jvt_effSF_NOSYS -> jet_%SYS%_jvtEfficiency', + # 'AnalysisJets_%SYS%.fjvt_effSF_NOSYS -> jet_%SYS%_fjvtEfficiency', + ] + ntupleMaker.systematicsRegex = '(^$)|(^JET_.*)' + algSeq += ntupleMaker + treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' ) + treeFiller.TreeName = 'jets' + algSeq += treeFiller + + return algSeq diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..5dae4f300888839fc01a6e0268a3b097dfb5ceca --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py @@ -0,0 +1,399 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool +import re + +# These algorithms set up the jet recommendations as-of 04/02/2019. +# Jet calibration recommendations +# https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ApplyJetCalibrationR21 +# Jet uncertainties recommendations +# Small-R +# https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2018SmallR +# Large-R +# https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetUncertaintiesRel21Moriond2018LargeR +# JVT recommendations +# https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JVTCalibrationRel21 + +# Keep the different possible sets of systematics here. +# All possible large-R jet systematics +largeRSysts = "|".join([ + "(^JET_Rtrk_.*)", + "(^JET_TAM_.*)", + "(^JET_MassRes_.*)", + "(^JET_Comb_.*_mass.*)"]) +smallRSysts = "|".join([ + "(^JET_BJES_Response$)", + "(^JET_EtaIntercalibration_.*)", + "(^JET_Flavor_.*)", + "(^JET_Gjet_.*)", + "(^JET_JER_.*)", + "(^JET_MJB_.*)", + "(^JET_Pileup_.*)", + "(^JET_PunchThrough_.*)", + "(^JET_RelativeNonClosure_.*)", + "(^JET_SingleParticle_HighPt$)", + "(^JET_Zjet_.*)", + "(^JET_EffectiveNP_.*)", + "(^JET_GroupedNP_.*)"]) +jvtSysts = "|".join([ + "(^JET_JvtEfficiency$)"]) +fjvtSysts = "|".join([ + "(^JET_fJvtEfficiency$)"]) + +def makeJetAnalysisSequence( dataType, jetCollection, postfix = '', + deepCopyOutput = False, + shallowViewOutput = True, + runGhostMuonAssociation = True, + enableCutflow = False, + enableKinematicHistograms = False, + **kwargs): + """Create a jet analysis algorithm sequence + The jet collection is interpreted and selects the correct function to call, + makeSmallRJetAnalysisSequence, makeRScanJetAnalysisSequence or + makeLargeRJetAnalysisSequence + + Keyword arguments + dataType -- The data type to run on ("data", "mc" or "afii") + jetCollection -- The jet container to run on. + postfix -- String to be added to the end of all public names. + deepCopyOutput -- Whether or not to deep copy the output + shallowViewOutput -- Whether or not to output a shallow view as the output + enableCutflow -- Whether or not to dump the cutflow + enableKinematicHistograms -- Whether or not to dump the kinematic histograms + Other keyword arguments are forwarded to the other functions. + """ + if dataType not in ["data", "mc", "afii"]: + raise ValueError ("invalid data type: " + dataType ) + + # Setup the postfix + if postfix != '': + postfix = "_" + postfix + + # Make sure selection options make sense + if deepCopyOutput and shallowViewOutput: + raise ValueError ("deepCopyOutput and shallowViewOutput can't both be true!") + + # Remove b-tagging calibration from the container name + btIndex = jetCollection.find('_BTagging') + if btIndex != -1: + jetCollection = jetCollection[:btIndex] + + # interpret the jet collection + collection_pattern = re.compile( + r"AntiKt(\d+)(EMTopo|EMPFlow|LCTopo|TrackCaloCluster)(TrimmedPtFrac5SmallR20)?Jets") + match = collection_pattern.match(jetCollection) + if not match: + raise ValueError( + "Jet collection {0} does not match expected pattern!".format(jetCollection) ) + radius = int(match.group(1) ) + if radius not in [2, 4, 6, 10]: + raise ValueError("Jet collection has an unsupported radius '{0}'!".format(radius) ) + jetInput = match.group(2) + + # Create the analysis algorithm sequence object. + seq = AnaAlgSequence( "JetAnalysisSequence"+postfix ) + # Relink original jets in case of b-tagging calibration + if btIndex != -1: + alg = createAlgorithm( 'CP::AsgOriginalObjectLinkAlg', + 'JetOriginalObjectLinkAlg'+postfix ) + alg.baseContainerName = jetCollection + seq.append( alg, inputPropName = 'particles', outputPropName = 'particlesOut', stageName = 'calibration' ) + + # Set up the jet ghost muon association algorithm: + if runGhostMuonAssociation: + alg = createAlgorithm( 'CP::JetGhostMuonAssociationAlg', + 'JetGhostMuonAssociationAlg'+postfix ) + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'calibration' ) + + # record all the selections each subfunction makes + cutlist = [] + cutlength = [] + + if radius == 4: + makeSmallRJetAnalysisSequence(seq, cutlist, cutlength, + dataType, jetCollection, jetInput=jetInput, postfix=postfix, **kwargs) + elif radius in [2, 6]: + makeRScanJetAnalysisSequence(seq, cutlist, cutlength, + dataType, jetCollection, jetInput=jetInput, radius=radius, + postfix=postfix, **kwargs) + else: + trim = match.group(3) + if trim == "": + raise ValueError("Untrimmed large-R jets are not supported!") + makeLargeRJetAnalysisSequence(seq, cutlist, cutlength, + dataType, jetCollection, jetInput=jetInput, postfix=postfix, **kwargs) + + # Set up an algorithm used to create jet selection cutflow: + if enableCutflow: + alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg', 'JetCutFlowDumperAlg'+postfix ) + alg.histPattern = 'jet_cflow_%SYS%'+postfix + alg.selection = cutlist + alg.selectionNCuts = cutlength + seq.append( alg, inputPropName = 'input', stageName = 'selection' ) + + # Set up an algorithm dumping the kinematic properties of the jets: + if enableKinematicHistograms: + alg = createAlgorithm( 'CP::KinematicHistAlg', 'JetKinematicDumperAlg'+postfix ) + alg.preselection = "&&".join (cutlist) + alg.histPattern = 'jet_%VAR%_%SYS%'+postfix + seq.append( alg, inputPropName = 'input', stageName = 'selection' ) + + if shallowViewOutput: + # Set up an algorithm that makes a view container using the selections + # performed previously: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', 'JetViewFromSelectionAlg'+postfix ) + alg.selection = cutlist + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + + # Set up a final deep copy making algorithm if requested: + if deepCopyOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', 'JetDeepCopyMaker'+postfix ) + alg.deepCopy = True + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + + return seq + +def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollection, + jetInput, postfix = '', + runJvtUpdate = True, runFJvtUpdate = True, + runJvtSelection = True, runFJvtSelection = True, + runJvtEfficiency = True, runFJvtEfficiency = True, + reduction = "Global", JEROption = "Simple"): + """Add algorithms for the R=0.4 jets. + + Keyword arguments + seq -- The sequence to add the algorithms to + cutlist -- Insert any cuts into this + cutlength -- Insert the lengths of any cuts into this + dataType -- The data type to run on ("data", "mc" or "afii") + jetCollection -- The jet container to run on. + jetInput -- The type of input used, read from the collection name. + postfix -- String to be added to the end of all public names. + runJvtUpdate -- Determines whether or not to update JVT on the jets + runFJvtUpdate -- Determines whether or not to update forward JVT on the jets + runJvtSelection -- Determines whether or not to run JVT selection on the jets + runFJvtSelection -- Determines whether or not to run forward JVT selection on the jets + runJvtEfficiency -- Determines whether or not to calculate the JVT efficiency + runFJvtEfficiency -- Determines whether or not to calculate the forward JVT efficiency + reduction -- Which NP reduction scheme should be used (All, Global, Category, Scenario) + JEROption -- Which variant of the reduction should be used (All, Full, Simple). Note that not all combinations of reduction and JEROption are valid! + """ + if jetInput not in ["EMTopo", "EMPFlow"]: + raise ValueError( + "Unsupported input type '{0}' for R=0.4 jets!".format(jetInput) ) + + # Prepare the jet calibration algorithm + alg = createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg'+postfix ) + addPrivateTool( alg, 'calibrationTool', 'JetCalibrationTool' ) + alg.calibrationTool.JetCollection = jetCollection[:-4] + # Get the correct string to use in the config file name + if dataType == 'afii': + configFile = "JES_MC16Recommendation_AFII_{0}_Apr2019_Rel21.config" + else: + configFile = "JES_MC16Recommendation_Consolidated_{0}_Apr2019_Rel21.config" + if jetInput == "EMPFlow": + configFile = configFile.format("PFlow") + else: + configFile = configFile.format(jetInput) + alg.calibrationTool.ConfigFile = configFile + if dataType == 'data': + alg.calibrationTool.CalibSequence = 'JetArea_Residual_EtaJES_GSC_Insitu' + else: + alg.calibrationTool.CalibSequence = 'JetArea_Residual_EtaJES_GSC_Smear' + alg.calibrationTool.IsData = (dataType == 'data') + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'calibration') + + # Jet uncertainties + # Prepare the config file + if reduction == "All" and JEROption == "All": + alg.uncertaintiesTool.ConfigFile = "R4_AllNuisanceParameters_AllJERNP.config" + elif "Scenario" in reduction: + if JEROption != "Simple": + raise ValueError( + "Invalid uncertainty configuration - Scenario* reductions can " + "only be used together with the Simple JEROption") + configFile = "R4_{0}_SimpleJER.config".format(reduction) + elif reduction in ["Global", "Category"] and JEROption in ["Simple", "Full"]: + configFile = "R4_{0}Reduction_{1}JER.config".format(reduction, JEROption) + else: + raise ValueError( + "Invalid combination of reduction and JEROption settings: " + "reduction: {0}, JEROption: {1}".format(reduction, JEROption) ) + + alg = createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesTool'+postfix ) + addPrivateTool( alg, 'uncertaintiesTool', 'JetUncertaintiesTool' ) + alg.uncertaintiesTool.JetDefinition = jetCollection[:-4] + # Add the correct directory on the front + alg.uncertaintiesTool.ConfigFile = "rel21/Fall2018/"+configFile + alg.uncertaintiesTool.MCType = "AFII" if dataType == "afii" else "MC16" + alg.uncertaintiesTool.IsData = (dataType == 'data') + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', + affectingSystematics = smallRSysts, stageName = 'calibration' ) + + # Set up the JVT update algorithm: + if runJvtUpdate : + alg = createAlgorithm( 'CP::JvtUpdateAlg', 'JvtUpdateAlg'+postfix ) + addPrivateTool( alg, 'jvtTool', 'JetVertexTaggerTool' ) + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'selection' ) + + if runFJvtUpdate : + alg = createAlgorithm( 'CP::JetModifierAlg', 'JetModifierAlg'+postfix ) + addPrivateTool( alg, 'modifierTool', 'JetForwardJvtTool') + alg.modifierTool.OutputDec = "passFJVT" #Output decoration + # fJVT WPs depend on the MET WP + # see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EtmissRecommendationsRel21p2#fJVT_and_MET + alg.modifierTool.UseTightOP = 1 # 1 = Tight, 0 = Loose + alg.modifierTool.EtaThresh = 2.5 # Eta dividing central from forward jets + alg.modifierTool.ForwardMaxPt = 120.0e3 #Max Pt to define fwdJets for JVT + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'selection' ) + pass + + # Set up the jet efficiency scale factor calculation algorithm + # Change the truthJetCollection property to AntiKt4TruthWZJets if preferred + if runJvtSelection : + alg = createAlgorithm( 'CP::JvtEfficiencyAlg', 'JvtEfficiencyAlg'+postfix ) + addPrivateTool( alg, 'efficiencyTool', 'CP::JetJvtEfficiency' ) + if jetInput == 'EMPFlow': + alg.efficiencyTool.SFFile = 'JetJvtEfficiency/Moriond2018/JvtSFFile_EMPFlow.root' + alg.efficiencyTool.MaxPtForJvt = 60e3 + else: + alg.efficiencyTool.SFFile = 'JetJvtEfficiency/Moriond2018/JvtSFFile_EMTopoJets.root' + alg.efficiencyTool.MaxPtForJvt = 120e3 + alg.efficiencyTool.WorkingPoint = 'Tight' if jetInput == 'EMPFlow' else 'Medium' + alg.selection = 'jvt_selection' + alg.scaleFactorDecoration = 'jvt_effSF_%SYS%' + alg.scaleFactorDecorationRegex = jvtSysts + # Disable scale factor decorations if running on data + # We still want to run the JVT selection + if not runJvtEfficiency or dataType == 'data': + alg.scaleFactorDecoration = '' + alg.truthJetCollection = '' + alg.outOfValidity = 2 + alg.outOfValidityDeco = 'no_jvt' + alg.skipBadEfficiency = 0 + seq.append( alg, inputPropName = 'jets', + affectingSystematics = jvtSysts, stageName = 'selection' ) + + if runFJvtSelection : + alg = createAlgorithm( 'CP::JvtEfficiencyAlg', 'ForwardJvtEfficiencyAlg' ) + addPrivateTool( alg, 'efficiencyTool', 'CP::JetJvtEfficiency' ) + alg.efficiencyTool.SFFile = 'JetJvtEfficiency/Moriond2018/fJvtSFFile.root' + alg.efficiencyTool.WorkingPoint = 'Tight' + alg.dofJVT = True + alg.fJVTStatus = 'passFJVT,as_char' + alg.selection = 'fjvt_selection' + alg.scaleFactorDecoration = 'fjvt_effSF_%SYS%' + alg.scaleFactorDecorationRegex = fjvtSysts + # Disable scale factor decorations if running on data + # We still want to run the JVT selection + if not runFJvtEfficiency or dataType == 'data': + alg.scaleFactorDecoration = '' + alg.truthJetCollection = '' + alg.outOfValidity = 2 + alg.outOfValidityDeco = 'no_fjvt' + alg.skipBadEfficiency = 0 + seq.append( alg, inputPropName = 'jets', + affectingSystematics = fjvtSysts, stageName = 'selection') + + # Return the sequence: + return seq, cutlist, cutlength + +def makeRScanJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollection, + jetInput, radius, postfix = '' ): + """Add algorithms for the R-scan jets. + + Keyword arguments + seq -- The sequence to add the algorithms to + cutlist -- Insert any cuts into this + cutlength -- Insert the lengths of any cuts into this + dataType -- The data type to run on ("data", "mc" or "afii") + jetCollection -- The jet container to run on. + jetInput -- The type of input used, read from the collection name. + radius -- The radius of the r-scan jets. + postfix -- String to be added to the end of all public names. + """ + if jetInput != "LCTopo": + raise ValueError( + "Unsupported input type '{0}' for R-scan jets!".format(jetInput) ) + # Prepare the jet calibration algorithm + alg = createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg'+postfix ) + addPrivateTool( alg, 'calibrationTool', 'JetCalibrationTool' ) + alg.calibrationTool.JetCollection = jetCollection[:-4] + alg.calibrationTool.ConfigFile = \ + "JES_MC16Recommendation_Rscan{0}LC_18Dec2018_R21.config".format(radius) + if dataType == 'data': + alg.calibrationTool.CalibSequence = "JetArea_Residual_EtaJES_GSC_Insitu" + else: + alg.calibrationTool.CalibSequence = "JetArea_Residual_EtaJES_GSC" + alg.calibrationTool.IsData = (dataType == 'data') + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'calibration' ) + # Logging would be good + print("WARNING: uncertainties for R-Scan jets are not yet released!") + +def makeLargeRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollection, + jetInput, postfix = '', largeRMass = "Comb"): + """Add algorithms for the R=1.0 jets. + + Keyword arguments + seq -- The sequence to add the algorithms to + cutlist -- Insert any cuts into this + cutlength -- Insert the lengths of any cuts into this + dataType -- The data type to run on ("data", "mc" or "afii") + jetCollection -- The jet container to run on. + jetInput -- The type of input used, read from the collection name. + postfix -- String to be added to the end of all public names. + largeRMass -- Which large-R mass definition to use. Ignored if not running on large-R jets ("Comb", "Calo", "TCC", "TA") + """ + + if largeRMass not in ["Comb", "Calo", "TCC", "TA"]: + raise ValueError ("Invalid large-R mass defintion {0}!".format(largeRMass) ) + + if jetInput not in ["LCTopo", "TrackCaloCluster"]: + raise ValueError ( + "Unsupported input type '{0}' for large-R jets!".format(jetInput) ) + if jetInput == "TrackCaloCluster": + # Only one mass defintion supported + if largeRMass != "Calo": + raise ValueError( + "Unsupported large-R TCC jet mass '{0}'!".format(largeRMass) ) + configFile = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config" + else: + if largeRMass == "Comb": + configFile = "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_17Oct2018.config" + elif largeRMass == "Calo": + configFile = "JES_MC16recommendation_FatJet_Trimmed_JMS_calo_12Oct2018.config" + elif largeRMass == "TCC": + configFile = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config" + else: + configFile = "JES_MC16recommendation_FatJet_Trimmed_JMS_TA_12Oct2018.config" + # Prepare the jet calibration algorithm + alg = createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg'+postfix ) + addPrivateTool( alg, 'calibrationTool', 'JetCalibrationTool' ) + alg.calibrationTool.JetCollection = jetCollection[:-4] + alg.calibrationTool.ConfigFile = configFile + alg.calibrationTool.CalibSequence = "EtaJES_JMS" + alg.calibrationTool.IsData = 0 + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'calibration' ) + + # Jet uncertainties + alg = createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg'+postfix ) + # R=1.0 jets have a validity range + alg.outOfValidity = 2 # SILENT + alg.outOfValidityDeco = 'outOfValidity' + addPrivateTool( alg, 'uncertaintiesTool', 'JetUncertaintiesTool' ) + alg.uncertaintiesTool.JetDefinition = jetCollection[:-4] + alg.uncertaintiesTool.ConfigFile = \ + "rel21/Moriond2018/R10_{0}Mass_all.config".format(largeRMass) + alg.uncertaintiesTool.MCType = "MC16a" + alg.uncertaintiesTool.IsData = (dataType == "data") + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', + affectingSystematics = largeRSysts, stageName = 'calibration' ) + + cutlist.append('outOfValidity') + cutlength.append(1) diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetJvtAnalysisSequence.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetJvtAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..8ebee22a2ab30f3bd48b25d641f3792a9ca7dcc7 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetJvtAnalysisSequence.py @@ -0,0 +1,89 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm + +def makeJetJvtAnalysisSequence( dataType, jetCollection, + preselection = '', + disableFJvt = False, + globalSF = True, + runSelection = True, + enableCutflow = False ): + """Create a jet JVT analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + jetCollection -- The jet container to run on + disableFJvt -- Whether to disable forward JVT calculations + globalSF -- Whether to calculate per event scale factors + runSelection -- Whether to run selection + enableCutflow -- Whether or not to dump the cutflow + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + if runSelection and not globalSF : + raise ValueError ("per-event scale factors needs to be computed when doing a JVT selection") + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "JetJVTAnalysisSequence" ) + + # Define a list of cuts to apply later on and the + # number of bits in the corresponding TAccept + cutlist = [] + cutlength = [] + + # Set up the per-event jet efficiency scale factor calculation algorithm + if dataType != 'data' and globalSF: + from JetAnalysisSequence import jvtSysts, fjvtSysts + + alg = createAlgorithm( 'CP::AsgEventScaleFactorAlg', 'JvtEventScaleFactorAlg' ) + alg.preselection = preselection + '&&no_jvt' if preselection else 'no_jvt' + alg.scaleFactorInputDecoration = 'jvt_effSF_%SYS%' + alg.scaleFactorInputDecorationRegex = jvtSysts + alg.scaleFactorOutputDecoration = 'jvt_effSF_%SYS%' + + seq.append( alg, + affectingSystematics = jvtSysts, + inputPropName = { 'jets' : 'particles', + 'eventInfo' : 'eventInfo' } ) + + if not disableFJvt: + alg = createAlgorithm( 'CP::AsgEventScaleFactorAlg', 'ForwardJvtEventScaleFactorAlg' ) + alg.preselection = preselection + '&&no_fjvt' if preselection else 'no_fjvt' + alg.scaleFactorInputDecoration = 'fjvt_effSF_%SYS%' + alg.scaleFactorInputDecorationRegex = fjvtSysts + alg.scaleFactorOutputDecoration = 'fjvt_effSF_%SYS%' + + seq.append( alg, + affectingSystematics = fjvtSysts, + inputPropName = { 'jets' : 'particles', + 'eventInfo' : 'eventInfo' } ) + + if runSelection: + cutlist.append('jvt_selection') + cutlength.append(1) + + if not disableFJvt: + cutlist.append('fjvt_selection') + cutlength.append(1) + + # Set up an algorithm used to create jet JVT selection cutflow: + if enableCutflow: + alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg', 'JetJvtCutFlowDumperAlg' ) + alg.histPattern = 'jet_cflow_jvt_%SYS%' + alg.selection = cutlist + alg.selectionNCuts = cutlength + seq.append( alg, inputPropName = { 'jets' : 'input' }) + + # Set up an algorithm that makes a view container using the selections + # performed previously: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', 'JetJvtViewFromSelectionAlg' ) + alg.selection = cutlist + seq.append( alg, inputPropName = { 'jets' : 'input' }, + outputPropName = { 'jets' : 'output' } ) + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5ccb446532599c01cc3844e5b1b18db06f721002 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +__version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_eljob.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..c114d0ad7608511074292f704493e289441e7d74 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_eljob.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# this forces the jet algorithms dictionary to be loaded before +# anything else, which works around some strange dictionary issues I +# don't understand. +ROOT.CP.JetCalibrationAlg ("dummy", None) + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +jetContainer = "AntiKt4EMTopoJets" + +if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +sample.add (os.getenv (inputfile[dataType])) +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +from JetAnalysisAlgorithms.JetAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType, jetContainer) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Set up an output file for the job: +job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) ) + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'jetTest_'+dataType+'_EMTopo_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..7b5afce3ae68197992610bcc596a53cbedfb92b9 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py @@ -0,0 +1,46 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +# User options, which can be set from command line after a "-" character +# athena EgammaAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +jetContainer = "AntiKt4EMTopoJets" + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from JetAnalysisAlgorithms.JetAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType, jetContainer) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='JetAnalysisAlgorithmsTestEMTopo." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_eljob.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..97f94a5bcd89ff802e544dc8954dec1d5a43e434 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_eljob.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# this forces the jet algorithms dictionary to be loaded before +# anything else, which works around some strange dictionary issues I +# don't understand. +ROOT.CP.JetCalibrationAlg ("dummy", None) + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +jetContainer = "AntiKt4EMTopoJets" + +if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +sample.add (os.getenv (inputfile[dataType])) +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +from JetAnalysisAlgorithms.JetAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType, jetContainer) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Set up an output file for the job: +job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) ) + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'jetTest_'+dataType+'_PFlow_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..69d7df65f6ff762245f20ef7c3903562eca105ca --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py @@ -0,0 +1,46 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +# User options, which can be set from command line after a "-" character +# athena EgammaAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +jetContainer = "AntiKt4EMTopoJets" + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from JetAnalysisAlgorithms.JetAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType, jetContainer) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='JetAnalysisAlgorithmsTestPFlow." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..757495457d3f4a77d15d045efb528c2840434c29 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_entries.cxx @@ -0,0 +1,32 @@ +// AsgExampleTools_entries.cxx + +#include <GaudiKernel/DeclareFactoryEntries.h> + +#include <JetAnalysisAlgorithms/JetCalibrationAlg.h> +#include <JetAnalysisAlgorithms/JetGhostMuonAssociationAlg.h> +#include <JetAnalysisAlgorithms/JetModifierAlg.h> +#include <JetAnalysisAlgorithms/JetSelectionAlg.h> +#include <JetAnalysisAlgorithms/JetSmearingAlg.h> +#include <JetAnalysisAlgorithms/JetUncertaintiesAlg.h> +#include <JetAnalysisAlgorithms/JvtEfficiencyAlg.h> +#include <JetAnalysisAlgorithms/JvtUpdateAlg.h> + +DECLARE_ALGORITHM_FACTORY (CP::JetCalibrationAlg) +DECLARE_ALGORITHM_FACTORY (CP::JetGhostMuonAssociationAlg) +DECLARE_ALGORITHM_FACTORY (CP::JetModifierAlg) +DECLARE_ALGORITHM_FACTORY (CP::JetSelectionAlg) +DECLARE_ALGORITHM_FACTORY (CP::JetSmearingAlg) +DECLARE_ALGORITHM_FACTORY (CP::JetUncertaintiesAlg) +DECLARE_ALGORITHM_FACTORY (CP::JvtEfficiencyAlg) +DECLARE_ALGORITHM_FACTORY (CP::JvtUpdateAlg) + +DECLARE_FACTORY_ENTRIES(JetAnalysisAlgorithms) { + DECLARE_ALGORITHM (CP::JetCalibrationAlg) + DECLARE_ALGORITHM (CP::JetGhostMuonAssociationAlg) + DECLARE_ALGORITHM (CP::JetModifierAlg) + DECLARE_ALGORITHM (CP::JetSelectionAlg) + DECLARE_ALGORITHM (CP::JetSmearingAlg) + DECLARE_ALGORITHM (CP::JetUncertaintiesAlg) + DECLARE_ALGORITHM (CP::JvtEfficiencyAlg) + DECLARE_ALGORITHM (CP::JvtUpdateAlg) +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e0d9aaf857bd6459352e06b881f084107585ac85 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_load.cxx @@ -0,0 +1,5 @@ +// AsgExampleTools_load.cxx + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(JetAnalysisAlgorithms) diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8705936bbbe40b9a13e33611ae1c9c68a8bf841b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,66 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# The name of the package: +atlas_subdir( MetAnalysisAlgorithms ) + +# The package's dependencies: +atlas_depends_on_subdirs( + PUBLIC + Event/xAOD/xAODMissingET + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PhysicsAnalysis/Interfaces/METInterface + Reconstruction/MET/METInterface + Reconstruction/MET/METUtilities + PRIVATE ) + +atlas_add_library( MetAnalysisAlgorithmsLib + MetAnalysisAlgorithms/*.h MetAnalysisAlgorithms/*.icc Root/*.cxx + PUBLIC_HEADERS MetAnalysisAlgorithms + LINK_LIBRARIES xAODMissingET + SystematicsHandlesLib AnaAlgorithmLib METInterface + SelectionHelpersLib METUtilitiesLib + PRIVATE_LINK_LIBRARIES ) + +atlas_add_dictionary( MetAnalysisAlgorithmsDict + MetAnalysisAlgorithms/MetAnalysisAlgorithmsDict.h + MetAnalysisAlgorithms/selection.xml + LINK_LIBRARIES MetAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( MetAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel MetAnalysisAlgorithmsLib ) +endif() + +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*_jobOptions.py ) +atlas_install_scripts( share/*_eljob.py ) + +if( XAOD_STANDALONE ) + atlas_add_test( testJobData + SCRIPT MetAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT MetAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT MetAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) +elseif( NOT "${CMAKE_PROJECT_NAME}" STREQUAL "AthDerivation" ) + atlas_add_test( testJobData + SCRIPT athena.py + MetAnalysisAlgorithms/MetAnalysisAlgorithmsTest_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT athena.py + MetAnalysisAlgorithms/MetAnalysisAlgorithmsTest_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT athena.py + MetAnalysisAlgorithms/MetAnalysisAlgorithmsTest_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) +endif() diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..751f56e8171afc57f916267267c5cc3ffb60dc2f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithmsDict.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef MET_ANALYSIS_ALGORITHMS__MET_ANALYSIS_ALGORITHMS_DICT_H +#define MET_ANALYSIS_ALGORITHMS__MET_ANALYSIS_ALGORITHMS_DICT_H + +#include <MetAnalysisAlgorithms/MetBuilderAlg.h> +#include <MetAnalysisAlgorithms/MetMakerAlg.h> +#include <MetAnalysisAlgorithms/MetSignificanceAlg.h> +#include <MetAnalysisAlgorithms/MetSystematicsAlg.h> + +#endif diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetBuilderAlg.h b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetBuilderAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..fb9aaec2853ae602e5d5e54f1a7cb6121ebdc11c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetBuilderAlg.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef MET_ANALYSIS_ALGORITHMS__MET_BUILDER_ALG_H +#define MET_ANALYSIS_ALGORITHMS__MET_BUILDER_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <METInterface/IMETMaker.h> +#include <xAODMissingET/MissingETContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMetCalibrationAndSmearingTool + + class MetBuilderAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MetBuilderAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the met collection we run on + private: + SysCopyHandle<xAOD::MissingETContainer> m_metHandle { + this, "met", "MissingET_%SYS%", "the met collection we run on"}; + + /// \brief the key for the final met term + private: + std::string m_finalKey {"Final"}; + + /// \brief the key for the soft term + private: + std::string m_softTerm {"PVSoftTrk"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetMakerAlg.h b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetMakerAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..da7cab77319412a73a3100b56b4b5b4f7a43882d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetMakerAlg.h @@ -0,0 +1,134 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef MET_ANALYSIS_ALGORITHMS__MET_MAKER_ALG_H +#define MET_ANALYSIS_ALGORITHMS__MET_MAKER_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <SystematicsHandles/SysWriteHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <METInterface/IMETMaker.h> + +#include <xAODBase/IParticleContainer.h> +#include <xAODMissingET/MissingETContainer.h> +#include <xAODMissingET/MissingETAuxContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMETMaker + /// + /// This algorithm is fairly complex for a common CP algorithm. The + /// main issue here is that the MET tools store temporary + /// information on the xAOD objects that gets reset on each + /// systematic, so a lot of actions have to happen in one go. + /// Despite that complexity it still can't be run on its own, you + /// always have to call \ref MetBuilderAlg afterwards to build the + /// final MET. + + class MetMakerAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MetMakerAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IMETMaker> m_makerTool; + + /// \brief the name of the core MissingETContainer + private: + std::string m_metCoreName; + + /// \brief the name of the MissingETAssociationMap + private: + std::string m_metAssociationName; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the electron container to use + private: + SysReadHandle<xAOD::IParticleContainer> m_electronsHandle { + this, "electrons", "", "the electron container to use" }; + + /// \brief the key for \ref m_electronsHandle + private: + std::string m_electronsKey {"RefEle"}; + + /// \brief the photon container to use + private: + SysReadHandle<xAOD::IParticleContainer> m_photonsHandle { + this, "photons", "", "the photon container to use" }; + + /// \brief the key for \ref m_photonsHandle + private: + std::string m_photonsKey {"RefGamma"}; + + /// \brief the muon container to use + private: + SysReadHandle<xAOD::IParticleContainer> m_muonsHandle { + this, "muons", "", "the muon container to use" }; + + /// \brief the key for \ref m_muonsHandle + private: + std::string m_muonsKey {"Muons"}; + + /// \brief the electron container to use + private: + SysReadHandle<xAOD::IParticleContainer> m_tausHandle { + this, "taus", "", "the tau container to use" }; + + /// \brief the key for \ref m_tausHandle + private: + std::string m_tausKey {"RefTau"}; + + /// \brief the input jet collection we run on + private: + SysReadHandle<xAOD::JetContainer> m_jetsHandle { + this, "jets", "", "the jet collection we use"}; + + private: + SysReadHandle<xAOD::IParticleContainer> m_invisHandle { + this, "invisible", "", "Any particles to treat as invisible."}; + + /// \brief the key for \ref m_jetsHandle + private: + std::string m_jetsKey {"RefJet"}; + + /// \brief the soft term key + private: + std::string m_softTermKey {"PVSoftTrk"}; + + /// \brief whether to use track-met instead of jet-met + private: + bool m_doTrackMet {false}; + + /// \brief whether to do jet JVT + private: + bool m_doJetJVT {true}; + + /// \brief the met collection we run on + private: + SysWriteHandle<xAOD::MissingETContainer,xAOD::MissingETAuxContainer> m_metHandle { + this, "met", "MissingET_%SYS%", "the met collection we produce"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSignificanceAlg.h b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSignificanceAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..f2dd8fcc93af2f1f0f639721512c20aa88951309 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSignificanceAlg.h @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef MET_ANALYSIS_ALGORITHMS__MET_SIGNIFICANCE_ALG_H +#define MET_ANALYSIS_ALGORITHMS__MET_SIGNIFICANCE_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysWriteHandle.h> +#include <METInterface/IMETSignificance.h> +#include <xAODMissingET/MissingETContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMETSignificanceTool + + class MetSignificanceAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MetSignificanceAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IMETSignificance> m_significanceTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the met collection we run on + private: + SysCopyHandle<xAOD::MissingETContainer> m_metHandle { + this, "met", "MissingET_%SYS%", "the met collection we run on"}; + + /// \brief the key for the final met term + private: + std::string m_totalMETName {"Final"}; + + /// \brief the key for the jets term + private: + std::string m_jetTermName {"RefJet"}; + + /// \brief the key for the soft term + private: + std::string m_softTermName {"PVSoftTrk"}; + + /// \brief the decoration for the significance + private: + std::string m_significanceDecoration {"significance"}; + + /// \brief the accessor for \ref m_selectionDecoration + private: + std::unique_ptr<const SG::AuxElement::Accessor<float> > m_significanceAccessor; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSystematicsAlg.h b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSystematicsAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..cba1d161ef4467072008872141b653956d32489b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSystematicsAlg.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef MET_ANALYSIS_ALGORITHMS__MET_SYSTEMATICS_ALG_H +#define MET_ANALYSIS_ALGORITHMS__MET_SYSTEMATICS_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <METInterface/IMETSystematicsTool.h> +#include <xAODMissingET/MissingETContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMetCalibrationAndSmearingTool + + class MetSystematicsAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MetSystematicsAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IMETSystematicsTool> m_systematicsTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the met collection we run on + private: + SysCopyHandle<xAOD::MissingETContainer> m_metHandle { + this, "met", "MissingET_%SYS%", "the met collection we run on"}; + + /// \brief the key for the soft term + private: + std::string m_softTerm {"PVSoftTrk"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..c83c888c5044aabdc2ad83858b67ec1222229d77 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/selection.xml @@ -0,0 +1,8 @@ +<lcgdict> + + <class name="CP::MetBuilderAlg" /> + <class name="CP::MetMakerAlg" /> + <class name="CP::MetSignificanceAlg" /> + <class name="CP::MetSystematicsAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetBuilderAlg.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetBuilderAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4a0f1c7c5a10de194f1beb8649e9112522b0b885 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetBuilderAlg.cxx @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <MetAnalysisAlgorithms/MetBuilderAlg.h> + +#include <METUtilities/METHelpers.h> +#include <xAODMissingET/MissingETAuxContainer.h> + +// +// method implementations +// + +namespace CP +{ + MetBuilderAlg :: + MetBuilderAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + declareProperty ("finalKey", m_finalKey, "the key for the final met term"); + declareProperty ("softTerm", m_softTerm, "the key for the soft term"); + } + + + + StatusCode MetBuilderAlg :: + initialize () + { + m_systematicsList.addHandle (m_metHandle); + ANA_CHECK (m_systematicsList.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode MetBuilderAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::MissingETContainer *met {}; + ANA_CHECK (m_metHandle.getCopy (met, sys)); + + xAOD::MissingET *softTerm = (*met)[m_softTerm]; + if (softTerm == nullptr) + { + ANA_MSG_ERROR ("could not find MET soft-term: " << m_softTerm); + return StatusCode::FAILURE; + } + ATH_CHECK (met::buildMETSum (m_finalKey, met, softTerm->source())); + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetMakerAlg.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetMakerAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6a4a76279d69e025523424b746adde48afcdb1ff --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetMakerAlg.cxx @@ -0,0 +1,125 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <MetAnalysisAlgorithms/MetMakerAlg.h> + +#include <xAODMissingET/MissingETAuxContainer.h> + +// +// method implementations +// + +namespace CP +{ + MetMakerAlg :: + MetMakerAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_makerTool ("METMaker", this) + { + declareProperty ("makerTool", m_makerTool, "the METMaker tool we apply"); + declareProperty ("metCore", m_metCoreName, "the name of the core MissingETContainer"); + declareProperty ("metAssociation", m_metAssociationName, "the name of the core MissingETContainer"); + declareProperty ("electronsKey", m_electronsKey, "the key for the electrons"); + declareProperty ("photonsKey", m_photonsKey, "the key for the photons"); + declareProperty ("muonsKey", m_muonsKey, "the key for the muons"); + declareProperty ("tausKey", m_tausKey, "the key for the taus"); + declareProperty ("jetsKey", m_jetsKey, "the key for jets"); + declareProperty ("softTermKey", m_softTermKey, "the soft term key"); + declareProperty ("doTrackMet", m_doTrackMet, "whether to use track-met instead of jet-met"); + declareProperty ("doJetJVT", m_doJetJVT, "whether to do jet JVT"); + } + + + + StatusCode MetMakerAlg :: + initialize () + { + ANA_CHECK (m_makerTool.retrieve()); + for (auto* handle : {&m_electronsHandle, &m_photonsHandle, + &m_muonsHandle, &m_tausHandle, &m_invisHandle}) { + if (*handle) { + m_systematicsList.addHandle (*handle); + } + } + m_systematicsList.addHandle (m_jetsHandle); + m_systematicsList.addHandle (m_metHandle); + ANA_CHECK (m_systematicsList.initialize()); + + return StatusCode::SUCCESS; + } + + + + StatusCode MetMakerAlg :: + execute () + { + const xAOD::MissingETContainer* metcore {nullptr}; + ANA_CHECK (evtStore()->retrieve(metcore, m_metCoreName)); + + const xAOD::MissingETAssociationMap* metMap {nullptr}; + ANA_CHECK (evtStore()->retrieve(metMap, m_metAssociationName)); + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + auto met = std::make_unique<xAOD::MissingETContainer> (); + auto aux = std::make_unique<xAOD::MissingETAuxContainer> (); + met->setStore (aux.get()); + + metMap->resetObjSelectionFlags(); + + if (m_invisHandle) { + const xAOD::IParticleContainer* invisible = nullptr; + ATH_CHECK( m_invisHandle.retrieve(invisible, sys) ); + ATH_CHECK( m_makerTool->markInvisible(invisible, metMap, met.get() ) ); + } + + // Lambda helping with calculating the MET terms coming from the leptons + // (and photons). + auto processParticles = + [&] (SysReadHandle<xAOD::IParticleContainer>& handle, + xAOD::Type::ObjectType type, + const std::string& term) -> StatusCode { + if (!handle) { + return StatusCode::SUCCESS; + } + const xAOD::IParticleContainer* particles = nullptr; + ANA_CHECK (handle.retrieve (particles, sys)); + ANA_CHECK (m_makerTool->rebuildMET (term, type, met.get(), + particles, metMap)); + return StatusCode::SUCCESS; + }; + + // Calculate the terms coming from the user's selected objects. + ANA_CHECK (processParticles (m_electronsHandle, xAOD::Type::Electron, + m_electronsKey)); + ANA_CHECK (processParticles (m_photonsHandle, xAOD::Type::Photon, + m_photonsKey)); + ANA_CHECK (processParticles (m_tausHandle, xAOD::Type::Tau, m_tausKey)); + ANA_CHECK (processParticles (m_muonsHandle, xAOD::Type::Muon, + m_muonsKey)); + + const xAOD::JetContainer *jets {nullptr}; + ANA_CHECK (m_jetsHandle.retrieve (jets, sys)); + + if (m_doTrackMet) + { + ANA_CHECK (m_makerTool->rebuildTrackMET (m_jetsKey, m_softTermKey, met.get(), jets, metcore, metMap, m_doJetJVT)); + } else + { + ANA_CHECK (m_makerTool->rebuildJetMET (m_jetsKey, m_softTermKey, met.get(), jets, metcore, metMap, m_doJetJVT)); + } + + ANA_CHECK (m_metHandle.record (std::move (met), std::move (aux), sys)); + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSignificanceAlg.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSignificanceAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e2a7c72855e96eb177669e0dff2c2acaf5702bde --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSignificanceAlg.cxx @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <MetAnalysisAlgorithms/MetSignificanceAlg.h> + +#include <xAODMissingET/MissingETAuxContainer.h> +#include "xAODEventInfo/EventInfo.h" + +// +// method implementations +// +namespace CP +{ + MetSignificanceAlg :: + MetSignificanceAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_significanceTool ("METMaker", this) + { + declareProperty ("significanceTool", m_significanceTool, "the significance tool we apply"); + declareProperty ("significanceDecoration", m_significanceDecoration, "the decoration to use for the significance"); + declareProperty ("totalMETName", m_totalMETName, "the key for the final met term"); + declareProperty ("jetTermName", m_jetTermName, "the key for the jets term"); + declareProperty ("softTermName", m_softTermName, "the key for the soft term"); + } + + + + StatusCode MetSignificanceAlg :: + initialize () + { + if (m_significanceDecoration.empty()) + { + ANA_MSG_ERROR ("no significance decoration name set"); + return StatusCode::FAILURE; + } + m_significanceAccessor = std::make_unique<SG::AuxElement::Accessor<float> > (m_significanceDecoration); + + ANA_CHECK (m_significanceTool.retrieve()); + m_systematicsList.addHandle (m_metHandle); + ANA_CHECK (m_systematicsList.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode MetSignificanceAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + // I'm not sure why this can't be const, but the interface + // requires a non-const object + xAOD::MissingETContainer *met {}; + ANA_CHECK (m_metHandle.getCopy (met, sys)); + + const xAOD::EventInfo* evtInfo = 0; + ANA_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + + ANA_CHECK (m_significanceTool->varianceMET (met, evtInfo->averageInteractionsPerCrossing(), m_jetTermName, m_softTermName, m_totalMETName)); + const float significance = m_significanceTool->GetSignificance(); + (*m_significanceAccessor) (*(*met)[m_totalMETName]) = significance; + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSystematicsAlg.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSystematicsAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1e255b6581d66bc07cda3bfc34b1b94bc59cff90 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSystematicsAlg.cxx @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <MetAnalysisAlgorithms/MetSystematicsAlg.h> + +#include <xAODMissingET/MissingETAuxContainer.h> + +// +// method implementations +// + +namespace CP +{ + MetSystematicsAlg :: + MetSystematicsAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_systematicsTool ("met::METSystematicsTool", this) + { + declareProperty ("systematicsTool", m_systematicsTool, "the systematics tool we apply"); + declareProperty ("softTerm", m_softTerm, "the key for the soft term"); + } + + + + StatusCode MetSystematicsAlg :: + initialize () + { + ANA_CHECK (m_systematicsTool.retrieve()); + m_systematicsList.addHandle (m_metHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_systematicsTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode MetSystematicsAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_systematicsTool->applySystematicVariation (sys)); + + xAOD::MissingETContainer *met {}; + ANA_CHECK (m_metHandle.getCopy (met, sys)); + + xAOD::MissingET *softTerm = (*met)[m_softTerm]; + if (softTerm == nullptr) + { + ANA_MSG_ERROR ("failed to find MET soft-term \"" << m_softTerm << "\""); + return StatusCode::FAILURE; + } + + // This returns a `CorrectionCode`, so in principle this could + // return an `OutOfValidity` result, but I have no idea what + // that would mean or how to handle it, so I'm implicitly + // converting it into a `FAILURE` instead. + ANA_CHECK (m_systematicsTool->applyCorrection (*softTerm)); + + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisAlgorithmsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..3086cdaabaf0c198098f53212494051e8c4c7a8a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisAlgorithmsTest.py @@ -0,0 +1,75 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AnaAlgorithm.AlgSequence import AlgSequence +from AnaAlgorithm.DualUseConfig import addPrivateTool, createAlgorithm + +def makeSequence (dataType) : + algSeq = AlgSequence() + + # Set up the systematics loader/handler algorithm: + sysLoader = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + sysLoader.sigmaRecommended = 1 + algSeq += sysLoader + + # Include, and then set up the jet analysis algorithm sequence: + from JetAnalysisAlgorithms.JetAnalysisSequence import makeJetAnalysisSequence + jetContainer = 'AntiKt4EMPFlowJets' + jetSequence = makeJetAnalysisSequence( dataType, jetContainer ) + jetSequence.configure( inputName = jetContainer, outputName = 'AnalysisJets_%SYS%' ) + + # Add all algorithms to the job: + algSeq += jetSequence + + # Set up a selection alg for demonstration purposes + # Also to avoid warnings from building MET with very soft electrons + selalg = createAlgorithm( 'CP::AsgSelectionAlg', 'METEleSelAlg' ) + addPrivateTool( selalg, 'selectionTool', 'CP::AsgPtEtaSelectionTool' ) + selalg.selectionTool.minPt = 10e3 + selalg.selectionTool.maxEta = 2.47 + selalg.selectionDecoration = 'selectPtEta' + selalg.particles = 'Electrons' + # We need to copy here, because w/o an output container, it's assumed + # that the input container is non-const + selalg.particlesOut = 'DecorElectrons_%SYS%' + algSeq += selalg + + # Now make a view container holding only the electrons for the MET calculation + viewalg = createAlgorithm( 'CP::AsgViewFromSelectionAlg','METEleViewAlg' ) + viewalg.selection = [ 'selectPtEta' ] + viewalg.input = 'DecorElectrons_%SYS%' + viewalg.output = 'METElectrons_%SYS%' + algSeq += viewalg + + # Include, and then set up the met analysis algorithm sequence: + from MetAnalysisAlgorithms.MetAnalysisSequence import makeMetAnalysisSequence + metSequence = makeMetAnalysisSequence( dataType, metSuffix = jetContainer[:-4] ) + metSequence.configure( inputName = { 'jets' : 'AnalysisJets_%SYS%', + 'muons' : 'Muons', + 'electrons' : 'METElectrons_%SYS%' }, + outputName = 'AnalysisMET_%SYS%', + affectingSystematics = { 'jets' : jetSequence.affectingSystematics(), + 'muons' : '(^$)', + 'electrons' : '(^$)' } ) + + # Add the sequence to the job: + algSeq += metSequence + + # Write the freshly produced MET object(s) to an output file: + treeMaker = createAlgorithm( 'CP::TreeMakerAlg', 'TreeMaker' ) + treeMaker.TreeName = 'met' + algSeq += treeMaker + ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMaker' ) + ntupleMaker.TreeName = 'met' + ntupleMaker.Branches = [ 'EventInfo.runNumber -> runNumber', + 'EventInfo.eventNumber -> eventNumber', + 'AnalysisMET_%SYS%.mpx -> met_%SYS%_mpx', + 'AnalysisMET_%SYS%.mpy -> met_%SYS%_mpy', + 'AnalysisMET_%SYS%.sumet -> met_%SYS%_sumet', + 'AnalysisMET_%SYS%.name -> met_%SYS%_name', ] + ntupleMaker.systematicsRegex = '.*' + algSeq += ntupleMaker + treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' ) + treeFiller.TreeName = 'met' + algSeq += treeFiller + + return algSeq diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisSequence.py b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..a20926c5c835ec62b6471c6ea8c1027b3ebcd6b2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisSequence.py @@ -0,0 +1,95 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + +def makeMetAnalysisSequence( dataType, metSuffix, + postfix = '', + useFJVT = True, + treatPUJets = True ): + """Create a met analysis algorithm sequence + + After creating the sequence object, it needs to be configured with a call + like: + + metSequence.configure( inputName = { + 'jets' : 'AntiKt4EMPFlowJets_%SYS%', + 'electrons' : 'AnalysisElectrons_%SYS%', + 'photons' : 'AnalysisPhotons_%SYS%', + 'muons' : 'AnalysisMuons_%SYS%', + 'taus' : 'AnalysisTaus_%STS%', + }, + outputName = 'AnalysisMET_%SYS%', + affectingSystematics = { + 'jets' : '(^$)|(^JET_.*)', + 'electrons' : '(^$)|(^EG_.*)|(^EL_.*)', + 'photons' : '(^$)|(^EG_.*)|(^PH_.*)', + 'muons' : '(^$)|(^MUON_.*)', + 'taus' : '(^$)|(^TAUS_.*)', + } ) + + Note that defining a jet container is mandatory, but all other input + containers are optional. + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + metSuffix -- Suffix for the (core) MET objects to use from the input + (file) + useFJVT -- Use FJVT decision for the calculation + treatPUJets -- Treat pile-up jets in the MET significance calculation + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + if not useFJVT and treatPUJets: + raise ValueError ("MET significance pile-up treatment requires fJVT") + + # Remove b-tagging calibration from the MET suffix name + btIndex = metSuffix.find('_BTagging') + if btIndex != -1: + metSuffix = metSuffix[:btIndex] + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "MetAnalysisSequence" + postfix ) + + # Set up the met maker algorithm: + alg = createAlgorithm( 'CP::MetMakerAlg', 'MetMakerAlg' + postfix) + addPrivateTool( alg, 'makerTool', 'met::METMaker' ) + alg.makerTool.DoPFlow = 'PFlow' in metSuffix + if useFJVT: + alg.makerTool.JetRejectionDec = 'passFJVT' + alg.metCore = 'MET_Core_' + metSuffix + alg.metAssociation = 'METAssoc_' + metSuffix + seq.append( alg, + inputPropName = { 'jets' : 'jets', + 'electrons' : 'electrons', + 'photons' : 'photons', + 'muons' : 'muons', + 'taus' : 'taus', + 'invisible' : 'invisible'}, + outputPropName = 'met', + affectingSystematics = '(^MET_.*)' ) + + if dataType != "data" : + alg = createAlgorithm( 'CP::MetSystematicsAlg', 'MetSystematicsAlg' + postfix ) + addPrivateTool( alg, 'systematicsTool', 'met::METSystematicsTool' ) + seq.append( alg, inputPropName = 'met', + affectingSystematics = '(^MET_.*)' ) + pass + + # Set up the met builder algorithm: + alg = createAlgorithm( 'CP::MetBuilderAlg', 'MetBuilderAlg' + postfix ) + seq.append( alg, inputPropName = 'met' ) + + # Set up the met significance algorithm: + alg = createAlgorithm( 'CP::MetSignificanceAlg', 'MetSignificanceAlg' + postfix ) + addPrivateTool( alg, 'significanceTool', 'met::METSignificance' ) + alg.significanceTool.SoftTermParam = 0 + alg.significanceTool.TreatPUJets = treatPUJets + alg.significanceTool.IsAFII = dataType == "afii" + seq.append( alg, inputPropName = 'met' ) + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5ccb446532599c01cc3844e5b1b18db06f721002 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +__version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..bdcc1d76fda56b9cd117006de3d1082dbc82a771 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_eljob.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) + +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +if dataType not in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +if dataType == "data" : + sample.add (os.getenv ('ASG_TEST_FILE_DATA')) + pass +if dataType == "mc" : + sample.add (os.getenv ('ASG_TEST_FILE_MC')) + pass +if dataType == "afii" : + sample.add (os.getenv ('ASG_TEST_FILE_MC_AFII')) + pass +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) ) + +from MetAnalysisAlgorithms.MetAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'metTest_'+dataType+'_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..b78287fabb906189f45f9a9bbae951fcf0a36ad2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +# User options, which can be set from command line after a "-" character +# athena EgammaAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from MetAnalysisAlgorithms.MetAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='MetAnalysisAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0c6538358cc1095944ab4edeb8285e84e0c49d4f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_entries.cxx @@ -0,0 +1,20 @@ +// AsgExampleTools_entries.cxx + +#include <GaudiKernel/DeclareFactoryEntries.h> + +#include <MetAnalysisAlgorithms/MetBuilderAlg.h> +#include <MetAnalysisAlgorithms/MetMakerAlg.h> +#include <MetAnalysisAlgorithms/MetSignificanceAlg.h> +#include <MetAnalysisAlgorithms/MetSystematicsAlg.h> + +DECLARE_ALGORITHM_FACTORY (CP::MetBuilderAlg) +DECLARE_ALGORITHM_FACTORY (CP::MetMakerAlg) +DECLARE_ALGORITHM_FACTORY (CP::MetSignificanceAlg) +DECLARE_ALGORITHM_FACTORY (CP::MetSystematicsAlg) + +DECLARE_FACTORY_ENTRIES(MetAnalysisAlgorithms) { + DECLARE_ALGORITHM (CP::MetBuilderAlg) + DECLARE_ALGORITHM (CP::MetMakerAlg) + DECLARE_ALGORITHM (CP::MetSignificanceAlg) + DECLARE_ALGORITHM (CP::MetSystematicsAlg) +} diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9bcc930733e1332169b3504f4a0ac213ae81221c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_load.cxx @@ -0,0 +1,5 @@ +// AsgExampleTools_load.cxx + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(MetAnalysisAlgorithms) diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a43af6b8437e1c40611133a73b0d9a0c5fe0f585 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,68 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# The name of the package: +atlas_subdir( MuonAnalysisAlgorithms ) + +# The package's dependencies: +atlas_depends_on_subdirs( + PUBLIC + Event/xAOD/xAODEventInfo + Event/xAOD/xAODMuon + PhysicsAnalysis/Algorithms/SelectionHelpers + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/AnalysisCommon/IsolationSelection + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PhysicsAnalysis/Interfaces/MuonAnalysisInterfaces + PRIVATE + PhysicsAnalysis/D3PDTools/RootCoreUtils ) + +atlas_add_library( MuonAnalysisAlgorithmsLib + MuonAnalysisAlgorithms/*.h MuonAnalysisAlgorithms/*.icc Root/*.cxx + PUBLIC_HEADERS MuonAnalysisAlgorithms + LINK_LIBRARIES xAODEventInfo xAODMuon SelectionHelpersLib + SystematicsHandlesLib MuonAnalysisInterfacesLib IsolationSelectionLib + AnaAlgorithmLib + PRIVATE_LINK_LIBRARIES RootCoreUtils ) + +atlas_add_dictionary( MuonAnalysisAlgorithmsDict + MuonAnalysisAlgorithms/MuonAnalysisAlgorithmsDict.h + MuonAnalysisAlgorithms/selection.xml + LINK_LIBRARIES MuonAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( MuonAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel MuonAnalysisAlgorithmsLib ) +endif() + +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*_jobOptions.py ) +atlas_install_scripts( share/*_eljob.py ) + +if( XAOD_STANDALONE ) + atlas_add_test( testJobData + SCRIPT MuonAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT MuonAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT MuonAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) +else() + atlas_add_test( testJobData + SCRIPT athena.py + MuonAnalysisAlgorithms/MuonAnalysisAlgorithmsTest_jobOptions.py --evtMax=500 - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT athena.py + MuonAnalysisAlgorithms/MuonAnalysisAlgorithmsTest_jobOptions.py --evtMax=500 - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT athena.py + MuonAnalysisAlgorithms/MuonAnalysisAlgorithmsTest_jobOptions.py --evtMax=500 - --data-type afii + PROPERTIES TIMEOUT 600 ) +endif() diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..7f54f49de8ad94a10d33a5a94599b32b294f77fc --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithmsDict.h @@ -0,0 +1,17 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef MUON_ANALYSIS_ALGORITHMS__MUON_ANALYSIS_ALGORITHMS_DICT_H +#define MUON_ANALYSIS_ALGORITHMS__MUON_ANALYSIS_ALGORITHMS_DICT_H + +#include <MuonAnalysisAlgorithms/MuonCalibrationAndSmearingAlg.h> +#include <MuonAnalysisAlgorithms/MuonEfficiencyScaleFactorAlg.h> +#include <MuonAnalysisAlgorithms/MuonIsolationAlg.h> +#include <MuonAnalysisAlgorithms/MuonSelectionAlg.h> +#include <MuonAnalysisAlgorithms/MuonTriggerEfficiencyScaleFactorAlg.h> + +#endif diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonCalibrationAndSmearingAlg.h b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonCalibrationAndSmearingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..36daa86cc57a73e44e060b3f5fd6d59b95ea5fdf --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonCalibrationAndSmearingAlg.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef MUON_ANALYSIS_ALGORITHMS__MUON_CALIBRATION_AND_SMEARING_ALG_H +#define MUON_ANALYSIS_ALGORITHMS__MUON_CALIBRATION_AND_SMEARING_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <MuonAnalysisInterfaces/IMuonCalibrationAndSmearingTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODMuon/MuonContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMuonCalibrationAndSmearingTool + + class MuonCalibrationAndSmearingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MuonCalibrationAndSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IMuonCalibrationAndSmearingTool> m_calibrationAndSmearingTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the muon collection we run on + private: + SysCopyHandle<xAOD::MuonContainer> m_muonHandle { + this, "muons", "Muons", "the muon collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonEfficiencyScaleFactorAlg.h b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonEfficiencyScaleFactorAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..cec9c4ad817b0d23399871da6ee19889327d3355 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonEfficiencyScaleFactorAlg.h @@ -0,0 +1,86 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef MUON_ANALYSIS_ALGORITHMS__MUON_EFFICIENCY_SCALE_FACTOR_ALG_H +#define MUON_ANALYSIS_ALGORITHMS__MUON_EFFICIENCY_SCALE_FACTOR_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <MuonAnalysisInterfaces/IMuonEfficiencyScaleFactors.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <xAODEventInfo/EventInfo.h> +#include <xAODMuon/MuonContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMuonEfficiencyScaleFactorTool + + class MuonEfficiencyScaleFactorAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MuonEfficiencyScaleFactorAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IMuonEfficiencyScaleFactors> m_efficiencyScaleFactorTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the muon collection we run on + private: + SysCopyHandle<xAOD::MuonContainer> m_muonHandle { + this, "muons", "Muons", "the muon collection to run on"}; + + /// \brief the EventInfo collection we use + private: + SysReadHandle<xAOD::EventInfo> m_eventInfoHandle { + this, "eventInfo", "EventInfo", "the EventInfo we use"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + + /// \brief the decoration for the muon scale factor + private: + SysDecorationHandle<float> m_scaleFactorDecoration { + this, "scaleFactorDecoration", "", "the decoration for the muon efficiency scale factor"}; + + /// \brief the decoration for the muon mc efficiency + private: + SysDecorationHandle<float> m_mcEfficiencyDecoration { + this, "mcEfficiencyDecoration", "", "the decoration for the muon MC efficiency"}; + + /// \brief the decoration for the muon data efficiency + private: + SysDecorationHandle<float> m_dataEfficiencyDecoration { + this, "dataEfficiencyDecoration", "", "the decoration for the muon data efficiency"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonIsolationAlg.h b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonIsolationAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..3f8b83f301f2d85b32067698be7c7250a6d6d8e8 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonIsolationAlg.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef MUON_ANALYSIS_ALGORITHMS__MUON_ISOLATION_ALG_H +#define MUON_ANALYSIS_ALGORITHMS__MUON_ISOLATION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <IsolationSelection/IIsolationSelectionTool.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODMuon/MuonContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMuonSelectionTool + + class MuonIsolationAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MuonIsolationAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IIsolationSelectionTool> m_isolationTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the muon collection we run on + private: + SysCopyHandle<xAOD::MuonContainer> m_muonHandle { + this, "muons", "Muons", "the muon collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the decoration for the muon isolation + private: + std::string m_isolationDecoration; + + /// \brief the accessor for \ref m_isolationDecoration + private: + std::unique_ptr<ISelectionAccessor> m_isolationAccessor; + + /// \brief the bits to set for an object failing the preselection + private: + SelectionType m_setOnFail; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonSelectionAlg.h b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..7537d0ce572af66642f7309355f6627db3519dd6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonSelectionAlg.h @@ -0,0 +1,78 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + +#ifndef MUON_ANALYSIS_ALGORITHMS__MUON_SELECTION_ALG_H +#define MUON_ANALYSIS_ALGORITHMS__MUON_SELECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <MuonAnalysisInterfaces/IMuonSelectionTool.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODMuon/MuonContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMuonSelectionTool + + class MuonSelectionAlgV2 final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MuonSelectionAlgV2 (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the selection tool + private: + ToolHandle<IMuonSelectionTool> m_selectionTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the particle continer we run on + private: + SysCopyHandle<xAOD::MuonContainer> m_muonsHandle { + this, "muons", "Muons", "the muons collection to run on"}; + + /// \brief the decoration for the quality selection + private: + std::string m_selectionDecoration; + + /// \brief the accessor for \ref m_selectionDecoration + private: + std::unique_ptr<ISelectionAccessor> m_selectionAccessor; + + /// \brief the decoration for the bad muon veto + private: + std::string m_badMuonVetoDecoration; + + /// \brief the accessor for \ref m_selectionDecoration + private: + std::unique_ptr<ISelectionAccessor> m_badMuonVetoAccessor; + + /// \brief the bits to set for an object failing the preselection + private: + SelectionType m_setOnFail; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonTriggerEfficiencyScaleFactorAlg.h b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonTriggerEfficiencyScaleFactorAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..934ba8d5859b2c6bbda0339fddba1979e13eb5cf --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/MuonTriggerEfficiencyScaleFactorAlg.h @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef MUON_ANALYSIS_ALGORITHMS__MUON_TRIGGER_EFFICIENCY_SCALE_FACTOR_ALG_H +#define MUON_ANALYSIS_ALGORITHMS__MUON_TRIGGER_EFFICIENCY_SCALE_FACTOR_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <xAODEventInfo/EventInfo.h> +#include <xAODMuon/MuonContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IMuonTriggerScaleFactors + + class MuonTriggerEfficiencyScaleFactorAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + MuonTriggerEfficiencyScaleFactorAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<IMuonTriggerScaleFactors> m_efficiencyScaleFactorTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the muon collection we run on + private: + SysCopyHandle<xAOD::MuonContainer> m_muonHandle { + this, "muons", "Muons", "the muon collection to run on"}; + + /// \brief the EventInfo collection we use + private: + SysReadHandle<xAOD::EventInfo> m_eventInfoHandle { + this, "eventInfo", "EventInfo", "the EventInfo we use"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + + /// \brief trigger to run efficiency for + private: + std::string m_trigger; + + /// \brief minimum run number this trigger is valid for + private: + uint32_t m_minRunNumber; + + /// \brief maximum run number this trigger is valid for + private: + uint32_t m_maxRunNumber; + + /// \brief the decoration for the muon scale factor + private: + SysDecorationHandle<float> m_scaleFactorDecoration { + this, "scaleFactorDecoration", "", "the decoration for the muon efficiency scale factor"}; + + /// \brief the decoration for the muon mc efficiency + private: + SysDecorationHandle<float> m_mcEfficiencyDecoration { + this, "mcEfficiencyDecoration", "", "the decoration for the muon MC efficiency"}; + + /// \brief the decoration for the muon data efficiency + private: + SysDecorationHandle<float> m_dataEfficiencyDecoration { + this, "dataEfficiencyDecoration", "", "the decoration for the muon data efficiency"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..f86b52b89753924208abb153adbc2eadbeb83558 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/MuonAnalysisAlgorithms/selection.xml @@ -0,0 +1,9 @@ +<lcgdict> + + <class name="CP::MuonCalibrationAndSmearingAlg" /> + <class name="CP::MuonEfficiencyScaleFactorAlg" /> + <class name="CP::MuonIsolationAlg" /> + <class name="CP::MuonSelectionAlgV2" /> + <class name="CP::MuonTriggerEfficiencyScaleFactorAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonCalibrationAndSmearingAlg.cxx b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonCalibrationAndSmearingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..055a56b507eb6790e1561f7abf26e3b8304fcc19 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonCalibrationAndSmearingAlg.cxx @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <MuonAnalysisAlgorithms/MuonCalibrationAndSmearingAlg.h> + +#include <RootCoreUtils/Assert.h> + +// +// method implementations +// + +namespace CP +{ + MuonCalibrationAndSmearingAlg :: + MuonCalibrationAndSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_calibrationAndSmearingTool ("CP::MuonCalibrationAndSmearingTool", this) + { + declareProperty ("calibrationAndSmearingTool", m_calibrationAndSmearingTool, "the calibration and smearing tool we apply"); + } + + + + StatusCode MuonCalibrationAndSmearingAlg :: + initialize () + { + ANA_CHECK (m_calibrationAndSmearingTool.retrieve()); + m_systematicsList.addHandle (m_muonHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_calibrationAndSmearingTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode MuonCalibrationAndSmearingAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_calibrationAndSmearingTool->applySystematicVariation (sys)); + xAOD::MuonContainer *muons = nullptr; + ANA_CHECK (m_muonHandle.getCopy (muons, sys)); + for (xAOD::Muon *muon : *muons) + { + if (m_preselection.getBool (*muon)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *muon, m_calibrationAndSmearingTool->applyCorrection (*muon)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonEfficiencyScaleFactorAlg.cxx b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonEfficiencyScaleFactorAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8a2decda46a764853a45635f9a5e34ed84cc4f93 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonEfficiencyScaleFactorAlg.cxx @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <MuonAnalysisAlgorithms/MuonEfficiencyScaleFactorAlg.h> + +#include <RootCoreUtils/Assert.h> + +// +// method implementations +// + +namespace CP +{ + MuonEfficiencyScaleFactorAlg :: + MuonEfficiencyScaleFactorAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_efficiencyScaleFactorTool ("CP::MuonEfficiencyScaleFactors", this) + { + declareProperty ("efficiencyScaleFactorTool", m_efficiencyScaleFactorTool, "the calibration and smearing tool we apply"); + } + + + + StatusCode MuonEfficiencyScaleFactorAlg :: + initialize () + { + if (m_scaleFactorDecoration.empty() && m_mcEfficiencyDecoration.empty() && m_dataEfficiencyDecoration.empty()) + { + ANA_MSG_ERROR ("no scale factor or efficiency decoration name set"); + return StatusCode::FAILURE; + } + + ANA_CHECK (m_efficiencyScaleFactorTool.retrieve()); + m_systematicsList.addHandle (m_muonHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyScaleFactorTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + + return StatusCode::SUCCESS; + } + + + + StatusCode MuonEfficiencyScaleFactorAlg :: + execute () + { + if (m_scaleFactorDecoration) { + ANA_CHECK (m_scaleFactorDecoration.preExecute (m_systematicsList)); + } + if (m_mcEfficiencyDecoration) { + ANA_CHECK (m_mcEfficiencyDecoration.preExecute (m_systematicsList)); + } + if (m_dataEfficiencyDecoration) { + ANA_CHECK (m_dataEfficiencyDecoration.preExecute (m_systematicsList)); + } + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_efficiencyScaleFactorTool->applySystematicVariation (sys)); + xAOD::MuonContainer *muons = nullptr; + ANA_CHECK (m_muonHandle.getCopy (muons, sys)); + const xAOD::EventInfo *eventInfo = nullptr; + ANA_CHECK (m_eventInfoHandle.retrieve (eventInfo, sys)); + for (xAOD::Muon *muon : *muons) + { + if (m_preselection.getBool (*muon)) + { + if (m_scaleFactorDecoration) { + float sf = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *muon, m_efficiencyScaleFactorTool->getEfficiencyScaleFactor (*muon, sf, eventInfo)); + m_scaleFactorDecoration.set (*muon, sf, sys); + } + + if (m_mcEfficiencyDecoration) { + float eff = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *muon, m_efficiencyScaleFactorTool->getMCEfficiency (*muon, eff, eventInfo)); + m_mcEfficiencyDecoration.set (*muon, eff, sys); + } + + if (m_dataEfficiencyDecoration) { + float eff = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *muon, m_efficiencyScaleFactorTool->getDataEfficiency (*muon, eff, eventInfo)); + m_dataEfficiencyDecoration.set (*muon, eff, sys); + } + } else + { + if (m_scaleFactorDecoration) { + m_scaleFactorDecoration.set (*muon, invalidScaleFactor(), sys); + } + + if (m_mcEfficiencyDecoration) { + m_mcEfficiencyDecoration.set (*muon, invalidEfficiency(), sys); + } + + if (m_dataEfficiencyDecoration) { + m_dataEfficiencyDecoration.set (*muon, invalidEfficiency(), sys); + } + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonIsolationAlg.cxx b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonIsolationAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cc4481ec6b09373543563a8945888bf094334cd5 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonIsolationAlg.cxx @@ -0,0 +1,80 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <MuonAnalysisAlgorithms/MuonIsolationAlg.h> + +#include <RootCoreUtils/Assert.h> + +// +// method implementations +// + +namespace CP +{ + MuonIsolationAlg :: + MuonIsolationAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_isolationTool ("CP::IsolationSelectionTool", this) + { + declareProperty ("isolationTool", m_isolationTool, "the isolation tool we apply"); + declareProperty ("isolationDecoration", m_isolationDecoration, "the decoration for the muon isolation"); + } + + + + StatusCode MuonIsolationAlg :: + initialize () + { + if (m_isolationDecoration.empty()) + { + ANA_MSG_ERROR ("no isolation decoration name set"); + return StatusCode::FAILURE; + } + ANA_CHECK (makeSelectionAccessor (m_isolationDecoration, m_isolationAccessor)); + + ANA_CHECK (m_isolationTool.retrieve()); + m_systematicsList.addHandle (m_muonHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + + Root::TAccept blankAccept = m_isolationTool->getObjTAccept(); + // Just in case this isn't initially set up as a failure clear it this one + // time. This only calls reset on the bitset + blankAccept.clear(); + m_setOnFail = selectionFromAccept(blankAccept); + + return StatusCode::SUCCESS; + } + + + + StatusCode MuonIsolationAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::MuonContainer *muons = nullptr; + ANA_CHECK (m_muonHandle.getCopy (muons, sys)); + for (xAOD::Muon *muon : *muons) + { + if (m_preselection.getBool (*muon)) + { + m_isolationAccessor->setBits + (*muon, selectionFromAccept (m_isolationTool->accept (*muon))); + } else { + m_isolationAccessor->setBits (*muon, m_setOnFail); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonSelectionAlg.cxx b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonSelectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a586bbcbb8c4df56121832e5e6bc18655d90a136 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonSelectionAlg.cxx @@ -0,0 +1,96 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + +// +// includes +// + +#include <MuonAnalysisAlgorithms/MuonSelectionAlg.h> +#include <PATCore/IAsgSelectionTool.h> + +// +// method implementations +// + +namespace CP +{ + MuonSelectionAlgV2 :: + MuonSelectionAlgV2 (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_selectionTool ("", this) + { + declareProperty ("selectionTool", m_selectionTool, "the selection tool we apply"); + declareProperty ("selectionDecoration", m_selectionDecoration, "the decoration for the quality selection"); + declareProperty ("badMuonVetoDecoration", m_badMuonVetoDecoration, "the decoration for the bad muon veto"); + } + + + + StatusCode MuonSelectionAlgV2 :: + initialize () + { + if (m_selectionDecoration.empty()) + { + ANA_MSG_ERROR ("no selection decoration name set"); + return StatusCode::FAILURE; + } + ANA_CHECK (makeSelectionAccessor (m_selectionDecoration, m_selectionAccessor)); + ANA_CHECK (m_selectionTool.retrieve()); + + if (!m_badMuonVetoDecoration.empty()) + { + ANA_CHECK (makeSelectionAccessor (m_badMuonVetoDecoration, m_badMuonVetoAccessor)); + ANA_CHECK (m_selectionTool.retrieve()); + } + + m_systematicsList.addHandle (m_muonsHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + + auto *selectionTool = dynamic_cast<IAsgSelectionTool *>(&*m_selectionTool); + Root::TAccept blankAccept = selectionTool->getTAccept(); + // Just in case this isn't initially set up as a failure clear it this one + // time. This only calls reset on the bitset + blankAccept.clear(); + m_setOnFail = selectionFromAccept(blankAccept); + + return StatusCode::SUCCESS; + } + + + + StatusCode MuonSelectionAlgV2 :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode + { + xAOD::MuonContainer *muons = nullptr; + ANA_CHECK (m_muonsHandle.getCopy (muons, sys)); + for (xAOD::Muon *muon : *muons) + { + if (m_preselection.getBool (*muon)) + { + m_selectionAccessor->setBits + (*muon, selectionFromAccept (m_selectionTool->accept (*muon))); + + if (m_badMuonVetoAccessor != nullptr) + { + m_badMuonVetoAccessor->setBool (*muon, m_selectionTool->isBadMuon (*muon)); + } + } else { + m_selectionAccessor->setBits (*muon, m_setOnFail); + + if (m_badMuonVetoAccessor != nullptr) + { + m_badMuonVetoAccessor->setBool (*muon, false); + } + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonTriggerEfficiencyScaleFactorAlg.cxx b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonTriggerEfficiencyScaleFactorAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a5795bf12295fdb41b23474d0f15c2bda1349de4 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/Root/MuonTriggerEfficiencyScaleFactorAlg.cxx @@ -0,0 +1,127 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + + +// +// includes +// + +#include <MuonAnalysisAlgorithms/MuonTriggerEfficiencyScaleFactorAlg.h> + +#include <AthContainers/ConstDataVector.h> +#include <RootCoreUtils/Assert.h> + +// +// method implementations +// + +namespace CP +{ + MuonTriggerEfficiencyScaleFactorAlg :: + MuonTriggerEfficiencyScaleFactorAlg (const std::string& name, ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_efficiencyScaleFactorTool ("CP::MuonTriggerScaleFactors", this) + { + declareProperty ("efficiencyScaleFactorTool", m_efficiencyScaleFactorTool, "the trigger efficiency scale factor tool we apply"); + declareProperty ("trigger", m_trigger, "trigger or trigger leg to calculate efficiency for"); + declareProperty ("minRunNumber", m_minRunNumber = 0, "trigger or trigger leg to calculate efficiency for"); + declareProperty ("maxRunNumber", m_maxRunNumber = 999999, "trigger or trigger leg to calculate efficiency for"); + } + + + + StatusCode MuonTriggerEfficiencyScaleFactorAlg :: + initialize () + { + if (m_trigger.empty()) + { + ANA_MSG_ERROR ("trigger name needs to be set"); + return StatusCode::FAILURE; + } + + if (m_scaleFactorDecoration.empty() && m_mcEfficiencyDecoration.empty() && m_dataEfficiencyDecoration.empty()) + { + ANA_MSG_ERROR ("no scale factor or efficiency decoration name set"); + return StatusCode::FAILURE; + } + + ANA_CHECK (m_efficiencyScaleFactorTool.retrieve()); + m_systematicsList.addHandle (m_muonHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyScaleFactorTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + + return StatusCode::SUCCESS; + } + + + + StatusCode MuonTriggerEfficiencyScaleFactorAlg :: + execute () + { + if (m_scaleFactorDecoration) { + ANA_CHECK (m_scaleFactorDecoration.preExecute (m_systematicsList)); + } + if (m_mcEfficiencyDecoration) { + ANA_CHECK (m_mcEfficiencyDecoration.preExecute (m_systematicsList)); + } + if (m_dataEfficiencyDecoration) { + ANA_CHECK (m_dataEfficiencyDecoration.preExecute (m_systematicsList)); + } + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_efficiencyScaleFactorTool->applySystematicVariation (sys)); + xAOD::MuonContainer *muons = nullptr; + ANA_CHECK (m_muonHandle.getCopy (muons, sys)); + const xAOD::EventInfo *eventInfo = nullptr; + ANA_CHECK (m_eventInfoHandle.retrieve (eventInfo, sys)); + + unsigned int randomRunNumber = eventInfo->auxdecor<unsigned int>("RandomRunNumber"); + bool validEvent = m_minRunNumber <= randomRunNumber && m_maxRunNumber >= randomRunNumber; + + for (xAOD::Muon *muon : *muons) + { + if (validEvent && m_preselection.getBool (*muon)) + { + if (m_scaleFactorDecoration) { + double sf = 0; + ConstDataVector<xAOD::MuonContainer> singleMuonContainer(SG::VIEW_ELEMENTS); + singleMuonContainer.push_back(muon); + ANA_CHECK_CORRECTION (m_outOfValidity, *muon, m_efficiencyScaleFactorTool->getTriggerScaleFactor (*singleMuonContainer.asDataVector(), sf, m_trigger)); + m_scaleFactorDecoration.set (*muon, sf, sys); + } + + if (m_mcEfficiencyDecoration) { + double eff = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *muon, m_efficiencyScaleFactorTool->getTriggerEfficiency (*muon, eff, m_trigger, false)); + m_mcEfficiencyDecoration.set (*muon, eff, sys); + } + + if (m_dataEfficiencyDecoration) { + double eff = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *muon, m_efficiencyScaleFactorTool->getTriggerEfficiency (*muon, eff, m_trigger, true)); + m_dataEfficiencyDecoration.set (*muon, eff, sys); + } + } else { + if (m_scaleFactorDecoration) { + m_scaleFactorDecoration.set (*muon, invalidScaleFactor(), sys); + } + + if (m_mcEfficiencyDecoration) { + m_mcEfficiencyDecoration.set (*muon, invalidEfficiency(), sys); + } + + if (m_dataEfficiencyDecoration) { + m_dataEfficiencyDecoration.set (*muon, invalidEfficiency(), sys); + } + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisAlgorithmsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..eee5a797da60513626a7c26d3dc54b41761abacb --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisAlgorithmsTest.py @@ -0,0 +1,70 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +from AnaAlgorithm.AlgSequence import AlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm + +def makeSequence (dataType) : + + algSeq = AlgSequence() + + # Set up the systematics loader/handler algorithm: + sysLoader = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + sysLoader.sigmaRecommended = 1 + algSeq += sysLoader + + + # Include, and then set up the pileup analysis sequence: + from AsgAnalysisAlgorithms.PileupAnalysisSequence import \ + makePileupAnalysisSequence + pileupSequence = makePileupAnalysisSequence( dataType ) + pileupSequence.configure( inputName = 'EventInfo', outputName = 'EventInfo_%SYS%' ) + + # Add the pileup sequence to the job: + algSeq += pileupSequence + + # Include, and then set up the muon analysis algorithm sequence: + from MuonAnalysisAlgorithms.MuonAnalysisSequence import makeMuonAnalysisSequence + muonSequenceMedium = makeMuonAnalysisSequence( dataType, deepCopyOutput = True, shallowViewOutput = False, + workingPoint = 'Medium.Iso', postfix = 'medium', + enableCutflow=True, enableKinematicHistograms=True ) + muonSequenceMedium.configure( inputName = 'Muons', + outputName = 'AnalysisMuonsMedium_%SYS%' ) + + # Add the sequence to the job: + algSeq += muonSequenceMedium + + muonSequenceTight = makeMuonAnalysisSequence( dataType, deepCopyOutput = True, shallowViewOutput = False, + workingPoint = 'Tight.Iso', postfix = 'tight', + enableCutflow=True, enableKinematicHistograms=True ) + muonSequenceTight.removeStage ("calibration") + muonSequenceTight.configure( inputName = 'AnalysisMuonsMedium_%SYS%', + outputName = 'AnalysisMuons_%SYS%', + affectingSystematics = muonSequenceMedium.affectingSystematics()) + + # Add the sequence to the job: + algSeq += muonSequenceTight + + # Add an ntuple dumper algorithm: + treeMaker = createAlgorithm( 'CP::TreeMakerAlg', 'TreeMaker' ) + treeMaker.TreeName = 'muons' + algSeq += treeMaker + ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMakerEventInfo' ) + ntupleMaker.TreeName = 'muons' + ntupleMaker.Branches = [ 'EventInfo.runNumber -> runNumber', + 'EventInfo.eventNumber -> eventNumber', ] + ntupleMaker.systematicsRegex = '(^$)' + algSeq += ntupleMaker + ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMakerMuons' ) + ntupleMaker.TreeName = 'muons' + ntupleMaker.Branches = [ 'AnalysisMuons_NOSYS.eta -> mu_eta', + 'AnalysisMuons_NOSYS.phi -> mu_phi', + 'AnalysisMuons_%SYS%.pt -> mu_%SYS%_pt', ] + ntupleMaker.systematicsRegex = '(^MUON_.*)' + algSeq += ntupleMaker + treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' ) + treeFiller.TreeName = 'muons' + algSeq += treeFiller + + return algSeq diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..2d3b893b8b27878c7c752f107ddd04914a4d036d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py @@ -0,0 +1,224 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool +import ROOT + +def makeMuonAnalysisSequence( dataType, workingPoint, + deepCopyOutput = False, + shallowViewOutput = True, + postfix = '', + ptSelectionOutput = False, + qualitySelectionOutput = True, + enableCutflow = False, + enableKinematicHistograms = False ): + """Create a muon analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + workingPoint -- The working point to use + deepCopyOutput -- If set to 'True', the output containers will be + standalone, deep copies (slower, but needed for xAOD + output writing) + shallowViewOutput -- Create a view container if required + postfix -- a postfix to apply to decorations and algorithm + names. this is mostly used/needed when using this + sequence with multiple working points to ensure all + names are unique. + ptSelectionOutput -- Whether or not to apply pt selection when creating + output containers. + qualitySelectionOutput -- Whether or not to apply muon quality selection + when creating output containers. + enableCutflow -- Whether or not to dump the cutflow + enableKinematicHistograms -- Whether or not to dump the kinematic histograms + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + if postfix != '' : + postfix = '_' + postfix + pass + + # Make sure selection options make sense + if deepCopyOutput and shallowViewOutput: + raise ValueError ("deepCopyOutput and shallowViewOutput can't both be true!") + + splitWP = workingPoint.split ('.') + if len (splitWP) != 2 : + raise ValueError ('working point should be of format "quality.isolation", not ' + workingPoint) + + sfWorkingPoint = splitWP[0] + if splitWP[0] == 'Tight' : + quality = ROOT.xAOD.Muon.Tight + pass + elif splitWP[0] == 'Medium' : + quality = ROOT.xAOD.Muon.Medium + pass + elif splitWP[0] == 'Loose' : + quality = ROOT.xAOD.Muon.Loose + pass + elif splitWP[0] == 'VeryLoose' : + quality = ROOT.xAOD.Muon.VeryLoose + pass + elif splitWP[0] == 'HighPt' : + quality = 4 + pass + elif splitWP[0] == 'LowPtEfficiency' : + quality = 5 + pass + else : + raise ValueError ("invalid muon quality: \"" + splitWP[0] + + "\", allowed values are Tight, Medium, Loose, " + + "VeryLoose, HighPt, LowPtEfficiency") + + if not splitWP[1] in ["Iso", "NonIso"] : + raise ValueError ('invalid muon isolation \"' + splitWP[1] + + '\", allowed values are Iso, NonIso') + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "MuonAnalysisSequence" + postfix ) + + seq.addMetaConfigDefault ("selectionDecorNames", []) + seq.addMetaConfigDefault ("selectionDecorNamesOutput", []) + seq.addMetaConfigDefault ("selectionDecorCount", []) + + # Set up the eta-cut on all muons prior to everything else + alg = createAlgorithm( 'CP::AsgSelectionAlg', + 'MuonEtaCutAlg' + postfix ) + addPrivateTool( alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool' ) + alg.selectionTool.maxEta = 2.5 + alg.selectionDecoration = 'selectEta' + postfix + ',as_bits' + seq.append( alg, inputPropName = 'particles', + outputPropName = 'particlesOut', + stageName = 'selection', + metaConfig = {'selectionDecorNames' : [alg.selectionDecoration], + 'selectionDecorNamesOutput' : [alg.selectionDecoration], + 'selectionDecorCount' : [2]}, + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])}) + + # Set up the track selection algorithm: + alg = createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', + 'MuonTrackSelectionAlg' + postfix ) + alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits' + alg.maxD0Significance = 3 + alg.maxDeltaZ0SinTheta = 0.5 + seq.append( alg, inputPropName = 'particles', + stageName = 'selection', + metaConfig = {'selectionDecorNames' : [alg.selectionDecoration], + 'selectionDecorNamesOutput' : [alg.selectionDecoration], + 'selectionDecorCount' : [3]}, + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])}) + + # Set up the muon calibration and smearing algorithm: + alg = createAlgorithm( 'CP::MuonCalibrationAndSmearingAlg', + 'MuonCalibrationAndSmearingAlg' + postfix ) + addPrivateTool( alg, 'calibrationAndSmearingTool', + 'CP::MuonCalibrationPeriodTool' ) + seq.append( alg, inputPropName = 'muons', outputPropName = 'muonsOut', + affectingSystematics = '(^MUON_ID$)|(^MUON_MS$)|(^MUON_SAGITTA_.*)|(^MUON_SCALE$)', + stageName = 'calibration', + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])}) + + # Set up the the pt selection + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'MuonPtCutAlg' + postfix ) + alg.selectionDecoration = 'selectPt' + postfix + ',as_bits' + addPrivateTool( alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool' ) + alg.selectionTool.minPt = 3e3 + seq.append( alg, inputPropName = 'particles', + stageName = 'selection', + metaConfig = {'selectionDecorNames' : [alg.selectionDecoration], + 'selectionDecorNamesOutput' : [alg.selectionDecoration] if ptSelectionOutput else [], + 'selectionDecorCount' : [2]}, + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])}) + + # Setup the muon quality selection + alg = createAlgorithm( 'CP::MuonSelectionAlgV2', + 'MuonSelectionAlg' + postfix ) + addPrivateTool( alg, 'selectionTool', 'CP::MuonSelectionTool' ) + alg.selectionTool.MuQuality = quality + alg.selectionDecoration = 'good_muon' + postfix + ',as_bits' + alg.badMuonVetoDecoration = 'is_bad' + postfix + ',as_char' + seq.append( alg, inputPropName = 'muons', + stageName = 'selection', + metaConfig = {'selectionDecorNames' : [alg.selectionDecoration], + 'selectionDecorNamesOutput' : [alg.selectionDecoration] if qualitySelectionOutput else [], + 'selectionDecorCount' : [4]}, + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])}) + + # Set up the isolation calculation algorithm: + if splitWP[1] != 'NonIso' : + alg = createAlgorithm( 'CP::MuonIsolationAlg', + 'MuonIsolationAlg' + postfix ) + addPrivateTool( alg, 'isolationTool', 'CP::IsolationSelectionTool' ) + alg.isolationDecoration = 'isolated_muon' + postfix + ',as_bits' + seq.append( alg, inputPropName = 'muons', outputPropName = 'muonsOut', + stageName = 'selection', + metaConfig = {'selectionDecorNames' : [alg.isolationDecoration], + 'selectionDecorNamesOutput' : [alg.isolationDecoration], + 'selectionDecorCount' : [1]}, + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])}) + pass + + # Set up an algorithm used for decorating baseline muon selection: + alg = createAlgorithm( 'CP::AsgSelectionAlg', + 'MuonSelectionSummary' + postfix ) + addPrivateTool( alg, 'selectionTool', 'CP::AsgFlagSelectionTool' ) + alg.selectionDecoration = 'baselineSelection' + postfix + ',as_char' + seq.append( alg, inputPropName = 'particles', + stageName = 'selection', + dynConfig = {'selectionTool.selectionFlags' : lambda meta : meta["selectionDecorNames"]}) + + # Set up an algorithm used to create muon selection cutflow: + if enableCutflow: + alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg', 'MuonCutFlowDumperAlg' + postfix ) + alg.histPattern = 'muon' + postfix + '_cflow_%SYS%' + seq.append( alg, inputPropName = 'input', stageName = 'selection', + dynConfig = {'selection' : lambda meta : meta["selectionDecorNames"], + 'selectionNCuts' : lambda meta : meta["selectionDecorCount"]} ) + + # Set up an algorithm that makes a view container using the selections + # performed previously: + if shallowViewOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'MuonViewFromSelectionAlg' + postfix ) + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection', + dynConfig = {'selection' : lambda meta : meta["selectionDecorNamesOutput"]} ) + + # Set up the efficiency scale factor calculation algorithm: + alg = createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg', + 'MuonEfficiencyScaleFactorAlg' + postfix ) + addPrivateTool( alg, 'efficiencyScaleFactorTool', + 'CP::MuonEfficiencyScaleFactors' ) + alg.scaleFactorDecoration = 'muon_effSF' + postfix + "_%SYS%" + alg.scaleFactorDecorationRegex = '(^MUON_EFF_RECO.*)' + alg.outOfValidity = 2 #silent + alg.outOfValidityDeco = 'bad_eff' + postfix + alg.efficiencyScaleFactorTool.WorkingPoint = sfWorkingPoint + if dataType != 'data': + seq.append( alg, inputPropName = 'muons', + affectingSystematics = '(^MUON_EFF_RECO.*)', + stageName = 'efficiency', + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])}) + + # Set up an algorithm dumping the kinematic properties of the muons: + if enableKinematicHistograms: + alg = createAlgorithm( 'CP::KinematicHistAlg', 'MuonKinematicDumperAlg' + postfix ) + alg.histPattern = 'muon' + postfix + '_%VAR%_%SYS%' + seq.append( alg, inputPropName = 'input', stageName = 'selection', + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])}) + + # Set up a final deep copy making algorithm if requested: + if deepCopyOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'MuonDeepCopyMaker' + postfix ) + alg.deepCopy = True + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection', + dynConfig = {'selection' : lambda meta : meta["selectionDecorNamesOutput"]} ) + pass + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5ccb446532599c01cc3844e5b1b18db06f721002 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +__version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..70d19f314de8a487a024e8600523f713172360e7 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_eljob.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +if dataType not in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +if dataType == "data" : + sample.add (os.getenv ('ASG_TEST_FILE_DATA')) + pass +if dataType == "mc" : + sample.add (os.getenv ('ASG_TEST_FILE_MC')) + pass +if dataType == "afii" : + sample.add (os.getenv ('ASG_TEST_FILE_MC_AFII')) + pass +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + + +from MuonAnalysisAlgorithms.MuonAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Make sure that both the ntuple and the xAOD dumper have a stream to write to. +job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) ) + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'muonTest_'+dataType+'_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..3b627b920c1e263f34279c65bfffc9c767d61681 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py @@ -0,0 +1,66 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack, Will Buttinger + +#User options, which can be set from command line after a "-" character +#athena MuonAnalysisAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type",action="store",dest="data_type", + default="data", + help="Type of data to run over. Valid options are data, mc, afii") +athArgsParser.add_argument("--write-xaod",action="store",dest="write_xaod", + default=False, + help="Specify if you want xaod writing to happen (which means slower access mode for now)") +athArgs = athArgsParser.parse_args() + + +if athArgs.write_xaod: + #currently we must use POOLAccess mode when writing an xAOD + jps.AthenaCommonFlags.AccessMode = "POOLAccess" +else: + #ClassAccess is much faster than POOLAccess + jps.AthenaCommonFlags.AccessMode = "ClassAccess" + +dataType = athArgs.data_type + +# Set up a histogram/tree output file for the job: +jps.AthenaCommonFlags.HistOutputs = ["ANALYSIS:MuonAnalysisAlgorithmsTest." + dataType + ".hist.root"] +svcMgr.THistSvc.MaxFileSize=-1 #make job run faster by disabling file size check + +#set a default file and number of events to process +#can override with standard athena command line options (--evtMax and --filesInput) +jps.AthenaCommonFlags.EvtMax = 500 + +if dataType=="data": + testFile = os.getenv ('ASG_TEST_FILE_DATA') +elif dataType=="mc": + testFile = os.getenv ('ASG_TEST_FILE_MC') +elif dataType=="afii": + testFile = os.getenv ('ASG_TEST_FILE_MC_AFII') + +jps.AthenaCommonFlags.FilesInput = [testFile] + + + +from MuonAnalysisAlgorithms.MuonAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Write a mini-xAOD if requested: +if athArgs.write_xaod: + from OutputStreamAthenaPool.MultipleStreamManager import MSMgr + minixAOD = MSMgr.NewPoolRootStream( 'AAOD_MUON', + FileName = 'MuonAnalysisAlgorithmsTest.AAOD_MUON.pool.root' ) + minixAOD.AddItem( + [ 'xAOD::EventInfo#EventInfo', + 'xAOD::EventAuxInfo#EventInfoAux.-', + 'xAOD::MuonContainer#AnalysisMuons_NOSYS', + 'xAOD::AuxContainerBase#AnalysisMuons_NOSYSAux.eta.phi.pt' ] ) + + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/src/components/MuonAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/src/components/MuonAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6bc2608c046013817c6377f0ab1c700c1d26e2b6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/src/components/MuonAnalysisAlgorithms_entries.cxx @@ -0,0 +1,23 @@ +// AsgExampleTools_entries.cxx + +#include <GaudiKernel/DeclareFactoryEntries.h> + +#include <MuonAnalysisAlgorithms/MuonCalibrationAndSmearingAlg.h> +#include <MuonAnalysisAlgorithms/MuonIsolationAlg.h> +#include <MuonAnalysisAlgorithms/MuonEfficiencyScaleFactorAlg.h> +#include <MuonAnalysisAlgorithms/MuonSelectionAlg.h> +#include <MuonAnalysisAlgorithms/MuonTriggerEfficiencyScaleFactorAlg.h> + +DECLARE_ALGORITHM_FACTORY (CP::MuonCalibrationAndSmearingAlg) +DECLARE_ALGORITHM_FACTORY (CP::MuonIsolationAlg) +DECLARE_ALGORITHM_FACTORY (CP::MuonEfficiencyScaleFactorAlg) +DECLARE_ALGORITHM_FACTORY (CP::MuonSelectionAlgV2) +DECLARE_ALGORITHM_FACTORY (CP::MuonTriggerEfficiencyScaleFactorAlg) + +DECLARE_FACTORY_ENTRIES(MuonAnalysisAlgorithms) { + DECLARE_ALGORITHM (CP::MuonCalibrationAndSmearingAlg) + DECLARE_ALGORITHM (CP::MuonIsolationAlg) + DECLARE_ALGORITHM (CP::MuonEfficiencyScaleFactorAlg) + DECLARE_ALGORITHM (CP::MuonSelectionAlgV2) + DECLARE_ALGORITHM (CP::MuonTriggerEfficiencyScaleFactorAlg) +} diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/src/components/MuonAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/src/components/MuonAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..309e5caa4afeb84c25c870d33e02edd174549f8f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/src/components/MuonAnalysisAlgorithms_load.cxx @@ -0,0 +1,5 @@ +// AsgExampleTools_load.cxx + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(MuonAnalysisAlgorithms) diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/CMakeLists.txt b/PhysicsAnalysis/Algorithms/SelectionHelpers/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b7655fb9e8cffb998a5b7966f175fa7eb8b9981 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +atlas_subdir( SelectionHelpers ) + +atlas_depends_on_subdirs( + PUBLIC + Control/AthContainers + Control/AthToolSupport/AsgTools + Event/xAOD/xAODBase + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PRIVATE + Control/AthToolSupport/AsgTesting + Event/xAOD/xAODJet + PhysicsAnalysis/AnalysisCommon/PATCore + PhysicsAnalysis/AnalysisCommon/PATInterfaces ) + +atlas_add_library( SelectionHelpersLib + SelectionHelpers/*.h SelectionHelpers/*.icc Root/*.cxx + PUBLIC_HEADERS SelectionHelpers + LINK_LIBRARIES AthContainers AsgTools xAODBase AnaAlgorithmLib + PRIVATE_LINK_LIBRARIES PATCoreLib PATInterfaces ) + +atlas_add_dictionary( SelectionHelpersDict + SelectionHelpers/SelectionHelpersDict.h + SelectionHelpers/selection.xml + LINK_LIBRARIES SelectionHelpersLib ) + +find_package( GTest ) + +atlas_add_test( gt_ISelectionAccessor + SOURCES test/gt_ISelectionAccessor.cxx + INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} + LINK_LIBRARIES ${GTEST_LIBRARIES} AsgTestingLib SelectionHelpersLib xAODJet ) diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/ISelectionAccessor.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/ISelectionAccessor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3c2ecb7743795111968eef1b2b09428a45d6407 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/ISelectionAccessor.cxx @@ -0,0 +1,140 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/ISelectionAccessor.h> + +#include <AsgTools/StatusCode.h> +#include <SelectionHelpers/SelectionAccessorBits.h> +#include <SelectionHelpers/SelectionAccessorChar.h> +#include <SelectionHelpers/SelectionAccessorInvert.h> +#include <SelectionHelpers/SelectionAccessorList.h> +#include <SelectionHelpers/SelectionAccessorNull.h> +#include <SelectionHelpers/SelectionExprParser.h> +#include <exception> +#include <unordered_map> + +// +// method implementations +// + +namespace CP +{ + namespace + { + std::vector<std::string> + splitString (const std::string& input, const std::string& separator) + { + std::vector<std::string> result; + std::string::size_type start = 0, split = 0; + while ((split = input.find (separator, start)) != std::string::npos) + { + result.emplace_back (input.substr (start, split - start)); + start = split + separator.size(); + } + result.emplace_back (input.substr (start)); + return result; + } + + } + + StatusCode + makeSelectionAccessor(const std::string& expr, + std::unique_ptr<ISelectionAccessor>& accessor, + bool defaultToChar) + { + using namespace msgSelectionHelpers; + + if (expr.empty()) + { + accessor = std::make_unique<SelectionAccessorNull> (true); + return StatusCode::SUCCESS; + } + + try { + SelectionExprParser parser(expr, defaultToChar); + ANA_CHECK(parser.build(accessor)); + } catch (const std::exception& e) { + ANA_MSG_FATAL("Failure to parse expression: '" << expr << "': " << e.what()); + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } + + + StatusCode + makeSelectionAccessorVar (const std::string& name, + std::unique_ptr<ISelectionAccessor>& accessor, + bool defaultToChar) + { + using namespace msgSelectionHelpers; + + std::string var; + bool asChar = false; + bool asBits = false; + bool invert = false; + + for (const std::string& option : splitString (name, ",")) + { + if (var.empty()) + { + // this is a bit of a hack, it will pick up the first + // component as the decoration name + var = option; + } else if (option == "as_char") + { + // using ",as_char" as a postfix to indicate char decorations + // (and ",as_bits" as a postfix to indicate bitset + // decorations). I chose that suffix as it should make it + // easier to read in configuration files and allows for future + // extensions if needed. + asChar = true; + } else if (option == "as_bits") + { + asBits = true; + } else if (option == "invert") + { + invert = true; + } else + { + ANA_MSG_ERROR ("invalid option " << option << "for selection decoration"); + return StatusCode::FAILURE; + } + } + + if (asChar && asBits) + { + ANA_MSG_ERROR ("can't specify both 'as_bits' and 'as_char' for the same selection decoration, pick one!!!"); + return StatusCode::FAILURE; + } + + if (!asChar && !asBits) + { + if (defaultToChar) + asChar = true; + else + asBits = true; + } + + if (asChar) + accessor = std::make_unique<SelectionAccessorChar> (var); + else + accessor = std::make_unique<SelectionAccessorBits> (var); + + if (invert) + { + accessor = std::make_unique<SelectionAccessorInvert> + (std::move (accessor)); + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/OutOfValidityEventHelper.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/OutOfValidityEventHelper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5eaa8d02501ee2db70daf6547c73d242fb604201 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/OutOfValidityEventHelper.cxx @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/OutOfValidityEventHelper.h> + +#include <AsgTools/MessageCheck.h> +#include <AsgTools/StatusCode.h> +#include <PATInterfaces/CorrectionCode.h> + +// +// method implementations +// + +namespace CP +{ + ::StatusCode OutOfValidityEventHelper :: + initialize () + { + m_isInitialized = true; + return StatusCode::SUCCESS; + } + + + ::StatusCode OutOfValidityEventHelper :: + check (const CP::CorrectionCode& code, + const char *context) const + { + assert (m_isInitialized); + + switch (code) + { + case CP::CorrectionCode::Ok: + return StatusCode::SUCCESS; + case CP::CorrectionCode::Error: + return StatusCode::FAILURE; + case CP::CorrectionCode::OutOfValidityRange: + switch (OutOfValidityAction (m_action)) + { + case OutOfValidityAction::ABORT: + ANA_MSG_ERROR ("encountered OutOfValidity: " << context); + return StatusCode::FAILURE; + case OutOfValidityAction::WARNING: + ANA_MSG_WARNING ("encountered OutOfValidity: " << context); + return StatusCode::SUCCESS; + case OutOfValidityAction::SILENT: + return StatusCode::SUCCESS; + } + } + ANA_MSG_ERROR (__FILE__ << ":" << __LINE__ << ": invalid enum value encountered " << code << " " << int (m_action)); + return StatusCode::FAILURE; + } + + + + MsgStream& OutOfValidityEventHelper :: + msg (MSG::Level lvl) const + { + assert (m_msg != nullptr); + *m_msg << lvl; + return *m_msg; + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/OutOfValidityHelper.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/OutOfValidityHelper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3069eb56eb09b4f6699369da3b29ef55f6a0de98 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/OutOfValidityHelper.cxx @@ -0,0 +1,78 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/OutOfValidityHelper.h> + +#include <AsgTools/MessageCheck.h> +#include <AsgTools/StatusCode.h> +#include <PATInterfaces/CorrectionCode.h> + +// +// method implementations +// + +namespace CP +{ + ::StatusCode OutOfValidityHelper :: + initialize () + { + if (!m_decorationName.empty()) + { + ANA_CHECK (makeSelectionAccessor (m_decorationName, m_accessor)); + } + + m_isInitialized = true; + return StatusCode::SUCCESS; + } + + + ::StatusCode OutOfValidityHelper :: + check (xAOD::IParticle& particle, + const CP::CorrectionCode& code, + const char *context) const + { + assert (m_isInitialized); + + switch (code) + { + case CP::CorrectionCode::Ok: + if (m_accessor) m_accessor->setBool (particle, true); + return StatusCode::SUCCESS; + case CP::CorrectionCode::Error: + return StatusCode::FAILURE; + case CP::CorrectionCode::OutOfValidityRange: + if (m_accessor) m_accessor->setBool (particle, false); + switch (OutOfValidityAction (m_action)) + { + case OutOfValidityAction::ABORT: + ANA_MSG_ERROR ("encountered OutOfValidity: " << context); + return StatusCode::FAILURE; + case OutOfValidityAction::WARNING: + ANA_MSG_WARNING ("encountered OutOfValidity: " << context); + return StatusCode::SUCCESS; + case OutOfValidityAction::SILENT: + return StatusCode::SUCCESS; + } + } + ANA_MSG_ERROR (__FILE__ << ":" << __LINE__ << ": invalid enum value encountered " << code << " " << int (m_action)); + return StatusCode::FAILURE; + } + + + + MsgStream& OutOfValidityHelper :: + msg (MSG::Level lvl) const + { + assert (m_msg != nullptr); + *m_msg << lvl; + return *m_msg; + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorBits.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorBits.cxx new file mode 100644 index 0000000000000000000000000000000000000000..56edd0aafa4c5c20fdf254e4fc09cfa5758abe9a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorBits.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/SelectionAccessorBits.h> + +// +// method implementations +// + +namespace CP +{ + SelectionAccessorBits :: + SelectionAccessorBits (const std::string& name) + : m_accessor (name), m_constAccessor (name), m_label(name) + {} + + + + SelectionType SelectionAccessorBits :: + getBits (const SG::AuxElement& element) const + { + return m_constAccessor (element); + } + + + + void SelectionAccessorBits :: + setBits (SG::AuxElement& element, + SelectionType selection) const + { + m_accessor (element) = selection; + } + + + + bool SelectionAccessorBits :: + getBool (const SG::AuxElement& element) const + { + return m_constAccessor (element) == selectionAccept(); + } + + + + void SelectionAccessorBits :: + setBool (SG::AuxElement& element, + bool selection) const + { + if (selection) + m_accessor (element) = selectionAccept(); + else + m_accessor (element) = selectionAccept() ^ 0x1; + } + + + + std::string SelectionAccessorBits :: + label () const + { + return m_label; + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorChar.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorChar.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c6a45b09a5199736eaebbac920b999cb2301aab1 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorChar.cxx @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/SelectionAccessorChar.h> + +// +// method implementations +// + +namespace CP +{ + SelectionAccessorChar :: + SelectionAccessorChar (const std::string& name) + : m_accessor (name), m_constAccessor (name), m_label(name) + {} + + + + SelectionType SelectionAccessorChar :: + getBits (const SG::AuxElement& element) const + { + if (m_constAccessor (element)) + return selectionAccept(); + else + return 0; + } + + + + void SelectionAccessorChar :: + setBits (SG::AuxElement& element, + SelectionType selection) const + { + if (selection == selectionAccept()) + m_accessor (element) = 1; + else + m_accessor (element) = 0; + } + + + + bool SelectionAccessorChar :: + getBool (const SG::AuxElement& element) const + { + return m_constAccessor (element); + } + + + + void SelectionAccessorChar :: + setBool (SG::AuxElement& element, + bool selection) const + { + m_accessor (element) = selection; + } + + + + std::string SelectionAccessorChar :: + label () const + { + return m_label; + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprBase.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..441396cf53c85aea2a2ec807c50de7ada269622b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprBase.cxx @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "SelectionHelpers/SelectionAccessorExprBase.h" + +namespace CP { + +SelectionType SelectionAccessorExprBase::getBits( + const SG::AuxElement& element) const { + return getBool(element) ? selectionAccept() : selectionReject(); +} + +void SelectionAccessorExprBase::setBool(SG::AuxElement& /*element*/, + bool /*value*/) const { + throw std::runtime_error( + "setting not supported for CP::SelectionAccessorExprBase"); +} + +void SelectionAccessorExprBase::setBits(SG::AuxElement& /*element*/, + SelectionType /*selection*/) const { + throw std::runtime_error( + "setting not supported for CP::SelectionAccessorExprBase"); +} + +} // namespace CP + + diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprNot.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprNot.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2829f4f6612470c8fcd3e1daf606677659f537b6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprNot.cxx @@ -0,0 +1,21 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "SelectionHelpers/SelectionAccessorExprNot.h" + +namespace CP { + +SelectionAccessorExprNot::SelectionAccessorExprNot( + std::unique_ptr<ISelectionAccessor> child) + : m_child(std::move(child)) {} + +bool SelectionAccessorExprNot::getBool(const SG::AuxElement& element) const { + return !m_child->getBool(element); +} + +std::string SelectionAccessorExprNot::label() const { + return "!" + m_child->label(); +} + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprOr.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprOr.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b91abe4978f0673b53cef221bf213dfe708341b5 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorExprOr.cxx @@ -0,0 +1,23 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "SelectionHelpers/SelectionAccessorExprOr.h" + +namespace CP { + +SelectionAccessorExprOr::SelectionAccessorExprOr( + std::unique_ptr<ISelectionAccessor> left, + std::unique_ptr<ISelectionAccessor> right) + : m_left(std::move(left)), m_right(std::move(right)) {} + +bool SelectionAccessorExprOr::getBool(const SG::AuxElement& element) const { + return m_left->getBool(element) || m_right->getBool(element); +} + +std::string SelectionAccessorExprOr::label() const { + return "( " + m_left->label() + " || " + m_right->label() + " )"; +} + +} // namespace CP + diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorInvert.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorInvert.cxx new file mode 100644 index 0000000000000000000000000000000000000000..071088bbfd3f6bb693473a5bf32a39fce4c00797 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorInvert.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/SelectionAccessorInvert.h> + +// +// method implementations +// + +namespace CP +{ + SelectionAccessorInvert :: + SelectionAccessorInvert (std::unique_ptr<ISelectionAccessor> val_base) + : m_base (std::move (val_base)) + {} + + + + SelectionType SelectionAccessorInvert :: + getBits (const SG::AuxElement& element) const + { + if (m_base->getBool (element) == false) + return selectionAccept(); + else + return 0; + } + + + + void SelectionAccessorInvert :: + setBits (SG::AuxElement& element, + SelectionType selection) const + { + m_base->setBool (element, selection != selectionAccept()); + } + + + + bool SelectionAccessorInvert :: + getBool (const SG::AuxElement& element) const + { + return m_base->getBool (element) == false; + } + + + + void SelectionAccessorInvert :: + setBool (SG::AuxElement& element, + bool selection) const + { + m_base->setBool (element, !selection); + } + + + + std::string SelectionAccessorInvert :: + label () const + { + return "not " + m_base->label(); + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorList.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorList.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3cca05d9ec56bf8ead00b6d8f97ec1b7a8dfa277 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorList.cxx @@ -0,0 +1,106 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/SelectionAccessorList.h> + +// +// method implementations +// + +namespace CP +{ + SelectionAccessorList :: + SelectionAccessorList (std::vector<std::unique_ptr<ISelectionAccessor> > val_list) + : m_list (std::move (val_list)) + { + for (const std::unique_ptr<ISelectionAccessor> &acc : m_list) + { + if (!m_label.empty()) + m_label.append(" && "); + + m_label.append(acc->label()); + } + + m_label = "( " + m_label + " )"; + } + + + + SelectionType SelectionAccessorList :: + getBits (const SG::AuxElement& element) const + { + // total number of bits in SelectionType + constexpr size_t SelectionTotalBits = 8 * sizeof (SelectionType); + + // if we have more cuts than bits, just return true/false + if (m_list.size() > SelectionTotalBits) + { + if (getBool (element)) + return selectionAccept(); + else + return 0; + } + + SelectionType result = selectionAccept(); + for (std::size_t iter = 0; iter != m_list.size(); ++ iter) + { + if (m_list[iter]->getBool (element) == false) + { + result = result & ~(SelectionType (1) << iter); + } + } + return result; + } + + + + void SelectionAccessorList :: + setBits (SG::AuxElement& /*element*/, + SelectionType /*selection*/) const + { + // technically we could support setting by setting all the + // components, but I can't think of a situation in which that + // would be a good idea + throw std::runtime_error ("setting not supported for CP::SelectionAccessorList"); + } + + + + bool SelectionAccessorList :: + getBool (const SG::AuxElement& element) const + { + for (auto& accessor : m_list) + { + if (!accessor->getBool (element)) + return false; + } + return true; + } + + + + void SelectionAccessorList :: + setBool (SG::AuxElement& /*element*/, + bool /*selection*/) const + { + // technically we could support setting by setting all the + // components, but I can't think of a situation in which that + // would be a good idea + throw std::runtime_error ("setting not supported for CP::SelectionAccessorList"); + } + + + std::string SelectionAccessorList :: + label () const + { + return m_label; + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorNull.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorNull.cxx new file mode 100644 index 0000000000000000000000000000000000000000..642d474b0ff94bbf9878643680d8591fdc882dc1 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionAccessorNull.cxx @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/SelectionAccessorNull.h> + +// +// method implementations +// + +namespace CP +{ + SelectionAccessorNull :: + SelectionAccessorNull (bool value) : m_value(value) + {} + + + + SelectionType SelectionAccessorNull :: + getBits (const SG::AuxElement& /*element*/) const + { + return m_value ? selectionAccept() : selectionReject(); + } + + + + void SelectionAccessorNull :: + setBits (SG::AuxElement& /*element*/, + SelectionType /*selection*/) const + { + // ok, let's not do anything here, making this an easy way to + // ignore selection decorations an algorithm calculates. however, + // the implication is that you can simply forget to set the + // decoration property and not get an error + } + + + + bool SelectionAccessorNull :: + getBool (const SG::AuxElement& /*element*/) const + { + return m_value; + } + + + + void SelectionAccessorNull :: + setBool (SG::AuxElement& /*element*/, + bool /*selection*/) const + { + // ok, let's not do anything here, making this an easy way to + // ignore selection decorations an algorithm calculates. however, + // the implication is that you can simply forget to set the + // decoration property and not get an error + } + + + std::string SelectionAccessorNull :: + label () const + { + return m_value ? "true" : "false"; + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionExprParser.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionExprParser.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c15925fae605b70880c247e1c3d124fd8ef040d2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionExprParser.cxx @@ -0,0 +1,171 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "SelectionHelpers/SelectionExprParser.h" +#include "SelectionHelpers/SelectionAccessorExprNot.h" +#include "SelectionHelpers/SelectionAccessorExprOr.h" +#include "SelectionHelpers/SelectionAccessorList.h" +#include "SelectionHelpers/SelectionAccessorNull.h" + +#include <iostream> +#include <regex> +#include <string> + +using CP::DetailSelectionExprParser::Lexer; + +namespace CP { +using namespace msgSelectionHelpers; + +namespace DetailSelectionExprParser { +bool Separator::operator()(std::string::const_iterator& next, + const std::string::const_iterator& end, + std::string& tok) const { + if (next == end) { + return false; + } + + static const std::regex base_regex( + "^( ?((?:[^|&()! ]+)|(?:&&)|(?:!)|(?:\\()|(?:\\))|(?:\\|\\|))).*"); + std::smatch m; + + if (std::regex_match(next, end, m, base_regex)) { + tok = m[2].str(); + next += m[1].length(); + } else { + std::smatch m2; + static const std::regex space_re{"^ +$"}; + if (std::regex_match(next, end, m, space_re)) { + // only spaces left, we're done + return false; + } + throw std::runtime_error("Cannot tokenize: '" + std::string(next, end) + + "'"); + } + return true; +} + +Lexer::Lexer(const std::string& s) : m_string(s), m_tokenizer(s, {}) { + m_iterator = m_tokenizer.begin(); +} + +auto Lexer::nextSymbol() -> Symbol { + if (m_iterator == m_tokenizer.end()) { + return Symbol{END, ""}; + } + std::string t = *m_iterator; + Type type; + if (t == "&&") + type = AND; + else if (t == "||") + type = OR; + else if (t == "(") + type = LEFT; + else if (t == ")") + type = RIGHT; + else if (t == "!") + type = NOT; + else if (t == "true") + type = TRUE_LITERAL; + else if (t == "false") + type = FALSE_LITERAL; + else { + // check if variable is valid + const std::regex base_regex("^([^|()&! ]*)$"); + std::smatch base_match; + + if (!std::regex_match(t, base_match, base_regex)) { + throw std::runtime_error("illegal variable encountered"); + } else { + type = VAR; + } + } + + ++m_iterator; + return Symbol{type, t}; +} + +} // namespace DetailSelectionExprParser + +SelectionExprParser::SelectionExprParser(Lexer lexer, bool defaultToChar) + : m_lexer(std::move(lexer)), m_defaultToChar(defaultToChar) {} + +StatusCode SelectionExprParser::build( + std::unique_ptr<ISelectionAccessor>& accessor) { + std::unique_ptr<ISelectionAccessor> root{nullptr}; + ANA_CHECK(expression(root)); + + if (m_symbol.type != Lexer::END) { + throw std::runtime_error( + "Not all symbols in expression were consumed. Check your expression."); + } + + accessor = std::move(root); + return StatusCode::SUCCESS; +} + +StatusCode SelectionExprParser::expression( + std::unique_ptr<ISelectionAccessor>& root) { + ANA_CHECK(term(root)); + while (m_symbol.type == Lexer::OR) { + std::unique_ptr<ISelectionAccessor> left = std::move(root); + ANA_CHECK(term(root)); + std::unique_ptr<ISelectionAccessor> right = std::move(root); + root = std::make_unique<SelectionAccessorExprOr>(std::move(left), + std::move(right)); + } + return StatusCode::SUCCESS; +} + +StatusCode SelectionExprParser::term( + std::unique_ptr<ISelectionAccessor>& root) { + ANA_CHECK(factor(root)); + std::vector<std::unique_ptr<ISelectionAccessor>> factors; + factors.push_back(std::move(root)); + + while (m_symbol.type == Lexer::AND) { + ANA_CHECK(factor(root)); + factors.push_back(std::move(root)); + } + + if (factors.size() == 1) { + root = std::move(factors[0]); + } else { + root = std::make_unique<SelectionAccessorList>(std::move(factors)); + } + return StatusCode::SUCCESS; +} + +StatusCode SelectionExprParser::factor( + std::unique_ptr<ISelectionAccessor>& root) { + m_symbol = m_lexer.nextSymbol(); + if (m_symbol.type == Lexer::TRUE_LITERAL) { + root = std::make_unique<SelectionAccessorNull>(true); + m_symbol = m_lexer.nextSymbol(); + } else if (m_symbol.type == Lexer::FALSE_LITERAL) { + root = std::make_unique<SelectionAccessorNull>(false); + m_symbol = m_lexer.nextSymbol(); + } else if (m_symbol.type == Lexer::NOT) { + ANA_CHECK(factor(root)); + std::unique_ptr<ISelectionAccessor> notEx = + std::make_unique<SelectionAccessorExprNot>(std::move(root)); + root = std::move(notEx); + } else if (m_symbol.type == Lexer::LEFT) { + ANA_CHECK(expression(root)); + if (m_symbol.type != Lexer::RIGHT) { + throw std::runtime_error( + "Missing closing bracket, check your expression."); + } + m_symbol = m_lexer.nextSymbol(); + + } else if (m_symbol.type == Lexer::VAR) { + ANA_CHECK(makeSelectionAccessorVar(m_symbol.value, root, m_defaultToChar)); + m_symbol = m_lexer.nextSymbol(); + } else { + throw std::runtime_error("Malformed expression."); + } + + return StatusCode::SUCCESS; +} + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionHelpers.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionHelpers.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bba7731d9650759ad487e063eaa22b53564dd17b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionHelpers.cxx @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/SelectionHelpers.h> + +#include <PATCore/TAccept.h> + +// +// method implementations +// + +namespace CP +{ + SelectionType selectionFromBool (bool accept) + { + if (accept) + return selectionAccept(); + else + return selectionReject(); + } + + + + SelectionType selectionFromAccept (const Root::TAccept& accept) + { + return ~SelectionType (accept.getCutResultInvertedBitSet().to_ulong()); + } + + + + ANA_MSG_SOURCE (msgSelectionHelpers, "selectionHelpers") +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionReadHandle.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionReadHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..80a95355b81966379d46615809db102d2ab4b282 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionReadHandle.cxx @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/SelectionReadHandle.h> + +#include <AsgTools/MessageCheck.h> +#include <AsgTools/StatusCode.h> + +// +// method implementations +// + +namespace CP +{ + MsgStream& SelectionReadHandle :: + msg () const + { + assert (m_msg != nullptr); + return *m_msg; + } + + + + MsgStream& SelectionReadHandle :: + msg (MSG::Level lvl) const + { + assert (m_msg != nullptr); + *m_msg << lvl; + return *m_msg; + } + + + + bool SelectionReadHandle :: + empty () const noexcept + { + return m_selection.empty(); + } + + + + SelectionReadHandle :: + operator bool () const noexcept + { + return !m_selection.empty(); + } + + + + StatusCode SelectionReadHandle :: + initialize () + { + ANA_CHECK (makeSelectionAccessor (m_selection, m_accessor)); + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/ISelectionAccessor.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/ISelectionAccessor.h new file mode 100644 index 0000000000000000000000000000000000000000..a41e66be72f021702a3813f757198e23bea16abd --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/ISelectionAccessor.h @@ -0,0 +1,100 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__I_SELECTION_ACCESSOR_H +#define SELECTION_HELPERS__I_SELECTION_ACCESSOR_H + +#include <AthContainers/AuxElement.h> +#include <SelectionHelpers/SelectionHelpers.h> +#include <memory> + +class StatusCode; + +namespace CP +{ + /// \brief a specialized accessor to read/write a selection + /// decoration from/to an xAOD object + /// + /// We have (at least) two conventions on how selection decorations + /// can look like, the one from the CP algorithms/TAccept and the + /// other from the derivation framework/overlap removal tool. This + /// accessor is a base class with specific implementations for + /// different conventions. + /// + /// The actual interface has separate accessor functions for + /// accessing as bitsets or as booleans. In part that is to avoid a + /// lot of unnecessary back and forth conversions, but mostly it is + /// to give us some more flexibility if we need to extend this in + /// the future. + + class ISelectionAccessor + { + // no slicing + ISelectionAccessor& operator = (const ISelectionAccessor&) = delete; + + /// \brief standard (virtual) destructor + public: + virtual ~ISelectionAccessor () noexcept = default; + + /// \brief get the selection decoration + public: + virtual SelectionType + getBits (const SG::AuxElement& element) const = 0; + + /// \brief set the selection decoration + public: + virtual void setBits (SG::AuxElement& element, + SelectionType selection) const = 0; + + /// \brief get the selection decoration + public: + virtual bool getBool (const SG::AuxElement& element) const = 0; + + /// \brief set the selection decoration + public: + virtual void setBool (SG::AuxElement& element, + bool selection) const = 0; + + /// \brief get the label of the accessor + public: + virtual std::string label () const = 0; + }; + + + /// \brief make the \ref ISelectionAccessor for the given name + /// + /// This will invoke @c SelectionExprParser to build a @c ISelectionAccessor + /// that corresponds to a given expression. + /// @note Passing in a simple selection name will createa plain selection accessor that + /// only reads that single name. + /// @note Passing in an expression which only contains names and && will produce an + /// instance of @c SelectionAccessorList, which has special semantics and allows + /// retrievel of AND'ed accessors via a bit sequence. + /// @note Allowed operators are &&, || and !, grouping with () is possible. + /// + /// @param [in] expr The expression to parse. + /// @param [out] accessor The created accessor will be owned by this unique pointer. + /// @param [in] defaultToChar Whether to treat decorations as char by default + StatusCode + makeSelectionAccessor (const std::string& expr, + std::unique_ptr<ISelectionAccessor>& accessor, + bool defaultToChar = false); + + /// @brief Produces a simple @c ISelectionAccessor accessing the given decoration + /// @note Through annotations like ",as_char" or ",as_bits" at the end of a name, + /// different decoding strategies can be selected. These need to match the + /// decoration type. + /// @param [in] name The name of the decoration to create an accessor for. + /// @param [out] accessor The created accessor will be owned by this unique pointer. + /// @param [in] defaultToChar Whether to treat decorations as char by default + StatusCode + makeSelectionAccessorVar (const std::string& name, + std::unique_ptr<ISelectionAccessor>& accessor, + bool defaultToChar = false); +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/OutOfValidityEventHelper.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/OutOfValidityEventHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..4fcc1f49c8fc29fadeba584edfe4edb9ef19f7ac --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/OutOfValidityEventHelper.h @@ -0,0 +1,91 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__OUT_OF_VALIDITY_EVENT_HELPER_H +#define SELECTION_HELPERS__OUT_OF_VALIDITY_EVENT_HELPER_H + +#include <AsgTools/MsgStream.h> +#include <AthContainers/AuxElement.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <xAODBase/IParticle.h> +#include <memory> + +class StatusCode; + +namespace CP +{ + class CorrectionCode; + + + + /// \brief a helper to translate a \ref CP::CorrectionCode into a + /// \ref ::StatusCode + /// + /// The prolem is OutOfValidityRange which does not have an + /// equivalent in StatusCode and which does not have a unique, + /// correct handling in all situations. This helper allows to + /// configure a variety of behaviors via properties. + + class OutOfValidityEventHelper final + { + /// \brief standard constructor + public: + template<typename T> + OutOfValidityEventHelper (T *owner, const std::string& propertyName = "outOfValidity", + const std::string& propertyDescription = "how to handle out of validity results"); + + + /// \brief standard initialize + public: + ::StatusCode initialize (); + + /// \brief check the correction code and do the proper thing + public: + ::StatusCode check (const CP::CorrectionCode& code, + const char *context) const; + + + /// \brief the action to take + private: + unsigned m_action {unsigned (OutOfValidityAction::ABORT)}; + + /// \brief the message stream we use + private: + MsgStream *m_msg {nullptr}; + + /// \brief whether we have been initialized + /// + /// This is only used in debug mode to indicate a programming + /// fault. Otherwise it is too easy for users to forget to + /// initialize this object. + private: + bool m_isInitialized = false; + + /// \brief helper for message macros + private: + MsgStream& msg( const MSG::Level lvl ) const; + }; + + + + template<typename T> OutOfValidityEventHelper :: + OutOfValidityEventHelper (T *owner, const std::string& propertyName, + const std::string& propertyDescription) + : m_msg (&owner->msg()) + { + owner->declareProperty (propertyName, m_action, + propertyDescription); + } +} + +/// \brief a helper check macro to work with \ref OutOfValidityEventHelper +#define ANA_CHECK_CORRECTION_EVENT(helper,expr) \ + { if ((helper).check ((expr), #expr).isFailure()) \ + return StatusCode::FAILURE; } + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/OutOfValidityHelper.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/OutOfValidityHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..97787061e61164fa61c67e6f54e9b92712b00645 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/OutOfValidityHelper.h @@ -0,0 +1,138 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__OUT_OF_VALIDITY_HELPER_H +#define SELECTION_HELPERS__OUT_OF_VALIDITY_HELPER_H + +#include <AsgTools/MsgStream.h> +#include <AthContainers/AuxElement.h> +#include <SelectionHelpers/ISelectionAccessor.h> +#include <xAODBase/IParticle.h> +#include <memory> + +class StatusCode; + +namespace CP +{ + class CorrectionCode; + + + /// \brief the action to perform on encountering an + /// OutOfValidityRange in \ref OutOfValidityHelper + /// + /// This is in addition to possibly setting a selection decoration + /// (if that has been configured. + /// + /// This is not a member enum of \ref OutOfValidityHelper to void + /// problems with member enums in dictionary generation, etc. + + enum class OutOfValidityAction + { + /// \brief print an error message and return a failure status code + /// (triggering an abort) + /// + /// This is currently the default, as it forces users to think + /// about what they want to do with OutOfValidityRange results. + /// That is fairly safe, as most tools don't actually report + /// OutOfValidityRange and we don't want to add a lot of + /// meaningless selection decorations to each object. + ABORT, + + /// \brief print a warning message and return a success status + /// code. + /// + /// This should only be used if OutOfValidity is a *rare* event, + /// or otherwise it will completely clobber the log file. + WARNING, + + /// \brief don't print anything and return success + /// + /// This should (normally) be combined with a selection decoration + /// that records OutOfValidity results, allowing to retrieve that + /// information subsequently. + SILENT + }; + + + + /// \brief a helper to translate a \ref CP::CorrectionCode into a + /// \ref ::StatusCode + /// + /// The prolem is OutOfValidityRange which does not have an + /// equivalent in StatusCode and which does not have a unique, + /// correct handling in all situations. This helper allows to + /// configure a variety of behaviors via properties. + + class OutOfValidityHelper final + { + /// \brief standard constructor + public: + template<typename T> + OutOfValidityHelper (T *owner, const std::string& propertyName = "outOfValidity", + const std::string& propertyDescription = "how to handle out of validity results"); + + + /// \brief standard initialize + public: + ::StatusCode initialize (); + + /// \brief check the correction code and do the proper thing + public: + ::StatusCode check (xAOD::IParticle& particle, + const CP::CorrectionCode& code, + const char *context) const; + + + /// \brief the action to take + private: + unsigned m_action {unsigned (OutOfValidityAction::ABORT)}; + + /// \brief the message stream we use + private: + MsgStream *m_msg {nullptr}; + + /// \brief the accessor if we apply one + private: + std::unique_ptr<ISelectionAccessor> m_accessor; + + /// \brief the decoration name we use (if we have one) + private: + std::string m_decorationName; + + /// \brief whether we have been initialized + /// + /// This is only used in debug mode to indicate a programming + /// fault. Otherwise it is too easy for users to forget to + /// initialize this object. + private: + bool m_isInitialized = false; + + /// \brief helper for message macros + private: + MsgStream& msg( const MSG::Level lvl ) const; + }; + + + + template<typename T> OutOfValidityHelper :: + OutOfValidityHelper (T *owner, const std::string& propertyName, + const std::string& propertyDescription) + : m_msg (&owner->msg()) + { + owner->declareProperty (propertyName, m_action, + propertyDescription); + owner->declareProperty (propertyName + "Deco", m_decorationName, + "decoration to set alongside action described by " + propertyName); + } +} + +/// \brief a helper check macro to work with \ref OutOfValidityHelper +#define ANA_CHECK_CORRECTION(helper,object,expr) \ + { if ((helper).check ((object), (expr), #expr).isFailure()) \ + return StatusCode::FAILURE; } + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorBits.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorBits.h new file mode 100644 index 0000000000000000000000000000000000000000..5c5d1df875225a8a4864c9fdf98e04d961d96d3d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorBits.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__SELECTION_ACCESSOR_BITS_H +#define SELECTION_HELPERS__SELECTION_ACCESSOR_BITS_H + +#include <SelectionHelpers/ISelectionAccessor.h> + +namespace CP +{ + /// \brief the \ref SelectionAccesor for standard CP algorithm + /// selection decorations encoded as bits + + class SelectionAccessorBits final : public ISelectionAccessor + { + // + // public interface + // + + public: + SelectionAccessorBits (const std::string& name); + + public: + virtual SelectionType + getBits (const SG::AuxElement& element) const override; + + public: + virtual void setBits (SG::AuxElement& element, + SelectionType selection) const override; + + public: + virtual bool + getBool (const SG::AuxElement& element) const override; + + public: + virtual void setBool (SG::AuxElement& element, + bool selection) const override; + + public: + virtual std::string label () const override; + + + // + // private interface + // + + /// \brief the underlying accessor + private: + SG::AuxElement::Accessor<SelectionType> m_accessor; + + /// \brief the underlying accessor + private: + SG::AuxElement::ConstAccessor<SelectionType> m_constAccessor; + + /// \brief the label of the accessor + private: + std::string m_label; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorChar.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorChar.h new file mode 100644 index 0000000000000000000000000000000000000000..8d9fe03c329b4c6224df8acdf93527213ea56945 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorChar.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__SELECTION_ACCESSOR_OR_H +#define SELECTION_HELPERS__SELECTION_ACCESSOR_OR_H + +#include <SelectionHelpers/ISelectionAccessor.h> + +namespace CP +{ + /// \brief the \ref SelectionAccesor for OR tool selection + /// decorations + + class SelectionAccessorChar final : public ISelectionAccessor + { + // + // public interface + // + + public: + SelectionAccessorChar (const std::string& name); + + public: + virtual SelectionType + getBits (const SG::AuxElement& element) const override; + + public: + virtual void setBits (SG::AuxElement& element, + SelectionType selection) const override; + + public: + virtual bool + getBool (const SG::AuxElement& element) const override; + + public: + virtual void setBool (SG::AuxElement& element, + bool selection) const override; + + public: + virtual std::string label () const override; + + + // + // private interface + // + + /// \brief th underlying accessor + private: + SG::AuxElement::Accessor<char> m_accessor; + + /// \brief th underlying accessor + private: + SG::AuxElement::ConstAccessor<char> m_constAccessor; + + /// \brief the label of the accessor + private: + std::string m_label; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprBase.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprBase.h new file mode 100644 index 0000000000000000000000000000000000000000..46cfcc31f479fc077bda44c0cf1dcf6470be0b13 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprBase.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SELECTION_HELPERS__SELECTION_ACCESSOR_EXPR_BASE_H +#define SELECTION_HELPERS__SELECTION_ACCESSOR_EXPR_BASE_H + +#include "SelectionHelpers/ISelectionAccessor.h" + +namespace CP { + +/// @brief Serves as the base for a few logical expression classes. +class SelectionAccessorExprBase : public ISelectionAccessor { + // leave getBool pure virtual + // leave label pure virtual + + public: + virtual SelectionType getBits(const SG::AuxElement &element) const override; + + virtual void setBool(SG::AuxElement & /*element*/, + bool /*value*/) const override; + + virtual void setBits(SG::AuxElement & /*element*/, + SelectionType /*selection*/) const override; +}; + +} // namespace CP + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprNot.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprNot.h new file mode 100644 index 0000000000000000000000000000000000000000..b7464e16c6af53cddb6624daf119b101c0343884 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprNot.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SELECTION_HELPERS__SELECTION_ACCESSOR_EXPR_AND_H +#define SELECTION_HELPERS__SELECTION_ACCESSOR_EXPR_AND_H + +#include "SelectionHelpers/SelectionAccessorExprBase.h" + +#include <memory> + +namespace CP { + +/// @brief SelectionAccessor which implements a logical NOT +class SelectionAccessorExprNot : public SelectionAccessorExprBase { + public: + /// @param child The selection accessor that is to be negated + SelectionAccessorExprNot(std::unique_ptr<ISelectionAccessor> child); + + /// @param element AuxElement to evaluate the selection on + /// @return Result of the negated result of @c child + virtual bool getBool(const SG::AuxElement &element) const override; + + /// @return Returns a readable and parseable representation + virtual std::string label() const override; + + private: + std::unique_ptr<ISelectionAccessor> m_child; +}; + + +} // namespace CP + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprOr.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprOr.h new file mode 100644 index 0000000000000000000000000000000000000000..072ff29819f0fa40330ced18a483065f0d6a16cb --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorExprOr.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SELECTION_HELPERS__SELECTION_ACCESSOR_EXPR_OR_H +#define SELECTION_HELPERS__SELECTION_ACCESSOR_EXPR_OR_H + +#include "SelectionHelpers/SelectionAccessorExprBase.h" + +#include <memory> + +namespace CP { + +/// @brief Implements a SelectionAccessor that performs a binary logical OR +class SelectionAccessorExprOr : public SelectionAccessorExprBase { + public: + /// @param left Left argument to the OR expression + /// @param Right Right argument to the OR expression + SelectionAccessorExprOr(std::unique_ptr<ISelectionAccessor> left, + std::unique_ptr<ISelectionAccessor> right); + + /// @param element AuxElement to evaluate the selection on + /// @return The result of the expression `left OR right` + virtual bool getBool(const SG::AuxElement &element) const override; + + /// @return Returns a readable and parseable representation + virtual std::string label() const override; + + private: + std::unique_ptr<ISelectionAccessor> m_left; + std::unique_ptr<ISelectionAccessor> m_right; +}; + +} // namespace CP + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorInvert.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorInvert.h new file mode 100644 index 0000000000000000000000000000000000000000..abb9c2a09aaf5dce476f58379ce8ff82e34e3874 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorInvert.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__SELECTION_ACCESSOR_INVERT_H +#define SELECTION_HELPERS__SELECTION_ACCESSOR_INVERT_H + +#include <SelectionHelpers/ISelectionAccessor.h> + +#include <memory> + +namespace CP +{ + /// \brief the \ref SelectionAccesor for inverting a selection + /// decoration + + class SelectionAccessorInvert final : public ISelectionAccessor + { + // + // public interface + // + + public: + SelectionAccessorInvert (std::unique_ptr<ISelectionAccessor> val_base); + + public: + virtual SelectionType + getBits (const SG::AuxElement& element) const override; + + public: + virtual void setBits (SG::AuxElement& element, + SelectionType selection) const override; + + public: + virtual bool + getBool (const SG::AuxElement& element) const override; + + public: + virtual void setBool (SG::AuxElement& element, + bool selection) const override; + + public: + virtual std::string label () const override; + + + // + // private interface + // + + /// \brief the base selection accessors I invert + private: + std::unique_ptr<ISelectionAccessor> m_base; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorList.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorList.h new file mode 100644 index 0000000000000000000000000000000000000000..900fa820136a9b1dd61ce32a6dfc2c39e0b11fda --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorList.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__SELECTION_ACCESSOR_LIST_H +#define SELECTION_HELPERS__SELECTION_ACCESSOR_LIST_H + +#include <SelectionHelpers/ISelectionAccessor.h> + +#include <memory> +#include <vector> + +namespace CP +{ + /// \brief the \ref SelectionAccesor for list of selection + /// decorations + + class SelectionAccessorList final : public ISelectionAccessor + { + // + // public interface + // + + public: + SelectionAccessorList (std::vector<std::unique_ptr<ISelectionAccessor> > val_list); + + public: + virtual SelectionType + getBits (const SG::AuxElement& element) const override; + + public: + virtual void setBits (SG::AuxElement& element, + SelectionType selection) const override; + + public: + virtual bool + getBool (const SG::AuxElement& element) const override; + + public: + virtual void setBool (SG::AuxElement& element, + bool selection) const override; + + public: + virtual std::string label () const override; + + + // + // private interface + // + + /// \brief the list of selection accessors I rely on + private: + std::vector<std::unique_ptr<ISelectionAccessor> > m_list; + + /// \brief the label of the accessor + private: + std::string m_label; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorNull.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorNull.h new file mode 100644 index 0000000000000000000000000000000000000000..08fbe74e243aec05f535e5575ea4361155dfc2da --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionAccessorNull.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__SELECTION_ACCESSOR_NULL_H +#define SELECTION_HELPERS__SELECTION_ACCESSOR_NULL_H + +#include <SelectionHelpers/ISelectionAccessor.h> + +namespace CP +{ + /// \brief a \ref SelectionAccesor that can be used instead of a + /// nullptr + /// + /// This makes it easier to set up code that just uses an \ref + /// ISelectionAccessor to preselect its objects, and doesn't want a + /// special code path for the case of no preselections. + + class SelectionAccessorNull final : public ISelectionAccessor + { + // + // public interface + // + + public: + SelectionAccessorNull (bool value = true); + + public: + virtual SelectionType + getBits (const SG::AuxElement& element) const override; + + public: + virtual void setBits (SG::AuxElement& element, + SelectionType selection) const override; + + public: + virtual bool + getBool (const SG::AuxElement& element) const override; + + public: + virtual void setBool (SG::AuxElement& element, + bool selection) const override; + + public: + virtual std::string label () const override; + + + // + // private interface + // + private: + bool m_value; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionExprParser.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionExprParser.h new file mode 100644 index 0000000000000000000000000000000000000000..cd58408031a8dd7f8b00d1e686f607babeba7171 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionExprParser.h @@ -0,0 +1,112 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SELECTION_HELPERS__SELECTION_EXPR_PARSER_H +#define SELECTION_HELPERS__SELECTION_EXPR_PARSER_H + +#include <boost/tokenizer.hpp> +#include <functional> +#include <memory> +#include <string> + +#include "SelectionHelpers/ISelectionAccessor.h" +#include "SelectionHelpers/SelectionHelpers.h" + +namespace CP { + +// Private detail namespace. This is not strictly private to enable testing +namespace DetailSelectionExprParser { + +/// Separator to be used in a @c boost::tokenizer +class Separator { + public: + /// @brief Extracts the subsequent token from the input string iterator + bool operator()(std::string::const_iterator &next, + const std::string::const_iterator &end, + std::string &tok) const; + + /// @brief Optional state reset method, does nothing. + void reset() {} +}; + +// Typedef over boost's tokenizer using the above Separator +typedef boost::tokenizer<Separator> Tokenizer; + +/// Lexer which turns a token stream into a stream of unambigous symbols to be +/// used by a parser +class Lexer { + public: + /// @brief Constructor from a strig + Lexer(const std::string &s); + + /// Disable copying of this class + Lexer(const Lexer &) = delete; + /// Default move-constructor behaviour + Lexer(Lexer &&) = default; + + /// Enum over the possible symbols that can be extracted from the token + /// stream. + enum Type { + AND = 0, + OR, + LEFT, + RIGHT, + NOT, + TRUE_LITERAL, + FALSE_LITERAL, + VAR, + END + }; + + /// Struct grouping together the type and original string representation + /// of a symbol. + struct Symbol { + Type type; + std::string value; + }; + + /// Generate a new symbol from the token sequence + Symbol nextSymbol(); + + private: + std::string m_string; + Tokenizer m_tokenizer; + Tokenizer::iterator m_iterator; +}; +} // namespace DetailSelectionExprParser + +/// Public interface for the expression parsing facility. +class SelectionExprParser { + public: + /// Constructor for the parser which accepts a @c Lecer + /// @param lexer The lexer to use for parsing + /// @note @c Lexer can be auto-constructed from a string, so you can pass one directly. + /// @param defaultToChar Assume "as_char" as default encoding + SelectionExprParser(DetailSelectionExprParser::Lexer lexer, + bool defaultToChar = false); + + /// Triggers the actual parsing of the expression + /// @param [out] accessor Unique pointer the resulting accessor will be written to. + /// @return StatusCode noting whether the operation succeeded. + StatusCode build(std::unique_ptr<ISelectionAccessor> &accessor); + + private: + // Construct a binary OR + StatusCode expression(std::unique_ptr<ISelectionAccessor> &root); + // Construct an AND, attempts to group all ANDs it can see into a list + StatusCode term(std::unique_ptr<ISelectionAccessor> &root); + // Handle other constructs, potentially more ORs or ANDs. + StatusCode factor(std::unique_ptr<ISelectionAccessor> &root); + + // The lexer to generate symbols from. + DetailSelectionExprParser::Lexer m_lexer; + // The last extracted symbol + DetailSelectionExprParser::Lexer::Symbol m_symbol; + // Stores constructor parameter to be used in calls to makeSelectionAccessorVar. + bool m_defaultToChar; +}; + +} // namespace CP + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpers.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..c75f7ba99eed885ac220b2f78327ab0d5895f7d1 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpers.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__SELECTION_HELPERS_H +#define SELECTION_HELPERS__SELECTION_HELPERS_H + +#include <AsgTools/MessageCheck.h> +#include <cstdint> + +namespace Root +{ + class TAccept; +} + +namespace CP +{ + /// \brief the type for selection decorations that are meant to hold + /// a \ref Root::TAccept + /// + /// This is matched to the number of bits in a TAccept, since that + /// holds 32 bits, so do we. + typedef uint32_t SelectionType; + + + /// \brief the selection decoration to apply for objects that are + /// selected + /// + /// This is to be used when making a selection decoration for a + /// single cut and no TAccept object is at hand, as well as to check + /// whether a particular selection passed. + inline constexpr SelectionType selectionAccept () { + return ~SelectionType (0);} + + + /// \brief the selection decoration to apply for objects that are + /// rejected + /// + /// This is to be used when making a selection decoration for a + /// single cut and no TAccept object is at hand. + inline constexpr SelectionType selectionReject () { + return ~SelectionType (1);} + + + /// \brief the selection decoration made from the given boolean + /// (true = accept) + SelectionType selectionFromBool (bool accept); + + + /// \brief the selection decoration made from the given TAccept + /// object + SelectionType selectionFromAccept (const Root::TAccept& accept); + + + ANA_MSG_HEADER (msgSelectionHelpers) +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpersDict.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpersDict.h new file mode 100644 index 0000000000000000000000000000000000000000..ea6e06901e907dae9f03d3d5579b864998959931 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpersDict.h @@ -0,0 +1,14 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS__SELECTION_HELPERS_DICT_H +#define SELECTION_HELPERS__SELECTION_HELPERS_DICT_H + +#include "SelectionHelpers/ISelectionAccessor.h" +#include "SelectionHelpers/OutOfValidityHelper.h" + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionReadHandle.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionReadHandle.h new file mode 100644 index 0000000000000000000000000000000000000000..3ad43fc265e24799bf12a9c7a56857db42b51dc1 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionReadHandle.h @@ -0,0 +1,92 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SELECTION_HELPERS_SELECTION_READ_HANDLE_H +#define SELECTION_HELPERS_SELECTION_READ_HANDLE_H + +#include <AthContainers/AuxElement.h> +#include <AsgTools/MsgStream.h> +#include <memory> + +class StatusCode; + +namespace CP +{ + class ISelectionAccessor; + + /// \brief a data handle for reading selection properties from + /// objects + /// + /// Essentially this is just a wrapper around \ref + /// ISelectionAccessor to make it easier to use in an algorithm. + /// Since we are now using this a lot, it seems like a good idea to + /// streamline this as much as possible. + + class SelectionReadHandle final + { + // + // public interface + // + + /// \brief standard constructor + public: + template<typename T2> + SelectionReadHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription); + + + /// \brief whether we have a name configured + public: + bool empty () const noexcept; + + /// \brief !empty() + public: + explicit operator bool () const noexcept; + + + /// \brief initialize the accessor + public: + StatusCode initialize (); + + + /// \brief get the selection as a bool + public: + bool getBool (const SG::AuxElement& element) const; + + + + // + // private interface + // + + /// \brief the selection we use + private: + std::string m_selection; + + /// \brief the accessor we use + private: + std::unique_ptr<ISelectionAccessor> m_accessor; + + + /// \brief the message stream we use + private: + MsgStream *m_msg {nullptr}; + + /// \brief helper for message macros + private: + MsgStream& msg( ) const; + + /// \brief helper for message macros + private: + MsgStream& msg( const MSG::Level lvl ) const; + }; +} + +#include "SelectionReadHandle.icc" + +#endif diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionReadHandle.icc b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionReadHandle.icc new file mode 100644 index 0000000000000000000000000000000000000000..e6d084e78168c6898dc7ff61c15d27b1e1b7b11d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionReadHandle.icc @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SelectionHelpers/ISelectionAccessor.h> + +// +// method implementations +// + +namespace CP +{ + template<typename T2> SelectionReadHandle :: + SelectionReadHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription) + : m_selection (propertyValue) + , m_msg (&owner->msg()) + { + owner->declareProperty (propertyName, m_selection, propertyDescription); + } + + + + inline bool SelectionReadHandle :: + getBool (const SG::AuxElement& element) const + { + assert (m_accessor); + return m_accessor->getBool (element); + } +} diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/selection.xml b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..9f977b4433e0f347dd67f96c5dd8e6a6706ab5b9 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/selection.xml @@ -0,0 +1,6 @@ +<lcgdict> + + <class name="CP::ISelectionAccessor" /> + <class name="CP::OutOfValidityAction" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/test/gt_ISelectionAccessor.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/test/gt_ISelectionAccessor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..58b44391d3888f147cfae218c8ef6f5590f0e7b1 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/test/gt_ISelectionAccessor.cxx @@ -0,0 +1,541 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <SelectionHelpers/ISelectionAccessor.h> +#include <SelectionHelpers/SelectionAccessorChar.h> +#include <SelectionHelpers/SelectionAccessorBits.h> +#include <SelectionHelpers/SelectionAccessorList.h> +#include <SelectionHelpers/SelectionAccessorNull.h> +#include <AsgTools/MessageCheck.h> +#include <AsgTesting/UnitTest.h> +#include <xAODJet/Jet.h> +#include <gtest/gtest.h> +#include "SelectionHelpers/SelectionExprParser.h" + +// +// unit test +// + +namespace CP +{ + TEST (ISelectionAccessorTest, all_tests) + { + auto jet = std::make_unique<xAOD::Jet> (); + jet->makePrivateStore(); + + // check a basic char accessor + std::unique_ptr<ISelectionAccessor> accA; + ASSERT_SUCCESS (makeSelectionAccessor ("a,as_char", accA)); + auto* selA = dynamic_cast<SelectionAccessorChar*>(accA.get()); + // check that this is actually nothing but a simple char accessor + EXPECT_NE(selA, nullptr); + accA->setBool (*jet, false); + EXPECT_EQ (jet->auxdata<char> ("a"), 0); + accA->setBool (*jet, true); + EXPECT_EQ (jet->auxdata<char> ("a"), 1); + accA->setBits (*jet, selectionReject()); + EXPECT_EQ (jet->auxdata<char> ("a"), 0); + accA->setBits (*jet, selectionAccept()); + EXPECT_EQ (jet->auxdata<char> ("a"), 1); + + // check an implicit char accessor + std::unique_ptr<ISelectionAccessor> accB; + ASSERT_SUCCESS (makeSelectionAccessor ("b", accB, true)); + accB->setBool (*jet, false); + EXPECT_EQ (jet->auxdata<char> ("b"), 0); + accB->setBool (*jet, true); + EXPECT_EQ (jet->auxdata<char> ("b"), 1); + + // check a basic bits accessor + std::unique_ptr<ISelectionAccessor> accC; + ASSERT_SUCCESS (makeSelectionAccessor ("c,as_bits", accC)); + // check that this is actually nothing but a simple bits accessor + auto* selC = dynamic_cast<SelectionAccessorBits*>(accC.get()); + EXPECT_NE(selC, nullptr); + accC->setBool (*jet, false); + EXPECT_EQ (jet->auxdata<SelectionType> ("c"), selectionReject()); + accC->setBool (*jet, true); + EXPECT_EQ (jet->auxdata<SelectionType> ("c"), selectionAccept()); + accC->setBits (*jet, selectionReject()); + EXPECT_EQ (jet->auxdata<SelectionType> ("c"), selectionReject()); + accC->setBits (*jet, selectionAccept()); + EXPECT_EQ (jet->auxdata<SelectionType> ("c"), selectionAccept()); + + // check an implicit bits accessor + std::unique_ptr<ISelectionAccessor> accD; + ASSERT_SUCCESS (makeSelectionAccessor ("d", accD, false)); + accD->setBool (*jet, false); + EXPECT_EQ (jet->auxdata<SelectionType> ("d"), selectionReject()); + accD->setBool (*jet, true); + EXPECT_EQ (jet->auxdata<SelectionType> ("d"), selectionAccept()); + + // check an and of two accessors + std::unique_ptr<ISelectionAccessor> accAnd; + ASSERT_SUCCESS (makeSelectionAccessor ("a,as_char&&b,as_char", accAnd)); + accA->setBool (*jet, true); + accB->setBool (*jet, true); + EXPECT_TRUE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)0); + accA->setBool (*jet, false); + accB->setBool (*jet, true); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)1); + accA->setBool (*jet, true); + accB->setBool (*jet, false); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)2); + accA->setBool (*jet, false); + accB->setBool (*jet, false); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)3); + + // check AND of three accessors + ASSERT_SUCCESS (makeSelectionAccessor ("a,as_char&&b,as_char&&c,as_bits", accAnd)); + auto* selAnd = dynamic_cast<SelectionAccessorList*>(accAnd.get()); + EXPECT_NE(selAnd, nullptr); + + accA->setBool (*jet, true); + accB->setBool (*jet, true); + accC->setBool (*jet, true); + EXPECT_TRUE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)0); + + accA->setBool (*jet, false); + accB->setBool (*jet, true); + accC->setBool (*jet, true); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)1); + + accA->setBool (*jet, true); + accB->setBool (*jet, false); + accC->setBool (*jet, true); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)2); + + accA->setBool (*jet, false); + accB->setBool (*jet, false); + accC->setBool (*jet, true); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)3); + + accA->setBool (*jet, true); + accB->setBool (*jet, true); + accC->setBool (*jet, false); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)4); + + accA->setBool (*jet, false); + accB->setBool (*jet, true); + accC->setBool (*jet, false); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)5); + + accA->setBool (*jet, true); + accB->setBool (*jet, false); + accC->setBool (*jet, false); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)6); + + accA->setBool (*jet, false); + accB->setBool (*jet, false); + accC->setBool (*jet, false); + EXPECT_FALSE (accAnd->getBool (*jet)); + EXPECT_EQ (accAnd->getBits (*jet), ~(SelectionType)7); + + // check an OR of two accessors + std::unique_ptr<ISelectionAccessor> accOr; + ASSERT_SUCCESS (makeSelectionAccessor ("a,as_char||b,as_char", accOr)); + accA->setBool (*jet, false); + accB->setBool (*jet, true); + EXPECT_TRUE (accOr->getBool (*jet)); + EXPECT_EQ (accOr->getBits (*jet), selectionAccept()); + accA->setBool (*jet, true); + accB->setBool (*jet, false); + EXPECT_TRUE (accOr->getBool (*jet)); + EXPECT_EQ (accOr->getBits (*jet), selectionAccept()); + accA->setBool (*jet, false); + accB->setBool (*jet, false); + EXPECT_FALSE (accOr->getBool (*jet)); + EXPECT_EQ (accOr->getBits (*jet), selectionReject()); + + std::unique_ptr<ISelectionAccessor> accEx; + ASSERT_SUCCESS (makeSelectionAccessor ("a,as_char||(b,as_char && c,as_bits)", accEx)); + accA->setBool (*jet, true); + accB->setBool (*jet, true); + accC->setBool (*jet, true); + EXPECT_TRUE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionAccept()); + accA->setBool (*jet, false); + accB->setBool (*jet, true); + accC->setBool (*jet, true); + EXPECT_TRUE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionAccept()); + accA->setBool (*jet, false); + accB->setBool (*jet, false); + accC->setBool (*jet, true); + EXPECT_FALSE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionReject()); + accA->setBool (*jet, false); + accB->setBool (*jet, true); + accC->setBool (*jet, false); + EXPECT_FALSE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionReject()); + accA->setBool (*jet, false); + accB->setBool (*jet, false); + accC->setBool (*jet, false); + EXPECT_FALSE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionReject()); + accA->setBool (*jet, true); + accB->setBool (*jet, false); + accC->setBool (*jet, false); + EXPECT_TRUE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionAccept()); + + ASSERT_SUCCESS (makeSelectionAccessor ("a,as_char||(b,as_char && !c,as_bits)", accEx)); + accA->setBool (*jet, true); + accB->setBool (*jet, true); + accC->setBool (*jet, false); + EXPECT_TRUE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionAccept()); + accA->setBool (*jet, false); + accB->setBool (*jet, true); + accC->setBool (*jet, false); + EXPECT_TRUE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionAccept()); + accA->setBool (*jet, false); + accB->setBool (*jet, false); + accC->setBool (*jet, false); + EXPECT_FALSE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionReject()); + accA->setBool (*jet, false); + accB->setBool (*jet, true); + accC->setBool (*jet, true); + EXPECT_FALSE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionReject()); + accA->setBool (*jet, false); + accB->setBool (*jet, false); + accC->setBool (*jet, true); + EXPECT_FALSE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionReject()); + accA->setBool (*jet, true); + accB->setBool (*jet, false); + accC->setBool (*jet, true); + EXPECT_TRUE (accEx->getBool (*jet)); + EXPECT_EQ (accEx->getBits (*jet), selectionAccept()); + + + // test that an empty string produces a SelectionAccessorNull(true) + std::unique_ptr<ISelectionAccessor> accEmpty; + ASSERT_SUCCESS (makeSelectionAccessor ("", accEmpty)); + auto accNull = dynamic_cast<SelectionAccessorNull*>(accEmpty.get()); + EXPECT_NE (accNull, nullptr); // is in fact a null accessor + // can either be true or false, let's test that it is true + EXPECT_TRUE (accEmpty->getBool (*jet)); + + } + + TEST (SelectionExprParser, tokenizer) { + using tok = DetailSelectionExprParser::Tokenizer; + + std::string s = "A && B"; + tok tokens(s, {}); + auto it = tokens.begin(); + EXPECT_EQ(*(it++), "A"); + EXPECT_EQ(*(it++), "&&"); + EXPECT_EQ(*(it++), "B"); + + s = "A&&B"; + tokens = tok{s, {}}; + it = tokens.begin(); + EXPECT_EQ(*(it++), "A"); + EXPECT_EQ(*(it++), "&&"); + EXPECT_EQ(*(it++), "B"); + + s = "( alpha || gamma) &beta "; + tokens = tok{s, {}}; + it = tokens.begin(); + EXPECT_EQ(*(it++), "("); + EXPECT_EQ(*(it++), "alpha"); + EXPECT_EQ(*(it++), "||"); + EXPECT_EQ(*(it++), "gamma"); + EXPECT_EQ(*it, ")"); + EXPECT_THROW(it++, std::runtime_error); + + s = "a|b"; + tokens = tok{s, {}}; + it = tokens.begin(); + EXPECT_EQ(*it, "a"); + EXPECT_THROW(it++, std::runtime_error); + + s = "( alpha || gamma) &&beta "; + tokens = tok{s, {}}; + it = tokens.begin(); + EXPECT_EQ(*(it++), "("); + EXPECT_EQ(*(it++), "alpha"); + EXPECT_EQ(*(it++), "||"); + EXPECT_EQ(*(it++), "gamma"); + EXPECT_EQ(*(it++), ")"); + EXPECT_EQ(*(it++), "&&"); // & not a token: considered part of variable + EXPECT_EQ(*(it++), "beta"); + + } + + TEST (SelectionExprParser, lexer) { + using lexer = DetailSelectionExprParser::Lexer; + using type = lexer::Type; + + lexer::Symbol s; + { + lexer lex("A&&B"); + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "A"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::AND); + EXPECT_EQ(s.value, "&&"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "B"); + } + + { + std::string str = "alpha,as_bits && beta,as_char"; + lexer lex{str}; + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "alpha,as_bits"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::AND); + EXPECT_EQ(s.value, "&&"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "beta,as_char"); + } + + + { + std::string str = "alpha,as_bits&&beta,as_char"; + lexer lex{str}; + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "alpha,as_bits"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::AND); + EXPECT_EQ(s.value, "&&"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "beta,as_char"); + } + + { + std::string str = "alpha,as_bits || beta,as_char"; + lexer lex{str}; + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "alpha,as_bits"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::OR); + EXPECT_EQ(s.value, "||"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "beta,as_char"); + } + + + { + std::string str = "alpha,as_bits||beta,as_char"; + lexer lex{str}; + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "alpha,as_bits"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::OR); + EXPECT_EQ(s.value, "||"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "beta,as_char"); + } + + { + std::string str = "alpha,as_bits||(beta,as_char &&!gamma,as_bits)"; + lexer lex{str}; + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "alpha,as_bits"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::OR); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::LEFT); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "beta,as_char"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::AND); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::NOT); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::VAR); + EXPECT_EQ(s.value, "gamma,as_bits"); + + s = lex.nextSymbol(); + EXPECT_EQ(s.type, type::RIGHT); + } + } + + TEST (SelectionExprParser, parser) { + auto parse = [](std::string s) -> std::string { + SelectionExprParser p(s, true); + std::unique_ptr<ISelectionAccessor> acc; + if(!p.build(acc).isSuccess()) { + ADD_FAILURE() << "unable to parse expression"; + } + return acc->label(); + }; + + std::string s; + // this asserts the tree structure + s = parse("A&&(C||!B)"); + EXPECT_EQ(s, "( A && ( C || !B ) )"); + // and this asserts the label output can be parse again, + // leading to the exact same expression + EXPECT_EQ(parse(s), s); + + s = parse("A&&(C||!(B&&true))"); + EXPECT_EQ(s, "( A && ( C || !( B && true ) ) )"); + EXPECT_EQ(parse(s), s); + + s = parse("alpha && ( beta || ! gamma )"); + EXPECT_EQ(s, "( alpha && ( beta || !gamma ) )"); + EXPECT_EQ(parse(s), s); + + s = parse(" alpha&&beta || !gamma "); + EXPECT_EQ(s, "( ( alpha && beta ) || !gamma )"); + EXPECT_EQ(parse(s), s); + + s = parse(" (alpha&&beta) || !gamma "); + EXPECT_EQ(s, "( ( alpha && beta ) || !gamma )"); + EXPECT_EQ(parse(s), s); + + s = parse(" A && B && C && D"); + EXPECT_EQ(s, "( A && B && C && D )"); + EXPECT_EQ(parse(s), s); + + + EXPECT_THROW(parse("alpha &&"), std::runtime_error); + EXPECT_THROW(parse("&&"), std::runtime_error); + EXPECT_THROW(parse("&& alpha"), std::runtime_error); + EXPECT_THROW(parse("alpha ||"), std::runtime_error); + EXPECT_THROW(parse("||"), std::runtime_error); + EXPECT_THROW(parse("|| alpha"), std::runtime_error); + EXPECT_THROW(parse("(alpha && beta || gamma"), std::runtime_error); + EXPECT_THROW(parse("alpha && beta) || gamma"), std::runtime_error); + EXPECT_THROW(parse("!"), std::runtime_error); + EXPECT_THROW(parse("alpha !"), std::runtime_error); + EXPECT_THROW(parse("()"), std::runtime_error); + EXPECT_THROW(parse(")"), std::runtime_error); + EXPECT_THROW(parse("("), std::runtime_error); + } + + TEST (SelectionExprParser, evaluate) { + auto mkex = [](const std::string& s) { + SelectionExprParser p(s, true); + std::unique_ptr<ISelectionAccessor> acc; + if(!p.build(acc).isSuccess()) { + ADD_FAILURE() << "unable to parse expression"; + } + return acc; + }; + + auto jet_ptr = std::make_unique<xAOD::Jet> (); + auto& jet = *jet_ptr; + jet.makePrivateStore(); + + xAOD::Jet::Decorator<char> alpha("alpha"); + xAOD::Jet::Decorator<char> beta("beta"); + xAOD::Jet::Decorator<char> gamma("gamma"); + + { + + std::string s = "alpha && ( beta || ! gamma )"; + auto ex = mkex(s); + + alpha(jet) = true; + beta(jet) = true; + gamma(jet) = true; + EXPECT_EQ(ex->getBool(jet), true); + + alpha(jet) = false; + EXPECT_EQ(ex->getBool(jet), 0); + + alpha(jet) = true; + beta(jet) = false; + EXPECT_EQ(ex->getBool(jet), 0); + + gamma(jet) = false; + EXPECT_EQ(ex->getBool(jet), 1); + } + { + std::string s = "true||(alpha && ( beta || ! gamma ))"; + auto ex = mkex(s); + + EXPECT_TRUE(ex->getBool(jet)); + + alpha(jet) = false; + EXPECT_TRUE(ex->getBool(jet)); + + alpha(jet) = true; + beta(jet) = false; + EXPECT_TRUE(ex->getBool(jet)); + + gamma(jet) = false; + EXPECT_TRUE(ex->getBool(jet)); + } + { + auto ex = mkex("true"); + EXPECT_TRUE(ex->getBool(jet)); + + ex = mkex("false"); + EXPECT_FALSE(ex->getBool(jet)); + + ex = mkex("true && false"); + EXPECT_FALSE(ex->getBool(jet)); + + ex = mkex("true || false"); + EXPECT_TRUE(ex->getBool(jet)); + + ex = mkex("true && !false"); + EXPECT_TRUE(ex->getBool(jet)); + + ex = mkex("!true && !false"); + EXPECT_FALSE(ex->getBool(jet)); + + } + } +} + +ATLAS_GOOGLE_TEST_MAIN diff --git a/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff41deca6757173eaef0d86abb266ac79bf563c7 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,36 @@ + +# Set the name of the package: +atlas_subdir( StandaloneAnalysisAlgorithms ) + +# Check that this is a standalone release: +if( NOT XAOD_STANDALONE ) + message( WARNING "This package is only meant for standalone releases" ) + return() +endif() + +# Set the package's dependencies: +atlas_depends_on_subdirs( + PUBLIC + Control/xAODRootAccess + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PRIVATE + Control/AthContainers + PhysicsAnalysis/D3PDTools/EventLoop ) + +# External(s): +find_package( ROOT COMPONENTS Core RIO ) + +# Set up the main library: +atlas_add_library( StandaloneAnalysisAlgorithmsLib + StandaloneAnalysisAlgorithms/*.h Root/*.cxx + PUBLIC_HEADERS StandaloneAnalysisAlgorithms + LINK_LIBRARIES xAODRootAccess SystematicsHandlesLib AnaAlgorithmLib + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers EventLoop ) + +# Set up a dictionary: +atlas_add_dictionary( StandaloneAnalysisAlgorithmsDict + StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithmsDict.h + StandaloneAnalysisAlgorithms/selection.xml + LINK_LIBRARIES StandaloneAnalysisAlgorithmsLib ) diff --git a/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/README.md b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/README.md new file mode 100644 index 0000000000000000000000000000000000000000..866f31f8a482324a01bce80cd494f802d011f508 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/README.md @@ -0,0 +1,9 @@ +# Standalone Analysis Algorithms + +This package collects code/algorithms that are only relevant for standalone +analysis releases. So they wouldn't need to be compiled in Athena based +releases. + +Current algorithm(s) in the package: + - [CP::xAODWriterAlg](StandaloneAnalysisAlgorithms/xAODWriterAlg.h): + Algorithm for writing mini-xAOD files as the output of analysis jobs. diff --git a/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/Root/xAODWriterAlg.cxx b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/Root/xAODWriterAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ae74459e41638f063e9c2e3ea68df98102e37c91 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/Root/xAODWriterAlg.cxx @@ -0,0 +1,202 @@ +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// + +// System include(s): +#include <regex> + +// ROOT include(s): +#include <TClass.h> +#include <TFile.h> + +// Core include(s): +#include "AthContainers/normalizedTypeinfoName.h" +#include "EventLoop/Worker.h" +#include "SystematicsHandles/Helpers.h" + +// Local include(s): +#include "StandaloneAnalysisAlgorithms/xAODWriterAlg.h" + +namespace CP { + + xAODWriterAlg::xAODWriterAlg( const std::string& name, ISvcLocator* svcLoc ) + : EL::AnaAlgorithm( name, svcLoc ) { + + // Declare the algorithm's properties. + declareProperty( "OutputStreamName", m_outputStreamName = "ANALYSIS", + "Stream name of the output file to use" ); + declareProperty( "ItemList", m_itemList, + "Objects to write to the output file" ); + declareProperty( "BasketSize", m_basketSize = 32000, + "(Starter) Basket size for the created branches" ); + declareProperty( "SplitLevel", m_splitLevel = 0, + "Split level for the created branches" ); + } + + StatusCode xAODWriterAlg::initialize() { + + // Make sure that the xAOD::TEvent object managed by EventLoop is the + // "active" one. + evtStore()->event()->setActive(); + + // Set up the systematics list. + ATH_CHECK( m_systematicsList.initialize() ); + + // Access the file of the output stream. + TFile* ofile = wk()->getOutputFile( m_outputStreamName ); + if( ! ofile ) { + ATH_MSG_FATAL( "Couldn't access output file for stream \"" + << m_outputStreamName << "\"" ); + return StatusCode::FAILURE; + } + + // Write to this output file. + ANA_CHECK( m_event.writeTo( ofile ) ); + + // Reset the internal flag(s). + m_itemListInitialized = false; + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode xAODWriterAlg::execute() { + + // If this is the first event, figure out which objects can actually be + // written out. + if( ! m_itemListInitialized ) { + ANA_CHECK( setup() ); + m_itemListInitialized = true; + } + + // Write all objects to the output file. + xAOD::TEvent* event = evtStore()->event(); + for( const Item& item : m_writtenItemList ) { + + // Get the object. See the description in @c xAOD::TEvent::retrieve + // (the const version) for an explanation of this implementation. + static const bool SILENT = true; + static const bool METADATA = false; + const void* obj = event->getOutputObject( item.name, *( item.type ), + METADATA ); + if( ! obj ) { + obj = event->getInputObject( item.name, *( item.type ), SILENT, + METADATA ); + } else { + event->getInputObject( item.name, *( item.type ), SILENT, + METADATA ); + } + + // Check that we succeeded. + if( ! obj ) { + ATH_MSG_FATAL( "Couldn't retrieve object \"" << item.name << "\"" ); + return StatusCode::FAILURE; + } + + // Record it to the output for the current event. + ANA_CHECK( m_event.record( const_cast< void* >( obj ), item.typeName, + item.name, m_basketSize, m_splitLevel ) ); + } + + // Write the event. + if( m_event.fill() <= 0 ) { + ATH_MSG_FATAL( "There was an error writing out the event" ); + return StatusCode::FAILURE; + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode xAODWriterAlg::finalize() { + + // Access the file of the output stream. + TFile* ofile = wk()->getOutputFile( m_outputStreamName ); + if( ! ofile ) { + ATH_MSG_FATAL( "Couldn't access output file for stream \"" + << m_outputStreamName << "\"" ); + return StatusCode::FAILURE; + } + + // Finish writing to this output file. + ANA_CHECK( m_event.finishWritingTo( ofile ) ); + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode xAODWriterAlg::setup() { + + // Loop over all of the declared items. + for( const std::string& stringItem : m_itemList ) { + + // Interpret the item string. + static const std::regex itemRegex( "([^#]+)#([^\\.]+\\.?)(.*)" ); + std::smatch itemMatch; + if( ! std::regex_match( stringItem, itemMatch, itemRegex ) ) { + ATH_MSG_FATAL( "Item \"" << stringItem + << "\" is not of the form: \"Type#Name\"" ); + return StatusCode::FAILURE; + } + ATH_MSG_VERBOSE( "Found item: " << itemMatch[ 1 ] << "#" + << itemMatch[ 2 ] << itemMatch[ 3 ] ); + + // Consider all systematics. Not usin CP::SysListHandle::foreach, to + // be able to exit the for-loop early if necessary. + auto sysVector = m_systematicsList.systematicsVector(); + for( const auto& sys : sysVector ) { + + // Event store key for the object under consideration. + const std::string key = makeSystematicsName( itemMatch[ 2 ], sys ); + + // Whether or not the object will be available, as long as + // variable selection rules were set up for it, let xAOD::TEvent + // know about them. + if( itemMatch[ 3 ] != "" ) { + ATH_MSG_DEBUG( "Calling setAuxItemList( \"" << key << "\"" + << ", \"" << itemMatch[ 3 ] + << "\" )" ); + m_event.setAuxItemList( key, itemMatch[ 3 ] ); + } + + // Construct an Item object. + Item item; + item.name = key; + TClass* cl = TClass::GetClass( itemMatch[ 1 ].str().c_str() ); + if( ! cl ) { + ATH_MSG_FATAL( "Type \"" << itemMatch[ 1 ] << "\" not found" ); + return StatusCode::FAILURE; + } + item.type = cl->GetTypeInfo(); + if( ! item.type ) { + ATH_MSG_FATAL( "No compiled dictionary found for \"" + << itemMatch[ 1 ] << "\"" ); + return StatusCode::FAILURE; + } + item.typeName = SG::normalizedTypeinfoName( *( item.type ) ); + + // Check if the item is available. + static const bool SILENT = true; + static const bool METADATA = false; + xAOD::TEvent* event = evtStore()->event(); + if( event->getOutputObject( item.name, *( item.type ), METADATA ) || + event->getInputObject( item.name, *( item.type ), SILENT, + METADATA ) ) { + m_writtenItemList.push_back( item ); + ATH_MSG_DEBUG( "Scheduling \"" << itemMatch[ 1 ] << "#" + << key << "\" for writing" ); + } + + // If there was no %SYS% pattern in the object name, stop the loop + // over the systematics now. + if( key == itemMatch[ 2 ] ) { + break; + } + } + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..0fad3aeb3153c93849a857e5b81b259b4834b551 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithmsDict.h @@ -0,0 +1,11 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// +#ifndef STANDALONEANALYSISALGORITHMS_STANDALONEANALYSISALGORITHMSDICT_H +#define STANDALONEANALYSISALGORITHMS_STANDALONEANALYSISALGORITHMSDICT_H + +// Local include(s): +#include "StandaloneAnalysisAlgorithms/xAODWriterAlg.h" + +#endif // STANDALONEANALYSISALGORITHMS_STANDALONEANALYSISALGORITHMSDICT_H diff --git a/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..073de929384c57dfbffdf09ba40ca49693669739 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/selection.xml @@ -0,0 +1,7 @@ +<!-- Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration --> +<lcgdict> + + <!-- Algorithm(s): --> + <class name="CP::xAODWriterAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/xAODWriterAlg.h b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/xAODWriterAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..2be743298f94f86255598a2990a0a657027395c9 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/StandaloneAnalysisAlgorithms/StandaloneAnalysisAlgorithms/xAODWriterAlg.h @@ -0,0 +1,92 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// +#ifndef STANDALONEANALYSISALGORITHMS_XAODWRITERALG_H +#define STANDALONEANALYSISALGORITHMS_XAODWRITERALG_H + +// System include(s): +#include <string> +#include <vector> +#include <typeinfo> + +// Core include(s): +#include "AnaAlgorithm/AnaAlgorithm.h" +#include "SystematicsHandles/SysListHandle.h" +#include "xAODRootAccess/TEvent.h" + +namespace CP { + + /// Algorithm writing an xAOD output file + /// + /// This algorithm is meant to be used to write mini-xAOD output files from + /// analysis jobs. Similar to how such a file could be written using an + /// Athena job. + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class xAODWriterAlg final : public EL::AnaAlgorithm { + + public: + /// Algorithm constructor + xAODWriterAlg( const std::string& name, ISvcLocator* svcLoc ); + + /// @name Function(s) inherited from @c EL::AnaAlgorithm + /// @{ + + /// Function initialising the algorithm + StatusCode initialize() override; + + /// Function executing the algorithm + StatusCode execute() override; + + /// Function finalising the algorithm + StatusCode finalize() override; + + /// @} + + private: + /// Function setting up the algorithm while processing the first event + StatusCode setup(); + + /// @name Algorithm properties + /// @{ + + /// Name of the output stream to write to + std::string m_outputStreamName; + /// Item list to write to the output file + std::vector< std::string > m_itemList; + + /// (Starter) Basket size for the created branches + int m_basketSize; + /// Split level for the created branches + int m_splitLevel; + + /// @} + + /// Helper struct + struct Item { + /// Name of the written object + std::string name; + /// Type of the written object + const std::type_info* type; + /// Type name of the written object + std::string typeName; + }; // struct Item + + /// Object to write the output file with + xAOD::TEvent m_event; + + /// Internal flag + bool m_itemListInitialized = false; + /// Item list being written after the first event + std::vector< Item > m_writtenItemList; + + /// The systematic list to consider during execution + SysListHandle m_systematicsList{ this }; + + }; // class xAODWriterAlg + +} // namespace CP + +#endif // STANDALONEANALYSISALGORITHMS_XAODWRITERALG_H diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/CMakeLists.txt b/PhysicsAnalysis/Algorithms/SystematicsHandles/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fa55968831c29fa603107f3f8d099f5268dcbb2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/CMakeLists.txt @@ -0,0 +1,58 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +atlas_subdir( SystematicsHandles ) + +atlas_depends_on_subdirs( + PUBLIC + Control/AthContainers + Control/AthToolSupport/AsgTools + PhysicsAnalysis/AnalysisCommon/PATInterfaces + PhysicsAnalysis/D3PDTools/AnaAlgorithm + Event/xAOD/xAODBase + Event/xAOD/xAODCore + Event/xAOD/xAODEventInfo + PRIVATE + Control/xAODRootAccess + Event/xAOD/xAODJet + Event/xAOD/xAODMuon + Event/xAOD/xAODEgamma + Event/xAOD/xAODTau + PhysicsAnalysis/D3PDTools/RootCoreUtils ) + +atlas_add_library( SystematicsHandlesLib + SystematicsHandles/*.h SystematicsHandles/*.icc Root/*.cxx + PUBLIC_HEADERS SystematicsHandles + LINK_LIBRARIES AsgTools PATInterfaces AnaAlgorithmLib xAODBase xAODCore AthContainers xAODEventInfo + PRIVATE_LINK_LIBRARIES RootCoreUtils + xAODJet xAODMuon xAODEgamma xAODTau ) + +atlas_add_test( cc_SysReadHandle + SOURCES test/cc_SysReadHandle.cxx + LINK_LIBRARIES AsgTools AnaAlgorithmLib SystematicsHandlesLib ) + +atlas_add_test( cc_SysCopyHandle + SOURCES test/cc_SysCopyHandle.cxx + LINK_LIBRARIES AsgTools AnaAlgorithmLib xAODEventInfo xAODJet + SystematicsHandlesLib ) + +if( XAOD_STANDALONE ) + atlas_add_test( ut_CopyHelpers + SOURCES test/ut_CopyHelpers.cxx + LINK_LIBRARIES xAODRootAccess AsgTools xAODBase xAODJet + SystematicsHandlesLib ) +endif() + +atlas_add_test( cc_SysWriteHandle + SOURCES test/cc_SysWriteHandle.cxx + LINK_LIBRARIES AsgTools AnaAlgorithmLib SystematicsHandlesLib ) + +atlas_add_test( cc_SysListHandle + SOURCES test/cc_SysListHandle.cxx + LINK_LIBRARIES AsgTools AnaAlgorithmLib SystematicsHandlesLib ) + +atlas_add_test( cc_SysDecorationHandle + SOURCES test/cc_SysDecorationHandle.cxx + LINK_LIBRARIES AsgTools AnaAlgorithmLib SystematicsHandlesLib ) diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/CopyHelpers.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/CopyHelpers.cxx new file mode 100644 index 0000000000000000000000000000000000000000..91520513e1911f1dd759e4395db96152d872314b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/CopyHelpers.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/CopyHelpers.h> + +#include <xAODEgamma/PhotonContainer.h> +#include <xAODEgamma/ElectronContainer.h> +#include <xAODJet/JetContainer.h> +#include <xAODMuon/MuonContainer.h> +#include <xAODTau/TauJetContainer.h> +#include <xAODTracking/TrackParticleContainer.h> + +// +// method implementations +// + +namespace CP +{ + namespace detail + { + StatusCode ShallowCopy<xAOD::IParticleContainer> :: + getCopy (MsgStream& msgStream, StoreType& store, + xAOD::IParticleContainer*& object, + const xAOD::IParticleContainer *inputObject, + const std::string& outputName, const std::string& auxName) + { + // this is probably not the best way to do this, but doing this + // the proper way will require an xAOD expert to do it. + + // Set up a lambda for providing a msg(...) function. + const auto msg = [&] (MSG::Level lvl) -> MsgStream& {msgStream << lvl; return msgStream;}; + + // using a macro is a bit awkward, but doing this as a template + // is not practical either +#define COPY(TYPE) \ + do { \ + const TYPE *in = dynamic_cast< const TYPE* >( inputObject ); \ + if( in ) { \ + TYPE *out = nullptr; \ + ANA_CHECK( ShallowCopy<TYPE>::getCopy( msgStream, store, out, in, \ + outputName, auxName ) ); \ + object = out; \ + return StatusCode::SUCCESS; \ + } \ + } while( false ) + + COPY( xAOD::JetContainer ); + COPY( xAOD::MuonContainer ); + COPY( xAOD::ElectronContainer ); + COPY( xAOD::PhotonContainer ); + COPY( xAOD::TauJetContainer ); + COPY(xAOD::TrackParticleContainer); + +#undef COPY + + ANA_MSG_ERROR ("could not determine type to create shallow copy " << outputName); + ANA_MSG_ERROR ("please extend CopyHelpers.cxx with the appropriate type"); + return StatusCode::FAILURE; + } + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/Helpers.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/Helpers.cxx new file mode 100644 index 0000000000000000000000000000000000000000..64e25257586b14a32fc6bec187390f036848b8e4 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/Helpers.cxx @@ -0,0 +1,56 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/Helpers.h> + +#include <RootCoreUtils/StringUtil.h> +#include <PATInterfaces/SystematicSet.h> +#include <regex> + +// +// method implementations +// + +namespace CP +{ + std::string nominalSystematicsName () + { + return "NOSYS"; + } + + + + std::string makeSystematicsName (const std::string& name, + const CP::SystematicSet& sys) + { + std::string sysName = sys.name(); + if (sysName.empty()) + sysName = nominalSystematicsName(); + return RCU::substitute (name, "%SYS%", sysName); + } + + + + std::string makeSystematicsName (const std::string& name, + const std::string& affecting, + const CP::SystematicSet& sys) + { + CP::SystematicSet mysys; + std::regex expr (affecting); + + for (auto& var : sys) + { + if (regex_match (var.basename(), expr)) + mysys.insert (var); + } + return makeSystematicsName (name, mysys); + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/ISysHandleBase.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/ISysHandleBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..67a269319eb27130b7f62c7ae61536b6f9d23d41 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/ISysHandleBase.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/ISysHandleBase.h> + +// +// method implementations +// + +namespace CP +{ +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporter.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..602f2d290aec669302f8c550177e70792f5267ce --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporter.cxx @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysFilterReporter.h> + +#include <SystematicsHandles/SysFilterReporterCombiner.h> +#include <SystematicsHandles/SysFilterReporterParams.h> +#include <AsgMessaging/MessageCheck.h> + +// +// method implementations +// + +namespace CP +{ + SysFilterReporter :: + SysFilterReporter (SysFilterReporterCombiner& val_combiner, + const SystematicSet& val_sys) + : AsgMessagingForward (&val_combiner) + , m_combiner (val_combiner) + , m_sys (val_sys) + , m_passed (val_combiner.m_passedDefault) + { + ANA_CHECK_THROW (val_combiner.m_params.m_eventInfoHandle.getCopy (m_eventInfo, m_sys)); + } + + + + SysFilterReporter :: + ~SysFilterReporter () noexcept + { + ANA_MSG_DEBUG ("setting systematics-filter-passed flag to " << m_passed << " for " << m_sys.name()); + if (m_passed) + m_combiner.m_passedOne = true; + else + m_combiner.m_passedAll = false; + // decorate event info + m_combiner.m_params.m_eventDecisionOutputDecoration.set (*m_eventInfo, m_passed, m_sys); + + // only recording nominal event selection for now + if (m_passed && m_sys.empty()) + m_combiner.m_params.m_passedNominal += 1; + +#ifndef XAOD_STANDALONE + // only recording nominal event selection for now + if (m_passed && m_sys.empty() && m_combiner.m_params.m_cutID != 0) + m_combiner.m_params.m_cutFlowSvc->addEvent (m_combiner.m_params.m_cutID); +#endif + } + + + + void SysFilterReporter :: + setPassed (bool val_passed) noexcept + { + ANA_MSG_DEBUG ("change systematics-filter-passed flag to " << m_passed << " for " << m_sys.name()); + m_passed = val_passed; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporterCombiner.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporterCombiner.cxx new file mode 100644 index 0000000000000000000000000000000000000000..eff665d98c889e94531beb14a19757f318e36c58 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporterCombiner.cxx @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysFilterReporterCombiner.h> + +#include <SystematicsHandles/SysFilterReporterParams.h> +#include <AsgMessaging/MessageCheck.h> +#include <exception> + +// +// method implementations +// + +namespace CP +{ + SysFilterReporterCombiner :: + SysFilterReporterCombiner (SysFilterReporterParams& val_params, + SysListHandle& systematicsList, + bool val_passedDefault) + : AsgMessagingForward (&val_params) + , m_params (val_params) + , m_passedDefault (val_passedDefault) + { + if (!m_params.m_isInitialized) + { + ANA_MSG_FATAL ("using uninitialized SysFilterReporterParams, throwing exception"); + throw std::logic_error ("using uninitialized SysFilterReporterParams"); + } + + ANA_CHECK_THROW (m_params.m_eventDecisionOutputDecoration.preExecute(systematicsList)); + } + + + + SysFilterReporterCombiner :: + ~SysFilterReporterCombiner () noexcept + { + ANA_MSG_DEBUG ("setting algorithm-filter-passed flag to " << m_passedOne); + m_params.m_setFilterPassed (m_passedOne); + m_params.m_total += 1; + if (m_passedOne) + m_params.m_passedOne += 1; + if (m_passedAll) + m_params.m_passedAll += 1; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporterParams.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporterParams.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3daac19f9e8efa948e7f58b0559a05e7aaf4534a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysFilterReporterParams.cxx @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysFilterReporterParams.h> + +#include <AsgMessaging/MessageCheck.h> +#include <AsgMessaging/StatusCode.h> + +// +// method implementations +// + +namespace CP +{ + StatusCode SysFilterReporterParams :: + initialize () + { + if (m_isInitialized) + { + ANA_MSG_FATAL ("calling initialize twice on SysFilterReporterParams, aborting"); + return StatusCode::FAILURE; + } + + if (m_eventDecisionOutputDecoration.empty()) + { + ANA_MSG_ERROR ("no event filter decoration name set"); + return StatusCode::FAILURE; + } + +#ifndef XAOD_STANDALONE + if (!m_cutFlowSvc.empty()) + { + ANA_CHECK (m_cutFlowSvc.retrieve()); + m_cutID = m_cutFlowSvc->registerFilter (m_cutFlowSvc.parentName(), m_filterDescription + " (nominal only)"); + if (m_cutID == 0) + { + ANA_MSG_ERROR ("problem registering myself with cutflow-svc"); + return StatusCode::FAILURE; + } + } +#endif + + m_isInitialized = true; + return StatusCode::SUCCESS; + } + + + + StatusCode SysFilterReporterParams :: + finalize () + { + if (!m_isInitialized) + { + ANA_MSG_FATAL ("using unitialized SysFilterReporterParams, aborting"); + return StatusCode::FAILURE; + } + + ATH_MSG_INFO ("Events passing selection for at least one systematic: " << m_passedOne << " / " << m_total << " for " << m_filterDescription); + ATH_MSG_INFO ("Events passing selection for at nominal: " << m_passedNominal << " / " << m_total << " for " << m_filterDescription); + ATH_MSG_INFO ("Events passing selection for all systematics: " << m_passedAll << " / " << m_total << " for " << m_filterDescription); + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysListHandle.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysListHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ccd200164bc7c0d63bc160d19b8689f570932a72 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysListHandle.cxx @@ -0,0 +1,135 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysListHandle.h> + +#include <AsgTools/MessageCheck.h> +#include <AsgTools/StatusCode.h> +#include <PATInterfaces/SystematicSet.h> +#include <SystematicsHandles/ISysHandleBase.h> +#include <regex> + +#include <stdexcept> + +// +// method implementations +// + +namespace CP +{ + void SysListHandle :: + addHandle (ISysHandleBase& handle) + { + assert (!isInitialized()); + m_sysHandles.push_back (&handle); + } + + + + StatusCode SysListHandle :: + addAffectingSystematics (const CP::SystematicSet& affectingSystematics) + { + assert (!isInitialized()); + bool failures = false; + std::regex expr (m_affectingRegex); + for (const CP::SystematicVariation& sys : affectingSystematics) + { + if (!regex_match (sys.basename(), expr)) + { + ANA_MSG_ERROR ("algorithm reports affecting systematic " << sys << " which doesn't match user supplied pattern " << m_affectingRegex); + failures = true; + } + } + if (failures) + return StatusCode::FAILURE; + return StatusCode::SUCCESS; + } + + + + ::StatusCode SysListHandle :: + initialize () + { + m_evtStore = m_evtStoreGetter(); + m_isInitialized = true; + return StatusCode::SUCCESS; + } + + + + std::unordered_set<CP::SystematicSet> SysListHandle :: + systematicsVector () + { + assert (isInitialized()); + + if (m_fullAffecting.empty()) + { + std::string affecting = m_affectingRegex; + for (ISysHandleBase *handle : m_sysHandles) + { + std::string subAffecting = handle->getInputAffecting (); + if (!subAffecting.empty()) + { + if (!affecting.empty()) + affecting += "|"; + affecting += subAffecting; + } + } + if (affecting.empty()) + affecting = "^$"; + m_fullAffecting = std::move (affecting); + } + + const SysListType *systematicsList = nullptr; + ANA_CHECK_THROW (m_evtStore->retrieve (systematicsList, m_systematicsListName)); + + std::unordered_set<CP::SystematicSet> mysysList; + for (const auto& sys : *systematicsList) + { + auto iter = m_affectingCache.find (sys); + if (iter != m_affectingCache.end()) + { + mysysList.insert (iter->second); + } else + { + CP::SystematicSet mysys; + std::regex affecting (m_fullAffecting); + + for (const CP::SystematicVariation& subsys : sys) + { + if (regex_match (subsys.basename(),affecting)) + mysys.insert (subsys); + } + m_affectingCache.insert (std::make_pair (sys, mysys)); + mysysList.insert (mysys); + } + } + return mysysList; + } + + + + StatusCode SysListHandle :: + foreach (const std::function<StatusCode(const CP::SystematicSet&)>& func) + { + assert (isInitialized()); + + for (const CP::SystematicSet& sys : systematicsVector()) + { + if (func (sys).isFailure()) + { + ANA_MSG_ERROR ("failed to evaluate algorithm for systematic " << sys.name()); + return StatusCode::FAILURE; + } + } + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysListType.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysListType.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c352f7aff01b453f98f6f12b628bf67d3b3ea633 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SysListType.cxx @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysListType.h> + +#include <string> + +// +// method implementations +// + +namespace CP +{ + const std::string& sysListDefaultName () + { + static const std::string result = "systematics"; + return result; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/CopyHelpers.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/CopyHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..c2eb45959410e9c270828132d1dc2da2ae38582f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/CopyHelpers.h @@ -0,0 +1,315 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__COPY_HELPERS_H +#define SYSTEMATICS_HANDLES__COPY_HELPERS_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/MessageCheck.h> +#include <AsgTools/StatusCode.h> +#include <xAODBase/IParticleContainer.h> +#include <xAODBase/IParticleHelpers.h> +#include <xAODCore/ShallowCopy.h> + +#include <memory> + +namespace CP +{ + namespace detail + { + /// \brief check what kind of object/container the argument is + template <typename T> + struct ContainerType + { + template <class, class> class checker; + + template <typename C> + static std::true_type test_iparticle(checker<C, decltype((*(const xAOD::IParticle**)nullptr) = ((C*)nullptr)->at(0))> *); + + template <typename C> + static std::false_type test_iparticle(...); + + template <typename C> + static std::true_type test_container(checker<C, decltype((*(const SG::AuxVectorBase**)nullptr) = ((C*)nullptr))>*); + + template <typename C> + static std::false_type test_container(...); + + /// Value evaluating to: + /// - 1 for xAOD::IParticleContainer types; + /// - 2 for other DataVector types; + /// - 3 for non-vector types. + static const int value = ( std::is_same< std::true_type, decltype( test_iparticle< T >( nullptr ) ) >::value ? + 1 : ( std::is_same< std::true_type, decltype( test_container< T >( nullptr ) ) >::value ? + 2 : 3 ) ); + }; + + /// \brief a helper class to create shallow copies and register + /// them in the event store + /// + /// The main purpose of this class is to make it (fairly) + /// straightforward to do partial specializations for base classes + /// which need special handling to register their objects with the + /// correct type. + template<typename T, int type = ContainerType<T>::value> + struct ShallowCopy + { + static_assert ((type==1)||(type==2)||(type==3), + "Type can not be shallow copied"); + }; + + template<typename T> + struct ShallowCopy<T,1> + { + /// \brief the type of the event store we use + public: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type + StoreType; + + static StatusCode + getCopy (MsgStream& msgStream, StoreType& store, + T*& object, const T *inputObject, + const std::string& outputName, const std::string& auxName) + { + // Define the msg(...) function as a lambda. + const auto msg = [&] (MSG::Level lvl) -> MsgStream& {msgStream << lvl; + return msgStream;}; + + // Make sure that we get a valid pointer. + assert (inputObject != nullptr); + + // Handle the case when the input object is a view container. + if( ! inputObject->getConstStore() ) { + + // Decide how to handle the container. + if( inputObject->size() ) { + // Get the pointer to the "owning container" from the first + // element. + const T* originContainer = + dynamic_cast< const T* >( ( *inputObject )[ 0 ]->container() ); + // Make sure that every element in the view container has the same + // parent. + for( size_t i = 1; i < inputObject->size(); ++i ) { + if( ( *inputObject )[ i ]->container() != originContainer ) { + ANA_MSG_ERROR( "Not all elements of the received view " + "container come from the same container!" ); + return StatusCode::FAILURE; + } + } + // Postfix for the shallow-copy container of the origin container. + static const char* ORIGIN_POSTFIX = "_ShallowCopyOrigin"; + // Make a shallow copy of the origin container. + auto originCopy = xAOD::shallowCopyContainer( *originContainer ); + if( ( ! originCopy.first ) || ( ! originCopy.second ) ) { + ANA_MSG_ERROR( "Failed to shallow copy the origin of a view " + << "container, meant for: " << outputName ); + return StatusCode::FAILURE; + } + // ...and record it. + ANA_CHECK( store.record( originCopy.first, + outputName + ORIGIN_POSTFIX ) ); + ANA_CHECK( store.record( originCopy.second, + outputName + ORIGIN_POSTFIX + "Aux." ) ); + // Make a view copy on top of it. + auto viewCopy = std::make_unique< T >( SG::VIEW_ELEMENTS ); + auto viewCopyPtr = viewCopy.get(); + for( const auto* element : *inputObject ) { + viewCopy->push_back( originCopy.first->at( element->index() ) ); + } + // Set the origin links on it. Note that + // xAOD::setOriginalObjectLink's "container version" doesn't work + // with view containers, we have to call this function one-by-one + // on the elements. + for( size_t i = 0; i < inputObject->size(); ++i ) { + if( ! xAOD::setOriginalObjectLink( *( ( *inputObject )[ i ] ), + *( ( *viewCopy )[ i ] ) ) ) { + return StatusCode::FAILURE; + } + } + // Finally, record the view container with the requested name. + ANA_CHECK( store.record( viewCopy.release(), outputName ) ); + // The copy is done. + object = viewCopyPtr; + return StatusCode::SUCCESS; + } else { + // If the container was empty, then let's just make a new empty + // container, and that's that... + auto viewCopy = std::make_unique< T >( SG::VIEW_ELEMENTS ); + auto viewCopyPtr = viewCopy.get(); + ANA_CHECK( store.record( viewCopy.release(), outputName ) ); + // The copy is done. + object = viewCopyPtr; + return StatusCode::SUCCESS; + } + + } else { + + // We can just copy the container as is. + auto copy = xAOD::shallowCopyContainer( *inputObject ); + if (!copy.first || !copy.second) + { + ANA_MSG_ERROR ("failed to shallow copy object: " << outputName); + ANA_MSG_ERROR ("likely shallow copying a view container"); + return StatusCode::FAILURE; + } + + if (!xAOD::setOriginalObjectLink (*inputObject, *copy.first)) { + return StatusCode::FAILURE; + } + + ANA_CHECK (store.record (copy.second, auxName)); + ANA_CHECK (store.record (copy.first, outputName)); + object = copy.first; + return StatusCode::SUCCESS; + } + } + }; + + template<typename T> + struct ShallowCopy<T,2> + { + /// \brief the type of the event store we use + public: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type + StoreType; + + static StatusCode + getCopy (MsgStream& msgStream, StoreType& store, + T*& object, const T *inputObject, + const std::string& outputName, const std::string& auxName) + { + // Define the msg(...) function as a lambda. + const auto msg = [&] (MSG::Level lvl) -> MsgStream& {msgStream << lvl; + return msgStream;}; + + // Make sure that we get a valid pointer. + assert (inputObject != nullptr); + + // Handle the case when the input object is a view container. + if( ! inputObject->getConstStore() ) { + + // Decide how to handle the container. + if( inputObject->size() ) { + // Get the pointer to the "owning container" from the first + // element. + const T* originContainer = + dynamic_cast< const T* >( ( *inputObject )[ 0 ]->container() ); + // Make sure that every element in the view container has the same + // parent. + for( size_t i = 1; i < inputObject->size(); ++i ) { + if( ( *inputObject )[ i ]->container() != originContainer ) { + ANA_MSG_ERROR( "Not all elements of the received view " + "container come from the same container!" ); + return StatusCode::FAILURE; + } + } + // Postfix for the shallow-copy container of the origin container. + static const char* ORIGIN_POSTFIX = "_ShallowCopyOrigin"; + // Make a shallow copy of the origin container. + auto originCopy = xAOD::shallowCopyContainer( *originContainer ); + if( ( ! originCopy.first ) || ( ! originCopy.second ) ) { + ANA_MSG_ERROR( "Failed to shallow copy the origin of a view " + << "container, meant for: " << outputName ); + return StatusCode::FAILURE; + } + // ...and record it. + ANA_CHECK( store.record( originCopy.first, + outputName + ORIGIN_POSTFIX ) ); + ANA_CHECK( store.record( originCopy.second, + outputName + ORIGIN_POSTFIX + + "Aux." ) ); + // Make a view copy on top of it. + auto viewCopy = std::make_unique< T >( SG::VIEW_ELEMENTS ); + auto viewCopyPtr = viewCopy.get(); + for( const auto* element : *inputObject ) { + viewCopy->push_back( originCopy.first->at( element->index() ) ); + } + // Finally, record the view container with the requested name. + ANA_CHECK( store.record( viewCopy.release(), outputName ) ); + // The copy is done. + object = viewCopyPtr; + return StatusCode::SUCCESS; + } else { + // If the container was empty, then let's just make a new empty + // container, and that's that... + auto viewCopy = std::make_unique< T >( SG::VIEW_ELEMENTS ); + auto viewCopyPtr = viewCopy.get(); + ANA_CHECK( store.record( viewCopy.release(), outputName ) ); + // The copy is done. + object = viewCopyPtr; + return StatusCode::SUCCESS; + } + + } else { + + // We can just copy the container as is. + auto copy = xAOD::shallowCopyContainer( *inputObject ); + if (!copy.first || !copy.second) + { + ANA_MSG_ERROR ("failed to shallow copy object: " << outputName); + ANA_MSG_ERROR ("likely shallow copying a view container"); + return StatusCode::FAILURE; + } + + ANA_CHECK (store.record (copy.second, auxName)); + ANA_CHECK (store.record (copy.first, outputName)); + object = copy.first; + return StatusCode::SUCCESS; + } + } + }; + + template<typename T> + struct ShallowCopy<T,3> + { + /// \brief the type of the event store we use + public: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type + StoreType; + + static StatusCode + getCopy (MsgStream& msgStream, StoreType& store, + T*& object, const T *inputObject, + const std::string& outputName, const std::string& auxName) + { + // Define the msg(...) function as a lambda. + const auto msg = [&] (MSG::Level lvl) -> MsgStream& {msgStream << lvl; + return msgStream;}; + + // We can just copy the object as is. + auto copy = xAOD::shallowCopyObject( *inputObject ); + if (!copy.first || !copy.second) + { + ANA_MSG_ERROR ("failed to shallow copy object: " << outputName); + ANA_MSG_ERROR ("likely shallow copying a view container"); + return StatusCode::FAILURE; + } + + ANA_CHECK (store.record (copy.second, auxName)); + ANA_CHECK (store.record (copy.first, outputName)); + object = copy.first; + return StatusCode::SUCCESS; + } + }; + + template<> + struct ShallowCopy<xAOD::IParticleContainer> + { + /// \brief the type of the event store we use + public: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type StoreType; + + static StatusCode + getCopy (MsgStream& msgStream, StoreType& store, + xAOD::IParticleContainer*& object, + const xAOD::IParticleContainer *inputObject, + const std::string& outputName, const std::string& auxName); + }; + } +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/Helpers.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/Helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..702564bf452c0c16bf56e43eb36aaed2f0998b5f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/Helpers.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__HELPERS_H +#define SYSTEMATICS_HANDLES__HELPERS_H + +#include <string> + +namespace CP +{ + class SystematicSet; + + /// \brief nominal systematics name + std::string nominalSystematicsName (); + + + /// \brief make the name for the given systematics + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory II + std::string makeSystematicsName (const std::string& name, + const CP::SystematicSet& sys); + + + /// \brief make the name for the given systematics, filtered for + /// the given affecting pattern + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory II + std::string makeSystematicsName (const std::string& name, + const std::string& affecting, + const CP::SystematicSet& sys); +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/ISysHandleBase.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/ISysHandleBase.h new file mode 100644 index 0000000000000000000000000000000000000000..8aeb9efaa51d833324d62f1a623ab97075acf90e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/ISysHandleBase.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__I_SYS_HANDLE_BASE_H +#define SYSTEMATICS_HANDLES__I_SYS_HANDLE_BASE_H + +#include <string> + +namespace CP +{ + /// \brief a basic interface for all systematics handles + /// + /// This is used by \ref SysListHandle to communicate with the + /// individual data handles. + + class ISysHandleBase + { + /// \brief standard (virtual) destructor + public: + virtual ~ISysHandleBase () noexcept = default; + + /// \brief get the regular expression for the affecting + /// systematics if this is an input handle + /// + /// This returns the empty string if this is either not an input + /// handle, or if the input handle is not affected by systematics. + /// + /// This should only be called inside execute(), not initialize(), + /// to allow upgrades to reading the affecting systematics from + /// the event store. + public: + virtual std::string getInputAffecting () const = 0; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysCopyHandle.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysCopyHandle.h new file mode 100644 index 0000000000000000000000000000000000000000..7f7e5f62705e922410d366cb6ead68fe31ecf60b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysCopyHandle.h @@ -0,0 +1,110 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__SYS_COPY_HANDLE_H +#define SYSTEMATICS_HANDLES__SYS_COPY_HANDLE_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgMessagingForward.h> +#include <PATInterfaces/SystematicSet.h> +#include <SystematicsHandles/ISysHandleBase.h> +#include <string> +#include <tuple> +#include <unordered_map> + +class StatusCode; + +namespace CP +{ + class SystematicSet; + + /// \brief a data handle for copying systematics varied input data + + template<typename T> class SysCopyHandle final + : public ISysHandleBase, public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + public: + template<typename T2> + SysCopyHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription); + + + /// \brief whether we have a name configured + public: + bool empty () const noexcept; + + /// \brief !empty() + public: + explicit operator bool () const noexcept; + + + /// \brief retrieve the object for the given name + public: + ::StatusCode getCopy (T*& object, + const CP::SystematicSet& sys) const; + + + + // + // inherited interface + // + + public: + virtual std::string getInputAffecting () const override; + + + + // + // private interface + // + + /// \brief the input name we use + private: + std::string m_inputName; + + /// \brief the regular expression for affecting systematics + private: + std::string m_affectingRegex {".*"}; + + /// \brief the output name we use + private: + std::string m_outputName; + + /// \brief the cache of names we use + private: + mutable std::unordered_map<CP::SystematicSet,std::tuple<std::string,std::string,std::string> > m_nameCache; + + + /// \brief the type of the event store we use + private: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type StoreType; + + /// \brief the event store we use + private: + mutable StoreType *m_evtStore = nullptr; + + /// \brief the function to retrieve the event store + /// + /// This is an std::function to allow the parent to be either a + /// tool or an algorithm. Though we are not really supporting + /// tools as parents when using \ref SysListHandle, so in + /// principle this could be replaced with a pointer to the + /// algorithm instead. + private: + std::function<StoreType*()> m_evtStoreGetter; + }; +} + +#include "SysCopyHandle.icc" + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysCopyHandle.icc b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysCopyHandle.icc new file mode 100644 index 0000000000000000000000000000000000000000..e41dd1c55ca1af023168ac5525cfddab231d3101 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysCopyHandle.icc @@ -0,0 +1,95 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgTools/MessageCheck.h> +#include <SystematicsHandles/CopyHelpers.h> +#include <SystematicsHandles/Helpers.h> + +// +// method implementations +// + +namespace CP +{ + template<typename T> template<typename T2> SysCopyHandle<T> :: + SysCopyHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription) + : AsgMessagingForward (owner), m_inputName (propertyValue) + , m_evtStoreGetter ([owner] () {return &*owner->evtStore();}) + { + owner->declareProperty (propertyName, m_inputName, propertyDescription); + owner->declareProperty (propertyName + "Regex", m_affectingRegex, "affecting systematics for " + propertyDescription); + owner->declareProperty (propertyName + "Out", m_outputName, "name to which to copy " + propertyName); + } + + + + template<typename T> bool SysCopyHandle<T> :: + empty () const noexcept + { + return m_inputName.empty(); + } + + + + template<typename T> SysCopyHandle<T> :: + operator bool () const noexcept + { + return !m_inputName.empty(); + } + + + + template<typename T> ::StatusCode SysCopyHandle<T> :: + getCopy (T*& object, const CP::SystematicSet& sys) const + { + auto cache = m_nameCache.find (sys); + if (cache == m_nameCache.end()) + { + std::string inputName = makeSystematicsName (m_inputName, m_affectingRegex, sys); + std::string outputName = makeSystematicsName (m_outputName, sys); + ANA_MSG_DEBUG ("SysCopyHandle: " << inputName << " -> " << outputName << " (" << sys.name() << ")"); + m_nameCache.insert (std::make_pair (sys, std::make_tuple (inputName, outputName, outputName+"Aux."))); + cache = m_nameCache.find (sys); + assert (cache != m_nameCache.end()); + if (!m_evtStore) + m_evtStore = m_evtStoreGetter(); + } + assert (m_evtStore); + if (std::get<1>(cache->second).empty()) + { + // if no output name is configured, act like an update handle + return m_evtStore->retrieve (object, std::get<0>(cache->second)); + } else + { + // if an output name is configured, retrieve the input object as + // a const object, (shallow) copy it, record the copy and return + // it. + + const T *inputObject = nullptr; + if (m_evtStore->retrieve (inputObject, std::get<0>(cache->second)).isFailure()) + return StatusCode::FAILURE; + + return detail::ShallowCopy<T>::getCopy + (msg(), *m_evtStore, object, inputObject, + std::get<1>(cache->second), std::get<2>(cache->second)); + } + } + + + + template<typename T> std::string SysCopyHandle<T> :: + getInputAffecting () const + { + return m_affectingRegex; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysDecorationHandle.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysDecorationHandle.h new file mode 100644 index 0000000000000000000000000000000000000000..5c736c3aaf41a9b2b2f690b12a0d018aede58a77 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysDecorationHandle.h @@ -0,0 +1,134 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__SYS_DECORATION_HANDLE_H +#define SYSTEMATICS_HANDLES__SYS_DECORATION_HANDLE_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgMessagingForward.h> +#include <AthContainers/AuxElement.h> +#include <PATInterfaces/SystematicSet.h> +#include <SystematicsHandles/ISysHandleBase.h> +#include <SystematicsHandles/SysListHandle.h> +#include <string> +#include <type_traits> +#include <unordered_map> + +class StatusCode; + +namespace CP +{ + class SystematicSet; + + /// \brief the decoration value to use if there is no valid scale + /// factor decoration + constexpr float invalidScaleFactor () {return -1;} + + /// \brief the decoration value to use if there is no valid + /// efficiency decoration + constexpr float invalidEfficiency () {return -1;} + + + /// \brief a data handle for reading systematics varied input data + + template<typename T> class SysDecorationHandle final + : public ISysHandleBase, public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + public: + template<typename T2> + SysDecorationHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription); + + + /// \brief register a set of used systematics for in the current + /// execut call (usually obtained from \ref CP::SystListHandle) + public: + StatusCode preExecute (SysListHandle &systematics); + + + /// \brief whether \ref preExecute has been called successfully at least once + public: + bool isPrepared () const noexcept; + + + /// \brief whether we have a name configured + public: + bool empty () const noexcept; + + /// \brief !empty() + public: + explicit operator bool () const noexcept; + + + /// \brief get the name we retrieve from the event store + public: + const std::string& getName (const CP::SystematicSet& sys) const; + + + /// \brief retrieve the object decoration for the given systematic + public: + const T& get (const SG::AuxElement& object, + const CP::SystematicSet& sys) const; + + /// \brief check if the object decoration is available + public: + bool isAvailable (const SG::AuxElement& object, + const CP::SystematicSet& sys) const; + + + /// \brief set the object decoration for the given systematic + public: + void set (SG::AuxElement& object, const T& value, + const CP::SystematicSet& sys) const; + + + + // + // inherited interface + // + + public: + virtual std::string getInputAffecting () const override; + + + + // + // private interface + // + + /// \brief the value of \ref isPrepared + private: + bool m_isPrepared{false}; + + /// \brief the input name we use + private: + std::string m_inputName; + + /// \brief the regular expression for affecting systematics + private: + std::string m_affectingRegex {".*"}; + + /// \brief the cache of names we use + private: + mutable std::unordered_map<CP::SystematicSet,std::tuple<std::string,SG::AuxElement::ConstAccessor<T>,SG::AuxElement::Accessor<T> > > m_dataCache; + + /// \brief get the data for the given systematics + private: + const std::tuple<std::string,SG::AuxElement::ConstAccessor<T>,SG::AuxElement::Accessor<T> >& + getData (const CP::SystematicSet& sys) const; + }; +} + +#include "SysDecorationHandle.icc" + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysDecorationHandle.icc b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysDecorationHandle.icc new file mode 100644 index 0000000000000000000000000000000000000000..13a59deed6ecdfac643b907c3b40cab0634437d8 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysDecorationHandle.icc @@ -0,0 +1,152 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgTools/MessageCheck.h> +#include <AsgTools/StatusCode.h> +#include <SystematicsHandles/Helpers.h> + +#include <regex> + +// +// method implementations +// + +namespace CP +{ + template<typename T> template<typename T2> SysDecorationHandle<T> :: + SysDecorationHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription) + : AsgMessagingForward (owner), m_inputName (propertyValue) + { + owner->declareProperty (propertyName, m_inputName, propertyDescription); + owner->declareProperty (propertyName + "Regex", m_affectingRegex, "affecting systematics for " + propertyDescription); + } + + + + template<typename T> ::StatusCode SysDecorationHandle<T> :: + preExecute (SysListHandle &systematics) + { + if (isPrepared()) + { + return StatusCode::SUCCESS; + } + + ANA_CHECK (systematics.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode + { + getData (sys); + return StatusCode::SUCCESS; + })); + + m_isPrepared = true; + + return StatusCode::SUCCESS; + } + + + + template<typename T> inline bool SysDecorationHandle<T> :: + isPrepared () const noexcept + { + return m_isPrepared; + } + + + + template<typename T> bool SysDecorationHandle<T> :: + empty () const noexcept + { + return m_inputName.empty(); + } + + + + template<typename T> SysDecorationHandle<T> :: + operator bool () const noexcept + { + return !m_inputName.empty(); + } + + + + template<typename T> const std::string& SysDecorationHandle<T> :: + getName (const CP::SystematicSet& sys) const + { + assert (isPrepared()); + + const auto& data = getData (sys); + return std::get<0> (data); + } + + + + template<typename T> const T& SysDecorationHandle<T> :: + get (const SG::AuxElement& object, + const CP::SystematicSet& sys) const + { + assert (isPrepared()); + + const auto& data = getData (sys); + return std::get<1> (data) (object); + } + + + + template<typename T> bool SysDecorationHandle<T> :: + isAvailable (const SG::AuxElement& object, + const CP::SystematicSet& sys) const + { + assert (isPrepared()); + + const auto& data = getData (sys); + return std::get<1> (data).isAvailable(object); + } + + + + template<typename T> void SysDecorationHandle<T> :: + set (SG::AuxElement& object, const T& value, + const CP::SystematicSet& sys) const + { + assert (isPrepared()); + + const auto& data = getData (sys); + std::get<2> (data) (object) = value; + } + + + + template<typename T> std::string SysDecorationHandle<T> :: + getInputAffecting () const + { + return m_affectingRegex; + } + + + + template<typename T> const std::tuple<std::string,SG::AuxElement::ConstAccessor<T>,SG::AuxElement::Accessor<T> >& + SysDecorationHandle<T> :: + getData (const CP::SystematicSet& sys) const + { + auto cache = m_dataCache.find (sys); + if (cache == m_dataCache.end()) + { + std::string newName = makeSystematicsName + (m_inputName, m_affectingRegex, sys); + ANA_MSG_DEBUG ("SysDecorationHandle: " << newName << " (" << sys.name() << ")"); + m_dataCache.insert (std::make_pair (sys, std::make_tuple (newName, newName, newName))); + cache = m_dataCache.find (sys); + assert (cache != m_dataCache.end()); + } + return cache->second; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporter.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporter.h new file mode 100644 index 0000000000000000000000000000000000000000..57042a5feccd307a77b4dfdd250610cc2e34a9b1 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporter.h @@ -0,0 +1,96 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef SYSTEMATICS_HANDLES__FILTER_REPORTER_H +#define SYSTEMATICS_HANDLES__FILTER_REPORTER_H + +#include <AsgMessaging/AsgMessagingForward.h> +#include <xAODEventInfo/EventInfo.h> + +namespace CP +{ + class SysFilterReporterCombiner; + class SystematicSet; + + /// \brief a systematics aware filter reporter + /// + /// In order to ensure that the filter decision will always be set + /// as part of `execute()`, this reporter class should be used like + /// this: + /// + /// ``` + /// StatusCode Foo::execute() + /// { + /// ... + /// static constexpr bool DEFAULT_DECISION = false; + /// SysFilterReporterCombiner filterCombiner + /// (m_filterParams, m_systematicsList, DEFAULT_DECISION); + /// + /// return m_systematicsList.foreach ([&](const CP::SystematicSet &sys) -> StatusCode { + /// SysFilterReporter filter (filterCombiner, sys); + /// ... + /// filter.setPassed (); + /// return StatusCode::SUCCESS; + /// }); + /// } + /// ``` + + class SysFilterReporter final : public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory I + public: + SysFilterReporter (SysFilterReporterCombiner& val_combiner, + const SystematicSet& val_sys); + + + /// \brief standard destructor + /// \par Guarantee + /// no-fail + public: + ~SysFilterReporter () noexcept; + + + /// \brief report the filter decision + /// \par Guarantee + /// no-fail + public: + void setPassed (bool val_passed = true) noexcept; + + + + // + // private interface + // + + /// \brief the \ref SysFilterReporterParams object + private: + SysFilterReporterCombiner& m_combiner; + + /// \brief the \ref SystematicSet object we use + private: + const SystematicSet& m_sys; + + /// \brief the event info object we are decorating + private: + xAOD::EventInfo *m_eventInfo {nullptr}; + + /// \brief the value of passed we will set + private: + bool m_passed {false}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporterCombiner.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporterCombiner.h new file mode 100644 index 0000000000000000000000000000000000000000..481ee7be7ca85eedf90f3269e059946abf35d400 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporterCombiner.h @@ -0,0 +1,81 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef SYSTEMATICS_HANDLES__FILTER_REPORTER_COMBINER_H +#define SYSTEMATICS_HANDLES__FILTER_REPORTER_COMBINER_H + +#include <AsgMessaging/AsgMessagingForward.h> + +class EventContext; + +namespace CP +{ + class SysFilterReporterParams; + class SysListHandle; + + + /// \brief a reporter class that combines the filter decisions for + /// all systematics + /// + /// Unlike the non-systematics aware version, when dealing with + /// systematics we need to combine all the individual filter + /// decisions into an overall filter decision for the algorithm, + /// i.e. if and only if the filter decision fails for all + /// systematics we should set filter to failed for the algorithm + /// itself, so that we avoid/skip processing of subsequent + /// algorithms. For details on usage see \ref SysFilterReporter. + + class SysFilterReporterCombiner final : public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory I + public: + SysFilterReporterCombiner (SysFilterReporterParams& val_params, + SysListHandle& systematicsList, + bool val_passedDefault); + + + /// \brief standard destructor + /// \par Guarantee + /// no-fail + public: + ~SysFilterReporterCombiner () noexcept; + + + + // + // private interface + // + + // this class does most of the actual work and acts as accessor to + // our private data members, and needs our internals for that. + friend class SysFilterReporter; + + /// \brief the \ref SysFilterReporterParams object + private: + SysFilterReporterParams& m_params; + + /// \brief the default value of passed we use for each individual reporter + private: + bool m_passedDefault {false}; + + /// \brief whether we passed for at least one/all systematics + private: + bool m_passedOne {false}; + bool m_passedAll {true}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporterParams.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporterParams.h new file mode 100644 index 0000000000000000000000000000000000000000..f73c74500627915b1ed40e0114053503a95dfda5 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysFilterReporterParams.h @@ -0,0 +1,156 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef SYSTEMATICS_HANDLES__FILTER_REPORTER_PARAMS_H +#define SYSTEMATICS_HANDLES__FILTER_REPORTER_PARAMS_H + +#include <AsgMessaging/AsgMessagingForward.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <xAODEventInfo/EventInfo.h> +#include <functional> + +#ifndef XAOD_STANDALONE +#include <AthenaKernel/ICutFlowSvc.h> +#include <GaudiKernel/ServiceHandle.h> +#endif + +class StatusCode; + +namespace CP +{ + /// \brief the properties and persistent data for systematics aware + /// filter reporters + /// + /// This is a systematics-aware version of the \ref + /// EL::FilterReporter mechanism. This is somewhat more + /// complicated, since there is per-systematics filter decisions and + /// an overall event-level filter decision, for details see \ref + /// SysFilterReporter. + + class SysFilterReporterParams final : public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + /// \par Guarantee + /// strong + /// \par Failures + /// out of memory I + public: + template<typename T> + explicit SysFilterReporterParams (T *owner, std::string val_filterDescription); + + + /// \brief do anything we need to do in initialize + /// \par Guarantee + /// strong + /// \par Failures + /// configuration/initialization errors + public: + StatusCode initialize (); + + + /// \brief do anything we need to do in finalize + /// \par Guarantee + /// strong + /// \par Failures + /// finalization errors + public: + StatusCode finalize (); + + + + // + // private interface + // + + // this class does most of the actual work and acts as accessor to + // our private data members, and needs our internals for that. + friend class SysFilterReporterCombiner; + friend class SysFilterReporter; + + /// \brief the function to call setFilterPassed() on the algorithm + /// + /// This is using a `std::function` object, so as to avoid tying + /// this to a particular algorithm class. + private: + std::function<void(bool)> m_setFilterPassed; + + /// \brief the event info we run on + private: + SysCopyHandle<xAOD::EventInfo> m_eventInfoHandle; + + /// \brief the decoration for writing the event decision + private: + SysDecorationHandle<char> m_eventDecisionOutputDecoration; + + /// \brief counter for passed events + private: + unsigned m_passedOne {0}; + unsigned m_passedNominal {0}; + unsigned m_passedAll {0}; + + /// \brief counter for total events + private: + unsigned m_total {0}; + + /// \brief whether the handle was initialized + private: + bool m_isInitialized {false}; + + /// \brief description what this filter does + private: + std::string m_filterDescription; + + +#ifndef XAOD_STANDALONE + + /// \brief the \ref CutIdentifier for this filter algorithm + private: + CutIdentifier m_cutID; + + /// \brief the handle to the service holding tables of cut-flows + /// for filtering algs. + private: + ServiceHandle<ICutFlowSvc> m_cutFlowSvc; + +#endif + }; + + + + // + // inline/template methods + // + + template<typename T> SysFilterReporterParams :: + SysFilterReporterParams (T *owner, std::string val_filterDescription) + : AsgMessagingForward (owner) + , m_setFilterPassed ([owner] (bool val_setFilterPassed) {owner->setFilterPassed (val_setFilterPassed);}) + , m_eventInfoHandle (owner, "eventInfo", "EventInfo", "the event info object to run on") + , m_eventDecisionOutputDecoration (owner, "eventDecisionOutputDecoration", "", "the decoration for the event decision") + , m_filterDescription (std::move (val_filterDescription)) +#ifndef XAOD_STANDALONE + , m_cutFlowSvc ("CutFlowSvc/CutFlowSvc", owner->name()) +#endif + { + owner->declareProperty("FilterDescription", m_filterDescription, + "describe to the cutflowsvc what this filter does."); + +#ifndef XAOD_STANDALONE + owner->declareProperty("CutFlowSvc", m_cutFlowSvc, + "handle to the ICutFlowSvc instance this filtering algorithm" + " will use for building the flow of cuts."); +#endif + } +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListHandle.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListHandle.h new file mode 100644 index 0000000000000000000000000000000000000000..53ec9d7a325a7c329637ad0b715b528836274d7a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListHandle.h @@ -0,0 +1,161 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__SYS_LIST_HANDLE_H +#define SYSTEMATICS_HANDLES__SYS_LIST_HANDLE_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgMessagingForward.h> +#include <PATInterfaces/SystematicSet.h> +#include <SystematicsHandles/SysListType.h> +#include <functional> +#include <string> +#include <vector> +#include <unordered_set> + +class StatusCode; + +namespace CP +{ + class ISysHandleBase; + class SystematicSet; + + /// \brief a class managing the property to configure the list of + /// systematics to process + + class SysListHandle : public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + public: + template<typename T> + SysListHandle (T *owner, const std::string& propertyName = "systematics", + const std::string& propertyDescription = "list of systematics to evaluate"); + + + /// \brief register an input handle we are using + /// + /// This is currently a no-op, but it could be useful for a + /// variety of future directions we could take the systematics + /// handling. + /// + /// \pre !isInitialized() + public: + void addHandle (ISysHandleBase& handle); + + + /// \brief register a set of affecting variables for the current + /// algorithm (usually obtained from an \ref CP::ISystematicsTool) + /// + /// This is currently a no-op, but it could be useful for a + /// variety of future directions we could take the systematics + /// handling (or at least as a cross check of those). + /// + /// \pre !isInitialized() + public: + StatusCode addAffectingSystematics + (const CP::SystematicSet& affectingSystematics); + + + /// \brief intialize this property + /// + /// This should be called exactly once during initialize of the + /// owning algorithm. + public: + ::StatusCode initialize (); + + + /// \brief whether \ref initialize has been called successfully + public: + bool isInitialized () const noexcept; + + + /// \brief the list of systematics to loop over + public: + std::unordered_set<CP::SystematicSet> systematicsVector (); + + + /// \brief run the function for each systematic + /// + /// This allows to perform some amount of behind-the-scenes + /// optimizations in the future, which hopefully not creating too + /// many issues in the present. + /// + /// Technically this would be slightly more performant as a + /// template, but this is likely not to be an issue, and can still + /// be changed if it ever becomes an issue. + /// + /// Ideally this would be const, but the current version is not + /// thread-safe, so I'd rather not add a const qualifier to it. + /// + /// \par Guarantee + /// basic + /// \par Failures + /// function failures + /// \pre isInitialized() + public: + StatusCode foreach + (const std::function<StatusCode(const CP::SystematicSet&)>& func); + + + + // + // private interface + // + + /// \brief the name under which the systematics list is stored in + /// the event store + private: + std::string m_systematicsListName {"systematics"}; + + /// \brief the regular expression for affecting systematics + private: + std::string m_affectingRegex {"^$"}; + + /// \brief the full affecting systematics including the inputs + private: + std::string m_fullAffecting; + + /// \brief the cache of affecting filtered systematics + private: + std::unordered_map<CP::SystematicSet,CP::SystematicSet> m_affectingCache; + + /// \brief the list of systematics handles we have + private: + std::vector<ISysHandleBase*> m_sysHandles; + + /// \brief the value of \ref isInitialized + private: + bool m_isInitialized = false; + + + /// \brief the type of the event store we use + private: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type StoreType; + + /// \brief the event store we use + private: + mutable StoreType *m_evtStore = nullptr; + + /// \brief the function to retrieve the event store + /// + /// This is an std::function to allow the parent to be either a + /// tool or an algorithm. Though we are not really supporting + /// tools as parents when using \ref SysListHandle, so in + /// principle this could be replaced with a pointer to the + /// algorithm instead. + private: + std::function<StoreType*()> m_evtStoreGetter; + }; +} + +#include "SysListHandle.icc" + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListHandle.icc b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListHandle.icc new file mode 100644 index 0000000000000000000000000000000000000000..753fc7c9905ec37c860f4d76a4d78c0ba14a5fdf --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListHandle.icc @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <cassert> + +// +// method implementations +// + +namespace CP +{ + template<typename T> SysListHandle :: + SysListHandle (T *owner, const std::string& propertyName, + const std::string& propertyDescription) + : AsgMessagingForward (owner) + , m_evtStoreGetter ([owner] () {return &*owner->evtStore();}) + { + owner->declareProperty (propertyName, m_systematicsListName, + propertyDescription); + owner->declareProperty (propertyName + "Regex", m_affectingRegex, "affecting systematics for " + propertyDescription); + } + + + + inline bool SysListHandle :: + isInitialized () const noexcept + { + return m_isInitialized; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListType.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListType.h new file mode 100644 index 0000000000000000000000000000000000000000..57f7c8705b4d418d15af1509610130fd27aef766 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysListType.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__SYS_LIST_TYPE_H +#define SYSTEMATICS_HANDLES__SYS_LIST_TYPE_H + +#include <string> +#include <vector> +#include <AsgTools/CLASS_DEF.h> + +namespace CP +{ + class SystematicSet; +} + +CLASS_DEF( std::vector<CP::SystematicSet> , 79952367 , 1 ) + +namespace CP +{ + /// \brief the type for the systematics list in the event store + /// + /// For now this is just a vector of SystematicSet, but I made a + /// typedef for this as I am not sure this will necessarily be + /// performant in all situations. This way at least I will get + /// compilation errors if I change it. + typedef std::vector<CP::SystematicSet> SysListType; + + /// \brief the default name for putting the systematics list into + /// the event store + const std::string& sysListDefaultName (); +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandle.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandle.h new file mode 100644 index 0000000000000000000000000000000000000000..ae7c304c77fea2f4a96e6b83e282b833a198a1e1 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandle.h @@ -0,0 +1,111 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__SYS_READ_HANDLE_H +#define SYSTEMATICS_HANDLES__SYS_READ_HANDLE_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgMessagingForward.h> +#include <PATInterfaces/SystematicSet.h> +#include <SystematicsHandles/ISysHandleBase.h> +#include <string> +#include <type_traits> +#include <unordered_map> + +class StatusCode; + +namespace CP +{ + class SystematicSet; + + /// \brief a data handle for reading systematics varied input data + + template<typename T> class SysReadHandle final + : public ISysHandleBase, public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + public: + template<typename T2> + SysReadHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription); + + + /// \brief whether we have a name configured + public: + bool empty () const noexcept; + + /// \brief !empty() + public: + explicit operator bool () const noexcept; + + + /// \brief get the name we retrieve from the event store + public: + const std::string& getName (const CP::SystematicSet& sys) const; + + + /// \brief retrieve the object for the given name + public: + ::StatusCode retrieve (const T*& object, + const CP::SystematicSet& sys) const; + + + + // + // inherited interface + // + + public: + virtual std::string getInputAffecting () const override; + + + + // + // private interface + // + + /// \brief the input name we use + private: + std::string m_inputName; + + /// \brief the regular expression for affecting systematics + private: + std::string m_affectingRegex {".*"}; + + /// \brief the cache of names we use + private: + mutable std::unordered_map<CP::SystematicSet,std::string> m_inputNameCache; + + + /// \brief the type of the event store we use + private: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type StoreType; + + /// \brief the event store we use + private: + mutable StoreType *m_evtStore = nullptr; + + /// \brief the function to retrieve the event store + /// + /// This is an std::function to allow the parent to be either a + /// tool or an algorithm. Though we are not really supporting + /// tools as parents when using \ref SysListHandle, so in + /// principle this could be replaced with a pointer to the + /// algorithm instead. + private: + std::function<StoreType*()> m_evtStoreGetter; + }; +} + +#include "SysReadHandle.icc" + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandle.icc b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandle.icc new file mode 100644 index 0000000000000000000000000000000000000000..690580cc971379baad805984ccf345cc1a4970e9 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandle.icc @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgTools/MessageCheck.h> +#include <AsgTools/StatusCode.h> +#include <SystematicsHandles/Helpers.h> + +// +// method implementations +// + +namespace CP +{ + template<typename T> template<typename T2> SysReadHandle<T> :: + SysReadHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription) + : AsgMessagingForward (owner), m_inputName (propertyValue) + , m_evtStoreGetter ([owner] () {return &*owner->evtStore();}) + { + owner->declareProperty (propertyName, m_inputName, propertyDescription); + owner->declareProperty (propertyName + "Regex", m_affectingRegex, "affecting systematics for " + propertyDescription); + } + + + + template<typename T> bool SysReadHandle<T> :: + empty () const noexcept + { + return m_inputName.empty(); + } + + + + template<typename T> SysReadHandle<T> :: + operator bool () const noexcept + { + return !m_inputName.empty(); + } + + + + template<typename T> const std::string& SysReadHandle<T> :: + getName (const CP::SystematicSet& sys) const + { + auto cache = m_inputNameCache.find (sys); + if (cache == m_inputNameCache.end()) + { + std::string newName = makeSystematicsName + (m_inputName, m_affectingRegex, sys); + ANA_MSG_DEBUG ("SysReadHandle: " << newName << " (" << sys.name() << ")"); + m_inputNameCache.insert (std::make_pair (sys, newName)); + cache = m_inputNameCache.find (sys); + assert (cache != m_inputNameCache.end()); + + // retrieving this here, just so it exists + if (!m_evtStore) + m_evtStore = m_evtStoreGetter(); + } + return cache->second; + } + + + + template<typename T> ::StatusCode SysReadHandle<T> :: + retrieve (const T*& object, const CP::SystematicSet& sys) const + { + const std::string& name = getName (sys); + assert (m_evtStore); + return m_evtStore->retrieve (object, name); + } + + + + template<typename T> std::string SysReadHandle<T> :: + getInputAffecting () const + { + return m_affectingRegex; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandleArray.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandleArray.h new file mode 100644 index 0000000000000000000000000000000000000000..614541e0cf96dd3da47b3a790266be34487c7985 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandleArray.h @@ -0,0 +1,123 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__SYS_READ_HANDLE_ARRAY_H +#define SYSTEMATICS_HANDLES__SYS_READ_HANDLE_ARRAY_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgMessagingForward.h> +#include <PATInterfaces/SystematicSet.h> +#include <SystematicsHandles/ISysHandleBase.h> +#include <boost/functional/hash.hpp> +#include <string> +#include <type_traits> +#include <unordered_map> + +class StatusCode; + +namespace CP +{ + class SystematicSet; + + /// \brief a data handle for reading systematics varied input data + + template<typename T> class SysReadHandleArray final + : public ISysHandleBase, public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + public: + template<typename T2> + SysReadHandleArray (T2 *owner, const std::string& propertyName, + const std::string& propertyDescription); + + + /// \brief initialize this data handle + public: + StatusCode initialize (); + + + /// \brief the number of read objects configured + public: + std::size_t size () const noexcept; + + + /// \brief get the name we retrieve from the event store + public: + const std::string& getName (const CP::SystematicSet& sys, + std::size_t index) const; + + + /// \brief retrieve the object for the given name + public: + ::StatusCode retrieve (const T*& object, + const CP::SystematicSet& sys, + std::size_t index) const; + + + + // + // inherited interface + // + + public: + virtual std::string getInputAffecting () const override; + + + + // + // private interface + // + + /// \brief the name of the property we configured + private: + std::string m_propertyName; + + /// \brief whether we have been initialized + private: + bool m_isInitialized {false}; + + + /// \brief the input name we use + private: + std::vector<std::string> m_inputName; + + /// \brief the regular expression for affecting systematics + private: + std::vector<std::string> m_affectingRegex; + + /// \brief the cache of names we use + private: + mutable std::unordered_map<std::pair<CP::SystematicSet,std::size_t>,std::string,boost::hash<std::pair<CP::SystematicSet,std::size_t>>> m_inputNameCache; + + + /// \brief the type of the event store we use + private: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type StoreType; + + /// \brief the event store we use + private: + mutable StoreType *m_evtStore = nullptr; + + /// \brief the function to retrieve the event store + /// + /// This is an std::function to allow the parent to be either a + /// tool or an algorithm. Though we are not really supporting + /// tools as parents when using \ref SysListHandle, so in + /// principle this could be replaced with a pointer to the + /// algorithm instead. + private: + std::function<StoreType*()> m_evtStoreGetter; + }; +} + +#include "SysReadHandleArray.icc" + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandleArray.icc b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandleArray.icc new file mode 100644 index 0000000000000000000000000000000000000000..89cbde7909719e76e745ac27a27947b89d8d36fd --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysReadHandleArray.icc @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgTools/MessageCheck.h> +#include <AsgTools/StatusCode.h> +#include <SystematicsHandles/Helpers.h> + +// +// method implementations +// + +namespace CP +{ + template<typename T> template<typename T2> SysReadHandleArray<T> :: + SysReadHandleArray (T2 *owner, const std::string& propertyName, + const std::string& propertyDescription) + : AsgMessagingForward (owner) + , m_propertyName (propertyName) + , m_evtStoreGetter ([owner] () {return &*owner->evtStore();}) + { + owner->declareProperty (propertyName, m_inputName, propertyDescription); + owner->declareProperty (propertyName + "Regex", m_affectingRegex, "affecting systematics for " + propertyDescription); + } + + + + template<typename T> StatusCode SysReadHandleArray<T> :: + initialize () + { + assert (m_isInitialized == false); + if (m_inputName.size() != m_affectingRegex.size()) + { + ANA_MSG_ERROR ("array sizes for property " << m_propertyName << " and " << m_propertyName << "Regex do not match"); + return StatusCode::FAILURE; + } + m_isInitialized = true; + return StatusCode::SUCCESS; + } + + + + template<typename T> std::size_t SysReadHandleArray<T> :: + size () const noexcept + { + assert (m_isInitialized); + return m_inputName.size(); + } + + + + template<typename T> const std::string& SysReadHandleArray<T> :: + getName (const CP::SystematicSet& sys, + std::size_t index) const + { + assert (m_isInitialized); + assert (index < size()); + auto cache = m_inputNameCache.find (std::make_pair (sys, index)); + if (cache == m_inputNameCache.end()) + { + std::string newName = makeSystematicsName + (m_inputName[index], m_affectingRegex[index], sys); + ANA_MSG_DEBUG ("SysReadHandleArray: " << newName << " (" << sys.name() << ")"); + m_inputNameCache.insert (std::make_pair (std::make_pair (sys, index), newName)); + cache = m_inputNameCache.find (std::make_pair (sys, index)); + assert (cache != m_inputNameCache.end()); + + // retrieving this here, just so it exists + if (!m_evtStore) + m_evtStore = m_evtStoreGetter(); + } + return cache->second; + } + + + + template<typename T> ::StatusCode SysReadHandleArray<T> :: + retrieve (const T*& object, const CP::SystematicSet& sys, + std::size_t index) const + { + assert (m_isInitialized); + assert (index < size()); + const std::string& name = getName (sys, index); + assert (m_evtStore); + return m_evtStore->retrieve (object, name); + } + + + + template<typename T> std::string SysReadHandleArray<T> :: + getInputAffecting () const + { + assert (m_isInitialized); + std::string result; + for (const std::string& regex : m_affectingRegex) + { + if (!regex.empty()) + { + if (!result.empty()) + result += "|"; + result += regex; + } + } + return result; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysWriteHandle.h b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysWriteHandle.h new file mode 100644 index 0000000000000000000000000000000000000000..81d7a20202b29a3f51388592f83c0efd301e94df --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysWriteHandle.h @@ -0,0 +1,164 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef SYSTEMATICS_HANDLES__SYS_WRITE_HANDLE_H +#define SYSTEMATICS_HANDLES__SYS_WRITE_HANDLE_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgMessagingForward.h> +#include <PATInterfaces/SystematicSet.h> +#include <SystematicsHandles/ISysHandleBase.h> +#include <memory> +#include <string> +#include <unordered_map> + +class StatusCode; + +namespace CP +{ + class SystematicSet; + + /// \brief a data handle for writing systematics varied input data + + template<typename T,typename Aux = void> class SysWriteHandle final + : public ISysHandleBase, public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + public: + template<typename T2> + SysWriteHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription); + + + /// \brief retrieve the object for the given name + public: + ::StatusCode record (std::unique_ptr<T> object, + std::unique_ptr<Aux> aux, + const CP::SystematicSet& sys) const; + + + + // + // inherited interface + // + + public: + virtual std::string getInputAffecting () const override; + + + + // + // private interface + // + + /// \brief the output name we use + private: + std::string m_outputName; + + /// \brief the cache of names we use + private: + mutable std::unordered_map<CP::SystematicSet,std::string> m_outputNameCache; + + + /// \brief the type of the event store we use + private: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type StoreType; + + /// \brief the event store we use + private: + mutable StoreType *m_evtStore = nullptr; + + /// \brief the function to retrieve the event store + /// + /// This is an std::function to allow the parent to be either a + /// tool or an algorithm. Though we are not really supporting + /// tools as parents when using \ref SysListHandle, so in + /// principle this could be replaced with a pointer to the + /// algorithm instead. + private: + std::function<StoreType*()> m_evtStoreGetter; + }; + + + + template<typename T> class SysWriteHandle<T,void> final + : public ISysHandleBase, public asg::AsgMessagingForward + { + // + // public interface + // + + /// \brief standard constructor + public: + template<typename T2> + SysWriteHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription); + + + /// \brief get the name we record to the event store + public: + const std::string& getName (const CP::SystematicSet& sys) const; + + + /// \brief record the object for the given systematic + public: + ::StatusCode record (std::unique_ptr<T> object, + const CP::SystematicSet& sys) const; + + + + // + // inherited interface + // + + public: + virtual std::string getInputAffecting () const override; + + + + // + // private interface + // + + /// \brief the output name we use + private: + std::string m_outputName; + + /// \brief the cache of names we use + private: + mutable std::unordered_map<CP::SystematicSet,std::string> m_outputNameCache; + + + /// \brief the type of the event store we use + private: + typedef std::decay<decltype(*((EL::AnaAlgorithm*)0)->evtStore())>::type StoreType; + + /// \brief the event store we use + private: + mutable StoreType *m_evtStore = nullptr; + + /// \brief the function to retrieve the event store + /// + /// This is an std::function to allow the parent to be either a + /// tool or an algorithm. Though we are not really supporting + /// tools as parents when using \ref SysListHandle, so in + /// principle this could be replaced with a pointer to the + /// algorithm instead. + private: + std::function<StoreType*()> m_evtStoreGetter; + }; +} + +#include "SysWriteHandle.icc" + +#endif diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysWriteHandle.icc b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysWriteHandle.icc new file mode 100644 index 0000000000000000000000000000000000000000..74ba4964619dbf002cbfda78d76cc5ce04f47a74 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/SystematicsHandles/SysWriteHandle.icc @@ -0,0 +1,114 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AsgTools/MessageCheck.h> +#include <SystematicsHandles/Helpers.h> + +// +// method implementations +// + +namespace CP +{ + template<typename T,typename Aux> template<typename T2> SysWriteHandle<T,Aux> :: + SysWriteHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription) + : AsgMessagingForward (owner), m_outputName (propertyValue) + , m_evtStoreGetter ([owner] () {return &*owner->evtStore();}) + { + owner->declareProperty (propertyName, m_outputName, propertyDescription); + } + + + + template<typename T,typename Aux> ::StatusCode SysWriteHandle<T,Aux> :: + record (std::unique_ptr<T> object, std::unique_ptr<Aux> aux, + const CP::SystematicSet& sys) const + { + auto cache = m_outputNameCache.find (sys); + if (cache == m_outputNameCache.end()) + { + std::string newName = makeSystematicsName (m_outputName, sys); + ANA_MSG_DEBUG ("SysWriteHandle: " << newName << " (" << sys.name() << ")"); + m_outputNameCache.insert (std::make_pair (sys, newName)); + cache = m_outputNameCache.find (sys); + assert (cache != m_outputNameCache.end()); + if (!m_evtStore) + m_evtStore = m_evtStoreGetter(); + } + assert (m_evtStore); + if (m_evtStore->record (aux.release(), cache->second + "Aux.").isFailure()) + return StatusCode::FAILURE; + if (m_evtStore->record (object.release(), cache->second).isFailure()) + return StatusCode::FAILURE; + return StatusCode::SUCCESS; + } + + + + template<typename T,typename Aux> std::string SysWriteHandle<T,Aux> :: + getInputAffecting () const + { + return ""; + } + + + + template<typename T> template<typename T2> SysWriteHandle<T,void> :: + SysWriteHandle (T2 *owner, const std::string& propertyName, + const std::string& propertyValue, + const std::string& propertyDescription) + : AsgMessagingForward (owner), m_outputName (propertyValue) + , m_evtStoreGetter ([owner] () {return &*owner->evtStore();}) + { + owner->declareProperty (propertyName, m_outputName, propertyDescription); + } + + + + template<typename T> const std::string& SysWriteHandle<T,void> :: + getName (const CP::SystematicSet& sys) const + { + auto cache = m_outputNameCache.find (sys); + if (cache == m_outputNameCache.end()) + { + std::string newName = makeSystematicsName (m_outputName, sys); + ANA_MSG_DEBUG ("SysWriteHandle: " << newName << " (" << sys.name() << ")"); + m_outputNameCache.insert (std::make_pair (sys, newName)); + cache = m_outputNameCache.find (sys); + assert (cache != m_outputNameCache.end()); + + // retrieving this here, just so that it exists + if (!m_evtStore) + m_evtStore = m_evtStoreGetter(); + } + return cache->second; + } + + + + template<typename T> ::StatusCode SysWriteHandle<T,void> :: + record (std::unique_ptr<T> object, const CP::SystematicSet& sys) const + { + const std::string& name = getName (sys); + assert (m_evtStore); + return m_evtStore->record (object.release(), name); + } + + + + template<typename T> std::string SysWriteHandle<T,void> :: + getInputAffecting () const + { + return ""; + } +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysCopyHandle.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysCopyHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..31ed464c6c0bd058fd4010d8f2eb1ec9a587a7ed --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysCopyHandle.cxx @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysCopyHandle.h> +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgTool.h> +#include <xAODEventInfo/EventInfo.h> +#include <xAODJet/JetContainer.h> + +// +// test code +// + +// this tries to instantiate the various handles +void test () +{ + CP::SystematicSet *sys = nullptr; + xAOD::EventInfo *object1 = nullptr; + xAOD::JetContainer *object2 = nullptr; + + EL::AnaAlgorithm *alg = nullptr; + CP::SysCopyHandle<xAOD::EventInfo> algHandle (alg, "test", "test", "test"); + algHandle.getCopy (object1, *sys); + + asg::AsgTool *tool = nullptr; + CP::SysCopyHandle<xAOD::JetContainer> toolHandle (tool, "test", "test", "test"); + toolHandle.getCopy (object2, *sys); +} + +int main () +{ + return 0; +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysDecorationHandle.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysDecorationHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..08a1b12617bc55ff1a49502ab9064eb2b0bbea93 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysDecorationHandle.cxx @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysDecorationHandle.h> +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgTool.h> + +// +// test code +// + +// this tries to instantiate the various handles +void test () +{ + CP::SystematicSet *sys = nullptr; + const SG::AuxElement *constObject = nullptr; + SG::AuxElement *object = nullptr; + + EL::AnaAlgorithm *alg = nullptr; + CP::SysDecorationHandle<float> algHandle (alg, "test", "test", "test"); + float value = algHandle.get (*constObject, *sys); + algHandle.set (*object, value, *sys); + + asg::AsgTool *tool = nullptr; + CP::SysDecorationHandle<float> toolHandle (tool, "test", "test", "test"); +} + +int main () +{ + return 0; +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysListHandle.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysListHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dbcb0acc7d003ee158b12a61e6565b83155036f8 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysListHandle.cxx @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgTool.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> + +// +// test code +// + +// this tries to instantiate the various templates +void test () +{ + EL::AnaAlgorithm *alg = nullptr; + CP::SysListHandle algProperty (alg); + CP::SysReadHandle<float> algHandle (alg, "test", "test", "test"); + algProperty.addHandle (algHandle); + + // we probably don't want to use SysListHandle with tools, but + // we may as well allow it for now. + asg::AsgTool *tool = nullptr; + CP::SysListHandle toolProperty (tool); + CP::SysReadHandle<float> toolHandle (tool, "test", "test", "test"); + toolProperty.addHandle (toolHandle); +} + +int main () +{ + return 0; +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysReadHandle.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysReadHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8edea9045817d150d1283becb52968136119017c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysReadHandle.cxx @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysReadHandle.h> +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgTool.h> + +// +// test code +// + +// this tries to instantiate the various handles +void test () +{ + CP::SystematicSet *sys = nullptr; + const float *object = nullptr; + + EL::AnaAlgorithm *alg = nullptr; + CP::SysReadHandle<float> algHandle (alg, "test", "test", "test"); + algHandle.retrieve (object, *sys); + + asg::AsgTool *tool = nullptr; + CP::SysReadHandle<float> toolHandle (tool, "test", "test", "test"); + toolHandle.retrieve (object, *sys); +} + +int main () +{ + return 0; +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysWriteHandle.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysWriteHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3454c857f7f57c975103cab07fb20be1e6f0856 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/cc_SysWriteHandle.cxx @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +// +// includes +// + +#include <SystematicsHandles/SysWriteHandle.h> +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgTools/AsgTool.h> + +// +// test code +// + +// this tries to instantiate the various handles +void test () +{ + CP::SystematicSet *sys = nullptr; + + EL::AnaAlgorithm *alg = nullptr; + CP::SysWriteHandle<float> algHandle (alg, "test", "test", "test"); + algHandle.record (std::unique_ptr<float> (), *sys); + + asg::AsgTool *tool = nullptr; + CP::SysWriteHandle<float,double> toolHandle (tool, "test", "test", "test"); + toolHandle.record (std::unique_ptr<float> (), std::unique_ptr<double> (), *sys); +} + +int main () +{ + return 0; +} diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/test/ut_CopyHelpers.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/ut_CopyHelpers.cxx new file mode 100644 index 0000000000000000000000000000000000000000..284efb0108095bb2731cbf369f43e537db8b942f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/test/ut_CopyHelpers.cxx @@ -0,0 +1,117 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +// System include(s): +#include <cstdlib> +#include <cmath> +#include <memory> + +// Infrastructure include(s): +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/TStore.h" +#include "xAODRootAccess/Init.h" +#include "AsgTools/MsgStream.h" +#include "AsgTools/MessageCheck.h" +#include "AsgTools/SgTEvent.h" + +// EDM include(s): +#include "xAODBase/IParticleHelpers.h" +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" + +// Local include(s): +#include "SystematicsHandles/CopyHelpers.h" + +/// Function generating a random number in a specific range +double randomInRange( double min, double max ) { + return static_cast< double >( rand() ) / RAND_MAX * ( max - min ) + min; +} + +int main() { + + // Set up the usage of the ANA_CHECK(...) macro. + using namespace asg::msgUserCode; + ANA_CHECK_SET_TYPE( int ); + + // Set up the environment. + ANA_CHECK( xAOD::Init() ); + + // Create the transient store objects. + xAOD::TEvent event; + xAOD::TStore store; + asg::SgTEvent sgEvent( &event, &store ); + + // Create a message stream, to be used later on in the code. + MsgStream msgStream( "ut_CopyHelpers" ); + + // Create a primary container, fill it with some random content, and + // record it into the transient store. + auto originalJets = std::make_unique< xAOD::JetContainer >(); + auto originalAux = std::make_unique< xAOD::JetAuxContainer >(); + originalJets->setStore( originalAux.get() ); + + for( int i = 0; i < 10; ++i ) { + xAOD::Jet* jet = new xAOD::Jet(); + originalJets->push_back( jet ); + jet->setJetP4( xAOD::JetFourMom_t( randomInRange( 10000.0, 50000.0 ), // Pt + randomInRange( -2.5, 2.5 ), // Eta + randomInRange( -M_PI, M_PI ), // Phi + randomInRange( 0.0, 500.0 ) ) ); // M + } + + const xAOD::JetContainer* originalJetsPtr = originalJets.get(); + ANA_CHECK( store.record( std::move( originalJets ), "OriginalJets" ) ); + ANA_CHECK( store.record( std::move( originalAux ), "OriginalJetsAux." ) ); + + // Make it easier to use CP::detail::ShallowCopy. + using CP::detail::ShallowCopy; + + // Make a copy of this simple container. + xAOD::JetContainer* copiedJets = nullptr; + ANA_CHECK( ShallowCopy< xAOD::JetContainer >::getCopy( msgStream, + sgEvent, + copiedJets, + originalJetsPtr, + "CopiedJets", + "CopiedJetsAux." ) ); + + // Make sure that the copied objects point to the originals. + ANA_CHECK( copiedJets->size() == originalJetsPtr->size() ); + for( size_t i = 0; i < copiedJets->size(); ++i ) { + ANA_CHECK( xAOD::getOriginalObject( *( copiedJets->at( i ) ) ) == + originalJetsPtr->at( i ) ); + } + msgStream << MSG::INFO << "Simple copy succeeded" << endmsg; + + // Make a view copy of the copied container, which selects only every second + // object from it. + auto viewCopy = std::make_unique< xAOD::JetContainer >( SG::VIEW_ELEMENTS ); + for( size_t i = 0; i < copiedJets->size(); i = i + 2 ) { + viewCopy->push_back( copiedJets->at( i ) ); + } + + const xAOD::JetContainer* viewCopyPtr = viewCopy.get(); + ANA_CHECK( store.record( std::move( viewCopy ), "ViewOfCopiedJets" ) ); + + // Now make a shallow copy of this view copy. + xAOD::JetContainer* copiedViewJets = nullptr; + ANA_CHECK( ShallowCopy< xAOD::JetContainer >::getCopy( msgStream, + sgEvent, + copiedViewJets, + viewCopyPtr, + "CopyOfViewJets", + "CopyOfViewJetsAux." ) ); + + // Check the copy. The logic here is a bit complicated, since the original + // objects of the copies of the view container are still the objects in the + // original container. And not the objects in the view container. + ANA_CHECK( copiedViewJets->size() == viewCopyPtr->size() ); + for( size_t i = 0; i < viewCopyPtr->size(); ++i ) { + ANA_CHECK( xAOD::getOriginalObject( *( copiedViewJets->at( i ) ) ) == + originalJetsPtr->at( copiedViewJets->at( i )->index() ) ); + } + msgStream << MSG::INFO << "Copy of view vector succeeded" << endmsg; + + return 0; +} diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b5989cb8c8d8078ba2ce48b44b4ae45217babf4 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,64 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# The name of the package: +atlas_subdir( TauAnalysisAlgorithms ) + +# The package's dependencies: +atlas_depends_on_subdirs( + PUBLIC + Event/xAOD/xAODTau + PhysicsAnalysis/Algorithms/SelectionHelpers + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PhysicsAnalysis/TauID/TauAnalysisTools ) + +atlas_add_library( TauAnalysisAlgorithmsLib + TauAnalysisAlgorithms/*.h TauAnalysisAlgorithms/*.icc Root/*.cxx + PUBLIC_HEADERS TauAnalysisAlgorithms + LINK_LIBRARIES xAODTau SelectionHelpersLib + SystematicsHandlesLib + AnaAlgorithmLib TauAnalysisToolsLib ) + +atlas_add_dictionary( TauAnalysisAlgorithmsDict + TauAnalysisAlgorithms/TauAnalysisAlgorithmsDict.h + TauAnalysisAlgorithms/selection.xml + LINK_LIBRARIES TauAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( TauAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel TauAnalysisAlgorithmsLib ) +endif() + +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*_jobOptions.py ) +atlas_install_scripts( share/*_eljob.py ) +atlas_install_data( data/*.conf ) + +if( XAOD_STANDALONE ) + atlas_add_test( testJobData + SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) +else() + atlas_add_test( testJobData + SCRIPT athena.py + TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFullSim + SCRIPT athena.py + TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( testJobFastSim + SCRIPT athena.py + TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) +endif() diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauEfficiencyCorrectionsAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauEfficiencyCorrectionsAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..140ad67c91e0ee4f2b84ba165b858d1a2bd97392 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauEfficiencyCorrectionsAlg.cxx @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <TauAnalysisAlgorithms/DiTauEfficiencyCorrectionsAlg.h> + +// +// method implementations +// + +namespace CP +{ + DiTauEfficiencyCorrectionsAlg :: + DiTauEfficiencyCorrectionsAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_efficiencyCorrectionsTool ("TauAnalysisTools::DiTauEfficiencyCorrectionsTool", this) + { + declareProperty ("efficiencyCorrectionsTool", m_efficiencyCorrectionsTool, "the calibration and smearing tool we apply"); + declareProperty ("scaleFactorDecoration", m_scaleFactorDecoration, "the decoration for the tau scale factor"); + } + + + + StatusCode DiTauEfficiencyCorrectionsAlg :: + initialize () + { + if (m_scaleFactorDecoration.empty()) + { + ANA_MSG_ERROR ("no scale factor decoration name set"); + return StatusCode::FAILURE; + } + m_scaleFactorAccessor = std::make_unique<SG::AuxElement::Accessor<float> > (m_scaleFactorDecoration); + + ANA_CHECK (m_efficiencyCorrectionsTool.retrieve()); + m_systematicsList.addHandle (m_tauHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyCorrectionsTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode DiTauEfficiencyCorrectionsAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_efficiencyCorrectionsTool->applySystematicVariation (sys)); + xAOD::DiTauJetContainer *taus = nullptr; + ANA_CHECK (m_tauHandle.getCopy (taus, sys)); + for (xAOD::DiTauJet *tau : *taus) + { + if (m_preselection.getBool (*tau)) + { + double sf = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *tau, m_efficiencyCorrectionsTool->getEfficiencyScaleFactor (*tau, sf)); + (*m_scaleFactorAccessor) (*tau) = sf; + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauSmearingAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauSmearingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e3a367ead8796488160470d8a15cbe64756c43c8 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauSmearingAlg.cxx @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <TauAnalysisAlgorithms/DiTauSmearingAlg.h> + +// +// method implementations +// + +namespace CP +{ + DiTauSmearingAlg :: + DiTauSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_smearingTool ("TauAnalysisTools::DiTauSmearingTool", this) + { + declareProperty ("smearingTool", m_smearingTool, "the calibration and smearing tool we apply"); + } + + + + StatusCode DiTauSmearingAlg :: + initialize () + { + ANA_CHECK (m_smearingTool.retrieve()); + m_systematicsList.addHandle (m_tauHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_smearingTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode DiTauSmearingAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_smearingTool->applySystematicVariation (sys)); + xAOD::DiTauJetContainer *taus = nullptr; + ANA_CHECK (m_tauHandle.getCopy (taus, sys)); + for (xAOD::DiTauJet *tau : *taus) + { + if (m_preselection.getBool (*tau)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *tau, m_smearingTool->applyCorrection (*tau)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauTruthMatchingAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauTruthMatchingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..685c0e87581f89ef3203d2b924d3ca8ee13152cc --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauTruthMatchingAlg.cxx @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <TauAnalysisAlgorithms/DiTauTruthMatchingAlg.h> + +// +// method implementations +// + +namespace CP +{ + DiTauTruthMatchingAlg :: + DiTauTruthMatchingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_matchingTool ("TauAnalysisTools::DiTauTruthMatchingTool", this) + { + declareProperty ("matchingTool", m_matchingTool, "the matching tool we apply"); + } + + + + StatusCode DiTauTruthMatchingAlg :: + initialize () + { + ANA_CHECK (m_matchingTool.retrieve()); + m_systematicsList.addHandle (m_tauHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode DiTauTruthMatchingAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::DiTauJetContainer *taus = nullptr; + ANA_CHECK (m_tauHandle.getCopy (taus, sys)); + for (xAOD::DiTauJet *tau : *taus) + { + if (m_preselection.getBool (*tau)) + { + m_matchingTool->applyTruthMatch (*tau); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauEfficiencyCorrectionsAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauEfficiencyCorrectionsAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bc7ed9a74c667f84a9c147032af1f11bd77a407e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauEfficiencyCorrectionsAlg.cxx @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <TauAnalysisAlgorithms/TauEfficiencyCorrectionsAlg.h> + +// +// method implementations +// + +namespace CP +{ + TauEfficiencyCorrectionsAlg :: + TauEfficiencyCorrectionsAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_efficiencyCorrectionsTool ("TauAnalysisTools::TauEfficiencyCorrectionsTool", this) + { + declareProperty ("efficiencyCorrectionsTool", m_efficiencyCorrectionsTool, "the calibration and smearing tool we apply"); + } + + + + StatusCode TauEfficiencyCorrectionsAlg :: + initialize () + { + if (m_scaleFactorDecoration.empty()) + { + ANA_MSG_ERROR ("no scale factor decoration name set"); + return StatusCode::FAILURE; + } + + ANA_CHECK (m_efficiencyCorrectionsTool.retrieve()); + m_systematicsList.addHandle (m_tauHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyCorrectionsTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode TauEfficiencyCorrectionsAlg :: + execute () + { + ANA_CHECK (m_scaleFactorDecoration.preExecute (m_systematicsList)); + + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_efficiencyCorrectionsTool->applySystematicVariation (sys)); + xAOD::TauJetContainer *taus = nullptr; + ANA_CHECK (m_tauHandle.getCopy (taus, sys)); + for (xAOD::TauJet *tau : *taus) + { + if (m_preselection.getBool (*tau)) + { + double sf = 0; + ANA_CHECK_CORRECTION (m_outOfValidity, *tau, m_efficiencyCorrectionsTool->getEfficiencyScaleFactor (*tau, sf)); + m_scaleFactorDecoration.set (*tau, sf, sys); + } else { + m_scaleFactorDecoration.set (*tau, invalidScaleFactor(), sys); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauSmearingAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauSmearingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f7b65a29ee8735390f5a133539c0fabcfb650e00 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauSmearingAlg.cxx @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <TauAnalysisAlgorithms/TauSmearingAlg.h> + +// +// method implementations +// + +namespace CP +{ + TauSmearingAlg :: + TauSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_smearingTool ("TauAnalysisTools::TauSmearingTool", this) + { + declareProperty ("smearingTool", m_smearingTool, "the calibration and smearing tool we apply"); + } + + + + StatusCode TauSmearingAlg :: + initialize () + { + ANA_CHECK (m_smearingTool.retrieve()); + m_systematicsList.addHandle (m_tauHandle); + ANA_CHECK (m_systematicsList.addAffectingSystematics (m_smearingTool->affectingSystematics())); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + ANA_CHECK (m_outOfValidity.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode TauSmearingAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + ANA_CHECK (m_smearingTool->applySystematicVariation (sys)); + xAOD::TauJetContainer *taus = nullptr; + ANA_CHECK (m_tauHandle.getCopy (taus, sys)); + for (xAOD::TauJet *tau : *taus) + { + if (m_preselection.getBool (*tau)) + { + ANA_CHECK_CORRECTION (m_outOfValidity, *tau, m_smearingTool->applyCorrection (*tau)); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d679581d9d9049a8c62075e0d82296727c8e0abc --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +// +// includes +// + +#include <TauAnalysisAlgorithms/TauTruthMatchingAlg.h> + +// +// method implementations +// + +namespace CP +{ + TauTruthMatchingAlg :: + TauTruthMatchingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_matchingTool ("TauAnalysisTools::TauTruthMatchingTool", this) + { + declareProperty ("matchingTool", m_matchingTool, "the matching tool we apply"); + } + + + + StatusCode TauTruthMatchingAlg :: + initialize () + { + ANA_CHECK (m_matchingTool.retrieve()); + m_systematicsList.addHandle (m_tauHandle); + ANA_CHECK (m_systematicsList.initialize()); + ANA_CHECK (m_preselection.initialize()); + return StatusCode::SUCCESS; + } + + + + StatusCode TauTruthMatchingAlg :: + execute () + { + return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode { + xAOD::TauJetContainer *taus = nullptr; + ANA_CHECK (m_tauHandle.getCopy (taus, sys)); + for (xAOD::TauJet *tau : *taus) + { + if (m_preselection.getBool (*tau)) + { + m_matchingTool->applyTruthMatch (*tau); + } + } + return StatusCode::SUCCESS; + }); + } +} diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauEfficiencyCorrectionsAlg.h b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauEfficiencyCorrectionsAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..194af5403133fc1bef8ec19bea7923f213b1945f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauEfficiencyCorrectionsAlg.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef TAU_ANALYSIS_ALGORITHMS__DI_TAU_EFFICIENCY_CORRECTIONS_ALG_H +#define TAU_ANALYSIS_ALGORITHMS__DI_TAU_EFFICIENCY_CORRECTIONS_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <TauAnalysisTools/IDiTauEfficiencyCorrectionsTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <xAODTau/DiTauJetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IDiTauEfficiencyCorrectionsTool + + class DiTauEfficiencyCorrectionsAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + DiTauEfficiencyCorrectionsAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<TauAnalysisTools::IDiTauEfficiencyCorrectionsTool> m_efficiencyCorrectionsTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the tau collection we run on + private: + SysCopyHandle<xAOD::DiTauJetContainer> m_tauHandle { + this, "taus", "DiTauJets", "the tau collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + + /// \brief the decoration for the tau scale factor + private: + std::string m_scaleFactorDecoration; + + /// \brief the accessor for \ref m_scaleFactorDecoration + private: + std::unique_ptr<const SG::AuxElement::Accessor<float> > m_scaleFactorAccessor; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauSmearingAlg.h b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauSmearingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..9610128e082e3e0e461294b5821fad2426efe043 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauSmearingAlg.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef TAU_ANALYSIS_ALGORITHMS__DI_TAU_CALIBRATION_AND_SMEARING_ALG_H +#define TAU_ANALYSIS_ALGORITHMS__DI_TAU_CALIBRATION_AND_SMEARING_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <TauAnalysisTools/IDiTauSmearingTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODTau/DiTauJetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IDiTauSmearingTool + + class DiTauSmearingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + DiTauSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<TauAnalysisTools::IDiTauSmearingTool> m_smearingTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the tau collection we run on + private: + SysCopyHandle<xAOD::DiTauJetContainer> m_tauHandle { + this, "taus", "DiTauJets", "the tau collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauTruthMatchingAlg.h b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauTruthMatchingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..a93a3aaf61726eaf6a52e2d82079aaa9059107ae --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/DiTauTruthMatchingAlg.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef TAU_ANALYSIS_ALGORITHMS__DI_TAU_TRUTH_MATCHING_ALG_H +#define TAU_ANALYSIS_ALGORITHMS__DI_TAU_TRUTH_MATCHING_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <TauAnalysisTools/IDiTauTruthMatchingTool.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODTau/DiTauJetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref IDiTauTruthMatchingTool + + class DiTauTruthMatchingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + DiTauTruthMatchingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the matching tool + private: + ToolHandle<TauAnalysisTools::IDiTauTruthMatchingTool> m_matchingTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the tau collection we run on + private: + SysCopyHandle<xAOD::DiTauJetContainer> m_tauHandle { + this, "taus", "DiTauJets", "the tau collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..146cf87c4538b12e98bc258f8d6ab18d6f30be02 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithmsDict.h @@ -0,0 +1,18 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef TAU_ANALYSIS_ALGORITHMS__TAU_ANALYSIS_ALGORITHMS_DICT_H +#define TAU_ANALYSIS_ALGORITHMS__TAU_ANALYSIS_ALGORITHMS_DICT_H + +#include <TauAnalysisAlgorithms/DiTauEfficiencyCorrectionsAlg.h> +#include <TauAnalysisAlgorithms/DiTauSmearingAlg.h> +#include <TauAnalysisAlgorithms/DiTauTruthMatchingAlg.h> +#include <TauAnalysisAlgorithms/TauEfficiencyCorrectionsAlg.h> +#include <TauAnalysisAlgorithms/TauSmearingAlg.h> +#include <TauAnalysisAlgorithms/TauTruthMatchingAlg.h> + +#endif diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauEfficiencyCorrectionsAlg.h b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauEfficiencyCorrectionsAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..321199c88c5b0cbfe57ac8fbe2f83ceaea174f83 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauEfficiencyCorrectionsAlg.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + +#ifndef TAU_ANALYSIS_ALGORITHMS__TAU_EFFICIENCY_CORRECTIONS_ALG_H +#define TAU_ANALYSIS_ALGORITHMS__TAU_EFFICIENCY_CORRECTIONS_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <TauAnalysisTools/ITauEfficiencyCorrectionsTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysDecorationHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <SystematicsHandles/SysReadHandle.h> +#include <xAODTau/TauJetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref ITauEfficiencyCorrectionsTool + + class TauEfficiencyCorrectionsAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + TauEfficiencyCorrectionsAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> m_efficiencyCorrectionsTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the tau collection we run on + private: + SysCopyHandle<xAOD::TauJetContainer> m_tauHandle { + this, "taus", "TauJets", "the tau collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + + /// \brief the decoration for the tau scale factor + private: + SysDecorationHandle<float> m_scaleFactorDecoration { + this, "scaleFactorDecoration", "", "the decoration for the tau efficiency scale factor"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauSmearingAlg.h b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauSmearingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..fa5f903e504949f9a2a60d7f92d0161ec8423649 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauSmearingAlg.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef TAU_ANALYSIS_ALGORITHMS__TAU_CALIBRATION_AND_SMEARING_ALG_H +#define TAU_ANALYSIS_ALGORITHMS__TAU_CALIBRATION_AND_SMEARING_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <TauAnalysisTools/ITauSmearingTool.h> +#include <SelectionHelpers/OutOfValidityHelper.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODTau/TauJetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref ITauSmearingTool + + class TauSmearingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + TauSmearingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the smearing tool + private: + ToolHandle<TauAnalysisTools::ITauSmearingTool> m_smearingTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the tau collection we run on + private: + SysCopyHandle<xAOD::TauJetContainer> m_tauHandle { + this, "taus", "TauJets", "the tau collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + + /// \brief the helper for OutOfValidity results + private: + OutOfValidityHelper m_outOfValidity {this}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauTruthMatchingAlg.h b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauTruthMatchingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..0bd2409052c34bd10dd8fcd40157123108aca6e2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/TauTruthMatchingAlg.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Nils Krumnack + + + +#ifndef TAU_ANALYSIS_ALGORITHMS__TAU_TRUTH_MATCHING_ALG_H +#define TAU_ANALYSIS_ALGORITHMS__TAU_TRUTH_MATCHING_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <TauAnalysisTools/ITauTruthMatchingTool.h> +#include <SelectionHelpers/SelectionReadHandle.h> +#include <SystematicsHandles/SysCopyHandle.h> +#include <SystematicsHandles/SysListHandle.h> +#include <xAODTau/TauJetContainer.h> + +namespace CP +{ + /// \brief an algorithm for calling \ref ITauTruthMatchingTool + + class TauTruthMatchingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + TauTruthMatchingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + + /// \brief the matching tool + private: + ToolHandle<TauAnalysisTools::ITauTruthMatchingTool> m_matchingTool; + + /// \brief the systematics list we run + private: + SysListHandle m_systematicsList {this}; + + /// \brief the tau collection we run on + private: + SysCopyHandle<xAOD::TauJetContainer> m_tauHandle { + this, "taus", "TauJets", "the tau collection to run on"}; + + /// \brief the preselection we apply to our input + private: + SelectionReadHandle m_preselection { + this, "preselection", "", "the preselection to apply"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..a815f8e0a47edce1db6a49c6270e37aa573dfa5c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/TauAnalysisAlgorithms/selection.xml @@ -0,0 +1,10 @@ +<lcgdict> + + <class name="CP::DiTauEfficiencyCorrectionsAlg" /> + <class name="CP::DiTauSmearingAlg" /> + <class name="CP::DiTauTruthMatchingAlg" /> + <class name="CP::TauEfficiencyCorrectionsAlg" /> + <class name="CP::TauSmearingAlg" /> + <class name="CP::TauTruthMatchingAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_baseline.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_baseline.conf new file mode 100644 index 0000000000000000000000000000000000000000..6fa54ab13cdc849e78564ae3e7621214296fa239 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_baseline.conf @@ -0,0 +1,9 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_baseline_legacy.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_baseline_legacy.conf new file mode 100644 index 0000000000000000000000000000000000000000..bf5b84d0e25f8aeb5c4d1a5678d8f2d493d4b72c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_baseline_legacy.conf @@ -0,0 +1,10 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +EleOLR: True + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_loose.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_loose.conf new file mode 100644 index 0000000000000000000000000000000000000000..5c3c8e8d125deeeea2ead9fe63cf5914d3c9e52e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_loose.conf @@ -0,0 +1,11 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDRNNLOOSE +EleBDTWP: ELEIDBDTLOOSE + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_loose_legacy.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_loose_legacy.conf new file mode 100644 index 0000000000000000000000000000000000000000..5cd30ef26f94075d54dd63ad4e238ff860efb9d0 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_loose_legacy.conf @@ -0,0 +1,12 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDBDTLOOSE +EleOLR: True +EleBDTWP: ELEIDBDTOLDLOOSE + +# EOF \ No newline at end of file diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_medium.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_medium.conf new file mode 100644 index 0000000000000000000000000000000000000000..db9c7e1eff77ed7a3a21c4bad8a40ffba4bc4f6b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_medium.conf @@ -0,0 +1,11 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDRNNMEDIUM +EleBDTWP: ELEIDBDTLOOSE + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_medium_legacy.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_medium_legacy.conf new file mode 100644 index 0000000000000000000000000000000000000000..73d26a97e56a9a1c92084d0b84dcf191f4f558c6 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_medium_legacy.conf @@ -0,0 +1,12 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDBDTMEDIUM +EleOLR: True +EleBDTWP: ELEIDBDTOLDLOOSE + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_noid.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_noid.conf new file mode 100644 index 0000000000000000000000000000000000000000..8d12d46d42ada61fc596208eb60bedc1608ad48d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_noid.conf @@ -0,0 +1,11 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDNONE +EleBDTWP: ELEIDBDTLOOSE + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_noid_legacy.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_noid_legacy.conf new file mode 100644 index 0000000000000000000000000000000000000000..c58146ecc3074d2b16bb14808d35575db6b2ac19 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_noid_legacy.conf @@ -0,0 +1,12 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDNONE +EleOLR: True +EleBDTWP: ELEIDBDTOLDLOOSE + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_tight.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_tight.conf new file mode 100644 index 0000000000000000000000000000000000000000..862691f0f17e2ca2a47ae0d1371796f6394dc77e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_tight.conf @@ -0,0 +1,11 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDRNNTIGHT +EleBDTWP: ELEIDBDTLOOSE + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_tight_legacy.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_tight_legacy.conf new file mode 100644 index 0000000000000000000000000000000000000000..c855481512ac2658ee2c07c76ff9d5c906f2ce45 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_tight_legacy.conf @@ -0,0 +1,12 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDBDTTIGHT +EleOLR: True +EleBDTWP: ELEIDBDTOLDLOOSE + +# EOF \ No newline at end of file diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_veryloose.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_veryloose.conf new file mode 100644 index 0000000000000000000000000000000000000000..1f3c0fb379e71c6debc24fbb2c3fdcf06bb85abc --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_veryloose.conf @@ -0,0 +1,11 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDRNNVERYLOOSE +EleBDTWP: ELEIDBDTLOOSE + +# EOF diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_veryloose_legacy.conf b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_veryloose_legacy.conf new file mode 100644 index 0000000000000000000000000000000000000000..5266e9f6875bbe765ff2b5621ac7cb83d6153191 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/data/tau_selection_veryloose_legacy.conf @@ -0,0 +1,12 @@ +# Cuts to perform, need to be specified below +SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR EleBDTWP + +PtMin: 20 +AbsEtaRegion: 0; 1.37; 1.52; 2.5 +AbsCharge: 1 +NTracks: 1; 3 +JetIDWP: JETIDBDTVERYLOOSE +EleOLR: True +EleBDTWP: ELEIDBDTOLDLOOSE + +# EOF \ No newline at end of file diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/DiTauAnalysisSequence.py b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/DiTauAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..b95773d5252648f511046e7a1d674c6b1d24075b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/DiTauAnalysisSequence.py @@ -0,0 +1,100 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool + +def makeDiTauAnalysisSequence( dataType, workingPoint, + deepCopyOutput = False, postfix = '' ): + """Create a tau analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + deepCopyOutput -- If set to 'True', the output containers will be + standalone, deep copies (slower, but needed for xAOD + output writing) + postfix -- a postfix to apply to decorations and algorithm + names. this is mostly used/needed when using this + sequence with multiple working points to ensure all + names are unique. + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + if postfix != '' : + postfix = '_' + postfix + pass + + splitWP = workingPoint.split ('.') + if len (splitWP) != 1 : + raise ValueError ('working point should be of format "quality", not ' + workingPoint) + + # using enum value from: https://gitlab.cern.ch/atlas/athena/blob/21.2/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h + # the dictionary is missing in Athena, so hard-coding values here + if splitWP[0] == 'Tight' : + IDLevel = 4 # ROOT.TauAnalysisTools.JETIDBDTTIGHT + pass + elif splitWP[0] == 'Medium' : + IDLevel = 3 # ROOT.TauAnalysisTools.JETIDBDTMEDIUM + pass + elif splitWP[0] == 'Loose' : + IDLevel = 2 # ROOT.TauAnalysisTools.JETIDBDTLOOSE + pass + else : + raise ValueError ("invalid tau quality: \"" + splitWP[0] + + "\", allowed values are Tight, Medium, Loose, " + + "VeryLoose") + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "DiTauAnalysisSequence" + postfix ) + + # Set up the tau 4-momentum smearing algorithm: + alg = createAlgorithm( 'CP::DiTauSmearingAlg', 'DiTauSmearingAlg' + postfix ) + addPrivateTool( alg, 'smearingTool', 'TauAnalysisTools::DiTauSmearingTool' ) + seq.append( alg, inputPropName = 'taus', outputPropName = 'tausOut', + affectingSystematics = '(^TAUS_TRUEHADDITAU_SME_TES_.*)', + stageName = 'calibration' ) + + # Set up an algorithm dumping the properties of the taus, for debugging: + alg = createAlgorithm( 'CP::KinematicHistAlg', 'DiTauKinematicDumperAlg' + postfix ) + alg.histPattern = "tau_%VAR%_%SYS%" + seq.append( alg, inputPropName = 'input', + stageName = 'selection' ) + + # Set up the algorithm calculating the efficiency scale factors for the + # taus: + alg = createAlgorithm( 'CP::DiTauEfficiencyCorrectionsAlg', + 'DiTauEfficiencyCorrectionsAlg' + postfix ) + addPrivateTool( alg, 'efficiencyCorrectionsTool', + 'TauAnalysisTools::DiTauEfficiencyCorrectionsTool' ) + alg.efficiencyCorrectionsTool.IDLevel = IDLevel + alg.scaleFactorDecoration = 'tau_effSF' + postfix + # alg.outOfValidity = 2 #silent + # alg.outOfValidityDeco = "bad_eff" + seq.append( alg, inputPropName = 'taus', outputPropName = 'tausOut', + affectingSystematics = '(^TAUS_TRUEHADDITAU_EFF_JETID_.*)', + stageName = 'efficiency' ) + + # Set up the tau truth matching algorithm: + if dataType != 'data': + alg = createAlgorithm( 'CP::DiTauTruthMatchingAlg', + 'DiTauTruthMatchingAlg' + postfix ) + addPrivateTool( alg, 'matchingTool', + 'TauAnalysisTools::DiTauTruthMatchingTool' ) + alg.matchingTool.WriteTruthTaus = 1 + seq.append( alg, inputPropName = 'taus', outputPropName = 'tausOut', + stageName = 'selection' ) + pass + + # Set up a final deep copy making algorithm if requested: + if deepCopyOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'DiTauDeepCopyMaker' + postfix ) + alg.deepCopy = True + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + pass + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/TauAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/TauAnalysisAlgorithmsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..7c496b06b12be9f4bdcd56a54d5985fa44af3c3f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/TauAnalysisAlgorithmsTest.py @@ -0,0 +1,35 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +from AnaAlgorithm.AlgSequence import AlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm + +def makeSequence (dataType) : + + algSeq = AlgSequence() + + # Set up the systematics loader/handler algorithm: + sysLoader = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + sysLoader.sigmaRecommended = 1 + algSeq += sysLoader + + # Include, and then set up the tau analysis algorithm sequence: + from TauAnalysisAlgorithms.TauAnalysisSequence import makeTauAnalysisSequence + tauSequence = makeTauAnalysisSequence( dataType, 'Tight', postfix = 'tight', + enableCutflow=True, enableKinematicHistograms=True ) + tauSequence.configure( inputName = 'TauJets', outputName = 'AnalysisTauJets_%SYS%' ) + + # Add the sequence to the job: + algSeq += tauSequence + + # Include, and then set up the tau analysis algorithm sequence: + from TauAnalysisAlgorithms.DiTauAnalysisSequence import makeDiTauAnalysisSequence + diTauSequence = makeDiTauAnalysisSequence( dataType, 'Tight', postfix = 'tight' ) + diTauSequence.configure( inputName = 'DiTauJets', outputName = 'AnalysisDiTauJets_%SYS%' ) + + # Add the sequence to the job: + # disabling this, the standard test files don't have DiTauJets + # algSeq += diTauSequence + + return algSeq diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/TauAnalysisSequence.py b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/TauAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..c48a2fc3b96f012405440ffc50436e6a8a188216 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/TauAnalysisSequence.py @@ -0,0 +1,170 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool, \ + createPublicTool + +def makeTauAnalysisSequence( dataType, workingPoint, postfix = '', + legacyRecommendations = False, + deepCopyOutput = False, + shallowViewOutput = True, + rerunTruthMatching = True, + enableCutflow = False, + enableKinematicHistograms = False ): + """Create a tau analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + legacyRecommendations -- use legacy tau BDT and electron veto recommendations + deepCopyOutput -- If set to 'True', the output containers will be + standalone, deep copies (slower, but needed for xAOD + output writing) + shallowViewOutput -- Create a view container if required + postfix -- a postfix to apply to decorations and algorithm + names. this is mostly used/needed when using this + sequence with multiple working points to ensure all + names are unique. + rerunTruthMatching -- Whether or not to rerun truth matching + enableCutflow -- Whether or not to dump the cutflow + enableKinematicHistograms -- Whether or not to dump the kinematic histograms + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + if postfix != '' : + postfix = '_' + postfix + pass + + # Make sure selection options make sense + if deepCopyOutput and shallowViewOutput: + raise ValueError ("deepCopyOutput and shallowViewOutput can't both be true!") + + splitWP = workingPoint.split ('.') + if len (splitWP) != 1 : + raise ValueError ('working point should be of format "quality", not ' + workingPoint) + + nameFormat = 'TauAnalysisAlgorithms/tau_selection_{}.conf' + if legacyRecommendations: + nameFormat = 'TauAnalysisAlgorithms/tau_selection_{}_legacy.conf' + + if splitWP[0] not in ['Tight', 'Medium', 'Loose', 'VeryLoose', 'NoID', 'Baseline'] : + raise ValueError ("invalid tau quality: \"" + splitWP[0] + + "\", allowed values are Tight, Medium, Loose, " + + "VeryLoose, NoID, Baseline") + inputfile = nameFormat.format(splitWP[0].lower()) + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "TauAnalysisSequence" + postfix ) + + # Variables keeping track of the selections being applied. + selectionDecorNames = [] + selectionDecorCount = [] + + # Setup the tau selection tool + selectionTool = createPublicTool( 'TauAnalysisTools::TauSelectionTool', + 'TauSelectionTool' + postfix) + selectionTool.ConfigPath = inputfile + seq.addPublicTool( selectionTool, stageName = 'selection' ) + + # Set up the tau truth matching algorithm: + if rerunTruthMatching and dataType != 'data': + alg = createAlgorithm( 'CP::TauTruthMatchingAlg', + 'TauTruthMatchingAlg' + postfix ) + addPrivateTool( alg, 'matchingTool', + 'TauAnalysisTools::TauTruthMatchingTool' ) + alg.matchingTool.WriteTruthTaus = 1 + seq.append( alg, inputPropName = 'taus', outputPropName = 'tausOut', + stageName = 'selection' ) + pass + + # Set up the tau 4-momentum smearing algorithm: + alg = createAlgorithm( 'CP::TauSmearingAlg', 'TauSmearingAlg' + postfix ) + addPrivateTool( alg, 'smearingTool', 'TauAnalysisTools::TauSmearingTool' ) + seq.append( alg, inputPropName = 'taus', outputPropName = 'tausOut', + affectingSystematics = '(^TAUS_TRUEHADTAU_SME_TES_.*)', + stageName = 'calibration' ) + + # Set up the algorithm selecting taus: + alg = createAlgorithm( 'CP::AsgSelectionAlg', 'TauSelectionAlg' + postfix ) + alg.selectionTool = '%s/%s' % \ + ( selectionTool.getType(), selectionTool.getName() ) + alg.selectionDecoration = 'selected_tau' + postfix + ',as_bits' + seq.append( alg, inputPropName = 'particles', + stageName = 'selection' ) + selectionDecorNames.append( alg.selectionDecoration ) + selectionDecorCount.append( 6 ) + + # Set up the algorithm calculating the efficiency scale factors for the + # taus: + if dataType != 'data': + alg = createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg', + 'TauEfficiencyCorrectionsAlg' + postfix ) + addPrivateTool( alg, 'efficiencyCorrectionsTool', + 'TauAnalysisTools::TauEfficiencyCorrectionsTool' ) + alg.efficiencyCorrectionsTool.TauSelectionTool = '%s/%s' % \ + ( selectionTool.getType(), selectionTool.getName() ) + alg.scaleFactorDecoration = 'tau_effSF' + postfix + '_%SYS%' + alg.scaleFactorDecorationRegex = '(^TAUS_TRUEELECTRON_EFF_.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_RECO.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_RNNID.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_JETID.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_RECO.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_ELEOLR.*)' + alg.outOfValidity = 2 #silent + alg.outOfValidityDeco = 'bad_eff' + postfix + seq.append( alg, inputPropName = 'taus', + affectingSystematics = '(^TAUS_TRUEELECTRON_EFF_.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_RECO.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_RNNID.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_JETID.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_RECO.*)' \ + + '|(^TAUS_TRUEHADTAU_EFF_ELEOLR.*)', + stageName = 'efficiency' ) + + # Set up an algorithm used to create tau selection cutflow: + if enableCutflow: + alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg', 'TauCutFlowDumperAlg' + postfix ) + alg.histPattern = 'tau_cflow_%SYS%' + alg.selection = selectionDecorNames[ : ] + alg.selectionNCuts = selectionDecorCount[ : ] + seq.append( alg, inputPropName = 'input', stageName = 'selection' ) + + # Set up an algorithm used for decorating baseline tau selection: + alg = createAlgorithm( 'CP::AsgSelectionAlg', + 'TauSelectionSummary' + postfix ) + addPrivateTool( alg, 'selectionTool', 'CP::AsgFlagSelectionTool' ) + alg.selectionTool.selectionFlags = selectionDecorNames[ : ] + alg.selectionDecoration = 'baselineSelection' + postfix + ',as_char' + seq.append( alg, inputPropName = 'particles', + stageName = 'selection' ) + + # Set up an algorithm that makes a view container using the selections + # performed previously: + if shallowViewOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'TauViewFromSelectionAlg' + postfix ) + alg.selection = selectionDecorNames[ : ] + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + + # Set up an algorithm dumping the kinematic properties of the taus: + if enableKinematicHistograms: + alg = createAlgorithm( 'CP::KinematicHistAlg', 'TauKinematicDumperAlg' + postfix ) + alg.preselection = '&&'.join (selectionDecorNames) + alg.histPattern = 'tau_%VAR%_%SYS%' + seq.append( alg, inputPropName = 'input', stageName = 'selection' ) + + # Set up a final deep copy making algorithm if requested: + if deepCopyOutput: + alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg', + 'TauDeepCopyMaker' + postfix ) + alg.deepCopy = True + alg.selection = selectionDecorNames[ : ] + seq.append( alg, inputPropName = 'input', outputPropName = 'output', + stageName = 'selection' ) + pass + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5ccb446532599c01cc3844e5b1b18db06f721002 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +__version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..0b1755dd1058de72bf62c41d341da48ec2301d72 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_eljob.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# this forces the tau algorithms dictionary to be loaded before +# anything else, which works around some strange dictionary issues I +# don't understand. +ROOT.CP.TauSmearingAlg ("dummy", None) + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +if dataType == "data" : + sample.add (os.getenv ('ASG_TEST_FILE_DATA')) + pass +if dataType == "mc" : + sample.add (os.getenv ('ASG_TEST_FILE_MC')) + pass +if dataType == "afii" : + sample.add (os.getenv ('ASG_TEST_FILE_MC_AFII')) + pass +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) + +from TauAnalysisAlgorithms.TauAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'tauTest_'+dataType+'_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..fb9d15adaf94ab997419cd5864a1fd628ce01f6f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Nils Krumnack + +# User options, which can be set from command line after a "-" character +# athena EgammaAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from TauAnalysisAlgorithms.TauAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='TauAnalysisAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/src/components/TauAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/src/components/TauAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2100a92e42f2491eee51b2041fb5786d81a11248 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/src/components/TauAnalysisAlgorithms_entries.cxx @@ -0,0 +1,26 @@ +// AsgExampleTools_entries.cxx + +#include <GaudiKernel/DeclareFactoryEntries.h> + +#include <TauAnalysisAlgorithms/DiTauEfficiencyCorrectionsAlg.h> +#include <TauAnalysisAlgorithms/DiTauSmearingAlg.h> +#include <TauAnalysisAlgorithms/DiTauTruthMatchingAlg.h> +#include <TauAnalysisAlgorithms/TauEfficiencyCorrectionsAlg.h> +#include <TauAnalysisAlgorithms/TauSmearingAlg.h> +#include <TauAnalysisAlgorithms/TauTruthMatchingAlg.h> + +DECLARE_ALGORITHM_FACTORY (CP::DiTauEfficiencyCorrectionsAlg) +DECLARE_ALGORITHM_FACTORY (CP::DiTauSmearingAlg) +DECLARE_ALGORITHM_FACTORY (CP::DiTauTruthMatchingAlg) +DECLARE_ALGORITHM_FACTORY (CP::TauEfficiencyCorrectionsAlg) +DECLARE_ALGORITHM_FACTORY (CP::TauSmearingAlg) +DECLARE_ALGORITHM_FACTORY (CP::TauTruthMatchingAlg) + +DECLARE_FACTORY_ENTRIES(TauAnalysisAlgorithms) { + DECLARE_ALGORITHM (CP::DiTauEfficiencyCorrectionsAlg) + DECLARE_ALGORITHM (CP::DiTauSmearingAlg) + DECLARE_ALGORITHM (CP::DiTauTruthMatchingAlg) + DECLARE_ALGORITHM (CP::TauEfficiencyCorrectionsAlg) + DECLARE_ALGORITHM (CP::TauSmearingAlg) + DECLARE_ALGORITHM (CP::TauTruthMatchingAlg) +} diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/src/components/TauAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/src/components/TauAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..30ea7bbd909d6498c1dec164c40961ed0b717acb --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/src/components/TauAnalysisAlgorithms_load.cxx @@ -0,0 +1,5 @@ +// AsgExampleTools_load.cxx + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(TauAnalysisAlgorithms) diff --git a/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..70e73676e4d5941da8e471cf143a53ef17d5b471 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +# The name of the package: +atlas_subdir( TrackingAnalysisAlgorithms ) + +# The package's dependencies: +atlas_depends_on_subdirs( + PUBLIC + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PRIVATE + Event/xAOD/xAODTracking ) + +# Components in the package: +atlas_add_library( TrackingAnalysisAlgorithmsLib + TrackingAnalysisAlgorithms/*.h Root/*.cxx + PUBLIC_HEADERS TrackingAnalysisAlgorithms + LINK_LIBRARIES AnaAlgorithmLib + PRIVATE_LINK_LIBRARIES xAODTracking ) + +atlas_add_dictionary( TrackingAnalysisAlgorithmsDict + TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithmsDict.h + TrackingAnalysisAlgorithms/selection.xml + LINK_LIBRARIES TrackingAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( TrackingAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel TrackingAnalysisAlgorithmsLib ) +endif() diff --git a/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/README.md b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/README.md new file mode 100644 index 0000000000000000000000000000000000000000..eb7a319d1dab7dc54009b3806322bfa513c5f34b --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/README.md @@ -0,0 +1,10 @@ +Tracking Analysis Algorithms +============================ + +This package is meant to collect dual-use/analysis algorithms that are +related to tracking. + +Current algorithm(s) in the package: + - [CP::VertexSelectionAlg](TrackingAlgorithms/VertexSelectionAlg.h): + Filter algorithm requiring a certain number of primary vertices in + the event. diff --git a/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/Root/VertexSelectionAlg.cxx b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/Root/VertexSelectionAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..33c6098aa6b3851724e530f361c97a661fcac9b2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/Root/VertexSelectionAlg.cxx @@ -0,0 +1,82 @@ +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// + +// Local include(s): +#include "TrackingAnalysisAlgorithms/VertexSelectionAlg.h" + +// EDM include(s): +#include "xAODTracking/VertexContainer.h" + +#include "AnaAlgorithm/FilterReporter.h" + +namespace CP { + + VertexSelectionAlg::VertexSelectionAlg( const std::string& name, + ISvcLocator* svcLoc ) + : EL::AnaAlgorithm( name, svcLoc ) { + + // Declare the algorithm's properties: + declareProperty( "VertexContainer", m_vertexKey = "PrimaryVertices", + "Vertex container to check" ); + declareProperty( "MinVertices", m_minVertices = 1, + "Minimum number of vertices required" ); + declareProperty( "MinTracks", m_minTracks = 0, + "Minimum number of track particles required per " + "vertex" ); + } + + StatusCode VertexSelectionAlg::initialize() { + + // Greet the user: + ATH_MSG_INFO( "Requiring " << m_minVertices << " vertex/vertices from \"" + << m_vertexKey << "\" with " << m_minTracks + << " track(s) each" ); + + ANA_CHECK (m_filterParams.initialize()); + + // Return gracefully: + return StatusCode::SUCCESS; + } + + StatusCode VertexSelectionAlg::finalize() { + ANA_CHECK (m_filterParams.finalize()); + + // Return gracefully: + return StatusCode::SUCCESS; + } + + StatusCode VertexSelectionAlg::execute() { + + EL::FilterReporter filter (m_filterParams, false); + + // Retrieve the vertex container: + const xAOD::VertexContainer* vertices = nullptr; + ATH_CHECK( evtStore()->retrieve( vertices, m_vertexKey ) ); + + // The number of "good" vertices found: + unsigned goodVertices = 0; + + // Check how many "good" vertices we have in the current event: + for( const xAOD::Vertex* vx : *vertices ) { + // It has to be either a primary or a pileup vertex: + if( ( vx->vertexType() != xAOD::VxType::PriVtx ) && + ( vx->vertexType() != xAOD::VxType::PileUp ) ) { + continue; + } + // With the minimum number of tracks specified: + if( vx->nTrackParticles() < m_minTracks ) { + continue; + } + // Apparently this is a "good" vertex: + ++goodVertices; + } + + // Decide about the event: + filter.setPassed( goodVertices >= m_minVertices ); + + // Return gracefully: + return StatusCode::SUCCESS; + } + +} // namespace CP diff --git a/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..05600c0795bde4f634529dbcc0668c5f1ba78ba2 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithmsDict.h @@ -0,0 +1,11 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// +#ifndef TRACKINGANALYSISALGORITHMS_TRACKINGANALYSISALGORITHMSDICT_H +#define TRACKINGANALYSISALGORITHMS_TRACKINGANALYSISALGORITHMSDICT_H + +// Local include(s): +#include "TrackingAnalysisAlgorithms/VertexSelectionAlg.h" + +#endif // TRACKINGANALYSISALGORITHMS_TRACKINGANALYSISALGORITHMSDICT_H diff --git a/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/VertexSelectionAlg.h b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/VertexSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..669118234ec529640477c52ed3fc97a8ebc5e471 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/VertexSelectionAlg.h @@ -0,0 +1,64 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// +#ifndef TRACKINGANALYSISALGORITHMS_VERTEXSELECTIONALG_H +#define TRACKINGANALYSISALGORITHMS_VERTEXSELECTIONALG_H + +// Framework include(s): +#include "AnaAlgorithm/AnaAlgorithm.h" +#include "AnaAlgorithm/FilterReporterParams.h" + +// System include(s): +#include <string> + +namespace CP { + + /// Algorithm meant to select events with "some" vertex requirements + /// + /// This algorithm is meant to be used to pose vertex requirements for the + /// analysed event. Most commonly requiring at least one primary vertex with + /// some number of track particles associated to it. + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class VertexSelectionAlg final : public EL::AnaAlgorithm { + + public: + /// Algorithm constructor + VertexSelectionAlg( const std::string& name, ISvcLocator* svcLoc ); + + /// @name Function(s) inherited from @c EL::AnaAlgorithm + /// @{ + + /// Function initialising the algorithm + virtual StatusCode initialize() override; + + /// Function executing the algorithm + virtual StatusCode execute() override; + + /// Function finalize the algorithm + virtual StatusCode finalize() override; + + /// @} + + private: + /// @name Algorithm properties + /// @{ + + /// Event store key of the vertex container + std::string m_vertexKey; + /// Number of vertices required in the event + unsigned m_minVertices; + /// Number of track particles required per vertex + unsigned m_minTracks; + + EL::FilterReporterParams m_filterParams {this, "vertex selection"}; + + /// @} + + }; // class VertexSelectionAlg + +} // namespace CP + +#endif // TRACKINGANALYSISALGORITHMS_VERTEXSELECTIONALG_H diff --git a/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..1b18e4184646d3966d9a309e6dd99504ab7b99e4 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/TrackingAnalysisAlgorithms/selection.xml @@ -0,0 +1,6 @@ +<!-- Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration --> +<lcgdict> + + <class name="CP::VertexSelectionAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/src/components/TrackingAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/src/components/TrackingAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e536726f483a2a9851883e1864af62787e181cc8 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/src/components/TrackingAnalysisAlgorithms_entries.cxx @@ -0,0 +1,18 @@ +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// + +// Local include(s): +#include "TrackingAnalysisAlgorithms/VertexSelectionAlg.h" + +// Framework include(s): +#include "GaudiKernel/DeclareFactoryEntries.h" + +// Declare the component(s) of the package: +DECLARE_NAMESPACE_ALGORITHM_FACTORY( CP, VertexSelectionAlg ) + +DECLARE_FACTORY_ENTRIES( TrackingAnalysisAlgorithms ) { + + DECLARE_NAMESPACE_ALGORITHM( CP, VertexSelectionAlg ) + +} diff --git a/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/src/components/TrackingAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/src/components/TrackingAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..241f0be8c02ed62c86ae19560cbf89880bbcad14 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TrackingAnalysisAlgorithms/src/components/TrackingAnalysisAlgorithms_load.cxx @@ -0,0 +1,9 @@ +// +// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +// + +// Framework include(s): +#include "GaudiKernel/LoadFactoryEntries.h" + +// Declare the library to Gaudi: +LOAD_FACTORY_ENTRIES( TrackingAnalysisAlgorithms ) diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a32fb71c0055535e837f92e0ed95fbc66e96d8a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/CMakeLists.txt @@ -0,0 +1,63 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak + +atlas_subdir( TriggerAnalysisAlgorithms ) + +atlas_depends_on_subdirs( + PUBLIC + Event/xAOD/xAODEventInfo + PhysicsAnalysis/Algorithms/SelectionHelpers + PhysicsAnalysis/Algorithms/SystematicsHandles + PhysicsAnalysis/D3PDTools/AnaAlgorithm + PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces + Trigger/TrigEvent/TrigDecisionInterface + PRIVATE + PhysicsAnalysis/D3PDTools/RootCoreUtils ) + +atlas_add_library( TriggerAnalysisAlgorithmsLib + TriggerAnalysisAlgorithms/*.h TriggerAnalysisAlgorithms/*.icc Root/*.cxx + PUBLIC_HEADERS TriggerAnalysisAlgorithms + LINK_LIBRARIES xAODEventInfo SelectionHelpersLib SystematicsHandlesLib + AnaAlgorithmLib AsgAnalysisInterfaces + PRIVATE_LINK_LIBRARIES RootCoreUtils ) + +atlas_add_dictionary( TriggerAnalysisAlgorithmsDict + TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithmsDict.h + TriggerAnalysisAlgorithms/selection.xml + LINK_LIBRARIES TriggerAnalysisAlgorithmsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( TriggerAnalysisAlgorithms + src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES GaudiKernel TriggerAnalysisAlgorithmsLib ) +endif() + +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*_jobOptions.py ) +atlas_install_scripts( share/*_eljob.py ) + +if( XAOD_STANDALONE ) + atlas_add_test( TriggerAlgorithmsTestJobData + SCRIPT TriggerAlgorithmsTest_eljob.py --data-type data --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( TriggerAlgorithmsTestJobFullSim + SCRIPT TriggerAlgorithmsTest_eljob.py --data-type mc --unit-test + PROPERTIES TIMEOUT 600 ) + atlas_add_test( TriggerAlgorithmsTestJobFastSim + SCRIPT TriggerAlgorithmsTest_eljob.py --data-type afii --unit-test + PROPERTIES TIMEOUT 600 ) +else() + atlas_add_test( TriggerAlgorithmsTestJobData + SCRIPT athena.py + TriggerAnalysisAlgorithms/TriggerAlgorithmsTest_jobOptions.py - --data-type data + PROPERTIES TIMEOUT 600 ) + atlas_add_test( TriggerAlgorithmsTestJobFullSim + SCRIPT athena.py + TriggerAnalysisAlgorithms/TriggerAlgorithmsTest_jobOptions.py - --data-type mc + PROPERTIES TIMEOUT 600 ) + atlas_add_test( TriggerAlgorithmsTestJobFastSim + SCRIPT athena.py + TriggerAnalysisAlgorithms/TriggerAlgorithmsTest_jobOptions.py - --data-type afii + PROPERTIES TIMEOUT 600 ) +endif() diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/Root/TrigEventSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/Root/TrigEventSelectorAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a66ce3f0369b823e11ba83781d1958bceb1927b3 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/Root/TrigEventSelectorAlg.cxx @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + +#include <AnaAlgorithm/FilterReporter.h> +#include <RootCoreUtils/StringUtil.h> +#include <TriggerAnalysisAlgorithms/TrigEventSelectionAlg.h> +#include <xAODEventInfo/EventInfo.h> + +CP::TrigEventSelectionAlg::TrigEventSelectionAlg(const std::string &name, + ISvcLocator *svcLoc) + : EL::AnaAlgorithm(name, svcLoc), + m_trigDecisionTool("Trig::TrigDecisionTool/TrigDecisionTool") +{ + declareProperty("tool", m_trigDecisionTool, "trigger decision tool"); + declareProperty("triggers", m_trigList, "trigger selection list"); + declareProperty("selectionDecoration", m_selectionDecoration, "the decoration the trigger pass status"); +} + +StatusCode CP::TrigEventSelectionAlg::initialize() +{ + if (m_trigList.empty()) { + ATH_MSG_ERROR("A list of triggers needs to be provided"); + return StatusCode::FAILURE; + } + + ANA_CHECK(m_trigDecisionTool.retrieve()); + + if (!m_selectionDecoration.empty()) { + for (const std::string &chain : m_trigList) { + m_selectionAccessors.emplace_back(m_selectionDecoration + "_" + RCU::substitute (chain, "-", "_")); + } + } + + ANA_CHECK (m_filterParams.initialize()); + + return StatusCode::SUCCESS; +} + +StatusCode CP::TrigEventSelectionAlg::execute() +{ + EL::FilterReporter filter (m_filterParams, false); + + if (m_trigList.empty()) { + filter.setPassed(true); + return StatusCode::SUCCESS; + } + + const xAOD::EventInfo *evtInfo = 0; + ANA_CHECK(evtStore()->retrieve(evtInfo, "EventInfo")); + + for (size_t i = 0; i < m_trigList.size(); i++) { + bool trigPassed = m_trigDecisionTool->isPassed(m_trigList[i]); + if (!m_selectionDecoration.empty()) { + m_selectionAccessors[i](*evtInfo) = trigPassed; + } + if (trigPassed) + filter.setPassed (true); + } + + return StatusCode::SUCCESS; +} + +StatusCode CP::TrigEventSelectionAlg::finalize() +{ + ANA_CHECK (m_filterParams.finalize()); + + return StatusCode::SUCCESS; +} diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/Root/TrigPrescalesAlg.cxx b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/Root/TrigPrescalesAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..db63776700c525fd4cc495bff87658a529f245b9 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/Root/TrigPrescalesAlg.cxx @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +// +// includes +// + +#include <TriggerAnalysisAlgorithms/TrigPrescalesAlg.h> + +#include <RootCoreUtils/StringUtil.h> +#include <xAODEventInfo/EventInfo.h> + +// +// method implementations +// + +namespace CP +{ + TrigPrescalesAlg :: + TrigPrescalesAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + , m_pileupReweightingTool ("CP::PileupReweightingTool", this) + { + declareProperty ("pileupReweightingTool", m_pileupReweightingTool, "the pileup reweighting tool to be used"); + declareProperty ("triggers", m_trigList, "trigger list"); + declareProperty ("triggersAll", m_trigListAll, "all trigger list"); + declareProperty ("prescaleDecoration", m_prescaleDecoration, "decoration to store prescales"); + } + + + + StatusCode TrigPrescalesAlg :: + initialize () + { + if (m_prescaleDecoration.empty()) + { + ANA_MSG_ERROR ("The decoration should not be empty"); + return StatusCode::FAILURE; + } + + if (m_trigList.empty()) + { + ANA_MSG_ERROR ("A list of triggers needs to be provided"); + return StatusCode::FAILURE; + } + + if (m_trigListAll.empty()) + { + m_trigListAll = m_trigList; + } + + for (const std::string &chain : m_trigListAll) + { + m_prescaleAccessors.emplace_back(m_prescaleDecoration + "_" + RCU::substitute (chain, "-", "_")); + + // Generate helper functions + if (std::find(m_trigList.begin(), m_trigList.end(), chain) != m_trigList.end()) + { + m_prescaleFunctions.emplace_back([this](const xAOD::EventInfo *evtInfo, const std::string &trigger) + { + return m_pileupReweightingTool->getDataWeight (*evtInfo, trigger, true); + }); + } + else + { + m_prescaleFunctions.emplace_back([](const xAOD::EventInfo *, const std::string &) + { + return invalidTriggerPrescale(); + }); + } + } + + ANA_CHECK (m_pileupReweightingTool.retrieve()); + + return StatusCode::SUCCESS; + } + + + + StatusCode TrigPrescalesAlg :: + execute () + { + const xAOD::EventInfo *evtInfo{}; + ANA_CHECK (evtStore()->retrieve(evtInfo, "EventInfo")); + + for (size_t i = 0; i < m_trigListAll.size(); i++) + { + (m_prescaleAccessors[i]) (*evtInfo) = (m_prescaleFunctions[i]) (evtInfo, m_trigListAll[i]); + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TrigEventSelectionAlg.h b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TrigEventSelectionAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..8ed2a020d793a81fce07e2f330968b8c9784dc1a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TrigEventSelectionAlg.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + +#ifndef TRIGGER_ANALYSIS_ALGORITHMS__TRIG_EVENT_SELECTION_ALG_H +#define TRIGGER_ANALYSIS_ALGORITHMS__TRIG_EVENT_SELECTION_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AnaAlgorithm/FilterReporterParams.h> +#include <AsgTools/ToolHandle.h> +#include <AthContainers/AuxElement.h> +#include <TrigDecisionInterface/ITrigDecisionTool.h> + +namespace CP +{ + class TrigEventSelectionAlg : public EL::AnaAlgorithm + { + public: + TrigEventSelectionAlg(const std::string &name, + ISvcLocator *svcLoc = nullptr); + + virtual StatusCode initialize() final; + virtual StatusCode execute() final; + virtual StatusCode finalize() final; + + private: + /// \brief trigger decision tool handle + ToolHandle<Trig::ITrigDecisionTool> m_trigDecisionTool; + + /// \brief list of triggers or trigger chains + std::vector<std::string> m_trigList; + + /// \brief the decoration for trigger selection + std::string m_selectionDecoration; + + /// \brief the accessors for \ref m_selectionDecoration and \ref m_trigList combination + std::vector<SG::AuxElement::Decorator<bool>> m_selectionAccessors; + + /// \brief the filter reporter parameters + EL::FilterReporterParams m_filterParams {this, "trigger event selection"}; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TrigPrescalesAlg.h b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TrigPrescalesAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..a6148e03355c72ff8248badd1846dc279baa05cb --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TrigPrescalesAlg.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef TRIGGER_ANALYSIS_ALGORITHMS__TRIG_PRESCALES_ALG_H +#define TRIGGER_ANALYSIS_ALGORITHMS__TRIG_PRESCALES_ALG_H + +#include <functional> + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <AsgAnalysisInterfaces/IPileupReweightingTool.h> + +namespace CP +{ + /// \brief the decoration value to use if there is no valid + /// trigger prescale information + constexpr float invalidTriggerPrescale () {return -1;} + + + + /// \brief an algorithm for retrieving trigger prescales + + class TrigPrescalesAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + TrigPrescalesAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + + /// \brief the pile-up reweighting tool + private: + ToolHandle<IPileupReweightingTool> m_pileupReweightingTool; + + /// \brief list of prescaled triggers or trigger chains + private: + std::vector<std::string> m_trigList; + + /// \brief list of all triggers or trigger chains + private: + std::vector<std::string> m_trigListAll; + + /// \brief list of helper functions to compute the prescales + private: + std::vector<std::function<float(const xAOD::EventInfo *, const std::string &)>> m_prescaleFunctions; + + /// \brief the decoration for trigger prescales + private: + std::string m_prescaleDecoration; + + /// \brief the accessors for \ref m_prescaleDecoration and \ref m_trigList combination + private: + std::vector<SG::AuxElement::Decorator<float>> m_prescaleAccessors; + }; +} + +#endif diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithmsDict.h new file mode 100644 index 0000000000000000000000000000000000000000..e86f6bb0300e7f053194ccaff336275923bbad3e --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithmsDict.h @@ -0,0 +1,14 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#ifndef TRIGGER_ANALYSIS_ALGORITHMS__TRIGGER_ANALYSIS_ALGORITHMS_DICT_H +#define TRIGGER_ANALYSIS_ALGORITHMS__TRIGGER_ANALYSIS_ALGORITHMS_DICT_H + +#include <TriggerAnalysisAlgorithms/TrigEventSelectionAlg.h> +#include <TriggerAnalysisAlgorithms/TrigPrescalesAlg.h> + +#endif diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..677efcf89427a25b3066bad75f590d0da329561a --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/TriggerAnalysisAlgorithms/selection.xml @@ -0,0 +1,6 @@ +<lcgdict> + + <class name="CP::TrigEventSelectionAlg" /> + <class name="CP::TrigPrescalesAlg" /> + +</lcgdict> diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/TriggerAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/TriggerAnalysisAlgorithmsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..c0d82335ddd0c6c11bafdfa3e860b04a253974fb --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/TriggerAnalysisAlgorithmsTest.py @@ -0,0 +1,49 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak +# @author Nils Krumnack + +from AnaAlgorithm.AlgSequence import AlgSequence +from AnaAlgorithm.DualUseConfig import createAlgorithm + +def makeSequence (dataType) : + + # Config: + triggerChains = [ + 'HLT_2mu14', + 'HLT_mu20_mu8noL1', + 'HLT_2e17_lhvloose_nod0' + ] + + + algSeq = AlgSequence() + + # Set up the systematics loader/handler algorithm: + alg = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' ) + alg.sigmaRecommended = 1 + algSeq += alg + + # Include, and then set up the pileup analysis sequence: + from TriggerAnalysisAlgorithms.TriggerAnalysisSequence import \ + makeTriggerAnalysisSequence + triggerSequence = makeTriggerAnalysisSequence( dataType, triggerChains=triggerChains ) + algSeq += triggerSequence + + # Set up an ntuple to check the job with: + treeMaker = createAlgorithm( 'CP::TreeMakerAlg', 'TreeMaker' ) + treeMaker.TreeName = 'events' + algSeq += treeMaker + ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMaker' ) + ntupleMaker.TreeName = 'events' + ntupleMaker.Branches = [ + 'EventInfo.runNumber -> runNumber', + 'EventInfo.eventNumber -> eventNumber', + ] + ntupleMaker.Branches += ['EventInfo.trigPassed_' + t + ' -> trigPassed_' + t for t in triggerChains] + ntupleMaker.systematicsRegex = '.*' + algSeq += ntupleMaker + treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' ) + treeFiller.TreeName = 'events' + algSeq += treeFiller + + return algSeq diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/TriggerAnalysisSequence.py b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/TriggerAnalysisSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..68e6dcfbc0bcacdcb3e35ebe39813ba29e8853be --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/TriggerAnalysisSequence.py @@ -0,0 +1,58 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# AnaAlgorithm import(s): +from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence +from AnaAlgorithm.DualUseConfig import addPrivateTool, createAlgorithm, createPublicTool + + +def makeTriggerAnalysisSequence( dataType, + triggerChains = [], + prescaleLumiCalcFiles = []): + """Create a basic trigger analysis algorithm sequence + + Keyword arguments: + dataType -- The data type to run on ("data", "mc" or "afii") + triggerChains -- a list of trigger chains + prescaleLumiCalcFiles -- a list of lumicalc files to calculate trigger prescales + """ + + if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + + # Create the analysis algorithm sequence object: + seq = AnaAlgSequence( "TriggerAnalysisSequence" ) + + # Create public trigger tools + xAODConfTool = createPublicTool( 'TrigConf::xAODConfigTool', 'xAODConfigTool' ) + decisionTool = createPublicTool( 'Trig::TrigDecisionTool', 'TrigDecisionTool') + decisionTool.ConfigTool = '%s/%s' % \ + ( xAODConfTool.getType(), xAODConfTool.getName() ) + + seq.addPublicTool( xAODConfTool ) + seq.addPublicTool( decisionTool ) + + if triggerChains: + # Set up the trigger selection: + alg = createAlgorithm( 'CP::TrigEventSelectionAlg', 'TrigEventSelectorAlg' ) + alg.tool = '%s/%s' % \ + ( decisionTool.getType(), decisionTool.getName() ) + alg.triggers = list(triggerChains) + alg.selectionDecoration = 'trigPassed' + + seq.append( alg, inputPropName = None ) + + # Calculate trigger prescales + if dataType == 'data' and prescaleLumiCalcFiles: + alg = createAlgorithm( 'CP::TrigPrescalesAlg', 'TrigPrescalesAlg' ) + addPrivateTool( alg, 'pileupReweightingTool', 'CP::PileupReweightingTool' ) + alg.pileupReweightingTool.LumiCalcFiles = prescaleLumiCalcFiles + alg.pileupReweightingTool.TrigDecisionTool = '%s/%s' % \ + ( decisionTool.getType(), decisionTool.getName() ) + alg.triggers = [lumicalc.split(':')[-1] for lumicalc in prescaleLumiCalcFiles if ':' in lumicalc] + alg.triggersAll = list(triggerChains) + alg.prescaleDecoration = 'prescale' + + seq.append( alg, inputPropName = None ) + + # Return the sequence: + return seq diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a37d36f3512db5b18b69e65df7aff2568fa8d2aa --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +__version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_eljob.py new file mode 100755 index 0000000000000000000000000000000000000000..ffcf2f3e48d094cfd01f7a222259706ee2cfa53c --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_eljob.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak + + +# Read the submission directory as a command line argument. You can +# extend the list of arguments with your private ones later on. +import optparse +parser = optparse.OptionParser() +parser.add_option( '-d', '--data-type', dest = 'data_type', + action = 'store', type = 'string', default = 'data', + help = 'Type of data to run over. Valid options are data, mc, afii' ) +parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', + action = 'store', type = 'string', default = 'submitDir', + help = 'Submission directory for EventLoop' ) +parser.add_option( '-u', '--unit-test', dest='unit_test', + action = 'store_true', default = False, + help = 'Run the job in "unit test mode"' ) +( options, args ) = parser.parse_args() + +# Set up (Py)ROOT. +import ROOT +ROOT.xAOD.Init().ignore() + +# ideally we'd run over all of them, but we don't have a mechanism to +# configure per-sample right now + +dataType = options.data_type + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +if dataType not in ["data", "mc", "afii"] : + raise ValueError ("invalid data type: " + dataType) + +# Set up the sample handler object. See comments from the C++ macro +# for the details about these lines. +import os +sh = ROOT.SH.SampleHandler() +sh.setMetaString( 'nc_tree', 'CollectionTree' ) +sample = ROOT.SH.SampleLocal (dataType) +sample.add (os.getenv (inputfile[dataType])) +sh.add (sample) +sh.printContent() + +# Create an EventLoop job. +job = ROOT.EL.Job() +job.sampleHandler( sh ) +job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 ) +job.options().setString( ROOT.EL.Job.optSubmitDirMode, "unique" ) + +from TriggerAnalysisAlgorithms.TriggerAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging +for alg in algSeq: + job.algsAdd( alg ) + pass + +# Set up an output file for the job: +job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) ) + +# Find the right output directory: +submitDir = options.submission_dir +if options.unit_test: + import os + import tempfile + submitDir = tempfile.mkdtemp( prefix = 'triggerTest_', dir = os.getcwd() ) + os.rmdir( submitDir ) + pass + +# Run the job using the direct driver. +driver = ROOT.EL.DirectDriver() +driver.submit( job, submitDir ) diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..a2244c9537c4367bf0920072a0f7b72391ca0c6f --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# @author Tadej Novak + +# User options, which can be set from command line after a "-" character +# athena EgammaAlgorithmsTest_jobOptions.py - --myOption ... +from AthenaCommon.AthArgumentParser import AthArgumentParser +athArgsParser = AthArgumentParser() +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") +athArgs = athArgsParser.parse_args() + +dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) + +print("Running on data type: " + dataType) + +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} + +# Set up the reading of the input file: +import AthenaRootComps.ReadAthenaxAODHybrid +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] + +from TriggerAnalysisAlgorithms.TriggerAnalysisAlgorithmsTest import makeSequence +algSeq = makeSequence (dataType) +print algSeq # For debugging + +# Add all algorithms from the sequence to the job. +athAlgSeq += algSeq + +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='TriggerAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" + ] + +# Reduce the printout from Athena: +include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/src/components/TriggerAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/src/components/TriggerAnalysisAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..aece9a7e751ec8175aa6ec410eb0b793f92ff366 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/src/components/TriggerAnalysisAlgorithms_entries.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#include <GaudiKernel/DeclareFactoryEntries.h> + +#include <TriggerAnalysisAlgorithms/TrigEventSelectionAlg.h> +#include <TriggerAnalysisAlgorithms/TrigPrescalesAlg.h> + + +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, TrigEventSelectionAlg) +DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, TrigPrescalesAlg) + +DECLARE_FACTORY_ENTRIES(TriggerAnalysisAlgorithms) { + DECLARE_NAMESPACE_ALGORITHM (CP, TrigEventSelectionAlg) + DECLARE_NAMESPACE_ALGORITHM (CP, TrigPrescalesAlg) +} diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/src/components/TriggerAnalysisAlgorithms_load.cxx b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/src/components/TriggerAnalysisAlgorithms_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1ba6022270b61d9a459b7d658eabc026ae7190dc --- /dev/null +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/src/components/TriggerAnalysisAlgorithms_load.cxx @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Tadej Novak + + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(TriggerAnalysisAlgorithms) diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/CMakeLists.txt index 498f13a2bd4af947fb2d4c89b97395722069932a..e49766d79eccc6d94db3fb8919d99fa70f45bb67 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/CMakeLists.txt @@ -19,6 +19,7 @@ atlas_depends_on_subdirs( PRIVATE GaudiKernel Generators/GenAnalysisTools/TruthHelper Generators/GeneratorObjects + Generators/AtlasHepMC PhysicsAnalysis/AnalysisCommon/AnalysisTools PhysicsAnalysis/AnalysisCommon/AnalysisUtils PhysicsAnalysis/AnalysisCommon/CompositeParticleEvent @@ -44,7 +45,6 @@ atlas_depends_on_subdirs( PRIVATE # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( HepPDT ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) @@ -52,8 +52,8 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minui atlas_add_component( AnalysisExamples src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} CaloEvent AthenaBaseComps AthenaKernel Navigation SGTools StoreGateLib SGtests NavFourMom xAODEventInfo xAODTracking GaudiKernel TruthHelper GeneratorObjects AthAnalysisToolsLib AnalysisUtilsLib ParticleEvent AnalysisTriggerEvent JetTagEvent JetTagInfo MuonIDEvent McParticleEvent McParticleKernel JetEvent muonEvent Particle ParticleTruth RecoToolInterfaces egammaEvent VxVertex TrkVKalVrtFitterLib TrigDecisionToolLib TrigInDetEvent TrigParticle TrigSteeringEvent ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib CaloEvent AthenaBaseComps AthenaKernel Navigation SGTools StoreGateLib SGtests NavFourMom xAODEventInfo xAODTracking GaudiKernel TruthHelper GeneratorObjects AthAnalysisToolsLib AnalysisUtilsLib ParticleEvent AnalysisTriggerEvent JetTagEvent JetTagInfo MuonIDEvent McParticleEvent McParticleKernel JetEvent muonEvent Particle ParticleTruth RecoToolInterfaces egammaEvent VxVertex TrkVKalVrtFitterLib TrigDecisionToolLib TrigInDetEvent TrigParticle TrigSteeringEvent ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.cxx index 5e1d57db07a4b7f2d2885b6e1a977229641e433c..ba11f5df82b214c14592a4fcb54e2f5996d9ff13 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.cxx +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.cxx @@ -77,9 +77,9 @@ #include "VxVertex/RecVertex.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "xAODEventInfo/EventInfo.h" #include "AthenaKernel/Units.h" diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.h index 271eeefcec43348e020b2ed3b2e209402a739778..d0b20006ddc788ddbd194099f2b02229053e59e7 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.h +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.h @@ -24,7 +24,7 @@ #include "JetEvent/JetTagInfoBase.h" #include "ParticleTruth/TrackParticleTruth.h" #include "ParticleTruth/TrackParticleTruthCollection.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "CLHEP/Vector/ThreeVector.h" #include "HepPDT/ParticleDataTable.hh" #include "egammaEvent/ElectronContainer.h" diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.cxx index 6320d756f541ea30abbe93b81e702ab6ad0a7778..ee85d0e11f04130fee18b70ef220e7694ef77147 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.cxx +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.cxx @@ -21,9 +21,9 @@ #include "StoreGate/DataHandle.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "McParticleKernel/ITruthParticleCnvTool.h" diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/CMakeLists.txt index 3a6b1c1ba8ae8d4e07d915500588670ded7dbee9..5e99eea7a1fef73f767e2e44b1b68c330fd081c4 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/CMakeLists.txt @@ -28,19 +28,19 @@ atlas_depends_on_subdirs( PUBLIC PhysicsAnalysis/AnalysisCommon/AnalysisUtils PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent PhysicsAnalysis/TruthParticleID/McParticleUtils - Reconstruction/Jet/JetEvent ) + Reconstruction/Jet/JetEvent + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) find_package( CppUnit ) -find_package( HepMC ) # Component(s) in the package: atlas_add_component( AnalysisTest src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} ${CLHEP_LIBRARIES} ${CPPUNIT_LIBRARIES} AthContainers StoreGateLib SGtests NavFourMom GaudiKernel McParticleEvent muonEvent Particle egammaEvent tauEvent VxVertex TestTools AthenaBaseComps AthenaKernel EventKernel FourMom GeneratorObjects AnalysisAssociation AnalysisUtilsLib AnalysisTriggerEvent McParticleUtils JetEvent ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} + LINK_LIBRARIES AtlasHepMCLib ${CLHEP_LIBRARIES} ${CPPUNIT_LIBRARIES} AthContainers StoreGateLib SGtests NavFourMom GaudiKernel McParticleEvent muonEvent Particle egammaEvent tauEvent VxVertex TestTools AthenaBaseComps AthenaKernel EventKernel FourMom GeneratorObjects AnalysisAssociation AnalysisUtilsLib AnalysisTriggerEvent McParticleUtils JetEvent ) # Install files from the package: atlas_install_headers( AnalysisTest ) diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/McVtxFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/McVtxFilterTest_CppUnit.cxx index d50c525dbc6da25ee413d42e911439b4257a1824..1bf60d1e731660f9f0e52c9280dd8f20ab1660df 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/McVtxFilterTest_CppUnit.cxx +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/McVtxFilterTest_CppUnit.cxx @@ -19,9 +19,9 @@ #include "CLHEP/Units/SystemOfUnits.h" // HepMC includes -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "AthContainers/DataVector.h" diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/PdgIdFilterTest_CppUnit.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/PdgIdFilterTest_CppUnit.cxx index 60f89149a28e4644e0d7c06cf882306577a0d4a0..b71bc55fd556beb12301a5b72d1f779f2e4dde06 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/PdgIdFilterTest_CppUnit.cxx +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisTest/test/PdgIdFilterTest_CppUnit.cxx @@ -16,7 +16,7 @@ // CLHEP includes #include "CLHEP/Units/SystemOfUnits.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "AthContainers/DataVector.h" diff --git a/PhysicsAnalysis/AthenaROOTAccess/AthenaROOTAccess/TestTypes.h b/PhysicsAnalysis/AthenaROOTAccess/AthenaROOTAccess/TestTypes.h index 60e3bf2e5cccbc56ae4f54975a1399a1065d43ef..dc499bf629e4f55bbc789f10a392bc7b3e309a62 100644 --- a/PhysicsAnalysis/AthenaROOTAccess/AthenaROOTAccess/TestTypes.h +++ b/PhysicsAnalysis/AthenaROOTAccess/AthenaROOTAccess/TestTypes.h @@ -1,10 +1,9 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id$ /** * @file AthenaROOTAccess/TestTypes.h * @author scott snyder <snyder@bnl.gov> @@ -79,7 +78,6 @@ struct H }; -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) struct G : virtual public E, virtual public F, public H { @@ -101,27 +99,6 @@ struct G int g; }; -#else -struct G - : virtual public E/*, virtual public F*/, public H -{ - G(int x) : D(x), E(x+10)/*, F(x+20)*/, H(x+40), g(x+30) {} - - // Avoid gcc4.8 warning - G(const G& other) : D(other), E(other), H(other), g(other.g) {} - G(G&& other) : D(other), E(other), H(other), g(other.g) {} - G& operator= (const G& other) - { if (this != &other) { x = other.x; e = other.e; g = other.g; h = other.h; } - return *this; - } - G& operator= (G&& other) - { if (this != &other) { x = other.x; e = other.e; g = other.g; h = other.h; } - return *this; - } - - int g; -}; -#endif } // namespace ARATest @@ -131,11 +108,7 @@ DATAVECTOR_BASE (ARATest::C, ARATest::A); DATAVECTOR_VIRTBASES1 (ARATest::E, ARATest::D); DATAVECTOR_VIRTBASES1 (ARATest::F, ARATest::D); -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) DATAVECTOR_VIRTBASES2 (ARATest::G, ARATest::E, ARATest::F); -#else -DATAVECTOR_VIRTBASES1 (ARATest::G, ARATest::E); -#endif SG_ADD_BASE (ARATest::G, ARATest::H); diff --git a/PhysicsAnalysis/D2PDMaker/CMakeLists.txt b/PhysicsAnalysis/D2PDMaker/CMakeLists.txt index 8c8358ab560896c797e2c227229605f9d1848b01..2005e65fe2ea1aabe3d298bb792907e666c30127 100644 --- a/PhysicsAnalysis/D2PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D2PDMaker/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( Event/NavFourMom GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC PhysicsAnalysis/AnalysisCommon/AnalysisUtils PhysicsAnalysis/AnalysisCommon/PATCore PhysicsAnalysis/AnalysisCommon/ParticleEvent @@ -40,16 +41,15 @@ atlas_depends_on_subdirs( # External dependencies: find_package( Boost ) find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist ) # Component(s) in the package: atlas_add_component( D2PDMaker D2PDMaker/*.h D2PDMaker/*.icc src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - ${HEPMC_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} - ${HEPMC_LIBRARIES} CaloEvent AthenaBaseComps AthenaKernel AthContainers AthLinks + AtlasHepMCLib CaloEvent AthenaBaseComps AthenaKernel AthContainers AthLinks Navigation StoreGateLib EventKernel NavFourMom GaudiKernel GeneratorObjects AnalysisUtilsLib PATCoreLib ParticleEvent AssociationKernel McParticleEvent JetEvent muonEvent Particle egammaEvent tauEvent VxVertex diff --git a/PhysicsAnalysis/D2PDMaker/D2PDMaker/D2PDTruthParticleSelector.h b/PhysicsAnalysis/D2PDMaker/D2PDMaker/D2PDTruthParticleSelector.h index c945b8e61bf86950e1a8c3adcf196d92b687e978..ad7113c43afce816b0a6b7ad5bf39bef1c005d08 100644 --- a/PhysicsAnalysis/D2PDMaker/D2PDMaker/D2PDTruthParticleSelector.h +++ b/PhysicsAnalysis/D2PDMaker/D2PDMaker/D2PDTruthParticleSelector.h @@ -31,7 +31,7 @@ #include "GeneratorObjects/McEventCollection.h" #include "McParticleEvent/TruthParticle.h" #include "McParticleEvent/TruthParticleContainer.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" diff --git a/PhysicsAnalysis/D2PDMaker/src/D2PDParticleCombiner.cxx b/PhysicsAnalysis/D2PDMaker/src/D2PDParticleCombiner.cxx index 79049aef2e65352d4d62425eed290a8a02060e15..b4cab570b04eadde6f9613d34c41ed57a85abd26 100644 --- a/PhysicsAnalysis/D2PDMaker/src/D2PDParticleCombiner.cxx +++ b/PhysicsAnalysis/D2PDMaker/src/D2PDParticleCombiner.cxx @@ -48,8 +48,8 @@ #include "GeneratorObjects/McEventCollection.h" #include "McParticleEvent/TruthParticle.h" #include "McParticleEvent/TruthParticleContainer.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" // The AthenaBarCode, used to check if two particles are identical #include "Navigation/IAthenaBarCode.h" diff --git a/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx b/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx index f5c0c6d27e1ae0e25ddb356945d9dcfe82261c21..bac52a9a11795991c55645d2bc0b67ca9a33a914 100644 --- a/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx +++ b/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx @@ -27,8 +27,8 @@ #include "D2PDMaker/D2PDTruthParticleSelector.h" // MC Truth includes -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "TruthHelper/IsGenStable.h" #include "TruthHelper/IsGenerator.h" #include "TruthHelper/IsStatus.h" diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/CMakeLists.txt index c01816fc744d501f53acb64edb12c61ec51cef8a..be475e86a92c452666f30bb37bd44c5ca7ee460d 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/CMakeLists.txt @@ -48,19 +48,18 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkEvent/VxVertex Tracking/TrkTools/TrkToolInterfaces Tracking/TrkValidation/TrkVertexFitterValidationUtils - ) + Generators/AtlasHepMC ) # External dependencies: find_package( Boost ) -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( InDetD3PDMaker src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPMC_LIBRARIES} ${HEPPDT_LIBRARIES} GaudiKernel CommissionEvent AthContainers AthenaKernel StoreGateLib AtlasDetDescr GeoAdaptors Identifier EventPrimitives xAODEventInfo xAODTracking InDetBeamSpotServiceLib SCT_ConditionsToolsLib TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry SCT_CablingLib InDetRawData InDetPrepRawData InDetRIO_OnTrack InDetSimEvent D3PDMakerUtils MCTruthClassifierLib ParticleTruth ITrackToVertex muonEvent Particle TrkCompetingRIOsOnTrack TrkEventPrimitives TrkParameters TrkParticleBase TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData TrkV0Vertex VxVertex TrkToolInterfaces TrkVertexFitterValidationUtilsLib ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} AtlasHepMCLib ${HEPPDT_LIBRARIES} GaudiKernel CommissionEvent AthContainers AthenaKernel StoreGateLib AtlasDetDescr GeoAdaptors Identifier EventPrimitives xAODEventInfo xAODTracking InDetBeamSpotServiceLib SCT_ConditionsToolsLib TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry SCT_CablingLib InDetRawData InDetPrepRawData InDetRIO_OnTrack InDetSimEvent D3PDMakerUtils MCTruthClassifierLib ParticleTruth ITrackToVertex muonEvent Particle TrkCompetingRIOsOnTrack TrkEventPrimitives TrkParameters TrkParticleBase TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData TrkV0Vertex VxVertex TrkToolInterfaces TrkVertexFitterValidationUtilsLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/share/RecoOptions.py b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/share/RecoOptions.py index 138c491debf2602d12ea25eceb8acebdfd4a82b7..2be702bc9108450674783576a1f5b5913c1951d0 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/share/RecoOptions.py +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/share/RecoOptions.py @@ -105,8 +105,6 @@ InDetFlags.preProcessing = redoPatternRecoAndTracking InDetFlags.doPRDFormation = redoPatternRecoAndTracking # those two will be (later) automatically false if InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing is false InDetFlags.doNewTracking = redoPatternRecoAndTracking -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doLowPt = True InDetFlags.doCTBTracking = False InDetFlags.doBackTracking = redoPatternRecoAndTracking diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/share/RecoSetupForSctNtuple.py b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/share/RecoSetupForSctNtuple.py index 5e2cdf67537ff22aa84ce382429b7268b3925d82..0e6e9383601d3fcc0b050cca6c68993e35320ae8 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/share/RecoSetupForSctNtuple.py +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/share/RecoSetupForSctNtuple.py @@ -145,8 +145,6 @@ InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing i InDetFlags.doNewTracking = redoPatternRecoAndTracking if readESD: - InDetFlags.doiPatRec = False - InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doCTBTracking = False diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitFillerTool.cxx index 6aa5810ce1ac1bd7a10c565231dbaec3782b6ac3..fc50dc610a7ffae520d4b9b851376ad014d437fa 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitFillerTool.cxx @@ -9,7 +9,7 @@ //#include "InDetIdentifier/PixelID.h" //#include "InDetPrepRawData/PixelCluster.h" //#include "TrkEventPrimitives/ErrorMatrix.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" //#include "GeoAdaptors/GeoSiHit.h" /* diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitTruthAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitTruthAssociationTool.cxx index bb5841ee3c51d44b08ed7b205e6e8ac8bc1058fd..fd8111b8dd96178a5cc3b6cf7aa79c47dadb298d 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitTruthAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitTruthAssociationTool.cxx @@ -5,7 +5,7 @@ #include "SiHitTruthAssociationTool.h" #include "AthenaKernel/errorcheck.h" - #include "HepMC/GenParticle.h" + #include "AtlasHepMC/GenParticle.h" //#include "TrkTrack/Track.h" //#include "TrkTrack/TrackCollection.h" //#include "TrkTruthData/TrackTruthCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitTruthAssociationTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitTruthAssociationTool.h index 488cfed3ef2cd204fff208c5e10e299a5c1fbe27..6dd3312120d770000f1d3511df50d99aa0ff4348 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitTruthAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SiHitTruthAssociationTool.h @@ -13,7 +13,7 @@ #include "StoreGate/StoreGateSvc.h" #include "InDetSimEvent/SiHit.h" #include "InDetSimEvent/SiHitCollection.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" namespace Trk { diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TRTUncompressedHitFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TRTUncompressedHitFillerTool.cxx index 56e557ef131c451e9ab6157c77778f469301d04d..f233c73630873c7b8cf200c380e4cfc10917eaaa 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TRTUncompressedHitFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TRTUncompressedHitFillerTool.cxx @@ -5,7 +5,7 @@ #include "TRTUncompressedHitFillerTool.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeoAdaptors/GeoTRTUncompressedHit.h" D3PD::TRTUncompressedHitFillerTool::TRTUncompressedHitFillerTool (const std::string& type, diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleDetailedTruthAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleDetailedTruthAssociationTool.cxx index 38c3dd5fcf52ce157c8d2cb82ce036b91130ad9b..a4b8ec29d70bc622cdd07e4440174907af3c9f9c 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleDetailedTruthAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleDetailedTruthAssociationTool.cxx @@ -7,8 +7,8 @@ #include "TrackParticleDetailedTruthAssociationTool.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "Particle/TrackParticle.h" #include "TrkTrack/Track.h" #include "TrkTrack/TrackCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleDetailedTruthAssociationTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleDetailedTruthAssociationTool.h index b6b307fbd23faf23ae669c8d0ffb53e33f2596b0..1e59e60a1aadf737bf7e86d5256a7276feab76e6 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleDetailedTruthAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleDetailedTruthAssociationTool.h @@ -14,7 +14,7 @@ #include "StoreGate/StoreGateSvc.h" #include "TrkTruthData/DetailedTrackTruthCollection.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <vector> namespace Rec { diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleTruthAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleTruthAssociationTool.cxx index 90bc8151cd4874292f191e10b1add74bc0fdd899..a4e8e908802967b66833528df7f23c587c7c3e7d 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleTruthAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleTruthAssociationTool.cxx @@ -5,7 +5,7 @@ #include "TrackParticleTruthAssociationTool.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "Particle/TrackParticle.h" #include "Particle/TrackParticleContainer.h" #include "ParticleTruth/TrackParticleTruthCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleTruthAssociationTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleTruthAssociationTool.h index 4de09047f3337871a1215b5adee727965c7420cc..80a16397b683ca1e6850b0eacd7aa82e1a18d825 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleTruthAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleTruthAssociationTool.h @@ -14,9 +14,7 @@ #include "StoreGate/StoreGateSvc.h" -namespace HepMC { -class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Rec { class TrackParticle; diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkPrepRawDataGenParticleAssociationTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkPrepRawDataGenParticleAssociationTool.h index 467279a0e072e467ef08c8e894d87b140d1c3ce7..98505283c7776f147264ccbb3ce6b5388d0f0bf1 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkPrepRawDataGenParticleAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkPrepRawDataGenParticleAssociationTool.h @@ -8,7 +8,7 @@ #include "D3PDMakerUtils/MultiAssociationTool.h" #include "GaudiKernel/ToolHandle.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "Identifier/Identifier.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" #include "TrkPrepRawData/PrepRawData.h" diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackDetailedTruthAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackDetailedTruthAssociationTool.cxx index c381e6168c68cf06f5eb5fc39e2da25b5d55db2e..5fccc41bd2dbb33f8e5716e197308ab189ea4f8f 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackDetailedTruthAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackDetailedTruthAssociationTool.cxx @@ -5,7 +5,7 @@ #include "TrkTrackDetailedTruthAssociationTool.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkTrack/Track.h" #include "TrkTrack/TrackCollection.h" #include "TrkTruthData/DetailedTrackTruthCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackDetailedTruthAssociationTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackDetailedTruthAssociationTool.h index 7811b91aaf2310bd24f04fd09d9d47397c35d4ff..ca8b925d3824e4de0350982dbb63c9965439e95e 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackDetailedTruthAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackDetailedTruthAssociationTool.h @@ -12,7 +12,7 @@ #include "StoreGate/StoreGateSvc.h" #include "TrkTruthData/DetailedTrackTruthCollection.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <vector> namespace Trk { diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackTruthAssociationTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackTruthAssociationTool.h index fd12a3b625c6cf745ca67a7e39a892760061eeea..bf81fb87d9aede0a96a17379fd0a29f50b18b3a7 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackTruthAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrkTrackTruthAssociationTool.h @@ -10,7 +10,7 @@ // EDM include(s): #include "TrkTrack/Track.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // D3PDMaker include(s): #include "D3PDMakerUtils/SingleAssociationTool.h" diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackFillerTool.cxx index 5f594ad6637a82497b32c56aaab6ee934fc21352..2c3a5484fcd391e9714caa78c1f57ac416e31b83 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackFillerTool.cxx @@ -7,8 +7,8 @@ #include "TruthTrackFillerTool.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackFillerTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackFillerTool.h index afe5dd81e4b89246916b7ec5b49f9b645228a6eb..47031a8c33e1a60c410f95cbd2dc464b6b8bf3d2 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackFillerTool.h @@ -11,9 +11,7 @@ #include "GaudiKernel/IPartPropSvc.h" #include "HepPDT/ParticleDataTable.hh" -namespace HepMC { -class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackGetterTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackGetterTool.h index 6879f611857bc3ab10b2e6ea6414beb9ea588eec..85792a23d7be0a3be20035162291fedd4c87affd 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackGetterTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthTrackGetterTool.h @@ -10,8 +10,8 @@ #include "D3PDMakerUtils/SGCollectionGetterTool.h" #include "GeneratorObjects/McEventCollection.h" #include "HepPDT/ParticleDataTable.hh" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthVertexFillerTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthVertexFillerTool.h index fce9f6d53ff1d3fd5fda95cfaf2ad2ad8eb8bb50..8e63da443a325f7e75de4e4b6bca2ca911c73ee4 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthVertexFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthVertexFillerTool.h @@ -8,7 +8,7 @@ #define INDETD3PDMAKER_TRUTHVERTEXFILLERTOOL_H #include "D3PDMakerUtils/BlockFillerTool.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthVertexGetterTool.h b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthVertexGetterTool.h index eb3b8740a408150d02859ed15ece8b74791c844a..83c3f3287c409f97e5e948d3002a5e2ec917eecd 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthVertexGetterTool.h +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TruthVertexGetterTool.h @@ -8,8 +8,8 @@ #define INDETD3PDMAKER_TRUTHVERTEXGETTERTOOL_H #include "D3PDMakerUtils/SGCollectionGetterTool.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/McEventCollection.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/CMakeLists.txt index d863e754a5a211b9841044cec8315ad777407b07..f862d80cd5a557bf594f9240c961ac5976dffd9b 100644 --- a/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/CMakeLists.txt @@ -14,6 +14,7 @@ atlas_depends_on_subdirs( PRIVATE Event/EventPrimitives GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry @@ -34,15 +35,14 @@ atlas_depends_on_subdirs( PRIVATE # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) -find_package( HepMC ) find_package( CLHEP ) # Component(s) in the package: atlas_add_component( JetTagD3PDMaker src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel AthContainers EventKernel EventPrimitives GaudiKernel GeneratorObjects InDetIdentifier InDetReadoutGeometry D3PDMakerUtils JetTagEvent JetTagInfo MuonIDEvent McParticleEvent JetEvent muonEvent Particle egammaEvent TrkParticleBase VxJetVertex VxSecVertex VxVertex TrkVertexFitterInterfaces ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel AthContainers EventKernel EventPrimitives GaudiKernel GeneratorObjects InDetIdentifier InDetReadoutGeometry D3PDMakerUtils JetTagEvent JetTagInfo MuonIDEvent McParticleEvent JetEvent muonEvent Particle egammaEvent TrkParticleBase VxJetVertex VxSecVertex VxVertex TrkVertexFitterInterfaces ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/src/JetTagJetGenSoftLeptonAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/src/JetTagJetGenSoftLeptonAssociationTool.cxx index d3df5293b63345f512789c9458bc05add7fa6f7d..fc97ac027bc4ae60d24e84e1b86446f38e70c4e8 100644 --- a/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/src/JetTagJetGenSoftLeptonAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/src/JetTagJetGenSoftLeptonAssociationTool.cxx @@ -5,8 +5,8 @@ #include "JetTagJetGenSoftLeptonAssociationTool.h" #include "JetEvent/Jet.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" #include "GeneratorObjects/McEventCollection.h" #include "JetTagInfo/SoftLeptonTruthInfo.h" diff --git a/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/src/JetTagJetGenSoftLeptonAssociationTool.h b/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/src/JetTagJetGenSoftLeptonAssociationTool.h index 2c95196c1a1227470b552a29a0656b2bcfe7df93..272f4d8940fe5e0cfb75fef092e0f56198e675da 100644 --- a/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/src/JetTagJetGenSoftLeptonAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/JetTagD3PDMaker/src/JetTagJetGenSoftLeptonAssociationTool.h @@ -19,10 +19,8 @@ class Jet; -namespace HepMC{ - class GenParticle; - class GenEvent; -} +#include "AtlasHepMC/GenParticle_fwd.h" +#include "AtlasHepMC/GenEvent_fwd.h" namespace Analysis{ class SoftLeptonTruthInfo; diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/CMakeLists.txt index dbadc55323ce2cd7b692144d5e294c7334bf9af7..87979a86a35443920ab1feddd3f5bc290b4289b8 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/CMakeLists.txt @@ -45,19 +45,19 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkTools/TrkToolInterfaces Trigger/TrigAnalysis/TrigObjectMatching Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigEvent/TrigMuonEvent ) + Trigger/TrigEvent/TrigMuonEvent + Generators/AtlasHepMC ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) -find_package( HepMC ) # Component(s) in the package: atlas_add_component( MuonD3PDMaker src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel AthContainers StoreGateLib SGtests AtlasDetDescr EventInfo EventKernel FourMomUtils xAODMuon xAODTracking xAODTruth GaudiKernel MuonCalibITools MuonIdHelpersLib MuonPattern MuonPrepRawData MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonSimEvent AnalysisTriggerEvent D3PDMakerUtils TriggerD3PDMakerLib MCTruthClassifierLib McParticleEvent muonEvent TrkGeometry TrkEventPrimitives TrkPrepRawData TrkSegment TrkTrackSummary TrkTruthData TrkExInterfaces TrkToolInterfaces TrigObjectMatchingLib TrigInDetEvent TrigMuonEvent ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel AthContainers StoreGateLib SGtests AtlasDetDescr EventInfo EventKernel FourMomUtils xAODMuon xAODTracking xAODTruth GaudiKernel MuonCalibITools MuonIdHelpersLib MuonPattern MuonPrepRawData MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonSimEvent AnalysisTriggerEvent D3PDMakerUtils TriggerD3PDMakerLib MCTruthClassifierLib McParticleEvent muonEvent TrkGeometry TrkEventPrimitives TrkPrepRawData TrkSegment TrkTrackSummary TrkTruthData TrkExInterfaces TrkToolInterfaces TrigObjectMatchingLib TrigInDetEvent TrigMuonEvent ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.cxx index 242dd6641e9f51f9f3476a3ae0b856f42b48d0f8..f1e1c3fca69aa77e080012432c8023aa8341256e 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.cxx @@ -10,7 +10,7 @@ #include "MuonPatternCombinationFillerTool.h" #include "AthenaKernel/errorcheck.h" #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" #include "MuonPattern/MuonPatternCombinationCollection.h" #include "MuonPattern/DetailedMuonPatternTruthCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx index 6e21fd146b3502cfde65785ac14f5214fe04adba..4143920d61edf06682d3b7f1d3602ce0efcf2221 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx @@ -10,7 +10,7 @@ #include "MuonPatternCombinationMissedHitFillerTool.h" #include "AthenaKernel/errorcheck.h" #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" #include "MuonPattern/MuonPatternCombinationCollection.h" #include "MuonPattern/DetailedMuonPatternTruthCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.cxx index 949aaba16acbdb43954731070a4643d9b41d2f62..c50ec5d9b7be315690711b37f4d89374f98b64bb 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.cxx @@ -10,7 +10,7 @@ #include "MuonSegmentTruthFillerTool.h" #include "AthenaKernel/errorcheck.h" #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" #include "MuonPattern/MuonPatternCombinationCollection.h" #include "MuonPattern/DetailedMuonPatternTruthCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx index 4a3fa46e330ed410b071a0ce6ab62dc6ce6a1eae..5d6e54d2a232a4188cb5e3e05ebcb8a5af7d7c88 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx @@ -13,7 +13,7 @@ #include "MuonIdHelpers/MuonIdHelperTool.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/CMakeLists.txt index a9f5b7960c920be566f7c693e19dc97bcb870aed..74a80d24847184804c1a2b05a6cbf8e6ac6de927 100644 --- a/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/CMakeLists.txt @@ -29,6 +29,7 @@ atlas_depends_on_subdirs( PRIVATE Event/xAOD/xAODTrigger GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC PhysicsAnalysis/D3PDMaker/D3PDMakerUtils Reconstruction/RecoTools/RecoToolInterfaces Reconstruction/RecoTools/TrackToVertex @@ -43,15 +44,14 @@ atlas_depends_on_subdirs( PRIVATE # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( TileD3PDMaker src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${HEPMC_LIBRARIES} CaloEvent CaloGeoHelpers AthContainers AthenaBaseComps StoreGateLib SGtests GeoModelUtilities Identifier EventInfo xAODCaloEvent xAODEventInfo xAODMissingET xAODMuon xAODPrimitives xAODTracking xAODTrigger GaudiKernel GeneratorObjects D3PDMakerUtils RecoToolInterfaces TileEvent TileIdentifier TrkParameters TrkParametersIdentificationHelpers VxVertex TrigInDetEvent TrigMuonEvent ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CORAL_LIBRARIES} AtlasHepMCLib CaloEvent CaloGeoHelpers AthContainers AthenaBaseComps StoreGateLib SGtests GeoModelUtilities Identifier EventInfo xAODCaloEvent xAODEventInfo xAODMissingET xAODMuon xAODPrimitives xAODTracking xAODTrigger GaudiKernel GeneratorObjects D3PDMakerUtils RecoToolInterfaces TileEvent TileIdentifier TrkParameters TrkParametersIdentificationHelpers VxVertex TrigInDetEvent TrigMuonEvent ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileClusterFillerTool.h b/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileClusterFillerTool.h index 288304b5c769cfe9bd5915afd2f043ebbb7c56b0..6d61955000c40c54e0458c8fe3e2d97736b5455c 100644 --- a/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileClusterFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileClusterFillerTool.h @@ -19,9 +19,9 @@ #include "TrackTools.h" // MONTE CARLO INCLUDES -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" // MONTE CARLO (TRUTH) INFORMATION #include "GeneratorObjects/McEventCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileMuonFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileMuonFillerTool.cxx index b3ef4178543538ae50a78ca679a68d835906eefc..ad89aabb0abf419564b7b344e342ac78fe52ce91 100644 --- a/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileMuonFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileMuonFillerTool.cxx @@ -20,9 +20,9 @@ #include "CaloEvent/CaloCellContainer.h" // MONTE CARLO INCLUDES -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" //xAOD tools #include "xAODPrimitives/IsolationType.h" diff --git a/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileTrackFillerTool.h b/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileTrackFillerTool.h index a8a06201c55a8c07d037b403cf189ed8dfb77956..a4f4f1e8d012471b0a5d67beff8316d8ebf9c098 100644 --- a/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileTrackFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/TileD3PDMaker/src/TileTrackFillerTool.h @@ -21,9 +21,9 @@ #include "TrackToVertex/TrackToVertex.h" // MONTE CARLO INCLUDES -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" // MONTE CARLO (TRUTH) INFORMATION #include "GeneratorObjects/McEventCollection.h" diff --git a/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/CMakeLists.txt index 6acf46991fa0cf32d8cee0953a2f7dbc67f7d7ad..a452d4a987314cec48990e79d37cc3eccba212d7 100644 --- a/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/CMakeLists.txt @@ -30,18 +30,18 @@ atlas_depends_on_subdirs( PUBLIC Reconstruction/RecoTools/RecoToolInterfaces Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParticleBase - Tracking/TrkEvent/VxVertex ) + Tracking/TrkEvent/VxVertex + Generators/AtlasHepMC ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( TrackD3PDMaker src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} TrkParameters AthenaKernel CxxUtils SGtests Identifier EventPrimitives xAODBase xAODPrimitives xAODTracking GaudiKernel InDetIdentifier InDetReadoutGeometry InDetTestBLayerLib ParticleEvent D3PDMakerUtils Particle ITrackToVertex RecoToolInterfaces TrkEventPrimitives TrkParticleBase VxVertex ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib TrkParameters AthenaKernel CxxUtils SGtests Identifier EventPrimitives xAODBase xAODPrimitives xAODTracking GaudiKernel InDetIdentifier InDetReadoutGeometry InDetTestBLayerLib ParticleEvent D3PDMakerUtils Particle ITrackToVertex RecoToolInterfaces TrkEventPrimitives TrkParticleBase VxVertex ) # Install files from the package: atlas_install_headers( TrackD3PDMaker ) diff --git a/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/python/xAODTrackD3PDObject.py b/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/python/xAODTrackD3PDObject.py index f997975965ce9ad61a053728791e87bb886a9d80..b1db9a65a70737c0a168e72b62b3dcc1bf3337df 100644 --- a/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/python/xAODTrackD3PDObject.py +++ b/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/python/xAODTrackD3PDObject.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration import TrackD3PDMaker import D3PDMakerCoreComps @@ -95,7 +95,6 @@ def xAODTrackD3PDObject(_label='trkTrack', varsTable = [ # ID hits [IDHits, 'nBLHits', 'numberOfInnermostPixelLayerHits'], - [IDHits, 'nNIPixHits', 'numberOfNextToInnermostPixelLayerHits'], [IDHits + HitSum, 'nPixHits', 'numberOfPixelHits' ], [IDHits + HitSum, 'nSCTHits', 'numberOfSCTHits' ], [IDHits + HitSum, 'nTRTHits', 'numberOfTRTHits' ], @@ -111,16 +110,13 @@ def xAODTrackD3PDObject(_label='trkTrack', # ID shared & Split hits [IDSharedHits, 'nBLSharedHits', 'numberOfInnermostPixelLayerSharedHits'], - [IDSharedHits, 'nNIPixSharedHits', 'numberOfNextToInnermostPixelLayerSharedHits'], [IDSharedHits, 'nPixSharedHits', 'numberOfPixelSharedHits'], [IDSharedHits, 'nSCTSharedHits', 'numberOfSCTSharedHits'], [IDSharedHits, 'nBLayerSplitHits', 'numberOfInnermostPixelLayerSplitHits'], - [IDSharedHits, 'nNIPixSplitHits', 'numberOfNextToInnermostPixelLayerSplitHits'], [IDSharedHits, 'nPixSplitHits', 'numberOfPixelSplitHits'], # ID outliers [IDOutliers, 'nBLayerOutliers', 'numberOfInnermostPixelLayerOutliers' ], - [IDOutliers, 'nNIPixOutliers', 'numberOfNextToInnermostPixelLayerOutliers' ], [IDOutliers, 'nPixelOutliers', 'numberOfPixelOutliers' ], [IDOutliers, 'nSCTOutliers', 'numberOfSCTOutliers' ], [IDOutliers, 'nTRTOutliers', 'numberOfTRTOutliers'], @@ -148,7 +144,6 @@ def xAODTrackD3PDObject(_label='trkTrack', # Expect BLayer hit [ExpectBLayer, 'expectInnermostPixelLayerHit'], - [ExpectBLayer, 'expectNextToInnermostPixelLayerHit'], # Muon hits [MuonHits + HitSum, 'numberOfPrecisionLayers'], @@ -157,9 +152,6 @@ def xAODTrackD3PDObject(_label='trkTrack', [MuonHits + HitSum, 'numberOfPhiHoleLayers'], [MuonHits + HitSum, 'numberOfTriggerEtaLayers'], [MuonHits + HitSum, 'numberOfTriggerEtaHoleLayers'], - - # DBM hits - [DBMHits + HitSum, 'numberOfDBMHits'], ] diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/CMakeLists.txt index 72b02af3c95430d9d46385eb7e84ea6cd8210093..e15e3a568bd396171bac76ad797e99d2ae5cacf8 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODMuon Generators/GenAnalysisTools/TruthHelper Generators/GeneratorObjects + Generators/AtlasHepMC PhysicsAnalysis/AnalysisCommon/ParticleJetTools PhysicsAnalysis/MCTruthClassifier PhysicsAnalysis/TruthParticleID/McParticleEvent @@ -30,21 +31,20 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_library( TruthD3PDAnalysisLib src/*.cxx PUBLIC_HEADERS TruthD3PDAnalysis - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} LINK_LIBRARIES AthenaBaseComps GaudiKernel D3PDMakerUtils McParticleKernel StoreGateLib SGtests ParticleJetToolsLib MCTruthClassifierLib MCTruthClassifierLib - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaKernel EventKernel xAODEgamma xAODJet xAODMuon TruthHelper GeneratorObjects McParticleEvent Particle ParticleTruth TrkParticleBase VxVertex ) + PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaKernel EventKernel xAODEgamma xAODJet xAODMuon TruthHelper GeneratorObjects McParticleEvent Particle ParticleTruth TrkParticleBase VxVertex ) atlas_add_component( TruthD3PDAnalysis src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel D3PDMakerUtils McParticleKernel AthenaKernel StoreGateLib SGtests EventKernel xAODEgamma xAODJet xAODMuon TruthHelper GeneratorObjects ParticleJetToolsLib MCTruthClassifierLib McParticleEvent Particle ParticleTruth TrkParticleBase VxVertex TruthD3PDAnalysisLib MCTruthClassifierLib ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel D3PDMakerUtils McParticleKernel AthenaKernel StoreGateLib SGtests EventKernel xAODEgamma xAODJet xAODMuon TruthHelper GeneratorObjects ParticleJetToolsLib MCTruthClassifierLib McParticleEvent Particle ParticleTruth TrkParticleBase VxVertex TruthD3PDAnalysisLib MCTruthClassifierLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/TruthD3PDAnalysis/IGenObjectsFilterTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/TruthD3PDAnalysis/IGenObjectsFilterTool.h index 64bf58c99767a0f6d66b31f1dca674a1b9ea0ae7..ba5cfa518deb39ee8e69dee1c537542b2627ecfc 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/TruthD3PDAnalysis/IGenObjectsFilterTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/TruthD3PDAnalysis/IGenObjectsFilterTool.h @@ -18,11 +18,10 @@ #include "GaudiKernel/IAlgTool.h" // Forward declaration(s): -namespace HepMC{ - class GenParticle; - class GenEvent; - class GenVertex; -} +#include "AtlasHepMC/GenParticle_fwd.h" +#include "AtlasHepMC/GenEvent_fwd.h" +#include "AtlasHepMC/GenVertex_fwd.h" + class McEventCollection; /// Interface ID for this tool type diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/TruthD3PDAnalysis/TruthParticleFilterBase.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/TruthD3PDAnalysis/TruthParticleFilterBase.h index 9a86078192cc687f612fe2d64dfe6e7c1bf4a773..ad5d00a83b13b9a621160ebf1976e921d39b627e 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/TruthD3PDAnalysis/TruthParticleFilterBase.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/TruthD3PDAnalysis/TruthParticleFilterBase.h @@ -26,11 +26,9 @@ class ITruthIsolationTool; class McEventCollection; class TruthEtIsolationsContainer; -namespace HepMC { - class GenEvent; - class GenVertex; - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" +#include "AtlasHepMC/GenEvent_fwd.h" +#include "AtlasHepMC/GenVertex_fwd.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/GenObjectsFilterTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/GenObjectsFilterTool.cxx index b9986de6d801b950bf661d11cc12c9081527116f..17ce7b2194d2f66192a538d4a2ef5a22c8dfd8a4 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/GenObjectsFilterTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/GenObjectsFilterTool.cxx @@ -16,9 +16,9 @@ #include "TruthHelper/IsGenInteracting.h" // EDM include(s): -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/McEventCollection.h" // Local include(s): diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/SimpleTruthParticleFilterTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/SimpleTruthParticleFilterTool.cxx index 9875f9d979a78b3e8a4def546ebb16ce96b21ff2..9ec416c451ea033b23465b5a6f2739c31d2d4fdd 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/SimpleTruthParticleFilterTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/SimpleTruthParticleFilterTool.cxx @@ -5,8 +5,8 @@ #include "SimpleTruthParticleFilterTool.h" #include "EventKernel/PdtPdg.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "HepPID/ParticleIDMethods.hh" #include "GaudiKernel/SystemOfUnits.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/SimpleTruthParticleFilterTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/SimpleTruthParticleFilterTool.h index 9e239de2ef3497a9cd84305ea104504334b6613c..9b3c1d4141189ffb712b0a83eef51c80e402aa08 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/SimpleTruthParticleFilterTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/SimpleTruthParticleFilterTool.h @@ -6,9 +6,7 @@ #define TRUTHD3PDANALYSIS_SIMPLETRUTHPARTICLEFILTERTOOL_H #include "TruthD3PDAnalysis/TruthParticleFilterBase.h" -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterBase.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterBase.cxx index 242273eecb6115b0cc84837cd9b82d1ee385bcfb..86154bab8bd86b48ed7a4b9c38678da743bfb760 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterBase.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterBase.cxx @@ -14,9 +14,9 @@ #include "McParticleEvent/TruthEtIsolationsContainer.h" #include "McParticleKernel/ITruthIsolationTool.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "boost/range/iterator_range_core.hpp" #include <utility> diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterTool.cxx index cb71f38221db4dbc7172dc0776cbef3e943e049e..899d2473b55d02c50da11782cab8ae682cd84e83 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterTool.cxx @@ -14,8 +14,8 @@ #include "TruthParticleFilterTool.h" #include "EventKernel/PdtPdg.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "HepPID/ParticleIDMethods.hh" #include "GaudiKernel/SystemOfUnits.h" #include <algorithm> diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterTool.h index 74e251050c0c1991d92a8ed050fb1af6bfd96dff..430c6bceb470f9fae159dc35ae7fe5333af3146d 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDAnalysis/src/TruthParticleFilterTool.h @@ -18,9 +18,7 @@ #include "TruthD3PDAnalysis/TruthParticleFilterBase.h" -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/CMakeLists.txt index 3a91e562bc6c3263ebb730c280e877c05d742ba8..06a3bbbed24f52d0c4233fe4e568d8dc21a0a6b9 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/CMakeLists.txt @@ -14,6 +14,7 @@ atlas_depends_on_subdirs( PRIVATE Event/xAOD/xAODTruth GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC Generators/GenInterfaces Generators/TruthUtils PhysicsAnalysis/D3PDMaker/D3PDMakerInterfaces @@ -28,15 +29,14 @@ atlas_depends_on_subdirs( PRIVATE # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( TruthD3PDMaker src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel Navigation EventInfo xAODTruth GaudiKernel GeneratorObjects TruthUtils D3PDMakerUtils TruthD3PDAnalysisLib MCTruthClassifierLib McParticleEvent McParticleKernel JetEvent TrkToolInterfaces ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel Navigation EventInfo xAODTruth GaudiKernel GeneratorObjects TruthUtils D3PDMakerUtils TruthD3PDAnalysisLib MCTruthClassifierLib McParticleEvent McParticleKernel JetEvent TrkToolInterfaces ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventFillerTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventFillerTool.h index cb6495ff81512553ca0e98b8ec00e83552102389..ef82ae33db79fb2facc461b07a7aba4de3c0f0a4 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventFillerTool.h @@ -18,7 +18,7 @@ #include "D3PDMakerUtils/BlockFillerTool.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGenParticleAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGenParticleAssociationTool.cxx index e7836082da798fcb094af96a9b3c71c291663a25..8a3f24ccec8225d764670393e3fbf05eda1791ad 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGenParticleAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGenParticleAssociationTool.cxx @@ -12,7 +12,7 @@ #include "GenEventGenParticleAssociationTool.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "AthenaKernel/errorcheck.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGenParticleAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGenParticleAssociationTool.h index a2de7a7bd821e580b7f5dd619d170fbf666d6105..e77d9b8d7c23a69f814e47ac03daf3d352351152 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGenParticleAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGenParticleAssociationTool.h @@ -18,8 +18,8 @@ #include "D3PDMakerUtils/MultiAssociationTool.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterFilterTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterFilterTool.cxx index 83ff1225136224d9676365f67b35b6437ecb6558..207d15cd1a3cae923c7550e70c60b45f4e373fc9 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterFilterTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterFilterTool.cxx @@ -12,7 +12,7 @@ #include "GenEventGetterFilterTool.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterFilterTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterFilterTool.h index f3a1f118b01121a07129233c946a295a46857997..d92b67e495802a9f6a9cfd73a8d696a1eeb8f6a1 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterFilterTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterFilterTool.h @@ -14,7 +14,7 @@ #include "D3PDMakerUtils/CollectionGetterFilterTool.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #ifndef EVENTCOMMOND3PDMAKER_GENEVENTGETTERFILTERTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterTool.cxx index fb521e46643c7dc91bebb27e3ac21fdd67f5d2fa..1914ab6df9fb0d773e9096c6825924d7f2bb759d 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventGetterTool.cxx @@ -8,7 +8,7 @@ #include "AthenaKernel/errorcheck.h" // EDM include(s): -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" // Local include(s): #include "GenEventGetterTool.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventPileUpFillerTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventPileUpFillerTool.h index ff3805887e0abfacfa2b11942ce96c498754347b..c5c160a710e818c37755cbf81987a377ff1efc36 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventPileUpFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenEventPileUpFillerTool.h @@ -18,7 +18,7 @@ #include "GaudiKernel/ToolHandle.h" // EDM include(s): -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" // D3PDMaker include(s): #include "D3PDMakerInterfaces/ICollectionGetterRegistryTool.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleEventAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleEventAssociationTool.h index 88a736490fa84481fc65a2013f45ab98274bd27a..5d0ebab4d422f771dd016102ccb5816ae149c658 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleEventAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleEventAssociationTool.h @@ -19,8 +19,8 @@ #include "D3PDMakerUtils/SingleAssociationTool.h" // EDM include(s): -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleFillerTool.cxx index 2ceca3d2cc7e1e9bc8474dd8c9128206ad634b40..3ad88df4a6d4b5aee981f18ec95f9fe529223d75 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleFillerTool.cxx @@ -12,9 +12,9 @@ #include "GenParticleFillerTool.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include "HepMC/SimpleVector.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/SimpleVector.h" #include "AthenaKernel/errorcheck.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleFillerTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleFillerTool.h index c6482ba42f989271d8a45cdf13753989afca9769..59a9681d35124dd18019bda898b65de7f9ce969c 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleFillerTool.h @@ -17,7 +17,7 @@ #include "D3PDMakerUtils/BlockFillerTool.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleGetterTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleGetterTool.cxx index 393059d26b9d019d9907fe37a529bd0a883ad174..a21e9549e3d917f6cad6059b5ef8cd8f2acc6469 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleGetterTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleGetterTool.cxx @@ -8,7 +8,7 @@ #include "AthenaKernel/errorcheck.h" // EDM include(s): -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // Local include(s): #include "GenParticleGetterTool.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleGetterTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleGetterTool.h index 6ab6f87a1e0695bab9ec685fe98bb9aca8d07d4d..881bf462206d7661b071f43c34634e84e4a46ade 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleGetterTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleGetterTool.h @@ -19,7 +19,7 @@ // EDM include(s): #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" // Helper tool(s): #include "TruthD3PDAnalysis/IGenObjectsFilterTool.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleParticleAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleParticleAssociationTool.h index ab8bb8e5d942a851b074700fd34231c4d09740b7..353e33afe6c86a7c4ebfadb459b2f680f1bccbb8 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleParticleAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleParticleAssociationTool.h @@ -19,7 +19,7 @@ #include "D3PDMakerUtils/SingleAssociationTool.h" // EDM include(s): -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticlePerigeeFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticlePerigeeFillerTool.cxx index 7d3bd8eda3aa2f8cbdc59d20ec5fe2ccd8434b6a..dbfbac6fbcccbff7e544caf4be471c3dafa77f11 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticlePerigeeFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticlePerigeeFillerTool.cxx @@ -5,7 +5,7 @@ #include "GenParticlePerigeeFillerTool.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkToolInterfaces/ITruthToTrack.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticlePerigeeFillerTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticlePerigeeFillerTool.h index 052563d260b218a6c565cd4e99e88a70f2a69f24..d5c3e964b592e750cff71994b2162984efdf4f62 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticlePerigeeFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticlePerigeeFillerTool.h @@ -6,7 +6,7 @@ #define TRACKD3PDMAKER_GENPARTICLEPERIGEEFILLERTOOL_H #include "D3PDMakerUtils/BlockFillerTool.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GaudiKernel/ToolHandle.h" #include "TrkToolInterfaces/ITruthToTrack.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleTruthParticleAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleTruthParticleAssociationTool.cxx index 72e0608906ecd9fdab65a6d5d22413eb87e5d5d4..92e10d84989dfb8aa15997152d1749d814574fee 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleTruthParticleAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleTruthParticleAssociationTool.cxx @@ -16,7 +16,7 @@ #include "D3PDMakerInterfaces/ICollectionGetterTool.h" #include "D3PDMakerInterfaces/ICollectionGetterRegistryTool.h" #include "McParticleEvent/TruthParticleContainer.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "AthenaKernel/errorcheck.h" #include "GaudiKernel/IIncidentSvc.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleTruthParticleAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleTruthParticleAssociationTool.h index 3a50a025b5b2c0af3e4f1bc3f4e32b7567f2b166..e0c01e65e357f9e41bc9251c714a64121ae61545 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleTruthParticleAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleTruthParticleAssociationTool.h @@ -19,7 +19,7 @@ #include "D3PDMakerUtils/SingleAssociationTool.h" #include "McParticleEvent/TruthParticle.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GaudiKernel/IIncidentListener.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleVertexAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleVertexAssociationTool.h index 39a157713faeaf99d5c185a4fc13be1f8763da36..78a5d2feea447a463540f1fd91ed8f6a1c034267 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleVertexAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenParticleVertexAssociationTool.h @@ -19,8 +19,8 @@ #include "D3PDMakerUtils/SingleAssociationTool.h" // EDM include(s): -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexEventAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexEventAssociationTool.h index 733ebee4734c30debfc10b311c946f8e6a85e55f..38a32c25b0730fffa09d4e667434bc6307fe224e 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexEventAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexEventAssociationTool.h @@ -19,8 +19,8 @@ #include "D3PDMakerUtils/SingleAssociationTool.h" // EDM include(s): -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.cxx index d4e786e4bed452d25b2b9b0a5902a44abd4b715a..453e1dc2558771524b006a1f3ed765c29c23623a 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.cxx @@ -12,7 +12,7 @@ #include "GenVertexFillerTool.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Geometry/Point3D.h" #include "AthenaKernel/errorcheck.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.h index da482ae476f352e40c2ce7cbb5287d656daa8092..e56b6d480d08bf951d1c49ad404695cbd8b73ad5 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.h @@ -18,7 +18,7 @@ #include "D3PDMakerUtils/BlockFillerTool.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexGetterTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexGetterTool.cxx index f3c00f5e53e353e3f7bd812d18771db92087513d..898e8340c1dc8aaa144bf095e29896f83945a8d9 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexGetterTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexGetterTool.cxx @@ -8,7 +8,7 @@ #include "AthenaKernel/errorcheck.h" // EDM include(s): -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" // Local include(s): #include "GenVertexGetterTool.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexGetterTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexGetterTool.h index e2106eddb9d6682f6d8950c905d6c3b021704c11..e5a798106a3d0a2daf9af02d4c97fa68be5b4cfc 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexGetterTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexGetterTool.h @@ -19,7 +19,7 @@ // EDM include(s): #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" // Helper tool(s): #include "TruthD3PDAnalysis/IGenObjectsFilterTool.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexParticleAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexParticleAssociationTool.h index 944b1a31497e8c57b6dc528294b2f0b2fbe1a10c..dd2dbe587d3721bfa80b35678765fb5a1bb7ef27 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexParticleAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexParticleAssociationTool.h @@ -22,8 +22,8 @@ #include "D3PDMakerUtils/MultiAssociationTool.h" // EDM include(s): -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/HforFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/HforFillerTool.cxx index 971eacc977b5e31d78d25d6db4b676c8fda8fe4c..6e6edb4c241ce2548d74387f48aee0aeb21af64c 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/HforFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/HforFillerTool.cxx @@ -10,7 +10,7 @@ #include "D3PDMakerUtils/BlockFillerTool.h" #include "AthenaKernel/errorcheck.h" #include "HforFillerTool.h" -#include "HepMC/SimpleVector.h" +#include "AtlasHepMC/SimpleVector.h" namespace D3PD{ diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/JetFullTruthTag.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/JetFullTruthTag.cxx index ce2a8884f584515f076b9d9577ea7d893bcc3386..71d853c66ec4ef2e56e9a0c0aaab8e8381f08dc6 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/JetFullTruthTag.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/JetFullTruthTag.cxx @@ -13,7 +13,7 @@ #include "AthenaKernel/errorcheck.h" #include "JetEvent/Jet.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "HepPID/ParticleIDMethods.hh" #include "GaudiKernel/SystemOfUnits.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthJetFilterTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthJetFilterTool.cxx index a0fda8ba1aa2cf8877e78323859cd398ae38d1bc..2f8d1c4cb3a343c400e33cd75dcf2128a3ca7ec6 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthJetFilterTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthJetFilterTool.cxx @@ -12,9 +12,9 @@ #include "TruthJetFilterTool.h" #include "GeneratorObjects/McEventCollection.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "CLHEP/Vector/LorentzVector.h" #include "boost/range/iterator_range_core.hpp" #include <utility> diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthJetFilterTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthJetFilterTool.h index 44eacdede3db451b2d12bc225e0dd34425b18660..132cc4953de95a4a071c8d075d891a296dcbdac7 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthJetFilterTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthJetFilterTool.h @@ -22,11 +22,9 @@ #include "AthenaBaseComps/AthAlgTool.h" #include <string> class McEventCollection; -namespace HepMC { - class GenEvent; - class GenVertex; - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" +#include "AtlasHepMC/GenVertex_fwd.h" +#include "AtlasHepMC/GenEvent_fwd.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.cxx index b7047e22715e58445d240c9ff0959a6145829fb4..321da3fb40d22fd7e91481051d2330e77a4527e6 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.cxx @@ -12,7 +12,7 @@ #include "TruthLeptonNearbyAssociationTool.h" #include "AthenaKernel/errorcheck.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "McParticleEvent/TruthParticle.h" #include "TruthUtils/PIDHelpers.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.h index 0aa09e21dff5b04b95b17106fd39b6c9321c98db..32b8f875f9382d71b9443a28379fa3e8f5e78b3e 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.h @@ -17,9 +17,7 @@ #include <vector> -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx index f2b8d9f27f06e744c4772dc3851774d6ef0a8189..d810eae7f0f1ca7822d72815ef800ce042387e28 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx @@ -9,8 +9,8 @@ */ #include "TruthLeptonParentAssociationTool.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "AthenaKernel/errorcheck.h" #include "barcodeOrder.h" #include "McParticleEvent/TruthParticle.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.h index aac7b0f49643b6505d4782c7c493171d2c5d1254..70ffc405c6179a7dc756f2540b36b9cc5c33cfc3 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.h @@ -19,9 +19,7 @@ #include "McParticleEvent/TruthParticle.h" -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace D3PD { /** diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.cxx index 18e0b34d9ba4f263bf144801e829d3021128529a..9af4e22c2b181e8c8b58ba5d851d847ea46307db 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.cxx @@ -11,8 +11,8 @@ */ #include "TruthParticleFakerTool.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "AthenaKernel/errorcheck.h" #include "GaudiKernel/SystemOfUnits.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.h index f47b8e9e0357d88ce40d38a2b0f47da5d5ba5ea2..7fded7fe29ad0787bc921d297d81ea25a5f6d5d1 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.h @@ -15,7 +15,7 @@ #include "D3PDMakerUtils/BlockFillerTool.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <vector> diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleGenParticleAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleGenParticleAssociationTool.h index 08376b9bd263bf517c190875b8e6ef3f2afab674..6db1e1725e45f2169908e8ccd2041b552721e96e 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleGenParticleAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleGenParticleAssociationTool.h @@ -19,7 +19,7 @@ #include "D3PDMakerUtils/SingleAssociationTool.h" #include "McParticleEvent/TruthParticle.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx index f4a2d27f19da820bfc207207e0015d56a5f6a89e..2fd1f3e2148273af02cd585702c45b2d2f788a8a 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx @@ -9,8 +9,8 @@ */ #include "TruthTauDecayAssociationTool.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "AthenaKernel/errorcheck.h" #include "barcodeOrder.h" #include "McParticleEvent/TruthParticle.h" diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.h index 9cf255c0de0cc6a1100ec0a59598f2e01073b395..bfb6b361fe698bdbf7dbe184f584b2316e4f74e5 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.h +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.h @@ -17,7 +17,7 @@ #include "D3PDMakerUtils/MultiAssociationTool.h" #include "McParticleEvent/TruthParticle.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" namespace D3PD { diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/hepMCInheritance.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/hepMCInheritance.cxx index 2853c8fe616896a3fba412d735a151e2937f621e..e43133f4c141389edb9cabfc52a8a6aa22e18b6d 100644 --- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/hepMCInheritance.cxx +++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/hepMCInheritance.cxx @@ -16,7 +16,7 @@ #include "McParticleEvent/TruthParticle.h" #include "GeneratorObjects/McEventCollection.h" #include "Navigation/IAthenaBarCode.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "AthenaKernel/BaseInfo.h" SG_ADD_BASE (McEventCollection, DataVector<HepMC::GenEvent>); diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/CMakeLists.txt index cbbc9ff030e42e78c781658397862a0a8baef500..755dad17eaa6f2d62b26c4025190f0aec2cecc74 100644 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/CMakeLists.txt @@ -33,18 +33,18 @@ atlas_depends_on_subdirs( PRIVATE Trigger/TrigAnalysis/TrigObjectMatching Trigger/TrigEvent/TrigCaloEvent Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigEvent/TrigParticle ) + Trigger/TrigEvent/TrigParticle + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) # Component(s) in the package: atlas_add_component( egammaD3PDMaker src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} CaloIdentifier AthenaKernel Navigation StoreGateLib SGtests EventKernel FourMomUtils xAODBase xAODCaloEvent xAODEgamma xAODJet xAODTracking xAODTruth GaudiKernel AnalysisTriggerEvent D3PDMakerUtils TriggerD3PDMakerLib MCTruthClassifierLib egammaEvent TrkParameters TrkExInterfaces TrkVertexFitterInterfaces TrigObjectMatchingLib TrigCaloEvent TrigInDetEvent TrigParticle ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib CaloIdentifier AthenaKernel Navigation StoreGateLib SGtests EventKernel FourMomUtils xAODBase xAODCaloEvent xAODEgamma xAODJet xAODTracking xAODTruth GaudiKernel AnalysisTriggerEvent D3PDMakerUtils TriggerD3PDMakerLib MCTruthClassifierLib egammaEvent TrkParameters TrkExInterfaces TrkVertexFitterInterfaces TrigObjectMatchingLib TrigCaloEvent TrigInDetEvent TrigParticle ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaGenParticleAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaGenParticleAssociationTool.cxx index 28130e1667610280da82b0242b6a35c097bb074f..29761b2f1c9ca6d52f9dfb014f4f0f2ef094d0ca 100644 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaGenParticleAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaGenParticleAssociationTool.cxx @@ -19,7 +19,7 @@ #include "xAODTruth/TruthParticle.h" #include "FourMomUtils/P4Helpers.h" #include "AthenaKernel/errorcheck.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include <cstdlib> diff --git a/PhysicsAnalysis/DPDUtils/CMakeLists.txt b/PhysicsAnalysis/DPDUtils/CMakeLists.txt index 94b19cf842d9e850952e90f288f50c7ab9c75d11..ac3c89bb615e238490c8d922711943686f125620 100644 --- a/PhysicsAnalysis/DPDUtils/CMakeLists.txt +++ b/PhysicsAnalysis/DPDUtils/CMakeLists.txt @@ -40,13 +40,9 @@ atlas_add_component( DPDUtils # Install files from the package: atlas_install_headers( DPDUtils ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - atlas_add_test( flake8_share SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share POST_EXEC_SCRIPT nopost.sh ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/CMakeLists.txt index 2ac5f4da23c3da046e6849f74423ae172547253c..a3ba64909251df27b18573b6d637911f12b20b85 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/CMakeLists.txt @@ -1,7 +1,7 @@ ################################################################################ # Package: DerivationFrameworkEGamma ################################################################################ - + # Declare the package name: atlas_subdir( DerivationFrameworkEGamma ) @@ -22,6 +22,7 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel PhysicsAnalysis/CommonTools/ExpressionEvaluation PhysicsAnalysis/MCTruthClassifier + PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers Calorimeter/CaloCalibHitRec ) # External dependencies: @@ -32,14 +33,14 @@ atlas_add_library( DerivationFrameworkEGammaLib src/*.cxx PUBLIC_HEADERS DerivationFrameworkEGamma PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AsgTools AthenaBaseComps PATCoreLib EgammaAnalysisInterfacesLib ExpressionEvaluationLib MCTruthClassifierLib + LINK_LIBRARIES AsgTools AthenaBaseComps PATCoreLib EgammaAnalysisInterfacesLib ExpressionEvaluationLib MCTruthClassifierLib CaloCalibHitRecLib EgammaAnalysisHelpersLib PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} xAODBase xAODCaloEvent xAODEgamma xAODMissingET xAODMuon xAODTruth ) atlas_add_component( DerivationFrameworkEGamma src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools AthenaBaseComps PATCoreLib EgammaAnalysisInterfacesLib xAODBase - xAODCaloEvent xAODEgamma xAODMissingET xAODMuon xAODTruth GaudiKernel ExpressionEvaluationLib MCTruthClassifierLib DerivationFrameworkEGammaLib ) + xAODCaloEvent xAODEgamma xAODMissingET xAODMuon xAODTruth GaudiKernel ExpressionEvaluationLib MCTruthClassifierLib CaloCalibHitRecLib DerivationFrameworkEGammaLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGCrackVetoCleaningTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGCrackVetoCleaningTool.h new file mode 100644 index 0000000000000000000000000000000000000000..abc091e607d550ac4eb0534deb65d495bfd59fe7 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGCrackVetoCleaningTool.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EGCrackVetoCleaningTool.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_EGCRACKVETOCLEANINGTOOL_H +#define DERIVATIONFRAMEWORK_EGCRACKVETOCLEANINGTOOL_H + +#include <string> + +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +#include "GaudiKernel/ToolHandle.h" + +namespace DerivationFramework { + + class EGCrackVetoCleaningTool : public AthAlgTool, public IAugmentationTool { + public: + EGCrackVetoCleaningTool(const std::string& t, const std::string& n, const IInterface* p); + + StatusCode initialize(); + StatusCode finalize(); + virtual StatusCode addBranches() const; + + private: + std::string m_sgName; + std::string m_containerName; + }; +} + +#endif // DERIVATIONFRAMEWORK_EGCRACKVETOCLEANINGTOOL_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronAmbiguityTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronAmbiguityTool.h new file mode 100644 index 0000000000000000000000000000000000000000..f437bef6b3fed551bb774e93930cd3f648055676 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronAmbiguityTool.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EGElectronAmbiguityTool.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_EGELECTRONAMBIGUITYTOOL_H +#define DERIVATIONFRAMEWORK_EGELECTRONAMBIGUITYTOOL_H + +#include <string> + +#include "GaudiKernel/ToolHandle.h" + +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" + +#include "xAODEgamma/Electron.h" +#include "xAODTracking/Vertex.h" +#include "xAODTracking/TrackParticle.h" + +namespace DerivationFramework { + + class EGElectronAmbiguityTool : public AthAlgTool, public IAugmentationTool { + + public: + EGElectronAmbiguityTool(const std::string& t, const std::string& n, const IInterface* p); + + virtual StatusCode addBranches() const; + + private: + std::string m_containerName, m_VtxContainerName, m_tpContainerName; + + StatusCode decorateSimple(const xAOD::Electron *ele, const xAOD::Vertex *pvtx) const; + void helix(const xAOD::TrackParticle *trkP, const xAOD::Vertex *pvtx, std::vector<double>& h) const; + + bool m_isMC; + + // cuts to select the electron to run on + double m_elepTCut; + std::string m_idCut; + + // cuts to select the other track + unsigned int m_nSiCut; + double m_dctCut, m_sepCut, m_dzCut; + + // cuts to define the various types : + // ambi = -1 : no other track, 0 : other track exists but no good gamma reco, 1 : gamma*, 2 : material conversion + double m_rvECCut, m_meeAtVtxECCut,m_meeICCut; + + }; +} + +#endif // DERIVATIONFRAMEWORK_EGCONVERSIONINFOTOOL_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronLikelihoodToolWrapper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronLikelihoodToolWrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..b50f5d47e13b17719d7e182e5591a0fcefb5414e --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronLikelihoodToolWrapper.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EGLikelihoodToolWrapper.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Author: Giovanni Marchiori (giovanni.marchiori@cern.ch) +// Note: while EGSelectionToolWrapper permits to only store the boolean +// accept and the isEM-like mask (works for both isEM and likelihood selectors), +// this tool (EGElectronLikelihoodToolWrapper) allows also to store +// the double TResult output (i.e. the value of the likelihood or the ECIDS BDT) +// if StoreTResult is set to true. Otherwise one can simply use the other tool. + + +#ifndef DERIVATIONFRAMEWORK_EGELECTRONLIKELIHOODTOOLWRAPPER_H +#define DERIVATIONFRAMEWORK_EGELECTRONLIKELIHOODTOOLWRAPPER_H + +#include <string> + +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +#include "EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h" +#include "EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h" +#include "AsgTools/IAsgTool.h" +#include "GaudiKernel/ToolHandle.h" + +namespace DerivationFramework { + + class EGElectronLikelihoodToolWrapper : public AthAlgTool, public IAugmentationTool { + public: + EGElectronLikelihoodToolWrapper(const std::string& t, const std::string& n, const IInterface* p); + + StatusCode initialize(); + StatusCode finalize(); + virtual StatusCode addBranches() const; + + private: + ToolHandle<IAsgElectronLikelihoodTool> m_tool; + ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_fudgeMCTool; + std::string m_cut; + std::string m_sgName; + std::string m_containerName; + bool m_storeTResult; + }; +} + +#endif // DERIVATIONFRAMEWORK_EGELECTRONLIKELIHOODTOOLWRAPPER_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..b25bcf8b2cc54181bb9a6138a97e084845e95f95 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EGPhotonCleaningWrapper.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_EGPHOTONCLEANINGWRAPPER_H +#define DERIVATIONFRAMEWORK_EGPHOTONCLEANINGWRAPPER_H + +#include <string> + +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +#include "EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h" +#include "GaudiKernel/ToolHandle.h" + +namespace DerivationFramework { + + class EGPhotonCleaningWrapper : public AthAlgTool, public IAugmentationTool { + public: + EGPhotonCleaningWrapper(const std::string& t, const std::string& n, const IInterface* p); + + StatusCode initialize(); + StatusCode finalize(); + virtual StatusCode addBranches() const; + + private: + ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_fudgeMCTool; + std::string m_sgName; + std::string m_containerName; + }; +} + +#endif // DERIVATIONFRAMEWORK_EGSELECTIONTOOLWRAPPER_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGSelectionToolWrapper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGSelectionToolWrapper.h index 8b0bc47b10ed5354daecdd80dc92bbfc3e1a71b1..c68ae0a5b4555525b5f1623489acff5cb5a8bcfd 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGSelectionToolWrapper.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGSelectionToolWrapper.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -15,6 +15,8 @@ #include "DerivationFrameworkInterfaces/IAugmentationTool.h" #include "EgammaAnalysisInterfaces/IAsgEGammaIsEMSelector.h" #include "EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h" +#include "PATCore/IAsgSelectionTool.h" +#include "AsgTools/IAsgTool.h" #include "GaudiKernel/ToolHandle.h" namespace DerivationFramework { @@ -28,8 +30,8 @@ namespace DerivationFramework { virtual StatusCode addBranches() const; private: - //ToolHandle<IAsgSelectionTool> m_tool; - ToolHandle<IAsgEGammaIsEMSelector> m_tool; // provides isemValue, but will not work with likelihood.. + ToolHandle<IAsgSelectionTool> m_tool; // can't use isemValue, but can use TAccept and then getInvertedCutBitSet to retrieve isem-like value for both cut-based and LH selectors + //ToolHandle<IAsgEGammaIsEMSelector> m_tool; // provides isemValue, but will not work with likelihood.. ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_fudgeMCTool; std::string m_cut; std::string m_sgName; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGammaPassSelectionWrapper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGammaPassSelectionWrapper.h deleted file mode 100644 index 547df92ee7b718e4686bd3d541a35f5c0c398e22..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGammaPassSelectionWrapper.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////// -// EGammaPassSelectionWrapper.h (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef DERIVATIONFRAMEWORK_EGAMMAPASSSELECTONWRAPPER_H -#define DERIVATIONFRAMEWORK_EGAMMAPASSSELECTONWRAPPER_H 1 - -#include<string> - -// Gaudi & Athena basics -#include "AthenaBaseComps/AthAlgTool.h" - -// DerivationFramework includes -#include "DerivationFrameworkInterfaces/IAugmentationTool.h" - -namespace DerivationFramework { - - /** @class EGammaPassSelectionWrapper - - the code used in this implementation is kindly stolen from: - atlasoff:: ISF/ISF_Core/ISF_Tools - - @author James Catmore -at- cern.ch - */ - class EGammaPassSelectionWrapper : public AthAlgTool, public IAugmentationTool { - - public: - /** Constructor with parameters */ - EGammaPassSelectionWrapper( const std::string& t, const std::string& n, const IInterface* p ); - - /** Destructor */ - ~EGammaPassSelectionWrapper(); - - // Athena algtool's Hooks - StatusCode initialize(); - StatusCode finalize(); - - /** Check that the current event passes this filter */ - virtual StatusCode addBranches() const; - - private: - std::vector<std::string> m_qualFlags; - std::string m_collName; - std::string m_sgPrefix; - - }; - -} - -#endif diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/TruthCaloShowerDecorator.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/TruthCaloShowerDecorator.h new file mode 100644 index 0000000000000000000000000000000000000000..dcc6dc61966f9ee336566ee7ee401b9c9935f53c --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/TruthCaloShowerDecorator.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DERIVATIONFRAMEWORK_TRUTHCALOSHOWERDECORATOR_H +#define DERIVATIONFRAMEWORK_TRUTHCALOSHOWERDECORATOR_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +#include "GaudiKernel/ToolHandle.h" +#include "CaloCalibHitRec/CalibHitToCaloCellTool.h" +#include <vector> + + +namespace DerivationFramework { + + class TruthCaloShowerDecorator : public AthAlgTool, public IAugmentationTool { + public: + TruthCaloShowerDecorator(const std::string& t, const std::string& n, const IInterface* p); + + StatusCode initialize(); + StatusCode finalize(); + virtual StatusCode addBranches() const; + + private: + + /** @brief Name of the input electron container **/ + std::string m_electronContainerName; + /** @brief Name of the truth particle container **/ + std::string m_truthParticleContainerName; + /** @brief barcode cut for egamma helpers **/ + int m_singleParticleBarcode; + + ToolHandle<CalibHitToCaloCellTool> m_calibhitToCaloCellTool; + //std::vector<std::string> m_truthClusterContainerNames; + + }; +} + +#endif // DERIVATIONFRAMEWORK_TRUTHCALOSHOWERDECORATOR_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM1ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM1ExtraContent.py index e3b257ff5d28574c32954b7d5cbc073ec9760741..c9f84c6756f3b96fcdd09ff6b134a686170f3e8e 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM1ExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM1ExtraContent.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration #Content included in addition to the Smart Slimming Content @@ -91,34 +91,50 @@ ExtraContainersTruth=["TruthEvents", ExtraContainersElectrons=["Electrons", "GSFTrackParticles", - "egammaClusters"] + "egammaClusters", + "CaloCalTopoClusters", + "NewSwElectrons", # only if DoCellReweighting is ON + "MaxVarSwElectrons", # if variations are ON + "MinVarSwElectrons" # if variations are ON + ] # for trigger studies ExtraContainersTrigger=[ - # to access the HLT egamma xAOD collections "HLT_xAOD__ElectronContainer_egamma_Electrons", - "HLT_xAOD__PhotonContainer_egamma_Photons", - #L2Calo collections + "HLT_xAOD__ElectronContainer_egamma_ElectronsAux.", + "HLT_xAOD__PhotonContainer_egamma_Photons", + "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", "HLT_xAOD__TrigRingerRingsContainer_TrigT2CaloEgamma", - "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", - # to access information about EF clusters and tracks + "HLT_xAOD__TrigRingerRingsContainer_TrigT2CaloEgammaAux.", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux.", "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", + "HLT_xAOD__TrigRNNOutputContainer_TrigRingerNeuralFex", + "HLT_xAOD__TrigRNNOutputContainer_TrigRingerNeuralFexAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig", - # For trigger matching + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrigAux.", "HLT_xAOD__TrigPassBitsContainer_passbits", - # for L1 studies + "HLT_xAOD__TrigPassBitsContainer_passbitsAux.", "LVL1EmTauRoIs", - "HLT_TrigRoiDescriptorCollection_initialRoI", #Athena - "HLT_xAOD__RoiDescriptorStore_initialRoI" #AthAnalysis + "LVL1EmTauRoIsAux.", + "HLT_TrigRoiDescriptorCollection_initialRoI", + "HLT_TrigRoiDescriptorCollection_initialRoIAux.", + "HLT_xAOD__RoiDescriptorStore_initialRoI", + "HLT_xAOD__RoiDescriptorStore_initialRoIAux.", + "HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "HLT_xAOD__TrigElectronContainer_L2ElectronFexAux." ] -ExtraContainersTriggerDataOnly=[ - "HLT_xAOD__TrigElectronContainer_L2ElectronFex" - ] +ExtraContainersTriggerDataOnly=[] ExtraVariablesEventShape=[ "TopoClusterIsoCentralEventShape.DensitySigma.Density.DensityArea", - "TopoClusterIsoForwardEventShape.DensitySigma.Density.DensityArea" + "TopoClusterIsoForwardEventShape.DensitySigma.Density.DensityArea", + "NeutralParticleFlowIsoCentralEventShape.Density.DensityArea.DensitySigma", + "NeutralParticleFlowIsoForwardEventShape.Density.DensityArea.DensitySigma", + "ParticleFlowIsoCentralEventShape.Density.DensityArea.DensitySigma", + "ParticleFlowIsoForwardEventShape.Density.DensityArea.DensitySigma" ] #should slim electron/fwdelectrons/cluster collections and keep only relevant subset of variables.. diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM2ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM2ExtraContent.py index 8c3a2fb8e39691cb1493ee432492acd075f3d4a1..e248b0a25cb25bd3e53edc2e5ba0b26f78482d46 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM2ExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM2ExtraContent.py @@ -91,15 +91,32 @@ ExtraContainersElectrons=["Electrons","GSFTrackParticles","egammaClusters"] # for trigger studies ExtraContainersTrigger = [ "HLT_xAOD__ElectronContainer_egamma_Electrons", - #L2Calo collections + "HLT_xAOD__ElectronContainer_egamma_ElectronsAux.", + "HLT_xAOD__PhotonContainer_egamma_Photons", + "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", "HLT_xAOD__TrigRingerRingsContainer_TrigT2CaloEgamma", - "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", - # to access information about EF clusters and tracks + "HLT_xAOD__TrigRingerRingsContainer_TrigT2CaloEgammaAux.", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux.", "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", + "HLT_xAOD__TrigRNNOutputContainer_TrigRingerNeuralFex", + "HLT_xAOD__TrigRNNOutputContainer_TrigRingerNeuralFexAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig", - # For trigger matching - "HLT_xAOD__TrigPassBitsContainer_passbits"] + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrigAux.", + "HLT_xAOD__TrigPassBitsContainer_passbits", + "HLT_xAOD__TrigPassBitsContainer_passbitsAux.", + "LVL1EmTauRoIs", + "LVL1EmTauRoIsAux.", + "HLT_TrigRoiDescriptorCollection_initialRoI", + "HLT_TrigRoiDescriptorCollection_initialRoIAux.", + "HLT_xAOD__RoiDescriptorStore_initialRoI", + "HLT_xAOD__RoiDescriptorStore_initialRoIAux.", + "HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "HLT_xAOD__TrigElectronContainer_L2ElectronFexAux." +] +ExtraContainersTriggerDataOnly = [] # should probably slim electron/cluster collections and keep only relevant subset of variables.. # no Jpsi with Fwd electrons so no ForwardElectrons, InDetTrackParticlesForwrd, ForwardElectronClusters diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM3ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM3ExtraContent.py index a9963636cd5b9381071701daaae82a494b43d5cf..990c084d3c0fb1c978d9ae9dabd4c83d75d482e5 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM3ExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM3ExtraContent.py @@ -3,23 +3,15 @@ #Content included in addition to the Smart Slimming Content ExtraContentElectrons=[ - "Electrons.etcone20", - "Electrons.etcone30", - "Electrons.etcone40", - "Electrons.ptcone20", - "Electrons.ptcone30", - "Electrons.ptcone40", "Electrons.Loose", "Electrons.Medium", - "Electrons.Tight", - "Electrons.DFCommonElectronsLHLoose", - "Electrons.DFCommonElectronsLHMedium", - "Electrons.DFCommonElectronsLHTight", - "Electrons.DFCommonElectronsML", - "Electrons.author", - "Electrons.OQ" + "Electrons.Tight" ] +# only if DoCellReweighting is ON +ExtraContentElectrons += ["NewSwElectrons.trackParticleLinks.pt.eta.phi.m.caloClusterLinks.author.OQ.ethad1.ethad.f1.f3.f3core.e233.e237.e277.weta1.weta2.e2tsts1.fracs1.wtots1.emins1.emaxs1.etcone20.ptcone30.deltaEta1.deltaPhi1.deltaPhi2.deltaPhiRescaled2.deltaPhiFromLastMeasurement.Loose.Medium.Tight.LHLoose.DFCommonElectronsLHLoose.DFCommonElectronsLHLooseBL.DFCommonElectronsLHMedium.DFCommonElectronsLHTight.DFCommonElectronsML.ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone20.topoetcone30.topoetcone40.charge.Reta.Rphi.Eratio.Rhad.Rhad1.DeltaE.topoetcone20ptCorrection.topoetcone30ptCorrection.topoetcone40ptCorrection.etcone20ptCorrection.etcone30ptCorrection.etcone40ptCorrection.ambiguityLink.truthParticleLink.truthOrigin.truthType.truthPdgId.firstEgMotherTruthType.firstEgMotherTruthOrigin.firstEgMotherTruthParticleLink.firstEgMotherPdgId.lastEgMotherTruthType.lastEgMotherTruthOrigin.lastEgMotherTruthParticleLink.lastEgMotherPdgId.ambiguityType"] +# might need to add extra variables for Min/Max variations... but not for the moment + ExtraElectronsTruth=[ "Electrons.truthOrigin", "Electrons.truthType", @@ -106,29 +98,46 @@ ExtraContainersPhotons=["Photons", "egammaClusters", "ForwardElectrons", "ForwardElectronClusters", + "NewSwPhotons", # only if DoCellReweighting is ON + "MaxVarSwPhotons", # if variations are ON + "MinVarSwPhotons" # if variations are ON ] # for trigger studies ExtraContainersTrigger=[ - # to access the HLT egamma xAOD collections "HLT_xAOD__ElectronContainer_egamma_Electrons", + "HLT_xAOD__ElectronContainer_egamma_ElectronsAux.", "HLT_xAOD__PhotonContainer_egamma_Photons", + "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", + "HLT_xAOD__PhotonContainer_egamma_Iso_Photons", + "HLT_xAOD__PhotonContainer_egamma_Iso_PhotonsAux.", "HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "HLT_xAOD__TrigElectronContainer_L2ElectronFexAux.", "HLT_xAOD__TrigPhotonContainer_L2PhotonFex", - # to access information about EF clusters and tracks + "HLT_xAOD__TrigPhotonContainer_L2PhotonFexAux.", "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFID", - # for L1 studies + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFIDAux.", "LVL1EmTauRoIs", + "LVL1EmTauRoIsAux.", "HLT_TrigPassBitsCollection_passbits", + "HLT_TrigPassBitsCollection_passbitsAux.", "HLT_TrigPassFlagsCollection_passflags", - "HLT_TrigRoiDescriptorCollection_initialRoI" + "HLT_TrigPassFlagsCollection_passflagsAux.", + "HLT_TrigRoiDescriptorCollection_initialRoI", + "HLT_TrigRoiDescriptorCollection_initialRoIAux." ] ExtraContainersTriggerDataOnly=[ "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux.", "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMaker", + "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMakerAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTF", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTFAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2ID", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig" + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2IDAux.", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrigAux." ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM4ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM4ExtraContent.py index 8c50357fdeb058bfe829b5b179ea5a54613511be..27a494b113c2beb84d53433e74742388f00609ab 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM4ExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM4ExtraContent.py @@ -1,24 +1,13 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration #Content included in addition to the Smart Slimming Content ExtraContentElectrons=[ - "Electrons.etcone20", - "Electrons.etcone30", - "Electrons.etcone40", - "Electrons.ptcone20", - "Electrons.ptcone30", - "Electrons.ptcone40", "Electrons.Loose", "Electrons.Medium", "Electrons.Tight", - "Electrons.DFCommonElectronsLHLoose", - "Electrons.DFCommonElectronsLHMedium", - "Electrons.DFCommonElectronsLHTight", - "Electrons.DFCommonElectronsML", - "Electrons.author", - "Electrons.OQ" ] + ExtraElectronsTruth=[ "Electrons.truthOrigin", "Electrons.truthType", @@ -77,22 +66,6 @@ ExtraContentHLTPhotons=[ "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex.calE.calEta.calPhi.calM.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME" ] -#cells = ("Cells5x5","Cells3x5","Cells3x7","Cells7x11") -#layers_gains = ( "_Lr0", "_Lr1", "_Lr2", "_Lr3", -# "_Lr0_LwG", "_Lr1_LwG", "_Lr2_LwG", "_Lr3_LwG", -# "_Lr0_LwG", "_Lr1_MdG", "_Lr2_MdG", "_Lr3_MdG", -# "_Lr0_LwG", "_Lr1_HiG", "_Lr2_HiG", "_Lr3_HiG" ) -# -#for cell in cells: -# ExtraContentPhotons.append("Photons."+cell) -# for layer in layers_gains: -# ExtraContentPhotons.append("Photons."+cell+layer) -# -#for cell in cells: -# ExtraContentElectrons.append("Electrons."+cell) -# for layer in layers_gains: -# ExtraContentElectrons.append("Electrons."+cell+layer) -# from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getGainDecorations GainDecoratorTool = GainDecorator() ExtraContentPhotons.extend( getGainDecorations(GainDecoratorTool) ) @@ -114,30 +87,39 @@ ExtraContainersTruth=["TruthEvents", ExtraContainersPhotons=["Photons", "GSFTrackParticles", - "egammaClusters" + "egammaClusters", + "NewSwPhotons", # only if DoCellReweighting is ON + "MaxVarSwPhotons", # if variations are ON + "MinVarSwPhotons" # if variations are ON ] -# for trigger studies +# for trigger studies and for trigger matching ExtraContainersTrigger=[ - # to access the HLT egamma xAOD collections - "HLT_xAOD__ElectronContainer_egamma_Electrons", + "HLT_xAOD__MuonContainer_MuonEFInfo", + "HLT_xAOD__MuonContainer_MuonEFInfoAux.", + "HLT_xAOD__MuonContainer_MuonEFInfo_FullScan", + "HLT_xAOD__MuonContainer_MuonEFInfo_FullScanAux.", "HLT_xAOD__PhotonContainer_egamma_Photons", - "HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", + "HLT_xAOD__PhotonContainer_egamma_Iso_Photons", + "HLT_xAOD__PhotonContainer_egamma_Iso_PhotonsAux.", "HLT_xAOD__TrigPhotonContainer_L2PhotonFex", - # to access information about EF clusters and tracks + "HLT_xAOD__TrigPhotonContainer_L2PhotonFexAux.", "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFID", - # for L1 studies + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", "LVL1EmTauRoIs", + "LVL1EmTauRoIsAux.", "HLT_TrigPassBitsCollection_passbits", + "HLT_TrigPassBitsCollection_passbitsAux.", "HLT_TrigPassFlagsCollection_passflags", - "HLT_TrigRoiDescriptorCollection_initialRoI" - ] + "HLT_TrigPassFlagsCollection_passflagsAux.", + "HLT_TrigRoiDescriptorCollection_initialRoI", + "HLT_TrigRoiDescriptorCollection_initialRoIAux." + ] ExtraContainersTriggerDataOnly=[ "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux.", "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMaker", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTF", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2ID", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig" + "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMakerAux." ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM5ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM5ExtraContent.py index 0f3aafeef9180dc389d328f309fbc41a96bce865..eca0e30a85720475ece329349965f899bc0f4bce 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM5ExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM5ExtraContent.py @@ -95,27 +95,31 @@ ExtraContainersElectrons=["Electrons", # for trigger studies ExtraContainersTrigger=[ - # to access the HLT egamma xAOD collections "HLT_xAOD__ElectronContainer_egamma_Electrons", + "HLT_xAOD__ElectronContainer_egamma_ElectronsAux.", "HLT_xAOD__PhotonContainer_egamma_Photons", + "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", "HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "HLT_xAOD__TrigElectronContainer_L2ElectronFexAux.", "HLT_xAOD__TrigPhotonContainer_L2PhotonFex", - # to access information about EF clusters and tracks + "HLT_xAOD__TrigPhotonContainer_L2PhotonFexAux.", "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFID", - # for L1 studies + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFIDAux.", "LVL1EmTauRoIs", + "LVL1EmTauRoIsAux.", "HLT_TrigPassBitsCollection_passbits", + "HLT_TrigPassBitsCollection_passbitsAux.", "HLT_TrigPassFlagsCollection_passflags", - "HLT_TrigRoiDescriptorCollection_initialRoI" + "HLT_TrigPassFlagsCollection_passflagsAux.", + "HLT_TrigRoiDescriptorCollection_initialRoI", + "HLT_TrigRoiDescriptorCollection_initialRoIAux." ] ExtraContainersTriggerDataOnly=[ "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", - "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMaker", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTF", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2ID", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig" + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux." ] #should probably slim electron/fwdelectrons/cluster collections and keep only relevant subset of variables.. diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM7ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM7ExtraContent.py index 33f8a33e4eadb20780d3448489ba8aec302c6009..2088e310366dd84b952298f48ad02feeaf5be89d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM7ExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM7ExtraContent.py @@ -94,13 +94,33 @@ ExtraContainersElectrons=["Electrons", "egammaClusters"] # for trigger studies -ExtraContainersTrigger = [ +ExtraContainersTrigger=[ "HLT_xAOD__ElectronContainer_egamma_Electrons", - #L2Calo collections + "HLT_xAOD__ElectronContainer_egamma_ElectronsAux.", + "HLT_xAOD__PhotonContainer_egamma_Photons", + "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", "HLT_xAOD__TrigRingerRingsContainer_TrigT2CaloEgamma", - "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", - # to access information about EF clusters and tracks + "HLT_xAOD__TrigRingerRingsContainer_TrigT2CaloEgammaAux.", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux.", "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", + "HLT_xAOD__TrigRNNOutputContainer_TrigRingerNeuralFex", + "HLT_xAOD__TrigRNNOutputContainer_TrigRingerNeuralFexAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig", - # For trigger matching - "HLT_xAOD__TrigPassBitsContainer_passbits"] + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrigAux.", + "HLT_xAOD__TrigPassBitsContainer_passbits", + "HLT_xAOD__TrigPassBitsContainer_passbitsAux.", + "LVL1EmTauRoIs", + "LVL1EmTauRoIsAux.", + "HLT_TrigRoiDescriptorCollection_initialRoI", + "HLT_TrigRoiDescriptorCollection_initialRoIAux.", + "HLT_xAOD__RoiDescriptorStore_initialRoI", + "HLT_xAOD__RoiDescriptorStore_initialRoIAux.", + "HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "HLT_xAOD__TrigElectronContainer_L2ElectronFexAux." + ] + +ExtraContainersTriggerDataOnly=[ + ] + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM8ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM8ExtraContent.py index e372ead0cb897fce9dd82ff6235c35fd1f52079e..b2b8645ca4251d4bd4e0ace83b67d891cf574728 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM8ExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM8ExtraContent.py @@ -79,28 +79,6 @@ ExtraContainersElectrons=["Electrons", "ForwardElectronClusters"] # for trigger studies -ExtraContainersTrigger=[ - # to access the HLT egamma xAOD collections - "HLT_xAOD__ElectronContainer_egamma_Electrons", - "HLT_xAOD__PhotonContainer_egamma_Photons", - "HLT_xAOD__TrigElectronContainer_L2ElectronFex", - "HLT_xAOD__TrigPhotonContainer_L2PhotonFex", - # to access information about EF clusters and tracks - "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFID", - # for L1 studies - "LVL1EmTauRoIs", - "HLT_TrigPassBitsCollection_passbits", - "HLT_TrigPassFlagsCollection_passflags", - "HLT_TrigRoiDescriptorCollection_initialRoI" - ] - -ExtraContainersTriggerDataOnly=[ - "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", - "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMaker", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTF", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2ID", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig" - ] +ExtraContainersTrigger=[] +ExtraContainersTriggerDataOnly=[] -#should slim electron/fwdelectrons/cluster collections and keep only relevant subset of variables.. diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM9ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM9ExtraContent.py index 07e1c96e7ff0de9849122549e43a3bcaf4688132..35c6d8b288ff654a72a9b3ae088299afbadb3429 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM9ExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGAM9ExtraContent.py @@ -89,27 +89,41 @@ ExtraContainersPhotons=["Photons", # for trigger studies ExtraContainersTrigger=[ - # to access the HLT egamma xAOD collections "HLT_xAOD__ElectronContainer_egamma_Electrons", + "HLT_xAOD__ElectronContainer_egamma_ElectronsAux.", "HLT_xAOD__PhotonContainer_egamma_Photons", + "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", + "HLT_xAOD__PhotonContainer_egamma_Iso_Photons", + "HLT_xAOD__PhotonContainer_egamma_Iso_PhotonsAux.", "HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "HLT_xAOD__TrigElectronContainer_L2ElectronFexAux.", "HLT_xAOD__TrigPhotonContainer_L2PhotonFex", - # to access information about EF clusters and tracks + "HLT_xAOD__TrigPhotonContainer_L2PhotonFexAux.", "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFID", - # for L1 studies + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFIDAux.", "LVL1EmTauRoIs", + "LVL1EmTauRoIsAux.", "HLT_TrigPassBitsCollection_passbits", + "HLT_TrigPassBitsCollection_passbitsAux.", "HLT_TrigPassFlagsCollection_passflags", - "HLT_TrigRoiDescriptorCollection_initialRoI" + "HLT_TrigPassFlagsCollection_passflagsAux.", + "HLT_TrigRoiDescriptorCollection_initialRoI", + "HLT_TrigRoiDescriptorCollection_initialRoIAux." ] ExtraContainersTriggerDataOnly=[ "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux.", "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMaker", + "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMakerAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTF", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTFAux.", "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2ID", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig" + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2IDAux.", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrigAux." ] #should slim electron/fwdelectrons/cluster collections and keep only relevant subset of variables.. diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py index e1905f4780c919edd7ea403f0dc4181236c37b14..738405860bb69dfc38cd650d4802c48458eb0953 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration #******************************************************************** # EGammaCommon.py @@ -22,7 +22,7 @@ ToolSvc += DFCommonPhotonsDirection #==================================================================== # SHOWER SHAPE FUDGING IN MC -# (PRESELECTION=16: FUDGE FACTORS GEO21->DATA12) +# (PRESELECTION=22: FUDGE FACTORS RUN2 2015+2016 DATA, Rel 21) #==================================================================== from PyUtils import AthFile @@ -37,22 +37,19 @@ if isMC: simulationFlavour = af.fileinfos['metadata']['/Simulation/Parameters']['SimulationFlavour'] isFullSim = simulationFlavour in ('default', 'MC12G4', 'FullG4') -print("EGammaCommon: isMC = ", isMC) +print "EGammaCommon: isMC = ", isMC if isMC: - print("EGammaCommon: isFullSim = ", isFullSim) + print "EGammaCommon: isFullSim = ", isFullSim if isFullSim: -#from AthenaCommon.GlobalFlags import globalflags -#print "globalflags.DataSource(): ", globalflags.DataSource() -#if globalflags.DataSource()=='geant4': from ElectronPhotonShowerShapeFudgeTool.ElectronPhotonShowerShapeFudgeToolConf import ElectronPhotonShowerShapeFudgeTool - DF_ElectronPhotonShowerShapeFudgeTool = ElectronPhotonShowerShapeFudgeTool(Preselection=16) + DF_ElectronPhotonShowerShapeFudgeTool = ElectronPhotonShowerShapeFudgeTool(Preselection=22) ToolSvc += DF_ElectronPhotonShowerShapeFudgeTool - print(DF_ElectronPhotonShowerShapeFudgeTool) + print DF_ElectronPhotonShowerShapeFudgeTool #==================================================================== -# ELECTRON SELECTION (loose, medium and tight LLH) +# ELECTRON LH SELECTORS # see http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py on how to configure the selectors #==================================================================== from ROOT import LikeEnum @@ -79,44 +76,59 @@ ElectronLHSelectorTight = ConfiguredAsgElectronLikelihoodTool("ElectronLHSelecto ElectronLHSelectorTight.primaryVertexContainer = "PrimaryVertices" ToolSvc += ElectronLHSelectorTight +# LooseBL +from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronLikelihoodTool +ElectronLHSelectorLooseBL = AsgElectronLikelihoodTool("ElectronLHSelectorLooseBL", WorkingPoint="LooseBLLHElectron") +ElectronLHSelectorLooseBL.primaryVertexContainer = "PrimaryVertices" +ToolSvc += ElectronLHSelectorLooseBL + #==================================================================== -# ELECTRON SELECTION (loose, medium and tight cut-based) +# ELECTRON CHARGE SELECTION #==================================================================== -from ROOT import egammaPID +from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronChargeIDSelectorTool +ElectronChargeIDSelector = AsgElectronChargeIDSelectorTool("ElectronChargeIDSelectorLoose") +ElectronChargeIDSelector.primaryVertexContainer = "PrimaryVertices" +ElectronChargeIDSelector.TrainingFile = "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root" +ToolSvc += ElectronChargeIDSelector -from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors import ConfiguredAsgElectronIsEMSelector +#==================================================================== +# FWD ELECTRON LH SELECTORS +#==================================================================== +from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgForwardElectronLikelihoodTool -# Loose -ElectronIsEMSelectorLoose = ConfiguredAsgElectronIsEMSelector("ElectronIsEMSelectorLoose", egammaPID.ElectronIDLoosePP) -ToolSvc += ElectronIsEMSelectorLoose +ForwardElectronLHSelectorLoose = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorLoose", WorkingPoint="LooseLHForwardElectron") +ToolSvc += ForwardElectronLHSelectorLoose -# Medium -ElectronIsEMSelectorMedium = ConfiguredAsgElectronIsEMSelector("ElectronIsEMSelectorMedium", egammaPID.ElectronIDMediumPP) -ToolSvc += ElectronIsEMSelectorMedium +ForwardElectronLHSelectorMedium = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorMedium", WorkingPoint="MediumLHForwardElectron") +ToolSvc += ForwardElectronLHSelectorMedium -# Tight -ElectronIsEMSelectorTight = ConfiguredAsgElectronIsEMSelector("ElectronIsEMSelectorTight", egammaPID.ElectronIDTightPP) -ToolSvc += ElectronIsEMSelectorTight +ForwardElectronLHSelectorTight = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorTight", WorkingPoint="TightLHForwardElectron") +ToolSvc += ForwardElectronLHSelectorTight -#==================================================================== -# ELECTRON SELECTION (multi lepton) -#==================================================================== -from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronMultiLeptonSelector -ElectronMLSelector = AsgElectronMultiLeptonSelector("ElectronMLSelector") -ToolSvc += ElectronMLSelector #==================================================================== # PHOTON SELECTION (loose and tight cut-based) #==================================================================== -# Loose +from ROOT import egammaPID + from ElectronPhotonSelectorTools.ConfiguredAsgPhotonIsEMSelectors import ConfiguredAsgPhotonIsEMSelector +from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import photonPIDmenu + +# Loose PhotonIsEMSelectorLoose = ConfiguredAsgPhotonIsEMSelector("PhotonIsEMSelectorLoose", egammaPID.PhotonIDLoose) ToolSvc += PhotonIsEMSelectorLoose -# Tight +# Tight (default == pt-dependent) PhotonIsEMSelectorTight = ConfiguredAsgPhotonIsEMSelector("PhotonIsEMSelectorTight", egammaPID.PhotonIDTight) ToolSvc += PhotonIsEMSelectorTight +# Tight (pt-inclusive) +# To be removed when pt-dependent menu above is supported with scale factors +PhotonIsEMSelectorTightPtIncl = ConfiguredAsgPhotonIsEMSelector("PhotonIsEMSelectorTightPtIncl", egammaPID.PhotonIDTight,menu=photonPIDmenu.menuPtInclJan2018) +ToolSvc += PhotonIsEMSelectorTightPtIncl + + + #==================================================================== # RECTANGULAR CLUSTER TOOLS #==================================================================== @@ -151,100 +163,108 @@ EGAMCOM_caloFillRect711 = CaloFillRectangularCluster ( name = "EGAMCOMCaloFillRe fill_cluster = True) ToolSvc += EGAMCOM_caloFillRect711 + #==================================================================== # AUGMENTATION TOOLS #==================================================================== from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper - +from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGSelectionToolWrapper +from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGElectronLikelihoodToolWrapper # decorate electrons with the output of LH very loose -ElectronPassLHVeryLoose = DerivationFramework__AsgSelectionToolWrapper( name = "ElectronPassLHVeryLoose", - AsgSelectionTool = ElectronLHSelectorVeryLoose, - CutType = "", - StoreGateEntryName = "DFCommonElectronsLHVeryLoose", - ContainerName = "Electrons") +ElectronPassLHVeryLoose = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHVeryLoose", + EGammaSelectionTool = ElectronLHSelectorVeryLoose, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsLHVeryLoose", + ContainerName = "Electrons") ToolSvc += ElectronPassLHVeryLoose -print(ElectronPassLHVeryLoose) +print ElectronPassLHVeryLoose # decorate electrons with the output of LH loose -ElectronPassLHLoose = DerivationFramework__AsgSelectionToolWrapper( name = "ElectronPassLHLoose", - AsgSelectionTool = ElectronLHSelectorLoose, - CutType = "", - StoreGateEntryName = "DFCommonElectronsLHLoose", - ContainerName = "Electrons") +ElectronPassLHLoose = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHLoose", + EGammaSelectionTool = ElectronLHSelectorLoose, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsLHLoose", + ContainerName = "Electrons") ToolSvc += ElectronPassLHLoose -print(ElectronPassLHLoose) +print ElectronPassLHLoose -# decorate electrons with the output of LH medium -ElectronPassLHMedium = DerivationFramework__AsgSelectionToolWrapper( name = "ElectronPassLHMedium", - AsgSelectionTool = ElectronLHSelectorMedium, +# decorate electrons with the output of LH loose+BL +ElectronPassLHLooseBL = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHLooseBL", + EGammaSelectionTool = ElectronLHSelectorLooseBL, + EGammaFudgeMCTool = "", CutType = "", - StoreGateEntryName = "DFCommonElectronsLHMedium", + StoreGateEntryName = "DFCommonElectronsLHLooseBL", ContainerName = "Electrons") -ToolSvc += ElectronPassLHMedium -print(ElectronPassLHMedium) +ToolSvc += ElectronPassLHLooseBL +print ElectronPassLHLooseBL -# decorate electrons with the output of LH tight -ElectronPassLHTight = DerivationFramework__AsgSelectionToolWrapper( name = "ElectronPassLHTight", - AsgSelectionTool = ElectronLHSelectorTight, +# decorate electrons with the output of LH medium +ElectronPassLHMedium = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHMedium", + EGammaSelectionTool = ElectronLHSelectorMedium, + EGammaFudgeMCTool = "", CutType = "", - StoreGateEntryName = "DFCommonElectronsLHTight", + StoreGateEntryName = "DFCommonElectronsLHMedium", ContainerName = "Electrons") -ToolSvc += ElectronPassLHTight -print(ElectronPassLHTight) - - -from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGSelectionToolWrapper - -# decorate electrons with the output of IsEM loose -ElectronPassIsEMLoose = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassIsEMLoose", - EGammaSelectionTool = ElectronIsEMSelectorLoose, - EGammaFudgeMCTool = None, - CutType = "", - StoreGateEntryName = "DFCommonElectronsIsEMLoose", - ContainerName = "Electrons") - -ToolSvc += ElectronPassIsEMLoose -print(ElectronPassIsEMLoose) - -# decorate electrons with the output of IsEM medium -ElectronPassIsEMMedium = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassIsEMMedium", - EGammaSelectionTool = ElectronIsEMSelectorMedium, - EGammaFudgeMCTool = None, - CutType = "", - StoreGateEntryName = "DFCommonElectronsIsEMMedium", - ContainerName = "Electrons") - - -ToolSvc += ElectronPassIsEMMedium -print(ElectronPassIsEMMedium) - -# decorate electrons with the output of IsEM tight -ElectronPassIsEMTight = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassIsEMTight", - EGammaSelectionTool = ElectronIsEMSelectorTight, - EGammaFudgeMCTool = None, - CutType = "", - StoreGateEntryName = "DFCommonElectronsIsEMTight", - ContainerName = "Electrons") - -ToolSvc += ElectronPassIsEMTight -print(ElectronPassIsEMTight) - -# decorate electrons with the output of MultiLepton -from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper -ElectronPassML = DerivationFramework__AsgSelectionToolWrapper( name = "ElectronPassML", - AsgSelectionTool = ElectronMLSelector, - CutType = "", - StoreGateEntryName = "DFCommonElectronsML", - ContainerName = "Electrons") -ToolSvc += ElectronPassML -print(ElectronPassML) +ToolSvc += ElectronPassLHMedium +print ElectronPassLHMedium +# decorate electrons with the output of LH tight +ElectronPassLHTight = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHTight", + EGammaSelectionTool = ElectronLHSelectorTight, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsLHTight", + ContainerName = "Electrons") +ToolSvc += ElectronPassLHTight +print ElectronPassLHTight + +# decorate electrons with the output of ECIDS ---------------------------------------------------------------------- +ElectronPassECIDS = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassECIDS", + EGammaElectronLikelihoodTool = ElectronChargeIDSelector, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsECIDS", + + ContainerName = "Electrons", + StoreTResult = True) +ToolSvc += ElectronPassECIDS +print ElectronPassECIDS + +# decorate forward electrons with the output of LH loose +ForwardElectronPassLHLoose = DerivationFramework__EGSelectionToolWrapper( name = "ForwardElectronPassLHLoose", + EGammaSelectionTool = ForwardElectronLHSelectorLoose, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonForwardElectronsLHLoose", + ContainerName = "ForwardElectrons") +ToolSvc += ForwardElectronPassLHLoose +print ForwardElectronPassLHLoose + +# decorate forward electrons with the output of LH medium +ForwardElectronPassLHMedium = DerivationFramework__EGSelectionToolWrapper( name = "ForwardElectronPassLHMedium", + EGammaSelectionTool = ForwardElectronLHSelectorMedium, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonForwardElectronsLHMedium", + ContainerName = "ForwardElectrons") +ToolSvc += ForwardElectronPassLHMedium +print ForwardElectronPassLHMedium + +# decorate forward electrons with the output of LH tight +ForwardElectronPassLHTight = DerivationFramework__EGSelectionToolWrapper( name = "ForwardElectronPassLHTight", + EGammaSelectionTool = ForwardElectronLHSelectorTight, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonForwardElectronsLHTight", + ContainerName = "ForwardElectrons") +ToolSvc += ForwardElectronPassLHTight +print ForwardElectronPassLHTight -from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGSelectionToolWrapper # decorate photons with the output of IsEM loose # on MC, fudge the shower shapes before computing the ID (but the original shower shapes are not overridden) -#if globalflags.DataSource()=='geant4': if isFullSim: PhotonPassIsEMLoose = DerivationFramework__EGSelectionToolWrapper( name = "PhotonPassIsEMLoose", EGammaSelectionTool = PhotonIsEMSelectorLoose, @@ -260,11 +280,10 @@ else: StoreGateEntryName = "DFCommonPhotonsIsEMLoose", ContainerName = "Photons") ToolSvc += PhotonPassIsEMLoose -print(PhotonPassIsEMLoose) +print PhotonPassIsEMLoose # decorate photons with the output of IsEM tight # on full-sim MC, fudge the shower shapes before computing the ID (but the original shower shapes are not overridden) -#if globalflags.DataSource()=='geant4': if isFullSim: PhotonPassIsEMTight = DerivationFramework__EGSelectionToolWrapper( name = "PhotonPassIsEMTight", EGammaSelectionTool = PhotonIsEMSelectorTight, @@ -280,15 +299,62 @@ else: StoreGateEntryName = "DFCommonPhotonsIsEMTight", ContainerName = "Photons") ToolSvc += PhotonPassIsEMTight -print(PhotonPassIsEMTight) +print PhotonPassIsEMTight + +# decorate photons with the output of IsEM tight pt-inclusive menu +# Can be removed once pt-dependent cuts are fully supported. +# On full-sim MC, fudge the shower shapes before computing the ID (but the original shower shapes are not overridden) +PhotonPassIsEMTightPtIncl = DerivationFramework__EGSelectionToolWrapper( name = "PhotonPassIsEMTightPtIncl", + EGammaSelectionTool = PhotonIsEMSelectorTightPtIncl, + EGammaFudgeMCTool = (DF_ElectronPhotonShowerShapeFudgeTool if isFullSim else None), + CutType = "", + StoreGateEntryName = "DFCommonPhotonsIsEMTightPtIncl", + ContainerName = "Photons") +ToolSvc += PhotonPassIsEMTightPtIncl +print PhotonPassIsEMTightPtIncl + +# decorate photons with the photon cleaning flags +# on MC, fudge the shower shapes before computing the flags +from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGPhotonCleaningWrapper +if isFullSim: + PhotonPassCleaning = DerivationFramework__EGPhotonCleaningWrapper( name = "PhotonPassCleaning", + EGammaFudgeMCTool = DF_ElectronPhotonShowerShapeFudgeTool, + StoreGateEntryName = "DFCommonPhotonsCleaning", + ContainerName = "Photons") +else: + PhotonPassCleaning = DerivationFramework__EGPhotonCleaningWrapper( name = "PhotonPassCleaning", + EGammaFudgeMCTool = None, + StoreGateEntryName = "DFCommonPhotonsCleaning", + ContainerName = "Photons") +ToolSvc += PhotonPassCleaning +print PhotonPassCleaning + +# decorate central electrons and photons with a flag to tell the the candidates are affected by the crack bug in mc16a and data 2015+2016 +from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGCrackVetoCleaningTool as DF_EGCVCT +PhotonPassCrackVeto = DF_EGCVCT(name = "PhotonPassCrackVeto", + StoreGateEntryName = "DFCommonCrackVetoCleaning", + ContainerName = "Photons") +ElectronPassCrackVeto = DF_EGCVCT(name = "ElectronPassCrackVeto", + StoreGateEntryName = "DFCommonCrackVetoCleaning", + ContainerName = "Electrons") +ToolSvc += [PhotonPassCrackVeto,ElectronPassCrackVeto] + +# decorate some electrons with an additional ambiguity flag against internal and early material conversion +from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGElectronAmbiguityTool as DF_EGEAT +ElectronAmbiguity = DF_EGEAT(name = "ElectronAdditionnalAmbiguity", + isMC = (globalflags.DataSource()!='data')) +ToolSvc += ElectronAmbiguity # list of all the decorators so far EGAugmentationTools = [DFCommonPhotonsDirection, - ElectronPassLHVeryLoose,ElectronPassLHLoose,ElectronPassLHMedium,ElectronPassLHTight, - ElectronPassIsEMLoose,ElectronPassIsEMMedium,ElectronPassIsEMTight, - PhotonPassIsEMLoose, - PhotonPassIsEMTight, - ElectronPassML] + ElectronPassLHVeryLoose, ElectronPassLHLoose, ElectronPassLHLooseBL, ElectronPassLHMedium, ElectronPassLHTight, + ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, + ElectronPassECIDS, + PhotonPassIsEMLoose, PhotonPassIsEMTight, + PhotonPassIsEMTightPtIncl, + PhotonPassCleaning, + PhotonPassCrackVeto,ElectronPassCrackVeto, + ElectronAmbiguity] #================================================== # Truth Related tools @@ -297,13 +363,16 @@ if rec.doTruth(): # Decorate Electron with bkg electron type/origin from MCTruthClassifier.MCTruthClassifierBase import MCTruthClassifier as BkgElectronMCTruthClassifier + BkgElectronMCTruthClassifier.barcodeG4Shift=(DerivationFrameworkSimBarcodeOffset+1) + from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__BkgElectronClassification BkgElectronClassificationTool = DerivationFramework__BkgElectronClassification (name = "BkgElectronClassificationTool", - MCTruthClassifierTool = BkgElectronMCTruthClassifier) + MCTruthClassifierTool = BkgElectronMCTruthClassifier, + barcodeCut=DerivationFrameworkSimBarcodeOffset) ToolSvc += BkgElectronClassificationTool - print(BkgElectronClassificationTool) + print BkgElectronClassificationTool EGAugmentationTools.append(BkgElectronClassificationTool) # Decorate egammaTruthParticles with truth-particle-level etcone20,30,40 @@ -317,7 +386,7 @@ if rec.doTruth(): IsolationVarNamePrefix = 'etcone', ChargedParticlesOnly = False) ToolSvc += TruthEgetIsolationTool - print(TruthEgetIsolationTool) + print TruthEgetIsolationTool EGAugmentationTools.append(TruthEgetIsolationTool) # Decorate egammaTruthParticles with truth-particle-level ptcone20,30,40 @@ -329,15 +398,14 @@ if rec.doTruth(): IsolationVarNamePrefix = 'ptcone', ChargedParticlesOnly = True) ToolSvc += TruthEgptIsolationTool - print(TruthEgptIsolationTool) + print TruthEgptIsolationTool EGAugmentationTools.append(TruthEgptIsolationTool) # Compute the truth-particle-level energy density in the central eta region - from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAlg + from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAthAlg from JetRec.JetRecStandard import jtm - tc=configEventDensityTool("EDTruthCentralTool", - inputlabel = jtm.truthget.Label, - radius = 0.5, + tc=configEventDensityTool("EDTruthCentralTool", jtm.truthget, + 0.5, AbsRapidityMax = 1.5, OutputContainer = "TruthIsoCentralEventShape", OutputLevel = 3, @@ -345,9 +413,8 @@ if rec.doTruth(): ToolSvc += tc # Compute the truth-particle-level energy density in the forward eta region - tf=configEventDensityTool("EDTruthForwardTool", - inputlabel = jtm.truthget.Label, - radius = 0.5, + tf=configEventDensityTool("EDTruthForwardTool", jtm.truthget, + 0.5, AbsRapidityMin = 1.5, AbsRapidityMax = 3.0, OutputContainer = "TruthIsoForwardEventShape", @@ -358,8 +425,9 @@ if rec.doTruth(): # Schedule the two energy density tools for running from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence += EventDensityAlg("EDTruthCentralAlg", EventDensityTool = tc ) - topSequence += EventDensityAlg("EDTruthForwardAlg", EventDensityTool = tf ) + topSequence += EventDensityAthAlg("EDTruthCentralAlg", EventDensityTool = tc ) + topSequence += EventDensityAthAlg("EDTruthForwardAlg", EventDensityTool = tf ) + #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM @@ -370,5 +438,12 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("EGamma AugmentationTools = EGAugmentationTools ) +#======================================= +# ADD TOOLS +#======================================= + +import IsolationAlgs.IsoUpdatedTrackCones as isoCones +if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"): + DerivationFrameworkJob += isoCones.GetUpdatedIsoTrackCones() diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/ElectronsCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/ElectronsCPContent.py index d8c24f416f9c114992d83944796603490e7e7b87..94950a9c2c2a5c100151bc9a024e2fad3ab337f0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/ElectronsCPContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/ElectronsCPContent.py @@ -1,14 +1,22 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration ElectronsCPContent = [ "Electrons", -"ElectronsAux.trackParticleLinks.pt.eta.phi.m.caloClusterLinks.author.OQ.ethad1.ethad.f1.f3.f3core.e233.e237.e277.weta1.weta2.e2tsts1.fracs1.wtots1.emins1.emaxs1.etcone20.ptcone30.deltaEta1.deltaPhi1.deltaPhi2.deltaPhiRescaled2.deltaPhiFromLastMeasurement.Loose.Medium.Tight.LHLoose.DFCommonElectronsLHLoose.DFCommonElectronsLHMedium.DFCommonElectronsLHTight.DFCommonElectronsML.ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone20.topoetcone30.topoetcone40.charge.Reta.Rphi.Eratio.Rhad.Rhad1.DeltaE.DFCommonElectronsIsEMLoose.DFCommonElectronsIsEMMedium.DFCommonElectronsIsEMTight.topoetcone20ptCorrection.topoetcone30ptCorrection.topoetcone40ptCorrection.etcone20ptCorrection.etcone30ptCorrection.etcone40ptCorrection.ambiguityLink.truthParticleLink.truthOrigin.truthType.truthPdgId.firstEgMotherTruthType.firstEgMotherTruthOrigin.firstEgMotherTruthParticleLink.firstEgMotherPdgId.lastEgMotherTruthType.lastEgMotherTruthOrigin.lastEgMotherTruthParticleLink.lastEgMotherPdgId.ambiguityType", +"ElectronsAux.trackParticleLinks.pt.eta.phi.m.charge.author.OQ.DFCommonElectronsLHVeryLoose.DFCommonElectronsLHLoose.DFCommonElectronsLHLooseBL.DFCommonElectronsLHMedium.DFCommonElectronsLHTight.DFCommonElectronsLHVeryLooseIsEMValue.DFCommonElectronsLHLooseIsEMValue.DFCommonElectronsLHLooseBLIsEMValue.DFCommonElectronsLHMediumIsEMValue.DFCommonElectronsLHTightIsEMValue.DFCommonElectronsECIDS.DFCommonElectronsECIDSResult.ptvarcone20.ptvarcone40_TightTTVALooseCone_pt1000.topoetcone20.topoetcone20ptCorrection.ptcone20_TightTTVALooseCone_pt500.ptcone20_TightTTVALooseCone_pt1000.ptvarcone20_TightTTVA_pt1000.ptvarcone30_TightTTVA_pt500.ptvarcone30_TightTTVA_pt1000.ptvarcone20_TightTTVALooseCone_pt1000.ptvarcone30_TightTTVALooseCone_pt500.ptvarcone30_TightTTVALooseCone_pt1000.neflowisol20.core57cellsEnergyCorrection.topoetconecoreConeSCEnergyCorrection.topoetconecoreConeEnergyCorrection.DFCommonCrackVetoCleaning.caloClusterLinks.ambiguityLink.truthParticleLink.truthOrigin.truthType.truthPdgId.firstEgMotherTruthType.firstEgMotherTruthOrigin.firstEgMotherTruthParticleLink.firstEgMotherPdgId.ambiguityType.DFCommonAddAmbiguity", "GSFTrackParticles", -"GSFTrackParticlesAux.chiSquared.phi.d0.theta.qOverP.definingParametersCovMatrix.parameterX.parameterPX.parameterPY.parameterPZ.parameterPosition.numberOfBLayerHits.numberOfBLayerOutliers.expectBLayerHit.numberOfPixelHits.numberOfPixelOutliers.numberOfPixelDeadSensors.numberOfSCTHits.numberOfSCTOutliers.numberOfSCTDeadSensors.numberOfTRTHits.numberOfTRTOutliers.numberOfTRTHighThresholdHits.numberOfTRTHighThresholdOutliers.numberOfTRTXenonHits.z0.vz.charge.vertexLink.numberOfInnermostPixelLayerHits.numberOfInnermostPixelLayerOutliers.numberOfNextToInnermostPixelLayerOutliers.expectInnermostPixelLayerHit.eProbabilityComb.truthParticleLink.originalTrackParticle.eProbabilityHT.numberOfNextToInnermostPixelLayerHits.expectNextToInnermostPixelLayerHit", +"GSFTrackParticlesAux.chiSquared.phi.d0.theta.qOverP.definingParametersCovMatrix.numberOfPixelHits.numberOfPixelOutliers.numberOfPixelDeadSensors.numberOfSCTHits.numberOfSCTOutliers.numberOfSCTDeadSensors.z0.vz.charge.vertexLink.numberOfInnermostPixelLayerHits.numberOfInnermostPixelLayerOutliers.numberOfNextToInnermostPixelLayerOutliers.expectInnermostPixelLayerHit.truthParticleLink.originalTrackParticle.numberOfNextToInnermostPixelLayerHits.expectNextToInnermostPixelLayerHit", "GSFConversionVertices", "GSFConversionVerticesAux.px.py.pz", "PrimaryVertices", "PrimaryVerticesAux.trackParticleLinks.vertexType.neutralParticleLinks", "egammaClusters", -"egammaClustersAux.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME" +"egammaClustersAux.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME.ETA2CALOFRAME.PHI2CALOFRAME.constituentClusterLinks", +"TopoClusterIsoCentralEventShape", +"TopoClusterIsoCentralEventShapeAux.Density", +"TopoClusterIsoForwardEventShape", +"TopoClusterIsoForwardEventShapeAux.Density", +"NeutralParticleFlowIsoCentralEventShape", +"NeutralParticleFlowIsoCentralEventShapeAux.Density", +"NeutralParticleFlowIsoForwardEventShape", +"NeutralParticleFlowIsoForwardEventShapeAux.Density" ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/ElectronsCPDetailedContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/ElectronsCPDetailedContent.py new file mode 100644 index 0000000000000000000000000000000000000000..fa5be95ec6489bef9e0500f3de5dca497ec682dc --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/ElectronsCPDetailedContent.py @@ -0,0 +1,11 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +ExtraElectronShowerShapes = ["Electrons.Rhad.Rhad1.e277.Reta.Rphi.weta2.f1.Eratio.DeltaE.weta1.fracs1.wtots1.f3.f3core.deltaEta1.deltaPhi1.deltaPhi2.deltaPhiRescaled2.deltaPhiFromLastMeasurement"] +ExtraElectronTruthInfo = ["Electrons.lastEgMotherTruthType.lastEgMotherTruthOrigin.lastEgMotherTruthParticleLink.lastEgMotherPdgId"] +ElectronsCPDetailedContent = ExtraElectronShowerShapes + ExtraElectronTruthInfo + +ExtraElectronGSFVar = ["GSFTrackParticles.parameterX.parameterPX.parameterPY.parameterPZ.parameterPosition.numberOfTRTHits.numberOfTRTOutliers.numberOfTRTHighThresholdHits.numberOfTRTHighThresholdOutliers.numberOfTRTXenonHits.eProbabilityComb.eProbabilityHT"] +GSFTracksCPDetailedContent = ExtraElectronGSFVar + +ElectronsAddAmbiguityContent = ["Electrons.DFCommonSimpleConvRadius.DFCommonSimpleConvPhi.DFCommonSimpleMee.DFCommonSimpleMeeAtVtx.DFCommonSimpleSeparation.DFCommonProdTrueRadius.DFCommonProdTruePhi.DFCommonProdTrueZ"] + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/PhotonsCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/PhotonsCPContent.py index f53499fd1b0df974909d27c6b46783388b56435e..483f80478f6cbffe359819f758de835c1ef90f52 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/PhotonsCPContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/PhotonsCPContent.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration PhotonsCPContent = [ "GSFConversionVertices", @@ -6,11 +6,15 @@ PhotonsCPContent = [ "GSFTrackParticles", "GSFTrackParticlesAux.phi.theta.qOverP.numberOfPixelHits.numberOfSCTHits.vertexLink.truthParticleLink.originalTrackParticle.numberOfInnermostPixelLayerHits.expectInnermostPixelLayerHit.numberOfNextToInnermostPixelLayerHits.expectNextToInnermostPixelLayerHit", "Photons", -"PhotonsAux.pt.eta.phi.m.caloClusterLinks.ethad1.ethad.f1.e233.e237.e277.weta1.weta2.e2tsts1.fracs1.wtots1.emins1.emaxs1.vertexLinks.ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone20.topoetcone30.topoetcone40.truthParticleLink.truthOrigin.truthType.author.OQ.f3.Loose.Medium.Tight.Reta.Rphi.Eratio.Rhad.Rhad1.DeltaE.DFCommonPhotonsIsEMLoose.DFCommonPhotonsIsEMTight.topoetcone20ptCorrection.topoetcone30ptCorrection.topoetcone40ptCorrection.etcone20ptCorrection.etcone30ptCorrection.etcone40ptCorrection", +"PhotonsAux.pt.eta.phi.m.author.OQ.DFCommonPhotonsIsEMLoose.DFCommonPhotonsIsEMTight.DFCommonPhotonsIsEMTightIsEMValue.DFCommonPhotonsIsEMTightPtIncl.DFCommonPhotonsIsEMTightPtInclIsEMValue.DFCommonPhotonsCleaning.DFCommonPhotonsCleaningNoTime.DFCommonCrackVetoCleaning.ptcone20.ptcone20_TightTTVA_pt1000.neflowisol20.topoetcone20.topoetcone40.topoetcone20ptCorrection.topoetcone40ptCorrection.core57cellsEnergyCorrection.topoetconecoreConeSCEnergyCorrection.topoetconecoreConeEnergyCorrection.caloClusterLinks.vertexLinks.ambiguityLink.truthParticleLink.truthOrigin.truthType", "egammaClusters", -"egammaClustersAux.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME.clusterSize.altE.calM", -"egammaTopoSeededClusters", -"egammaTopoSeededClustersAux.calE.calEta.calPhi.e_sampl.eta_sampl.ETACALOFRAME.PHICALOFRAME.etaCalo.phiCalo.calM", +"egammaClustersAux.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME.clusterSize.altE.calM.constituentClusterLinks", "Electrons", -"ElectronsAux.trackParticleLinks.truthParticleLink.caloClusterLinks" +"ElectronsAux.trackParticleLinks.truthParticleLink.caloClusterLinks", +"TopoClusterIsoCentralEventShape", +"TopoClusterIsoCentralEventShapeAux.Density", +"TopoClusterIsoForwardEventShape", +"TopoClusterIsoForwardEventShapeAux.Density", +"NeutralParticleFlowIsoCentralEventShape", +"NeutralParticleFlowIsoCentralEventShapeAux.Density" ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/PhotonsCPDetailedContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/PhotonsCPDetailedContent.py new file mode 100644 index 0000000000000000000000000000000000000000..75d148c8bd5a189380410478551457f3ef2480fd --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/PhotonsCPDetailedContent.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +PhotonsCPDetailedContent = ["Photons.Rhad.Rhad1.e277.Reta.Rphi.weta2.f1.weta1.fracs1.wtots1.Eratio.DeltaE.f3"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/egammaDFFlags.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/egammaDFFlags.py new file mode 100644 index 0000000000000000000000000000000000000000..3cc63f4d558aa834f31e150b84ce5ef5eded6f5c --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/egammaDFFlags.py @@ -0,0 +1,77 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +#======================================================================= +# File: DerivationFrameworkEGamma/python/egammaDFFlags.py +#======================================================================= +__author__ = 'G. Marchiori' +__version__="$Revision: 1.0 $" +__doc__="egamma DF flags . " + +#======================================================================= +# imports +#======================================================================= +from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer +from AthenaCommon.JobProperties import jobproperties + +class Enabled(JobProperty): + """ jobproperty to disable/enable the egamma algorithms as a group (container) in one go. + Can enable/disable the full egamma + """ + statusOn=True + allowedTypes=['bool'] + StoredValue=True + +class egammaDFFlagsJobProperty(JobProperty): + """ special flag . Subclass which has get_value depending on job properties.egammaDFFlags.Enabled + so properties inheriting from this will be disables if egammaRec is not Enabled. + """ + def get_Value(self): + return self.statusOn and self.StoredValue and jobproperties.egammaDFFlags.Enabled() + +# enable or disable cell-level reweighting +class doEGammaCellReweighting (egammaDFFlagsJobProperty): + """ switch for enabling cell-level reweighting of e/gamma clusters + """ + statusOn=True + allowedTypes=['bool'] + StoredValue=True + +# enable or disable cell-level reweighting variations +class doEGammaCellReweightingVariations (egammaDFFlagsJobProperty): + """ switch for enabling cell-level reweighting of e/gamma clusters with max/min variations + """ + statusOn=True + allowedTypes=['bool'] + StoredValue=False + +class doEGammaDAODTrackThinning (egammaDFFlagsJobProperty): + """ switch for enabling track-thinning in egamma DAODs + """ + statusOn=True + allowedTypes=['bool'] + StoredValue=True + + +# class calibMVAVersion (JobProperty): +# """Version of calo cluster corrections used for calibration. +# """ +# statusOn=True +# allowedTypes=['str', 'None'] +# StoredValue="egammaMVACalib/offline/v7_pre" + +# Defines a sub-container holding the jobProperties for egamma +class egammaDFFlags(JobPropertyContainer): + """ egamma information """ + +# add the egammaRec flags container to the top container +jobproperties.add_Container(egammaDFFlags) + +# I want always the following flags in the container +_list_Egamma=[Enabled,doEGammaCellReweighting,doEGammaCellReweightingVariations,doEGammaDAODTrackThinning] + +for j in _list_Egamma: + jobproperties.egammaDFFlags.add_JobProperty(j) +del _list_Egamma + + + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM1.py index c46ecf66adfc2dbd2ee929195fde0e0bf9b13e19..d1e4309ed85b4dd554c88177389c32231d4c9cb2 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM1.py @@ -1,5 +1,6 @@ #******************************************************************** # EGAM1.py +# Z->ee reduction for central electrons - for electron ID and calibration # reductionConf flag EGAM1 in Reco_tf.py # author: giovanni.marchiori@cern.ch #******************************************************************** @@ -10,34 +11,49 @@ from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM1ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") +# this could also go in egammaDFFlags RecomputeElectronSelectors = True #RecomputeElectronSelectors = False +#OutputLevel = DEBUG + +DoCellReweighting = jobproperties.egammaDFFlags.doEGammaCellReweighting +DoCellReweightingVariations = jobproperties.egammaDFFlags.doEGammaCellReweightingVariations +#override if needed (do at your own risk..) +#DoCellReweighting = False +#DoCellReweighting = True +#DoCellReweightingVariations = True + + +# check if we run on data or MC (DataSource = geant4) +from AthenaCommon.GlobalFlags import globalflags +print "EGAM1 globalflags.DataSource(): ", globalflags.DataSource() +if globalflags.DataSource()!='geant4': + DoCellReweighting = False + DoCellReweightingVariations = False + + #==================================================================== -# SET UP STREAM +# SET UP STREAM (to be done early in the game to set up thinning Svc #==================================================================== streamName = derivationFlags.WriteDAOD_EGAM1Stream.StreamName fileName = buildFileName( derivationFlags.WriteDAOD_EGAM1Stream ) EGAM1Stream = MSMgr.NewPoolRootStream( streamName, fileName ) -# Only events that pass the filters listed below are written out. -# Name must match that of the kernel above -# AcceptAlgs = logical OR of filters -# RequireAlgs = logical AND of filters -EGAM1Stream.AcceptAlgs(["EGAM1Kernel"]) -#Special lines for thinning -# Thinning service name must match the one passed to the thinning tools -augStream = MSMgr.GetStream( streamName ) -evtStream = augStream.GetEventStream() - +augmentationTools = [] #==================================================================== -# SKIMMING TOOLS +# SET UP SKIMMING #==================================================================== -# SELECTION FOR CALIBRATION +# 1. SELECTION FOR CALIBRATION #==================================================================== # Z->ee selection based on single e trigger: @@ -49,14 +65,12 @@ evtStream = augStream.GetEventStream() # tool? #==================================================================== -# switch to likelihood selectors only as soon as they're commissioned (and used in trigger) - if RecomputeElectronSelectors : - requirement_tag = '(Electrons.DFCommonElectronsIsEMTight || Electrons.DFCommonElectronsLHTight) && Electrons.pt > 24.5*GeV' - requirement_probe = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' + requirement_tag = '(Electrons.DFCommonElectronsLHTight) && (Electrons.pt > 24.5*GeV)' + requirement_probe = '(Electrons.DFCommonElectronsLHMedium) && (Electrons.pt > 19.5*GeV)' else : - requirement_tag = '(Electrons.Tight || Electrons.DFCommonElectronsLHTight) && Electrons.pt > 24.5*GeV' - requirement_probe = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' + requirement_tag = '(Electrons.LHTight) && (Electrons.pt > 24.5*GeV)' + requirement_probe = '(Electrons.LHMedium) && (Electrons.pt > 19.5*GeV)' from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGInvariantMassTool EGAM1_ZEEMassTool1 = DerivationFramework__EGInvariantMassTool( name = "EGAM1_ZEEMassTool1", @@ -71,6 +85,7 @@ EGAM1_ZEEMassTool1 = DerivationFramework__EGInvariantMassTool( name = "EGAM1_ZEE DoTransverseMass = False, MinDeltaR = 0.0) ToolSvc += EGAM1_ZEEMassTool1 +augmentationTools += [EGAM1_ZEEMassTool1] print EGAM1_ZEEMassTool1 #==================================================================== @@ -79,11 +94,10 @@ print EGAM1_ZEEMassTool1 # OS, mee>50 GeV #==================================================================== -# switch to likelihood selectors only as soon as they're commissioned (and used in trigger) if RecomputeElectronSelectors: - requirement = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' + requirement = '(Electrons.DFCommonElectronsLHMedium) && (Electrons.pt > 19.5*GeV)' else: - requirement = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' + requirement = '(Electrons.LHMedium) && (Electrons.pt > 19.5*GeV)' EGAM1_ZEEMassTool2 = DerivationFramework__EGInvariantMassTool( name = "EGAM1_ZEEMassTool2", Object1Requirements = requirement, Object2Requirements = requirement, @@ -96,26 +110,24 @@ EGAM1_ZEEMassTool2 = DerivationFramework__EGInvariantMassTool( name = "EGAM1_ZEE DoTransverseMass = False, MinDeltaR = 0.0) ToolSvc += EGAM1_ZEEMassTool2 +augmentationTools += [EGAM1_ZEEMassTool2] print EGAM1_ZEEMassTool2 -# SELECTION FOR T&P +# 2. SELECTION FOR T&P #==================================================================== -# Z->ee selection based on single e trigger, for reco (central) and ID SF(central+fwd) +# Z->ee selection based on single e trigger, for reco (central) and ID SF(central) # 1 tight e, central, pT>25 GeV -# 1 e, central, pT>15 GeV +# 1 e, central, pT>4 GeV # OS+SS, mee>50 GeV #==================================================================== -# switch to likelihood selectors only as soon as they're commissioned (and used in trigger) if RecomputeElectronSelectors : -# use medium for early data upon electron group request - requirement_tag = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.DFCommonElectronsLHMedium) && (Electrons.pt > 24.5*GeV)' else : - requirement_tag = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' -# central electrons: collection = Electrons, pt>14.5 GeV -requirement_probe = 'Electrons.pt > 6.5*GeV' + requirement_tag = '(Electrons.LHMedium) && (Electrons.pt > 24.5*GeV)' +requirement_probe = 'Electrons.pt > 4*GeV' EGAM1_ZEEMassTool3 = DerivationFramework__EGInvariantMassTool( name = "EGAM1_ZEEMassTool3", Object1Requirements = requirement_tag, Object2Requirements = requirement_probe, @@ -128,6 +140,7 @@ EGAM1_ZEEMassTool3 = DerivationFramework__EGInvariantMassTool( name = "EGAM1_ZEE DoTransverseMass = False, MinDeltaR = 0.0) ToolSvc += EGAM1_ZEEMassTool3 +augmentationTools += [EGAM1_ZEEMassTool3] print EGAM1_ZEEMassTool3 @@ -139,12 +152,11 @@ print EGAM1_ZEEMassTool3 # OS+SS, mee>50 GeV #==================================================================== -# switch to likelihood selectors only as soon as they're commissioned (and used in trigger) if RecomputeElectronSelectors: # use medium for early data upon electron group request - requirement_tag = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.DFCommonElectronsLHMedium) && (Electrons.pt > 24.5*GeV)' else: - requirement_tag = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.LHMedium) && (Electrons.pt > 24.5*GeV)' requirement_probe = 'DFCommonPhotons_et > 14.5*GeV' EGAM1_ZEGMassTool = DerivationFramework__EGInvariantMassTool( name = "EGAM1_ZEGMassTool", Object1Requirements = requirement_tag, @@ -161,27 +173,23 @@ EGAM1_ZEGMassTool = DerivationFramework__EGInvariantMassTool( name = "EGAM1_ZEGM DoTransverseMass = False, MinDeltaR = 0.0) ToolSvc += EGAM1_ZEGMassTool +augmentationTools += [EGAM1_ZEGMassTool] print EGAM1_ZEGMassTool + # Skimming criteria -#expression = '( ( count(Photons.pt > 10*GeV) > 0 ) || ( count(Electrons.pt > 10*GeV) > 0 ) )' expression = 'count(EGAM1_DiElectronMass > 50.0*GeV)>=1 || count(EGAM1_DiElectronMass2 > 50.0*GeV)>=1 || count(EGAM1_DiElectronMass3 > 50.0*GeV)>=1 || count (EGAM1_ElectronPhotonMass > 50.0*GeV)>=1' from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool EGAM1SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM1SkimmingTool", - expression = expression) + expression = expression) ToolSvc += EGAM1SkimmingTool -print "EGAM1 skimming tool:", EGAM1SkimmingTool +print "EGAM1 skimming tool: ", EGAM1SkimmingTool + #==================================================================== -# Gain and cluster energies per layer decoration tool +# SET UP AUGMENTATIONS #==================================================================== -from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getGainDecorations, getClusterEnergyPerLayerDecorator, getClusterEnergyPerLayerDecorations -EGAM1_GainDecoratorTool = GainDecorator() -ToolSvc += EGAM1_GainDecoratorTool - -cluster_sizes = (3,5), (5,7), (7,7), (7,11) -EGAM1_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, nphi)() for neta, nphi in cluster_sizes] #==================================================================== @@ -190,176 +198,456 @@ EGAM1_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__MaxCellDecorator EGAM1_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name = "EGAM1_MaxCellDecoratorTool", SGKey_electrons = "Electrons", - SGKey_photons = "Photons", - ) + SGKey_photons = "Photons" ) ToolSvc += EGAM1_MaxCellDecoratorTool +augmentationTools += [EGAM1_MaxCellDecoratorTool] + + +#==================================================================== +# Cell reweighter +#==================================================================== +if DoCellReweighting: + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import NewCellTool, ClusterDecoratorWithNewCells, EGammaReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM1_NewCellTool = NewCellTool("EGAM1_NewCellTool", + #OutputLevel = DEBUG, + CellContainerName = "AODCellContainer", + ReweightCellContainerName = "NewCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs10.root" ) + + print EGAM1_NewCellTool + ToolSvc += EGAM1_NewCellTool + augmentationTools += [EGAM1_NewCellTool] + + # second, run a tool that creates the clusters and objects from these new cells + EGAM1_ClusterDecoratorTool = ClusterDecoratorWithNewCells("EGAM1_ClusterDecoratorTool", + #OutputLevel=DEBUG, + OutputClusterSGKey = "EGammaSwClusterWithNewCells", + OutputClusterLink = "NewSwClusterLink", + SGKey_caloCells = "NewCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM1_ClusterDecoratorTool + ToolSvc += EGAM1_ClusterDecoratorTool + augmentationTools += [EGAM1_ClusterDecoratorTool] + + + # third, schedule a tool that will be invoked by the EGammaReweightTool to create on-the-fly the shower shapes with the new cells + from egammaTools.egammaToolsFactories import EMShowerBuilder + EGAM1_EMShowerBuilderTool = EMShowerBuilder("EGAM1_EMShowerBuilderTool", + CellsName="NewCellContainer" ) + + print EGAM1_EMShowerBuilderTool + ToolSvc += EGAM1_EMShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM1_EGammaReweightTool = EGammaReweightTool("EGAM1_EGammaReweightTool", + #OutputLevel=DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + NewCellContainerName = "NewCellContainer", + NewElectronContainer = "NewSwElectrons", + NewPhotonContainer = "NewSwPhotons", + EMShowerBuilderTool = EGAM1_EMShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithNewCells", + CaloClusterLinkName = "NewSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "RW_", + SaveReweightedContainer = True) + + print EGAM1_EGammaReweightTool + ToolSvc += EGAM1_EGammaReweightTool + augmentationTools += [EGAM1_EGammaReweightTool] + + if DoCellReweightingVariations: + + ########################################### REWEIGHTING VARIATIONS - MAX ###################################################### + + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import MaxVarCellTool, ClusterDecoratorWithMaxVarCells, EGammaMaxVarReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM1_MaxVarCellTool = MaxVarCellTool ("EGAM1_MaxVarCellTool", + #OutputLevel = DEBUG, + CellContainerName="AODCellContainer", + ReweightCellContainerName="MaxVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs11.root") + + print EGAM1_MaxVarCellTool + ToolSvc += EGAM1_MaxVarCellTool + + # second, run a tool that creates the clusters and objects from these new cells + EGAM1_MaxVarClusterDecoratorTool = ClusterDecoratorWithMaxVarCells("EGAM1_MaxVarClusterDecoratorTool", + OutputClusterSGKey="EGammaSwClusterWithMaxVarCells", + OutputClusterLink="MaxVarSwClusterLink", + SGKey_caloCells = "MaxVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM1_MaxVarClusterDecoratorTool + ToolSvc += EGAM1_MaxVarClusterDecoratorTool + + # third, schedule a tool that will be invoked by the EGammaReweightTool to create on-the-fly the shower shapes with the new cells + EGAM1_EMMaxVarShowerBuilderTool = EMShowerBuilder("EGAM1_EMMaxVarShowerBuilderTool", + CellsName="MaxVarCellContainer") + print EGAM1_EMMaxVarShowerBuilderTool + ToolSvc += EGAM1_EMMaxVarShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM1_EGammaMaxVarReweightTool = EGammaReweightTool("EGAM1_EGammaMaxVarReweightTool", + #OutputLevel = DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons="Photons", + NewCellContainerName="MaxVarCellContainer", + NewElectronContainer = "MaxVarSwElectrons", + NewPhotonContainer = "MaxVarSwPhotons", + EMShowerBuilderTool = EGAM1_EMMaxVarShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithMaxVarCells", + CaloClusterLinkName="MaxVarSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "Max_", + SaveReweightedContainer = True) + print EGAM1_EGammaMaxVarReweightTool + ToolSvc += EGAM1_EGammaMaxVarReweightTool + + + ########################################### REWEIGHTING VARIATIONS - MIN ###################################################### + + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import MinVarCellTool, ClusterDecoratorWithMinVarCells, EGammaMinVarReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM1_MinVarCellTool = MinVarCellTool ("EGAM1_MinVarCellTol", + #OutputLevel = DEBUG, + CellContainerName="AODCellContainer", + ReweightCellContainerName="MinVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs00.root") + + + print EGAM1_MinVarCellTool + ToolSvc += EGAM1_MinVarCellTool + + # second, run a tool that creates the clusters and objects from these new cells + EGAM1_MinVarClusterDecoratorTool = ClusterDecoratorWithMinVarCells("EGAM1_MinVarClusterDecoratorTool", + OutputClusterSGKey="EGammaSwClusterWithMinVarCells", + OutputClusterLink="MinVarSwClusterLink", + SGKey_caloCells = "MinVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM1_MinVarClusterDecoratorTool + ToolSvc += EGAM1_MinVarClusterDecoratorTool + + # third, schedule a tool that will be invoked by the EGammaReweightTool to create on-the-fly the shower shapes with the new cells + EGAM1_EMMinVarShowerBuilderTool = EMShowerBuilder("EGAM1_EMMinVarShowerBuilderTool", + CellsName="MinVarCellContainer") + print EGAM1_EMMinVarShowerBuilderTool + ToolSvc += EGAM1_EMMinVarShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM1_EGammaMinVarReweightTool = EGammaReweightTool("EGAM1_EGammaMinVarReweightTool", + #OutputLevel = DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons="Photons", + NewCellContainerName="MinVarCellContainer", + NewElectronContainer = "MinVarSwElectrons", + NewPhotonContainer = "MinVarSwPhotons", + EMShowerBuilderTool = EGAM1_EMMinVarShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithMinVarCells", + CaloClusterLinkName="MinVarSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "Min_", + SaveReweightedContainer = True) + + print EGAM1_EGammaMinVarReweightTool + ToolSvc += EGAM1_EGammaMinVarReweightTool + + augmentationTools += [EGAM1_MaxVarCellTool, EGAM1_MaxVarClusterDecoratorTool, EGAM1_EGammaMaxVarReweightTool, EGAM1_MinVarCellTool, EGAM1_MinVarClusterDecoratorTool, EGAM1_EGammaMinVarReweightTool] + + +#==================================================================== +# Gain and cluster energies per layer decoration tool +#==================================================================== +# GM: do we really need new, different tools: getClusterEnergyPerLayerDecoratorNew, getClusterEnergyPerLayerDecoratorMaxVar, getClusterEnergyPerLayerDecoratorMinVar? +from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getGainDecorations, getClusterEnergyPerLayerDecorator, getClusterEnergyPerLayerDecorations, getClusterEnergyPerLayerDecoratorNew, getClusterEnergyPerLayerDecoratorMaxVar, getClusterEnergyPerLayerDecoratorMinVar +EGAM1_GainDecoratorTool = GainDecorator() +ToolSvc += EGAM1_GainDecoratorTool +augmentationTools += [EGAM1_GainDecoratorTool] + +cluster_sizes = (3,7), (5,5), (7,11) +EGAM1_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, nphi)() for neta, nphi in cluster_sizes] +if DoCellReweighting: + EGAM1_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorNew(neta, nphi)() for neta, nphi in cluster_sizes] + if DoCellReweightingVariations: + EGAM1_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorMaxVar(neta, nphi)() for neta, nphi in cluster_sizes] + EGAM1_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorMinVar(neta, nphi)() for neta, nphi in cluster_sizes] +augmentationTools += EGAM1_ClusterEnergyPerLayerDecorators + + +#==================================================================== +# SET UP THINNING +#==================================================================== + +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM1ThinningHelper = ThinningHelper( "EGAM1ThinningHelper" ) +EGAM1ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(mu|j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_[eg].*))|HLT_e.*_Zee.*' +EGAM1ThinningHelper.AppendToStream( EGAM1Stream, ExtraContainersTrigger ) -#================ -# THINNING -#================ thinningTools=[] -# Tracks associated with Jets -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning -EGAM1JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM1JetLCTPThinningTool", - StreamName = streamName, - JetKey = "AntiKt4EMTopoJets", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += EGAM1JetLCTPThinningTool -print EGAM1JetLCTPThinningTool -#thinningTools.append(EGAM1JetLCTPThinningTool) - -# Tracks associated with Muons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning -EGAM1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM1MuonTPThinningTool", - StreamName = streamName, - MuonKey = "Muons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM1MuonTPThinningTool -print EGAM1MuonTPThinningTool -#thinningTools.append(EGAM1MuonTPThinningTool) - -# Tracks associated with Electrons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning -EGAM1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM1ElectronTPThinningTool", - Streamname = streamName, - SGKey = "Electrons", +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = True + TrackThinningKeepPhotonTracks = True + TrackThinningKeepAllElectronTracks = True + TrackThinningKeepJetTracks = False + TrackThinningKeepMuonTracks = False + TrackThinningKeepTauTracks = False + TrackThinningKeepPVTracks = True + + # Tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM1ElectronTPThinningTool", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM1ElectronTPThinningTool + print EGAM1ElectronTPThinningTool + thinningTools.append(EGAM1ElectronTPThinningTool) + + # Tracks associated with Electrons (all tracks, large cone, for track isolation studies of the selected electrons) + if (TrackThinningKeepAllElectronTracks) : + EGAM1ElectronTPThinningTool2 = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM1ElectronTPThinningTool2", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 4*GeV", + BestMatchOnly = False, + ConeSize = 0.6, + ApplyAnd = False) + + ToolSvc += EGAM1ElectronTPThinningTool2 + print EGAM1ElectronTPThinningTool2 + thinningTools.append(EGAM1ElectronTPThinningTool2) + + # Tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM1PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM1PhotonTPThinningTool", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM1PhotonTPThinningTool + print EGAM1PhotonTPThinningTool + thinningTools.append(EGAM1PhotonTPThinningTool) + + # Tracks associated with Jets + if (TrackThinningKeepJetTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + EGAM1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM1JetTPThinningTool", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM1JetTPThinningTool + print EGAM1JetTPThinningTool + thinningTools.append(EGAM1JetTPThinningTool) + + + # Tracks associated with Muons + if (TrackThinningKeepMuonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + EGAM1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM1MuonTPThinningTool", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM1MuonTPThinningTool + print EGAM1MuonTPThinningTool + thinningTools.append(EGAM1MuonTPThinningTool) + + + # Tracks associated with Taus + if (TrackThinningKeepTauTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + EGAM1TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM1TauTPThinningTool", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM1ElectronTPThinningTool -print EGAM1ElectronTPThinningTool -#thinningTools.append(EGAM1ElectronTPThinningTool) - -# Tracks associated with Photons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning -EGAM1PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM1PhotonTPThinningTool", - StreamName = streamName, - SGKey = "Photons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM1PhotonTPThinningTool -print EGAM1PhotonTPThinningTool -#thinningTools.append(EGAM1PhotonTPThinningTool) - -# Tracks associated with Taus -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning -EGAM1TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM1TauTPThinningTool", - StreamName = streamName, - TauKey = "TauJets", - ConeSize = 0.6, - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM1TauTPThinningTool -print EGAM1TauTPThinningTool -#thinningTools.append(EGAM1TauTPThinningTool) - -# Tracks from primary vertex -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -EGAM1TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM1TPThinningTool", - StreamName = streamName, - SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM1TPThinningTool -print EGAM1TPThinningTool -#thinningTools.append(EGAM1TPThinningTool) + ToolSvc += EGAM1TauTPThinningTool + print EGAM1TauTPThinningTool + thinningTools.append(EGAM1TauTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM1TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM1TPThinningTool", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + SelectionString = "InDetTrackParticles.DFCommonTightPrimary && abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0*mm", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM1TPThinningTool + print EGAM1TPThinningTool + thinningTools.append(EGAM1TPThinningTool) +# keep topoclusters around electrons +from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning +EGAM1CCTCThinningTool = DerivationFramework__CaloClusterThinning(name = "EGAM1CCTCThinningTool", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + SelectionString = "Electrons.pt>4*GeV", + TopoClCollectionSGKey = "CaloCalTopoClusters", + ConeSize = 0.5) +ToolSvc += EGAM1CCTCThinningTool +print EGAM1CCTCThinningTool +thinningTools.append(EGAM1CCTCThinningTool) -# Truth thinning -truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs -truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons -truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark -truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon -truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles -truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' - -from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning -EGAM1TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM1TruthThinningTool", - StreamName = streamName, - ParticleSelectionString = truth_expression, - PreserveDescendants = False, - PreserveGeneratorDescendants = True, - PreserveAncestors = True) -from AthenaCommon.GlobalFlags import globalflags -print "EGAM1 globalflags.DataSource(): ", globalflags.DataSource() +# Truth thinning if globalflags.DataSource()=='geant4': + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark + truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles + truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + EGAM1TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM1TruthThinningTool", + ThinningService = EGAM1ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + ToolSvc += EGAM1TruthThinningTool thinningTools.append(EGAM1TruthThinningTool) + print "EGAM1 thinningTools: ", thinningTools + #======================================= -# CREATE THE DERIVATION KERNEL ALGORITHM +# CREATE PRIVATE SEQUENCE #======================================= +egam1Seq = CfgMgr.AthSequencer("EGAM1Sequence") +DerivationFrameworkJob += egam1Seq +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM1Kernel", - AugmentationTools = [EGAM1_ZEEMassTool1, EGAM1_ZEEMassTool2, EGAM1_ZEEMassTool3, EGAM1_ZEGMassTool, EGAM1_GainDecoratorTool, EGAM1_MaxCellDecoratorTool] + EGAM1_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM1SkimmingTool], - ThinningTools = thinningTools - ) + +print "EGAM1 skimming tools", [EGAM1SkimmingTool] +print "EGAM1 thinning tools", thinningTools +print "EGAM1 augmentation tools", augmentationTools +egam1Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM1Kernel", + AugmentationTools = augmentationTools, + SkimmingTools = [EGAM1SkimmingTool], + ThinningTools = thinningTools + ) + +#==================================================================== +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 +#==================================================================== +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +#reducedJetList = ["AntiKt4PV0TrackJets", "AntiKt4TruthJets"] +reducedJetList = ["AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam1Seq,"EGAM1") + #======================================= # ADD NON-PROMPT LEPTON VETO ALGORITHMS #======================================= -import JetTagNonPromptLepton.JetTagNonPromptLeptonConfig as Config -#DerivationFrameworkJob += Config.DecoratePromptLepton("Electrons", "AntiKt4PV0TrackJets") -#DerivationFrameworkJob += Config.DecoratePromptLepton("Muons", "AntiKt4PV0TrackJets") -DerivationFrameworkJob += Config.GetDecoratePromptLeptonAlgs() +import JetTagNonPromptLepton.JetTagNonPromptLeptonConfig as JetTagConfig +JetTagConfig.ConfigureAntiKt4PV0TrackJets(egam1Seq, "EGAM1") +egam1Seq += JetTagConfig.GetDecoratePromptLeptonAlgs(name="Electrons") + + +#==================================================================== +# SET UP STREAM SELECTION +#==================================================================== +# Only events that pass the filters listed below are written out. +# Name must match that of the kernel above +# AcceptAlgs = logical OR of filters +# RequireAlgs = logical AND of filters +EGAM1Stream.AcceptAlgs(["EGAM1Kernel"]) -#======================================================================== #==================================================================== -# CONTENT LIST +# SET UP SLIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper EGAM1SlimmingHelper = SlimmingHelper("EGAM1SlimmingHelper") - -from DerivationFrameworkEGamma.EGAM1ExtraContent import * -EGAM1SlimmingHelper.SmartCollections = [ - "Electrons", +EGAM1SlimmingHelper.SmartCollections = ["Electrons", "Photons", - "Muons", + "Muons", "TauJets", "MET_Reference_AntiKt4EMTopo", "AntiKt4EMTopoJets", - "BTagging_AntiKt4EMTopo", + "AntiKt4EMTopoJets_BTagging201810", + "BTagging_AntiKt4EMTopo_201810", "InDetTrackParticles", - "PrimaryVertices" - ] + "PrimaryVertices" ] # Add egamma trigger objects EGAM1SlimmingHelper.IncludeEGammaTriggerContent = True +# Append cell-reweighted collections to dictionary +if DoCellReweighting: + EGAM1SlimmingHelper.AppendToDictionary = {"NewSwElectrons": "xAOD::ElectronContainer", "NewSwElectronsAux": "xAOD::ElectronAuxContainer"} + if DoCellReweightingVariations: + EGAM1SlimmingHelper.AppendToDictionary.update({ "MaxVarSwElectrons": "xAOD::ElectronContainer", "MaxVarSwElectronsAux": "xAOD::ElectronAuxContainer", "MinVarSwElectrons": "xAOD::ElectronContainer", "MinVarSwElectronsAux": "xAOD::ElectronAuxContainer" }) + # Extra variables EGAM1SlimmingHelper.ExtraVariables = ExtraContentAll # the next line is not needed because we save all variables for electrons, including the prompt lepton decorations -# EGAM1SlimmingHelper.ExtraVariables += Config.GetExtraPromptVariablesForDxAOD() +# EGAM1SlimmingHelper.ExtraVariables += JetTagConfig.GetExtraPromptVariablesForDxAOD() EGAM1SlimmingHelper.AllVariables = ExtraContainersElectrons EGAM1SlimmingHelper.AllVariables += ExtraContainersTrigger -if globalflags.DataSource()!='geant4': - EGAM1SlimmingHelper.AllVariables += ExtraContainersTriggerDataOnly - if globalflags.DataSource()=='geant4': EGAM1SlimmingHelper.ExtraVariables += ExtraContentAllTruth EGAM1SlimmingHelper.AllVariables += ExtraContainersTruth +else: + EGAM1SlimmingHelper.ExtraVariables += ExtraContainersTriggerDataOnly for tool in EGAM1_ClusterEnergyPerLayerDecorators: EGAM1SlimmingHelper.ExtraVariables.extend( getClusterEnergyPerLayerDecorations( tool ) ) +# Add energy density variables EGAM1SlimmingHelper.ExtraVariables += ExtraVariablesEventShape +# Add detailed shower shape variables (not needed for electrons because we save everything but it doesn't hurt..) +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * +EGAM1SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent +EGAM1SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent +from DerivationFrameworkEGamma.PhotonsCPDetailedContent import * +EGAM1SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent + # This line must come after we have finished configuring EGAM1SlimmingHelper EGAM1SlimmingHelper.AppendContentToStream(EGAM1Stream) -# Add MET_RefFinalFix -# JRC: COMMENTED TEMPORARILY -#addMETOutputs(EGAM1Stream) +#Add full CellContainer +EGAM1Stream.AddItem("CaloCellContainer#AODCellContainer") +EGAM1Stream.AddItem("CaloClusterCellLinkContainer#egammaClusters_links") + -# Add Derived Egamma CellContainer -from DerivationFrameworkEGamma.EGammaCellCommon import CellCommonThinning -CellCommonThinning(EGAM1Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM2.py index caee0a9eb6d53ac228261888cb8d5ab9e8fafe5b..4681c663d174f86fc1b0cbd6bbf1a4637a0160f9 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM2.py @@ -11,30 +11,45 @@ from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM2ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") +# this could also go in egammaDFFlags RecomputeElectronSelectors = True #RecomputeElectronSelectors = False +# check if we run on data or MC +from AthenaCommon.GlobalFlags import globalflags +print "EGAM2 globalflags.DataSource(): ", globalflags.DataSource() + + + #==================================================================== -# SKIMMING TOOLS +# SET UP STREAM (to be done early in the game to set up thinning Svc +#==================================================================== +streamName = derivationFlags.WriteDAOD_EGAM2Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_EGAM2Stream ) +EGAM2Stream = MSMgr.NewPoolRootStream( streamName, fileName ) + + +#==================================================================== +# SET UP SKIMMING #==================================================================== # SELECTION FOR CALIBRATION #==================================================================== # J/psi->ee selection for e/gamma calibration -# 2 tight or medium e (depends on Run2 triggers..), pT>4.5 GeV, author=1 or 3, OS, 1<Mee<5 GeV +# 2 tight or medium e (depends on Run2 triggers..), pT>4.5 GeV, OS, 1<Mee<5 GeV #==================================================================== -# author requirement not needed in Run2: forward electrons are in separate collection -# and no tracking-based (soft-e) electron reconstruction is run -# electronAuthorRequirement = '(Electrons.author==1 || Electrons.author==3)' electronPtRequirement = '(Electrons.pt > 4.5*GeV)' if RecomputeElectronSelectors : - electronQualityRequirement = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium)' + electronQualityRequirement = '(Electrons.DFCommonElectronsLHMedium)' else : - electronQualityRequirement = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium)' -#electronQualityRequirement='(Electrons.Tight || DFCommonElectronsLHTight)' -#requirement_el = '(' + electronQualityRequirement + '&&' + electronPtRequirement + '&&' + electronAuthorRequirement + ')' + electronQualityRequirement = '(Electrons.LHMedium)' requirement_el = '(' + electronQualityRequirement + '&&' + electronPtRequirement + ')' @@ -64,9 +79,9 @@ print EGAM2_JPSIEEMassTool # dR>0.15 #==================================================================== if RecomputeElectronSelectors : - requirement_el_tag = '(Electrons.DFCommonElectronsIsEMTight || Electrons.DFCommonElectronsLHTight) && Electrons.pt > 4.5*GeV' + requirement_el_tag = '(Electrons.DFCommonElectronsLHTight) && (Electrons.pt > 4.5*GeV)' else : - requirement_el_tag = '(Electrons.Tight || Electrons.DFCommonElectronsLHTight) && Electrons.pt > 4.5*GeV' + requirement_el_tag = '(Electrons.LHTight) && (Electrons.pt > 4.5*GeV)' requirement_el_probe = 'Electrons.pt > 4.5*GeV' EGAM2_JPSIEEMassTool2 = DerivationFramework__EGInvariantMassTool( name = "EGAM2_JPSIEEMassTool2", @@ -112,6 +127,15 @@ triggers+=['HLT_e14_etcut_e5_lhtight_nod0_Jpsiee'] triggers+=['HLT_e14_lhtight_e4_etcut_Jpsiee'] triggers+=['HLT_e14_lhtight_nod0_e4_etcut_Jpsiee'] +triggers+=['HLT_e5_lhtight_nod0_e4_etcut_Jpsiee_L1RD0_FILLED'] +triggers+=['HLT_e5_lhtight_nod0_e9_etcut_Jpsiee'] +triggers+=['HLT_e5_lhtight_nod0_e14_etcut_Jpsiee'] +triggers+=['HLT_e5_lhtight_nod0_e9_etcut_Jpsiee_L1JPSI-1M5-EM7'] +triggers+=['HLT_e9_lhtight_nod0_e4_etcut_Jpsiee_L1JPSI-1M5-EM7'] +triggers+=['HLT_e5_lhtight_nod0_e14_etcut_Jpsiee_L1JPSI-1M5-EM12'] +triggers+=['HLT_e14_lhtight_nod0_e4_etcut_Jpsiee_L1JPSI-1M5-EM12'] + + from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool EGAM2_TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( name = "EGAM2_TriggerSkimmingTool", TriggerListOR = triggers) @@ -120,12 +144,17 @@ ToolSvc += EGAM2_TriggerSkimmingTool print "EGAM2 trigger skimming tool:", EGAM2_TriggerSkimmingTool +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__FilterCombinationOR +EGAM2_SkimmingTool = DerivationFramework__FilterCombinationOR(name="EGAM2SkimmingTool", FilterList=[EGAM2_OfflineSkimmingTool,EGAM2_TriggerSkimmingTool] ) +ToolSvc+=EGAM2_SkimmingTool +print "EGAM2 skimming tool:", EGAM2_SkimmingTool + + + +#==================================================================== +# SET UP AUGMENTATIONS +#==================================================================== -#================ -# THINNING -#================ -thinningTools=[] -# TO BE ADDED #==================================================================== # Gain and cluster energies per layer decoration tool @@ -138,27 +167,140 @@ cluster_sizes = (3,5), (5,7), (7,7), (7,11) EGAM2_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, nphi)() for neta, nphi in cluster_sizes] +#==================================================================== +# SET UP THINNING +#==================================================================== + +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM2ThinningHelper = ThinningHelper( "EGAM2ThinningHelper" ) +EGAM2ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(mu|j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_[eg].*))|HLT_e.*_Jpsiee.*' + +EGAM2ThinningHelper.AppendToStream( EGAM2Stream, ExtraContainersTrigger ) + + +thinningTools=[] + +# Track thinning +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = True + TrackThinningKeepPhotonTracks = True + TrackThinningKeepJetTracks = False + TrackThinningKeepMuonTracks = False + TrackThinningKeepTauTracks = False + TrackThinningKeepPVTracks = False + + # Tracks associated with Jets + if (TrackThinningKeepJetTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + EGAM2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM2JetTPThinningTool", + ThinningService = EGAM2ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += EGAM2JetTPThinningTool + print EGAM2JetTPThinningTool + thinningTools.append(EGAM2JetTPThinningTool) + + # Tracks associated with Muons + if (TrackThinningKeepMuonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + EGAM2MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM2MuonTPThinningTool", + ThinningService = EGAM2ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM2MuonTPThinningTool + print EGAM2MuonTPThinningTool + thinningTools.append(EGAM2MuonTPThinningTool) + + # Tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM2ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM2ElectronTPThinningTool", + ThinningService = EGAM2ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM2ElectronTPThinningTool + print EGAM2ElectronTPThinningTool + thinningTools.append(EGAM2ElectronTPThinningTool) + + # Tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM2PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM2PhotonTPThinningTool", + ThinningService = EGAM2ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + + ToolSvc += EGAM2PhotonTPThinningTool + print EGAM2PhotonTPThinningTool + thinningTools.append(EGAM2PhotonTPThinningTool) + + # Tracks associated with Taus + if (TrackThinningKeepTauTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + EGAM2TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM2TauTPThinningTool", + ThinningService = EGAM2ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM2TauTPThinningTool + print EGAM2TauTPThinningTool + thinningTools.append(EGAM2TauTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM2TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM2TPThinningTool", + ThinningService = EGAM2ThinningHelper.ThinningSvc(), + SelectionString = "InDetTrackParticles.DFCommonTightPrimary && abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0*mm", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM2TPThinningTool + print EGAM2TPThinningTool + thinningTools.append(EGAM2TPThinningTool) + +print "EGAM2 thinningTools: ", thinningTools + + #======================================= -# CREATE THE DERIVATION KERNEL ALGORITHM +# CREATE PRIVATE SEQUENCE #======================================= -from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__FilterCombinationOR -EGAM2_SkimmingTool = DerivationFramework__FilterCombinationOR(name="EGAM2SkimmingTool", FilterList=[EGAM2_OfflineSkimmingTool,EGAM2_TriggerSkimmingTool] ) -ToolSvc+=EGAM2_SkimmingTool +egam2Seq = CfgMgr.AthSequencer("EGAM2Sequence") +DerivationFrameworkJob += egam2Seq +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM2Kernel", - AugmentationTools = [EGAM2_JPSIEEMassTool,EGAM2_JPSIEEMassTool2,EGAM2_GainDecoratorTool] + EGAM2_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM2_SkimmingTool] - ) +egam2Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM2Kernel", + AugmentationTools = [EGAM2_JPSIEEMassTool,EGAM2_JPSIEEMassTool2,EGAM2_GainDecoratorTool] + EGAM2_ClusterEnergyPerLayerDecorators, + SkimmingTools = [EGAM2_SkimmingTool], + ThinningTools = thinningTools + ) #==================================================================== -# SET UP STREAM +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 +#==================================================================== +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +reducedJetList = ["AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam2Seq,"EGAM2") + + +#==================================================================== +# SET UP STREAM SELECTION #==================================================================== -streamName = derivationFlags.WriteDAOD_EGAM2Stream.StreamName -fileName = buildFileName( derivationFlags.WriteDAOD_EGAM2Stream ) -EGAM2Stream = MSMgr.NewPoolRootStream( streamName, fileName ) # Only events that pass the filters listed below are written out. # Name must match that of the kernel above # AcceptAlgs = logical OR of filters @@ -166,13 +308,13 @@ EGAM2Stream = MSMgr.NewPoolRootStream( streamName, fileName ) EGAM2Stream.AcceptAlgs(["EGAM2Kernel"]) + #==================================================================== -# CONTENT LIST +# SET UP SLIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper EGAM2SlimmingHelper = SlimmingHelper("EGAM2SlimmingHelper") -from DerivationFrameworkEGamma.EGAM2ExtraContent import * EGAM2SlimmingHelper.SmartCollections = [ "Electrons", "Photons", @@ -180,7 +322,8 @@ EGAM2SlimmingHelper.SmartCollections = [ "TauJets", "MET_Reference_AntiKt4EMTopo", "AntiKt4EMTopoJets", - "BTagging_AntiKt4EMTopo", + "AntiKt4EMTopoJets_BTagging201810", + "BTagging_AntiKt4EMTopo_201810", "InDetTrackParticles", "PrimaryVertices" ] # muons, tau, MET, b-tagging could be switched off if not needed and use too much space @@ -192,19 +335,22 @@ EGAM2SlimmingHelper.IncludeEGammaTriggerContent = True EGAM2SlimmingHelper.ExtraVariables = ExtraContentAll EGAM2SlimmingHelper.AllVariables = ExtraContainersElectrons EGAM2SlimmingHelper.AllVariables += ExtraContainersTrigger -# if globalflags.DataSource()!='geant4': -# EGAM2SlimmingHelper.AllVariables += ExtraContainersTriggerDataOnly if globalflags.DataSource()=='geant4': EGAM2SlimmingHelper.ExtraVariables += ExtraContentAllTruth EGAM2SlimmingHelper.AllVariables += ExtraContainersTruth +else: + EGAM2SlimmingHelper.ExtraVariables += ExtraContainersTriggerDataOnly for tool in EGAM2_ClusterEnergyPerLayerDecorators: EGAM2SlimmingHelper.ExtraVariables.extend( getClusterEnergyPerLayerDecorations( tool ) ) +# Add detailed shower shape variables +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * +EGAM2SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent +EGAM2SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent +from DerivationFrameworkEGamma.PhotonsCPDetailedContent import * +EGAM2SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent + # This line must come after we have finished configuring EGAM2SlimmingHelper EGAM2SlimmingHelper.AppendContentToStream(EGAM2Stream) - -# Add MET_RefFinalFix -# JRC: COMMENTED TEMPORARILY -#addMETOutputs(EGAM2Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM3.py index 16cc4efab6cb6c7b839c42fff1435954b63b2825..d1e2dfa42c7c2947908e9bd7d7d40860538ef80a 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM3.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM3.py @@ -1,3 +1,4 @@ + #******************************************************************** # EGAM3.py # Z->eegamma reduction for low-pT electron and photon studies @@ -5,40 +6,66 @@ # author: giovanni.marchiori@cern.ch #******************************************************************** -# notes: - from DerivationFrameworkCore.DerivationFrameworkMaster import * from DerivationFrameworkInDet.InDetCommon import * from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM3ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") + +# this could also go in egammaDFFlags +RecomputeEGammaSelectors = True +#RecomputeEGammaSelectors = False + +DoCellReweighting = jobproperties.egammaDFFlags.doEGammaCellReweighting +DoCellReweightingVariations = jobproperties.egammaDFFlags.doEGammaCellReweightingVariations +#override if needed (do at your own risk..) +#DoCellReweighting = False +#DoCellReweighting = True + +# check if we run on data or MC (DataSource = geant4) +from AthenaCommon.GlobalFlags import globalflags +print "EGAM3 globalflags.DataSource(): ", globalflags.DataSource() +if globalflags.DataSource()!='geant4': + DoCellReweighting = False + DoCellReweightingVariations = False -RecomputeElectronSelectors = True -#RecomputeElectronSelectors = False #==================================================================== -# SKIMMING TOOLS +# SET UP STREAM (to be done early in the game to set up thinning Svc +#==================================================================== +streamName = derivationFlags.WriteDAOD_EGAM3Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_EGAM3Stream ) +EGAM3Stream = MSMgr.NewPoolRootStream( streamName, fileName ) + + +#==================================================================== +# SET UP SKIMMING #==================================================================== #==================================================================== -# eegamma selection for photon studies, di-electron triggers +# eegamma and eee selection for photon efficiency studies, di-electron triggers # two opposite-sign medium el, pT>10 GeV, |eta|<2.5, mee>40 GeV -# gamma: reco, ET>10 GeV< |eta|<2.5 +# eegamma: one reco photon, ET>10 GeV< |eta|<2.5 +# eee: 3 electrons, pT>10 GeV, mee>40 GeV #==================================================================== # if skim size too large either require tight electrons (at least one) or raise electron pT threshold (at least one) -#requirement = 'DFCommonElectronsLHMedium && (DFCommonElectrons_pt > 9.5*GeV)' -if RecomputeElectronSelectors : - requirement = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium) && (Electrons.pt > 9.5*GeV)' +if RecomputeEGammaSelectors : + requirementElectrons = '(Electrons.DFCommonElectronsLHMedium) && (Electrons.pt > 9.5*GeV)' else : - requirement = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium) && (Electrons.pt > 9.5*GeV)' + requirementElectrons = '(Electrons.LHMedium) && (Electrons.pt > 9.5*GeV)' from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGInvariantMassTool EGAM3_EEMassTool = DerivationFramework__EGInvariantMassTool( name = "EGAM3_EEMassTool", - Object1Requirements = requirement, - Object2Requirements = requirement, + Object1Requirements = requirementElectrons, + Object2Requirements = requirementElectrons, StoreGateEntryName = "EGAM3_DiElectronMass", Mass1Hypothesis = 0.511*MeV, Mass2Hypothesis = 0.511*MeV, @@ -49,25 +76,30 @@ EGAM3_EEMassTool = DerivationFramework__EGInvariantMassTool( name = "EGAM3_EEMas MinDeltaR = 0.0) ToolSvc += EGAM3_EEMassTool print EGAM3_EEMassTool - +skimmingExpression1a = '(count(DFCommonPhotons_et>9.5*GeV)>=1 && count(EGAM3_DiElectronMass > 40.0*GeV)>=1)' +skimmingExpression1b = '(count(Electrons.pt>9.5*GeV)>=3 && count(EGAM3_DiElectronMass > 40.0*GeV)>=1)' #==================================================================== # eegamma selection for low-pT electron studies with T&P # tag e: tight, |eta|<2.5, pT>25 GeV -# probe e: reco, ET>7 GeV, no eta cut +# probe e: reco, ET>7 GeV, central electron # gamma: tight, ET>10 GeV #==================================================================== # asymmetric electron cuts/single e trigger, low pT cut for subleading e (for e calibration studies at low pT) -#requirement1 = 'DFCommonElectronsLHTight && (DFCommonElectrons_pt > 24.5*GeV)' -if RecomputeElectronSelectors : - requirement1 = '(Electrons.DFCommonElectronsIsEMTight || Electrons.DFCommonElectronsLHTight) && (Electrons.pt > 24.5*GeV)' +if RecomputeEGammaSelectors : + requirementElectron1 = '(Electrons.DFCommonElectronsLHTight) && (Electrons.pt > 24.5*GeV)' +else : + requirementElectron1 = '(Electrons.LHTight) && (Electrons.pt > 24.5*GeV)' +requirementElectron2 = '(Electrons.pt > 6.5*GeV)' +if RecomputeEGammaSelectors : + requirementPhoton = 'Photons.DFCommonPhotonsIsEMTight' else : - requirement1 = '(Electrons.Tight || Electrons.DFCommonElectronsLHTight) && (Electrons.pt > 24.5*GeV)' -requirement2 = '(Electrons.pt > 6.5*GeV)' + requirementPhoton = 'Photons.Tight' + EGAM3_EEMassTool2 = DerivationFramework__EGInvariantMassTool( name = "EGAM3_EEMassTool2", - Object1Requirements = requirement1, - Object2Requirements = requirement2, + Object1Requirements = requirementElectron1, + Object2Requirements = requirementElectron2, StoreGateEntryName = "EGAM3_DiElectronMass2", Mass1Hypothesis = 0.511*MeV, Mass2Hypothesis = 0.511*MeV, @@ -80,17 +112,25 @@ EGAM3_EEMassTool2 = DerivationFramework__EGInvariantMassTool( name = "EGAM3_EEMa ToolSvc += EGAM3_EEMassTool2 print EGAM3_EEMassTool2 +skimmingExpression2 = '(count(DFCommonPhotons_et>9.5*GeV && '+ requirementPhoton + ')>=1 && count(EGAM3_DiElectronMass2 > 40.0*GeV)>=1)' + -if RecomputeElectronSelectors : - requirement1 = '(Electrons.DFCommonElectronsIsEMTight || Electrons.DFCommonElectronsLHTight) && (Electrons.pt > 24.5*GeV)' +#==================================================================== +# eegamma selection for low-pT electron studies with T&P +# tag e: tight, |eta|<2.5, pT>25 GeV +# probe e: reco, ET>7 GeV, forward electron +# gamma: tight, ET>10 GeV +#==================================================================== + +if RecomputeEGammaSelectors : + requirementElectron1 = '(Electrons.DFCommonElectronsLHTight) && (Electrons.pt > 24.5*GeV)' else : - requirement1 = '(Electrons.Tight || Electrons.DFCommonElectronsLHTight) && (Electrons.pt > 24.5*GeV)' -requirement2 = '(ForwardElectrons.pt > 6.5*GeV)' -#requirement2 = '(ForwardElectrons.pt > 9.5*GeV)' + requirementElectron1 = '(Electrons.LHTight) && (Electrons.pt > 24.5*GeV)' +requirementElectron2 = '(ForwardElectrons.pt > 6.5*GeV)' EGAM3_EEMassTool3 = DerivationFramework__EGInvariantMassTool( name = "EGAM3_EEMassTool3", - Object1Requirements = requirement1, - Object2Requirements = requirement2, + Object1Requirements = requirementElectron1, + Object2Requirements = requirementElectron2, StoreGateEntryName = "EGAM3_DiElectronMass3", Mass1Hypothesis = 0.511*MeV, Mass2Hypothesis = 0.511*MeV, @@ -102,73 +142,385 @@ EGAM3_EEMassTool3 = DerivationFramework__EGInvariantMassTool( name = "EGAM3_EEMa MinDeltaR = 0.0) ToolSvc += EGAM3_EEMassTool3 print EGAM3_EEMassTool3 - +skimmingExpression3 = '(count(DFCommonPhotons_et>9.5*GeV && '+ requirementPhoton + ')>=1 && count(EGAM3_DiElectronMass3 > 40.0*GeV)>=1)' #==================================================================== # SKIMMING TOOL #==================================================================== -if RecomputeElectronSelectors : - photon_quality = 'Photons.DFCommonPhotonsIsEMTight' -else : - photon_quality = 'Photons.Tight' +skimmingExpression = skimmingExpression1a + ' || ' + skimmingExpression1b + ' || ' + skimmingExpression2 + ' || ' + skimmingExpression3 +print "EGAM3 skimming expression: ", skimmingExpression + -expression = '(count(DFCommonPhotons_et>9.5*GeV)>=1 && count(EGAM3_DiElectronMass > 40.0*GeV)>=1) || (count(DFCommonPhotons_et>9.5*GeV && '+ photon_quality + ')>=1 && (count(EGAM3_DiElectronMass2 > 40.0*GeV)>=1 || count(EGAM3_DiElectronMass3 > 40.0*GeV)>=1))' from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool -EGAM3SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM3SkimmingTool", - expression = expression) -ToolSvc += EGAM3SkimmingTool -print "EGAM3 skimming tool:", EGAM3SkimmingTool +EGAM3_SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM3_SkimmingTool", + expression = skimmingExpression) +ToolSvc += EGAM3_SkimmingTool +print "EGAM3 skimming tool: ", EGAM3_SkimmingTool + + + +#==================================================================== +# SET UP AUGMENTATIONS +#==================================================================== + #==================================================================== # Gain and cluster energies per layer decoration tool #==================================================================== -from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getGainDecorations, getClusterEnergyPerLayerDecorator, getClusterEnergyPerLayerDecorations +from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getGainDecorations, getClusterEnergyPerLayerDecorator, getClusterEnergyPerLayerDecorations, getClusterEnergyPerLayerDecoratorNew, getClusterEnergyPerLayerDecoratorMaxVar, getClusterEnergyPerLayerDecoratorMinVar EGAM3_GainDecoratorTool = GainDecorator() ToolSvc += EGAM3_GainDecoratorTool -cluster_sizes = (3,5), (5,7), (7,7), (7,11) +cluster_sizes = (3,7), (5,5), (7,11) EGAM3_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, nphi)() for neta, nphi in cluster_sizes] +if DoCellReweighting: + EGAM3_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorNew(neta, nphi)() for neta, nphi in cluster_sizes] + if DoCellReweightingVariations: + EGAM3_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorMaxVar(neta, nphi)() for neta, nphi in cluster_sizes] + EGAM3_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorMinVar(neta, nphi)() for neta, nphi in cluster_sizes] + + +#==================================================================== +# Max Cell sum decoration tool +#==================================================================== +from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__MaxCellDecorator +EGAM3_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name = "EGAM3_MaxCellDecoratorTool", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons" ) +ToolSvc += EGAM3_MaxCellDecoratorTool + + +#==================================================================== +# Cell reweighter +#==================================================================== +if DoCellReweighting: + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import NewCellTool, ClusterDecoratorWithNewCells, EGammaReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM3_NewCellTool = NewCellTool("EGAM3_NewCellTool", + #OutputLevel = DEBUG + CellContainerName = "AODCellContainer", + ReweightCellContainerName = "NewCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs10.root" ) + print EGAM3_NewCellTool + ToolSvc += EGAM3_NewCellTool + + # second, run a tool that creates the clusters and objects from these new cells + EGAM3_ClusterDecoratorTool = ClusterDecoratorWithNewCells("EGAM3_ClusterDecoratorTool", + #OutputLevel=DEBUG, + OutputClusterSGKey = "EGammaSwClusterWithNewCells", + OutputClusterLink = "NewSwClusterLink", + SGKey_caloCells = "NewCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM3_ClusterDecoratorTool + ToolSvc += EGAM3_ClusterDecoratorTool + + # third, run a tool that creates the shower shapes with the new cells + from egammaTools.egammaToolsFactories import EMShowerBuilder + EGAM3_EMShowerBuilderTool = EMShowerBuilder("EGAM3_EMShowerBuilderTool", + CellsName="NewCellContainer") + print EGAM3_EMShowerBuilderTool + ToolSvc += EGAM3_EMShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM3_EGammaReweightTool = EGammaReweightTool("EGAM3_EGammaReweightTool", + #OutputLevel=DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons="Photons", + NewCellContainerName="NewCellContainer", + NewElectronContainer = "NewSwElectrons", + #NewElectronContainer = "", # no container for electrons + NewPhotonContainer = "NewSwPhotons", + EMShowerBuilderTool = EGAM3_EMShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithNewCells", + CaloClusterLinkName="NewSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "RW_", + SaveReweightedContainer = True) + + print EGAM3_EGammaReweightTool + ToolSvc += EGAM3_EGammaReweightTool + + if DoCellReweightingVariations: + + ########################################### REWEIGHTING VARIATIONS - MAX ###################################################### + + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import MaxVarCellTool, ClusterDecoratorWithMaxVarCells, EGammaMaxVarReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM3_MaxVarCellTool = MaxVarCellTool ("EGAM3_MaxVarCellTool", + #OutputLevel = DEBUG, + CellContainerName="AODCellContainer", + ReweightCellContainerName="MaxVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs11.root") + + print EGAM3_MaxVarCellTool + ToolSvc += EGAM3_MaxVarCellTool + + # second, run a tool that creates the clusters and objects from these new cells + EGAM3_MaxVarClusterDecoratorTool = ClusterDecoratorWithMaxVarCells("EGAM3_MaxVarClusterDecoratorTool", + OutputClusterSGKey="EGammaSwClusterWithMaxVarCells", + OutputClusterLink="MaxVarSwClusterLink", + SGKey_caloCells = "MaxVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM3_MaxVarClusterDecoratorTool + ToolSvc += EGAM3_MaxVarClusterDecoratorTool + + # third, schedule a tool that will be invoked by the EGammaReweightTool to create on-the-fly the shower shapes with the new cells + EGAM3_EMMaxVarShowerBuilderTool = EMShowerBuilder("EGAM3_EMMaxVarShowerBuilderTool", + CellsName="MaxVarCellContainer") + print EGAM3_EMMaxVarShowerBuilderTool + ToolSvc += EGAM3_EMMaxVarShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM3_EGammaMaxVarReweightTool = EGammaReweightTool("EGAM3_EGammaMaxVarReweightTool", + #OutputLevel = DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons="Photons", + NewCellContainerName="MaxVarCellContainer", + #NewElectronContainer = "MaxVarSwElectrons", + NewElectronContainer = "", + NewPhotonContainer = "MaxVarSwPhotons", + EMShowerBuilderTool = EGAM3_EMMaxVarShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithMaxVarCells", + CaloClusterLinkName="MaxVarSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "Max_", + SaveReweightedContainer = True) + print EGAM3_EGammaMaxVarReweightTool + ToolSvc += EGAM3_EGammaMaxVarReweightTool + + + ########################################### REWEIGHTING VARIATIONS - MIN ###################################################### + + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import MinVarCellTool, ClusterDecoratorWithMinVarCells, EGammaMinVarReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM3_MinVarCellTool = MinVarCellTool ("EGAM3_MinVarCellTol", + #OutputLevel = DEBUG, + CellContainerName="AODCellContainer", + ReweightCellContainerName="MinVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs00.root") + + + print EGAM3_MinVarCellTool + ToolSvc += EGAM3_MinVarCellTool + + # second, run a tool that creates the clusters and objects from these new cells + EGAM3_MinVarClusterDecoratorTool = ClusterDecoratorWithMinVarCells("EGAM3_MinVarClusterDecoratorTool", + OutputClusterSGKey="EGammaSwClusterWithMinVarCells", + OutputClusterLink="MinVarSwClusterLink", + SGKey_caloCells = "MinVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM3_MinVarClusterDecoratorTool + ToolSvc += EGAM3_MinVarClusterDecoratorTool + + # third, schedule a tool that will be invoked by the EGammaReweightTool to create on-the-fly the shower shapes with the new cells + EGAM3_EMMinVarShowerBuilderTool = EMShowerBuilder("EGAM3_EMMinVarShowerBuilderTool", + CellsName="MinVarCellContainer") + print EGAM3_EMMinVarShowerBuilderTool + ToolSvc += EGAM3_EMMinVarShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM3_EGammaMinVarReweightTool = EGammaReweightTool("EGAM3_EGammaMinVarReweightTool", + #OutputLevel = DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons="Photons", + NewCellContainerName="MinVarCellContainer", + #NewElectronContainer = "MinVarSwElectrons", + NewElectronContainer = "", + NewPhotonContainer = "MinVarSwPhotons", + EMShowerBuilderTool = EGAM3_EMMinVarShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithMinVarCells", + CaloClusterLinkName="MinVarSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "Min_", + SaveReweightedContainer = True) + + print EGAM3_EGammaMinVarReweightTool + ToolSvc += EGAM3_EGammaMinVarReweightTool + + +#==================================================================== +# SET UP THINNING +#==================================================================== +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM3ThinningHelper = ThinningHelper( "EGAM3ThinningHelper" ) +EGAM3ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(mu|j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_[eg].*))' +if globalflags.DataSource()!='geant4': + ExtraContainersTrigger += ExtraContainersTriggerDataOnly +EGAM3ThinningHelper.AppendToStream( EGAM3Stream, ExtraContainersTrigger ) -#================ -# THINNING -#================ thinningTools=[] -# TO BE ADDED + +# Track thinning +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = True + TrackThinningKeepPhotonTracks = True + TrackThinningKeepAllPhotonTracks = True + TrackThinningKeepJetTracks = False + TrackThinningKeepMuonTracks = False + TrackThinningKeepTauTracks = False + TrackThinningKeepPVTracks = False + + # Tracks associated with Jets + if (TrackThinningKeepJetTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + EGAM3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM3JetTPThinningTool", + ThinningService = EGAM3ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += EGAM3JetTPThinningTool + print EGAM3JetTPThinningTool + thinningTools.append(EGAM3JetTPThinningTool) + + # Tracks associated with Muons + if (TrackThinningKeepMuonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + EGAM3MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM3MuonTPThinningTool", + ThinningService = EGAM3ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM3MuonTPThinningTool + print EGAM3MuonTPThinningTool + thinningTools.append(EGAM3MuonTPThinningTool) + + # Tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM3ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM3ElectronTPThinningTool", + ThinningService = EGAM3ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM3ElectronTPThinningTool + print EGAM3ElectronTPThinningTool + thinningTools.append(EGAM3ElectronTPThinningTool) + + # Tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM3PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM3PhotonTPThinningTool", + ThinningService = EGAM3ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + + ToolSvc += EGAM3PhotonTPThinningTool + print EGAM3PhotonTPThinningTool + thinningTools.append(EGAM3PhotonTPThinningTool) + + # Tracks associated with Photons (all tracks, large cone, for track isolation studies of the selected photon) + if (TrackThinningKeepAllPhotonTracks) : + EGAM3PhotonTPThinningTool2 = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM3PhotonTPThinningTool2", + ThinningService = EGAM3ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 9.5*GeV", + BestMatchOnly = False, + ConeSize = 0.6, + ApplyAnd = False) + + ToolSvc += EGAM3PhotonTPThinningTool2 + print EGAM3PhotonTPThinningTool2 + thinningTools.append(EGAM3PhotonTPThinningTool2) + + # Tracks associated with Taus + if (TrackThinningKeepTauTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + EGAM3TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM3TauTPThinningTool", + ThinningService = EGAM3ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM3TauTPThinningTool + print EGAM3TauTPThinningTool + thinningTools.append(EGAM3TauTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM3TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM3TPThinningTool", + ThinningService = EGAM3ThinningHelper.ThinningSvc(), + SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM3TPThinningTool + print EGAM3TPThinningTool + thinningTools.append(EGAM3TPThinningTool) + + +print "EGAM3 thinningTools: ", thinningTools + + +#======================================= +# CREATE PRIVATE SEQUENCE +#======================================= +egam3Seq = CfgMgr.AthSequencer("EGAM3Sequence") +DerivationFrameworkJob += egam3Seq #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM3Kernel", - AugmentationTools = [EGAM3_EEMassTool,EGAM3_EEMassTool2,EGAM3_EEMassTool3,EGAM3_GainDecoratorTool] + EGAM3_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM3SkimmingTool], - ThinningTools = thinningTools - ) +augmentationTools = [EGAM3_EEMassTool,EGAM3_EEMassTool2,EGAM3_EEMassTool3,EGAM3_GainDecoratorTool,EGAM3_MaxCellDecoratorTool] +if DoCellReweighting: + augmentationTools += [EGAM3_NewCellTool, EGAM3_ClusterDecoratorTool, EGAM3_EGammaReweightTool] + if DoCellReweightingVariations: + augmentationTools += [EGAM3_MaxVarCellTool, EGAM3_MaxVarClusterDecoratorTool, EGAM3_EGammaMaxVarReweightTool, EGAM3_MinVarCellTool, EGAM3_MinVarClusterDecoratorTool, EGAM3_EGammaMinVarReweightTool] + +augmentationTools += EGAM3_ClusterEnergyPerLayerDecorators +print "EGAM3 augmentationTools", augmentationTools +egam3Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM3Kernel", + AugmentationTools = augmentationTools, + SkimmingTools = [EGAM3_SkimmingTool], + ThinningTools = thinningTools + ) #==================================================================== -# SET UP STREAM +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 +#==================================================================== +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +reducedJetList = ["AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam3Seq,"EGAM3") + + +#==================================================================== +# SET UP STREAM SELECTION #==================================================================== -streamName = derivationFlags.WriteDAOD_EGAM3Stream.StreamName -fileName = buildFileName( derivationFlags.WriteDAOD_EGAM3Stream ) -EGAM3Stream = MSMgr.NewPoolRootStream( streamName, fileName ) # Only events that pass the filters listed below are written out. # Name must match that of the kernel above # AcceptAlgs = logical OR of filters # RequireAlgs = logical AND of filters EGAM3Stream.AcceptAlgs(["EGAM3Kernel"]) -augStream = MSMgr.GetStream( streamName ) -evtStream = augStream.GetEventStream() - #==================================================================== -# CONTENT LIST +# SET UP SLIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper -from DerivationFrameworkEGamma.EGAM3ExtraContent import * EGAM3SlimmingHelper = SlimmingHelper("EGAM3SlimmingHelper") EGAM3SlimmingHelper.SmartCollections = ["Electrons", @@ -177,34 +529,48 @@ EGAM3SlimmingHelper.SmartCollections = ["Electrons", "TauJets", "MET_Reference_AntiKt4EMTopo", "AntiKt4EMTopoJets", - "BTagging_AntiKt4EMTopo", + "AntiKt4EMTopoJets_BTagging201810", + "BTagging_AntiKt4EMTopo_201810", "InDetTrackParticles", "PrimaryVertices" ] # Add egamma trigger objects EGAM3SlimmingHelper.IncludeEGammaTriggerContent = True +# Append cell-reweighted collections to dictionary +if DoCellReweighting: + EGAM3SlimmingHelper.AppendToDictionary = {"NewSwPhotons": "xAOD::PhotonContainer", "NewSwPhotonsAux": "xAOD::PhotonAuxContainer", "NewSwElectrons": "xAOD::ElectronContainer", "NewSwElectronsAux": "xAOD::ElectronAuxContainer" } + if DoCellReweightingVariations: + EGAM3SlimmingHelper.AppendToDictionary.update({ "MaxVarSwPhotons": "xAOD::PhotonContainer", "MaxVarSwPhotonsAux": "xAOD::PhotonAuxContainer", "MinVarSwPhotons": "xAOD::PhotonContainer", "MinVarSwPhotonsAux": "xAOD::PhotonAuxContainer" }) + EGAM3SlimmingHelper.AppendToDictionary.update({ "MaxVarSwElectrons": "xAOD::ElectronContainer", "MaxVarSwElectronsAux": "xAOD::ElectronAuxContainer", "MinVarSwElectrons": "xAOD::ElectronContainer", "MinVarSwElectronsAux": "xAOD::ElectronAuxContainer" }) + + # Extra variables EGAM3SlimmingHelper.ExtraVariables = ExtraContentAll EGAM3SlimmingHelper.AllVariables = ExtraContainersPhotons EGAM3SlimmingHelper.AllVariables += ExtraContainersTrigger -if globalflags.DataSource()!='geant4': - EGAM3SlimmingHelper.AllVariables += ExtraContainersTriggerDataOnly if globalflags.DataSource()=='geant4': EGAM3SlimmingHelper.ExtraVariables += ExtraContentAllTruth EGAM3SlimmingHelper.AllVariables += ExtraContainersTruth +else: + EGAM3SlimmingHelper.ExtraVariables += ExtraContainersTriggerDataOnly for tool in EGAM3_ClusterEnergyPerLayerDecorators: EGAM3SlimmingHelper.ExtraVariables.extend( getClusterEnergyPerLayerDecorations( tool ) ) + +# Add detailed shower shape variables +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * +EGAM3SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent +EGAM3SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent +from DerivationFrameworkEGamma.PhotonsCPDetailedContent import * +EGAM3SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent + # This line must come after we have finished configuring EGAM3SlimmingHelper EGAM3SlimmingHelper.AppendContentToStream(EGAM3Stream) -# Add MET_RefFinalFix -# JRC: COMMENTED TEMPORARILY -#addMETOutputs(EGAM3Stream) - -# Add AODCellContainer (have to find how to keep only cells belonging to e/gamma objects) +#Add full CellContainer EGAM3Stream.AddItem("CaloCellContainer#AODCellContainer") +EGAM3Stream.AddItem("CaloClusterCellLinkContainer#egammaClusters_links") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM4.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM4.py index e0b7f7bf3aabe1bd18be955577b3e4b040d30143..ce8f65ec744ad2ba56bba2d945e3a6222cf2b120 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM4.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM4.py @@ -11,26 +11,53 @@ from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM4ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") +DoCellReweighting = jobproperties.egammaDFFlags.doEGammaCellReweighting +DoCellReweightingVariations = jobproperties.egammaDFFlags.doEGammaCellReweightingVariations +#override if needed (do at your own risk..) +#DoCellReweighting = False +#DoCellReweighting = True + +# check if we run on data or MC (DataSource = geant4) +from AthenaCommon.GlobalFlags import globalflags +print "EGAM4 globalflags.DataSource(): ", globalflags.DataSource() +if globalflags.DataSource()!='geant4': + DoCellReweighting = False + DoCellReweightingVariations = False #==================================================================== -# SKIMMING TOOLS +# SET UP STREAM (to be done early in the game to set up thinning Svc #==================================================================== +streamName = derivationFlags.WriteDAOD_EGAM4Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_EGAM4Stream ) +EGAM4Stream = MSMgr.NewPoolRootStream( streamName, fileName ) #==================================================================== -# mumugamma selection for photon studies, single & di-muon triggers +# SET UP SKIMMING +#==================================================================== + + +#==================================================================== +# mumugamma and mumue selection for photon studies, single & di-muon triggers # two opposite-sign muons, pT>15 GeV, |eta|<2.5, mmumu>40 GeV # gamma: reco, ET>10 GeV, |eta|<2.5 +# mumueegamma: one reco photon, ET>10 GeV< |eta|<2.5 +# mumue: one reco electron, pT>10 GeV #==================================================================== #requirement = 'Muons.pt>9.5*GeV && abs(Muons.eta)<2.7 && Muons.DFCommonGoodMuon' -requirement = 'Muons.pt>9.5*GeV && abs(Muons.eta)<2.7 && Muons.DFCommonMuonsPreselection' +requirementMuons = 'Muons.pt>9.5*GeV && abs(Muons.eta)<2.7 && Muons.DFCommonMuonsPreselection' from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGInvariantMassTool EGAM4_MuMuMassTool = DerivationFramework__EGInvariantMassTool( name = "EGAM4_MuMuMassTool", - Object1Requirements = requirement, - Object2Requirements = requirement, + Object1Requirements = requirementMuons, + Object2Requirements = requirementMuons, StoreGateEntryName = "EGAM4_DiMuonMass", Mass1Hypothesis = 105*MeV, Mass2Hypothesis = 105*MeV, @@ -42,70 +69,386 @@ EGAM4_MuMuMassTool = DerivationFramework__EGInvariantMassTool( name = "EGAM4_MuM ToolSvc += EGAM4_MuMuMassTool print EGAM4_MuMuMassTool +skimmingExpression1a = 'count(DFCommonPhotons_et>9.5*GeV)>=1 && count(EGAM4_DiMuonMass > 40.0*GeV)>=1' +skimmingExpression1b = 'count(Electrons.pt>9.5*GeV)>=1 && count(EGAM4_DiMuonMass > 40.0*GeV)>=1' + #==================================================================== # SKIMMING TOOL #==================================================================== -expression = 'count(DFCommonPhotons_et>9.5*GeV)>=1 && count(EGAM4_DiMuonMass > 40.0*GeV)>=1' +skimmingExpression = skimmingExpression1a + ' || ' + skimmingExpression1b +print "EGAM4 skimming expression: ", skimmingExpression from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool -EGAM4SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM4SkimmingTool", - expression = expression) -ToolSvc += EGAM4SkimmingTool -print "EGAM4 skimming tool:", EGAM4SkimmingTool +EGAM4_SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM4_SkimmingTool", + expression = skimmingExpression) +ToolSvc += EGAM4_SkimmingTool +print "EGAM4 skimming tool: ", EGAM4_SkimmingTool -#================ -# THINNING -#================ -thinningTools=[] -# TO BE ADDED +#==================================================================== +# SET UP AUGMENTATIONS +#==================================================================== + #==================================================================== # Gain and cluster energies per layer decoration tool #==================================================================== -from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getGainDecorations, getClusterEnergyPerLayerDecorator, getClusterEnergyPerLayerDecorations +# GM: do we really need new, different tools: getClusterEnergyPerLayerDecoratorNew, getClusterEnergyPerLayerDecoratorMaxVar, getClusterEnergyPerLayerDecoratorMinVar? +from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getGainDecorations, getClusterEnergyPerLayerDecorator, getClusterEnergyPerLayerDecorations, getClusterEnergyPerLayerDecoratorNew, getClusterEnergyPerLayerDecoratorMaxVar, getClusterEnergyPerLayerDecoratorMinVar EGAM4_GainDecoratorTool = GainDecorator() ToolSvc += EGAM4_GainDecoratorTool -cluster_sizes = (3,5), (5,7), (7,7), (7,11) +cluster_sizes = (3,7), (5,5), (7,11) EGAM4_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, nphi)() for neta, nphi in cluster_sizes] +if DoCellReweighting: + EGAM4_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorNew(neta, nphi)() for neta, nphi in cluster_sizes] + if DoCellReweightingVariations: + EGAM4_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorMaxVar(neta, nphi)() for neta, nphi in cluster_sizes] + EGAM4_ClusterEnergyPerLayerDecorators += [getClusterEnergyPerLayerDecoratorMinVar(neta, nphi)() for neta, nphi in cluster_sizes] + + + +#==================================================================== +# Max Cell sum decoration tool +#==================================================================== +from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__MaxCellDecorator +EGAM4_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name = "EGAM4_MaxCellDecoratorTool", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") +ToolSvc += EGAM4_MaxCellDecoratorTool + + +#==================================================================== +# Cell reweighter +#==================================================================== +if DoCellReweighting: + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import NewCellTool, ClusterDecoratorWithNewCells, EGammaReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM4_NewCellTool = NewCellTool("EGAM4_NewCellTool", + #OutputLevel = DEBUG + CellContainerName = "AODCellContainer", + ReweightCellContainerName="NewCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs10.root" ) + print EGAM4_NewCellTool + ToolSvc += EGAM4_NewCellTool + + # second, run a tool that creates the clusters and objects from these new cells + EGAM4_ClusterDecoratorTool = ClusterDecoratorWithNewCells("EGAM4_ClusterDecoratorTool", + #OutputLevel=DEBUG, + OutputClusterSGKey = "EGammaSwClusterWithNewCells", + OutputClusterLink = "NewSwClusterLink", + SGKey_caloCells = "NewCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM4_ClusterDecoratorTool + ToolSvc += EGAM4_ClusterDecoratorTool + + # third, run a tool that creates the shower shapes with the new cells + from egammaTools.egammaToolsFactories import EMShowerBuilder + EGAM4_EMShowerBuilderTool = EMShowerBuilder("EGAM4_EMShowerBuilderTool", + CellsName="NewCellContainer") + print EGAM4_EMShowerBuilderTool + ToolSvc += EGAM4_EMShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM4_EGammaReweightTool = EGammaReweightTool("EGAM4_EGammaReweightTool", + #OutputLevel=DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons="Photons", + NewCellContainerName="NewCellContainer", + #NewElectronContainer = "", # no container for electrons + #NewElectronContainer = "NewSwElectrons", + NewPhotonContainer = "NewSwPhotons", + EMShowerBuilderTool = EGAM4_EMShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithNewCells", + CaloClusterLinkName="NewSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "RW_", + SaveReweightedContainer = True) + + print EGAM4_EGammaReweightTool + ToolSvc += EGAM4_EGammaReweightTool + + if DoCellReweightingVariations: + + ########################################### REWEIGHTING VARIATIONS - MAX ###################################################### + + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import MaxVarCellTool, ClusterDecoratorWithMaxVarCells, EGammaMaxVarReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM4_MaxVarCellTool = MaxVarCellTool ("EGAM4_MaxVarCellTool", + #OutputLevel = DEBUG, + CellContainerName="AODCellContainer", + ReweightCellContainerName="MaxVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs11.root") + + print EGAM4_MaxVarCellTool + ToolSvc += EGAM4_MaxVarCellTool + + # second, run a tool that creates the clusters and objects from these new cells + EGAM4_MaxVarClusterDecoratorTool = ClusterDecoratorWithMaxVarCells("EGAM4_MaxVarClusterDecoratorTool", + OutputClusterSGKey="EGammaSwClusterWithMaxVarCells", + OutputClusterLink="MaxVarSwClusterLink", + SGKey_caloCells = "MaxVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM4_MaxVarClusterDecoratorTool + ToolSvc += EGAM4_MaxVarClusterDecoratorTool + + # third, schedule a tool that will be invoked by the EGammaReweightTool to create on-the-fly the shower shapes with the new cells + EGAM4_EMMaxVarShowerBuilderTool = EMShowerBuilder("EGAM4_EMMaxVarShowerBuilderTool", + CellsName="MaxVarCellContainer") + print EGAM4_EMMaxVarShowerBuilderTool + ToolSvc += EGAM4_EMMaxVarShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM4_EGammaMaxVarReweightTool = EGammaReweightTool("EGAM4_EGammaMaxVarReweightTool", + #OutputLevel = DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons="Photons", + NewCellContainerName="MaxVarCellContainer", + #NewElectronContainer = "MaxVarSwElectrons", + NewElectronContainer = "", + NewPhotonContainer = "MaxVarSwPhotons", + #NewPhotonContainer = "", + EMShowerBuilderTool = EGAM4_EMMaxVarShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithMaxVarCells", + CaloClusterLinkName="MaxVarSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "Max_", + SaveReweightedContainer = True) + print EGAM4_EGammaMaxVarReweightTool + ToolSvc += EGAM4_EGammaMaxVarReweightTool + + + ########################################### REWEIGHTING VARIATIONS - MIN ###################################################### + + from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import MinVarCellTool, ClusterDecoratorWithMinVarCells, EGammaMinVarReweightTool + + # first, create the container with the new cells (after reweighting) + EGAM4_MinVarCellTool = MinVarCellTool ("EGAM4_MinVarCellTol", + #OutputLevel = DEBUG, + CellContainerName="AODCellContainer", + ReweightCellContainerName="MinVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons", + ReweightCoefficients2DPath = "DerivationFrameworkCalo/CellReweight_v2d/rewCoeffs00.root") + + + print EGAM4_MinVarCellTool + ToolSvc += EGAM4_MinVarCellTool + + # second, run a tool that creates the clusters and objects from these new cells + EGAM4_MinVarClusterDecoratorTool = ClusterDecoratorWithMinVarCells("EGAM4_MinVarClusterDecoratorTool", + OutputClusterSGKey="EGammaSwClusterWithMinVarCells", + OutputClusterLink="MinVarSwClusterLink", + SGKey_caloCells = "MinVarCellContainer", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons") + print EGAM4_MinVarClusterDecoratorTool + ToolSvc += EGAM4_MinVarClusterDecoratorTool + + # third, schedule a tool that will be invoked by the EGammaReweightTool to create on-the-fly the shower shapes with the new cells + EGAM4_EMMinVarShowerBuilderTool = EMShowerBuilder("EGAM4_EMMinVarShowerBuilderTool", + CellsName="MinVarCellContainer") + print EGAM4_EMMinVarShowerBuilderTool + ToolSvc += EGAM4_EMMinVarShowerBuilderTool + + # fourth, decorate the new objects with their shower shapes computed from the new clusters + EGAM4_EGammaMinVarReweightTool = EGammaReweightTool("EGAM4_EGammaMinVarReweightTool", + #OutputLevel = DEBUG, + SGKey_electrons = "Electrons", + SGKey_photons="Photons", + NewCellContainerName="MinVarCellContainer", + NewElectronContainer = "", + #NewElectronContainer = "MinVarSwElectrons", + NewPhotonContainer = "MinVarSwPhotons", + #NewPhotonContainer = "", + EMShowerBuilderTool = EGAM4_EMMinVarShowerBuilderTool, + ClusterCorrectionToolName = "DFEgammaSWToolWithMinVarCells", + CaloClusterLinkName="MinVarSwClusterLink", + DecorateEGammaObjects = False, + DecorationPrefix = "Min_", + SaveReweightedContainer = True) + + print EGAM4_EGammaMinVarReweightTool + ToolSvc += EGAM4_EGammaMinVarReweightTool + + +#==================================================================== +# SET UP THINNING +#==================================================================== +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM4ThinningHelper = ThinningHelper( "EGAM4ThinningHelper" ) +EGAM4ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_g[1-9].*|HLT_2g[1-9].*|HLT_mu.*|HLT_2mu.*))' +if globalflags.DataSource()!='geant4': + ExtraContainersTrigger += ExtraContainersTriggerDataOnly +EGAM4ThinningHelper.AppendToStream( EGAM4Stream, ExtraContainersTrigger ) + +thinningTools=[] + +# Track thinning +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = True + TrackThinningKeepPhotonTracks = True + TrackThinningKeepAllPhotonTracks = True + TrackThinningKeepJetTracks = False + TrackThinningKeepMuonTracks = True + TrackThinningKeepTauTracks = False + TrackThinningKeepPVTracks = False + + # Tracks associated with Jets + if (TrackThinningKeepJetTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + EGAM4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM4JetTPThinningTool", + ThinningService = EGAM4ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += EGAM4JetLCTPThinningTool + print EGAM4JetLCTPThinningTool + thinningTools.append(EGAM4JetLCTPThinningTool) + + # Tracks associated with Muons + if (TrackThinningKeepMuonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + EGAM4MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM4MuonTPThinningTool", + ThinningService = EGAM4ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM4MuonTPThinningTool + print EGAM4MuonTPThinningTool + thinningTools.append(EGAM4MuonTPThinningTool) + + # Tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM4ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM4ElectronTPThinningTool", + ThinningService = EGAM4ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM4ElectronTPThinningTool + print EGAM4ElectronTPThinningTool + thinningTools.append(EGAM4ElectronTPThinningTool) + + # Tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM4PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM4PhotonTPThinningTool", + ThinningService = EGAM4ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + + ToolSvc += EGAM4PhotonTPThinningTool + print EGAM4PhotonTPThinningTool + thinningTools.append(EGAM4PhotonTPThinningTool) + + # Tracks associated with Photons (all tracks, large cone, for track isolation studies of the selected photon) + if (TrackThinningKeepAllPhotonTracks) : + EGAM4PhotonTPThinningTool2 = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM4PhotonTPThinningTool2", + ThinningService = EGAM4ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 9.5*GeV", + BestMatchOnly = False, + ConeSize = 0.6, + ApplyAnd = False) + + ToolSvc += EGAM4PhotonTPThinningTool2 + print EGAM4PhotonTPThinningTool2 + thinningTools.append(EGAM4PhotonTPThinningTool2) + + # Tracks associated with Taus + if (TrackThinningKeepTauTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + EGAM4TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM4TauTPThinningTool", + ThinningService = EGAM4ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM4TauTPThinningTool + print EGAM4TauTPThinningTool + thinningTools.append(EGAM4TauTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM4TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM4TPThinningTool", + ThinningService = EGAM4ThinningHelper.ThinningSvc(), + SelectionString = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM4TPThinningTool + print EGAM4TPThinningTool + thinningTools.append(EGAM4TPThinningTool) + +print "EGAM4 thinningTools: ", thinningTools #======================================= -# CREATE THE DERIVATION KERNEL ALGORITHM +# CREATE PRIVATE SEQUENCE #======================================= +egam4Seq = CfgMgr.AthSequencer("EGAM4Sequence") +DerivationFrameworkJob += egam4Seq + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM4Kernel", - #AugmentationTools = [EGAM4_MuMuMassTool,EGAM4_CellDecoratorTool], - AugmentationTools = [EGAM4_MuMuMassTool,EGAM4_GainDecoratorTool] + EGAM4_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM4SkimmingTool], - ThinningTools = thinningTools - ) +augmentationTools = [EGAM4_MuMuMassTool,EGAM4_GainDecoratorTool,EGAM4_MaxCellDecoratorTool] +if DoCellReweighting: + augmentationTools += [EGAM4_NewCellTool, EGAM4_ClusterDecoratorTool, EGAM4_EGammaReweightTool] + if DoCellReweightingVariations: + augmentationTools += [EGAM4_MaxVarCellTool, EGAM4_MaxVarClusterDecoratorTool, EGAM4_EGammaMaxVarReweightTool, EGAM4_MinVarCellTool, EGAM4_MinVarClusterDecoratorTool, EGAM4_EGammaMinVarReweightTool] + +augmentationTools += EGAM4_ClusterEnergyPerLayerDecorators +egam4Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM4Kernel", + AugmentationTools = augmentationTools, + SkimmingTools = [EGAM4_SkimmingTool], + ThinningTools = thinningTools + ) + #==================================================================== -# SET UP STREAM +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 +#==================================================================== +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +reducedJetList = ["AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam4Seq,"EGAM4") + + +#==================================================================== +# SET UP STREAM SELECTION #==================================================================== -streamName = derivationFlags.WriteDAOD_EGAM4Stream.StreamName -fileName = buildFileName( derivationFlags.WriteDAOD_EGAM4Stream ) -EGAM4Stream = MSMgr.NewPoolRootStream( streamName, fileName ) # Only events that pass the filters listed below are written out. # Name must match that of the kernel above # AcceptAlgs = logical OR of filters # RequireAlgs = logical AND of filters EGAM4Stream.AcceptAlgs(["EGAM4Kernel"]) -augStream = MSMgr.GetStream( streamName ) -evtStream = augStream.GetEventStream() - #==================================================================== -# CONTENT LIST +# SET UP SLIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper -from DerivationFrameworkEGamma.EGAM4ExtraContent import * - EGAM4SlimmingHelper = SlimmingHelper("EGAM4SlimmingHelper") EGAM4SlimmingHelper.SmartCollections = ["Electrons", "Photons", @@ -113,7 +456,8 @@ EGAM4SlimmingHelper.SmartCollections = ["Electrons", "TauJets", "MET_Reference_AntiKt4EMTopo", "AntiKt4EMTopoJets", - "BTagging_AntiKt4EMTopo", + "AntiKt4EMTopoJets_BTagging201810", + "BTagging_AntiKt4EMTopo_201810", "InDetTrackParticles", "PrimaryVertices" ] @@ -121,26 +465,36 @@ EGAM4SlimmingHelper.SmartCollections = ["Electrons", EGAM4SlimmingHelper.IncludeEGammaTriggerContent = True EGAM4SlimmingHelper.IncludeMuonTriggerContent = True +# Append cell-reweighted collections to dictionary +if DoCellReweighting: + EGAM4SlimmingHelper.AppendToDictionary = {"NewSwPhotons": "xAOD::PhotonContainer", "NewSwPhotonsAux": "xAOD::PhotonAuxContainer" } + if DoCellReweightingVariations: + EGAM4SlimmingHelper.AppendToDictionary.update({ "MaxVarSwPhotons": "xAOD::PhotonContainer", "MaxVarSwPhotonsAux": "xAOD::PhotonAuxContainer", "MinVarSwPhotons": "xAOD::PhotonContainer", "MinVarSwPhotonsAux": "xAOD::PhotonAuxContainer" }) + # Extra variables EGAM4SlimmingHelper.ExtraVariables = ExtraContentAll EGAM4SlimmingHelper.AllVariables = ExtraContainersPhotons EGAM4SlimmingHelper.AllVariables += ExtraContainersTrigger -if globalflags.DataSource()!='geant4': - EGAM4SlimmingHelper.AllVariables += ExtraContainersTriggerDataOnly if globalflags.DataSource()=='geant4': EGAM4SlimmingHelper.ExtraVariables += ExtraContentAllTruth EGAM4SlimmingHelper.AllVariables += ExtraContainersTruth +else: + EGAM4SlimmingHelper.ExtraVariables += ExtraContainersTriggerDataOnly for tool in EGAM4_ClusterEnergyPerLayerDecorators: EGAM4SlimmingHelper.ExtraVariables.extend( getClusterEnergyPerLayerDecorations( tool ) ) +# Add detailed shower shape variables +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * +EGAM4SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent +EGAM4SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent +from DerivationFrameworkEGamma.PhotonsCPDetailedContent import * +EGAM4SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent + # This line must come after we have finished configuring EGAM4SlimmingHelper EGAM4SlimmingHelper.AppendContentToStream(EGAM4Stream) -# Add MET_RefFinalFix -# JRC: COMMENTED TEMPORARILY -# addMETOutputs(EGAM4Stream) - -# Add AODCellContainer (have to find how to keep only cells belonging to e/gamma objects) +#Add full CellContainer EGAM4Stream.AddItem("CaloCellContainer#AODCellContainer") +EGAM4Stream.AddItem("CaloClusterCellLinkContainer#egammaClusters_links") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM5.py index 35e5887b51bbf98cfc96bb70ff108f0aec2345eb..5ba7064281368010b5f534d27f1a00dc0139e3af 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM5.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM5.py @@ -11,12 +11,31 @@ from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM5ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") +# this could also go in egammaDFFlags RecomputeElectronSelectors = True #RecomputeElectronSelectors = False +# check if we run on data or MC (DataSource = geant4) +from AthenaCommon.GlobalFlags import globalflags +print "EGAM5 globalflags.DataSource(): ", globalflags.DataSource() + + +#==================================================================== +# SET UP STREAM (to be done early in the game to set up thinning Svc +#==================================================================== +streamName = derivationFlags.WriteDAOD_EGAM5Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_EGAM5Stream ) +EGAM5Stream = MSMgr.NewPoolRootStream( streamName, fileName ) + + #==================================================================== -# SKIMMING TOOLS +# SET UP SKIMMING #==================================================================== #==================================================================== @@ -64,11 +83,6 @@ triggers += ['HLT_e13_etcut_L1EM10_W-MT25'] triggers += ['HLT_e13_etcut_L1EM10_W-MT30'] triggers += ['HLT_e13_etcut_trkcut_L1EM12'] triggers += ['HLT_e13_etcut_trkcut_L1EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE'] -triggers += ['HLT_e13_etcut_trkcut_xs15_mt25'] -triggers += ['HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_2dphi05_mt25'] -triggers += ['HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_6dphi05_mt25'] -triggers += ['HLT_e13_etcut_trkcut_j20_perf_xe15_2dphi05_mt25'] -triggers += ['HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi05_mt25'] triggers += ['HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25'] triggers += ['HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20'] triggers += ['HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0'] @@ -83,8 +97,6 @@ triggers += ['HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM12_W-MT2 triggers += ['HLT_e18_etcut_L1EM15_W-MT35'] triggers += ['HLT_e18_etcut_trkcut_L1EM15'] triggers += ['HLT_e18_etcut_trkcut_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE'] -triggers += ['HLT_e18_etcut_trkcut_xs20_mt35'] -triggers += ['HLT_e18_etcut_trkcut_xs20_j20_perf_xe20_6dphi15_mt35'] triggers += ['HLT_e18_etcut_trkcut_xs30_xe30_mt35'] triggers += ['HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35'] triggers += ['HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35'] @@ -101,10 +113,43 @@ triggers += ['HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM15_W-MT3 triggers += ['HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30'] triggers += ['HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE'] triggers += ['HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE'] -triggers += ['HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35'] triggers += ['HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30'] triggers += ['HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE'] +# added for 2017 +triggers += ['HLT_e60_etcut'] +triggers += ['HLT_e60_etcut_L1EM24VHIM'] +triggers += ['HLT_e60_etcut_trkcut_L1EM24VHIM_j15_perf_xe60_6dphi15_mt35'] +triggers += ['HLT_e60_etcut_trkcut_L1EM24VHIM_xe60_mt35'] +triggers += ['HLT_e60_etcut_trkcut_L1EM24VHIM_xs30_j15_perf_xe30_6dphi15_mt35'] +triggers += ['HLT_e60_etcut_trkcut_L1EM24VHIM_xs30_xe30_mt35'] +triggers += ['HLT_e60_lhmedium_nod0'] +triggers += ['HLT_e60_lhmedium_nod0_L1EM24VHI'] +triggers += ['HLT_e60_lhmedium_nod0_L1EM24VHIM'] +triggers += ['HLT_e60_lhvloose_nod0'] +triggers += ['HLT_e60_etcut_trkcut_j15_perf_xe60_6dphi05_mt35'] +triggers += ['HLT_e60_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35'] +triggers += ['HLT_e70_etcut'] +triggers += ['HLT_e70_etcut_L1EM24VHIM'] +triggers += ['HLT_e70_lhloose_nod0_L1EM24VHIM_xe70noL1'] +triggers += ['HLT_e70_lhloose_nod0_xe70noL1'] +triggers += ['HLT_noalg_l1topo_L1EM15'] +triggers += ['HLT_noalg_l1topo_L1EM7'] +triggers += ['HLT_j80_xe80'] +triggers += ['HLT_xe80_tc_lcw_L1XE50'] +triggers += ['HLT_xe90_mht_L1XE50'] +triggers += ['HLT_xe90_tc_lcw_wEFMu_L1XE50'] +triggers += ['HLT_xe90_mht_wEFMu_L1XE50'] +triggers += ['HLT_xe110_mht_L1XE50'] +triggers += ['HLT_xe110_pufit_L1XE50'] + +#added for low-mu data analysis, 2017 and 2018 data +triggers += ['HLT_e15_lhloose_nod0_L1EM12'] +#added for low-mu data analysis, 2018 data +triggers += ['HLT_xe35'] +triggers += ['HLT_e15_etcut_trkcut_xe30noL1'] + + from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool EGAM5_TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( name = "EGAM5_TriggerSkimmingTool", TriggerListOR = triggers) @@ -117,9 +162,9 @@ print "EGAM5 trigger skimming tool:", EGAM5_TriggerSkimmingTool # could add track isolation (if included in single electron trigger..) if RecomputeElectronSelectors : - requirement_el = '(Electrons.DFCommonElectronsIsEMTight || Electrons.DFCommonElectronsLHTight) && Electrons.pt > 24.5*GeV' + requirement_el = '(Electrons.DFCommonElectronsLHTight) && Electrons.pt > 24.5*GeV' else : - requirement_el = '(Electrons.Tight || Electrons.DFCommonElectronsLHTight) && Electrons.pt > 24.5*GeV' + requirement_el = '(Electrons.LHTight) && Electrons.pt > 24.5*GeV' from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGTransverseMassTool EGAM5_MTTool = DerivationFramework__EGTransverseMassTool( name = "EGAM5_MTTool", @@ -151,6 +196,17 @@ ToolSvc += EGAM5_ThirdSkimmingTool print "EGAM5 offline skimming tool:", EGAM5_ThirdSkimmingTool +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__FilterCombinationOR +EGAM5_SkimmingTool = DerivationFramework__FilterCombinationOR(name="EGAM5_SkimmingTool", FilterList=[EGAM5_TriggerSkimmingTool,EGAM5_OfflineSkimmingTool,EGAM5_ThirdSkimmingTool] ) +ToolSvc+=EGAM5_SkimmingTool + + + +#==================================================================== +# DECORATION TOOLS +#==================================================================== + + #==================================================================== # Gain and cluster energies per layer decoration tool #==================================================================== @@ -162,10 +218,9 @@ cluster_sizes = (3,5), (5,7), (7,7), (7,11) EGAM5_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, nphi)() for neta, nphi in cluster_sizes] -#==================================================================== -# Max Cell sum decoration tool -#==================================================================== - +#==================================================================== +# Max Cell sum decoration tool +#==================================================================== from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__MaxCellDecorator EGAM5_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name = "EGAM5_MaxCellDecoratorTool", SGKey_electrons = "Electrons", @@ -174,26 +229,141 @@ EGAM5_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name ToolSvc += EGAM5_MaxCellDecoratorTool + +#==================================================================== +# SET UP THINNING +#==================================================================== +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM5ThinningHelper = ThinningHelper( "EGAM5ThinningHelper" ) +EGAM5ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(mu|j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_[eg].*))' +if globalflags.DataSource()!='geant4': + ExtraContainersTrigger += ExtraContainersTriggerDataOnly +EGAM5ThinningHelper.AppendToStream( EGAM5Stream, ExtraContainersTrigger ) + +thinningTools=[] + +# Track thinning +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = True + TrackThinningKeepPhotonTracks = True + TrackThinningKeepJetTracks = False + TrackThinningKeepMuonTracks = False + TrackThinningKeepTauTracks = False + TrackThinningKeepPVTracks = True + + # Tracks associated with Jets + if (TrackThinningKeepJetTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + EGAM5JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM5JetTPThinningTool", + ThinningService = EGAM5ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += EGAM5JetTPThinningTool + print EGAM5JetTPThinningTool + thinningTools.append(EGAM5JetTPThinningTool) + + # Tracks associated with Muons + if (TrackThinningKeepMuonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + EGAM5MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM5MuonTPThinningTool", + ThinningService = EGAM5ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM5MuonTPThinningTool + print EGAM5MuonTPThinningTool + thinningTools.append(EGAM5MuonTPThinningTool) + + # Tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM5ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM5ElectronTPThinningTool", + ThinningService = EGAM5ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM5ElectronTPThinningTool + print EGAM5ElectronTPThinningTool + thinningTools.append(EGAM5ElectronTPThinningTool) + + # Tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM5PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM5PhotonTPThinningTool", + ThinningService = EGAM5ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + + ToolSvc += EGAM5PhotonTPThinningTool + print EGAM5PhotonTPThinningTool + thinningTools.append(EGAM5PhotonTPThinningTool) + + # Tracks associated with Taus + if (TrackThinningKeepTauTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + EGAM5TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM5TauTPThinningTool", + ThinningService = EGAM5ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM5TauTPThinningTool + print EGAM5TauTPThinningTool + thinningTools.append(EGAM5TauTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM5TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM5TPThinningTool", + ThinningService = EGAM5ThinningHelper.ThinningSvc(), + SelectionString = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM5TPThinningTool + print EGAM5TPThinningTool + thinningTools.append(EGAM5TPThinningTool) + +print "EGAM5 thinningTools: ", thinningTools + + #======================================= -# CREATE THE DERIVATION KERNEL ALGORITHM +# CREATE PRIVATE SEQUENCE #======================================= -from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__FilterCombinationOR -EGAM5SkimmingTool = DerivationFramework__FilterCombinationOR(name="EGAM5SkimmingTool", FilterList=[EGAM5_TriggerSkimmingTool,EGAM5_OfflineSkimmingTool,EGAM5_ThirdSkimmingTool] ) -ToolSvc+=EGAM5SkimmingTool +egam5Seq = CfgMgr.AthSequencer("EGAM5Sequence") +DerivationFrameworkJob += egam5Seq + + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM5Kernel", - AugmentationTools = [EGAM5_MTTool,EGAM5_GainDecoratorTool,EGAM5_MaxCellDecoratorTool] + EGAM5_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM5SkimmingTool] - ) +egam5Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM5Kernel", + AugmentationTools = [EGAM5_MTTool,EGAM5_GainDecoratorTool,EGAM5_MaxCellDecoratorTool] + EGAM5_ClusterEnergyPerLayerDecorators, + SkimmingTools = [EGAM5_SkimmingTool], + ThinningTools = thinningTools + ) #==================================================================== -# SET UP STREAM +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 +#==================================================================== +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +reducedJetList = ["AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam5Seq,"EGAM5") + + +#==================================================================== +# SET UP STREAM SELECTION #==================================================================== -streamName = derivationFlags.WriteDAOD_EGAM5Stream.StreamName -fileName = buildFileName( derivationFlags.WriteDAOD_EGAM5Stream ) -EGAM5Stream = MSMgr.NewPoolRootStream( streamName, fileName ) # Only events that pass the filters listed below are written out. # Name must match that of the kernel above # AcceptAlgs = logical OR of filters @@ -202,19 +372,19 @@ EGAM5Stream.AcceptAlgs(["EGAM5Kernel"]) #==================================================================== -# CONTENT LIST +# SET UP SKIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper EGAM5SlimmingHelper = SlimmingHelper("EGAM5SlimmingHelper") -from DerivationFrameworkEGamma.EGAM5ExtraContent import * EGAM5SlimmingHelper.SmartCollections = ["Electrons", "Photons", "Muons", "TauJets", "MET_Reference_AntiKt4EMTopo", "AntiKt4EMTopoJets", - "BTagging_AntiKt4EMTopo", + "AntiKt4EMTopoJets_BTagging201810", + "BTagging_AntiKt4EMTopo_201810", "InDetTrackParticles", "PrimaryVertices" ] @@ -225,20 +395,23 @@ EGAM5SlimmingHelper.IncludeEGammaTriggerContent = True EGAM5SlimmingHelper.ExtraVariables = ExtraContentAll EGAM5SlimmingHelper.AllVariables = ExtraContainersElectrons EGAM5SlimmingHelper.AllVariables += ExtraContainersTrigger -if globalflags.DataSource()!='geant4': - EGAM5SlimmingHelper.AllVariables += ExtraContainersTriggerDataOnly if globalflags.DataSource()=='geant4': EGAM5SlimmingHelper.ExtraVariables += ExtraContentAllTruth EGAM5SlimmingHelper.AllVariables += ExtraContainersTruth +else: + EGAM5SlimmingHelper.ExtraVariables += ExtraContainersTriggerDataOnly for tool in EGAM5_ClusterEnergyPerLayerDecorators: EGAM5SlimmingHelper.ExtraVariables.extend( getClusterEnergyPerLayerDecorations( tool ) ) +# Add detailed shower shape variables +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * +EGAM5SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent +EGAM5SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent +from DerivationFrameworkEGamma.PhotonsCPDetailedContent import * +EGAM5SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent + # This line must come after we have finished configuring EGAM5SlimmingHelper EGAM5SlimmingHelper.AppendContentToStream(EGAM5Stream) -# Add MET_RefFinalFix -# JRC: COMMENTED TEMPORARILY -#addMETOutputs(EGAM5Stream) - diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM6.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM6.py index 6cea0a839c42cbbc97c0f2209727cb3701d5ef42..56723395a2b52d27ee0d0cca93ea538abcb8d5d0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM6.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM6.py @@ -11,30 +11,32 @@ from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM1ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") + RecomputeElectronSelectors = True #RecomputeElectronSelectors = False + +# check if we run on data or MC (DataSource = geant4) +from AthenaCommon.GlobalFlags import globalflags +print "EGAM6 globalflags.DataSource(): ", globalflags.DataSource() + + #==================================================================== -# SET UP STREAM +# SET UP STREAM (to be done early in the game to set up thinning Svc #==================================================================== streamName = derivationFlags.WriteDAOD_EGAM6Stream.StreamName fileName = buildFileName( derivationFlags.WriteDAOD_EGAM6Stream ) EGAM6Stream = MSMgr.NewPoolRootStream( streamName, fileName ) -# Only events that pass the filters listed below are written out. -# Name must match that of the kernel above -# AcceptAlgs = logical OR of filters -# RequireAlgs = logical AND of filters -EGAM6Stream.AcceptAlgs(["EGAM6Kernel"]) -#Special lines for thinning -# Thinning service name must match the one passed to the thinning tools -augStream = MSMgr.GetStream( streamName ) -evtStream = augStream.GetEventStream() - #==================================================================== -# SKIMMING TOOLS +# SET UP SKIMMING #==================================================================== # SELECTION FOR CALIBRATION @@ -49,11 +51,11 @@ evtStream = augStream.GetEventStream() # switch to likelihood selectors only as soon as they're commissioned (and used in trigger) if RecomputeElectronSelectors : - requirement_tag = '(Electrons.DFCommonElectronsIsEMTight || Electrons.DFCommonElectronsLHTight) && Electrons.pt > 24.5*GeV' - requirement_probe = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' + requirement_tag = '(Electrons.DFCommonElectronsLHTight) && Electrons.pt > 24.5*GeV' + requirement_probe = '(Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' else : - requirement_tag = '(Electrons.Tight || Electrons.DFCommonElectronsLHTight) && Electrons.pt > 24.5*GeV' - requirement_probe = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' + requirement_tag = '(Electrons.LHTight) && Electrons.pt > 24.5*GeV' + requirement_probe = '(Electrons.LHMedium) && Electrons.pt > 19.5*GeV' from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGInvariantMassTool EGAM6_ZEEMassTool1 = DerivationFramework__EGInvariantMassTool( name = "EGAM6_ZEEMassTool1", @@ -76,11 +78,10 @@ print EGAM6_ZEEMassTool1 # OS, mee>60 GeV #==================================================================== -# switch to likelihood selectors only as soon as they're commissioned (and used in trigger) if RecomputeElectronSelectors: - requirement = '(Electrons.DFCommonElectronsIsEMLoose || Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' + requirement = '(Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' else: - requirement = '(Electrons.Loose || Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 19.5*GeV' + requirement = '(Electrons.LHLoose || Electrons.LHMedium) && Electrons.pt > 19.5*GeV' EGAM6_ZEEMassTool2 = DerivationFramework__EGInvariantMassTool( name = "EGAM6_ZEEMassTool2", Object1Requirements = requirement, Object2Requirements = requirement, @@ -107,9 +108,9 @@ print EGAM6_ZEEMassTool2 # switch to likelihood selectors only as soon as they're commissioned (and used in trigger) if RecomputeElectronSelectors : - requirement_tag = '(Electrons.DFCommonElectronsIsEMLoose || Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' else : - requirement_tag = '(Electrons.Loose || Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.LHLoose || Electrons.LHMedium) && Electrons.pt > 24.5*GeV' # central electrons: collection = Electrons, pt>14.5 GeV requirement_probe = 'Electrons.pt > 14.5*GeV' @@ -137,9 +138,9 @@ print EGAM6_ZEEMassTool3 # switch to likelihood selectors only as soon as they're commissioned (and used in trigger) if RecomputeElectronSelectors: - requirement_tag = '(Electrons.DFCommonElectronsIsEMLoose || Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' else: - requirement_tag = '(Electrons.Loose || Electrons.DFCommonElectronsLHLoose || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.LHLoose || Electrons.LHMedium) && Electrons.pt > 24.5*GeV' requirement_probe = 'DFCommonPhotons_et > 14.5*GeV' EGAM6_ZEGMassTool = DerivationFramework__EGInvariantMassTool( name = "EGAM6_ZEGMassTool", Object1Requirements = requirement_tag, @@ -162,10 +163,17 @@ print EGAM6_ZEGMassTool #expression = '( ( count(Photons.pt > 10*GeV) > 0 ) || ( count(Electrons.pt > 10*GeV) > 0 ) )' expression = 'count(EGAM6_DiElectronMass > 60.0*GeV)>=1 || count(EGAM6_DiElectronMass2 > 60.0*GeV)>=1 || count(EGAM6_DiElectronMass3 > 60.0*GeV)>=1 || count (EGAM6_ElectronPhotonMass > 60.0*GeV)>=1' from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool -EGAM6SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM6SkimmingTool", +EGAM6_SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM6_SkimmingTool", expression = expression) -ToolSvc += EGAM6SkimmingTool -print "EGAM6 skimming tool:", EGAM6SkimmingTool +ToolSvc += EGAM6_SkimmingTool +print "EGAM6 skimming tool:", EGAM6_SkimmingTool + + + +#==================================================================== +# DECORATION TOOLS +#==================================================================== + #==================================================================== # Gain and cluster energies per layer decoration tool @@ -190,116 +198,186 @@ EGAM6_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name ToolSvc += EGAM6_MaxCellDecoratorTool -#================ -# THINNING -#================ +#==================================================================== +# SET UP THINNING +#==================================================================== + +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM6ThinningHelper = ThinningHelper( "EGAM6ThinningHelper" ) +EGAM6ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(mu|j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_[eg].*))|HLT_e.*_Zee.*' +EGAM6ThinningHelper.AppendToStream( EGAM6Stream, ExtraContainersTrigger ) + thinningTools=[] -# Tracks associated with Jets -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning -EGAM6JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM6JetLCTPThinningTool", - StreamName = streamName, - JetKey = "AntiKt4EMTopoJets", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += EGAM6JetLCTPThinningTool -print EGAM6JetLCTPThinningTool -#thinningTools.append(EGAM6JetLCTPThinningTool) - -# Tracks associated with Muons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning -EGAM6MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM6MuonTPThinningTool", - StreamName = streamName, - MuonKey = "Muons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM6MuonTPThinningTool -print EGAM6MuonTPThinningTool -#thinningTools.append(EGAM6MuonTPThinningTool) - -# Tracks associated with Electrons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning -EGAM6ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM6ElectronTPThinningTool", - StreamName = streamName, - SGKey = "Electrons", +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = True + TrackThinningKeepPhotonTracks = True + TrackThinningKeepAllElectronTracks = True + TrackThinningKeepJetTracks = False + TrackThinningKeepMuonTracks = False + TrackThinningKeepTauTracks = False + TrackThinningKeepPVTracks = True + + # Tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM6ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM6ElectronTPThinningTool", + ThinningService = EGAM6ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM6ElectronTPThinningTool + print EGAM6ElectronTPThinningTool + thinningTools.append(EGAM6ElectronTPThinningTool) + + # Tracks associated with Electrons (all tracks, large cone, for track isolation studies of the selected electrons) + if (TrackThinningKeepAllElectronTracks) : + EGAM6ElectronTPThinningTool2 = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM6ElectronTPThinningTool2", + ThinningService = EGAM6ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 4*GeV", + BestMatchOnly = False, + ConeSize = 0.6, + ApplyAnd = False) + + ToolSvc += EGAM6ElectronTPThinningTool2 + print EGAM6ElectronTPThinningTool2 + thinningTools.append(EGAM6ElectronTPThinningTool2) + + # Tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM6PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM6PhotonTPThinningTool", + ThinningService = EGAM6ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM6PhotonTPThinningTool + print EGAM6PhotonTPThinningTool + thinningTools.append(EGAM6PhotonTPThinningTool) + + # Tracks associated with Jets + if (TrackThinningKeepJetTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + EGAM6JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM6JetTPThinningTool", + ThinningService = EGAM6ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM6ElectronTPThinningTool -print EGAM6ElectronTPThinningTool -#thinningTools.append(EGAM6ElectronTPThinningTool) - -# Tracks associated with Photons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning -EGAM6PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM6PhotonTPThinningTool", - StreamName = streamName, - SGKey = "Photons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM6PhotonTPThinningTool -print EGAM6PhotonTPThinningTool -#thinningTools.append(EGAM6PhotonTPThinningTool) - -# Tracks associated with Taus -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning -EGAM6TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM6TauTPThinningTool", - StreamName = streamName, - TauKey = "TauJets", - ConeSize = 0.6, - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM6TauTPThinningTool -print EGAM6TauTPThinningTool -#thinningTools.append(EGAM6TauTPThinningTool) - -# Tracks from primary vertex -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -EGAM6TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM6TPThinningTool", - StreamName = streamName, - SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM6TPThinningTool -print EGAM6TPThinningTool -#thinningTools.append(EGAM6TPThinningTool) - + ToolSvc += EGAM6JetTPThinningTool + print EGAM6JetTPThinningTool + thinningTools.append(EGAM6JetTPThinningTool) + + + # Tracks associated with Muons + if (TrackThinningKeepMuonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + EGAM6MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM6MuonTPThinningTool", + ThinningService = EGAM6ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM6MuonTPThinningTool + print EGAM6MuonTPThinningTool + thinningTools.append(EGAM6MuonTPThinningTool) + + + # Tracks associated with Taus + if (TrackThinningKeepTauTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + EGAM6TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM6TauTPThinningTool", + ThinningService = EGAM6ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM6TauTPThinningTool + print EGAM6TauTPThinningTool + thinningTools.append(EGAM6TauTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM6TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM6TPThinningTool", + ThinningService = EGAM6ThinningHelper.ThinningSvc(), + SelectionString = "InDetTrackParticles.DFCommonTightPrimary && abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0*mm", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM6TPThinningTool + print EGAM6TPThinningTool + thinningTools.append(EGAM6TPThinningTool) # Truth thinning -truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs -truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons -truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark -truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon -truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles -truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' - -from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning -EGAM6TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM6TruthThinningTool", - StreamName = streamName, - ParticleSelectionString = truth_expression, - PreserveDescendants = False, - PreserveGeneratorDescendants = True, - PreserveAncestors = True) - -from AthenaCommon.GlobalFlags import globalflags -print "EGAM6 globalflags.DataSource(): ", globalflags.DataSource() if globalflags.DataSource()=='geant4': + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark + truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles + truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + EGAM6TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM6TruthThinningTool", + ThinningService = "EGAM6ThinningSvc", + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + + ToolSvc += EGAM6TruthThinningTool thinningTools.append(EGAM6TruthThinningTool) + print "EGAM6 thinningTools: ", thinningTools +#======================================= +# CREATE PRIVATE SEQUENCE +#======================================= +egam6Seq = CfgMgr.AthSequencer("EGAM6Sequence") +DerivationFrameworkJob += egam6Seq + + #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM6Kernel", +egam6Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM6Kernel", AugmentationTools = [EGAM6_ZEEMassTool1, EGAM6_ZEEMassTool2, EGAM6_ZEEMassTool3, EGAM6_ZEGMassTool, EGAM6_GainDecoratorTool, EGAM6_MaxCellDecoratorTool] + EGAM6_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM6SkimmingTool], + SkimmingTools = [EGAM6_SkimmingTool], ThinningTools = thinningTools ) -#======================================================================== +#==================================================================== +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 +#==================================================================== +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +reducedJetList = ["AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam6Seq,"EGAM6") + + +#==================================================================== +# SET UP STREAM SELECTION +#==================================================================== +# Only events that pass the filters listed below are written out. +# Name must match that of the kernel above +# AcceptAlgs = logical OR of filters +# RequireAlgs = logical AND of filters +EGAM6Stream.AcceptAlgs(["EGAM6Kernel"]) #==================================================================== -# CONTENT LIST +# SET UP SLIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper EGAM6SlimmingHelper = SlimmingHelper("EGAM6SlimmingHelper") @@ -311,7 +389,8 @@ EGAM6SlimmingHelper.SmartCollections = [ "TauJets", "MET_Reference_AntiKt4EMTopo", "AntiKt4EMTopoJets", - "BTagging_AntiKt4EMTopo", + "AntiKt4EMTopoJets_BTagging201810", + "BTagging_AntiKt4EMTopo_201810", "InDetTrackParticles", "PrimaryVertices" ] @@ -320,7 +399,6 @@ EGAM6SlimmingHelper.SmartCollections = [ EGAM6SlimmingHelper.IncludeEGammaTriggerContent = True # read list of extra content from EGAM1 file (output of EGAM6 and EGAM1 is the same) -from DerivationFrameworkEGamma.EGAM1ExtraContent import * EGAM6SlimmingHelper.ExtraVariables = ExtraContentAll EGAM6SlimmingHelper.AllVariables = ExtraContainersElectrons EGAM6SlimmingHelper.AllVariables += ExtraContainersTrigger @@ -343,5 +421,9 @@ EGAM6SlimmingHelper.AppendContentToStream(EGAM6Stream) #addMETOutputs(EGAM6Stream) # Add Derived Egamma CellContainer -from DerivationFrameworkEGamma.EGammaCellCommon import CellCommonThinning -CellCommonThinning(EGAM6Stream) +# from DerivationFrameworkEGamma.EGammaCellCommon import CellCommonThinning +# CellCommonThinning(EGAM6Stream) + +#Add full CellContainer +EGAM6Stream.AddItem("CaloCellContainer#AODCellContainer") +EGAM6Stream.AddItem("CaloClusterCellLinkContainer#egammaClusters_links") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM7.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM7.py index 9be82d1328520d96e411481c2995275ffb1a2b5f..efa45d4b2d841ca0096a8bbe284df38cfb3b5fd2 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM7.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM7.py @@ -1,4 +1,3 @@ - #******************************************************************** # EGAM7.py - keep events passing or of electron triggers, to select # fake electron candidates @@ -12,10 +11,27 @@ from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM7ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") + +# check if we run on data or MC (DataSource = geant4) +from AthenaCommon.GlobalFlags import globalflags +print "EGAM7 globalflags.DataSource(): ", globalflags.DataSource() + + +#==================================================================== +# SET UP STREAM (to be done early in the game to set up thinning Svc +#==================================================================== +streamName = derivationFlags.WriteDAOD_EGAM7Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_EGAM7Stream ) +EGAM7Stream = MSMgr.NewPoolRootStream( streamName, fileName ) #==================================================================== -# SKIMMING TOOLS +# SET UP SKIMMING #==================================================================== # SELECTION FOR BACKGROUND ESTIMATES @@ -108,15 +124,30 @@ triggers += ['HLT_e120_lhvloose' ] triggers += ['HLT_e120_lhloose' ] triggers += ['HLT_e120_loose' ] triggers += ['HLT_e120_vloose' ] +triggers += ['HLT_e140_etcut' ] +triggers += ['HLT_e160_etcut' ] +triggers += ['HLT_e180_etcut' ] +triggers += ['HLT_e200_etcut' ] +triggers += ['HLT_e250_etcut' ] +triggers += ['HLT_e300_etcut' ] +triggers += ['HLT_g250_etcut' ] +triggers += ['HLT_g300_etcut' ] expression = '(' + ' || '.join(triggers) + ') && '+objectSelection print expression from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool -EGAM7SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM7SkimmingTool", +EGAM7_SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM7_SkimmingTool", expression = expression) -ToolSvc += EGAM7SkimmingTool -print "EGAM7 skimming tool:", EGAM7SkimmingTool +ToolSvc += EGAM7_SkimmingTool +print "EGAM7 skimming tool:", EGAM7_SkimmingTool + + + +#==================================================================== +# SET UP AUGMENTATIONS +#==================================================================== + #==================================================================== # Gain and cluster energies per layer decoration tool @@ -129,7 +160,7 @@ cluster_sizes = (3,5), (5,7), (7,7), (7,11) EGAM7_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, nphi)() for neta, nphi in cluster_sizes] -#==================================================================== +#==================================================================== # Max Cell sum decoration tool #==================================================================== @@ -141,56 +172,172 @@ EGAM7_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name ToolSvc += EGAM7_MaxCellDecoratorTool -#================ -# THINNING -#================ -thinningTools=[] - +#==================================================================== +# SET UP THINNING +#==================================================================== +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM7ThinningHelper = ThinningHelper( "EGAM7ThinningHelper" ) +EGAM7ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(mu|j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_[eg].*))|HLT_e.*_Zee.*' +if globalflags.DataSource()!='geant4': + ExtraContainersTrigger += ExtraContainersTriggerDataOnly +EGAM7ThinningHelper.AppendToStream( EGAM7Stream, ExtraContainersTrigger ) +thinningTools=[] +# Track thinning +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = True + TrackThinningKeepPhotonTracks = True + TrackThinningKeepJetTracks = False + TrackThinningKeepMuonTracks = False + TrackThinningKeepTauTracks = False + TrackThinningKeepPVTracks = False + + # Tracks associated with Jets + if (TrackThinningKeepJetTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + EGAM7JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM7JetTPThinningTool", + ThinningService = EGAM7ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += EGAM7JetTPThinningTool + print EGAM7JetTPThinningTool + thinningTools.append(EGAM7JetTPThinningTool) + + # Tracks associated with Muons + if (TrackThinningKeepMuonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + EGAM7MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM7MuonTPThinningTool", + ThinningService = EGAM7ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM7MuonTPThinningTool + print EGAM7MuonTPThinningTool + thinningTools.append(EGAM7MuonTPThinningTool) + + # Tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM7ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM7ElectronTPThinningTool", + ThinningService = EGAM7ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM7ElectronTPThinningTool + print EGAM7ElectronTPThinningTool + thinningTools.append(EGAM7ElectronTPThinningTool) + + # Tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM7PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM7PhotonTPThinningTool", + ThinningService = EGAM7ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + + ToolSvc += EGAM7PhotonTPThinningTool + print EGAM7PhotonTPThinningTool + thinningTools.append(EGAM7PhotonTPThinningTool) + + # Tracks associated with Taus + if (TrackThinningKeepTauTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + EGAM7TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM7TauTPThinningTool", + ThinningService = EGAM7ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM7TauTPThinningTool + print EGAM7TauTPThinningTool + thinningTools.append(EGAM7TauTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM7TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM7TPThinningTool", + ThinningService = EGAM7ThinningHelper.ThinningSvc(), + SelectionString = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM7TPThinningTool + print EGAM7TPThinningTool + thinningTools.append(EGAM7TPThinningTool) # Truth thinning -truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs -truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons -truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark -truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon -truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles -truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' - -from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning -EGAM7TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM7TruthThinningTool", - StreamName = streamName, - ParticleSelectionString = truth_expression, - PreserveDescendants = False, - PreserveGeneratorDescendants = True, - PreserveAncestors = True) - -from AthenaCommon.GlobalFlags import globalflags -print "EGAM7 globalflags.DataSource(): ", globalflags.DataSource() if globalflags.DataSource()=='geant4': + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark + truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles + truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + EGAM7TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM7TruthThinningTool", + ThinningService = EGAM7ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + ToolSvc += EGAM7TruthThinningTool thinningTools.append(EGAM7TruthThinningTool) + print "EGAM7 thinningTools: ", thinningTools +#======================================= +# CREATE PRIVATE SEQUENCE +#======================================= +egam7Seq = CfgMgr.AthSequencer("EGAM7Sequence") +DerivationFrameworkJob += egam7Seq + + #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM7Kernel", - AugmentationTools = [EGAM7_GainDecoratorTool, EGAM7_MaxCellDecoratorTool] + EGAM7_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM7SkimmingTool], - ThinningTools = thinningTools - ) +egam7Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM7Kernel", + AugmentationTools = [EGAM7_GainDecoratorTool, EGAM7_MaxCellDecoratorTool] + EGAM7_ClusterEnergyPerLayerDecorators, + SkimmingTools = [EGAM7_SkimmingTool], + ThinningTools = thinningTools + ) + +#==================================================================== +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 +#==================================================================== +# od syntax +# addStandardJets("AntiKt", 0.4, "PV0Track", 2000, mods="track_ungroomed", algseq=egam7Seq, outputGroup="EGAM7") +# new syntax +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +reducedJetList = ["AntiKt4PV0TrackJets", "AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam7Seq,"EGAM7") + + +#============ Create Derivation EGAM7 cell collection ================== + +# Keep only calo cells associated with the egammaClusters collection +from DerivationFrameworkCalo.CaloCellDFGetter import CaloCellDFGetter +theCaloCellDFGetter = CaloCellDFGetter(inputClusterKeys=["egammaClusters"], + outputCellKey="DFEGAMCellContainer") +#======================================================================== + #==================================================================== -# SET UP STREAM +# SET UP STREAM SELECTION #==================================================================== -streamName = derivationFlags.WriteDAOD_EGAM7Stream.StreamName -fileName = buildFileName( derivationFlags.WriteDAOD_EGAM7Stream ) -EGAM7Stream = MSMgr.NewPoolRootStream( streamName, fileName ) # Only events that pass the filters listed below are written out. # Name must match that of the kernel above # AcceptAlgs = logical OR of filters @@ -198,29 +345,12 @@ EGAM7Stream = MSMgr.NewPoolRootStream( streamName, fileName ) EGAM7Stream.AcceptAlgs(["EGAM7Kernel"]) -#Special lines for thinning -# Thinning service name must match the one passed to the thinning tools -augStream = MSMgr.GetStream( streamName ) -evtStream = augStream.GetEventStream() - -#============ Thin cells for EGAM7 ================== - -# Keep only calo cells associated with the egammaClusters collection -from DerivationFrameworkCalo.CaloCellDFGetter import thinCaloCellsForDF -thinCaloCellsForDF (inputClusterKeys=["egammaClusters"], - streamName = EGAM7Stream.Name, - outputCellKey = "DFEGAMCellContainer") - -#======================================================================== - - #==================================================================== -# CONTENT LIST +# SET UP SLIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper EGAM7SlimmingHelper = SlimmingHelper("EGAM7SlimmingHelper") -from DerivationFrameworkEGamma.EGAM7ExtraContent import * EGAM7SlimmingHelper.SmartCollections = [ "Electrons", "Photons", @@ -228,7 +358,8 @@ EGAM7SlimmingHelper.SmartCollections = [ "TauJets", "MET_Reference_AntiKt4EMTopo", "AntiKt4EMTopoJets", - "BTagging_AntiKt4EMTopo", + "AntiKt4EMTopoJets_BTagging201810", + "BTagging_AntiKt4EMTopo_201810", "InDetTrackParticles", "PrimaryVertices" ] @@ -240,18 +371,22 @@ EGAM7SlimmingHelper.IncludeEGammaTriggerContent = True EGAM7SlimmingHelper.ExtraVariables = ExtraContentAll EGAM7SlimmingHelper.AllVariables = ExtraContainersElectrons EGAM7SlimmingHelper.AllVariables += ExtraContainersTrigger -#if globalflags.DataSource()!='geant4': -# EGAM7SlimmingHelper.AllVariables += ExtraContainersTriggerDataOnly if globalflags.DataSource()=='geant4': EGAM7SlimmingHelper.ExtraVariables += ExtraContentAllTruth EGAM7SlimmingHelper.AllVariables += ExtraContainersTruth +else: + EGAM7SlimmingHelper.ExtraVariables += ExtraContainersTriggerDataOnly for tool in EGAM7_ClusterEnergyPerLayerDecorators: EGAM7SlimmingHelper.ExtraVariables.extend( getClusterEnergyPerLayerDecorations( tool ) ) +# Add detailed shower shape variables +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * +EGAM7SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent +EGAM7SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent +from DerivationFrameworkEGamma.PhotonsCPDetailedContent import * +EGAM7SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent + # This line must come after we have finished configuring EGAM7SlimmingHelper EGAM7SlimmingHelper.AppendContentToStream(EGAM7Stream) - -# Add AODCellContainer (thinned) -EGAM7Stream.AddItem("CaloClusterCellLinkContainer#egammaClusters_links") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM8.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM8.py index 796e6c66127c23bce5474e1baceeb026fd151306..c62b7913e9562c04527a6d593e83b2290cba0267 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM8.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM8.py @@ -10,48 +10,46 @@ from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM8ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") +# this could also go in egammaDFFlags RecomputeElectronSelectors = True #RecomputeElectronSelectors = False +# check if we run on data or MC (DataSource = geant4) +from AthenaCommon.GlobalFlags import globalflags +print "EGAM8 globalflags.DataSource(): ", globalflags.DataSource() + #==================================================================== -# SET UP STREAM +# SET UP STREAM (to be done early in the game to set up thinning Svc #==================================================================== streamName = derivationFlags.WriteDAOD_EGAM8Stream.StreamName fileName = buildFileName( derivationFlags.WriteDAOD_EGAM8Stream ) EGAM8Stream = MSMgr.NewPoolRootStream( streamName, fileName ) -# Only events that pass the filters listed below are written out. -# Name must match that of the kernel above -# AcceptAlgs = logical OR of filters -# RequireAlgs = logical AND of filters -EGAM8Stream.AcceptAlgs(["EGAM8Kernel"]) -#Special lines for thinning -# Thinning service name must match the one passed to the thinning tools -augStream = MSMgr.GetStream( streamName ) -evtStream = augStream.GetEventStream() - #==================================================================== -# SKIMMING TOOLS +# SET UP SKIMMING #==================================================================== # SELECTION FOR T&P #==================================================================== # Z->ee selection based on single e trigger, for reco (central) and ID SF(central+fwd) -# 1 tight e, central, pT>25 GeV +# 1 medium e, central, pT>25 GeV # 1 forward e, pT>20 GeV # OS+SS, mee>50 GeV #==================================================================== -# switch to likelihood selectors only as soon as they're commissioned (and used in trigger) if RecomputeElectronSelectors : -# use medium for early data upon electron group request - requirement_tag = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' else : - requirement_tag = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium) && Electrons.pt > 24.5*GeV' + requirement_tag = '(Electrons.LHMedium) && Electrons.pt > 24.5*GeV' requirement_probe = 'ForwardElectrons.pt > 19.5*GeV' from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGInvariantMassTool EGAM8_ZEEMassTool = DerivationFramework__EGInvariantMassTool( name = "EGAM8_ZEEMassTool", @@ -96,10 +94,17 @@ print EGAM8_ZMuEMassTool # Skimming criteria expression = 'count(EGAM8_DiElectronMass > 50.0*GeV)>=1 || count(EGAM8_MuonElectronMass > 50.0*GeV)>=1' from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool -EGAM8SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM8SkimmingTool", +EGAM8_SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM8_SkimmingTool", expression = expression) -ToolSvc += EGAM8SkimmingTool -print "EGAM8 skimming tool:", EGAM8SkimmingTool +ToolSvc += EGAM8_SkimmingTool +print "EGAM8 skimming tool:", EGAM8_SkimmingTool + + + +#==================================================================== +# SET UP AUGMENTATIONS +#==================================================================== + #==================================================================== # Gain and cluster energies per layer decoration tool @@ -124,122 +129,177 @@ EGAM8_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name ToolSvc += EGAM8_MaxCellDecoratorTool -#================ -# THINNING -#================ +#==================================================================== +# SET UP THINNING +#==================================================================== + +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM8ThinningHelper = ThinningHelper( "EGAM8ThinningHelper" ) +EGAM8ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(mu|j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_[eg].*))|HLT_e.*_Zee.*' +if globalflags.DataSource()!='geant4': + ExtraContainersTrigger += ExtraContainersTriggerDataOnly +EGAM8ThinningHelper.AppendToStream( EGAM8Stream, ExtraContainersTrigger ) + thinningTools=[] -# Tracks associated with Jets -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning -EGAM8JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM8JetLCTPThinningTool", - StreamName = streamName, - JetKey = "AntiKt4EMTopoJets", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += EGAM8JetLCTPThinningTool -print EGAM8JetLCTPThinningTool -#thinningTools.append(EGAM8JetLCTPThinningTool) - -# Tracks associated with Muons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning -EGAM8MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM8MuonTPThinningTool", - StreamName = streamName, - MuonKey = "Muons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM8MuonTPThinningTool -print EGAM8MuonTPThinningTool -#thinningTools.append(EGAM8MuonTPThinningTool) - -# Tracks associated with Electrons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning -EGAM8ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM8ElectronTPThinningTool", - StreamName = streamName, - SGKey = "Electrons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM8ElectronTPThinningTool -print EGAM8ElectronTPThinningTool -#thinningTools.append(EGAM8ElectronTPThinningTool) - -# Tracks associated with Photons -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning -EGAM8PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM8PhotonTPThinningTool", - StreamName = streamName, - SGKey = "Photons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM8PhotonTPThinningTool -print EGAM8PhotonTPThinningTool -#thinningTools.append(EGAM8PhotonTPThinningTool) - -# Tracks associated with Taus -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning -EGAM8TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM8TauTPThinningTool", - StreamName = streamName, - TauKey = "TauJets", - ConeSize = 0.6, - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM8TauTPThinningTool -print EGAM8TauTPThinningTool -#thinningTools.append(EGAM8TauTPThinningTool) - -# Tracks from primary vertex -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -EGAM8TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM8TPThinningTool", - StreamName = streamName, - SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += EGAM8TPThinningTool -print EGAM8TPThinningTool -#thinningTools.append(EGAM8TPThinningTool) +# Track thinning +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = True + TrackThinningKeepPhotonTracks = True + TrackThinningKeepJetTracks = False + TrackThinningKeepMuonTracks = True + TrackThinningKeepTauTracks = False + TrackThinningKeepPVTracks = False + + # Tracks associated with Jets + if (TrackThinningKeepJetTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + EGAM8JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM8JetTPThinningTool", + ThinningService = EGAM8ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += EGAM8JetTPThinningTool + print EGAM8JetTPThinningTool + thinningTools.append(EGAM8JetTPThinningTool) + + # Tracks associated with Muons + if (TrackThinningKeepMuonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + EGAM8MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "EGAM8MuonTPThinningTool", + ThinningService = EGAM8ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM8MuonTPThinningTool + print EGAM8MuonTPThinningTool + thinningTools.append(EGAM8MuonTPThinningTool) + + # Tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM8ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM8ElectronTPThinningTool", + ThinningService = EGAM8ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM8ElectronTPThinningTool + print EGAM8ElectronTPThinningTool + thinningTools.append(EGAM8ElectronTPThinningTool) + + # Tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM8PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM8PhotonTPThinningTool", + ThinningService = EGAM8ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + + ToolSvc += EGAM8PhotonTPThinningTool + print EGAM8PhotonTPThinningTool + thinningTools.append(EGAM8PhotonTPThinningTool) + + # Tracks associated with Taus + if (TrackThinningKeepTauTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + EGAM8TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "EGAM8TauTPThinningTool", + ThinningService = EGAM8ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM8TauTPThinningTool + print EGAM8TauTPThinningTool + thinningTools.append(EGAM8TauTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM8TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM8TPThinningTool", + ThinningService = EGAM8ThinningHelper.ThinningSvc(), + SelectionString = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM8TPThinningTool + print EGAM8TPThinningTool + thinningTools.append(EGAM8TPThinningTool) # Truth thinning -truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs -truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons -truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark -truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon -truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles -truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' - -from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning -EGAM8TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM8TruthThinningTool", - StreamName = streamName, - ParticleSelectionString = truth_expression, - PreserveDescendants = False, - PreserveGeneratorDescendants = True, - PreserveAncestors = True) - -from AthenaCommon.GlobalFlags import globalflags -print "EGAM8 globalflags.DataSource(): ", globalflags.DataSource() if globalflags.DataSource()=='geant4': + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark + truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles + truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + EGAM8TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM8TruthThinningTool", + ThinningService = "EGAM8ThinningSvc", + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + + ToolSvc += EGAM8TruthThinningTool thinningTools.append(EGAM8TruthThinningTool) + print "EGAM8 thinningTools: ", thinningTools #======================================= -# CREATE THE DERIVATION KERNEL ALGORITHM +# CREATE PRIVATE SEQUENCE #======================================= +egam8Seq = CfgMgr.AthSequencer("EGAM8Sequence") +DerivationFrameworkJob += egam8Seq + + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM8Kernel", - AugmentationTools = [EGAM8_ZEEMassTool, EGAM8_ZMuEMassTool, EGAM8_GainDecoratorTool, EGAM8_MaxCellDecoratorTool] + EGAM8_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM8SkimmingTool], - ThinningTools = thinningTools - ) +egam8Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM8Kernel", + AugmentationTools = [EGAM8_ZEEMassTool, EGAM8_ZMuEMassTool, EGAM8_GainDecoratorTool, EGAM8_MaxCellDecoratorTool] + EGAM8_ClusterEnergyPerLayerDecorators, + SkimmingTools = [EGAM8_SkimmingTool], + ThinningTools = thinningTools + ) +#==================================================================== +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 +#==================================================================== +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +reducedJetList = ["AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam8Seq,"EGAM8") -#======================================================================== + +#==================================================================== +# SET UP STREAM SELECTION +#==================================================================== +# Only events that pass the filters listed below are written out. +# Name must match that of the kernel above +# AcceptAlgs = logical OR of filters +# RequireAlgs = logical AND of filters +EGAM8Stream.AcceptAlgs(["EGAM8Kernel"]) #==================================================================== -# CONTENT LIST +# SET UP SLIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper EGAM8SlimmingHelper = SlimmingHelper("EGAM8SlimmingHelper") -from DerivationFrameworkEGamma.EGAM8ExtraContent import * EGAM8SlimmingHelper.SmartCollections = [ "Electrons", "Photons", @@ -247,7 +307,8 @@ EGAM8SlimmingHelper.SmartCollections = [ "TauJets", "MET_Reference_AntiKt4EMTopo", "AntiKt4EMTopoJets", - "BTagging_AntiKt4EMTopo", + "AntiKt4EMTopoJets_BTagging201810", + "BTagging_AntiKt4EMTopo_201810", "InDetTrackParticles", "PrimaryVertices" ] @@ -261,23 +322,22 @@ EGAM8SlimmingHelper.IncludeMuonTriggerContent = True EGAM8SlimmingHelper.ExtraVariables = ExtraContentAll EGAM8SlimmingHelper.AllVariables = ExtraContainersElectrons EGAM8SlimmingHelper.AllVariables += ExtraContainersTrigger -if globalflags.DataSource()!='geant4': - EGAM8SlimmingHelper.AllVariables += ExtraContainersTriggerDataOnly if globalflags.DataSource()=='geant4': EGAM8SlimmingHelper.ExtraVariables += ExtraContentAllTruth EGAM8SlimmingHelper.AllVariables += ExtraContainersTruth +else: + EGAM8SlimmingHelper.ExtraVariables += ExtraContainersTriggerDataOnly for tool in EGAM8_ClusterEnergyPerLayerDecorators: EGAM8SlimmingHelper.ExtraVariables.extend( getClusterEnergyPerLayerDecorations( tool ) ) +# Add detailed shower shape variables +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * +EGAM8SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent +EGAM8SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent +from DerivationFrameworkEGamma.PhotonsCPDetailedContent import * +EGAM8SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent + # This line must come after we have finished configuring EGAM8SlimmingHelper EGAM8SlimmingHelper.AppendContentToStream(EGAM8Stream) - -# Add MET_RefFinalFix -# JRC: COMMENTED TEMPORARILY -#addMETOutputs(EGAM8Stream) - -# Add Derived Egamma CellContainer -from DerivationFrameworkEGamma.EGammaCellCommon import CellCommonThinning -CellCommonThinning(EGAM8Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM9.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM9.py index 6f69bc95f4eaa0812577688e7155424754a4046a..a13d27fba4cf9ba315b046a4d5e48d72551922dd 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM9.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM9.py @@ -1,7 +1,6 @@ #******************************************************************** # EGAM9.py - keep events passing or of photon triggers used for # boostrap efficiency measurement of photon triggers -# fake electron candidates # reductionConf flag EGAM9 in Reco_tf.py # author: fernando.monticelli@cern.ch #******************************************************************** @@ -12,10 +11,27 @@ from DerivationFrameworkMuons.MuonsCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.EGAM9ExtraContent import * + +# read common DFEGamma settings from egammaDFFlags +from DerivationFrameworkEGamma.egammaDFFlags import jobproperties +jobproperties.egammaDFFlags.print_JobProperties("full") + +# check if we run on data or MC +from AthenaCommon.GlobalFlags import globalflags +print "EGAM9 globalflags.DataSource(): ", globalflags.DataSource() + + +#==================================================================== +# SET UP STREAM (to be done early in the game to set up thinning Svc +#==================================================================== +streamName = derivationFlags.WriteDAOD_EGAM9Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_EGAM9Stream ) +EGAM9Stream = MSMgr.NewPoolRootStream( streamName, fileName ) #==================================================================== -# SKIMMING TOOLS +# SET UP SKIMMING #==================================================================== # SELECTION FOR BACKGROUND ESTIMATES @@ -34,35 +50,59 @@ objectSelection = '( (' + photon_selection + ') || ('+ electron_selection +' ) ) triggers =[] -# HLT_noalg_ triggers for 2016 run +# HLT_noalg_ triggers triggers += ['HLT_noalg_L1EM15VH'] +triggers += ['HLT_noalg_L1EM12'] +triggers += ['HLT_noalg_L1EM15'] +triggers += ['HLT_noalg_L1EM18VH'] +triggers += ['HLT_noalg_L1EM20VH'] +triggers += ['HLT_noalg_L1EM10'] +triggers += ['HLT_noalg_L1EM10VH'] +triggers += ['HLT_noalg_L1EM13VH'] +triggers += ['HLT_noalg_L1EM20VHI'] +triggers += ['HLT_noalg_L1EM22VHI'] +triggers += ['HLT_noalg_L1EM8VH'] # pt_cut triggers triggers += ['HLT_g20_etcut_L1EM12'] -# Passed through triggers -triggers += ['HLT_g10_loose' ] -triggers += ['HLT_g20_loose_L1EM12' ] - -# additional low pt HLT loose triggers -triggers += ['HLT_g20_loose' ] - -# additional BT for high pt HLT loose triggers -triggers += ['HLT_g60_loose' ] +# Passed through triggers for bootstrapping +triggers += ['HLT_g10_loose'] +triggers += ['HLT_g15_loose_L1EM7'] +triggers += ['HLT_g20_loose_L1EM12'] +triggers += ['HLT_g20_loose'] +triggers += ['HLT_g25_loose_L1EM15'] +triggers += ['HLT_g60_loose'] +triggers += ['HLT_g100_loose'] +triggers += ['HLT_g120_loose'] +triggers += ['HLT_g160_loose'] +triggers += ['HLT_g160_loose_L1EM24VHIM'] +triggers += ['HLT_g180_loose'] +triggers += ['HLT_g180_loose_L1EM24VHIM'] +triggers += ['HLT_g35_loose_L1EM15'] +triggers += ['HLT_g40_loose_L1EM15'] +triggers += ['HLT_g45_loose_L1EM15'] +triggers += ['HLT_g50_loose_L1EM15'] +triggers += ['HLT_g70_loose'] +triggers += ['HLT_g80_loose'] +triggers += ['HLT_g140_loose'] +triggers += ['HLT_g200_loose'] -# higher-pT triggers, to bootstrap g140_loose and g140_tight triggers -triggers += ['HLT_g100_loose' ] -triggers += ['HLT_g120_loose' ] expression = '(' + ' || '.join(triggers) + ') && '+objectSelection print expression from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool -EGAM9SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM9SkimmingTool", +EGAM9_SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "EGAM9_SkimmingTool", expression = expression) -ToolSvc += EGAM9SkimmingTool -print "EGAM9 skimming tool:", EGAM9SkimmingTool +ToolSvc += EGAM9_SkimmingTool +print "EGAM9 skimming tool:", EGAM9_SkimmingTool + + +#==================================================================== +# SET UP AUGMENTATIONS +#==================================================================== #==================================================================== @@ -76,7 +116,6 @@ cluster_sizes = (3,5), (5,7), (7,7), (7,11) EGAM9_ClusterEnergyPerLayerDecorators = [getClusterEnergyPerLayerDecorator(neta, nphi)() for neta, nphi in cluster_sizes] - #==================================================================== # Max Cell sum decoration tool #==================================================================== @@ -89,84 +128,150 @@ EGAM9_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name ToolSvc += EGAM9_MaxCellDecoratorTool -#================ -# THINNING -#================ -thinningTools=[] +#==================================================================== +# SET UP THINNING +#==================================================================== +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +EGAM9ThinningHelper = ThinningHelper( "EGAM9ThinningHelper" ) +EGAM9ThinningHelper.TriggerChains = '(^(?!.*_[0-9]*(mu|j|xe|tau|ht|xs|te))(?!HLT_[eg].*_[0-9]*[eg][0-9].*)(?!HLT_eb.*)(?!.*larpeb.*)(?!HLT_.*_AFP_.*)(HLT_[eg].*))' +if globalflags.DataSource()!='geant4': + ExtraContainersTrigger += ExtraContainersTriggerDataOnly +EGAM9ThinningHelper.AppendToStream( EGAM9Stream, ExtraContainersTrigger ) +thinningTools=[] # Truth thinning -truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs -truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons -truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark -truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon -truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles -truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' - -from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning -EGAM9TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM9TruthThinningTool", - StreamName = streamName, - ParticleSelectionString = truth_expression, - PreserveDescendants = False, - PreserveGeneratorDescendants = True, - PreserveAncestors = True) - -from AthenaCommon.GlobalFlags import globalflags -print "EGAM9 globalflags.DataSource(): ", globalflags.DataSource() if globalflags.DataSource()=='geant4': + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_top = "((abs(TruthParticles.pdgId) == 6))" # Top quark + truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles + truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + EGAM9TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "EGAM9TruthThinningTool", + ThinningService = EGAM9ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + + ToolSvc += EGAM9TruthThinningTool thinningTools.append(EGAM9TruthThinningTool) + + +# Track thinning +if jobproperties.egammaDFFlags.doEGammaDAODTrackThinning: + + TrackThinningKeepElectronTracks = False + TrackThinningKeepPhotonTracks = True + TrackThinningKeepPVTracks = False + + # tracks associated with Electrons + if (TrackThinningKeepElectronTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM9ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM9ElectronTPThinningTool", + ThinningService = EGAM9ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Electrons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + ToolSvc += EGAM9ElectronTPThinningTool + print EGAM9ElectronTPThinningTool + thinningTools.append(EGAM9ElectronTPThinningTool) + + # tracks associated with Photons + if (TrackThinningKeepPhotonTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + EGAM9PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "EGAM9PhotonTPThinningTool", + ThinningService = EGAM9ThinningHelper.ThinningSvc(), + SGKey = "Photons", + GSFTrackParticlesKey = "GSFTrackParticles", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "Photons.pt > 0*GeV", + BestMatchOnly = True, + ConeSize = 0.3, + ApplyAnd = False) + + ToolSvc += EGAM9PhotonTPThinningTool + print EGAM9PhotonTPThinningTool + thinningTools.append(EGAM9PhotonTPThinningTool) + + # Tracks from primary vertex + if (TrackThinningKeepPVTracks) : + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning + EGAM9TPThinningTool = DerivationFramework__TrackParticleThinning( name = "EGAM9TPThinningTool", + ThinningService = EGAM9ThinningHelper.ThinningSvc(), + SelectionString = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm", + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += EGAM9TPThinningTool + print EGAM9TPThinningTool + thinningTools.append(EGAM9TPThinningTool) + print "EGAM9 thinningTools: ", thinningTools +#======================================= +# CREATE PRIVATE SEQUENCE +#======================================= +egam9Seq = CfgMgr.AthSequencer("EGAM9Sequence") +DerivationFrameworkJob += egam9Seq + + + #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("EGAM9Kernel", - AugmentationTools = [EGAM9_GainDecoratorTool, EGAM9_MaxCellDecoratorTool] + EGAM9_ClusterEnergyPerLayerDecorators, - SkimmingTools = [EGAM9SkimmingTool], - ThinningTools = thinningTools - ) +egam9Seq += CfgMgr.DerivationFramework__DerivationKernel("EGAM9Kernel", + AugmentationTools = [EGAM9_GainDecoratorTool, EGAM9_MaxCellDecoratorTool] + EGAM9_ClusterEnergyPerLayerDecorators, + SkimmingTools = [EGAM9_SkimmingTool], + ThinningTools = thinningTools + ) + #==================================================================== -# SET UP STREAM +# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21 #==================================================================== -streamName = derivationFlags.WriteDAOD_EGAM9Stream.StreamName -fileName = buildFileName( derivationFlags.WriteDAOD_EGAM9Stream ) -EGAM9Stream = MSMgr.NewPoolRootStream( streamName, fileName ) -# Only events that pass the filters listed below are written out. -# Name must match that of the kernel above -# AcceptAlgs = logical OR of filters -# RequireAlgs = logical AND of filters -EGAM9Stream.AcceptAlgs(["EGAM9Kernel"]) +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import replaceAODReducedJets +reducedJetList = ["AntiKt4TruthJets"] +replaceAODReducedJets(reducedJetList,egam9Seq,"EGAM9") -#Special lines for thinning -# Thinning service name must match the one passed to the thinning tools -augStream = MSMgr.GetStream( streamName ) -evtStream = augStream.GetEventStream() -#============ Thin cells for EGAM9 ================== +#============ Create Derivation EGAM9 cell collection ================== # Keep only calo cells associated with the egammaClusters collection -from DerivationFrameworkCalo.CaloCellDFGetter import thinCaloCellsForDF -thinCaloCellsForDF (inputClusterKeys=["egammaClusters"], - streamName = EGAM9Stream.Name, - outputCellKey = "DFEGAMCellContainer") +from DerivationFrameworkCalo.CaloCellDFGetter import CaloCellDFGetter +theCaloCellDFGetter = CaloCellDFGetter(inputClusterKeys=["egammaClusters"], + outputCellKey="DFEGAMCellContainer") #======================================================================== #==================================================================== -# CONTENT LIST +# SET UP STREAM SELECTION +#==================================================================== +# Only events that pass the filters listed below are written out. +# Name must match that of the kernel above +# AcceptAlgs = logical OR of filters +# RequireAlgs = logical AND of filters +EGAM9Stream.AcceptAlgs(["EGAM9Kernel"]) + + +#==================================================================== +# SET UP SLIMMING #==================================================================== from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper -from DerivationFrameworkEGamma.EGAM9ExtraContent import * # Keep only electrons and photons EGAM9SlimmingHelper = SlimmingHelper("EGAM9SlimmingHelper") @@ -185,18 +290,22 @@ EGAM9SlimmingHelper.ExtraVariables = ExtraContentAll EGAM9SlimmingHelper.AllVariables = ExtraContainersElectrons EGAM9SlimmingHelper.AllVariables += ExtraContainersPhotons EGAM9SlimmingHelper.AllVariables += ExtraContainersTrigger -if globalflags.DataSource()!='geant4': - EGAM9SlimmingHelper.AllVariables += ExtraContainersTriggerDataOnly if globalflags.DataSource()=='geant4': EGAM9SlimmingHelper.ExtraVariables += ExtraContentAllTruth EGAM9SlimmingHelper.AllVariables += ExtraContainersTruth +else: + EGAM9SlimmingHelper.ExtraVariables += ExtraContainersTriggerDataOnly for tool in EGAM9_ClusterEnergyPerLayerDecorators: EGAM9SlimmingHelper.ExtraVariables.extend( getClusterEnergyPerLayerDecorations( tool ) ) +# Add detailed shower shape variables +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * +EGAM9SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent +EGAM9SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent +from DerivationFrameworkEGamma.PhotonsCPDetailedContent import * +EGAM9SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent + # This line must come after we have finished configuring EGAM9SlimmingHelper EGAM9SlimmingHelper.AppendContentToStream(EGAM9Stream) - -# Add AODCellContainer (thinned) -EGAM9Stream.AddItem("CaloClusterCellLinkContainer#egammaClusters_links") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/BkgElectronClassification.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/BkgElectronClassification.cxx index 53179354a5a8fae1904ba48a0fa90ea397938de6..dfe0c1eaf3f17710a0daaf48f521905fbee42172 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/BkgElectronClassification.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/BkgElectronClassification.cxx @@ -66,45 +66,12 @@ namespace DerivationFramework { if(tPL.isAvailable(*el) && tPL(*el).isValid() ){ tPdgID(*el)=(*tPL(*el))->pdgId(); } - // - //Additional info for electron coming from photons or another electron, - //not produced by the std egamma reconstruction - // - //use the Classifier for the bkg Electron - //Add Extra Decoration from Classifier in case of BkgElectron (Electron coming for a photon) - static SG::AuxElement::Decorator<int> bkgTT("bkgTruthType") ; - static SG::AuxElement::Decorator<int> bkgTO("bkgTruthOrigin") ; - static SG::AuxElement::Decorator<ElementLink<xAOD::TruthParticleContainer> > bkgTPL ("bkgTruthParticleLink"); - static SG::AuxElement::Decorator<int> bkgMotherPdgID("bkgMotherPdgId") ; - bkgTT(*el)= 0; - bkgTO(*el)= 0; - bkgTPL(*el)=ElementLink<xAOD::TruthParticleContainer>(); - bkgMotherPdgID(*el)=0; - - if(tT.isAvailable(*el) && tO.isAvailable(*el) && - tPL.isAvailable(*el) && tPL(*el).isValid() && - tT(*el)==MCTruthPartClassifier::BkgElectron){ - -#ifdef MCTRUTHCLASSIFIER_CONST - IMCTruthClassifier::Info info; - auto res = m_mcTruthClassifier->checkOrigOfBkgElec(*tPL(*el), &info); - const xAOD::TruthParticle* truthParticle= info.bkgElecMother; -#else - auto res = m_mcTruthClassifier->checkOrigOfBkgElec(*tPL(*el)); - const xAOD::TruthParticle* truthParticle= m_mcTruthClassifier->getBkgElecMother(); -#endif - bkgTT(*el)= res.first; - bkgTO(*el)= res.second; - if(truthParticle){ - ElementLink<xAOD::TruthParticleContainer> link(truthParticle, *truthContainer); - bkgTPL(*el)=link; - bkgMotherPdgID(*el)=truthParticle->pdgId(); - } - } - // - //use the Helpers for electron from electron or photon + + //Use the Helpers for electron from electron or photon //Add Extra Decoration from Egamma helpers in case of BkgElectron (Electron coming for a photon) - //Go back to the last electron/photon mother and classify this one + //Go back to the first/last electron/photon Generator mother and classify this one + + //First the one entering the Geant, the first we meet on the way back static SG::AuxElement::Decorator<int> firstEgMotherTT("firstEgMotherTruthType") ; static SG::AuxElement::Decorator<int> firstEgMotherTO("firstEgMotherTruthOrigin") ; static SG::AuxElement::Decorator<ElementLink<xAOD::TruthParticleContainer> > firstEgMotherTPL ("firstEgMotherTruthParticleLink"); @@ -113,18 +80,35 @@ namespace DerivationFramework { firstEgMotherTO(*el)= 0; firstEgMotherTPL(*el)=ElementLink<xAOD::TruthParticleContainer>(); firstEgMotherPdgID(*el)=0; - // - const xAOD::TruthParticle* eltruth = xAOD::EgammaHelpers::getBkgElectronMother(el,m_barcodecut); - if(eltruth){ - auto res = m_mcTruthClassifier->particleTruthClassifier(eltruth); + const xAOD::TruthParticle* firstElTruth = xAOD::EgammaHelpers::getBkgElectronMother(el,m_barcodecut); + if( firstElTruth ){ + auto res = m_mcTruthClassifier->particleTruthClassifier(firstElTruth); firstEgMotherTT(*el)= res.first; firstEgMotherTO(*el)= res.second; - firstEgMotherPdgID(*el)=eltruth->pdgId(); - ElementLink<xAOD::TruthParticleContainer> link(eltruth, *truthContainer); + firstEgMotherPdgID(*el)=firstElTruth->pdgId(); + ElementLink<xAOD::TruthParticleContainer> link( firstElTruth , *truthContainer); firstEgMotherTPL(*el)=link; } - // - // + + //The last electron / photon we meet on the way back towards the Generator vertex + static SG::AuxElement::Decorator<int> lastEgMotherTT("lastEgMotherTruthType") ; + static SG::AuxElement::Decorator<int> lastEgMotherTO("lastEgMotherTruthOrigin") ; + static SG::AuxElement::Decorator<ElementLink<xAOD::TruthParticleContainer> > lastEgMotherTPL ("lastEgMotherTruthParticleLink"); + static SG::AuxElement::Decorator<int> lastEgMotherPdgID("lastEgMotherPdgId") ; + lastEgMotherTT(*el)= 0; + lastEgMotherTO(*el)= 0; + lastEgMotherTPL(*el)=ElementLink<xAOD::TruthParticleContainer>();; + lastEgMotherPdgID(*el)=0; + const xAOD::TruthParticle* lastElTruth = xAOD::EgammaHelpers::getBkgElectronMother(el); + if( lastElTruth ){ + auto res = m_mcTruthClassifier->particleTruthClassifier(lastElTruth); + lastEgMotherTT(*el)= res.first; + lastEgMotherTO(*el)= res.second; + lastEgMotherPdgID(*el)=lastElTruth->pdgId(); + ElementLink<xAOD::TruthParticleContainer> link( lastElTruth , *truthContainer); + lastEgMotherTPL(*el)=link; + } + } return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGCrackVetoCleaningTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGCrackVetoCleaningTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..09f839cbfd8bcc9fdbb756a92fb2808d5816cb41 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGCrackVetoCleaningTool.cxx @@ -0,0 +1,95 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EGCrackVetoCleaningTool.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// + +#include "DerivationFrameworkEGamma/EGCrackVetoCleaningTool.h" +#include "xAODEgamma/EgammaContainer.h" +#include "xAODEgamma/EgammaxAODHelpers.h" + +namespace DerivationFramework { + + EGCrackVetoCleaningTool::EGCrackVetoCleaningTool(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t,n,p), + m_sgName(""), + m_containerName("") + { + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("StoreGateEntryName", m_sgName); + declareProperty("ContainerName", m_containerName); + } + + StatusCode EGCrackVetoCleaningTool::initialize() + { + if (m_sgName=="") { + ATH_MSG_ERROR("No SG name provided for the output of EGCrackVetoCleaningTool!"); + return StatusCode::FAILURE; + } + if (m_containerName!="Photons" && m_containerName!="Electrons" && m_containerName!="ForwardElectrons") { + ATH_MSG_ERROR("Wrong container provided!"); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; + } + + StatusCode EGCrackVetoCleaningTool::finalize() + { + return StatusCode::SUCCESS; + } + + StatusCode EGCrackVetoCleaningTool::addBranches() const + { + // retrieve container + const xAOD::EgammaContainer* particles = evtStore()->retrieve< const xAOD::EgammaContainer >( m_containerName ); + if( ! particles ) { + ATH_MSG_ERROR ("Couldn't retrieve IParticles with key: " << m_containerName ); + return StatusCode::FAILURE; + } + + // Decorator + SG::AuxElement::Decorator< char > decoratorPass(m_sgName); + + // In principle could use meta-data to do the loop only if mc16a/data15+16 + + // Write mask for each element and record to SG for subsequent selection + for (xAOD::EgammaContainer::const_iterator pItr = particles->begin(); pItr!=particles->end(); ++pItr) { + + xAOD::Type::ObjectType type = (*pItr)->type(); + if (type!=xAOD::Type::Electron && type!=xAOD::Type::Photon) { + ATH_MSG_ERROR ("addBranches(): Wrong particle type (not electron nor photon) being passed to EGCrackVetoCleaningTool"); + return StatusCode::FAILURE; + } + if (type==xAOD::Type::Electron && m_containerName!="Electrons") { + ATH_MSG_ERROR ("addBranches(): Wrong particle type being passed to EGCrackVetoCleaningTool"); + return StatusCode::FAILURE; + } + if (type==xAOD::Type::Photon && m_containerName!="Photons") { + ATH_MSG_ERROR ("addBranches(): Wrong particle type being passed to EGCrackVetoCleaningTool"); + return StatusCode::FAILURE; + } + + const xAOD::Egamma* pCopy = *pItr; + + const xAOD::CaloCluster *clu = pCopy->caloCluster(); + bool maybeBug = clu->hasSampling(CaloSampling::EMB2) && clu->hasSampling(CaloSampling::EME2); + const std::vector<const xAOD::CaloCluster*> assocC = xAOD::EgammaHelpers::getAssociatedTopoClusters(clu); + double dRsatMax = -1.; + if (assocC.size() > 1) { + for (auto sclu : assocC) { + double dR = clu->p4().DeltaR(sclu->p4()); + if (dR > dRsatMax) + dRsatMax = dR; + } + } + decoratorPass(*pCopy) = !(maybeBug && assocC.size() > 1 && dRsatMax > 0.16); // (or dPhi > 0.15 better ?) + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronAmbiguityTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronAmbiguityTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2846a1174ec893cbe369cd141d77274bd120130e --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronAmbiguityTool.cxx @@ -0,0 +1,410 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EGElectronAmbiguityTool.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// +// + +#include "DerivationFrameworkEGamma/EGElectronAmbiguityTool.h" + +#include "xAODTruth/xAODTruthHelpers.h" +#include "xAODEgamma/ElectronxAODHelpers.h" + +#include "xAODEgamma/ElectronContainer.h" +#include "xAODTracking/VertexContainer.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTruth/TruthParticle.h" +#include "xAODTruth/TruthVertex.h" +#include "AthContainers/ConstDataVector.h" + +#include "TMath.h" + +namespace { + SG::AuxElement::Decorator< float > drv("DFCommonSimpleConvRadius"); + SG::AuxElement::Decorator< float > dphiv("DFCommonSimpleConvPhi"); + SG::AuxElement::Decorator< float > dmee("DFCommonSimpleMee"); + SG::AuxElement::Decorator< float > dmeeVtx("DFCommonSimpleMeeAtVtx"); + SG::AuxElement::Decorator< float > dsep("DFCommonSimpleSeparation"); + SG::AuxElement::Decorator< int > dambi("DFCommonAddAmbiguity"); + + SG::AuxElement::Decorator< float > dtrv("DFCommonProdTrueRadius"); + SG::AuxElement::Decorator< float > dtpv("DFCommonProdTruePhi"); + SG::AuxElement::Decorator< float > dtzv("DFCommonProdTrueZ"); +} //> end anonymous namespace + +namespace DerivationFramework { + + EGElectronAmbiguityTool::EGElectronAmbiguityTool(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t,n,p) + { + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("ContainerName", m_containerName = "Electrons"); + declareProperty("VtxContainerName", m_VtxContainerName = "PrimaryVertices"); + declareProperty("tpContainerName", m_tpContainerName = "InDetTrackParticles"); + + declareProperty("isMC", m_isMC); + + declareProperty("pTCut", m_elepTCut = 9e3, "minimum pT for an electron to be studied"); + declareProperty("idCut", m_idCut = "DFCommonElectronsLHLoose", "minimal quality for an electron to be studied"); + + declareProperty("nSiCut", m_nSiCut = 7, "minimum number of Si hits in the other track"); + declareProperty("dzsinTCut", m_dzCut = 0.5, "max dz sinTheta between ele and other tracks"); + declareProperty("SeparationCut", m_sepCut = 1., "first separation cut"); + declareProperty("DCTCut", m_dctCut = 0.02, "second separation cut"); + + declareProperty("radiusCut", m_rvECCut = 20, "minimum radius to be classified as external conversion"); + declareProperty("meeAtVtxCut", m_meeAtVtxECCut = 100, "maximal mass at vertex to be classified as external conversion"); + declareProperty("meeCut", m_meeICCut = 100, "maximal mass at primary vertex to be classified as gamma*"); + + } + + StatusCode EGElectronAmbiguityTool::addBranches() const + { + + static SG::AuxElement::ConstAccessor<char> aidCut(m_idCut); + + // retrieve primary vertex + const xAOD::Vertex *pvtx(nullptr); + const xAOD::VertexContainer *vtxC(nullptr); + if (evtStore()->retrieve(vtxC,m_VtxContainerName).isFailure()) { + ATH_MSG_ERROR( "Failed to retrieve vertex container. Exiting." ); + return StatusCode::FAILURE; + } + for (auto vertex: *vtxC) { + if (vertex->vertexType() == xAOD::VxType::VertexType::PriVtx) { + pvtx = vertex; + break; + } + } + + + // retrieve electron container + const xAOD::ElectronContainer* eleC = evtStore()->retrieve< const xAOD::ElectronContainer >( m_containerName ); + + if( ! eleC ) { + ATH_MSG_ERROR ("Couldn't retrieve Electron container with key: " << m_containerName ); + return StatusCode::FAILURE; + } + if (!pvtx) { + ATH_MSG_DEBUG("No primary vertex found. Setting default values."); + for (const xAOD::Electron* iele : *eleC) { + drv(*iele) = -1; + dphiv(*iele) = -1; + dmee(*iele) = -1; + dmeeVtx(*iele) = -1; + dsep(*iele) = -1; + dambi(*iele) = -1; + dtrv(*iele) = -1; + dtpv(*iele) = -1; + dtzv(*iele) = -1; + } + return StatusCode::SUCCESS; + } + ATH_MSG_DEBUG("Pvx z = " << pvtx->z() << ", number of electrons " << eleC->size()); + + // Make a container of selected tracks : with Si hits, close to electron track + const xAOD::TrackParticleContainer* idtpC(nullptr); + if (evtStore()->retrieve(idtpC,"InDetTrackParticles").isFailure()) { + ATH_MSG_ERROR("No InDetTrackParticles container found"); + return StatusCode::FAILURE; + } + std::set<const xAOD::TrackParticle*> alreadyStored; + std::set<const xAOD::TrackParticle*> eleIDtpStored, eleGSFtpStored; + auto closeByTracks = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(SG::VIEW_ELEMENTS); + + for (auto ele : *eleC) { + + dambi(*ele) = -1; + + // Electron preselection + if (ele->pt() < m_elepTCut || !(m_idCut.size() && aidCut.isAvailable(*ele) && aidCut(*ele))) + continue; + + // Just for debug + const xAOD::TrackParticle *eleGSFtp = ele->trackParticle(); + if (eleGSFtpStored.find(eleGSFtp) == eleGSFtpStored.end()) + eleGSFtpStored.insert(eleGSFtp); + + const xAOD::TrackParticle *eleIDtp = xAOD::EgammaHelpers::getOriginalTrackParticle(ele); + if (eleIDtpStored.find(eleIDtp) == eleIDtpStored.end()) + eleIDtpStored.insert(eleIDtp); + + // The loop on track + for (auto tp : *idtpC) { + + // Keep the electron track (I build a container to run vertexing on it...) + if (tp == eleIDtp) { + closeByTracks->push_back(tp); + alreadyStored.insert(tp); + continue; + } + + // potential candidate to store if not already there + if (alreadyStored.find(tp) != alreadyStored.end()) + continue; + + //// Keep only opposite charge + //if (tp->charge() * ele->charge() > 0) + // continue; + + // Close-by + double dR = eleIDtp->p4().DeltaR(tp->p4()); + double dz = fabs(eleIDtp->z0()-tp->z0())*sin(eleIDtp->theta()); + if (!(dR < 0.3 && dz < m_dzCut)) + continue; + + // With minimum number of Si hits + if (xAOD::EgammaHelpers::numberOfSiHits(tp) < m_nSiCut) + continue; + + alreadyStored.insert(tp); + + closeByTracks->push_back(tp); + } + } + + if (closeByTracks->size() == 0) + return StatusCode::SUCCESS; + + // Record the objects into the event store + if (evtStore()->record ( closeByTracks.release(), "closeByTrackParticles").isFailure()) { + ATH_MSG_ERROR("Could not record the skimmed track particle container"); + return StatusCode::FAILURE; + } + + // + const xAOD::TrackParticleContainer* idSeltpC(nullptr); + if (msgLvl(MSG::DEBUG)) { + if (evtStore()->retrieve(idSeltpC,"closeByTrackParticles").isFailure()) { + ATH_MSG_ERROR("No closeByTrackParticles container found"); + return StatusCode::FAILURE; + } + const xAOD::TrackParticleContainer* tpC(nullptr); + if (evtStore()->retrieve(tpC,"GSFTrackParticles").isFailure()) { + ATH_MSG_ERROR("No TrackParticleInputContainer found"); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("Number of input tracks " << idtpC->size() << " , number of selected close-by tracks " << idSeltpC->size() << " , number of GSF tracks " << tpC->size()); + for (auto trk : eleIDtpStored) + ATH_MSG_DEBUG("ele ID trk " << trk << " pt = " << trk->pt()*1e-3 << " eta = " << trk->eta() << " phi = " << trk->phi() << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk)); + for (auto trk : eleGSFtpStored) + ATH_MSG_DEBUG("ele GSF trk " << trk << " pt = " << trk->pt()*1e-3 << " eta = " << trk->eta() << " phi = " << trk->phi() << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk)); + for (auto trk : *idSeltpC) + ATH_MSG_DEBUG("closeby trk " << trk << " pt = " << trk->pt()*1e-3 << " eta = " << trk->eta() << " phi = " << trk->phi() << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk)); + } + + for (auto ele : *eleC) { + + // Electron preselection + if (ele->pt() < m_elepTCut || !(m_idCut.size() && aidCut.isAvailable(*ele) && aidCut(*ele))) + continue; + + // Henri's circles + if (decorateSimple(ele,pvtx).isFailure()) { + ATH_MSG_ERROR("Cannot decorate the electron with the simple info"); + return StatusCode::FAILURE; + } + + } // loop on electrons to decorate + + return StatusCode::SUCCESS; + } +} + +StatusCode DerivationFramework::EGElectronAmbiguityTool::decorateSimple(const xAOD::Electron *ele, const xAOD::Vertex *pvtx) const { + + + // This is the GSF electron track + const xAOD::TrackParticle *eleGSFtrkP = ele->trackParticle(); + + // And the ID one + const xAOD::TrackParticle *eleIDtrkP = xAOD::EgammaHelpers::getOriginalTrackParticle(ele); + + // For the time being, use the ID one, to be consistent when we only find a good ID to make a conversion and no GSF + bool useGSF = false; // hardcoded because it seems we will not use true. Kept for the time being, as not 100% sure + const xAOD::TrackParticle *eletrkP = useGSF ? eleGSFtrkP : eleIDtrkP; + + ATH_MSG_DEBUG("Electron pt = " << ele->pt()*1e-3 << " eta = " << ele->eta() << " phi = " << ele->phi() << " GSF trk ptr = " << eleGSFtrkP << " ID trk ptr " << eleIDtrkP); + + if (m_isMC) { + const xAOD::TruthParticle *truthEl = xAOD::TruthHelpers::getTruthParticle(*ele); + double tpvr = -1, tpvp = 9e9, tpvz = 9e9; + if (truthEl && fabs(truthEl->pdgId()) == 11 && truthEl->prodVtx() != nullptr) { + tpvr = truthEl->prodVtx()->perp(); + tpvp = truthEl->prodVtx()->phi(); + tpvz = truthEl->prodVtx()->z(); + } + dtrv(*ele) = tpvr; + dtpv(*ele) = tpvp; + dtzv(*ele) = tpvz; + } + + // Find the closest track particle with opposite charge and a minimum nb of Si hits + const xAOD::TrackParticleContainer *tpC(nullptr); + if (evtStore()->retrieve(tpC,"closeByTrackParticles").isFailure()) { + ATH_MSG_ERROR ("Failed to retrieve track particle container. Exiting." ); + return StatusCode::FAILURE; + } + const xAOD::TrackParticle *otrkP(nullptr); + double detaMin = 9e9; + for (auto tp : *tpC) { + // Keep only opposite charge + if (tp->charge() * eletrkP->charge() > 0) + continue; + + // Close-by + double dR = eletrkP->p4().DeltaR(tp->p4()); + double dz = fabs(eletrkP->z0()-tp->z0())*sin(eletrkP->theta()); + if (!(dR < 0.3 && dz < m_dzCut)) + continue; + + double deta = fabs(eletrkP->eta() - tp->eta()); + if (deta < detaMin) { + otrkP = tp; + detaMin = deta; + } + } + + double rv = -9e9; + double pv = -9e9; + double mee = -1.; + double meeAtVtx = -1.; + double sep = -9e9; + bool goodConv = false; + + if (otrkP) { + + // To be consistent with the other, use the ID track. + TLorentzVector ep4; ep4.SetPtEtaPhiM(eletrkP->pt(),eletrkP->eta(),eletrkP->phi(),0.511); + + // Maybe could see if a GSF tp exists for this ID tp and use it if yes ? + TLorentzVector op4; op4.SetPtEtaPhiM(otrkP->pt(),otrkP->eta(),otrkP->phi(),0.511); + + // Simple masses + mee = (ep4+op4).M(); + op4.SetPhi(eletrkP->phi()); + meeAtVtx = (ep4+op4).M(); + + // And the conversion point + std::vector<double> helix1, helix2; + helix1.resize(5); + helix2.resize(5); + helix(eletrkP,pvtx,helix1); + helix(otrkP,pvtx,helix2); + + double beta(0.); + if (helix1[4] < helix2[4]) + beta = TMath::PiOver2()-helix1[4]; + else + beta = TMath::PiOver2()-helix2[4]; + + double phi1(helix1[4] + beta); + if (phi1 > TMath::TwoPi()) phi1 -= TMath::TwoPi(); + if (phi1 < 0.) phi1 += TMath::TwoPi(); + + double phi2(helix2[4] + beta); + if (phi2 > TMath::TwoPi()) phi2 -= TMath::TwoPi(); + if (phi2 < 0.) phi2 += TMath::TwoPi(); + + /// HelixToCircle Main Track Electron + double r1 = 1/(2.*fabs(helix1[1])); + + double charge1(1.); + if (helix1[1]<0.) charge1 = -1.; + double rcenter1(helix1[3]/charge1 + r1); + double phicenter1(phi1 + TMath::PiOver2()*charge1); + + double x1 = rcenter1*cos(phicenter1); + double y1 = rcenter1*sin(phicenter1); + + /// HelixToCircle Other Electron Conv Track + double r2 = 1/(2.*fabs(helix2[1])); + + double charge2(1.); + if(helix2[1]<0.) charge2 = -1.; + double rcenter2(helix2[3]/charge2 + r2); + double phicenter2(phi2 + TMath::PiOver2()*charge2); + + double x2 = rcenter2*cos(phicenter2); + double y2 = rcenter2*sin(phicenter2); + ////// + + double dx(x1-x2); + if (dx < 1e-9 && dx > 0.) dx = 1e-9; + if (dx > -1e-9 && dx < 0.) dx = -1e-9; + double slope((y1-y2)/dx); + double b(y1 - slope*x1); + double alpha(atan(slope)); + double d(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))); + //only keeping opposite sign option + double separation = d-r1-r2; + double cpx1, cpx2; + if (x1 > x2) { + cpx1 = x1-r1*cos(alpha); + cpx2 = x2+r2*cos(alpha); + } else { + cpx1 = x1+r1*cos(alpha); + cpx2 = x2 - r2*cos(alpha); + } + + double temp1 = (cpx1+cpx2)/2; + double temp2 = slope*temp1+b; + double convX = cos(beta)*temp1 + sin(beta)*temp2; + double convY = -sin(beta)*temp1+ cos(beta)*temp2; + + double dct(helix1[0]-helix2[0]); + + /////// + if (fabs(separation) < m_sepCut && fabs(dct) < m_dctCut){ + goodConv = true; + sep = separation; + pv = TMath::ATan2(convY,convX); + rv = sqrt(convX*convX + convY*convY); + if (convX*cos(eletrkP->phi()) + convY*sin(eletrkP->phi()) < 0) rv *= -1.; + } + } else { + dambi(*ele) = -1; + } + drv(*ele) = rv; + dphiv(*ele) = pv; + dmee(*ele) = mee; + dmeeVtx(*ele) = meeAtVtx; + dsep(*ele) = sep; + if (goodConv && rv > m_rvECCut && meeAtVtx < m_meeAtVtxECCut) + dambi(*ele) = 2; + else if (otrkP) { + if (mee < m_meeICCut) + dambi(*ele) = 1; + else + dambi(*ele) = 0; + } + return StatusCode::SUCCESS; +} + +void DerivationFramework::EGElectronAmbiguityTool::helix(const xAOD::TrackParticle *trkP, const xAOD::Vertex *pvtx, std::vector<double>&he) const { + + static const double PTTOCURVATURE = -0.301; + + he[0] = 1./tan(trkP->theta()); + he[1] = PTTOCURVATURE*trkP->charge()/trkP->pt(); + + if (trkP->phi0() > 0.) + he[4] = trkP->phi0(); + else + he[4] = TMath::TwoPi() + trkP->phi0(); + + double c1 = cos(trkP->phi0()); + double s1 = sin(trkP->phi0()); + he[3] = trkP->d0() + c1*pvtx->y() - s1*pvtx->x(); + + c1 *= he[0]; + s1 *= he[0]; + he[2] = trkP->z0() - c1*pvtx->x() - s1*pvtx->y() + pvtx->z(); +} + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronLikelihoodToolWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronLikelihoodToolWrapper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c591bcba6c5b23a294b45474a30e773102c0f937 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronLikelihoodToolWrapper.cxx @@ -0,0 +1,158 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EGElectronLikelihoodToolWrapper.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Author: Giovanni Marchiori (giovanni.marchiori@cern.ch) + +#include "DerivationFrameworkEGamma/EGElectronLikelihoodToolWrapper.h" +#include "xAODBase/IParticleContainer.h" +#include "xAODEgamma/EgammaContainer.h" +#include "xAODEgamma/Photon.h" +#include "xAODEgamma/Electron.h" +#include "PATCore/AcceptData.h" +#include "PATCore/AcceptInfo.h" + + +namespace DerivationFramework { + + EGElectronLikelihoodToolWrapper::EGElectronLikelihoodToolWrapper(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t,n,p), + m_cut(""), + m_sgName(""), + m_containerName(""), + m_storeTResult(false) + { + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("EGammaElectronLikelihoodTool", m_tool); + declareProperty("EGammaFudgeMCTool", m_fudgeMCTool); + declareProperty("CutType", m_cut); + declareProperty("StoreGateEntryName", m_sgName); + declareProperty("ContainerName", m_containerName); + declareProperty("StoreTResult", m_storeTResult); + } + + StatusCode EGElectronLikelihoodToolWrapper::initialize() + { + if (m_sgName.empty()) { + ATH_MSG_ERROR("No SG name provided for the output of EGElectronLikelihoodToolWrapper!"); + return StatusCode::FAILURE; + } + if (m_containerName!="Photons" && m_containerName!="Electrons") { + ATH_MSG_ERROR("Wrong container provided!"); + return StatusCode::FAILURE; + } + CHECK(m_tool.retrieve()); + if (!(m_fudgeMCTool.name().empty())) CHECK(m_fudgeMCTool.retrieve()); + return StatusCode::SUCCESS; + } + + StatusCode EGElectronLikelihoodToolWrapper::finalize() + { + return StatusCode::SUCCESS; + } + + StatusCode EGElectronLikelihoodToolWrapper::addBranches() const + { + // retrieve container + const xAOD::IParticleContainer* particles = evtStore()->retrieve< const xAOD::IParticleContainer >( m_containerName ); + if( ! particles ) { + ATH_MSG_ERROR ("Couldn't retrieve IParticles with key: " << m_containerName ); + return StatusCode::FAILURE; + } + + // Decorator + SG::AuxElement::Decorator< char > decoratorPass(m_sgName); + SG::AuxElement::Decorator< unsigned int > decoratorIsEM(m_sgName + "IsEMValue"); + + // Write mask for each element and record to SG for subsequent selection + for (xAOD::IParticleContainer::const_iterator pItr = particles->begin(); pItr!=particles->end(); ++pItr) { + + xAOD::Type::ObjectType type = (*pItr)->type(); + if (type!=xAOD::Type::Electron && type!=xAOD::Type::Photon) { + ATH_MSG_ERROR ("addBranches(): Wrong particle type (not electron nor photon) being passed to EGElectronLikelihoodToolWrapper"); + return StatusCode::FAILURE; + } + if (type==xAOD::Type::Electron && m_containerName!="Electrons") { + ATH_MSG_ERROR ("addBranches(): Wrong particle type being passed to EGElectronLikelihoodToolWrapper"); + return StatusCode::FAILURE; + } + if (type==xAOD::Type::Photon && m_containerName!="Photons") { + ATH_MSG_ERROR ("addBranches(): Wrong particle type being passed to EGElectronLikelihoodToolWrapper"); + return StatusCode::FAILURE; + } + + const xAOD::IParticle* pCopy = *pItr; + + // this should be computed based on some property of the tool or the existence of the ElectronPhotonShowerShapeFudgeTool + bool applyFF = (!m_fudgeMCTool.empty()); + if (applyFF) { + // apply the shower shape corrections + CP::CorrectionCode correctionCode = CP::CorrectionCode::Ok; + if (type==xAOD::Type::Electron) { + const xAOD::Electron* eg = static_cast<const xAOD::Electron*>(*pItr); + xAOD::Electron* el = nullptr; + correctionCode = m_fudgeMCTool->correctedCopy(*eg, el); + pCopy = el; + } + else { + const xAOD::Photon* eg = static_cast<const xAOD::Photon*>(*pItr); + xAOD::Photon* ph = nullptr; + correctionCode = m_fudgeMCTool->correctedCopy(*eg, ph); + pCopy = ph; + } + if (correctionCode==CP::CorrectionCode::Ok) + ; + else if (correctionCode==CP::CorrectionCode::Error) + Error("addBranches()","Error applying fudge factors to current photon"); + else if (correctionCode==CP::CorrectionCode::OutOfValidityRange) + Warning("addBranches()","Current object has no valid fudge factors due to out-of-range"); + else + Warning("addBranches()",Form("Unknown correction code %d from ElectronPhotonShowerShapeFudgeTool",(int) correctionCode)); + } + + // compute the output of the selector + asg::AcceptData theAccept(m_tool->accept(pCopy)); + unsigned int isEM = (unsigned int) theAccept.getCutResultInvertedBitSet().to_ulong(); // this should work for both the cut-based and the LH selectors + double result(0.); // initialise explicitly to avoid compilation warning. It will be overridden in the following block (result is used only if m_storeTResult is true) + + // Lukas Heinrich: interface in master not yet available. + // if (m_storeTResult) { + // result = double(m_tool->calculate(pCopy)); + // } + + // decorate the original object + if(m_cut.empty()){ + bool pass_selection = (bool) theAccept; + if(pass_selection) decoratorPass(**pItr) = 1; + else decoratorPass(**pItr) = 0; + decoratorIsEM(**pItr) = isEM; + if (m_storeTResult) { + SG::AuxElement::Decorator< double > decoratorResult(m_sgName + "Result"); + decoratorResult(**pItr) = result; + } + } + else{ + if (theAccept.getCutResult(m_cut)) { + decoratorPass(**pItr) = 1; + } else { + decoratorPass(**pItr) = 0; + } + decoratorIsEM(**pItr) = isEM; + if (m_storeTResult) { + SG::AuxElement::Decorator< double > decoratorResult(m_sgName + "Result"); + decoratorResult(**pItr) = result; + } + } + + // delete the particle copy + if (applyFF) delete pCopy; + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGPhotonCleaningWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGPhotonCleaningWrapper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f21810ad10594057fad9d33bb209f0331a158021 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGPhotonCleaningWrapper.cxx @@ -0,0 +1,106 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EGPhotonCleaningWrapper.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Author: Giovanni Marchiori (giovanni.marchiori@cern.ch) +// + +#include "DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/Photon.h" +#include <EgammaAnalysisHelpers/PhotonHelpers.h> + +namespace DerivationFramework { + + EGPhotonCleaningWrapper::EGPhotonCleaningWrapper(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t,n,p), + m_sgName("DFCommonPhotonsCleaning"), + m_containerName("Photons") + { + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("EGammaFudgeMCTool", m_fudgeMCTool); + declareProperty("StoreGateEntryName", m_sgName); + declareProperty("ContainerName", m_containerName); + } + + StatusCode EGPhotonCleaningWrapper::initialize() + { + if (m_sgName=="") { + ATH_MSG_ERROR("No SG name provided for the output of EGPhotonCleaningWrapper"); + return StatusCode::FAILURE; + } + if (m_fudgeMCTool.name()!="") CHECK(m_fudgeMCTool.retrieve()); + return StatusCode::SUCCESS; + } + + StatusCode EGPhotonCleaningWrapper::finalize() + { + return StatusCode::SUCCESS; + } + + StatusCode EGPhotonCleaningWrapper::addBranches() const + { + // retrieve container + const xAOD::PhotonContainer* photons = evtStore()->retrieve< const xAOD::PhotonContainer >( m_containerName ); + if( ! photons ) { + ATH_MSG_ERROR ("Couldn't retrieve photons with key: " << m_containerName ); + return StatusCode::FAILURE; + } + + // Decorator + SG::AuxElement::Decorator< char > decoratorPass(m_sgName); + SG::AuxElement::Decorator< char > decoratorPassDelayed(m_sgName+"NoTime"); + + // Write mask for each element and record to SG for subsequent selection + for (xAOD::PhotonContainer::const_iterator phItr = photons->begin(); phItr!=photons->end(); ++phItr) { + + bool passSelection = false; + bool passSelectionDelayed = false; + + bool applyFF = (!m_fudgeMCTool.empty()); + + if (!applyFF) { + passSelection = PhotonHelpers::passOQquality(*phItr); + passSelectionDelayed = PhotonHelpers::passOQqualityDelayed(*phItr); + } + else { + // apply the shower shape corrections + CP::CorrectionCode correctionCode = CP::CorrectionCode::Ok; + xAOD::Photon* ph = 0; + correctionCode = m_fudgeMCTool->correctedCopy(**phItr, ph); + if (correctionCode==CP::CorrectionCode::Ok) { + passSelection = PhotonHelpers::passOQquality(ph); + passSelectionDelayed = PhotonHelpers::passOQqualityDelayed(ph); + } + else if (correctionCode==CP::CorrectionCode::Error) { + Error("addBranches()","Error applying fudge factors to current photon"); + } + else if (correctionCode==CP::CorrectionCode::OutOfValidityRange) { + Warning("addBranches()","Current photon has no valid fudge factors due to out-of-range"); + } + else { + Warning("addBranches()",Form("Unknown correction code %d from ElectronPhotonShowerShapeFudgeTool",(int) correctionCode)); + } + delete ph; + } + + // decorate the original object + if (passSelection) + decoratorPass(**phItr) = 1; + else + decoratorPass(**phItr) = 0; + + if (passSelectionDelayed) + decoratorPassDelayed(**phItr) = 1; + else + decoratorPassDelayed(**phItr) = 0; + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx index 1fda708116608a574fc7486b4e2cb587b50f0536..5b3715b1dc9ae42e3bd6b09eb13063c66d61f7c4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -36,10 +36,10 @@ namespace DerivationFramework { StatusCode EGSelectionToolWrapper::initialize() { if (m_sgName=="") { - ATH_MSG_ERROR("No SG name provided for the output of invariant mass tool!"); + ATH_MSG_ERROR("No SG name provided for the output of EGSelectionToolWrapper!"); return StatusCode::FAILURE; } - if (m_containerName!="Photons" && m_containerName!="Electrons") { + if (m_containerName!="Photons" && m_containerName!="Electrons" && m_containerName!="ForwardElectrons") { ATH_MSG_ERROR("Wrong container provided!"); return StatusCode::FAILURE; } @@ -65,7 +65,7 @@ namespace DerivationFramework { // Decorator SG::AuxElement::Decorator< char > decoratorPass(m_sgName); SG::AuxElement::Decorator< unsigned int > decoratorIsEM(m_sgName + "IsEMValue"); - + // Write mask for each element and record to SG for subsequent selection for (xAOD::IParticleContainer::const_iterator pItr = particles->begin(); pItr!=particles->end(); ++pItr) { @@ -74,7 +74,7 @@ namespace DerivationFramework { ATH_MSG_ERROR ("addBranches(): Wrong particle type (not electron nor photon) being passed to EGSelectionToolWrapper"); return StatusCode::FAILURE; } - if (type==xAOD::Type::Electron && m_containerName!="Electrons") { + if (type==xAOD::Type::Electron && (m_containerName!="Electrons" && m_containerName!="ForwardElectrons")) { ATH_MSG_ERROR ("addBranches(): Wrong particle type being passed to EGSelectionToolWrapper"); return StatusCode::FAILURE; } @@ -114,9 +114,9 @@ namespace DerivationFramework { // compute the output of the selector asg::AcceptData theAccept(m_tool->accept(pCopy)); - // this one should be done only for IsEM selectors.. - unsigned int isEM = theAccept.getCutResultInverted(); - + //unsigned int isEM = m_tool->IsemValue(); // this one should be done only for IsEM selectors.. + unsigned int isEM = (unsigned int) theAccept.getCutResultInvertedBitSet().to_ulong(); // this should work for both the cut-based and the LH selectors + // decorate the original object if(m_cut==""){ bool pass_selection = (bool) theAccept; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGammaPassSelectionWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGammaPassSelectionWrapper.cxx deleted file mode 100644 index c9072e5eec7f4acd927f8af906d207a86306cbd1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGammaPassSelectionWrapper.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// EGammaPassSelectionWrapper.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Author: James Catmore (James.Catmore@cern.ch) -// Wrapper around the passSelection() method of xAOD egamma -// Writes result to SG for later selection by string parser - -#include "DerivationFrameworkEGamma/EGammaPassSelectionWrapper.h" -#include "xAODEgamma/EgammaContainer.h" -#include <vector> -#include <string> - -// Constructor -DerivationFramework::EGammaPassSelectionWrapper::EGammaPassSelectionWrapper( const std::string& t, - const std::string& n, - const IInterface* p ) : - AthAlgTool(t,n,p), - m_collName("Electrons"), - m_sgPrefix("") -{ - declareInterface<DerivationFramework::IAugmentationTool>(this); - declareProperty("SelectionVariables",m_qualFlags); - declareProperty("CollectionName", m_collName); - declareProperty("SGPrefix", m_sgPrefix); -} - -// Destructor -DerivationFramework::EGammaPassSelectionWrapper::~EGammaPassSelectionWrapper() { -} - -// Athena initialize and finalize -StatusCode DerivationFramework::EGammaPassSelectionWrapper::initialize() -{ - if (m_qualFlags.size()==0) { - ATH_MSG_ERROR("No selection variables for the egamma passSelection wrapper tool!"); - return StatusCode::FAILURE; - } - ATH_MSG_VERBOSE("initialize() ..."); - return StatusCode::SUCCESS; -} -StatusCode DerivationFramework::EGammaPassSelectionWrapper::finalize() -{ - ATH_MSG_VERBOSE("finalize() ..."); - return StatusCode::SUCCESS; -} - -// Augmentation -StatusCode DerivationFramework::EGammaPassSelectionWrapper::addBranches() const -{ - - // Retrieve data - const xAOD::EgammaContainer* egammas = evtStore()->retrieve< const xAOD::EgammaContainer >( m_collName ); - if( ! egammas ) { - ATH_MSG_ERROR("Couldn't retrieve e-gamma container with key: " << m_collName); - return StatusCode::FAILURE; - } - - // Make vectors for the cut results - std::vector<std::vector<int>* > allSelectionResults; - for (std::vector<std::string>::const_iterator strItr = m_qualFlags.begin(); strItr!=m_qualFlags.end(); ++strItr) { - std::vector<int> *passEgamma = new std::vector<int>(); - allSelectionResults.push_back(passEgamma); - } - // Loop over egammas, set decisions - for (xAOD::EgammaContainer::const_iterator eIt = egammas->begin(); eIt!=egammas->end(); ++eIt) { - unsigned int itr(0); - for (std::vector<std::string>::const_iterator strItr = m_qualFlags.begin(); strItr!=m_qualFlags.end(); ++strItr, ++itr) { - bool val(0); - if ( (*eIt)->passSelection(val,*strItr) ) { - if (val) {allSelectionResults[itr]->push_back(1);} - else {allSelectionResults[itr]->push_back(0);} - } else { - ATH_MSG_WARNING("Evident problem with quality flag " << *strItr << " so setting to false!"); - allSelectionResults[itr]->push_back(0); - } - } - } - - // Write decision to SG for access by downstream algs - unsigned int itr(0); - for (std::vector<std::string>::const_iterator strItr = m_qualFlags.begin(); strItr!=m_qualFlags.end(); ++strItr, ++itr) { - std::string sgKey(""); - if (m_sgPrefix=="") { - sgKey = *strItr; - } else { - sgKey = m_sgPrefix+*strItr; - } - if (evtStore()->contains<std::vector<int> >(sgKey)) { - ATH_MSG_ERROR("Tool is attempting to write a StoreGate key " << sgKey << " which already exists. Please use a different key"); - return StatusCode::FAILURE; - } - CHECK(evtStore()->record(allSelectionResults[itr],sgKey)); - } - return StatusCode::SUCCESS; -} - diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/TruthCaloShowerDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/TruthCaloShowerDecorator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..419f9fbd59d4da511a05e4c2e1f8d53b091bb8e9 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/TruthCaloShowerDecorator.cxx @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "DerivationFrameworkEGamma/TruthCaloShowerDecorator.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/Electron.h" +#include "xAODEgamma/EgammaTruthxAODHelpers.h" +#include "xAODTruth/TruthParticle.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "CaloCalibHitRec/CalibHitToCaloCellTool.h" + +namespace DerivationFramework { + + TruthCaloShowerDecorator::TruthCaloShowerDecorator(const std::string& t,const std::string& n, const IInterface* p) : + AthAlgTool(t,n,p) + { + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("TruthParticleContainerName", m_truthParticleContainerName ="egammaTruthParticles", "Name of the truth particle container"); + declareProperty("SingleParticleBarcode", m_singleParticleBarcode=10001, "Barcode of single particle"); + declareProperty("CalibHitToCaloCellTool",m_calibhitToCaloCellTool); + //declareProperty("TruthClusterContainerNames", m_truthClusterContainerNames, "Name of input containers for truth clusters"); + } + + StatusCode TruthCaloShowerDecorator::initialize() + { + ATH_MSG_DEBUG("Initializing " << name() << "..."); + + if(m_calibhitToCaloCellTool.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_calibhitToCaloCellTool); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Retrieved tool " << m_calibhitToCaloCellTool); + + return StatusCode::SUCCESS; + } + + StatusCode TruthCaloShowerDecorator::finalize() + { + return StatusCode::SUCCESS; + } + + StatusCode TruthCaloShowerDecorator::addBranches() const + { + const xAOD::TruthParticleContainer* truthPartContainer(0); + CHECK ( evtStore()->retrieve(truthPartContainer, m_truthParticleContainerName) ); + + // create truth clusters + ATH_MSG_DEBUG("Creating truth clusters"); + int singleElectronBarcode = 10001; + if (!m_calibhitToCaloCellTool->processCalibHitsFromParticle(singleElectronBarcode).isSuccess()) { + ATH_MSG_FATAL("Tool " << m_calibhitToCaloCellTool << " failed."); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("Retrieving truth clusters"); + const xAOD::CaloClusterContainer * truthClusterContainerEtot=0; + const xAOD::CaloClusterContainer * truthClusterContainerEvis=0; + const xAOD::CaloClusterContainer * truthClusterContainerEem=0; + + truthClusterContainerEtot = evtStore()->retrieve<const xAOD::CaloClusterContainer>("TruthLArClustersEtot"); + truthClusterContainerEvis = evtStore()->retrieve<const xAOD::CaloClusterContainer>("TruthLArClustersEvis"); + truthClusterContainerEem = evtStore()->retrieve<const xAOD::CaloClusterContainer>("TruthLArClustersEem"); + if (!truthClusterContainerEtot || !truthClusterContainerEvis || !truthClusterContainerEem) { + ATH_MSG_ERROR("Failed to retrieve truth cluster container"); + return StatusCode::FAILURE; + } + + SG::AuxElement::Decorator< ElementLink<xAOD::CaloClusterContainer> > linkDecoratorClusterEtot("truthLArClusterEtotLink"); + SG::AuxElement::Decorator< ElementLink<xAOD::CaloClusterContainer> > linkDecoratorClusterEvis("truthLArClusterEvisLink"); + SG::AuxElement::Decorator< ElementLink<xAOD::CaloClusterContainer> > linkDecoratorClusterEem("truthLArClusterEemLink"); + + ElementLink<xAOD::CaloClusterContainer> truthClusterEtot(*truthClusterContainerEtot,0); + ElementLink<xAOD::CaloClusterContainer> truthClusterEvis(*truthClusterContainerEvis,0); + ElementLink<xAOD::CaloClusterContainer> truthClusterEem(*truthClusterContainerEem,0); + + ATH_MSG_DEBUG("Decorating truth parts with truth cluster energy"); + for (const auto truthPart: *truthPartContainer) { + if (!truthPart) continue; + if (truthPart->barcode() != m_singleParticleBarcode) continue; + linkDecoratorClusterEtot(*truthPart) = truthClusterEtot; + linkDecoratorClusterEvis(*truthPart) = truthClusterEvis; + linkDecoratorClusterEem(*truthPart) = truthClusterEem; + } + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/components/DerivationFrameworkEGamma_entries.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/components/DerivationFrameworkEGamma_entries.cxx index 3c27b0642e86f2731433410e6ac478eb4965194e..492129dd3ceb4eae0b85e322080338acc4772585 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/components/DerivationFrameworkEGamma_entries.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/components/DerivationFrameworkEGamma_entries.cxx @@ -1,18 +1,24 @@ #include "DerivationFrameworkEGamma/PhotonsDirectionTool.h" -#include "DerivationFrameworkEGamma/EGammaPassSelectionWrapper.h" #include "DerivationFrameworkEGamma/EGInvariantMassTool.h" #include "DerivationFrameworkEGamma/EGTransverseMassTool.h" #include "DerivationFrameworkEGamma/EGSelectionToolWrapper.h" +#include "DerivationFrameworkEGamma/EGElectronLikelihoodToolWrapper.h" +#include "DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h" +#include "DerivationFrameworkEGamma/EGCrackVetoCleaningTool.h" #include "DerivationFrameworkEGamma/BkgElectronClassification.h" - +#include "DerivationFrameworkEGamma/TruthCaloShowerDecorator.h" +#include "DerivationFrameworkEGamma/EGElectronAmbiguityTool.h" using namespace DerivationFramework; DECLARE_COMPONENT( PhotonsDirectionTool ) -DECLARE_COMPONENT( EGammaPassSelectionWrapper ) DECLARE_COMPONENT( EGInvariantMassTool ) DECLARE_COMPONENT( EGTransverseMassTool ) DECLARE_COMPONENT( EGSelectionToolWrapper ) +DECLARE_COMPONENT( EGElectronLikelihoodToolWrapper ) +DECLARE_COMPONENT( EGPhotonCleaningWrapper ) +DECLARE_COMPONENT( EGCrackVetoCleaningTool ) DECLARE_COMPONENT( BkgElectronClassification ) +DECLARE_COMPONENT( TruthCaloShowerDecorator ) +DECLARE_COMPONENT( EGElectronAmbiguityTool ) - diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/CMakeLists.txt index 8e5dd27936d9db581f1c7b1a869d9f41c1309f47..963699679cf9486ed8f2417ed119ba4f50efb21c 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/CMakeLists.txt @@ -36,10 +36,5 @@ atlas_add_component( DerivationFrameworkExotics LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps xAODJet TrigDecisionToolLib xAODCore xAODEventInfo GaudiKernel DerivationFrameworkExoticsLib PATInterfaces ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT10ContentList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT10ContentList.py index 21e0296e5f541a7f426ed0ff9ff9a9a1f29b6ceb..b9deeb21c702fad62ade097d278fbf1504bd7857 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT10ContentList.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT10ContentList.py @@ -1,51 +1,51 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -EXOT10SmartContent = [ - "Photons", - "Muons", - "Electrons", - "PrimaryVertices", - "InDetTrackParticles", - "BTagging_AntiKt4EMTopo", - "TauJets", - "AntiKt4EMTopoJets", - "AntiKt4LCTopoJets" -] - -EXOT10AllVariablesContent = [ - "egammaClusters", - "GSFConversionVertices", - "TruthParticles", - "egammaTruthParticles", - "MET_Truth", - "egammaTopoSeededClusters", - "CaloCalTopoClusters", - "TruthEvents", - "TruthVertices", - "AntiKt4TruthJets", - "MET_LocHadTopo", - "METAssoc_AntiKt4EMTopo", - "MET_Core_AntiKt4EMTopo", - "MET_Reference_AntiKt4EMTopo", - "METAssoc_AntiKt4LCTopo", - "MET_Core_AntiKt4LCTopo", - "MET_Reference_AntiKt4LCTopo", - "AntiKt4PV0TrackJets", - "BTagging_AntiKt4Track" -] - -EXOT10Content = [ -] - -EXOT10ExtraVariables = [ - "Electrons.author.Medium.Tight.Loose.charge", - "BTagging_AntiKt4EMTopo.MV1_discriminant.MV1c_discriminant", - "Muons.ptcone30.ptcone20.charge.quality.InnerDetectorPt.MuonSpectrometerPt.CaloLRLikelihood.CaloMuonIDTag", - "AntiKt4EMTopoJets.NumTrkPt1000.TrackWidthPt1000.NumTrkPt500", - "GSFTrackParticles.z0.d0.vz.definingParametersCovMatrix", - "CombinedMuonTrackParticles.d0.z0.vz.definingParametersCovMatrix.truthOrigin.truthType", - "ExtrapolatedMuonTrackParticles.d0.z0.vz.definingParametersCovMatrix.truthOrigin.truthType", - "TauJets.TruthCharge.TruthProng.IsTruthMatched.TruthPtVis.truthOrigin.truthType", - "MuonTruthParticles.barcode.decayVtxLink.e.m.pdgId.prodVtxLink.px.py.pz.recoMuonLink.status.truthOrigin.truthType", - # "AntiKt4LCTopoJets.AverageLArQF" -] +EXOT10SmartContent = [ + "Photons", + "Muons", + "Electrons", + "PrimaryVertices", + "InDetTrackParticles", + "BTagging_AntiKt4EMTopo", + "TauJets", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets" +] + +EXOT10AllVariablesContent = [ + "egammaClusters", + "GSFConversionVertices", + "TruthParticles", + "egammaTruthParticles", + "MET_Truth", + "egammaTopoSeededClusters", + "CaloCalTopoClusters", + "TruthEvents", + "TruthVertices", + "AntiKt4TruthJets", + "MET_LocHadTopo", + "METAssoc_AntiKt4EMTopo", + "MET_Core_AntiKt4EMTopo", + "MET_Reference_AntiKt4EMTopo", + "METAssoc_AntiKt4LCTopo", + "MET_Core_AntiKt4LCTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4PV0TrackJets", + "BTagging_AntiKt4Track" +] + +EXOT10Content = [ +] + +EXOT10ExtraVariables = [ + "Electrons.author.Medium.Tight.Loose.charge", + "BTagging_AntiKt4EMTopo.MV1_discriminant.MV1c_discriminant", + "Muons.ptcone30.ptcone20.charge.quality.InnerDetectorPt.MuonSpectrometerPt.CaloLRLikelihood.CaloMuonIDTag", + "AntiKt4EMTopoJets.NumTrkPt1000.TrackWidthPt1000.NumTrkPt500", + "GSFTrackParticles.z0.d0.vz.definingParametersCovMatrix", + "CombinedMuonTrackParticles.d0.z0.vz.definingParametersCovMatrix.truthOrigin.truthType", + "ExtrapolatedMuonTrackParticles.d0.z0.vz.definingParametersCovMatrix.truthOrigin.truthType", + "TauJets.TruthCharge.TruthProng.IsTruthMatched.TruthPtVis.truthOrigin.truthType", + "MuonTruthParticles.barcode.decayVtxLink.e.m.pdgId.prodVtxLink.px.py.pz.recoMuonLink.status.truthOrigin.truthType", + # "AntiKt4LCTopoJets.AverageLArQF" +] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT14ContentList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT14ContentList.py index 4c66e7bb1633d03ca73f8d3c54dcdf0ff1ad0528..47fb90aca1d3b6ec44c787022ce640bfc84441c0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT14ContentList.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT14ContentList.py @@ -1,52 +1,51 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -EXOT14SmartContent = [ - "TauJets", - "MET_Reference_AntiKt4LCTopo", - "MET_Reference_AntiKt4EMTopo", - "PrimaryVertices", - "Photons", - "Electrons", - "Muons", - "InDetTrackParticles", - "AntiKt4EMTopoJets", - "AntiKt4LCTopoJets", - "BTagging_AntiKt4LCTopo", - "BTagging_AntiKt4EMTopo", -] - -EXOT14AllVariablesContent = [ - "GSFTrackParticles", - "egammaClusters", - "CaloCalTopoClusters", - "GSFConversionVertices", - "METAssoc_AntiKt4LCTopo", - "MET_Core_AntiKt4LCTopo", - "METAssoc_AntiKt4EMTopo", - "MET_Core_AntiKt4EMTopo", - "AntiKt4TruthJets", - "LVL1JetRoIs", - "LVL1MuonRoIs", - "LVL1EmTauRoIs", - 'MET_Truth', - 'TruthEvents', - #'TruthVertex', # MenuTruthThinning does not keep vertices - 'TruthParticles', - "HLT_xAOD__JetContainer_a4tcemsubjesFS", - "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET", - "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht", - "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl", - "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl_PS", - "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl_PUC" -] - -EXOT14ExtraVariablesContent = [ - 'Electrons.author.pt.Medium.Tight.Loose.charge', - 'Muons.ptcone20.ptcone30.ptcone40.etcone20.etcone30.etcone40', - 'CombinedMuonTrackParticles.d0.z0.phi.theta.charge.chiSquared.numberDoF.qOverP.vz.definingParametersCovMatrix', # SUSYTools - 'ExtrapolatedMuonTrackParticles.d0.z0.phi.theta.charge.chiSquared.numberDoF.qOverP.vz.definingParametersCovMatrix', # SUSYTools -] - -EXOT14Content = [ -] - +EXOT14SmartContent = [ + "TauJets", + "MET_Reference_AntiKt4LCTopo", + "MET_Reference_AntiKt4EMTopo", + "PrimaryVertices", + "Photons", + "Electrons", + "Muons", + "InDetTrackParticles", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4LCTopo", + "BTagging_AntiKt4EMTopo", +] + +EXOT14AllVariablesContent = [ + "GSFTrackParticles", + "egammaClusters", + "CaloCalTopoClusters", + "GSFConversionVertices", + "METAssoc_AntiKt4LCTopo", + "MET_Core_AntiKt4LCTopo", + "METAssoc_AntiKt4EMTopo", + "MET_Core_AntiKt4EMTopo", + "AntiKt4TruthJets", + "LVL1JetRoIs", + "LVL1MuonRoIs", + "LVL1EmTauRoIs", + 'MET_Truth', + 'TruthEvents', + #'TruthVertex', # MenuTruthThinning does not keep vertices + 'TruthParticles', + "HLT_xAOD__JetContainer_a4tcemsubjesFS", + "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET", + "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht", + "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl", + "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl_PS", + "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl_PUC" +] + +EXOT14ExtraVariablesContent = [ + 'Electrons.author.pt.Medium.Tight.Loose.charge', + 'Muons.ptcone20.ptcone30.ptcone40.etcone20.etcone30.etcone40', + 'CombinedMuonTrackParticles.d0.z0.phi.theta.charge.chiSquared.numberDoF.qOverP.vz.definingParametersCovMatrix', # SUSYTools + 'ExtrapolatedMuonTrackParticles.d0.z0.phi.theta.charge.chiSquared.numberDoF.qOverP.vz.definingParametersCovMatrix', # SUSYTools +] + +EXOT14Content = [ +] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/CMakeLists.txt index a8159393c11e13614e846ee6f1b39c292d60ce39..fb63bb353bdc060e587eb250ffd04b20ba28706d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/CMakeLists.txt @@ -6,8 +6,11 @@ atlas_subdir( DerivationFrameworkInterfaces ) # Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel ) +atlas_depends_on_subdirs( + PUBLIC + GaudiKernel + Control/StoreGate + PhysicsAnalysis/CommonTools/ExpressionEvaluation ) # Component(s) in the package: atlas_add_library( DerivationFrameworkInterfaces @@ -16,7 +19,9 @@ atlas_add_library( DerivationFrameworkInterfaces PUBLIC_HEADERS DerivationFrameworkInterfaces LINK_LIBRARIES GaudiKernel ) + atlas_add_dictionary( DerivationFrameworkInterfacesDict DerivationFrameworkInterfaces/DerivationFrameworkInterfacesDict.h DerivationFrameworkInterfaces/selection.xml LINK_LIBRARIES DerivationFrameworkInterfaces ) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/DerivationFrameworkInterfaces/ExpressionParserHelper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/DerivationFrameworkInterfaces/ExpressionParserHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..9a6a5b448848e63feed36463f4da898031ad4d61 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/DerivationFrameworkInterfaces/ExpressionParserHelper.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DERIVATIONFRAMEWORKINTERFACES_EXPRESSIONPARSERHELPER_H +#define DERIVATIONFRAMEWORKINTERFACES_EXPRESSIONPARSERHELPER_H + +// Framework include(s): +#include "GaudiKernel/ServiceHandle.h" +#include "StoreGate/StoreGateSvc.h" + +// Expression parsing include(s): +#include "ExpressionEvaluation/SGxAODProxyLoader.h" +#include "ExpressionEvaluation/SGNTUPProxyLoader.h" +#include "ExpressionEvaluation/MultipleProxyLoader.h" +#include "ExpressionEvaluation/ExpressionParser.h" + +namespace DerivationFramework { + + /// Helper class for using @c ExpressionParsing::ExpressionParser + /// + /// Since the correct memory management for + /// @c ExpressionParsing::ExpressionParser is not so trivial, instead of + /// implementing that individually in every DF class that uses it, would + /// not be a too good design. Instead each DF class should migrate to using + /// this helper class to avoid memory leaks coming from the expression + /// parsing code. + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class ExpressionParserHelper { + + public: + /// Default constructor + ExpressionParserHelper( ServiceHandle< StoreGateSvc >& evtStore ) + : m_xaodLoader( evtStore ), m_ntupLoader( evtStore ), + m_proxyLoader({&m_xaodLoader, &m_ntupLoader}), m_parser( &m_proxyLoader ) { + } + + /// Return a reference to the expression parser + ExpressionParsing::ExpressionParser& parser() { + return m_parser; + } + + private: + /// The xAOD proxy loader + ExpressionParsing::SGxAODProxyLoader m_xaodLoader; + /// The ntuple variable proxy loader + ExpressionParsing::SGNTUPProxyLoader m_ntupLoader; + /// The multiple proxy loader + ExpressionParsing::MultipleProxyLoader m_proxyLoader; + /// The main expression parser object + ExpressionParsing::ExpressionParser m_parser; + + }; // class ExpressionParserHelper + +} // namespace DerivationFramework + +#endif // DERIVATIONFRAMEWORKINTERFACES_EXPRESSIONPARSERHELPER_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/DerivationFrameworkInterfaces/IForwardParentThinningTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/DerivationFrameworkInterfaces/IForwardParentThinningTool.h new file mode 100644 index 0000000000000000000000000000000000000000..2553a43e92efb6a72caa84b777717b0e90215ecc --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces/DerivationFrameworkInterfaces/IForwardParentThinningTool.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef DerivationFrameworkInterfaces_IForwardParentThinningTool_H +#define DerivationFrameworkInterfaces_IForwardParentThinningTool_H + +// athena includes +#include "GaudiKernel/IAlgTool.h" + +// EDM includes +#include "xAODBase/IParticleContainer.h" + +/** + * @class IForwardParentThinningTool + * @brief Interface class for tools that thin low-level objects based on a + * selection on associated high-level objects. + * + * @author Jon Burr + */ +class IForwardParentThinningTool : virtual public IAlgTool { + public: + /// AlgTool interface ID + DeclareInterfaceID(IForwardParentThinningTool, 1, 0); + + /// Virtual destructor + virtual ~IForwardParentThinningTool() {} + + /// Forward the thinning from the parent particles + virtual StatusCode forwardParentThinning( + const xAOD::IParticleContainer* parent, + const std::vector<bool>& mask) const = 0; +}; + +#endif //> !DerivationFrameworkInterfaces_IForwardParentThinningTool_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt index 58a15924e42752b3f13f184701b179cbc989d171..2540eb7eb360214e0774911472330624e93fc718 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt @@ -17,12 +17,12 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODBase Event/xAOD/xAODJet Generators/GeneratorObjects + Generators/AtlasHepMC PhysicsAnalysis/CommonTools/ExpressionEvaluation PhysicsAnalysis/MCTruthClassifier ) # External dependencies: find_package( FastJet ) -find_package( HepMC ) find_package( HepPDT ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -30,15 +30,15 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) atlas_add_library( DerivationFrameworkMCTruthLib src/*.cxx PUBLIC_HEADERS DerivationFrameworkMCTruth - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${FASTJET_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps xAODEventInfo xAODTruth GaudiKernel SGtests ExpressionEvaluationLib MCTruthClassifierLib + LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${FASTJET_LIBRARIES} AtlasHepMCLib AthenaBaseComps xAODEventInfo xAODTruth GaudiKernel SGtests ExpressionEvaluationLib MCTruthClassifierLib PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaKernel xAODBase xAODJet GeneratorObjects ) atlas_add_component( DerivationFrameworkMCTruth src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${FASTJET_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps xAODEventInfo xAODTruth GaudiKernel AthenaKernel SGtests EventInfo xAODBase xAODJet GeneratorObjects ExpressionEvaluationLib MCTruthClassifierLib DerivationFrameworkMCTruthLib ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${FASTJET_LIBRARIES} AtlasHepMCLib AthenaBaseComps xAODEventInfo xAODTruth GaudiKernel AthenaKernel SGtests EventInfo xAODBase xAODJet GeneratorObjects ExpressionEvaluationLib MCTruthClassifierLib DerivationFrameworkMCTruthLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/CompactHardTruth.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/CompactHardTruth.h index c9c4eafcb9752a2639b9362be173cc4dc2012912..058219f71b303f32a891083d2a8712ca3a071775 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/CompactHardTruth.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/CompactHardTruth.h @@ -33,9 +33,9 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" // fwd declares class IMcVtxFilterTool; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CompactHardTruth.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CompactHardTruth.cxx index f64605d005b7ab8c1981a589b2f0ee03044e01a5..2cfcd3dc035fe08cc4958ff46fdff4a2d083400e 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CompactHardTruth.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CompactHardTruth.cxx @@ -26,11 +26,11 @@ //#include "McParticleEvent/TruthParticle.h" //#include "McParticleEvent/TruthParticleContainer.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" // Needed for FourVector -#include "HepMC/SimpleVector.h" +#include "AtlasHepMC/SimpleVector.h" //#include "McParticleUtils/McVtxFilter.h" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/CMakeLists.txt index 83c0f2885f1cff63a30e564fda774dfc0dd95704..1a8dcf98482c1eb71a7578a5d84341aa4b135f53 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/CMakeLists.txt @@ -50,5 +50,6 @@ atlas_add_component( DerivationFrameworkMuons LINK_LIBRARIES GaudiKernel DerivationFrameworkMuonsLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py index 72fa80ca1ca83aff6aadd8b4a841c459e43820cf..be7fe10d5482c7223e906070320f2bbd62769eaf 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py @@ -1,9 +1,9 @@ -#Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +#Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration def ConstituentPileupIso(privateSeq): from AthenaCommon.AppMgr import ToolSvc from JetRecTools.JetRecToolsConfig import ctm - from JetRecTools.JetRecToolsConf import CaloClusterConstituentsOrigin, ConstituentSubtractorTool, ConstitTimeCutTool, SoftKillerWeightTool + from JetRecTools.JetRecToolsConf import ConstituentSubtractorTool, ConstitTimeCutTool, SoftKillerWeightTool ctm.add( ConstitTimeCutTool("JetConstit_Timing"), alias = 'timing' ) ctm.add( ConstituentSubtractorTool("JetConstit_ConstSub"), @@ -95,11 +95,11 @@ def ConstituentPileupIso(privateSeq): ToolSvc += OrigTimeCSSKCaloClustersInConeTool from PFlowUtils.PFlowUtilsConf import CP__RetrievePFOTool as RetrievePFOTool - TimePFCSTool = RetrievePFOTool("TimePFCSTool",NeutralInputContainer="TimePFCSNeutralParticleFlowObjects"); + TimePFCSTool = RetrievePFOTool("TimePFCSTool",NeutralInputContainer="TimePFCSNeutralParticleFlowObjects") ToolSvc += TimePFCSTool - TimePFSKTool = RetrievePFOTool("TimePFSKTool",NeutralInputContainer="TimePFSKNeutralParticleFlowObjects"); + TimePFSKTool = RetrievePFOTool("TimePFSKTool",NeutralInputContainer="TimePFSKNeutralParticleFlowObjects") ToolSvc += TimePFSKTool - TimePFCSSKTool = RetrievePFOTool("TimePFCSSKTool",NeutralInputContainer="TimePFCSSKNeutralParticleFlowObjects"); + TimePFCSSKTool = RetrievePFOTool("TimePFCSSKTool",NeutralInputContainer="TimePFCSSKNeutralParticleFlowObjects") ToolSvc += TimePFCSSKTool from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__PFlowObjectsInConeTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/JPsiVertexFitSetup.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/JPsiVertexFitSetup.py index 9bba723fa900fd8c9f39b2554599d3e12fb8d264..4aa9ce48a7f18ca30a64891c5f1da2440288eb01 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/JPsiVertexFitSetup.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/JPsiVertexFitSetup.py @@ -1,3 +1,6 @@ +#Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function def AddJPsiVertexingAlgs(prefix='',addAlgo=True): @@ -12,7 +15,7 @@ def AddJPsiVertexingAlgs(prefix='',addAlgo=True): from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__KalmanVertexUpdator VertexUpdater = Trk__KalmanVertexUpdator(name = "MuonTP_KalmanVertexUpdator") ToolSvc += VertexUpdater - print VertexUpdater + print ( VertexUpdater) @@ -21,7 +24,7 @@ def AddJPsiVertexingAlgs(prefix='',addAlgo=True): MuContainer = job.CalibratedMuonsProvider.Output - from AthenaCommon.Constants import INFO,DEBUG,WARNING + from AthenaCommon.Constants import WARNING from JpsiUpsilonTools.JpsiUpsilonToolsConf import Analysis__JpsiFinder ExampleJpsiFinder = Analysis__JpsiFinder(name = prefix+"JpsiFinderName", muAndMu = False, @@ -70,7 +73,7 @@ def AddJPsiVertexingAlgs(prefix='',addAlgo=True): OutputLevel = WARNING ) ToolSvc += MuonTP_Reco_mumu - print MuonTP_Reco_mumu + print (MuonTP_Reco_mumu) from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Select_onia2mumu @@ -88,7 +91,7 @@ def AddJPsiVertexingAlgs(prefix='',addAlgo=True): OutputLevel = WARNING) ToolSvc += MuonTP_Select_Jpsi2mumu - print MuonTP_Select_Jpsi2mumu + print (MuonTP_Select_Jpsi2mumu) if addAlgo: from DerivationFrameworkMuons.DerivationFrameworkMuonsConf import MuonTPJpsiVertexFittingAlg diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py index 9b9269caa2e494ff9498ccfbde37f49eda0ebdf4..a7f233c4fa0f3f25c98847a461f59acd7eab7cc4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py @@ -1,12 +1,16 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #******************************************************************** # MuonsCommon.py # Schedules all tools needed for muon object selection and writes # results into SG. These may then be accessed along the train #******************************************************************** -from DerivationFrameworkCore.DerivationFrameworkMaster import * +from __future__ import print_function + +from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob from DerivationFrameworkMuons import DFCommonMuonsConfig +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon import CfgMgr DFCommonMuonsTrtCutOff = DFCommonMuonsConfig.TrtCutOff #==================================================================== @@ -27,9 +31,9 @@ DFCommonMuonsSelector.MuQuality = 3 # turn of the momentum correction which is not needed for IDHits cut and Preselection DFCommonMuonsSelector.TurnOffMomCorr = True -if DFCommonMuonsTrtCutOff != None: DFCommonMuonsSelector.TrtCutOff = DFCommonMuonsTrtCutOff +if DFCommonMuonsTrtCutOff is not None: DFCommonMuonsSelector.TrtCutOff = DFCommonMuonsTrtCutOff ToolSvc += DFCommonMuonsSelector -print DFCommonMuonsSelector +print (DFCommonMuonsSelector) DFCommonMuonToolWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonMuonToolWrapper", AsgSelectionTool = DFCommonMuonsSelector, @@ -37,7 +41,7 @@ DFCommonMuonToolWrapper = DerivationFramework__AsgSelectionToolWrapper( name = " StoreGateEntryName = "DFCommonGoodMuon", ContainerName = "Muons") ToolSvc += DFCommonMuonToolWrapper -print DFCommonMuonToolWrapper +print (DFCommonMuonToolWrapper) DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapper) ### Preselection @@ -47,9 +51,9 @@ DFCommonMuonsSelectorPreselection.MuQuality = 3 # turn of the momentum correction which is not needed for IDHits cut and Preselection DFCommonMuonsSelectorPreselection.TurnOffMomCorr = True -if DFCommonMuonsTrtCutOff != None: DFCommonMuonsSelectorPreselection.TrtCutOff = DFCommonMuonsTrtCutOff +if DFCommonMuonsTrtCutOff is not None: DFCommonMuonsSelectorPreselection.TrtCutOff = DFCommonMuonsTrtCutOff ToolSvc += DFCommonMuonsSelectorPreselection -print DFCommonMuonsSelectorPreselection +print (DFCommonMuonsSelectorPreselection) DFCommonMuonToolWrapperPreselection = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonMuonToolWrapperPreselection", AsgSelectionTool = DFCommonMuonsSelectorPreselection, @@ -57,20 +61,19 @@ DFCommonMuonToolWrapperPreselection = DerivationFramework__AsgSelectionToolWrapp StoreGateEntryName = "DFCommonMuonsPreselection", ContainerName = "Muons") ToolSvc += DFCommonMuonToolWrapperPreselection -print DFCommonMuonToolWrapperPreselection +print (DFCommonMuonToolWrapperPreselection) DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapperPreselection) ### Decoration of the muon objects with the ID track covariances #from DerivationFrameworkMuons.DerivationFrameworkMuonsConf import DerivationFramework__MuonIDCovMatrixDecorator #DFCommonMuonIDCovMatrixDecorator = DerivationFramework__MuonIDCovMatrixDecorator( name = "DFCommonMuonIDCovMatrixDecorator") #ToolSvc += DFCommonMuonIDCovMatrixDecorator -#print DFCommonMuonIDCovMatrixDecorator +#print (DFCommonMuonIDCovMatrixDecorator) #DFCommonMuonToolWrapperTools.append(DFCommonMuonIDCovMatrixDecorator) ############# # Add tools ############# -from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("DFCommonMuonsKernel", AugmentationTools = DFCommonMuonToolWrapperTools ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/StreamConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/StreamConfig.py index 1bb41d4b5baa524b54d6b764f425b38ff80c97ec..b4f65fd734be78e4444459485b2ed32c0c3bd43f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/StreamConfig.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/StreamConfig.py @@ -1,6 +1,9 @@ #!/usr/bin/env python -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkIsMonteCarlo def useSmartSlimmingIfSupported(itemPairs, smAllVarlist, addItemList, ContainerNamesAndTypes): @@ -8,7 +11,7 @@ def useSmartSlimmingIfSupported(itemPairs, smAllVarlist, addItemList, ContainerN cname = i.split('#')[-1] if cname in ContainerNamesAndTypes and itemPairs[i].split('#')[-1].rstrip('.') in ContainerNamesAndTypes: smAllVarlist.append(cname) - print cname, 'added to smartlimming' + print (cname, 'added to smartlimming') else: addItemList.append(i) addItemList.append(itemPairs[i]) @@ -124,14 +127,18 @@ class MuonsDxAODStreamConfigurer: stream.AddItem(item) def show(self): - print 'Add Items:' - for i in self.Items: print i,'=',self.Items[i] - print 'Smart slimming:' - for i in self.smSlContainer and (not i in self.allVarContainer): print i,'=',self.smSlContainer[i] - print 'Keep all varaibles:' - for i in self.allVarContainer: print i,'=',self.allVarContainer[i] - print 'Keep trigger content:' - for i in self.UseTriggerContent: print i,'=',self.UseTriggerContent[i] + print ('Add Items:') + for i in self.Items: + print (i,'=',self.Items[i]) + print ('Smart slimming:') + for i in self.smSlContainer and (i not in self.allVarContainer): + print (i,'=',self.smSlContainer[i]) + print ('Keep all variables:') + for i in self.allVarContainer: + print (i,'=',self.allVarContainer[i]) + print ('Keep trigger content:') + for i in self.UseTriggerContent: + print (i,'=',self.UseTriggerContent[i]) if __name__ == '__main__': diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py index 77fa4230cbf4325399155595c022afab058316cb..d2ecc20518018153a1a74e02949911fa0941c32a 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py @@ -1,7 +1,9 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Add a track isolation updater tool +from __future__ import print_function + from AthenaCommon.AppMgr import ToolSvc from IsolationTool.IsolationToolConf import xAOD__TrackIsolationTool @@ -36,7 +38,7 @@ CaloIsoTool.addCaloExtensionDecoration = False # if hasattr(CaloIsoTool, 'addCaloExtensionDecoration'): ### somehow does not work # CaloIsoTool.addCaloExtensionDecoration = False # CaloIsoTool.OutputLevel = 2 -print CaloIsoTool +print (CaloIsoTool) ToolSvc += CaloIsoTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/create_period_container.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/create_period_container.py index 8d3a8a7fd2dd204b4e6f8160ceb9c3830f78cd5d..3f75bda852382407064331c230bcaf0797484a21 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/create_period_container.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/create_period_container.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ###################### ## ## Contact: Dongliang Zhang <dongliang.zhang@cern.ch> @@ -10,6 +10,8 @@ ## lsetup pyami ###################### +from __future__ import print_function + import sys import pyAMI.client import pyAMI.atlas.api as AtlasAPI @@ -46,7 +48,7 @@ def makeContainer(c1): runs = set([a['run_number'] for a in x0]) if len(runs)==0: - print 'no run in period'+c1.period+' is listed in GRL:', c1.grl + print ('no run in period'+c1.period+' is listed in GRL:', c1.grl) return ### get AOD datasets @@ -55,7 +57,7 @@ def makeContainer(c1): ### get dataset info dic1={} for a in x: - print a['run_number'], a['ldn'] + print (a['run_number'], a['ldn']) try: dic1[a['ldn'].split('_')[-1]].append((a['run_number'],a['ldn'])) except KeyError: @@ -64,10 +66,10 @@ def makeContainer(c1): ### get the tags, sorted by popularity allTags = sorted(dic1.keys(), key=lambda k: len(dic1[k]),reverse=True) for tag in allTags: - print tag,':', + print (tag,':', end='') for xx in dic1[tag]: - print xx[0], - print + print (xx[0], end='') + print() ### use the most popular tags if not spicified t_acceptTags = c1.acceptTags if c1.acceptTags else allTags @@ -86,19 +88,19 @@ def makeContainer(c1): ### Warning when the given tag does not select any dataset if len(ds)==0: - print 'No dataset in period',c1.period+', exiting...' + print ('No dataset in period',c1.period+', exiting...') return #### find any missing runs for d in ds: - print d[0],d[1] + print (d[0],d[1]) runs.remove(d[0]) - print runs + print (runs) #### Warn when there are any missing runs if len(runs) !=0: - print '!'*10 - print 'MISSING ', ' '.join(runs) + print ('!'*10) + print ('MISSING ', ' '.join(runs)) ### prepare commands dlist=','.join([d[1] for d in ds]) @@ -106,7 +108,7 @@ def makeContainer(c1): comments = superTag+','+c1.derivation cmd='ami cmd COMAPopulateSuperProductionDataset -rucioRegistration="yes" -creationComment="'+comments+'" -selectionType="run_config" -superTag="'+superTag+'" -containedDatasets="'+dlist+'" -separator="," ' - print 'command:',cmd + print ('command:',cmd) ### write out script if asked if c1.outScript: @@ -139,7 +141,7 @@ def doFirstTry(): c1.grl = grl15 pds =[p['period'] for p in periods if p['status']=='frozen'] -# print pds +# print (pds) # sys.exit(0) for p in pds: @@ -161,7 +163,7 @@ def doData15(): c1.grl = grl15 pds =[p['period'] for p in periods if p['status']=='frozen'] -# print pds +# print (pds) # sys.exit(0) for p in pds: @@ -184,7 +186,7 @@ def do2016LaterPeriods(): c1.grl = grl16 # pds =[p['period'] for p in periods if p['status']=='frozen'] -# print pds +# print (pds) # sys.exit(0) pds = ['J', 'K', 'L'] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/update_CPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/update_CPContent.py index dc98885e138cd97a1c46da47627c8bf801a69f51..0a81ae99464ed2a7d0301d78fa627baa609dcdc1 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/update_CPContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/update_CPContent.py @@ -1,12 +1,15 @@ #!/usr/bin/env python -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function + import sys import os sys.path.append(os.path.abspath("../python")) import MuonsCPContent as mcc -print mcc.MuonsCPContent +print (mcc.MuonsCPContent) def makeContent(l): ct = 'MuonsCPContent = [\n' @@ -29,10 +32,10 @@ def mergeList(l1, l2, excludeList=[]): found = True for m in x[1:]: if m in y[1:]: continue - print m, 'is not found for', tag + print (m, 'is not found for', tag) l2[ji] += '.'+m if (not found) and (not (tag in excludeList)): - print tag, 'is not found' + print (tag, 'is not found') l1a.append(i) return l2+l1a @@ -41,8 +44,8 @@ list1 = [] with open(ifile) as if1: for line in if1.readlines(): list1.append(line.rstrip()) -print makeContent(list1) -print makeContent(mcc.MuonsCPContent) +print (makeContent(list1)) +print (makeContent(mcc.MuonsCPContent)) kk = mergeList(list1, mcc.MuonsCPContent, ['EventInfo', 'EventInfoAux']) nc = makeContent(kk) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON0.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON0.py index 872429414cfadc8b218c30c4b4ea3b14477684f0..17990106e311f3351bf34a7f9a9c384d6540250e 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON0.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON0.py @@ -28,7 +28,7 @@ triggerList = ['HLT_.*mu.*', 'L1_.*MU.*','HLT_noalg_L1.*MU.*'] from DerivationFrameworkCore.ThinningHelper import ThinningHelper MUON0ThinningHelper = ThinningHelper( "MUON0ThinningHelper" ) MUON0ThinningHelper.TriggerChains = '|'.join(triggerList1) -print MUON0ThinningHelper.TriggerChains +printfunc (MUON0ThinningHelper.TriggerChains) MUON0ThinningHelper.AppendToStream( MUON0Stream ) thinningSvc = getattr( svcMgr, "MUON0ThinningSvc" ) thinningHelperTool = getattr( ToolSvc, "MUON0ThinningHelperSlim" ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON1.py index 9577569fdb7a3d4580ae20d56e5a6b20a64236ab..a714cd23af43a356ef2a7e7c36c0c798c2c24aa6 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON1.py @@ -40,7 +40,7 @@ triggerList1 = ['HLT_.*mu\d+.*'] from DerivationFrameworkCore.ThinningHelper import ThinningHelper MUON1ThinningHelper = ThinningHelper( "MUON1ThinningHelper" ) MUON1ThinningHelper.TriggerChains = '|'.join(triggerList1) -print MUON1ThinningHelper.TriggerChains +printfunc (MUON1ThinningHelper.TriggerChains) MUON1ThinningHelper.AppendToStream( MUON1Stream ) #==================================================================== @@ -79,7 +79,7 @@ ToolSvc += MUON1AugmentTool1a MUON1AugmentTools.append(MUON1AugmentTool1a) skimmingORs.append(brPrefix1a+'DIMU_pass>0') thinningORs.append(brPrefix1a+'DIMU_trkStatus>0') -print MUON1AugmentTool1a +printfunc (MUON1AugmentTool1a) ### Jpsi for tag-probe @@ -114,7 +114,7 @@ ToolSvc += MUON1AugmentTool1b MUON1AugmentTools.append(MUON1AugmentTool1b) skimmingORs.append(brPrefix1b+'DIMU_pass>0') thinningORs.append(brPrefix1b+'DIMU_trkStatus>0') -print MUON1AugmentTool1b +printfunc (MUON1AugmentTool1b) ### Jpsi for calibration @@ -149,7 +149,7 @@ ToolSvc += MUON1AugmentTool1c MUON1AugmentTools.append(MUON1AugmentTool1c) skimmingORs.append(brPrefix1c+'DIMU_pass>0') thinningORs.append(brPrefix1c+'DIMU_trkStatus>0') -print MUON1AugmentTool1c +printfunc (MUON1AugmentTool1c) ### Upsilon tagging brPrefix1d = 'MUON1d' @@ -182,7 +182,7 @@ ToolSvc += MUON1AugmentTool1d MUON1AugmentTools.append(MUON1AugmentTool1d) skimmingORs.append(brPrefix1d+'DIMU_pass>0') thinningORs.append(brPrefix1d+'DIMU_trkStatus>0') -print MUON1AugmentTool1d +printfunc (MUON1AugmentTool1d) ### isolation decorations from DerivationFrameworkMuons.TrackIsolationDecorator import MUON1IDTrackDecorator as MUON1AugmentTool2a @@ -192,12 +192,12 @@ MUON1AugmentTool2a.SelectionFlagValue = 0 ToolSvc += MUON1AugmentTool2a MUON1AugmentTools.append(MUON1AugmentTool2a) -print MUON1AugmentTool2a +printfunc (MUON1AugmentTool2a) from DerivationFrameworkMuons.TrackIsolationDecorator import MUON1MSTrackDecorator as MUON1AugmentTool3 ToolSvc += MUON1AugmentTool3 MUON1AugmentTools.append(MUON1AugmentTool3) -print MUON1AugmentTool3 +printfunc (MUON1AugmentTool3) #==================================================================== # SKIMMING @@ -256,7 +256,7 @@ MUON1ThinningTool4 = DerivationFramework__CaloClusterThinning(name TopoClCollectionSGKey = "CaloCalTopoClusters", ConeSize = 0.5) ToolSvc += MUON1ThinningTool4 -print MUON1ThinningTool4 +printfunc (MUON1ThinningTool4) MUON1ThinningTools.append(MUON1ThinningTool4) ### also for forward tracks @@ -278,7 +278,8 @@ theCaloCellDFGetter = CaloCellDFGetter(inputClusterKeys=["MuonClusterCollection" from DerivationFrameworkMuons import JPsiVertexFitSetup MUON1AugmentTools += JPsiVertexFitSetup.AddJPsiVertexingAlgs('MUON1',False) -for t in MUON1AugmentTools: print t +for t in MUON1AugmentTools: + printfunc (t) from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Thin_vtxTrk MUON1Thin_vtxTrk = DerivationFramework__Thin_vtxTrk( diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON2.py index 2e9e6e55f18704ca7fbac7f67cabc5db9efe4a75..dcf96bb121760d74863dba64cb1f2b2e183da0fe 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON2.py @@ -12,7 +12,7 @@ isSimulation = False if globalflags.DataSource()=='geant4': isSimulation = True -print isSimulation +printfunc (isSimulation) #==================================================================== # AUGMENTATION TOOLS @@ -60,7 +60,7 @@ MUON2JpsiFinder = Analysis__JpsiFinder(name = "MUON2Jpsi VertexPointEstimator = MUON2_VertexTools.VtxPointEstimator, useMCPCuts = False) ToolSvc += MUON2JpsiFinder -print MUON2JpsiFinder +printfunc ( MUON2JpsiFinder) #-------------------------------------------------------------------- ## 3/ setup the vertex reconstruction "call" tool(s). They are part of the derivation framework. @@ -76,7 +76,7 @@ MUON2JpsiSelectAndWrite = DerivationFramework__Reco_mumu(name = RefPVContainerName = "SHOULDNOTBEUSED", DoVertexType =1) ToolSvc += MUON2JpsiSelectAndWrite -print MUON2JpsiSelectAndWrite +printfunc (MUON2JpsiSelectAndWrite) from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Select_onia2mumu @@ -94,7 +94,7 @@ MUON2_Select_Jpsi2mumu = DerivationFramework__Select_onia2mumu( ToolSvc += MUON2_Select_Jpsi2mumu -print MUON2_Select_Jpsi2mumu +printfunc ( MUON2_Select_Jpsi2mumu) @@ -107,7 +107,7 @@ BsKKVertexFit = Trk__TrkVKalVrtFitter( FirstMeasuredPoint = True, MakeExtendedVertex = True) ToolSvc += BsKKVertexFit -print BsKKVertexFit +printfunc ( BsKKVertexFit) from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter BplKplVertexFit = Trk__TrkVKalVrtFitter( @@ -116,7 +116,7 @@ BplKplVertexFit = Trk__TrkVKalVrtFitter( FirstMeasuredPoint = True, MakeExtendedVertex = True) ToolSvc += BplKplVertexFit -print BplKplVertexFit +printfunc ( BplKplVertexFit) ## 5/ setup the Jpsi+2 track finder @@ -145,7 +145,7 @@ TrackSelectorTool = MUON2_VertexTools.InDetTrackSelectorTool, UseMassConstraint = True) ToolSvc += MUON2BsJpsiKK -print MUON2BsJpsiKK +printfunc ( MUON2BsJpsiKK ) ## 5a/ setup the Jpsi+1 track finder from JpsiUpsilonTools.JpsiUpsilonToolsConf import Analysis__JpsiPlus1Track @@ -169,7 +169,7 @@ TrackSelectorTool = MUON2_VertexTools.InDetTrackSelectorTool, UseMassConstraint = True) ToolSvc += MUON2BplJpsiKpl -print MUON2BplJpsiKpl +printfunc ( MUON2BplJpsiKpl ) ## 6/ setup the combined augmentation/skimming tool for the Bpm @@ -182,7 +182,7 @@ MUON2BsKKSelectAndWrite = DerivationFramework__Reco_dimuTrkTrk(name RefitPV = True, MaxPVrefit = 10000, DoVertexType = 7) ToolSvc += MUON2BsKKSelectAndWrite -print MUON2BsKKSelectAndWrite +printfunc ( MUON2BsKKSelectAndWrite) from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Reco_dimuTrk MUON2BplKplSelectAndWrite = DerivationFramework__Reco_dimuTrk(name = "MUON2BplKplSelectAndWrite", @@ -193,7 +193,7 @@ MUON2BplKplSelectAndWrite = DerivationFramework__Reco_dimuTrk(name = "M RefitPV = True, MaxPVrefit = 10000 ) ToolSvc += MUON2BplKplSelectAndWrite -print MUON2BplKplSelectAndWrite +printfunc ( MUON2BplKplSelectAndWrite) ## b/ augment and select Bs->JpsiKK candidates @@ -208,7 +208,7 @@ MUON2_Select_Bs2JpsiKK = DerivationFramework__Select_onia2mumu( Chi2Max = 200) ToolSvc += MUON2_Select_Bs2JpsiKK -print MUON2_Select_Bs2JpsiKK +printfunc ( MUON2_Select_Bs2JpsiKK) MUON2_Select_Bpl2JpsiKpl = DerivationFramework__Select_onia2mumu( name = "MUON2_Select_Bpl2JpsiKpl", @@ -221,7 +221,7 @@ MUON2_Select_Bpl2JpsiKpl = DerivationFramework__Select_onia2mumu( Chi2Max = MUON2BplJpsiKpl.Chi2Cut) ToolSvc += MUON2_Select_Bpl2JpsiKpl -print MUON2_Select_Bpl2JpsiKpl +printfunc ( MUON2_Select_Bpl2JpsiKpl) MUON2_Select_Bpl2JpsiPi = DerivationFramework__Select_onia2mumu( name = "MUON2_Select_Bpl2JpsiPi", @@ -234,14 +234,14 @@ MUON2_Select_Bpl2JpsiPi = DerivationFramework__Select_onia2mumu( Chi2Max = MUON2BplJpsiKpl.Chi2Cut) ToolSvc += MUON2_Select_Bpl2JpsiPi -print MUON2_Select_Bpl2JpsiPi +printfunc ( MUON2_Select_Bpl2JpsiPi) #expression = "count(BpmJpsiKpmCandidates.passed_Bplus) > 0" #from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool #MUON2_SelectEvent = DerivationFramework__xAODStringSkimmingTool(name = "MUON2_SelectEvent", # expression = expression) #ToolSvc += MUON2_SelectEvent -#print MUON2_SelectEvent +#printfunc (MUON2_SelectEvent) #from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__SelectEvent @@ -253,17 +253,17 @@ if not isSimulation: #Only Skim Data expression = "count(BsJpsiKKCandidates.passed_Bs > 0) > 0") ToolSvc += MUON2_SelectBsJpsiKKEvent - print MUON2_SelectBsJpsiKKEvent + printfunc (MUON2_SelectBsJpsiKKEvent) MUON2_SelectBplJpsiKplEvent = DerivationFramework__xAODStringSkimmingTool(name = "MUON2_SelectBplJpsiKplEvent", expression = "count(BpmJpsiKpmCandidates.passed_Bplus>0) > 0") ToolSvc += MUON2_SelectBplJpsiKplEvent - print MUON2_SelectBplJpsiKplEvent + printfunc ( MUON2_SelectBplJpsiKplEvent) MUON2_SelectBplJpsiKplEventBc = DerivationFramework__xAODStringSkimmingTool(name = "MUON2_SelectBplJpsiKplEventBc", expression = "count(BpmJpsiKpmCandidates.passed_Bc>0) > 0") ToolSvc += MUON2_SelectBplJpsiKplEventBc - print MUON2_SelectBplJpsiKplEventBc + printfunc ( MUON2_SelectBplJpsiKplEventBc) #==================================================================== # Make event selection based on an OR of the input skimming tools @@ -272,7 +272,7 @@ if not isSimulation: #Only Skim Data MUON2SkimmingOR = CfgMgr.DerivationFramework__FilterCombinationOR("MUON2SkimmingOR", FilterList = [MUON2_SelectBsJpsiKKEvent, MUON2_SelectBplJpsiKplEvent, MUON2_SelectBplJpsiKplEventBc]) ToolSvc += MUON2SkimmingOR - print MUON2SkimmingOR + printfunc ( MUON2SkimmingOR) from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Thin_vtxTrk MUON2_thinningTool_Tracks = DerivationFramework__Thin_vtxTrk( @@ -322,7 +322,7 @@ ToolSvc+=MUON2ElectronTPThinningTool #==================================================================== thiningCollection = [] -print thiningCollection +printfunc (thiningCollection) from DerivationFrameworkJetEtMiss.JetCommon import * bphy5Seq = CfgMgr.AthSequencer("MUON2Sequence") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON5.py index 3f4872aca6e15ecd79505a4fecf305e88e8f594a..21c9f0f61519efa3c0f4e75d0d3c43a45edbeefd 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON5.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON5.py @@ -113,7 +113,7 @@ if is_MC: augmentationTools.append(MUON5BkgElectronClassificationTool) - print "BkgElectronClassificationTool: ", MUON5BkgElectronClassificationTool + printfunc ("BkgElectronClassificationTool: ", MUON5BkgElectronClassificationTool) #==================================================================== # THINNING TOOLS diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON6.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON6.py index e24e5981a4b0fb620d121ac3b5a480e2a630c635..1ae4dfcfe3c9a2cb8f13511c00c4f3ad8d2e8db5 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON6.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON6.py @@ -45,7 +45,7 @@ MUON6AugmentToolSel = DerivationFramework__dimuonTaggingTool(name = 'MUON6Augmen ToolSvc += MUON6AugmentToolSel MUON6AugmentTools.append(MUON6AugmentToolSel) -print MUON6AugmentToolSel +printfunc (MUON6AugmentToolSel) # Isolation decorations from DerivationFrameworkMuons.TrackIsolationDecorator import MUON1IDTrackDecorator as MUON6AugmentToolIsoDecID @@ -55,12 +55,12 @@ MUON6AugmentToolIsoDecID.SelectionFlagValue = 0 ToolSvc += MUON6AugmentToolIsoDecID MUON6AugmentTools.append(MUON6AugmentToolIsoDecID) -print MUON6AugmentToolIsoDecID +printfunc (MUON6AugmentToolIsoDecID) from DerivationFrameworkMuons.TrackIsolationDecorator import MUON1MSTrackDecorator as MUON6AugmentToolIsoDecMS ToolSvc += MUON6AugmentToolIsoDecMS MUON6AugmentTools.append(MUON6AugmentToolIsoDecMS) -print MUON6AugmentToolIsoDecMS +printfunc (MUON6AugmentToolIsoDecMS) #==================================================================== # SKIMMING diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/CMakeLists.txt index 79b0a55ab13ccf891a71d8292e8e6a62249a89b3..2c19af072bbd0e6987107625b2ff577a44a669ae 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/CMakeLists.txt @@ -39,10 +39,5 @@ atlas_add_component( DerivationFrameworkSUSY LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps xAODTruth RecoToolInterfaces AthenaKernel xAODAssociations xAODEventInfo xAODJet xAODTracking GaudiKernel ExpressionEvaluationLib MCTruthClassifierLib DerivationFrameworkSUSYLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/python/SUSY8ContentList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/python/SUSY8ContentList.py index c9e5a30ffc25a88919b30302716e23a75cd60a7e..79fc1d730ef0d4c1657710a0c2135d05fa365277 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/python/SUSY8ContentList.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/python/SUSY8ContentList.py @@ -1,29 +1,29 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration SUSY8SmartContent = [ - "AntiKt4EMTopoJets", - "Muons", - "Photons", - "MET_Reference_AntiKt4EMTopo", - "PrimaryVertices" - ] - + "AntiKt4EMTopoJets", + "Muons", + "Photons", + "MET_Reference_AntiKt4EMTopo", + "PrimaryVertices" + ] + SUSY8ExtraVariables = [ - # jets - #"AntiKt4EMTopoJets.pt", - #"AntiKt4EMTopoJets.eta", - #"AntiKt4EMTopoJets.phi", - #"AntiKt4EMTopoJets.m", - #"AntiKt4EMTopoJets.constituentLinks", - # taus - "TauJets.pt", - "TauJets.eta", - "TauJets.phi", - "TauJets.m" - ] - + # jets + #"AntiKt4EMTopoJets.pt", + #"AntiKt4EMTopoJets.eta", + #"AntiKt4EMTopoJets.phi", + #"AntiKt4EMTopoJets.m", + #"AntiKt4EMTopoJets.constituentLinks", + # taus + "TauJets.pt", + "TauJets.eta", + "TauJets.phi", + "TauJets.m" + ] + SUSY8AllVariablesContent = [ - #"CaloCalTopoClusters", + #"CaloCalTopoClusters", "CombinedMuonTrackParticles", "CombinedStauTrackParticles", #"ExtrapolatedMuonTrackParticles", @@ -50,4 +50,4 @@ SUSY8AllVariablesContent = [ "TruthEvents", "TruthParticles", "TruthVertices" - ] + ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/python/SUSY8TriggerList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/python/SUSY8TriggerList.py index 7743bead836607877a6be78ddb02f719e3c1c141..ef9ca66c556cb5387269b7c177b2ab7993f94c5e 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/python/SUSY8TriggerList.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/python/SUSY8TriggerList.py @@ -1,21 +1,21 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration SUSY8JetMETTriggers = [ - 'HLT_j100_xe80', + 'HLT_j100_xe80', 'HLT_j80_xe80' -# 'HLT_j80_xe80_dphi1_L1J40_DPHI-CJ20XE50', -# 'HLT_j80_xe80_dphi1_L1J40_DPHI-J20XE50', -# 'HLT_j80_xe80_dphi1_L1J40_DPHI-J20s2XE50', -# 'HLT_j80_xe80_dphi1_L1J40_DPHI-Js2XE50', -# 'HLT_j100_xe80_L1J40_DPHI-CJ20XE50', -# 'HLT_j100_xe80_L1J40_DPHI-J20XE50', -# 'HLT_j100_xe80_L1J40_DPHI-J20s2XE50', -# 'HLT_j100_xe80_L1J40_DPHI-Js2XE50' +# 'HLT_j80_xe80_dphi1_L1J40_DPHI-CJ20XE50', +# 'HLT_j80_xe80_dphi1_L1J40_DPHI-J20XE50', +# 'HLT_j80_xe80_dphi1_L1J40_DPHI-J20s2XE50', +# 'HLT_j80_xe80_dphi1_L1J40_DPHI-Js2XE50', +# 'HLT_j100_xe80_L1J40_DPHI-CJ20XE50', +# 'HLT_j100_xe80_L1J40_DPHI-J20XE50', +# 'HLT_j100_xe80_L1J40_DPHI-J20s2XE50', +# 'HLT_j100_xe80_L1J40_DPHI-Js2XE50' ] SUSY8MuonTriggers = [ - 'HLT_mu20_iloose_L1MU15', - 'HLT_mu24', + 'HLT_mu20_iloose_L1MU15', + 'HLT_mu24', 'HLT_mu24_imedium', 'HLT_mu24_iloose_L1MU15', 'HLT_mu24_L1MU15', @@ -29,24 +29,24 @@ SUSY8MuonTriggers = [ ] SUSY8DimuonTriggers = [ - 'HLT_2mu10', + 'HLT_2mu10', 'HLT_2mu14' ] SUSY8METTriggers = [ - 'HLT_xe120', - 'HLT_xe120_mht', - 'HLT_xe120_pueta', - 'HLT_xe120_pufit', - 'HLT_xe120_tc_em', - 'HLT_xe120_tc_lcw', - 'HLT_xe120_wEFMu', - 'HLT_xe120_mht_wEFMu', - 'HLT_xe120_pueta_wEFMu', - 'HLT_xe120_pufit_wEFMu', - 'HLT_xe120_tc_em_wEFMu', - 'HLT_xe120_tc_lcw_wEFMu', - 'HLT_xe120_L1XE80_BGRP7', + 'HLT_xe120', + 'HLT_xe120_mht', + 'HLT_xe120_pueta', + 'HLT_xe120_pufit', + 'HLT_xe120_tc_em', + 'HLT_xe120_tc_lcw', + 'HLT_xe120_wEFMu', + 'HLT_xe120_mht_wEFMu', + 'HLT_xe120_pueta_wEFMu', + 'HLT_xe120_pufit_wEFMu', + 'HLT_xe120_tc_em_wEFMu', + 'HLT_xe120_tc_lcw_wEFMu', + 'HLT_xe120_L1XE80_BGRP7', 'HLT_xe120_mht_L1XE80_BGRP7', 'HLT_xe120_pueta_L1XE80_BGRP7', 'HLT_xe120_pufit_L1XE80_BGRP7', @@ -58,91 +58,91 @@ SUSY8METTriggers = [ 'HLT_xe120_pufit_wEFMu_L1XE80_BGRP7', 'HLT_xe120_tc_em_wEFMu_L1XE80_BGRP7', 'HLT_xe120_tc_lcw_wEFMu_L1XE80_BGRP7', - 'HLT_xe100', - 'HLT_xe100_wEFMu', - 'HLT_xe100_mht', - 'HLT_xe100_mht_wEFMu', - 'HLT_xe100_pueta', - 'HLT_xe100_pueta_wEFMu', - 'HLT_xe100_pufit', - 'HLT_xe100_pufit_wEFMu', - 'HLT_xe100_tc_em', - 'HLT_xe100_tc_em_wEFMu', - 'HLT_xe100_tc_lcw', - 'HLT_xe100_tc_lcw_wEFMu', - 'HLT_xe100_L1XE80', - 'HLT_xe100_mht_L1XE80', - 'HLT_xe100_pueta_L1XE80', - 'HLT_xe100_pufit_L1XE80', - 'HLT_xe100_tc_em_L1XE80', - 'HLT_xe100_tc_lcw_L1XE80', - 'HLT_xe100_wEFMu_L1XE80', - 'HLT_xe100_mht_wEFMu_L1XE80', - 'HLT_xe100_pueta_wEFMu_L1XE80', - 'HLT_xe100_pufit_wEFMu_L1XE80', - 'HLT_xe100_tc_em_wEFMu_L1XE80', - 'HLT_xe100_tc_lcw_wEFMu_L1XE80', - 'HLT_xe100_L1XE70_BGRP7', - 'HLT_xe100_mht_L1XE70_BGRP7', - 'HLT_xe100_pueta_L1XE70_BGRP7', - 'HLT_xe100_pufit_L1XE70_BGRP7', - 'HLT_xe100_tc_em_L1XE70_BGRP7', - 'HLT_xe100_tc_lcw_L1XE70_BGRP7', - 'HLT_xe100_wEFMu_L1XE70_BGRP7', - 'HLT_xe100_mht_wEFMu_L1XE70_BGRP7', - 'HLT_xe100_pueta_wEFMu_L1XE70_BGRP7', - 'HLT_xe100_pufit_wEFMu_L1XE70_BGRP7', - 'HLT_xe100_tc_em_wEFMu_L1XE70_BGRP7', - 'HLT_xe100_tc_lcw_wEFMu_L1XE70_BGRP7', - 'HLT_xe100_L1XE80_BGRP7', - 'HLT_xe100_mht_L1XE80_BGRP7', - 'HLT_xe100_pueta_L1XE80_BGRP7', - 'HLT_xe100_pufit_L1XE80_BGRP7', - 'HLT_xe100_tc_em_L1XE80_BGRP7', - 'HLT_xe100_tc_lcw_L1XE80_BGRP7', - 'HLT_xe100_wEFMu_L1XE80_BGRP7', - 'HLT_xe100_mht_wEFMu_L1XE80_BGRP7', - 'HLT_xe100_pueta_wEFMu_L1XE80_BGRP7', - 'HLT_xe100_pufit_wEFMu_L1XE80_BGRP7', - 'HLT_xe100_tc_em_wEFMu_L1XE80_BGRP7', - 'HLT_xe100_tc_lcw_wEFMu_L1XE80_BGRP7', - 'HLT_xe80_L1XE70', - 'HLT_xe80_wEFMu_L1XE70', - 'HLT_xe80_mht_L1XE70', - 'HLT_xe80_mht_wEFMu_L1XE70', - 'HLT_xe80_pueta_L1XE70', - 'HLT_xe80_pueta_wEFMu_L1XE70', - 'HLT_xe80_pufit_L1XE70', - 'HLT_xe80_pufit_wEFMu_L1XE70', - 'HLT_xe80_tc_em_L1XE70', - 'HLT_xe80_tc_em_wEFMu_L1XE70', - 'HLT_xe80_tc_lcw_L1XE70', - 'HLT_xe80_tc_lcw_wEFMu_L1XE70', - 'HLT_xe80_L1XE70_BGRP7', - 'HLT_xe80_mht_L1XE70_BGRP7', - 'HLT_xe80_pueta_L1XE70_BGRP7', - 'HLT_xe80_pufit_L1XE70_BGRP7', - 'HLT_xe80_tc_em_L1XE70_BGRP7', - 'HLT_xe80_tc_lcw_L1XE70_BGRP7', - 'HLT_xe80_wEFMu_L1XE70_BGRP7', - 'HLT_xe80_mht_wEFMu_L1XE70_BGRP7', - 'HLT_xe80_tc_lcw_wEFMu_L1XE70_BGRP7', - 'HLT_xe80_pueta_wEFMu_L1XE70_BGRP7', - 'HLT_xe80_pufit_wEFMu_L1XE70_BGRP7', - 'HLT_xe80_tc_em_wEFMu_L1XE70_BGRP7', - 'HLT_xe80', - 'HLT_xe80_wEFMu', - 'HLT_xe80_mht', - 'HLT_xe80_mht_wEFMu', - 'HLT_xe80_pueta', - 'HLT_xe80_pueta_wEFMu', - 'HLT_xe80_pufit', - 'HLT_xe80_pufit_wEFMu', - 'HLT_xe80_tc_em', - 'HLT_xe80_tc_em_wEFMu', - 'HLT_xe80_tc_lcw', - 'HLT_xe80_tc_lcw_wEFMu', - 'HLT_xe80_L1XE50', + 'HLT_xe100', + 'HLT_xe100_wEFMu', + 'HLT_xe100_mht', + 'HLT_xe100_mht_wEFMu', + 'HLT_xe100_pueta', + 'HLT_xe100_pueta_wEFMu', + 'HLT_xe100_pufit', + 'HLT_xe100_pufit_wEFMu', + 'HLT_xe100_tc_em', + 'HLT_xe100_tc_em_wEFMu', + 'HLT_xe100_tc_lcw', + 'HLT_xe100_tc_lcw_wEFMu', + 'HLT_xe100_L1XE80', + 'HLT_xe100_mht_L1XE80', + 'HLT_xe100_pueta_L1XE80', + 'HLT_xe100_pufit_L1XE80', + 'HLT_xe100_tc_em_L1XE80', + 'HLT_xe100_tc_lcw_L1XE80', + 'HLT_xe100_wEFMu_L1XE80', + 'HLT_xe100_mht_wEFMu_L1XE80', + 'HLT_xe100_pueta_wEFMu_L1XE80', + 'HLT_xe100_pufit_wEFMu_L1XE80', + 'HLT_xe100_tc_em_wEFMu_L1XE80', + 'HLT_xe100_tc_lcw_wEFMu_L1XE80', + 'HLT_xe100_L1XE70_BGRP7', + 'HLT_xe100_mht_L1XE70_BGRP7', + 'HLT_xe100_pueta_L1XE70_BGRP7', + 'HLT_xe100_pufit_L1XE70_BGRP7', + 'HLT_xe100_tc_em_L1XE70_BGRP7', + 'HLT_xe100_tc_lcw_L1XE70_BGRP7', + 'HLT_xe100_wEFMu_L1XE70_BGRP7', + 'HLT_xe100_mht_wEFMu_L1XE70_BGRP7', + 'HLT_xe100_pueta_wEFMu_L1XE70_BGRP7', + 'HLT_xe100_pufit_wEFMu_L1XE70_BGRP7', + 'HLT_xe100_tc_em_wEFMu_L1XE70_BGRP7', + 'HLT_xe100_tc_lcw_wEFMu_L1XE70_BGRP7', + 'HLT_xe100_L1XE80_BGRP7', + 'HLT_xe100_mht_L1XE80_BGRP7', + 'HLT_xe100_pueta_L1XE80_BGRP7', + 'HLT_xe100_pufit_L1XE80_BGRP7', + 'HLT_xe100_tc_em_L1XE80_BGRP7', + 'HLT_xe100_tc_lcw_L1XE80_BGRP7', + 'HLT_xe100_wEFMu_L1XE80_BGRP7', + 'HLT_xe100_mht_wEFMu_L1XE80_BGRP7', + 'HLT_xe100_pueta_wEFMu_L1XE80_BGRP7', + 'HLT_xe100_pufit_wEFMu_L1XE80_BGRP7', + 'HLT_xe100_tc_em_wEFMu_L1XE80_BGRP7', + 'HLT_xe100_tc_lcw_wEFMu_L1XE80_BGRP7', + 'HLT_xe80_L1XE70', + 'HLT_xe80_wEFMu_L1XE70', + 'HLT_xe80_mht_L1XE70', + 'HLT_xe80_mht_wEFMu_L1XE70', + 'HLT_xe80_pueta_L1XE70', + 'HLT_xe80_pueta_wEFMu_L1XE70', + 'HLT_xe80_pufit_L1XE70', + 'HLT_xe80_pufit_wEFMu_L1XE70', + 'HLT_xe80_tc_em_L1XE70', + 'HLT_xe80_tc_em_wEFMu_L1XE70', + 'HLT_xe80_tc_lcw_L1XE70', + 'HLT_xe80_tc_lcw_wEFMu_L1XE70', + 'HLT_xe80_L1XE70_BGRP7', + 'HLT_xe80_mht_L1XE70_BGRP7', + 'HLT_xe80_pueta_L1XE70_BGRP7', + 'HLT_xe80_pufit_L1XE70_BGRP7', + 'HLT_xe80_tc_em_L1XE70_BGRP7', + 'HLT_xe80_tc_lcw_L1XE70_BGRP7', + 'HLT_xe80_wEFMu_L1XE70_BGRP7', + 'HLT_xe80_mht_wEFMu_L1XE70_BGRP7', + 'HLT_xe80_tc_lcw_wEFMu_L1XE70_BGRP7', + 'HLT_xe80_pueta_wEFMu_L1XE70_BGRP7', + 'HLT_xe80_pufit_wEFMu_L1XE70_BGRP7', + 'HLT_xe80_tc_em_wEFMu_L1XE70_BGRP7', + 'HLT_xe80', + 'HLT_xe80_wEFMu', + 'HLT_xe80_mht', + 'HLT_xe80_mht_wEFMu', + 'HLT_xe80_pueta', + 'HLT_xe80_pueta_wEFMu', + 'HLT_xe80_pufit', + 'HLT_xe80_pufit_wEFMu', + 'HLT_xe80_tc_em', + 'HLT_xe80_tc_em_wEFMu', + 'HLT_xe80_tc_lcw', + 'HLT_xe80_tc_lcw_wEFMu', + 'HLT_xe80_L1XE50', 'HLT_xe80_wEFMu_L1XE50', 'HLT_xe80_mht_L1XE50', 'HLT_xe80_mht_wEFMu_L1XE50', @@ -154,86 +154,86 @@ SUSY8METTriggers = [ 'HLT_xe80_tc_em_wEFMu_L1XE50', 'HLT_xe80_tc_lcw_L1XE50', 'HLT_xe80_tc_lcw_wEFMu_L1XE50', - 'HLT_xe80_L1XE60_BGRP7', - 'HLT_xe80_mht_L1XE60_BGRP7', - 'HLT_xe80_pueta_L1XE60_BGRP7', - 'HLT_xe80_pufit_L1XE60_BGRP7', - 'HLT_xe80_tc_em_L1XE60_BGRP7', - 'HLT_xe80_tc_lcw_L1XE60_BGRP7', - 'HLT_xe80_wEFMu_L1XE60_BGRP7', - 'HLT_xe80_mht_wEFMu_L1XE60_BGRP7', - 'HLT_xe80_pueta_wEFMu_L1XE60_BGRP7', - 'HLT_xe80_pufit_wEFMu_L1XE60_BGRP7', - 'HLT_xe80_tc_em_wEFMu_L1XE60_BGRP7', - 'HLT_xe80_tc_lcw_wEFMu_L1XE60_BGRP7', - 'HLT_xe80_L1XE50_BGRP7', - 'HLT_xe80_mht_L1XE50_BGRP7', - 'HLT_xe80_pueta_L1XE50_BGRP7', - 'HLT_xe80_pufit_L1XE50_BGRP7', - 'HLT_xe80_tc_em_L1XE50_BGRP7', - 'HLT_xe80_tc_lcw_L1XE50_BGRP7', - 'HLT_xe80_wEFMu_L1XE50_BGRP7', - 'HLT_xe80_mht_wEFMu_L1XE50_BGRP7', - 'HLT_xe80_pueta_wEFMu_L1XE50_BGRP7', - 'HLT_xe80_pufit_wEFMu_L1XE50_BGRP7', - 'HLT_xe80_tc_em_wEFMu_L1XE50_BGRP7', - 'HLT_xe80_tc_lcw_wEFMu_L1XE50_BGRP7', - 'HLT_xe70', - 'HLT_xe70_wEFMu', - 'HLT_xe70_mht', - 'HLT_xe70_mht_wEFMu', - 'HLT_xe70_pueta', - 'HLT_xe70_pueta_wEFMu', - 'HLT_xe70_pufit', - 'HLT_xe70_pufit_wEFMu', - 'HLT_xe70_tc_em', - 'HLT_xe70_tc_em_wEFMu', - 'HLT_xe70_tc_lcw', - 'HLT_xe70_tc_lcw_wEFMu', - 'HLT_xe70_L1XE50_BGRP7', - 'HLT_xe70_mht_L1XE50_BGRP7', - 'HLT_xe70_pueta_L1XE50_BGRP7', - 'HLT_xe70_pufit_L1XE50_BGRP7', - 'HLT_xe70_tc_em_L1XE50_BGRP7', - 'HLT_xe70_tc_lcw_L1XE50_BGRP7', - 'HLT_xe70_wEFMu_L1XE50_BGRP7', - 'HLT_xe70_mht_wEFMu_L1XE50_BGRP7', - 'HLT_xe70_pueta_wEFMu_L1XE50_BGRP7', - 'HLT_xe70_pufit_wEFMu_L1XE50_BGRP7', - 'HLT_xe70_tc_em_wEFMu_L1XE50_BGRP7', - 'HLT_xe70_tc_lcw_wEFMu_L1XE50_BGRP7', - 'HLT_xe70_L1XE45', - 'HLT_xe60', - 'HLT_xe60_wEFMu', - 'HLT_xe60_mht', - 'HLT_xe60_mht_wEFMu', - 'HLT_xe60_pueta', - 'HLT_xe60_pueta_wEFMu', - 'HLT_xe60_pufit', - 'HLT_xe60_pufit_wEFMu', - 'HLT_xe60_tc_em', - 'HLT_xe60_tc_em_wEFMu', - 'HLT_xe60_tc_lcw', - 'HLT_xe60_tc_lcw_wEFMu', - 'HLT_xe50', - 'HLT_xe50_mht', - 'HLT_xe50_pueta', - 'HLT_xe50_pufit', - 'HLT_xe50_tc_em', - 'HLT_xe50_tc_lcw', - 'HLT_xe50_L1XE35_BGRP7', - 'HLT_xe50_mht_L1XE35_BGRP7', - 'HLT_xe50_pueta_L1XE35_BGRP7', - 'HLT_xe50_pufit_L1XE35_BGRP7', - 'HLT_xe50_tc_em_L1XE35_BGRP7', - 'HLT_xe50_tc_lcw_L1XE35_BGRP7', - 'HLT_xe50_L1XE35_BGRP7', - 'HLT_xe50_mht_L1XE35_BGRP7', - 'HLT_xe50_pueta_L1XE35_BGRP7', - 'HLT_xe50_pufit_L1XE35_BGRP7', - 'HLT_xe50_tc_em_L1XE35_BGRP7', - 'HLT_xe50_tc_lcw_L1XE35_BGRP7', - 'HLT_xe35', + 'HLT_xe80_L1XE60_BGRP7', + 'HLT_xe80_mht_L1XE60_BGRP7', + 'HLT_xe80_pueta_L1XE60_BGRP7', + 'HLT_xe80_pufit_L1XE60_BGRP7', + 'HLT_xe80_tc_em_L1XE60_BGRP7', + 'HLT_xe80_tc_lcw_L1XE60_BGRP7', + 'HLT_xe80_wEFMu_L1XE60_BGRP7', + 'HLT_xe80_mht_wEFMu_L1XE60_BGRP7', + 'HLT_xe80_pueta_wEFMu_L1XE60_BGRP7', + 'HLT_xe80_pufit_wEFMu_L1XE60_BGRP7', + 'HLT_xe80_tc_em_wEFMu_L1XE60_BGRP7', + 'HLT_xe80_tc_lcw_wEFMu_L1XE60_BGRP7', + 'HLT_xe80_L1XE50_BGRP7', + 'HLT_xe80_mht_L1XE50_BGRP7', + 'HLT_xe80_pueta_L1XE50_BGRP7', + 'HLT_xe80_pufit_L1XE50_BGRP7', + 'HLT_xe80_tc_em_L1XE50_BGRP7', + 'HLT_xe80_tc_lcw_L1XE50_BGRP7', + 'HLT_xe80_wEFMu_L1XE50_BGRP7', + 'HLT_xe80_mht_wEFMu_L1XE50_BGRP7', + 'HLT_xe80_pueta_wEFMu_L1XE50_BGRP7', + 'HLT_xe80_pufit_wEFMu_L1XE50_BGRP7', + 'HLT_xe80_tc_em_wEFMu_L1XE50_BGRP7', + 'HLT_xe80_tc_lcw_wEFMu_L1XE50_BGRP7', + 'HLT_xe70', + 'HLT_xe70_wEFMu', + 'HLT_xe70_mht', + 'HLT_xe70_mht_wEFMu', + 'HLT_xe70_pueta', + 'HLT_xe70_pueta_wEFMu', + 'HLT_xe70_pufit', + 'HLT_xe70_pufit_wEFMu', + 'HLT_xe70_tc_em', + 'HLT_xe70_tc_em_wEFMu', + 'HLT_xe70_tc_lcw', + 'HLT_xe70_tc_lcw_wEFMu', + 'HLT_xe70_L1XE50_BGRP7', + 'HLT_xe70_mht_L1XE50_BGRP7', + 'HLT_xe70_pueta_L1XE50_BGRP7', + 'HLT_xe70_pufit_L1XE50_BGRP7', + 'HLT_xe70_tc_em_L1XE50_BGRP7', + 'HLT_xe70_tc_lcw_L1XE50_BGRP7', + 'HLT_xe70_wEFMu_L1XE50_BGRP7', + 'HLT_xe70_mht_wEFMu_L1XE50_BGRP7', + 'HLT_xe70_pueta_wEFMu_L1XE50_BGRP7', + 'HLT_xe70_pufit_wEFMu_L1XE50_BGRP7', + 'HLT_xe70_tc_em_wEFMu_L1XE50_BGRP7', + 'HLT_xe70_tc_lcw_wEFMu_L1XE50_BGRP7', + 'HLT_xe70_L1XE45', + 'HLT_xe60', + 'HLT_xe60_wEFMu', + 'HLT_xe60_mht', + 'HLT_xe60_mht_wEFMu', + 'HLT_xe60_pueta', + 'HLT_xe60_pueta_wEFMu', + 'HLT_xe60_pufit', + 'HLT_xe60_pufit_wEFMu', + 'HLT_xe60_tc_em', + 'HLT_xe60_tc_em_wEFMu', + 'HLT_xe60_tc_lcw', + 'HLT_xe60_tc_lcw_wEFMu', + 'HLT_xe50', + 'HLT_xe50_mht', + 'HLT_xe50_pueta', + 'HLT_xe50_pufit', + 'HLT_xe50_tc_em', + 'HLT_xe50_tc_lcw', + 'HLT_xe50_L1XE35_BGRP7', + 'HLT_xe50_mht_L1XE35_BGRP7', + 'HLT_xe50_pueta_L1XE35_BGRP7', + 'HLT_xe50_pufit_L1XE35_BGRP7', + 'HLT_xe50_tc_em_L1XE35_BGRP7', + 'HLT_xe50_tc_lcw_L1XE35_BGRP7', + 'HLT_xe50_L1XE35_BGRP7', + 'HLT_xe50_mht_L1XE35_BGRP7', + 'HLT_xe50_pueta_L1XE35_BGRP7', + 'HLT_xe50_pufit_L1XE35_BGRP7', + 'HLT_xe50_tc_em_L1XE35_BGRP7', + 'HLT_xe50_tc_lcw_L1XE35_BGRP7', + 'HLT_xe35', 'HLT_xe35_wEFMu', 'HLT_xe35_mht', 'HLT_xe35_mht_wEFMu', @@ -245,16 +245,16 @@ SUSY8METTriggers = [ 'HLT_xe35_tc_em_wEFMu', 'HLT_xe35_tc_lcw', 'HLT_xe35_tc_lcw_wEFMu' - 'HLT_xe35_L1XE35_BGRP7', - 'HLT_xe35_mht_L1XE35_BGRP7', - 'HLT_xe35_pueta_L1XE35_BGRP7', - 'HLT_xe35_pufit_L1XE35_BGRP7', - 'HLT_xe35_tc_em_L1XE35_BGRP7', - 'HLT_xe35_tc_lcw_L1XE35_BGRP7', - 'HLT_xe35_wEFMu_L1XE35_BGRP7', - 'HLT_xe35_mht_wEFMu_L1XE35_BGRP7', - 'HLT_xe35_pueta_wEFMu_L1XE35_BGRP7', - 'HLT_xe35_pufit_wEFMu_L1XE35_BGRP7', - 'HLT_xe35_tc_em_wEFMu_L1XE35_BGRP7', - 'HLT_xe35_tc_lcw_wEFMu_L1XE35_BGRP7' + 'HLT_xe35_L1XE35_BGRP7', + 'HLT_xe35_mht_L1XE35_BGRP7', + 'HLT_xe35_pueta_L1XE35_BGRP7', + 'HLT_xe35_pufit_L1XE35_BGRP7', + 'HLT_xe35_tc_em_L1XE35_BGRP7', + 'HLT_xe35_tc_lcw_L1XE35_BGRP7', + 'HLT_xe35_wEFMu_L1XE35_BGRP7', + 'HLT_xe35_mht_wEFMu_L1XE35_BGRP7', + 'HLT_xe35_pueta_wEFMu_L1XE35_BGRP7', + 'HLT_xe35_pufit_wEFMu_L1XE35_BGRP7', + 'HLT_xe35_tc_em_wEFMu_L1XE35_BGRP7', + 'HLT_xe35_tc_lcw_wEFMu_L1XE35_BGRP7' ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/CMakeLists.txt index 74ab42c4f0539f5c059b230c3d11af8ec5d19405..f953620a6584bffebe157a15b021c02a99d1547d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/CMakeLists.txt @@ -28,10 +28,5 @@ atlas_add_component( DerivationFrameworkTau LINK_LIBRARIES AthenaBaseComps xAODTracking GaudiKernel xAODTau JpsiUpsilonToolsLib DerivationFrameworkTauLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt index 6d8ef3ae2b878e1825a377d411782fe33fa5e2e8..fb6e5abd7d1d0e13a4070aa9d97e74643635b605 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt @@ -88,8 +88,3 @@ endif() atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) atlas_install_data( data/*.root data/*.conf ) - -# Check python syntax on Config files -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python/*Config.py - POST_EXEC_SCRIPT nopost.sh ) diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/customGetter.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/customGetter.h index 820f82556063429726b36889e773e934bf95d360..16d4d7b77f522f246f73d02b8755746babdd9c7d 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/customGetter.h +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/customGetter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // The customGetter file is a catch-all for various getter functinos @@ -18,6 +18,32 @@ #define CUSTOM_GETTER_H namespace FlavorTagDiscriminants { + + /// Factory function to produce TrackParticle -> vector<double> functions + /// + /// DL2 configures the its inputs when the algorithm is initalized, + /// meaning that the list of track and jet properties that are used + /// as inputs won't be known at compile time. Instead we build an + /// array of "getter" functions, each of which returns one input for + /// the tagger. The function here returns those getter functions. + /// + /// Many of the getter functions are trivial: they will, for example, + /// read one double of auxdata off of the BTagging object. The + /// sequence input getters tend to be more complicated. Since we'd + /// like to avoid reimplementing the logic in these functions in + /// multiple places, they are exposed here. + /// + /// This function will return a getter based on a string key. See the + /// implementation for the definitions. + /// + /// NOTE: This function is for experts only, don't expect support. + /// + std::function<std::vector<double>( + const xAOD::Jet&, + const std::vector<const xAOD::TrackParticle*>&)> + customSequenceGetter(const std::string& name); + + // internal functions namespace internal { std::function<std::pair<std::string, double>(const xAOD::Jet&)> customGetterAndName(const std::string&); diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/customGetter.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/customGetter.cxx index e8753e238d45bf8ba01a05cd56cec9229677d0c9..800a1d54da7ed607b1e0a62cfd1568f59137062d 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/customGetter.cxx +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/customGetter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "FlavorTagDiscriminants/customGetter.h" #include "FlavorTagDiscriminants/BTagTrackAugmenter.h" @@ -68,6 +68,40 @@ namespace { }; +} + +namespace FlavorTagDiscriminants { + namespace internal { + + // ________________________________________________________________ + // Interface functions + // + // As long as we're giving lwtnn pair<name, double> objects, we + // can't use the raw getter functions above (which only return a + // double). Instead we'll wrap those functions in another function, + // which returns the pair we wanted. + // + // Case for jet variables + std::function<std::pair<std::string, double>(const xAOD::Jet&)> + customGetterAndName(const std::string& name) { + auto getter = customGetter(name); + return [name, getter](const xAOD::Jet& j) { + return std::make_pair(name, getter(j)); + }; + } + + // Case for track variables + std::function<std::pair<std::string, std::vector<double>>( + const xAOD::Jet&, + const std::vector<const xAOD::TrackParticle*>&)> + customNamedSeqGetter(const std::string& name) { + auto getter = customSequenceGetter(name); + return [name, getter](const xAOD::Jet& j, + const std::vector<const xAOD::TrackParticle*>& t) { + return std::make_pair(name, getter(j, t)); + }; + } + } // ________________________________________________________________________ // Master track getter list // @@ -76,8 +110,8 @@ namespace { // std::function<std::vector<double>( const xAOD::Jet&, - const std::vector<const xAOD::TrackParticle*>&)> customSeqGetter( - const std::string& name) { + const std::vector<const xAOD::TrackParticle*>&)> + customSequenceGetter(const std::string& name) { typedef std::vector<const xAOD::TrackParticle*> Tracks; if (name == "IP3D_signed_d0_significance") { return SignedD0SequenceGetter(); @@ -116,40 +150,21 @@ namespace { return log_dr; }; } - throw std::logic_error("no match for custom getter " + name); - } -} - -namespace FlavorTagDiscriminants { - namespace internal { - - // ________________________________________________________________ - // Interface functions - // - // As long as we're giving lwtnn pair<name, double> objects, we - // can't use the raw getter functions above (which only return a - // double). Instead we'll wrap those functions in another function, - // which returns the pair we wanted. - // - // Case for jet variables - std::function<std::pair<std::string, double>(const xAOD::Jet&)> - customGetterAndName(const std::string& name) { - auto getter = customGetter(name); - return [name, getter](const xAOD::Jet& j) { - return std::make_pair(name, getter(j)); + if (name == "pt") { + return [](const xAOD::Jet&, const Tracks& t) { + std::vector<double> tracks; + for (auto* trk: t) tracks.push_back(trk->pt()); + return tracks; }; } - - // Case for track variables - std::function<std::pair<std::string, std::vector<double>>( - const xAOD::Jet&, - const std::vector<const xAOD::TrackParticle*>&)> - customNamedSeqGetter(const std::string& name) { - auto getter = customSeqGetter(name); - return [name, getter](const xAOD::Jet& j, - const std::vector<const xAOD::TrackParticle*>& t) { - return std::make_pair(name, getter(j, t)); + if (name == "eta") { + return [](const xAOD::Jet&, const Tracks& t) { + std::vector<double> tracks; + for (auto* trk: t) tracks.push_back(trk->eta()); + return tracks; }; } + throw std::logic_error("no match for custom getter " + name); } + } diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/ImprovedJetFitterInitializationHelperConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/ImprovedJetFitterInitializationHelperConfig.py index e1ee51a4c1c7b6e9423025c14ba22dcd11c74c6c..d2096f341690e829dea813c50853a1c36ceef4b7 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/ImprovedJetFitterInitializationHelperConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/ImprovedJetFitterInitializationHelperConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -18,8 +18,7 @@ def ImprovedJetFitterInitializationHelperCfg(name, useBTagFlagsDefaults = True, acc = ComponentAccumulator() if useBTagFlagsDefaults: jetFitterFullLinearizedTrackFactory = acc.popToolsAndMerge(JetFitterFullLinearizedTrackFactoryCfg('JFFullLinearizedTrackFactory')) - defaults = { - 'LinearizedTrackFactory' : jetFitterFullLinearizedTrackFactory} + defaults = {'LinearizedTrackFactory' : jetFitterFullLinearizedTrackFactory} for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name diff --git a/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt b/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt index 56063345bf8b04bc1fc91b2e0b436d897727dde3..2d400ab9772870cc036e8a36c687d2de3e5ddd53 100644 --- a/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt +++ b/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt @@ -32,6 +32,7 @@ elseif( XAOD_ANALYSIS ) elseif(GENERATIONBASE) set(extra_deps GaudiKernel + Generators/AtlasHepMC Generators/GeneratorObjects PRIVATE Control/AthenaKernel) @@ -66,6 +67,7 @@ atlas_depends_on_subdirs( Control/AthToolSupport/AsgTools Event/xAOD/xAODTruth Generators/TruthUtils + Generators/AtlasHepMC ${extra_deps} ) # External dependencies: diff --git a/PhysicsAnalysis/MCTruthClassifier/src/MCTruthClassifierAthena.cxx b/PhysicsAnalysis/MCTruthClassifier/src/MCTruthClassifierAthena.cxx index 26f4b1ff15cbe67371d74d4764c63ed7e670ce36..c605f923d719e11a6f5390cfb2f04e83fca35962 100644 --- a/PhysicsAnalysis/MCTruthClassifier/src/MCTruthClassifierAthena.cxx +++ b/PhysicsAnalysis/MCTruthClassifier/src/MCTruthClassifierAthena.cxx @@ -19,7 +19,7 @@ // Athena only includes #include "AthenaKernel/Units.h" #include "GeneratorObjects/xAODTruthParticleLink.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" #include "TrkEventPrimitives/PropDirection.h" #include "TrkParametersIdentificationHelpers/TrackParametersIdHelper.h" diff --git a/PhysicsAnalysis/NTUPtoNTUP/JetN2N/CMakeLists.txt b/PhysicsAnalysis/NTUPtoNTUP/JetN2N/CMakeLists.txt index 86e624377c4c8555efd980336f16b9c71986a51c..2a4be6c836c9cf02f30f35dbf14741b9658c95e2 100644 --- a/PhysicsAnalysis/NTUPtoNTUP/JetN2N/CMakeLists.txt +++ b/PhysicsAnalysis/NTUPtoNTUP/JetN2N/CMakeLists.txt @@ -6,13 +6,9 @@ atlas_subdir( JetN2N ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - atlas_add_test( flake8_share SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share POST_EXEC_SCRIPT nopost.sh ) diff --git a/PhysicsAnalysis/NTUPtoNTUP/JetN2N/python/JetN2NFlags.py b/PhysicsAnalysis/NTUPtoNTUP/JetN2N/python/JetN2NFlags.py index ff837c11af65c69063dd7ee1f9f8c878470d304c..eb055b62b68eed76fe528243b5b762b0506a2239 100644 --- a/PhysicsAnalysis/NTUPtoNTUP/JetN2N/python/JetN2NFlags.py +++ b/PhysicsAnalysis/NTUPtoNTUP/JetN2N/python/JetN2NFlags.py @@ -1,19 +1,19 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer from AthenaCommon.JobProperties import jobproperties class JetN2NFlags (JobPropertyContainer): - """Flags for Jet N2N making. - """ + """Flags for Jet N2N making. + """ jobproperties.add_Container (JetN2NFlags) class JetN2NYear (JobProperty): - """Define which year (2011 or 2012)""" - statusOn = True - allowedTypes = ['str'] - StoredValue = '2012' + """Define which year (2011 or 2012)""" + statusOn = True + allowedTypes = ['str'] + StoredValue = '2012' jobproperties.JetN2NFlags.add_JobProperty(JetN2NYear) # shortcut name diff --git a/PhysicsAnalysis/NTUPtoNTUP/JetN2N/python/SlimSMQCD.py b/PhysicsAnalysis/NTUPtoNTUP/JetN2N/python/SlimSMQCD.py index 13b979427706d0945deb98a316b60cb9cb2b2b2e..b60945881fbf179553fedbb5c2fb46830fc27656 100644 --- a/PhysicsAnalysis/NTUPtoNTUP/JetN2N/python/SlimSMQCD.py +++ b/PhysicsAnalysis/NTUPtoNTUP/JetN2N/python/SlimSMQCD.py @@ -86,7 +86,7 @@ def doSlimSMQCD(treeName,outputFile,inputFiles,year): # and ch.mcevt_weight[0].size() !=0: # w=ch.mcevt_weight[0][0] #else: - # w=1 + # w=1 #weight[1]+=w ch_new.Fill() diff --git a/PhysicsAnalysis/PyAnalysis/PyAnalysisUtils/CMakeLists.txt b/PhysicsAnalysis/PyAnalysis/PyAnalysisUtils/CMakeLists.txt index eff8d7da7fc8d2bca63f23142e93b2ea4813b5a9..2bb8b377bc3ec32c299b4ce979ba20f9195482e7 100644 --- a/PhysicsAnalysis/PyAnalysis/PyAnalysisUtils/CMakeLists.txt +++ b/PhysicsAnalysis/PyAnalysis/PyAnalysisUtils/CMakeLists.txt @@ -6,11 +6,7 @@ atlas_subdir( PyAnalysisUtils ) # Install files from the package: -atlas_install_python_modules( python/*.py ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_add_test( root_pickle_test SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/root_pickle_t.py ) diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/test/TruthParticle_test.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEvent/test/TruthParticle_test.cxx index a5456dd37ae694f9fcf92d4bb057e00c4d9f1cb8..102fbd101d7efa7772aa6ce716745eca914c4863 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/test/TruthParticle_test.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/test/TruthParticle_test.cxx @@ -26,9 +26,9 @@ // CLHEP includes #include "CLHEP/Units/SystemOfUnits.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/HepMcParticleLink.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/CMakeLists.txt b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/CMakeLists.txt index dbbfa8c228517d2dc892a12f318a5a6ea717d189..bd3a2df0c858bda355648237ccde6f651509eb3d 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/CMakeLists.txt +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/CMakeLists.txt @@ -17,12 +17,12 @@ atlas_depends_on_subdirs( PUBLIC Control/SGTools Control/StoreGate Generators/GeneratorObjects + Generators/AtlasHepMC PhysicsAnalysis/TruthParticleID/McParticleKernel ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS EG Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: @@ -30,15 +30,15 @@ atlas_add_tpcnv_library( McParticleEventTPCnv src/*.cxx PUBLIC_HEADERS McParticleEventTPCnv INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib GaudiKernel McParticleEvent AthenaKernel StoreGateLib SGtests GeneratorObjects McParticleKernel ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib DataModelAthenaPoolLib AthenaPoolCnvSvcLib GaudiKernel McParticleEvent AthenaKernel StoreGateLib SGtests GeneratorObjects McParticleKernel ) atlas_add_dictionary( McParticleEventTPCnvDict McParticleEventTPCnv/McParticleEventTPCnvDict.h McParticleEventTPCnv/selection.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib GaudiKernel McParticleEvent AthenaKernel StoreGateLib SGtests GeneratorObjects McParticleKernel McParticleEventTPCnv ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib DataModelAthenaPoolLib AthenaPoolCnvSvcLib GaudiKernel McParticleEvent AthenaKernel StoreGateLib SGtests GeneratorObjects McParticleKernel McParticleEventTPCnv ) atlas_add_test( TruthParticleContainerCnv_p5_test SOURCES diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/TruthParticleContainerCnv_p5.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/TruthParticleContainerCnv_p5.cxx index e83151c83766e4048d731de9b5cd97a0c7059dbd..dbe2bb5d09b9703e7e80bcad804ff14fbb6c337f 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/TruthParticleContainerCnv_p5.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/TruthParticleContainerCnv_p5.cxx @@ -15,7 +15,7 @@ #include "GaudiKernel/MsgStream.h" // HepMC includes -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" // McParticleKernel includes diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/TruthParticleContainerCnv_p6.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/TruthParticleContainerCnv_p6.cxx index d53471baa0b3068f99e8711c4e246bc89cfab325..74b62e21d1f73cbef4222fbcb814b6183dfd73b5 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/TruthParticleContainerCnv_p6.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/TruthParticleContainerCnv_p6.cxx @@ -15,7 +15,7 @@ #include "GaudiKernel/MsgStream.h" // HepMC includes -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" // McParticleKernel includes diff --git a/PhysicsAnalysis/TruthParticleID/McParticleKernel/CMakeLists.txt b/PhysicsAnalysis/TruthParticleID/McParticleKernel/CMakeLists.txt index ea5946a1eb37ea8ed19cf7a43305bd3294fa59ba..9ef64aa501d5ab1dc70e8640a4d60354136dc9d5 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleKernel/CMakeLists.txt +++ b/PhysicsAnalysis/TruthParticleID/McParticleKernel/CMakeLists.txt @@ -7,11 +7,12 @@ atlas_subdir( McParticleKernel ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + Generators/AtlasHepMC GaudiKernel ) # Component(s) in the package: atlas_add_library( McParticleKernel src/*.cxx PUBLIC_HEADERS McParticleKernel - LINK_LIBRARIES GaudiKernel ) + LINK_LIBRARIES GaudiKernel AtlasHepMCLib ) diff --git a/PhysicsAnalysis/TruthParticleID/McParticleKernel/McParticleKernel/IMcVtxFilterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleKernel/McParticleKernel/IMcVtxFilterTool.h index 865214ba71d0c5da7ce6404ffeee8ebc2ffa4e01..bd5db9923610e046e059eea4241a0e7f5fbc801f 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleKernel/McParticleKernel/IMcVtxFilterTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleKernel/McParticleKernel/IMcVtxFilterTool.h @@ -18,7 +18,7 @@ // Forward declaration class McEventCollection; -namespace HepMC { class GenVertex; } +#include "AtlasHepMC/GenVertex_fwd.h" static const InterfaceID IID_IMcVtxFilterTool("IMcVtxFilterTool", 1, 0); diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTests/CMakeLists.txt b/PhysicsAnalysis/TruthParticleID/McParticleTests/CMakeLists.txt index ebfcba03a5b6105f4b02322effd8ea3879add21f..fa7a6f28a6bdfd1ced3a86a8e881d05cc95a16df 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleTests/CMakeLists.txt +++ b/PhysicsAnalysis/TruthParticleID/McParticleTests/CMakeLists.txt @@ -14,6 +14,7 @@ atlas_depends_on_subdirs( PRIVATE Event/NavFourMom GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC PhysicsAnalysis/TruthParticleID/McParticleAlgs PhysicsAnalysis/TruthParticleID/McParticleEvent PhysicsAnalysis/TruthParticleID/McParticleKernel @@ -21,21 +22,16 @@ atlas_depends_on_subdirs( PRIVATE # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( McParticleTests src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps StoreGateLib SGtests EventKernel NavFourMom GaudiKernel GeneratorObjects McParticleEvent McParticleKernel McParticleUtils ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps StoreGateLib SGtests EventKernel NavFourMom GaudiKernel GeneratorObjects McParticleEvent McParticleKernel McParticleUtils ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( test/*.ref ) - -atlas_add_test( flake8_test_dir - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTests/src/McAodMcTopAna_solution.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTests/src/McAodMcTopAna_solution.cxx index f6944d67a3337a032693db636fd26f8e63793c30..77bfb2b4c666508f05c391983a962effeca7825a 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleTests/src/McAodMcTopAna_solution.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTests/src/McAodMcTopAna_solution.cxx @@ -25,9 +25,9 @@ #include "McParticleEvent/TruthParticle.h" #include "McParticleEvent/TruthParticleContainer.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "McParticleUtils/McVtxFilter.h" #include "EventKernel/PdtPdg.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/CMakeLists.txt b/PhysicsAnalysis/TruthParticleID/McParticleTools/CMakeLists.txt index 0c33e59eb47faef577add4f56ac768f98e4c7ff9..fd5438edf5faab927f0d615e547ca4744cdeaa7d 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/CMakeLists.txt +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PRIVATE GaudiKernel Generators/GenAnalysisTools/TruthHelper Generators/GeneratorObjects + Generators/AtlasHepMC PhysicsAnalysis/TruthParticleID/McParticleEvent PhysicsAnalysis/TruthParticleID/McParticleKernel PhysicsAnalysis/TruthParticleID/McParticleUtils ) @@ -22,7 +23,6 @@ atlas_depends_on_subdirs( PRIVATE # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) -find_package( HepMC ) find_package( HepPDT ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -30,5 +30,5 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) atlas_add_component( McParticleTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthContainers StoreGateLib SGtests EventKernel GaudiKernel TruthHelper GeneratorObjects McParticleEvent McParticleKernel McParticleUtils SGTools ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthContainers StoreGateLib SGtests EventKernel GaudiKernel TruthHelper GeneratorObjects McParticleEvent McParticleKernel McParticleUtils SGTools ) diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/GenAodValidationTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/GenAodValidationTool.cxx index 0eb68243f914edffaa0c6e89837352f22661ed16..363c7d5cf17b6aa4abac34384bc5afa94e9940ad 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/GenAodValidationTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/GenAodValidationTool.cxx @@ -20,9 +20,9 @@ // CLHEP/HepMC includes #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" // McParticleKernel includes #include "McParticleKernel/IIOHepMcTool.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/GenAodValidationTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/GenAodValidationTool.h index d21a0093a5de98598fcd027153b5c7fb9a48ad25..449d7cda11a5bc7fb96dd5731e4e611689fc5be2 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/GenAodValidationTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/GenAodValidationTool.h @@ -27,9 +27,9 @@ // Forward declaration class IIOHepMcTool; class McEventCollection; -namespace HepMC { class GenEvent; } -namespace HepMC { class GenVertex; } -namespace HepMC { class GenParticle; } +#include "AtlasHepMC/GenParticle_fwd.h" +#include "AtlasHepMC/GenVertex_fwd.h" +#include "AtlasHepMC/GenEvent_fwd.h" class GenAodValidationTool : public TruthParticleValidationBaseTool { diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.h index 97b87a243673d452d0d252b7989b89c00779d5ba..b0a8202e28b6e92a240d689a4b05d5d9c5f12b6b 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.h @@ -23,7 +23,7 @@ #include "McParticleKernel/IIOHepMcTool.h" // Forward declaration -namespace HepMC { class GenEvent; } +#include "AtlasHepMC/GenEvent_fwd.h" //namespace McAod { class IO_BaseClass; } class HepMcFloatWriterTool : virtual public IIOHepMcTool, diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.cxx index cb5e39845deda97ca5989c329bcff6a416058e23..af6d67a97cf00c79ea6172652584bc4f71dd88a9 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.cxx @@ -18,7 +18,7 @@ // CLHEP/HepMC includes #include "GeneratorObjects/McEventCollection.h" #include "HepPDT/ParticleDataTable.hh" -#include "HepMC/IO_GenEvent.h" +#include "AtlasHepMC/IO_GenEvent.h" // McParticleTools includes #include "HepMcReaderTool.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.h index 866df6c1707ddae0449f830e47a96f5f9cbd6336..2b0393adf668b58d3e2a72c2f9c3d2e2583657fa 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.h @@ -22,8 +22,8 @@ #include "McParticleKernel/IIOHepMcTool.h" // Forward declaration -namespace HepMC { class GenEvent; } -namespace HepMC { class IO_BaseClass; } +#include "AtlasHepMC/GenEvent_fwd.h" +#include "AtlasHepMC/IO_BaseClass_fwd.h" class HepMcReaderTool : virtual public IIOHepMcTool, public AthAlgTool diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.h index 817e4b95624258c05f98e5feaf51d0cb87ac8531..2284a4ec2f79b82e15a5e61a597d7a0254552cb4 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.h @@ -27,7 +27,7 @@ // Forward declaration class ITHistSvc; class TTree; -namespace HepMC { class GenEvent; } +#include "AtlasHepMC/GenEvent_fwd.h" class HepMcTupleWriterTool : virtual public IIOHepMcTool, public AthAlgTool diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.cxx index 9f05a2cb7c986823fd078e34005fdfceb12febe4..10e6ec02c9ada63095896b3378d3dbb4bc2e2674 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.cxx @@ -18,7 +18,7 @@ // CLHEP/HepMC includes #include "GeneratorObjects/McEventCollection.h" #include "HepPDT/ParticleDataTable.hh" -#include "HepMC/IO_GenEvent.h" +#include "AtlasHepMC/IO_GenEvent.h" // McParticleTools includes #include "HepMcWriterTool.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.h index a12cd36d5158c1cc9a4a2989ed81b590f22a9ab6..e10e73810702e7d7a44370e4944351ddd6786612 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.h @@ -22,8 +22,8 @@ #include "McParticleKernel/IIOHepMcTool.h" // Forward declaration -namespace HepMC { class GenEvent; } -namespace HepMC { class IO_BaseClass; } +#include "AtlasHepMC/GenEvent_fwd.h" +#include "AtlasHepMC/IO_BaseClass_fwd.h" class HepMcWriterTool : virtual public IIOHepMcTool, public AthAlgTool diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McAodWriterTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McAodWriterTool.cxx index ad5d48d6cd809a900529ab4240b743b308cd967c..8fd5bbe7b65b5c7556ad689a961f3247ee1c0eac 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McAodWriterTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McAodWriterTool.cxx @@ -17,7 +17,7 @@ // FrameWork includes // HepMC includes -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // McParticleEvent includes #include "McParticleEvent/TruthParticleContainer.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McVtxFilterTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McVtxFilterTool.cxx index 0c24a823fada37e52d242d3621e25304ee1a69f7..73c8712743cbf7d83ec357c160e71a1a6e1bd107 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McVtxFilterTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McVtxFilterTool.cxx @@ -16,9 +16,9 @@ #include "GaudiKernel/Property.h" // HepMC includes -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" // McParticleTools includes diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McVtxFilterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McVtxFilterTool.h index 134c0af13ecaef05ba6eef086e7ec94b01957e50..62da553336783a43ff592e71f0ef4f5fe4840987 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McVtxFilterTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/McVtxFilterTool.h @@ -66,7 +66,7 @@ // Forward declaration class McEventCollection; -namespace HepMC { class GenVertex; } +#include "AtlasHepMC/GenVertex_fwd.h" class McVtxFilterTool : virtual public IMcVtxFilterTool, public AthAlgTool diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/OldSpclMcFilterTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/OldSpclMcFilterTool.cxx index b4549b81033509b4dbe20fc23ae2ca4fca212a87..123ad0ca1e7ca3d8e58d4ef178e0039410dd2eb9 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/OldSpclMcFilterTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/OldSpclMcFilterTool.cxx @@ -19,9 +19,9 @@ #include "TruthHelper/IsGenStable.h" #include "TruthHelper/IsGenSimulStable.h" #include "TruthHelper/IsGenerator.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Units/SystemOfUnits.h" // McParticleKernel includes diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/OldSpclMcFilterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/OldSpclMcFilterTool.h index 80d91b85fb6a53c2a9d93b48c0ddae1b8e62b174..47e9accee9c5f467ecfa86debd3e214ba82ea4f1 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/OldSpclMcFilterTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/OldSpclMcFilterTool.h @@ -25,7 +25,7 @@ namespace TruthHelper{ class GenAccessIO; } -namespace HepMC { class GenEvent; } +#include "AtlasHepMC/GenEvent_fwd.h" class IMcVtxFilterTool; class OldSpclMcFilterTool : public TruthParticleFilterBaseTool diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/PileupFilterTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/PileupFilterTool.cxx index 0f84a9398d023b98b20f95c8eec7849b28189e04..6090e15004611367ce731c7ebebc18f9752b5035 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/PileupFilterTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/PileupFilterTool.cxx @@ -19,9 +19,9 @@ #include "TruthHelper/IsGenStable.h" #include "TruthHelper/IsGenSimulStable.h" #include "TruthHelper/IsGenerator.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Units/SystemOfUnits.h" // McParticleKernel includes diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/PileupFilterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/PileupFilterTool.h index c85af4414047068082ffc083bd1e5fd1324f9688..07bb7c5333adb3ccf293d3f8b3c975213e931b0d 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/PileupFilterTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/PileupFilterTool.h @@ -24,7 +24,7 @@ namespace TruthHelper{ class GenAccessIO; } -namespace HepMC { class GenEvent; } +#include "AtlasHepMC/GenEvent_fwd.h" class IMcVtxFilterTool; class PileupFilterTool : public TruthParticleFilterBaseTool diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx index eddb46b4a4d9aea6d03bba8d1d58b0566d48d692..9d2a377c934ffbcda37dca57a9d0fa8cc63950f1 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx @@ -15,9 +15,9 @@ // CLHEP/HepMC includes #include "TruthHelper/IsGenStable.h" #include "TruthHelper/IsGenInteracting.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/McEventCollection.h" #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Vector/LorentzVector.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthIsolationTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthIsolationTool.h index 94bcad573d04cdb3a657f155d342fb7836c3f0fe..c8973ca0370791efacc6a61ba4713d3c355f2040 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthIsolationTool.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthIsolationTool.h @@ -26,8 +26,8 @@ // Forward declarations class McEventCollection; class TruthEtIsolations; -namespace HepMC { class GenEvent; } -namespace HepMC { class GenParticle; } +#include "AtlasHepMC/GenEvent_fwd.h" +#include "AtlasHepMC/GenParticle_fwd.h" class TruthIsolationTool : virtual public ITruthIsolationTool, public AthAlgTool diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthParticleCnvTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthParticleCnvTool.cxx index 7e5e49dc655a0da665941b73b06779b4ff93035e..b012d013efffecb9381c2017a6e02b0176444065 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthParticleCnvTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthParticleCnvTool.cxx @@ -20,10 +20,10 @@ #include "GaudiKernel/ThreadLocalContext.h" // CLHEP/HepMC includes -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include "HepMC/Polarization.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/Polarization.h" #include "HepPDT/ParticleData.hh" // McParticleKernel includes diff --git a/PhysicsAnalysis/TruthParticleID/McParticleUtils/CMakeLists.txt b/PhysicsAnalysis/TruthParticleID/McParticleUtils/CMakeLists.txt index d0d6edeef4fa84cd27286d1ce13befbfec9b9b3c..fce02c971f6f5795ff0582f620fe12a0d5c685f6 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleUtils/CMakeLists.txt +++ b/PhysicsAnalysis/TruthParticleID/McParticleUtils/CMakeLists.txt @@ -15,13 +15,13 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE AtlasTest/TestTools Control/StoreGate - Control/RootUtils ) + Control/RootUtils + Generators/AtlasHepMC ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) find_package( CppUnit ) -find_package( HepMC ) find_package( HepPDT ) find_package( Python COMPONENTS Development ) @@ -29,10 +29,10 @@ find_package( Python COMPONENTS Development ) atlas_add_library( McParticleUtils src/*.cxx PUBLIC_HEADERS McParticleUtils - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthenaKernel AthContainers EventKernel GaudiKernel AnalysisUtilsLib StoreGateLib SGtests RootUtils + LINK_LIBRARIES AtlasHepMCLib AthenaKernel AthContainers EventKernel GaudiKernel AnalysisUtilsLib StoreGateLib SGtests RootUtils PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPPDT_LIBRARIES} ${Python_LIBRARIES} ${CLHEP_LIBRARIES} ${CPPUNIT_LIBRARIES} ) # Install files from the package: diff --git a/PhysicsAnalysis/TruthParticleID/McParticleUtils/McParticleUtils/McVtxFilter.h b/PhysicsAnalysis/TruthParticleID/McParticleUtils/McParticleUtils/McVtxFilter.h index 4e8092f1500a19c967f2d6424522275ccc1fa19a..4956d27328e6e85a460de7df70dda2430fe77422 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleUtils/McParticleUtils/McVtxFilter.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleUtils/McParticleUtils/McVtxFilter.h @@ -31,9 +31,9 @@ #include "GaudiKernel/GaudiException.h" // HepMC includes -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" // EventKernel includes #include "EventKernel/PdtPdg.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleUtils/src/McVtxFilter.cxx b/PhysicsAnalysis/TruthParticleID/McParticleUtils/src/McVtxFilter.cxx index fdc742faece1eecf15da9f5de84e065b9962ec06..5636286b7c0ab0413a37945aae03a8ffadbf05df 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleUtils/src/McVtxFilter.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleUtils/src/McVtxFilter.cxx @@ -17,8 +17,8 @@ #include "GaudiKernel/GaudiException.h" // HepMC includes -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" // AnalysisUtils includes #include "AnalysisUtils/AnalysisPermutation.h" diff --git a/PhysicsAnalysis/TruthParticleID/McParticleUtils/test/McVtxFilterTest_CppUnit.cxx b/PhysicsAnalysis/TruthParticleID/McParticleUtils/test/McVtxFilterTest_CppUnit.cxx index 2df400c9b029c932ea62b24a14a6b2dc8358c0b4..0a8ef1049ee40e1d31cc40041c5d6e1ee9606611 100755 --- a/PhysicsAnalysis/TruthParticleID/McParticleUtils/test/McVtxFilterTest_CppUnit.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleUtils/test/McVtxFilterTest_CppUnit.cxx @@ -22,9 +22,9 @@ #include "CLHEP/Units/SystemOfUnits.h" // HepMC includes -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "AthContainers/DataVector.h" diff --git a/Projects/AthGeneration/CMakeLists.txt b/Projects/AthGeneration/CMakeLists.txt index ac18de096d92b299691ce022c3f800fed908035b..a69f765b983333b9ec1eb444f23b07d923b3b30e 100644 --- a/Projects/AthGeneration/CMakeLists.txt +++ b/Projects/AthGeneration/CMakeLists.txt @@ -8,7 +8,7 @@ project( AthGeneration VERSION ${_version} LANGUAGES C CXX Fortran ) unset( _version ) # Configure flake8: -set( ATLAS_FLAKE8 "flake8_atlas --select ATL,F,E7,E9,W6 --enable-extension ATL902 --extend-ignore E701,E702,E741" +set( ATLAS_FLAKE8 "flake8_atlas --select ATL,F,E101,E7,E9,W6 --ignore ATL238,ATL9,E701,E702,E704,E741 --enable-extensions ATL902" CACHE STRING "Default flake8 command" ) set( ATLAS_PYTHON_CHECKER "${ATLAS_FLAKE8} --filterFiles AthenaConfiguration" diff --git a/Projects/AthGeneration/package_filters.txt b/Projects/AthGeneration/package_filters.txt index e3943ba233b3d84e9534a2c006f1c76b73c56170..5115e018aeb9d38a2740c95933f04395dad6c676 100644 --- a/Projects/AthGeneration/package_filters.txt +++ b/Projects/AthGeneration/package_filters.txt @@ -131,6 +131,7 @@ + Event/xAOD/xAODCutFlow + Event/xAOD/xAODEventFormat + Event/xAOD/xAODEventInfo ++ Event/xAOD/xAODEventInfoAthenaPool + Event/xAOD/xAODEventInfoCnv + Event/xAOD/xAODEventShape + Event/xAOD/xAODJet diff --git a/Projects/AthSimulation/package_filters.txt b/Projects/AthSimulation/package_filters.txt index 48b8bcc63b66d4a0d0f0f83fb21d521687aa8b07..a4cb2f4c05ed15ac048ca2907eb879c58cd054e7 100644 --- a/Projects/AthSimulation/package_filters.txt +++ b/Projects/AthSimulation/package_filters.txt @@ -145,6 +145,7 @@ + Event/xAOD/xAODCoreCnv + Event/xAOD/xAODEventFormat + Event/xAOD/xAODEventInfo ++ Event/xAOD/xAODEventInfoAthenaPool + Event/xAOD/xAODEventInfoCnv + Event/xAOD/xAODJet + Event/xAOD/xAODJetAthenaPool diff --git a/Projects/Athena/CMakeLists.txt b/Projects/Athena/CMakeLists.txt index a21c2cb21344068fb5079c3680b12cc589ab244c..c79c975a593683ddf2fb0c97fc4d0020c86ea8ff 100644 --- a/Projects/Athena/CMakeLists.txt +++ b/Projects/Athena/CMakeLists.txt @@ -41,7 +41,7 @@ mark_as_advanced( TDAQ-COMMON_ATROOT TDAQ_PROJECT_NAME TDAQ_ATROOT ) # Configure flake8: -set( ATLAS_FLAKE8 "flake8_atlas -j 1 --select ATL,F,E7,E9,W6 --enable-extension ATL902 --extend-ignore E701,E702,E741" +set( ATLAS_FLAKE8 "flake8_atlas --select ATL,F,E101,E7,E9,W6 --ignore ATL238,ATL9,E701,E702,E704,E741 --enable-extensions ATL902" CACHE STRING "Default flake8 command" ) set( ATLAS_PYTHON_CHECKER "${ATLAS_FLAKE8} --filterFiles AthenaConfiguration" diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt index e4383323a0ac882711d458b6235737f56e843f1a..9a7107070e1b4d83e6cf19f43f886b523cdc7722 100644 --- a/Projects/Athena/package_filters.txt +++ b/Projects/Athena/package_filters.txt @@ -29,6 +29,7 @@ # Some analysis packages that are not part of Athena - Control/AthLinksSA +- PhysicsAnalysis/Algorithms/.* - PhysicsAnalysis/AnalysisCommon/CPAnalysisExamples - PhysicsAnalysis/AnalysisCommon/PMGTools - PhysicsAnalysis/D3PDTools/EventLoop.* diff --git a/Reconstruction/DiTauRec/CMakeLists.txt b/Reconstruction/DiTauRec/CMakeLists.txt index d5303d5ca7b5c1b24ad0936accc5534e2a837f8b..76aefbb839bbea7683da514b2f0e6f1ace94d551 100644 --- a/Reconstruction/DiTauRec/CMakeLists.txt +++ b/Reconstruction/DiTauRec/CMakeLists.txt @@ -35,13 +35,9 @@ atlas_add_component( DiTauRec # Install files from the package: atlas_install_headers( DiTauRec ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - atlas_add_test( flake8_share SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share POST_EXEC_SCRIPT nopost.sh ) diff --git a/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py b/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py index 32d84e71ddc14df547b0f1d9c77ea8a04a9906f2..6c1bed68c0e08ee1642a54d942ff47e52f217d13 100644 --- a/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py +++ b/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ######################################################################## # # @@ -134,14 +134,14 @@ def defineJetCalibTool(jetcollection, configfile, calibarea, calibseq, data_type # from AthenaConfiguration.ComponentFactory import CompFactory jct = CompFactory.JetCalibrationTool(toolname, - JetCollection = jetcollection, - ConfigFile = configfile, - CalibArea = calibarea, - CalibSequence = calibseq, - IsData = (data_type == "data"), - RhoKey = rhoname, - PrimaryVerticesContainerName = pvname, - GSCDepth = gscdepth + JetCollection = jetcollection, + ConfigFile = configfile, + CalibArea = calibarea, + CalibSequence = calibseq, + IsData = (data_type == "data"), + RhoKey = rhoname, + PrimaryVerticesContainerName = pvname, + GSCDepth = gscdepth ) return jct diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py index 0928e8fa6e067de157111b98db40c3651941b0df..8cedc71a23f3c041af828fb435147d6fa7ee23c8 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py @@ -165,10 +165,12 @@ class ToolSpec(ConfigDict): klass = getattr(CompFactory,conf.pop('klass')) # remove 'klass' conf.pop('name') conf.pop('topLevelDir',None) + conf.pop('bottomLevelDir',None) conf.pop('defineHistoFunc',None) # not used here. for k, v in six.iteritems (conf): if isinstance(v,ToolSpec): v.topLevelDir = self.topLevelDir + v.bottomLevelDir = self.bottomLevelDir conf[k] = v.toTool() if isinstance(v,list): if v == []: continue @@ -177,6 +179,7 @@ class ToolSpec(ConfigDict): toolInstances = [] for toolSpec in v: toolSpec.topLevelDir=self.topLevelDir + toolSpec.bottomLevelDir=self.bottomLevelDir toolInstances.append( toolSpec.toTool() ) conf[k] = toolInstances return klass(**conf) @@ -214,6 +217,7 @@ class VarSpec(ToolSpec): def toTool(self): from AthenaConfiguration.ComponentFactory import CompFactory self.pop('topLevelDir', None) + self.pop('bottomLevelDir', None) return CompFactory.JetHistoVarTool(self.Name, **self) def vname(self): @@ -344,7 +348,8 @@ class HistoSpec(ToolSpec): hargs.update( **self.hargs) # overwrite by user-given args if any # we create one group for each histoFiller : self.groupName() are unique within a JetMonitoringAlg - group = monhelper.addGroup(parentAlg, self.groupName(), self.topLevelDir+parentAlg.JetContainerName) + bottomLevelDir = self.bottomLevelDir if self.bottomLevelDir != '' else parentAlg.JetContainerName + group = monhelper.addGroup(parentAlg, self.groupName(), self.topLevelDir+bottomLevelDir) # define the variables used by this tool # we encode as 'varx,vary;alias' as requested ny standard monitoring config, see @@ -420,12 +425,14 @@ class SelectSpec(ToolSpec): selTool = CompFactory.JetHistoSelectSort(self.name, SelectedIndex=self.get('SelectedIndex',-1)) if hasattr(self,'Selector'): self.Selector.topLevelDir = self.topLevelDir + self.Selector.bottomLevelDir = self.bottomLevelDir selTool.Selector = self.Selector.toTool() if hasattr(self, 'SortVariable'): selTool.SortVariable = retrieveVarToolConf(self.SortVariable) suffix = '_'+self.name for i,tconf in enumerate(self.FillerTools): tconf.topLevelDir = self.topLevelDir + tconf.bottomLevelDir = self.bottomLevelDir tconf = tconf.clone(newname=tconf.name+suffix) self.FillerTools[i] = tconf # re-assign the modified conf so it's consistently re-used elsewhere selTool.FillerTools += [ tconf.toTool() ] # assign a configured tool to the JetHistoSelectSort instance @@ -460,6 +467,7 @@ class JetMonAlgSpec(ConfigDict): self.name = name args.setdefault('FillerTools',[]) args.setdefault('topLevelDir', 'Jets/') + args.setdefault('bottomLevelDir', '') ConfigDict.__init__(self, defaultPath=defaultPath, TriggerChain=TriggerChain, **args) tmpL = self.FillerTools self.FillerTools = [] @@ -479,6 +487,7 @@ class JetMonAlgSpec(ConfigDict): tools = [] for tconf in self.FillerTools: tconf.topLevelDir = self.topLevelDir + tconf.bottomLevelDir = self.bottomLevelDir tools.append( tconf.toTool( )) tconf.defineHisto(alg, monhelper, path) alg.FillerTools = tools diff --git a/Reconstruction/MissingETEvent/CMakeLists.txt b/Reconstruction/MissingETEvent/CMakeLists.txt index f8b2161efad9973e0dac1c9c45219429d2676882..dbf249baca7cae8d44abab713a0d0ff8ebf30526 100644 --- a/Reconstruction/MissingETEvent/CMakeLists.txt +++ b/Reconstruction/MissingETEvent/CMakeLists.txt @@ -38,6 +38,6 @@ atlas_add_library( MissingETEvent atlas_add_dictionary( MissingETEventDict MissingETEvent/MissingETEventDict.h MissingETEvent/selection.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib CaloEvent CaloGeoHelpers AthContainers Navigation EventKernel NavFourMom GaudiKernel CxxUtils TruthHelper MissingETEvent ) diff --git a/Reconstruction/MissingETPerformance/CMakeLists.txt b/Reconstruction/MissingETPerformance/CMakeLists.txt index 1b54b7b6a7ed752a09bac81458e86b042082f260..63ce2de9eba3d330572a588ed2c33457854ebd5c 100644 --- a/Reconstruction/MissingETPerformance/CMakeLists.txt +++ b/Reconstruction/MissingETPerformance/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC Control/StoreGate GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC LArCalorimeter/LArRecConditions PhysicsAnalysis/AnalysisCommon/AnalysisTools PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent @@ -45,7 +46,6 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Graf Gpad Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf3d Html Postscript Gui GX11TTF GX11 ) # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake @@ -57,15 +57,15 @@ atlas_add_library( MissingETPerformanceLib src/*.cxx PUBLIC_HEADERS MissingETPerformance INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CaloConditions CaloEvent AthenaBaseComps SGTools GaudiKernel GeneratorObjects LArRecConditions AnalysisTriggerEvent McParticleEvent JetEvent JetUtils MissingETEvent muonEvent Particle egammaEvent TrigCaloEvent TrigInDetEvent TrigMissingEtEvent TrigMuonEvent StoreGateLib SGtests AthAnalysisToolsLib MissingETGoodnessLib TrigDecisionToolLib - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPMC_LIBRARIES} AthenaKernel CaloGeoHelpers FourMom FourMomUtils xAODEventInfo TruthHelper tauEvent VxVertex TrigConfL1Data ) + PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} AtlasHepMCLib AthenaKernel CaloGeoHelpers FourMom FourMomUtils xAODEventInfo TruthHelper tauEvent VxVertex TrigConfL1Data ) atlas_add_component( MissingETPerformance src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} CaloConditions CaloEvent AthenaBaseComps SGTools StoreGateLib SGtests GaudiKernel GeneratorObjects LArRecConditions AthAnalysisToolsLib AnalysisTriggerEvent McParticleEvent JetEvent JetUtils MissingETEvent MissingETGoodnessLib muonEvent Particle egammaEvent TrigDecisionToolLib TrigCaloEvent TrigInDetEvent TrigMissingEtEvent TrigMuonEvent AthenaKernel CaloGeoHelpers FourMom FourMomUtils xAODEventInfo TruthHelper tauEvent VxVertex TrigConfL1Data MissingETPerformanceLib ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib CaloConditions CaloEvent AthenaBaseComps SGTools StoreGateLib SGtests GaudiKernel GeneratorObjects LArRecConditions AthAnalysisToolsLib AnalysisTriggerEvent McParticleEvent JetEvent JetUtils MissingETEvent MissingETGoodnessLib muonEvent Particle egammaEvent TrigDecisionToolLib TrigCaloEvent TrigInDetEvent TrigMissingEtEvent TrigMuonEvent AthenaKernel CaloGeoHelpers FourMom FourMomUtils xAODEventInfo TruthHelper tauEvent VxVertex TrigConfL1Data MissingETPerformanceLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Reconstruction/MissingETPerformance/src/MissingETMuonData.cxx b/Reconstruction/MissingETPerformance/src/MissingETMuonData.cxx index 51f04244a0e562679a19cef4ab9a4442215ef802..014a9c3f5ea0e54a6327d69c2a42a2c6f8d19066 100644 --- a/Reconstruction/MissingETPerformance/src/MissingETMuonData.cxx +++ b/Reconstruction/MissingETPerformance/src/MissingETMuonData.cxx @@ -7,8 +7,8 @@ #include "JetEvent/Jet.h" #include "JetEvent/JetCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include "TruthHelper/IsGenStable.h" #include "TruthHelper/IsGenNonInteracting.h" diff --git a/Reconstruction/MissingETPerformance/src/MuonTool.cxx b/Reconstruction/MissingETPerformance/src/MuonTool.cxx index 2b92c46bc8efff28aa1389ac00a6568569cf4451..1865325d41fd848aa9548d6ecefe2f70cc82a9be 100644 --- a/Reconstruction/MissingETPerformance/src/MuonTool.cxx +++ b/Reconstruction/MissingETPerformance/src/MuonTool.cxx @@ -22,9 +22,9 @@ //HEPMC stuff #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "TruthHelper/IsGenStable.h" #include "TruthHelper/IsGenNonInteracting.h" #include "TruthHelper/GenAccessIO.h" diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt index 20804d5431a84718c4e1248dad8ac158f2ce50ba..b71f6720cf84f3f3ac056e5562130719f5b29347 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt @@ -55,17 +55,17 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTrackSummary Tracking/TrkExtrapolation/TrkExInterfaces - Tracking/TrkTools/TrkToolInterfaces ) + Tracking/TrkTools/TrkToolInterfaces + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( MuonCombinedBaseTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} CaloEvent AthLinks AthenaBaseComps Identifier EventPrimitives FourMomUtils xAODCaloEvent xAODEventInfo xAODMuon xAODTracking xAODTruth GaudiKernel MagFieldInterfaces MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonSegmentMakerUtils MuonSelectorToolsLib ICaloTrkMuIdTools MuidInterfaces MuonCombinedEvent MuonCombinedToolInterfaces muonEvent MuidEvent ParticleTruth RecoToolInterfaces TrackToCaloLib TrkGeometry TrkSurfaces TrkCaloExtension TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkParameters TrkParametersIdentificationHelpers TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces TrkToolInterfaces BeamSpotConditionsData ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib CaloEvent AthLinks AthenaBaseComps Identifier EventPrimitives FourMomUtils xAODCaloEvent xAODEventInfo xAODMuon xAODTracking xAODTruth GaudiKernel MagFieldInterfaces MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonSegmentMakerUtils MuonSelectorToolsLib ICaloTrkMuIdTools MuidInterfaces MuonCombinedEvent MuonCombinedToolInterfaces muonEvent MuidEvent ParticleTruth RecoToolInterfaces TrackToCaloLib TrkGeometry TrkSurfaces TrkCaloExtension TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkParameters TrkParametersIdentificationHelpers TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces TrkToolInterfaces BeamSpotConditionsData ) diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx index 636bebc61e50295b12fb6b993959754973753a1c..cb54becfc0e1bb6836e301706bce9ebdf660701c 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx @@ -34,8 +34,8 @@ #include "xAODTruth/TruthParticle.h" // --- HepMC Includes --- -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Vector/LorentzVector.h" #include <cmath> diff --git a/Reconstruction/MuonIdentification/MuonCombinedTestTools/src/MuonTrackTagTestTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTestTools/src/MuonTrackTagTestTool.cxx index 8a99f30bdfa25793d40a323d036a4f838c35e557..b54fdd21c05a0f9a03eb448b91c338f379ed9945 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTestTools/src/MuonTrackTagTestTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTestTools/src/MuonTrackTagTestTool.cxx @@ -19,7 +19,7 @@ #ifdef MUONCOMBDEBUG #include "TrkTruthData/TrackTruth.h" #include "TrkTruthData/TrackTruthCollection.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #endif using namespace MuonCombined; diff --git a/Reconstruction/PFlow/PFlowUtils/CMakeLists.txt b/Reconstruction/PFlow/PFlowUtils/CMakeLists.txt index d57f06fe8af2fdc90f34510df0b0ef524795a84b..6407592f882a4221c06d85012d8de55504ab8c01 100644 --- a/Reconstruction/PFlow/PFlowUtils/CMakeLists.txt +++ b/Reconstruction/PFlow/PFlowUtils/CMakeLists.txt @@ -21,6 +21,7 @@ atlas_depends_on_subdirs( PRIVATE Control/AthContainers Event/xAOD/xAODJet + Event/xAOD/xAODTruth ${extra_deps} ) # Component(s) in the package: @@ -32,7 +33,7 @@ atlas_add_library( PFlowUtilsLib if( NOT XAOD_STANDALONE ) atlas_add_component( PFlowUtils src/*.h src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps xAODJet xAODPFlow GaudiKernel + LINK_LIBRARIES AthenaBaseComps xAODJet xAODPFlow GaudiKernel xAODTruth PFlowUtilsLib ) endif() diff --git a/Reconstruction/RecExample/RecExAlgs/CMakeLists.txt b/Reconstruction/RecExample/RecExAlgs/CMakeLists.txt index 45382f75ac2c097b47909153dacf25ed5205a013..f0d80a5c22d8f47f6abd5723ac29e71b504950f3 100644 --- a/Reconstruction/RecExample/RecExAlgs/CMakeLists.txt +++ b/Reconstruction/RecExample/RecExAlgs/CMakeLists.txt @@ -22,13 +22,9 @@ atlas_add_component( RecExAlgs # Install files from the package: atlas_install_headers( RecExAlgs ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - atlas_add_test( flake8_share SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/share POST_EXEC_SCRIPT nopost.sh ) diff --git a/Reconstruction/RecExample/RecExCond/share/MinimalRec_flagsESD.py b/Reconstruction/RecExample/RecExCond/share/MinimalRec_flagsESD.py index 040b7dc845773fd2203c9c3b938208e02722f32d..98cafeff5a89cd51fa38e0f5f5f64d0f61572ef1 100755 --- a/Reconstruction/RecExample/RecExCond/share/MinimalRec_flagsESD.py +++ b/Reconstruction/RecExample/RecExCond/share/MinimalRec_flagsESD.py @@ -1,8 +1,6 @@ # switch off algorithms that are not needed for minimal reconstruction if rec.doMinimalRec(): from InDetRecExample.InDetJobProperties import InDetFlags - InDetFlags.doiPatRec=False - InDetFlags.doxKalman=False from tauRec.tauRecFlags import jobproperties jobproperties.tauRecFlags.Enabled=False recAlgs.doMuonIDStandAlone=False diff --git a/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py b/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py index fec5258dd5a08623f898aa5c3863703a5315114a..02a7462d2b73bf2fc8f2adec56d63d6b95c331fc 100755 --- a/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py +++ b/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py @@ -171,8 +171,6 @@ RecExCommonFlags = { RecExCommonAlgs = { 'doTrackRecordFilter' : True, 'donewTracking' : True, - 'doxKalman' : False, - 'doiPatRec' : True, 'doBackTracking' : True, 'doEmCluster' : True, 'doCaloCluster' : False, @@ -296,7 +294,6 @@ except Exception: try: from InDetRecExample.InDetJobProperties import InDetFlags # change default here - InDetFlags.doxKalman=False InDetFlags.doPrintConfigurables=False except Exception: treatException("Could not instantiate InDetFlags ") @@ -863,7 +860,6 @@ if not rec.doInDet: else: if rec.Production: from InDetRecExample.InDetJobProperties import InDetFlags - InDetFlags.doiPatRec=False if not rec.doLArg: DetFlags.LAr_setOff() @@ -1000,12 +996,6 @@ except Exception: DetFlags.ID_setOff() -## if rec.doAODall() and oneTrackingAlg : -## if recAlgs.donewTracking() + recAlgs.doiPatRec() +recAlgs.doxKalman() <= 1 : -## logRecExCommon_flags.warning('doAODall=True : more than one tracking alg should be enabled ! So switching doAODall=False') -## rec.doAODall=False -## else: -## InDetFlags.setAODall() if not rec.doTruth() or ( globalflags.DetDescrVersion()[0:3]=="DC1" or globalflags.DetDescrVersion()[0:3]=="DC2" ) : diff --git a/Reconstruction/RecExample/RecExRecoTest/test/test_recexreco_art_muonsegmentfinding_fromesd_newJobConfig.sh b/Reconstruction/RecExample/RecExRecoTest/test/test_recexreco_art_muonsegmentfinding_fromesd_newJobConfig.sh index a23036959c3f2c18a06ed62cf5f05d0be1d85667..004f14a6645ba3b33d9cdc61fa4d96cb61f04e61 100755 --- a/Reconstruction/RecExample/RecExRecoTest/test/test_recexreco_art_muonsegmentfinding_fromesd_newJobConfig.sh +++ b/Reconstruction/RecExample/RecExRecoTest/test/test_recexreco_art_muonsegmentfinding_fromesd_newJobConfig.sh @@ -7,7 +7,7 @@ python $Athena_DIR/python/MuonConfig/MuonSegmentFindingConfig.py | tee temp1.log echo "art-result: ${PIPESTATUS[0]}" -athena MuonSegmentFinding.pkl | tee temp2.log +CARunner.py MuonSegmentFinding.pkl | tee temp2.log echo "art-result: ${PIPESTATUS[0]}" test_postProcessing_Errors.sh temp1.log diff --git a/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh b/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh index 8e5e36484ff8256f03bf301f59d69593f4e4ce85..88f88e739ff42d1edfe60bbd7acf183dd85d48c0 100755 --- a/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh +++ b/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh @@ -2,7 +2,7 @@ echo "Creating new serial directory" mkdir serial; cd serial -Reco_tf.py --AMI=$1 | tee athenaSerial.log +Reco_tf.py --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' | tee athenaSerial.log rc=${PIPESTATUS[0]} echo "art-result: $rc Serial" @@ -12,7 +12,7 @@ cd ../ echo "Creating new threadOne directory" mkdir threadOne; cd threadOne -Reco_tf.py --athenaopts="--threads=1" --AMI=$1 | tee athenaOneThread.log +Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' | tee athenaOneThread.log rc1=${PIPESTATUS[0]} echo "art-result: $rc1 OneThread" @@ -33,7 +33,7 @@ cd ../ echo "Creating new threadTwo directory" mkdir threadTwo; cd threadTwo -Reco_tf.py --athenaopts="--threads=1" --AMI=$1 | tee athenaTwoThreads.log +Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' | tee athenaTwoThreads.log rc2=${PIPESTATUS[0]} echo "art-result: $rc2 TwoThreads" @@ -50,7 +50,7 @@ cd ../ echo "Creating new threadFive directory" mkdir threadFive; cd threadFive -Reco_tf.py --athenaopts="--threads=1" --AMI=$1 | tee athenaFiveThreads.log +Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' | tee athenaFiveThreads.log rc5=${PIPESTATUS[0]} echo "art-result: $rc5 FiveThreads" diff --git a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx index b9365fda41e3b7caa66f1d1774ce35fcf726d6c1..910ed5e112962347213d32a7953f1e406850c836 100644 --- a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx +++ b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx @@ -18,8 +18,8 @@ #include "SGTools/TestStore.h" #include "TestTools/leakcheck.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include <cassert> #include <iostream> diff --git a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx index 16620b0e2af99e0163c32b32d707528eeab87810..d218af9130a0d24acdeae240bfdbf538859f0ad9 100644 --- a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx +++ b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx @@ -17,8 +17,8 @@ #include "ParticleTruth/TrackParticleTruthCollection.h" #include "SGTools/TestStore.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include <cassert> #include <iostream> diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/share/VrtSecInclusive_DV_postInclude.py b/Reconstruction/VKalVrt/VrtSecInclusive/share/VrtSecInclusive_DV_postInclude.py index d0b3e7df3497b73031d18a7392c4f659493050a9..a5950f8b4ca3b3b0e64f6aad64e8b39facb5c666 100644 --- a/Reconstruction/VKalVrt/VrtSecInclusive/share/VrtSecInclusive_DV_postInclude.py +++ b/Reconstruction/VKalVrt/VrtSecInclusive/share/VrtSecInclusive_DV_postInclude.py @@ -34,8 +34,7 @@ topSequence.VrtSecInclusive.SelTrkMaxCutoff = 300 from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter InclusiveVxFitterTool = Trk__TrkVKalVrtFitter(name = "InclusiveVxFitter", Extrapolator = ToolSvc.AtlasExtrapolator, - IterationNumber = 30, - AtlasMagFieldSvc = "AtlasFieldSvc" + IterationNumber = 30 ) ToolSvc += InclusiveVxFitterTool; InclusiveVxFitterTool.OutputLevel = INFO diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/share/VrtSecInclusive_jobOptions.py b/Reconstruction/VKalVrt/VrtSecInclusive/share/VrtSecInclusive_jobOptions.py index 844dd470d2ca7a91c555fc398bc9b9618541f89c..33838775640b90eebbb4d775dfbed5ef8cd0afc3 100644 --- a/Reconstruction/VKalVrt/VrtSecInclusive/share/VrtSecInclusive_jobOptions.py +++ b/Reconstruction/VKalVrt/VrtSecInclusive/share/VrtSecInclusive_jobOptions.py @@ -80,9 +80,7 @@ topSequence.VrtSecInclusive.MCEventContainer = "GEN_AOD" from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter InclusiveVxFitterTool = Trk__TrkVKalVrtFitter(name = "InclusiveVxFitter", Extrapolator = ToolSvc.AtlasExtrapolator, - IterationNumber = 30, - MagFieldSvc = ToolSvc.AtlasMagneticFieldTool, - AtlasMagFieldSvc = 'dummy' + IterationNumber = 30 ) ToolSvc += InclusiveVxFitterTool; InclusiveVxFitterTool.OutputLevel = INFO diff --git a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx index e62d9ac083e5fbcaf14f4852ce753c3ac666c7ba..1a0e3818e05da6bdf1f59ffd103494a7d5defb2f 100644 --- a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx @@ -65,7 +65,13 @@ StatusCode topoEgammaBuilder::initialize() } if ( m_doElectrons && m_doPhotons ){ - ATH_CHECK( m_ambiguityTool.retrieve() ); + ATH_MSG_DEBUG("Retrieving ambiguity tool"); + if (not m_ambiguityTool.isSet()) { + ATH_MSG_DEBUG("Ambiguity tool IS NOT set. Not using it"); + } + else { + ATH_CHECK( m_ambiguityTool.retrieve() ); + } } // retrieve timing profile @@ -129,10 +135,15 @@ StatusCode topoEgammaBuilder::execute(const EventContext& ctx) const{ const xAOD::CaloCluster *const phClus = photonRec->caloCluster(); //See if they have the same hottest cell if (elEta0 == phClus->eta0() && elPhi0 == phClus->phi0()) { - author = m_ambiguityTool->ambiguityResolve(elClus, - photonRec->vertex(), - electronRec->trackParticle(), - type); + if (m_ambiguityTool.isSet()) { // should be the default + author = m_ambiguityTool->ambiguityResolve(elClus, + photonRec->vertex(), + electronRec->trackParticle(), + type); + } + else { // in case the ambiguity tool is not set ambiguity is not resolved + author = xAOD::EgammaParameters::AuthorAmbiguous; + } break; } } @@ -160,10 +171,15 @@ StatusCode topoEgammaBuilder::execute(const EventContext& ctx) const{ const xAOD::CaloCluster *const elClus = electronRec->caloCluster(); //See if they have the same hottest cell if (phEta0 == elClus->eta0() && phPhi0 == elClus->phi0()) { - author = m_ambiguityTool->ambiguityResolve(elClus, - photonRec->vertex(), - electronRec->trackParticle(), - type); + if (m_ambiguityTool.isSet()) { // should be the default + author = m_ambiguityTool->ambiguityResolve(elClus, + photonRec->vertex(), + electronRec->trackParticle(), + type); + } + else { // in case the ambiguity tool is not set ambiguity is not resolved + author = xAOD::EgammaParameters::AuthorAmbiguous; + } break; } } diff --git a/Reconstruction/egamma/egammaConfig/CMakeLists.txt b/Reconstruction/egamma/egammaConfig/CMakeLists.txt index 94b03d5685d5f3a3ba723a2bb72fd02f7043dd4b..ea010cd78f32650ba8ef725b271f32b992246c03 100644 --- a/Reconstruction/egamma/egammaConfig/CMakeLists.txt +++ b/Reconstruction/egamma/egammaConfig/CMakeLists.txt @@ -6,13 +6,8 @@ atlas_subdir( egammaConfig ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_add_test( egammaConfigFlagsTest SCRIPT python -m unittest -v egammaConfig.egammaConfigFlags POST_EXEC_SCRIPT nopost.sh ) - -# Check python syntax on Config files -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python/*.py - POST_EXEC_SCRIPT nopost.sh ) diff --git a/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt b/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt index ee3d4b3178689b9a5cd3b8d32f2af42787dc78a5..65284af0c5d22bc0c17438fbce653776ffae397f 100644 --- a/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt +++ b/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt @@ -47,8 +47,3 @@ endif() # Install files from the package: atlas_install_python_modules( python/*.py ) - -# Check python syntax on Config files -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python/*Config.py - POST_EXEC_SCRIPT nopost.sh ) diff --git a/Reconstruction/egamma/egammaTools/CMakeLists.txt b/Reconstruction/egamma/egammaTools/CMakeLists.txt index dda68b96e6bf8007610ffafb6d9b66ed2ac4f754..3f57946cfdfd20de45713a0571d1d8884d277e49 100644 --- a/Reconstruction/egamma/egammaTools/CMakeLists.txt +++ b/Reconstruction/egamma/egammaTools/CMakeLists.txt @@ -51,8 +51,3 @@ atlas_add_component( egammaTools # Install files from the package: atlas_install_python_modules( python/*.py ) - -# Check python syntax on Config files -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python/*Config.py - POST_EXEC_SCRIPT nopost.sh ) diff --git a/Reconstruction/egamma/egammaTrackTools/CMakeLists.txt b/Reconstruction/egamma/egammaTrackTools/CMakeLists.txt index 58e51ed470e509d7a2965e5024862c8dd0bf515d..38bb36882aaae00c9180a8e8508c04a48b3edafc 100644 --- a/Reconstruction/egamma/egammaTrackTools/CMakeLists.txt +++ b/Reconstruction/egamma/egammaTrackTools/CMakeLists.txt @@ -59,8 +59,3 @@ atlas_add_component( egammaTrackTools # Install files from the package: atlas_install_python_modules( python/*.py ) - -# Check python syntax on Config files -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python/*Config.py - POST_EXEC_SCRIPT nopost.sh ) diff --git a/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITrajectoryTool.h b/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITrajectoryTool.h index 8b7d89f280784c38840531871cef633013ec7352..12045f9e33f12dc36d3960196361ff598bcad7b6 100644 --- a/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITrajectoryTool.h +++ b/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITrajectoryTool.h @@ -27,10 +27,7 @@ Abstract base class for TrajectoryTool AlgTool class FastField; class PerigeeParameters; class TrackParameters; -namespace HepMC -{ - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace iPat { diff --git a/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITruthParameters.h b/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITruthParameters.h index 8f6efc96170b0ab406bb91108b9072bc8e4fe2f7..234ef43245caa278e7ccb0944c1aa7e2ef5bd36e 100755 --- a/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITruthParameters.h +++ b/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITruthParameters.h @@ -26,11 +26,7 @@ Abstract base class for TruthParameters AlgTool class PerigeeParameters; class TrackParameters; -namespace HepMC -{ - class GenParticle; -} - +#include "AtlasHepMC/GenParticle_fwd.h" class ITruthParameters: virtual public IAlgTool { public: diff --git a/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt b/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt index e34fc393bf5dd93de6e4b34a345733ad1ba86241..40fb3fddad192ea1b0471dac29aeab51ff65f0ae 100644 --- a/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt +++ b/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt @@ -7,6 +7,7 @@ atlas_subdir( iPatTrackFinder ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + Control/StoreGate Control/AthenaBaseComps DetectorDescription/Identifier Event/EventPrimitives @@ -16,11 +17,12 @@ atlas_depends_on_subdirs( PUBLIC Reconstruction/iPat/iPatTrack Event/EventContainers InnerDetector/InDetConditions/BeamSpotConditionsData + MagneticField/MagFieldElements + MagneticField/MagFieldConditions PRIVATE InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetDetDescr/InDetReadoutGeometry - InnerDetector/InDetDetDescr/PixelReadoutGeometry - MagneticField/MagFieldInterfaces + InnerDetector/InDetDetDescr/PixelReadoutGeometry Reconstruction/iPat/iPatGeometry Reconstruction/iPat/iPatTrackParameters Reconstruction/iPat/iPatUtility @@ -42,7 +44,7 @@ atlas_add_component( iPatTrackFinder src/TrackFinder.cxx src/TrackManager.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps Identifier EventPrimitives GaudiKernel InDetPrepRawData iPatInterfaces iPatTrack InDetReadoutGeometry PixelReadoutGeometry MagFieldInterfaces iPatGeometry iPatTrackParameters iPatUtility TrkPrepRawData TrkSpacePoint VxVertex EventContainers) + LINK_LIBRARIES AthenaBaseComps Identifier EventPrimitives GaudiKernel InDetPrepRawData iPatInterfaces iPatTrack InDetReadoutGeometry PixelReadoutGeometry MagFieldElements MagFieldConditions iPatGeometry iPatTrackParameters iPatUtility TrkPrepRawData TrkSpacePoint VxVertex EventContainers StoreGateLib) # Install files from the package: atlas_install_headers( iPatTrackFinder ) diff --git a/Reconstruction/iPat/iPatTrackFinder/iPatTrackFinder/FinderTolerances.h b/Reconstruction/iPat/iPatTrackFinder/iPatTrackFinder/FinderTolerances.h index cfda9b73c0faa4468d23672497a34946ac9ae446..9599b5bee83b951c1f03b19974771a2b6602ec70 100755 --- a/Reconstruction/iPat/iPatTrackFinder/iPatTrackFinder/FinderTolerances.h +++ b/Reconstruction/iPat/iPatTrackFinder/iPatTrackFinder/FinderTolerances.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -22,12 +22,13 @@ #include "GaudiKernel/IIncidentListener.h" #include "GaudiKernel/ServiceHandle.h" #include "iPatInterfaces/IFinderConfiguration.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "StoreGate/ReadCondHandleKey.h" //<<<<<< CLASS DECLARATIONS >>>>>> class IIncidentSvc; namespace InDetDD { class PixelDetectorManager; } -namespace MagField { class IMagFieldSvc; } class FinderTolerances: public AthAlgTool, virtual public IFinderConfiguration, IIncidentListener @@ -37,10 +38,9 @@ public: FinderTolerances (const std::string& type, const std::string& name, const IInterface* parent); - ~FinderTolerances (void); + ~FinderTolerances()=default; - StatusCode initialize(); - StatusCode finalize(); + StatusCode initialize(); /** handle for incident service */ void handle(const Incident& inc) ; @@ -85,8 +85,8 @@ private: // services and managers: ServiceHandle<IIncidentSvc> m_incidentSvc; //!< IncidentSvc to catch begin of event - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; const InDetDD::PixelDetectorManager* m_manager; + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj"}; double m_halfField; double m_maxPhiSlope; diff --git a/Reconstruction/iPat/iPatTrackFinder/src/FinderTolerances.cxx b/Reconstruction/iPat/iPatTrackFinder/src/FinderTolerances.cxx index 9f461a77650e8e4b6916cd983121443039f895bb..14b416790a9c241983642d71154b42850e3b828a 100755 --- a/Reconstruction/iPat/iPatTrackFinder/src/FinderTolerances.cxx +++ b/Reconstruction/iPat/iPatTrackFinder/src/FinderTolerances.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -13,9 +13,9 @@ #include "GaudiKernel/Incident.h" #include "GaudiKernel/SystemOfUnits.h" #include "PixelReadoutGeometry/PixelDetectorManager.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "iPatTrackFinder/FinderTolerances.h" #include "iPatUtility/VertexRegion.h" +#include <TString.h> // for Form //<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> @@ -24,7 +24,6 @@ FinderTolerances::FinderTolerances (const std::string& type, const IInterface* parent) : AthAlgTool (type, name, parent), m_incidentSvc ("IncidentSvc", name), - m_magFieldSvc ("MagField::AtlasFieldSvc/AtlasFieldSvc", name), m_manager (nullptr), m_halfField (0.), m_maxPhiSlope (0.), @@ -47,12 +46,8 @@ FinderTolerances::FinderTolerances (const std::string& type, m_vertexZWidth (0.) { declareInterface<IFinderConfiguration>(this); - declareProperty("MagFieldSvc", m_magFieldSvc ); } -FinderTolerances::~FinderTolerances (void) -{} - //<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> StatusCode @@ -61,46 +56,18 @@ FinderTolerances::initialize() // print where you are ATH_MSG_INFO( "FinderTolerances::initialize()" ); - if (m_incidentSvc.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve service " << m_incidentSvc ); - return StatusCode::FAILURE; - } + ATH_CHECK(m_incidentSvc.retrieve()); // register to the incident service: // BeginEvent needed to update field dependent tolerances m_incidentSvc->addListener( this, IncidentType::BeginEvent); - if (! m_magFieldSvc.empty()) - { - if (m_magFieldSvc.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve service " << m_magFieldSvc ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_INFO( "Retrieved service " << m_magFieldSvc ); - } - } - // retrieve the pixel GeoModel manager - if (StatusCode::SUCCESS != detStore()->retrieve(m_manager,m_pixelName)) - { - ATH_MSG_FATAL( "Could not find the pixel Manager: " << m_pixelName << " !" ); - return StatusCode::FAILURE; - } + ATH_CHECK(detStore()->retrieve(m_manager,m_pixelName)); + ATH_CHECK(m_fieldCondObjInputKey.initialize()); return StatusCode::SUCCESS; } -StatusCode -FinderTolerances::finalize() -{ - ATH_MSG_DEBUG( "FinderTolerances::finalize()" ); - - return StatusCode::SUCCESS; -} - /** handle for incident service */ void FinderTolerances::handle(const Incident& inc) @@ -111,11 +78,21 @@ FinderTolerances::handle(const Incident& inc) // this is used to obtain an approx pt for TrackCandidates in TrackFinder. // A nominal 0.1Tesla is assumed if the soelenoid field is off double fieldValue = -0.1*Gaudi::Units::tesla*CLHEP::c_light; - if (m_magFieldSvc->solenoidOn()) + + /// magnetic field + MagField::AtlasFieldCache fieldCache; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (!fieldCondObj) { + throw std::runtime_error(Form("File: %s, Line: %d\nUpdateBField::prepareSegments() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (m_fieldCondObjInputKey.key()).c_str())); + } + fieldCondObj->getInitializedCache(fieldCache); + + if (fieldCache.solenoidOn()) { Amg::Vector3D field; Amg::Vector3D position(0.,0.,0.); - m_magFieldSvc->getField(&position,&field); + fieldCache.getField(position.data(), field.data()); fieldValue = -field(2)*CLHEP::c_light; } m_halfField = 0.5*fieldValue; diff --git a/Reconstruction/iPat/iPatTruthTrajectory/CMakeLists.txt b/Reconstruction/iPat/iPatTruthTrajectory/CMakeLists.txt index c3fc30a718de840c6866cea0999b62e8831b6923..f75b270d248c9763ad35497c2cde06dbf298be98 100644 --- a/Reconstruction/iPat/iPatTruthTrajectory/CMakeLists.txt +++ b/Reconstruction/iPat/iPatTruthTrajectory/CMakeLists.txt @@ -16,19 +16,19 @@ atlas_depends_on_subdirs( PUBLIC Generators/GenAnalysisTools/TruthTools Generators/GenInterfaces Generators/GeneratorObjects + Generators/AtlasHepMC Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkExtrapolation/TrkExInterfaces ) # External dependencies: -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( iPatTruthTrajectory src/TruthParameters.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel iPatInterfaces iPatTrackParameters TrkExUtils GeneratorObjects TrkSurfaces TrkExInterfaces ) + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel iPatInterfaces iPatTrackParameters TrkExUtils GeneratorObjects TrkSurfaces TrkExInterfaces ) # Install files from the package: atlas_install_headers( iPatTruthTrajectory ) diff --git a/Reconstruction/iPat/iPatTruthTrajectory/iPatTruthTrajectory/TruthParameters.h b/Reconstruction/iPat/iPatTruthTrajectory/iPatTruthTrajectory/TruthParameters.h index 64d823361476220a758d6a163316e5b4fe25f7fe..963db93f57debe7ec3a7937ed454e4806697e543 100755 --- a/Reconstruction/iPat/iPatTruthTrajectory/iPatTruthTrajectory/TruthParameters.h +++ b/Reconstruction/iPat/iPatTruthTrajectory/iPatTruthTrajectory/TruthParameters.h @@ -13,7 +13,7 @@ //<<<<<< INCLUDES >>>>>> #include "AthenaBaseComps/AthAlgTool.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "HepPDT/ParticleDataTable.hh" #include "GaudiKernel/ToolHandle.h" #include "TrkExUtils/TrackSurfaceIntersection.h" diff --git a/Reconstruction/tauMonitoring/python/tauMonitorAlgorithm.py b/Reconstruction/tauMonitoring/python/tauMonitorAlgorithm.py index 90554b1b74d5f0dd1543b04b29234196fc1bcb5a..8224221e346232d892c44cbac5d8e9ac6616055f 100644 --- a/Reconstruction/tauMonitoring/python/tauMonitorAlgorithm.py +++ b/Reconstruction/tauMonitoring/python/tauMonitorAlgorithm.py @@ -112,7 +112,12 @@ def tauMonitoringConfig(inputFlags): def namer(variables,histogramName, folder, algorithm): if folder != "": - return variables+";"+naming[algorithm]+folder+"_"+histogramName + #This wouldn't have been necessary except the calo folder in the naming convention: + #This adds the Tau prefix to the histograms in the calo folder + if postfix == "Global" and (folder =="Calo" or folder=="Track"): + return variables+";"+"Tau_"+naming[algorithm]+folder+"_"+histogramName + else: + return variables+";"+naming[algorithm]+folder+"_"+histogramName else: return variables+";"+naming[algorithm]+folder+histogramName @@ -140,11 +145,8 @@ def tauMonitoringConfig(inputFlags): if(postfix =="BA" or postfix =="CR" or postfix=="EC" or postfix == "Global" or postfix=="TauTrig" or postfix=="EleTrig" or postfix =="JetTrig"): - igroup.defineHistogram(namer('lumiPerBCID', 'lumiPerBCID',"",postfix), title='Luminosity per Bunch Crossing ID; Luminosity', - xbins=200, xmin=0., xmax=200.,path=folder) - igroup.defineHistogram(namer('nTauCandidates', 'nTauCandidates',"",postfix), title='Number of tau candidates;Number of Taus per Event', - xbins=40, xmin=0., xmax=40.,path=folder) + xbins=30, xmin=-0.5, xmax=30.5,path=folder) igroup.defineHistogram(namer('tauCharge','tauCharge','',postfix), title='Charge of tau candidates;Charge;Number of Candidates', @@ -171,45 +173,31 @@ def tauMonitoringConfig(inputFlags): igroup.defineHistogram(namer('LB,tauPhi','tauPhiVsLB','',postfix), type='TH2F', title='Tau Phi vs Lumiblock;Lumiblock;Phi', xbins=1200,xmin=0,xmax=1200,ybins=80,ymin=PHIMIN,ymax=PHIMAX,path=folder) - if(postfix =="BA" or postfix =="CR" or postfix=="EC" or postfix=="TauTrig"): - igroup.defineHistogram(namer('centFrac',"CentFrac","Identification_tauJetBDTinputs",postfix), title='Centrality Fraction;Centrality Fraction;Number Of Candidates', - xbins=70, xmin=0., xmax=1.4, path=folder+"Identification/tauJetBDTinputs") - - igroup.defineHistogram(namer('dRmax',"dRmax","Identification_tauJetBDTinputs",postfix), title='Maximum delta R;delta R;Number of Candidates', - xbins=42, xmin=0., xmax=0.21, path=folder+"Identification/tauJetBDTinputs" ) - - - igroup.defineHistogram(namer('EMPOverTrkSysP','EMPOverTrkSysP','Identification_tauJetBDTinputs',postfix), title='Momenta EM over tracks;;', - xbins=50, xmin=0., xmax=10., path=folder+"Identification/tauJetBDTinputs" ) - igroup.defineHistogram(namer('SumPtTrkFracCorrected','SumPtTrkFracCorrected','Identification_tauJetBDTinputs',postfix), title='Track PtSum Fraction;;', - xbins=10, xmin=0., xmax=1, path=folder+"Identification/tauJetBDTinputs" ) + igroup.defineHistogram(namer('tauPhiBDTLoose','phi','Identification_BDTLoose',postfix), title='Phi of tau candidates ( BDTLoose) ;Phi;Number of Candidates', + xbins=65, xmin=PHIMIN-0.098174/2., xmax=PHIMAX+0.098174/2., path=folder+"Identification/BDTLoose" ) - igroup.defineHistogram(namer('mEflowApprox','mEflowApprox','Identification_tauJetBDTinputs',postfix), title='Approx Energy Flow;;', - xbins=50, xmin=0., xmax=20, path=folder+"Identification/tauJetBDTinputs" ) + igroup.defineHistogram(namer('tauEtaBDTLoose','eta','Identification_BDTLoose',postfix), title='Eta of tau candidates ( BDTLoose) ;Eta;Number of Candidates', + xbins=51, xmin=-2.55, xmax=2.55, path=folder+"Identification/BDTLoose") - igroup.defineHistogram(namer('ptIntermediateAxis','ptIntermediateAxis','Identification_tauJetBDTinputs',postfix), title='Pt of tau candidates in IntermediateAxis;;', - xbins=60, xmin=0, xmax=150, path=folder+"Identification/tauJetBDTinputs" ) + igroup.defineHistogram(namer('tauEtBDTLoose','et','Identification_BDTLoose',postfix), title='Et of tau candidates;Transverse Energy (GeV);Number of Candidates', + xbins=60, xmin=0., xmax=300.,path=folder+"Identification/BDTLoose") - igroup.defineHistogram(namer('absipSigLeadTrk','absipSigLeadTrk','Identification_tauJetBDTinputs',postfix), title='Impact Parameter Significance of Leading Track;Transverse Impact Parameter Significance', - xbins=50, xmin=0., xmax=5., path=folder+"Identification/tauJetBDTinputs" ) + igroup.defineHistogram(namer('NumTracksBDTLoose','NumTracks','Identification_BDTLoose',postfix), title='Number Of Tracks for Tau Candidates (BDTLoose);Number Of Tracks;Number Of Candidates', + xbins=21, xmin=-0.5, xmax=20.5,path=folder+"Identification/BDTLoose") - igroup.defineHistogram(namer('etOverPtLeadTrk','etOverPtLeadTrk','Identification_tauJetBDTinputs',postfix), title='Et over Pt of lead track of tau candidates;Et/Pt;Number of Candidates', - xbins=50, xmin=0., xmax=12., path=folder+"Identification/tauJetBDTinputs" ) + igroup.defineHistogram(namer('tauPhiBDTMedium','phi','Identification_BDTMedium',postfix), title='Phi of tau candidates ( BDTMedium) ;Phi;Number of Candidates', + xbins=65, xmin=PHIMIN-0.098174/2., xmax=PHIMAX+0.098174/2., path=folder+"Identification/BDTMedium" ) - igroup.defineHistogram(namer('massTrkSys','massTrkSys','Identification_tauJetBDTinputs',postfix), title='Mass of the Track System;Invariant Mass (GeV)', - xbins=30, xmin=-1., xmax=5., path=folder+"Identification/tauJetBDTinputs" ) + igroup.defineHistogram(namer('tauEtaBDTMedium','eta','Identification_BDTMedium',postfix), title='Eta of tau candidates ( BDTMedium) ;Eta;Number of Candidates', + xbins=51, xmin=-2.55, xmax=2.55, path=folder+"Identification/BDTMedium") - igroup.defineHistogram(namer('ptRatioEflowApprox','ptRatioEflowApprox','Identification_tauJetBDTinputs',postfix), title='Ratio of pt to shot total energy for associated tracks; track pt ratio', - xbins=20, xmin=0., xmax=2., path=folder+"Identification/tauJetBDTinputs" ) - - igroup.defineHistogram(namer('trFlightPathSig','trFlightPathSig','Identification_tauJetBDTinputs',postfix),title='Track Transverse Flight Path Significance;Transverse Flight Path Significance', - xbins=125, xmin=-4.5, xmax=8., path=folder+"Identification/tauJetBDTinputs" ) - - igroup.defineHistogram(namer('trkAvgDist','trkAvgDist','Identification_tauJetBDTinputs',postfix), title='Average Track Distance from Calorimeter Seed;Distance (mm);Number of Candidates', - xbins=20, xmin=0., xmax=1., path=folder+"Identification/tauJetBDTinputs" ) + igroup.defineHistogram(namer('tauEtBDTMedium','et','Identification_BDTMedium',postfix), title='Et of tau candidates;Transverse Energy (GeV);Number of Candidates', + xbins=60, xmin=0., xmax=300.,path=folder+"Identification/BDTMedium") + igroup.defineHistogram(namer('NumTracksBDTMedium','NumTracks','Identification_BDTMedium',postfix), title='Number Of Tracks for Tau Candidates (BDTMedium);Number Of Tracks;Number Of Candidates', + xbins=21, xmin=-0.5, xmax=20.5,path=folder+"Identification/BDTMedium") igroup.defineHistogram(namer('tauPhiEt15BDTLoose','phi','Identification_BDTLoose15GeV',postfix), title='Phi of tau candidates (Et>15, BDTLoose) ;Phi;Number of Candidates', xbins=65, xmin=PHIMIN-0.098174/2., xmax=PHIMAX+0.098174/2., path=folder+"Identification/BDTLoose15GeV" ) @@ -279,6 +267,7 @@ def tauMonitoringConfig(inputFlags): igroup.defineHistogram(namer('BDTJetScoreSigTrans','BDTJetScoreSigTrans','Identification',postfix), title='Flattened signal Transformed BDT Score for Jet Rejection;Boosted Decision Tree Score',path=folder+"Identification", xbins=48, xmin=0, xmax=1.1 ) + igroup.defineHistogram(namer('eleBDTMedium','eleBDTMedium','Identification',postfix), title='Medium EleBDT',path=folder+"Identification", xbins=2, xmin=-0.5, xmax=1.5, xlabels=["False","True"]) @@ -297,17 +286,6 @@ def tauMonitoringConfig(inputFlags): igroup.defineHistogram(namer('tauBDTTight','tauBDTTight','Identification',postfix), title='Identification Flag: tauBDTTight',path=folder+"Identification", xbins=2, xmin=-0.5, xmax=1.5, xlabels=["False","True"]) - igroup.defineHistogram(namer('etHotShotWinOverPtLeadTrk','etHotShotWinOverPtLeadTrk','Identification_EleVetoBDTinputs',postfix), title='etHotShotWinOverPtLeadTrk',path=folder+"Identification/EleVetoBDTinputs", - xbins=20, xmin=0, xmax=12 ) - - igroup.defineHistogram(namer('hadLeakFracFixed','hadLeakFracFixed','Identification_EleVetoBDTinputs',postfix), title='hadLeakFracFixed',path=folder+"Identification/EleVetoBDTinputs", - xbins=20, xmin=0, xmax=2. ) - - igroup.defineHistogram(namer('PSSFrac','PSSFrac','Identification_EleVetoBDTinputs',postfix), title='Energy fraction for PreSampling and sampling layers in effective clusters in shot;Sampling Energy Fraction',path=folder+"Identification/EleVetoBDTinputs", - xbins=10, xmin=0, xmax=1. ) - - igroup.defineHistogram(namer('EMFrac','EMFrac','Identification_EleVetoBDTinputs',postfix), title='EMFracFixed',path=folder+"Identification/EleVetoBDTinputs", - xbins=20, xmin=0., xmax=2. ) #Substructure Histograms igroup.defineHistogram(namer('panModeSubstructure','panMode','SubStructure',postfix), title='tau decay mode from PanTau upon JetBDTSigMedium;mode', @@ -346,31 +324,67 @@ def tauMonitoringConfig(inputFlags): igroup.defineHistogram(namer('pt3','shots_pt3','SubStructure',postfix), title='weighted cell pt in 3x3 window in shots; pt3 (GeV) ',path=folder+"SubStructure", xbins=24, xmin=0, xmax=12 ) - #Track Histograms! - igroup.defineHistogram(namer('d0','d0','Track',postfix), title='Track d0;Transverse Impact Parameter (mm)',path=folder+"Track", - xbins=50, xmin=-5.0, xmax=5.0 ) + igroup.defineHistogram(namer('PSSFrac','PSSFracEffCluster','SubStructure',postfix), title='Energy fraction for PreSampling and sampling layers in effective clusters in shot;Sampling Energy Fraction',path=folder+"SubStructure", + xbins=10, xmin=0, xmax=1. ) - igroup.defineHistogram(namer('eProbabilityHT','eProbabilityHT','Track',postfix), title='Probability of High Threshold ;Probability of TRT High Threshold',path=folder+"Track", - xbins=12, xmin=-0.1, xmax=1.1 ) + igroup.defineHistogram(namer('ptRatioEflowApprox','ptRatioApprox','SubStructure',postfix), title='Ratio of pt to shot total energy for associated tracks; track pt ratio', + xbins=20, xmin=0., xmax=2., path=folder+"SubStructure" ) - igroup.defineHistogram(namer('leadTrackDeltaEta','leadTrackDeltaEta','Track',postfix), title='Leading Track Delta Eta; Leading track Delta Eta from jetSeed, EleVeto BDT input',path=folder+"Track", - xbins=30, xmin=-1.5, xmax=1.5 ) - igroup.defineHistogram(namer('leadTrackDeltaPhi','leadTrackDeltaPhi','Track',postfix), title='Leading Track Delta Phi; Leading track Delta Phi from jetSeed, EleVeto BDT input',path=folder+"Track", - xbins=30, xmin=-1.5, xmax=1.5 ) - igroup.defineHistogram(namer('dRJetSeedAxis','dRJetSeedAxis','Track',postfix), title='DeltaR from Track to JetSeedAxis; dR ',path=folder+"Track", - xbins=30, xmin=0.0, xmax=1.5 ) - igroup.defineHistogram(namer('z0TJVA','z0TJVA','Track',postfix), title='z0 respected to Tau vertex , Z0SinTheta (mm)',path=folder+"Track", - xbins=50, xmin=-35.0, xmax=35.0 ) - igroup.defineHistogram(namer('z0PriVtx','z0PriVtx','Track',postfix), title=' z0 respected to primary vertex ; Z0 SinTheta (mm)',path=folder+"Track", - xbins=50, xmin=-35.0, xmax=35.0 ) + + if(postfix =="BA" or postfix =="CR" or postfix=="EC" or postfix=="TauTrig" or postfix=="Global"): + #Calo Histograms + igroup.defineHistogram(namer('EMRadius','EMRadius','Calo',postfix), title='Uncalibrated EM Radius;EM Radius;Number Of Candidates',path=folder+"Calo", + xbins=50, xmin=0., xmax=1.2 ) - igroup.defineHistogram(namer('LB2,z0PriVtx','z0VsLB','Calo',postfix), type='TH2F', title='Track z0 vs Lumiblock;Longitudinal Impact Parameter (mm) );Lumiblock', path=folder+"Track", - xbins=1200,xmin=0,xmax=1200,ybins=50,ymin=-35.,ymax=35) + igroup.defineHistogram(namer('hadRadius','hadRadius','Calo',postfix), title='Hadronic Radius of tau candidates;Hadronic Radius; Number Of Candidates',path=folder+"Calo", + xbins=50, xmin=0., xmax=1. ) + + igroup.defineHistogram(namer('stripWidth2','stripWidth2','Calo',postfix), title='Strip Width of tau candidates;Strip Width;Number of Candidates',path=folder+"Calo", + xbins=50, xmin=-0.1, xmax=0.12 ) + igroup.defineHistogram(namer('isolFrac','isolFrac','Calo',postfix), title='Isolation Fraction;Et Isolation Fraction;Number of Candidates',path=folder+"Calo", + xbins=51, xmin=0.0, xmax=1.02 ) + + igroup.defineHistogram(namer('nStrip','nStrip','Calo',postfix), title='Number of strip cells of tau candidates;Number of Strip Cells;Number of Candidates',path=folder+"Calo", + xbins=56, xmin=-0.5, xmax=55.5 ) + + igroup.defineHistogram(namer('etEMAtEMScale','etEMAtEMScale','Calo',postfix), title='EM energy at the EM scale;EM Et (GeV) );Number of Candidates',path=folder+"Calo", + xbins=50, xmin=0., xmax=200. ) + + igroup.defineHistogram(namer('etHadAtEMScale','etHadAtEMScale','Calo',postfix), title='Hadronic Energy at the EM Scale;Had Et (GeV) );Number of Candidates',path=folder+"Calo", + xbins=50, xmin=0., xmax=200. ) + + igroup.defineHistogram(namer('centFrac,LB','centFracVsLB','Calo',postfix), type='TH2F', title='Centrality Fraction vs Lumiblock;Centrality Fraction;Lumiblock', path=folder+"Calo", + xbins=51,xmin=0,xmax=1.02,ybins=1200,ymin=0.,ymax=1200.) + + igroup.defineHistogram(namer('isolFrac,LB','isolFracVsLB','Calo',postfix), type='TH2F', title='Isolation Fraction vs Lumiblock;Isolation Fraction;Lumiblock', path=folder+"Calo", + xbins=51,xmin=0,xmax=1.02,ybins=1200,ymin=0.,ymax=1200.) + + igroup.defineHistogram(namer('centFrac',"centralityFraction","Calo",postfix), title='Centrality Fraction;Centrality Fraction;Number Of Candidates', + xbins=70, xmin=0., xmax=1.4, path=folder+"Calo") + + igroup.defineHistogram(namer('dRmax',"dRmax","Calo",postfix), title='Maximum delta R;delta R;Number of Candidates', + xbins=42, xmin=0., xmax=0.21, path=folder+"Calo" ) + + igroup.defineHistogram(namer('tauEta','eta','Calo',postfix), title='Eta of tau candidates;Eta;Number of Candidates', + xbins=51, xmin=-2.55, xmax=2.55,path=folder+"Calo") + + igroup.defineHistogram(namer('tauPhi','phi','Calo',postfix), title='Phi of tau candidates;Phi;Number of Candidates', + xbins=65, xmin=PHIMIN, xmax=PHIMAX,path=folder+"Calo") + + igroup.defineHistogram(namer('trkAvgDist','trkAvgDist','Calo',postfix), title='Average Track Distance from Calorimeter Seed;Distance (mm);Number of Candidates', + xbins=20, xmin=0., xmax=1., path=folder+"Calo" ) + + #Track Histograms! + igroup.defineHistogram(namer('d0','d0','Track',postfix), title='Track d0;Transverse Impact Parameter (mm)',path=folder+"Track", + xbins=50, xmin=-5.0, xmax=5.0 ) + + igroup.defineHistogram(namer('z0PriVtx','z0PriVtx','Track',postfix), title=' z0 respected to primary vertex ; Z0 SinTheta (mm)',path=folder+"Track", + xbins=50, xmin=-35.0, xmax=35.0 ) igroup.defineHistogram(namer('etaTrack','eta','Track',postfix), title='Track Eta;Eta',path=folder+"Track", xbins=51, xmin=-2.55, xmax=2.55 ) @@ -381,7 +395,6 @@ def tauMonitoringConfig(inputFlags): igroup.defineHistogram(namer('nHighPtTaus','nHighPtTaus','Track',postfix), title='Number of High Pt tau candidates;Number of Taus per Event', xbins=15, xmin=-0.5, xmax=14.5,path=folder+"Track") - igroup.defineHistogram(namer('numberOfTRTHighThresholdHits','numberOfTRTHighThresholdHits','Track',postfix), title='Number of TRT High Threshold Hits;Number of High Threshold TRT Hits',path=folder+"Track", xbins=15, xmin=-0.5, xmax=14.5 ) @@ -400,12 +413,6 @@ def tauMonitoringConfig(inputFlags): igroup.defineHistogram(namer('phiTrack','phi','Track',postfix), title='Track Phi;Phi',path=folder+"Track", xbins=64, xmin=PHIMIN, xmax=PHIMAX ) - igroup.defineHistogram(namer('rConv','rConv','Track',postfix), title='rConv;rConv',path=folder+"Track", - xbins=40, xmin=0, xmax=80 ) - - igroup.defineHistogram(namer('rConvII','rConvII','Track',postfix), title='rConvII;rConvII',path=folder+"Track", - xbins=40, xmin=0, xmax=80 ) - igroup.defineHistogram(namer('trkWidth2','trkWidth2','Track',postfix), title='Weighted Track Width;Momentum-Weighted Width of Track System',path=folder+"Track", xbins=50, xmin=0.0, xmax=0.1 ) @@ -413,38 +420,34 @@ def tauMonitoringConfig(inputFlags): xbins=50, xmin=-10.0, xmax=10.0 ) igroup.defineHistogram(namer('numberOfPixelHits','numberOfPixelHits','Track',postfix), title='Number of Pixel Hits;Number of Pixel Hits',path=folder+"Track", - xbins=33, xmin=-0.5, xmax=15.5 ) - - igroup.defineHistogram(namer('numberOfInnermostPixelLayerHits','numberOfInnermostPixelLayerHits','Track',postfix), title='Number of Innermost Pixel layer Hits;Number of Innermost Pixel layer Hits',path=folder+"Track", - xbins=11, xmin=-0.5, xmax=10.5 ) - - igroup.defineHistogram(namer('numberOfPixelSharedHits','numberOfPixelSharedHits','Track',postfix), title='Number of Pixel shared Hits;Number of Pixel shared Hits',path=folder+"Track", - xbins=11, xmin=-0.5, xmax=10.5 ) + xbins=25, xmin=-0.5, xmax=25.5 ) igroup.defineHistogram(namer('numberOfSCTHits','numberOfSCTHits','Track',postfix), title='Number of SCT Hits;Number of SCT Hits',path=folder+"Track", xbins=26, xmin=0, xmax=26 ) - igroup.defineHistogram(namer('numberOfSCTSharedHits','numberOfSCTSharedHits','Track',postfix), title='Number of SCT shared Hits;Number of SCT shared Hits',path=folder+"Track", - xbins=21, xmin=-0.5, xmax=20.5 ) + igroup.defineHistogram(namer('etOverPtLeadTrack','etOverPtLeadTrack','Track',postfix), title='Et over Pt of lead track of tau candidates;Et/Pt;Number of Candidates', + xbins=50, xmin=0., xmax=12., path=folder+"Track" ) + igroup.defineHistogram(namer('ipSigLeadTrk','ipSigLeadTrk','Track',postfix), title='Impact Parameter Significance of Leading Track;Transverse Impact Parameter Significance', + xbins=100, xmin=-5., xmax=5., path=folder+"Track" ) - if postfix == 'Global' or postfix == "TauTrig" or postfix == "EleTrig" or postfix=="JetTrig": - igroup.defineHistogram(namer('PtCombined','Ptcombined','',postfix), title='combined pT of tau candidates);Transverse Energy (GeV) );Number of Candidates', - xbins=60, xmin=0., xmax=300. ,path=folder) + igroup.defineHistogram(namer('massTrkSys','massTrkSys','Track',postfix), title='Mass of the Track System;Invariant Mass (GeV)', + xbins=30, xmin=-1., xmax=5., path=folder+"Track" ) - igroup.defineHistogram(namer('PtTESMVA','PtTESMVA','',postfix), title='TES pT (MVA) of tau candidates);Transverse Energy (GeV) );Number of Candidates', - xbins=60, xmin=0., xmax=300. ,path=folder) + igroup.defineHistogram(namer('trFlightPathSig','trFlightPathSig','Track',postfix),title='Track Transverse Flight Path Significance;Transverse Flight Path Significance', + xbins=125, xmin=-4.5, xmax=8., path=folder+"Track" ) - igroup.defineHistogram(namer('LB,coreTrk','NumCoreTrkVsLB','',postfix), type='TH2F', title='Tau Core tracks vs Lumiblock); LumiBlock ; NumCoreTrk', - xbins=1200,xmin=0,xmax=1200,ybins=400,ymin=0,ymax=40,path=folder) + igroup.defineHistogram(namer('z0','z0','Track',postfix), title='Track z0;Longitudinal Impact Parameter (mm)',path=folder+"Track", + xbins=50, xmin=-35.0, xmax=35.0 ) + if postfix == 'Global' or postfix == "TauTrig" or postfix == "EleTrig" or postfix=="JetTrig": igroup.defineHistogram(namer('LB','nTauPerLB','',postfix), title='Total number of tau candidates per LB);Luminosity Block);Number of Candidates', xbins=1000, xmin=0., xmax=1000. ,path=folder) igroup.defineHistogram(namer('nHighPtTauCandidates','nHightPtTauCandidates','',postfix), title='Number of High Pt tau candidates;Number of Taus per Event', xbins=15, xmin=-0.5, xmax=14.5,path=folder) - igroup.defineHistogram(namer('NumTracks','NumTracks','',postfix), title='Number Of Tracks for Tau Candidates;Number Of Tracks;Number Of Candidates', + igroup.defineHistogram(namer('NumTracks','tauNumTracks','',postfix), title='Number Of Tracks for Tau Candidates;Number Of Tracks;Number Of Candidates', xbins=21, xmin=-0.5, xmax=20.5,path=folder) igroup.defineHistogram(namer('nClusters','nCluster','',postfix), title='Number Of CaloTopoClusters;Number Of Clusters;Number Of Candidates', @@ -456,24 +459,33 @@ def tauMonitoringConfig(inputFlags): igroup.defineHistogram(namer('tauPhi,tauEt','tauEtVsPhi','',postfix), type='TH2F', title='EtVsPhi;Phi;Transverse Energy (GeV);', xbins=80,xmin=PHIMIN,xmax=PHIMAX,ybins=300,ymin=-0.,ymax=300.,path=folder) - igroup.defineHistogram(namer('LB,tauEt','tauEtVsLB','',postfix), type='TH2F', title='Tau Et Vs Lumiblock ;Lumiblock;Transverse Energy (GeV)', - xbins=1200,xmin=0,xmax=1200,ybins=300,ymin=0.,ymax=300.,path=folder) + if postfix == 'Global': + #Physics Histograms - I suspect these should be doing some kind of selection, not obvious in the old code. + igroup.defineHistogram(namer('tauEta','tau_eta','',postfix), title='Eta of tau candidates;Eta;Number of Candidates', + xbins=51, xmin=-2.55, xmax=2.55,path=folder+"Physics/Z") + + igroup.defineHistogram(namer('tauEta,tauEt','tau_pTVsEta','',postfix), type='TH2F', title='Tau Et Vs Eta;#eta;Transverse Energy (Gev)', + xbins=40,xmin=-2.55,xmax=2.55 ,ybins=300,ymin=0,ymax=300,path=folder+"Physics/Z") + + + #will use different variable when not a placeholder + igroup.defineHistogram(namer('tauEta','lepton_pTVsEta','',postfix), title='Placeholder for empty histogram;Eta;Number of Candidates', + xbins=51, xmin=-2.55, xmax=2.55,path=folder+"Physics/Z") - if postfix == 'HighPt': - igroup.defineHistogram(namer('tauEtaEt15,tauPhiEt15','tauPhiVsEtaEt15','',postfix), type='TH2F', title='EtaVsEtTitle;Eta;Phi', + igroup.defineHistogram(namer('tauEta,tauEt','tau_pTVsEta','',postfix), type='TH2F', title='Tau Et Vs Eta;#eta;Transverse Energy (Gev)', + xbins=40,xmin=-2.55,xmax=2.55 ,ybins=300,ymin=0,ymax=300,path=folder+"Physics/W") + + if postfix == 'HighPt': + igroup.defineHistogram(namer('tauEtaEt15,tauPhiEt15','tauPhiVsEta_et15','',postfix), type='TH2F', title='EtaVsEtTitle;Eta;Phi', xbins=30,xmin=-2.55,xmax=2.55,ybins=32,ymin=PHIMIN,ymax=PHIMAX) if postfix == 'HighPtBDTLoose': - igroup.defineHistogram(namer('LB,tauPhiEt15BDTLoose','tauPhiVsLBet15BDTLoose','',postfix), type='TH2F', title='Tau Eta Vs Lumiblock (Et>15, BDTLoose) ;Lumiblock;Phi', - xbins=1200,xmin=0,xmax=1200,ybins=80,ymin=PHIMIN,ymax=PHIMAX) - - igroup.defineHistogram(namer('tauEtaEt15BDTLoose,tauPhiEt15BDTLoose','tauPhiVsEtaEt15BDTLoose','',postfix), type='TH2F', title='Phi vs Eta (Et>15, BDTLoose) ;Eta;Phi', + igroup.defineHistogram(namer('tauEtaEt15BDTLoose,tauPhiEt15BDTLoose','tauPhiVsEta_et15_BDTLoose','',postfix), type='TH2F', title='Phi vs Eta (Et>15, BDTLoose) ;Eta;Phi', xbins=30,xmin=-2.55,xmax=2.55,ybins=32,ymin=PHIMIN,ymax=PHIMAX) - igroup.defineHistogram(namer('LB,tauEtaEt15BDTLoose','tauEtaVsLBet15BDTLoose','',postfix), type='TH2F', title='Tau Eta VsLumiblock (Et>15, BDTLoose) ;Lumiblock;Eta', - xbins=1200,xmin=0,xmax=1200,ybins=51,ymin=-2.55,ymax=2.55) + ### STEP 6 ### # Finalize. The return value should be a tuple of the ComponentAccumulator diff --git a/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx b/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx index 23c949b2e193bbdab91e0429167347a45ca7131b..32e17fc9a1ff684f143441b75df88b7282ca65b1 100644 --- a/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx +++ b/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx @@ -46,7 +46,6 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const const int lowerEtThreshold = 15; const int higherEtThreshold = 75; - auto tool = getGroup(m_kinGroupName); auto tauEta = Monitored::Scalar<float>("tauEta",0.0); auto tauPhi = Monitored::Scalar<float>("tauPhi",0.0); @@ -75,8 +74,17 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const auto nClusters = Monitored::Scalar<int>("nClusters",0.0); auto nClustersEt15BDTLoose = Monitored::Scalar<int>("nClustersEt15BDTLoose",0.0); + auto tauEtBDTLoose = Monitored::Scalar<float>("tauEtBDTLoose",0.0); + auto tauEtaBDTLoose = Monitored::Scalar<float>("tauEtaBDTLoose",0.0); + auto tauPhiBDTLoose = Monitored::Scalar<float>("tauPhiBDTLoose",0.0); + auto NumTracksBDTLoose = Monitored::Scalar<float>("NumTracksBDTLoose",0.0); + + auto tauEtBDTMedium = Monitored::Scalar<float>("tauEtBDTMedium",0.0); + auto tauEtaBDTMedium = Monitored::Scalar<float>("tauEtaBDTMedium",0.0); + auto tauPhiBDTMedium = Monitored::Scalar<float>("tauPhiBDTMedium",0.0); + auto NumTracksBDTMedium = Monitored::Scalar<float>("NumTracksBDTMedium",0.0); + auto LB = Monitored::Scalar<int>("LB",0.0); - auto LB2 = Monitored::Scalar<int>("LB2",0.0); auto EMRadius = Monitored::Scalar<float>("EMRadius",0.0); auto hadRadius = Monitored::Scalar<float>("hadRadius",0.0); @@ -84,6 +92,7 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const auto stripWidth2 = Monitored::Scalar<float>("stripWidth2",0.0); auto nStrip = Monitored::Scalar<float>("nStrip",0.0); auto etEMAtEMScale = Monitored::Scalar<float>("etEMAtEMScale",0.0); + auto etHadAtEMScale = Monitored::Scalar<float>("etHadAtEMScale",0.0); auto centFrac = Monitored::Scalar<float>("centFrac",0.0); auto jetSeedEta = Monitored::Scalar<float>("jetSeedEta",0.0); @@ -98,6 +107,8 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const auto eleBDTMedium = Monitored::Scalar<float>("eleBDTMedium",0.0); auto eleBDTTight = Monitored::Scalar<float>("eleBDTTight",0.0); auto muonVeto = Monitored::Scalar<float>("muonVeto",0.0); + + auto tauBDTLoose = Monitored::Scalar<float>("tauBDTLoose",0.0); auto tauBDTMedium = Monitored::Scalar<float>("tauBDTMedium",0.0); auto tauBDTTight = Monitored::Scalar<float>("tauBDTTight",0.0); @@ -123,8 +134,8 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const auto ptIntermediateAxis = Monitored::Scalar<float>("ptIntermediateAxis",0.0); auto ipSigLeadTrk = Monitored::Scalar<float>("ipSigLeadTrk",0.0); - auto etOverPtLeadTrk = Monitored::Scalar<float>("etOverPtLeadTrk",0.0); auto massTrkSys = Monitored::Scalar<float>("massTrkSys",0.0); + auto etOverPtLeadTrack = Monitored::Scalar<float>("etOverPtLeadTrack",0.0); auto ptRatioEflowApprox = Monitored::Scalar<float>("ptRatioEflowApprox",0.0); auto trFlightPathSig = Monitored::Scalar<float>("trFlightPathSig",0.0); auto trkAvgDist = Monitored::Scalar<float>("trkAvgDist",0.0); @@ -139,6 +150,8 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const auto dRJetSeedAxis = Monitored::Scalar<float>("dRJetSeedAxis",0.0); auto z0TJVA = Monitored::Scalar<float>("z0TJVA",0.0); auto z0PriVtx = Monitored::Scalar<float>("z0PriVtx",0.0); + auto z0 = Monitored::Scalar<float>("z0",0.0); + auto etaTrack = Monitored::Scalar<float>("etaTrack",0.0); auto ptTrack = Monitored::Scalar<float>("ptTrack",0.0); @@ -186,6 +199,7 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const nStrip = tau->detail<int>(xAOD::TauJetParameters::nStrip) ; etEMAtEMScale = tau->detail<float>(xAOD::TauJetParameters::etEMAtEMScale); etHadAtEMScale = tau->detail<float>(xAOD::TauJetParameters::etHadAtEMScale); + centFrac = tau->detail<float>(xAOD::TauJetParameters::centFrac) ; jetSeedEta = tau->etaJetSeed(); jetSeedPhi = tau->phiJetSeed(); @@ -195,6 +209,7 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const //identification BDTJetScore = tau->discriminant(xAOD::TauJetParameters::BDTJetScore); BDTJetScoreSigTrans = tau->discriminant(xAOD::TauJetParameters::BDTJetScoreSigTrans); + JetBDTBkgMedium = tau->isTau(xAOD::TauJetParameters::JetBDTBkgMedium); BDTEleScoreSigTrans = tau->auxdata<float>("BDTEleScoreSigTrans"); @@ -210,10 +225,7 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const EMPOverTrkSysP = tau->detail<float>(xAOD::TauJetParameters::EMPOverTrkSysP); SumPtTrkFracCorrected = tau->detail<float>(xAOD::TauJetParameters::SumPtTrkFracCorrected); mEflowApprox = tau->detail<float>(xAOD::TauJetParameters::mEflowApprox)/GeV; - - etOverPtLeadTrk = tau->detail<float>(xAOD::TauJetParameters::etOverPtLeadTrk); ptRatioEflowApprox = tau->detail<float>( xAOD::TauJetParameters::ptRatioEflowApprox ); - trFlightPathSig = tau->detail<float>(xAOD::TauJetParameters::trFlightPathSig); trkAvgDist = tau->detail<float>(xAOD::TauJetParameters::trkAvgDist); panEta = tau->etaPanTauCellBased(); @@ -272,13 +284,45 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const tau->panTauDetail(xAOD::TauJetParameters::PanTau_DecayMode, panModeDummy); panModeEt15BDTLoose = panModeDummy; - fill(tool,tauPhiEt15BDTLoose); - fill(tool,tauEtaEt15BDTLoose); - fill(tool,nClustersEt15BDTLoose); - fill(tool,NumTracksEt15BDTLoose); - fill(tool,tauEtEt15BDTLoose); - fill(tool,panModeEt15BDTLoose); + fill(tool + ,tauPhiEt15BDTLoose + ,tauEtaEt15BDTLoose + ,nClustersEt15BDTLoose + ,NumTracksEt15BDTLoose + ,tauEtEt15BDTLoose + ,panModeEt15BDTLoose); + } + + + if(m_kinGroupName != "tauMonKinGroupGlobal" && tauBDTLoose){ + tauPhiBDTLoose = tau->phi(); + tauEtaBDTLoose = tau->eta(); + tauEtBDTLoose = tau->pt()/GeV; + NumTracksBDTLoose = tau->nTracks(); + + fill(tool + ,tauPhiBDTLoose + ,tauEtaBDTLoose + ,NumTracksBDTLoose + ,tauEtBDTLoose); } + + if(m_kinGroupName != "tauMonKinGroupGlobal" && tauBDTMedium){ + tauPhiBDTMedium = tau->phi(); + tauEtaBDTMedium = tau->eta(); + tauEtBDTMedium = tau->pt()/GeV; + NumTracksBDTMedium = tau->nTracks(); + + fill(tool + ,tauPhiBDTMedium + ,tauEtaBDTMedium + ,NumTracksBDTMedium + ,tauEtBDTMedium); + } + + + + if (tau->nTracks()!= 0){ massTrkSys = tau->detail<float>(xAOD::TauJetParameters::massTrkSys) / GeV; //GeV @@ -286,15 +330,17 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const trFlightPathSig = tau->detail<float>(xAOD::TauJetParameters::trFlightPathSig); ipSigLeadTrk = tau->detail<float>(xAOD::TauJetParameters::ipSigLeadTrk); ipZ0SinThetaSigLeadTrk = tau->detail<float>(xAOD::TauJetParameters::ipZ0SinThetaSigLeadTrk); - + etOverPtLeadTrack = tau->detail<float>(xAOD::TauJetParameters::etOverPtLeadTrk); leadTrkPt =tau->detail<float>(xAOD::TauJetParameters::leadTrkPt)/GeV; - fill(tool,massTrkSys); - fill(tool,trkWidth2); - fill(tool,trFlightPathSig); - fill(tool,ipSigLeadTrk); - fill(tool,ipZ0SinThetaSigLeadTrk); - fill(tool,leadTrkPt); + fill(tool + ,massTrkSys + ,etOverPtLeadTrack + ,trkWidth2 + ,trFlightPathSig + ,ipSigLeadTrk + ,ipZ0SinThetaSigLeadTrk + ,leadTrkPt); if ( environment() != Environment_t::AOD ){ const xAOD::TrackParticle* track = tau->track(0)->track(); @@ -345,14 +391,18 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const d0 = perigee.parameters()[Trk::d0]; - fill(tool,d0); - //z0 missing + z0 = perigee.parameters()[Trk::z0]; + phiTrack = perigee.parameters()[Trk::phi]; - fill(tool,phiTrack); etaTrack = perigee.eta(); - fill(tool,etaTrack); ptTrack = perigee.pT()/GeV; - fill(tool,ptTrack); + + fill(tool + ,d0 + ,z0 + ,phiTrack + ,etaTrack + ,ptTrack); } } @@ -381,63 +431,67 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const BDTScoreAsP0 = npfo->bdtPi0Score(); fill(tool,BDTScoreAsP0); } - - fill(tool,tauPhi,tauEta,LB,tauEt,centFrac, isolFrac,coreTrk); //for all 2d Histograms - fill(tool,PtTESMVA); - fill(tool,PtCombined); - fill(tool,EMRadius); - fill(tool,hadRadius); - fill(tool,stripWidth2); - fill(tool,nStrip); - fill(tool,etEMAtEMScale); - fill(tool,etHadAtEMScale); - fill(tool,tauCharge); - fill(tool,BDTEleScoreSigTrans); - fill(tool,BDTJetScore); - fill(tool,BDTJetScoreSigTrans); - fill(tool,JetBDTBkgMedium); - fill(tool,BDTEleScoreSigTrans); - fill(tool,eleBDTMedium); - fill(tool,eleBDTTight); - fill(tool,muonVeto); - fill(tool,tauBDTLoose); - fill(tool,tauBDTMedium); - fill(tool,tauBDTTight); - fill(tool,BDTJetScore); - fill(tool,PSSFrac); - fill(tool,hadLeakFracFixed); - fill(tool,etHotShotWinOverPtLeadTrk); - fill(tool,EMFrac); - fill(tool,EMFracTrk); - fill(tool,EfracL2EffCluster); - fill(tool,EisoEffCluster); - fill(tool,InvMassEffClusters); - fill(tool,nNeutPFO); - fill(tool,nShot); - fill(tool,NumTracks); - fill(tool,nClusters); - fill(tool,jetSeedEta); - fill(tool,jetSeedPhi); - fill(tool,jetSeedPt); - fill(tool,dRmax); - fill(tool,EMPOverTrkSysP); - fill(tool,SumPtTrkFracCorrected); - fill(tool,mEflowApprox); - fill(tool,ptIntermediateAxis); - fill(tool,etOverPtLeadTrk); - fill(tool,ptRatioEflowApprox); - fill(tool,trkAvgDist); - fill(tool,lumiPerBCID); + fill(tool + ,tauPhi + ,tauEta + ,LB,tauEt + ,centFrac + ,isolFrac + ,coreTrk + ,PtTESMVA + ,PtCombined + ,EMRadius + ,hadRadius + ,stripWidth2 + ,nStrip + ,etEMAtEMScale + ,etHadAtEMScale + ,tauCharge + ,BDTEleScoreSigTrans + ,BDTJetScore + ,BDTJetScoreSigTrans + ,JetBDTBkgMedium + ,BDTEleScoreSigTrans + ,eleBDTMedium + ,eleBDTTight + ,muonVeto + ,tauBDTLoose + ,tauBDTMedium + ,tauBDTTight + ,BDTJetScore + ,PSSFrac + ,hadLeakFracFixed + ,etHotShotWinOverPtLeadTrk + ,EMFrac + ,EMFracTrk + ,EfracL2EffCluster + ,EisoEffCluster + ,InvMassEffClusters + ,nNeutPFO + ,nShot + ,NumTracks + ,nClusters + ,jetSeedEta + ,jetSeedPhi + ,jetSeedPt + ,dRmax + ,EMPOverTrkSysP + ,SumPtTrkFracCorrected + ,mEflowApprox + ,ptIntermediateAxis + ,ptRatioEflowApprox + ,trkAvgDist + ,lumiPerBCID); tau->panTauDetail(xAOD::TauJetParameters::PanTau_DecayMode, panModeSubstructureDummy); - panModeSubstructure = panModeSubstructureDummy; fill(tool,panModeSubstructure); if ( panPhi > -100 ){ - fill(tool,panEta); - fill(tool,panPhi); - fill(tool,panPt); + fill(tool + ,panEta + ,panPhi + ,panPt); } } } @@ -455,14 +509,16 @@ StatusCode tauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const nClustersEt15BDTLoose = tau->detail<int>(xAOD::TauJetParameters::numTopoClusters) ; NumTracksEt15BDTLoose = tau->nTracks(); - fill(tool,LB,tauPhiEt15BDTLoose,tauEtaEt15BDTLoose); - fill(tool,nClustersEt15BDTLoose); - fill(tool,NumTracksEt15BDTLoose); - fill(tool,tauEtEt15BDTLoose); + fill(tool + ,LB + ,tauPhiEt15BDTLoose + ,tauEtaEt15BDTLoose + ,nClustersEt15BDTLoose + ,NumTracksEt15BDTLoose + ,tauEtEt15BDTLoose); } } } - fill(tool,nHighPtTauCandidates); - fill(tool,nTauCandidates); + fill(tool,nHighPtTauCandidates,nTauCandidates,nHighPtTaus); return StatusCode::SUCCESS; } diff --git a/Reconstruction/tauRecTools/Root/CombinedP4FromRecoTaus.cxx b/Reconstruction/tauRecTools/Root/CombinedP4FromRecoTaus.cxx index 7884e21d3c9e7f236c145414a57ff6292786c457..a312b7deeae82ed711dcb3c2583befe16a6ec3a2 100644 --- a/Reconstruction/tauRecTools/Root/CombinedP4FromRecoTaus.cxx +++ b/Reconstruction/tauRecTools/Root/CombinedP4FromRecoTaus.cxx @@ -17,8 +17,11 @@ //_____________________________________________________________________________ CombinedP4FromRecoTaus::CombinedP4FromRecoTaus(const std::string& name) : - TauRecToolBase(name) -{ + TauRecToolBase(name) { + + declareProperty("addCalibrationResultVariables", m_addCalibrationResultVariables = false); + declareProperty("addUseCaloPtFlag", m_addUseCaloPtFlag = false); + declareProperty("WeightFileName", m_sWeightFileName = ""); } //_____________________________________________________________________________ diff --git a/Reconstruction/tauRecTools/Root/HelperFunctions.cxx b/Reconstruction/tauRecTools/Root/HelperFunctions.cxx index 4ec4b578151f64f4844be25af05b67ec192ecbd3..bed43d1062c169fef5f4a6ea5257862fa610eb37 100644 --- a/Reconstruction/tauRecTools/Root/HelperFunctions.cxx +++ b/Reconstruction/tauRecTools/Root/HelperFunctions.cxx @@ -4,7 +4,6 @@ // local include(s) #include "tauRecTools/HelperFunctions.h" -#include <AsgTools/MessageCheck.h> #include <TObjString.h> #include <TObjArray.h> @@ -13,6 +12,10 @@ #include <iostream> +namespace tauRecTools { + ANA_MSG_SOURCE(msgHelperFunction, "HelperFunction") +} + xAOD::TauTrack::TrackFlagType tauRecTools::isolateClassifiedBits(xAOD::TauTrack::TrackFlagType flag){ const int flagsize=sizeof(flag)*8; flag=flag<<(flagsize-xAOD::TauJetParameters::classifiedFake-1); @@ -194,15 +197,21 @@ float tauRecTools::TRTBDT::GetResponse(){ const StatusCode tauRecTools::GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool incShowerSubtracted){ - using namespace asg::msgUserCode; + using namespace tauRecTools::msgHelperFunction; // If using subtracted clusters, need to store unmodified to check if charged are duplicates std::vector<const xAOD::CaloCluster*> dupList; // Loop over jet constituents xAOD::JetConstituentVector jVec = jet->getConstituents(); for(auto jCon : jVec){ + ANA_MSG_DEBUG("JetConstituent: "); + ANA_MSG_DEBUG("eta: " << jCon->eta() << " phi: " << jCon->phi() << " e: " << jCon->e()); if( jCon->type() == xAOD::Type::CaloCluster ) { const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( jCon->rawConstituent() ); + ANA_MSG_DEBUG("CaloCluster: "); + ANA_MSG_DEBUG("eta: " << cluster->eta() << " phi: " << cluster->phi() << " e: " << cluster->e()); + ANA_MSG_DEBUG("rawEta: " << cluster->rawEta() << " rawPhi: " << cluster->rawPhi() << " rawE: " << cluster->rawE()); + ANA_MSG_DEBUG("calEta: " << cluster->calEta() << " calPhi: " << cluster->calPhi() << " calE: " << cluster->calE()); clusterList.push_back(cluster); } else if( jCon->type() == xAOD::Type::ParticleFlow ) { diff --git a/Reconstruction/tauRecTools/Root/MvaTESEvaluator.cxx b/Reconstruction/tauRecTools/Root/MvaTESEvaluator.cxx index cb53de053474ac9bf61e6a32bf1e04af0457ab2d..bec21ad6869af9e174c4e5f7ee2bf5966ca1b6b2 100644 --- a/Reconstruction/tauRecTools/Root/MvaTESEvaluator.cxx +++ b/Reconstruction/tauRecTools/Root/MvaTESEvaluator.cxx @@ -12,13 +12,12 @@ //_____________________________________________________________________________ MvaTESEvaluator::MvaTESEvaluator(const std::string& name) - : TauRecToolBase(name) -{ + : TauRecToolBase(name) { + declareProperty("WeightFileName", m_sWeightFileName = ""); } //_____________________________________________________________________________ -MvaTESEvaluator::~MvaTESEvaluator() -{ +MvaTESEvaluator::~MvaTESEvaluator() { } //_____________________________________________________________________________ diff --git a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx index db817cb9edfce28de27ccfb1ae592ca4d52260d4..f19fbc769a82cf82abe5836cd2af3355c13762ee 100644 --- a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx @@ -6,20 +6,20 @@ #include "tauRecTools/MvaTESVariableDecorator.h" #include "tauRecTools/HelperFunctions.h" -#include "GaudiKernel/SystemOfUnits.h" +#define GeV 1000 //_____________________________________________________________________________ MvaTESVariableDecorator::MvaTESVariableDecorator(const std::string& name) - : TauRecToolBase(name) -{ + : TauRecToolBase(name) { + declareProperty("IncShowerSubtr", m_incShowerSubtr = true, "use shower subtracted clusters in calo calculations"); } //_____________________________________________________________________________ -MvaTESVariableDecorator::~MvaTESVariableDecorator() -{ +MvaTESVariableDecorator::~MvaTESVariableDecorator() { + } -StatusCode MvaTESVariableDecorator::initialize(){ +StatusCode MvaTESVariableDecorator::initialize() { ATH_CHECK( m_eventInfo.initialize() ); @@ -190,7 +190,7 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) { // calculate interpolated pT double pt_pantau = xTau.ptPanTauCellBased(); double pt_LC = xTau.ptDetectorAxis(); - double interpolWeight = 0.5 * ( 1. + TMath::TanH( ( pt_LC/Gaudi::Units::GeV - 250. ) / 20. ) ); + double interpolWeight = 0.5 * ( 1. + TMath::TanH( ( pt_LC/GeV - 250. ) / 20. ) ); double LC_pantau_interpolPt = interpolWeight*pt_LC + (1.-interpolWeight)*pt_pantau; xTau.setDetail(xAOD::TauJetParameters::LC_pantau_interpolPt, (float) LC_pantau_interpolPt); diff --git a/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx b/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx index 1a78706b2718602c309db6bdafd9fcf7a0232afc..ad9a55c15b9cea9fff16cee48c17fe263d2394b6 100644 --- a/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx +++ b/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx @@ -2,8 +2,6 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/SystemOfUnits.h" - //tau #include "tauRecTools/TauCalibrateLC.h" #include "xAODTau/TauJet.h" @@ -13,11 +11,18 @@ #include "TF1.h" #include "TH1D.h" -using Gaudi::Units::GeV; +#define GeV 1000 /********************************************************************/ TauCalibrateLC::TauCalibrateLC(const std::string& name) : TauRecToolBase(name) { + declareProperty("calibrationFile", m_calibrationFile = ""); + declareProperty("doEnergyCorrection", m_doEnergyCorr = false); + declareProperty("doPtResponse", m_doPtResponse = false); + declareProperty("countOnlyPileupVertices", m_countOnlyPileupVertices = false); + declareProperty("doAxisCorrection", m_doAxisCorr = false); + declareProperty("usePantauAxis", m_usePantauAxis = false); + declareProperty("isCaloOnly", m_isCaloOnly = false); } /********************************************************************/ diff --git a/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx b/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx index cd02d423d7ac3a1646ec86db7a0743228c80ee90..423f7dc08ed3899b4395d89f8200ad42f1615a38 100644 --- a/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx +++ b/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx @@ -23,6 +23,8 @@ TauCommonCalcVars::TauCommonCalcVars(const std::string &name) : TauRecToolBase(name) { + //if TauTrackClassifier is not run, wide&passTrkSelector==classifiedIsolation==modifiedIsolationTrack + declareProperty("isolationTrackType", m_isolationTrackType=xAOD::TauJetParameters::modifiedIsolationTrack); } //----------------------------------------------------------------------------- @@ -87,7 +89,7 @@ StatusCode TauCommonCalcVars::execute(xAOD::TauJet& pTau) { // invariant mass of track system std::vector<const xAOD::TauTrack*> tauTracks = pTau.tracks(xAOD::TauJetParameters::TauTrackFlag::classifiedCharged); - for( const xAOD::TauTrack* trk : pTau.tracks((xAOD::TauJetParameters::TauTrackFlag) m_isolationTrackType.value()) ) tauTracks.push_back(trk); + for( const xAOD::TauTrack* trk : pTau.tracks((xAOD::TauJetParameters::TauTrackFlag) m_isolationTrackType) ) tauTracks.push_back(trk); if (tauTracks.size()> 0) { TLorentzVector sumOfTrackVector; diff --git a/Reconstruction/tauRecTools/Root/TauEleOLRDecorator.cxx b/Reconstruction/tauRecTools/Root/TauEleOLRDecorator.cxx index 33811dedabe9e95b515e587c3c163fbc8463f0b9..8add49ef121c27474f47814ec9dd483c61fd1549 100644 --- a/Reconstruction/tauRecTools/Root/TauEleOLRDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/TauEleOLRDecorator.cxx @@ -9,18 +9,17 @@ * Modified: Lorenz Hauswald */ -#include "GaudiKernel/SystemOfUnits.h" - #include "tauRecTools/TauEleOLRDecorator.h" #include "ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h" #include "TFile.h" -using Gaudi::Units::GeV; +#define GeV 1000 TauEleOLRDecorator::TauEleOLRDecorator(const std::string& name): TauRecToolBase(name), m_tEMLHTool(nullptr), m_hCutValues(nullptr){ + declareProperty("EleOLRFile", m_sEleOLRFilePath = ""); } TauEleOLRDecorator::~TauEleOLRDecorator(){ diff --git a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx index 9b681c2e9457519b336a0a71a487250bbaf50bb9..de9c8deaabf552a4c0b43f02e608d1da7b356451 100644 --- a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx +++ b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx @@ -8,8 +8,6 @@ * Author: Lorenz Hauswald */ -#include "GaudiKernel/SystemOfUnits.h" - #include "tauRecTools/HelperFunctions.h" #include "tauRecTools/TauIDVarCalculator.h" #include "xAODTracking/VertexContainer.h" @@ -17,7 +15,7 @@ #include "FourMomUtils/xAODP4Helpers.h" #include "TLorentzVector.h" -using Gaudi::Units::GeV; +#define GeV 1000 const float TauIDVarCalculator::LOW_NUMBER = -1111.; TauIDVarCalculator::TauIDVarCalculator(const std::string& name): diff --git a/Reconstruction/tauRecTools/Root/TauJetBDTEvaluator.cxx b/Reconstruction/tauRecTools/Root/TauJetBDTEvaluator.cxx index 7a1df6ddc392306a44bc0b3d20132a7198dfd700..d1bf07dc4a10eb3234e7713e4052fbaef2d3a9ce 100644 --- a/Reconstruction/tauRecTools/Root/TauJetBDTEvaluator.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetBDTEvaluator.cxx @@ -6,8 +6,14 @@ TauJetBDTEvaluator::TauJetBDTEvaluator(const std::string& name) : TauRecToolBase(name) - , m_mvaBDT(nullptr) -{ + , m_mvaBDT(nullptr) { + declareProperty("weightsFile", m_weightsFile=""); + declareProperty("minNTracks", m_minNTracks=0); + declareProperty("maxNTracks", m_maxNTracks=999); + declareProperty("minAbsTrackEta", m_minAbsTrackEta=-1); + declareProperty("maxAbsTrackEta", m_maxAbsTrackEta=-1); + declareProperty("outputVarName", m_outputVarName="BDTJetScore"); + declareProperty("defaultValue", m_dummyValue=-1111, "if no weightsFile, then set all taus to this value nTrack/eta ignored"); } //________________________________________ diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx index 9a64dd3ea31d320760593aa030868b1d03f73c0b..7479447354c58b22655bc01dd6bee28ac200af1c 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx @@ -15,6 +15,23 @@ TauJetRNNEvaluator::TauJetRNNEvaluator(const std::string &name): m_net_0p(nullptr), m_net_1p(nullptr), m_net_3p(nullptr){ + + declareProperty("NetworkFile0P", m_weightfile_0p = ""); + declareProperty("NetworkFile1P", m_weightfile_1p = ""); + declareProperty("NetworkFile3P", m_weightfile_3p = ""); + declareProperty("OutputVarname", m_output_varname = "RNNJetScore"); + declareProperty("MaxTracks", m_max_tracks = 10); + declareProperty("MaxClusters", m_max_clusters = 6); + declareProperty("MaxClusterDR", m_max_cluster_dr = 1.0f); + + // Naming conventions for the network weight files: + declareProperty("InputLayerScalar", m_input_layer_scalar = "scalar"); + declareProperty("InputLayerTracks", m_input_layer_tracks = "tracks"); + declareProperty("InputLayerClusters", m_input_layer_clusters = "clusters"); + declareProperty("OutputLayer", m_output_layer = "rnnid_output"); + declareProperty("OutputNode", m_output_node = "sig_prob"); + + declareProperty("IncShowerSubtr", m_incShowerSubtr = true, "use shower subtracted clusters in calo calculations"); } TauJetRNNEvaluator::~TauJetRNNEvaluator() {} diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx index cc1ab948b30aff6de8239b283b6e5c7964d80914..3d24d3e2bcc6fe07f464f5e177d51f5a35d2ac5d 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx @@ -2,11 +2,9 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/SystemOfUnits.h" - #include "tauRecTools/TauJetRNNUtils.h" -using Gaudi::Units::GeV; +#define GeV 1000 namespace TauJetRNNUtils { diff --git a/Reconstruction/tauRecTools/Root/TauPi0ScoreCalculator.cxx b/Reconstruction/tauRecTools/Root/TauPi0ScoreCalculator.cxx index 8ff75ae6c0c93f0acf4492f4d0a69604e9f233f7..457eb95138c8253b21082c34acc6491699cb95c3 100644 --- a/Reconstruction/tauRecTools/Root/TauPi0ScoreCalculator.cxx +++ b/Reconstruction/tauRecTools/Root/TauPi0ScoreCalculator.cxx @@ -25,7 +25,9 @@ using std::string; TauPi0ScoreCalculator::TauPi0ScoreCalculator( const string& name ) : TauRecToolBase(name), - m_mvaBDT(nullptr) { + m_mvaBDT(nullptr) +{ + declareProperty("BDTWeightFile", m_weightfile); } //------------------------------------------------------------------------- diff --git a/Reconstruction/tauRecTools/Root/TauPi0Selector.cxx b/Reconstruction/tauRecTools/Root/TauPi0Selector.cxx index d0bf1614a804a7e5077d2baaf5c28297afc205e7..c3071d1ef869dc1f0d58307140cf7727f0d64a27 100644 --- a/Reconstruction/tauRecTools/Root/TauPi0Selector.cxx +++ b/Reconstruction/tauRecTools/Root/TauPi0Selector.cxx @@ -19,7 +19,11 @@ using std::string; //------------------------------------------------------------------------- TauPi0Selector::TauPi0Selector( const string& name ) : - TauRecToolBase(name) { + TauRecToolBase(name) +{ + declareProperty("ClusterEtCut", m_clusterEtCut); + declareProperty("ClusterBDTCut_1prong", m_clusterBDTCut_1prong); + declareProperty("ClusterBDTCut_mprong", m_clusterBDTCut_mprong); } //------------------------------------------------------------------------- @@ -64,11 +68,6 @@ StatusCode TauPi0Selector::executePi0nPFO(xAOD::TauJet& pTau, xAOD::PFOContainer // Pi0NeutralPFOs //--------------------------------------------------------------------- int nRecoPi0s=0; - - const std::vector<float>& clusterEtCut = m_clusterEtCut.value(); - const std::vector<float>& clusterBDTCut_1prong = m_clusterBDTCut_1prong.value(); - const std::vector<float>& clusterBDTCut_mprong = m_clusterBDTCut_mprong.value(); - for( auto neutralPFO : neutralPFOContainer ) { // Set number of pi0s to 0 for all neutral PFOs. Required when rerunning on xAOD level @@ -78,17 +77,17 @@ StatusCode TauPi0Selector::executePi0nPFO(xAOD::TauJet& pTau, xAOD::PFOContainer int etaBin = getPi0Cluster_etaBin( neutralPFO->cluster(0)->eta() ); // Preselection - if(neutralPFO->p4().Et() < clusterEtCut.at(etaBin)) continue; + if(neutralPFO->p4().Et() < m_clusterEtCut.at(etaBin)) continue; if(pTau.p4().DeltaR(neutralPFO->p4()) > 0.2) continue; // TODO: Replace by shrinking cone? // BDT Selection float BDTScore = neutralPFO->bdtPi0Score(); ATH_MSG_DEBUG("etaBin = " << etaBin - << ", clusterEtCut.at(etaBin) = " <<clusterEtCut.at(etaBin) - << ", clusterBDTCut_1prong.at(etaBin) = " << clusterBDTCut_1prong.at(etaBin) - << ", clusterBDTCut_mprong.at(etaBin) = " << clusterBDTCut_mprong.at(etaBin)); - if( (pTau.nTracks()==1 && BDTScore < clusterBDTCut_1prong.at(etaBin)) - || (pTau.nTracks()>1 && BDTScore < clusterBDTCut_mprong.at(etaBin)) ) continue; + << ", m_clusterEtCut.at(etaBin) = " <<m_clusterEtCut.at(etaBin) + << ", m_clusterBDTCut_1prong.at(etaBin) = " << m_clusterBDTCut_1prong.at(etaBin) + << ", m_clusterBDTCut_mprong.at(etaBin) = " << m_clusterBDTCut_mprong.at(etaBin)); + if( (pTau.nTracks()==1 && BDTScore < m_clusterBDTCut_1prong.at(etaBin)) + || (pTau.nTracks()>1 && BDTScore < m_clusterBDTCut_mprong.at(etaBin)) ) continue; // Set number of pi0s int nHitsInEM1 = 0; diff --git a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx index 0f425d08ee78b78069b321c42ffc01964aa65877..e7017156772b598e98b57d3bc4a2b2c657fdc1d0 100644 --- a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx +++ b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx @@ -158,10 +158,12 @@ StatusCode TauRecToolBase::executeShotFinder(xAOD::TauJet& /*pTau*/, xAOD::CaloC return StatusCode::FAILURE; } +#ifndef XAOD_ANALYSIS StatusCode TauRecToolBase::executePi0CreateROI(xAOD::TauJet& /*pTau*/, CaloCellContainer& /*caloCellContainer*/, std::vector<CaloCell*>& /*map*/ ) { ATH_MSG_ERROR("function not implemented"); return StatusCode::FAILURE; } +#endif StatusCode TauRecToolBase::executePi0ClusterCreator(xAOD::TauJet& /*pTau*/, xAOD::PFOContainer& /*neutralPFOContainer*/, xAOD::PFOContainer& /*hadronicPFOContainer*/, diff --git a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx index 09d7f52d13b23482a24032c3845c9dbae0b2c2dd..17bfc4df285418953777b4f82b1ff76b2b499dc1 100644 --- a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx +++ b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx @@ -21,15 +21,18 @@ #include "tauRecTools/KineUtils.h" - +#define GeV 1000 const double TauSubstructureVariables::DEFAULT = -1111.; //********************************** // Constructor //********************************** -TauSubstructureVariables::TauSubstructureVariables( const std::string& name ) : - TauRecToolBase(name) { +TauSubstructureVariables::TauSubstructureVariables( const std::string& name ) + : TauRecToolBase(name) { + declareProperty("maxPileUpCorrection", m_maxPileUpCorrection = 4 * GeV); + declareProperty("pileUpAlpha", m_pileUpAlpha = 1.0); + declareProperty("VertexCorrection", m_doVertexCorrection = false); } diff --git a/Reconstruction/tauRecTools/Root/TauWPDecorator.cxx b/Reconstruction/tauRecTools/Root/TauWPDecorator.cxx index 0db39ce22f9dfdeb42c200956ee3406c0b2d9584..138ecbac632dbf568508d28b7eaa6e6a061d0293 100644 --- a/Reconstruction/tauRecTools/Root/TauWPDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/TauWPDecorator.cxx @@ -11,7 +11,27 @@ /********************************************************************/ TauWPDecorator::TauWPDecorator(const std::string& name) : - TauRecToolBase(name) { + TauRecToolBase(name) +{ + declareProperty("flatteningFile0Prong", m_file0P); + declareProperty("flatteningFile1Prong", m_file1P); + declareProperty("flatteningFile3Prong", m_file3P); + + declareProperty("ScoreName", m_scoreName = "BDTJetScore"); + declareProperty("NewScoreName", m_newScoreName = "BDTJetScoreSigTrans"); + + declareProperty("DefineWPs", m_defineWP=false); + declareProperty("UseEleBDT", m_electronMode=false); + + declareProperty("CutEnumVals", m_cut_bits); + declareProperty("SigEff0P", m_cut_effs_0p); + declareProperty("SigEff1P", m_cut_effs_1p); + declareProperty("SigEff3P", m_cut_effs_3p); + + declareProperty("DecorWPNames", m_decoration_names); + declareProperty("DecorWPCutEffs0P", m_cut_effs_decoration_0p); + declareProperty("DecorWPCutEffs1P", m_cut_effs_decoration_1p); + declareProperty("DecorWPCutEffs3P", m_cut_effs_decoration_3p); } /********************************************************************/ diff --git a/Reconstruction/tauRecTools/src/TauVertexFinder.cxx b/Reconstruction/tauRecTools/src/TauVertexFinder.cxx index d3869a9dc67cb704c73d58a298733eb82f9ffa9b..e50ff0a9793e261afd29a5cdf94dc0b986d1c08b 100644 --- a/Reconstruction/tauRecTools/src/TauVertexFinder.cxx +++ b/Reconstruction/tauRecTools/src/TauVertexFinder.cxx @@ -43,7 +43,7 @@ StatusCode TauVertexFinder::finalize() { // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * StatusCode TauVertexFinder::executeVertexFinder(xAOD::TauJet& pTau, const xAOD::VertexContainer* vertexContainer, - const xAOD::TrackParticleContainer* trackContainer) { + const xAOD::TrackParticleContainer* trackContainer) const { const xAOD::VertexContainer * vxContainer = 0; @@ -117,13 +117,13 @@ ElementLink<xAOD::VertexContainer> TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau, const xAOD::VertexContainer& vertices, const xAOD::TrackParticleContainer * trackContainer, - float& maxJVF) + float& maxJVF) const { const xAOD::Jet* pJetSeed = (*pTau.jetLink()); std::vector<const xAOD::TrackParticle*> tracksForTJVA; const double dDeltaRMax(0.2); - m_matchedVertexOnline.clear(); + std::vector<const xAOD::Vertex*> matchedVertexOnline; // the implementation follows closely the example given in modifyJet(...) in https://svnweb.cern.ch/trac/atlasoff/browser/Reconstruction/Jet/JetMomentTools/trunk/Root/JetVertexFractionTool.cxx#15 const xAOD::TrackParticleContainer* trackParticleCont = 0; @@ -180,7 +180,7 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau, ATH_MSG_DEBUG("Creating online TJVA"); ATH_MSG_DEBUG("Building online track-vertex association trk size="<< tracksForTJVA.size() << " vtx size="<< vertices.size()); - m_matchedVertexOnline.resize(tracksForTJVA.size(), 0 ); + matchedVertexOnline.resize(tracksForTJVA.size(), 0 ); for (size_t iTrack = 0; iTrack < tracksForTJVA.size(); ++iTrack) { @@ -221,7 +221,7 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau, // If we matched a vertex, then associate that vertex to the track if (foundMatch) - m_matchedVertexOnline[ iTrack ] = vertices.at(matchedIndex); + matchedVertexOnline[ iTrack ] = vertices.at(matchedIndex); } } else { @@ -243,7 +243,7 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau, for (const xAOD::Vertex* vert : vertices) { float jvf = 0; if(!inTrigger()) jvf = getJetVertexFraction(vert,tracksForTJVA,tva); - else jvf = getJetVertexFraction(vert,tracksForTJVA); + else jvf = getJetVertexFraction(vert,tracksForTJVA,matchedVertexOnline); if (jvf > maxJVF) { maxJVF = jvf; max_vert = vert; @@ -278,13 +278,15 @@ float TauVertexFinder::getJetVertexFraction(const xAOD::Vertex* vertex, const st return sumTrackAll!=0 ? sumTrackPV/sumTrackAll : 0; } // for online ATR-15665: reimplementation needed for online because the tva doesn't work. The size of the track collection from TE is not the same as the max track index -float TauVertexFinder::getJetVertexFraction(const xAOD::Vertex* vertex, const std::vector<const xAOD::TrackParticle*>& tracks) const +float TauVertexFinder::getJetVertexFraction(const xAOD::Vertex* vertex, + const std::vector<const xAOD::TrackParticle*>& tracks, + const std::vector<const xAOD::Vertex*>& matchedVertexOnline) const { float sumTrackPV = 0; float sumTrackAll = 0; for (size_t iTrack = 0; iTrack < tracks.size(); ++iTrack) { - const xAOD::Vertex* ptvtx = m_matchedVertexOnline[iTrack]; + const xAOD::Vertex* ptvtx = matchedVertexOnline[iTrack]; if (ptvtx != nullptr) { // C++11 feature if (ptvtx->index() == vertex->index()) sumTrackPV += tracks.at(iTrack)->pt(); } diff --git a/Reconstruction/tauRecTools/src/TauVertexFinder.h b/Reconstruction/tauRecTools/src/TauVertexFinder.h index 2e773c2fcd2026d5c35fed04573c548ac46b4ff9..3243fece37aa8ee7e1372c17377ef553f5b49dc1 100644 --- a/Reconstruction/tauRecTools/src/TauVertexFinder.h +++ b/Reconstruction/tauRecTools/src/TauVertexFinder.h @@ -39,22 +39,32 @@ public: //------------------------------------------------------------- //! Algorithm functions //------------------------------------------------------------- - virtual StatusCode initialize() override; - virtual StatusCode executeVertexFinder(xAOD::TauJet& pTau, - const xAOD::VertexContainer* vertexContainer = nullptr, - const xAOD::TrackParticleContainer* trackContainer = nullptr) override; - virtual StatusCode finalize() override; + StatusCode initialize() override; + StatusCode executeVertexFinder(xAOD::TauJet& pTau, + const xAOD::VertexContainer* vertexContainer = nullptr, + const xAOD::TrackParticleContainer* trackContainer = nullptr) override + { + return static_cast<const TauVertexFinder*>(this)->executeVertexFinder(pTau, vertexContainer, trackContainer); + } + + StatusCode executeVertexFinder(xAOD::TauJet& pTau, + const xAOD::VertexContainer* vertexContainer = nullptr, + const xAOD::TrackParticleContainer* trackContainer = nullptr) const; + + StatusCode finalize() override; private: ElementLink<xAOD::VertexContainer> getPV_TJVA(const xAOD::TauJet& tauJet, const xAOD::VertexContainer& vertices, const xAOD::TrackParticleContainer* trackContainer, - float& maxJVF); + float& maxJVF) const; float getJetVertexFraction(const xAOD::Vertex* vertex, const std::vector<const xAOD::TrackParticle*>& tracks, const jet::TrackVertexAssociation* tva) const; // for online ATR-15665 - float getJetVertexFraction(const xAOD::Vertex* vertex, const std::vector<const xAOD::TrackParticle*>& tracks) const; + float getJetVertexFraction(const xAOD::Vertex* vertex, + const std::vector<const xAOD::TrackParticle*>& tracks, + const std::vector<const xAOD::Vertex*>& matchedVertexOnline) const; private: @@ -69,9 +79,6 @@ private: SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer{this,"Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackPartInputContainer{this,"Key_trackPartInputContainer", "InDetTrackParticles", "input track particle container key"}; SG::ReadHandleKey<jet::TrackVertexAssociation> m_jetTrackVtxAssoc{this, "Key_JetTrackVtxAssoc_forTaus", "JetTrackVtxAssoc_forTaus", "input TVA for taus"}; - - std::vector<const xAOD::Vertex*> m_matchedVertexOnline; - }; #endif // not TAUREC_TAUVERTEXFINDER_H diff --git a/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h b/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h index f15dd6b69b8d4ae8243a1f3a5fe907af97d8d62b..8ae83f9fa25a4432b7f425df966704000e8fc742 100644 --- a/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h +++ b/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h @@ -116,10 +116,10 @@ private: /// size of m_modeNames std::vector<std::unique_ptr<TH1F>> m_correlationHists; - Gaudi::Property<bool> m_addCalibrationResultVariables{this, "addCalibrationResultVariables", false}; - Gaudi::Property<bool> m_addUseCaloPtFlag{this, "addUseCaloPtFlag", false}; - - Gaudi::Property<std::string> m_sWeightFileName{this, "WeightFileName", ""}; + bool m_addCalibrationResultVariables; + bool m_addUseCaloPtFlag; + std::string m_sWeightFileName; + std::unique_ptr<TF1> m_Nsigma_compatibility; }; diff --git a/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h b/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h index 9d1cb94426765de9236c12549e36fac5b47e16c1..d394f7c7b9715ec537ac36548a2e53c60519fe05 100644 --- a/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h +++ b/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h @@ -6,6 +6,7 @@ #define TAURECTOOLS_HELPERFUNCTIONS_H #include "MVAUtils/BDT.h" +#include "AsgMessaging/MessageCheck.h" #include <vector> #include <map> @@ -19,6 +20,7 @@ namespace tauRecTools { + ANA_MSG_HEADER(msgHelperFunction) const StatusCode GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool incShowerSubtracted); diff --git a/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h b/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h index 6a98cf7d0451d2d761c837bab113ac7133a91ee1..410e566330773aa300b72e9d4a5769e4850bfbb1 100644 --- a/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h +++ b/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h @@ -48,7 +48,9 @@ class ITauToolBase : virtual public asg::IAsgTool const xAOD::TrackParticleContainer* trackContainer = nullptr) = 0; virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, const xAOD::TrackParticleContainer* trackContainer = nullptr) = 0; virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) = 0; +#ifndef XAOD_ANALYSIS virtual StatusCode executePi0CreateROI(xAOD::TauJet& pTau, CaloCellContainer& caloCellContainer, std::vector<CaloCell*>& map ) = 0; +#endif virtual StatusCode executePi0ClusterCreator(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicPFOContainer, xAOD::CaloClusterContainer& caloClusterContainer, diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h index c25972d59895865360f629c0174f2d20a4c8c361..53b1f570d2a52b001e1b70741d66e9fe3a610872 100644 --- a/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h +++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h @@ -70,7 +70,7 @@ class MvaTESEvaluator std::unique_ptr<tauRecTools::BDTHelper> m_bdtHelper; // Configurable properties - Gaudi::Property<std::string> m_sWeightFileName{this, "WeightFileName", "MvaTES_20170207_v2_BDTG.weights.root"}; + std::string m_sWeightFileName; }; #endif // TAURECTOOLSDEV_MVATESEVALUATOR_H diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h index cbc3f6065f8670c3c61d791d01bd6a703e3fd828..ca098a1ff7f4092d55fb8c3e053a1192bc19d3f2 100644 --- a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h @@ -30,8 +30,7 @@ class MvaTESVariableDecorator SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"Key_eventInfo", "EventInfo", "EventInfo key"}; SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer{this,"Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; - Gaudi::Property<bool> m_incShowerSubtr {this, "IncShowerSubtr", true, "use shower subtracted clusters in calo calculations"}; - + bool m_incShowerSubtr; }; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h index 38b690bbc4902e9319ebf103e7a0ed776e84e553..a83f74e81f68bf68eab904e2d38f9c934632400a 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h @@ -6,7 +6,6 @@ #define TAUREC_TAUCALIBRATELC_H #include "tauRecTools/TauRecToolBase.h" -#include "GaudiKernel/ToolHandle.h" #include "xAODEventInfo/EventInfo.h" class TH1; @@ -36,8 +35,6 @@ public: private: - Gaudi::Property<std::string> m_calibrationFile {this, "calibrationFile", "EnergyCalibrationLC2012.root", "energy calibration file"}; - static const int s_nProngBins = 2; std::vector<std::vector<std::unique_ptr<TF1>>> m_calibFunc; @@ -49,12 +46,13 @@ private: int m_nEtaBins=0; double m_averageNPV=0; - Gaudi::Property<bool> m_doEnergyCorr {this, "doEnergyCorrection", false, "switch for energy correction"}; - Gaudi::Property<bool> m_doPtResponse {this, "doPtResponse", false, "switch for pt response vs pt, if false, use E response vs E"}; - Gaudi::Property<bool> m_countOnlyPileupVertices {this, "countOnlyPileupVertices", false, "switch for counting vertices by nTracks or VxType::PileUp"}; - Gaudi::Property<bool> m_doAxisCorr {this, "doAxisCorrection", false, "switch for eta correction"}; - Gaudi::Property<bool> m_usePantauAxis {this, "usePantauAxis", false, "switch for overwriting calo (eta,phi) with Pantau (eta,phi)"}; - Gaudi::Property<bool> m_isCaloOnly {this, "isCaloOnly", false, "switch for CaloOnly corrections"}; + std::string m_calibrationFile; //!< energy calibration file + bool m_doEnergyCorr; //!< switch for energy correction + bool m_doPtResponse; //!< switch for pt response vs pt, if false, use E response vs E + bool m_countOnlyPileupVertices; //!< switch for counting vertices by nTracks or VxType::PileUp + bool m_doAxisCorr; //!< switch for eta correction + bool m_usePantauAxis; //!< switch for overwriting calo (eta,phi) with Pantau (eta,phi) + bool m_isCaloOnly; //!< switch for CaloOnly corrections SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this,"Key_eventInfo", "EventInfo", "EventInfo key"}; SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer{this,"Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauCommonCalcVars.h b/Reconstruction/tauRecTools/tauRecTools/TauCommonCalcVars.h index c6fdb309df615a40259fd3aa91ac18ccc7014c91..ce0f24bfc4f170bdcbb413a3c2fdaa23a620bb6a 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauCommonCalcVars.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauCommonCalcVars.h @@ -31,9 +31,7 @@ public: virtual StatusCode finalize() override; private: - - //if TauTrackClassifier is not run, wide&passTrkSelector==classifiedIsolation==modifiedIsolationTrack - Gaudi::Property<int> m_isolationTrackType {this, "isolationTrackType", xAOD::TauJetParameters::modifiedIsolationTrack}; + int m_isolationTrackType; }; #endif // TAUREC_TAUCOMMONCALCVARS_H diff --git a/Reconstruction/tauRecTools/tauRecTools/TauEleOLRDecorator.h b/Reconstruction/tauRecTools/tauRecTools/TauEleOLRDecorator.h index 0b9d72c8af6739e5401c148896ffa014643272ce..0ee9de03dfbcc3dd9abd883b6bf6fa30473770e3 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauEleOLRDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauEleOLRDecorator.h @@ -35,10 +35,10 @@ class TauEleOLRDecorator: virtual public TauRecToolBase private: float getCutVal(float fEta, float fPt); - + + std::string m_sEleOLRFilePath; SG::ReadHandleKey<xAOD::ElectronContainer> m_electronInputContainer{this,"Key_electronInputContainer", "Electrons", "input electron container key"}; std::unique_ptr<AsgElectronLikelihoodTool> m_tEMLHTool; - Gaudi::Property<std::string> m_sEleOLRFilePath {this, "EleOLRFile", "eveto_cutvals.root"}; std::unique_ptr<TH2F> m_hCutValues; }; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h b/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h index 67ab21b8a0842ef7802c20589b2cdbeddc8946c3..c4624608a57ae10dbfcb38e72aa942bf15d77583 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h @@ -37,7 +37,7 @@ class TauIDVarCalculator: public TauRecToolBase SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer{this,"Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; - Gaudi::Property<bool> m_incShowerSubtr {this, "IncShowerSubtr", true, "use shower subtracted clusters in calo calculations"}; + bool m_incShowerSubtr; }; #endif diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetBDTEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/TauJetBDTEvaluator.h index 95a5d9a231e8d23702bd1b1ad06e7791ee145bff..2dfd4c945a15ee341547532e1ba4ef1889d8439b 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetBDTEvaluator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetBDTEvaluator.h @@ -36,15 +36,13 @@ class TauJetBDTEvaluator StatusCode finalize() override; private: - - Gaudi::Property<std::string> m_weightsFile{this, "weightsFile", ""}; - Gaudi::Property<std::string> m_outputVarName{this, "outputVarName", "BDTJetScore"}; - std::unique_ptr<tauRecTools::BDTHelper> m_mvaBDT; - Gaudi::Property<int> m_minNTracks{this, "minNTracks", 0}; - Gaudi::Property<int> m_maxNTracks{this, "maxNTracks", 999}; - Gaudi::Property<float> m_minAbsTrackEta{this, "minAbsTrackEta", -1}; - Gaudi::Property<float> m_maxAbsTrackEta{this, "maxAbsTrackEta", -1}; - Gaudi::Property<float> m_dummyValue{this, "defaultValue", -1111, "if no weightsFile, then set all taus to this value nTrack/eta ignored"}; + std::string m_weightsFile; + std::string m_outputVarName; + int m_minNTracks; + int m_maxNTracks; + float m_minAbsTrackEta; + float m_maxAbsTrackEta; + float m_dummyValue; }; #endif diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h index 0d9a00e6c3c31acc32d429cff06f54303cf235a9..66125f8f0b523fc58a3db185ebc987adb368f9ff 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h @@ -49,29 +49,27 @@ private: std::vector<const xAOD::CaloCluster *> &out); private: - Gaudi::Property<std::string> m_output_varname {this, "OutputVarname", "RNNJetScore"}; - // Network weight files for 0-, 1- and 3-prong taus - // If the filename is an empty string a default value is decorated - Gaudi::Property<std::string> m_weightfile_0p {this, "NetworkFile0P", ""}; - Gaudi::Property<std::string> m_weightfile_1p {this, "NetworkFile1P", ""}; - Gaudi::Property<std::string> m_weightfile_3p {this, "NetworkFile3P", ""}; - Gaudi::Property<std::size_t> m_max_tracks {this, "MaxTracks", 10}; - Gaudi::Property<std::size_t> m_max_clusters {this, "MaxClusters", 6}; - Gaudi::Property<float> m_max_cluster_dr {this, "MaxClusterDR", 1.0f}; + std::string m_output_varname; + std::string m_weightfile_0p; + std::string m_weightfile_1p; + std::string m_weightfile_3p; + std::size_t m_max_tracks; + std::size_t m_max_clusters; + float m_max_cluster_dr; // Configuration of the weight file - Gaudi::Property<std::string> m_input_layer_scalar {this, "InputLayerScalar", "scalar"}; - Gaudi::Property<std::string> m_input_layer_tracks {this, "InputLayerTracks", "tracks"}; - Gaudi::Property<std::string> m_input_layer_clusters {this, "InputLayerClusters", "clusters"}; - Gaudi::Property<std::string> m_output_layer {this, "OutputLayer", "rnnid_output"}; - Gaudi::Property<std::string> m_output_node {this, "OutputNode", "sig_prob"}; - - Gaudi::Property<bool> m_incShowerSubtr {this, "IncShowerSubtr", true, "use shower subtracted clusters in calo calculations"}; + std::string m_input_layer_scalar; + std::string m_input_layer_tracks; + std::string m_input_layer_clusters; + std::string m_output_layer; + std::string m_output_node; // Wrappers for lwtnn std::unique_ptr<TauJetRNN> m_net_0p; //! std::unique_ptr<TauJetRNN> m_net_1p; //! std::unique_ptr<TauJetRNN> m_net_3p; //! + + bool m_incShowerSubtr; }; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauPi0ScoreCalculator.h b/Reconstruction/tauRecTools/tauRecTools/TauPi0ScoreCalculator.h index e43bb319459efb89d2231e5a648dd3e3e48deb87..8c01d0aac55090cef1c568c89a9a4174c37f2be4 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauPi0ScoreCalculator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauPi0ScoreCalculator.h @@ -33,8 +33,8 @@ public: private: /** @brief function used to calculate BDT score */ float calculateScore(const xAOD::PFO* neutralPFO); - - Gaudi::Property<std::string> m_weightfile {this, "BDTWeightFile"}; + + std::string m_weightfile; std::unique_ptr<tauRecTools::BDTHelper> m_mvaBDT; }; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauPi0Selector.h b/Reconstruction/tauRecTools/tauRecTools/TauPi0Selector.h index fb4f9c651c6d2e5da9947a50c4bffa6fd84902e1..0e9c5f724768c5f8d6bb9c828078ba37ef2a220a 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauPi0Selector.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauPi0Selector.h @@ -27,9 +27,9 @@ public: private: - Gaudi::Property<std::vector<float>> m_clusterEtCut {this, "ClusterEtCut"}; - Gaudi::Property<std::vector<float>> m_clusterBDTCut_1prong {this, "ClusterBDTCut_1prong"}; - Gaudi::Property<std::vector<float>> m_clusterBDTCut_mprong {this, "ClusterBDTCut_mprong"}; + std::vector<float> m_clusterEtCut; + std::vector<float> m_clusterBDTCut_1prong; + std::vector<float> m_clusterBDTCut_mprong; /** @brief function used to get eta bin of Pi0Cluster */ int getPi0Cluster_etaBin(double Pi0Cluster_eta); /** @brief function used to calculate the visible tau 4 momentum */ diff --git a/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h b/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h index 3edc81f1ff59805615618866eb1497f355ce8879..0e7657c42d2985c318b8eb068a2f9811239ea4c0 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h @@ -45,7 +45,9 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase { const xAOD::TrackParticleContainer* trackContainer = nullptr) override; virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, const xAOD::TrackParticleContainer* trackContainer = nullptr) override; virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) override; +#ifndef XAOD_ANALYSIS virtual StatusCode executePi0CreateROI(xAOD::TauJet& pTau, CaloCellContainer& caloCellContainer, std::vector<CaloCell*>& map ) override; +#endif virtual StatusCode executePi0ClusterCreator(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicPFOContainer, xAOD::CaloClusterContainer& caloClusterContainer, diff --git a/Reconstruction/tauRecTools/tauRecTools/TauSubstructureVariables.h b/Reconstruction/tauRecTools/tauRecTools/TauSubstructureVariables.h index b82f247ab1a282486dcecb37fedfa2297e0b5228..a6038c22f3e4fb428f5e84a0bb09e9cf0df59616 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauSubstructureVariables.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauSubstructureVariables.h @@ -7,8 +7,6 @@ #include "tauRecTools/TauRecToolBase.h" -#include "GaudiKernel/SystemOfUnits.h" - /** * @brief Calculate variables from the tau substructure. * @@ -36,14 +34,14 @@ class TauSubstructureVariables : public TauRecToolBase /** Maximal pile up correction in GeV for a tau candidate. * Used for the caloIso corrected variable. */ - Gaudi::Property<double> m_maxPileUpCorrection {this, "maxPileUpCorrection", 4 * Gaudi::Units::GeV }; - Gaudi::Property<double> m_pileUpAlpha {this, "pileUpAlpha", 1.0}; //!< slope of the pileup correction + double m_maxPileUpCorrection; + double m_pileUpAlpha; //!< slope of the pileup correction /** * enable cell origin correction * eta and phi of the cells are corrected wrt to the origin of the tau vertex */ - Gaudi::Property<bool> m_doVertexCorrection {this, "VertexCorrection", false}; + bool m_doVertexCorrection; }; #endif diff --git a/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h b/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h index 07c32c301c0108b75be9adf66487540b92d37b84..b8524ccfc0a29e372d0efa496efded0bebe43ee5 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h @@ -41,10 +41,9 @@ public: virtual double transformScore(double score, double cut_lo, double eff_lo, double cut_hi, double eff_hi); private: - - Gaudi::Property<std::string> m_file0P {this, "flatteningFile0Prong"}; - Gaudi::Property<std::string> m_file1P {this, "flatteningFile1Prong"}; - Gaudi::Property<std::string> m_file3P {this, "flatteningFile3Prong"}; + std::string m_file0P; + std::string m_file1P; + std::string m_file3P; typedef std::pair<double, std::unique_ptr<TH2> > m_pair_t; @@ -58,21 +57,21 @@ private: std::map<int, double> m_xmax; std::map<int, double> m_ymax; - Gaudi::Property<bool> m_defineWP {this, "DefineWPs", false}; - Gaudi::Property<bool> m_electronMode {this, "UseEleBDT", false}; + bool m_defineWP; + bool m_electronMode; - Gaudi::Property<std::vector<int>> m_cut_bits {this, "CutEnumVals"}; - Gaudi::Property<std::vector<float>> m_cut_effs_0p {this, "SigEff0P"}; - Gaudi::Property<std::vector<float>> m_cut_effs_1p {this, "SigEff1P"}; - Gaudi::Property<std::vector<float>> m_cut_effs_3p {this, "SigEff3P"}; + std::vector<int> m_cut_bits; + std::vector<float> m_cut_effs_0p; + std::vector<float> m_cut_effs_1p; + std::vector<float> m_cut_effs_3p; - Gaudi::Property<std::vector<std::string>> m_decoration_names {this, "DecorWPNames"}; - Gaudi::Property<std::vector<float>> m_cut_effs_decoration_0p {this, "DecorWPCutEffs0P"}; - Gaudi::Property<std::vector<float>> m_cut_effs_decoration_1p {this, "DecorWPCutEffs1P"}; - Gaudi::Property<std::vector<float>> m_cut_effs_decoration_3p {this, "DecorWPCutEffs3P"}; + std::vector<std::string> m_decoration_names; + std::vector<float> m_cut_effs_decoration_0p; + std::vector<float> m_cut_effs_decoration_1p; + std::vector<float> m_cut_effs_decoration_3p; - Gaudi::Property<std::string> m_scoreName {this, "ScoreName", "BDTJetScore"}; - Gaudi::Property<std::string> m_newScoreName {this, "NewScoreName", "BDTJetScoreSigTrans"}; + std::string m_scoreName; + std::string m_newScoreName; SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"Key_eventInfo", "EventInfo", "EventInfo key"}; }; diff --git a/Simulation/FastShower/FastCaloSim/CMakeLists.txt b/Simulation/FastShower/FastCaloSim/CMakeLists.txt index 916d464d5ca11f82a95c169dd9d435c1c2c65a7e..85e00e690e429eb1271c48566bf47ae9ed0aa0c3 100644 --- a/Simulation/FastShower/FastCaloSim/CMakeLists.txt +++ b/Simulation/FastShower/FastCaloSim/CMakeLists.txt @@ -79,14 +79,14 @@ atlas_add_library( FastCaloSimLib ${FastCaloSimLibDictSource} PUBLIC_HEADERS FastCaloSim INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} CaloEvent CaloIdentifier AthenaBaseComps AthenaKernel Identifier GaudiKernel LArRecEvent TileEvent TrkEventPrimitives TrkParameters TrkExInterfaces CaloDetDescrLib StoreGateLib SGtests PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthAllocators AthenaPoolUtilities AtlasDetDescr GeoPrimitives EventKernel NavFourMom GeneratorObjects TruthUtils FastCaloSimAthenaPool PathResolver TrkGeometry TrkSurfaces TrkMaterialOnTrack ) atlas_add_component( FastCaloSim src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} CaloDetDescrLib CaloEvent CaloIdentifier AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier GaudiKernel LArRecEvent TileEvent TrkEventPrimitives TrkParameters TrkExInterfaces AthAllocators AthenaPoolUtilities AtlasDetDescr GeoPrimitives EventKernel NavFourMom GeneratorObjects TruthUtils FastCaloSimAthenaPool PathResolver TrkGeometry TrkSurfaces TrkMaterialOnTrack FastCaloSimLib ) # Install files from the package: @@ -97,7 +97,7 @@ atlas_install_joboptions( share/*.py ) atlas_add_test( FastShowerCellBuilderTool_test SCRIPT test/FastShowerCellBuilderTool_test.sh PROPERTIES TIMEOUT 600 - LOG_IGNORE_PATTERN "Reading file|FastCaloSimFactory|FileName|default:|DATAPATH|Cache alignment|map from|Database being retired|Resolved path|^Domain|HepPDT Version|from file|AtlasTracking.* INFO|CaloTra.* INFO|TrackingGeometrySvc|INFO finalize|INFO Disconnecting from|INFO.*10-bit|Py:Athena +INFO" ) + LOG_IGNORE_PATTERN "Reading file|FastCaloSimFactory|FileName|default:|DATAPATH|Cache alignment|map from|Database being retired|Resolved path|^Domain|HepPDT Version|from file|AtlasTracking.* INFO|CaloTra.* INFO|TrackingGeometrySvc|INFO finalize|INFO Disconnecting from|INFO.*10-bit|Py:Athena +INFO|AtlasField|IOVDbFolder" ) atlas_add_test( AddNoiseCellBuilderToolConfigTest_test diff --git a/Simulation/FastShower/FastCaloSim/src/obsolete/CBNTAA_DetailedCellInfo.cxx b/Simulation/FastShower/FastCaloSim/src/obsolete/CBNTAA_DetailedCellInfo.cxx index 437b4a663434d5af6190bc583e022eed400f303b..28a94ffac22d3898be609d1f61ae3d73b5a17818 100644 --- a/Simulation/FastShower/FastCaloSim/src/obsolete/CBNTAA_DetailedCellInfo.cxx +++ b/Simulation/FastShower/FastCaloSim/src/obsolete/CBNTAA_DetailedCellInfo.cxx @@ -39,7 +39,7 @@ #include "TruthHelper/GenAll.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GaudiKernel/IPartPropSvc.h" #include "HepPDT/ParticleData.hh" diff --git a/Simulation/FastShower/FastCaloSim/src/obsolete/FastCaloSimIsGenSimulStable.cxx b/Simulation/FastShower/FastCaloSim/src/obsolete/FastCaloSimIsGenSimulStable.cxx index 67fe500a5ad54d5e53b3ef0a3d7f4c607096dc9d..2117d049ed5aef61386f74a494d302f3a0422b55 100755 --- a/Simulation/FastShower/FastCaloSim/src/obsolete/FastCaloSimIsGenSimulStable.cxx +++ b/Simulation/FastShower/FastCaloSim/src/obsolete/FastCaloSimIsGenSimulStable.cxx @@ -5,8 +5,8 @@ #include <vector> #include "FastCaloSim/FastCaloSimIsGenSimulStable.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" using std::vector; using std::abs; diff --git a/Simulation/FastShower/FastCaloSimAthenaPool/CMakeLists.txt b/Simulation/FastShower/FastCaloSimAthenaPool/CMakeLists.txt index 4e23e9cdb63cd011d65de25afab0656c23644778..e57d8d5defd6a25c5eba02b9c9b47f0ae2233461 100644 --- a/Simulation/FastShower/FastCaloSimAthenaPool/CMakeLists.txt +++ b/Simulation/FastShower/FastCaloSimAthenaPool/CMakeLists.txt @@ -24,7 +24,6 @@ atlas_add_library( FastCaloSimAthenaPool LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaPoolUtilities AthenaPoolCnvSvcLib ) atlas_add_poolcnv_library( FastCaloSimAthenaPoolPoolCnv - src/*.cxx FILES FastCaloSimAthenaPool/FastShowerInfoContainer.h FastCaloSimAthenaPool/FastShowerInfo.h INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaPoolUtilities AthenaPoolCnvSvcLib FastCaloSimAthenaPool ) diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_FastChain_fatras_mc16a_ttbar.sh b/Simulation/FastSimulation/FastChainPileup/test/test_fastchain_fatras_mc16a_ttbar.sh similarity index 73% rename from Simulation/FastSimulation/FastChainPileup/test/test_FastChain_fatras_mc16a_ttbar.sh rename to Simulation/FastSimulation/FastChainPileup/test/test_fastchain_fatras_mc16a_ttbar.sh index e516c8d6f69261c8c9456e76fe385a0645dbbf97..1fe97b68567433700a7d67a973d7f7a6c89374a9 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_FastChain_fatras_mc16a_ttbar.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_fastchain_fatras_mc16a_ttbar.sh @@ -5,10 +5,15 @@ # art-include: master/Athena # art-output: *.root # art-output: config.txt +# art-output: dcube-rdo-truth +# art-html: dcube-rdo-truth HighPtMinbiasHitsFiles="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/mc16_13TeV.361239.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_high.merge.HITS.e4981_s3087_s3089/*" LowPtMinbiasHitsFiles="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/mc16_13TeV.361238.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_low.merge.HITS.e4981_s3087_s3089/*" - +inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_fastchain_fatras_mc16a_ttbar" +inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" +dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_fatras.xml" +dcubeRefRDO="${inputRefDir}/RDO_truth.root" FastChain_tf.py \ --simulator ATLFASTIIF \ @@ -24,7 +29,7 @@ FastChain_tf.py \ --conditionsTag default:OFLCOND-MC16-SDR-16 \ --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True;from Digitization.DigitizationFlags import digitizationFlags;digitizationFlags.experimentalDigi=["NewMerge"]' \ --preExec 'EVNTtoRDO:ToolSvc.NewMergeMcEventCollTool.OutputLevel=VERBOSE;' \ - --postInclude='PyJobTransforms/UseFrontier.py' \ + --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt");ServiceMgr.MessageSvc.Format = "% F%32W%S%7W%R%T %0W%M"' \ --DataRunNumber '284500' \ --inputHighPtMinbiasHitsFile ${HighPtMinbiasHitsFiles} \ @@ -38,6 +43,7 @@ rc=$? echo "art-result: $rc EVNTtoRDO" rc2=-9999 +rc3=-9999 if [ ${rc} -eq 0 ] then # Regression test @@ -46,5 +52,12 @@ then art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc2=$? + # Histogram comparison with DCube + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x dcube-rdo-truth \ + -c ${dcubeXmlRDO} -r ${dcubeRefRDO} RDO_truth.root + rc3=$? + fi echo "art-result: ${rc2} regression" +echo "art-result: ${rc3} dcubeRDO" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_fastchain_g4ms_mc16a_ttbar.sh b/Simulation/FastSimulation/FastChainPileup/test/test_fastchain_g4ms_mc16a_ttbar.sh index 58db96fe0323725a5457e11fed94a782dce72054..05219a9a96819e5dc42cf45d5d358fa7c8d9ddf3 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_fastchain_g4ms_mc16a_ttbar.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_fastchain_g4ms_mc16a_ttbar.sh @@ -5,10 +5,16 @@ # art-include: master/Athena # art-output: *.root # art-output: config.txt +# art-output: dcube-rdo-truth +# art-html: dcube-rdo-truth + HighPtMinbiasHitsFiles="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/mc16_13TeV.361239.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_high.merge.HITS.e4981_s3087_s3089/*" LowPtMinbiasHitsFiles="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/mc16_13TeV.361238.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_low.merge.HITS.e4981_s3087_s3089/*" - +inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_fastchain_g4ms_mc16a_ttbar" +inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" +dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_g4ms.xml" +dcubeRefRDO="${inputRefDir}/RDO_truth.root" FastChain_tf.py \ --simulator ATLFASTIIF_G4MS \ @@ -24,7 +30,7 @@ FastChain_tf.py \ --conditionsTag default:OFLCOND-MC16-SDR-16 \ --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True;from Digitization.DigitizationFlags import digitizationFlags;digitizationFlags.experimentalDigi=["NewMerge"]' \ --preExec 'EVNTtoRDO:ToolSvc.NewMergeMcEventCollTool.OutputLevel=VERBOSE;' \ - --postInclude='PyJobTransforms/UseFrontier.py' \ + --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt");ServiceMgr.MessageSvc.Format = "% F%32W%S%7W%R%T %0W%M"' \ --DataRunNumber '284500' \ --inputHighPtMinbiasHitsFile ${HighPtMinbiasHitsFiles} \ @@ -38,6 +44,7 @@ rc=$? echo "art-result: $rc EVNTtoRDO" rc2=-9999 +rc3=-9999 if [ ${rc} -eq 0 ] then # Regression test @@ -46,5 +53,12 @@ then art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc2=$? + # Histogram comparison with DCube + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x dcube-rdo-truth \ + -c ${dcubeXmlRDO} -r ${dcubeRefRDO} RDO_truth.root + rc3=$? + fi echo "art-result: ${rc2} regression" +echo "art-result: ${rc3} dcubeRDO" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_FastChain_mc16a_ttbar.sh b/Simulation/FastSimulation/FastChainPileup/test/test_fastchain_mc16a_ttbar.sh similarity index 88% rename from Simulation/FastSimulation/FastChainPileup/test/test_FastChain_mc16a_ttbar.sh rename to Simulation/FastSimulation/FastChainPileup/test/test_fastchain_mc16a_ttbar.sh index d093f92e4ce516ccb8f820a87c65ed9816ab530e..fc4f119b6f72cdc0be7896ebf8e5d80451d5b340 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_FastChain_mc16a_ttbar.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_fastchain_mc16a_ttbar.sh @@ -2,15 +2,18 @@ # # art-description: Run AFII simulation and full digitization of an MC16a ttbar sample with 2016a geometry and conditions, 25ns pile-up # art-type: grid -# art-include: 21.3/Athena # art-include: master/Athena # art-output: *.root # art-output: config.txt # art-output: dcube-rdo-truth +# art-html: dcube-rdo-truth HighPtMinbiasHitsFiles="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/mc16_13TeV.361239.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_high.merge.HITS.e4981_s3087_s3089/*" LowPtMinbiasHitsFiles="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/mc16_13TeV.361238.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_low.merge.HITS.e4981_s3087_s3089/*" - +inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_fastchain_mc16a_ttbar" +inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" +dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_ATLFASTII.xml" +dcubeRefRDO="${inputRefDir}/RDO_truth.root" FastChain_tf.py \ --simulator ATLFASTII \ @@ -44,13 +47,6 @@ echo "art-result: $rc EVNTtoRDO" rc2=-9999 rc3=-9999 -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_FastChain_mc16a_ttbar" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="FastChain_mc16a_ttbar" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_ATLFASTII.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - if [ ${rc} -eq 0 ] then # Regression test @@ -62,12 +58,10 @@ then rc2=$? # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x dcube-rdo-truth \ + -c ${dcubeXmlRDO} -r ${dcubeRefRDO} RDO_truth.root rc3=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi fi echo "art-result: ${rc2} regression" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_stdReco_fastSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_stdReco_fastSim_fullDigi.sh index 62cf2b1aa0b1fceb058a4397f31c7632edb8ece1..acfef675aa501a08f774b67f50662f256f60e661 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_stdReco_fastSim_fullDigi.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_stdReco_fastSim_fullDigi.sh @@ -2,20 +2,18 @@ # art-description: test for job configuration ttFC_fastSim_fulldigi (Sim/Digi job) + stdReco_fastSim_fullDigi # art-type: grid -# art-include: 21.3/Athena # art-include: master/Athena # art-output: config.txt # art-output: RAWtoESD_config.txt # art-output: *.root # art-output: dcube-rdo-truth # art-output: dcube-id +# art-html: dcube-id inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_stdReco_fastSim_fullDigi" inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="stdReco_fastSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" +dcubeXmlID="${inputXmlDir}/physval-stdReco_fastSim_fullDigi.xml" +dcubeRefID="${inputRefDir}/physval-stdReco_fastSim_fullDigi.root" dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth.xml" dcubeRefRDO="${inputRefDir}/RDO_truth.root" @@ -42,42 +40,42 @@ echo "art-result: ${rc1} EVNTtoRDO" rc2=-9999 if [ ${rc1} -eq 0 ] then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} + # Histogram comparison with DCube + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x dcube-rdo-truth \ + -c ${dcubeXmlRDO} -r ${dcubeRefRDO} RDO_truth.root rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi fi echo "art-result: ${rc2} dcubeRDO" Reco_tf.py --inputRDOFile='RDO_pileup_fastsim_fulldigi.pool.root'\ - --outputAODFile=AOD_fastSim_fullDigi.pool.root \ + --outputAODFile=AOD_fastSim_fullDigi.pool.root \ --autoConfiguration=everything \ --maxEvents 100 \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ + --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" \ --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ + --outputNTUP_PHYSVALFile 'physval-stdReco_fastSim_fullDigi.root' \ + --validationFlags 'doInDet' \ + --valid 'True' \ --imf False - rc3=$? + rc4=-9999 rc5=-9999 -if [ ${rc3} -eq 0 ] +if [ ${rc1} -eq 0 ] then # Regression test ArtPackage=$1 ArtJobName=$2 art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi fi +# Histogram comparison with DCube +$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ +-p -x dcube-id \ +-c ${dcubeXmlID} -r ${dcubeRefID} physval-stdReco_fastSim_fullDigi.root +rc5=$? + echo "art-result: $rc3 RDOtoAOD" echo "art-result: $rc4 regression" echo "art-result: $rc5 dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_stdReco_fullSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_stdReco_fullSim_fullDigi.sh deleted file mode 100755 index 6bdcbbf193699d7ffeca47e554be90a98f9561bc..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_stdReco_fullSim_fullDigi.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test job ttFC_fullSim_fullDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: RAWtoESD_config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_stdReco_fullSim_fullDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="stdReco_fullSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/RDOTruthCompare.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTII \ - --digiSteeringConf "SplitNoMerge" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fullsim_fulldigi.pool.root \ - --maxEvents 50 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - -Reco_tf.py --inputRDOFile=RDO_pileup_fullsim_fulldigi.pool.root \ - --outputAODFile=AOD_fullSim_fullDigi.pool.root \ - --autoConfiguration=everything \ - --maxEvents=500 \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ - --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ - --imf False - -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fastSim_fastDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fastSim_fastDigi.sh deleted file mode 100755 index 58bdbe306f577d9e3c98aadf0b8d60babf0e9daf..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fastSim_fastDigi.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test ttFC_fastSim_fastDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: *.root -# art-output: dcube-rdo-truth - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMergeFF" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fastsim_fastdigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --preDigiInclude="FastTRT_Digitization/preInclude.FastTRT_Digi.Validation.py" \ - --imf False -rc=$? -echo "art-result: ${rc} EVNTtoRDO" - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_fastSim_fastDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_fastSim_fastDigi" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_pileup.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -rc2=-9999 -rc3=-9999 -if [ ${rc} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - echo ArtJobName - echo $ArtJobName - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc2=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc3=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi - -fi -echo "art-result: $rc2 regression" -echo "art-result: $rc3 dcubeRDO" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fastSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fastSim_fullDigi.sh deleted file mode 100755 index 6ce3462c8b22c5ebf3edab1e6ef1bc862d0d7bc0..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fastSim_fullDigi.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test for job configuration ttFC_fastSim_fulldigi (Sim/Digi job) -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: *.root -# art-output: dcube-rdo-truth - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMerge" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root --outputRDOFile RDO_pileup_fastsim_fulldigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --imf False -rc=$? -echo "art-result: ${rc} EVNTtoRDO" - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_fastSim_fullDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_fastSim_fullDigi" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -rc2=-9999 -rc3=-9999 -if [ ${rc} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - echo ArtJobName - echo $ArtJobName - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc2=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc3=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi - -fi -echo "art-result: $rc2 regression" -echo "art-result: $rc3 dcubeRDO" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fullHS_fastPU_simDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fullHS_fastPU_simDigi.sh deleted file mode 100755 index 64ef286cf8d3a831ccf5913817507356d1d01e28..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fullHS_fastPU_simDigi.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash -# -# art-description: ttFC_fullHS_fastPU_simDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: *.root -# art-output: dcube-rdo-truth - -# Run FastChain 'Fast PU, Full HS' and tests: G4HS_FastPileup sim (G4 for HS, Pythia on the fly + FastCaloSim for PU) + fast digi PU/full digi HS + Split reco (truth tracking PU, full HS) -FastChain_tf.py --simulator G4HS_FastPileup \ - --digiSteeringConf "SplitNoMergeSF" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_fullHS_fastPU_simdigi.pool.root \ - --maxEvents 10 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --preDigiInclude="FastTRT_Digitization/preInclude.FastTRT_Digi.Validation.py" \ - --imf False -rc=$? -echo "art-result: ${rc} EVNTtoRDO" - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_fullHS_fastPU_simDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_fullHS_fastPU_simDigi" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_pileup.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -rc2=-9999 -rc3=-9999 -if [ ${rc} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - echo ArtJobName - echo $ArtJobName - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc2=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc3=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi - -fi -echo "art-result: $rc2 regression" -echo "art-result: $rc3 dcubeRDO" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fullSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fullSim_fullDigi.sh deleted file mode 100755 index aa4c30d68c2bb21a8d8c0d2973d95a59a2ca71ed..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_fullSim_fullDigi.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env bash - -# art-type: grid -# art-description: test job ttFC_fullSim_fullDigi -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: *.root -# art-output: dcube-rdo-truth - -FastChain_tf.py --simulator ATLFASTII \ - --digiSteeringConf "SplitNoMerge" \ - --useISF True --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fullsim_fulldigi.pool.root \ - --maxEvents 50 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --imf False -rc=$? -echo "art-result: ${rc} EVNTtoRDO" - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_fullSim_fullDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_fullSim_fullDigi" -dcubeXmlRDO="${inputXmlDir}/RDOTruthCompare.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -rc2=-9999 -rc3=-9999 -if [ ${rc} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - echo ArtJobName - echo $ArtJobName - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc2=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc3=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi - -fi -echo "art-result: $rc2 regression" -echo "art-result: $rc3 dcubeRDO" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fastSim_fastDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fastSim_fastDigi.sh deleted file mode 100755 index 12ee40d2e6fcf6d8058c21fc7235c12234bddb1c..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fastSim_fastDigi.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test ttFC_fastSim_fastDigi + ttFC_reco_Split_fastSim_fastDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: RAWtoESD_config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_Split_fastSim_fastDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_Split_fastSim_fastDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID_PseudoT_fastSim_fastDigi.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_pileup.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMergeFF" \ - --useISF True --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fastsim_fastdigi.pool.root \ - --maxEvents 50 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --preDigiInclude="FastTRT_Digitization/preInclude.FastTRT_Digi.Validation.py" \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - - -FastChain_tf.py --maxEvents 50 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_pileup_fastsim_fastdigi.pool.root' \ - --outputAODFile AOD_Split_fastSim_fastDigi.pool.root \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.pixelClusterSplittingType.set_Value_and_Lock(\"AnalogClus\");InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False);InDetFlags.doStandardPlots.set_Value_and_Lock(True);InDetFlags.doSplitReco.set_Value_and_Lock(True);from InDetRecExample.InDetKeys import InDetKeys; InDetKeys.PixelPUClusters.set_Value_and_Lock('PixelFast_PU_Clusters');InDetFlags.doSplitReco.set_Value_and_Lock(True);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True);InDetKeys.PixelPUClustersTruth.set_Value_and_Lock('PRD_MultiTruthPixel_PU');InDetKeys.SCT_PU_ClustersTruth.set_Value_and_Lock('PRD_MultiTruthSCT_PU');InDetKeys.TRT_PU_DriftCirclesTruth.set_Value_and_Lock('PRD_MultiTruthTRT_PU');" \ - --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")'\ - --imf False - -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fastSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fastSim_fullDigi.sh deleted file mode 100755 index 99dc97d2578ec161b1c4c39d2068b3cdb07ff6d0..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fastSim_fullDigi.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test for job configuration ttFC_fastSim_fulldigi + ttFC_reco_Split_fastSim_fullDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: RAWtoESD_config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_Split_fastSim_fullDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_Split_fastSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_indetplots.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_pileup.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMerge" --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fastsim_fulldigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --imf False - - -echo "art-result: $? EVNTtoRDO" - -FastChain_tf.py --maxEvents 500 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_pileup_fastsim_fulldigi.pool.root' \ - --outputAODFile AOD_Split_fastSim_fullDigi.pool.root \ - --preExec "RAWtoESD:from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doStandardPlots.set_Value_and_Lock(True);InDetFlags.doSplitReco.set_Value_and_Lock(True);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True); from InDetRecExample.InDetKeys import InDetKeys; InDetKeys.PixelPUClusters.set_Value_and_Lock('PixelFast_PU_Clusters');InDetKeys.PixelPUClustersTruth.set_Value_and_Lock('PRD_MultiTruthPixel_PU');InDetKeys.SCT_PU_ClustersTruth.set_Value_and_Lock('PRD_MultiTruthSCT_PU');InDetKeys.TRT_PU_DriftCirclesTruth.set_Value_and_Lock('PRD_MultiTruthTRT_PU');rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" \ - --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ - --imf False -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fullHS_fastPU_simDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fullHS_fastPU_simDigi.sh deleted file mode 100755 index b9f7fc6f9b55c81f0c944543e8279509d4e7eef4..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_Split_fullHS_fastPU_simDigi.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash - -# art-description: ttFC_fullHS_fastPU_simDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: RAWtoESD_config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_Split_fullHS_fastPU_simDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_Split_fullHS_fastPU_simDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID_PseudoT_fastSim_fastDigi.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - - -# Run FastChain 'Fast PU, Full HS' and tests: G4HS_FastPileup sim (G4 for HS, Pythia on the fly + FastCaloSim for PU) + fast digi PU/full digi HS + Split reco (truth tracking PU, full HS) - -FastChain_tf.py --simulator G4HS_FastPileup \ - --digiSteeringConf "SplitNoMergeSF" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_fullHS_fastPU_simdigi.pool.root \ - --maxEvents 10 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --preDigiInclude="FastTRT_Digitization/preInclude.FastTRT_Digi.Validation.py" \ - --imf False -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - -FastChain_tf.py --maxEvents 10 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_fullHS_fastPU_simdigi.pool.root' \ - --outputAODFile AOD_Split_fullHS_fastPU_simDigi.pool.root \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);InDetFlags.doStatistics.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.pixelClusterSplittingType.set_Value_and_Lock(\"AnalogClus\");InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False);InDetFlags.doStandardPlots.set_Value_and_Lock(True);InDetFlags.doSplitReco.set_Value_and_Lock(True);from InDetRecExample.InDetKeys import InDetKeys; InDetKeys.PixelPUClusters.set_Value_and_Lock('PixelFast_PU_Clusters');InDetKeys.SCT_PU_ClustersTruth.set_Value_and_Lock('PRD_MultiTruthSCT_PU');InDetKeys.TRT_PU_DriftCirclesTruth.set_Value_and_Lock('PRD_MultiTruthTRT_PU');InDetFlags.doSplitReco.set_Value_and_Lock(True);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True); from InDetRecExample.InDetKeys import InDetKeys; InDetKeys.PixelPUClusters.set_Value_and_Lock('PixelFast_PU_Clusters');InDetKeys.PixelPUClustersTruth.set_Value_and_Lock('PRD_MultiTruthPixel_PU');InDetKeys.SCT_PU_ClustersTruth.set_Value_and_Lock('PRD_MultiTruthSCT_PU');InDetKeys.TRT_PU_DriftCirclesTruth.set_Value_and_Lock('PRD_MultiTruthTRT_PU');" \ - --postExec 'RAWtoESD:import AthenaCommon.AlgSequence as acas;job = acas.AlgSequence();del job.InDetSCT_ClusterizationPU;del job.InDetPixelClusterizationPU;del job.InDetPRD_MultiTruthMakerSiPU;del job.InDetPRD_MultiTruthMakerTRTPU;from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ - --imf False -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fastSim_fastDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fastSim_fastDigi.sh deleted file mode 100755 index a42c8c35860a20bbdd132477dec6eebb59ef26e6..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fastSim_fastDigi.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test ttFC_fastSim_fastDigi + ttFC_reco_newTracking_PseudoT_fastSim_fastDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_newTracking_PseudoT_fastSim_fastDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_newTracking_PseudoT_fastSim_fastDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID_PseudoT_fastSim_fastDigi.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_pileup.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMergeFF" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fastsim_fastdigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --preDigiInclude="FastTRT_Digitization/preInclude.FastTRT_Digi.Validation.py" \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - - -FastChain_tf.py --maxEvents 500 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_pileup_fastsim_fastdigi.pool.root' \ - --outputAODFile AOD_newTracking_pseudoTracking_fastSim_fastDigi.pool.root \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.pixelClusterSplittingType.set_Value_and_Lock(\"AnalogClus\");InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False);InDetFlags.doStandardPlots.set_Value_and_Lock(True);InDetFlags.doPseudoTracking.set_Value_and_Lock(True);InDetFlags.doNewTracking.set_Value_and_Lock(True);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True);" \ - --imf False - -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fastSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fastSim_fullDigi.sh deleted file mode 100755 index dfdd1777c79bb7fb39cec10714b575edf1207f4e..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fastSim_fullDigi.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test for job configuration ttFC_fastSim_fulldigi then ttFC_reco_newTracking_PseudoT_fastSim_fullDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_newTracking_PseudoT_fastSim_fullDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_newTracking_PseudoT_fastSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_indetplots.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMerge" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fastsim_fulldigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - -# Reconstruction -FastChain_tf.py --maxEvents 500 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_pileup_fastsim_fulldigi.pool.root' \ - --outputAODFile AOD_newTracking_pseudoTracking_fastSim_fullDigi.pool.root \ - --preExec "RAWtoESD:from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doPseudoTracking.set_Value_and_Lock(True);InDetFlags.doNewTracking.set_Value_and_Lock(True);rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True);" "InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ - --imf False - -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fullSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fullSim_fullDigi.sh index 2841c51b59622552f6bd20a745ebcabcb2dfe573..be1247ee60ce3ececb9fa0d026436f0800900c10 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fullSim_fullDigi.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_newTracking_PseudoT_fullSim_fullDigi.sh @@ -2,20 +2,18 @@ # art-description: test job ttFC_fullSim_fullDigi + ttFC_reco_newTracking_PseudoT_fullSim_fullDigi # art-type: grid -# art-include: 21.3/Athena # art-include: master/Athena # art-output: config.txt # art-output: *.root # art-output: dcube-rdo-truth # art-output: dcube-id +# art-html: dcube-id inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_newTracking_PseudoT_fullSim_fullDigi" inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_newTracking_PseudoT_fullSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_indetplots.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/RDOTruthCompare.xml" +dcubeXmlID="${inputXmlDir}/physval-newTracking_PseudoT_fullSim_fullDigi.xml" +dcubeRefID="${inputRefDir}/physval-newTracking_PseudoT_fullSim_fullDigi.root" +dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_compare.xml" dcubeRefRDO="${inputRefDir}/RDO_truth.root" @@ -35,18 +33,17 @@ FastChain_tf.py --simulator ATLFASTII \ --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ --DataRunNumber '284500' \ --imf False - rc1=$? echo "art-result: ${rc1} EVNTtoRDO" + rc2=-9999 if [ ${rc1} -eq 0 ] then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} + # Histogram comparison with DCube + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x dcube-rdo-truth \ + -c ${dcubeXmlRDO} -r ${dcubeRefRDO} RDO_truth.root rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi fi echo "art-result: ${rc2} dcubeRDO" @@ -57,28 +54,31 @@ FastChain_tf.py --maxEvents 500 \ --conditionsTag OFLCOND-RUN12-SDR-31 \ --inputRDOFile RDO_pileup_fullsim_fulldigi.pool.root \ --outputAODFile AOD_newTracking_pseudoTracking_fullSim_fullDigi.pool.root \ - --preExec "RAWtoESD:from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doPseudoTracking.set_Value_and_Lock(True);InDetFlags.doNewTracking.set_Value_and_Lock(True);rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True);" "InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ + --preExec "RAWtoESD:from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doPseudoTracking.set_Value_and_Lock(True);InDetFlags.doNewTracking.set_Value_and_Lock(True);rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True);" \ + --outputNTUP_PHYSVALFile 'physval-newTracking_PseudoT_fullSim_fullDigi.root' \ + --validationFlags 'doInDet' \ + --valid 'True' \ --imf False - rc3=$? + rc4=-9999 rc5=-9999 -if [ ${rc3} -eq 0 ] +if [ ${rc1} -eq 0 ] then # Regression test ArtPackage=$1 ArtJobName=$2 art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi fi + +# Histogram comparison with DCube +$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ +-p -x dcube-id \ +-c ${dcubeXmlID} -r ${dcubeRefID} physval-newTracking_PseudoT_fullSim_fullDigi.root +rc5=$? + + echo "art-result: ${rc3} RDOtoAOD" echo "art-result: ${rc4} regression" echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fastSim_fastDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fastSim_fastDigi.sh deleted file mode 100755 index 6c08fef2739c0865b166239ba99fe09d4d59ed0e..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fastSim_fastDigi.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test ttFC_fastSim_fastDigi + ttFC_reco_noSplit_PseudoT_fastSim_fastDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_noSplit_PseudoT_fastSim_fastDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_noSplit_PseudoT_fastSim_fastDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID_PseudoT_fastSim_fastDigi.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_pileup.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMergeFF" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fastsim_fastdigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --preDigiInclude="FastTRT_Digitization/preInclude.FastTRT_Digi.Validation.py" \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - -# Reconstruction -FastChain_tf.py --maxEvents 500 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_pileup_fastsim_fastdigi.pool.root' \ - --outputAODFile AOD_noSplit_pseudoTracking_fastSim_fastDigi.pool.root \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.pixelClusterSplittingType.set_Value_and_Lock(\"AnalogClus\");InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False);InDetFlags.doStandardPlots.set_Value_and_Lock(True);InDetFlags.doPseudoTracking.set_Value_and_Lock(True);" \ - --imf False - -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fastSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fastSim_fullDigi.sh deleted file mode 100755 index 206445a56b2dec9b772cd7fb55bf7973262c1df2..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fastSim_fullDigi.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test for job configuration ttFC_fastSim_fulldigi followed by reco job ttFC_reco_noSplit_PseudoT_fastSim_fullDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_noSplit_PseudoT_fastSim_fullDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_noSplit_PseudoT_fastSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_indetplots.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -# Sim/Digi job -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMerge" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fastsim_fulldigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - -# Reconstruction -FastChain_tf.py --maxEvents 500 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_pileup_fastsim_fulldigi.pool.root' \ - --outputAODFile AOD_noSplit_pseudoTracking_fastSim_fullDigi.pool.root \ - --preExec "RAWtoESD:from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doPseudoTracking.set_Value_and_Lock(True);rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True);" "InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ - --imf False - -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fullSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fullSim_fullDigi.sh deleted file mode 100755 index 3a988c42c38e95dbc001e44a310cd097cef3bf12..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_PseudoT_fullSim_fullDigi.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test job ttFC_fullSim_fullDigi + ttFC_reco_noSplit_PseudoT_fullSim_fullDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_noSplit_PseudoT_fullSim_fullDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_noSplit_PseudoT_fullSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_indetplots.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/RDOTruthCompare.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTII \ - --digiSteeringConf "SplitNoMerge" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fullsim_fulldigi.pool.root \ - --maxEvents 50 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - -# Reconstruction -FastChain_tf.py --maxEvents 500 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile RDO_pileup_fullsim_fulldigi.pool.root \ - --outputAODFile AOD_noSplit_pseudoTracking_fullSim_fullDigi.pool.root \ - --preExec "RAWtoESD:from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doPseudoTracking.set_Value_and_Lock(True);rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(True);" "InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ - --imf False - -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fastSim_fastDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fastSim_fastDigi.sh deleted file mode 100755 index 3b42e30a9d3958966baa94e4a326b96f8c40f8f4..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fastSim_fastDigi.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test ttFC_fastSim_fastDigi + ttFC_reco_noSplit_noPseudoT_fastSim_fastDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: RAWtoESD_config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_noSplit_noPseudoT_fastSim_fastDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_noSplit_noPseudoT_fastSim_fastDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_pileup.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMergeFF" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root --outputRDOFile RDO_pileup_fastsim_fastdigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --preDigiInclude="FastTRT_Digitization/preInclude.FastTRT_Digi.Validation.py" \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - -# Reconstruction -FastChain_tf.py --maxEvents 500 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_pileup_fastsim_fastdigi.pool.root' \ - --outputAODFile AOD_noSplit_noPseudoT_fastSim_fastDigi.pool.root \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.pixelClusterSplittingType.set_Value_and_Lock(\"AnalogClus\");InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False);InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ - --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ - --imf False -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fastSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fastSim_fullDigi.sh deleted file mode 100755 index 1c54e1cc3ac8fa018a8bf77c1af84a3442815ee8..0000000000000000000000000000000000000000 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fastSim_fullDigi.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash - -# art-description: test for job configuration ttFC_fastSim_fulldigi _ttFC_reco_noSplit_noPseudoT_fastSim_fullDigi -# art-type: grid -# art-include: 21.3/Athena -# art-output: config.txt -# art-output: RAWtoESD_config.txt -# art-output: *.root -# art-output: dcube-rdo-truth -# art-output: dcube-id - -inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_noSplit_noPseudoT_fastSim_fullDigi" -inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_noSplit_noPseudoT_fastSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth.xml" -dcubeRefRDO="${inputRefDir}/RDO_truth.root" - -FastChain_tf.py --simulator ATLFASTIIF_PileUp \ - --digiSteeringConf "SplitNoMerge" \ - --useISF True \ - --randomSeed 123 \ - --enableLooperKiller True \ - --inputEVNTFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/ttbar_muplusjets-pythia6-7000.evgen.pool.root \ - --outputRDOFile RDO_pileup_fastsim_fulldigi.pool.root \ - --maxEvents 100 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --preSimExec 'from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags;TrkDetFlags.TRT_BuildStrawLayers=True' \ - --preSimInclude FastChainPileup/FastPileup.py \ - --postInclude='PyJobTransforms/UseFrontier.py,G4AtlasTests/postInclude.DCubeTest_FCpileup.py,DigitizationTests/postInclude.RDO_Plots.py' \ - --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ - --DataRunNumber '284500' \ - --postSimExec='genSeq.Pythia8.NCollPerEvent=10;' \ - --imf False - -rc1=$? -echo "art-result: ${rc1} EVNTtoRDO" -rc2=-9999 -if [ ${rc1} -eq 0 ] -then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} - rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi -fi -echo "art-result: ${rc2} dcubeRDO" - -# Reconstruction -FastChain_tf.py --maxEvents 500 \ - --skipEvents 0 \ - --geometryVersion ATLAS-R2-2015-03-01-00 \ - --conditionsTag OFLCOND-RUN12-SDR-31 \ - --inputRDOFile 'RDO_pileup_fastsim_fulldigi.pool.root' \ - --outputAODFile AOD_noSplit_noPseudoT_fastSim_fullDigi.pool.root \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" "InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ - --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ - --imf False - -rc3=$? -rc4=-9999 -rc5=-9999 -if [ ${rc3} -eq 0 ] -then - # Regression test - ArtPackage=$1 - ArtJobName=$2 - art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary - rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi -fi -echo "art-result: ${rc3} RDOtoAOD" -echo "art-result: ${rc4} regression" -echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi.sh index 9874e28c3af3d1be470d487dfd61fcbcfcdc3c76..4acf662abc476fea304a952bd9e29f717b96ca60 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi.sh @@ -2,21 +2,19 @@ # art-description: test job ttFC_fullSim_fullDigi + ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi # art-type: grid -# art-include: 21.3/Athena # art-include: master/Athena # art-output: config.txt # art-output: RAWtoESD_config.txt # art-output: *.root # art-output: dcube-rdo-truth # art-output: dcube-id +# art-html: dcube-id inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi" inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" -dcubeXmlRDO="${inputXmlDir}/RDOTruthCompare.xml" +dcubeXmlID="${inputXmlDir}/physval-noSplit_noPseudoT_fullSim_fullDigi.xml" +dcubeRefID="${inputRefDir}/physval-noSplit_noPseudoT_fullSim_fullDigi.root" +dcubeXmlRDO="${inputXmlDir}/dcube_RDO_truth_compare.xml" dcubeRefRDO="${inputRefDir}/RDO_truth.root" FastChain_tf.py --simulator ATLFASTII \ @@ -35,18 +33,16 @@ FastChain_tf.py --simulator ATLFASTII \ --postExec 'from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("config.txt")' \ --DataRunNumber '284500' \ --imf False - rc1=$? echo "art-result: ${rc1} EVNTtoRDO" rc2=-9999 if [ ${rc1} -eq 0 ] then - bash ${art_dcube} ${dcubeName} RDO_truth.root ${dcubeXmlRDO} ${dcubeRefRDO} + # Histogram comparison with DCube + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x dcube-rdo-truth \ + -c ${dcubeXmlRDO} -r ${dcubeRefRDO} RDO_truth.root rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-rdo-truth" - fi fi echo "art-result: ${rc2} dcubeRDO" @@ -57,29 +53,31 @@ FastChain_tf.py --maxEvents 500 \ --conditionsTag OFLCOND-RUN12-SDR-31 \ --inputRDOFile RDO_pileup_fullsim_fulldigi.pool.root \ --outputAODFile AOD_noSplit_noPseudoT_fullSim_fullDigi.pool.root \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" "InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ + --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" \ --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ + --outputNTUP_PHYSVALFile 'physval-noSplit_noPseudoT_fullSim_fullDigi.root' \ + --validationFlags 'doInDet' \ + --valid 'True' \ --imf False - rc3=$? + rc4=-9999 rc5=-9999 -if [ ${rc3} -eq 0 ] +if [ ${rc1} -eq 0 ] then # Regression test ArtPackage=$1 ArtJobName=$2 art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi fi + +# Histogram comparison with DCube +$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ +-p -x dcube-id \ +-c ${dcubeXmlID} -r ${dcubeRefID} physval-noSplit_noPseudoT_fullSim_fullDigi.root +rc5=$? + echo "art-result: ${rc3} RDOtoAOD" echo "art-result: ${rc4} regression" echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_stdFullSimDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_stdFullSimDigi.sh index e2f52e1707ade08df2761f48819d47da04b5b6b0..44bb9d439bbcf1dbec6ce8ace2c0a7512bd9028a 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_stdFullSimDigi.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_reco_noSplit_noPseudoT_stdFullSimDigi.sh @@ -2,18 +2,16 @@ # art-description: Job ttFC_stdFullSim + ttFC_stdFullSimMerge + ttFC_stdFullSimDigi + ttFC_reco_noSplit_noPseudoT_stdFullSimDigi # art-type: grid -# art-include: 21.3/Athena # art-include: master/Athena # art-output: *.root # art-output: dcube-truth # art-output: dcube-id +# art-html: dcube-id inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_reco_noSplit_noPseudoT_stdFullSimDigi" inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_reco_noSplit_noPseudoT_stdFullSimDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" +dcubeXmlID="${inputXmlDir}/physval-noSplit_noPseudoT_stdFullSimDigi.xml" +dcubeRefID="${inputRefDir}/physval-noSplit_noPseudoT_stdFullSimDigi.root" dcubeXmlTruth="${inputXmlDir}/dcube_truth.xml" dcubeRefTruth="${inputRefDir}/truth.root" @@ -30,18 +28,17 @@ Sim_tf.py --conditionsTag 'default:OFLCOND-RUN12-SDR-19' \ --outputHITSFile "HITS.pool.root" \ --maxEvents 50 \ --imf False - rc1=$? echo "art-result: ${rc1} EVNTtoHITS" + rc2=-9999 if [ ${rc1} -eq 0 ] then - bash ${art_dcube} ${dcubeName} truth.root ${dcubeXmlTruth} ${dcubeRefTruth} + # Histogram comparison with DCube + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x dcube-truth \ + -c ${dcubeXmlTruth} -r ${dcubeRefTruth} truth.root rc2=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-truth" - fi fi echo "art-result: ${rc2} dcubeTruth" @@ -77,28 +74,30 @@ FastChain_tf.py --maxEvents 50 \ --conditionsTag OFLCOND-RUN12-SDR-31 \ --inputRDOFile RDO.pool.root \ --outputAODFile AOD_Split_stdFullSimDigi.pool.root \ - --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doStandardPlots.set_Value_and_Lock(True);" \ + --preExec "RAWtoESD:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" \ + --outputNTUP_PHYSVALFile 'physval-noSplit_noPseudoT_stdFullSimDigi.root' \ + --validationFlags 'doInDet' \ + --valid 'True' \ --imf False - rc3=$? + rc4=-9999 rc5=-9999 -if [ ${rc3} -eq 0 ] +if [ ${rc1} -eq 0 ] then # Regression test ArtPackage=$1 ArtJobName=$2 art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi fi + +# Histogram comparison with DCube +$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ +-p -x dcube-id \ +-c ${dcubeXmlID} -r ${dcubeRefID} physval-noSplit_noPseudoT_stdFullSimDigi.root +rc5=$? + echo "art-result: ${rc3} RDOtoAOD" echo "art-result: ${rc4} regression" echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fastDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fastDigi.sh index f8cd526c33be733e1ff979452da830a65e1a639a..bb22f6471527afb412c8104946fcc0c81b26df78 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fastDigi.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fastDigi.sh @@ -7,43 +7,45 @@ # art-output: RAWtoESD_config.txt # art-output: *.root # art-output: dcube-id +# art-html: dcube-id inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fastDigi" inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_recoinp_noSplit_noPseudoT_fastSim_fastDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID_recoinp.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" +dcubeXmlID="${inputXmlDir}/physval-noSplit_noPseudoT_fastSim_fastDigi.xml" +dcubeRefID="${inputRefDir}/physval-noSplit_noPseudoT_fastSim_fastDigi.root" -# RDO input from 21.3/Nov 13 Nightly test_ttFC_reco_noSplit_noPseudoT_fastSim_fastDigi.sh +# RDO input from 21.3/Apr 27 Nightly test_ttFC_reco_noSplit_noPseudoT_fastSim_fastDigi.sh FastChain_tf.py --maxEvents 500 \ --skipEvents 0 \ --geometryVersion ATLAS-R2-2015-03-01-00 \ --conditionsTag OFLCOND-RUN12-SDR-31 \ --inputRDOFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/RecoInputRefs/RDO_pileup_fastsim_fastdigi.pool.root' \ --outputAODFile AOD_noSplit_noPseudoT_fastSim_fastDigi.pool.root \ - --preExec "all:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(False);InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False);InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ + --preExec "all:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(False);InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False);" \ --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt");ToolSvc.InDetPixelClusterOnTrackTool.ErrorStrategy=1' \ + --outputNTUP_PHYSVALFile 'physval-noSplit_noPseudoT_fastSim_fastDigi.root' \ + --validationFlags 'doInDet' \ + --valid 'True' \ --imf False rc3=$? rc4=-9999 rc5=-9999 -if [ ${rc3} -eq 0 ] +# return to this check after physval returns proper exit_code +# if [ ${rc3} -eq 0 ] +if [ -f "AOD_noSplit_noPseudoT_fastSim_fastDigi.pool.root" ] then # Regression test ArtPackage=$1 ArtJobName=$2 art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi fi +# Histogram comparison with DCube +$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ +-p -x dcube-id \ +-c ${dcubeXmlID} -r ${dcubeRefID} physval-noSplit_noPseudoT_fastSim_fastDigi.root +rc5=$? + echo "art-result: ${rc3} RDOtoAOD" echo "art-result: ${rc4} regression" echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fullDigi.sh index 2fe927238f3f869394da7ef8e4928b57a02bcafa..37b5088f631cd3d1135508697a48215a568ab0a2 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fullDigi.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fullDigi.sh @@ -7,44 +7,48 @@ # art-output: RAWtoESD_config.txt # art-output: *.root # art-output: dcube-id +# art-html: dcube-id inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_recoinp_noSplit_noPseudoT_fastSim_fullDigi" inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_recoinp_noSplit_noPseudoT_fastSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID_recoinp.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" +dcubeXmlID="${inputXmlDir}/physval-noSplit_noPseudoT_fastSim_fullDigi.xml" +dcubeRefID="${inputRefDir}/physval-noSplit_noPseudoT_fastSim_fullDigi.root" -# RDO input from 21.3/Nov 13 Nightly test_ttFC_reco_noSplit_noPseudoT_fastSim_fullDigi.sh +# RDO input from 21.3/Apr 27 Nightly test_ttFC_reco_noSplit_noPseudoT_fastSim_fullDigi.sh FastChain_tf.py --maxEvents 500 \ --skipEvents 0 \ --geometryVersion ATLAS-R2-2015-03-01-00 \ --conditionsTag OFLCOND-RUN12-SDR-31 \ --inputRDOFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/RecoInputRefs/RDO_pileup_fastsim_fulldigi.pool.root' \ --outputAODFile AOD_noSplit_noPseudoT_fastSim_fullDigi.pool.root \ - --preExec "all:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" "InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ + --preExec "all:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" \ --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ + --outputNTUP_PHYSVALFile 'physval-noSplit_noPseudoT_fastSim_fullDigi.root' \ + --validationFlags 'doInDet' \ + --valid 'True' \ --imf False - rc3=$? + rc4=-9999 rc5=-9999 -if [ ${rc3} -eq 0 ] +# return to this check after physval returns proper exit_code +# if [ ${rc3} -eq 0 ] +if [ -f "AOD_noSplit_noPseudoT_fastSim_fullDigi.pool.root" ] then # Regression test ArtPackage=$1 ArtJobName=$2 art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi fi + +# Histogram comparison with DCube +$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ +-p -x dcube-id \ +-c ${dcubeXmlID} -r ${dcubeRefID} physval-noSplit_noPseudoT_fastSim_fullDigi.root +rc5=$? + + echo "art-result: ${rc3} RDOtoAOD" echo "art-result: ${rc4} regression" echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fullSim_fullDigi.sh b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fullSim_fullDigi.sh index 69c13cb782ca378304c956bd6cebb8f33cbb2a9d..9e7c967305f35c569b792a8e7d54e2d019e7be61 100755 --- a/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fullSim_fullDigi.sh +++ b/Simulation/FastSimulation/FastChainPileup/test/test_ttFC_recoinp_noSplit_noPseudoT_fullSim_fullDigi.sh @@ -7,45 +7,48 @@ # art-output: RAWtoESD_config.txt # art-output: *.root # art-output: dcube-id +# art-html: dcube-id inputRefDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-refs/${AtlasBuildBranch}/test_ttFC_recoinp_noSplit_noPseudoT_fullSim_fullDigi" inputXmlDir="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/DCube-configs/${AtlasBuildBranch}" -art_dcube="/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube" -dcubeName="ttFC_recoinp_noSplit_noPseudoT_fullSim_fullDigi" -dcubeXmlID="${inputXmlDir}/dcube_ID_recoinp.xml" -dcubeRefID="${inputRefDir}/InDetStandardPlots.root" +dcubeXmlID="${inputXmlDir}/physval-noSplit_noPseudoT_fullSim_fullDigi.xml" +dcubeRefID="${inputRefDir}/physval-noSplit_noPseudoT_fullSim_fullDigi.root" -# RDO input from 21.3/Nov13 nightly test_ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi.sh +# RDO input from 21.3/Apr 27 nightly test_ttFC_reco_noSplit_noPseudoT_fullSim_fullDigi.sh FastChain_tf.py --maxEvents 500 \ --skipEvents 0 \ --geometryVersion ATLAS-R2-2015-03-01-00 \ --conditionsTag OFLCOND-RUN12-SDR-31 \ --inputRDOFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/RecoInputRefs/RDO_pileup_fullsim_fulldigi.pool.root' \ --outputAODFile AOD_noSplit_noPseudoT_fullSim_fullDigi.pool.root \ - --preExec "all:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" "InDetFlags.doStandardPlots.set_Value_and_Lock(True)" \ + --preExec "all:rec.doTrigger.set_Value_and_Lock(False);recAlgs.doTrigger.set_Value_and_Lock(False);" \ --postExec 'RAWtoESD:from AthenaCommon.ConfigurationShelve import saveToAscii;saveToAscii("RAWtoESD_config.txt")' \ + --outputNTUP_PHYSVALFile 'physval-noSplit_noPseudoT_fullSim_fullDigi.root' \ + --validationFlags 'doInDet' \ + --valid 'True' \ --imf False - rc3=$? + rc4=-9999 rc5=-9999 -if [ ${rc3} -eq 0 ] +# return to this check after physval returns proper exit_code +# if [ ${rc3} -eq 0 ] +if [ -f "AOD_noSplit_noPseudoT_fullSim_fullDigi.pool.root" ] then # Regression test ArtPackage=$1 ArtJobName=$2 art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary rc4=$? - - # Histogram comparison with DCube - bash ${art_dcube} ${dcubeName} InDetStandardPlots.root ${dcubeXmlID} ${dcubeRefID} - rc5=$? - if [ -d "dcube" ] - then - mv "dcube" "dcube-id" - fi fi + +# Histogram comparison with DCube +$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ +-p -x dcube-id \ +-c ${dcubeXmlID} -r ${dcubeRefID} physval-noSplit_noPseudoT_fullSim_fullDigi.root +rc5=$? + echo "art-result: ${rc3} RDOtoAOD" echo "art-result: ${rc4} regression" echo "art-result: ${rc5} dcubeID" diff --git a/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt index 3510ec858b95c29ffaa7313333fc0a502915496e..4bd638d877009ae2b56f12792572cb759818d592 100644 --- a/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt +++ b/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt @@ -34,14 +34,14 @@ atlas_add_library( G4AtlasAlgLib src/*.cxx PUBLIC_HEADERS G4AtlasAlg INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - ${HEPMC_INCLUDE_DIRS} + LINK_LIBRARIES ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel GaudiKernel G4AtlasInterfaces SGTools StoreGateLib SGtests EventInfo GeneratorObjects MCTruthBaseLib ) # Component(s) in the package: atlas_add_component( G4AtlasAlg src/components/*.cxx PUBLIC_HEADERS G4AtlasAlg - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel GaudiKernel G4AtlasInterfaces G4AtlasAlgLib SGTools StoreGateLib SGtests EventInfo GeneratorObjects MCTruthBaseLib ) #Test G4AtlasAlg diff --git a/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt index 70bbbadc14f248d3a96526bf92fbcb3d020b3dde..307695cfc60d73ff815c56dc281fda6aebd3dbf9 100644 --- a/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt +++ b/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt @@ -49,7 +49,7 @@ find_package( XercesC ) # Component(s) in the package: atlas_add_component( G4AtlasTests src/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel CaloDetDescrLib CaloIdentifier CaloSimEvent AthenaKernel StoreGateLib SGtests GeoAdaptors GeoPrimitives Identifier EventInfo ALFA_SimEv LUCID_SimEvent ZDC_SimEvent GeneratorObjects InDetSimEvent LArSimEvent MuonReadoutGeometry MuonIdHelpersLib MuonSimEvent McParticleEvent G4AtlasToolsLib MCTruth HitManagement TileDetDescr TileIdentifier TileSimEvent ) # Install files from the package: diff --git a/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt b/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt index ccba67748899ab42c45a680ae40fd8e5eaaf4e0b..28d20a9fb87ffd2add04db31de06e3fc0184faf6 100644 --- a/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt +++ b/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt @@ -29,7 +29,7 @@ if( MCUTILS_FOUND ) list( APPEND extra_libs ${MCUTILS_LIBRARIES} ) endif() if( HEPMC_FOUND ) - list( APPEND extra_includes ${HEPMC_INCLUDE_DIRS} ) + list( APPEND extra_includes ) list( APPEND extra_libs AtlasHepMCLib ) endif() @@ -39,7 +39,7 @@ atlas_add_library( G4ExternalDecay src/*.cxx PUBLIC_HEADERS G4ExternalDecay INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${LHAPDF_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${PYTHIA8_INCLUDE_DIRS} ${extra_includes} - PRIVATE_INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${PYTHIA8_LIBRARIES} ${LHAPDF_LIBRARIES} ${GEANT4_LIBRARIES} Pythia8_iLib ${extra_libs} PRIVATE_LINK_LIBRARIES AtlasHepMCLib ) diff --git a/Simulation/G4Sim/MCTruth/CMakeLists.txt b/Simulation/G4Sim/MCTruth/CMakeLists.txt index 4dc85f6995a60d4788d9e882a99a3174adf3cc63..4343bfbaf45729c1c339bdd5edb50f62a02bf491 100644 --- a/Simulation/G4Sim/MCTruth/CMakeLists.txt +++ b/Simulation/G4Sim/MCTruth/CMakeLists.txt @@ -23,7 +23,7 @@ find_package( XercesC ) atlas_add_library( MCTruth src/*.cxx PUBLIC_HEADERS MCTruth - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaKernel GeneratorObjects PRIVATE_LINK_LIBRARIES ISF_Event SimHelpers ) diff --git a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt index 7400360b76ed4de6815fd1d478dc1af7ee476c27..ffe5e7f3d062d26e9d55d13187e479dabf5418f8 100644 --- a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt +++ b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt @@ -31,7 +31,7 @@ find_package( XercesC ) atlas_add_library( MCTruthBaseLib src/*.cxx PUBLIC_HEADERS MCTruthBase - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaKernel GaudiKernel StoreGateLib SGtests G4AtlasToolsLib PRIVATE_LINK_LIBRARIES AthenaBaseComps @@ -41,7 +41,7 @@ atlas_add_library( MCTruthBaseLib atlas_add_component( MCTruthBase src/components/*.cxx - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaKernel GaudiKernel diff --git a/Simulation/G4Sim/TrackRecord/CMakeLists.txt b/Simulation/G4Sim/TrackRecord/CMakeLists.txt index 58013814dc4c4e5e00450d53941dd941c674fcd9..62efd9cbf5b21b4e64c0f99e66711ec80e69b638 100644 --- a/Simulation/G4Sim/TrackRecord/CMakeLists.txt +++ b/Simulation/G4Sim/TrackRecord/CMakeLists.txt @@ -16,13 +16,17 @@ atlas_depends_on_subdirs( PUBLIC find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) +atlas_add_library( TrackRecordLib + TrackRecord/*.h + INTERFACE + PUBLIC_HEADERS TrackRecord + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES HitManagement AthenaKernel ${CLHEP_LIBRARIES} ) + # Component(s) in the package: atlas_add_dictionary( TrackRecordDict TrackRecord/TrackRecordDict.h TrackRecord/selection.xml INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel HitManagement ) - -# Install files from the package: -atlas_install_headers( TrackRecord ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel HitManagement TrackRecordLib ) diff --git a/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt index 57c9aeb9d1887d27191b94baba0cc3a653d4fd71..e1acf8b6debc89ee2df94bd63b74d2f9c62ca928 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt +++ b/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt @@ -24,12 +24,12 @@ find_package( Eigen ) atlas_add_library( ISF_Event src/*.cxx PUBLIC_HEADERS ISF_Event - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} TestTools AthenaBaseComps AtlasDetDescr GeoPrimitives GeneratorObjects GaudiKernel ) atlas_add_test( ISFParticle_test SOURCES test/ISFParticle_test.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} TestTools AthenaBaseComps AtlasDetDescr GeoPrimitives GeneratorObjects GaudiKernel ISF_Event ) diff --git a/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt index d31bed16612165cb91d0753d6ef4c029144dac01..57d11d1b07578fc0d42b28050695998e88778a7e 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt +++ b/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt @@ -47,7 +47,7 @@ find_package( GMock ) atlas_add_component( ISF_Services src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEANT4_LIBRARIES} AtlasHepMCLib ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} GaudiKernel CaloIdentifier CaloSimEvent AthenaBaseComps StoreGateLib SGtests AtlasDetDescr GeneratorObjects InDetSimEvent MuonSimEvent G4AtlasInterfaces MCTruth SimHelpers ISF_Event ISF_Interfaces TileSimEvent PmbCxxUtils TruthUtils ) # Tests in the package: @@ -85,7 +85,7 @@ atlas_add_test( TruthSvc_test ${GMOCK_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} - ${HEPMC_INCLUDE_DIRS} + ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} LINK_LIBRARIES diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt index 39a45f51d69a7fb7872e59520e3dc0083c846d05..ff49138660cbdc82436dd33d34df844c525c43e6 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt @@ -69,7 +69,7 @@ atlas_add_library( ISF_FastCaloSimParametrizationLib Root/*.cxx src/CaloGeometryFromCaloDDM.cxx src/CaloGeometryLookup.cxx src/CaloGeometry.cxx ${ISF_FastCaloSimParametrizationLibDictSource} PUBLIC_HEADERS ISF_FastCaloSimParametrization - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib CaloGeoHelpers AthenaBaseComps AthenaKernel Identifier GaudiKernel ISF_Interfaces TrkEventPrimitives TrkParameters TrkExInterfaces CaloDetDescrLib StoreGateLib SGtests TileConditionsLib @@ -78,7 +78,7 @@ atlas_add_library( ISF_FastCaloSimParametrizationLib atlas_add_component( ISF_FastCaloSimParametrization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} CaloDetDescrLib CaloGeoHelpers AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier GaudiKernel ISF_Interfaces TrkEventPrimitives TrkParameters TrkExInterfaces CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileConditionsLib TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack ISF_FastCaloSimParametrizationLib ) # Install files from the package: diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt index 901fe1c71889201fba6ae56fb88a96eaf255db42..0f284499c6d850e39efa6b90bf5b2d7a40cbc911 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt @@ -40,7 +40,7 @@ find_package(lwtnn) atlas_add_component( ISF_FastCaloSimServices src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${LWTNN_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel IdDictParser ISF_Interfaces TrkEventPrimitives TrkExInterfaces CaloEvent StoreGateLib SGtests NavFourMom GeneratorObjects FastCaloSimLib ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces ISF_FastCaloSimParametrizationLib PathResolver) # Install files from the package: diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt index 0686e08b1af3c5c576f72e0b05eff513c78606a5..421e23419bcae30472cf40b98086e659e3b6e809 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt @@ -32,7 +32,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) atlas_add_component( ISF_PunchThroughTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives ISF_FastCaloSimInterfaces AthContainers GaudiKernel ISF_Event ISF_Interfaces PathResolver ) # Install files from the package: diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/CMakeLists.txt index f054c56b0602b74dea658781750c5e3004e64b5f..059b4cf71a1546c6044f7f62d68b031bbd25a757 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/CMakeLists.txt @@ -42,7 +42,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) atlas_add_component( ISF_FatrasRecoTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AtlasHepMCLib AthenaBaseComps GeoPrimitives Identifier ISF_FatrasEvent TrkEventPrimitives TrkParameters TrkSpacePoint TrkTrackSummary TrkToolInterfaces AtlasDetDescr EventPrimitives GaudiKernel InDetIdentifier InDetPrepRawData SiSpacePoint ISF_FatrasDetDescrModel TrkDetElementBase TrkCompetingRIOsOnTrack TrkEventUtils TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTruthData ) # Install files from the package: diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt index 88917c813ef851485b3e34325537bd1903963a12..5eb594d7eae713a9f22b598139076a2e3bca5e07 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt @@ -33,7 +33,7 @@ find_package( XercesC ) atlas_add_component( ISF_FatrasToolsG4 src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel ISF_Event ISF_FatrasInterfaces TrkEventPrimitives StoreGateLib SGtests ISF_Interfaces TrkGeometry ) # Install files from the package: diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt index 2d4f2045e7dac26ae457cb3f788d6ad33e69e7a0..6bd2f4d29bef955f6f61190f67c6106ad269f7cf 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt @@ -31,7 +31,7 @@ atlas_add_library( ISF_Geant4Event PUBLIC_HEADERS ISF_Geant4Event INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - ${HEPMC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib @@ -40,7 +40,7 @@ atlas_add_library( ISF_Geant4Event #atlas_add_test(SOURCES # INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} -# ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} +# ${EIGEN_INCLUDE_DIRS} # LINK_LIBRARIES # ${CLHEP_LIBRARIES} AtlasHepMCLib # ${EIGEN_LIBRARIES} ISF_Event SimHelpers GeoPrimitives diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt index 37851eb4673e905f428e77b851a110b105476378..6aad927886fd73ca54dcbb11912a9187c7b940d9 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt @@ -35,7 +35,7 @@ find_package( XercesC ) atlas_add_component( ISF_Geant4Tools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} AthenaKernel GaudiKernel G4AtlasInterfaces AthenaBaseComps StoreGateLib SGtests AtlasDetDescr GeneratorObjects G4AtlasToolsLib G4AtlasAlgLib MCTruth SimHelpers ISF_Event ISF_Interfaces ISF_Geant4Event ) # Install files from the package: diff --git a/Simulation/ISF/ISF_HepMC/ISF_HepMC_Tools/CMakeLists.txt b/Simulation/ISF/ISF_HepMC/ISF_HepMC_Tools/CMakeLists.txt index 835f2bbc15aa2c8ab4ee82488f0295c45ffa0b8b..78f249afa983d22f9955f653f2b9772d73bc6b42 100644 --- a/Simulation/ISF/ISF_HepMC/ISF_HepMC_Tools/CMakeLists.txt +++ b/Simulation/ISF/ISF_HepMC/ISF_HepMC_Tools/CMakeLists.txt @@ -29,25 +29,25 @@ find_package( GMock ) atlas_add_component( ISF_HepMC_Tools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib GaudiKernel AtlasDetDescr AthenaBaseComps TruthUtils ISF_Event ISF_Interfaces PathResolver ) # Tests atlas_add_test( GenParticleGenericFilter_test SOURCES test/GenParticleGenericFilter_test.cxx src/GenParticleGenericFilter.cxx - INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} LINK_LIBRARIES ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} AtlasHepMCLib AthenaBaseComps ) # Tests atlas_add_test( GenParticleInteractingFilter_test SOURCES test/GenParticleInteractingFilter_test.cxx src/GenParticleInteractingFilter.cxx - INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} LINK_LIBRARIES ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} AtlasHepMCLib AthenaBaseComps TruthUtils ) # Tests atlas_add_test( GenParticleLifetimeFilter_test SOURCES test/GenParticleLifetimeFilter_test.cxx src/GenParticleLifetimeFilter.cxx - INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} LINK_LIBRARIES ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} AtlasHepMCLib AthenaBaseComps TruthUtils ) # Install files from the package: diff --git a/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt b/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt index 96ddeaf336b8c5051baa12b81b93ca2d0cb8374d..3e6f6364606d91c019381f49b02f925b41731cc2 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt +++ b/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt @@ -22,7 +22,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) atlas_add_component( ISF_SimulationSelectors src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib GaudiKernel BarcodeServicesLib ISF_Event ISF_Interfaces ) # Install files from the package: diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py index 32d425c98a8b4ab274740290eaef09c967d0f41a..6c6900c4f7f6f8c2f36d86631b38675db31158b0 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py +++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py @@ -143,7 +143,7 @@ def getNeutralGeant4Selector(name="ISF_NeutralGeant4Selector", **kwargs): def getProtonAFIIGeant4Selector(name="ISF_ProtonAFIIGeant4Selector", **kwargs): kwargs.setdefault('MaxMom' , 750) - kwargs.setdefault('ParticlePDG' , 2112) + kwargs.setdefault('ParticlePDG' , 2212) kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') kwargs.setdefault('SimulationFlavor', SimulationFlavor.Geant4) return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt b/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt index 27aabee14e3ec6afe578704e62571a834e1072c7..79c27a60b40f628bcab172367786753ac7ff36e1 100644 --- a/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt @@ -34,7 +34,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore atlas_add_component( CaloSamplingFractionAnalysis src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib GaudiKernel CaloDetDescrLib CaloIdentifier CaloSimEvent CaloEvent AthenaBaseComps GeoAdaptors EventInfo LArSimEvent TileDetDescr TileSimEvent ) # Install files from the package: diff --git a/Simulation/Tools/HitAnalysis/CMakeLists.txt b/Simulation/Tools/HitAnalysis/CMakeLists.txt index 0ca5a408303b6bf59c897b250cd228b2dc734c53..c5755f260819e0b1d209c3f02c15a6866698985d 100644 --- a/Simulation/Tools/HitAnalysis/CMakeLists.txt +++ b/Simulation/Tools/HitAnalysis/CMakeLists.txt @@ -40,7 +40,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore atlas_add_component( HitAnalysis src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib GaudiKernel CaloDetDescrLib CaloIdentifier CaloSimEvent AthenaBaseComps GeoAdaptors EventInfo AFP_SimEv ALFA_SimEv LUCID_SimEvent ZDC_SimEvent GeneratorObjects InDetSimEvent LArSimEvent MuonSimEvent TileDetDescr TileSimEvent ) # Install files from the package: diff --git a/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt b/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt index a8fa91bcf9ce6259f0a9527f027c8875cbab61ab..81c0bc06d556253f10fc67c37e8eda619177a7e9 100644 --- a/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt +++ b/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt @@ -23,14 +23,14 @@ find_package( Eigen ) atlas_add_library( McEventCollectionFilterLib src/*.cxx NO_PUBLIC_HEADERS - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES StoreGateLib SGtests PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel GeneratorObjects InDetSimEvent MuonSimEvent ) atlas_add_component( McEventCollectionFilter src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GeoPrimitives GaudiKernel GeneratorObjects InDetSimEvent MuonSimEvent McEventCollectionFilterLib ) atlas_install_python_modules( python/*.py ) diff --git a/Simulation/TruthJiveXML/CMakeLists.txt b/Simulation/TruthJiveXML/CMakeLists.txt index 51d325b1eb1bbd1bf7fd35700a9c1f69ba4f9afa..fe2785555abb040e21df9d822e1926f9b2da93dc 100644 --- a/Simulation/TruthJiveXML/CMakeLists.txt +++ b/Simulation/TruthJiveXML/CMakeLists.txt @@ -25,7 +25,7 @@ find_package( HepPDT ) atlas_add_component( TruthJiveXML src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel JiveXMLLib StoreGateLib SGtests EventPrimitives GeneratorObjects ) # Install files from the package: diff --git a/TileCalorimeter/TileMonitoring/share/TileMon_jobOptions.py b/TileCalorimeter/TileMonitoring/share/TileMon_jobOptions.py index be7e6d6cfa2915ea7b3f5944a6530f461793c376..ff26b723edadbcbf43160fd7c3b72088006376f4 100644 --- a/TileCalorimeter/TileMonitoring/share/TileMon_jobOptions.py +++ b/TileCalorimeter/TileMonitoring/share/TileMon_jobOptions.py @@ -265,5 +265,6 @@ if tileRawMon: from TileMonitoring.TileDQFragMonitorAlgorithm import TileDQFragMonitoringConfigOld topSequence += TileDQFragMonitoringConfigOld(DQMonFlags) -topSequence += ManagedAthenaTileMon -printfunc (ManagedAthenaTileMon) +if jp.ConcurrencyFlags.NumThreads() == 0: + topSequence += ManagedAthenaTileMon + printfunc (ManagedAthenaTileMon) diff --git a/Tools/DCubeClient/CMakeLists.txt b/Tools/DCubeClient/CMakeLists.txt deleted file mode 100644 index cc6dc6446eb99af2221a66223a0b23dc84dc494d..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -################################################################################ -# Package: DCubeClient -################################################################################ - -# Declare the package name: -atlas_subdir( DCubeClient ) - -# Install files from the package: -atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/DCubeClient_jobOptions.py ) -atlas_install_runtime( test/DCubeClient_TestConfiguration.xml test/*.C share/DCubeValid.xml share/DCubeServer ) -atlas_install_scripts( python/dcube.py python/dcubeConvert.py ) -atlas_install_xmls( share/DCubeValid.xml ) - diff --git a/Tools/DCubeClient/RTT/DCubeForRTTCfg.xml b/Tools/DCubeClient/RTT/DCubeForRTTCfg.xml deleted file mode 100644 index d81e48f755225ba2678032ac8b4a0a7760cf2319..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/RTT/DCubeForRTTCfg.xml +++ /dev/null @@ -1,23 +0,0 @@ -<!-- - file: DCubeForRTTCfg.xml - brief: DCubeClient for AtlasRTT ini file - author: Krzysztof Daniel Ciba - date: Sep 4, 2007 - - * Oct 23, 2007 - cibak - switch to root 5.17/04 - * Apr 10, 2008 - cibak - switch to root 5.19/02, python 2.5, DCubeServer-00-00-10 - * Aug 14, 2009 - cibak - switch to root 5.22/00d - * Oct 06, 2009 - cibak - switch to root 5.25/02 - * Feb 15, 2010 - cibak - swicth to root 5.26.00b ---> -<init version="3.1.4.1.5"> - -<!-- runtime parameters --> -<!-- base directory with reference files --> -<ref_dir>/afs/cern.ch/atlas/project/RTT/prod/Results/reference/</ref_dir> -<!-- base directory with dcube server installation --> -<server>/afs/cern.ch/atlas/project/RTT/prod/Results/dcube/latest/</server> -</init> - - -<!-- end of DCubeForRTTCfg.xml file --> diff --git a/Tools/DCubeClient/RTT/DCubeRunner.py b/Tools/DCubeClient/RTT/DCubeRunner.py deleted file mode 100644 index 3faf5dadab78a4a5b57f8a4613ba5174aab5e65a..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/RTT/DCubeRunner.py +++ /dev/null @@ -1,369 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -## -# @module DCubeRunner -# @author Krzysztof Daniel Ciba -# @date 4 Sep 2007 -# @brief Glue module to plugin DCube to Atlas RTT. -# -# * Feb 4, 2007 - switch to DCubeClient-00-00-13 -# and DCubeServer-00-00-08 -# * Apr 10, 2008 - switch to DCubeServer-00-00-10 -# * Nov 7, 2008 - switch to new DCubeServer-00-00-11 -# * Nov 11, 2008 - switch to new DCubeClient-00-00-19 and DCubeServer-00-00-12 -# - -## some imports -import xml.dom.minidom as minidom -import os, sys -import os.path -import re - -## @class DCubeRunner -# @brief prepares and runs shell script with DCube command -class DCubeRunner: - - ## DCubeClient API classes - __reAPIClasses = [ re.compile("DCubeApp"), - re.compile("DCubeConfig"), - re.compile("DCubeTester"), - re.compile("DCubePlotter"), - re.compile("DCubePHPWriter") ] - - ## base directory for references - baseRef = "/afs/cern.ch/atlas/project/RTT/prod/Results/reference/" - - ## DCubeServer directory - dcubeServer = "/afs/cern.ch/atlas/project/RTT/prod/Results/dcube/latest/" - - ## DCubeClient directory - dcubeClient = "/afs/cern.ch/atlas/project/RTT/DCubeClient/latest/python" - - ## c'tor - # @param self "Me, myself and Irene" - # @param argDict RTT action runner dictionary - def __init__( self, argDict={} ): - - try: - from Logger import Logger - self.logger = Logger() - except ImportError: - self.logger = False - - self.error = None - - self.debug("DCubeRunner constructor is getting args from dictionary...") - - self.cfgFile = None - if ( "DCubeCfg" in argDict ): - self.cfgFile = argDict["DCubeCfg"] - else: - self.info( "*** No DCubeCfg in DCubeRunner action dictionary ***" ) - self.error = "No DCubeCfg in DCubeRunner argDict" - - self.refFile = None - if ( "DCubeRef" in argDict ): - self.refFile = argDict["DCubeRef"] - else: - self.info( "*** No DCubeRef in DCubeRunner action dictionay, will use value from config XML file ***" ) - - self.monFile = None - if ( "DCubeMon" in argDict ): - self.monFile = argDict["DCubeMon"] - else: - self.info( "*** No DCubeMon in DCubeRunner action dictionary ***" ) - self.error = "No DCubeMon in DCubeRunner argDict" - - if ( "DCubeJobId" in argDict ): - self.jobId = argDict["DCubeJobId"] - else: - self.jobId = None - - jobDtor = argDict.get('JobDescriptor', None ) - - if ( jobDtor != None ): - self.DCubeForRTTCfg = jobDtor.paths.dCubeCfgFile - self.outputPath = jobDtor.runPath - self.installArea = jobDtor.paths.installArea - self.cvsPath = 'offline/' + jobDtor.paths.containerPackage - self.cmtPath = jobDtor.paths.cmtPath - self.nightly = jobDtor.paths.branch # branch - self.install = jobDtor.paths.runType # install - self.cmtconfig = jobDtor.paths.cmtConfig # CMTCONFIG - self.project = jobDtor.paths.topProject # Atlas project name - self.release = jobDtor.paths.release # release name - else: - ## dummy values for testing - self.DCubeForRTTCfg = "./DCubeForRTTCfg.xml" - self.outputPath = "./" - self.installArea = "./" - self.cvsPath = "offline/Tools/DCubeClient" - self.cmtPath = "." - self.nightly = "dev" - self.install = "build" - self.cmtconfig = "i686-slc5-gcc43-opt" - self.project = "AtlasProduction" - self.release = "rel_1" - - self.debug("[01] will use '%s' as DCubeClient configuration file for RTT" % self.DCubeForRTTCfg ) - self.debug("[02] will use '%s' as output path" % self.outputPath ) - self.debug("[03] will use '%s' as install area path" % self.installArea ) - self.debug("[04] will use '%s' as package CVS path" % self.cvsPath ) - self.debug("[05] will use '%s' as cmt path" % self.cmtPath ) - self.debug("[06] will use DCubeClient monitored file '%s'" % self.monFile ) - self.debug("[07] will use DCubeClient reference file '%s'" % self.refFile ) - self.debug("[08] will use DCubeClient configuration file '%s'" % self.cfgFile ) - self.debug("[09] will use '%s' as DCubeClient branch name" % self.nightly ) - self.debug("[10] will use '%s' as DCubeClient install name" % self.install ) - self.debug("[11] will use '%s' as DCubeClient cmtconfig name" % self.cmtconfig ) - self.debug("[12] will use '%s' as DCubeClient project name" % self.project ) - if ( self.jobId ): - self.debug("[13] will use '%s' as DCubeClient jobId" % self.jobId ) - else: - self.debug("[13] DCubeClient jobId not set!") - - self.command = [ ] - if ( self.error == None ): - for line in self.__parseDCubeRTTCfg(): - self.command.append( line ) - msg = "command to run is:\n"+20*"-"+"\n" - for line in self.command: - msg += line - msg += "\n"+20*"-"+"\n" - self.debug( msg ) - self.debug( "DCubeRunner is ready to work...") - - ## run method - # @param self "Me, myself and Irene" - def run( self ): - if ( self.error == None ): - try: - from ShellCommand import ShellCommand - # FIXME - self.logger could be just python False... - sc = ShellCommand( self.command, - self.logger ) - replay = sc.getReply() - reLine = re.compile("OVERALL STATISTICS STATUS") - status = 1 - for line in replay: - for apiClass in self.__reAPIClasses: - if ( apiClass.search( line ) ): - self.debug( line ) - if ( reLine.search( line ) ): - if ( "OK" in line ): status = 0 - - return status - except ImportError: - self.info("No ShellCommand in PYTHONPATH! 'No Cin-Cin, no run...'") - return 1 - else: - self.info(self.error) - return 1 - - ## XML parsing of DCubeForRTTCfg.xml - # @param self "Me, myself and Irene" - def __parseDCubeRTTCfg( self ): - self.debug( "parsing DCubeRunner configuration file %s" % self.DCubeForRTTCfg ) - try: - xmldoc = minidom.parse( self.DCubeForRTTCfg ) - - self.refBaseDir = self.getText( xmldoc.getElementsByTagName("ref_dir")[0].childNodes ) - self.debug( "[14] will use '%s' as base reference directory" % self.refBaseDir ) - - self.dcubeServer = self.getText( xmldoc.getElementsByTagName("server")[0].childNodes ) - self.debug( "[15] will use DCubeServer installed in %s" % self.dcubeServer ) - - except: - self.error = "error when parsing DCubeRunner configuration file, no run will be preformed" - return [ "" ] - - self.debug("constructing command to run DCube...") - out = [ ] - words = self.cmtconfig.split("-") - if ( words[0] == "i686" ): - bin = "32" - else: - bin = "64" - gcc = words[2] - opt = words[3] - - tag = ",".join( [self.release, self.nightly, bin, gcc, opt, self.project, "forceConfig" ]) - out.append("export CMTCONFIG="+self.cmtconfig+"\n") - out.append("source ~/cmthome/setup.sh -tag=%s\n" % ( tag ) ) - out.append( "export PATH=" + self.dcubeClient + ":${PATH}\n") - out.append( "export PYTHONPATH=" + self.dcubeClient + ":${PYTHONPATH}\n") - - # changing the outputPath - monPath = self.outputPath - - self.outputPath = self.outputPath + os.sep + "DCube-" + self.refFile - - # creating DCube subdirectory - out.append("mkdir -p " + self.outputPath + "\n") - - dcubePath = self.dcubeClient - - dcubeConvert = os.path.join( dcubePath, "./dcubeConvert.py") - - run = os.path.join(dcubePath,"./dcube.py") - run += " -p " # generate plot - run += " --branch " + self.nightly # set branch - run += " --install " + self.install # set install - run += " --cmtconfig " + self.cmtconfig # set cmtconfig - run += " --project " + self.project # set project - # set jobId - if ( self.jobId ): - run += " --jobId " + self.jobId - - - run += " -l " + self.outputPath + os.sep + self.monFile + ".dcube.log" # save log to monitored.dcube.log - run += " -s " + self.dcubeServer # path to the DCubeServer installation - run += " -x " + self.outputPath + os.sep + self.monFile + ".dcube.xml " # save output to monitored.dcube.xml - - # dangerous hacking at the moment... - if ( os.path.isabs( self.cfgFile ) or "DUMMY-TEST" in self.cfgFile ): - run += " -c " + self.cfgFile - config = self.cfgFile - else: - # checking cfg file in reference dir - refCfg = "/afs/cern.ch/atlas/project/RTT/Results/reference/" + self.cvsPath + os.sep + self.cfgFile - self.debug("will check the timestamp of DCube configuration file (reference volume): " + refCfg ) - refCfgStat = None - - if ( os.path.exists(refCfg) ): - refCfgStat = os.stat(refCfg) - self.debug("File %s modified %d" %( refCfg, refCfgStat[8]) ) - else: - self.debug("DCube configuration file %s not found on 'reference' volume" % self.cfgFile ) - - # checking cfg file in cvs co dir - - cvsCfg = self.cmtPath + os.sep + self.cvsPath.lstrip("offline") + "/test/" + self.cfgFile - self.debug("will check the timestamp of DCube configuration file (CVS checkout volume):" + cvsCfg) - cvsCfgStat = None - if ( os.path.exists(cvsCfg) ) : - cvsCfgStat = os.stat( cvsCfg ) - self.debug("File %s modified %d" %( cvsCfg, cvsCfgStat[8]) ) - else: - self.debug("DCube configuration file %s not found in CVS checkout directory" % self.cfgFile ) - - - # choose configuration file based on latest timestamp - config = None - - # both are present, check time stamps - if ( None not in ( refCfgStat, cvsCfgStat) ): - # install area newer - if ( refCfgStat[8] <= cvsCfgStat[8] ): - config = cvsCfg - else: - config = refCfg - - # reference is present - elif ( None != refCfgStat ): - config = refCfg - # install area is present - elif ( None != cvsCfgStat ): - config = cvsCfg - # both are absent - else: - pass - - if ( config != None ): - run += " -c " + config # add configuration file - else: - self.debug("DCube configuration file %s not found on afs reference volume or InstallArea directories" % self.cfgFile ) - return [ "" ] - - if ( self.refFile != None ): - run += " -r " + os.path.join( os.path.join(self.refBaseDir , self.cvsPath) , self.refFile ) # overwrite reference - run += " " + os.path.join( monPath , self.monFile) # add monitored file at the end - - - if ( "DUMMY-TEST" in self.cfgFile ): - dcubeConvert += " %s " % os.path.abspath(self.cfgFile) - else: - dcubeConvert += " %s " % os.path.abspath(config) - - dcubeConvert += " %s\n" % os.path.join( os.path.join(self.refBaseDir , self.cvsPath) , self.refFile ) - out.append( dcubeConvert ) - out.append( run + "\n") - - return out - - - ## logger level INFO - # @param self "Me, myself and Irene" - # @param msg message - def info( self, msg ): - if ( bool(self.logger) ): - self.logger.info( str(msg) ) - else: - print "DCubeRunner INFO " + str(msg) - - ## logger level DEBUG - # @param self "Me, myself and Irene" - # @param msg message - def debug( self, msg ): - if ( bool(self.logger) ): - self.logger.debug( str( msg) ) - else: - print "DCubeRunner DEBUG " + str(msg) - - - ## get CDATA section - # @param self "me, myself and Irene" - # @param nodelist list of XML DOM Nodes - def getText( self, nodelist ): - out = "" - for node in nodelist: - if node.nodeType == node.TEXT_NODE: - out = out + node.data - return out - - ## split path - # @param self "Me, myself and Irene" - # @param path path to split - # @param rest splitted tail - def pathSplit(self, path, rest=[] ): - ( head , tail ) = os.path.split( path ) - if len(head) < 1: return [tail]+ rest - if len(tail) < 1: return [head]+ rest - return self.pathSplit( head, [tail] + rest ) - - ## find common names in path - # @param self "Me, myself and Irene" - # @param l1 first list with splitted path - # @param l2 second lust with splitted path - # @param common list of common dirnames - def commonPath(self, l1, l2, common=[] ): - if len(l1) < 1: return (common, l1, l2) - if len(l2) < 1: return (common, l1, l2) - if l1[0] != l2[0]: return (common, l1, l2) - return self.commonPath( l1[1:], l2[1:], common+[l1[0]]) - - ## finds relative path between p1 and p2 - # @param self "Me, myself and Irene" - # @param p1 first path - # @param p2 second path - def relPath(self, p1, p2): - ( common, l1, l2 ) = self.commonPath( self.pathSplit(p1), self.pathSplit(p2)) - p = [] - if len(l1) > 0: - p = [ '../' * len(l1) ] - p = p + l2 - return os.path.join( *p ) - - -## dummy test running -if __name__ == "__main__": - print "running DCubeRunner..." - testCfg = { "DCubeCfg" : "test_dcube_cfg.xml", - "DCubeMon" : "monitored.root", - "DCubeRef" : "reference.root", - "DCubeJobId" : "test_01", - "JobDescriptor" : None } - dc = DCubeRunner( testCfg ) - dc.run() - - diff --git a/Tools/DCubeClient/python/DCubeApp.py b/Tools/DCubeClient/python/DCubeApp.py deleted file mode 100644 index 94bccfc66cf52739c469fcac80be329d38d96f3f..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/DCubeApp.py +++ /dev/null @@ -1,578 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -## -# @file DCubeClient/python/DCubeApp.py -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief implementation of DozerApp and test_DozerApp classes -import sys,os,shutil -from DCubeUtils import * -from DCubeOptParser import DCubeOptParser -from DCubeValid import DCubeValid -from DCubeConfig import DCubeConfig -from DCubeTester import DCubeTester -from DCubePHPWriter import DCubePHPWriter -import unittest -## -# @class DCubeApp -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief DCube client application -class DCubeApp( DCubeObject ): - - ## parser options (optparse.Values) - opts = None - - ## left over positional arguments as list - args = None - - ## path to monitored root file - monitoredURI = None - - ## path to reference root file - referenceURI = None - - ## monitored file handle - monTFile = None - - ## reference file handle - refTFile = None - - ## Output directory - outdir = None - - ## c'tor - # @param self "Me, myself and Irene" - def __init__( self ): - - parser = DCubeOptParser() - self.parsed = self.opts, self.args = parser.parse( sys.argv ) - - ## to run ROOT in batch mode and not try to interpret other command-line args - sys.argv[1:] = ["-b"] - - import ROOT - global ROOT - - self.monitoredURI = None - if ( len(self.args) == 2 ): - self.monitoredURI = self.args[-1] - - self.outdir = self.opts.output - if not self.outdir: - if self.monitoredURI: - self.__update( "output", self.monitoredURI + ".dcube.xml" ) - self.outdir = os.path.dirname( self.monitoredURI ) - else: - self.__update( "output", "dcube.xml" ) - else: - if self.outdir.endswith(".xml") and not os.path.isdir( self.outdir ): - self.outdir = os.path.dirname( self.outdir ) - else: - self.__update( "output", os.path.join( self.outdir, "dcube.xml" ) ) - if self.outdir and not os.path.isdir( self.outdir ): - os.mkdir( self.outdir ) - - if not self.opts.log: - self.__update( "log", os.path.join( self.outdir, "dcube.log" ) ) - - DCubeLogger( self.opts.log, logName="", toConsole=True, verbosity=self.opts.verbosity ) - - super( DCubeApp, self ).__init__( self ) - - ## DCubeVersion instance - theVersion = DCubeVersion() - - ROOT.gErrorIgnoreLevel= (self.opts.verbosity-1)*1000 - - self.info( theVersion ) - self.info( theVersion.python() ) - self.info( theVersion.root() ) - - if self.opts.checkKnown: - ## DCubeValid instance - self.valid = DCubeValid() - - for line in str(self.valid).split("\n"): - self.info( line ) - - self.__dumpOptions() - self.__dumpArgs() - - ## - ## run dispatcher - ## - - try: - ## generation of config XML file - if ( self.opts.generate and self.opts.reference ) : - - self.info("RUN: generation of DCube configuration") - - if ( DCubeConfig( self.parsed ).generate( ) ): - self.info("*** SUCCESS ***") - sys.exit(0) - - elif ( self.opts.config and self.monitoredURI ): - - self.info("RUN: test suite execution") - - dcubeConfig = DCubeConfig( self.parsed ) - runConfig = dcubeConfig.getConfig( strict = False ) - #if ( not runConfig ): - # runConfig = dcubeConfig.getConfig( strict = False ) - - - if ( self.monitoredURI ): - if ( self.exists( self.monitoredURI ) ): - self.__update( "monitored", self.monitoredURI ) - else: - self.error("monitored root file %s not found" % self.monitoredURI ) - else: - raise DCubeException( "wrong arguments, monitored file not specified!" ) - - if ( runConfig ): - - if ( self.runConfig ( runConfig ) ): - - if ( self.tester ): - - if self.opts.makeplots: - if ( self.__producePHPs() ): - self.info("creation of PHP files completed") - self.info("*** SUCCESS ***") - else: - self.warn("some problems occured when producing PHP files") - self.info("*** WARNING ***") - sys.exit({"OK":0,"FAIL":1,"WARN":2}.get(self.tester.status(),3)) - else: - self.error("no DCubeTester instance, no summary information found") - sys.exit(-1) - else: - raise DCubeException( "bad configuration - wrong configuration requested?" ) - else: - self.error( "wrong set of CLI options, neither generation of config (-g) nor test suite excecution (-c CONFIG.XML MONITORED.root) specified" ) - sys.exit(-1) - - except DCubeException as value: - self.epanic( value ) - self.epanic("*** FAILURE ***") - sys.exit(-1) - - ## testing and plotting using \<dcube\> node - # @param self "Me, myself and Irene" - # @param xmlConfig dcube node from configuration file - def runConfig( self, xmlConfig ): - self.info("will run test suite using xml configuration..." ) - - ## output XML DOM document - self.xmldoc = xml.dom.minidom.Document() - self.xmldoc.appendChild( xmlConfig ) - - ## overwritting xml config to match run config - self.debug("will overwrite xml config to match run config...") - xmlConfig.setAttribute( "branch", self.opts.branch ) - xmlConfig.setAttribute( "install", self.opts.install ) - xmlConfig.setAttribute( "cmtconfig", self.opts.cmtconfig ) - xmlConfig.setAttribute( "project", self.opts.project ) - xmlConfig.setAttribute( "jobId", self.opts.jobId ) - self.debug("done!") - - config = "/".join([xmlConfig.getAttribute("branch"), - xmlConfig.getAttribute("install"), - xmlConfig.getAttribute("cmtconfig"), - xmlConfig.getAttribute("project"), - xmlConfig.getAttribute("jobId")]) - self.debug("the run config is %s" % config) - - ## get pvalue limits - pvalues = xmlConfig.getElementsByTagName("plimit") - if len(pvalues) == 0: - self.warn("tag <plimit> not found, will use CLI pvalue limits FAIL=%f WARN=%f" % ( self.opts.pfail, - self.opts.pwarn ) ) - elif len(pvalues) > 1: - self.warn("too many <plimit> tags, will use CLI pvalue limits FAIL=%f WARN=%f" % ( self.opts.pfail, - self.opts.pwarn ) ) - else: - self.debug("tag <plimit> found, will user p-value limits from its attributes") - try: - pfail = float ( pvalues[0].getAttribute("fail") ) - self.__update( "pfail", pfail ) - except TypeError as value: - raise DCubeException( "pvalue limit for FAIL is NAN - %s" % str(value) ) - - try: - pwarn = float( pvalues[0].getAttribute( "warn" ) ) - self.__update( "pwarn", pwarn ) - except TypeError as value: - raise DCubeException( "pvalue limit for WARN is NAN - %s" % str(value) ) - - referenceNode = None - self.referenceURI = None - ## reference root file - if ( self.opts.reference != None ): - - self.referenceURI = os.path.abspath( self.opts.reference ) - - self.debug("will use reference root file from CLI = %s" % self.referenceURI ) - referenceNode = self.xmldoc.createElement( "reference" ) - referenceNode.setAttribute( "file", self.referenceURI ) - - if ( xmlConfig.getElementsByTagName("reference") ): - xmlConfig.replaceChild( referenceNode, xmlConfig.getElementsByTagName("reference")[0] ) - else: - xmlConfig.appendChild( referenceNode ) - - else: - - reference = xmlConfig.getElementsByTagName( "reference" ) - if ( len(reference) == 0 ): raise DCubeException("tag <reference> not found!") - elif ( len(reference) > 1 ): raise DCubeException("too many (>1) <reference> tags") - else: - referenceNode = reference[0] - self.referenceURI = os.path.abspath( referenceNode.getAttribute("file") ) - self.__update( "reference", self.referenceURI ) - - self.debug("will use reference root file from XML = %s" % self.referenceURI ) - - # monitored root file - monitoredNode = self.xmldoc.createElement( "monitored" ) - monitoredNode.setAttribute( "file", self.monitoredURI ) - - xmlConfig.insertBefore( monitoredNode, referenceNode ) - - # date node - dateNode = self.xmldoc.createElement( "date" ) - dateCDataNode = self.xmldoc.createTextNode( self.opts.isodate ) - - dateNode.appendChild( dateCDataNode ) - - xmlConfig.insertBefore( dateNode, monitoredNode ) - - # get <tdirectory> tags and run tester - tdirs = xmlConfig.getElementsByTagName( "TDirectory" ) - if ( len(tdirs) == 0 ): raise DCubeException("no <TDirectory> tags found!") - else: - ## DCubeTester instance - self.tester = DCubeTester( self.xmldoc, self.parsed ) - - self.refTFile = None - if self.exists(self.referenceURI): - try: - self.refTFile = ROOT.TFile.Open(self.referenceURI, "READ") - except Exception as value: - self.epanic( "cannot get handle for reference root file, all tests will be skipped, reason: %s" % str(value) ) - else: - self.warn("reference root file '%s' does not exist, all tests will be skipped!" % self.referenceURI) - - self.monTFile = None - if ( self.exists( self.monitoredURI ) ): - try: - self.monTFile = ROOT.TFile.Open( self.monitoredURI , "READ") - except Exception as value: - msg = "cannot get handle for monitored root file, reason: %s" % str(value) - raise DCubeException( msg ) - else: - raise DCubeException( "monitored root file '%s' does not exist!" % self.monitoredURI ) - - # run DCubeTester recursively - self.test( tdirs[0], tdirs[0].getAttribute("name") ) - - if ( self.refTFile ): self.refTFile.Close() - if ( self.monTFile ): self.monTFile.Close() - - # print and append summary node - xmlConfig.appendChild ( self.tester.summary() ) - - # save output XML to file - return self.__save( ) - - - ## get CDATA section - # @param self "Me, myself and Irene" - # @param nodelist list of XML DOM Node objects - def __cdata( self, nodelist ): - out = "" - for node in nodelist: - if node.nodeType == node.TEXT_NODE: - out = out + node.data - return out - - ## main worker here - # @param self "Me, myself and Irene" - # @param node xml \<tdirectory\> node - # @param path full path inside both root files - def test(self, node, path): - self.debug("now testing objects in path = %s" % path) - status = [] - for child in node.childNodes: - if child.nodeType == node.ELEMENT_NODE: - self.debug("child tagName %s" % child.tagName) - tagName = child.tagName - if tagName == "TDirectory": - status.append(self.test(child, os.path.join(path, child.getAttribute("name")))) - - for test in ["KS", "chi2", "bbb"]: - for stat in ["OK", "WARN", "FAIL"]: - attr = test + stat - - parentCounter = node.getAttribute(attr) - if not parentCounter: - parentCounter = "0" - - nodeCounter = child.getAttribute(attr) - if not nodeCounter: - nodeCounter = "0" - - node.setAttribute(attr, "%d" % (int(parentCounter) + int(nodeCounter))) - else: - - if child.hasAttribute("name"): - if child.hasAttribute("mon"): - objName = child.getAttribute("mon") - else: - objName = child.getAttribute("name") - if child.hasAttribute("ref"): - refName = child.getAttribute("ref") - else: - refName = objName - objTests = child.getAttribute("tests").split(",") - - if path == "/": - objPath = objName - refPath = refName - else: - objPath = os.path.normpath( os.path.join(path, objName) ) - refPath = os.path.normpath( os.path.join(path, refName) ) - if objPath == refPath: - self.info("test %s '%s' [%s]" % (tagName, objPath, ",".join(objTests))) - else: - self.info("test %s '%s' vs '%s' [%s]" % (tagName, objPath, refPath, ",".join(objTests))) - - # objPath is type unicode in Python2, which isn't recognised by TFile.Get(). - # Not a problem with Python3. - if not isinstance(objPath,str): - objPath = objPath.encode('ascii', 'ignore') - refPath = refPath.encode('ascii', 'ignore') - - refObj = self.refTFile.Get(refPath) - monObj = self.monTFile.Get(objPath) - - status.append(self.tester.test(child, monObj, refObj)) - else: - self.warn("empty attribute 'name' found for tag <%s> in path %s, skipping!" % (tagName, path)) - - statusAttr = "OK" - if (("FAIL" in status) or (None in status)): - statusAttr = "FAIL" - elif "WARN" in status: - statusAttr = "WARN" - - self.debug("TDirectory %s status %s" % (path, statusAttr)) - node.setAttribute("status", statusAttr) - - return statusAttr - - ## update parsed options from DCubeOptParser - # @param self "Me, myself and Irene" - # @param key option name - # @param what new value - def __update( self, key, what ): - self.debug("updating option %s to %s" % ( str(key), str(what) ) ) - self.opts._update_loose( { key : what } ) - - ## dump left arguments to logger - # @param self "Me, myself and Irene" - def __dumpArgs( self ): - if ( len(self.args) ): - self.info("dumping not parsed arguments...") - i = 1 - for item in self.args: - self.info("[%02d] %s" % ( i, item ) ) - i += 1 - - ## dump parsed options to logger - # @param self "Me, myself and Irene" - def __dumpOptions( self ): - self.info("dumping parsed options...") - i = 1 - for k, v in self.opts.__dict__.items(): - if ( v == "" ): v = "not set" - self.info("[%02d] %s %s" % ( i, k, v)) - i += 1 - - ## save new output XML to file - # @param self "Me, myself and Irene" - def __save( self ): - - outputURI = os.path.abspath( self.opts.output ) - self.__backup( outputURI ) - try: - fileXML = open( outputURI, "w+") - self.xmldoc.normalize() - - xmlstring = self.xmldoc.toprettyxml(" ", "\n").split("\n") - for line in xmlstring: - if line.strip("\n").strip() != "": - fileXML.write( line+"\n" ) - fileXML.close() - self.info("DCube output has been saved to file %s" % outputURI ) - except IOError as value: - msg = "creation of XML output file %s failed - %s" % ( outputURI, str(value) ) - self.epanic( msg ) - return False - - return True - - ## create backup for old XML output file file - # @param self "Me, myself and Irene" - # @param file path to file - def __backup( self, file ): - - fileURI = os.path.abspath(file) - self.debug( "will create backup file for %s" % file) - - if ( os.path.exists( fileURI ) and os.path.isfile(fileURI) ): - self.warn("file %s exists and will be overwritten!" % fileURI ) - backupURI = fileURI + ".bak" - self.debug("will create backup file %s" % backupURI ) - if ( os.path.isfile( backupURI ) ): - self.warn("backup file %s exists and will be overwritten!" % backupURI ) - try: - os.rename( fileURI, backupURI ) - self.info("backup file %s from file %s has been created" % ( backupURI, fileURI ) ) - except OSError as value: - msg = "creation of backup file %s failed - %s" % ( backupURI, str(value) ) - self.epanic( msg ) - - ## check existence of file - # @param self "Me, myself and Irene" - # @param filename a file name to check - def exists( self, filename ): - if ( "://" not in filename ): - return os.path.exists( os.path.abspath( str(filename) ) ) - self.warn("can't check exsitence of file at URI %s" % filename ) - return True - - ## produce PHP files - # @param self "Me, myself and Irene" - # @return boolean status - def __producePHPs( self ): - self.info("will produce PHP files...") - - if ( not self.opts.server ): - self.__update( "server", os.path.join( os.path.dirname( os.path.dirname( sys.argv[0] ) ), "share/DCubeServer" ) ) - - if ( None not in ( self.opts.log, self.opts.config, self.opts.output ) ): - - locserver = os.path.join( self.outdir, "DCubeServer" ) - serverOK = os.path.isdir( locserver ) - - if serverOK: - self.info( "server files already in %s - don't overwrite them" % locserver ) - else: - if not os.path.isfile( os.path.join( self.opts.server, "dcube.php" ) ): - self.error("server files not found in %s" % self.opts.server ) - else: - self.info( "copy server files from %s to %s" % ( self.opts.server, locserver ) ) - try: - shutil.copytree( self.opts.server, locserver, symlinks=True ) - self.debug( "copied server files" ) - serverOK = True - except Exception as value: - self.error("copy server files from %s to %s, reason - %s" % ( self.opts.server, locserver, str(value) ) ) - - phpWriter = DCubePHPWriter( self.parsed ) - - phpURI = os.path.abspath( self.opts.output + ".php" ) - logURI = os.path.abspath( os.path.join( self.outdir, "dcubelog.php" ) ) - - self.debug( "out php URI %s" % phpURI ) - self.debug( "log php URI %s" % logURI ) - - phpOK = False - try: - filePHP = open( phpURI, "w+" ) - filePHP.writelines( phpWriter.dcubePHP() ) - filePHP.close() - self.debug("out php file has been created") - phpOK = True - except Exception as value: - self.error("can't create output PHP file %s, reason - %s" % ( phpURI, str(value) ) ) - - lnsrc = os.path.join( self.outdir, "index.php" ) - lndst = os.path.basename( phpURI ) - if os.path.islink( lnsrc ): - self.debug( "symlink %s already exists - don't overwrite" % lnsrc ) - else: - self.debug( "symlink %s -> %s" % ( lnsrc, lndst ) ) - try: - os.symlink( lndst, lnsrc ) - except Exception as value: - self.error("can't create symlink %s, reason - %s" % ( lnsrc, str(value) ) ) - - logOK = False - try: - filePHP = open( logURI, "w+" ) - filePHP.writelines( phpWriter.dcubeLOG() ) - filePHP.close() - self.debug("log php file has been created") - logOK = True - except Exception as value: - self.error("can't create log PHP file %s, reason - %s" % ( logURI, str(value) ) ) - - return ( phpOK and logOK and serverOK ) - - - ## main comment in output XML file - # @param self "Me, myself and Irene" - # @return a comment string - def __mainXMLComment( self ): - pass - - -## -# @class test_DCubeApp -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief test case for DCubeApp -# @todo cover more! -class test_DCubeApp( unittest.TestCase ): - - ## setup test suite - # @param self "Me, myself and Irene" - def setUp( self ): - self.sysArgv = [ "--branch", "dev", - "--install", "build", - "--cmtconfig", "i686-slc4-gcc34-opt", - "--project", "AtlasProduction", - "--jobId", "job_1", - "--server", "/afs/cern.ch/user/c/cibak/scratch1/dcube/dcube.php", - "monitored.root" ] - - self.sysExitHolder = sys.exit - def exitCode( value ): - print("sys.exit called with value %s" % str(value)) - sys.exit = exitCode - - ## test contructor - # @param self "Me, myself and Irene" - def test_01_ctor( self ): - sys.argv = self.sysArgv - theApp = DCubeApp( ) - del theApp - - ## test public API - # @param self "Me, myself and Irene" - def test_02_api( self ): - sys.argv = self.sysArgv - theApp = DCubeApp( ) - del theApp - - -## test suite execution -if __name__ == "__main__": - - # sometimes I believe python interpreter ignores all my comments - testLoader = unittest.TestLoader() - suite = testLoader.loadTestsFromTestCase(test_DCubeApp) - unittest.TextTestRunner(verbosity=3).run(suite) - diff --git a/Tools/DCubeClient/python/DCubeConfig.py b/Tools/DCubeClient/python/DCubeConfig.py deleted file mode 100644 index 5de2663916adfc2999b1c63cff1ea0d1cbd52ea8..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/DCubeConfig.py +++ /dev/null @@ -1,651 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -## -# @file DCubeClient/python/DCubeConfig.py -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief implementation of DCubeConfig and test_DCubeConfig classes - -import os -import re -import DCubeUtils -from DCubeOptParser import DCubeOptParser -import unittest -import ROOT -import xml.parsers.expat -import xml.dom.minidom -from time import strftime, localtime, strptime - - -## -# @class DCubeConfig -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief DCube configuration holder -class DCubeConfig( DCubeUtils.DCubeObject ): - - ## forcing to be a singleton - __metaclass__ = DCubeUtils.DCubeSingleton - - ## configuration dictionary - __config = { } - - - ## flag to trigger transformation from old format - needTransform = False - - ## c'tor - # @param self "Me, myself and Irene" - # @param parsed arguments and options from DCubeOptParser - def __init__(self, parsed): - - super(DCubeConfig, self).__init__( self ) - self.info("constructing DCubeConfig...") - - self.opts, self.args = parsed - - if ( self.opts.config != "" ): - self.xmldoc = self.__readXML() - - - ## branch name getter - # @param self "Me, myself and Irene" - def branch( self ): - return self.opts.branch - - ## install name getter - # @param self "Me, myslf and Irene" - def install( self ): - return self.opts.install - - ## cmtconfig name getter - # @param self "Me, myself and Irene" - def cmtconfig( self ): - return self.opts.cmtconfig - - ## project name getter - # @param self "Me, myself and Irene" - def project( self ): - return self.opts.project - - ## job id getter - # @param self "Me, myself and Irene" - def jobId( self ): - return self.opts.jobId - - ## remove white spaces nodes from XML DOM tree - # @param self "Me, myself and Irene" - # @param node xml.dom.Node object - def __removeWS( self, node ): - - toRemove = [] - for child in node.childNodes : - - if ( ( child.nodeType is xml.dom.Node.TEXT_NODE ) and - not child.data.strip() ): - toRemove.append( child ) - elif ( child.hasChildNodes() ): - self.__removeWS( child ) - for node in toRemove: - self.debug( "removing node %s" % str(node) ) - node.unlink() - - - ## save new config to file - # @param self "Me, myself and Irene" - def __save( self ): - - configURI = self.opts.config - self.__backup( configURI ) - try: - fileXML = open( configURI, "w+") - self.xmldoc.normalize() - - xmlstring = self.xmldoc.toprettyxml(" ", "\n").split("\n") - for line in xmlstring: - if line.strip("\n").strip() != "": - fileXML.write( line+"\n" ) - fileXML.close() - self.info("DCubeConfig has been saved to file %s" % configURI) - except IOError as value: - msg = "creation of XML file %s failed - %s" % ( configURI, str(value) ) - self.epanic( msg ) - - return True - - ## create backup for old config file - # @param self "Me, myself and Irene" - # @param file path to file - def __backup( self, file ): - - fileURI = os.path.abspath(file) - self.debug( "will create backup file for %s" % file) - - if ( os.path.exists( fileURI ) and os.path.isfile(fileURI) ): - self.warn("file %s exists and will be overwritten!" % fileURI ) - backupURI = fileURI + ".bak" - self.debug("will create backup file %s" % backupURI ) - if ( os.path.isfile( backupURI ) ): - self.warn("backup file %s exists and will be overwritten!" % backupURI ) - try: - os.rename( fileURI, backupURI ) - self.info("backup file %s from file %s has been created" % ( backupURI, fileURI ) ) - except OSError as value: - msg = "creation of backup file %s failed - %s" % ( backupURI, str(value) ) - self.epanic( msg ) - - - ## (re)genaration of DCube xml configuration file - # @param self "Me, myself and Irene" - def generate( self ): - - configURI = os.path.abspath( self.opts.config ) - - fromScratch = False - - msg = "configuration file %s" % configURI - if ( os.path.exists( configURI ) and - os.path.isfile( configURI ) ): - msg += " exists" - if ( os.path.getsize( configURI ) ): - msg += " and will be overwritten" - else: - msg += ", but is empty, will create configuration from scratch" - fromScratch = True - else: - msg += " doesn't exist, will create it from scratch..." - fromScratch = True - - self.info( msg ) - - if ( fromScratch ): - self.debug( "will create XML DOM document and store dcube config in file %s" % configURI ) - self.xmldoc = self.__createXMLDOC() - else: - self.debug( "will ready dcube config from file %s" % configURI ) - self.xmldoc = self.__readXML() - - self.refFileHandle = None - self.refFileURI = os.path.abspath( self.opts.reference ) - self.debug("will try to open refernce root file=%s" % self.refFileURI ) - try: - self.refFileHandle = ROOT.TFile.Open( self.refFileURI, "READ" ) - self.debug("done") - except Exception: - pass - - if ( not self.refFileHandle ): - raise DCubeUtils.DCubeException("cannot open %s reference root file" % self.refFileURI ) - - cliConfig = "/".join( [ self.opts.branch, self.opts.install, - self.opts.cmtconfig, self.opts.project, - self.opts.jobId ] ) - - self.info("will try to match CLI config %s to XML config" % cliConfig) - runConfigNode = self.getConfig( strict=True ) - self.info("done!") - if ( not runConfigNode ): - self.warn("non matching config found in XML, will create it from scratch") - runConfigNode = self.__emptyConfig() - else: - self.warn("XML config has been found and will be overwritten" ) - - commentFound = False - for child in runConfigNode.childNodes: - if ( child.nodeType == child.COMMENT_NODE ): - runConfigNode.replaceChild( self.__configComment(), child ) - commentFound = True - break - - if ( not commentFound ): - runConfigNode.insertBefore( self.__configComment(), runConfigNode.firstChild ) - - ## overwrite reference node - refNode = runConfigNode.getElementsByTagName("reference") - if ( len(refNode) == 0 ): - refNode = self.xmldoc.createElement("reference") - runConfigNode.appendChild( refNode ) - else: - refNode = refNode[0] - refNode.setAttribute("file", os.path.abspath( self.opts.reference ) ) - - ## overwrite pvalue node - pValueNode = runConfigNode.getElementsByTagName("plimit") - if ( len(pValueNode) == 0 ): - pValueNode = self.xmldoc.createElement("plimit") - runConfigNode.appendChild( pValueNode ) - else: - pValueNode = pValueNode[0] - - pValueNode.setAttribute("fail", str( self.opts.pfail ) ) - pValueNode.setAttribute("warn", str( self.opts.pwarn ) ) - - ## overwrite top level tdirectory tag - rootDirNodes = runConfigNode.getElementsByTagName("TDirectory") - - if ( len(rootDirNodes) != 0 ): - for rootDirNode in rootDirNodes: - if ( rootDirNode.parentNode == runConfigNode ): - runConfigNode.removeChild( rootDirNode ) - - rootDirNode = self.xmldoc.createElement("TDirectory") - rootDirNode.setAttribute("name", "/") - runConfigNode.appendChild( rootDirNode ) - - self.info("will scan reference file for objects...") - self.__scan( self.refFileHandle, rootDirNode ) - self.info("done!") - - msg = "generation of dcube config file='%s' " % os.path.abspath( self.opts.config ) - if ( self.__save() ): - self.info( msg + "completed" ) - return True - - self.error(msg + "failed" % self.opts.config ) - return False - - - ## match runtime config (from CLI) to offline XML config - # @param self "Me, myself and Irene" - # @param fromRun tuple from CLI - # @param fromXML tuple from XML - # @param strict flag to forve only str to str matching - def __match( self, fromRun, fromXML, strict=True ): - - mode = "strict" if strict else "regexp" - self.info("maching config in %s mode" % mode) - - pattern = "[\S]*" - whats = ["branch", "install", "cmtconfig", "project", "jobId" ] - cPairs = dict( zip (whats, zip( fromRun, fromXML ) ) ) - cMatch = dict( zip (whats, [False for i in range(5)] ) ) - - - for k,v in cPairs.items(): - cliValue, xmlValue = v - msg = "what=%-10s fromCLI=%-23s fromXML=%-23s" % ( k , cliValue, xmlValue ) - if ( cliValue.strip() == xmlValue.strip() ): - msg += "match (str to str)" - self.debug( msg ) - cMatch[k] = True - else: - if ( not strict ): - if ( "*" in cliValue and "*" not in xmlValue ): - reCLI = re.compile( cliValue.replace("*", pattern, cliValue.count("*") ) ) - if ( reCLI.match( xmlValue ) ): - msg += "match (reqexp to str)" - self.debug( msg ) - cMatch[k] = True - continue - elif ("*" in xmlValue and "*" not in cliValue ): - reXML = re.compile( xmlValue.replace("*", pattern, xmlValue.count("*") ) ) - if ( reXML.match( cliValue ) ): - msg += "match (str to regexp)" - self.debug( msg ) - cMatch[k] = True - else: - msg += "not match" - self.debug( msg ) - else: - msg += "not match (strict mode on)" - self.debug( msg ) - cMatch[k] = False - - - return all(cMatch.values()) - - - ## get config XML node based on runtime configuration - # @param self "Me, myself and Irene" - # @param strict match config strings w/o regexp - def getConfig( self, strict=True ): - - runConfig = ( self.opts.branch, - self.opts.install, - self.opts.cmtconfig, - self.opts.project, - self.opts.jobId ) - - self.info("will try to find CLI config='%s' in DCubeClient configuration file %s" % ( "/".join(runConfig), - os.path.abspath( self.opts.config) ) ) - - - configs = list(self.__config.keys()) - configs.sort( reverse=True ) - for config in configs: - if self.__match( runConfig, config, strict ): - self.info("runtime config='%s' match to XML config='%s'" % ( "/".join(runConfig), "/".join(config) ) ) - return self.__config[ config ] - - self.warn("<dcube> DOM XML node for CLI config %s not found" % "/".join( runConfig ) ) - return None - - - def __oldConfig( self ): - pass - - - def __configComment( self ): - comNode = "\n" - comNode += " " + "#"*51 + "\n" - comNode += " DCubeClient for:\n" - comNode += " [1] branch: %s\n" % self.opts.branch - comNode += " [2] install: %s\n" % self.opts.install - comNode += " [3] cmtconfig: %s\n" % self.opts.cmtconfig - comNode += " [4] project: %s\n" % self.opts.project - comNode += " [5] jobId: %s\n" % self.opts.jobId - comNode += " [6] reference root file: %s\n" % os.path.abspath( self.opts.reference ) - comNode += " [7] p-values limits FAIL = %f WARN = %f\n" % ( self.opts.pfail, self.opts.pwarn ) - comNode += " " + "#"*51 + "\n" - comNode = self.xmldoc.createComment( comNode ) - return comNode - - ## prepare empty config XML DOM element with attributes from CLI passed thru DCubeOptParser - # @param self "Me, myself and Irene" - def __emptyConfig( self ): - - self.info("will create empty <dcube> DOM XML node...") - - runConfigNode = self.xmldoc.createElement("dcube") - runConfigNode.setAttribute( "branch", self.opts.branch ) - runConfigNode.setAttribute( "install", self.opts.install ) - runConfigNode.setAttribute( "cmtconfig", self.opts.cmtconfig ) - runConfigNode.setAttribute( "project", self.opts.project ) - runConfigNode.setAttribute( "jobId", self.opts.jobId ) - - - referenceNode = self.xmldoc.createElement("reference") - referenceNode.setAttribute("file", os.path.abspath( self.opts.reference ) ) - - referenceDescNode = self.xmldoc.createElement("ref_desc") - refDescCData = self.xmldoc.createTextNode("PUT YOUR REFERENCE DESCRIPTION HERE") - - referenceDescNode.appendChild( refDescCData ) - - testDescNode = self.xmldoc.createElement("test_desc") - testDescCData = self.xmldoc.createTextNode("PUT YOUR TEST DESCRIPTION HERE") - - testDescNode.appendChild( testDescCData ) - - pValueNode = self.xmldoc.createElement("plimit") - pValueNode.setAttribute("fail", str( self.opts.pfail ) ) - pValueNode.setAttribute("warn", str( self.opts.pwarn ) ) - - ## append all nodes - runConfigNode.appendChild( referenceNode ) - runConfigNode.appendChild( referenceDescNode ) - runConfigNode.appendChild( testDescNode ) - - runConfigNode.appendChild( pValueNode ) - - rootDirNode = self.xmldoc.createElement("TDirectory") - rootDirNode.setAttribute("name", "/") - - runConfigNode.appendChild( rootDirNode ) - - self.xmldoc.getElementsByTagName("dcube_client_config")[0].appendChild( runConfigNode ) - - self.info("creation of empty <dcube> node completed") - return runConfigNode - - - ## - # @param self "Me, myself and Irene" - def __handleConfigNodes( self, parent ): - - - runConfig = ( self.opts.branch, - self.opts.install, - self.opts.cmtconfig, - self.opts.project, - self.opts.jobId ) - - configNodes = parent.getElementsByTagName("dcube") - - self.debug("found %d <dcube> tags" % len( configNodes) ) - if ( len(configNodes) ): - for configNode in configNodes: - - nodeConfig = ( configNode.getAttribute("branch") if configNode.getAttribute("branch") != "" else "*", - configNode.getAttribute("install") if configNode.getAttribute("install") != "" else "*", - configNode.getAttribute("cmtconfig") if configNode.getAttribute("cmtconfig") != "" else "*", - configNode.getAttribute("project") if configNode.getAttribute("project") != "" else "*", - configNode.getAttribute("jobId") if configNode.getAttribute("jobId") != "" else "*" ) - - self.info("found <dcube> tag for configuration %s/%s/%s/%s/%s" % nodeConfig ) - self.__config[nodeConfig] = configNode - else: - self.warn("DCube config file is empty? no <config> tags found!") - - - - - ## generate and return empty XML DOM document - # @param self "Me, myself and Irene" - def __createXMLDOC( self ): - xmldoc = xml.dom.minidom.Document() - - commentNode = xmldoc.createComment( self.__mainXMLComment() ) - xmldoc.appendChild( commentNode ) - - dcubeNode = xmldoc.createElement("dcube_client_config") - xmldoc.appendChild( dcubeNode ) - - return xmldoc - - - ## produce scratch config comment string - # @param self "Me, myself and Irene" - def __mainXMLComment( self ): - - out = "\n DCube configuration XML file = %s\n" % self.opts.config - out += " auto-generated using %s\n" % DCubeUtils.DCubeVersion() - out += " on %s\n" % strftime("%a, %d %b %Y %H:%M:%S %Z" , localtime()) - out += " from Root reference file: %s\n" % str( self.opts.reference ) - out += " Statistics tests:\n" - out += " %r\n" % repr( self.opts.tests ) - out += " Legend:\n" - out += " * KS - Kolmogorov-Smirnov test (default)\n" - out += " * chi2 - chi2 test\n" - out += " * bbb - bin-by-bin comparision\n" - out += " * meany - avg eff mean y [TProfiles only!]\n" - out += " * all - all above tests\n\n" - out += " Tweaks:\n" - out += " [1] remove or comment out (using HTML comments tags) histograms not relevant\n" - out += " to your analysis\n" - out += " [2] provide a new content to \"ref_desc\" and \"mon_desc\" tags to something\n" - out += " more meaningful\n" - out += " [3] and of course feel free to change attribute \"tests\" in each \"hist\" tag\n" - out += " [4] limits of p-value warning and failure can be set by changing attributes\n" - out += " in <plimit> tag\n\n" - out += " [5] if you want to make plots FOR EVERY histogram in your monitored file\n" - out += " change attribute \"inclusive\" in <mode> tag to \"true\"\n\n" - return out - - - - ## read XML configuration from - # @param self "Me, myself and Irene" - def __readXML( self ): - - configURI = os.path.abspath( self.opts.config ) - self.debug("will try to read and parse configuration file %s" % configURI ) - - if ( os.path.exists( configURI ) and - os.path.isfile( configURI ) and - os.path.getsize( configURI ) ): - try: - xmldoc = xml.dom.minidom.parse( configURI ) - except xml.parsers.expat.ExpatError as value: - self.panic("configuration file parsing failed, %s" % str( value ) ) - return False - except xml.dom.DOMException as value: - self.panic("configuration file parsing failed, %s" % str( value ) ) - return False - - - if ( xmldoc ): - self.debug("will try to extract <config> tags...") - self.__handleConfigNodes( xmldoc ) - self.debug("done!") - return xmldoc - - - ## scan reference root file and dump its contents to dom xml nodes - # @param self "Me, myself and Irene" - # @param target ROOT.TDirectory to scan - # @param configNode XML DOM Element - # @param level level of recursion to pretty print - def __scan( self, target, configNode, level=1 ): - - nbsp = " " * level - target.cd() - path = target.GetPath().split(":")[1] - curdir = ROOT.gDirectory - nextkey = ROOT.TIter( curdir.GetListOfKeys() ) - - for ik in range( target.GetNkeys() ): - - key = nextkey.Next() - - obj = key.ReadObj() - name = obj.GetName() - cl = obj.Class().GetName() - isa = obj.IsA() - fp = None - - fp = os.path.join( path, name) - - self.debug( nbsp + "--> found " + name + " of type " + cl ) - - if ( isa.InheritsFrom("TH1") ): - - objDim = obj.GetDimension() - self.debug( nbsp + " --> found object '%s' at location '%s' of name '%s'" % ( cl, path, name) ) - - if ( objDim <= 2 ): - objNode = self.xmldoc.createElement( "hist%dD" % objDim ) - objNode.setAttribute( "name", name ) - if self.opts.flat: - objNode.setAttribute( "mon", fp ) - objNode.setAttribute( "type", cl ) - objNode.setAttribute( "plotopts", "" ) - if ( "TProfile" in cl ): - if ( "meany" in self.opts.tests ): - objNode.setAttribute( "tests", "meany" ) - else: - tests = self.opts.tests[:] - if ( "meany" in tests ): tests.remove("meany") - objNode.setAttribute( "tests", ",".join(tests) ) - configNode.appendChild( objNode ) - else: - self.warn("dimension > 2 for histogram '%s', skipping" % fp) - - elif ( isa.InheritsFrom("TGraph") or isa.InheritsFrom("TEfficiency") ): - - self.debug( nbsp + " --> found object '%s' at location '%s' of name '%s'" % ( cl, path, name) ) - - objNode = self.xmldoc.createElement( "graph" ) - objNode.setAttribute( "name", name ) - if self.opts.flat: - objNode.setAttribute( "mon", fp ) - objNode.setAttribute( "type", cl ) - objNode.setAttribute( "plotopts", "" ) - configNode.appendChild( objNode ) - - #elif ( isa.InheritsFrom("TGraph2D") ): - # self.debug( nbsp + " --> found object %s at location %s of name %s" % ( cl, path, name) ) - - # objNode = self.xmldoc.createElement( cl ) - # objNode.setAttribute( "name", name ) - # configNode.appendChild( objNode ) - - elif ( isa.InheritsFrom("TDirectory") ): - self.debug( nbsp +" --> found TDirectory=" + fp ) - - if self.opts.flat: - self.__scan( obj, configNode, level ) - else: - dirNode = self.xmldoc.createElement("TDirectory") - dirNode.setAttribute( "name", name ) - - configNode.appendChild( dirNode ) - - self.__scan( obj, dirNode, level+1 ) - - else: - self.warn( nbsp +" --> unsupported object of type '%s' found at '%s'" % ( cl, fp ) ) - pass - - return configNode - - - ## - # @param self "Me, myself and Irene" - def __DOMXML( self ): - return self.xmldoc - -## -# @class test_DCubeConfig -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief test case for DCubeConfig class -class test_DCubeConfig( unittest.TestCase ): - - - ## test suite setup - # @param self "Me, myself and Irene" - def setUp( self ): - - import sys - def sysExit( value ): - pass - sys.exit = sysExit - - DCubeUtils.DCubeLogger("test_DCubeConfig.log", "test_DCubeConfig", True ) - self.log = DCubeUtils.DCubeLogger.getLogger( self ) - - self.info = self.log.info - - self.args = [ __file__, - "-c", "dcube_config.xml", - "-r" , "reference.root", - "-t", "bbb", "KS", - "--branch", "dev", - "--project", "AtlasProduction" ] - self.parser = DCubeOptParser() - self.parsed = self.parser.parse( self.args ) - - - - self.config = DCubeConfig( self.parsed ) - - - ## test constructor - # @param self "Me, myself and Irene" - def test_01_constructor( self ): - try: - self.config = DCubeConfig( self.parsed ) - except Exception: - pass - self.assertEqual( isinstance( self.config, DCubeConfig), True ) - - ## test generate() - # @param self "Me, myself nad Irene" - def test_02_generate( self ): - self.config.generate() - - ## test get() - # @param self "Me, myself and Irene" - def test_03_get( self ): - configNode = self.config.getConfig( strict = False ) - print(configNode) - - - - -if __name__ == "__main__": - - testLoader = unittest.TestLoader() - suite = testLoader.loadTestsFromTestCase(test_DCubeConfig) - unittest.TextTestRunner(verbosity=3).run(suite) - - diff --git a/Tools/DCubeClient/python/DCubeOptParser.py b/Tools/DCubeClient/python/DCubeOptParser.py deleted file mode 100644 index fde2925724ebe546b4df7489b84b36017e9e808e..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/DCubeOptParser.py +++ /dev/null @@ -1,690 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -## -# @file DCubeClient/python/DCubeOptParser.py -# @author Krzysztof Danile Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief implementation of DCubeOptParser - -import sys,os,re -import optparse -from DCubeUtils import DCubeObject, DCubeLogger, DCubeSingleton, DCubeVersion -from DCubeValid import DCubeValid -import unittest - - -## -# @class DCubeOptParser -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief sys.argv parser for DCube -class DCubeOptParser( object ): - - ## forcing to be a singleton - __metaclass__ = DCubeSingleton - - ## c'tor - # @param self "Me, myself and Irene" - # @param opts options to parse - # @param args args to parse - def __init__( self ): - - - self.valid = None - - today = "today" - try: - from datetime import date - today = date.today().isoformat() - except Exception: - pass - - usage = "dcube.py [options] [args] [MONITORED.root]" - - self.__version = DCubeVersion() - self.__par = optparse.OptionParser( usage=usage, version=self.__version.version() ) - - self.__par.add_option( "-v", - "--verbose", - action="callback", - callback=self.verbose_callback, - dest="verbosity", - help="more verbose console output (INFO level). -vv for DEBUG. Log file always shows full detail. [default WARNING]") - - self.__par.add_option( "-q", - "--quiet", - action="count", - dest="verbosity", - help="less verbose console output (ERROR level). -qq for CRITICAL, -qqq for no console output.") - - self.__par.add_option( "--checkKnown", - action="callback", - callback=self.checkKnown_callback, - dest="checkKnown", - help="check following options have only known values") - - self.__par.add_option( "-r", - "--reference", - action="store", - type="string", - dest="reference", - metavar="REFERENCE", - help="reference root file" ) - - self.__par.add_option( "-x", - "--xml", - "--output", - action="store", - dest="output", - metavar="OUTPUTXML", - help="output directory or XML file name" ) - - self.__par.add_option( "-c", - "--config", - type="string", - dest="config", - metavar="CONFIGXML", - help="XML configuration file" ) - - self.__par.add_option( "-l", - "--logname", - type="string", - dest="log", - metavar="LOGNAME", - help="log file [default 'dcube.log' in output (-x) directory]" ) - - self.__par.add_option( "-t", - "--tests", - action="callback", - callback=self.tests_callback, - dest="tests", - help="statistics tests to perform: KS(default),chi2,bbb,meany(default),all") - - self.__par.add_option( "-f", - "--pfail", - action="callback", - type="float", - callback=self.check_pfail_callback, - dest="pfail", - help="p-value limit for test failure [default %default]" ) - - self.__par.add_option( "-w", - "--pwarn", - type="float", - action="callback", - callback=self.check_pwarn_callback, - dest="pwarn", - help="p-value limit for test warning [default %default]" ) - - self.__par.add_option( "-d", - "--date", - action="callback", - type="string", - callback=self.isodate_callback, - dest="isodate", - metavar="YYYY-MM-DD", - help="date of run in ISO format [default '%default']") - - self.__par.add_option( "-s", - "--server", - type="string", - dest="server", - metavar="DCUBESERVER", - help="path to DCubeServer") - - self.__par.add_option( "--branch", - type="string", - action="callback", - callback=self.branch_callback, - dest="branch", - help="branch name [default '%default']" ) - - self.__par.add_option( "--cmtconfig", - type="string", - action="callback", - callback=self.cmtconfig_callback, - dest="cmtconfig", - help="CMTCONFIG name [default '%default']" ) - - self.__par.add_option( "--release", - "--install", - type="string", - action="callback", - callback=self.install_callback, - dest="install", - help="release or install name [default '%default']" ) - - self.__par.add_option( "--project", - type="string", - action="callback", - callback=self.project_callback, - dest="project", - help="project name [default '%default']" ) - - self.__par.add_option( "--jobId", - type="string", - dest="jobId", - help="job identification name [default '%default']") - - self.__par.add_option( "-g", - "--generate", - action="store_true", - dest="generate", - help="trigger for configuration file generation [default off]") - - self.__par.add_option( "-p", - "--plots", - action="store_true", - dest="makeplots", - help="trigger for histograms plots generation [default off]") - - - self.__par.add_option( "-b", - action="store_true", - dest="batch", - help="batch mode for PyROOT [always on]") - - - self.__par.add_option( "--useVarNameForPlotName", - action="store_true", - dest="useVarNameForPlotName", - help="Name output plots after the variable they contain [default: use a generated UUID as name]") - - self.__par.add_option( "--flat", - action="store_true", - dest="flat", - help="generate XML config with flat structure in a single <TDirectory>, specifying path with 'mon' attributes [default: generate hierarchical structure]") - - self.__par.set_defaults( verbosity=3, - checkKnown=False, - pwarn=0.95, - pfail=0.75, - config="dcube_config.xml", - output="", - log="", - tests=["KS", "meany"], - isodate=today, - server="", - generate=False, - makeplots=False, - useVarNameForPlotName=False, - flat=False) - - - - ## prints out help - # @param self "Me, myself and Irene" - def help( self ): - self.__par.print_help() - print(self.valid) - - ## prints out usage - # @param self "Me, myself and Irene" - def usage( self ): - self.__par.print_usage() - - ## prints out version - # @param self "Me, myself and Irene" - def version( self ): - self.__par.print_version() - - ## parses arguments - # @param self "Me, myself and Irene" - # @param args list of arguments to parse (default sys.argv[1:]) - # @return tuple ( argumenst, optparse.Values ) - def parse( self, args = sys.argv[1:] ): - - opts, args = self.__par.parse_args( args ) - - if opts.generate: - defaults = { - "branch": "*", - "cmtconfig": "*", - "install": "*", - "project": "*", - "jobId": "*", - } - else: - defaults = { - "branch": os.environ.get("AtlasBuildBranch","*"), - "cmtconfig": os.environ.get("CMTCONFIG","*"), - "install": (os.environ.get("AtlasBuildStamp" if os.environ.get("AtlasReleaseType","")=="nightly" else "AtlasVersion","*")), - "project": os.environ.get("AtlasProject","*"), - "jobId": re.sub(r"^test_",r"",re.sub(r"\.\w+$","",os.environ.get("ArtJobName","*"))), - } - for o,v in defaults.items(): - if getattr( opts, o, None ) is None: - setattr( opts, o, v ) - - #if ( opts.generate and not opts.reference ): - # print "can't generate DCube config, reference root file not set (use -r, --reference)" - # self.usage() - # sys.exit(0) - #if ( ( opts.config and not opts.generate ) and len(args) < 2 ): - # self.usage() - # sys.exit(0) - - return ( opts, args ) - - - - ## - # @param self "Me, myself and Irene" - # @param option option name - # @param opt_str option long name - # @param value returned value - # @param parser OptParser instance - def checkKnown_callback( self, option , opt_str, value, parser ): - self.valid = DCubeValid() - parser.values.checkKnown= True - - ## - # @param self "Me, myself and Irene" - # @param option option name - # @param opt_str option long name - # @param value returned value - # @param parser OptParser instance - def verbose_callback( self, option , opt_str, value, parser ): - parser.values.verbosity -= 1 - - ## - # @param self "Me, myself and Irene" - # @param option option name - # @param opt_str option long name - # @param value returned value - # @param parser OptParser instance - def check_generation_callback( self, option , opt_str, value, parser ): - - print(parser.values.reference) - if ( not parser.values.reference ): - pass - - ## check pwarn value - # @param self "Me, myself and Irene" - # @param option option name - # @param opt_str option long name - # @param value returned value - # @param parser OptParser instance - def check_pwarn_callback( self, option, opt_str, value, parser ): - - if ( value > 1.0 or value < 0.0 ): - raise optparse.OptionValueError("%s value %f out of range (0, 1)" % (opt_str, value ) ) - - if ( ( "-f", "--pfail" ) not in parser.rargs ): - if ( value <= parser.values.pfail ): - raise optparse.OptionValueError("value for %s <= p-value failure (%f <= %f)" % ( opt_str, - value, - parser.values.pfail ) ) - - setattr( parser.values, option.dest, value ) - - ## callback for -f and -pfail options - # @param self "Me, myself and Irene" - # @param option option name - # @param opt_str option long name - # @param value returned value - # @param parser OptParser instance - def check_pfail_callback( self, option, opt_str, value, parser ): - - if ( value > 1.0 or value < 0.0 ): - raise optparse.OptionValueError("%s value %f out of range (0, 1)" % (opt_str, value ) ) - - if ( ( "-w", "--pwarn" ) not in parser.rargs ): - if ( value >= parser.values.pwarn ): - raise optparse.OptionValueError("value for %s >= p-value warning (%f >= %f)" % ( opt_str, - value, - parser.values.pwarn ) ) - - setattr( parser.values, option.dest, value ) - - ## callback for "-d" and "--date" options - # @param self "Me, myself and Irene" - # @param option option name - # @param opt_str option long name - # @param value returned value - # @param parser OptParser instance - def isodate_callback( self, option, opt_str, value, parser ): - info = ( opt_str, value ) - - if ( ( "-" not in value ) or - ( value.count("-") != 2 ) ): - raise optparse.OptionValueError("%s option value (=%s) error, not in ISO date format (YYYY-MM-DD)!" % info ) - - year, month, day = value.split("-") - - try: - year = int(year) - except ValueError as value: - raise optparse.OptionValueError("%s option value (=%s) error, year isn't an integer!" % info ) - - try: - month = int(month) - except ValueError as value: - raise optparse.OptionValueError("%s option value (=%s) error, month isn't an integer!" % info ) - - try: - day = int(day) - except ValueError as value: - raise optparse.OptionValueError("%s option value (=%s) error, day isn't an integer!" % info ) - - try: - from datetime import datetime - datetime( year, month, day, 0, 0, 0 ) - except ValueError as val: - raise optparse.OptionValueError("%s option value (=%s) error, %s" % ( opt_str, value, val ) ) - - setattr( parser.values, option.dest, value ) - - ## callback for parsing "-t" and "--tests" options - # @param self "Me, myself and Irene" - # @param option option name - # @param opt_str option long name - # @param value option value - # @param parser OptParser instance - def tests_callback( self, option, opt_str, value, parser ): - assert value is None - done = 0 - value = [] - rargs = parser.rargs - while rargs: - arg = rargs[0] - if ( (arg[:2] == "--" and len(arg) > 2) or - (arg[:1] == "-" and len(arg) > 1 and arg[1] != "-") ): - break - else: - if ( arg in ("KS", "chi2", "bbb", "all", "meany" ) ): - value.append(arg) - del rargs[0] - else: - raise optparse.OptionValueError("unknown statistics test value '%s'" % arg ) - - if ( "all" in value ): value = [ "KS", "bbb", "chi2", "meany" ] - assert len(value) != 0 - setattr( parser.values, option.dest, value ) - - - ## callback for parsing --branch option - # @param self "Me, myself and Irene" - # @param option option string - # @param opt_str long option name - # @param value option value - # @param parser OptParser instance - def branch_callback( self, option, opt_str, value, parser ): - if ( self.valid and "*" not in value ): - found = False - for k, v in self.valid.branches().items(): - if ( v.match( value ) ): - found = True - if ( not found ): - print(self.valid.listBranches()) - raise optparse.OptionValueError("invalid %s option value '%s'" % (option, value ) ) - setattr( parser.values, option.dest, value ) - - - ## callback for parsing --install option - # @param self "Me, myself and Irene" - # @param option option string - # @param opt_str long option name - # @param value option value - # @param parser OptParser instance - def install_callback( self, option, opt_str, value, parser ): - if ( self.valid and "*" not in value ): - if ( value not in self.valid.installs() ): - print(self.valid.listInstalls()) - raise optparse.OptionValueError("invalid %s option value '%s'" % (option, value) ) - setattr( parser.values, option.dest, value ) - - - ## callback for parsing --cmtconfig option - # @param self "Me, myself and Irene" - # @param option option string - # @param opt_str long option name - # @param value option value - # @param parser OptParser instance - def cmtconfig_callback( self, option, opt_str, value, parser ): - if ( self.valid and "*" not in value ): - if ( value not in self.valid.cmtconfigs() ): - print(self.valid.listCmtconfigs()) - raise optparse.OptionValueError("invalid %s option value '%s'" % (option, value) ) - setattr( parser.values, option.dest, value ) - - ## callback for parsing --project option - # @param self "Me, myself and Irene" - # @param option option string - # @param opt_str long option name - # @param value option value - # @param parser OptParser instance - def project_callback( self, option, opt_str, value, parser ): - if ( self.valid and "*" not in value ): - if ( value not in self.valid.projects() ): - print(self.valid.listProjects()) - raise optparse.OptionValueError("invalid %s option value '%s'" % (option, value) ) - setattr( parser.values, option.dest, value ) - - - -## -# @class test_DCubeOptParse -# @author Krzysztof Daniel Ciba (Krzsyztof.Ciba@NOSPAMgmail.com) -# @brief test case for DCubeOptParser -class test_DCubeOptParser( unittest.TestCase ): - - ## test suite setup - # @param self "Me, myself and Irene" - def setUp( self ): - - self.logger = DCubeLogger( "test_DCubeOptParser.log", logName="test_DCubeParser", toConsole=True ) - - opts = [ ] - args = [ __file__, "-h" ] - - self.opt = DCubeOptParser( ) - - self.log = self.logger.getLogger(self) - - self.info = self.logger.info - - - ## c'tor - # @param self "Me, myself and Irene" - def test_01_constructor( self ): - try: - self.opt = DCubeOptParser() - except Exception: - pass - - self.assertEqual( isinstance( self.opt, DCubeOptParser), True ) - - ## usage(), version(), help() - # @param self "Me, myself and Irene" - def test_02_printouts( self ): - self.opt.version() - self.opt.usage() - self.opt.help() - - ## parse() - # @param self "Me, myself and Irene" - def test_03_parse( self ): - - - self.info( "sys.argv[1:] = %s" % str( sys.argv[1:] ) ) - args, opts = self.opt.parse() - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - - sysExitHolder = sys.exit - def sysExit( value ): - print("sys.exit called with value = %s" % str(value)) - sys.exit = sysExit - - args = [ __file__, "-h"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - - args = [ __file__, "--version"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - - - args = [ __file__, "-g"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.generate = %s " % args.generate ) - - - args = [ __file__, "-c", "configuration.xml"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.config = %s " % args.config ) - - args = [ __file__, "-x", "output.xml"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.output = %s " % args.output ) - - args = [ __file__, "-r", "reference.xml"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.reference = %s " % args.reference ) - - args = [ __file__, "-d", "2008-12-24"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.isodate = %s " % args.isodate ) - - args = [ __file__, "-t", "KS", "bbb", "chi2"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.tests = %s " % str(args.tests) ) - - args = [ __file__, "-t", "all"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.tests = %s " % str(args.tests) ) - - args = [ __file__, "-t", "KS", "bbb"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.tests = %s " % str(args.tests) ) - - args = [ __file__, "--date", "2008-02-31"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - - args = [ __file__, "-w", "0.85"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.pwarn = %s " % str(args.pwarn) ) - - args = [ __file__, "-f", "0.65"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.pfail = %s " % str(args.pfail) ) - - args = [ __file__, "-f", "-1"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.pfail = %s " % str(args.pfail) ) - - args = [ __file__, "-f", "2"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.pfail = %s " % str(args.pfail) ) - - args = [ __file__, "-w", "-1"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.pwarn = %s " % str(args.pwarn) ) - - args = [ __file__, "-w", "2"] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.pwarn = %s " % str(args.pwarn) ) - - args = [ __file__, "-f", "0.65" , "-w", "0.85" ] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - self.info( "args (after) =%s" % str(args) ) - self.info( "opts (after) =%s" % str(opts) ) - self.info( "args.pfail = %s " % str(args.pfail) ) - self.info( "args.pwarn = %s " % str(args.pwarn) ) - - args = [ __file__, "-w", "0.65" , "-f", "0.85" ] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - - args = [ __file__, "-f", "0.75" , "-w", "0.65" ] - self.info( "args (before) =%s" % str(args) ) - args, opts = self.opt.parse( args ) - - - def test_04_callback( self ): - args = [ __file__, "--branch", "blah" ] - args, opts = self.opt.parse( args ) - - args = [ __file__, "--branch", "14.2X.Y" ] - args, opts = self.opt.parse( args ) - self.info( "args.branch = %s" % str(args.branch) ) - - - args = [ __file__, "--install", "blah" ] - args, opts = self.opt.parse( args ) - - args = [ __file__, "--install", "build" ] - args, opts = self.opt.parse( args ) - self.info( "args.install = %s" % str(args.install) ) - - args = [ __file__, "--cmtconfig", "blah" ] - args, opts = self.opt.parse( args ) - - args = [ __file__, "--cmtconfig", "i686-slc4-gcc34-opt" ] - args, opts = self.opt.parse( args ) - self.info( "args.cmtconfig = %s" % str(args.cmtconfig) ) - - - args = [ __file__, "--project", "blah" ] - args, opts = self.opt.parse( args ) - - args = [ __file__, "--project", "AtlasProduction" ] - args, opts = self.opt.parse( args ) - self.info( "args.cmtconfig = %s" % str(args.cmtconfig) ) - - -## test suite execution -if __name__ == "__main__": - - testLoader = unittest.TestLoader() - suite = testLoader.loadTestsFromTestCase(test_DCubeOptParser) - unittest.TextTestRunner(verbosity=3).run(suite) - diff --git a/Tools/DCubeClient/python/DCubePHPWriter.py b/Tools/DCubeClient/python/DCubePHPWriter.py deleted file mode 100644 index 8bbc2efa443cb0240f9ef1076f34ac6c3a0561e6..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/DCubePHPWriter.py +++ /dev/null @@ -1,177 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -## -# @file DCubeClient/python/DCubePHPWriter.py -# @author Krzyszotf Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief implementation of DCubePHPWriter and test_DCubePHPWriter classes - -import sys -import os -from time import strftime, localtime, strptime -from DCubeUtils import DCubeObject, DCubeException, DCubeVersion -from DCubeOptParser import DCubeOptParser - -import unittest - -## -# @class DCubePHPWriter -# @author Krzysztof Daniel Ciba (Krzytof.Ciba@NOSPAMgmail.com) -# @brief PHP files producer -class DCubePHPWriter( DCubeObject ): - - ## c'tor - # @param self "My, myself and Irene" - # @param parsed opts and args from DCubeOptParser - def __init__( self, parsed ): - super( DCubePHPWriter, self ).__init__( self ) - self.opts, self.args = parsed - - - ## give relative path between target and base - # @param self "Me, myself and Irene" - # @param target target directory name - # @param base base directory name - def __relpath( self, target, base="." ): - - if ( not os.path.exists(target) ): - self.error( "target directory %s does not exist" % target ) - - if ( not os.path.isdir(base) ): - self.warn( "base %s is not a directory or does not exist" % base ) - - - base_list = (os.path.abspath(base)).split(os.sep) - target_list = (os.path.abspath(target)).split(os.sep) - - for i in range(min(len(base_list), len(target_list))): - if base_list[i] != target_list[i]: break - else: - i+=1 - - rel_list = [os.pardir] * (len(base_list)-i) + target_list[i:] - return os.path.join(*rel_list) - - ## php heading string - # @param self "Me, myself and Irene" - def __head( self ): - return "<?php\n" - - ## php tail string - # @param self "Me, myself and Irene" - def __tail( self ): - return "?>\n" - - ## php comment string - # @param self "Me, myself and Irene" - def __comment( self, what="output" ): - - out = "/**\n" - out += " * DCubeClient PHP %s file\n" % what - out += " * autogenerated using %s\n" % DCubeVersion().version() - out += " * on %s\n" % strftime("%a, %d %b %Y %H:%M:%S %Z" , localtime()) - out += " * Files:\n" - out += " * [1] monitored file = %s\n" % str( self.opts.monitored ) - out += " * [2] reference file = %s\n" % str( self.opts.reference ) - out += " * [3] config XML file = %s\n" % str( self.opts.config ) - out += " * [4] output XML file = %s\n" % str( self.opts.output ) - out += " * [5] log file = %s\n" % str( self.opts.log ) - out += " *\n" - out += " * ***************************************************\n" - out += " * * !!! WARNINIG !!! *\n" - out += " * * make sure that dcube.php is in PHP include path *\n" - out += " * ***************************************************\n" - out += " *\n" - out += " *\n" - out += " * ***************************************************\n" - out += " * * !!! WARNINIG !!! *\n" - out += " * * make sure to put relative path from your result *\n" - out += " * * directory to the the directory with dcube.php *\n" - out += " * ***************************************************\n" - out += " *\n" - - return out - - ## body of output PHP file - # @param self "Me, myself and Irene" - def __bodyPHP( self ): - out = "/* ADD TO include_path TO LOCAL INSTALLATION OF DCUBE PHP PART */\n" - out += "$where = \"DCubeServer\";\n" - out += "set_include_path($where);\n"; - out += "require \"dcube.php\";\n\n"; - - out += "$xml_file = \"%s\";\n" % os.path.basename(self.opts.output) - out += "$log_file = \"%s\";\n" % os.path.basename(self.opts.log ) - out += "$dcube = new dcube( $xml_file, $log_file, $where );\n" - return out - - ## body for log php file - # @param self "Me, myself and Irene" - def __bodyLOG( self ): - out = "/* ADD TO include_path TO LOCAL INSTALLATION OF DCUBE PHP PART */\n"; - out += "$where = \"DCubeServer\";\n" - out += "set_include_path($where);\n" - out += "require \"rw.php\";\n\n" - out += "$log_file = \"%s\";\n" % os.path.basename(self.opts.log) - out += "$page = new rainbow( $log_file );\n" - return out - - ## dcube output PHP file contents - # @param self "Me, myself and Irene" - def dcubePHP( self ): - out = self.__head() - out += self.__comment() - out += self.__bodyPHP() - out += self.__tail() - return out - - - ## dcube log PHP file contents - # @param self "Me, myself and Irene" - def dcubeLOG( self ): - out = self.__head() - out += self.__comment( "log" ) - out += self.__bodyLOG() - out += self.__tail() - return out - - -## -# @class test_DCubePHPWriter -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief test case for DCubePHPWriter class -class test_DCubePHPWriter( unittest.TestCase ): - - ## test case setup - # @param self "Me, myself and Irene" - def setUp( self ): - sys.argv = [__file__, "-r", "testRef.root", "-s", "/path/to/server/", "-x", "output.xml", "montitored.root" ] - self.parsed = DCubeOptParser().parse( sys.argv ) - self.parsed[0]._update_loose( { "monitored" : "monitored.root" } ) - - ## c'tor - # @param self "Me, myself and Irene" - def test_01_ctor( self ): - try: - self.phpWriter = DCubePHPWriter( self.parsed ) - except: - pass - self.assertEqual( isinstance(self.phpWriter, DCubePHPWriter), True) - - - ## dcubePHP nad dcubeLOG - # @param self "Me, myself and Irene" - def test_02_writer( self ): - phpWriter = DCubePHPWriter( self.parsed ) - print(phpWriter.dcubePHP( )) - print(phpWriter.dcubeLOG( )) - - -## test suite execution -if __name__ == "__main__": - testLoader = unittest.TestLoader() - suite = testLoader.loadTestsFromTestCase(test_DCubePHPWriter) - unittest.TextTestRunner(verbosity=3).run(suite) - - - diff --git a/Tools/DCubeClient/python/DCubePlotter.py b/Tools/DCubeClient/python/DCubePlotter.py deleted file mode 100644 index 14135f07ebf4e391c9352fc2a3d8b583b0a64d3d..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/DCubePlotter.py +++ /dev/null @@ -1,1160 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -## -# @file DCubeClient/python/DCubePlotter.py -# @author Krzysztof Daniel Ciba (Krzyszotf.Ciba@NOSPAgmail.com) -# @brief implementation of DCubePlotter, DCubeStyle and test_DCubePlotter classes -# -# Bez wzgledu na to jak idiotoodporny jest twoj program, zawsze znajdzie -# sie wiekszy idiota. -# - -import os -import ctypes -import uuid -import ROOT -from DCubeUtils import DCubeObject, DCubeException -import unittest - -## -# @class DCubePlotter -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief root plotter for DCubeClient package - - - -class DCubePlotter( DCubeObject ): - - ## DCubePlotter TCanvas - canvas = None - - ## TPaveText with configuration - configPave = None - - ## additional plot options - plotOpts = [] - - ## unzoom factor for yspread - unzoom = 1.4 - - ## c'tor - # @param self "Me, myself and Irene" - # @param xmldoc DOM XML Document instance - # @param parsed tuple with args and opts from option parser - def __init__( self, xmldoc, parsed): - super( DCubePlotter, self).__init__( self ) - self.debug( "constructing DCubePlotter...") - - self.xmldoc = xmldoc - self.opts, self.args = parsed - - self.outputDir = os.path.join( os.path.dirname( self.opts.output ), "plots" ) - self.info("will store all plots in directory %s" % self.outputDir ) - - try: - if (not os.path.exists( self.outputDir ) ): - os.mkdir( self.outputDir ) - - except: - self.error("cannot create output plot directory, plot creation will be disabled") - self.opts._update_careful( { "makeplots": False } ) - - - self.__applyTStyle() - - ## prepare/return ROOT.TCanvas instance - # @param self "Me, myself and Irene" - def __getCanvas( self ): - - # if ( self.canvas ): del self.canvas - # suggested by Time Adye: 1/05/2011 - if ( self.canvas ): - self.canvas.IsA().Destructor(self.canvas) - - self.canvas = ROOT.TCanvas( "dcube", "dcube" , 600, 600 ) - if ( "logx" in self.plotOpts ): - self.canvas.SetLogx(1) - if ( "logy" in self.plotOpts ): - self.canvas.SetLogy(1) - if ( "logz" in self.plotOpts ): - self.canvas.SetLogz(1) - return self.canvas - - ## set DCube plot dtaw style - # @param self "Me, myself and Irene" - def __applyTStyle( self, name="DCube" ): - - self.debug("setting up DCube plot style...") - - ROOT.gStyle.SetOptTitle(0) - ROOT.gStyle.SetOptStat(0) - ROOT.gStyle.SetOptFit(0) - - ROOT.gStyle.SetFillStyle(1001) - - ROOT.gStyle.SetMarkerSize( 0.8 ) - ROOT.gStyle.SetMarkerStyle( ROOT.kFullCircle ) - - ROOT.gStyle.SetLabelFont(42, "xyz") - ROOT.gStyle.SetLabelSize(0.03, "xyz") - - ROOT.gStyle.SetTitleFont(42, "xyz") - ROOT.gStyle.SetTitleFontSize(0.04) - - ROOT.gStyle.SetTitleFont(42, "a") - - ROOT.gStyle.SetFuncStyle(1) - ROOT.gStyle.SetFuncWidth(2) - - ROOT.gStyle.SetHistLineColor( ROOT.kBlack ) - ROOT.gStyle.SetHistFillColor( ROOT.kRed ) - ROOT.gStyle.SetHistLineWidth(1) - - ROOT.gStyle.SetPadBorderSize(1) - ROOT.gStyle.SetPadBorderMode(0) - - ROOT.gStyle.SetPadLeftMargin( 0.1 ) - ROOT.gStyle.SetPadBottomMargin( 0.1 ) - ROOT.gStyle.SetPadRightMargin( 0.1 ) - ROOT.gStyle.SetPadTopMargin( 0.1 ) - - ROOT.gStyle.SetCanvasBorderSize(1) - ROOT.gStyle.SetCanvasBorderMode(0) - - ROOT.gStyle.SetGridStyle(3) - ROOT.gStyle.SetGridWidth(1) - - ROOT.gStyle.SetOptDate(21) - ROOT.gStyle.GetAttDate().SetTextFont(42) - ROOT.gStyle.GetAttDate().SetTextSize(0.025) - - ROOT.gStyle.SetLegendBorderSize(1) - - ROOT.gStyle.SetTextColor( ROOT.kBlack ) - ROOT.gStyle.GetAttDate().SetTextColor( ROOT.kBlack ) - ROOT.gStyle.SetLabelColor(ROOT.kBlack, "xyz") - ROOT.gStyle.SetTitleColor(ROOT.kBlack, "xyz") - - ROOT.gStyle.SetFillColor( ROOT.kWhite ) - ROOT.gStyle.SetMarkerColor( ROOT.kBlue ) - ROOT.gStyle.SetCanvasColor( ROOT.kWhite ) - - ROOT.gStyle.SetFrameFillColor(ROOT.kWhite) - ROOT.gStyle.SetPadColor( ROOT.kGray ) - ROOT.gStyle.SetTitleColor(390, "a") - ROOT.gStyle.SetFuncColor(ROOT.kOrange) - - ROOT.gStyle.SetGridColor(1) - - ROOT.gStyle.SetCanvasDefH( 800 ) - ROOT.gStyle.SetCanvasDefW( 800 ) - - ROOT.gROOT.ForceStyle(1) - self.debug("done!") - - - ## get unique plot name - # @param self "Me, myself and Irene" - def __plotName( self, what="" ): - name = str(uuid.uuid4()) - if self.opts.useVarNameForPlotName: - name = self.name - return what + "_" + name + ".png" - - ## plot dispatcher - # @param self "Me, myself and Irene" - # @param node DOM XML element - # @param mon monitored object - # @param ref reference object - # @param opts additional plot options - def plot( self, node, mon=None, ref=None, opts=None ): - - self.mon = self.ref = self.node = None - - self.debug("plot called for object of name " + node.getAttribute("name") ) - - self.node = node - self.mon = mon - self.ref = ref - - - self.plotOpts = [] - - if ( opts != "" ): - plotOpts = [ opt.strip().lower() for opt in opts.split(";") ] - #self.debug("additional plot options are: '%s'" % str(plotOpts) ) - - for opt in plotOpts: - if ( opt not in [ "logx", "logy", "logz", "norm", "enorm", "box" ] ): - self.error("ignoring unknown additional plot option '%s'" % opt ) - else: - self.plotOpts.append(opt) - if opt == "enorm": self.plotOpts.append("norm") - self.debug("additional plot options are: '%s'" % str(plotOpts) ) - - - if ( not self.mon ): - self.error("monitored object not found, creation of plots skipped!") - return "FAIL" - - self.name = self.mon.GetName() - self.title = self.mon.GetTitle() - - if ( not self.ref ): - self.warn("reference object not found, not all plots will be produced") - - self.className = mon.Class().GetName() - - status = "OK" - if ( "TGraph" in self.className ): - status = self.__plotGraph() - elif ( "TH1" in self.className ): - if ( "norm" in self.plotOpts ): - self.__normTH( self.mon ) - self.__normTH( self.ref ) - status = self.__plotTH1() - elif ( "TH2" in self.className ): - if ( "norm" in self.plotOpts ): - self.__normTH( self.mon ) - self.__normTH( self.ref ) - status = self.__plotTH2() - elif ( "TProfile" == self.className ): - if ( "norm" in self.plotOpts ): - self.__normTH( self.mon ) - self.__normTH( self.ref ) - status = self.__plotProf1D() - elif ( "TProfile2D" == self.className ): - if ( "norm" in self.plotOpts ): - self.__normTH( self.mon ) - self.__normTH( self.ref ) - status = self.__plotProf2D() - else: - self.error( "unsupported object name=%s class=%s" % ( self.name, self.className ) ) - status = "FAIL" - - return status - - ## save TCanvas to png file - # @param self "Me, myself and Irene" - # @param type string with type attribute - # @param plot plot file naem prefix - # @return status string - def __saveAs( self, canvas, type, plot ): - try: - plotName = self.__plotName( plot ) - absPath = os.path.join( self.outputDir, plotName ) - canvas.Update() - canvas.SaveAs( absPath ) - imgNode = self.xmldoc.createElement( "img" ) - imgNode.setAttribute( "src" , os.path.join( "plots", plotName ) ) - imgNode.setAttribute( "type", type ) - if ( os.path.exists(absPath) ): - self.debug("plot '%s' has been created" % absPath ) - self.node.appendChild( imgNode ) - return "OK" - else: - self.warn("problem when saving plot '%s' to file" % absPath ) - return "WARN" - except: - self.warn("unknown error when plotting %s for %s" % ( type, self.name ) ) - - return "WARN" - - - ## plotter for TGraph, TGraphError, TGraphAsymmError etc. - # @param self "Me, myself and Irene" - def __plotGraph( self ): - - status = [ "OK" ] - self.debug("plotting %s of type %s" % ( self.name, self.className ) ) - - title = "%s;%s;%s" % ( self.mon.GetTitle(), - self.mon.GetXaxis().GetTitle(), - self.mon.GetYaxis().GetTitle() ) - graph = ROOT.TMultiGraph() - - canvas = self.__getCanvas() - canvas.cd() - - xmin, xmax, ymin, ymax = self.__getMinMaxTGraph( self.mon, self.ref ) - - dy = abs(ymax - ymin) - y0 = ymin - dy * 0.1 - if ymin >= 0.0 and y0 < 0.0: y0 = 0.0 - ymin= y0 - ymax = ymax + dy * (self.unzoom-1.0) - - ROOT.gPad.DrawFrame( xmin, ymin, xmax, ymax, title) - -## remove unneeded padding (10/7/2017) -# ROOT.gStyle.SetPadBottomMargin(0.2) - - - self.mon.SetMarkerStyle( ROOT.kFullCircle ) - self.mon.SetMarkerColor( ROOT.kRed ) - self.mon.SetFillColor( ROOT.kRed ) - self.mon.SetFillStyle( 3004 ) - self.mon.SetLineColor( ROOT.kRed ) - - - if ( self.ref ): - - self.ref.SetMarkerStyle( ROOT.kOpenCircle ) - self.ref.SetMarkerColor( ROOT.kBlue ) - self.ref.SetMarkerSize( 1.0 ) - self.ref.SetFillColor( ROOT.kBlue ) - self.ref.SetFillStyle( 3005 ) - self.ref.SetLineColor( ROOT.kBlue ) - - graph.Add( self.ref, "P" ) - - graph.Add( self.mon, "P") - - graph.Draw("P" ) - - legend = self.__legend() - legend.Draw() - - titlePave = self.__titlePave() - titlePave.Draw() - - configPave = self.__configPave() - if ( configPave ): configPave.Draw() - - status.append( self.__saveAs( canvas, "reg", "gr" ) ) - - - if ( None not in ( self.ref, self.mon ) ): - - canvas.Clear() - - diffGraph = ROOT.TGraph() - - diffGraph.SetMarkerColor( ROOT.kRed ) - - monN = self.mon.GetN() - refN = self.ref.GetN() - - monXraw = self.mon.GetX() - monYraw = self.mon.GetY() - - refXraw = self.ref.GetX() - refYraw = self.ref.GetY() - - points = {} - for i in range( monN ): - if ( monXraw[i] not in points ): - points [ monXraw[i] ] = monYraw[i] - for i in range( refN ): - if ( refXraw[i] not in points ): - points[ refXraw[i] ] = refYraw[i] - else: - points[ refXraw[i] ] = points[ refXraw[i] ] - refYraw[i] - i = 0 - for x in sorted( points.keys() ): - diffGraph.SetPoint(i, x, points[x] ) - i += 1 - - xmin, xmax, ymin, ymax = self.__getMinMaxTGraph( diffGraph ) - - dy = abs(ymax - ymin) - y0 = ymin - dy * 0.1 - if ymin >= 0.0 and y0 < 0.0: y0 = 0.0 - ymax = ymax * self.unzoom - if ( ymax == 0.0 ): ymax = ymin + ( abs(ymin) * self.unzoom ) - - ROOT.gPad.DrawFrame( xmin, y0, xmax, ymax, "diff %s" % title) - - diffGraph.SetTitle( self.mon.GetTitle() ) - diffGraph.SetName( self.mon.GetName() ) - - diffGraph.Draw("P") - - titlePave = self.__titlePave("diff (mon - ref)") - titlePave.Draw() - - configPave = self.__configPave() - if ( configPave ): configPave.Draw() - - status.append( self.__saveAs( canvas, "dif", "gd" ) ) - - return self.__getStatus( status ) - - ## get xmin, xmax, ymin, ymax for monitored and reference TGraphs - # @param self "Me, myself and Irene" - def __getMinMaxTGraph( self, mon=None, ref=None ): - - xmin = xmax = ymin = ymax = exmin = exmax = dxmin = None - xd = ctypes.c_double(0) - yd = ctypes.c_double(0) - for g in (ref, mon): - if g: - x0 = None - for i in range( g.GetN() ): - - g.GetPoint(i, xd, yd) - x = float(xd.value) - y = float(yd.value) - - if x0 is not None: - dx = x - x0 - if dx > 0.0 and (dxmin is None or dx < dxmin): dxmin = dx - x0 = x - - if ( self.className == "TGraph" ): - exh = exl = eyh = eyl = 0.0 - else: - exh = g.GetErrorXhigh( i ) - exl = g.GetErrorXlow( i ) - eyh = g.GetErrorYhigh( i ) - eyl = g.GetErrorYlow( i ) - - xh = x + exh - xl = x - exl - yh = y + eyh - yl = y - eyl - - if ( xmin is None or xl < xmin ): xmin, exmin = xl, exl - if ( xmax is None or xh > xmax ): xmax, exmax = xh, exh - if ( ymin is None or yl < ymin ): ymin = yl - if ( ymax is None or yh > ymax ): ymax = yh - - # if no x-errors, add half-bin width - if ( dxmin is not None ): - if ( exmin <= 0.0 ): xmin -= 0.5 * dxmin - if ( exmax <= 0.0 ): xmax += 0.5 * dxmin - - # if no limits, then use graph range - if ref: g = ref - else: g = mon - if g: - if ( xmin is None or xmin >= xmax ): xmin = g.GetHistogram().GetXaxis().GetXmin() - if ( xmax is None or xmin >= xmax ): xmax = g.GetHistogram().GetXaxis().GetXmax() - if ( ymin is None or ymin >= ymax ): ymin = g.GetHistogram().GetYaxis().GetXmin() - if ( ymax is None or ymin >= ymax ): ymax = g.GetHistogram().GetYaxis().GetXmax() - - return ( xmin, xmax, ymin, ymax) - - - def __normTH( self, obj=None ): - if ( obj ): - if ( "enorm" in self.plotOpts ): - self.debug( "will normalize histogram '%s' to the number of entries" % obj.GetName()) - integral = obj.GetEntries() - else: - self.debug( "will normalize histogram '%s'" % obj.GetName()) - integral = obj.Integral() - if ( integral != 0.0 ): - scale = 1.0 / integral - self.debug("integral = %f, scale = %f" % (integral, scale ) ) - obj.Scale( scale ) - else: - self.warn("cannot normalize histogram '%s', Integral = 0.0!" % obj.GetName()) - - ## plotter for TH1 histograms - # @param self "Me, myself and Irene" - def __plotTH1( self ): - - status = [ "OK" ] - self.debug("plotting %s of type %s" % ( self.name, self.className ) ) - - - canvas = self.__getCanvas() - titlePave = self.__titlePave( ) - title = "%s;%s;%s" % ( self.mon.GetTitle(), - self.mon.GetXaxis().GetTitle(), - self.mon.GetYaxis().GetTitle() ) - stack = ROOT.THStack( "dcube stack", title ) - - - - self.mon.SetMarkerColor( ROOT.kRed ) - - self.mon.SetLineColor( ROOT.kRed ) - self.mon.SetFillStyle( 3004 ) - self.mon.SetLineColor( ROOT.kRed ) - - ymax = self.mon.GetMaximum() - ymin = self.mon.GetMinimum() - - if ( self.ref ): - - self.ref.SetMarkerStyle( ROOT.kOpenCircle ) - self.ref.SetMarkerColor( ROOT.kBlue ) - self.ref.SetMarkerSize( 1.0 ) - - self.ref.SetFillColor( ROOT.kBlue ) - self.ref.SetLineColor( ROOT.kBlue ) - self.ref.SetFillStyle( 3005 ) - - - stack.Add( self.ref ) - - if ( ymax < self.ref.GetMaximum() ): ymax = self.ref.GetMaximum() - if ( ymin > self.ref.GetMinimum() ): ymin = self.ref.GetMinimum() - - stack.Add( self.mon ) - - #yspread = abs( ymax - ymin ) - #self.panic( "ymin, ymax, yspread %f, %f, %f" % ( ymin, ymax, yspread) ) - #ymax = ymin + ( self.unzoom * yspread ) - #self.panic( "ymax %f" % ymax ) - - ymax = ymax * self.unzoom - if ( ymax == 0.0 ): ymax = ymin + ( abs(ymin) * self.unzoom ) - stack.SetMaximum( ymax ) - - - config = self.__configPave() - legend = self.__legend() - - canvas.cd() - stack.Draw( "NOSTACK" ) - titlePave.Draw() - if ( config ): config.Draw() - legend.Draw() - pvaluePave = self.__pvaluePave() - if ( pvaluePave ): pvaluePave.Draw() - - status.append( self.__saveAs( canvas, "reg", "h1r" ) ) - - - canvas = self.__getCanvas() - diffHist = self.mon.Clone() - diffHist.Reset() - diffHist.SetTitle( "diff %s" % title ) - diffHist.SetLineColor( ROOT.kRed ) - - if ( self.ref ): - diffHist.Add( self.ref, self.mon, 1.0, -1.0 ) - else: - diffHist.Add( self.mon, self.mon, 1.0, -1.0 ) - - canvas.Clear() - canvas.cd() - - titlePave = self.__titlePave( "diff" ) - configPave = self.__configPave() - - ymax = diffHist.GetMaximum() - ymin = diffHist.GetMinimum() - - ymax = ymax * self.unzoom - if ( ymax == 0.0 ): ymax = ymin + ( abs(ymin) * self.unzoom ) - - - if ( ymax ) : diffHist.SetMaximum( ymax ) - - diffHist.Draw( ) - titlePave.Draw() - if ( configPave ): configPave.Draw() - - status.append( self.__saveAs( canvas, "dif", "h1d" ) ) - - return self.__getStatus( status ) - - ## plotter for TH2 histograms - # @param self "Me, myself and Irene" - def __plotTH2( self ): - - status = [ "OK" ] - self.debug( "plotting %s of type %s" % ( self.name, self.className) ) - - canvas = self.__getCanvas() - title = "%s;%s;%s;%s" % ( self.mon.GetTitle(), - self.mon.GetXaxis().GetTitle(), - self.mon.GetYaxis().GetTitle(), - self.mon.GetZaxis().GetTitle() ) - - configPave = self.__configPave( ) - titlePave = self.__titlePave() - pvaluePave = self.__pvaluePave() - - if ( self.ref ): - - bottom = self.mon.Clone() - top = self.mon.Clone() - same = self.mon.Clone() - - bottom.Reset() - bottom.SetLineColor( ROOT.kBlack ) - bottom.SetFillColor( ROOT.kBlue ) - bottom.SetLineWidth( 2 ) - top.Reset() - top.SetLineColor( ROOT.kBlack ) - top.SetFillColor( ROOT.kRed ) - top.SetLineWidth(2) - same.Reset() - same.SetLineColor( ROOT.kBlack ) - same.SetFillColor( ROOT.kGreen ) - same.SetLineWidth( 2) - - for i in range(self.ref.GetNbinsX()+1): - for j in range(self.ref.GetNbinsY()+1 ) : - - refBin = self.ref.GetBinContent(i, j) - monBin = self.mon.GetBinContent(i, j) - - if ( refBin < monBin ): - top.SetBinContent(i, j, monBin - refBin) - bottom.SetBinContent( i, j, refBin ) - elif ( refBin > monBin ): - bottom.SetBinContent( i, j, refBin - monBin) - top.SetBinContent(i, j, monBin) - else: - same.SetBinContent(i, j, refBin ) - - stack = ROOT.THStack( "dcube stack", title ) - stack.Add( same ) - stack.Add( bottom ) - stack.Add( top ) - #stack.UseCurrentStyle() - - Y1NDC = (self.configPave.GetY1NDC() if self.configPave else 0.9) - legend = ROOT.TLegend(0.1, Y1NDC, 0.45, Y1NDC-0.08, "", "NDC") - legend.SetTextFont(102) - legend.SetTextSize(0.02) - legend.SetTextColor(1) - legend.SetBorderSize(1) - - legend.AddEntry( top, "monitored", "F" ) - legend.AddEntry( bottom, "reference", "F" ) - legend.AddEntry( same, "same", "F") - - canvas.cd() - if ( "box" in self.plotOpts ): - stack.Draw( "box nostack" ) - else: - stack.Draw( "lego1 nostack" ) - titlePave.Draw() - if ( configPave ): configPave.Draw() - legend.Draw() - - if ( pvaluePave ): pvaluePave.Draw() - - canvas.Draw() - - else: - canvas.cd() - self.mon.Draw( ) - - if ( configPave ): configPave.Draw() - titlePave.Draw() - if ( pvaluePave ): pvaluePave.Draw() - canvas.Draw() - - status.append( self.__saveAs( canvas, "reg", "h2r" ) ) - - # make diff plot - canvas = self.__getCanvas() - diffHist = self.mon.Clone() - diffHist.Reset() - diffHist.SetFillColor( ROOT.kRed ) - diffHist.SetLineColor( ROOT.kBlack ) - - if ( self.ref ): - diffHist.Add( self.ref, self.mon, 1.0, -1.0 ) - else: - diffHist.Add( self.mon, self.mon, 1.0, -1.0 ) - - canvas.Clear() - if ( "box" in self.plotOpts ): - diffHist.Draw("colz1 0" ) - else: - diffHist.Draw("LEGO1 0" ) - titlePave = self.__titlePave( "diff" ) - titlePave.Draw() - if ( configPave ): configPave.Draw() - if ( pvaluePave ): pvaluePave.Draw() - status.append( self.__saveAs( canvas, "dif", "h2d" ) ) - - - # make projection x plot - canvas = self.__getCanvas() - canvas.Clear() - projX = ROOT.THStack("projectionX", "projectionX") - - monPX = self.mon.ProjectionX( "mon px " + str(self.name) ) - - if ( "norm" in self.plotOpts ): self.__normTH( monPX ) - - monPX.SetFillStyle( 3004 ) - monPX.SetLineColor( ROOT.kRed ) - projX.Add( monPX ) - - ymax = monPX.GetMaximum() - - if ( self.ref ): - refPX = self.ref.ProjectionX( "ref px " + str(self.name) ) - if ( "norm" in self.plotOpts ): self.__normTH( refPX ) - refPX.SetFillStyle( 3005 ) - refPX.SetFillColor( ROOT.kBlue ) - refPX.SetLineColor( ROOT.kBlue ) - if ( ymax < refPX.GetMaximum() ): - ymax = refPX.GetMaximum() - - projX.Add( refPX ) - - projX.SetMaximum( ymax * self.unzoom ) - - canvas.cd() - if ( "logx" in self.plotOpts ): - ROOT.gPad.SetLogx(1) - if ( "logy" in self.plotOpts ): - ROOT.gPad.SetLogy(1) - if ( "logz" in self.plotOpts ): - ROOT.gPad.SetLogz(1) - - projX.Draw( "NOSTACK" ) - - titlePave = self.__titlePave( "proj X") - titlePave.Draw() - if ( pvaluePave ): pvaluePave.Draw() - if ( configPave ): configPave.Draw() - - Y1NDC = (self.configPave.GetY1NDC() if self.configPave else 0.9) - legend = ROOT.TLegend(0.1, Y1NDC, 0.45, Y1NDC-0.06, "", "NDC") - legend.SetTextFont(102) - legend.SetTextSize(0.02) - legend.SetTextColor(1) - legend.SetBorderSize(1) - - legend.AddEntry( monPX, "mon projection X", "F" ) - # if self.ref: - legend.AddEntry( refPX, "ref projection X", "F" ) - legend.Draw() - - status.append( self.__saveAs( canvas, "prx", "h2x" ) ) - - # make projection y plot - canvas = self.__getCanvas() - canvas.cd() - if ( "logx" in self.plotOpts ): - ROOT.gPad.SetLogx(1) - if ( "logy" in self.plotOpts ): - ROOT.gPad.SetLogy(1) - if ( "logz" in self.plotOpts ): - ROOT.gPad.SetLogz(1) - canvas.Clear() - - projY = ROOT.THStack("projectionY", "projectionY") - monPY = self.mon.ProjectionY( "mon py " + str(self.name) ) - if ( "norm" in self.plotOpts ): self.__normTH( monPY ) - monPY.SetFillStyle( 3004 ) - monPY.SetLineColor( ROOT.kRed ) - projY.Add( monPY ) - - ymax = monPY.GetMaximum() - - if ( self.ref ): - refPY = self.ref.ProjectionY( "ref py " + str(self.name) ) - if ( "norm" in self.plotOpts ): self.__normTH( refPY ) - refPY.SetFillStyle( 3005 ) - refPY.SetFillColor( ROOT.kBlue ) - refPY.SetLineColor( ROOT.kBlue ) - if ( ymax < refPY.GetMaximum() ): - ymax = refPY.GetMaximum() - - projY.Add( refPY ) - - projY.SetMaximum( ymax * self.unzoom ) - - canvas.cd() - - projY.Draw("NOSTACK" ) - - titlePave = self.__titlePave( "proj Y") - titlePave.Draw() - if ( configPave ): configPave.Draw() - if ( pvaluePave ): pvaluePave.Draw() - - - Y1NDC = (self.configPave.GetY1NDC() if self.configPave else 0.9) - legend = ROOT.TLegend(0.1, Y1NDC, 0.45, Y1NDC-0.06, "", "NDC") - legend.SetTextFont(102) - legend.SetTextSize(0.02) - legend.SetTextColor(1) - legend.SetBorderSize(1) - - legend.AddEntry( monPY, "mon projection Y", "F" ) - - # if self.ref: - legend.AddEntry( refPY, "ref projection Y", "F" ) - legend.Draw() - - - status.append( self.__saveAs( canvas, "pry", "h2y" ) ) - - return self.__getStatus( status ) - - ## plotter for 1D TProfile - # @param self "Me, myself and Irene" - def __plotProf1D( self ): - status = [ ] - self.debug("plotting %s of type %s" % ( self.name, self.className ) ) - - canvas = self.__getCanvas() - - titlePave = self.__titlePave() - configPave = self.__configPave() - legend = self.__legend() - - self.mon.SetMarkerColor( ROOT.kRed ) - self.mon.SetMarkerSize( 0.9 ) - self.mon.SetFillColor( ROOT.kRed ) - self.mon.SetFillStyle( 3005 ) - self.mon.SetLineColor( ROOT.kRed ) - - ymax = self.mon.GetMaximum() - ymin = self.mon.GetMinimum() - if ( self.ref ): - self.ref.SetMarkerStyle( ROOT.kOpenCircle ) - self.ref.SetMarkerColor( ROOT.kBlue ) - self.ref.SetMarkerSize( 1.0 ) - self.ref.SetFillColor( ROOT.kBlue ) - self.ref.SetFillStyle( 3004 ) - self.ref.SetLineColor( ROOT.kBlue ) - - if ( ymax < self.ref.GetMaximum() ): - ymax = self.ref.GetMaximum() - if ( ymin > self.ref.GetMinimum() ): - ymin = self.ref.GetMinimum() - - - #yspread = abs( ymax) + abs( ymin ) - #ymax = ymin + ( self.unzoom * yspread ) - ymax = ymax * self.unzoom - if ( ymax == 0.0 ): ymax = ymin + ( abs(ymin) * self.unzoom ) - - - self.mon.SetMaximum( ymax ) - if ( self.ref ): self.ref.SetMaximum( ymax ) - - if ( self.ref ): self.ref.Draw( ) - self.mon.Draw( "SAME" ) - - titlePave.Draw() - if ( configPave ): configPave.Draw() - legend.Draw() - - status.append( self.__saveAs( canvas, "reg", "p1r" ) ) - - canvas = self.__getCanvas() - canvas.Clear() - canvas.cd() - - diffProfile = self.mon.Clone() - diffProfile.Reset() - if ( self.ref ): - diffProfile.Add( self.ref, self.mon, 1.0, -1.0 ) - else: - diffProfile.Add( self.mon, self.mon, 1.0, -1.0 ) - - titlePave = self.__titlePave( "diff" ) - - ymin = diffProfile.GetMinimum() - ymax = diffProfile.GetMaximum() - - ymax = ymax * self.unzoom - if ( ymax == 0.0 ): ymax = ymin + ( abs(ymin) * self.unzoom ) - - diffProfile.SetMaximum( ymax ) - - - diffProfile.Draw( ) - titlePave.Draw() - if ( configPave ): configPave.Draw() - - status.append( self.__saveAs( canvas, "dif", "p1d" ) ) - - return self.__getStatus( status ) - - ## plotter for TProfile2D - # @param self "Me, myself and Irene" - def __plotProf2D( self ): - status = [ ] - self.debug("plotting %s of type %s" % ( self.name, self.className ) ) - - canvas = self.__getCanvas() - - titlePave = self.__titlePave() - configPave = self.__configPave() - legend = self.__legend() - - self.mon.SetMarkerColor( ROOT.kRed ) - self.mon.SetMarkerSize( 0.9 ) - self.mon.SetFillColor( ROOT.kRed ) - self.mon.SetFillStyle( 3005 ) - self.mon.SetLineColor( ROOT.kBlack ) - - self.mon = ROOT.TH2D( self.mon ) - - title = "%s;%s;%s;%s" % ( self.mon.GetTitle(), - self.mon.GetXaxis().GetTitle(), - self.mon.GetYaxis().GetTitle(), - self.mon.GetZaxis().GetTitle() ) - - - ymax = self.mon.GetMaximum() - if ( self.ref ): - - self.ref = ROOT.TH2D( self.ref ) - - bottom = self.ref.Clone() - top = self.ref.Clone() - same = self.ref.Clone() - - bottom.Reset() - bottom.SetLineColor( ROOT.kBlack ) - bottom.SetFillColor( ROOT.kBlue ) - bottom.SetLineWidth( 2 ) - top.Reset() - top.SetLineColor( ROOT.kBlack ) - top.SetFillColor( ROOT.kRed ) - top.SetLineWidth(2) - same.Reset() - same.SetLineColor( ROOT.kBlack ) - same.SetFillColor( ROOT.kGreen ) - same.SetLineWidth( 2 ) - - for i in range(self.ref.GetNbinsX()+1): - for j in range(self.ref.GetNbinsY()+1 ) : - - refBin = self.ref.GetBinContent(i, j) - monBin = self.mon.GetBinContent(i, j) - - if ( refBin < monBin ): - top.SetBinContent(i, j, monBin - refBin) - bottom.SetBinContent( i, j, refBin ) - elif ( refBin > monBin ): - bottom.SetBinContent( i, j, refBin - monBin) - top.SetBinContent(i, j, monBin) - else: - same.SetBinContent(i, j, refBin ) - - stack = ROOT.THStack( "dcube stack", title ) - stack.Add( same ) - stack.Add( bottom ) - stack.Add( top ) - - Y1NDC = (self.configPave.GetY1NDC() if self.configPave else 0.9) - legend = ROOT.TLegend(0.1, Y1NDC, 0.45, Y1NDC-0.08, "", "NDC") - legend.SetTextFont(102) - legend.SetTextSize(0.02) - legend.SetTextColor(1) - legend.SetBorderSize(1) - - legend.AddEntry( top, "monitored", "F" ) - legend.AddEntry( bottom, "reference", "F" ) - legend.AddEntry( same, "same", "F") - - canvas.cd() - if ( "box" in self.plotOpts ): - stack.Draw( "box 0 NOSTACK" ) - else: - stack.Draw( "LEGO1 0 NOSTACK" ) - titlePave.Draw() - if ( configPave ): configPave.Draw() - legend.Draw() - - pvaluePave = self.__pvaluePave() - if ( pvaluePave ): pvaluePave.Draw() - canvas.Draw() - - else: - canvas.cd() - self.mon.Draw( ) - if ( configPave ): configPave.Draw() - titlePave.Draw() - canvas.Draw() - - status.append( self.__saveAs( canvas, "reg", "p2r" ) ) - - canvas = self.__getCanvas() - canvas.Clear() - canvas.cd() - - diffProfile = self.mon.Clone() - diffProfile.Reset() - diffProfile.SetFillColor( ROOT.kRed ) - diffProfile.SetLineColor( ROOT.kBlack ) - - if ( self.ref ): - diffProfile.Add( self.ref, self.mon, 1.0, -1.0 ) - else: - diffProfile.Add( self.mon, self.mon, 1.0, -1.0 ) - - titlePave = self.__titlePave( "diff" ) - if ( "box" in self.plotOpts ): - diffProfile.Draw( "colz1 0" ) - else: - diffProfile.Draw( "LEGO1 0" ) - titlePave.Draw() - if ( configPave ): configPave.Draw() - - - status.append( self.__saveAs( canvas, "dif", "p2d" ) ) - - return self.__getStatus( status ) - - - - - ## get status string from a list of strings - # @param self "Me, myself and Irene" - # @param sl list of strings - def __getStatus( self, sl ): - if ( "FAIL" in sl ): return "FAIL" - if ( "WARN" in sl ): return "WARN" - return "OK" - - def __configPave_AddText( self, s1, s2, width=31 ): - if s2 == "" or s2 == "*": return 0 - if len(s1)+len(s2) > width: - s1 = s1.rstrip().ljust(width-len(s2)) - self.configPave.AddText( s1 + s2 ) - return 1 - - ## runtime configuration pave - # @param self "Me, myself and Irene" - def __configPave( self ): - if ( not self.configPave ): - self.configPave = ROOT.TPaveText() - self.configPave.SetMargin( 0.02 ) - self.configPave.SetBorderSize( 1 ) - self.configPave.SetTextColor( 1 ) - self.configPave.SetTextSize( 0.02 ) - self.configPave.SetTextFont( 102 ) - self.configPave.SetTextAlign( 12 ) - lines = 0 - lines += self.__configPave_AddText( "branch: ", self.opts.branch ) - lines += self.__configPave_AddText( "release: ", self.opts.install ) - lines += self.__configPave_AddText( "cmt: ", self.opts.cmtconfig ) - lines += self.__configPave_AddText( "project: ", self.opts.project ) - lines += self.__configPave_AddText( "jobId: ", self.opts.jobId ) - if lines: - self.configPave.SetX1NDC( 0.1 ) - self.configPave.SetY1NDC( 0.9 - (lines*0.020) ) - self.configPave.SetX2NDC( 0.45 ) - self.configPave.SetY2NDC( 0.9 ) - else: - self.configPave = None - return self.configPave - - ## p-value pave - # @param self "Me, myself and Irene" - def __pvaluePave( self ): - pvaluePave = ROOT.TPaveText( ) - pvaluePave.SetBorderSize( 1 ) - pvaluePave.SetTextColor( 1 ) - pvaluePave.SetTextSize( 0.02 ) - pvaluePave.SetTextFont( 42 ) - pvaluePave.SetTextAlign( 12 ) - - lines = 0 - pvalues = self.node.getElementsByTagName( "pvalue" ) - for pvalue in pvalues: - test = pvalue.getAttribute( "test" ) - status = pvalue.getAttribute( "status" ) - pval = self.__getCData( pvalue.childNodes ) - text = "p-value = %s" % pval - - - if test == "chi2": text = "#chi^{2} %s" % text - else: - text = "%-3s %s" % (test, text) - - - text = pvaluePave.AddText( text ) - if ( status == "FAIL" ): - text.SetTextColor( ROOT.kRed ) - if ( status == "WARN" ): - text.SetTextColor( ROOT.kOrange ) - lines += 1 - - if ( lines ): - pvaluePave.SetX1NDC( 0.715 ) - pvaluePave.SetX2NDC( 0.9 ) - pvaluePave.SetY1NDC( 0.9 ) - pvaluePave.SetY2NDC( 0.9 - (lines*0.021) ) - return pvaluePave - - - ## title pave - # @param self "Me, myself and Irene" - def __titlePave( self, what="" ): - titlePave = ROOT.TPaveText( 0.0, 1.0, 1.0, 0.93 , "NDC") - titlePave.SetBorderSize( 0 ) - titlePave.SetTextColor( ROOT.kBlack ) - titlePave.SetTextSize( 0.028 ) - titlePave.SetTextFont( 42 ) - titlePave.SetFillColor( ROOT.kGray ) - titlePave.SetTextAlign( 12 ) - titlePave.AddText( "title: %s" % self.title ) - #titlePave.AddText( "name: %s" % self.name ) - if ( what == "" ): what = "normal" - titlePave.AddText( "%s plot" % what ) - return titlePave - - ## plot legend - # @param self "Me, myself and Irene" - def __legend( self ): - Y1NDC = (self.configPave.GetY1NDC() if self.configPave else 0.9) - legend = ROOT.TLegend(0.1, Y1NDC, 0.45, Y1NDC-0.05, "", "NDC") - legend.SetTextFont(42) - legend.SetTextSize(0.02) - legend.SetTextColor( ROOT.kBlack ) - legend.SetBorderSize(1) - - if ( "TH" in self.className ): - legend.AddEntry( self.mon, "monitored" )#"f" ) - if ( self.ref ): legend.AddEntry( self.ref, "reference" )#, "f" ) - else: - legend.AddEntry( self.mon, "monitored", "pe") - if ( self.ref ): legend.AddEntry( self.ref, "reference", "pe") - - return legend - - ## CDATA getter - # @param self "Me, myself and Irene" - # @param nodeList list of DOM nodes - def __getCData( self, nodeList ): - cdata = "" - for node in nodeList: - if ( node.nodeType == node.TEXT_NODE ): - cdata += node.data - return cdata -## -# @class test_DCubePlotter -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief test case for DCubePlotter -class test_DCubePlotter( unittest.TestCase ): - - ## test case setup - # @param self "Me, myself and Irene" - def setUp( self ): - pass - - ## c'tor - # @param self "Me, myself and Irene" - def test_01_ctor( self ): - try: - self.plotter = DCubePlotter() - except: - pass - self.assertEqual( isinstance( self.plotter, DCubePlotter), True ) - - ## plot diff objects - # @param self "Me, myself and Irene" - def test_02_plot( self ): - pass - - -# test suite execution -if __name__ == "__main__": - - testLoader = unittest.TestLoader() - suite = testLoader.loadTestsFromTestCase(test_DCubePlotter) - unittest.TextTestRunner(verbosity=3).run(suite) - diff --git a/Tools/DCubeClient/python/DCubeTester.py b/Tools/DCubeClient/python/DCubeTester.py deleted file mode 100644 index 16f3e316271c282aa1385a72547d5e4d856e71f4..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/DCubeTester.py +++ /dev/null @@ -1,807 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -## -# @file DCubeClient/python/DCubeTester.py -# @author Krzysztof Daniel Ciba (Krzyszotf.Ciba@NOSPAMgmail.com) -# @brief implementation of DCubeTester and test_DCubeTester classes - -import sys -import ctypes -from DCubeUtils import DCubeObject, DCubeException -from DCubePlotter import DCubePlotter -import ROOT -import unittest -import math - -## -# @class DCubeTester -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief perform statictics tests and plotting -class DCubeTester( DCubeObject ): - - ## XML DOM Document instance - xmldoc = None - - ## XML DOM Element instance - node = None - - ## handle for monitored root object - mon = None - - ## handle for reference root object - ref = None - - ## errors counters - errors = { } - - ## intarnal histogram counter - __nbObjs = 0 - - ## statistics summary table - sumTable = { "KS" : { "OK" : 0, - "WARN" : 0, - "FAIL" : 0 }, - "chi2" : { "OK" : 0, - "WARN" : 0, - "FAIL" : 0 }, - "bbb" : { "OK" : 0, - "WARN" : 0, - "FAIL" : 0 }, - "meanY": { "OK" : 0, - "WARN" : 0, - "FAIL" : 0 }} - - - ## chi2 error communicates - chi2igood = { 0 : "no problems", - 1 : "there is bin in mon hist with low then 1 exp number of event", - 2 : "there is bin in ref hist with low then 1 exp number of event", - 3 : "there are bins in both histograms with less than 1 event" } - - - ## summary status - __status = "" - - ## c'tor - # @param self "Me, myself and Irene" - # @param xmldoc XML DOM Document instance - def __init__( self, xmldoc, parsed ): - - super( DCubeTester, self ).__init__( self ) - self.xmldoc = xmldoc - self.opts, self.args = parsed - self.tests = { "KS" : self.__testKS, - "bbb" : self.__testBBB, - "chi2" : self.__testChi2, - "meanY": self.__testMeanY } - - - if ( self.opts.makeplots ): - self.info("will produce plot files") - self.__plotter = DCubePlotter( xmldoc, parsed ) - else: - self.warn("making of plots disabled") - - ## - # @param self "Me, myself and Irene" - # @param node DOM XML node - # @param mon monitored ROOT object - # @param ref reference ROOT object - # @return modified XML node - def test(self, node, mon=None, ref=None): - self.__nbObjs += 1 - - self.node = self.mon = self.ref = None - - self.node = node - self.parent = self.node.parentNode - - self.mon = mon - self.ref = ref - - # mon exists? - if not self.mon: - status = "FAIL;monitored not found" - self.node.setAttribute("status", status) - if status not in self.errors.keys(): - self.errors[status] = 1 - else: - self.errors[status] = self.errors[status] + 1 - self.error("monitored object '%s' not found!" % self.node.getAttribute("name")) - return "FAIL" - - cl = self.mon.Class().GetName() - isHist = (cl[:2] in ("TH", "TP")) - - # dimension OK? - if (isHist and self.mon.GetDimension() > 2): - status = "FAIL;unsupported object, dimension bigger than 2" - self.node.setAttribute("status", status) - if status not in self.errors.keys(): - self.errors[status] = 1 - else: - self.errors[status] = self.errors[status] + 1 - self.error("unsuported object '%s' found" % self.node.getAttribute('name')) - return "FAIL" - - # reference exists? - if ( not self.ref ): - self.warn( "reference object '%s' not found!" % self.node.getAttribute('name') ) - status = "WARN;reference histogram not found" - self.node.setAttribute( "status", status ) - if ( status not in self.errors.keys() ): - self.errors[ status ] = 1 - else: - self.errors[ status ] = self.errors[ status ] + 1 - - if ( self.mon and self.ref ): - # same class? - monClassName = self.mon.Class().GetName() - refClassName = self.ref.Class().GetName() - if ( monClassName != refClassName ): - status = "FAIL;different root types" - self.node.setAttribute( "status", status + " mon=%s ref=%s" % ( monClassName, - refClassName ) ) - if ( status not in self.errors.keys() ): - self.errors[ status ] = 1 - else: - self.errors[ status ] = self.errors[ status ] + 1 - self.error("different types for mon and ref '%s' objects!" % self.node.getAttribute('name')) - return "FAIL" - - - if ( isHist ): - self.monBins = [ self.mon.GetNbinsX(), self.mon.GetNbinsY() ] - if ( isHist and self.ref ): - self.refBins = [ self.ref.GetNbinsX(), self.ref.GetNbinsY() ] - - if ( isHist and self.mon and self.ref ): - # same binnig? - monBins = [ "%s=%d" % ( x, y) for ( x, y) in zip(["x", "y"], self.monBins ) ] - refBins = [ "%s=%d" % ( x, y) for ( x, y) in zip(["x", "y"], self.refBins ) ] - diffBins = [ "mon %s ref %s" % (x, y) for (x,y) in zip(monBins,refBins) if x != y ] - if ( diffBins ): - status = "FAIL;different binning" - self.node.setAttribute( "status", status + " %s" % " ".join(diffBins) ) - if ( status not in self.errors.keys() ): - self.errors[ status ] = 1 - else: - self.errors[ status ] = self.errors[ status ] + 1 - self.error("different binning for mon and ref '%s' objects!" % self.node.getAttribute('name')) - return "FAIL" - - if cl == "TEfficiency": - # Replace with TGraphAsymmErrors for stats and plotting - self.mon = mon.CreateGraph("AP") - self.ref = ref.CreateGraph("AP") - # remove x-error bars - for i in range( self.mon.GetN() ): - self.mon.SetPointEXlow( i, 0.0 ) - self.mon.SetPointEXhigh( i, 0.0 ) - for i in range( self.ref.GetN() ): - self.ref.SetPointEXlow( i, 0.0 ) - self.ref.SetPointEXhigh( i, 0.0 ) - isHist = False - - status = "OK" - if ( isHist ): - status = self.__grabHistogramStat() - else: - status = self.__grabGraphStat() - - plotStatus = "OK" - if ( self.opts.makeplots ): - plotStatus = self.__makePlots() - else: - plotStatus = "WARN;plots not reqested" - self.node.setAttribute( "plots", plotStatus) - - return status - - - ## grab statistic info for TGraphXXX - # @param self "Me, myself and Irene" - def __grabGraphStat( self ): - if self.mon.GetHistogram().GetDimension() == 1: axis = 2 # change to y-mean and y-RMS (10/7/2017) - else: axis = 1 # TGraph2D probably not supported anyway - - statNode = self.xmldoc.createElement( "stat" ) - self.node.appendChild( statNode ) - - nbPointsNode = self.xmldoc.createElement( "points" ) - nbPointsCData = self.xmldoc.createTextNode( "%d" % self.mon.GetN() ) - if ( self.ref ): - nbPointsNode.setAttribute( "ref" , "%d" % self.ref.GetN() ) - nbPointsNode.appendChild( nbPointsCData ) - - meanNode = self.xmldoc.createElement( "mean" ) - meanCData = self.xmldoc.createTextNode( "%4.3f" % self.mon.GetMean(axis) ) - if ( self.ref ): - meanNode.setAttribute( "ref" , "%4.3f" % self.ref.GetMean(axis) ) - meanNode.appendChild( meanCData ) - - rmsNode = self.xmldoc.createElement( "rms" ) - rmsCData = self.xmldoc.createTextNode( "%4.3f" % self.mon.GetRMS(axis) ) - if ( self.ref ): - rmsNode.setAttribute( "ref" , "%4.3f" % self.ref.GetRMS(axis) ) - rmsNode.appendChild( rmsCData ) - - statNode.appendChild( nbPointsNode ) - statNode.appendChild( meanNode ) - statNode.appendChild( rmsNode ) - - return "OK" - - - - ## grab basic statistics - nb of entries, mean and RMS - # @param self "Me, myself and Irene" - def __grabHistogramStat( self ): - - statNode = self.xmldoc.createElement( "stat" ) - - self.node.appendChild( statNode ) - - entriesNode = self.xmldoc.createElement("entries") - entriesCDataNode = self.xmldoc.createTextNode( str( self.mon.GetEntries() ) ) - if ( self.ref ): - entriesNode.setAttribute( "ref", str( self.ref.GetEntries() ) ) - entriesNode.appendChild( entriesCDataNode ) - - statNode.appendChild( entriesNode ) - - dim = self.mon.GetDimension() - - ### To dump MeanY values - if ( "TProfile" in self.mon.Class().GetName() ): dim = 2 - - # store under and overflows - monU = [] - monO = [] - refU = [] - refO = [] - - #store underflows and overflows to check is some of them are inf or nan - vals = [] - - if ( dim == 1 ): - monU.append( self.mon.GetBinContent(0) ) - vals.append( self.mon.GetBinContent(0) ) - monO.append( self.mon.GetBinContent( self.mon.GetNbinsX()+1 ) ) - vals.append( self.mon.GetBinContent( self.mon.GetNbinsX()+1 ) ) - if ( self.ref ): - refU.append( self.ref.GetBinContent(0) ) - vals.append( self.ref.GetBinContent(0) ) - refO.append( self.ref.GetBinContent( self.ref.GetNbinsX()+1 ) ) - vals.append( self.ref.GetBinContent( self.ref.GetNbinsX()+1 ) ) - elif ( dim == 2 ): - monU.append( self.mon.GetBinContent( 0, 0 ) ) - vals.append( self.mon.GetBinContent( 0, 0 ) ) - monO.append( self.mon.GetBinContent( self.mon.GetNbinsX()+1, 0 ) ) - vals.append( self.mon.GetBinContent( self.mon.GetNbinsX()+1, 0 ) ) - monU.append( self.mon.GetBinContent( 0, self.mon.GetNbinsY()+1) ) - vals.append( self.mon.GetBinContent( 0, self.mon.GetNbinsY()+1) ) - monO.append( self.mon.GetBinContent( self.mon.GetNbinsX()+1, self.mon.GetNbinsY()+1 ) ) - vals.append( self.mon.GetBinContent( self.mon.GetNbinsX()+1, self.mon.GetNbinsY()+1 ) ) - if ( self.ref ): - refU.append( self.ref.GetBinContent( 0, 0 ) ) - vals.append( self.ref.GetBinContent( 0, 0 ) ) - refO.append( self.ref.GetBinContent( self.ref.GetNbinsX()+1, 0 ) ) - vals.append( self.ref.GetBinContent( self.ref.GetNbinsX()+1, 0 ) ) - refU.append( self.ref.GetBinContent( 0, self.ref.GetNbinsY()+1) ) - vals.append( self.ref.GetBinContent( 0, self.ref.GetNbinsY()+1) ) - refO.append( self.ref.GetBinContent( self.ref.GetNbinsX()+1, self.ref.GetNbinsY()+1 ) ) - vals.append( self.ref.GetBinContent( self.ref.GetNbinsX()+1, self.ref.GetNbinsY()+1 ) ) - - #check if some values are inf or nan - if ( self.__checkValues(vals) != "OK" ): - self.warn( "some values in histogram '%s' are infinity or NaN, skipping!" % self.node.getAttribute('name') ) - self.node.setAttribute( "status", "FAIL;monitored or reference histogram contains inf or NaN values") - return "FAIL" - - underflowNode = self.xmldoc.createElement( "underflow" ) - underflowCData = self.xmldoc.createTextNode( "%d" % sum( monU ) ) - if ( self.ref ): - underflowNode.setAttribute( "ref", "%d" % sum( refU) ) - underflowNode.appendChild( underflowCData ) - - overflowNode = self.xmldoc.createElement( "overflow" ) - overflowCData = self.xmldoc.createTextNode( "%d" % sum( monO ) ) - if ( self.ref ): - overflowNode.setAttribute( "ref", "%d" % sum( refO ) ) - overflowNode.appendChild( overflowCData ) - - statNode.appendChild( underflowNode ) - statNode.appendChild( overflowNode ) - - dimName = [ "x", "y", "z" ] - for i in range( 1, dim+1 ): - self.debug( "gathering statistics along %s axis" % dimName[i-1] ) - - dimNode = self.xmldoc.createElement( "dim" ) - dimNode.setAttribute( "name", dimName[i-1] ) - dimNode.setAttribute( "bins", "%d" % self.monBins[i-1]) - - underflowNode = self.xmldoc.createElement( "underflow" ) - underflowCData = self.xmldoc.createTextNode( "%d" % monU[i-1] ) - if ( self.ref ): - underflowNode.setAttribute( "ref", "%d" % refU[i-1] ) - underflowNode.appendChild( underflowCData ) - - dimNode.appendChild( underflowNode ) - - overflowNode = self.xmldoc.createElement( "overflow" ) - overflowCData = self.xmldoc.createTextNode( "%d" % monO[i-1] ) - if ( self.ref ): - overflowNode.setAttribute( "ref", "%d" % refO[i-1] ) - overflowNode.appendChild( overflowCData ) - - dimNode.appendChild( overflowNode ) - - meanNode = self.xmldoc.createElement( "mean" ) - if ( self.ref ): - meanNode.setAttribute( "ref", "%3.2e" % self.ref.GetMean(i) ) - - meanCData = self.xmldoc.createTextNode( "%3.2e" % self.mon.GetMean( i ) ) - meanNode.appendChild( meanCData ) - - meanErrorNode = self.xmldoc.createElement( "mean_unc" ) - if ( self.ref ): - meanErrorNode.setAttribute( "ref", "%3.2e" % self.ref.GetMeanError(i) ) - - meanErrorCData = self.xmldoc.createTextNode( "%3.2e" % self.mon.GetMeanError( i ) ) - meanErrorNode.appendChild( meanErrorCData ) - - rmsNode = self.xmldoc.createElement( "rms" ) - if ( self.ref ): - rmsNode.setAttribute( "ref", "%3.2e" % self.ref.GetRMS(i) ) - rmsCData = self.xmldoc.createTextNode( "%3.2e" % self.mon.GetRMS(i) ) - rmsNode.appendChild( rmsCData ) - - rmsErrorNode = self.xmldoc.createElement( "rms_unc" ) - if ( self.ref ): - rmsErrorNode.setAttribute( "ref", "%3.2e" % self.ref.GetRMSError(i) ) - rmsErrorCData = self.xmldoc.createTextNode( "%3.2e" % self.mon.GetRMSError(i)) - rmsErrorNode.appendChild( rmsErrorCData ) - - dimNode.appendChild( meanNode ) - dimNode.appendChild( meanErrorNode ) - dimNode.appendChild( rmsNode ) - dimNode.appendChild( rmsErrorNode ) - - statNode.appendChild( dimNode ) - - - - status = [ ] - - tests = [t for t in self.node.getAttribute('tests').strip().split(',') if t] - - - if ( self.node.getAttribute('pwarn') ): - try: - pwarn = float ( self.node.getAttribute('pwarn').strip() ) - except TypeError as value: - raise DCubeException( "histogram %s pvalue limit for WARN is NAN" % self.node.getAttribute('name') ) - self.info("overriding pvalue limits for histogram %s: new WARN limit is pwarn=%s" % ( self.node.getAttribute('name'), pwarn ) ) - else: - pwarn = self.opts.pwarn - - if ( self.node.getAttribute('pfail') ): - try: - pfail = float ( self.node.getAttribute('pfail').strip() ) - except TypeError as value: - raise DCubeException( "histogram %s pvalue limit for FAIL is NAN" % self.node.getAttribute('name') ) - self.info("overriding pvalue limits for histogram %s: new FAIL limit is pfail=%s" % ( self.node.getAttribute('name'), pfail ) ) - else: - pfail = self.opts.pfail - - - - if ( "all" in tests ): tests = [ "KS", "chi2", "bbb", "meany" ] - - if ( None not in ( self.mon, self.ref ) ): - - if ( "TProfile" in self.mon.Class().GetName() ): - if ( "meany" in tests ): - status.append( self.__testMeanY.__call__( statNode ) ) - else: - for test in tests: - if ( test != "meany" ): - status.append( self.tests[ test ].__call__( statNode, pwarn, pfail ) ) - - statusAttr = "OK" - if ( "FAIL" in status ): statusAttr = "FAIL" - elif ( "WARN" in status ): statusAttr = "WARN" - - self.node.setAttribute( "stest", statusAttr ) - - return statusAttr - - ## perform @f$\chi^2@f$ test - # @param self "Me, myself and Irene" - # @param statNode <stat> element - def __testChi2( self, statNode, pwarn, pfail ): - - chi2 = 0.0 - igood = 0 - ndf = 0 - - - nbBins,nbBinsSame,nbBinsDiff = self.__testEqual() - self.debug("*** Pearson's chi2 *** all none-empty bins=%d all equal non-empty bins=%d" % ( nbBins, nbBinsSame ) ) - - pval = 1.0 - if nbBins==0.0 and nbBinsSame==0.0: - self.warn( "*** Pearson's chi2 *** both '%s' histograms are empty!" % self.node.getAttribute('name') ) - elif nbBinsSame==nbBins: - self.debug( "*** Pearson's chi2 *** both '%s' histograms are equal!" % self.node.getAttribute('name') ) - else: - chi2 = ctypes.c_double( chi2 ) - igood = ctypes.c_int( igood ) - ndf = ctypes.c_int( ndf ) - pval = self.mon.Chi2TestX( self.ref, chi2, ndf, igood, "UUDNORM") - chi2 = chi2.value - ndf = ndf.value - igood = igood.value - - self.debug( "*** Pearson's chi2 *** (UUDNORM) p-value= %4.3f" % pval ) - ig = "*** Pearson's chi2 *** igood = %d, %s for '%s'" % ( igood, self.chi2igood[igood], self.node.getAttribute('name') ) - if ( igood == 0 ): - self.debug( ig ) - else: - self.warn( ig ) - - status = self.__getTestStatus( pval, pwarn, pfail ) - self.sumTable["chi2"][status] = self.sumTable["chi2"][status] + 1 - - if ( ndf != 0 ): - self.info( "*** Pearson's chi2 *** chi2 (/ndf) = %4.3f (/%d = %4.3f) status=%s" % ( chi2, - ndf, - chi2/ndf, - status ) ) - else: - self.info( "*** Pearson's chi2 *** chi2 = %4.3f ndf = %d status=%s" % ( chi2, - ndf, - status ) ) - - pValueNode = self.xmldoc.createElement( "pvalue" ) - pValueCData = self.xmldoc.createTextNode( "%4.3f" % pval ) - - pValueNode.setAttribute( "test", "chi2" ) - pValueNode.setAttribute( "status", status ) - - counter = self.parent.getAttribute( "chi2" + status ) - if ( not counter ): counter = "0" - self.parent.setAttribute( "chi2" + status, "%d" % ( int(counter) + 1 ) ) - - pValueNode.appendChild( pValueCData ) - - statNode.appendChild( pValueNode ) - - - return status - - ## perform Kolmogorov-Smirnoff test - # @param self "Me, myself and Irene" - # @param statNode <stat> element - def __testKS( self, statNode, pwarn, pfail ): - - nbBins,nbBinsSame,nbBinsDiff = self.__testEqual() - self.debug("*** Kolmogorov-Smirnoff *** all none-empty bins=%d all equal non-empty bins=%d" % ( nbBins, nbBinsSame ) ) - - pval = 1.0 - if nbBins==0.0 and nbBinsSame==0.0: - self.warn( "*** Kolmogorov-Smirnoff *** both '%s' histograms are empty!" % self.node.getAttribute('name') ) - elif nbBinsSame==nbBins: - self.debug( "*** Kolmogorov-Smirnoff *** both '%s' histograms are equal!" % self.node.getAttribute('name') ) - else: - pval = self.mon.KolmogorovTest( self.ref, "D" if self.opts.verbosity <= 2 else "" ) - - status = self.__getTestStatus( pval, pwarn, pfail ) - self.sumTable["KS"][status] = self.sumTable["KS"][status] + 1 - - self.info( "*** Kolmogorov-Smirnoff *** (D) p-value=%4.3f status=%s" % ( pval, status ) ) - - pValueNode = self.xmldoc.createElement( "pvalue" ) - pValueCData = self.xmldoc.createTextNode( "%4.3f" % pval ) - - pValueNode.setAttribute( "test", "KS" ) - pValueNode.setAttribute( "status", status ) - - counter = self.parent.getAttribute( "KS" + status ) - if ( not counter ): counter = "0" - self.parent.setAttribute( "KS" + status, "%d" % ( int(counter) + 1 ) ) - - pValueNode.appendChild( pValueCData ) - - statNode.appendChild( pValueNode ) - return status - - ## ** provide check if equal ** - # returns (nbBins,nbBinsSame,nbBinsDiff) - # nbBins - nb of bins not zero - # nbBinsSame - nb of bins not zero but equal - # nbBinsDiff - nb of bins not zero and different - def __testEqual( self): - nbBins = 0.0 - nbBinsSame = 0.0 - - binX = self.mon.GetNbinsX() - binY = self.mon.GetNbinsY() - - for i in range( binX+1 ): - for j in range( binY + 1 ): - mon = self.mon.GetBinContent( i, j ) - ref = self.ref.GetBinContent( i, j ) - if ( mon or ref ): - nbBins += 1 - if ( mon == ref ): - nbBinsSame += 1 - return (nbBins,nbBinsSame,nbBins-nbBinsSame) - - ## perform "bin-by-bin" statistic test - # @param self "Me, myself and Irene" - # @param statNode <stat> element - def __testBBB( self, statNode, pwarn, pfail ): - - nbBins,nbBinsSame,nbBinsDiff = self.__testEqual() - self.debug("*** bin-by-bin *** all none-empty bins=%d all equal non-empty bins=%d" % ( nbBins, nbBinsSame ) ) - - pval = 0.0 - if ( nbBins != 0.0 ): - pval = nbBinsSame / nbBins - self.debug("*** bin-by-bin *** p-value=%4.3f" % pval ) - elif ( nbBinsSame == 0.0 ): - pval = 1.0 - self.warn( "*** bin-by-bin *** both '%s' histograms are empty!" % self.node.getAttribute('name') ) - self.debug( "*** bin-by-bin *** p-value=%4.3f" % pval ) - else: - # AS: this part is never called?! - self.warn( "*** bin-by-bin *** reference '%s' histogram is empty, while monitored has some entries" % self.node.getAttribute('name') ) - self.debug( "*** bin-by-bin *** test failed" ) - - status = self.__getTestStatus( pval, pwarn, pfail ) - self.info("*** bin-by-bin *** p-value=%4.3f status=%s" % ( pval, status ) ) - - self.sumTable["bbb"][status] = self.sumTable["bbb"][status] + 1 - - pValueNode = self.xmldoc.createElement( "pvalue" ) - pValueCData = self.xmldoc.createTextNode( "%4.3f" % pval ) - - pValueNode.setAttribute( "test", "bbb" ) - pValueNode.setAttribute( "status", status ) - - counter = self.parent.getAttribute( "bbb" + status ) - if ( not counter ): counter = "0" - self.parent.setAttribute( "bbb" + status, "%d" % ( int(counter) + 1 ) ) - - pValueNode.appendChild( pValueCData ) - - statNode.appendChild( pValueNode ) - - return status - - - ## perform "diff(MeanY)" test for TProfile histos - # @param self "Me, myself and Irene" - # @param statNode <stat> element - def __testMeanY( self, statNode ): - - avgEffmon = self.mon.GetMean( 2 ) * 100 - avgEffref = self.ref.GetMean( 2 ) * 100 - - self.debug("*** MeanY Test *** refMean=%4.3f and monMean=%4.3f" % ( avgEffref, avgEffmon ) ) - - pval = abs(avgEffmon - avgEffref) - - status = self.__getMeanTestStatus( pval ) - self.info("*** Mean Test *** p-value=%4.3f status=%s" % ( pval, status ) ) - - self.sumTable["meanY"][status] = self.sumTable["meanY"][status] + 1 - - pValueNode = self.xmldoc.createElement( "pvalue" ) - pValueCData = self.xmldoc.createTextNode( "%4.3f" % pval ) - - pValueNode.setAttribute( "test", "meanY" ) - pValueNode.setAttribute( "status", status ) - - counter = self.parent.getAttribute( "meanY" + status ) - if ( not counter ): counter = "0" - self.parent.setAttribute( "meanY" + status, "%d" % ( int(counter) + 1 ) ) - - pValueNode.appendChild( pValueCData ) - - statNode.appendChild( pValueNode ) - - return status - - - ## get test status for given pvalue - # @param self "Me, myself and Irene" - # @param pval p-value from test - def __getTestStatus( self, pval, pwarn, pfail ): - if ( ( pval < 0.0 or pval > 1.0 ) or - ( pval <= pfail ) ): return "FAIL" - if ( pval > pwarn ): return "OK" - return "WARN" - - - ## get test status for given pvalue - # @param self "Me, myself and Irene" - # @param pval p-value from test - def __getMeanTestStatus( self, pval ): - if ( pval > 1.0 and pval <= 5.0 ): return "WARN" - if ( pval <= 1.0 ): return "OK" - return "FAIL" - - - ## make plots - # @param self "Me, myself and Irene" - def __makePlots( self ): - if ( self.__plotter ): - plotOpts = self.node.getAttribute( "plotopts" ) - status = self.__plotter.plot( self.node, self.mon, self.ref, plotOpts ) - return status - - - ## string representation of DCubeTester - # @param self "Me, myself and Irene" - def __str__( self ): - out = "*"*61 + "\n" - out += "* RUN SUMMARY\n" - out += "*"*61 + "\n" - out += "* objects processed = %d\n" % self.__nbObjs - out += "* STATISTICS TESTS TABLE\n" - out += "* " + "-"*45 + "\n" - out += "* | %-8s | %8s | %8s | %8s |\n" % ( "test", "OK", "WARN", "FAIL") - self.allGOOD = 0 - self.allWARN = 0 - self.allFAIL = 0 - for key, value in self.sumTable.items(): - nbGOOD = value["OK"] - nbWARN = value["WARN"] - nbFAIL = value["FAIL"] - - self.allGOOD += nbGOOD - self.allWARN += nbWARN - self.allFAIL += nbFAIL - out += "* " + "-"*45+"\n" - out += "* | %-8s | %8d | %8d | %8d |\n" % ( key, nbGOOD, nbWARN, nbFAIL ) - - out += "* " + "-"*45+"\n" - - - out += "* | %-8s | %8d | %8d | %8d |\n" % ( "all", self.allGOOD, self.allWARN, self.allFAIL ) - out += "* " + "-"*45+"\n" - - self.fracGOOD = 0.0 - self.fracWARN = 0.0 - self.fracFAIL = 0.0 - all = float( self.allGOOD + self.allWARN + self.allFAIL ) - if ( all ): - self.fracGOOD = 100 * float( self.allGOOD ) / all - self.fracWARN = 100 * float( self.allWARN ) / all - self.fracFAIL = 100 * float( self.allFAIL ) / all - out += "* | %% | %6.2f | %6.2f | %6.2f |\n" % ( self.fracGOOD, self.fracWARN, self.fracFAIL ) - out += "* " + "-"*45+"\n" - - out += "*"*61+"\n" - self.nbErrors = sum( self.errors.values() ) - out += "* WARNINGS = %3d\n" % self.nbErrors - i = 1 - for key, value in self.errors.items( ): - sev, what = key.split(";") - - out += "* [%02d] %4s %-30s - occured %d " % (i, sev, what, value ) - if ( value == 1 ): out += "time\n" - else: out += "times\n" - i += 1 - - out += "*"*61+"\n" - - self.__status = "" - - if ( self.allFAIL != 0 ): - self.__status = "FAIL" - elif ( self.allWARN != 0 or self.nbErrors != 0 ): - self.__status = "WARN" - else: - self.__status = "OK" - - out += "* OVERALL STATISTICS STATUS: %-4s\n" % self.__status - - out += "*"*61 - - return out - - ## put summary to the logger and create summary node - # @param self "Me, myself and Irene" - # @return summary XML Element - def summary( self ): - - # Print RUN SUMMARY to console (even if --verbosity=3), but still with "INFO" flag - it's not a warning. - self.infoExtra( str(self).split("\n"), self.opts.verbosity-1 ) - - summaryNode = self.xmldoc.createElement( "summary" ) - summaryNode.setAttribute( "status" , self.__status ) - summaryNode.setAttribute( "objs", "%d" % self.__nbObjs ) - summaryNode.setAttribute( "errors", "%d" % self.nbErrors ) - - testTable = self.xmldoc.createElement( "table" ) - testTable.appendChild( self.__sumTableRow( [ "test", "OK", "WARN", "FAIL" ] ) ) - for test, results in self.sumTable.items(): - testTable.appendChild( self.__sumTableRow( [ test, - results["OK"], - results["WARN"], - results["FAIL"] ] ) ) - - testTable.appendChild( self.__sumTableRow( ["sum", self.allGOOD, self.allWARN, self.allFAIL ] ) ) - testTable.appendChild( self.__sumTableRow( ["fraction", - "%4.2f" % self.fracGOOD, - "%4.2f" % self.fracWARN, - "%4.2f" % self.fracFAIL ] ) ) - - summaryNode.appendChild( testTable ) - - errorsNode = self.xmldoc.createElement( "errors" ) - errorsNode.setAttribute( "nb", "%d" % self.nbErrors ) - - for error,times in self.errors.items(): - error = error.replace(";", " ") - errorNode = self.xmldoc.createElement( "error" ) - errorNode.setAttribute( "times", "%d" % times ) - errorNode.setAttribute( "what", error ) - errorsNode.appendChild( errorNode ) - - summaryNode.appendChild( errorsNode ) - - return summaryNode - - ## produce summary table row - # @param self "Me, myself and Irene" - def __sumTableRow( self, what ): - row = self.xmldoc.createElement( "tr" ) - for item in what: - cellNode = self.xmldoc.createElement("td") - cellCData = self.xmldoc.createTextNode( str(item) ) - cellNode.appendChild( cellCData ) - row.appendChild( cellNode ) - return row - - ## return overall summary as string - # @param self "Me, myself and Irene" - def status( self ): - return self.__status - - #check that values in histogram are not infinity or nan - def __checkValues( self, values ): - for val in values: - if ( math.isinf(abs( val ) ) or math.isnan( val ) ) : - return "BAD" - return "OK" - - -## -# @class test_DCubeTester -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief test case for DCubeTester class -class test_DCubeTester( unittest.TestCase ): - - ## setup test cases - # @param self "Me, myself and Irene" - def setUp( self ): - pass - - ## ctor - # @param self "Me, myself and Irene" - def test_01_ctor( self ): - pass - - -## test case execution -if __name__ == "__main__": - pass - - diff --git a/Tools/DCubeClient/python/DCubeUtils.py b/Tools/DCubeClient/python/DCubeUtils.py deleted file mode 100644 index 35e074fc092e81eb2df0a76ddf857864dabc20b7..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/DCubeUtils.py +++ /dev/null @@ -1,450 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -## -# @file DCubeClient/python/DCubeUtils.py -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief Utility classes for DCubeApp -# - -import xml.dom.minidom -import logging -import os -import sys -from types import * -import unittest - -## -# @class Singleton -# @author Krzysztof Daniel Ciba (Kerzysztof.Ciba@NOSPAMgmail.com) -# @brief Forcing singleton type for python class instance. -class DCubeSingleton( type ): - - ## c'tor - # @param cls class instance - # @param name class name - # @param bases base classes - # @param dic parameters dictionary - def __init__(cls, name, bases, dic): - super( DCubeSingleton, cls ).__init__( name, bases, dic ) - cls.instance = None - - ## call operator - # @param cls class instance - # @param *args unnamed arguments - # @param **kw keyword arguments - def __call__( cls, *args, **kw ): - if cls.instance is None: - cls.instance = super( DCubeSingleton, cls ).__call__( *args, **kw ) - return cls.instance - -## -# @class DCubeLogger -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAgmail.com) -# @brief DCube customized logger -class DCubeLogger( object ): - - ## metaclass type - __metaclass__ = DCubeSingleton - - ## reference to original logger instance - __log = None - - ## name of the log file - __logFile = None - - ## default name of the log file - __defaultLogFile = "./dcube.log" - - ## flag to trigger stdout print outs - __console = None - - ## logging levels - __levels = { "CRITICAL": logging.CRITICAL, - "ERROR": logging.ERROR, - "WARNING" : logging.WARNING, - "INFO" : logging.INFO, - "DEBUG" : logging.DEBUG } - - ## c'tor - # @brief c'tor - # @param self "Me, myself and Irene" - # @param fileName name of log file - # @param logName name of logger - # @param toConsole flag to trigger stdout printout - def __init__( self, fileName=None, logName="DCube", toConsole=True, verbosity=1 ): - - if ( fileName == None ): fileName = self.__defaultLogFile - - self.__logFile = os.path.abspath( fileName ) - - logging.basicConfig( level=logging.DEBUG, - format='%(name)-12s %(asctime)s %(levelname)-8s: %(message)s', - filename=fileName, - filemode='w' ) - - self.toConsole( toConsole, verbosity ) - - self.__log = logging.getLogger( str(logName) ) - - ## save stdout and stderr handle - #self.__stdout = sys.stdout - #self.__stderr = sys.stderr - - - ## - # @brief set logging level - # @param cls class reference - # @param level string with level name - @classmethod - def setLevel(cls, level="DEBUG"): - if ( level in cls.__levels.keys() ): - cls.__log.setLevel( cls.__levels[level] ) - - - ## - # @brief log file name getter - # @param cls class reference - # @return name of log file - def getFileName( self ): - return self.__logFile - - ## - # @brief logger getter - # @param cls class reference - # @param caller who call me? - @classmethod - def getLogger( cls, caller ): - logName = caller.__class__.__name__ - cls.__log = logging.getLogger( logName ) - return cls - - ## add/remove logging to the stdout and stderr - # @param cls class reference - # @param toConsole bool flag [default True] - @classmethod - def toConsole( cls, toConsole=True, verbosity=1 ): - if ( toConsole ): - - if ( not isinstance(cls.__console, logging.StreamHandler) ): - cls.__console = logging.StreamHandler() - cls.__console.setLevel(verbosity*10) - formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') - cls.__console.setFormatter(formatter) - - logging.getLogger('').addHandler( cls.__console ) - - else: - if ( isinstance(cls.__console, logging.StreamHandler) ): - logging.getLogger('').removeHandler( cls.__console ) - - ## - # @brief debug level logger - # @param cls class reference - # @param msg message to log - @classmethod - def debug( cls, msg ): - cls.__log.debug( msg ) - - ## - # @brief info level logger - # @param cls class reference - # @param msg message to log - @classmethod - def info( cls, msg ): - cls.__log.info( msg ) - - ## - # @brief info level logger, but always print (if verbosity<=2) - # @param cls class reference - # @param msg message to log - @classmethod - def infoExtra( cls, lines, verbosity=2 ): - oldlevel = None - if ( isinstance(cls.__console, logging.StreamHandler) ): - oldlevel = cls.__console.level - cls.__console.setLevel(verbosity*10) - - for msg in lines: - cls.__log.info( str(msg) ) - - if oldlevel is not None: - cls.__console.setLevel(oldlevel) - - ## - # @brief warning level logger - # @param cls class reference - # @param msg message to log - @classmethod - def warn( cls, msg ): - cls.__log.warning( msg ) - - ## - # @brief error level logger - # @param cls class reference - # @param msg message to log - @classmethod - def error( cls, msg ): - cls.__log.error( msg ) - - ## - # @brief critical level logger - # @param cls class reference - # @param msg message to log - @classmethod - def panic( cls, msg ): - cls.__log.critical( msg ) - - ## - # @brief critical level logger - # @param cls class reference - # @param msg message to log - @classmethod - def critical( cls, msg ): - cls.__log.critical( msg ) - - ## - # @brief exception level logger - # @param cls class reference - # @param msg message to log - @classmethod - def exception( cls, msg ): - cls.__log.exception( msg ) - - ## - # @brief exception level logger - # @param cls class reference - # @param msg message to log - @classmethod - def epanic( cls, msg ): - cls.__log.exception( msg ) - - -## -# @class DCubeObject -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief base class for all DCube classes -class DCubeObject( DCubeLogger ): - - ## c'tor - # @param self "Me, myself and Irene" - # @param caller reference to inherited object - def __init__( self, caller ): - ## setting up logger - self.__log = DCubeLogger.getLogger( caller ) - - ## debug level logger - # @param self "Me, myself and Irene" - # @param msg logging string - def debug( self, msg ): - try: - self.__log.getLogger(self).debug( str(msg) ) - except AttributeError: - pass - - ## info level logger - # @param self "Me, myself and Irene" - # @param msg logging string - def info( self, msg ): - try: - self.__log.getLogger(self).info( str(msg) ) - except AttributeError: - pass - - ## info level logger, but always print (if verbosity<=2) - # @param self "Me, myself and Irene" - # @param lines list of logging strings - def infoExtra( self, lines, verbose=2 ): - try: - self.__log.getLogger(self).infoExtra( lines, verbose ) - except AttributeError: - for msg in lines: - print( str(msg) ) - - ## warning level logger - # @param self "Me, myself and Irene" - # @param msg logging string - def warn( self, msg ): - try: - self.__log.getLogger(self).warn( str(msg) ) - except AttributeError: - print(msg) - - ## error level logger - # @param self "Me, myself and Irene" - # @param msg logging string - def error( self, msg ): - try: - self.__log.getLogger(self).error( str(msg) ) - except AttributeError: - print(msg) - - ## critical level logger - # @param self "Me, myself and Irene" - # @param msg logging string - def panic( self, msg ): - try: - self.__log.getLogger(self).critical( str(msg) ) - except AttributeError: - print(msg) - - ## exception level logger - # @param self "Me, myself and Irene" - # @param msg logging string - def epanic( self, msg ): - try: - self.__log.getLogger(self).epanic( str(msg) ) - except AttributeError: - print(msg) - - -## -# @class DCubeVersion -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief DCube version holder -class DCubeVersion( object ): - - __project = "DCube" - __version = "5.0" - __author = "Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com)" - - ## str operator - # @param self "Me, myself and Irene" - def __str__( self ): - return "%s %s by %s" % ( self.__project, self.__version, self.__author ) - - ## DCube version getter - # @param self "Me, myself and Irene" - def version( self ): - return str(self) - - ## python version getter - # @param self "Me, myself and Irene" - def python( self ): - return "using Python %s" % sys.version.replace("\n", "").strip("\n") - - ## root version getter - # @param self "Me, myself and Irene" - def root( self ): - out = "using ROOT " - try: - if ( "ROOT" not in dir() ): - import ROOT - out += ROOT.gROOT.GetVersion().strip("\n") - except: - out += "UNKNOWN" - return out - -## -# @class DCubeException -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAgmail.com) -# @brief class for DCube triggered execution errors -class DCubeException( Exception ): - - ## c'tor - # @param self "Me, myself and Irene" - # @param value whatever, who cares, this is python, dumb! - def __init__( self, value ): - self.value = value - - ## exception printing - # @param self "Me, myself and Irene" - def __str__( self ): - return repr( self.value ) - - -## -# @class test_DCubeUtils -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief test case for DCubeUtils module classes -class test_DCubeUtils( unittest.TestCase ): - - ## test case setup - # @param self "Me, myself and Irene" - def setUp( self ): - - self.logger = DCubeLogger( "test_DCubeUtils.log", logName="test_DCubeUtils", toConsole=True ) - - self.exception = DCubeException("test exception, don't panic") - self.version = DCubeVersion() - self.base = DCubeObject( self ) - self.log = DCubeLogger.getLogger( self ) - pass - - ## c'tors - # @param self "Me, myself and Irene" - def test_01_constructors( self ): - - try: - self.exception = DCubeException("test exception, don't panic!") - self.version = DCubeVersion() - self.base = DCubeObject( self ) - self.log = DCubeLogger.getLogger( self ) - except: - pass - - self.assertEqual( isinstance( self.exception, DCubeException), True ) - self.assertEqual( isinstance( self.version, DCubeVersion), True ) - self.assertEqual( isinstance( self.base, DCubeObject), True ) - - ## DCubeLogger interface - # @param self "me, myself and Irene" - def test_02_logger( self ): - self.log.debug("debug level text") - self.log.info("info level text") - self.log.warn("warning level text") - self.log.error("error level text") - self.log.panic("fatal level text") - try: - raise NameError("intentional NameError, don't panic!") - except NameError as value: - self.log.epanic("exception level text") - - self.log.toConsole(False) - self.log.info("this won't be printed to console") - self.log.toConsole(True) - self.log.info("this will be printed to console") - - self.logger.setLevel("INFO") - self.log.debug("this should not be printed") - - self.logger.setLevel("DEBUG") - self.log.debug("while this should be printed") - - ## DCubeException interface - # @param self "Me, myslf and Irene" - def test_03_exception( self ): - try: - raise self.exception - except DCubeException as value: - self.log.epanic(value) - - ## DCubeObject interface - # @param self "Me, myself and Irene" - def test_04_DCubeObject( self ): - self.base.debug("debug level text") - self.base.info("info level text") - self.base.warn("warn level text") - self.base.error("error level text") - self.base.panic("panic level text") - try: - raise NameError("intentional NameError, don't panic!") - except NameError: - self.base.epanic("exception level text") - - ## DCubeVersion interface - # @param self "Me, myself and Irene" - def test_05_DCubeVersion( self ): - self.log.info( self.version.version() ) - self.log.info( self.version.root() ) - self.log.info( self.version.python() ) - self.log.info( self.version ) - - -## test case execution -if __name__ == "__main__": - - testLoader = unittest.TestLoader() - suite = testLoader.loadTestsFromTestCase(test_DCubeUtils) - unittest.TextTestRunner(verbosity=3).run(suite) - diff --git a/Tools/DCubeClient/python/DCubeValid.py b/Tools/DCubeClient/python/DCubeValid.py deleted file mode 100644 index 3551087c662be1e8f3cdd7084a070699ac151a06..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/DCubeValid.py +++ /dev/null @@ -1,295 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -## -# @file DCubeClient/python/DCubeValid.py -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @date Apr 21st, 2008 -# @brief implementation of DCubeValid class - - -import xml.dom.minidom -import re -import sys -import os -import unittest - -from DCubeUtils import DCubeLogger, DCubeObject, DCubeException, DCubeSingleton - -## -# @class DCubeValid -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief Holder for valid configurations and presettings. -# -# <h3>Usage</h3> -# -# DCubeValid object holds legal values for: -# <ul> -# <li> nightly names -# <li> installation names -# <li> CMTCONFIG values -# <li> Atlas project names -# <li> test frameworks names -# </ul> -# -# The above values are taken from the CoolDozer XML configuration file picked up during DozerValid object construction. -# If user does not pass the path to the CoolDozer configuration XML file, the default one will be chosen. -# -class DCubeValid( object ): - - __default_dcubeValid_xmlfile = "DCubeValid.xml" - - __metaclass__ = DCubeSingleton - - __server = "" - - __testFrameworks = { } - - __nightlies = { } - - __installs = { } - - __cmtconfigs = { } - - __projects = { } - - - ## c'tor - # @param self "Me, myself and Irene" - # @param xmlfile path to file with XMl configuration - # @param log DCubeLogger instance - def __init__( self, xmlfile=None, log=None ): - - - if not xmlfile: - basepath = os.path.dirname( globals()["__file__"] ) - # xmlfile locations depend on how dcube.py is run: (1) direct from source package or with CMT layout, (2) CMake layout, or (3) all-in-one. - for subpath in "../share:../../share:".split(":"): - testpath = os.path.abspath( os.path.join( basepath, subpath, self.__default_dcubeValid_xmlfile ) ) - if ( os.path.exists( testpath ) ): - xmlfile = testpath - break - - if ( xmlfile ): - self.__xmlfile = xmlfile - self.__parse( xmlfile ) - else: - print("DCubeValid.xml not found in InstallArea nor DCubeClient install directories, wrong installation?") - sys.exit( -1 ) - - ## - # @param self "Me, myself and Irene" - # @brief valid nightlies name getter - def branches( self ): - return self.__nightlies - - ## - # @param self "Me, myself and Irene" - # @brief valid installs names getter - def installs( self ): - return self.__installs - ## - # @param self "Me, myself and Irene" - # @brief valid CMTCONFIGs values getter - def cmtconfigs( self ): - return self.__cmtconfigs - - ## - # @param self "Me, myself and Irene" - # @brief valid project names getter - def projects( self ): - return self.__projects - - ## - # @param self "Me, myself and Irene" - # @param nodeList children of XML node element - # @brief CDATA section getter - def __getCData( self, nodeList ): - cdata = "" - for node in nodeList: - if node.nodeType == node.TEXT_NODE: - cdata += node.data - return cdata - - ## - # @param self "Me, myself and Irene" - # @param where path to XML file - def __parse( self, where ): - - xmldoc = xml.dom.minidom.parse( where ) - rootNode = xmldoc.documentElement - - # get server location - server = xmldoc.getElementsByTagName("server") - if ( len(server) == 1 ): - server = self.__getCData( server[0].childNodes ) - if ( server != "" ): - self.__server = server - else: - self.panic( msg ) - raise DCubeException( msg ) - - - # get known nightlies - nightlies = xmldoc.getElementsByTagName("branch") - - if ( len(nightlies) != 0 ): - for nightly in nightlies: - ndata = self.__getCData( nightly.childNodes ) - if ( ndata != "" ): - nre = ndata - if ( nightly.hasAttribute("re") ): - nre = nightly.getAttribute("re") - if ( nre == ndata ): nre = "^" + nre + "$" - self.__nightlies[ndata] = re.compile(nre) - - - # get known install list - install = xmldoc.getElementsByTagName("install") - if ( len(install) != 0): - for ins in install: - idata = self.__getCData( ins.childNodes ) - if ( idata != "" ): - self.__installs[idata] = idata - - - # get known CMTCONFIGs list - cmts = xmldoc.getElementsByTagName("cmt") - if ( len(cmts) != 0): - for cmt in cmts: - cdata = self.__getCData( cmt.childNodes ) - if ( cdata != "" ): - self.__cmtconfigs[cdata] = cdata - - # projects - projects = xmldoc.getElementsByTagName("project") - if ( len(projects) != 0): - for bundle in projects: - cdata = self.__getCData( bundle.childNodes ) - if ( cdata != "" ): - - self.__projects[cdata] = cdata - - ## list valid branch names - # @param self "Me, myself and Irene" - def listBranches( self ): - out = "- valid branches values and thier regexp patterns:\n" - i = 1 - for k in sorted( self.branches().keys() ): - v = self.branches()[k] - out += " [%02d] %-14s regexp pattern=%s\n" % ( i, k, v.pattern ) - i += 1 - return out - - ## list valid install names - # @param self "Me, myself and Irene" - def listInstalls( self ): - out = "- valid installs values:\n" - i = 1 - for k in sorted( self.installs() ): - out += " [%02d] %s\n" % ( i, k ) - i += 1 - return out - - ## list valid cmtconfig names - # @param self "Me, myself and Irene" - def listCmtconfigs( self ): - out = "- valid cmtconfigs names:\n" - i = 1 - for k in sorted( self.cmtconfigs() ): - out += " [%02d] %s\n" % ( i, k ) - i += 1 - return out - - ## list valid project names - # @param self "Me, myself and Irene" - def listProjects( self ): - out = "- valid projects names:\n" - i = 1 - for k in sorted( self.projects() ): - out += " [%02d] %s\n" % ( i, k ) - i += 1 - return out - - ## str operator - # @param self "Me, myself and Irene" - def __str__( self ): - out = "DCube valid names based on DCube XML configuarionm file %s\n" % self.__xmlfile - out += self.listBranches() - out += self.listInstalls() - out += self.listCmtconfigs() - out += self.listProjects() - return out.strip() - -## -# @class test_DCubeValid -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @date May 22, 2008 -# @brief test case for DCubeValid class -class test_DCubeValid( unittest.TestCase ): - - ## test case setup - # @param self "Me, myself and Irene" - def setUp( self ): - self.__log = DCubeLogger("test_DCubeValid.log", "test_DCubeValid",toConsole=True) - self.cv = DCubeValid() - - ##__init__ - # @param self "Me, myself and Irene" - def test_01_constructor( self ): - try: - self.cv = DCubeValid() - except: - pass - self.assertEqual( isinstance( self.cv, DCubeValid ), True) - - ## nightlies() - # @param self "Me, myself and Irene" - def test_02_nightlies( self ): - nightlies = self.cv.branches() - self.assertEqual( "dev" in nightlies, True ) - self.assertEqual( "devval" in nightlies, True ) - self.assertEqual( "bugfix" in nightlies, True ) - self.assertEqual( "*" in nightlies, True ) - self.assertEqual( "val" in nightlies, True ) - self.assertEqual( "numbered" in nightlies, True ) - self.assertEqual( "pcache" in nightlies, True ) - self.assertEqual( "NN.N.NX" in nightlies, True ) - print(nightlies) - - ## installs() - # @param self "Me, myself and Irene" - def test_03_installs( self ): - installs = self.cv.installs() - self.assertEqual( "build" in installs, True ) - self.assertEqual( "kit" in installs, True ) - self.assertEqual( "*" in installs, True ) - - ## cmtconfigs() - # @param self "Me, mylsef and Irene" - def test_04_cmtconfigs( self ): - cmtconfigs = self.cv.cmtconfigs() - self.assertEqual( len(cmtconfigs.keys()), 17) - - ## projects() - # @param self "Me, myslf and Irene" - def test_05_projects( self ): - projects = self.cv.projects() - self.assertEqual( len( projects.keys()), 12 ) - - - ## str() - # @param self "Me, myself and Irene" - def test_06_str( self ): - print(self.cv) - - -## test suite execution -if __name__ == "__main__": - - testLoader = unittest.TestLoader() - suite = testLoader.loadTestsFromTestCase(test_DCubeValid) - unittest.TextTestRunner(verbosity=3).run(suite) - - diff --git a/Tools/DCubeClient/python/__init__.py b/Tools/DCubeClient/python/__init__.py deleted file mode 100644 index 74583d364ec2ca794156596c7254d9b234a940c6..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - diff --git a/Tools/DCubeClient/python/dcube.py b/Tools/DCubeClient/python/dcube.py deleted file mode 100755 index fdd053bec51e70d25cc5bc251dc0f990be5cbbb3..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/dcube.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -import sys, os -try: from DCubeApp import DCubeApp -except: from DCubeClient.DCubeApp import DCubeApp -if __name__ == "__main__": - ## to run ROOT in batch mode - sys.argv.append("-b") - DCubeApp( ) diff --git a/Tools/DCubeClient/python/dcubeConvert.py b/Tools/DCubeClient/python/dcubeConvert.py deleted file mode 100755 index 1cbe2ca48e764dabff812ebc7eb006a00f57c75a..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/python/dcubeConvert.py +++ /dev/null @@ -1,318 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -## -# @file DCubeClient/python/dcubeConvert.py -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# -import os, sys -from time import strftime, localtime, strptime -import xml.dom.minidom -import ROOT - -## -# @class DCubeConvert -# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) -# @brief converter for XML DCubeClient configuration files -class DCubeConvert( object ): - - oldURI = None - newURI = None - referenceURI = None - - ## c'tor - # @param self "Me, myself nad Irene" - # @param old old configuration file - # @param new new configuration file - def __init__( self, old, ref=None, new=None): - - print("dcubeConvert arguments:") - whatOLD = old - whatREF = ref - whatNEW = new - if ( not whatREF ): - whatREF = "not specified, will be taken from old configuration file" - if ( not whatNEW ): - whatNEW = "not specified, will be set to old configuration file" - - print("[01] old dcube configuration file: %s" % str(whatOLD)) - print("[02] reference root file: %s" % str(whatREF)) - print("[03] new dcube configuration file: %s" % str(whatNEW)) - - if ( not new ): - new = old - - print("will convert old DCubeClient configuration file '%s' and save new configuration to file '%s'" % ( old, new )) - - self.oldURI = os.path.abspath(old) - self.newURI = os.path.abspath(new) - - if ( not os.path.isfile( self.oldURI) ): - sys.exit("cannot find old DCubeClient config in path %s - exiting!" % self.oldURI ) - - if ( self.oldURI == self.newURI ): - print("DCubeClient configuration file %s exists and will be overwritten" % self.oldURI) - - if ( ref ): - self.referenceURI = os.path.abspath( ref ) - print("will use '%s' as reference root file" % self.referenceURI) - if ( not os.path.exists( self.referenceURI ) ): - sys.exit("reference file '%s' does not exist!" % self.referenceURI ) - sys.exit( self.convert() ) - - ## get CDATA from node list - # @param self "Me, myself and Irene" - # @param nodeList list of XML DOM Nodes - def __cdata( self, nodeList ): - out = "" - for node in nodeList: - if node.nodeType == node.TEXT_NODE: - out += node.data - return out - - pass - - ## parse old configuration file - # @param self "Me, myself and Irene" - def __parseOLD( self ): - - print("parsing old configuration file %s" % self.oldURI) - - self.xmlOLD = xml.dom.minidom.parse(self.oldURI) - - if (self.xmlOLD.documentElement.tagName != "cfg"): - - m = '%s.__parseOld %s is not an old DCubeClient configuration' - m += ' file, root node name is different form <cfg>' - m = m % (self.__class__.__name__, - os.path.basename(self.oldURI) - ) - print(m) - sys.exit(0) - else: - - if ( not self.referenceURI ): - self.referenceURI = self.__cdata( self.xmlOLD.getElementsByTagName("reference")[0].childNodes ) - - print("OLD: reference URI=%s" % self.referenceURI) - - if ( not os.path.exists(self.referenceURI ) ): - sys.exit( "reference root file not exists!") - - - self.refDesc = self.__cdata( self.xmlOLD.getElementsByTagName("ref_desc")[0].childNodes ) - - print("OLD: reference description=%s" % self.refDesc) - - self.monDesc = self.__cdata( self.xmlOLD.getElementsByTagName("mon_desc")[0].childNodes ) - - print("OLD: monitored description=%s" % self.monDesc) - - self.plimit = self.xmlOLD.getElementsByTagName("plimit")[0] - - print("OLD: plimit attributes fail=%s warn=%s" % ( self.plimit.getAttribute("fail"), self.plimit.getAttribute("warn"))) - - self.hists = self.xmlOLD.getElementsByTagName("hist") - - i = 1 - for hist in self.hists: - print("OLD: [%02d] hist path=%s tests=%s" % ( i, hist.getAttribute("path"), hist.getAttribute("tests") )) - i += 1 - - ## create new XML DOM Document instance - # @param self "Me, myself and Irene" - def __createNEW( self ): - self.xmlNEW = xml.dom.minidom.Document() - self.dcubeClientConfig = self.xmlNEW.createElement("dcube_client_config") - self.xmlNEW.appendChild( self.dcubeClientConfig ) - self.dcubeClientConfig.appendChild( self.__mainComment() ) - - self.dcube = self.xmlNEW.createElement("dcube") - self.dcube.setAttribute("branch", "*") - self.dcube.setAttribute("install", "*") - self.dcube.setAttribute("cmtconfig", "*") - self.dcube.setAttribute("project", "*") - self.dcube.setAttribute("jobId", "*") - - reference = self.xmlNEW.createElement( "reference" ) - reference.setAttribute("path", self.referenceURI ) - - self.dcube.appendChild( reference ) - - refDesc = self.xmlNEW.createElement("ref_desc") - refDescCDATA = self.xmlNEW.createTextNode( self.refDesc ) - refDesc.appendChild( refDescCDATA ) - - self.dcube.appendChild( refDesc ) - - testDesc = self.xmlNEW.createElement( "test_desc" ) - testDescCDATA = self.xmlNEW.createTextNode( self.monDesc ) - testDesc.appendChild( testDescCDATA ) - - self.dcube.appendChild( testDesc ) - - self.dcube.appendChild( self.plimit ) - - rootTDir = self.xmlNEW.createElement("TDirectory") - rootTDir.setAttribute("name", "/") - - self.dcube.appendChild( rootTDir ) - - - self.refROOT = ROOT.TFile().Open( self.referenceURI, "READ" ) - - for hist in self.hists: - xmlpath = hist.getAttribute("path") - if ( xmlpath.count("/") and xmlpath[0] == "/" ): - xmlpath = xmlpath[1:] - obj = self.refROOT.Get( xmlpath ) - - if ( obj ): - type = obj.ClassName() - path = hist.getAttribute("path").split("/")[1:] - tests = hist.getAttribute("tests") - self.__attach( path, rootTDir, tests, type ) - print("NEW: obj type=%s path=%s tests=%s has been added" % ( type, xmlpath, tests)) - else: - print("NEW: cannot find object at %s" % xmlpath) - - - self.refROOT.Close() - self.dcubeClientConfig.appendChild( self.dcube ) - - - ## create XML DOM Comment node - # @param self "Me, myself and Irene" - def __mainComment( self ): - com = "\n DCubeClient configuration file '%s'" % os.path.basename(self.newURI) - com += "\n converted from old configuration file '%s'" % os.path.basename(self.oldURI) - com += "\n using dcubeConvert.py script" - com += "\n on %s " % strftime("%a, %d %b %Y %H:%M:%S %Z" , localtime()) - return self.xmlNEW.createComment( com ) - - ## create backup file - # @param self "Me, myself and Irene" - # @param path path to file - def __backup( self, path ): - - backup = path + ".bak" - if ( os.path.exists( backup ) ): - print("BCK: backup file exists and will be overwitten!") - try: - os.rename( path, backup ) - except: - print("BCK: creation of backup file failed") - - - ## save new DCubeClient configuration to file - # @param self "Me, myself and Irene" - def __save( self ): - - if ( os.path.exists(self.newURI ) ): self.__backup( self.newURI ) - try: - xmlNEW = open( self.newURI, "w+" ) - xmlNEW.writelines( self.xmlNEW.toprettyxml() ) - xmlNEW.close() - print("NEW: new config file '%s' has been created" % self.newURI) - except: - sys.exit("error when saving new configuration file!") - - - ## perform conversion - # @param self "Me, myself and Irene" - def convert( self ): - self.__parseOLD( ) - self.__createNEW() - self.__save() - return 0 - - ## attach child node to parent - # @param self "Me, myself and Irene" - # @param what list of path chunks - # @param where path inside reference root file - def __attach( self, what, where, tests, type ): - - histName = what[-1] - parent = what[0] - - if ( len(what) == 1 ): - nodeName = "" - if ( "TH1" in type ): nodeName = "hist1D" - if ( "TH2" in type ): nodeName = "hist2D" - if ( "TProfile" == type ): nodeName == "hist1D" - if ( "TProfile2D" == type ): nodeName = "hist2D" - if ( "TGraph" in type and "2" not in type ): nodeName = "graph" - - if ( nodeName != "" ): - histNode = self.xmlNEW.createElement( nodeName ) - histNode.setAttribute("tests", tests) - histNode.setAttribute("name", histName) - histNode.setAttribute( "type", type) - - print("NEW: attaching %s '%s' with tests '%s' at TDirectory '%s'" % ( type, histName, tests, where.getAttribute("name"))) - where.appendChild( histNode ) - return - else: - print("unsupported object name='%s' type='%s' found, skipping!" % ( histName, nodeName)) - else: - subDirs = where.getElementsByTagName("TDirectory") - subDirsDict = { } - - for subDir in subDirs: - subDirsDict[subDir.getAttribute( "name")] = subDir - - if ( parent not in subDirsDict ): - print("NEW: creating TDirectory name '%s'" % parent) - tdir = self.xmlNEW.createElement( "TDirectory" ) - tdir.setAttribute("name", parent ) - where.appendChild( tdir ) - print("NEW: calling recursive: what '%s' " % str(what[1:])) - self.__attach( what[1:], tdir, tests, type ) - else: - print("NEW: calling recursive: what '%s' " % str(what[1:])) - self.__attach( what[1:], subDirsDict[parent], tests, type ) - - - pass - -## script execution -if __name__ == "__main__": - - usage = "Usage: $sh> dcubeConvert.py OLDCONFIG.XML [REFERENCE.root] [NEWCONFIG.XML]" - - old = None - ref = None - new = None - - if ( len(sys.argv) == 1 ): - print(usage) - sys.exit(0) - if ( len(sys.argv) == 2 ): - old = sys.argv[1] - DCubeConvert( old, ref, new ) - if ( len(sys.argv) == 3 ): - old = sys.argv[1] - what = sys.argv[2] - if ( what.endswith(".root") ): ref = what - elif ( what.endswith(".xml") ): new = what - DCubeConvert( old, ref, new ) - elif ( len(sys.argv) == 4 ): - old = sys.argv[1] - what1 = sys.argv[2] - what2 = sys.argv[3] - if ( what1.endswith(".root") ): ref = what1 - if ( what1.endswith(".xml") ): new = what1 - if ( not ref and what2.endswith(".root") ): ref = what2 - if ( not new and what2.endswith(".xml") ): new = what2 - DCubeConvert(old, ref, new) - else: - print("ERROR: wrong arguments!") - print(usage) - sys.exit(1) - - - - - - - diff --git a/Tools/DCubeClient/scripts/setup.csh b/Tools/DCubeClient/scripts/setup.csh deleted file mode 100644 index 0a3d1763c1201c6398c30bff5f3ac4c5009ba75e..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/scripts/setup.csh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/csh -# enviroment setup for dcube.py running on lxplus for (t)csh shell -# -# Aug 16, 2007 - cibak - switch to root 5.16/00 -# Oct 23, 2007 - cibak - switch to root 5.17/04 -# Apr 10, 2008 - cibak - switch to root 5.19/02 and python 2.5 -# - -setenv ROOT_VER 5.19.02 -setenv BIN slc4_amd64_gcc34 - -setenv ROOTSYS /afs/cern.ch/sw/lcg/external/root/${ROOT_VER}/${BIN}/root -setenv PYTHONPATH ${ROOTSYS}/lib:/afs/cern.ch/sw/lcg/external/Python/2.5/${BIN}/lib/python2.5 -setenv PATH ${ROOTSYS}/bin:/afs/cern.ch/sw/lcg/external/Python/2.5/${BIN}/bin:${PATH} -setenv LD_LIBRARY_PATH ${ROOTSYS}/lib:/afs/cern.ch/sw/lcg/external/Python/2.5/${BIN}/lib - diff --git a/Tools/DCubeClient/scripts/setup.sh b/Tools/DCubeClient/scripts/setup.sh deleted file mode 100644 index fda54223aed0c8d5ff06daefc20970a98e73ddc2..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/scripts/setup.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -# enviroment setup script for dcube.py running on lxplus for (ba,z)sh shell -# -# Aug 16, 2007 - cibak - switch to root 5.16/00 -# Oct 23, 2007 - cibak - switch to root 5.17/04 -# Apr 10, 2008 - cibak - switch to root 5.19/02 and python 2.5 -# - -export ROOT_VER=5.19.02 -export BIN=slc4_amd64_gcc34 - -export ROOTSYS=/afs/cern.ch/sw/lcg/external/root/${ROOT_VER}/${BIN}/root -export PYTHONPATH=${ROOTSYS}/lib:/afs/cern.ch/sw/lcg/external/Python/2.5/${BIN}/lib/python2.5 -export PATH=${ROOTSYS}/bin:/afs/cern.ch/sw/lcg/external/Python/2.5/${BIN}/bin:${PATH} -export LD_LIBRARY_PATH=${ROOTSYS}/lib:/afs/cern.ch/sw/lcg/external/Python/2.5/${BIN}/lib - diff --git a/Tools/DCubeClient/share/DCubeClient_jobOptions.py b/Tools/DCubeClient/share/DCubeClient_jobOptions.py deleted file mode 100644 index 7cb7b03906c257504edea8981431d39b7c3ad568..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/share/DCubeClient_jobOptions.py +++ /dev/null @@ -1,7 +0,0 @@ -# -# dummy job options -# -print "This is only placeholder, does nothing..." - -# run one event and exit -theApp.EvtMax = 1 diff --git a/Tools/DCubeClient/share/DCubeServer/css/dcube.css.php b/Tools/DCubeClient/share/DCubeServer/css/dcube.css.php deleted file mode 100644 index d8e665679b9ca93c02ce41f81b5ddcde43213831..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/share/DCubeServer/css/dcube.css.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php -ob_start ("ob_gzhandler"); -header("Content-type: text/css"); -header("Cache-Control: must-revalidate"); -$offset = 60 * 60 * 12; -$ExpStr = "Expires: " . -gmdate("D, d M Y H:i:s", -time() + $offset) . " GMT"; -header($ExpStr); -/** - * @file dcube.css - * @brief Cascade Style Sheet for DCube - * @author Krzysztof Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl) - * @date 11/04/2007 - */ -?> -body {font-family: Arial,Halvetica,sans-serif; background-color: #ffffff; font-size: 12pt;} -div {text-align: center;} -#loading {width: 193px; height: 70px; position: absolute; left: 50%; top: 50%; margin-top: -50px; margin-left: -100px; background-color: #ff6600; border: 5px solid #ffff00; z-index: 1000;} -#load {width: 173px; height: 10px; background-image: url(../images/loading.gif); position: relative; top: 10px; left: 10px;} -div.wrapper {text-align: left; margin: 0px auto; padding: 0px; border: 0; width: 99%;} -div.header {margin: 0 0 12px 0; background-color: #cccccc; text-align: right; font-size: 10pt;} -div.mid_panel {padding: 5px 5px; margin: 18px 0 0 0; background-color: #cccccc; width: auto; text-align: left; overflow: auto;} -div.legend { margin: 18px 0 0 0; background-color: transparent; } -legend {background-color: #a0a0a0; border: 1px dotted #000000;} -fieldset {background-color: transparent; font-weight: bold; border: 1px dotted #000000; text-align: center;} -fieldset.fc {text-align: left;} -div.content {margin: 18px 0 0 0; text-align: left; width: 100%;} -div.footer {clear: both; margin: 18px 0 0 0; text-align: right; background-color: #cccccc;} -div.tp {border: 1px dotted #000000; margin: auto auto; padding: 5px 5px;} -div.his {width: 100%; height: 28px; background-color: #ffffff; cursor: pointer; margin: 1px 0px;} -div.his0 {text-align: left; vertical-align: middle; width: 32%; min-width: 15em; height: 28px; float: left; clear: left; overflow: auto; cursor: pointer; position: relative; top: 4px;} -div.his:hover , div.dir:hover {border: 1px #000000 solid;} -div.his1 {width: 16%; float: left; vertical-align: middle; text-align: center; margin-left: 2px; margin-right: 2px; } -div.ok {width: 97%; margin: 2px 1px; border: 2px dotted #00ff00;} -div.warn {width: 97%; background-color: #ffd700; margin: 2px 1px; border: 2px solid #ffd700;} -div.fail {width: 97%; background-color: #ff4500; margin: 2px 1px; border: 2px solid #ff4500;} -div.absent {width: 97%; background-color: #cccccc; margin: 2px 1px; border: 2px solid #cccccc;} -div.hc { margin: auto auto; width: 99%; background-color: #cccccc; padding: 5px 5px; border: 1px dotted #000000;} -div.dir {text-align: left; width: 100%; height: 28px; vertical-align: middle; font-weight: bold; background-color: #fff8dc; cursor: pointer; margin: 1px 0px;} -div.dir0 {text-align: left; min-width: 15em; width: 32%; float: left; clear: left; overflow: auto; cursor: pointer; position: relative; top: 4px;} -div.dir1 {width: 16%; float: left; margin-left: 2px; margin-right: 2px;} -div.dirc {clear: left; width: 100%;} -div.tdir {text-align: left; width: 100%; height: 27px; font-weight: bold; background-color: #cccccc;} -div.tdir0 {min-width: 15em; width: 32%; float: left; overflow: auto;} -div.tdir1 {width: 16%; float: left; margin-left: 2px; margin-right: 2px; } -div.ch {width: 30%; height: 550px; float: left; position: relative; left: 0px; top: 0px; text-align: left; padding: 10px 10px;} -div.si {margin-left: auto; margin-right: auto; border: 2px solid #cccccc; width: 55%; text-align: left;} -table.pval_table {cursor: pointer; border: dotted 1px; width: 100%; background-color: transparent; text-align: left; empty-cells: hide;} -table.st {width: 100%; border-width: 0px; empty-cells: hide; border-collapse: collapse; position: relative; top: 2px;} -table.center {margin-left: auto; margin-right: auto; border-collapse: collapse;} -td.bc {background-color: #6699cc; text-align: center;} -td.bl {background-color: #6699cc; text-align: left;} -td.yc {background-color: #ffcc00; text-align: center;} -td.yl {background-color: #ffcc00; text-align: left;} -div.pval_legend {position: fixed; bottom: 0em; left: 0em; padding: 1px; background-color: transparent; width: 100%; display: none; } -a {color: #000099; font-weight: bold; } -a:visited {color: #990000; font-weight: bold;} -td {background-color: #ffffff; width: 14%; text-align: left; cursor: pointer;} -th {font-weight: bold; text-align: center; background-color: #cccccc; width: 14%;} -td.sum {cursor: pointer;} -td.warn {font-weight: bold; background-color: #ffd700; text-align: center;} -td.fail {font-weight: bold; background-color: #ff4500; text-align: center;} -td.ok {font-weight: bold; background-color: #ffffff; border: 2px dotted #00ff00; text-align: center;} -td.eok {margin: 2px 1px; background-color: #ffffff; border: 2px dotted #99ff99; text-align: center;} -td.ewarn {background-color: #ffff99; text-align: center; } -td.efail {background-color: #ffab99; text-align: center; } -td.basic {font-family: serif; background-color: #cccccc; font-weight: bold; text-align: center;} -td.absent {font-weight: bold; background-color: #cccccc; text-align: center;} -td.missing {font-weight: bold; background-color: #00ff00; border: 3px dotted #ff0000; text-align: center;} -td.dir {font-weight: bold; background-color: #fff8dc; text-align: left;} -td.plot {font-weight: bold; background-color: #ffffff; border: 2px dotted #0000ff; text-align: center;} -img { vertical-align: middle; } -img.plot { border: 1px dotted #000000; } -.tabpane {cursor: default; margin: 0px 0px; height: 24px; float: left;} -.tabpane .tp_left {position: relative; top: 0px; left: 0px; background: url(../images/tabpane_left.gif) no-repeat; width: 6px; height: 24px; float: left;} -.tabpane .tp_right {position: relative; top: 0px; right: 0px; background: url(../images/tabpane_right.gif) no-repeat; width: 6px; height: 24px; float:left; } -.tabpane .tp_title {background: url(../images/tabpane_bkg.gif) repeat-x; float: left; height: 24px; padding: 4px 5px; } -.tabpane .sel_tp_left {position: relative; top: 0px; left: 0px; background: url(../images/sel_tabpane_left.gif) no-repeat; width: 6px; height: 24px; float:left;} -.tabpane .sel_tp_right {position: relative; top: 0px; right: 0px; background: url(../images/sel_tabpane_right.gif) no-repeat; width: 6px; height: 24px; float:left;} -.tabpane .sel_tp_title {background: url(../images/sel_tabpane_bkg.gif) repeat-x; float: left; height: 24px; padding: 4px 5px; color: #ffffff;} -.contentPane {clear: left; width: 99%; border: 1px solid black; margin: 0px 0px; padding: 5px 5px;} -.sumTable {margin-left: auto; margin-right: auto; text-align: center; border: 1px solid #000000; width: 55%;} -.sumTable td {text-align: center;} -.gal span {position: relative; top: 4px;} -.gbar {width: 100%; height: 24px; background-color: #cccccc; text-align: center;} -#gtop {position: relative; top: 0px; left: 0px;} -#gbottom {position: relative; bottom: 0px; left: 0px; clear: both;} -.gnav {height: 24px; width: 75px; cursor: pointer;} -div.gnav:hover {background-color: #6d6d6d; text-decoration: underline;} -.gc {width: 100%; clear: both; text-align: center; padding: 5px 5px;} -#gsbt, #gsbb {position: absolute; left: 0px; top: 0px;} -#gspt, #gspb {position: absolute; left: 75px; top: 0px;} -#gsnt, #gsnb {position: absolute; right: 75px; top: 0px;} -#gset, #gseb {position: absolute; right: 0px; top: 0px;} -#gjt, #gjb {position: absolute; top: 0px; left: 150px; width: 230px;} -#gjt select , #gjb select, .setup select {width: 160px; height: 22px; text-align: center; background-color: #cccccc; border: 1px solid #6d6d6d;} -.gp {width: 596px; height: 596px; margin: 1px 1px; border: 1px dotted #000000; display: none; float: left;} -.gs {text-align: left; text-indent: 20px; width: 100%; height: 24px; position: relative; top: 0px; left: 0px; background-color: #cccccc;} -.gi {width: 596px; height: 572px;} -.setup { font-weight: normal; text-align: left; text-indent: 20px; width: 100%; height: 24px; position: relative; top: 0px; left: 0px; background-color: #cccccc; } -.bold { font-weight: bold; font-family: Courier; } \ No newline at end of file diff --git a/Tools/DCubeClient/share/DCubeServer/dcube.js.php b/Tools/DCubeClient/share/DCubeServer/dcube.js.php deleted file mode 100644 index 8f4c9463d906a5381a723c6f1c2961646e823ec6..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/share/DCubeServer/dcube.js.php +++ /dev/null @@ -1,365 +0,0 @@ -<?php -ob_start ("ob_gzhandler"); -header("Content-type: text/javascript; charset: UTF-8"); -header("Cache-Control: must-revalidate"); -$offset = 60 * 60 * 12; -$ExpStr = "Expires: " . - gmdate("D, d M Y H:i:s", - time() + $offset) . " GMT"; -header($ExpStr); -?> - -/** - * @file dcube.js.php - * @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl - * @brief A set of java script functions to deal with web display - * histograms. - */ -//! string with URL or PHP path -var where='./'; -//! DOM td element -var el; - -function createCookie(name,value,days) { - if (days) { - var date = new Date(); - date.setTime(date.getTime()+(days*24*60*60*1000)); - var expires = "; expires="+date.toGMTString(); - } - else var expires = ""; - document.cookie = name+"="+value+expires+"; path=/; domain=cern.ch"; -} - -function readCookie(name) { - var nameEQ = name + "="; - var ca = document.cookie.split(';'); - for(var i=0;i < ca.length;i++) { - var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1,c.length); - if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); - } - return null; -} - -function eraseCookie(name) { - createCookie(name,"",-1); -} - -function setGNumPicToShow( value ) { - gNumPicToShow = parseInt(value); -} -var gNumPicToShow = readCookie('DCubeServerPlotsPerPage'); -if ( gNumPicToShow == null ) { - gNumPicToShow = 20; -} else { - gNumPicToShow = parseInt(gNumPicToShow); -} - -/** - * @author Krzysztof Ciba - * @brief set status bar message - */ -function statusBar(message){ - window.status = message; -} -/** - * @author Krzysztof Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl) - * @brief slof for onclick event in dir/hist div - * @param id id for div to show/hide - */ -function showhide( id, fid, pid, src ) { - - var toShow = document.getElementById( id ); - var dirIcon = document.getElementById( fid ); - var plot = document.getElementById( pid ); - - if ( toShow.style.display === "none" || - toShow.style.display === "" ) { - toShow.style.display = "block"; - if ( fid !== null ) { - dirIcon.src = where+"./images/tdirectory_o.gif"; - } - if ( plot !== null ) { - showPlot( pid, src ); - } - } else { - toShow.style.display = "none"; - if ( fid !== null ) { - dirIcon.src = where+"./images/tdirectory_c.gif"; - } - } -} - - -function showPlot(id, src) { - var dd =document.getElementById( id ); - dd.src = loading.src; - plot = new Image(); - plot.src = src; - dd.src = plot.src; - return dd; -} - -/** - * @brief slot for show/hide legend - */ -function toggleLegend( ) { - legend = document.getElementById( "pval_legend" ); - if ( legend.style.display == "none" ) { - legend.style.display = "block"; - } else { - legend.style.display = "none"; - } -}; -function selPlot( id, src ) { - idNum = id.split("_")[1]; - var sel = new Array("reg_", "dif_", "prx_", "pry_"); - for ( var i = 0; i < sel.length; i++ ) { - sid = sel[i] + idNum; - if ( id === sid ) { - document.getElementById(sid).childNodes[0].style.backgroundImage = selLeft; - document.getElementById(sid).childNodes[1].style.backgroundImage = selBkg; - document.getElementById(sid).childNodes[1].style.color = "#ffffff"; - document.getElementById(sid).childNodes[2].style.backgroundImage = selRight; - } else { - unsel = document.getElementById( sid ); - if ( unsel != null ) { - unsel.childNodes[0].style.backgroundImage = pLeft; - unsel.childNodes[1].style.backgroundImage = pBkg; - unsel.childNodes[1].style.color = "#000000"; - unsel.childNodes[2].style.backgroundImage = pRight; - } - } - } - var dd=showPlot( "plot_" + idNum, src ); - var ap=dd.parentElement; - if (ap.tagName=='A' || ap.tagName=='a' ) { - ap.setAttribute('href','?rid='+id); - } -} - -function selPane( id ) { - var tids = new Array("t1", "t2", "t3", "t4"); - var cids = new Array("c1", "c2", "c3", "c4"); - cur_tid = "t" + id; - cur_cid = "c" + id; - for ( var i=0; i < tids.length; i++ ) { - if ( cur_tid == tids[i] ) { - document.getElementById(tids[i]).childNodes[0].style.backgroundImage = selLeft; - document.getElementById(tids[i]).childNodes[1].style.backgroundImage = selBkg; - document.getElementById(tids[i]).childNodes[1].style.color = "#ffffff"; - document.getElementById(tids[i]).childNodes[2].style.backgroundImage = selRight; - } else { - document.getElementById(tids[i]).childNodes[0].style.backgroundImage = pLeft; - document.getElementById(tids[i]).childNodes[1].style.backgroundImage = pBkg; - document.getElementById(tids[i]).childNodes[1].style.color = "#000000"; - document.getElementById(tids[i]).childNodes[2].style.backgroundImage = pRight; - } - if ( cur_cid != cids[i] ) { - document.getElementById(cids[i]).style.display = "none"; - } else { - document.getElementById(cids[i]).style.display = "block"; - } - } -} -//! 1st shown picture gallery -var gFirstPic = 0; - - -// open given picture -function selPic( id) { - var idNum = id.split("_")[1]; - var rid = "r_"+idNum; - var dd=document.getElementById(rid); - dd.onclick(); - if (rid!=id) { - var ad=document.getElementById(id); - ad.onclick(); - } - while (dd.parentElement.tagName=='DIV') { - dd=dd.parentElement; - if (dd.getAttribute("style")=="display: none;") { - dd.setAttribute("style","display: block;"); - } - } - return dd; -} - -function gSetFirstPic( val ) { - - sum = gFirstPic + val; - if ( sum < 0 ) { - gFirtsPic = 0; } - else if ( sum > picTable.length ) { - gFirstPic = sum - val; - } else { - gFirstPic = sum; - } -} - - -//! getNext -function gGetNext() { - gSetFirstPic( gNumPicToShow ); - to = gFirstPic+gNumPicToShow; - - if ( gFirstPic >= picTable.length ) { - gGetEnd(); - } - - if ( gFirstPic < picTable.length ) { - - if ( to <= picTable.length ) - gShow( picTable.slice(gFirstPic, to), picInfoTable.slice(gFirstPic, to) ); - - if ( to > picTable.length ) - gShow( picTable.slice( gFirstPic ) , picInfoTable.slice( gFirstPic ) ); - - gTitle( gFirstPic ); - - } -} -//! get previous -function gGetPrev() { - gSetFirstPic( -gNumPicToShow ); - - if ( gFirstPic < 0 ) { - gGetBeg(); - } else { - to = gFirstPic+gNumPicToShow; - - if ( to > picTable.length ) { - gShow(picTable.slice(gFirstPic), picInfoTable.slice(gFirstPic)); - } else { - gShow(picTable.slice(gFirstPic, to), picInfoTable.slice(gFirstPic, to)); - } - } - gTitle( gFirstPic ); -} -//! get end -function gGetEnd() { - - var gLast = ( picTable.length/gNumPicToShow ) * gNumPicToShow - ( picTable.length%gNumPicToShow ); - - if ( gLast == picTable.length ) gLast -= gNumPicToShow; - gFirstPic = gLast; - to = gLast+gNumPicToShow; - - - if ( to > picTable.length ) { - gShow( picTable.slice(gLast), picInfoTable.slice(gLast)); - } - - if ( to <= picTable.length ) { - gShow( picTable.slice(gLast, to), picInfoTable.slice(gLast, to ) ); - } - gTitle( gLast ); -} - -//! get begin -function gGetBeg() { - var toShow = new Array(); - gFirstPic = 0; - to = gFirstPic+gNumPicToShow; - if (to > picTable.length ) { - gShow( picTable.slice(gFirstPic), picInfoTable.slice(gFirstPic)); - } else { - gShow( picTable.slice(gFirstPic, to), picInfoTable.slice(gFirstPic, to)); - } - gTitle( gFirstPic ); -} - -function gOnLoad( show ) { - - if ( show === true ) { - document.getElementById("loading").display = ""; - } else { - document.getElementById("loading").display = "none"; - } - -} - -//! show pictures -function gShow( arr, arrInfo ) { - - //alert("arr.length" + arr.length ); - - for ( i = 0; i < gNumPicToShow; i++ ) { - var img = document.getElementById("gi_"+i); - img.src = loading.src; - } - - - for ( i = 0; i < gNumPicToShow; i++ ) { - var imgDiv = document.getElementById("gp_"+i); - var img = document.getElementById("gi_"+i); - var imgInfo = document.getElementById("gs_"+i) - - if ( i < arr.length ) { - if ( arr[i] != '' && arrInfo[i] != '' ) { - imgDiv.style.display = 'block'; - img.src = arr[i]; - img.style.display = 'block'; - imgInfo.innerHTML = arrInfo[i]; - } else if ( arrInfo[i] != '' && arr[i] == '' ) { - imgDiv.style.display = 'block'; - img.src = ''; - img.style.display= 'none'; - imgInfo.innerHTML = arrInfo[i]; - } else { - imgDiv.style.display = 'none'; - img.src = ''; - img.style.display = 'none'; - } - } else { - imgDiv.style.display = 'none'; - img.src = ''; - img.style.display = 'none'; - } - } - - -} - -//! select pictures -function gOnSelect( val ) { - gFirstPic = parseInt(val); - to = gFirstPic+gNumPicToShow; - if (to > picTable.length ) { - gShow( picTable.slice(gFirstPic), picInfoTable.slice(gFirstPic)); - - } else { - gShow( picTable.slice(gFirstPic, to), picInfoTable.slice(gFirstPic, to) ) ; - } - gTitle( gFirstPic ); -} - -//! set title -function gTitle( from ) { - - gtt = document.getElementById('gtt'); - gbt = document.getElementById('gbt'); - to = from + gNumPicToShow; - - if ( to > picTable.length ) to = picTable.length; - - if ( from == to ) { - gtt.innerHTML = "Last plot (Total: "+ picTable.length+" plots)"; - gbt.innerHTML = "Last plot (Total: "+ picTable.length+" plots)"; - } else { - gtt.innerHTML = "Plots from " + (from+1) + " to " + to + " (Total "+ picTable.length+" plots)"; - gbt.innerHTML = "Plots from " + (from+1) + " to " + to + " (Total "+ picTable.length+" plots)"; - } -} - - -function setupGallery( value ) { - createCookie( 'DCubeServerPlotsPerPage', value, 3650 ); - setGNumPicToShow( value ); - document.location.reload(); -} - -function setupPane( value ) { - createCookie( 'DCubeServerFirstPane', value, 3650 ); - setPane(value); -} \ No newline at end of file diff --git a/Tools/DCubeClient/share/DCubeServer/dcube.php b/Tools/DCubeClient/share/DCubeServer/dcube.php deleted file mode 100644 index e16d1532d97652b169fe26cee0c315c4c9efadae..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/share/DCubeServer/dcube.php +++ /dev/null @@ -1,1378 +0,0 @@ -<?php -/** - * @file dcube.php - * @author Krzysztof Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl) - * @date 30/05/2007 - * @brief The PHP part of dcube. "fri:d:cub" - * - * This is a part of dcube package - offline monitoring of root histograms. - * Copylefts (C) 2007 Krzysztof Ciba - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -// start gzip compression -ob_start("ob_gzhandler"); - -// set headers -header("Content-type: text/html; charset=utf-8"); -header("Cache-Control: must-revalidate"); -$offset = 60 * 60 * 12 ; -$ExpStr = "Expires: " . -gmdate("D, d M Y H:i:s", -time() + $offset) . " GMT"; -header($ExpStr); - -/** - * @class dcube_header - * @author Krzysztof Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl) - * @date 30/05/2007 - * - * @brief This class produces HTML header for DCubeServer page. - * - */ -class dcube_header { - - /** - * @param $project string with project name - * @param $version string with project version number - * @param $author string with my name :) - * @param $css path (absolute or relative) to CSS file - * @param $js path (absoulte or relative to JS file - * @param $where relative path to dcube.php file - */ - function dcube_header( $project, $version, $author, $css, $js, $where ) { - - - echo "\n<head>\n"; - echo "<title>".$version.$project." by ".$author." </title>\n"; - echo "<meta http-equiv='content-type' content='text/html; charset=utf-8'>\n"; - echo "<meta name ='description' content='DCubeServer page'>\n"; - echo "<meta name='keywords' content='webbased root histogram displaying ATLAS CERN DCube'>\n"; - echo "<meta http-equiv='content-language' content='en'>\n"; - echo "<meta name='generator' content='GNU Emacs 22.3.2'>\n"; - echo "<meta name='author' content='Krzysztof Daniel Ciba'>\n"; - echo "<link rel='stylesheet' href='./".$where."/".$css."' type='text/css'>\n"; - echo "<link rel='shortcut icon' href='./".$where."/images/favicon.gif' type='image/gif'>\n"; - echo "<link rel='icon' type='image/gif' href='./".$where."/images/favicon.gif'>\n"; - echo "<script type='text/javascript' src='./".$where."/preLoading.js'></script>\n"; - echo "<script type='text/javascript' src='./".$where."/".$js."'></script>\n"; - echo "</head>\n"; - - } - -} - -/** - * @class dcube_xml_parser - * @author Krzysztof Ciba <Krzysztof.Ciba@NOSPAMagh.edu.pl> - * - * @brief An awful XML parser. - */ -class dcube_xml_parser { - - var $parser; - var $data; - var $file; - var $currTag; - var $tagStack; - - /** - * @param $xml_file path (absoulte or relative) to XML file - */ - function dcube_xml_parser( $xml_file ) { - - $this->parser = xml_parser_create(); - $this->file = $xml_file; - $this->data = array(); - $this->currTag =& $this->data; - $this->tagStack = array(); - - } - - /** main worker here */ - function parse() { - - xml_set_object($this->parser, $this); - xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1); - xml_set_element_handler($this->parser, 'tag_open', 'tag_close'); - xml_set_character_data_handler($this->parser, 'cdata'); - if ( ! ( $fp = fopen($this->file, "r") ) ) { - die( "Cannot open XML file" . $this->file . "\n" ); - return false; - } - - while ($data = fread($fp, 4096)) { - if ( ! xml_parse( $this->parser, $data, feof( $fp ) ) ) { - die( sprintf( 'Error parsing XML file. %s. Line %d', - xml_error_string( xml_get_error_code($this->parser) ), - xml_get_current_line_number( $this->parser ) ) ); - return false; - } - } - - fclose($fp); - xml_parser_free($this->parser); - return true; - } - - /** function to run if opening tag is found */ - function tag_open( $parser, $name, $attribs ) { - - $name = strtolower($name); - $tagname = $name; - /* keep all plots together in one list, so we maintain the order in the xml */ - if ( $name == "hist1d" || $name == "hist2d" || $name == "graph" ) $name = "plot"; - - if( ! isset( $this->currTag[$name] ) ) - $this->currTag[$name] = array(); - $newTag = array(); - if( ! empty($attribs) ) { - /* give default icons for TH1 or TH2 or TGraph */ - $newTag['attr']['type']='TH1'; - if ( strstr($tagname, "hist2d") ) { - $newTag['attr']['type']='TH2'; - } - if ( strstr($tagname, "graph") ) { - $newTag['attr']['type']='TGraph'; - } - /* end fix */ - foreach( $attribs as $attrname => $attrvalue ) { - $newTag['attr'][strtolower($attrname)] = $attrvalue; - } - } - array_push( $this->currTag[$name], $newTag ); - $t =& $this->currTag[$name]; - $this->currTag =& $t[count($t)-1]; - array_push($this->tagStack, $name); - - } - - /* function to store CDATA into array */ - function cdata( $parser, $cdata ) { - $cdata = trim($cdata); - - if( ! empty($cdata) ) { - if(isset($this->currTag['cdata'])) - $this->currTag['cdata'] .= $cdata; - else - $this->currTag['cdata'] = $cdata; - } - } - - /* function to run if closing tag is found */ - function tag_close( $parser, $name ) { - $this->currTag =& $this->data; - array_pop($this->tagStack); - - for( $i = 0; $i < count($this->tagStack); $i++ ) { - $t =& $this->currTag[$this->tagStack[$i]]; - $this->currTag =& $t[count($t)-1]; - } - } - -} - -/** - * @class dcube_body - * @author Krzysztof Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl) - * - * @brief A class for displaying body part of DCubeServer page. - */ -class dcube_body { - - /** reference to XML parser */ - var $xml_parser; - - /** string with generated HTML */ - var $body; - - /** ??? */ - var $xml; - - /** default p-value limit for warning */ - var $pwarn = 0.95; - - /** default p-value limit for failed tests */ - var $pfail = 0.7; - - /** counter for histograms */ - var $id = 0; - - /** counter for directories */ - var $did = 0; - - /** ??? */ - var $plotDir = ""; - - /** histogram counter */ - var $hnum = 0; - - /** relative path from this file to the xml output file */ - var $where = ""; - - /** DOM script */ - var $script = ""; - - /** JS DOM table for img src */ - var $picTableJS = ""; - - /** JS DOM table for img info*/ - var $picInfoTableJS = ""; - - var $picNum = 0; - - var $numPicToShow = 20; - - /** - * @param $project string with name of project - * @param $version string with project version - * @param $author my name :) - * @param $xml_file XML file to parse and display - * @param $log_file path to log file from python processing - * @param $pDir directory with plots to display - * @param $lDir directory with log file - * @param $where relative path to dcube.php file - */ - function dcube_body( $project, $version, $author, $xml_file, $pDir, $log_file, $lDir, $where) { - - // set the directory with plot images - $this->plotDir = $pDir; - - $this->log_file = $log_file; - $this->log_dir = $lDir; - - $this->where = $where; - - // parse xml file - $this->xml_parser =& new dcube_xml_parser( $xml_file ); - $this->xml_parser->parse(); - $this->xml =& $this->xml_parser->data; - - // take values for prob limits - $this->pwarn = $this->xml["dcube"][0]["plimit"][0]["attr"]["warn"]; - // set to default if absent - if ( $this->pwarn == 0) $this->pwarn = 0.95; - $this->pfail = $this->xml["dcube"][0]["plimit"][0]["attr"]["fail"]; - // set to deafult if absent - if ( $this->pfail == 0) $this->pfail = 0.75; - - if ( isset($_COOKIE['DCubeServerPlotsPerPage'] ) ) { - $this->plotsPerPage = $_COOKIE['DCubeServerPlotsPerPage']; - } else { - $this->plotsPerPage = 20; - } - - if ( isset($_COOKIE['DCubeServerFirstPane'] ) ) { - $this->firstPane = $_COOKIE['DCubeServerFirstPane']; - } else { - $this->firstPane= "1"; - } - - echo "<body onload='jsfix();'>\n"; - echo "<div class='wrapper'>\n"; - echo "<div class='header'><b>".$version."</b>".$project." by ". - "<a href='mailto:Krzysztof.Ciba@NOSPAMagh.edu.pl?subject=dcube'>".$author."</a></div>\n"; - - - echo "<div class='container'>\n"; - - // configuration panel - echo "<div class='mid_panel'>"; - $this->configurationPanel(); - echo "</div>\n"; - - // static legend display - echo "<div class='legend' title='Show/hide legend window'>"; - $this->staticLegend(); - echo "</div>"; - - // main panel content - echo "<div class='content'>\n"; - $this->mainPanel(); - echo "</div>\n"; - - // end of container - echo "</div>\n"; - - // footer content - echo "<div class='footer'>"; - $this->footer(); - echo "</div>\n"; - - // end of wrapper - echo "</div>\n"; - - // display statistics tests legend - $this->testLegend(); - - /// moving out of body - echo "<script type='text/javascript'>\n"; - echo "<!--\n"; - echo "function jsfix() {\n"; - echo $this->script; - echo "document.getElementById('loading').style.display = 'none';\n"; - echo "}\n"; - // set the where variable - echo "var where ='".$this->where."';\n"; - echo "var loading = new Image();\n"; - echo "loading.src = where + './images/loading_plot.gif';\n"; - echo "var selBkg = 'url('+where+'/../images/sel_tabpane_bkg.gif)';\n"; - echo "var selLeft = 'url('+where+'/../images/sel_tabpane_left.gif)';\n"; - echo "var selRight = 'url('+where+'/../images/sel_tabpane_right.gif)';\n"; - echo "var pBkg = 'url('+where+'/../images/tabpane_bkg.gif)';\n"; - echo "var pLeft = 'url('+where+'/../images/tabpane_left.gif)';\n"; - echo "var pRight = 'url('+where+'/../images/tabpane_right.gif)';\n"; - echo "var picTable = new Array();\n"; - echo "var picInfoTable = new Array();\n"; - echo $this->picTableJS; - echo $this->picInfoTableJS; - echo "gGetBeg();\n"; - echo "selPane('".$this->firstPane."');\n"; - // allow for picture to be selected by url - if (isset($_GET["rid"])) { - $rid=$_GET["rid"]; - echo "selPic('".$rid."');\n"; - } - echo "-->\n"; - echo "</script>\n"; - echo "</body>\n"; - } - - - function staticLegend() { - - echo "<fieldset onclick='toggleLegend();'>\n"; - echo "<legend>Legend</legend>\n"; - echo "<table class='pval_table' title='Click here to show/hide legend'>"; - echo "<tr>\n"; - echo "<th>stats tests</th>\n"; - echo "<td class='ok' style='height: 32px;'>OK (p-value >".$this->pwarn.")</td>"; - echo "<td class='warn' style='height: 32px;'>WARN (".$this->pfail; - echo "<p-value<".$this->pwarn.")</td>\n"; - echo "<td class='fail' style='height: 32px;'>FAIL (p-value<".$this->pfail.")</td>\n"; - echo "<td class='absent' style='height: 32px;'> ABSENT (no test)</td>\n"; - echo "</tr>\n"; - echo "<tr>\n"; - echo "<td class='absent'>DCube status</td>"; - echo "<td class='plot'><img src='".$this->where."/images/green.gif' alt='Green'> OK</td>"; - echo "<td class='plot'><img src='".$this->where."/images/yellow.gif' alt='Yellow'> WARN</td>"; - echo "<td class='plot'><img src='".$this->where."/images/red.gif' alt='Red'> FAIL</td>"; - echo "<td class='absent'> ABSENT (no status)</td>"; - echo "</tr></table>\n"; - echo "</fieldset>\n"; - - } - - /** - * footer - Valid CSS, Valid HTML icons + anchors to documentation, download etc. - */ - function footer() { - - $url = "http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/Tools/DCubeClient/"; - echo "<a href='https://twiki.cern.ch/twiki/bin/view/Sandbox/DCubeDoc'>[ Documentation ]</a>\n"; - echo "<a href='http://validator.w3.org/check?uri=referer'>"; - echo "<img src='".$this->where."./images/valid-html401-blue.png' "; - echo "alt='Valid HTML 4.01 Strict' style='vertical-align: middle;' " . - "height='31' width='88'></a>\n"; - echo "<a href='http://jigsaw.w3.org/css-validator/check/referer'>"; - echo "<img src='".$this->where."./images/valid-css-blue.png' "; - echo "alt='Valid CSS!' style='vertical-align: middle;'></a>\n"; - echo "<a href='http://www.totalvalidator.com/validator/Revalidate?revalidate=true'>". - "<img src='".$this->where."/images/valid_n_html_401.gif' alt='Totally Valid HTML 4.01!' ". - "style='vertical-align: middle;'></a>\n"; - } - - - - function relpath ( $dest ) { - $here = explode ("/", realpath(".") ); - $to = explode ("/", realpath($dest) ); - $result = "."; - while ( implode ("/", $to) != implode ("/", $here) ) { - if (count($here)>count($to)) { - array_pop($here); - $result .= "/.."; - } else { - array_pop($to); - } - } - return str_replace("//", - "/", - $result . str_replace( implode ("/", $to), - "", - realpath($dest)).(@is_dir(realpath($dest)) ? "/" : "" ) ); - } - - /** - * @brief displays monitored and reference filenames, descriptions, time stamp etc. - */ - function configurationPanel() { - - $mon = $this->xml["dcube"][0]["monitored"][0]["attr"]["file"]; - $ref = $this->xml["dcube"][0]["reference"][0]["attr"]["file"]; - $test_desc = $this->xml["dcube"][0]["test_desc"][0]["cdata"]; - $ref_desc = $this->xml["dcube"][0]["ref_desc"][0]["cdata"]; - $branch = $this->xml["dcube"][0]["attr"]["branch"]; - $install = $this->xml["dcube"][0]["attr"]["install"]; - $cmtconfig = $this->xml["dcube"][0]["attr"]["cmtconfig"]; - $project = $this->xml["dcube"][0]["attr"]["project"]; - $jobId = $this->xml["dcube"][0]["attr"]["jobid"]; - $date = $this->xml["dcube"][0]["date"][0]["cdata"]; - - - if ( file_exists( $mon ) ) { - $mon = "<a href='".$this->relpath( realpath($mon) )."'>".$mon."</a>"; - } - - if ( file_exists( $ref ) ) { - $ref = "<a href='".$this->relpath( realpath($ref) )."'>".$ref."</a>"; - } - if ( $test_desc == "PUT YOUR TEST DESCRIPTION HERE" ) - $test_desc = "—"; - if ( $ref_desc == "PUT YOUR REFERENCE DESCRIPTION HERE" ) - $ref_desc = "—"; - - - echo "Test desc.: <span class='bold'>".$test_desc."</span><br>\n"; - echo "Date: <span class='bold'>".$date."</span><br>\n"; - echo "BRANCH: <span class='bold'>".$branch."</span> "; - echo "INSTALL: <span class='bold'>".$install."</span> \n"; - echo "CMTCONFIG: <span class='bold'>".$cmtconfig."</span> \n"; - echo "PROJECT: <span class='bold'>".$project."</span> \n"; - echo "JOB ID: <span class='bold'>".$jobId."</span><br>\n"; - echo "Monitored root file: ".$mon."<br>\n"; - echo "Reference root file: ".$ref."<br>\n"; - echo "Reference file descr.: <span class='bold'>".$ref_desc."</span><br>\n"; - - - if ( $this->log_file != "" ) { - echo "Log file: <a href=\"".$this->log_file."\">[ as plain text ]</a>"; - echo " <a href=\"./dcubelog.php\">[ as HTML ]</a><br>"; - } else { - echo "Log file:<i>Log file not available.</i><br>\n"; - } - - } - - /** - * @brief produces histograms/directories DIV - */ - function mainPanel( ) { - - echo "<br>"; - - // tabpanel bar - echo "<div class='tabbar'>"; - - // 1st button - echo "<div id='t1' class='tabpane' onClick='selPane(\"1\");'>"; - echo "<div class='sel_tp_left'></div>"; - echo "<div class='sel_tp_title'>Normal view</div>"; - echo "<div class='sel_tp_right'></div>"; - echo "</div>"; - - // 2nd button - echo "<div id='t2' class='tabpane' onClick='selPane(\"2\");'>"; - echo "<div class='tp_left'></div>"; - echo "<div class='tp_title'>Plots View</div>"; - echo "<div class='tp_right'></div>"; - echo "</div>"; - - // 3rd button - echo "<div id='t3' class='tabpane' onClick='selPane(\"3\");'>"; - echo "<div class='tp_left'></div>"; - echo "<div class='tp_title'>Summary</div>"; - echo "<div class='tp_right'></div>"; - echo "</div>"; - - // 4th button - echo "<div id='t4' class='tabpane' onClick='selPane(\"4\");'>"; - echo "<div class='tp_left'></div>"; - echo "<div class='tp_title'>Settings</div>"; - echo "<div class='tp_right'></div>"; - echo "</div>"; - - // end of tabpanel - echo "</div>"; - - // content panel - echo "<div class='contentPane' >\n"; - - // normal, tree-like view - echo "<div id='c1' class='tp'>"; - - // header row - echo "<div class='tdir'>"; - echo "<div class='tdir0'><div class='absent'>name</div></div>"; - echo "<div class='tdir1'><div class='absent'>K-S test</div></div>"; - echo "<div class='tdir1'><div class='absent'>χ² test</div></div>"; - echo "<div class='tdir1'><div class='absent'>\"bin-by-bin\" test</div></div>"; - echo "<div class='tdir1'><div class='absent'>DCube status</div></div>"; - echo "</div>\n"; - - // directory tree - $rootDir = $this->xml["dcube"][0]["tdirectory"][0]; - if ( is_array($rootDir) ) { - $this->id = 0; - $this->treeView($rootDir, 0); - } else { - echo "<span style='color: red;'> root (/) TDirectory not found in output xml file!</span><br>"; - } - - echo "</div>\n"; - - // plots view - echo "<div id='c2' class='tp' style='display: none; text-align: left;'>\n"; - $this->plotView($rootDir, "/", "prow_1_1"); - echo "</div>\n"; - - // summary view - echo "<div id='c3' class='tp' style='display: none;'>"; - $this->summaryViewDIV(); - echo "</div>\n"; - - // settings - echo "<div id='c4' class='tp' style='display: none;'>"; - $this->settingsView(); - echo "</div>\n"; - - echo "</div>"; - // end of content panel - - echo "<br>"; - - } - - - function settingsView() { - echo "<fieldset>"; - echo "<legend> Display </legend>"; - echo "<div class='setup'> When loading DCube page show "; - - $arr = array( 1 => "Normal View", - 2 => "Plots View", - 3 => "Summary", - 4 => "Settings" ); - - echo "<select id='gSelectPane' onChange='createCookie( \"DCubeServerFirstPane\", this.value, 3650 );'>"; - - foreach ( $arr as $key => $value ) { - echo "<option value='".$key."'"; - if ( $this->firstPane == $key ) echo " selected='selected'"; - echo ">".$value."</option>"; - } - - echo "</select> tabpane first. </div>"; - echo "</fieldset>"; - - echo "<fieldset>"; - echo "<legend> Plots view </legend>"; - echo "<div class='setup'> Show "; - echo "<select id='gSelectPlotsPerPage' onChange='setupGallery( this.value );'>"; - - $arr = array(5, 10, 20, 50, 500); - foreach ( $arr as $value ) { - echo "<option name='".$value."' value='".$value."'"; - if ( $value == $this->plotsPerPage ) echo " selected='selected'"; - echo ">".$value."</option>"; - } - echo "</select> plots per page <i>(triggers page reloading)</i></div>"; - echo "</fieldset>"; - } - - /** - * @brief displays p-value test legend (transparend box in upper-right corner of the page) - */ - function testLegend( ) { - - echo "<div title='Click here to hide legend' id='pval_legend' " . - "class='pval_legend' onclick='toggleLegend();' style='display: none; background: #ffffff; z-index: 10000;'>"; - echo "<table class='pval_table' title='Click here to hide legend'>"; - echo "<tr>\n"; - echo "<th>stats tests</th>\n"; - echo "<td class='ok' style='height: 32px;'>OK (p-value >".$this->pwarn.")</td>"; - echo "<td class='warn' style='height: 32px;'>WARN (".$this->pfail; - echo "<p-value<".$this->pwarn.")</td>\n"; - echo "<td class='fail' style='height: 32px;'>FAIL (p-value<".$this->pfail.")</td>\n"; - echo "<td class='absent' style='height: 32px;'> ABSENT (no test)</td>\n"; - echo "</tr>\n"; - echo "<tr>\n"; - echo "<td class='absent'>DCube status</td>"; - echo "<td class='plot'><img src='".$this->where."/images/green.gif' alt='Green'> OK</td>"; - echo "<td class='plot'><img src='".$this->where."/images/yellow.gif' alt='Yellow'> WARN</td>"; - echo "<td class='plot'><img src='".$this->where."/images/red.gif' alt='Red'> FAIL</td>"; - echo "<td class='absent'> ABSENT (no status)</td>"; - echo "</tr></table>\n"; - echo "</div>\n"; - - } - - /** - * @brief Summary View content - */ - function summaryViewDIV() { - - $summaryNode = $this->xml["dcube"][0]["summary"][0]; - - $status = $summaryNode["attr"]["status"]; - if ( $status == "OK" ) - $status = "<img src='".$this->where."./images/green.gif' alt='Green'>"; - if ( $status == "WARN" ) - $status = "<img src='".$this->where."./images/yellow.gif' alt='Yellow'>"; - if ( $status == "FAIL" ) - $status = "<img src='".$this->where."./images/red.gif' alt='Red'>"; - - - echo "<div class='si' style='text-align: center;'>"; - echo " Overall status: ".$status." ".$summaryNode["attr"]["status"]."<br>"; - echo " Objects processed: ".$summaryNode["attr"]["objs"]; - echo "</div><br>"; - - echo "<div style='text-align: center;'>"; - echo "<table class='sumTable'>"; - - $nodeKS = $summaryNode["table"][0]["tr"][1]["td"]; - $rowKS = "<td>".($nodeKS[1]["cdata"]+0)."</td>". - "<td>".($nodeKS[2]["cdata"]+0)."</td>". - "<td>".($nodeKS[3]["cdata"]+0)."</td></tr>"; - - $nodeChi2 = $summaryNode["table"][0]["tr"][2]["td"]; - $rowChi2 = "<td>".($nodeChi2[1]["cdata"]+0)."</td>". - "<td>".($nodeChi2[2]["cdata"]+0)."</td>". - "<td>".($nodeChi2[3]["cdata"]+0)."</td></tr>"; - - $nodeBBB = $summaryNode["table"][0]["tr"][3]["td"]; - $rowBBB = "<td>".($nodeBBB[1]["cdata"]+0)."</td>". - "<td>".($nodeBBB[2]["cdata"]+0)."</td>". - "<td>".($nodeBBB[3]["cdata"]+0)."</td></tr>"; - - $nodeMeanY = $summaryNode["table"][0]["tr"][4]["td"]; - $rowMeanY = "<td>".($nodeMeanY[1]["cdata"]+0)."</td>". - "<td>".($nodeMeanY[2]["cdata"]+0)."</td>". - "<td>".($nodeMeanY[3]["cdata"]+0)."</td></tr>"; - - $nodeSUM = $summaryNode["table"][0]["tr"][5]["td"]; - $rowSUM = "<td>".($nodeSUM[1]["cdata"]+0)."</td>". - "<td>".($nodeSUM[2]["cdata"]+0)."</td>". - "<td>".($nodeSUM[3]["cdata"]+0)."</td></tr>"; - - $nodeFRAC = $summaryNode["table"][0]["tr"][6]["td"]; - $rowFRAC = "<td>".($nodeFRAC[1]["cdata"]+0)."%</td>". - "<td>".($nodeFRAC[2]["cdata"]+0)."%</td>". - "<td>".($nodeFRAC[3]["cdata"]+0)."%</td></tr>"; - - echo "<tr><th>test</th><td class='ok'>OK</td>". - "<td class='warn'>WARN</td>". - "<td class='fail'>FAIL</td></tr>"; - - echo "<tr><th>K-S</th>".$rowKS; - echo "<tr><th>χ²</th>".$rowChi2; - echo "<tr><th>\"bin-by-bin\"</th>".$rowBBB; - echo "<tr><th>\"mean y\"</th>".$rowMeanY; - echo "<tr><th>sum</th>".$rowSUM; - echo "<tr><th>fractions</th>".$rowFRAC; - echo "</table>"; - echo "</div><br>"; - - $nbErrors = $summaryNode["attr"]["errors"]; - - echo "<div class='si'>"; - echo " Errors: ".($nbErrors+0); - - - $errorsNode = $summaryNode["errors"][0]["error"]; - - if ( is_array( $errorsNode ) ) { - echo "<ul>"; - foreach ( $errorsNode as $key => $error ) { - $what = $error["attr"]["what"]; - $times = $error["attr"]["times"]; - echo "<li>" . $what ." - occured ". $times . " time(s)"; - } - echo "</ul>"; - } - - echo "</div>"; - } - - - - // tree-like view - function treeView( $dirNode, $level=0 ) { - - $dirName = $dirNode["attr"]["name"]; - $displayName = $this->displayName( $dirName, $level ); - - $tab = str_repeat(" ", $level); - $this->id++; - - // set the counters for stat test - $dirNode["KS"] = array( "OK" => 0, "WARN" => 0, "FAIL" => 0 ); - $dirNode["chi2"] = array( "OK" => 0, "WARN" => 0, "FAIL" => 0 ); - $dirNode["bbb"] = array( "OK" => 0, "WARN" => 0, "FAIL" => 0 ); - - echo "<div id='d_".($this->id+0)."' class='dir' "; - if ( $level <= 1 ) - echo "style='display: block' "; - else - echo "style='display: auto' "; - echo " title='".$this->$dirName."' onmouseover=\"statusBar('TDirectory ".$dirName."');\"". - "onclick=\"showhide('dc_".($this->id+0)."', 'di_".($this->id+0)."');\">"; - - echo "<div class='dir0'>".$tab; - if ( $dirName != "/" ) { - echo "<img id='di_".($this->id+0)."' src='".$this->where."./images/tdirectory_c.gif' alt='folder icon'> "; - } else { - echo "<img id='di_".($this->id+0)."' src='".$this->where."./images/tdirectory_o.gif' alt='folder icon'> "; - } - echo $displayName; - echo "</div>"; - - // summary tables - echo "<div class='dir1' id='KS_".($this->id+0)."'>"; - $this->sumDirTABLE( $dirNode, "ks"); - echo "</div>"; - echo "<div class='dir1' id='chi2_".($this->id+0)."'>"; - $this->sumDirTABLE( $dirNode, "chi2"); - echo "</div>"; - echo "<div class='dir1' id='bbb_".($this->id+0)."'>"; - $this->sumDirTABLE( $dirNode, "bbb"); - echo "</div>"; - - // DCube processing status - $status = $dirNode["attr"]["status"]; - echo "<div class='dir1'><img src='"; - if ( strstr($status, "OK") ) { - echo $this->where."./images/green.gif' alt='Green' id='dqb_".($this->id+0)."'>"; - } else if ( strstr($status, "WARN") ) { - echo $this->where."./images/yellow.gif' alt='yellow' id='dqb_".($this->id+0)."'>"; - } else { - echo $this->where."./images/red.gif' alt='red' id='dqb_".($this->id+0)."'>"; - } - echo "</div>"; - - echo "</div>\n"; - - - if ( $level < 1 ) { - echo "<div id='dc_".($this->id+0)."' class='dirc' style='display: auto;'>"; - } else { - echo "<div id='dc_".($this->id+0)."' class='dirc' style='display: none;'>"; - } - - $subDirs = $dirNode["tdirectory"]; - if ( is_array($subDirs) ) { - foreach ( $subDirs as $nb => $subdir ) { - $this->treeView( $subdir, $level+1 ); - } - } - - $hists = $dirNode["plot"]; - if ( is_array( $hists ) ) { - foreach ( $hists as $hist ) { - $this->histDiv( $hist, $level+1, $dirNode); - } - } - - echo "</div>\n"; - } - - function sumDirTABLE( $dirNode, $test ) { - - echo "<table class='st'>"; - echo "<tr>"; - - $testOK = $dirNode["attr"][$test . "ok"]; - if ( $testOK != 0 ) { - echo "<td class='ok'>" . $testOK . "</td>"; - } else - echo "<td class='eok'>—</td>"; - - $testWARN = $dirNode["attr"][$test . "warn"]; - if ( $testWARN != 0 ) { - echo "<td class='warn'>" .$testWARN . "</td>"; - } else - echo "<td class='ewarn'>—</td>"; - - $testFAIL = $dirNode["attr"][$test . "fail"]; - if ( $testFAIL != 0 ) { - echo "<td class='fail'>" . $testFAIL . "</td>"; - } else - echo "<td class='efail'>—</td>"; - - echo "</tr></table>"; - } - - - function histDiv( $hist, $level, $parDir) { - - $this->id++; - $tab = str_repeat(" ", $level); - - $histName = $hist["attr"]["name"]; - $displayName = $this->displayName( $histName, $level ); - $type = $hist["attr"]["type"]; - - - // DCube status - $tests = $hist["attr"]["stest"]; - $plots = $hist["attr"]["plots"]; - $stat = $hist["attr"]["status"]; - - $regSrc = $hist["img"][0]["attr"]["src"]; - - $picInfo = ""; - if ( strstr($stat, "FAIL") ) { - $status = explode(";", $stat ); - $picInfo .= "STATUS: ". $status[0] . " — " . $status[1]; - } else { - $picInfo .= "TESTS: " . $tests; - } - - $this->picTableJS .= "picTable[".($this->picNum+0)."]='".$regSrc."';\n"; - $this->picInfoTableJS .= "picInfoTable[".($this->picNum+0)."]='<span>#".($this->picNum+1)." ".$picInfo."</span>';\n"; - $this->picNum++; - - $showhide = " showhide('hc_".($this->id+0)."', null, 'plot_".$this->id."', '".$regSrc."');"; - - // allow for picture to be selected by url - $rid=("r_".($this->id)); - - if ( strstr($type, "TH1") ) $icon = "h1"; - if ( strstr($type, "TH2") ) $icon = "h2"; - if ( strstr($type, "TGraph") || strstr($type, "TEfficiency") ) $icon = "graph"; - if ( strstr($type, "TProfile") ) $icon = "profile"; - - if ( $level == 1 ) { - echo "<div id='".$rid."' class='his' style='display: block;' title='".$histName."' ". - "onmouseover=\"statusBar('".$type." ".$histName."');\" onclick=\"".$showhide."\">"; - } else { - echo "<div id='".$rid."' class='his' style='display: auto;' title='".$histName."' ". - "onmouseover=\"statusBar('".$type." ".$histName."');\" onclick=\"".$showhide."\">"; - } - - echo "<div class='his0'>".$tab. - "<img src='".$this->where."./images/".$icon.".gif' alt='icon'> ".$displayName; - echo "</div>"; - - - $pvalNode = $hist["stat"][0]["pvalue"]; - - $test0 = $pvalNode[0]["attr"]["test"]; - $test1 = $pvalNode[1]["attr"]["test"]; - $test2 = $pvalNode[2]["attr"]["test"]; - - $pval0 = $pvalNode[0]["cdata"]; - $pval1 = $pvalNode[1]["cdata"]; - $pval2 = $pvalNode[2]["cdata"]; - - $stat0 = $pvalNode[0]["attr"]["status"]; - $stat1 = $pvalNode[1]["attr"]["status"]; - $stat2 = $pvalNode[2]["attr"]["status"]; - - $pvals = array( $test0 => $pval0, $test1 => $pval1, $test2 => $pval2 ); - $stats = array( $test0 => $stat0, $test1 => $stat1, $test2 => $stat2 ); - - if ( strstr($type, "TProfile") ) { - - echo "<div class='his1' style='width: 48.5%;'>"; - $pval = "<span style='font-size: 8pt;'>|μ<sup>eff</sup>(mon) - μ<sup>eff</sup>(ref)| = ".$pvals["meanY"]."</span>"; - if ( $stats["meanY"] == "OK" ) { - echo "<div class='ok' style='margin: auto auto;'>".$pval."</div>"; - } else if ( $stats["meanY"] == "WARN" ) { - echo "<div class='warn' style='margin: auto auto;'>".$pval."</div>"; - } else if ( $stats["meanY"] == "FAIL" ) { - echo "<div class='fail' style='margin: auto auto;'>".$pval."</div>"; - } else { - echo "<div class='absent' style='margin: auto auto;'>—</div>"; - } - echo "</div>"; - - } else { - echo $this->pvalueDIV( $pvals["KS"], $stats["KS"] ); - echo $this->pvalueDIV( $pvals["chi2"], $stats["chi2"] ); - echo $this->pvalueDIV( $pvals["bbb"], $stats["bbb"] ); - } - - - - // DCube status - $tests = $hist["attr"]["stest"]; - $plots = $hist["attr"]["plots"]; - $stat = $hist["attr"]["status"]; - - $status = $stat . $tests . $plots; - - echo "<div title='DCube status' class='his1'>"; - if ( strstr($status, "FAIL") ) { - echo "<img src='".$this->where."./images/red.gif' alt='Red'>"; - } else if ( strstr($status, "WARN") ) { - echo "<img src='".$this->where."./images/yellow.gif' alt='Yellow'>"; - } else { - echo "<img src='".$this->where."./images/green.gif' alt='Green'>"; - } - echo "</div>"; - echo "</div>"; - - $this->histContentsDIV( $hist, $this->id ); - } - - - /** - * @brief display DIV with histogram/plot or progfile contents - */ - function histContentsDIV( $histNode, $id ) { - - $type = $histNode["attr"]["type"]; - $name = $histNode["attr"]["name"]; - $status = $histNode["attr"]["status"]; - - echo "\n<div id='hc_".$id."' class='hc' style='display: none;'>"; - echo "<span style='font-size: 14pt;'>Name: <tt>".$name."</tt> Type: <tt>".$type."</tt></span><br><br>"; - - if ( strlen($status) ) { - $status = explode(";", $status); - echo "<span style='color: red'>" . $status[0] . " — " . $status[1] . "</span><br>"; - - } else { - - $imgNodes = $histNode["img"]; - - $this->statbox( $histNode, $type ); - - - echo "<div class='tabbar'>"; - $pid = "plot_" . $this->id; - - $reg = ""; - foreach ( $imgNodes as $key => $val ) { - - $src = $val["attr"]["src"]; - $type = $val["attr"]["type"]; - if ( $reg == "" ) $reg = $src; - - $id = $type . "_" . $this->id; - - echo "<div id='".$id."' class='tabpane' onClick='selPlot(\"".$id."\", \"".$src."\");'>"; - - if ( strstr($type, "reg") ) { - echo "<div class='sel_tp_left'></div>"; - echo "<div class='sel_tp_title'>Normal plot</div>"; - echo "<div class='sel_tp_right'></div>"; - echo "</div>"; - } else { - echo "<div class='tp_left'></div>"; - if ( $type == "log" ) $type = "Log"; - if ( $type == "dif" ) $type = "Diff"; - if ( $type == "prx" ) $type = "Proj X"; - if ( $type == "pry" ) $type = "Proj Y"; - $type .= " plot"; - echo "<div class='tp_title'>".$type."</div>"; - echo "<div class='tp_right'></div>"; - echo "</div>"; - } - } - - echo "</div>"; - - echo "<div class='contentPane'>\n"; - - echo "<div class='tp'>"; - // provide a link to this picture - echo "<a href='?rid=r_".$this->id."'><img class='plot' alt='plot' id='".$pid."' src='".$this->where."./images/loading_plot.gif'></a>"; - echo "</div>"; - - echo "</div>"; - - } - echo "</div>"; - } - /** - * @param $pval pvalue - * @param $status test status - */ - function pvalueDIV( $pval, $status ) { - - echo "<div class='his1'>"; - - if ( $status == "OK" ) { - echo "<div class='ok'>".$pval."</div>"; - } else if ( $status == "WARN" ) { - echo "<div class='warn'>".$pval."</div>"; - } else if ( $status == "FAIL" ) { - echo "<div class='fail'>".$pval."</div>"; - } else { - echo "<div class='absent'>—</div>"; - } - echo "</div>"; - } - - - // change the display name if longer than 35 characters - function displayName( $name, $level ) { - $where = ($level-1)*5; - - if ( ( strlen($name) + $where ) > 35 ) { - - $where = 35 - $where + ($level-1)*3 -1; - - if ( $where + 8 < strlen($name) ) { - $beg = substr( $name, 0, $where); - $end = substr( $name, -3); - $name = $beg . "(...)" .$end; - } - } - return $name; - } - - /** - * function to display "plot view" - */ - function plotView( $object, $dirname , $pid ) { - - $steps = $this->picNum / $this->plotsPerPage; - $steps = (int)$steps; - $rest = $this->picNum % $this->plotsPerPage; - echo "<div class='gal'>"; - - // top bar - echo "<div class='gbar' id='gtop'>"; - echo "<span id='gtt'></span>"; - echo "<div class='gnav' id='gsbt' onClick='gGetBeg();' title='Begin'><span><<<</span></div>"; - echo "<div class='gnav' id='gspt' onClick='gGetPrev();' title='Previous'><span><</span></div>"; - echo "<div class='gnav' id='gjt' title='Jump to...'>Jump: "; - echo "<select id='gst' onchange='gOnSelect(this.value);'>"; - if ( $steps > 0 ) { - for ($i = 0; $i < $steps; $i++ ) { - $val = $i*$this->plotsPerPage; - $beg = $val+1; - $end = ($i+1)*$this->plotsPerPage; - echo "<option value='".$val."'>".$beg." - ".$end."</option>"; - } - } - if ( $rest > 0 ) { - $val = $steps*$this->plotsPerPage; - $beg = $steps*$this->plotsPerPage+1; - $end = $beg + $rest-1; - echo "<option value='".$val."'>".$beg." - ".$end."</option>"; - } - echo "</select>"; - echo "</div>"; - echo "<div class='gnav' id='gsnt' onClick='gGetNext();' title='Next'><span>></span></div>"; - echo "<div class='gnav' id='gset' onClick='gGetEnd();' title='End'><span>>>></span></div>"; - echo "</div>"; - - // galery content - echo "<div class='gc'>"; - - for ($i = 0; $i < $this->plotsPerPage; $i++ ) { - echo "\n<div class='gp' id='gp_".($i+0)."'><div class='gs' id='gs_".($i+0)."'></div>"; - echo "<img class='gi' id='gi_".($i+0)."' src='' alt='plot'></div>"; - } - echo "</div>\n"; - - // bottom bar - echo "<div class='gbar' id='gbottom'>"; - echo "<span id='gbt'></span>"; - echo "<div class='gnav' id='gsbb' onClick='gGetBeg();' title='Begin'><span><<<</span></div>"; - echo "<div class='gnav' id='gspb' onClick='gGetPrev();' title='Previuos'><span><</span></div>"; - echo "<div class='gnav' id='gjb' title='Jump to...'>Jump: "; - echo "<select id='gsb' onchange='gOnSelect(this.value);'>"; - if ( $steps > 0 ) { - for ($i = 0; $i < $steps; $i++ ) { - $val = $i*$this->plotsPerPage; - $beg = $val+1; - $end = ($i+1)*$this->plotsPerPage; - echo "<option value='".$val."'>".$beg." - ".$end."</option>"; - } - } - if ( $rest > 0 ) { - $val = $steps*$this->plotsPerPage; - $beg = $steps*$this->plotsPerPage+1; - $end = $beg + $rest-1; - echo "<option value='".$val."'>".$beg." - ".$end."</option>"; - } - - echo "</select>"; - echo "</div>\n"; - echo "<div class='gnav' id='gsnb' onClick='gGetNext();' title='Next'><span>></span></div>"; - echo "<div class='gnav' id='gseb' onClick='gGetEnd();' title='End'><span>>>></span></div>"; - echo "</div>"; - - // end of gallery - echo "</div>\n"; - } - - - /** - * @brief produces basic statistic div - * @param object XML node - * @param type root type - */ - function statbox( $object, $type ) { - - $obj = $object["stat"][0]; - - if ( strstr($type, "TGraph" ) || strstr($type, "TEfficiency" ) ) { - - $p = $obj["points"][0]["cdata"]; - $rp = $obj["points"][0]["attr"]["ref"]; - - $m = $obj["mean"][0]["cdata"]; - $rm = $obj["mean"][0]["attr"]["ref"]; - - $r = $obj["rms"][0]["cdata"]; - $rr = $obj["rms"][0]["attr"]["ref"]; - - echo "<table class='center' style='width: 60%; font-size: 10pt;'>"; - - echo "<tr><th></th><th>monitored</th><th>reference</th></tr>"; - - echo "<tr><td class='bl'>Points</td><td class='bc'>".($p+0)."</td>"; - echo "<td class='bc'>"; - if ( $rp != "" ) { - echo ($rp+0); - } else { - echo "—"; - } - echo "</td></tr>"; - - echo "<tr><td class='yl'>Mean</td><td class='yc'>".($m+0)."</td>"; - echo "<td class='yc'>"; - if ( $rm != "" ) { - echo ($rm+0); - } else { - echo "—"; - } - echo "</td></tr>"; - - echo "<tr><td class='bl'>RMS</td><td class='bc'>".($r+0)."</td>"; - echo "<td class='bc'>"; - if ( $rr != "" ) { - echo ($rr+0); - } else { - echo "—"; - } - echo "</td></tr>"; - - echo "</table>\n"; - - } else { - - $e = $obj["entries"][0]["cdata"] + 0; - $re = $obj["entries"][0]["attr"]["ref"] + 0; - - $xbin = $obj["dim"][0]["attr"]["bins"]; - $ybin = $obj["dim"][1]["attr"]["bins"]; - - $xu = $obj["dim"][0]["underflow"][0]["cdata"] + 0; - $xo = $obj["dim"][0]["overflow"][0]["cdata"] + 0; - - $yu = $obj["dim"][1]["underflow"][0]["cdata"] + 0; - $yo = $obj["dim"][1]["overflow"][0]["cdata"] + 0; - - $rxu = $obj["dim"][0]["underflow"][0]["attr"]["ref"] + 0; - $rxo = $obj["dim"][0]["overflow"][0]["attr"]["ref"] + 0; - - $ryu = $obj["dim"][1]["underflow"][0]["attr"]["ref"] + 0; - $ryo = $obj["dim"][1]["overflow"][0]["attr"]["ref"] + 0; - - - $xm = $obj["dim"][0]["mean"][0]["cdata"]; - $xm_unc = $obj["dim"][0]["mean_unc"][0]["cdata"]; - - $rxm = $obj["dim"][0]["mean"][0]["attr"]["ref"]; - $rxm_unc = $obj["dim"][0]["mean_unc"][0]["attr"]["ref"]; - - $ym = $obj["dim"][1]["mean"][0]["cdata"]; - $ym_unc = $obj["dim"][1]["mean_unc"][0]["cdata"]; - - $rym = $obj["dim"][1]["mean"][0]["attr"]["ref"]; - $rym_unc = $obj["dim"][1]["mean_unc"][0]["attr"]["ref"]; - - - $xrms = $obj["dim"][0]["rms"][0]["cdata"]; - $xrms_unc = $obj["dim"][0]["rms_unc"][0]["cdata"]; - - $rxrms = $obj["dim"][0]["rms"][0]["attr"]["ref"]; - $rxrms_unc = $obj["dim"][0]["rms_unc"][0]["attr"]["ref"]; - - $yrms = $obj["dim"][1]["rms"][0]["cdata"]; - $yrms_unc = $obj["dim"][1]["rms_unc"][0]["cdata"]; - - $ryrms = $obj["dim"][1]["rms"][0]["attr"]["ref"]; - $ryrms_unc = $obj["dim"][1]["rms_unc"][0]["attr"]["ref"]; - - - echo "<table class='center' style='width: 60%; font-size: 10pt;'>"; - - echo "<tr><th></th><th>monitored</th><th>reference</th></tr>"; - - echo "<tr><td class='bl'>Entries</td><td class='bc'>".($e+0)."</td>"; - echo "<td class='bc'>"; - if ( $re != "" ) { - echo ($re+0); - } else { - echo "—"; - } - echo "</td></tr>"; - - echo "<tr><td class='yl'>Underflows</td><td class='yc'>".($xu+$yu)."</td>"; - echo "<td class='yc'>"; - if ( $rxu.$ryu != "" ) { - echo ($rxu+$ryu); - } else { - echo "—"; - } - echo "</td></tr>"; - - echo "<tr><td class='bl'>Overflows</td><td class='bc'>".($xo+$yo)."</td>"; - echo "<td class='bc'>"; - if ( $rxo.$ryo != "" ) { - echo ($rxo+$ryo); - } else { - echo "—"; - } - echo "</td></tr>"; - - // x - echo "<tr><td class='yl'>Bins(x)</td><td class='yc' colspan='2'>".$xbin."</td></tr>"; - - echo "<tr><td class='bl'>Mean(x)</td><td class='bc'>".$xm."±".$xm_unc."</td>"; - echo "<td class='bc'>"; - if ( $rxm != "" ) { - echo $rxm."±".$rxm_unc; - } else { - echo "—"; - } - echo "</td></tr>"; - - echo "<tr><td class='yl'>RMS(x)</td><td class='yc'>".$xrms."±".$xrms_unc."</td>"; - echo "<td class='yc'>"; - if ( $rxrms != "" ) { - echo $rxrms."±".$rxrms_unc; - } else { - echo "—"; - } - echo "</td></tr>"; - - - if ( strstr($type,"2") || strstr($type, "TProfile" ) ) { - - // y - echo "<tr><td class='bl'>Bins(y)</td><td class='bc' colspan='2'>".$ybin."</td></tr>"; - - echo "<tr><td class='yl'>Mean(y)</td><td class=\"yc\">".$ym."±".$ym_unc."</td>"; - echo "<td class='yc'>"; - if ( $rym != "" ) { - echo $rym."±".$rym_unc; - } else { - echo "—"; - } - echo "</td></tr>"; - - echo "<tr><td class='bl'>RMS(y)</td><td class='bc'>".$yrms."±".$yrms_unc."</td>"; - echo "<td class='bc'>"; - if ( $ryrms != "" ) { - echo $ryrms."±".$ryrms_unc; - } else { - echo "—"; - } - echo "</td></tr>"; - - } - - echo "</table>\n"; - } - } - -} - - -/** - * @class dcube - * @author Krzysztof Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl) - * @date 30/05/2007 - * - * @brief main class to build up the HTML output. - */ -class dcube { - - var $project = "DCube"; - var $version = "5.0 "; - var $author = "Krzysztof Daniel Ciba"; - var $css = "css/dcube.css.php"; - var $js = "dcube.js.php"; - - - /** - * @param $xml_file output XML file pythom python part - * @param $log_file log file from from python part - * @param $whereiam relative path from xml file to dcube.php - */ - function dcube( $xml_file, $log_file = NULL, $whereiam = "" ) { - - echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" " . - "\"http://www.w3.org/TR/html4/strict.dtd\">\n\n"; - - $whereiam = $this->relpath( $whereiam ); - - echo "<html>"; - $header = new dcube_header( $this->project, - $this->version, - $this->author, - $this->css, - $this->js, - $whereiam ); - - $body = new dcube_body( $this->project, - $this->version, - $this->author , - $xml_file, - dirname($xml_file), - $log_file, - dirname($logfile), - $whereiam ); - - - - echo "</html>"; - - } - - - function relpath ($dest) { - $Ahere = explode ("/", realpath(".") ); - $Adest = explode ("/", realpath($dest) ); - $result = "."; - while (implode ("/", $Adest) != implode ("/", $Ahere) ) { - if (count($Ahere)>count($Adest)) { - array_pop($Ahere); - $result .= "/.."; - } - else { - array_pop($Adest); - } - } - return str_replace("//", "/", $result.str_replace(implode ("/", $Adest), "", realpath($dest)).(@is_dir(realpath($dest))?"/":"")); - } - - -} - -/* end of PHP part */ -?> \ No newline at end of file diff --git a/Tools/DCubeClient/share/DCubeServer/images/favicon.gif b/Tools/DCubeClient/share/DCubeServer/images/favicon.gif deleted file mode 100644 index 2fea8883bfbfb2f897a9f4ab77db38de45076625..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/favicon.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/graph.gif b/Tools/DCubeClient/share/DCubeServer/images/graph.gif deleted file mode 100644 index a9b2bea2ff11d6dfad346bbf3cb79eefbf115b89..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/graph.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/green.gif b/Tools/DCubeClient/share/DCubeServer/images/green.gif deleted file mode 100644 index 304437efe1f8fe69a02abec3e5ec13f7aadd3248..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/green.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/h1.gif b/Tools/DCubeClient/share/DCubeServer/images/h1.gif deleted file mode 100644 index 0885e535a509343000ccd60252c5301d5c3b279f..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/h1.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/h2.gif b/Tools/DCubeClient/share/DCubeServer/images/h2.gif deleted file mode 100644 index b690d8910326395d3b221f84620bf3b981f499d2..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/h2.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/loading.gif b/Tools/DCubeClient/share/DCubeServer/images/loading.gif deleted file mode 100644 index 31b64c2cd0f29cffcfa65036d4164b65e710f55b..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/loading.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/loading_plot.gif b/Tools/DCubeClient/share/DCubeServer/images/loading_plot.gif deleted file mode 100644 index 80623a73a5b2f2c0a7e4048a788b5140f009e7f3..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/loading_plot.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/profile.gif b/Tools/DCubeClient/share/DCubeServer/images/profile.gif deleted file mode 100644 index 215dfb09490cbd552a098e079f752c65c97898ec..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/profile.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/red.gif b/Tools/DCubeClient/share/DCubeServer/images/red.gif deleted file mode 100644 index f00f5c96e496917bee6c46f7fedd5aa583fcbd51..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/red.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_bkg.gif b/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_bkg.gif deleted file mode 100644 index b201da22c168287fc4c2690fc358e239d8475ecc..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_bkg.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_left.gif b/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_left.gif deleted file mode 100644 index e3f61c49a38d3de474d9f92c1e03e7ac78e724f9..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_left.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_right.gif b/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_right.gif deleted file mode 100644 index 7aa0008e6d9ad2b96db167a0362b086e5f461e8e..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/sel_tabpane_right.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/tabpane_bkg.gif b/Tools/DCubeClient/share/DCubeServer/images/tabpane_bkg.gif deleted file mode 100644 index d54e4f1ffb9420d5ee532595955f555a636c7c82..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/tabpane_bkg.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/tabpane_left.gif b/Tools/DCubeClient/share/DCubeServer/images/tabpane_left.gif deleted file mode 100644 index a232d3da820b1953751637a158e3bede3c1b4f47..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/tabpane_left.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/tabpane_right.gif b/Tools/DCubeClient/share/DCubeServer/images/tabpane_right.gif deleted file mode 100644 index fd2a5e4f93f0860128d43816554d878b0669fe13..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/tabpane_right.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/tdirectory_c.gif b/Tools/DCubeClient/share/DCubeServer/images/tdirectory_c.gif deleted file mode 100644 index 07ec0c643bca807610587e2306a707332d6b043e..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/tdirectory_c.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/tdirectory_o.gif b/Tools/DCubeClient/share/DCubeServer/images/tdirectory_o.gif deleted file mode 100644 index 92ba882ed69db50ffad87994cfaf82dd391c2fb8..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/tdirectory_o.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/valid-css-blue.png b/Tools/DCubeClient/share/DCubeServer/images/valid-css-blue.png deleted file mode 100644 index f022511ad50f62cf47f28b119328dca18b53e5ed..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/valid-css-blue.png and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/valid-html401-blue.png b/Tools/DCubeClient/share/DCubeServer/images/valid-html401-blue.png deleted file mode 100644 index dd20e497e37a97a6ee56d666a0b6d502bf9176d0..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/valid-html401-blue.png and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/valid_n_html_401.gif b/Tools/DCubeClient/share/DCubeServer/images/valid_n_html_401.gif deleted file mode 100644 index 69ab6b6a8ba9b7465cb7f245458aa269da5a60fa..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/valid_n_html_401.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/images/yellow.gif b/Tools/DCubeClient/share/DCubeServer/images/yellow.gif deleted file mode 100644 index 7ff7575059a5c4fa230757426253ee3080b29446..0000000000000000000000000000000000000000 Binary files a/Tools/DCubeClient/share/DCubeServer/images/yellow.gif and /dev/null differ diff --git a/Tools/DCubeClient/share/DCubeServer/preLoading.js b/Tools/DCubeClient/share/DCubeServer/preLoading.js deleted file mode 100644 index bff40c7ce1bf7050d57ec8a83ffed92b0da76740..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/share/DCubeServer/preLoading.js +++ /dev/null @@ -1,4 +0,0 @@ - - -document.write('<div id="loading"><br>Please wait...'+ - '<div id="load"> </div></div>'); diff --git a/Tools/DCubeClient/share/DCubeServer/rw.php b/Tools/DCubeClient/share/DCubeServer/rw.php deleted file mode 100644 index 95cb7773d876234fb36cbaf23e74e6b290094fb3..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/share/DCubeServer/rw.php +++ /dev/null @@ -1,185 +0,0 @@ -<?php -/** - * @file rainbowWarrior.php - * @author Krzysztof.Ciba@NOSPAMagh.edu.pl - * @date July 31, 2007 - * @brief log file coloriser - * - * This is a part of DCube package - offline monitoring of root histograms. - * Copyleft (C) 2007 Krzysztof Ciba - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * If something goes wrong during run of dcube, please read again paragraph - * about WARRANTY... - */ - - -ob_start ("ob_gzhandler"); -header("Content-type: text/html; charset: UTF-8"); -header("Cache-Control: must-revalidate"); -$offset = 60 * 60 * 12; -$ExpStr = "Expires: " . - gmdate("D, d M Y H:i:s", - time() + $offset) . " GMT"; -header($ExpStr); - -set_time_limit(300); - - /** - * @class rainbow - * @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl) - * @brief <i>Rainbow Warrior</i>, log file coloriser - * - */ -class rainbow { - - var $ln = 1; - - var $lcount = array( "VERBOSE" => 0, - "DEBUG" => 0, - "INFO" => 0, - "WARNING" => 0, - "ERROR" => 0, - "FATAL" => 0, - "CRITICAL" => 0, - "DEFAULT" => 0 ); - - - function rainbow( $log ) { - - echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" ". - "\"http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd\">\n\n"; - echo "<html>\n"; - - $this->header(); - - $this->body( $log ); - - echo "</html>\n"; - - } - - function header( ) { - - echo "<head>\n"; - - echo "<title>RainbowWarrior LogBook</title>\n"; - echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n"; - echo "<meta name=\"description\" content=\"displaying log files as html\">\n"; - echo "<meta name=\"keywords\" content=\"Gaudi Athena log file colour\">\n"; - echo "<meta http-equiv=\"content-language\" content=\"en\">\n"; - echo "<meta name=\"generator\" content=\"GNU Emacs 21.3.1\">\n"; - echo "<meta name=\"author\" content=\"Krzysztof Daniel Ciba\">\n"; - - echo "<style>\n"; - echo "<!--\n"; - - echo "body { background-color: #e6e6e6; font-family: Courier, serif; font-size: 12pt; "; - echo " font-weight: normal; height: 100%; }\n"; - echo "span, div { width: 100%; }\n"; - echo "a { color: #0033ff; }\n"; - echo "a:visited {color: #ff0000; }\n"; - echo "div.log { padding-bottom: 95px; }\n"; - echo "div.bottom { font-weight: bold; height: 90px; color: #ffffff; background-color: #003399; "; - echo "position: fixed; bottom: 0px; left: 0px; text-align: center; }\n"; - echo ".v { color: #999999; white-space: pre; }\n"; - echo ".d { color: #333333; white-space: pre; }\n"; - echo ".i { color: #000033; font-weight: bold; white-space: pre; }\n"; - echo ".w { color: #ff6600; font-weight: bold; white-space: pre; }\n"; - echo ".e { color: #cc0000; font-weight: bold; white-space: pre; }\n"; - echo ".f { color: #990000; font-weight: bold; white-space: pre; }\n"; - echo ".c { text-align: right; }\n"; - echo "-->\n"; - echo "</style>\n"; - - echo "</head>\n"; - } - - function body( $log ) { - - $handle = fopen( $log, "r" ); - - if ( ! $handle ) { - - die( "Cannot open and read file " . $log . "\n" ); - - } else { - - echo "<div class=\"log\">\n"; - echo "<table>\n"; - while ( ! feof( $handle ) ) { - - $buffer = fgets( $handle ); - $buffer = htmlentities(rtrim( $buffer )); - - if ( $buffer != "" ) { - echo "<tr><td class=\"c\"><a href=\"#".$this->ln."\" name=\"".$this->ln."\">" - .$this->ln++."</a> </td><td>"; - if ( ereg( "VERBOSE", $buffer ) ) { - echo "<span class=\"v\">".$buffer."</span></td></tr>\n"; - $this->lcount["VERBOSE"]++; - } else - if ( ereg( "DEBUG", $buffer ) ) { - echo "<span class=\"d\">".$buffer."</span></td></tr>\n"; - $this->lcount["DEBUG"]++; - } else - if ( ereg( "INFO", $buffer ) ) { - echo "<span class=\"i\">".$buffer."</span></td></tr>\n"; - $this->lcount["INFO"]++; - } else - if ( ereg( "WARNING", $buffer ) ) { - echo "<span class=\"w\">".$buffer."</span></td></tr>\n"; - $this->lcount["WARNING"]++; - } else - if ( ereg( "ERROR", $buffer ) ) { - echo "<span class=\"e\">".$buffer."</span></td></tr>\n"; - $this->lcount["ERROR"]++; - } else - if ( ereg("FATAL|CRITICAL|Traceback", $buffer ) ) { - echo "<span class=\"f\">".$buffer."</span></td></tr>\n"; - $this->lcount["FATAL"]++; - } else { - echo "<span>".$buffer."</span></td></tr>\n"; - $this->lcount["DEFAULT"]++; - } - } - } - echo "</table>\n"; - echo "</div>\n"; - - - echo "<div class=\"bottom\">"; - echo "<br>Number of lines with:<br>"; - echo "<span class=\"v\">VERBOSE = </span>".$this->lcount["VERBOSE"]." | \n"; - echo "<span class=\"d\">DEBUG = </span>".$this->lcount["DEBUG"]."| \n"; - echo "<span class=\"i\">INFO = </span>".$this->lcount["INFO"]." | \n"; - echo "<span class=\"w\">WARNING = </span>".$this->lcount["WARNING"]." | \n"; - echo "<span class=\"e\">ERROR = </span>".$this->lcount["ERROR"]." | \n"; - echo "<span class=\"f\">FATAL/CRITICAL/Traceback = </span>".$this->lcount["FATAL"]." | \n"; - echo "<span class=\"v\">OTHERS = </span>".$this->lcount["DEFAULT"]."<br> \n"; - echo "<a href=\"".$log."\" target=\"_blank\" style=\"color: #ffcc00\" >click here to download log"; - echo " file as plain text</a><br>\n"; - - echo "</div>\n"; - } - - fclose( $handle ); - } - -} - - -?> \ No newline at end of file diff --git a/Tools/DCubeClient/share/DCubeValid.xml b/Tools/DCubeClient/share/DCubeValid.xml deleted file mode 100644 index fd1579e4ab43675b8d39df1769726dac732e3751..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/share/DCubeValid.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" ?> -<!-- - DCube API configuration file - author: Krzysztof Daniel Ciba - date: November 14th, 2007 - purpose: holds configuration for DCubeClient - - cibak @ 19/01/2009: added CMTCONFIG values for SLC5 - ---> -<dcube version="0.0"> - -<!-- path to CoolDozer server directory --> -<server>/afs/cern.ch/user/c/cibak/scratch2</server> - -<!-- known branches --> -<branch>master</branch> -<branch>dev</branch> -<branch>devval</branch> -<branch>bugfix</branch> -<branch>point1</branch> -<branch re="\d{2}\.\d{1}$">NN.N</branch> -<branch re="\d{2}\.\d{1}\.\d{1}X$">NN.N.NX</branch> -<branch re="\d{2}\.\d{1}\.\d{1}X\.Y$">NN.N.NX.Y</branch> -<branch re="\d{2}\.\d{1}\.\d{1}X\.Y\-VAL$">NN.N.NX.Y-VAL</branch> -<branch re="\d{2}\.\d{1}\.OLD\.Y$">NN.N.OLD.Y</branch> -<branch re="\d{2}\.\d{1}\.X\.Y">NN.N.X.Y</branch> -<branch re="\d{2}\.\d{1}\.X\.Y\-VAL">NN.N.X.Y-VAL</branch> -<branch>val</branch> -<branch>mig0</branch> -<branch>mig1</branch> -<branch>mig2</branch> -<branch>mig3</branch> -<branch>mig4</branch> -<branch>mig5</branch> -<branch>mig6</branch> -<branch re="(^(?:\d{1,2}\.){3}\d{1,2}$)|(^(?:\d{1,2}\.){2}\d{1,2}$)">numbered</branch> -<branch re="(^(?:\d{1,2}\.){3}Y$)|(^pcache$)">pcache</branch> -<!-- this one matches to ALL --> -<branch re='.+'>*</branch> - -<!-- AFS or KIT installation?--> -<install>build</install> -<install>kit</install> -<!-- this one matches to ALL --> -<install>*</install> - -<!-- known CMTCONFIG values --> -<cmt>i686-slc5-gcc34-dbg</cmt> -<cmt>i686-slc5-gcc34-opt</cmt> -<cmt>i686-slc5-gcc43-dbg</cmt> -<cmt>i686-slc5-gcc43-opt</cmt> -<cmt>x86_64-slc5-gcc34-dbg</cmt> -<cmt>x86_64-slc5-gcc34-opt</cmt> -<cmt>x86_64-slc5-gcc43-dbg</cmt> -<cmt>x86_64-slc5-gcc43-opt</cmt> -<cmt>x86_64-slc6-gcc46-opt</cmt> -<cmt>x86_64-slc6-gcc46-dbg</cmt> -<cmt>x86_64-slc6-gcc47-opt</cmt> -<cmt>x86_64-slc6-gcc47-dbg</cmt> -<cmt>x86_64-slc6-gcc48-opt</cmt> -<cmt>x86_64-slc6-gcc48-dbg</cmt> -<cmt>x86_64-slc6-gcc49-opt</cmt> -<cmt>x86_64-slc6-gcc49-dbg</cmt> -<cmt>x86_64-slc6-gcc62-opt</cmt> -<cmt>x86_64-slc6-gcc62-dbg</cmt> -<cmt>x86_64-slc6-gcc8-opt</cmt> -<cmt>x86_64-slc6-gcc8-dbg</cmt> -<cmt>x86_64-centos7-gcc62-opt</cmt> -<cmt>x86_64-centos7-gcc62-dbg</cmt> -<cmt>x86_64-centos7-gcc8-opt</cmt> -<cmt>x86_64-centos7-gcc8-dbg</cmt> -<!-- this one matches to ALL --> -<cmt>*</cmt> - - -<!-- known projects --> -<project>Athena</project> -<project>AthAnalysis</project> -<project>AnalysisBase</project> -<project>AthDerivation</project> -<project>AthSimulation</project> -<project>AthenaP1</project> -<project>AthDatQuality</project> -<project>AnalysisTop</project> -<project>AtlasProduction</project> -<project>AtlasOffline</project> -<project>AtlasAnalysis</project> -<project>AtlasTrigger</project> -<project>AtlasReconstruction</project> -<project>AtlasSimulation</project> -<project>AtlasEvent</project> -<project>AtlasConditions</project> -<project>AtlasCore</project> -<project>AtlasTier0</project> -<project>AtlasP1HLT</project> -<project>AtlasCAFHLT</project> -<project>TopPhys</project> -<project>AtlasPhysics</project> -<project>AthGeneration</project> -<!-- this one matches to ALL --> -<project>*</project> - -</dcube> diff --git a/Tools/DCubeClient/test/DCubeClient_TestConfiguration.xml b/Tools/DCubeClient/test/DCubeClient_TestConfiguration.xml deleted file mode 100644 index 2a81f9a38c98ca9d9b77e7eb9da1526d43ea9051..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/test/DCubeClient_TestConfiguration.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd"> - -<unifiedTestConfiguration> -<rtt xmlns="http://www.hep.ucl.ac.uk/atlas/AtlasTesting/rtt"> - <rttContactPerson>Krzysztof D. Ciba (Krzysztof.Ciba@NOSPAMgmail.com)</rttContactPerson> - <refRelease>10.3.0</refRelease> - -<jobList> - <classification> - <displayClass>OfflineValidation</displayClass> - <displayProcess>Core</displayProcess> - <displayComponent>Athena-Core</displayComponent> - </classification> - <!-- INHERITS THIS GLOBAL CPC VALUES--> - <athena userJobId='selfTest'> - <doc>DCube self-test</doc> - <doclink>https://twiki.cern.ch/twiki/bin/view/Sandbox/DCubeDoc</doclink> - <options>DCubeClient/DCubeClient_jobOptions</options> - <package>Tools/DCubeClient</package> - <group>DCubeClient</group> - <queue>short</queue> - </athena> -</jobList> - -<jobGroups> - <jobGroup name="AthenaDCubeClient" parent="Athena"> - <keepFilePattern>*.php</keepFilePattern> - <keepFilePattern>*.log</keepFilePattern> - <keepFilePattern>*.xml</keepFilePattern> - <keepFilePattern>*.root</keepFilePattern> - <auxFilePattern>test.C</auxFilePattern> - <test position="1"> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>test.C</argvalue> - </arg> - </test> - <test position="2"> - <modulename>RttLibraryTools</modulename> - <testname>DCubeRunner</testname> - <arg> - <argname>DCubeCfg</argname> - <argvalue>test_dcube_cfg.xml</argvalue> - </arg> - <arg> - <argname>DCubeRef</argname> - <argvalue>reference.root</argvalue> - </arg> - <arg> - <argname>DCubeMon</argname> - <argvalue>monitored.root</argvalue> - </arg> - </test> - </jobGroup> -</jobGroups> -</rtt> -</unifiedTestConfiguration> - diff --git a/Tools/DCubeClient/test/ref.C b/Tools/DCubeClient/test/ref.C deleted file mode 100644 index ee507ff7be3bb02b581dc6b254e40c2fe72eff68..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/test/ref.C +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @fn test - * @brief creates monitored.roo file - */ -void ref() { - - TFile * mon = new TFile("reference.root", "RECREATE"); - - TDirectory * histosDir = mon->mkdir("histos"); - TDirectory * errorsDir = mon->mkdir("errors"); - TDirectory * graphsDir = mon->mkdir("graphs"); - TDirectory * profilesDir = mon->mkdir("profiles"); - - // histos - histosDir->cd(); - TH1D * th1d = new TH1D("1-dim hist", "1-dim hist", 50, -3, 3); - TH2D * th2d = new TH2D("2-dim hist", "2-dim hist", 50, -3, 3, 50, -3, 3); - - th1d->FillRandom("gaus", 5000 ); - - TF2 * xygaus = new TF2( "f2", "xygaus" ); - xygaus->SetParameters( 10.0, 0.0, 1.0, 0.0, 1.0 ); - th2d->FillRandom("f2", 10000 ); - - - TH1D * normth1d = new TH1D("norm 1-dim hist", "norm 1-dim hist", 50, -3, 3); - normth1d->FillRandom("gaus", 5000); - - - TH2D * normth2d = new TH2D("norm 2-dim hist", "norm 2-dim hist", 50, -3, 3, 50, -3, 3 ); - normth2d->FillRandom("f2", 10000); - - - TH1D * logyth1d = new TH1D("logy 1-dim hist", "logy 1-dim hist", 50, -3, 3); - logyth1d->FillRandom("gaus", 5000); - - - TH2D * logzth2d = new TH2D("logz 2-dim hist", "logz 2-dim hist", 50, -3, 3, 50, -3, 3 ); - logzth2d->FillRandom("f2", 5000); - - // graphs - graphsDir->cd(); - - TGraph * tGraph = new TGraph(); - tGraph->SetName("1-dim graph"); - tGraph->SetTitle("1-dim graph"); - TRandom rnd; - for ( int i = 0; i < 20; i++) { - Double_t y = rnd.Rndm() * i; - tGraph->SetPoint( i, i, y); - } - tGraph->Write(); - - TGraphErrors * tGraphErr = new TGraphErrors(); - tGraphErr->SetTitle("1-dim with symmetric errors"); - tGraphErr->SetName("1-dim with symmetric errors"); - for ( int i = 0; i < 20; i++ ) { - Double_t x = 0.1 * i; - Double_t y = x*x + 2; - Double_t ex = x * rnd.Rndm(); - Double_t ey = y * rnd.Rndm(); - tGraphErr->SetPoint(i, x, y ); - tGraphErr->SetPointError( i, ex, ey ); - } - tGraphErr->Write(); - - - TGraphAsymmErrors * tGraphAsymmErrors = new TGraphAsymmErrors(); - tGraphAsymmErrors->SetTitle( "1-dim with asymmetric errors"); - tGraphAsymmErrors->SetName( "1-dim with asymmetric errors"); - - for ( int i = 0; i < 20; i++) { - Double_t x = i; - Double_t y = x*x + 2; - Double_t exl = rnd.Rndm() * x; - Double_t exr = rnd.Rndm() * x; - Double_t eyl = rnd.Rndm() * y; - Double_t eyh = rnd.Rndm() * y; - tGraphAsymmErrors->SetPoint( i, x, y ); - tGraphAsymmErrors->SetPointError( i, exl, exr, eyl, eyh ); - } - tGraphAsymmErrors->Write(); - - /* - TGraph2D * tGraph2D = new TGraph2D(); - tGraph2D->SetName( "2-dim" ); - tGraph2D->SetTitle( "2-dim" ); - int k = 0; - for (int i = -10; i < 10; i++ ) { - for (int j =-10; j < 10; j++ ) { - Double_t x = i; - Double_t y = j; - Double_t z = sin( x*x + y*y - 0.5 ); - tGraph2D->SetPoint(k, x, y, z); - k++; - } - } - - tGraph2D->Write(); - */ - - - // profiles - profilesDir->cd(); - TProfile * tprof1d = new TProfile( "1-dim profile", "1-dim profile", 100, -4, 4 , 0, 20); - TProfile2D * tprof2d = new TProfile2D( "2-dim profile", "2-dim profile", 100, -4, 4, 100, -4, 4 ); - - Double_t x,y,z; - for( int i =0; i < 20000; i++) { - gRandom->Rannor( x, y ); - z = x*x + y*y; - tprof1d->Fill( x, z, 1 ); - tprof2d->Fill( x, y, z ); - } - //tprof1d->Write(); - //tprof2d->Write(); - // errors - errorsDir->cd(); - - TH1D * wrongBin = new TH1D("bad binning", "bad binning", 51, 0, 100); - //wrongBin->Write(); - - TH1D * wrongClass = new TH1D("diff class", "diff class", 100, 0, 100); - //wrongClass->Write(); - - mon->Write(); - mon->Close(); - -} diff --git a/Tools/DCubeClient/test/test.C b/Tools/DCubeClient/test/test.C deleted file mode 100644 index edd6c718e10b62ff4bfc1f2429357523f431fcd0..0000000000000000000000000000000000000000 --- a/Tools/DCubeClient/test/test.C +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @fn test - * @brief creates monitored.roo file - */ -void test() { - - TFile * mon = new TFile("monitored.root", "RECREATE"); - - TDirectory * histosDir = mon->mkdir("histos"); - TDirectory * errorsDir = mon->mkdir("errors"); - TDirectory * graphsDir = mon->mkdir("graphs"); - TDirectory * profilesDir = mon->mkdir("profiles"); - - - // histos - histosDir->cd(); - TH1D * th1d = new TH1D("1-dim hist", "1-dim hist", 50, -3, 3); - TH2D * th2d = new TH2D("2-dim hist", "2-dim hist", 50, -3, 3, 50, -3, 3); - - th1d->FillRandom("gaus", 5500 ); - - TF2 * xygaus = new TF2( "f2", "xygaus" ); - xygaus->SetParameters( 10.0, 0.0, 1.0, 0.0, 1.0 ); - th2d->FillRandom("f2", 12000 ); - - TH1D * normth1d = new TH1D("norm 1-dim hist", "norm 1-dim hist", 50, -3, 3); - normth1d->FillRandom("gaus", 5500); - - TH2D * normth2d = new TH2D("norm 2-dim hist", "norm 2-dim hist", 50, -3, 3, 50, -3, 3 ); - normth2d->FillRandom("f2", 12000); - - TH1D * logyth1d = new TH1D("logy 1-dim hist", "logy 1-dim hist", 50, -3, 3); - logyth1d->FillRandom("gaus", 5500); - - TH2D * logzth2d = new TH2D("logz 2-dim hist", "logz 2-dim hist", 50, -3, 3, 50, -3, 3 ); - logzth2d->FillRandom("f2", 5500); - - // graphs - graphsDir->cd(); - - TGraph * tGraph = new TGraph(); - tGraph->SetName("1-dim graph"); - tGraph->SetTitle("1-dim graph"); - TRandom rnd; - for ( int i = 0; i < 20; i++) { - Double_t y = rnd.Rndm() * i; - tGraph->SetPoint( i, i, y); - } - tGraph->Write(); - - TGraphErrors * tGraphErr = new TGraphErrors(); - tGraphErr->SetTitle("1-dim with symmetric errors"); - tGraphErr->SetName("1-dim with symmetric errors"); - for ( int i = 0; i < 20; i++ ) { - Double_t x = 0.1 * i; - Double_t y = x*x + 1.5; - Double_t ex = x * rnd.Rndm(); - Double_t ey = y * rnd.Rndm(); - tGraphErr->SetPoint(i, x, y ); - tGraphErr->SetPointError( i, ex, ey ); - } - tGraphErr->Write(); - - - TGraphAsymmErrors * tGraphAsymmErrors = new TGraphAsymmErrors(); - tGraphAsymmErrors->SetTitle( "1-dim with asymmetric errors"); - tGraphAsymmErrors->SetName( "1-dim with asymmetric errors"); - - for ( int i = 0; i < 20; i++) { - Double_t x = i; - Double_t y = x*x + 1.5; - Double_t exl = rnd.Rndm() * x; - Double_t exr = rnd.Rndm() * x; - Double_t eyl = rnd.Rndm() * y; - Double_t eyh = rnd.Rndm() * y; - tGraphAsymmErrors->SetPoint( i, x, y ); - tGraphAsymmErrors->SetPointError( i, exl, exr, eyl, eyh ); - } - tGraphAsymmErrors->Write(); - - - /*TGraph2D * tGraph2D = new TGraph2D(); - tGraph2D->SetName( "2-dim" ); - tGraph2D->SetTitle( "2-dim" ); - int k = 0; - for (int i = -10; i < 10; i++ ) { - for (int j =-10; j < 10; j++ ) { - Double_t x = i; - Double_t y = j*0.9; - Double_t z = sin( x*x + y*y - 0.75 ); - tGraph2D->SetPoint(k, x, y, z); - k++; - } - } - tGraph2D->Write(); - */ - - - // profiles - profilesDir->cd(); - TProfile * tprof1d = new TProfile( "1-dim profile", "1-dim profile", 100, -4, 4 , 0, 20); - TProfile2D * tprof2d = new TProfile2D( "2-dim profile", "2-dim profile", 100, -4, 4, 100, -4, 4 ); - - Double_t x,y,z; - for( int i =0; i < 22000; i++) { - gRandom->Rannor( x, y ); - z = x*x + y*y; - tprof1d->Fill( x, z, 1 ); - tprof2d->Fill( x, y, z ); - } - //tprof1d->Write(); - //tprof2d->Write(); - - - // errors - errorsDir->cd(); - - TH1D * wrongBin = new TH1D("bad binning", "bad binning", 50, 0, 100); - //wrongBin->Write(); - - TH2D * wrongClass = new TH2D("diff class", "diff class", 100, 0, 100, 100, 0, 100); - //wrongClass->Write(); - - mon->Write(); - mon->Close(); - -} diff --git a/Tools/OnlineRecoTests/CMakeLists.txt b/Tools/OnlineRecoTests/CMakeLists.txt index bf4a38eef91f22b2e5301ddf8d658841809d8a5f..c988ddb57288397be7e594c04542fd535dcdf430 100644 --- a/Tools/OnlineRecoTests/CMakeLists.txt +++ b/Tools/OnlineRecoTests/CMakeLists.txt @@ -9,10 +9,6 @@ atlas_subdir( OnlineRecoTests ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_install_scripts( scripts/ort_*.py scripts/ort_*.sh ) - -atlas_add_test( flake8_test_dir - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) diff --git a/Tools/OnlineRecoTests/python/ort_interpretTimestamp.py b/Tools/OnlineRecoTests/python/ort_interpretTimestamp.py index 8f9224d6080955c02bb6735840cabd4750f1a840..70ff4a5e3d3b6094bc61854f1925dbd3b3606888 100755 --- a/Tools/OnlineRecoTests/python/ort_interpretTimestamp.py +++ b/Tools/OnlineRecoTests/python/ort_interpretTimestamp.py @@ -83,8 +83,8 @@ if __name__ == "__main__": updateTimestamp = int(sys.argv[3]) ## interpret timestamp - doInstall,pacmankey = interpretNewTimestamp(newtimestampfile, \ - prvtimestampfile) + doInstall,pacmankey = interpretNewTimestamp(newtimestampfile, + prvtimestampfile) if doInstall: print("Install new nightly kit ? %s" % str(doInstall)) print(pacmankey) diff --git a/Tools/PROCTools/python/RunTier0TestsTools.py b/Tools/PROCTools/python/RunTier0TestsTools.py index 515f5ec6a2f2ca7dab683ee79a896ee5af60ef06..1344cc6849e35b591c0ca6bba8d0b20afcab4962 100644 --- a/Tools/PROCTools/python/RunTier0TestsTools.py +++ b/Tools/PROCTools/python/RunTier0TestsTools.py @@ -25,7 +25,7 @@ ciRefFileMap = { 's3505-21.0' : 'v1', 's3505-21.3' : 'v1', 's3505-21.9' : 'v1', - 's3505-22.0' : 'v2', + 's3505-22.0' : 'v3', # OverlayTier0Test_required-test 'overlay-d1498-21.0' : 'v2', 'overlay-d1498-22.0' : 'v30', diff --git a/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/InverseTruthMap.h b/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/InverseTruthMap.h index 89db27beca2d969f670152441ce31562305beabe..d33cee3605199d86621cb4cc9fb540be135fef7e 100755 --- a/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/InverseTruthMap.h +++ b/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/InverseTruthMap.h @@ -11,7 +11,7 @@ #include <map> -namespace HepMC { class GenParticle; } +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { /** diff --git a/Tracking/TrkEventCnv/TrkEventTPCnv/CMakeLists.txt b/Tracking/TrkEventCnv/TrkEventTPCnv/CMakeLists.txt index 9a239c75da148ad9fa2d127976b282d3ad3c66ef..52900a2532e9dddfa02181dab71cb26bc808a1c0 100644 --- a/Tracking/TrkEventCnv/TrkEventTPCnv/CMakeLists.txt +++ b/Tracking/TrkEventCnv/TrkEventTPCnv/CMakeLists.txt @@ -101,7 +101,7 @@ atlas_add_tpcnv_library( TrkEventTPCnv TrkCompetingRIOsOnTrack TrkEventPrimitives TrkMaterialOnTrack TrkMeasurementBase TrkNeutralParameters TrkParameters TrkParametersBase TrkParticleBase TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack - TrkSegment TrkTrack TrkTrackSummary TrkV0Vertex TrkVertexOnTrack + TrkSegment TrkTrack TrkTrackSummary TrkV0Vertex TrkVertexOnTrack TrkEventCnvToolsLib VxMultiVertex VxVertex PRIVATE_LINK_LIBRARIES AthenaKernel CxxUtils TrkDetDescrUtils DEFINITIONS ${_definitions} ) diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p2_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p2_test.cxx index 62876f04a91c6cc6f6d2cf7b1da926d7928fead3..8ad82cc7c8f6eeaa68e40885357d229df131ea27 100644 --- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p2_test.cxx +++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p2_test.cxx @@ -17,8 +17,8 @@ #include "StoreGate/StoreGateSvc.h" #include "SGTools/TestStore.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include <cassert> #include <iostream> diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p3_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p3_test.cxx index 129ecfe4178ef5d46cf0a11af5351e027db8a465..9be3a0ce50954869b2ddcb4d79ba8a2e93c301dd 100644 --- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p3_test.cxx +++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p3_test.cxx @@ -17,8 +17,8 @@ #include "StoreGate/StoreGateSvc.h" #include "SGTools/TestStore.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include <cassert> #include <iostream> diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p1_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p1_test.cxx index d8dc05d3765e50e20d0faa20aea9e590cfe104c7..c361e094043460569689858394220358bce72a5e 100644 --- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p1_test.cxx +++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p1_test.cxx @@ -16,8 +16,8 @@ #include "TrkTruthData/TrackTruthCollection.h" #include "SGTools/TestStore.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include <cassert> #include <iostream> diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p2_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p2_test.cxx index 27eb48c3bdcb7acfee6d9d2975c4ab04f3131399..3693284104fcd3a4fcfff59d18ef6cbeea1020f6 100644 --- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p2_test.cxx +++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p2_test.cxx @@ -16,8 +16,8 @@ #include "TrkTruthData/TrackTruthCollection.h" #include "SGTools/TestStore.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include <cassert> #include <iostream> diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p1_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p1_test.cxx index a934c5d72a0c80395bd69ba5cf0e23acb8932422..07186551b3c836527a33052756b8a3f1e09e235a 100644 --- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p1_test.cxx +++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p1_test.cxx @@ -16,8 +16,8 @@ #include "TrkTruthData/TruthTrajectory.h" #include "SGTools/TestStore.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include <cassert> #include <iostream> diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p2_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p2_test.cxx index 61db3c83735ab38efe375eee3056faa7cc099a98..cc56edca571cd96ff08c32a5302dfc1568f92cd5 100644 --- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p2_test.cxx +++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p2_test.cxx @@ -16,8 +16,8 @@ #include "TrkTruthData/TruthTrajectory.h" #include "SGTools/TestStore.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include <cassert> #include <iostream> diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/TrkExRungeKuttaPropagator/RungeKuttaPropagator.h b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/TrkExRungeKuttaPropagator/RungeKuttaPropagator.h index b1d07ac7fb75a411ff96508b2dbbf594f0d1488e..7cd43f637cb42c35ab84512f8d5cb3063bed0966 100755 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/TrkExRungeKuttaPropagator/RungeKuttaPropagator.h +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/TrkExRungeKuttaPropagator/RungeKuttaPropagator.h @@ -488,9 +488,6 @@ namespace Trk { double m_straightStep ; // max step whith srtaight line model bool m_usegradient ; // use magnetif field gradient - // temporary flag to be able to avoid the use of the AtlasFieldCacheCondObj - Gaudi::Property<bool> m_useCondObj {this, "UseCondObj", true, "Use the conditions object to fetch the field cache"}; - // Read handle for conditions object to get the field cache SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; void getFieldCacheObject(Cache& cache, const EventContext& ctx) const; diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx index a29154f62a19a77d7438f770e7a32b7ba4ee1bc5..7f1c6d06c6ef1cd616e470f954c3a3ec1994c481 100755 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx @@ -51,12 +51,9 @@ StatusCode Trk::RungeKuttaPropagator::initialize() // temporarily protect the use of the field cond object/field cache for clients with IOV callbacks // Read handle for AtlasFieldCacheCondObj - ATH_CHECK( m_fieldCondObjInputKey.initialize(m_useCondObj) ); - if (m_useCondObj) ATH_MSG_INFO("initialize() init key: " << m_fieldCondObjInputKey.key()); - else ATH_MSG_INFO("initialize() DID NOT init key: " << m_fieldCondObjInputKey.key()); - + ATH_CHECK( m_fieldCondObjInputKey.initialize() ); + ATH_MSG_INFO("initialize() init key: " << m_fieldCondObjInputKey.key()); -// msg(MSG::INFO) << name() <<" initialize() successful" << endmsg; return StatusCode::SUCCESS; } @@ -1986,21 +1983,18 @@ void Trk::RungeKuttaPropagator::propagateStep(const EventContext& ctx, void Trk::RungeKuttaPropagator::getFieldCacheObject( Cache& cache,const EventContext& ctx) const { - if (m_useCondObj) { - - SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, ctx}; - const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; - if (fieldCondObj == nullptr) { + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (fieldCondObj == nullptr) { - // temporarily protect for when cache a cannot be retrieved in an IOV callback - ATH_MSG_ERROR("extrapolate: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key() - << ". Skipping use of field cache!"); + // temporarily protect for when cache a cannot be retrieved in an IOV callback + ATH_MSG_ERROR("extrapolate: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key() + << ". Skipping use of field cache!"); - // ATH_MSG_ERROR("extrapolate: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key()); - // return; - } - fieldCondObj->getInitializedCache (cache.m_fieldCache); + // ATH_MSG_ERROR("extrapolate: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key()); + // return; } + fieldCondObj->getInitializedCache (cache.m_fieldCache); } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfCombinedMaterialEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfCombinedMaterialEffects.h index 0a8a65c948e4db14aa470c1358023c315a8bf036..273ae852fa927a57c28e47e9d9c2978690a9ebe9 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfCombinedMaterialEffects.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfCombinedMaterialEffects.h @@ -18,9 +18,10 @@ decription : Class definition for consideration of multiple scatter an #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" +#include "TrkExInterfaces/IMultipleScatteringUpdator.h" +#include "TrkExInterfaces/IEnergyLossUpdator.h" namespace Trk { - class GsfCombinedMaterialEffects : public AthAlgTool , virtual public IMultiStateMaterialEffects @@ -30,36 +31,57 @@ public: GsfCombinedMaterialEffects(const std::string&, const std::string&, const IInterface*); /** Virtual destructor */ - virtual ~GsfCombinedMaterialEffects(); + virtual ~GsfCombinedMaterialEffects() override; /** AlgTool initialise method */ - StatusCode initialize(); + virtual StatusCode initialize() override; /** AlgTool finalise method */ - StatusCode finalize(); + StatusCode finalize() override; virtual void compute(IMultiStateMaterialEffects::Cache&, const ComponentParameters&, const MaterialProperties&, double, PropDirection = anyDirection, - ParticleHypothesis = nonInteracting) const; + ParticleHypothesis = nonInteracting) const override final; private: - ToolHandle<IMultiStateMaterialEffects> m_multipleScatterEffects{ + + + void scattering(IMultiStateMaterialEffects::Cache&, + const ComponentParameters&, + const MaterialProperties&, + double, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const; + + void energyLoss(IMultiStateMaterialEffects::Cache&, + const ComponentParameters&, + const MaterialProperties&, + double, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const; + + ToolHandle<IMultipleScatteringUpdator> m_msUpdator{ + this, + "MultipleScatteringUpdator", + "Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator", + "" + }; + + ToolHandle<IEnergyLossUpdator> m_EnergyLossUpdator{ + this, + "EnergyLossUpdator", + "Trk::EnergyLossUpdator/AtlasEnergyLossUpdator", + "" + }; + ToolHandle<IMultiStateMaterialEffects> m_betheHeitlerEffects{ this, - "MultipleScatteringEffects", - "Trk::MultipleScatteringEffects/MultipleScatterEffects", + "BetheHeitlerEffects", + "Trk::GsfBetheHeitlerEffects/GsfBetheHeitlerEffects", "" }; - ToolHandle<IMultiStateMaterialEffects> m_energyLossEffects{ this, - "EnergyLossEffects", - "Trk::GsfEnergyLossEffects/GsfEnergyLossEffects", - "" }; - ToolHandle<IMultiStateMaterialEffects> m_betheHeitlerEffects{ this, - "BetheHeitlerEffects", - "Trk::GsfBetheHeitlerEffects/GsfBetheHeitlerEffects", - "" }; }; } // end Trk namespace diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfEnergyLossEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfEnergyLossEffects.h deleted file mode 100644 index ffb2596bce7e157847d47e56b2c19b5930926375..0000000000000000000000000000000000000000 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfEnergyLossEffects.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************* - GsfEnergyLossEffects.h - description - -------------------------------------- -begin : Tuesday 22nd January 2005 -author : amorley -email : amorley@cern.ch -decription : Class for describing energy loss effects only. -*********************************************************************************/ - -#ifndef TrkGsfEnergyLossEffects_H -#define TrkGsfEnergyLossEffects_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "TrkEventPrimitives/ParticleHypothesis.h" -#include "TrkEventPrimitives/PropDirection.h" -#include "TrkExInterfaces/IEnergyLossUpdator.h" -#include "TrkExUtils/MaterialUpdateMode.h" -#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" -#include "TrkParameters/TrackParameters.h" - -namespace Trk { - -class Layer; -class MaterialProperties; - -class GsfEnergyLossEffects - : public AthAlgTool - , virtual public IMultiStateMaterialEffects -{ - -public: - /** Constructor with AlgTool parameters */ - GsfEnergyLossEffects(const std::string&, const std::string&, const IInterface*); - - /** Virtual destructor */ - virtual ~GsfEnergyLossEffects(); - - /** AlgTool initialise method */ - StatusCode initialize() override final; - - /** AlgTool finalise method */ - StatusCode finalize() override final; - - virtual void compute(IMultiStateMaterialEffects::Cache&, - const ComponentParameters&, - const MaterialProperties&, - double, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const override final; - -private: - ToolHandle<IEnergyLossUpdator> m_EnergyLossUpdator{ this, - "EnergyLossUpdator", - "Trk::EnergyLossUpdator/AtlasEnergyLossUpdator", - "" }; -}; - -} - -#endif diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h index 5c1bfb76238637f12754e90ad00644f6d3a9784e..15758259fe50b1263c889eb840742bf7bc2ec7c1 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h @@ -2,15 +2,13 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/********************************************************************************* - KLGaussianMixReduction.h - description - ------------------------------------------------- -begin : 26th November 2019 -author : amorley, Christos -decription : Function that help implement a -"Kullback-Leibler Approach to Gaussian Mixture Reduction" - *********************************************************************************/ - +/** +* @file KLGaussianMixtureReduction.h +* @author amorley +* @author Anastopoulos +* @date 26th November 2019 +* @brief Function that help implement component merging . +*/ #ifndef KLGaussianMixReductionUtils_H #define KLGaussianMixReductionUtils_H @@ -22,8 +20,39 @@ decription : Function that help implement a namespace GSFUtils { /** - * Assuming 0..... N (N+1 elements) - * the pairwise distance matrix can be represented in a trangular way: + * Alignment used for SIMD + */ +constexpr int32_t alignment =32; + +/** + * The main pupropse of the utilities here + * are to facilitate the calculation of the + * divergence between components of the mixture + * and the merging of similar componets. + * + * For a revies of available methods look + * https://arxiv.org/pdf/2001.00727.pdf + * + * Here we opt for formula 10. + * For an 1D Normal distributions this becomes: + * + * (variance1-variance2) (1/variance1 - 1/variance2) - + * (mean1-mean2)(1/variance+1/variance)(mean1-mean2) + * + * We use doubles for the intermediate calculations + * but we store the final distances to short in an array + * of floats. + * +*/ +struct Component1D{ + double mean=0.; + double cov=0.; + double invCov=1e10; +}; + +/** + * For pairwise distance comparisons assuming 0..... N (N+1 elements) + * the pairwise distance matrix can be represented in a triangular array: * * [ (0,0)............... * [ (1,0), (1,1)........ @@ -37,60 +66,83 @@ namespace GSFUtils { * with size N*(N+1)/2 * * In the following methods: - * qonpIn,qonpCovIn,qonpGIn have size N+1 [0......N] + * componentsIn has size N+1 [0......N] * distancesIn has size N*(N+1)/2 * * We also want to map the position in the distance array to the (i,j) of * the elements * 0--> (0,0) - * 1-->(1,0) + * 1--> (1,0) * 2--> (1,1) - * + * 3--> (2,0) + * e.g the lexicographical storage allocation function is + * Loc( i, j) = i*(i+1)/2 + j */ - struct triangularToIJ{ int32_t I=-1; int32_t J=-1; }; -typedef float* ATH_RESTRICT floatPtrRestrict; -constexpr int32_t alignment =32; - -//find the index of the smaller value +/** + * Some usefull typedefs + */ +typedef float* ATH_RESTRICT floatPtrRestrict; +typedef Component1D* ATH_RESTRICT componentPtrRestrict; +/** + * For finding the index of the minumum pairwise distance + * we opt for SIMD and function multiversioning + */ #if HAVE_FUNCTION_MULTIVERSIONING #if defined(__x86_64__) -__attribute__((target("avx2"))) -int32_t findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); +__attribute__((target("avx2"))) +int32_t +findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); __attribute__((target("sse4.2,sse2"))) -int32_t findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); +int32_t +findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); #endif //x86_64 specific targets -__attribute__((target("default"))) +__attribute__((target("default"))) #endif// function multiversioning -int32_t findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); -//find the index of the smaller value STL style -int32_t findMinimumIndexSTL(const floatPtrRestrict distancesIn, const int n); +int32_t +findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); + +/** + * Extra methods for finding the index of the minimum + * pairwise distance + */ +int32_t +findMinimumIndexSTL(const floatPtrRestrict distancesIn, const int n); //find a pair of the indices of the 2 smaller values -std::pair<int32_t, int32_t> findMinimumIndexPair(const floatPtrRestrict distancesIn, const int32_t n) ; +std::pair<int32_t, int32_t> +findMinimumIndexPair(const floatPtrRestrict distancesIn, const int32_t n); -// Recalculate the distances for a row of pairs and return the index of the minimum pair -int32_t recalculateDistances(floatPtrRestrict qonpIn, - floatPtrRestrict qonpCovIn, - floatPtrRestrict qonpGIn, - floatPtrRestrict distancesIn, - int32_t mini, - int32_t n); +/** + * Recalculate the distances given a merged input + * and return the index of the minimum pair + */ +int32_t +recalculateDistances(const componentPtrRestrict componentsIn, + floatPtrRestrict distancesIn, + const int32_t mini, + const int32_t n); -// Calculate the distances for all pairs -void calculateAllDistances(floatPtrRestrict qonpIn, - floatPtrRestrict qonpCovIn, - floatPtrRestrict qonpGIn, - floatPtrRestrict distancesIn, - int32_t n) ; +/** + * Calculate the distances for all component pairs + */ +void +calculateAllDistances(const componentPtrRestrict componentsIn, + floatPtrRestrict distancesIn, + const int32_t n); -// Reset the distances for a row -void resetDistances(floatPtrRestrict distancesIn, const int32_t mini, const int32_t n) ; +/* + * Reset the distances wrt to a mini index + */ +void +resetDistances(floatPtrRestrict distancesIn, + const int32_t mini, + const int32_t n); } // namespace KLGaussianMixtureReduction diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultipleScatteringEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultipleScatteringEffects.h deleted file mode 100644 index c8e9ed201fd8bc3c3636e911ccdfd5f507c85ade..0000000000000000000000000000000000000000 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultipleScatteringEffects.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************* - MultipleScatteringEffects.h - description - ---------------------------------------- -begin : Tuesday 22nd January 2005 -author : amorley -email : amorley at cern.ch -decription : Class for describing multiple scattering effects only. -*********************************************************************************/ - -#ifndef Trk_MultipleScatteringEffects_H -#define Trk_MultipleScatteringEffects_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrkEventPrimitives/PropDirection.h" -#include "TrkExInterfaces/IMultipleScatteringUpdator.h" -#include "TrkExUtils/MaterialUpdateMode.h" -#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" -#include "TrkParameters/TrackParameters.h" - -#include "GaudiKernel/ToolHandle.h" - -namespace Trk { - -class Layer; -class MaterialProperties; - -class MultipleScatteringEffects - : public AthAlgTool - , virtual public IMultiStateMaterialEffects -{ - -public: - /** Constructor with AlgTool parameters */ - MultipleScatteringEffects(const std::string&, const std::string&, const IInterface*); - - /** Virtual destructor */ - virtual ~MultipleScatteringEffects(); - - /** AlgTool initialise method */ - StatusCode initialize() override; - - /** AlgTool finalise method */ - StatusCode finalize() override; - - virtual void compute(IMultiStateMaterialEffects::Cache&, - const ComponentParameters&, - const MaterialProperties&, - double, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const override final; - -private: - ToolHandle<IMultipleScatteringUpdator> m_msUpdator{ this, - "MultipleScatteringUpdator", - "Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator", - "" }; //!< AlgoTool for MultipleScatterin effects - - bool m_multipleScatterLogTermOn; -}; - -} - -#endif diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx index e0af9b739f275a4164f2f7dbad2673dcb1197db3..55bb5aaa72c9f1805cba3e05b33503a651779692 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx @@ -6,18 +6,22 @@ GsfCombinedMaterialEffects.cxx - description ---------------------------------------------- begin : Friday 11th January 2005 -author : atkinson -email : Tom.Atkinson@cern.ch +authors : atkinson,Morley,Anastopoulos decription : Implementation code for GsfCombinedMaterialEffects class *********************************************************************************/ #include "TrkGaussianSumFilter/GsfCombinedMaterialEffects.h" +#include "GaudiKernel/ToolHandle.h" +#include "TrkSurfaces/Surface.h" #include "TrkGeometry/Layer.h" #include "TrkParameters/TrackParameters.h" -#include "TrkSurfaces/Surface.h" +#include "TrkMaterialOnTrack/EnergyLoss.h" +#include "TrkEventPrimitives/ParamDefs.h" -#include "GaudiKernel/ToolHandle.h" +namespace { +const Trk::ParticleMasses s_particleMasses{}; +} Trk::GsfCombinedMaterialEffects::GsfCombinedMaterialEffects(const std::string& type, const std::string& name, @@ -34,34 +38,17 @@ Trk::GsfCombinedMaterialEffects::initialize() { // Retrieve and configure multiple scattering effects for multi-state operation ATH_MSG_INFO("Configuring for multiple scattering"); + ATH_CHECK(m_msUpdator.retrieve()); - // Retrieve the multiple scattering effects - if (m_multipleScatterEffects.retrieve().isFailure()) { - ATH_MSG_FATAL("Could not retrieve multiple scattering AlgTool: " << m_multipleScatterEffects.typeAndName() - << "... Exiting!"); - return StatusCode::FAILURE; - } - - // Retrieve and configure the energy loss effects for multi-state operation + // Retrieve and configure the std energy loss effects for multi-state operation ATH_MSG_INFO("Configuring for normal energy loss"); - - if (m_energyLossEffects.retrieve().isFailure()) { - ATH_MSG_FATAL("Could not retrieve energy loss AlgTool: " << m_energyLossEffects.typeAndName() << "... Exiting!"); - return StatusCode::FAILURE; - } else { - ATH_MSG_INFO("Retrieved energy loss AlgTool: " << m_energyLossEffects.typeAndName() << "... YAY!"); - } + ATH_CHECK(m_EnergyLossUpdator.retrieve()); // Retrieve and configure the Bethe-Heitler effects for energy loss ATH_MSG_INFO("Configuring for Bethe-Heitler energy loss"); - - if (m_betheHeitlerEffects.retrieve().isFailure()) { - ATH_MSG_FATAL("Could not retrieve energy loss AlgTool: " << m_betheHeitlerEffects.typeAndName() << "... Exiting!"); - return StatusCode::FAILURE; - } + ATH_CHECK(m_betheHeitlerEffects.retrieve()); ATH_MSG_INFO("Initialisation of " << name() << " was successful"); - return StatusCode::SUCCESS; } @@ -73,12 +60,13 @@ Trk::GsfCombinedMaterialEffects::finalize() } void -Trk::GsfCombinedMaterialEffects::compute(IMultiStateMaterialEffects::Cache& cache, - const Trk::ComponentParameters& componentParameters, - const Trk::MaterialProperties& materialProperties, - double pathLength, - Trk::PropDirection direction, - Trk::ParticleHypothesis particleHypothesis) const +Trk::GsfCombinedMaterialEffects::compute( + IMultiStateMaterialEffects::Cache& cache, + const Trk::ComponentParameters& componentParameters, + const Trk::MaterialProperties& materialProperties, + double pathLength, + Trk::PropDirection direction, + Trk::ParticleHypothesis particleHypothesis) const { ATH_MSG_DEBUG("Computing combined material effects"); @@ -93,8 +81,12 @@ Trk::GsfCombinedMaterialEffects::compute(IMultiStateMaterialEffects::Cache& cach ======================================================================== */ IMultiStateMaterialEffects::Cache cache_multipleScatter; - m_multipleScatterEffects->compute( - cache_multipleScatter, componentParameters, materialProperties, pathLength, direction, particleHypothesis); + this->scattering(cache_multipleScatter, + componentParameters, + materialProperties, + pathLength, + direction, + particleHypothesis); // Protect if there are no new components if (cache_multipleScatter.weights.empty()) { @@ -111,16 +103,10 @@ Trk::GsfCombinedMaterialEffects::compute(IMultiStateMaterialEffects::Cache& cach ======================================================================== */ IMultiStateMaterialEffects::Cache cache_energyLoss; - if (particleHypothesis == electron) { - - ATH_MSG_VERBOSE("Considering Bethe-Heitler energy loss effects"); m_betheHeitlerEffects->compute(cache_energyLoss, componentParameters, materialProperties, pathLength, direction); - } else if (particleHypothesis != nonInteracting) { - ATH_MSG_VERBOSE("Considering standard energy loss effects"); - - m_energyLossEffects->compute( + this->energyLoss( cache_energyLoss, componentParameters, materialProperties, pathLength, direction, particleHypothesis); } @@ -132,11 +118,9 @@ Trk::GsfCombinedMaterialEffects::compute(IMultiStateMaterialEffects::Cache& cach newCov.setZero(); cache_energyLoss.deltaCovariances.push_back(std::move(newCov)); } - /* ======================================================================== Combine the multiple scattering and energy loss components ======================================================================== */ - ATH_MSG_DEBUG("Combining the energy loss and multiple scattering components"); // Iterators over the multiple scattering components @@ -175,3 +159,96 @@ Trk::GsfCombinedMaterialEffects::compute(IMultiStateMaterialEffects::Cache& cach } // end for loop over multiple scattering components ATH_MSG_DEBUG("Successfully included combined material effects"); } + +void +Trk::GsfCombinedMaterialEffects::scattering( + IMultiStateMaterialEffects::Cache& cache, + const ComponentParameters& componentParameters, + const MaterialProperties& materialProperties, + double pathLength, + PropDirection /*direction*/, + ParticleHypothesis /*particleHypothesis*/) const +{ + // Reset the cache + cache.reset(); + + // Request track parameters from component parameters + const Trk::TrackParameters* trackParameters = componentParameters.first.get(); + const AmgSymMatrix(5)* measuredTrackCov = trackParameters->covariance(); + + if (!measuredTrackCov) { + ATH_MSG_DEBUG("No measurement associated with track parameters... returning original parameters"); + return; + } + + const Amg::Vector3D& globalMomentum = trackParameters->momentum(); + double p = globalMomentum.mag(); + + double pathcorrection = 1.; + if (materialProperties.thickness() != 0) + pathcorrection = pathLength / materialProperties.thickness(); + + // Here we know the path length to be meff.thicknessX0, so we set pathcorrection = 1 + // and create a dummy materialProperties with the properties we are interested in + MaterialProperties mprop(materialProperties.thicknessInX0(), 1., 0., 0., 0., 0.); + const double angularVariation = m_msUpdator->sigmaSquare(mprop, p, pathcorrection, Trk::muon); + + AmgSymMatrix(5) deltaCov; + deltaCov.setZero(); + // double sign = (direction == Trk::oppositeMomentum) ? 1. : 1.; + const double sinTheta = std::sin(trackParameters->parameters()[Trk::theta]); + deltaCov(Trk::phi, Trk::phi) += angularVariation / (sinTheta * sinTheta); + deltaCov(Trk::theta, Trk::theta) += angularVariation; + cache.weights.push_back(1.); + cache.deltaPs.push_back(0.); + cache.deltaCovariances.push_back(std::move(deltaCov)); +} + +void +Trk::GsfCombinedMaterialEffects::energyLoss( + IMultiStateMaterialEffects::Cache& cache, + const ComponentParameters& componentParameters, + const MaterialProperties& materialProperties, + double pathLength, + PropDirection direction, + ParticleHypothesis particleHypothesis) const +{ + // Reset the cache + cache.reset(); + + // Request track parameters from component parameters + const Trk::TrackParameters* trackParameters = componentParameters.first.get(); + const AmgSymMatrix(5)* measuredCov = trackParameters->covariance(); + if (!measuredCov) { + ATH_MSG_DEBUG("No measurement on track parameters... returning original track parameters"); + return; + } + double pathcorrection = pathLength / materialProperties.thickness(); + const Amg::Vector3D& globalMomentum = trackParameters->momentum(); + + EnergyLoss* energyLoss = m_EnergyLossUpdator->energyLoss( + materialProperties, globalMomentum.mag(), pathcorrection, direction, particleHypothesis, true); + + // update for mean energy loss + const double deltaE = energyLoss ? energyLoss->deltaE() : 0; + const double sigmaDeltaE = energyLoss ? energyLoss->sigmaDeltaE() : 0; + delete energyLoss; + + // Calculate the pathlength encountered by the track + const double p = globalMomentum.mag(); + const double m = s_particleMasses.mass[particleHypothesis]; + const double E = sqrt(p * p + m * m); + const double beta = p / E; + + // Calculate energy loss values uncertainty + const double sigmaQoverP = sigmaDeltaE / pow(beta * p, 2); + + // Update diagonal and off-diagonal covariance matrix elements + AmgSymMatrix(5) deltaCov; + deltaCov.setZero(); + deltaCov(Trk::qOverP, Trk::qOverP) += sigmaQoverP * sigmaQoverP; + + cache.weights.push_back(1.); + cache.deltaPs.push_back(deltaE); + cache.deltaCovariances.push_back(std::move(deltaCov)); +} diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfEnergyLossEffects.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfEnergyLossEffects.cxx deleted file mode 100644 index d9f8f4e2b5487b65b95dd8860ae950d38a9e651d..0000000000000000000000000000000000000000 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfEnergyLossEffects.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************* - GsfEnergyLossEffects.cxx - description - ---------------------------------------- -begin : Tuesday 22nd January 2005 -author : amorley -email : amorley@cern.ch -decription : Implementation code for EnergyLossUpdator class -*********************************************************************************/ - -#include "TrkGaussianSumFilter/GsfEnergyLossEffects.h" - -#include "TrkGeometry/Layer.h" -#include "TrkGeometry/MaterialProperties.h" -#include "TrkParameters/TrackParameters.h" -#include "TrkSurfaces/Surface.h" - -#include "TrkMaterialOnTrack/EnergyLoss.h" - -#include "TrkEventPrimitives/ParamDefs.h" - -namespace { -const Trk::ParticleMasses s_particleMasses{}; -} - -Trk::GsfEnergyLossEffects::GsfEnergyLossEffects(const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent) -{ - - declareInterface<IMultiStateMaterialEffects>(this); -} - -Trk::GsfEnergyLossEffects::~GsfEnergyLossEffects() = default; - -StatusCode -Trk::GsfEnergyLossEffects::initialize() -{ - if (m_EnergyLossUpdator.retrieve().isFailure()) { - ATH_MSG_FATAL("Failed to retrieve tool " << m_EnergyLossUpdator - << ". No energy effects will be taken into account."); - return StatusCode::FAILURE; - } else { - ATH_MSG_INFO("Retrieved tool " << m_EnergyLossUpdator); - } - ATH_MSG_INFO("Initialisation of " << name() << " was successful"); - return StatusCode::SUCCESS; -} - -StatusCode -Trk::GsfEnergyLossEffects::finalize() -{ - ATH_MSG_INFO("Finalisation of " << name() << " was successful"); - return StatusCode::SUCCESS; -} - -void -Trk::GsfEnergyLossEffects::compute(IMultiStateMaterialEffects::Cache& cache, - const ComponentParameters& componentParameters, - const MaterialProperties& materialProperties, - double pathLength, - PropDirection direction, - ParticleHypothesis particleHypothesis) const -{ - // Reset the cache - cache.reset(); - // Request track parameters from component parameters - const Trk::TrackParameters* trackParameters = componentParameters.first.get(); - - const AmgSymMatrix(5)* measuredCov = trackParameters->covariance(); - - if (!measuredCov) { - ATH_MSG_DEBUG("No measurement on track parameters... returning original track parameters"); - return; - } - - double pathcorrection = pathLength / materialProperties.thickness(); - const Amg::Vector3D& globalMomentum = trackParameters->momentum(); - - EnergyLoss* energyLoss = m_EnergyLossUpdator->energyLoss( - materialProperties, globalMomentum.mag(), pathcorrection, direction, particleHypothesis, true); - - // update for mean energy loss - double deltaE = energyLoss ? energyLoss->deltaE() : 0; - double sigmaDeltaE = energyLoss ? energyLoss->sigmaDeltaE() : 0; - delete energyLoss; - - // Calculate the pathlength encountered by the track - double p = globalMomentum.mag(); - double m = s_particleMasses.mass[particleHypothesis]; - double E = sqrt(p * p + m * m); - double beta = p / E; - - // Calculate energy loss values uncertainty - double sigmaQoverP = sigmaDeltaE / pow(beta * p, 2); - - // Update diagonal and off-diagonal covariance matrix elements - AmgSymMatrix(5) deltaCov; - deltaCov.setZero(); - deltaCov(Trk::qOverP, Trk::qOverP) += sigmaQoverP * sigmaQoverP; - - cache.weights.push_back(1.); - cache.deltaPs.push_back(deltaE); - cache.deltaCovariances.push_back(std::move(deltaCov)); -} diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx index 40d0ce8899689d47c0c8e52e978c4d3396518a79..1ec7d4e56193d2ab5e4095018fcade3fbd6ee54f 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx @@ -2,10 +2,10 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkGaussianSumFilter/KLGaussianMixtureReduction.h" -#include <algorithm> -#include <limits> #include "CxxUtils/features.h" #include "CxxUtils/vectorize.h" +#include <algorithm> +#include <limits> #if !defined(__GNUC__) #define __builtin_assume_aligned(X, N) X @@ -30,7 +30,7 @@ namespace GSFUtils { * * We also provide a default "scalar" implementation * - * FindMinimumSTL + * FindMinimumSTL * One of the issues we have see in that gcc8.3 and clang8 (02/2020) * optimise differently the STL version. See also * https://its.cern.ch/jira/projects/ATLASRECTS/issues/ATLASRECTS-5244 @@ -44,39 +44,36 @@ namespace GSFUtils { /* * * AVX2 intrinsics used : - * + * * _mm256_set1_epi32 - * Broadcast 32-bit integer a to all elements of dst. This intrinsic may generate the vpbroadcastd. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi32&expand=4657,4949 + * Broadcast 32-bit integer a to all elements of dst. This intrinsic may + * generate the vpbroadcastd. * * _mm256_setr_epi32 * Set packed 32-bit integers in dst with the supplied values in reverse order. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_setr_epi32&expand=4657,4949,4989 * * _mm256_load_ps - * Load 256-bits (composed of 8 packed single-precision (32-bit) floating-point elements) from memory into dst. - * mem_addr must be aligned on a 32-byte boundary or a general-protection exception may be generated. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_load_ps&expand=4657,4949,4989,3333 + * Load 256-bits (composed of 8 packed single-precision (32-bit) floating-point + * elements) from memory into dst. mem_addr must be aligned on a 32-byte + * boundary or a general-protection exception may be generated. * * _mm256_add_epi32 * Add packed 32-bit integers in a and b, and store the results in dst. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_add_epi32&expand=4657,4949,4989,3333,97 * * _mm256_cmp_ps - * Compare packed single-precision (32-bit) floating-point elements in a and b based on the comparison - * operand specified by imm8, and store the results in dst. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmp_ps&expand=4657,4949,4989,3333,97,744 + * Compare packed single-precision (32-bit) floating-point elements in a and b + * based on the comparison operand specified by imm8, and store the results in + * dst. * * _mm256_min_ps - * Compare packed single-precision (32-bit) floating-point elements in a and b, and store packed minimum values in - * dst. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_min_ps&expand=4657,4949,4989,3333,97,744,3766 + * Compare packed single-precision (32-bit) floating-point elements in a and + * b, and store packed minimum values in dst. * * _mm256_blendv_epi8 - * Blend packed 8-bit integers from a and b using mask, and store the results in dst. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_blendv_epi8&expand=4657,4949,4989,3333,97,744,3766,453 + * Blend packed 8-bit integers from a and b using mask, and store the results + * in dst. */ -__attribute__((target("avx2"))) +__attribute__((target("avx2"))) int32_t findMinimumIndex(const floatPtrRestrict distancesIn, const int n) { @@ -91,7 +88,8 @@ findMinimumIndex(const floatPtrRestrict distancesIn, const int n) // increment the indices indicesIn = _mm256_add_epi32(indicesIn, increment); // Get a mask indicating when an element is less than the ones we have - __m256i lt = _mm256_castps_si256(_mm256_cmp_ps(values, minvalues, _CMP_LT_OS)); + __m256i lt = + _mm256_castps_si256(_mm256_cmp_ps(values, minvalues, _CMP_LT_OS)); // b lend select the indices to update minindices = _mm256_blendv_epi8(minindices, indicesIn, lt); minvalues = _mm256_min_ps(values, minvalues); @@ -117,7 +115,6 @@ findMinimumIndex(const floatPtrRestrict distancesIn, const int n) * SSE * SSE2 does not have a blend/select instruction. * Instruction describes in - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_b&expand=431,452&techs=SSE4_1 * We AND & * - a with the NOT of the mask * - b with the mask @@ -138,34 +135,28 @@ static const auto mm_blendv_epi8 = SSE2_mm_blendv_epi8; * * _mm_set1_epi32 * Broadcast 32-bit integer a to all elements of dst. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi32&expand=431,452,426,4946,4946&techs=SSE2 * * _mm_setr_epi32 - * Set packed 32-bit integers in dst with the supplied values in reverse order. * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_setr_epi32&expand=431,452,426,4946,4946,4988&techs=SSE2 * * _mm_load_ps * Set packed 32-bit integers in dst with the supplied values in reverse order. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_setr_epi32&expand=431,452,426,4946,4946,4988&techs=SSE2 * * dst = _mm_add_epi32 (a,b) * Add packed 32-bit integers in a and b, and store the results in dst. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_add_epi32&expand=431,452,426,4946,4946,4988,94&techs=SSE2 * * dst = _mm_min_ps (a,b) - * Compare packed single-precision (32-bit) floating-point elements in a and b, and store packed minimum values in - * dst. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=%2525252520_mm_min_ps&expand=431,452,426,4946,4946,4988,94,3763 + * Compare packed single-precision (32-bit) floating-point elements in a and + * b, and store packed minimum values in dst. * * dst = _mm_cmplt_ps ( a, b) - * Compare packed single-precision (32-bit) floating-point elements in a and b for less-than, and store the results in - * dst. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=%252520_mm_cmplt_ps&expand=431,452,426,4946,4946,4988,94,3763,4988 + * Compare packed single-precision (32-bit) floating-point elements in a and b + * for less-than, and store the results in dst. * * _mm_castps_si128 - * Cast vector of type __m128 to type __m128i. This intrinsic is only used for compilation and does not generate any - * instructions, thus it has zero latency. - * https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=%2520_mm_castps_si128&expand=431,452,426,4946,4946,4988,94,3763,4988,617 + * Cast vector of type __m128 to type __m128i. This intrinsic is only used + * for compilation and does not generate any instructions, thus it has zero + * latency. */ __attribute__((target("sse4.2,sse2"))) int32_t @@ -217,8 +208,7 @@ findMinimumIndex(const floatPtrRestrict distancesIn, const int n) } return minIndex; } -#endif //end of x86_64 versions - +#endif // end of x86_64 versions /* Always fall back to a simple default version with no intrinsics */ __attribute__((target("default"))) @@ -254,7 +244,7 @@ findMinimumIndexSTL(const floatPtrRestrict distancesIn, const int n) /* * Find the index of the 2 smaller values - */ + */ std::pair<int32_t, int32_t> findMinimumIndexPair(const floatPtrRestrict distancesIn, const int n) { @@ -279,104 +269,55 @@ findMinimumIndexPair(const floatPtrRestrict distancesIn, const int n) return std::make_pair(mini, mini2); } - -void -resetDistances(floatPtrRestrict distancesIn, const int mini, const int n) -{ - - float* distances = (float*)__builtin_assume_aligned(distancesIn, alignment); - const int j = mini; - const int indexConst = (j + 1) * j / 2; - for (int i = 0; i < j; ++i) { - distances[indexConst + i] = std::numeric_limits<float>::max(); - } - - for (int i = j; i < n; ++i) { - int index = (i + 1) * i / 2 + j; - distances[index] = std::numeric_limits<float>::max(); - } -} - -void -calculateAllDistances(floatPtrRestrict qonpIn, - floatPtrRestrict qonpCovIn, - floatPtrRestrict qonpGIn, - floatPtrRestrict distancesIn, - int n) -{ - - float* qonp = (float*)__builtin_assume_aligned(qonpIn, alignment); - float* qonpCov = (float*)__builtin_assume_aligned(qonpCovIn, alignment); - float* qonpG = (float*)__builtin_assume_aligned(qonpGIn, alignment); - float* distances = (float*)__builtin_assume_aligned(distancesIn, alignment); - - for (int i = 0; i < n; ++i) { - const int indexConst = (i + 1) * i / 2; - float qonpi = qonp[i]; - float qonpCovi = qonpCov[i]; - float qonpGi = qonpG[i]; - for (int j = 0; j < i; ++j) { - float parametersDifference = qonpi - qonp[j]; - float covarianceDifference = qonpCovi - qonpCov[j]; - float G_difference = qonpG[j] - qonpGi; - float G_sum = qonpGi + qonpG[j]; - distances[indexConst + j] = - covarianceDifference * G_difference + parametersDifference * G_sum * parametersDifference; - - //\log \frac{\sigma_2}{\sigma_1} + \frac{\sigma_1^2 + (\mu_1 - \mu_2)^2}{2 \sigma_2^2} - - //\frac{1}{2} - } - } -} - -int -recalculateDistances(floatPtrRestrict qonpIn, - floatPtrRestrict qonpCovIn, - floatPtrRestrict qonpGIn, +int32_t +recalculateDistances(const componentPtrRestrict componentsIn, floatPtrRestrict distancesIn, - int mini, - int n) + const int32_t mini, + const int32_t n) { + const Component1D* components = + static_cast<const Component1D*>(__builtin_assume_aligned(componentsIn, alignment)); + float* distances = static_cast<float*>(__builtin_assume_aligned(distancesIn, alignment)); - float* qonp = (float*)__builtin_assume_aligned(qonpIn, alignment); - float* qonpCov = (float*)__builtin_assume_aligned(qonpCovIn, alignment); - float* qonpG = (float*)__builtin_assume_aligned(qonpGIn, alignment); - float* distances = (float*)__builtin_assume_aligned(distancesIn, alignment); - - int j = mini; - const int indexConst = (j + 1) * j / 2; + const int32_t j = mini; + const int32_t indexConst = (j + 1) * j / 2; - int minIndex = 0; // The distance will always be 1e30 for this entry; + int32_t minIndex = 0; float minDistance = std::numeric_limits<float>::max(); - for (int i = 0; i < j; ++i) { - if (qonpCov[i] == 0) { - distances[indexConst + i] = std::numeric_limits<float>::max(); + const Component1D componentJ = components[j]; + + for (int32_t i = 0; i < j; ++i) { + const Component1D componentI = components[i]; + const int32_t index = indexConst + i; + if (componentI.cov == 0) { + distances[index] = std::numeric_limits<float>::max(); continue; } - float parametersDifference = qonp[i] - qonp[j]; - float covarianceDifference = qonpCov[i] - qonpCov[j]; - float G_difference = qonpG[j] - qonpG[i]; - float G_sum = qonpG[i] + qonpG[j]; - int index = indexConst + i; - distances[index] = covarianceDifference * G_difference + parametersDifference * G_sum * parametersDifference; + const double meanDifference = componentI.mean - componentJ.mean; + const double covarianceDifference = componentI.cov - componentJ.cov; + const double invertCovDiff = componentI.invCov - componentJ.invCov; + const double inverCovSum = componentI.invCov + componentJ.invCov; + distances[index] = covarianceDifference * invertCovDiff + + meanDifference * inverCovSum * meanDifference; if (distances[index] < minDistance) { minIndex = index; minDistance = distances[index]; } } - - for (int i = j + 1; i < n; ++i) { - int index = (i + 1) * i / 2 + j; - if (qonpCov[i] == 0) { + for (int32_t i = j + 1; i < n; ++i) { + const int32_t index = (i + 1) * i / 2 + j; + const Component1D componentI = components[i]; + if (componentI.cov == 0) { distances[index] = std::numeric_limits<float>::max(); continue; } - float parametersDifference = qonp[i] - qonp[j]; - float covarianceDifference = qonpCov[i] - qonpCov[j]; - float G_difference = qonpG[j] - qonpG[i]; - float G_sum = qonpG[i] + qonpG[j]; - distances[index] = covarianceDifference * G_difference + parametersDifference * G_sum * parametersDifference; + const double meanDifference = componentI.mean - componentJ.mean; + const double covarianceDifference = componentI.cov - componentJ.cov; + const double invertCovDiff = componentI.invCov - componentJ.invCov; + const double inverCovSum = componentI.invCov + componentJ.invCov; + distances[index] = covarianceDifference * invertCovDiff + + meanDifference * inverCovSum * meanDifference; if (distances[index] < minDistance) { minIndex = index; minDistance = distances[index]; @@ -384,4 +325,51 @@ recalculateDistances(floatPtrRestrict qonpIn, } return minIndex; } + +// Calculate the distances for all pairs +void +calculateAllDistances(const componentPtrRestrict componentsIn, + floatPtrRestrict distancesIn, + const int32_t n) +{ + + const Component1D* components = + static_cast<const Component1D*>(__builtin_assume_aligned(componentsIn, alignment)); + float* distances = static_cast<float*>(__builtin_assume_aligned(distancesIn, alignment)); + + for (int32_t i = 0; i < n; ++i) { + const int32_t indexConst = (i + 1) * i / 2; + const Component1D componentI = components[i]; + for (int32_t j = 0; j < i; ++j) { + const Component1D componentJ = components[j]; + const double meanDifference = componentI.mean - componentJ.mean; + const double covarianceDifference = componentI.cov - componentJ.cov; + const double invertCovDiff = componentI.invCov - componentJ.invCov; + const double inverCovSum = componentI.invCov + componentJ.invCov; + distances[indexConst + j] = covarianceDifference * invertCovDiff + + meanDifference * inverCovSum * meanDifference; + } + } +} + +// Reset the distances for a row +void +resetDistances(floatPtrRestrict distancesIn, + const int32_t mini, + const int32_t n) +{ + + float* distances = (float*)__builtin_assume_aligned(distancesIn, alignment); + const int32_t j = mini; + const int32_t indexConst = (j + 1) * j / 2; + for (int32_t i = 0; i < j; ++i) { + distances[indexConst + i] = std::numeric_limits<float>::max(); + } + + for (int32_t i = j; i < n; ++i) { + const int32_t index = (i + 1) * i / 2 + j; + distances[index] = std::numeric_limits<float>::max(); + } +} + } // end namespace GSFUtils diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultipleScatteringEffects.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultipleScatteringEffects.cxx deleted file mode 100644 index 00d2cfb5b4138a8bcb5eb2344fcc6e9b9167acbf..0000000000000000000000000000000000000000 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultipleScatteringEffects.cxx +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************* - MultipleScatteringEffects.cxx - description - ------------------------------------------ -begin : Tuesday 22nd January 2005 -author : amorley -email : amorley@cern.ch -decription : Implementation code for multiple scatter effects -*********************************************************************************/ - -#include "TrkGaussianSumFilter/MultipleScatteringEffects.h" -#include "TrkGeometry/Layer.h" -#include "TrkGeometry/MaterialProperties.h" -#include "TrkParameters/TrackParameters.h" -#include "TrkSurfaces/Surface.h" - -#include "TrkEventPrimitives/ParamDefs.h" - -#include <cmath> - -Trk::MultipleScatteringEffects::MultipleScatteringEffects(const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent) - , m_multipleScatterLogTermOn(true) -{ - declareInterface<IMultiStateMaterialEffects>(this); - declareProperty("MultipleScatterLogarithmicTermOn", m_multipleScatterLogTermOn); -} - -Trk::MultipleScatteringEffects::~MultipleScatteringEffects() = default; - -StatusCode -Trk::MultipleScatteringEffects::initialize() -{ - ATH_CHECK(m_msUpdator.retrieve()); - ATH_MSG_DEBUG("Initialisation of " << name() << " was successful"); - return StatusCode::SUCCESS; -} - -StatusCode -Trk::MultipleScatteringEffects::finalize() -{ - ATH_MSG_DEBUG("Finalisation of " << name() << " was successful"); - return StatusCode::SUCCESS; -} - -void -Trk::MultipleScatteringEffects::compute(IMultiStateMaterialEffects::Cache& cache, - const ComponentParameters& componentParameters, - const MaterialProperties& materialProperties, - double pathLength, - PropDirection /*direction*/, - ParticleHypothesis /*particleHypothesis*/) const -{ - // Reset the cache - cache.reset(); - // Request track parameters from component parameters - const Trk::TrackParameters* trackParameters = componentParameters.first.get(); - - ATH_MSG_VERBOSE("Updating multiple scatter effects based on material properties and path length"); - - const AmgSymMatrix(5)* measuredTrackCov = trackParameters->covariance(); - - if (!measuredTrackCov) { - ATH_MSG_DEBUG("No measurement associated with track parameters... returning original parameters"); - return; - } - - const Amg::Vector3D& globalMomentum = trackParameters->momentum(); - double p = globalMomentum.mag(); - - double pathcorrection = 1.; - if (materialProperties.thickness() != 0) - pathcorrection = pathLength / materialProperties.thickness(); - - // Here we know the path length to be meff.thicknessX0, so we set pathcorrection = 1 - // and create a dummy materialProperties with the properties we are interested in - MaterialProperties mprop(materialProperties.thicknessInX0(), 1., 0., 0., 0., 0.); - double angularVariation = m_msUpdator->sigmaSquare(mprop, p, pathcorrection, Trk::muon); - ATH_MSG_DEBUG("Sigma squared multiple scattering: " << angularVariation); - - AmgSymMatrix(5) deltaCov; - deltaCov.setZero(); - // double sign = (direction == Trk::oppositeMomentum) ? 1. : 1.; - double sinTheta = std::sin(trackParameters->parameters()[Trk::theta]); - deltaCov(Trk::phi, Trk::phi) += angularVariation / (sinTheta * sinTheta); - deltaCov(Trk::theta, Trk::theta) += angularVariation; - cache.weights.push_back(1.); - cache.deltaPs.push_back(0.); - cache.deltaCovariances.push_back(std::move(deltaCov)); -} diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx index c22d99ef332a92a77afdabb0955f01bfb4e7fbec..a4ba73500173d8d25e8411bb05f3fb631fc07d76 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx @@ -103,10 +103,7 @@ Trk::QuickCloseComponentsMultiStateMerger::mergeFullDistArray(MultiComponentStat // Array to store all of the distances between components AlignedDynArray<float, alignment> distances(nn2, std::numeric_limits<float>::max()); - AlignedDynArray<float, alignment> qonp(n, 0.0); // Array of qonp for each component - AlignedDynArray<float, alignment> qonpCov(n, 0.0); // Array of Cov(qonp,qonp) for each component - AlignedDynArray<float, alignment> qonpG(n, 1e10); // Array of 1/Cov(qonp,qonp) for each component - + AlignedDynArray<Component1D, alignment> components(n); // Arrayfor each component // Needed to convert the triangular index to (i,j) std::vector<triangularToIJ> convert(nn2, { -1, -1 }); // Calculate indicies @@ -122,15 +119,16 @@ Trk::QuickCloseComponentsMultiStateMerger::mergeFullDistArray(MultiComponentStat // Create an array of all components to be merged for (int32_t i = 0; i < n; ++i) { const AmgSymMatrix(5)* measuredCov = statesToMerge[i].first->covariance(); - const AmgVector(5) parameters = statesToMerge[i].first->parameters(); + const AmgVector(5)& parameters = statesToMerge[i].first->parameters(); // Fill in infomation - qonp[i] = parameters[Trk::qOverP]; - qonpCov[i] = measuredCov ? (*measuredCov)(Trk::qOverP, Trk::qOverP) : -1.; - qonpG[i] = qonpCov[i] > 0 ? 1. / qonpCov[i] : 1e10; + const double cov= measuredCov ? (*measuredCov)(Trk::qOverP, Trk::qOverP) : -1.; + components[i].mean= parameters[Trk::qOverP]; + components[i].cov = cov; + components[i].invCov = cov > 0 ? 1./cov : 1e10; } // Calculate distances for all pairs // This loop can be vectorised - calculateAllDistances(qonp, qonpCov, qonpG, distances, n); + calculateAllDistances(components, distances, n); /* * Loop over all components until you reach the target amount @@ -171,15 +169,18 @@ Trk::QuickCloseComponentsMultiStateMerger::mergeFullDistArray(MultiComponentStat */ const AmgSymMatrix(5)* measuredCov = statesToMerge[mini].first->covariance(); const AmgVector(5)& parameters = statesToMerge[mini].first->parameters(); - qonp[mini] = parameters[Trk::qOverP]; - qonpCov[mini] = (*measuredCov)(Trk::qOverP, Trk::qOverP); - qonpG[mini] = qonpCov[mini] > 0 ? 1. / qonpCov[mini] : 1e10; - qonp[minj] = 0.; - qonpCov[minj] = 0.; - qonpG[minj] = 1e10; - + const double cov = (*measuredCov)(Trk::qOverP, Trk::qOverP); + + components[mini].mean= parameters[Trk::qOverP]; + components[mini].cov = cov; + components[mini].invCov = cov > 0 ? 1./cov : 1e10; + + components[minj].mean = 0.; + components[minj].cov = 0.; + components[minj].invCov = 1e10; + // re-calculate distances wrt the new component at mini - int32_t possibleNextMin = recalculateDistances(qonp, qonpCov, qonpG, distances, mini, n); + int32_t possibleNextMin = recalculateDistances(components, distances, mini, n); //We might already got something smaller than the previous minimum //we can therefore use the new one directly if (possibleNextMin > 0 && distances[possibleNextMin] < currentMinValue) { diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/components/TrkGaussianSumFilter_entries.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/components/TrkGaussianSumFilter_entries.cxx index 8770108bb55bb7a2019e8afe82a4995a534554e8..1a90a82d02e8cf77a02b3c59688f6cba96ce10fe 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/components/TrkGaussianSumFilter_entries.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/components/TrkGaussianSumFilter_entries.cxx @@ -2,10 +2,8 @@ #include "TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h" #include "TrkGaussianSumFilter/GsfCombinedMaterialEffects.h" #include "TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h" -#include "TrkGaussianSumFilter/MultipleScatteringEffects.h" #include "TrkGaussianSumFilter/GsfBetheHeitlerEffects.h" #include "TrkGaussianSumFilter/GsfMeasurementUpdator.h" -#include "TrkGaussianSumFilter/GsfEnergyLossEffects.h" #include "TrkGaussianSumFilter/GaussianSumFitter.h" #include "TrkGaussianSumFilter/ForwardGsfFitter.h" #include "TrkGaussianSumFilter/GsfExtrapolator.h" @@ -15,10 +13,8 @@ DECLARE_COMPONENT( Trk::QuickCloseComponentsMultiStateMerger ) DECLARE_COMPONENT( Trk::GsfMaterialMixtureConvolution ) DECLARE_COMPONENT( Trk::GsfCombinedMaterialEffects ) DECLARE_COMPONENT( Trk::GsfMaterialEffectsUpdator ) -DECLARE_COMPONENT( Trk::MultipleScatteringEffects ) DECLARE_COMPONENT( Trk::GsfBetheHeitlerEffects ) DECLARE_COMPONENT( Trk::GsfMeasurementUpdator ) -DECLARE_COMPONENT( Trk::GsfEnergyLossEffects ) DECLARE_COMPONENT( Trk::GaussianSumFitter ) DECLARE_COMPONENT( Trk::ForwardGsfFitter ) DECLARE_COMPONENT( Trk::GsfExtrapolator ) diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorToolDebug.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorToolDebug.cxx index 8f830ead06b819f4414d4e65def4a8f258538082..a33d2344ffe7b84679a065853a23a4bafc8f7031 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorToolDebug.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorToolDebug.cxx @@ -6,8 +6,8 @@ #include "GeneratorObjects/HepMcParticleLink.h" #include "GaudiKernel/ITHistSvc.h" #include "TTree.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "InDetPrepRawData/SCT_Cluster.h" #include "InDetPrepRawData/PixelCluster.h" @@ -18,7 +18,7 @@ #include "InDetPrepRawData/SCT_ClusterContainer.h" #include "InDetPrepRawData/PixelClusterContainer.h" #include "InDetPrepRawData/TRT_DriftCircle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" #include "GaudiKernel/IPartPropSvc.h" #include "TrkToolInterfaces/ITruthToTrack.h" #include "GeneratorObjects/McEventCollection.h" diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorToolDebug.h b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorToolDebug.h index 8aba573b5ab3be32a5ba7e0575bd2c74b5cb130d..6f8f787a8b2d1820813706c0e8380f37981b2ecd 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorToolDebug.h +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorToolDebug.h @@ -19,7 +19,7 @@ typedef HepGeom::Point3D<double> HepPoint3D; #include "TrkTruthData/TrackTruthCollection.h" #include "xAODEventInfo/EventInfo.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" typedef std::map<const Trk::Track*, const Trk::Track*> TrackCollectionConnection; #ifndef SIMPLEAMBIGPROCDEBUGCODE_CLASS_DEF diff --git a/Tracking/TrkTools/TrkParticleCreator/CMakeLists.txt b/Tracking/TrkTools/TrkParticleCreator/CMakeLists.txt index 138a96a10d29a9f1eae542e112b165f13822f278..70ff9751062a259d219a7feeeaca22064584c9f6 100644 --- a/Tracking/TrkTools/TrkParticleCreator/CMakeLists.txt +++ b/Tracking/TrkTools/TrkParticleCreator/CMakeLists.txt @@ -36,7 +36,9 @@ atlas_depends_on_subdirs( Reconstruction/Particle Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkPseudoMeasurementOnTrack - Tracking/TrkEvent/VxVertex ) + Tracking/TrkEvent/VxVertex + MagneticField/MagFieldElements + MagneticField/MagFieldConditions) # Component(s) in the package: atlas_add_library( TrkParticleCreatorLib @@ -56,4 +58,4 @@ atlas_add_component( TrkParticleCreator AthContainers AtlasDetDescr GeoPrimitives IdDictDetDescr InDetPrepRawData InDetRIO_OnTrack MagFieldInterfaces Particle ITrackToVertex TrkSurfaces TrkPseudoMeasurementOnTrack VxVertex TrkExInterfaces PixelGeoModelLib - TrkParticleCreatorLib ) + TrkParticleCreatorLib MagFieldElements MagFieldConditions) diff --git a/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h index 2bce75cb68760e7bda6d6cb34e2f3bdf79aeb81b..0664cebf9db68c0d43ffaa7f2e7c141798e5532b 100644 --- a/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h +++ b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h @@ -14,6 +14,7 @@ changes : 11.02.04 added docu #ifndef TRKPARTICLECREATOR_PARTICLECREATORTOOL_H #define TRKPARTICLECREATOR_PARTICLECREATORTOOL_H +#include "GaudiKernel/EventContext.h" #include "TrkToolInterfaces/ITrackParticleCreatorTool.h" #include "AthenaBaseComps/AthAlgTool.h" @@ -21,7 +22,6 @@ changes : 11.02.04 added docu #include "EventPrimitives/EventPrimitivesHelpers.h" #include "InDetIdentifier/PixelID.h" #include "ITrackToVertex/ITrackToVertex.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "MuonRecToolInterfaces/IMuonHitSummaryTool.h" #include "PixelGeoModel/IBLParameterSvc.h" #include "TrkEventPrimitives/FitQuality.h" @@ -38,6 +38,9 @@ changes : 11.02.04 added docu #include "xAODTracking/VertexFwd.h" #include "GaudiKernel/ToolHandle.h" +// MagField cache +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" namespace Rec { @@ -69,8 +72,8 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato @param track Pointer to a valid track (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted) @param vxCandidate Pointer to a valid vxCandidate (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted) @param bsdata BeamSpot data - can be obtained with CondHandle or from a tool. - @param prtOrigin - @warning In my opinion, the interface is not optimal - we're not taking ownership of the Trk::Track or Vx::Candidate, + @param prtOrigin + @warning In my opinion, the interface is not optimal - we're not taking ownership of the Trk::Track or Vx::Candidate, so they should be passed by reference. */ virtual @@ -79,7 +82,7 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato Trk::TrackParticleOrigin prtOrigin) const override; /** Method to construct a xAOD::TrackParticle from a Rec::TrackParticle. - @param track particle + @param track particle @param TrackParticleContainer needed to have an AuxStore, if provided particle will be added to store which takes ownership */ virtual @@ -118,8 +121,8 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato /** create a xAOD::TrackParticle out of constituents */ virtual xAOD::TrackParticle* createParticle( const Perigee* perigee, const FitQuality* fq, const TrackInfo* trackInfo, const TrackSummary* summary, - const std::vector<const Trk::TrackParameters*>& parameters, - const std::vector< xAOD::ParameterPosition>& positions, + const std::vector<const Trk::TrackParameters*>& parameters, + const std::vector< xAOD::ParameterPosition>& positions, xAOD::ParticleHypothesis prtOrigin, xAOD::TrackParticleContainer* container ) const override; @@ -145,48 +148,50 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato void setNumberOfUsedHits(xAOD::TrackParticle& tp, int hits) const; void setNumberOfOverflowHits(xAOD::TrackParticle& tp, int overflows) const; - + /** Get the name used for the decoration of the track particle with the number of used hits for TRT dE/dx computation.*/ static const std::string & trtdEdxUsedHitsAuxName() { return s_trtdEdxUsedHitsDecorationName; } virtual const InDet::BeamSpotData* CacheBeamSpotData(const ::EventContext &ctx) const override; private: - void compare( const Rec::TrackParticle& tp, const xAOD::TrackParticle& tpx ) const; + void compare( const Rec::TrackParticle& tp, const xAOD::TrackParticle& tpx ) const; void compare( const TrackParameters& tp1, const TrackParameters& tp2 ) const; /**atlas id helper*/ const AtlasDetectorID* m_detID; const PixelID* m_pixelID; - + //Need to change to private when is safe to do so PublicToolHandle<IExtendedTrackSummaryTool> m_trackSummaryTool{this, "TrackSummaryTool","Trk::TrackSummaryTool/AtlasTrackSummaryTool"}; - + PublicToolHandle<IExtrapolator> m_extrapolator{this, "Extrapolator","Trk::Extrapolator/AtlasExtrapolator"}; - + ToolHandle<Reco::ITrackToVertex> m_trackToVertex{this, "TrackToVertex","Reco::TrackToVertex/TrackToVertex"}; ToolHandle<Muon::IMuonHitSummaryTool> m_hitSummaryTool{this, "MuonSummaryTool","Muon::MuonHitSummaryTool/MuonHitSummaryTool"}; - - + + /** to query magnetic field configuration */ - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + //ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; ServiceHandle <IBLParameterSvc> m_IBLParameterSvc; - + + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", + "Name of the Magnetic Field conditions object key"}; /** Configurable to set the eProbabilities and extra track summary types which are to be copied from the track summary.*/ std::vector<std::string> m_copyExtraSummaryName; /** Enums of an eProbability which are set in the xAOD::TrackSummary.*/ - std::vector<Trk::eProbabilityType> m_copyEProbabilities; + std::vector<Trk::eProbabilityType> m_copyEProbabilities; /** The pairs if enums of an eProbability which is added as a decoration to the track particle and the name of the decoration.*/ - std::vector<std::pair<SG::AuxElement::Decorator<float>,Trk::eProbabilityType> > m_decorateEProbabilities; - std::vector<std::pair<SG::AuxElement::Decorator<uint8_t>,Trk::SummaryType> > m_decorateSummaryTypes; + std::vector<std::pair<SG::AuxElement::Decorator<float>,Trk::eProbabilityType> > m_decorateEProbabilities; + std::vector<std::pair<SG::AuxElement::Decorator<uint8_t>,Trk::SummaryType> > m_decorateSummaryTypes; + - /** Name used for the decoration of the track particle with TRT dE/dx .*/ static const std::string s_trtdEdxUsedHitsDecorationName; static const SG::AuxElement::Decorator<uint8_t> s_trtdEdxUsedHitsDecoration; @@ -205,14 +210,14 @@ private: (e.g. adding those that may exist at Volume boundaries) */ bool m_expressPerigeeToBeamSpot; int m_badclusterID; - + std::string m_perigeeExpression; - std::vector<std::string> m_perigeeOptions{"BeamLine", "BeamSpot", "Vertex", "Origin"}; + std::vector<std::string> m_perigeeOptions{"BeamLine", "BeamSpot", "Vertex", "Origin"}; bool m_checkConversion; int m_minSiHits; double m_minPt; - + bool castPerigeeAndCheck(const Trk::Track* track, const Trk::Perigee* &aPer) const; bool m_updateTrack; }; @@ -230,7 +235,7 @@ inline void TrackParticleCreatorTool::setTrackInfo( xAOD::TrackParticle& tp, con uint64_t patternReco=0; const uint64_t c1=1; - for (unsigned int i = 0; i< xAOD::NumberOfTrackRecoInfo ; i++){ + for (unsigned int i = 0; i< xAOD::NumberOfTrackRecoInfo ; i++){ if (trackInfo.patternRecoInfo(static_cast<Trk::TrackInfo::TrackPatternRecoInfo>(i))) patternReco |= c1 << i; } @@ -249,13 +254,13 @@ inline void TrackParticleCreatorTool::setDefiningParameters( xAOD::TrackParticle perigee.parameters()[Trk::theta], perigee.parameters()[Trk::qOverP]); const AmgSymMatrix(5)* covMatrix = perigee.covariance(); - // see https://its.cern.ch/jira/browse/ATLASRECTS-645 for justification to comment out the following line - // assert(covMatrix && covMatrix->rows()==5&& covMatrix->cols()==5); + // see https://its.cern.ch/jira/browse/ATLASRECTS-645 for justification to comment out the following line + // assert(covMatrix && covMatrix->rows()==5&& covMatrix->cols()==5); std::vector<float> covMatrixVec; if( !covMatrix ) ATH_MSG_WARNING("Setting Defining parameters without error matrix"); else Amg::compress(*covMatrix,covMatrixVec); tp.setDefiningParametersCovMatrixVec(covMatrixVec); - const Amg::Vector3D& surfaceCenter = perigee.associatedSurface().center(); + const Amg::Vector3D& surfaceCenter = perigee.associatedSurface().center(); tp.setParametersOrigin(surfaceCenter.x(), surfaceCenter.y(), surfaceCenter.z() ); } diff --git a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx index 73e76dc784245a30efe6a25d57b79e6d9d98e937..e813b8206e49e134bbc876a4b488dd729f0da2a7 100644 --- a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx +++ b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx @@ -9,7 +9,7 @@ authors : Andreas Wildauer (CERN PH-ATC), Fredrik Akesson (CERN PH-ATC) email : andreas.wildauer@cern.ch, fredrik.akesson@cern.ch changes : - + ***************************************************************************/ #undef NDEBUG #include "TrkParticleCreator/TrackParticleCreatorTool.h" @@ -51,7 +51,7 @@ #include <memory> #include <vector> -// helper methods to print messages +// helper methods to print messages template<class T> inline MsgStream& operator<<( MsgStream& msg_stream, const std::map<std::string, T>& elm_map) { for (const std::pair<const std::string, T> &elm : elm_map) { @@ -82,7 +82,7 @@ namespace Trk eprob_map.insert( std::make_pair("eProbabilityComb",std::make_pair(Trk::eProbabilityComb,false)) ); eprob_map.insert( std::make_pair("eProbabilityHT",std::make_pair(Trk::eProbabilityHT,false)) ); - // added as decorations + // added as decorations eprob_map.insert( std::make_pair("eProbabilityToT",std::make_pair(Trk::eProbabilityToT,true)) ); eprob_map.insert( std::make_pair("eProbabilityBrem",std::make_pair(Trk::eProbabilityBrem,true)) ); eprob_map.insert( std::make_pair("TRTTrackOccupancy",std::make_pair(Trk::numberOfeProbabilityTypes,true)) ); @@ -102,7 +102,6 @@ namespace Trk : base_class(t,n,p), m_detID(nullptr), m_pixelID(nullptr), - m_magFieldSvc ("AtlasFieldSvc", n), m_IBLParameterSvc("IBLParameterSvc",n), m_copyExtraSummaryName {"eProbabilityComb","eProbabilityHT","TRTTrackOccupancy","TRTdEdx","TRTdEdxUsedHits"}, m_copyEProbabilities{}, @@ -122,7 +121,6 @@ namespace Trk declareProperty("ForceTrackSummaryUpdate", m_forceTrackSummaryUpdate ); declareProperty("ComputeAdditionalInfo", m_computeAdditionalInfo); declareProperty("UpdateTrack", m_updateTrack=true ); - declareProperty("MagFieldSvc", m_magFieldSvc); declareProperty("UseTrackSummaryTool" , m_useTrackSummaryTool); declareProperty("UseMuonSummaryTool" , m_useMuonSummaryTool); declareProperty("KeepParameters", m_keepParameters); @@ -136,17 +134,17 @@ namespace Trk declareProperty("BadClusterID", m_badclusterID = 0); //0 = off, 1 = OOT, 2 = dE/dx, 3 = combination of OOT and dE/dx, 4 = combination of OOT, dE/dx, and size declareProperty("ExtraSummaryTypes", m_copyExtraSummaryName); } - + StatusCode TrackParticleCreatorTool::initialize() { ATH_MSG_DEBUG("initialize TrackParticleCreatorTool"); - if (std::find(std::begin(m_perigeeOptions), std::end(m_perigeeOptions), m_perigeeExpression) == std::end(m_perigeeOptions)){ - ATH_MSG_ERROR("Unknown Configuration for Perigee Expression - please use one of " << m_perigeeOptions); - return StatusCode::FAILURE; - } - + if (std::find(std::begin(m_perigeeOptions), std::end(m_perigeeOptions), m_perigeeExpression) == std::end(m_perigeeOptions)){ + ATH_MSG_ERROR("Unknown Configuration for Perigee Expression - please use one of " << m_perigeeOptions); + return StatusCode::FAILURE; + } + if (!m_expressPerigeeToBeamSpot){ ATH_MSG_WARNING("Using old configuration option! please use one of " << m_perigeeOptions << ". Assuming Origin." ); m_perigeeExpression = "Origin"; @@ -165,7 +163,7 @@ namespace Trk else { m_trackSummaryTool.disable(); } - + /* Retrieve track extrapolator from ToolService */ if ( m_extrapolator.retrieve().isFailure() ) { ATH_MSG_FATAL( "Failed to retrieve tool " << m_extrapolator ); @@ -197,14 +195,14 @@ namespace Trk if (m_doIBL && !m_IBLParameterSvc->contains3D()){ ATH_MSG_WARNING( "Assuming hybrid 2D/3D IBL module composition, but geometry is all-planar" ); } - - /* Retrieve track to vertex from ToolService */ - if ( m_trackToVertex.retrieve().isFailure() ) { + + /* Retrieve track to vertex from ToolService */ + if ( m_trackToVertex.retrieve().isFailure() ) { ATH_MSG_FATAL( "Failed to retrieve tool " << m_trackToVertex ); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG( "Retrieved tool " << m_trackToVertex ); - } + return StatusCode::FAILURE; + } else { + ATH_MSG_DEBUG( "Retrieved tool " << m_trackToVertex ); + } if (m_useMuonSummaryTool){ /* Retrieve hit summary tool from ToolService */ @@ -219,12 +217,8 @@ namespace Trk m_hitSummaryTool.disable(); } - /* MagneticFieldSvc handles updates itself */ - if (m_magFieldSvc.retrieve().isFailure()){ - ATH_MSG_FATAL( "Could not retrieve MagneticFieldSvc." ); - return StatusCode::FAILURE; - } - + + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); StatusCode sc(StatusCode::SUCCESS); m_copyEProbabilities.clear(); @@ -239,7 +233,7 @@ namespace Trk std::vector<std::string> errors; for ( const std::string &eprob_to_copy : m_copyExtraSummaryName) { - std::map<std::string,std::pair<Trk::eProbabilityType, bool> >::const_iterator + std::map<std::string,std::pair<Trk::eProbabilityType, bool> >::const_iterator eprob_iter = eprob_map.find(eprob_to_copy); if (eprob_iter == eprob_map.end()) { std::map<std::string,Trk::SummaryType >::const_iterator @@ -249,7 +243,7 @@ namespace Trk } else { m_decorateSummaryTypes.emplace_back(SG::AuxElement::Decorator<uint8_t>(extra_summary_type_iter->first), - extra_summary_type_iter->second); + extra_summary_type_iter->second); } } else { @@ -257,7 +251,7 @@ namespace Trk m_copyEProbabilities.push_back(eprob_iter->second.first); } else{ - m_decorateEProbabilities.emplace_back(SG::AuxElement::Decorator<float>(eprob_iter->first),eprob_iter->second.first); + m_decorateEProbabilities.emplace_back(SG::AuxElement::Decorator<float>(eprob_iter->first),eprob_iter->second.first); } } } @@ -272,20 +266,20 @@ namespace Trk ATH_MSG_VERBOSE( " initialize successful." ); return sc; } - + StatusCode TrackParticleCreatorTool::finalize() { ATH_MSG_INFO( " finalize successful" ); return StatusCode::SUCCESS; } - + Rec::TrackParticle* TrackParticleCreatorTool::createParticle(const Trk::Track* track, const Trk::VxCandidate* vxCandidate, Trk::TrackParticleOrigin prtOrigin) const { if (track == nullptr) return nullptr; const Trk::Perigee* aPer = nullptr; - + // the default way; I left it as it was because it is working fine!! if ( m_perigeeExpression == "Origin") { @@ -302,34 +296,34 @@ namespace Trk } } else { - const Amg::Vector3D persf(0,0,0); - const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex( *track, persf ); - if (result != nullptr) { - aPer = result; - }else{ - ATH_MSG_DEBUG ("Could not extrapolate to 0,0,0. No TrackParticle created."); + const Amg::Vector3D persf(0,0,0); + const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex( *track, persf ); + if (result != nullptr) { + aPer = result; + }else{ + ATH_MSG_DEBUG ("Could not extrapolate to 0,0,0. No TrackParticle created."); return nullptr; } } - } - - else if (m_perigeeExpression == "BeamSpot"){ //Express parameters at beamspot - const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamspot( *track, CacheBeamSpotData(Gaudi::Hive::currentContext()) ); - if (!result){ - - ATH_MSG_WARNING("Failed to extrapolate to first Beamspot"); - if ( !track->perigeeParameters() ){ + } + + else if (m_perigeeExpression == "BeamSpot"){ //Express parameters at beamspot + const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamspot( *track, CacheBeamSpotData(Gaudi::Hive::currentContext()) ); + if (!result){ + + ATH_MSG_WARNING("Failed to extrapolate to first Beamspot"); + if ( !track->perigeeParameters() ){ return nullptr; - } + } aPer = track->perigeeParameters()->clone(); - } else { - aPer = result; - } - } + } else { + aPer = result; + } + } else if (m_perigeeExpression == "Vertex"){ if (vxCandidate != nullptr) { - const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex( *track, vxCandidate->recVertex().position()); + const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex( *track, vxCandidate->recVertex().position()); if (result != nullptr) { aPer = result; } else{ @@ -348,19 +342,19 @@ namespace Trk } } else if (m_perigeeExpression == "BeamLine"){ - const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamline( *track, CacheBeamSpotData(Gaudi::Hive::currentContext()) ); - if (!result){ - - ATH_MSG_WARNING("Failed to extrapolate to Beamline"); - if ( !track->perigeeParameters() ){ + const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamline( *track, CacheBeamSpotData(Gaudi::Hive::currentContext()) ); + if (!result){ + + ATH_MSG_WARNING("Failed to extrapolate to Beamline"); + if ( !track->perigeeParameters() ){ return nullptr; - } - aPer = track->perigeeParameters()->clone(); - } else { + } + aPer = track->perigeeParameters()->clone(); + } else { aPer = result; - } + } } - + std::unique_ptr<const Trk::TrackSummary> summary; if (m_trackSummaryTool.get()!=nullptr) { if (m_forceTrackSummaryUpdate) { @@ -390,12 +384,12 @@ namespace Trk // we do that the same way as in the track slimming tool! // that way it is also ok on not slimmed tracks! std::vector<const Trk::TrackParameters*> parameters; - + if (m_keepParameters) { const DataVector<const TrackStateOnSurface>* trackStates = track->trackStateOnSurfaces(); const Trk::TrackParameters* first = nullptr; - + // search first valid TSOS first for ( const TrackStateOnSurface* tsos : *trackStates ) { @@ -409,7 +403,7 @@ namespace Trk break; } } - + // search last valid TSOS first for ( DataVector<const TrackStateOnSurface>::const_reverse_iterator rItTSoS = trackStates->rbegin(); rItTSoS != trackStates->rend(); ++rItTSoS) { @@ -422,7 +416,7 @@ namespace Trk break; } } - + // security check: if (parameters.size() > 2) ATH_MSG_WARNING ("More than two additional track parameters to be stored in TrackParticle!"); @@ -475,7 +469,7 @@ namespace Trk Rec::TrackParticle* tp = new Rec::TrackParticle(track, prtOrigin, vxCandidate, summary.release(), parameters, aPer, fitQuality); return tp; } - + xAOD::TrackParticle* TrackParticleCreatorTool::createParticle( const Trk::Track& track, xAOD::TrackParticleContainer* container, const xAOD::Vertex* vxCandidate, @@ -489,25 +483,25 @@ namespace Trk // aMeasPer clone will be created later if all perigee option selected if (m_keepAllPerigee) aPer = nullptr; }else{ - const Amg::Vector3D persf(0,0,0); - const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex(track, persf); - if (result != nullptr) { - aPer = result; - parsToBeDeleted = result; + const Amg::Vector3D persf(0,0,0); + const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex(track, persf); + if (result != nullptr) { + aPer = result; + parsToBeDeleted = result; } else{ ATH_MSG_WARNING ("Could not extrapolate to 0,0,0. No TrackParticle created."); return nullptr; } } - }else if (m_perigeeExpression == "BeamSpot"){ //Express parameters at beamspot - const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamspot(track, CacheBeamSpotData(Gaudi::Hive::currentContext())); - if (!result){ - ATH_MSG_WARNING("Failed to extrapolate to first Beamspot - No TrackParticle created."); - return nullptr; - }else{ - parsToBeDeleted = result; - aPer = result; + }else if (m_perigeeExpression == "BeamSpot"){ //Express parameters at beamspot + const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamspot(track, CacheBeamSpotData(Gaudi::Hive::currentContext())); + if (!result){ + ATH_MSG_WARNING("Failed to extrapolate to first Beamspot - No TrackParticle created."); + return nullptr; + }else{ + parsToBeDeleted = result; + aPer = result; } } else if (m_perigeeExpression == "Vertex"){ // the non default way, express the perigee wrt. the vertex position if (vxCandidate != nullptr) { @@ -525,14 +519,14 @@ namespace Trk } } else if (m_perigeeExpression == "BeamLine"){ - const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamline(track, CacheBeamSpotData(Gaudi::Hive::currentContext())); - if (!result){ - ATH_MSG_WARNING("Failed to extrapolate to Beamline - No TrackParticle created."); - return nullptr; + const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamline(track, CacheBeamSpotData(Gaudi::Hive::currentContext())); + if (!result){ + ATH_MSG_WARNING("Failed to extrapolate to Beamline - No TrackParticle created."); + return nullptr; } - else{ - parsToBeDeleted = result; - aPer = result; + else{ + parsToBeDeleted = result; + aPer = result; } } std::unique_ptr<Trk::TrackSummary> cleanup_summary; @@ -591,7 +585,7 @@ namespace Trk if (!clus){ ATH_MSG_DEBUG( "Failed dynamic_cast to InDet::SiClusterOnTrack "); continue; - } + } const Trk::PrepRawData* prdc = nullptr; prdc = clus->prepRawData(); if (!prdc){ @@ -603,7 +597,7 @@ namespace Trk continue; } const Trk::MeasurementBase* mesb=tsos->measurementOnTrack(); - + if (RawDataClus->detectorElement()->isPixel()) { const InDetDD::SiDetectorElement* element = nullptr; @@ -653,7 +647,7 @@ namespace Trk PixTrkAngle = M_PI_2 - PixTrkAngle; if (theta > M_PI_2) theta = M_PI-theta; } - + Identifier surfaceID; surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify(); if (m_detID->is_pixel(surfaceID)) @@ -695,7 +689,7 @@ namespace Trk // search first valid TSOS first for (const TrackStateOnSurface* tsos : *trackStates) { if ( tsos->type(TrackStateOnSurface::Measurement) && - tsos->trackParameters()!=nullptr && + tsos->trackParameters()!=nullptr && tsos->measurementOnTrack()!=nullptr && !dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(tsos->measurementOnTrack())) { first = tsos->trackParameters(); @@ -734,7 +728,7 @@ namespace Trk bool haveFirstMeasurementParameters = false; for (const TrackStateOnSurface* tsos : *(track.trackStateOnSurfaces())) { if (! tsos->trackParameters()) continue; - + if (! haveFirstMeasurementParameters && tsos->type(TrackStateOnSurface::Measurement) && ! tsos->type(TrackStateOnSurface::Outlier) @@ -755,11 +749,11 @@ namespace Trk } else { parameters.push_back(tsos->trackParameters()); } - + ATH_MSG_VERBOSE( " including perigee at R " << tsos->trackParameters()->position().perp() << ", Z " << tsos->trackParameters()->position().z() ); - + // we are not interested in keeping measurement parameters after any second perigee if (!parameters.empty()) haveFirstMeasurementParameters = true; } @@ -790,9 +784,9 @@ namespace Trk delete parsToBeDeleted; return trackparticle; } - + xAOD::TrackParticle* TrackParticleCreatorTool::createParticle( const Rec::TrackParticle& trackParticle, xAOD::TrackParticleContainer* container ) const { - + // Attempt to fill the position enums - will necessarily be a bit of a hack, since we don't have all the information. std::vector< xAOD::ParameterPosition> positions; bool firstMeasurement = false; @@ -812,7 +806,7 @@ namespace Trk xAOD::TrackParticle* trackparticle = createParticle(trackParticle.measuredPerigee(),trackParticle.fitQuality(), &trackParticle.info(),trackParticle.trackSummary(),trackParticle.trackParameters(),positions, static_cast<xAOD::ParticleHypothesis>(trackParticle.info().particleHypothesis()),container); - + if (!trackparticle){ ATH_MSG_WARNING( "WARNING: Problem creating TrackParticle - Returning 0"); return nullptr; @@ -821,31 +815,31 @@ namespace Trk trackparticle->setTrackLink( *(trackParticle.trackElementLink()) ); if ( m_checkConversion ) compare(trackParticle,*trackparticle); - + return trackparticle; } - + xAOD::TrackParticle* TrackParticleCreatorTool::createParticle( const ElementLink<TrackCollection>& trackLink, xAOD::TrackParticleContainer* container, const xAOD::Vertex* vxCandidate, xAOD::ParticleHypothesis prtOrigin, const Trk::PRDtoTrackMap *prd_to_track_map) const { - + xAOD::TrackParticle* trackparticle = createParticle( **trackLink, container, vxCandidate, prtOrigin, prd_to_track_map ); - + if (!trackparticle){ ATH_MSG_WARNING( "WARNING: Problem creating TrackParticle - Returning 0"); return nullptr; } - + trackparticle->setTrackLink( trackLink ); - + return trackparticle; } - - + + xAOD::TrackParticle* TrackParticleCreatorTool::createParticle( const Perigee* perigee, const FitQuality* fq, const TrackInfo* trackInfo, const TrackSummary* summary, - const std::vector<const Trk::TrackParameters*>& parameters, + const std::vector<const Trk::TrackParameters*>& parameters, const std::vector< xAOD::ParameterPosition>& positions, xAOD::ParticleHypothesis prtOrigin, xAOD::TrackParticleContainer* container ) const { @@ -856,7 +850,7 @@ namespace Trk return nullptr; } /* - * The following needs care as in one case the ownership + * The following needs care as in one case the ownership * can be passed to StoreGate i.e to the relevant container * DataVector. * In the other the caller has the ownership @@ -868,7 +862,7 @@ namespace Trk else { trackparticle->makePrivateStore(); } - + // Fit quality if ( fq ) { setFitQuality(*trackparticle,*fq); @@ -899,8 +893,8 @@ namespace Trk return trackparticle; } - - + + //W.L. 2013-10-29: Since no dcast is needed any more the whole function could be removed bool TrackParticleCreatorTool::castPerigeeAndCheck( const Trk::Track* track, @@ -914,7 +908,7 @@ namespace Trk } return true; } - + void TrackParticleCreatorTool::compare( const TrackParameters& tp1, const TrackParameters& tp2 ) const { int index = Amg::compare(tp1.parameters(),tp2.parameters(),1e-6,true); if ( index != -1 ){ @@ -928,17 +922,17 @@ namespace Trk std::pair<int,int> indices = Amg::compare(*tp1.covariance(),*tp2.covariance(),1e-6,true); if ( indices.first != -1 ) ATH_MSG_WARNING("Bad Covariance conversion " << std::endl - << Amg::toString(*tp1.covariance(),10) << std::endl + << Amg::toString(*tp1.covariance(),10) << std::endl << Amg::toString(*tp2.covariance(),10) ); } } - + void TrackParticleCreatorTool::compare( const Rec::TrackParticle& tp, const xAOD::TrackParticle& tpx ) const { if ( tp.measuredPerigee() ) compare(*tp.measuredPerigee(),tpx.perigeeParameters()); - - // do to add other components + + // do to add other components if ( tp.fitQuality() ){ - + } //trackParticle.info(),trackParticle.trackSummary(), if ( tp.trackParameters().size() != tpx.numberOfParameters()){ @@ -946,12 +940,18 @@ namespace Trk } } - + void TrackParticleCreatorTool::setParameters( xAOD::TrackParticle& tp, const std::vector<const Trk::TrackParameters*>& parameters, const std::vector< xAOD::ParameterPosition>& positions ) const { std::vector< std::vector < float > > parametersVec; parametersVec.resize(parameters.size()); unsigned int numParam=0; - for ( auto param : parameters ){ + + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + + for ( auto param : parameters ){ std::vector<float>& values = parametersVec[numParam]; values.resize(6); const Amg::Vector3D & pos = param->position(); @@ -966,18 +966,18 @@ namespace Trk // has covariance matrix //now convert from to Curvilinear -- to be double checked for correctness Amg::Vector3D magnFieldVect; magnFieldVect.setZero(); - m_magFieldSvc->getField( &pos, &magnFieldVect ); + fieldCache.getField(pos.data(), magnFieldVect.data()); - CurvilinearUVT curvilinearUVT(param->momentum().unit()); + CurvilinearUVT curvilinearUVT(param->momentum().unit()); const Amg::Transform3D& localToGlobalTransform = param->associatedSurface().transform(); - + JacobianLocalToCurvilinear jacobian(magnFieldVect, param->parameters()[Trk::qOverP], sin(param->parameters()[Trk::theta]), curvilinearUVT, localToGlobalTransform.rotation().col(0), - localToGlobalTransform.rotation().col(1)); - + localToGlobalTransform.rotation().col(1)); + covarianceMatrix = param->covariance()->similarity(jacobian); } std::vector<float> covMatrixVec; @@ -986,7 +986,7 @@ namespace Trk ++numParam; } - + tp.setTrackParameters(parametersVec); unsigned int i=0; for (;i<positions.size();++i) { @@ -1003,11 +1003,11 @@ namespace Trk void TrackParticleCreatorTool::setTilt( xAOD::TrackParticle& tp, float tiltx, float tilty ) const { tp.setBeamlineTiltX(tiltx); tp.setBeamlineTiltY(tilty); - } + } void TrackParticleCreatorTool::setHitPattern( xAOD::TrackParticle& tp, unsigned long hitpattern ) const { tp.setHitPattern(hitpattern); - } + } void TrackParticleCreatorTool::setNumberOfUsedHits( xAOD::TrackParticle& tp, int hits ) const { tp.setNumberOfUsedHitsdEdx(hits); @@ -1021,14 +1021,14 @@ namespace Trk // int types unsigned int offset = 47;// where the floats start in xAOD::SummaryType - // ensure that xAOD TrackSummary and TrackSummary enums are in sync. + // ensure that xAOD TrackSummary and TrackSummary enums are in sync. constexpr unsigned int xAodReferenceEnum=static_cast<unsigned int>(xAOD::pixeldEdx); constexpr unsigned int TrkReferenceEnum=static_cast<unsigned int>(Trk::pixeldEdx_res); static_assert( xAodReferenceEnum == TrkReferenceEnum, "Trk and xAOD enums differ in their indices" ); - + for (unsigned int i =0 ; i<Trk::numberOfTrackSummaryTypes ; i++){ // Only add values which are +ve (i.e., which were created) - if ( i >= Trk::numberOfMdtHits && i <= Trk::numberOfRpcEtaHits ) continue; + if ( i >= Trk::numberOfMdtHits && i <= Trk::numberOfRpcEtaHits ) continue; if ( i == Trk::numberOfCscUnspoiltEtaHits ) continue; if ( i >= Trk::numberOfCscEtaHoles && i <= Trk::numberOfTgcPhiHoles ) continue; if ( i >= offset && i < offset+Trk::numberOfeProbabilityTypes+1){ diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthToTrack.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthToTrack.h index 32c56c0e0deca664e4d927f130093e3fffebc9a6..ff2438d11c26c3bfb67a77c661bd0f8eba823351 100644 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthToTrack.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthToTrack.h @@ -20,7 +20,7 @@ // FIXME: namespace Trk { TrackParameters; } #include "TrkParameters/TrackParameters.h" -namespace HepMC { class GenParticle; } +#include "AtlasHepMC/GenParticle_fwd.h" #include "xAODTruth/TruthParticle.h" //namespace xAOD { class TruthParticle; } diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthTrajectoryBuilder.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthTrajectoryBuilder.h index 973e022bd5a7e3de71b317c0d66393bb5aa7393b..61e708ffe730eb9a70a435936e12d8ac139059b4 100644 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthTrajectoryBuilder.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthTrajectoryBuilder.h @@ -16,7 +16,7 @@ // Forard declarations class TruthTrajectory; -namespace HepMC { class GenParticle; } +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/CMakeLists.txt b/Tracking/TrkTools/TrkTruthCreatorTools/CMakeLists.txt index d40b54945211bd7e980f841148881436ceb92f25..398833ee9b02e9482809c32e5f9cb06286aa4064 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/CMakeLists.txt +++ b/Tracking/TrkTools/TrkTruthCreatorTools/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkTools/TrkToolInterfaces PRIVATE Generators/GeneratorObjects + Generators/AtlasHepMC Tracking/TrkEvent/TrkCompetingRIOsOnTrack Tracking/TrkEvent/TrkMeasurementBase Tracking/TrkEvent/TrkPrepRawData @@ -24,14 +25,13 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkTrack ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_component( TrkTruthCreatorTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthenaBaseComps AthLinks AthContainers AtlasDetDescr GaudiKernel TrkEventUtils TrkTruthData TrkToolInterfaces GeneratorObjects TrkCompetingRIOsOnTrack TrkMeasurementBase TrkPrepRawData TrkRIO_OnTrack TrkTrack ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps AthLinks AthContainers AtlasDetDescr GaudiKernel TrkEventUtils TrkTruthData TrkToolInterfaces GeneratorObjects TrkCompetingRIOsOnTrack TrkMeasurementBase TrkPrepRawData TrkRIO_OnTrack TrkTrack ) # Install files from the package: atlas_install_headers( TrkTruthCreatorTools ) diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DecayInFlyTruthTrajectoryBuilder.h b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DecayInFlyTruthTrajectoryBuilder.h index f62fba752140e278b02676d36a4880e36da8e658..9084aebc13f2bfe429ee4fff0338839591d559f2 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DecayInFlyTruthTrajectoryBuilder.h +++ b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DecayInFlyTruthTrajectoryBuilder.h @@ -10,7 +10,7 @@ #include "TrkToolInterfaces/ITruthTrajectoryBuilder.h" #include "AthenaBaseComps/AthAlgTool.h" -namespace HepMC { class GenVertex; } +#include "AtlasHepMC/GenVertex_fwd.h" namespace Trk { diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/ElasticTruthTrajectoryBuilder.h b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/ElasticTruthTrajectoryBuilder.h index c2502ff1fbaddfe54798c5df453b89b39dda79a2..2a4fe184040fe0368b87dec06d41fa4ba1961473 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/ElasticTruthTrajectoryBuilder.h +++ b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/ElasticTruthTrajectoryBuilder.h @@ -10,7 +10,7 @@ #include "TrkToolInterfaces/ITruthTrajectoryBuilder.h" #include "AthenaBaseComps/AthAlgTool.h" -namespace HepMC { class GenVertex; } +#include "AtlasHepMC/GenVertex_fwd.h" namespace Trk { diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx index bf98d4704c9e45c5422b1905a9c790449f270703..1a77376c8404b5a6a9374dd531727b01907f0ac5 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx @@ -8,8 +8,8 @@ #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "AthContainers/DataVector.h" diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx index 2a9e17a34dd68ecb46a2af5430cfc862a9a2a848..48d6ca1b9efbbf27dd4fc02359bc34e7b72ce059 100755 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx @@ -7,8 +7,8 @@ #include "TrkTruthData/DetailedTrackTruth.h" #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "GeneratorObjects/McEventCollection.h" diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/ElasticTruthTrajectoryBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/ElasticTruthTrajectoryBuilder.cxx index ff1b382a17c046027e543827cc21dd342253c4bf..be2b26513633c4e512218be24255bec0cea5eedc 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/ElasticTruthTrajectoryBuilder.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/ElasticTruthTrajectoryBuilder.cxx @@ -8,8 +8,8 @@ #include "TrkTruthData/TruthTrajectory.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "AthContainers/DataVector.h" diff --git a/Tracking/TrkTools/TrkTruthToTrack/CMakeLists.txt b/Tracking/TrkTools/TrkTruthToTrack/CMakeLists.txt index cd8805c4558ee8b5d5b77ce194d0abb477736b84..72ff7263518bbb6fc594262548e0aae992d339f5 100644 --- a/Tracking/TrkTools/TrkTruthToTrack/CMakeLists.txt +++ b/Tracking/TrkTools/TrkTruthToTrack/CMakeLists.txt @@ -14,18 +14,18 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE Event/xAOD/xAODTruth Simulation/G4Sim/TrackRecord - Tracking/TrkExtrapolation/TrkExInterfaces ) + Tracking/TrkExtrapolation/TrkExInterfaces + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( TrkTruthToTrack src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel TrkParameters TrkToolInterfaces xAODTruth TrkExInterfaces ) + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel TrkParameters TrkToolInterfaces xAODTruth TrkExInterfaces ) # Install files from the package: atlas_install_headers( TrkTruthToTrack ) diff --git a/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthTrackRecordToTrack.h b/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthTrackRecordToTrack.h index d5ee8457ed042d307409c3f8a4661711c6268871..877e50de410a2d8b35afc6c7fcbe8aa39d318211 100755 --- a/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthTrackRecordToTrack.h +++ b/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthTrackRecordToTrack.h @@ -15,7 +15,7 @@ #include "TrackRecord/TrackRecordCollection.h" namespace HepPDT { class ParticleDataTable; } -namespace HepMC { class GenParticle; } +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { diff --git a/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx b/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx index 7f9dd987d190104d4a8c2f1841bced0082f7e0a5..17b82caa12b4c899dea97fc02d0c4dde0be479ce 100755 --- a/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx +++ b/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx @@ -10,8 +10,8 @@ #include "GaudiKernel/IPartPropSvc.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "xAODTruth/TruthParticle.h" #include "xAODTruth/TruthVertex.h" diff --git a/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx b/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx index 2ac0eb397dbccaf7439124f1d2552c431adad5e7..d70cbcfb6aad8e24c4807c07d963bbf0df679164 100755 --- a/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx +++ b/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx @@ -9,8 +9,8 @@ #include "GaudiKernel/IPartPropSvc.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "xAODTruth/TruthParticle.h" #include "xAODTruth/TruthVertex.h" diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/CMakeLists.txt b/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/CMakeLists.txt index 533edd39a9aced56c14fe2f78ae7f1b34d793ec9..9288b5a2c159579921291ec5cddedca86c35bfbb 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/CMakeLists.txt +++ b/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/CMakeLists.txt @@ -11,15 +11,15 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkEvent/TrkSegment Tracking/TrkEvent/TrkTrack Tracking/TrkTools/TrkToolInterfaces - Tracking/TrkTruthTracks/TrkTruthTrackInterfaces ) + Tracking/TrkTruthTracks/TrkTruthTrackInterfaces + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_component( TrkTruthTrackAlgs src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel TrkSegment TrkTrack TrkToolInterfaces ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps GaudiKernel TrkSegment TrkTrack TrkToolInterfaces ) diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx b/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx index 90a37543b83604862d1cb5fe4078a3e474493fa0..c5f3468e91aee1e8db42d62704d45b9d17d74f92 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx +++ b/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx @@ -14,8 +14,8 @@ #include "TrkTruthTrackInterfaces/PRD_TruthTrajectory.h" #include "TrkToolInterfaces/ITrackSelectorTool.h" // HepMC -#include "HepMC/GenParticle.h" -#include "HepMC/SimpleVector.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/SimpleVector.h" //================ Constructor ================================================= diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h index e936239d168ecc74701d0435408d616dd8e63fac..309d14623515dc70d45915a2e352ff3a53dfc5f3 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h +++ b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h @@ -13,9 +13,7 @@ #include "GaudiKernel/IAlgTool.h" #include "TrkTruthTrackInterfaces/PRD_TruthTrajectory.h" -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryManipulator.h b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryManipulator.h index 33a33f45775df9b195d88d74f4abeb68c988831c..baf67645e0bad1b2e134baa0d2067b0deffa61db 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryManipulator.h +++ b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryManipulator.h @@ -14,9 +14,7 @@ #include "TrkTruthTrackInterfaces/PRD_TruthTrajectory.h" -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/PRD_TruthTrajectory.h b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/PRD_TruthTrajectory.h index bfcb7d92e2c3c6d1c77e9d8f6a9c76bf02938626..21ff251f2e43dd3129747a08aa3ed830668a7b0f 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/PRD_TruthTrajectory.h +++ b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/PRD_TruthTrajectory.h @@ -10,9 +10,7 @@ #define TRK_TRKTRUTHTRACKS_PRD_TRUTHTRAJECTORY_H 1 -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackTools/CMakeLists.txt b/Tracking/TrkTruthTracks/TrkTruthTrackTools/CMakeLists.txt index 222a52ce393c5d92dd044e802eee366d2a8192f3..cca05367824c1dd999a6ec5c96dd1229d93d1065 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackTools/CMakeLists.txt +++ b/Tracking/TrkTruthTracks/TrkTruthTrackTools/CMakeLists.txt @@ -20,16 +20,16 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkExtrapolation/TrkExInterfaces Tracking/TrkFitter/TrkFitterInterfaces Tracking/TrkTools/TrkToolInterfaces - Tracking/TrkTruthTracks/TrkTruthTrackInterfaces ) + Tracking/TrkTruthTracks/TrkTruthTrackInterfaces + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) find_package( HepPDT ) # Component(s) in the package: atlas_add_component( TrkTruthTrackTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AtlasDetDescr GaudiKernel TrkSurfaces TrkEventUtils TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces ) + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps AtlasDetDescr GaudiKernel TrkSurfaces TrkEventUtils TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces ) diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.cxx b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.cxx index 3a33007b05295596ed1cd0bdef0f55f8d6092b83..7b60f9c4c5d8753febe9c5c73af442944d4b9255 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.cxx +++ b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.cxx @@ -16,8 +16,8 @@ // DetectorDescription #include "AtlasDetDescr/AtlasDetectorID.h" // HepMC -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" /** Constructor **/ diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.h b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.h index f5e5e2bbb001b5df3248f16a0974fcbc36aabfd5..3199d6c9ed38d7c6ef22da7037ba8be0badc7f4f 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.h +++ b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.h @@ -21,9 +21,7 @@ class AtlasDetectorID; -namespace HepMC { - class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/TruthTrackBuilder.cxx b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/TruthTrackBuilder.cxx index 252418b051dc5f0d70683c37fa0d934369d72562..d3635339af1c596aaa9e2a97dd37d102f29fee72 100644 --- a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/TruthTrackBuilder.cxx +++ b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/TruthTrackBuilder.cxx @@ -25,8 +25,8 @@ #include "GaudiKernel/IPartPropSvc.h" #include "GaudiKernel/SystemOfUnits.h" // HepMC -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "HepPDT/ParticleDataTable.hh" #include "AtlasDetDescr/AtlasDetectorID.h" diff --git a/Tracking/TrkValidation/TrkValAlgs/CMakeLists.txt b/Tracking/TrkValidation/TrkValAlgs/CMakeLists.txt index db278a03a8b0b0d04676d1ec9137815006757db8..eb46684f5997a7bf3a5829bf908fd3b3f23efa7f 100644 --- a/Tracking/TrkValidation/TrkValAlgs/CMakeLists.txt +++ b/Tracking/TrkValidation/TrkValAlgs/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PRIVATE DetectorDescription/AtlasDetDescr Generators/GeneratorObjects + Generators/AtlasHepMC Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkEventUtils Tracking/TrkEvent/TrkMaterialOnTrack @@ -32,14 +33,13 @@ atlas_depends_on_subdirs( Tracking/TrkValidation/TrkValInterfaces ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree ) # Component(s) in the package: atlas_add_component( TrkValAlgs TrkValAlgs/*.h src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel TrkParameters TrkTrack TrkTruthData AtlasDetDescr GeneratorObjects TrkSurfaces TrkEventUtils TrkMaterialOnTrack TrkParticleBase TrkPrepRawData TrkRIO_OnTrack TrkSegment TrkSpacePoint diff --git a/Tracking/TrkValidation/TrkValAlgs/TrkValAlgs/TrackValidationNtupleWriter.h b/Tracking/TrkValidation/TrkValAlgs/TrkValAlgs/TrackValidationNtupleWriter.h index 100957fe34815222c9d0dc6996660e904985f2a7..b5fe26995e4d217a39997ba7531c8584abfe75c0 100644 --- a/Tracking/TrkValidation/TrkValAlgs/TrkValAlgs/TrackValidationNtupleWriter.h +++ b/Tracking/TrkValidation/TrkValAlgs/TrkValAlgs/TrackValidationNtupleWriter.h @@ -20,11 +20,7 @@ class TrackTruth; class TTree; -namespace HepMC { - -class GenParticle; //!< Truth information - -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { diff --git a/Tracking/TrkValidation/TrkValAlgs/src/RecMomentumQualityValidation.cxx b/Tracking/TrkValidation/TrkValAlgs/src/RecMomentumQualityValidation.cxx index e7712195a107419f471fb63771b5225b4a36b5f9..6b6d9248f5e57bb4e1b122ba8f078fe6b1438938 100644 --- a/Tracking/TrkValidation/TrkValAlgs/src/RecMomentumQualityValidation.cxx +++ b/Tracking/TrkValidation/TrkValAlgs/src/RecMomentumQualityValidation.cxx @@ -11,7 +11,7 @@ #include "TrkTruthData/TrackTruthCollection.h" #include "TrkParameters/TrackParameters.h" //#include "TrkParameters/Perigee.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkToolInterfaces/ITruthToTrack.h" #include "TrkToolInterfaces/ITrackSelectorTool.h" #include "AtlasDetDescr/AtlasDetectorID.h" diff --git a/Tracking/TrkValidation/TrkValAlgs/src/TrackValidationNtupleWriter.cxx b/Tracking/TrkValidation/TrkValAlgs/src/TrackValidationNtupleWriter.cxx index 23a4057f8a52e1548af9169a2cad11c720f0a2cd..8b5204b6b857e3f8ab20ea7643e220b27a29d87c 100644 --- a/Tracking/TrkValidation/TrkValAlgs/src/TrackValidationNtupleWriter.cxx +++ b/Tracking/TrkValidation/TrkValAlgs/src/TrackValidationNtupleWriter.cxx @@ -15,7 +15,7 @@ // Trk #include "TrkTrack/Track.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrkValEvent/GenParticleJet.h" #include "TrkToolInterfaces/ITruthToTrack.h" diff --git a/Tracking/TrkValidation/TrkValEvent/CMakeLists.txt b/Tracking/TrkValidation/TrkValEvent/CMakeLists.txt index ed7d3800a63a0d9d04dd81f9439e776e815a74b9..4ba1fed21b327e1e42c4a82700c540016849cb95 100644 --- a/Tracking/TrkValidation/TrkValEvent/CMakeLists.txt +++ b/Tracking/TrkValidation/TrkValEvent/CMakeLists.txt @@ -9,17 +9,17 @@ atlas_subdir( TrkValEvent ) atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParameters - Tracking/TrkEvent/TrkTrack ) + Tracking/TrkEvent/TrkTrack + Generators/AtlasHepMC ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) # Component(s) in the package: atlas_add_library( TrkValEvent src/*.cxx PUBLIC_HEADERS TrkValEvent - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} TrkEventPrimitives TrkParameters TrkTrack ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib TrkEventPrimitives TrkParameters TrkTrack ) diff --git a/Tracking/TrkValidation/TrkValEvent/TrkValEvent/GenParticleJet.h b/Tracking/TrkValidation/TrkValEvent/TrkValEvent/GenParticleJet.h index 17bd5c9ca8678c3259604fe6f79995131c47160b..99750d412c14fa9c5d0e9dc432e7f3452bf95c94 100644 --- a/Tracking/TrkValidation/TrkValEvent/TrkValEvent/GenParticleJet.h +++ b/Tracking/TrkValidation/TrkValEvent/TrkValEvent/GenParticleJet.h @@ -15,7 +15,7 @@ #include <vector> #include <utility> #include "CLHEP/Geometry/Vector3D.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" namespace Trk { diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleJetFinder.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleJetFinder.h index c898bb49321e3b895dbb31e1566164c276587871..fde30d484a15d4eae8a98ffd6076812fb75f75a6 100644 --- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleJetFinder.h +++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleJetFinder.h @@ -17,9 +17,7 @@ //#include "TrkValEvent/GenParticleJet.h" #include "GaudiKernel/IAlgTool.h" -namespace HepMC { -class GenParticle; //!< Truth information -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { class GenParticleJet; diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleSelector.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleSelector.h index 9b85b642f2b66526bc7fef359704e01efe4417de..0e58912b073fef1eaf5768fab0b5e74f0144cf9e 100644 --- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleSelector.h +++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleSelector.h @@ -18,9 +18,7 @@ #include "GaudiKernel/IAlgTool.h" class McEventCollection; -namespace HepMC { -class GenParticle; //!< Truth information -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { static const InterfaceID IID_IGenParticleSelector("IGenParticleSelector",1,0); diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IJetTruthNtupleTool.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IJetTruthNtupleTool.h index 081283b832ecce9a5e4f7edf52de5a983301b43c..5eb45a683943a079080f36d44c266bdc1b1a6b32 100644 --- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IJetTruthNtupleTool.h +++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IJetTruthNtupleTool.h @@ -19,11 +19,7 @@ #include <vector> -namespace HepMC { - -class GenParticle; //!< Truth information - -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { class GenParticleJet; diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrackTruthClassifier.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrackTruthClassifier.h index e75c7d4a92b2bfc237d0b774ac0ad1defd466125..56af45805d4908631248bcf821940a35cc15f72e 100644 --- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrackTruthClassifier.h +++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrackTruthClassifier.h @@ -17,9 +17,7 @@ #include "GaudiKernel/IAlgTool.h" class McEventCollection; -namespace HepMC { -class GenParticle; //!< Truth information -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { static const InterfaceID IID_ITrackTruthClassifier("ITrackTruthClassifier",1,0); diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITruthNtupleTool.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITruthNtupleTool.h index bc80fe72d29c415bc1b1c8d74b2a807d235d5876..d5581fc266a0620b5e9065cafae913c45d5d47c5 100644 --- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITruthNtupleTool.h +++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITruthNtupleTool.h @@ -20,11 +20,7 @@ #include "TrkParameters/TrackParameters.h" //#include "TrkValInterfaces/ITrackTruthClassifier.h" -namespace HepMC { - -class GenParticle; //!< Truth information - -} +#include "AtlasHepMC/GenParticle_fwd.h" namespace Trk { class ITrackTruthClassifier; diff --git a/Tracking/TrkValidation/TrkValTools/CMakeLists.txt b/Tracking/TrkValidation/TrkValTools/CMakeLists.txt index 4cdd172d850c0a5dd34e9f93b16ba9e16f18fe63..21a199390fbd18a11d7aec92497512889c649bb9 100644 --- a/Tracking/TrkValidation/TrkValTools/CMakeLists.txt +++ b/Tracking/TrkValidation/TrkValTools/CMakeLists.txt @@ -37,6 +37,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventInfo Event/EventPrimitives Generators/GeneratorObjects + Generators/AtlasHepMC Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkCompetingRIOsOnTrack Tracking/TrkEvent/TrkEventUtils @@ -52,7 +53,6 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( HepPDT ) find_package( ROOT COMPONENTS Core EG Tree MathCore Hist RIO pthread Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) find_package( Eigen ) @@ -63,8 +63,8 @@ find_package( Boost ) atlas_add_component( TrkValTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthContainers AthenaKernel xAODTracking GaudiKernel TrkEventPrimitives TrkParameters TrkTrack TrkToolInterfaces TrkValEvent TrkValInterfaces CommissionEvent AtlasDetDescr EventInfo EventPrimitives GeneratorObjects TrkSurfaces TrkCompetingRIOsOnTrack TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkParticleBase TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkExInterfaces TrkFitterUtils xAODTruth xAODJet xAODPFlow xAODCaloEvent xAODCore xAODEventInfo AsgTools AthenaKernel AthenaMonitoringLib) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthContainers AthenaKernel xAODTracking GaudiKernel TrkEventPrimitives TrkParameters TrkTrack TrkToolInterfaces TrkValEvent TrkValInterfaces CommissionEvent AtlasDetDescr EventInfo EventPrimitives GeneratorObjects TrkSurfaces TrkCompetingRIOsOnTrack TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkParticleBase TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkExInterfaces TrkFitterUtils xAODTruth xAODJet xAODPFlow xAODCaloEvent xAODCore xAODEventInfo AsgTools AthenaKernel AthenaMonitoringLib) # Install files from the package: atlas_install_headers( TrkValTools ) diff --git a/Tracking/TrkValidation/TrkValTools/TrkValTools/PrimaryTruthClassifier.h b/Tracking/TrkValidation/TrkValTools/TrkValTools/PrimaryTruthClassifier.h index 607db76418a391a315a0d183a002afb5d552402e..496e2a09b8d731a26b207b1bac57f719ce27d894 100644 --- a/Tracking/TrkValidation/TrkValTools/TrkValTools/PrimaryTruthClassifier.h +++ b/Tracking/TrkValidation/TrkValTools/TrkValTools/PrimaryTruthClassifier.h @@ -17,7 +17,7 @@ #include "TrkValInterfaces/ITrackTruthClassifier.h" #include "TrkValEvent/TruthClassificationDefs.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" namespace Trk { diff --git a/Tracking/TrkValidation/TrkValTools/src/InDetHaloSelector.cxx b/Tracking/TrkValidation/TrkValTools/src/InDetHaloSelector.cxx index e6b834fa0867d8df57f2e96ab12d8aee5a56d209..ff4fa1575205d75a56876d6b943f31a8fd062e30 100644 --- a/Tracking/TrkValidation/TrkValTools/src/InDetHaloSelector.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/InDetHaloSelector.cxx @@ -10,11 +10,11 @@ /////////////////////////////////////////////////////////////////// #include "TrkValTools/InDetHaloSelector.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Geometry/Point3D.h" #include "HepPDT/ParticleData.hh" #include "GaudiKernel/IPartPropSvc.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" Trk::InDetHaloSelector::InDetHaloSelector(const std::string& type, const std::string& name, diff --git a/Tracking/TrkValidation/TrkValTools/src/InDetPrimaryConversionSelector.cxx b/Tracking/TrkValidation/TrkValTools/src/InDetPrimaryConversionSelector.cxx index d7260d0d05e8f4a711774f2d4394ee6212d2e615..26e8b3a1552558fc7751a711ca8e6d207bc82371 100644 --- a/Tracking/TrkValidation/TrkValTools/src/InDetPrimaryConversionSelector.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/InDetPrimaryConversionSelector.cxx @@ -10,12 +10,12 @@ /////////////////////////////////////////////////////////////////// #include "TrkValTools/InDetPrimaryConversionSelector.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Geometry/Point3D.h" #include "CLHEP/Units/SystemOfUnits.h" #include "HepPDT/ParticleData.hh" #include "GaudiKernel/IPartPropSvc.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" Trk::InDetPrimaryConversionSelector::InDetPrimaryConversionSelector(const std::string& type, const std::string& name, diff --git a/Tracking/TrkValidation/TrkValTools/src/InDetReconstructableSelector.cxx b/Tracking/TrkValidation/TrkValTools/src/InDetReconstructableSelector.cxx index e67b8c1e00a1af2dc6f1fc4b322c334b6dd4cfee..5b7e11ba89d59693c2990b51d3a6522124c092b5 100644 --- a/Tracking/TrkValidation/TrkValTools/src/InDetReconstructableSelector.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/InDetReconstructableSelector.cxx @@ -10,12 +10,12 @@ /////////////////////////////////////////////////////////////////// #include "TrkValTools/InDetReconstructableSelector.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Geometry/Point3D.h" #include "CLHEP/Units/SystemOfUnits.h" #include "HepPDT/ParticleData.hh" #include "GaudiKernel/IPartPropSvc.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" Trk::InDetReconstructableSelector::InDetReconstructableSelector(const std::string& type, const std::string& name, diff --git a/Tracking/TrkValidation/TrkValTools/src/JetTruthNtupleTool.cxx b/Tracking/TrkValidation/TrkValTools/src/JetTruthNtupleTool.cxx index 51a1d14ff97fff63c89d1b7628f45afbeddd35f3..ea9d3bf46b14cac41e3d05006cff22f29bf84ee4 100644 --- a/Tracking/TrkValidation/TrkValTools/src/JetTruthNtupleTool.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/JetTruthNtupleTool.cxx @@ -19,7 +19,7 @@ // Truth #include "TrkTruthData/TrackTruth.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <TGraphAsymmErrors.h> #include "TTree.h" diff --git a/Tracking/TrkValidation/TrkValTools/src/PerigeeParametersNtupleTool.cxx b/Tracking/TrkValidation/TrkValTools/src/PerigeeParametersNtupleTool.cxx index 67dbd3c4ddb08cbf0dfb37012f0dc9ef69f0cde0..e72d15373b0992796548568dedb1bba085156e74 100644 --- a/Tracking/TrkValidation/TrkValTools/src/PerigeeParametersNtupleTool.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/PerigeeParametersNtupleTool.cxx @@ -22,7 +22,7 @@ #include "TrkParameters/TrackParameters.h" //Truth #include "TrkTruthData/TrackTruth.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // constructor Trk::PerigeeParametersNtupleTool::PerigeeParametersNtupleTool( diff --git a/Tracking/TrkValidation/TrkValTools/src/PrimaryTruthClassifier.cxx b/Tracking/TrkValidation/TrkValTools/src/PrimaryTruthClassifier.cxx index f8111fd208df603e4550f93eb87516ff81645bb7..bd344c64e57067554318fcfd02eb0fcffc5a2dae 100644 --- a/Tracking/TrkValidation/TrkValTools/src/PrimaryTruthClassifier.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/PrimaryTruthClassifier.cxx @@ -12,7 +12,7 @@ #include "TrkValTools/PrimaryTruthClassifier.h" #include "TrkValEvent/TruthClassificationDefs.h" #include "CLHEP/Units/SystemOfUnits.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" Trk::PrimaryTruthClassifier::PrimaryTruthClassifier(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool (type,name,parent), diff --git a/Tracking/TrkValidation/TrkValTools/src/TrackSummaryNtupleTool.cxx b/Tracking/TrkValidation/TrkValTools/src/TrackSummaryNtupleTool.cxx index bfccca1618c1ee9237c1579bd7d591000aceceac..ba358588b00b1740080f4be400d9555d68f4116c 100644 --- a/Tracking/TrkValidation/TrkValTools/src/TrackSummaryNtupleTool.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/TrackSummaryNtupleTool.cxx @@ -20,7 +20,7 @@ #include "TrkFitterUtils/ProtoTrackStateOnSurface.h" //Truth #include "TrkTruthData/TrackTruth.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" // constructor diff --git a/Tracking/TrkValidation/TrkValTools/src/TruthNtupleTool.cxx b/Tracking/TrkValidation/TrkValTools/src/TruthNtupleTool.cxx index 37a3d874199e470449cd24746b9036a8f7f78e1e..c3aab911ed92b0298eee851947a6e1fa76738803 100644 --- a/Tracking/TrkValidation/TrkValTools/src/TruthNtupleTool.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/TruthNtupleTool.cxx @@ -21,8 +21,8 @@ // Truth #include "TrkTruthData/TrackTruth.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" // root #include "TTree.h" diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationInterfaces/CMakeLists.txt b/Tracking/TrkValidation/TrkVertexFitterValidationInterfaces/CMakeLists.txt index 52b034132fc66fcb103d8cf13ba85d5ad58f4335..67e17f5aed968aaed30eda2b6427515287fd30e6 100644 --- a/Tracking/TrkValidation/TrkVertexFitterValidationInterfaces/CMakeLists.txt +++ b/Tracking/TrkValidation/TrkVertexFitterValidationInterfaces/CMakeLists.txt @@ -10,10 +10,10 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTruthData - Tracking/TrkEvent/VxVertex ) + Tracking/TrkEvent/VxVertex + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) # Install files from the package: atlas_install_headers( TrkVertexFitterValidationInterfaces ) diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationInterfaces/TrkVertexFitterValidationInterfaces/IMcEventNtupleTool.h b/Tracking/TrkValidation/TrkVertexFitterValidationInterfaces/TrkVertexFitterValidationInterfaces/IMcEventNtupleTool.h index d969a85c50797892758a2fe33b4e66e16cea0993..ab6d4fc0c677f7f566687fbdf225296ca9c4aee8 100755 --- a/Tracking/TrkValidation/TrkVertexFitterValidationInterfaces/TrkVertexFitterValidationInterfaces/IMcEventNtupleTool.h +++ b/Tracking/TrkValidation/TrkVertexFitterValidationInterfaces/TrkVertexFitterValidationInterfaces/IMcEventNtupleTool.h @@ -15,7 +15,7 @@ #define TRK_IMCEVENTNTUPLETOOL_H #include "GaudiKernel/IAlgTool.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" namespace Trk { static const InterfaceID IID_IMcEventNtupleTool("IMcEventNtupleTool",1,0); diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationTools/CMakeLists.txt b/Tracking/TrkValidation/TrkVertexFitterValidationTools/CMakeLists.txt index 9f3deea5ebb6a4a6a2ed132eaa80117e0f2a0b1f..5765b158d28b4601d940684dabc73242ef506729 100644 --- a/Tracking/TrkValidation/TrkVertexFitterValidationTools/CMakeLists.txt +++ b/Tracking/TrkValidation/TrkVertexFitterValidationTools/CMakeLists.txt @@ -14,21 +14,21 @@ atlas_depends_on_subdirs( PUBLIC Event/EventPrimitives Event/xAOD/xAODEventInfo Generators/GeneratorObjects + Generators/AtlasHepMC Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTruthData Tracking/TrkEvent/VxVertex ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( TrkVertexFitterValidationTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel EventPrimitives xAODEventInfo GeneratorObjects TrkTrack TrkTruthData VxVertex ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel EventPrimitives xAODEventInfo GeneratorObjects TrkTrack TrkTruthData VxVertex ) # Install files from the package: atlas_install_headers( TrkVertexFitterValidationTools ) diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/BasicVtxValidationNtupleTool.cxx b/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/BasicVtxValidationNtupleTool.cxx index 9ce132cf85ae87962240fac1543df7d208b83121..00a281e5cf8604759891c563432ee30a2b466e5d 100755 --- a/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/BasicVtxValidationNtupleTool.cxx +++ b/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/BasicVtxValidationNtupleTool.cxx @@ -31,8 +31,8 @@ //CLHEP #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" // constructor Trk::BasicVtxValidationNtupleTool::BasicVtxValidationNtupleTool( diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/McEventNtupleTool.cxx b/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/McEventNtupleTool.cxx index 49e42059a13a4c9e4ee4f8df41e8892698948786..50bcee860a7c3aa13f6665fd6cf81650a1b05c52 100755 --- a/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/McEventNtupleTool.cxx +++ b/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/McEventNtupleTool.cxx @@ -20,9 +20,9 @@ //CLHEP #include "CLHEP/Vector/LorentzVector.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" // constructor Trk::McEventNtupleTool::McEventNtupleTool( diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/TrueTracksNtupleTool.cxx b/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/TrueTracksNtupleTool.cxx index f0148a783b5f6035f14e2626f6ba481755e14888..d42f765b5ed9433de3e5ab1262c55d5f60199d18 100755 --- a/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/TrueTracksNtupleTool.cxx +++ b/Tracking/TrkValidation/TrkVertexFitterValidationTools/src/TrueTracksNtupleTool.cxx @@ -22,9 +22,9 @@ #include "TrkTruthData/TrackTruthCollection.h" //CLHEP #include "GeneratorObjects/HepMcParticleLink.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" // constructor Trk::TrueTracksNtupleTool::TrueTracksNtupleTool( diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationUtils/CMakeLists.txt b/Tracking/TrkValidation/TrkVertexFitterValidationUtils/CMakeLists.txt index 7be4492800e610e13c7a9a02b91df7f81aa87fd8..2cb335b447fa889cd4dd99096e17bf4a0d4008dc 100644 --- a/Tracking/TrkValidation/TrkVertexFitterValidationUtils/CMakeLists.txt +++ b/Tracking/TrkValidation/TrkVertexFitterValidationUtils/CMakeLists.txt @@ -11,23 +11,23 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel PRIVATE Generators/GeneratorObjects + Generators/AtlasHepMC Reconstruction/ParticleTruth Tracking/TrkEvent/TrkParticleBase Tracking/TrkEvent/VxVertex ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_library( TrkVertexFitterValidationUtilsLib src/*.cxx PUBLIC_HEADERS TrkVertexFitterValidationUtils - PRIVATE_INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS LINK_LIBRARIES AthenaBaseComps GaudiKernel - PRIVATE_LINK_LIBRARIES ${HEPMC_LIBRARIES} GeneratorObjects ParticleTruth TrkParticleBase VxVertex ) + PRIVATE_LINK_LIBRARIES AtlasHepMCLib GeneratorObjects ParticleTruth TrkParticleBase VxVertex ) atlas_add_component( TrkVertexFitterValidationUtils src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel GeneratorObjects ParticleTruth TrkParticleBase VxVertex TrkVertexFitterValidationUtilsLib ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps GaudiKernel GeneratorObjects ParticleTruth TrkParticleBase VxVertex TrkVertexFitterValidationUtilsLib ) diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationUtils/src/TrkPriVxPurityTool.cxx b/Tracking/TrkValidation/TrkVertexFitterValidationUtils/src/TrkPriVxPurityTool.cxx index ecca441d2b56c3d45478cb40a19c863622115db3..11f434ebc3e123ef710ac0f34bf4229e3809c2f7 100755 --- a/Tracking/TrkValidation/TrkVertexFitterValidationUtils/src/TrkPriVxPurityTool.cxx +++ b/Tracking/TrkValidation/TrkVertexFitterValidationUtils/src/TrkPriVxPurityTool.cxx @@ -11,9 +11,9 @@ // normal includes #include "GeneratorObjects/HepMcParticleLink.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" #include "VxVertex/VxTrackAtVertex.h" #include "TrkParticleBase/LinkToTrackParticleBase.h" diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/CMakeLists.txt index fb0800cb54e19fa9859ac76acc654580715d6bca..ee0c6669817642ef795d4f64f707c6df3248fa55 100644 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/CMakeLists.txt @@ -13,8 +13,9 @@ atlas_add_library( TrkVKalVrtFitterLib PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES AthenaBaseComps GeoPrimitives EventPrimitives xAODTracking - GaudiKernel MagFieldInterfaces TrkNeutralParameters TrkParameters - TrkParticleBase TrkTrack VxSecVertex VxVertex TrkExInterfaces TrkVKalVrtCore + GaudiKernel MagFieldInterfaces MagFieldElements MagFieldConditions + TrkNeutralParameters TrkParameters + TrkParticleBase VxSecVertex VxVertex TrkExInterfaces TrkVKalVrtCore TrkVertexFitterInterfaces PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} TrkSurfaces TestTools ) diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h index 8e9b7c27c51ea0253fddc05019ba9df369fd3bf9..c02c0262ccd46943987f41fd72763226f8f38b63 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h @@ -7,11 +7,10 @@ #ifndef TRKVKALVRTFITTER_VKALVRTFITTER_H #define TRKVKALVRTFITTER_VKALVRTFITTER_H // Normal STL and physical vectors -//#include <vector> // Gaudi includes -//#include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/EventContext.h" // // Interfaces #include "TrkVertexFitterInterfaces/IVertexFitter.h" @@ -28,6 +27,8 @@ #include "TrkNeutralParameters/NeutralParameters.h" //#include "VxVertex/ExtendedVxCandidate.h" #include "MagFieldInterfaces/IMagFieldSvc.h" +// MagField cache +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" // #include <thread> #include <mutex> @@ -293,11 +294,13 @@ namespace Trk{ std::vector<double> m_c_MassInputParticles; ToolHandle < IExtrapolator > m_extPropagator; //External propagator - ////ServiceHandle < IMagFieldAthenaSvc > m_magFieldAthenaSvc; //Athena magnetic field----old version - ServiceHandle<MagField::IMagFieldSvc> m_magFieldAthenaSvc; //Athena magnetic field + ////ServiceHandle<MagField::IMagFieldSvc> m_magFieldAthenaSvc; //Athena magnetic field + //Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field key"}; SimpleProperty<bool> m_firstMeasuredPoint; SimpleProperty<bool> m_firstMeasuredPointLimit; SimpleProperty<bool> m_makeExtendedVertex; + SimpleProperty<bool> m_useFixedField; bool m_isAtlasField; @@ -356,6 +359,7 @@ namespace Trk{ VKalAtlasMagFld m_fitField; VKalVrtControl m_vkalFitControl; + MagField::AtlasFieldCache m_fieldCache; const TrackParameters * m_globalFirstHit = nullptr; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/VKalVrtAtlas.h b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/VKalVrtAtlas.h index 3273ca7ac40d442b6aec80d8b7a85ce2af335ff1..e278170b8964f2ddac79ae6d8847769240f0a1a4 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/VKalVrtAtlas.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/VKalVrtAtlas.h @@ -10,6 +10,7 @@ // Mag field service #include "MagFieldInterfaces/IMagFieldSvc.h" #include "TrkVKalVrtCore/VKalVrtBMag.h" +#include "MagFieldElements/AtlasFieldCache.h" // External propagator #include "TrkVKalVrtCore/Propagator.h" #include "TrkExInterfaces/IExtrapolator.h" @@ -33,13 +34,13 @@ class TrkVKalVrtFitter; VKalAtlasMagFld(); ~VKalAtlasMagFld(); void getMagFld(const double,const double,const double,double&,double&,double&)const; - void setAtlasField(MagField::IMagFieldSvc *); + void setAtlasField(MagField::AtlasFieldCache *); void setAtlasField(const double ); void setAtlasMagRefFrame( double, double, double ); private: - MagField::IMagFieldSvc* m_VKalAthenaField; + MagField::AtlasFieldCache * m_VKalAthenaField; double m_FIXED_ATLAS_FIELD=1.997; double m_magFrameX, m_magFrameY, m_magFrameZ ; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx index 5228964287e7fb763c6b84440be31f5263a3aa90..d4c558396640f8e19d0ac511f4477f022173d37e 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx @@ -38,11 +38,11 @@ TrkVKalVrtFitter:: TrkVKalVrtFitter(const std::string& type, m_IDsizeZ(3000.), m_extPropagator(this), // Internal propagator // m_extPropagator("Trk::Extrapolator/InDetExtrapolator"), // External propagator - // m_magFieldAthenaSvc("MagFieldAthenaSvc",name), //Athena magnetic field---old version - m_magFieldAthenaSvc("AtlasFieldSvc", name), //Athena magnetic field + //m_magFieldAthenaSvc("AtlasFieldSvc", name), //Athena magnetic field m_firstMeasuredPoint(false), m_firstMeasuredPointLimit(false), m_makeExtendedVertex(false), + m_useFixedField(false), m_useAprioriVertex(false), m_useThetaCnst(false), m_usePhiCnst(false), @@ -76,7 +76,7 @@ TrkVKalVrtFitter:: TrkVKalVrtFitter(const std::string& type, declareProperty("CovVrtForConstraint", m_c_CovVrtForConstraint); declareProperty("InputParticleMasses", m_c_MassInputParticles, "List of masses of input particles (pions assumed if this list is absent)" ); declareProperty("Extrapolator", m_extPropagator); - declareProperty("AtlasMagFieldSvc", m_magFieldAthenaSvc); + declareProperty("useFixedField", m_useFixedField, " Use fixed magnetic field instead of exact Atlas one"); declareProperty("FirstMeasuredPoint", m_firstMeasuredPoint); declareProperty("FirstMeasuredPointLimit", m_firstMeasuredPointLimit); declareProperty("MakeExtendedVertex", m_makeExtendedVertex, "VKalVrt returns VxCandidate with full covariance matrix"); @@ -147,12 +147,17 @@ StatusCode TrkVKalVrtFitter::initialize() // if( m_Constraint == 12) { m_usePhiCnst = true; m_useThetaCnst = true;} // setCnstType((int)m_Constraint); - StatusCode sc=m_magFieldAthenaSvc.retrieve(); - if (sc.isFailure() ){ - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Could not find MagFieldAthenaSvc"<< endmsg; - }else{ - m_isAtlasField = true; - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "MagFieldAthenaSvc is retrieved" << endmsg; + if(!m_useFixedField){ + // Read handle for AtlasFieldCacheCondObj + if (!m_fieldCacheCondObjInputKey.key().empty()){ + if( (m_fieldCacheCondObjInputKey.initialize()).isSuccess() ){ + m_isAtlasField = true; + ATH_MSG_DEBUG( "Found AtlasFieldCacheCondObj with key ="<< m_fieldCacheCondObjInputKey.key()); + }else{ + ATH_MSG_INFO( "No AtlasFieldCacheCondObj with key ="<< m_fieldCacheCondObjInputKey.key()); + ATH_MSG_INFO( "Use fixed magnetic field instead"); + } + } } // // Only here the VKalVrtFitter propagator object is created if ATHENA propagator is provided (see setAthenaPropagator) @@ -221,10 +226,17 @@ void TrkVKalVrtFitter::initState (State& state) const // VKalVrtFitter must set up Core BEFORE any call required propagation!!! // if (m_isAtlasField) { - state.m_fitField.setAtlasField( m_magFieldAthenaSvc.get() ); - } - else { - state.m_fitField.setAtlasField(m_BMAG); + // For the moment, use Gaudi Hive for the event context - would need to be passed in from clients + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return; + } + fieldCondObj->getInitializedCache (state.m_fieldCache); + state.m_fitField.setAtlasField(&state.m_fieldCache); + } else { + state.m_fitField.setAtlasField(m_BMAG); } state.m_vkalFitControl.vk_objProp = m_fitPropagator; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalMagFld.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalMagFld.cxx index a5035ae8af17be119af36240fa353ac2b2cd63c9..e80d21b572f0abf82052ff57b7a273a81689a66b 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalMagFld.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalMagFld.cxx @@ -35,18 +35,20 @@ namespace Trk{ //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& // ATLAS magnetic field access - VKalAtlasMagFld::VKalAtlasMagFld() { - m_VKalAthenaField=0; - m_magFrameX=0.; - m_magFrameY=0.; - m_magFrameZ=0.; - } + VKalAtlasMagFld::VKalAtlasMagFld(): + m_magFrameX(0.), + m_magFrameY(0.), + m_magFrameZ(0.) + {} + VKalAtlasMagFld::~VKalAtlasMagFld(){} // // Setting of parameters // - void VKalAtlasMagFld::setAtlasField(MagField::IMagFieldSvc* pnt) - { m_VKalAthenaField = pnt; } + void VKalAtlasMagFld::setAtlasField(MagField::AtlasFieldCache * pnt ) + { + m_VKalAthenaField = pnt; + } void VKalAtlasMagFld::setAtlasField(const double field) { m_FIXED_ATLAS_FIELD = field; } diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/CMakeLists.txt index a1b45280504eb3bd63bae529bf8ea7529df145b6..a04de66bae29623dd030caf213bd418757bff9fc 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODEventInfo Generators/GenAnalysisTools/TruthHelper Generators/GeneratorObjects + Generators/AtlasHepMC MagneticField/MagFieldInterfaces Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParameters @@ -25,7 +26,6 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( Eigen ) -find_package( HepMC ) find_package( HepPDT ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -33,8 +33,8 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) atlas_add_component( TrkVertexSeedFinderTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel TrkVertexFitterInterfaces GeoPrimitives EventPrimitives xAODEventInfo TruthHelper GeneratorObjects TrkEventPrimitives TrkParameters TrkTrack VxVertex ) + INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel TrkVertexFitterInterfaces GeoPrimitives EventPrimitives xAODEventInfo TruthHelper GeneratorObjects TrkEventPrimitives TrkParameters TrkTrack VxVertex ) # Install files from the package: atlas_install_headers( TrkVertexSeedFinderTools ) diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/TrkVertexSeedFinderTools/MCTrueSeedFinder.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/TrkVertexSeedFinderTools/MCTrueSeedFinder.h index a7ad3c6f596546883be236a084b0c9a95218d00e..dbd5e0cfaaea953b6394c402ea7dc3922de51823 100755 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/TrkVertexSeedFinderTools/MCTrueSeedFinder.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/TrkVertexSeedFinderTools/MCTrueSeedFinder.h @@ -12,10 +12,8 @@ class IPartPropSvc; -namespace HepMC { -class GenEvent; -class GenParticle; -} +#include "AtlasHepMC/GenParticle_fwd.h" +#include "AtlasHepMC/GenEvent_fwd.h" namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/src/MCTrueSeedFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/src/MCTrueSeedFinder.cxx index 18e39e54359fb1aba9deada3cd9a69bb4a6cf91e..0e7874f1e43506f15c434450a503cce07f61b0c8 100755 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/src/MCTrueSeedFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/src/MCTrueSeedFinder.cxx @@ -12,9 +12,9 @@ #include "TrkParameters/TrackParameters.h" #include "GeoPrimitives/GeoPrimitives.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/HepMcParticleLink.h" #include "GaudiKernel/IPartPropSvc.h" diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/GaussianDensityTestAlg_jobOptions.py b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/GaussianDensityTestAlg_jobOptions.py index 553052c06c23303f2b9be210977f6e0c1902c80b..e87072ce21bbb7089a3bcb95846c7d64d21e2700 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/GaussianDensityTestAlg_jobOptions.py +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/GaussianDensityTestAlg_jobOptions.py @@ -29,8 +29,6 @@ InDetFlags.preProcessing = False InDetFlags.doPRDFormation = False InDetFlags.doSpacePointFormation = False InDetFlags.doNewTracking = False -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/ImagingSeedTuningAlg_jobOptions.py b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/ImagingSeedTuningAlg_jobOptions.py index 44f0ae150a080ab6fbcdd5e8a4c89d9ce31f07d4..f68e67cd97a42e79147b09547b1d20eacb8c813d 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/ImagingSeedTuningAlg_jobOptions.py +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/ImagingSeedTuningAlg_jobOptions.py @@ -28,8 +28,6 @@ InDetFlags.preProcessing = False InDetFlags.doPRDFormation = False InDetFlags.doSpacePointFormation = False InDetFlags.doNewTracking = False -InDetFlags.doiPatRec = False -InDetFlags.doxKalman = False InDetFlags.doLowPt = False InDetFlags.doBackTracking = False InDetFlags.doTRTStandalone = False diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt index c399d168271cb07424df6907fc1ce0f9fbad3b3b..539498ae86c0f4ff47c05c46efbcafb590012512 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt @@ -16,19 +16,19 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE Event/EventPrimitives Generators/GeneratorObjects + Generators/AtlasHepMC Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/VxVertex ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) # Component(s) in the package: atlas_add_component( TrkVertexTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel xAODTracking GaudiKernel TrkVertexFitterInterfaces EventPrimitives GeneratorObjects TrkEventPrimitives VxVertex ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel xAODTracking GaudiKernel TrkVertexFitterInterfaces EventPrimitives GeneratorObjects TrkEventPrimitives VxVertex ) # Install files from the package: atlas_install_headers( TrkVertexTools ) diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/src/TruthVertexSelectionTool.cxx b/Tracking/TrkVertexFitter/TrkVertexTools/src/TruthVertexSelectionTool.cxx index b73cbbd58035d21c17ab0f86d807f332dab7afab..2a87e468fce559fd5dec0a34ffa5c03d905cd50f 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/src/TruthVertexSelectionTool.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexTools/src/TruthVertexSelectionTool.cxx @@ -5,7 +5,7 @@ #include "TrkVertexTools/TruthVertexSelectionTool.h" #include "TrkEventPrimitives/ParamDefs.h" #include "CLHEP/Random/RandFlat.h" -#include "HepMC/SimpleVector.h" +#include "AtlasHepMC/SimpleVector.h" #include "EventPrimitives/EventPrimitivesHelpers.h" #include <vector> diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/CMakeLists.txt b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/CMakeLists.txt index 364be430ff4b9a0c10f86b68ce8bf76d2dd1fe23..79db3b49f8e722b3065c7739da9ebf3e37795b34 100644 --- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/CMakeLists.txt @@ -5,28 +5,27 @@ # Declare the package name: atlas_subdir( TrigEgammaMatchingTool ) -# Extra dependencies, based on the build environment: -set( extra_deps ) -if( NOT XAOD_STANDALONE ) - set( extra_deps Control/AthenaBaseComps GaudiKernel ) - endif() # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC - Control/AthToolSupport/AsgTools Event/xAOD/xAODCaloEvent Event/xAOD/xAODEgamma Event/xAOD/xAODTracking Event/xAOD/xAODTrigCalo Event/xAOD/xAODTrigEgamma + Event/xAOD/xAODMuon + Event/xAOD/xAODTau + Event/xAOD/xAODTrigger Trigger/TrigAnalysis/TrigDecisionTool Trigger/TrigConfiguration/TrigConfHLTData Trigger/TrigEvent/TrigSteeringEvent + Trigger/TrigSteer/DecisionHandling PRIVATE - Event/xAOD/xAODMuon - Event/xAOD/xAODTau - Event/xAOD/xAODTrigger - ${extra_deps} ) + Control/AthToolSupport/AsgTools + Control/AthenaMonitoring + Control/StoreGate + Control/AthenaBaseComps + GaudiKernel ) @@ -38,18 +37,16 @@ atlas_add_library( TrigEgammaMatchingToolLib Root/*.cxx PUBLIC_HEADERS TrigEgammaMatchingTool PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AsgTools xAODCaloEvent xAODEgamma xAODTracking xAODTrigCalo xAODTrigEgamma TrigConfHLTData TrigSteeringEvent TrigDecisionToolLib + LINK_LIBRARIES AsgTools xAODCaloEvent xAODEgamma xAODTracking xAODTrigCalo xAODTrigEgamma TrigConfHLTData + TrigSteeringEvent TrigDecisionToolLib DecisionHandlingLib AthenaMonitoringLib PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} xAODMuon xAODTau xAODTrigger ) -if( NOT XAOD_STANDALONE ) atlas_add_component( TrigEgammaMatchingTool src/*.h src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent xAODEgamma xAODTracking xAODTrigCalo xAODTrigEgamma TrigDecisionToolLib TrigConfHLTData TrigSteeringEvent AthenaBaseComps xAODMuon xAODTau xAODTrigger GaudiKernel TrigEgammaMatchingToolLib ) - -endif() + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent xAODEgamma xAODTracking xAODTrigCalo xAODTrigEgamma + TrigDecisionToolLib TrigConfHLTData TrigSteeringEvent AthenaBaseComps xAODMuon xAODTau xAODTrigger GaudiKernel + TrigEgammaMatchingToolLib AthenaMonitoringLib StoreGateLib) -# Install files from the package: -atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingTool.cxx b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingTool.cxx index da0dbfd2e1fecdc13541722da7232fb6ff6fb67c..59e2c648583a3ec1ce947e0d1f1d1558253ff0e8 100644 --- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingTool.cxx +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingTool.cxx @@ -28,13 +28,6 @@ namespace Trig { TrigEgammaMatchingTool::~TrigEgammaMatchingTool(){ } - StatusCode TrigEgammaMatchingTool::finalize() { - return StatusCode::SUCCESS; - } - - StatusCode TrigEgammaMatchingTool::execute() { - return StatusCode::SUCCESS; - } StatusCode TrigEgammaMatchingTool::initialize() { // Greet the user: @@ -56,11 +49,11 @@ namespace Trig { * Note does not use DeactiviateTEs * Returns closest EF object to offline object * Requires TrigPassBits only works in Athena*/ - const xAOD::Egamma* TrigEgammaMatchingTool::closestHLTObject(const xAOD::Egamma *eg,const std::string trigger){ + const xAOD::Egamma* TrigEgammaMatchingTool::closestHLTObject(const xAOD::Egamma *eg,const std::string &trigger){ - if(eg==NULL) { - ATH_MSG_DEBUG("NULL Offline object"); - return NULL; + if(eg==nullptr) { + ATH_MSG_DEBUG("nullptr Offline object"); + return nullptr; } Trig::FeatureContainer fc = m_trigDecTool->features(trigger); double deltaR=0.; @@ -73,13 +66,13 @@ namespace Trig { for(auto feat : vec){ const xAOD::ElectronContainer *cont = feat.cptr(); - if(cont == NULL) { - ATH_MSG_DEBUG("Electron container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_DEBUG("Electron container from TE nullptr"); continue; } for(const auto& el : *cont){ - if(el == NULL) { - ATH_MSG_DEBUG("Electron from TE NULL"); + if(el == nullptr) { + ATH_MSG_DEBUG("Electron from TE nullptr"); continue; } deltaR = dR(elOff->trackParticle()->eta(),elOff->trackParticle()->phi(), el->trackParticle()->eta(),el->trackParticle()->phi()); @@ -96,13 +89,13 @@ namespace Trig { const std::vector< Trig::Feature<xAOD::PhotonContainer> > vec = fc.get<xAOD::PhotonContainer>("egamma_Photons"); for(auto feat : vec){ const xAOD::PhotonContainer *cont = feat.cptr(); - if(cont == NULL) { - ATH_MSG_DEBUG("Photon Container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_DEBUG("Photon Container from TE nullptr"); continue; } for(const auto& ph : *cont){ - if(ph == NULL) { - ATH_MSG_DEBUG("Photon from TE NULL"); + if(ph == nullptr) { + ATH_MSG_DEBUG("Photon from TE nullptr"); continue; } deltaR = dR(phOff->caloCluster()->eta(),phOff->caloCluster()->phi(), ph->caloCluster()->eta(),ph->caloCluster()->phi()); @@ -119,7 +112,7 @@ namespace Trig { /*! Calls match with a FeatureContainer for a given triggerfor HLT only * Note does not use DeactiviateTEs */ - bool TrigEgammaMatchingTool::matchHLT(const xAOD::Egamma *eg,const std::string trigger){ + bool TrigEgammaMatchingTool::matchHLT(const xAOD::Egamma *eg,const std::string &trigger){ ATH_MSG_DEBUG("matchHLT"); Trig::FeatureContainer fc = m_trigDecTool->features(trigger); ATH_MSG_DEBUG("FeatureContainer"); @@ -135,13 +128,13 @@ namespace Trig { ATH_MSG_DEBUG("Container Feature"); for(const auto feat : vec){ const xAOD::ElectronContainer *cont = feat.cptr(); - if(cont == NULL) { - ATH_MSG_DEBUG("Electron container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_DEBUG("Electron container from TE nullptr"); continue; } for(const auto& el : *cont){ - if(el == NULL) { - ATH_MSG_WARNING("Electron from TE NULL"); + if(el == nullptr) { + ATH_MSG_WARNING("Electron from TE nullptr"); continue; } deltaR = dR(eg->eta(),eg->phi(), el->eta(),el->phi()); @@ -164,13 +157,13 @@ namespace Trig { #endif // XAOD_ANALYSIS for(const auto feat : vec){ const xAOD::PhotonContainer *cont = feat.cptr(); - if(cont == NULL) { - ATH_MSG_DEBUG("Photon Container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_DEBUG("Photon Container from TE nullptr"); continue; } for(const auto& ph : *cont){ - if(ph == NULL) { - ATH_MSG_DEBUG("Photon from TE NULL"); + if(ph == nullptr) { + ATH_MSG_DEBUG("Photon from TE nullptr"); continue; } deltaR = dR(phOff->eta(),phOff->phi(), ph->eta(),ph->phi()); @@ -183,8 +176,8 @@ namespace Trig { return false; // No match } - bool TrigEgammaMatchingTool::matchHLTPhoton(const xAOD::Photon *eg,const std::string trigger,const HLT::TriggerElement*& finalFC){ - finalFC=NULL; + bool TrigEgammaMatchingTool::matchHLTPhoton(const xAOD::Photon *eg,const std::string &trigger,const HLT::TriggerElement*& finalFC){ + finalFC=nullptr; ATH_MSG_DEBUG("Match HLT Photon"); // Get the container of online electrons associated to passed items auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs)); @@ -202,14 +195,14 @@ namespace Trig { double deltaR=0.; for(auto feat : vec){ const xAOD::PhotonContainer *cont = feat.cptr(); - if(cont == NULL) { - ATH_MSG_DEBUG("Photon Container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_DEBUG("Photon Container from TE nullptr"); continue; } ATH_MSG_DEBUG("EF Size " << cont->size()); for(const auto& ph : *cont){ - if(ph == NULL) { - ATH_MSG_DEBUG("Photon from TE NULL"); + if(ph == nullptr) { + ATH_MSG_DEBUG("Photon from TE nullptr"); continue; } deltaR = dR(eg->eta(),eg->phi(), ph->eta(),ph->phi()); @@ -222,9 +215,9 @@ namespace Trig { return false; } - bool TrigEgammaMatchingTool::matchHLTElectron(const xAOD::Electron *eg,const std::string trigger,const HLT::TriggerElement*& finalFC){ + bool TrigEgammaMatchingTool::matchHLTElectron(const xAOD::Electron *eg,const std::string &trigger,const HLT::TriggerElement*& finalFC){ ATH_MSG_DEBUG("Match HLT electron"); - finalFC=NULL; + finalFC=nullptr; // Get the container of online electrons associated to passed items auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs)); @@ -237,31 +230,31 @@ namespace Trig { double deltaR=0.; for(auto feat : vec){ const xAOD::ElectronContainer *cont = feat.cptr(); - if(cont == NULL) { - ATH_MSG_WARNING("Electron Container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_WARNING("Electron Container from TE nullptr"); continue; } ATH_MSG_DEBUG("EF Size " << cont->size()); for(const auto& el : *cont){ - if(el == NULL) { - ATH_MSG_DEBUG("Electron from TE NULL"); + if(el == nullptr) { + ATH_MSG_DEBUG("Electron from TE nullptr"); continue; } deltaR = dR(eg->eta(),eg->phi(), el->eta(),el->phi()); if(deltaR < m_dR){ finalFC = (feat.te()); - ATH_MSG_DEBUG("Electron finalFC matches offline"); + ATH_MSG_DEBUG("Electron finalFC matches offline"); return true; } } } - ATH_MSG_DEBUG("Reached the end in matchHLTElectron. So didn't match!"); + ATH_MSG_DEBUG("Reached the end in matchHLTElectron. So didn't match!"); return false; } - bool TrigEgammaMatchingTool::matchHLTCalo(const xAOD::Egamma *eg,const std::string trigger,const HLT::TriggerElement*& finalFC){ + bool TrigEgammaMatchingTool::matchHLTCalo(const xAOD::Egamma *eg,const std::string &trigger,const HLT::TriggerElement*& finalFC){ ATH_MSG_DEBUG("Match HLT CaloCluster"); - finalFC=NULL; + finalFC=nullptr; auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs)); #ifdef XAOD_ANALYSIS const auto vec = fc.containerFeature<xAOD::CaloClusterContainer>("TrigEFCaloCalibFex",TrigDefs::alsoDeactivateTEs); @@ -274,13 +267,13 @@ namespace Trig { for(auto feat : vec){ const xAOD::CaloClusterContainer *cont = feat.cptr(); ATH_MSG_DEBUG("EF Calo Size " << cont->size()); - if(cont == NULL) { - ATH_MSG_DEBUG("CaloCluster Container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_DEBUG("CaloCluster Container from TE nullptr"); continue; } for(const auto& clus : *cont){ - if(clus == NULL) { - ATH_MSG_DEBUG("CaloCluster from TE NULL"); + if(clus == nullptr) { + ATH_MSG_DEBUG("CaloCluster from TE nullptr"); continue; } deltaR = dR(eg->eta(),eg->phi(), clus->eta(),clus->phi()); @@ -294,8 +287,8 @@ namespace Trig { } - bool TrigEgammaMatchingTool::matchL2Photon(const xAOD::Photon *eg,const std::string trigger,const HLT::TriggerElement*& finalFC){ - finalFC=NULL; + bool TrigEgammaMatchingTool::matchL2Photon(const xAOD::Photon *eg,const std::string &trigger,const HLT::TriggerElement*& finalFC){ + finalFC=nullptr; ATH_MSG_DEBUG("Match L2 Photon"); auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs)); @@ -308,14 +301,14 @@ namespace Trig { double deltaR=0.; for(auto feat : vec){ const xAOD::TrigPhotonContainer *cont = feat.cptr(); - if(cont == NULL) { - ATH_MSG_WARNING("TrigPhoton Container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_WARNING("TrigPhoton Container from TE nullptr"); continue; } ATH_MSG_DEBUG("L2 Size " << cont->size()); for(const auto& l2 : *cont){ - if(l2 == NULL) { - ATH_MSG_DEBUG("TrigElectron from TE NULL"); + if(l2 == nullptr) { + ATH_MSG_DEBUG("TrigElectron from TE nullptr"); continue; } deltaR = dR(eg->eta(),eg->phi(), l2->eta(),l2->phi()); @@ -328,8 +321,8 @@ namespace Trig { return false; } - bool TrigEgammaMatchingTool::matchL2Electron(const xAOD::Electron *eg,const std::string trigger,const HLT::TriggerElement*& finalFC){ - finalFC=NULL; + bool TrigEgammaMatchingTool::matchL2Electron(const xAOD::Electron *eg,const std::string &trigger,const HLT::TriggerElement*& finalFC){ + finalFC=nullptr; ATH_MSG_DEBUG("Match L2 Electron"); auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs)); #ifdef XAOD_ANALYSIS @@ -341,14 +334,14 @@ namespace Trig { double deltaR=0.; for(auto feat : vec){ const xAOD::TrigElectronContainer *cont = feat.cptr(); - if(cont == NULL) { - ATH_MSG_DEBUG("TrigElectron Container from TE NULL"); + if(cont == nullptr) { + ATH_MSG_DEBUG("TrigElectron Container from TE nullptr"); continue; } ATH_MSG_DEBUG("L2 Size " << cont->size()); for(const auto& l2 : *cont){ - if(l2 == NULL) { - ATH_MSG_DEBUG("TrigElectron from TE NULL"); + if(l2 == nullptr) { + ATH_MSG_DEBUG("TrigElectron from TE nullptr"); continue; } deltaR = dR(eg->eta(),eg->phi(), l2->eta(),l2->phi()); @@ -362,8 +355,8 @@ namespace Trig { } - bool TrigEgammaMatchingTool::matchL2Calo(const xAOD::Egamma *eg,const std::string trigger,const HLT::TriggerElement*& finalFC){ - finalFC=NULL; + bool TrigEgammaMatchingTool::matchL2Calo(const xAOD::Egamma *eg,const std::string &trigger,const HLT::TriggerElement*& finalFC){ + finalFC=nullptr; auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs)); #ifdef XAOD_ANALYSIS ATH_MSG_DEBUG("No matching for TrigEMCluster in AnalysisBase"); @@ -374,8 +367,8 @@ namespace Trig { ATH_MSG_DEBUG("L2 FC Size " << vec.size()); for(auto feat : vec){ const xAOD::TrigEMCluster *em = feat.cptr(); - if(em == NULL) { - ATH_MSG_DEBUG("TrigEMCluster from TE NULL"); + if(em == nullptr) { + ATH_MSG_DEBUG("TrigEMCluster from TE nullptr"); continue; } ATH_MSG_DEBUG("TrigEMCluster << " << em->et() ); @@ -391,8 +384,8 @@ namespace Trig { } - bool TrigEgammaMatchingTool::matchL1( const xAOD::Egamma* eg, const std::string trigger,const HLT::TriggerElement*& finalFC ){ - finalFC=NULL; + bool TrigEgammaMatchingTool::matchL1( const xAOD::Egamma* eg, const std::string &trigger,const HLT::TriggerElement*& finalFC ){ + finalFC=nullptr; #ifdef XAOD_ANALYSIS if(m_trigDecTool->isPassed("L1_EM.*")) return true; @@ -404,8 +397,8 @@ namespace Trig { for (auto initRoi: initRois) { auto itEmTau = m_trigDecTool->ancestor<xAOD::EmTauRoI>(initRoi); const xAOD::EmTauRoI *l1 = itEmTau.cptr(); - if(l1 == NULL) { - ATH_MSG_DEBUG("EMTauRoI from TE NULL"); + if(l1 == nullptr) { + ATH_MSG_DEBUG("EMTauRoI from TE nullptr"); return false; } deltaR = dR(eg->eta(),eg->phi(), l1->eta(),l1->phi()); @@ -421,7 +414,7 @@ namespace Trig { } /*bool TrigEgammaMatchingTool::matchL1( const xAOD::Egamma* eg, const std::string trigger){ - finalFC=NULL; + finalFC=nullptr; #ifdef XAOD_ANALYSIS if(m_trigDecTool->isPassed("L1_EM.*")) return true; @@ -433,8 +426,8 @@ namespace Trig { auto cont = m_trigDecTool->ancestor<xAOD::EmTauRoIContainer>(initRois); for(const auto &l1 : cont){ //const xAOD::EmTauRoI *l1 = feat.cptr(); - if(l1 == NULL) { - ATH_MSG_DEBUG("EMTauRoI from TE NULL"); + if(l1 == nullptr) { + ATH_MSG_DEBUG("EMTauRoI from TE nullptr"); return false; } @@ -454,18 +447,18 @@ namespace Trig { return false; // otherwise, someone matched! }*/ - bool TrigEgammaMatchingTool::match(const xAOD::Egamma *eg,const std::string trigger,const HLT::TriggerElement*& finalFC){ - // Set TE to NULL + bool TrigEgammaMatchingTool::match(const xAOD::Egamma *eg,const std::string &trigger,const HLT::TriggerElement*& finalFC){ + // Set TE to nullptr // If no match easy check - finalFC=NULL; + finalFC=nullptr; ATH_MSG_DEBUG("Match objec with trigger " << trigger); if(xAOD::EgammaHelpers::isElectron(eg)){ const xAOD::Electron* el =static_cast<const xAOD::Electron*> (eg); if( matchHLTElectron(el,trigger,finalFC) ) { - ATH_MSG_DEBUG("Matchched!"); - return true; - } + ATH_MSG_DEBUG("Matchched!"); + return true; + } } else if(xAOD::EgammaHelpers::isPhoton(eg)){ const xAOD::Photon* ph =static_cast<const xAOD::Photon*> (eg); @@ -483,25 +476,25 @@ namespace Trig { } if( matchL2Calo(eg,trigger,finalFC) ) return true; if( matchL1(eg,trigger,finalFC) ) return true; - ATH_MSG_DEBUG("match() failed!"); + ATH_MSG_DEBUG("match() failed!"); return false;// otherwise, someone matched!*/ } /*! Calls match with a TE, so recursive matching to L1 * Check that the HLT Electron or Photon ancester passed */ - bool TrigEgammaMatchingTool::match(const xAOD::Egamma *eg,const std::string trigger){ + bool TrigEgammaMatchingTool::match(const xAOD::Egamma *eg,const std::string &trigger){ const HLT::TriggerElement* finalFC; bool passed = false; if( match(eg,trigger,finalFC) ){ - if( finalFC == NULL) return false; + if( finalFC == nullptr) return false; if(xAOD::EgammaHelpers::isElectron(eg)){ - if ( (m_trigDecTool->ancestor<xAOD::ElectronContainer>(finalFC)).te() != NULL){ + if ( (m_trigDecTool->ancestor<xAOD::ElectronContainer>(finalFC)).te() != nullptr){ if( (m_trigDecTool->ancestor<xAOD::ElectronContainer>(finalFC)).te()->getActiveState()) passed = true; } } else if(xAOD::EgammaHelpers::isPhoton(eg)){ - if ( (m_trigDecTool->ancestor<xAOD::PhotonContainer>(finalFC)).te() != NULL){ + if ( (m_trigDecTool->ancestor<xAOD::PhotonContainer>(finalFC)).te() != nullptr){ if( (m_trigDecTool->ancestor<xAOD::PhotonContainer>(finalFC)).te()->getActiveState()) passed = true; } diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingToolMT.cxx b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingToolMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dda8ae6c3cb2a70e7ff46f25e2ad3a49df083ec0 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingToolMT.cxx @@ -0,0 +1,183 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + + +#include "TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h" +#include "DecisionHandling/TrigCompositeUtils.h" +#include "TrigSteeringEvent/TrigRoiDescriptor.h" +#include "DecisionHandling/HLTIdentifier.h" +#include "boost/algorithm/string.hpp" +#include <typeinfo> +#include <string> + + +using namespace TrigCompositeUtils; +using namespace Trig; + + + + +/* + * TrigEgammaMatchinTool API + */ + + +TrigEgammaMatchingToolMT::TrigEgammaMatchingToolMT( const std::string& name ): + asg::AsgTool( name ), + m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool") +{ +} + + + +TrigEgammaMatchingToolMT::~TrigEgammaMatchingToolMT() +{ +} + + + + +StatusCode TrigEgammaMatchingToolMT::initialize() +{ + ATH_CHECK(tdt().retrieve()); + + ATH_CHECK( m_emTauRoIKey.initialize() ); + m_keys[ "Electron"] = "HLT_egamma_Electrons" ; + m_keys[ "Photon"] = "HLT_egamma_Photons" ; + m_keys[ "Track"] = ""; + m_keys[ "EFCalo"] = "HLT_CaloEMClusters" ; + m_keys[ "L2Electron"] = "HLT_L2Electrons" ; + m_keys[ "L2Photon"] = "HLT_L2Photons" ; + m_keys[ "L2Calo"] = "HLT_L2CaloEMClusters" ; + m_keys[ "L1Calo"] = "LVL1EmTauRoIs" ; + + return StatusCode::SUCCESS; +} + + + +std::string TrigEgammaMatchingToolMT::key( std::string key) const +{ + return m_keys.at(key); +} + + +bool TrigEgammaMatchingToolMT::match(const xAOD::Egamma *eg,const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const +{ + ATH_MSG_DEBUG("Match decec with trigger " << trigger); + if(xAOD::EgammaHelpers::isElectron(eg)){ + const xAOD::Electron* el =static_cast<const xAOD::Electron*> (eg); + if( matchHLTElectron(el,trigger,dec) ) { + ATH_MSG_DEBUG("Matched!"); + return true; + } + }else if(xAOD::EgammaHelpers::isPhoton(eg)){ + const xAOD::Photon* ph =static_cast<const xAOD::Photon*> (eg); + if( matchHLTPhoton(ph,trigger,dec) ) return true; + } + + if( matchHLTCalo(eg,trigger,dec) ) return true; + + if(xAOD::EgammaHelpers::isElectron(eg)){ + const xAOD::Electron* el =static_cast<const xAOD::Electron*> (eg); + if( matchL2Electron(el,trigger,dec) ) return true; + + }else if(xAOD::EgammaHelpers::isPhoton(eg)){ + const xAOD::Photon* ph =static_cast<const xAOD::Photon*> (eg); + if( matchL2Photon(ph,trigger,dec) ) return true; + } + + if( matchL1(eg,trigger,dec) ) return true; + ATH_MSG_DEBUG("match() failed!"); + return false; +} + + +bool TrigEgammaMatchingToolMT::match(const xAOD::Egamma *eg,const std::string &trigger ) const +{ + const TrigCompositeUtils::Decision *dec=nullptr; + if( match( eg, trigger, dec ) ){ + if( dec ){ + if(xAOD::EgammaHelpers::isElectron(eg)){ + return ancestorPassed<xAOD::ElectronContainer>(dec, trigger,key("Electron")); + } + if(xAOD::EgammaHelpers::isPhoton(eg)){ + return ancestorPassed<xAOD::PhotonContainer>(dec, trigger, key("Photon")); + } + } + } + return false; +} + + + +bool TrigEgammaMatchingToolMT::matchHLTPhoton(const xAOD::Photon *eg,const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const +{ + ATH_MSG_DEBUG("Match HLT Photon"); + return closestObject<xAOD::PhotonContainer>( eg, dec, trigger, key("Photon") ); +} + + +bool TrigEgammaMatchingToolMT::matchHLTElectron(const xAOD::Electron *eg,const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const +{ + ATH_MSG_DEBUG("Match HLT Electron"); + return closestObject<xAOD::ElectronContainer>( eg, dec , trigger, key("Electron") ); +} + + +bool TrigEgammaMatchingToolMT::matchHLTCalo(const xAOD::Egamma *eg,const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const +{ + ATH_MSG_DEBUG("Match HLT Calo"); + return closestObject<xAOD::CaloClusterContainer>( eg, dec, trigger, key("EFCalo") ); +} + + +bool TrigEgammaMatchingToolMT::matchL2Photon(const xAOD::Photon *eg,const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const +{ + ATH_MSG_DEBUG("Match L2 Photon"); + return closestObject<xAOD::TrigPhotonContainer>( eg, dec, trigger, key("L2Photon") ); +} + + +bool TrigEgammaMatchingToolMT::matchL2Electron(const xAOD::Electron *eg,const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const +{ + ATH_MSG_DEBUG("Match L2 Photon"); + return closestObject<xAOD::TrigElectronContainer>( eg, dec, trigger, key("L2Electron") ); +} + + +bool TrigEgammaMatchingToolMT::matchL2Calo(const xAOD::Egamma *eg,const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const +{ + ATH_MSG_DEBUG("Match L2 Calo"); + return closestObject<xAOD::TrigEMClusterContainer>( eg, dec, trigger, key("L2Calo") ); +} + + +bool TrigEgammaMatchingToolMT::matchL1( const xAOD::Egamma* eg, const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const +{ + ATH_MSG_DEBUG("Match L1 Calo"); + double deltaR=0.; + auto initRois = tdt()->features<TrigRoiDescriptorCollection>(trigger,TrigDefs::includeFailedDecisions,"", + TrigDefs::allFeaturesOfType,"initialRoI"); + if( initRois.size() < 1) return false; + for( auto &initRoi: initRois ){ + if( !initRoi.link.isValid() ) continue; + deltaR = dR(eg->eta(),eg->phi(), (*initRoi.link)->eta(),(*initRoi.link)->phi()); + if(deltaR < (float)m_dRL1){ + dec=initRoi.source; + return true; + } + } + + return false; +} + + + + + + + + + diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/ITrigEgammaMatchingTool.h b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/ITrigEgammaMatchingTool.h index b48f5e953f325cf87801b07005df2e6d788ab86c..54d9eb321c86190e4ac6c8595463ff04fd03cb7d 100644 --- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/ITrigEgammaMatchingTool.h +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/ITrigEgammaMatchingTool.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef ITRIGEGAMMAMATCHINGTOOL_H_ -#define ITRIGEGAMMAMATCHINGTOOL_H_ +#ifndef ITrigEgammaMatchingTool_H +#define ITrigEgammaMatchingTool_H #include "AsgTools/IAsgTool.h" #include "TrigConfHLTData/HLTFrame.h" @@ -30,13 +30,11 @@ namespace Trig{ ASG_TOOL_INTERFACE( Trig::ITrigEgammaMatchingTool ) public: - virtual StatusCode initialize(void) = 0; - virtual StatusCode execute()=0; - virtual StatusCode finalize()=0; - virtual bool match(const xAOD::Egamma *,const std::string,const HLT::TriggerElement*&)=0; - virtual bool match(const xAOD::Egamma *,const std::string)=0; - virtual bool matchHLT(const xAOD::Egamma *,const std::string)=0; - virtual const xAOD::Egamma* closestHLTObject(const xAOD::Egamma *,const std::string)=0; + virtual StatusCode initialize() = 0; + virtual bool match(const xAOD::Egamma *,const std::string&,const HLT::TriggerElement*&)=0; + virtual bool match(const xAOD::Egamma *,const std::string&)=0; + virtual bool matchHLT(const xAOD::Egamma *,const std::string&)=0; + virtual const xAOD::Egamma* closestHLTObject(const xAOD::Egamma *,const std::string&)=0; protected: private: diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingTool.h b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingTool.h index 8bb52d5b7790625d36bcedacaadc3604c22fc38e..1d9fd066fcec09f57dd94471400cf6c14b5a1c22 100644 --- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingTool.h +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingTool.h @@ -1,19 +1,19 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAMATCHINGTOOL_H_ -#define TRIGEGAMMAMATCHINGTOOL_H_ +#ifndef TrigEgammaMatchingTool_H +#define TrigEgammaMatchingTool_H +#include "TrigDecisionTool/TrigDecisionTool.h" #include "TrigEgammaMatchingTool/ITrigEgammaMatchingTool.h" #include "xAODEgamma/EgammaxAODHelpers.h" -//#include "AsgTools/AsgToolsConf.h" #include "AsgTools/AsgMetadataTool.h" #include "AsgTools/AsgTool.h" #include "AsgTools/ToolHandle.h" #include <iostream> -#include "TrigDecisionTool/TrigDecisionTool.h" + namespace Trig{ class TrigEgammaMatchingTool : @@ -29,17 +29,17 @@ class TrigEgammaMatchingTool : virtual ~TrigEgammaMatchingTool(); - virtual StatusCode initialize(void); - virtual StatusCode execute(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + + /*! Egamma trigger matching which returns TE */ - bool match(const xAOD::Egamma *,const std::string,const HLT::TriggerElement*&); + virtual bool match(const xAOD::Egamma *,const std::string&,const HLT::TriggerElement*&) override; /*! Egamma trigger matching to HLT Electron/Photon with DeactivatedTE*/ - bool match(const xAOD::Egamma *,const std::string); + virtual bool match(const xAOD::Egamma *,const std::string&) override; /*! Egamma trigger matching to HLT Electron/Photon Only */ - bool matchHLT(const xAOD::Egamma *,const std::string); + virtual bool matchHLT(const xAOD::Egamma *,const std::string&) override; /*! Egamma trigger matching to HLT Electron/Photon only -- returns nearest object */ - const xAOD::Egamma* closestHLTObject(const xAOD::Egamma *,const std::string); + virtual const xAOD::Egamma* closestHLTObject(const xAOD::Egamma *,const std::string&) override; double dR(const double, const double, const double, const double); double m_dR; double m_dRL1; @@ -49,13 +49,13 @@ class TrigEgammaMatchingTool : template<class T> const T* getFeature(const HLT::TriggerElement* te); template<class T> bool ancestorPassed(const HLT::TriggerElement* te); - bool matchHLTElectron(const xAOD::Electron *,const std::string,const HLT::TriggerElement*&); - bool matchHLTPhoton(const xAOD::Photon *,const std::string,const HLT::TriggerElement*&); - bool matchHLTCalo(const xAOD::Egamma *,const std::string,const HLT::TriggerElement*&); - bool matchL2Electron(const xAOD::Electron *,const std::string,const HLT::TriggerElement*&); - bool matchL2Photon(const xAOD::Photon *,const std::string,const HLT::TriggerElement*&); - bool matchL2Calo(const xAOD::Egamma *,const std::string,const HLT::TriggerElement*&); - bool matchL1(const xAOD::Egamma *,const std::string,const HLT::TriggerElement*&); + bool matchHLTElectron(const xAOD::Electron *,const std::string&,const HLT::TriggerElement*&); + bool matchHLTPhoton(const xAOD::Photon *,const std::string&,const HLT::TriggerElement*&); + bool matchHLTCalo(const xAOD::Egamma *,const std::string&,const HLT::TriggerElement*&); + bool matchL2Electron(const xAOD::Electron *,const std::string&,const HLT::TriggerElement*&); + bool matchL2Photon(const xAOD::Photon *,const std::string&,const HLT::TriggerElement*&); + bool matchL2Calo(const xAOD::Egamma *,const std::string&,const HLT::TriggerElement*&); + bool matchL1(const xAOD::Egamma *,const std::string&,const HLT::TriggerElement*&); }; } diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h new file mode 100644 index 0000000000000000000000000000000000000000..6b7e759c1b3b152975463d54760ee3f2d55bddc2 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h @@ -0,0 +1,92 @@ +/* + * (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + */ + +#ifndef TrigEgammaMatchingToolMT_H +#define TrigEgammaMatchingToolMT_H + +#include "GaudiKernel/Property.h" +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "TrigDecisionTool/TrigDecisionTool.h" +#include "xAODTrigger/EmTauRoIContainer.h" +#include "xAODTrigCalo/TrigEMClusterContainer.h" +#include "xAODTrigEgamma/TrigPhotonContainer.h" +#include "xAODTrigEgamma/TrigElectronContainer.h" +#include "xAODCaloEvent/CaloClusterContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/EgammaxAODHelpers.h" + + + + + +class TrigEgammaMatchingToolMT : public asg::AsgTool + +{ + ASG_TOOL_INTERFACE( TrigEgammaMatchingToolMT ) + ASG_TOOL_CLASS0( TrigEgammaMatchingToolMT ) + + public: + + TrigEgammaMatchingToolMT( const std::string& name ); + + + ~TrigEgammaMatchingToolMT(); + StatusCode initialize(); + + + bool match(const xAOD::Egamma *,const std::string&) const; + bool match(const xAOD::Egamma *,const std::string&, const TrigCompositeUtils::Decision *&) const; + + std::string key( std::string ) const; + + template<class T> bool ancestorPassed( const TrigCompositeUtils::Decision*, const std::string trigger , const std::string key) const; + + template<class T> TrigCompositeUtils::LinkInfo<T> getFeature( const TrigCompositeUtils::Decision *, std::string trigger ) const; + template<class T> std::vector<TrigCompositeUtils::LinkInfo<T>> getFeatures( const TrigCompositeUtils::Decision *, std::string trigger ) const; + template<class T> std::vector<TrigCompositeUtils::LinkInfo<T>> getFeatures( const TrigCompositeUtils::Decision *, std::string trigger, std::string key ) const; + + + const xAOD::EmTauRoI* getL1Feature( const TrigCompositeUtils::Decision * ) const; + + + private: + + bool matchHLTElectron(const xAOD::Electron *,const std::string &, const TrigCompositeUtils::Decision *&) const; + bool matchHLTPhoton( const xAOD::Photon *,const std::string &, const TrigCompositeUtils::Decision *&) const; + bool matchHLTCalo( const xAOD::Egamma *,const std::string &, const TrigCompositeUtils::Decision *&) const; + bool matchL2Electron( const xAOD::Electron *,const std::string &, const TrigCompositeUtils::Decision *&) const; + bool matchL2Photon( const xAOD::Photon *,const std::string &, const TrigCompositeUtils::Decision *&) const; + bool matchL2Calo( const xAOD::Egamma *,const std::string &, const TrigCompositeUtils::Decision *&) const; + bool matchL1( const xAOD::Egamma *,const std::string &, const TrigCompositeUtils::Decision *&) const; + + template<class T> bool closestObject( const xAOD::Egamma *, const TrigCompositeUtils::Decision *&, std::string trigger, std::string key ) const; + + + inline double dR(const double eta1, const double phi1, const double eta2, const double phi2) const + { + double deta = std::abs(eta1 - eta2); + double dphi = std::abs(phi1 - phi2) < TMath::Pi() ? std::abs(phi1 - phi2) : 2*TMath::Pi() - std::abs(phi1 - phi2); + return sqrt(deta*deta + dphi*dphi); + }; + + + std::map<std::string,std::string> m_keys; + + ToolHandle<Trig::TrigDecisionTool> m_trigDecTool{this, "TriggerTool", ""}; + const ToolHandle<Trig::TrigDecisionTool>& tdt() const { return m_trigDecTool; }; + + Gaudi::Property<float> m_dR{this, "DeltaR", 0.07}; + Gaudi::Property<float> m_dRL1{this, "L1DeltaR", 0.15}; + SG::ReadHandleKey<xAOD::EmTauRoIContainer> m_emTauRoIKey{this, "EmTauRoIKey" , "LVL1EmTauRoIs", ""}; + +}; + + + + +#include "TrigEgammaMatchingToolMT.icc" + +#endif diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.icc b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.icc new file mode 100644 index 0000000000000000000000000000000000000000..288f5c0898ad6a3861ea984c5ea76658235b68df --- /dev/null +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.icc @@ -0,0 +1,207 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +using namespace TrigCompositeUtils; + + +// L2Calo, L2Electron, L2Photon, EFCalo, Electron and Photon trigger passed access +template<class T> +inline bool TrigEgammaMatchingToolMT::ancestorPassed( const TrigCompositeUtils::Decision *dec, const std::string trigger, const std::string key) const +{ + + if( !dec ) return false; + HLT::Identifier id(trigger); + auto initRoi = TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>( dec, "initialRoI"); + if( !initRoi.link.isValid() ) + return false; + + auto vec = tdt()->features< T >(trigger,TrigDefs::includeFailedDecisions ,key); + + for( auto &featLinkInfo : vec ) + { + auto roi = TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>(featLinkInfo.source, "initialRoI"); + if( ! roi.isValid()) continue; + if( (*roi.link)->roiWord() == (*initRoi.link)->roiWord()) + { + const auto *fDec = featLinkInfo.source; + return (std::find(fDec->decisions().begin(), fDec->decisions().end(), id.numeric()) != fDec->decisions().end()); + } + } + return false; +} + + +// L1Calo trigger passed access +template<> +inline bool TrigEgammaMatchingToolMT::ancestorPassed<TrigRoiDescriptorCollection>( const TrigCompositeUtils::Decision *dec, + const std::string trigger, const std::string /*key*/) const +{ + if( !dec ) return false; + HLT::Identifier id(trigger); + auto initRoi = TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>( dec, "initialRoI"); + if( !initRoi.link.isValid() ) + return false; + + auto vec = tdt()->features<TrigRoiDescriptorCollection>(trigger,TrigDefs::includeFailedDecisions,"", + TrigDefs::allFeaturesOfType,"initialRoI"); + + for( auto &featLinkInfo : vec ) + { + if( (*featLinkInfo.link)->roiWord() == (*initRoi.link)->roiWord()) + { + const auto *fDec = featLinkInfo.source; + return (std::find(fDec->decisions().begin(), fDec->decisions().end(), id.numeric()) != fDec->decisions().end()); + } + } + return false; +} + + + + +template<class T> +inline bool TrigEgammaMatchingToolMT::closestObject( const xAOD::Egamma *eg, const TrigCompositeUtils::Decision *&dec, std::string trigger, std::string key ) const +{ + double deltaR=0.; + auto vec = tdt()->features<T>(trigger,TrigDefs::includeFailedDecisions ,key); + for( auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + deltaR = dR(eg->eta(),eg->phi(), feat->eta(),feat->phi()); + if(deltaR < (float)m_dR){ + dec = featLinkInfo.source; + return true; + } + } + return false; +} + + +template<class T> +inline std::vector<LinkInfo<T>> TrigEgammaMatchingToolMT::getFeatures( const TrigCompositeUtils::Decision *dec , std::string trigger, std::string key) +const +{ + std::vector<LinkInfo<T>> vec; + auto initRoi = TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>(dec, "initialRoI"); + if( !initRoi.link.isValid() ) return vec; + + auto vec_dec = tdt()->features<T>(trigger, TrigDefs::includeFailedDecisions, key); + for ( auto& featLinkInfo : vec_dec ){ + if( !featLinkInfo.isValid() ) continue; + auto roi = TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>(featLinkInfo.source, "initialRoI"); + if( ! roi.isValid()) continue; + if( (*roi.link)->roiWord() == (*initRoi.link)->roiWord() ) + vec.push_back( featLinkInfo ); + } + return vec; +} + + +inline const xAOD::EmTauRoI* TrigEgammaMatchingToolMT::getL1Feature( const TrigCompositeUtils::Decision *dec ) const +{ + if( !dec ) return nullptr; + auto initRoi = TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>(dec, "initialRoI"); + if( !initRoi.link.isValid() ) return nullptr; + + SG::ReadHandle<xAOD::EmTauRoIContainer> l1_cont( m_emTauRoIKey, Gaudi::Hive::currentContext()); + if( !l1_cont.isValid() ) return nullptr; + + for( const auto *l1 : *l1_cont ){ + if ( l1->roiType() != xAOD::EmTauRoI::RoIType::EMRoIWord) continue; + if((*initRoi.link)->roiWord()==l1->roiWord()){ + return l1; + } + } + return nullptr; +} + + +// L1Calo +template<> +inline LinkInfo<TrigRoiDescriptorCollection> TrigEgammaMatchingToolMT::getFeature<TrigRoiDescriptorCollection>( const TrigCompositeUtils::Decision *dec , + std::string trigger) +const +{ + auto initRoi = TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>(dec, "initialRoI"); + if( initRoi.link.isValid() ){ + auto vec_dec = tdt()->features<TrigRoiDescriptorCollection>(trigger,TrigDefs::includeFailedDecisions,"", + TrigDefs::allFeaturesOfType,"initialRoI"); + for( auto &featLinkInfo: vec_dec ){ + if( !featLinkInfo.isValid() ) continue; + if( (*featLinkInfo.link)->roiWord() == (*initRoi.link)->roiWord() ) return featLinkInfo; + } + } + return LinkInfo<TrigRoiDescriptorCollection>(); +} + + +// L2Calo +template<> +inline LinkInfo<xAOD::TrigEMClusterContainer> TrigEgammaMatchingToolMT::getFeature<xAOD::TrigEMClusterContainer>( const TrigCompositeUtils::Decision *dec , + std::string trigger) +const +{ + std::vector<LinkInfo<xAOD::TrigEMClusterContainer>> vec = getFeatures<xAOD::TrigEMClusterContainer>(dec, trigger, key("L2Calo") ); + return !vec.empty() ? vec.front() : LinkInfo<xAOD::TrigEMClusterContainer>(); +} + + +// L2Electron +template<> +inline std::vector<LinkInfo<xAOD::TrigElectronContainer>> TrigEgammaMatchingToolMT::getFeatures<xAOD::TrigElectronContainer>( const TrigCompositeUtils::Decision *dec , + std::string trigger) +const +{ + return getFeatures<xAOD::TrigElectronContainer>(dec, trigger, key("L2Electron") ); +} + + +// L2Photon +template<> +inline std::vector<LinkInfo<xAOD::TrigPhotonContainer>> TrigEgammaMatchingToolMT::getFeatures<xAOD::TrigPhotonContainer>( const TrigCompositeUtils::Decision *dec , + std::string trigger) +const +{ + return getFeatures<xAOD::TrigPhotonContainer>(dec, trigger, key("L2Photon") ); +} + + +// EFCalo +template<> +inline std::vector<LinkInfo<xAOD::CaloClusterContainer>> TrigEgammaMatchingToolMT::getFeatures<xAOD::CaloClusterContainer>( const TrigCompositeUtils::Decision *dec , + std::string trigger) +const +{ + return getFeatures<xAOD::CaloClusterContainer>(dec, trigger, key("EFCalo") ); +} + + +// Electron +template<> +inline std::vector<LinkInfo<xAOD::ElectronContainer>> TrigEgammaMatchingToolMT::getFeatures<xAOD::ElectronContainer>( const TrigCompositeUtils::Decision *dec , + std::string trigger) +const +{ + return getFeatures<xAOD::ElectronContainer>(dec, trigger, key("Electron") ); +} + + +// Photon +template<> +inline std::vector<LinkInfo<xAOD::PhotonContainer>> TrigEgammaMatchingToolMT::getFeatures<xAOD::PhotonContainer>( const TrigCompositeUtils::Decision *dec , + std::string trigger) +const +{ + return getFeatures<xAOD::PhotonContainer>(dec, trigger, key("Photon") ); +} + + + + + + + + diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/share/job_match_test.py b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/share/job_match_test.py new file mode 100644 index 0000000000000000000000000000000000000000..4596816cbcbae6179069866e02e95be7c97d70af --- /dev/null +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/share/job_match_test.py @@ -0,0 +1,59 @@ +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +from RecExConfig.RecFlags import rec +from RecExConfig.RecAlgsFlags import recAlgs +from InDetRecExample.InDetJobProperties import InDetFlags +InDetFlags.doSecVertexFinder.set_Value_and_Lock(False) +from AthenaCommon.AppMgr import ToolSvc + +import os + +outputName = 'Validation_asdf' + + +athenaCommonFlags.FilesInput=['AOD.pool.root'] +athenaCommonFlags.EvtMax=100 +#athenaCommonFlags.EvtMax=-1 +rec.readAOD=True +# switch off detectors +rec.doForwardDet=False +rec.doInDet=False +rec.doCalo=False +rec.doMuon=False +rec.doEgamma=False +rec.doTrigger = True; recAlgs.doTrigger=False # disable trigger (maybe necessary if detectors switched off) +rec.doMuon=False +rec.doMuonCombined=False +rec.doWriteAOD=False +rec.doWriteESD=False +rec.doDPD=False +rec.doTruth=False + + +# autoconfiguration might trigger undesired feature +rec.doESD.set_Value_and_Lock(False) # uncomment if do not run ESD making algorithms +rec.doWriteESD.set_Value_and_Lock(False) # uncomment if do not write ESD +rec.doAOD.set_Value_and_Lock(False) # uncomment if do not run AOD making algorithms +rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if do not write AOD +rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if do not write TAG +# main jobOption +triggerList = [ + 'HLT_e5_etcut', + ] +include ("RecExCommon/RecExCommon_topOptions.py") +ToolSvc.TrigDecisionTool.TrigDecisionKey='xTrigDecision' +from AthenaCommon.AlgSequence import AlgSequence +theJob = AlgSequence() + +from TrigEgammaMatchingTool.TrigEgammaMatchingToolConf import Trig__TrigEgammaMatchingTool +matchtool = Trig__TrigEgammaMatchingTool("MatchingTool"); +from AthenaCommon.AppMgr import ToolSvc +ToolSvc += matchtool + +from TrigEgammaMatchingTool.TrigEgammaMatchingToolConf import Trig__TrigEgammaMatchingToolTest +alg = Trig__TrigEgammaMatchingToolTest() +alg.TrigEgammaMatchingTool = matchtool +alg.TriggerList = triggerList +alg.OutputLevel = DEBUG +theJob += alg + +include("TriggerTest/TriggerTestCommon.py") diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/TrigEgammaMatchingToolMTTest.cxx b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/TrigEgammaMatchingToolMTTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..10ce7107557bb96c545b782bba049cf115503831 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/TrigEgammaMatchingToolMTTest.cxx @@ -0,0 +1,155 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + + +#include "TrigEgammaMatchingToolMTTest.h" +#include "DecisionHandling/TrigCompositeUtils.h" + + + + +TrigEgammaMatchingToolMTTest::TrigEgammaMatchingToolMTTest(const std::string& name, ISvcLocator* pSvcLocator ) + : AthMonitorAlgorithm( name, pSvcLocator ), + m_trigdec("Trig::TrigDecisionTool/TrigDecisionTool"), + m_matchTool("Trig::TrigEgammaMatchingTool/TrigEgammaMatchingToolMT",this) + +{ + declareProperty("TrigEgammaMatchingToolMT",m_matchTool); + declareProperty("TriggerList",m_triggerList); +} + + + +//********************************************************************** + +StatusCode TrigEgammaMatchingToolMTTest::initialize() { + + ATH_MSG_INFO("Initializing " << name() << "..."); + + ATH_CHECK( m_trigdec.retrieve() ); + ATH_CHECK( m_matchTool.retrieve()); + ATH_CHECK(m_electronKey.initialize()); + + + + return StatusCode::SUCCESS; +} + + + +//********************************************************************** + +void TrigEgammaMatchingToolMTTest::inspect(const std::string trigger,const xAOD::Egamma *eg) const { + + if (eg) { + + ATH_MSG_INFO("Getting all associated objects for " << trigger); + + const TrigCompositeUtils::Decision *dec=nullptr; + + m_matchTool->match( eg, trigger , dec); + + if ( dec ) + { + ATH_MSG_INFO( "Matched!"); + + + auto l1_link = m_matchTool->getFeature<TrigRoiDescriptorCollection>(dec, trigger); + auto emCluster_link = m_matchTool->getFeature<xAOD::TrigEMClusterContainer>( dec , trigger); + auto trig_el_links = m_matchTool->getFeatures<xAOD::TrigElectronContainer>( dec, trigger ); + auto cl_links = m_matchTool->getFeatures<xAOD::CaloClusterContainer>( dec , trigger); + auto el_links = m_matchTool->getFeatures<xAOD::ElectronContainer>( dec , trigger); + + if( l1_link.isValid() ){ + ATH_MSG_INFO( "We found the Roi object link" ); + // Let's get the EMTau + auto l1 = m_matchTool->getL1Feature( l1_link.source ); + if(l1) + ATH_MSG_INFO( "We found the EmTau object" ); + ATH_MSG_INFO( "L1 object state is assigned as " << (l1_link.state==ActiveState::ACTIVE ? "Active" : "Not active") ); + } + + if( emCluster_link.isValid() ){ + ATH_MSG_INFO( "We found the EmCluster object link" ); + ATH_MSG_INFO( "L2Calo object state is assigned as " << (emCluster_link.state==ActiveState::ACTIVE ? "Active" : "Not active") ); + } + + if (trig_el_links.size() > 0){ + ATH_MSG_INFO ( "We found " << trig_el_links.size() << " TrigElectron link objects for this decision souce." ); + for ( auto featLinkInfo : trig_el_links ){ + ATH_MSG_INFO( "L2Electron object state is assigned as " << (featLinkInfo.state==ActiveState::ACTIVE ? "Active" : "Not active") ); + } + } + + if (cl_links.size() > 0){ + ATH_MSG_INFO ( "We found " << cl_links.size() << " CaloCluster link objects for this decision souce." ); + for ( auto featLinkInfo : cl_links ){ + ATH_MSG_INFO( "EFCalo object state is assigned as " << (featLinkInfo.state==ActiveState::ACTIVE ? "Active" : "Not active") ); + } + } + + if (el_links.size() > 0){ + ATH_MSG_INFO ( "We found " << el_links.size() << " CaloCluster link objects for this decision souce." ); + for ( auto featLinkInfo : el_links ){ + ATH_MSG_INFO( "EFCalo object state is assigned as " << (featLinkInfo.state==ActiveState::ACTIVE ? "Active" : "Not active") ); + } + } + + + bool passedHLT = m_matchTool->ancestorPassed<xAOD::ElectronContainer> (dec, trigger , "HLT_egamma_Electrons"); + bool passedEFCalo = m_matchTool->ancestorPassed<xAOD::CaloClusterContainer> (dec, trigger , "HLT_CaloEMClusters"); + bool passedL2 = m_matchTool->ancestorPassed<xAOD::TrigElectronContainer> (dec, trigger , "HLT_L2Electrons"); + bool passedL2Calo = m_matchTool->ancestorPassed<xAOD::TrigEMClusterContainer> (dec, trigger , "HLT_L2CaloEMClusters"); + bool passedL1Calo = m_matchTool->ancestorPassed<TrigRoiDescriptorCollection> (dec, trigger , "initialRois"); + + ATH_MSG_INFO( "L1Calo passed : "<< passedL1Calo ); + ATH_MSG_INFO( "L2Calo passed : "<< passedL2Calo ); + ATH_MSG_INFO( "L2 passed : "<< passedL2 ); + ATH_MSG_INFO( "EFCalo passed : "<< passedEFCalo ); + ATH_MSG_INFO( "HLT passed : "<< passedHLT ); + + }else{ + ATH_MSG_INFO( "Not Matched! There is no Dec object for this trigger " << trigger ); + } + + } + else ATH_MSG_INFO("REGTEST: eg pointer null!"); +} + + +//********************************************************************** + +StatusCode TrigEgammaMatchingToolMTTest::fillHistograms( const EventContext& ctx ) const { + + ATH_MSG_INFO ("Fill histograms " << name() << "..."); + + + SG::ReadHandle<xAOD::ElectronContainer> el_cont(m_electronKey, ctx); + + if( !el_cont.isValid() ){ + ATH_MSG_WARNING("Container "<< m_electronKey << " does not exist or is empty"); + return StatusCode::SUCCESS; + } + + + ATH_MSG_INFO("Offline Electron container size " << el_cont->size()); + + for(const auto &trigger : m_triggerList){ + for(const auto& eg : *el_cont){ + ATH_MSG_INFO("REGTEST:: Electron offline (eta="<<eg->eta()<<",phi="<<eg->phi()<<")"); + inspect(trigger,eg); + + } //End loop of offline electrons + } // End loop over trigger list + + + + return StatusCode::SUCCESS; +} // End execute + + + + + + diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/TrigEgammaMatchingToolMTTest.h b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/TrigEgammaMatchingToolMTTest.h new file mode 100644 index 0000000000000000000000000000000000000000..341b9c54133546f05d36efe8103fa52023876594 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/TrigEgammaMatchingToolMTTest.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef TrigEgammaMatchingToolMTTest_H +#define TrigEgammaMatchingToolMTTest_H + + +#include "TrigDecisionTool/TrigDecisionTool.h" +#include "TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h" +#include "xAODEgamma/ElectronContainer.h" +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" +#include <vector> +#include <string> + + +class TrigEgammaMatchingToolMTTest : public AthMonitorAlgorithm { + public: + + TrigEgammaMatchingToolMTTest( const std::string& name, ISvcLocator* pSvcLocator ); + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + private: + + + void inspect(const std::string, const xAOD::Egamma *) const ; + + SG::ReadHandleKey<xAOD::ElectronContainer> m_electronKey{this , "ElectronKey", "Electrons", ""}; + + ToolHandle<Trig::TrigDecisionTool> m_trigdec; + ToolHandle<TrigEgammaMatchingToolMT> m_matchTool; + + + std::vector<std::string> m_triggerList; +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/components/TrigEgammaMatchingTool_entries.cxx b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/components/TrigEgammaMatchingTool_entries.cxx index c0b951dcd651f8096b91932670e44430a0f3b6d2..589c376d1b11506f57cdffce4a37bf2c3d80a274 100644 --- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/components/TrigEgammaMatchingTool_entries.cxx +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/src/components/TrigEgammaMatchingTool_entries.cxx @@ -1,6 +1,10 @@ #include "TrigEgammaMatchingTool/TrigEgammaMatchingTool.h" +#include "TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h" #include "../TrigEgammaMatchingToolTest.h" +#include "../TrigEgammaMatchingToolMTTest.h" DECLARE_COMPONENT( Trig::TrigEgammaMatchingTool ) +DECLARE_COMPONENT( TrigEgammaMatchingToolMT ) DECLARE_COMPONENT( Trig::TrigEgammaMatchingToolTest ) +DECLARE_COMPONENT( TrigEgammaMatchingToolMTTest ) diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/CMakeLists.txt b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/CMakeLists.txt index 0467867563076616635506f23913958a7d6df949..82799a859452e5b8a637db4a0c109d8c679a3f7f 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/CMakeLists.txt @@ -11,6 +11,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventInfo Event/xAOD/xAODEventInfo Generators/GeneratorObjects + Generators/AtlasHepMC InnerDetector/InDetConditions/InDetBeamSpotService PhysicsAnalysis/TruthParticleID/McParticleEvent Reconstruction/MuonIdentification/muonEvent @@ -29,24 +30,24 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkTrack - Trigger/TrigSteer/TrigCompositeUtils ) + Trigger/TrigSteer/TrigCompositeUtils + ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_library( TrigInDetAnalysisExampleLib src/*.cxx PUBLIC_HEADERS TrigInDetAnalysisExample - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} EventInfo GeneratorObjects McParticleEvent muonEvent egammaEvent tauEvent VxVertex TrigInDetAnalysis TrigInDetAnalysisUtils TrigInDetEvent TrigSteeringEvent TrigDecisionToolLib TrigHLTMonitoringLib AthenaMonitoringLib TrigCompositeUtilsLib + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib EventInfo GeneratorObjects McParticleEvent muonEvent egammaEvent tauEvent VxVertex TrigInDetAnalysis TrigInDetAnalysisUtils TrigInDetEvent TrigSteeringEvent TrigDecisionToolLib TrigHLTMonitoringLib AthenaMonitoringLib TrigCompositeUtilsLib PRIVATE_LINK_LIBRARIES GaudiKernel TrkParameters TrkTrack ) atlas_add_component( TrigInDetAnalysisExample src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} EventInfo GeneratorObjects McParticleEvent muonEvent egammaEvent tauEvent VxVertex TrigDecisionToolLib TrigInDetAnalysis TrigInDetAnalysisUtils TrigInDetEvent TrigSteeringEvent TrigHLTMonitoringLib AthenaMonitoringLib GaudiKernel TrkParameters TrkTrack TrigInDetAnalysisExampleLib ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib EventInfo GeneratorObjects McParticleEvent muonEvent egammaEvent tauEvent VxVertex TrigDecisionToolLib TrigInDetAnalysis TrigInDetAnalysisUtils TrigInDetEvent TrigSteeringEvent TrigHLTMonitoringLib AthenaMonitoringLib GaudiKernel TrkParameters TrkTrack TrigInDetAnalysisExampleLib ) # Disable naming convention checker. # FIXME: This should be fixed properly once run2 is finished. diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h index d89c8f4a9877fe244b11f636a083c3aed5a59dc0..f38a8b025d7618db130d77772fc6ad1d7898bd1f 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h @@ -43,9 +43,9 @@ #include "McParticleEvent/TruthParticleContainer.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfig_Tier0.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfig_Tier0.h index ae2167634553412ef9bc93a4ac6111f10f7910a2..99c320e463a8c360d24cd021a1adf2d738468376 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfig_Tier0.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfig_Tier0.h @@ -43,9 +43,9 @@ #include "McParticleEvent/TruthParticleContainer.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx index e9a4044c3860970b02fadf1a491a372e4d94749e..78e4c0989100e83197bfd1530cea343fc2778be7 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx @@ -15,9 +15,9 @@ #include "McParticleEvent/TruthParticleContainer.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "EventInfo/EventInfo.h" diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx index ba9f98daacd172dc835c8d6de57464173e7f1138..93bd37dba24e51135de85c98177aa875f6a64720 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx @@ -4,7 +4,7 @@ ** @author mark sutton ** @date Fri 12 Oct 2012 13:39:05 BST ** - ** Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + ** Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration **/ @@ -52,11 +52,21 @@ bool fulldbg = false; +/// global typedef here is ok, since this is a standalone +/// executable, including a main(). As such it does not need +/// to be in a namespace at this point as it won't in any +/// case be visible outside this translation unit + +typedef std::map<std::string,std::string> chainmap_t; + + /// get a histogram given a path, and an optional initial directory -/// if histogram is not found, then check for dir/name +/// if histogram is not found, then check for dir/name, +/// allows optional remapping of the reference chain information template<typename T=TH1F> -T* Get( TFile& f, const std::string& n, const std::string& dir="", std::vector<std::string>* saved=0 ) { +T* Get( TFile& f, const std::string& n, const std::string& dir="", + const chainmap_t* chainmap=0, std::vector<std::string>* saved=0 ) { std::string name; @@ -66,18 +76,30 @@ T* Get( TFile& f, const std::string& n, const std::string& dir="", std::vector<s T* h = (T*)f.Get( name.c_str() ); if ( h || dir=="" || name.find(dir)!=std::string::npos ) { - std::cout << "Get() name " << name << " :: " << h << std::endl; - if ( saved ) saved->push_back( name ); + std::cout << "Get() name 0 " << name << " :: " << h << std::endl; } else { - h = (T*)f.Get( (dir+"/"+name).c_str() ); - std::cout << "Get() name " << (dir+"/"+name) << " :: " << h << std::endl; - if ( saved ) { - if ( h ) saved->push_back( dir+"/"+name ); - else saved->push_back( name ); - } + name = dir+"/"+name; + h = (T*)f.Get( name.c_str() ); + std::cout << "Get() name 1 " << name << " :: " << h << std::endl; } + + if ( h == 0 ) { + if ( chainmap && chainmap->size()!=0 ) { + for ( chainmap_t::const_iterator itr=chainmap->begin() ; itr!=chainmap->end() ; itr++ ) { + if ( contains( name, itr->first ) ) { + std::cout << "\tmatch: " << itr->first << " -> " << itr->second << std::endl; + name.replace( name.find(itr->first), itr->first.size(), itr->second ); + h = (T*)f.Get( name.c_str() ); + break; + } + } + } + } + + if ( saved ) saved->push_back( name ); + if ( h ) h->SetDirectory(0); return h; @@ -116,6 +138,8 @@ int usage(const std::string& name, int status, const std::string& err_msg="" ) { s << " -al, --atlaslable value \t set value for atlas label\n"; s << " -ac, --addchains \t if possible, add chain names histogram labels \n\n"; + s << " -m, --mapfile \t remap file for reference histograms \n\n"; + s << " -rc, --refchains values ..\t allow different reference chains for comparison\n"; s << " -s, --swap pattern regex \t swap \"pattern\" in the reference chains name by \"regex\"\n"; s << " -nr, --noref \t do not plot reference histograms\n"; @@ -191,8 +215,6 @@ void zero( TH2* h ) { for ( int i=1 ; i<=Nx ; i++ ) { for ( int j=1 ; j<=Ny ; j++ ) { if ( h->GetBinContent( i, j )==0 ) { - // h->SetBinContent( h->FindBin( i, j ), 1e-10 ); - // h->SetBinError( h->FindBin( i, j ), 1e-10 ); h->SetBinContent( i, j, 1e-10 ); h->SetBinError( i, j, 1e-10 ); } @@ -298,6 +320,8 @@ int main(int argc, char** argv) { bool addingrefchains = false; + std::string mapfile = ""; + int ncols = 2; @@ -342,6 +366,10 @@ int main(int argc, char** argv) { if ( ++i<argc ) key=argv[i]; else return usage(argv[0], -1, "no key provided"); } + else if ( arg=="-m" || arg=="--mapfile" ) { + if ( ++i<argc ) mapfile=argv[i]; + else return usage(argv[0], -1, "no mapfile provided"); + } else if ( arg=="-d" || arg=="--dir" ) { if ( ++i<argc ) dir=argv[i]; else return usage(argv[0], -1, "no directory provided"); @@ -573,7 +601,7 @@ int main(int argc, char** argv) { std::cout << "Chains: " << std::endl; for ( unsigned ic=0 ; ic<chains.size() ; ic++ ) std::cout << "\t" << chains[ic] << std::endl; - if ( usrlabels.size()>0 ) std::cout << "labels " << usrlabels << std::endl; + if ( usrlabels.size()>0 ) std::cout << "labels: " << usrlabels << std::endl; if ( usrlabels.size()>0 && usrlabels.size()==chains.size() ) uselabels = true; @@ -681,11 +709,6 @@ int main(int argc, char** argv) { } - // std::vector<std::string> chainnames; - - // chainnames.resize(chains.size(),""); - // chainnames.clear(); - /// we divide the resolutions by these /// values if we have an "entries" histogram /// to tell us how many events there are @@ -713,6 +736,30 @@ int main(int argc, char** argv) { NeventRef = 1; } + chainmap_t* chainmap = nullptr; + + if ( mapfile == "" ) mapfile = configfile; + + if ( mapfile != "" ) { + + ReadCards m( mapfile ); + + if ( m.isTagDefined( "ChainMap" ) ) { + std::vector<std::string> chains = m.GetStringVector( "ChainMap" ); + + chainmap = new chainmap_t(); + + for ( size_t i=0 ; i<chains.size() ; i+=2 ) { + chainmap->insert( chainmap_t::value_type( chains[i], chains[i+1] ) ); + } + + for ( chainmap_t::iterator itr=chainmap->begin() ; itr!=chainmap->end() ; itr++ ) { + std::cout << "\t" << itr->first << "\t" << itr->second << std::endl; + } + } + } + + /// set up the correct reference chain names ... @@ -724,8 +771,7 @@ int main(int argc, char** argv) { /// the Chain histogram if present std::cout << "chain: " << chains[j] << "\taddchains: " << addchains << std::endl; - // std::cout << "chainref: " << chainref[j] << " - original" << std::endl; - + if ( addchains && ( contains(chains[j],"Shifter") || ( !contains(chains[j],"HLT_") && !contains(chains[j], "Fullscan" ) ) ) ) { TH1F* hchain = Get( ftest, chains[j]+"/Chain", testrun ); @@ -806,10 +852,12 @@ int main(int argc, char** argv) { } + std::cout << "searching for panels" << std::endl; + /// read in the panel descriptions - if ( rc.isTagDefined( "panels" ) ) { - + if ( rc.isTagDefined( "panels" ) ) { + std::vector<std::string> panel_config = rc.GetStringVector( "panels" ); for ( size_t ipanel=panel_config.size() ; ipanel-- ; ) { @@ -836,6 +884,7 @@ int main(int argc, char** argv) { } else { + std::cout << "using default panels" << std::endl; /// use the default values as single histogram panels @@ -993,11 +1042,6 @@ int main(int argc, char** argv) { Plots plots; plots.clear(); - - // TCanvas* c1 = new TCanvas(label("canvas-%d",i).c_str(),"histogram",800,600); - // c1->cd(); - - double xpos = 0.18; double ypos = 0.93; @@ -1033,6 +1077,9 @@ int main(int argc, char** argv) { ypositions.push_back( yhi - deltay*(ilines+0.5) ); } + + /// leave these comments as useful for debugging ... + // bool residual = false; // if ( contains(histo.name(),"_res") || contains(histo.name(),"residual_") || contains(histo.name(),"1d") ) residual = true; @@ -1067,7 +1114,7 @@ int main(int argc, char** argv) { bool power_set = false; - + /// leave these comments here for testing ... // bool uselogx = xinfo.log(); // bool uselogy = yinfo.log(); @@ -1104,8 +1151,6 @@ int main(int argc, char** argv) { bool bmean = false; if ( contains(histo.name(),"/mean") ) bmean = true; - // std::cout << "\trefitting: " << histos[i] << std::endl; - Resplot::setoldrms95(oldrms); Resplot::setscalerms95(true); @@ -1115,13 +1160,8 @@ int main(int argc, char** argv) { if ( bsigma ) base = chop( tmp_, "/sigma" ); if ( bmean ) base = chop( tmp_, "/mean" ); - // TH2D* _htest2d = (TH2D*)ftest.Get((chains[j]+"/"+base+"/2d").c_str()) ; - // TH2D* _href2d = (TH2D*)ftest.Get((refchain[j]+"/"+base+"/2d").c_str()) ; - - // savedhistos.push_back( chains[j]+"/"+base+"/2d" ); - - TH2D* _htest2d = Get<TH2D>( ftest, chains[j]+"/"+base+"/2d", testrun, &savedhistos ); - TH2D* _href2d = Get<TH2D>( ftest, refchain[j]+"/"+base+"/2d", testrun ); + TH2D* _htest2d = Get<TH2D>( ftest, chains[j]+"/"+base+"/2d", testrun, 0, &savedhistos ); + TH2D* _href2d = Get<TH2D>( ftest, refchain[j]+"/"+base+"/2d", testrun ); if ( _htest2d==0 ) continue; if ( !noreftmp && _href2d==0 ) noreftmp = true; @@ -1129,10 +1169,8 @@ int main(int argc, char** argv) { /// get the test histogram - // std::cout << "test " << _htest2d << std::endl; Resplot rtest("tmp", _htest2d); - // if ( contains(histos[i],"npix") || contains(histos[i],"nsct") ) rtest.Finalise(Resplot::FitNull); - // else rtest.Finalise(Resplot::FitNull95); + if ( rtest.finalised() ) { if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") || contains(histo.name(),"nsi") || contains(histo.name(),"nbl") ) rtest.Refit(Resplot::FitNull); else rtest.Refit(Resplot::FitNull95); @@ -1151,27 +1189,23 @@ int main(int argc, char** argv) { } - /// Actually D) refit the references - if we are adding together many + /// Actually Do refit the references - if we are adding together many /// resplots, then the means etc may not even have been calculated /// /// NB: DON'T Refit the reference, since only the central values /// are plotted - // std::cout << "ref " << _href2d << std::endl; + // std::cout << "ref " << _href2d << std::endl; // Resplot rref("tmp", _href2d); // rref.Finalise(Resplot::FitNull95); // href = (TH1F*)rref.Sigma()->Clone("rref_sigma"); href->SetDirectory(0); /// still get the reference histo - // href = (TH1F*)fref.Get((chains[j]+"/"+histos[i]).c_str()) ; - - // TH1F* hreft = (TH1F*)fref.Get( (refchain[j]+"/"+histos[i]).c_str() ); - TH1F* hreft = 0; if ( !noreftmp ) { if ( refitref_resplots ) { - // std::cout << "test " << _htest2d << std::endl; + Resplot rref("tmp", _href2d); if ( rref.finalised() ) { @@ -1188,7 +1222,7 @@ int main(int argc, char** argv) { } else { - hreft = Get( fref, refchain[j]+"/"+histo.name(), rawrefrun ); + hreft = Get( fref, refchain[j]+"/"+histo.name(), rawrefrun, chainmap ); } } @@ -1202,8 +1236,9 @@ int main(int argc, char** argv) { href = (TH1F*)hreft->Clone(); href->SetDirectory(0); } - - // std::cout << "\tget " << (refchain[j]+"/"+histos[i]) << "\t" << href << std::endl; + + /// useful test for debugging ... + // std::cout << "\tget " << (refchain[j]+"/"+histos[i]) << "\t" << href << std::endl; savedhistos.push_back( refchain[j]+"/"+histo.name() ); @@ -1218,27 +1253,16 @@ int main(int argc, char** argv) { std::cout << "hist: " << (chains[j]+"/"+reghist) << std::endl; - htest = Get( ftest, chains[j]+"/"+reghist, testrun, &savedhistos ); + htest = Get( ftest, chains[j]+"/"+reghist, testrun, 0, &savedhistos ); - // htest = (TH1F*)ftest.Get((chains[j]+"/"+reghist).c_str(), &savedhistos ) ; - // savedhistos.push_back( chains[j]+"/"+reghist ); - - // if ( htest==0 ) { - // htest = (TH1F*)ftest.Get((testrun+"/"+chains[j]+"/"+reghist).c_str()) ; - // savedhistos.push_back( testrun+"/"+chains[j]+"/"+reghist ); - // } if ( htest==0 ) { if ( htest==0 ) std::cerr << "missing histogram: " << (chains[j]+" / "+reghist) << " " << htest<< std::endl; continue; } + TH1F* hreft = Get( fref, refchain[j]+"/"+reghist, rawrefrun, chainmap ); - TH1F* hreft = Get( fref, refchain[j]+"/"+reghist, rawrefrun ); - - // TH1F* hreft = Get( fref, refchain+"/"+reghist, rawrefrun ); - // TH1F* hreft = (TH1F*)fref.Get((refchain+"/"+reghist).c_str()) ; - if ( std::string(htest->ClassName()).find("TH2")!=std::string::npos ) { std::cout << "Class TH2: " << htest->GetName() << std::endl; continue; @@ -1254,14 +1278,12 @@ int main(int argc, char** argv) { if ( !noreftmp && hreft==0 ) { - if ( hreft==0 ) std::cerr << "missing histogram: " << (refchain[j]+" / "+reghist) << " " << hreft << std::endl; + if ( hreft==0 ) std::cerr << "missing histogram: " << (refchain[j]+" / "+reghist) + << " " << hreft << std::endl; noreftmp = true; Plotter::setplotref(false); } - if ( fulldbg ) std::cout << "htest: " << htest << std::endl; - if ( fulldbg ) std::cout << "hreft: " << hreft << std::endl; - if ( hreft!=0 ) { href = (TH1F*)hreft->Clone(); href->SetDirectory(0); @@ -1309,27 +1331,20 @@ int main(int argc, char** argv) { if ( make_ref_efficiencies ) { if ( htest && href ) { - // std::cout << "contains _eff " << contains( std::string(htest->GetName()), "eff" ) << std::endl; + /// deugging ... + // std::cout << "contains _eff " << contains( std::string(htest->GetName()), "eff" ) << std::endl; if ( contains( std::string(htest->GetName()), "_eff" ) ) { htestnum = Get( ftest, chains[j]+"/"+histo.name()+"_n", testrun ); - // htestnum = (TH1F*)ftest.Get((chains[j]+"/"+histo.name()+"_n").c_str()) ; - TH1F* hrefnumt = Get( fref, refchain[j]+"/"+histo.name()+"_n", rawrefrun, &savedhistos ); - - // TH1F* hrefnumt = (TH1F*)fref.Get((refchain+"/"+histo.name()+"_n").c_str()) ; - // savedhistos.push_back( refchain+"/"+histo.name()+"_n" ); - + TH1F* hrefnumt = Get( fref, refchain[j]+"/"+histo.name()+"_n", rawrefrun, chainmap, &savedhistos ); if ( !noreftmp && hrefnumt!=0 ) { hrefnum = (TH1F*)hrefnumt->Clone(); hrefnum->SetDirectory(0); } - - // std::cout << "numerator histos " << htestnum << " " << hrefnum << std::endl; - } } } @@ -1339,23 +1354,16 @@ int main(int argc, char** argv) { if ( htest && contains( std::string(htest->GetName()), "eff" ) ) { - // delete htest; - - // htestnum = (TH1F*)ftest.Get((chains[j]+"/"+histo.name()+"_n").c_str()) ; - // htestden = (TH1F*)ftest.Get((chains[j]+"/"+histo.name()+"_d").c_str()) ; - - // savedhistos.push_back( chains[j]+"/"+histo.name()+"_n" ); - // savedhistos.push_back( chains[j]+"/"+histo.name()+"_d" ); - - - htestnum = Get( ftest, chains[j]+"/"+histo.name()+"_n", testrun, &savedhistos ) ; - htestden = Get( ftest, chains[j]+"/"+histo.name()+"_d", testrun, &savedhistos ) ; + htestnum = Get( ftest, chains[j]+"/"+histo.name()+"_n", testrun, 0, &savedhistos ) ; + htestden = Get( ftest, chains[j]+"/"+histo.name()+"_d", testrun, 0, &savedhistos ) ; std::cout << "Bayesian error calculation " << htestnum << " " << htestden << "\tscale " << scale_eff << std::endl; if ( htestnum && htestden ) { #if 0 + /// need this for lumi block histograms - although not always needed, so + /// excluded to prevent problems most of the time ... if ( contains( htest->GetName(), "_vs_lb" ) ) { std::cout << "rebin " << histo.name() << std::endl; htestnum->Rebin(3); @@ -1382,21 +1390,18 @@ int main(int argc, char** argv) { if ( href ) { - // delete htest; - std::cout << "doin ..." << std::endl; - // TH1F* hrefnum = (TH1F*)fref.Get((refchain+"/"+histo.name()+"_n").c_str()) ; - // TH1F* hrefden = (TH1F*)fref.Get((refchain+"/"+histo.name()+"_d").c_str()) ; - TH1F* hrefnum = Get( fref, refchain[j]+"/"+histo.name()+"_n", rawrefrun ); - TH1F* hrefden = Get( fref, refchain[j]+"/"+histo.name()+"_d", rawrefrun ); + TH1F* hrefnum = Get( fref, refchain[j]+"/"+histo.name()+"_n", rawrefrun, chainmap ); + TH1F* hrefden = Get( fref, refchain[j]+"/"+histo.name()+"_d", rawrefrun, chainmap ); std::cout << "Bayesian error calculation " << htestnum << " " << htestden << "\tscale " << scale_eff << std::endl; std::cout << "Bayesian error calculation " << hrefnum << " " << hrefden << "\tscale " << scale_eff_ref << std::endl; if ( hrefnum && hrefden ) { Efficiency e( hrefnum, hrefden, "", scale_eff_ref ); - // tgref = e.Bayes(scale_eff); + /// leave for documentation purposes ... + // tgref = e.Bayes(scale_eff); href = e.Hist(); @@ -1441,8 +1446,6 @@ int main(int argc, char** argv) { href->Rebin(2); href->Sumw2(); } - // htest->Scale(1./NeventTest); - // href->Scale(1./NeventRef); } #endif @@ -1515,9 +1518,9 @@ int main(int argc, char** argv) { if ( actual_chain.find("_boffperf")!=std::string::npos ) actual_chain.erase( actual_chain.find("_boffperf"), 9 ); if ( collection.find("_IDTrkNoCut")!=std::string::npos ) collection.erase( collection.find("_IDTrkNoCut"), 11 ); if ( collection.find("xAODCnv")!=std::string::npos ) collection.erase( collection.find("xAODCnv"), 7 ); + if ( collection.find("HLT_IDTrack")!=std::string::npos ) collection.erase( collection.find("HLT_IDTrack"), 7 ); if ( collection.find("Tracking")!=std::string::npos ) collection.replace( collection.find("Tracking"), 8, "Trk" ); if ( collection.find("InDetTrigTrk_")!=std::string::npos ) collection.erase( collection.find("InDetTrigTrk_"), 13 ); - if ( collection.find("FTK_Track")==std::string::npos ) replace( collection, "_Tr", " : " ); std::string c = actual_chain + " : " + collection; @@ -1798,6 +1801,7 @@ int main(int argc, char** argv) { if ( fulldbg ) std::cout << __LINE__ << std::endl; + // more useful debugging ... // std::cout << "yauto: " << yinfo.autoset() << "\tyrange " << yinfo.rangeset() << std::endl; // std::cout << "yminset " << yminset << "\tymaxset " << ymaxset << std::endl; @@ -1841,9 +1845,6 @@ int main(int argc, char** argv) { if ( fulldbg ) std::cout << __LINE__ << std::endl; - /// if ( contains(histo.name(),"_res")) plots.xrange(true); - // if ( contains(histo.name(),"_res") ) plots.MaxScale( 100 ); - // plots.limits(); /// actually draw the plot here ... @@ -1854,16 +1855,12 @@ int main(int argc, char** argv) { if ( fulldbg ) if ( fulldbg ) std::cout << __LINE__ << std::endl; - // if ( atlasstyle ) ATLASLabel( xpos, ypositions[0]+deltay, atlaslabel.c_str() ); - if ( atlasstyle ) ATLASLabel( xpos, ypositions[0]+deltay, atlaslabel.c_str(), kBlack, ncolsp, nrowsp ); if ( fulldbg ) if ( fulldbg ) std::cout << __LINE__ << std::endl; for ( unsigned it=0 ; it<taglabels.size() ; it++ ) { - // std::cout << "\ttaglabel " << ypositions[it] << "\t(" << histo.name() << ")" << std::endl; DrawLabel( xpos, ypositions[it], taglabels[it], kBlack, 0.04 ); - } } @@ -1889,7 +1886,6 @@ int main(int argc, char** argv) { if ( j<Mean.size() ) { if ( !nomeans ) DrawLabel( 0.62, (0.57-j*0.035), Mean[j], colours[j%6] ); DrawLabel( 0.62, (0.57-0.035*chains.size()-j*0.035)-0.01, RMS[j], colours[j%6] ); - // std::cout << "\tdraw stats " << histo.name() << "\tMean " << Mean[j] << std::endl; } } } @@ -1979,7 +1975,6 @@ int main(int argc, char** argv) { std::cout << "main() cleaning up reference file" << std::endl; - // TFile* newout = new TFile(".newout.root","recreate"); TFile* newout = new TFile(".newout.root","recreate"); newout->cd(); @@ -1989,7 +1984,8 @@ int main(int argc, char** argv) { TDirectory* base = gDirectory; for ( unsigned i=0 ; i<savedhistos.size() ; i++ ) { - + + /// debugging ... // std::cout << i << " " << savedhistos[i] << std::endl; std::vector<std::string> dirs = AxisInfo::split( savedhistos[i], "/" ); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.h index 8f33ff7975d0ba73bb1f85a863b8914cff680dc4..eb22d8c1f774ef5182734c6b11c0b5c8db5b5106 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.h @@ -1,1010 +1,1010 @@ -/* emacs: this is -*- c++ -*- */ -/** - ** @file computils.h - ** - ** @author mark sutton - ** @date Sat Aug 30 2014 14:38:03 CEST - ** - ** Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - **/ - -#ifndef COMPUTILS_H -#define COMPUTILS_H - -#include <iostream> -#include <string> -#include <vector> -#include <cstdio> -#include <cstdlib> -#include <exception> - -#include "label.h" -#include "utils.h" -#include "DrawLabel.h" - - -#include "TStyle.h" -#include "TPad.h" -#include "TH1D.h" -#include "TFile.h" -#include "TH1.h" -#include "TGraphAsymmErrors.h" - -#include "TLegend.h" -#include "TrigInDetAnalysis/Efficiency.h" - -void ATLASFORAPP_LABEL( double x, double y, int color, double size=0.06 ); - -void myText( Double_t x, Double_t y, Color_t color, const std::string& text, Double_t tsize); - - -/// return the current data and time -std::string stime(); -static std::string release; - -double integral( TH1* h ); - -void Norm( TH1* h, double scale=1 ); - -double Entries( TH1* h ); - -/// does a string contain the substring -bool contains( const std::string& s, const std::string& p); - -/// does a string contain the substring at the beginning of the string -bool fcontains( const std::string& s, const std::string& p); - -/// does a file exist -bool exists( const std::string& filename ); - -/// tail of a string -std::string tail( std::string s, const std::string& pattern ); - -/// match a file name -std::string globbed( const std::string& s ); - -void contents( std::vector<std::string>& keys, - TDirectory* td, - const std::string& directory="", - const std::string& pattern="", - const std::string& path="" ); - -double realmax( TH1* h, bool include_error=true, double lo=0, double hi=0 ); -double realmin( TH1* h, bool include_error=true, double lo=0, double hi=0 ); - -std::string findcell( std::string name, const std::string regex, const std::string splitex="/" ); - -std::string findrun( TFile *f ); - -double plotable( TH1* h ); // , double xlo=-999, double xhi=-999 ); - - - -template<typename T> -std::ostream& operator<<( std::ostream& s, std::vector<T>& v) { - for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\t" << v[i]; - return s; -} - - -/// automatically set the xrange on a histogram -std::vector<int> findxrange(TH1* h, bool symmetric=false ); -std::vector<double> findxrangeuser(TH1* h, bool symmetric=false ); - - -void xrange(TH1* h, bool symmetric=true ); - -/// copy the TTree of release info from one directory to another -void copyReleaseInfo( TFile* finput, TFile* foutdir ); - - -/// class to store information about axes, limits, whether it is -/// log or linear scale etc - -class AxisInfo { - -public: - - AxisInfo( const std::string& s ) : - m_info(s), - m_log(false), - m_autoset(false), - m_symmetric(false), - m_rangeset(false), - m_lo(0), - m_hi(0), - m_norm(false), - m_refnorm(false), - m_binwidth(false) - { - // std::cout << "AxisInfo::info" << m_info << std::endl; - - std::vector<std::string> keys = split( s, ":" ); - - // std::cout << "\n\n" << s << "\nnkeys " << keys.size() << std::endl; - - if ( keys.size()>0 ) m_tag = keys[0]; - - bool minset = false; - // bool maxset = false; - - for ( size_t i=1 ; i<keys.size() ; i++ ) { - - if ( keys[i]=="lin" ) m_log = false; - else if ( keys[i]=="log" ) m_log = true; - else if ( keys[i]=="sym" ) m_symmetric = true; - else if ( keys[i]=="norm" ) m_norm = true; - else if ( keys[i]=="refn" ) m_refnorm = true; - else if ( keys[i]=="width" ) m_binwidth = true; - else if ( keys[i]=="auto" ) m_autoset = true; - else if ( keys[i]=="auton" ) { - m_autoset = true; - m_norm = true; - } - else if ( keys[i]=="autow" ) { - m_autoset = true; - m_binwidth = true; - } - else if ( keys[i]=="autown" || keys[i]=="autonw" ) { - m_autoset = true; - m_norm = true; - m_binwidth = true; - } - else if ( keys[i]=="autosym" ) { - m_autoset = true; - m_symmetric = true; - } - else if ( keys[i]=="normw" || keys[i]=="widthn" ) { - m_norm = true; - m_binwidth = true; - } - else if ( !minset ) { - m_lo = std::atof(keys[i].c_str()); - i++; - if ( i<keys.size() ) m_hi = std::atof(keys[i].c_str()); - else { - std::cerr << "not enough values for the axis range: " << s << std::endl; - std::exit(-1); - } - minset = true; - // maxset = true; - m_rangeset = true; - } - } - -#if 0 - std::cout << "AxisInfo::info" << m_info << "\n"; - std::cout << "\tlog " << m_log << "\n"; - std::cout << "\tauto " << m_autoset << "\n"; - std::cout << "\tsym " << m_symmetric << "\n"; - std::cout << "\trange " << m_rangeset << " : " << m_lo << " - " << m_hi << std::endl; -#endif - - } - - /// accessors - - std::string tag() const { return m_tag; } - - bool log() const { return m_log; } - - bool autoset() const { return m_autoset; } - - bool normset() const { return m_norm; } - - bool refnormset() const { return m_refnorm; } - - bool symmetric() const { return m_symmetric; } - - bool rangeset() const { return m_rangeset; } - - double lo() const { return m_lo; } - double hi() const { return m_hi; } - - double binwidth() const { return m_binwidth; } - - std::string c_str() const { return m_info; } - -public: - - static std::vector<std::string> split( const std::string& s, const std::string& t=":" ) { - - std::string _s = s; - size_t pos = _s.find(t); - - std::vector<std::string> tags; - - while ( pos!=std::string::npos ) { - tags.push_back( chop(_s,t) ); - pos = _s.find(t); - } - - tags.push_back(_s); - - return tags; - } - - -public: - - std::string m_info; - - std::string m_tag; - - bool m_log; - bool m_autoset; - bool m_symmetric; - - bool m_rangeset; - double m_lo; - double m_hi; - - bool m_norm; - bool m_refnorm; - - bool m_binwidth; - -}; - - -inline std::ostream& operator<<( std::ostream& s, const AxisInfo& a ) { - s << "[ " << a.tag() << ( a.log() ? " : log" : "" ) << " "; - if ( a.autoset() ) s << " : auto"; - else if ( a.rangeset() ) s << " : range " << a.lo() << " - " << a.hi(); - s << " ]"; - return s; -} - - - - - - - -/// slightly more convenient legend class -class Legend { - -public: - - Legend() : mleg(0) { } - - Legend(double x1, double x2, double y1, double y2) { - mleg = new TLegend(x1, y1, x2, y2); - mleg->SetBorderSize(0); - mleg->SetTextFont(42); - mleg->SetTextSize(0.04); - mleg->SetFillStyle(3000); - mleg->SetFillColor(0); - mleg->SetLineColor(0); - } - - - // Legend( const Legend& leg ) : mleg((TLegend*)leg.mleg->Clone()) { } - - Legend(const Legend& legend) : mleg(legend.mleg) { } - - ~Legend() { } - - TLegend* legend() { return mleg; } - - TLegend* operator->() { return mleg; } - - size_t size() const { - if ( mleg ) return mleg->GetNRows(); - else return 0; - } - -private: - - TLegend* mleg; - -}; - - -static const int colours[6] = { 1, 2, kBlue-4, 6, kCyan-2, kGreen+2 }; -static const int markers[6] = { 20, 24, 25, 26, 21, 22 }; - - -template<typename T> -void setParameters( T* h, TGraphAsymmErrors* tg ) { - tg->SetLineColor( h->GetLineColor() ); - tg->SetMarkerColor( h->GetMarkerColor() ); - tg->SetMarkerStyle( h->GetMarkerStyle() ); - tg->SetMarkerSize( h->GetMarkerSize() ); - tg->SetLineWidth( h->GetLineWidth() ); - tg->SetLineStyle( h->GetLineStyle() ); -} - - -template<typename T> -void zeroErrors( T* h ) { - for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) h->SetBinError( i, 1e-100 ); -} - - - -/// generic plotter class - better to have one of these - make -/// sure it can be configured however you like, line styles, -/// marker types, legends etc -/// now a template so can be used for TH1D and TH2D etc -template<typename T> -class tPlotter { - -public: - - tPlotter(T* _htest=0, T* _href=0, const std::string& s="", TGraphAsymmErrors* _tgtest=0, TGraphAsymmErrors* _tgref=0 ) : - m_htest(_htest), m_href(_href), - m_tgtest(_tgtest), m_tgref(_tgref), - m_plotfilename(s) { - // plotref = true; - } - - - tPlotter(const tPlotter& p) : - m_htest(p.m_htest), m_href(p.m_href), - m_tgtest(p.m_tgtest), m_tgref(p.m_tgref), - m_plotfilename(p.m_plotfilename) { - } - - - /// sadly, root manages all the histograms (does it really? - /// who can tell) so we mustn't delete anything just in case - // ~tPlotter() { if ( m_tg ) delete m_tg; } - /// NO, NO, NO, don't delete the objects, root need them because - /// it is TOO STUPID to allow objects to be used as actual objects - ~tPlotter() { } - - std::string plotfilename() const { return m_plotfilename; } - - // void Draw(const std::string& chain, unsigned int i, Legend& leg ) { - void Draw( int i, Legend& _leg, bool mean=false, bool first=true ) { - - Legend leg = _leg; - - // std::cout << "\thref() " << href() << "\thtest() " << htest() << std::endl; - - if ( htest() ) { - gStyle->SetOptStat(0); - if ( href() ) { - href()->SetLineColor(colours[i%6]); - href()->SetLineStyle(2); - href()->SetMarkerStyle(0); - href()->GetYaxis()->SetMoreLogLabels(true); - } - // href()->SetMarkerColor(href()->GetLineColor()); - htest()->SetLineColor(colours[i%6]); - htest()->SetLineStyle(1); - htest()->SetMarkerColor(htest()->GetLineColor()); - htest()->SetMarkerStyle(markers[i%6]); - htest()->GetYaxis()->SetMoreLogLabels(true); - - // std::cout << "Draw() href() " << href() << "\thtest() " << htest() << "\ttgtest() " << tgtest(); - if ( htest() ) std::cout << "\tentries " << plotable( htest() ); - std::cout << std::endl; - - if(first) { -#if 0 - if ( plotref && href() ) { - href()->GetXaxis()->SetMoreLogLabels(true); - href()->Draw("hist]["); - // if ( tgref() ) { - // setParameters( href(), tgref() ); - // } - } - else -#endif - { - if ( tgtest() ) { - zeroErrors(htest()); - htest()->GetXaxis()->SetMoreLogLabels(true); - htest()->GetYaxis()->SetMoreLogLabels(true); - htest()->Draw("ep"); - setParameters( htest(), tgtest() ); - // tgtest()->Draw("p1same"); - tgtest()->Draw("esame"); - } - else { - htest()->GetXaxis()->SetMoreLogLabels(true); - htest()->GetYaxis()->SetMoreLogLabels(true); - htest()->Draw("ep"); - } - } - } - -#if 0 - static bool _dbg = true; - - if ( _dbg && htest() && tgtest() ) { - TFile f("dbg.root","recreate"); - htest()->Write(); - tgtest()->Write(); - f.Close(); - - _dbg = false; - } -#endif - - - if ( plotref && href() ) { - if ( contains(href()->GetName(),"_vs_") || - contains(href()->GetName(),"sigma") || - contains(href()->GetName(),"mean") || - contains(href()->GetName(),"_eff") || - contains(href()->GetName(),"Res_") || - contains(href()->GetName(),"Eff_") ) href()->Draw("hist same]["); - else href()->Draw("hist same"); - } - - - if ( tgtest() ) { - zeroErrors(htest()); - setParameters( htest(), tgtest() ); - tgtest()->Draw("e1same"); - } - -#if 0 - /// solid white centres for the marker types - if ( htest()->GetMarkerStyle()>23 ) { - TH1D* hnull = (TH1D*)htest()->Clone("duff"); hnull->SetDirectory(0); - zeroErrors( hnull ); - hnull->SetLineColor(kWhite); - hnull->SetMarkerStyle( htest()->GetMarkerStyle()-4 ); - // hnull->SetMarkerStyle( 0 ); - hnull->SetMarkerColor(kWhite); - hnull->SetMarkerSize( htest()->GetMarkerSize()*0.75 ); - // hnull->SetMarkerSize( 0 ); - hnull->DrawCopy("l same"); - delete hnull; - } -#endif - - htest()->Draw("ep same"); - - // href()->Draw("lhistsame"); - // htest()->Draw("lhistsame"); - - std::string key = m_plotfilename; - - // std::cout << "adding key " << key << std::endl; - - // std::cout << "cost size " << key.size() << std::endl; - - static TH1D* hnull = new TH1D("hnull", "", 1, 0, 1); - hnull->SetMarkerColor(kWhite); - hnull->SetLineColor(kWhite); - hnull->SetMarkerStyle(0); - hnull->SetLineStyle(0); - hnull->SetLineWidth(0); - hnull->SetMarkerSize(0); - - - if ( mean ) { - - char _meanref[64]; - bool displayref = false; - if ( meanplotref && href() ) { - displayref = true; - std::sprintf( _meanref, " <t> = %3.2f #pm %3.2f ms (ref)", href()->GetMean(), href()->GetMeanError() ); - } - else { - std::sprintf( _meanref, "%s", "" ); - } - - char _mean[64]; - std::sprintf( _mean, " <t> = %3.2f #pm %3.2f ms", htest()->GetMean(), htest()->GetMeanError() ); - - std::cout << "alg: " << m_plotfilename << " " << _mean << "\tref: " << _meanref << std::endl; - - std::string rkey = key; - - key += std::string(" : "); - leg->AddEntry( htest(), key.c_str(), "p" ); - leg->AddEntry( hnull, _mean, "p" ); - - if ( displayref ) { - rkey += std::string(" : "); - leg->AddEntry( hnull, "", "l" ); - leg->AddEntry( href(), rkey.c_str(), "l" ); - leg->AddEntry( hnull, _meanref, "l" ); - } - - - } - else leg->AddEntry( htest(), key.c_str(), "p" ); - - leg->Draw(); - - } - } - - - /// print the output - void Print(const std::string& s="") { - if ( s!="" ) gPad->Print(s.c_str()); - else gPad->Print(m_plotfilename.c_str()); - } - - T* htest() { return m_htest; } - T* href() { return m_href; } - - - TGraphAsymmErrors* tgtest() { return m_tgtest; } - TGraphAsymmErrors* tgref() { return m_tgref; } - - -public: - - static void setplotref( bool b ) { plotref=meanplotref=b; } - static void setmeanplotref( bool b ) { meanplotref=b; } - -private: - - /// actual histograms - T* m_htest; - T* m_href; - - TGraphAsymmErrors* m_tgtest; - TGraphAsymmErrors* m_tgref; - - std::string m_plotfilename; - - static bool plotref; - static bool meanplotref; - -}; - -template<typename T> -bool tPlotter<T>::plotref = true; - - -template<typename T> -bool tPlotter<T>::meanplotref = true; - - - - -typedef tPlotter<TH1F> Plotter; - -bool empty( TH1* h ); - - - -inline void hminus(TH1* h) { - std::cout << __FUNCTION__ << std::endl; - for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) { - double duff = h->GetBinContent(i); - if ( duff<0 ) { - std::cout<< "\t\t" << __FUNCTION__ << " " << h->GetName() << " " << i << " " << h->GetBinContent(i) << " " << (duff*1e6) << std::endl; - } - } - h->DrawCopy(); - gPad->Print( (std::string("duff-")+h->GetName()+".pdf").c_str() ); -} - - -/// set of generic plots -class Plots : public std::vector<Plotter> { - -public: - - Plots(const std::string& s="") : - m_name(s), - m_logx(false), m_logy(false), - m_maxset(false), m_max(0), - m_minset(false), m_min(0), - m_rangeset(false) - { } - - double realmin( double lo=0, double hi=0 ) { - bool first = true; - double _min = 1000; - for ( unsigned i=0 ; i<size() ; i++ ) { - double rmtest = ::realmin( at(i).htest(), false, lo, hi ); - if ( rmtest!=0 && ( first || _min>rmtest ) ) _min = rmtest; - if ( rmtest!=0 ) first = false; - } - return _min; - } - - double realmax(double lo=0, double hi=0) { - bool first = true; - double _max = 0; - for ( unsigned i=0 ; i<size() ; i++ ) { - // double rmref = realmin( at(i).href(), false ); - double rmtest = ::realmax( at(i).htest(), false, lo, hi ); - if ( rmtest!=0 && ( first || _max<rmtest ) ) _max = rmtest; - if ( rmtest!=0 ) first = false; - } - return _max; - } - - - - void MaxScale(double scale=1.1, double lo=0, double hi=0) { - - if ( size()<1 ) return; - - double tmax = realmax(lo,hi); - double tmin = realmin(lo,hi); - - // std::cout << "\tname: " << m_name << "\ttmin: " << tmin << "\ttmax: " << tmax << "\tlog: " << m_logy << std::endl; - - m_max = scale*tmin; - - if ( m_logy ) m_min = tmin; - - for ( unsigned i=0 ; i<size() ; i++ ) { - if ( at(i).href() ) at(i).href()->SetMaximum(scale*tmax); - at(i).htest()->SetMaximum(scale*tmax); - - // if ( m_logy ) { - // at(i).href()->SetMinimum(tmin); - // at(i).htest()->SetMinimum(tmin); - // } - - // std::cout << "refmax : " << at(i).href()->GetMaximum() << std::endl; - // std::cout << "testmax : " << at(i).htest()->GetMaximum() << std::endl; - } - - } - - - void MinScale( double scale, double lo=0, double hi=0 ) { - - if ( size()<1 ) return; - - if ( scale==0 ) { - for ( unsigned i=0 ; i<size() ; i++ ) { - if ( at(i).href() ) at(i).href()->SetMinimum(0); - at(i).htest()->SetMinimum(0); - } - return; - } - - - double tmin = 0; - - if ( lo!=hi ) tmin = realmin( lo, hi ); - else tmin = realmin(); - - m_min = scale*tmin; - - for ( unsigned i=0 ; i<size() ; i++ ) { - if ( at(i).href() ) at(i).href()->SetMinimum(scale*tmin); - at(i).htest()->SetMinimum(scale*tmin); - - // if ( m_logy ) { - // if ( at(i).href()->GetMinimum()<=0 ) at(i).href()->GetMinimum(1e-4); - // if ( at(i).htest()->GetMinimum()<=0 ) at(i).htest()->GetMinimum(1e-4); - // } - - // if ( contains( at(i).href()->GetName(), "sigma" ) ) { - // std::cout << "refmin : " << at(i).href()->GetMinimum() << std::endl; - // std::cout << "testmin : " << at(i).htest()->GetMinimum() << std::endl; - // } - } - } - - - void Min( double scale ) { - m_minset = true; - for ( unsigned i=0 ; i<size() ; i++ ) { - if ( at(i).href() ) at(i).href()->SetMinimum(scale); - at(i).htest()->SetMinimum(scale); - if ( m_logy ) { - if ( at(i).href() ) if ( at(i).href()->GetMinimum()<=0 ) at(i).href()->GetMinimum(1e-4); - if ( at(i).htest()->GetMinimum()<=0 ) at(i).htest()->GetMinimum(1e-4); - } - - // if ( contains( at(i).href()->GetName(), "sigma" ) ) { - // std::cout << "refmin : " << at(i).href()->GetMinimum() << std::endl; - // std::cout << "testmin : " << at(i).htest()->GetMinimum() << std::endl; - // } - } - } - - - void Max( double scale ) { - m_maxset = true; - for ( unsigned i=0 ; i<size() ; i++ ) { - if ( at(i).href() ) at(i).href()->SetMaximum(scale); - at(i).htest()->SetMaximum(scale); - } - } - - std::vector<double> findxrange( bool symmetric=false ) { - - /// don't use empty histograms to find the bin limits - /// unless they are *all* empty - - std::vector<double> v(2,0); - - if ( size()>0 ) v = ::findxrangeuser( at(0).htest(), symmetric ); - - bool first = true; - - for ( unsigned i=1 ; i<size() ; i++ ) { - - if ( ::empty( at(i).htest() ) ) continue; - - std::vector<double> limits = ::findxrangeuser( at(i).htest(), symmetric ); - - double lo = limits[0]; - double hi = limits[1]; - - if ( first ) { - v[0] = lo; - v[1] = hi; - } - else { - if ( v[0]>lo ) v[0] = lo; - if ( v[1]<hi ) v[1] = hi; - } - - first = false; - } - - return v; - } - - - - void sortx( const AxisInfo xinfo ) { // bool autoset=false, bool sym=false, bool logset=false, bool rangeset=false, double lo=0, double hi=0 ) { - - if ( xinfo.rangeset() ) { - m_lo = xinfo.lo(); - m_hi = xinfo.hi(); - } - - if ( xinfo.autoset() ) { - std::vector<double> limits = findxrange( xinfo.symmetric() ); - if ( xinfo.rangeset() ) { - if ( limits[0]<m_lo ) m_lo = limits[0]; - if ( limits[1]>m_hi ) m_hi = limits[1]; - } - else { - m_lo = limits[0]; - m_hi = limits[1]; - } - } - - if ( xinfo.rangeset() || xinfo.autoset() ) { - SetRangeUser( m_lo, m_hi ); - if ( xinfo.log() && m_lo>0 ) SetLogx(true); - else SetLogx(false); - } - - } - - - double lo() const { return m_lo; } - double hi() const { return m_hi; } - - - void xrange(bool symmetric=false) { - m_rangeset = false; - for ( unsigned i=0 ; i<size() ; i++ ) { - if ( at(i).href() ) ::xrange( at(i).href(), symmetric ); - ::xrange( at(i).htest(), symmetric ); - // ::xrange( at(i).htest(), symmetric ); - } - } - - void SetRangeUser( double lo, double hi ){ - m_rangeset = true; - m_lo = lo; - m_hi = hi; - for ( unsigned i=0 ; i<size() ; i++ ) { - if ( at(i).href() ) at(i).href()->GetXaxis()->SetRangeUser( m_lo, m_hi ); - at(i).htest()->GetXaxis()->SetRangeUser( m_lo, m_hi ); - } - } - - - void limits() { - double rmax = realmax(); - double rmin = realmin(); - if ( rmin<0 ) { - std::cout << "\tlimits \t" << m_name << "\tmin " << rmin << "\tmax " << rmax << std::endl; - std::cout << "\tlimits \t" << m_name << "\tmin " << rmin << "\tmax " << rmax << std::endl; - } - } - - - void Draw( Legend& leg, bool means=false ) { - // Max(); - - // std::cout << "\thref() " << href() << "\thtest() " << htest() << std::endl; - - /// plotting range options etc - // std::cout << "Plotter::Draw() " << m_name << "\tsize " << size() << "\txaxis: log: " << m_logx; - - // if ( m_rangeset ) std::cout << "\trange: " << m_lo << " - " << m_hi; - - // std::cout << "\tyaxis: log:" << m_logy; - // if ( m_minset ) std::cout << "\tymin: " << m_min; - // if ( m_maxset ) std::cout << "\tymax: " << m_max; - // std::cout << std::endl; - - bool first = true; - - // for ( unsigned i=size() ; i-- ; first=false ) at(i).Draw( i, leg, means, first ); - for ( unsigned i=0 ; i<size() ; i++, first=false ) at(i).Draw( i, leg, means, first ); - if ( watermark ) DrawLabel(0.1, 0.02, "built on "+stime()+release, kBlack, 0.03 ); - - /// std::cout << "\txlimits : " << m_lo << " " << m_hi << std::endl; - - gPad->SetLogy(m_logy); - gPad->SetLogx(m_logx); - } - - void SetLogx( bool b=true ) { m_logx=b; } - void SetLogy( bool b=true ) { m_logy=b; } - - std::string GetXaxisTitle() { - if ( size()>0 ) return at(0).htest()->GetXaxis()->GetTitle(); - return ""; - } - - std::string GetYaxisTitle() { - if ( size()>0 ) return at(0).htest()->GetYaxis()->GetTitle(); - return ""; - } - - void SetXaxisTitle(std::string s) { - if ( size()>0 ) at(0).htest()->GetXaxis()->SetTitle(s.c_str()); - } - - void SetYaxisTitle(std::string s) { - if ( size()>0 ) at(0).htest()->GetYaxis()->SetTitle(s.c_str()); - } - - - /// this is so that we can update the stats as we go along, - /// but no updating isn't done at the moment - void push_back(const Plotter& val) { - std::vector<Plotter>::push_back( val ); - } - -public: - - static void setwatermark(bool b) { watermark = b; } - -private: - - std::string m_name; - - /// canvas log setting - bool m_logx; - bool m_logy; - - /// yaxis range setting - bool m_maxset; - double m_max; - - bool m_minset; - double m_min; - - /// xaxis range setting - bool m_rangeset; - double m_lo; - double m_hi; - -private: - - static bool watermark; - -}; - - - - -/// details of the histogram axes etc - -class HistDetails { - -public: - - HistDetails( const std::vector<std::string>& v ) : m_xinfo(v[2]), m_yinfo(v[4]) { - if ( v.size() < 6 ) throw std::exception(); - m_details.reserve(6); - for ( size_t i=0 ; i<6 ; i++ ) m_details.push_back(v[i]); - } - - HistDetails( const std::string* vp ) : m_xinfo(vp[2]), m_yinfo(vp[4]) { - m_details.reserve(6); - for ( size_t i=0 ; i<6 ; i++ ) m_details.push_back(vp[i]); - } - - - std::string name() const { return m_details[0]; } - - std::string info() const { return m_details[1]; } - - std::string xtitle() const { return m_details[3]; } - std::string ytitle() const { return m_details[5]; } - - const AxisInfo& xaxis() const { return m_xinfo; } - const AxisInfo& yaxis() const { return m_yinfo; } - -private: - - std::vector<std::string> m_details; - - AxisInfo m_xinfo; - AxisInfo m_yinfo; - -}; - - - -inline std::ostream& operator<<( std::ostream& s, const HistDetails& h ) { - return s << "[ " << h.name() << " \tx: \"" << h.xtitle() << "\" " << h.xaxis() << "\t\ty: \"" << h.ytitle() << "\" " << h.yaxis() << " ]"; -} - - - -// plot panel inforamtion - -class Panel { - -public: - - /// don't know how many rows or total hists yet, - /// but do know number of columns - Panel( const std::string& s, int nc ) : - m_name(s), m_nhist(-1), m_nrows(-1), m_ncols(nc) { - m_hist.reserve( nc ); - } - - /// know number of rows and columns - Panel( const std::string& s, int nr, int nc ) : - m_name(s), m_nhist(nr*nc), m_nrows(nr), m_ncols(nc) { - m_hist.reserve( m_nhist ); - } - - void push_back( const HistDetails& h ) { - m_hist.push_back( h ); - m_nhist = m_hist.size(); - m_nrows = m_nhist/m_ncols + (m_nhist%m_ncols ? 1 : 0 ); - } - - std::string name() const { return m_name; } - - size_t size() const { return m_hist.size(); } - - const HistDetails& operator[](int i) const { return m_hist.at(i); } - HistDetails& operator[](int i) { return m_hist.at(i); } - - const HistDetails& back() const { return m_hist.back(); } - HistDetails& back() { return m_hist.back(); } - - int nrows() const { return m_nrows; } - int ncols() const { return m_ncols; } - -private: - - std::string m_name; - - int m_nhist; - - int m_nrows; - int m_ncols; - - std::vector<HistDetails> m_hist; - -}; - - - -inline std::ostream& operator<<( std::ostream& s, const Panel& p ) { - s << "Panel: " << p.name(); - for ( size_t i=0 ; i<p.size() ; i++ ) s << "\n\t" << p[i]; - return s; -} - - - - - -#endif // COMPUTILS_H +/* emacs: this is -*- c++ -*- */ +/** + ** @file computils.h + ** + ** @author mark sutton + ** @date Sat Aug 30 2014 14:38:03 CEST + ** + ** Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + **/ + +#ifndef COMPUTILS_H +#define COMPUTILS_H + +#include <iostream> +#include <string> +#include <vector> +#include <cstdio> +#include <cstdlib> +#include <exception> + +#include "label.h" +#include "utils.h" +#include "DrawLabel.h" + + +#include "TStyle.h" +#include "TPad.h" +#include "TH1D.h" +#include "TFile.h" +#include "TH1.h" +#include "TGraphAsymmErrors.h" + +#include "TLegend.h" +#include "TrigInDetAnalysis/Efficiency.h" + +void ATLASFORAPP_LABEL( double x, double y, int color, double size=0.06 ); + +void myText( Double_t x, Double_t y, Color_t color, const std::string& text, Double_t tsize); + + +/// return the current data and time +std::string stime(); +static std::string release; + +double integral( TH1* h ); + +void Norm( TH1* h, double scale=1 ); + +double Entries( TH1* h ); + +/// does a string contain the substring +bool contains( const std::string& s, const std::string& p); + +/// does a string contain the substring at the beginning of the string +bool fcontains( const std::string& s, const std::string& p); + +/// does a file exist +bool exists( const std::string& filename ); + +/// tail of a string +std::string tail( std::string s, const std::string& pattern ); + +/// match a file name +std::string globbed( const std::string& s ); + +void contents( std::vector<std::string>& keys, + TDirectory* td, + const std::string& directory="", + const std::string& pattern="", + const std::string& path="" ); + +double realmax( TH1* h, bool include_error=true, double lo=0, double hi=0 ); +double realmin( TH1* h, bool include_error=true, double lo=0, double hi=0 ); + +std::string findcell( std::string name, const std::string regex, const std::string splitex="/" ); + +std::string findrun( TFile *f ); + +double plotable( TH1* h ); // , double xlo=-999, double xhi=-999 ); + + + +template<typename T> +std::ostream& operator<<( std::ostream& s, std::vector<T>& v) { + for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\t" << v[i]; + return s; +} + + +/// automatically set the xrange on a histogram +std::vector<int> findxrange(TH1* h, bool symmetric=false ); +std::vector<double> findxrangeuser(TH1* h, bool symmetric=false ); + + +void xrange(TH1* h, bool symmetric=true ); + +/// copy the TTree of release info from one directory to another +void copyReleaseInfo( TFile* finput, TFile* foutdir ); + + +/// class to store information about axes, limits, whether it is +/// log or linear scale etc + +class AxisInfo { + +public: + + AxisInfo( const std::string& s ) : + m_info(s), + m_log(false), + m_autoset(false), + m_symmetric(false), + m_rangeset(false), + m_lo(0), + m_hi(0), + m_norm(false), + m_refnorm(false), + m_binwidth(false) + { + // std::cout << "AxisInfo::info" << m_info << std::endl; + + std::vector<std::string> keys = split( s, ":" ); + + // std::cout << "\n\n" << s << "\nnkeys " << keys.size() << std::endl; + + if ( keys.size()>0 ) m_tag = keys[0]; + + bool minset = false; + // bool maxset = false; + + for ( size_t i=1 ; i<keys.size() ; i++ ) { + + if ( keys[i]=="lin" ) m_log = false; + else if ( keys[i]=="log" ) m_log = true; + else if ( keys[i]=="sym" ) m_symmetric = true; + else if ( keys[i]=="norm" ) m_norm = true; + else if ( keys[i]=="refn" ) m_refnorm = true; + else if ( keys[i]=="width" ) m_binwidth = true; + else if ( keys[i]=="auto" ) m_autoset = true; + else if ( keys[i]=="auton" ) { + m_autoset = true; + m_norm = true; + } + else if ( keys[i]=="autow" ) { + m_autoset = true; + m_binwidth = true; + } + else if ( keys[i]=="autown" || keys[i]=="autonw" ) { + m_autoset = true; + m_norm = true; + m_binwidth = true; + } + else if ( keys[i]=="autosym" ) { + m_autoset = true; + m_symmetric = true; + } + else if ( keys[i]=="normw" || keys[i]=="widthn" ) { + m_norm = true; + m_binwidth = true; + } + else if ( !minset ) { + m_lo = std::atof(keys[i].c_str()); + i++; + if ( i<keys.size() ) m_hi = std::atof(keys[i].c_str()); + else { + std::cerr << "not enough values for the axis range: " << s << std::endl; + std::exit(-1); + } + minset = true; + // maxset = true; + m_rangeset = true; + } + } + +#if 0 + std::cout << "AxisInfo::info" << m_info << "\n"; + std::cout << "\tlog " << m_log << "\n"; + std::cout << "\tauto " << m_autoset << "\n"; + std::cout << "\tsym " << m_symmetric << "\n"; + std::cout << "\trange " << m_rangeset << " : " << m_lo << " - " << m_hi << std::endl; +#endif + + } + + /// accessors + + std::string tag() const { return m_tag; } + + bool log() const { return m_log; } + + bool autoset() const { return m_autoset; } + + bool normset() const { return m_norm; } + + bool refnormset() const { return m_refnorm; } + + bool symmetric() const { return m_symmetric; } + + bool rangeset() const { return m_rangeset; } + + double lo() const { return m_lo; } + double hi() const { return m_hi; } + + double binwidth() const { return m_binwidth; } + + std::string c_str() const { return m_info; } + +public: + + static std::vector<std::string> split( const std::string& s, const std::string& t=":" ) { + + std::string _s = s; + size_t pos = _s.find(t); + + std::vector<std::string> tags; + + while ( pos!=std::string::npos ) { + tags.push_back( chop(_s,t) ); + pos = _s.find(t); + } + + tags.push_back(_s); + + return tags; + } + + +public: + + std::string m_info; + + std::string m_tag; + + bool m_log; + bool m_autoset; + bool m_symmetric; + + bool m_rangeset; + double m_lo; + double m_hi; + + bool m_norm; + bool m_refnorm; + + bool m_binwidth; + +}; + + +inline std::ostream& operator<<( std::ostream& s, const AxisInfo& a ) { + s << "[ " << a.tag() << ( a.log() ? " : log" : "" ) << " "; + if ( a.autoset() ) s << " : auto"; + else if ( a.rangeset() ) s << " : range " << a.lo() << " - " << a.hi(); + s << " ]"; + return s; +} + + + + + + + +/// slightly more convenient legend class +class Legend { + +public: + + Legend() : mleg(0) { } + + Legend(double x1, double x2, double y1, double y2) { + mleg = new TLegend(x1, y1, x2, y2); + mleg->SetBorderSize(0); + mleg->SetTextFont(42); + mleg->SetTextSize(0.04); + mleg->SetFillStyle(3000); + mleg->SetFillColor(0); + mleg->SetLineColor(0); + } + + + // Legend( const Legend& leg ) : mleg((TLegend*)leg.mleg->Clone()) { } + + Legend(const Legend& legend) : mleg(legend.mleg) { } + + ~Legend() { } + + TLegend* legend() { return mleg; } + + TLegend* operator->() { return mleg; } + + size_t size() const { + if ( mleg ) return mleg->GetNRows(); + else return 0; + } + +private: + + TLegend* mleg; + +}; + + +static const int colours[6] = { 1, 2, kBlue-4, 6, kCyan-2, kGreen+2 }; +static const int markers[6] = { 20, 24, 25, 26, 21, 22 }; + + +template<typename T> +void setParameters( T* h, TGraphAsymmErrors* tg ) { + tg->SetLineColor( h->GetLineColor() ); + tg->SetMarkerColor( h->GetMarkerColor() ); + tg->SetMarkerStyle( h->GetMarkerStyle() ); + tg->SetMarkerSize( h->GetMarkerSize() ); + tg->SetLineWidth( h->GetLineWidth() ); + tg->SetLineStyle( h->GetLineStyle() ); +} + + +template<typename T> +void zeroErrors( T* h ) { + for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) h->SetBinError( i, 1e-100 ); +} + + + +/// generic plotter class - better to have one of these - make +/// sure it can be configured however you like, line styles, +/// marker types, legends etc +/// now a template so can be used for TH1D and TH2D etc +template<typename T> +class tPlotter { + +public: + + tPlotter(T* _htest=0, T* _href=0, const std::string& s="", TGraphAsymmErrors* _tgtest=0, TGraphAsymmErrors* _tgref=0 ) : + m_htest(_htest), m_href(_href), + m_tgtest(_tgtest), m_tgref(_tgref), + m_plotfilename(s) { + // plotref = true; + } + + + tPlotter(const tPlotter& p) : + m_htest(p.m_htest), m_href(p.m_href), + m_tgtest(p.m_tgtest), m_tgref(p.m_tgref), + m_plotfilename(p.m_plotfilename) { + } + + + /// sadly, root manages all the histograms (does it really? + /// who can tell) so we mustn't delete anything just in case + // ~tPlotter() { if ( m_tg ) delete m_tg; } + /// NO, NO, NO, don't delete the objects, root need them because + /// it is TOO STUPID to allow objects to be used as actual objects + ~tPlotter() { } + + std::string plotfilename() const { return m_plotfilename; } + + // void Draw(const std::string& chain, unsigned int i, Legend& leg ) { + void Draw( int i, Legend& _leg, bool mean=false, bool first=true ) { + + Legend leg = _leg; + + // std::cout << "\thref() " << href() << "\thtest() " << htest() << std::endl; + + if ( htest() ) { + gStyle->SetOptStat(0); + if ( href() ) { + href()->SetLineColor(colours[i%6]); + href()->SetLineStyle(2); + href()->SetMarkerStyle(0); + href()->GetYaxis()->SetMoreLogLabels(true); + } + // href()->SetMarkerColor(href()->GetLineColor()); + htest()->SetLineColor(colours[i%6]); + htest()->SetLineStyle(1); + htest()->SetMarkerColor(htest()->GetLineColor()); + htest()->SetMarkerStyle(markers[i%6]); + htest()->GetYaxis()->SetMoreLogLabels(true); + + // std::cout << "Draw() href() " << href() << "\thtest() " << htest() << "\ttgtest() " << tgtest(); + if ( htest() ) std::cout << "\tentries " << plotable( htest() ); + std::cout << std::endl; + + if(first) { +#if 0 + if ( plotref && href() ) { + href()->GetXaxis()->SetMoreLogLabels(true); + href()->Draw("hist]["); + // if ( tgref() ) { + // setParameters( href(), tgref() ); + // } + } + else +#endif + { + if ( tgtest() ) { + zeroErrors(htest()); + htest()->GetXaxis()->SetMoreLogLabels(true); + htest()->GetYaxis()->SetMoreLogLabels(true); + htest()->Draw("ep"); + setParameters( htest(), tgtest() ); + // tgtest()->Draw("p1same"); + tgtest()->Draw("esame"); + } + else { + htest()->GetXaxis()->SetMoreLogLabels(true); + htest()->GetYaxis()->SetMoreLogLabels(true); + htest()->Draw("ep"); + } + } + } + +#if 0 + static bool _dbg = true; + + if ( _dbg && htest() && tgtest() ) { + TFile f("dbg.root","recreate"); + htest()->Write(); + tgtest()->Write(); + f.Close(); + + _dbg = false; + } +#endif + + + if ( plotref && href() ) { + if ( contains(href()->GetName(),"_vs_") || + contains(href()->GetName(),"sigma") || + contains(href()->GetName(),"mean") || + contains(href()->GetName(),"_eff") || + contains(href()->GetName(),"Res_") || + contains(href()->GetName(),"Eff_") ) href()->Draw("hist same]["); + else href()->Draw("hist same"); + } + + + if ( tgtest() ) { + zeroErrors(htest()); + setParameters( htest(), tgtest() ); + tgtest()->Draw("e1same"); + } + +#if 0 + /// solid white centres for the marker types + if ( htest()->GetMarkerStyle()>23 ) { + TH1D* hnull = (TH1D*)htest()->Clone("duff"); hnull->SetDirectory(0); + zeroErrors( hnull ); + hnull->SetLineColor(kWhite); + hnull->SetMarkerStyle( htest()->GetMarkerStyle()-4 ); + // hnull->SetMarkerStyle( 0 ); + hnull->SetMarkerColor(kWhite); + hnull->SetMarkerSize( htest()->GetMarkerSize()*0.75 ); + // hnull->SetMarkerSize( 0 ); + hnull->DrawCopy("l same"); + delete hnull; + } +#endif + + htest()->Draw("ep same"); + + // href()->Draw("lhistsame"); + // htest()->Draw("lhistsame"); + + std::string key = m_plotfilename; + + // std::cout << "adding key " << key << std::endl; + + // std::cout << "cost size " << key.size() << std::endl; + + static TH1D* hnull = new TH1D("hnull", "", 1, 0, 1); + hnull->SetMarkerColor(kWhite); + hnull->SetLineColor(kWhite); + hnull->SetMarkerStyle(0); + hnull->SetLineStyle(0); + hnull->SetLineWidth(0); + hnull->SetMarkerSize(0); + + + if ( mean ) { + + char _meanref[64]; + bool displayref = false; + if ( meanplotref && href() ) { + displayref = true; + std::sprintf( _meanref, " <t> = %3.2f #pm %3.2f ms (ref)", href()->GetMean(), href()->GetMeanError() ); + } + else { + std::sprintf( _meanref, "%s", "" ); + } + + char _mean[64]; + std::sprintf( _mean, " <t> = %3.2f #pm %3.2f ms", htest()->GetMean(), htest()->GetMeanError() ); + + std::cout << "alg: " << m_plotfilename << " " << _mean << "\tref: " << _meanref << std::endl; + + std::string rkey = key; + + key += std::string(" : "); + leg->AddEntry( htest(), key.c_str(), "p" ); + leg->AddEntry( hnull, _mean, "p" ); + + if ( displayref ) { + rkey += std::string(" : "); + leg->AddEntry( hnull, "", "l" ); + leg->AddEntry( href(), rkey.c_str(), "l" ); + leg->AddEntry( hnull, _meanref, "l" ); + } + + + } + else leg->AddEntry( htest(), key.c_str(), "p" ); + + leg->Draw(); + + } + } + + + /// print the output + void Print(const std::string& s="") { + if ( s!="" ) gPad->Print(s.c_str()); + else gPad->Print(m_plotfilename.c_str()); + } + + T* htest() { return m_htest; } + T* href() { return m_href; } + + + TGraphAsymmErrors* tgtest() { return m_tgtest; } + TGraphAsymmErrors* tgref() { return m_tgref; } + + +public: + + static void setplotref( bool b ) { plotref=meanplotref=b; } + static void setmeanplotref( bool b ) { meanplotref=b; } + +private: + + /// actual histograms + T* m_htest; + T* m_href; + + TGraphAsymmErrors* m_tgtest; + TGraphAsymmErrors* m_tgref; + + std::string m_plotfilename; + + static bool plotref; + static bool meanplotref; + +}; + +template<typename T> +bool tPlotter<T>::plotref = true; + + +template<typename T> +bool tPlotter<T>::meanplotref = true; + + + + +typedef tPlotter<TH1F> Plotter; + +bool empty( TH1* h ); + + + +inline void hminus(TH1* h) { + std::cout << __FUNCTION__ << std::endl; + for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) { + double duff = h->GetBinContent(i); + if ( duff<0 ) { + std::cout<< "\t\t" << __FUNCTION__ << " " << h->GetName() << " " << i << " " << h->GetBinContent(i) << " " << (duff*1e6) << std::endl; + } + } + h->DrawCopy(); + gPad->Print( (std::string("duff-")+h->GetName()+".pdf").c_str() ); +} + + +/// set of generic plots +class Plots : public std::vector<Plotter> { + +public: + + Plots(const std::string& s="") : + m_name(s), + m_logx(false), m_logy(false), + m_maxset(false), m_max(0), + m_minset(false), m_min(0), + m_rangeset(false) + { } + + double realmin( double lo=0, double hi=0 ) { + bool first = true; + double _min = 1000; + for ( unsigned i=0 ; i<size() ; i++ ) { + double rmtest = ::realmin( at(i).htest(), false, lo, hi ); + if ( rmtest!=0 && ( first || _min>rmtest ) ) _min = rmtest; + if ( rmtest!=0 ) first = false; + } + return _min; + } + + double realmax(double lo=0, double hi=0) { + bool first = true; + double _max = 0; + for ( unsigned i=0 ; i<size() ; i++ ) { + // double rmref = realmin( at(i).href(), false ); + double rmtest = ::realmax( at(i).htest(), false, lo, hi ); + if ( rmtest!=0 && ( first || _max<rmtest ) ) _max = rmtest; + if ( rmtest!=0 ) first = false; + } + return _max; + } + + + + void MaxScale(double scale=1.1, double lo=0, double hi=0) { + + if ( size()<1 ) return; + + double tmax = realmax(lo,hi); + double tmin = realmin(lo,hi); + + // std::cout << "\tname: " << m_name << "\ttmin: " << tmin << "\ttmax: " << tmax << "\tlog: " << m_logy << std::endl; + + m_max = scale*tmin; + + if ( m_logy ) m_min = tmin; + + for ( unsigned i=0 ; i<size() ; i++ ) { + if ( at(i).href() ) at(i).href()->SetMaximum(scale*tmax); + at(i).htest()->SetMaximum(scale*tmax); + + // if ( m_logy ) { + // at(i).href()->SetMinimum(tmin); + // at(i).htest()->SetMinimum(tmin); + // } + + // std::cout << "refmax : " << at(i).href()->GetMaximum() << std::endl; + // std::cout << "testmax : " << at(i).htest()->GetMaximum() << std::endl; + } + + } + + + void MinScale( double scale, double lo=0, double hi=0 ) { + + if ( size()<1 ) return; + + if ( scale==0 ) { + for ( unsigned i=0 ; i<size() ; i++ ) { + if ( at(i).href() ) at(i).href()->SetMinimum(0); + at(i).htest()->SetMinimum(0); + } + return; + } + + + double tmin = 0; + + if ( lo!=hi ) tmin = realmin( lo, hi ); + else tmin = realmin(); + + m_min = scale*tmin; + + for ( unsigned i=0 ; i<size() ; i++ ) { + if ( at(i).href() ) at(i).href()->SetMinimum(scale*tmin); + at(i).htest()->SetMinimum(scale*tmin); + + // if ( m_logy ) { + // if ( at(i).href()->GetMinimum()<=0 ) at(i).href()->GetMinimum(1e-4); + // if ( at(i).htest()->GetMinimum()<=0 ) at(i).htest()->GetMinimum(1e-4); + // } + + // if ( contains( at(i).href()->GetName(), "sigma" ) ) { + // std::cout << "refmin : " << at(i).href()->GetMinimum() << std::endl; + // std::cout << "testmin : " << at(i).htest()->GetMinimum() << std::endl; + // } + } + } + + + void Min( double scale ) { + m_minset = true; + for ( unsigned i=0 ; i<size() ; i++ ) { + if ( at(i).href() ) at(i).href()->SetMinimum(scale); + at(i).htest()->SetMinimum(scale); + if ( m_logy ) { + if ( at(i).href() ) if ( at(i).href()->GetMinimum()<=0 ) at(i).href()->GetMinimum(1e-4); + if ( at(i).htest()->GetMinimum()<=0 ) at(i).htest()->GetMinimum(1e-4); + } + + // if ( contains( at(i).href()->GetName(), "sigma" ) ) { + // std::cout << "refmin : " << at(i).href()->GetMinimum() << std::endl; + // std::cout << "testmin : " << at(i).htest()->GetMinimum() << std::endl; + // } + } + } + + + void Max( double scale ) { + m_maxset = true; + for ( unsigned i=0 ; i<size() ; i++ ) { + if ( at(i).href() ) at(i).href()->SetMaximum(scale); + at(i).htest()->SetMaximum(scale); + } + } + + std::vector<double> findxrange( bool symmetric=false ) { + + /// don't use empty histograms to find the bin limits + /// unless they are *all* empty + + std::vector<double> v(2,0); + + if ( size()>0 ) v = ::findxrangeuser( at(0).htest(), symmetric ); + + bool first = true; + + for ( unsigned i=1 ; i<size() ; i++ ) { + + if ( ::empty( at(i).htest() ) ) continue; + + std::vector<double> limits = ::findxrangeuser( at(i).htest(), symmetric ); + + double lo = limits[0]; + double hi = limits[1]; + + if ( first ) { + v[0] = lo; + v[1] = hi; + } + else { + if ( v[0]>lo ) v[0] = lo; + if ( v[1]<hi ) v[1] = hi; + } + + first = false; + } + + return v; + } + + + + void sortx( const AxisInfo xinfo ) { // bool autoset=false, bool sym=false, bool logset=false, bool rangeset=false, double lo=0, double hi=0 ) { + + if ( xinfo.rangeset() ) { + m_lo = xinfo.lo(); + m_hi = xinfo.hi(); + } + + if ( xinfo.autoset() ) { + std::vector<double> limits = findxrange( xinfo.symmetric() ); + if ( xinfo.rangeset() ) { + if ( limits[0]<m_lo ) m_lo = limits[0]; + if ( limits[1]>m_hi ) m_hi = limits[1]; + } + else { + m_lo = limits[0]; + m_hi = limits[1]; + } + } + + if ( xinfo.rangeset() || xinfo.autoset() ) { + SetRangeUser( m_lo, m_hi ); + if ( xinfo.log() && m_lo>0 ) SetLogx(true); + else SetLogx(false); + } + + } + + + double lo() const { return m_lo; } + double hi() const { return m_hi; } + + + void xrange(bool symmetric=false) { + m_rangeset = false; + for ( unsigned i=0 ; i<size() ; i++ ) { + if ( at(i).href() ) ::xrange( at(i).href(), symmetric ); + ::xrange( at(i).htest(), symmetric ); + } + } + + void SetRangeUser( double lo, double hi ){ + m_rangeset = true; + m_lo = lo; + m_hi = hi; + for ( unsigned i=0 ; i<size() ; i++ ) { + if ( at(i).href() ) at(i).href()->GetXaxis()->SetRangeUser( m_lo, m_hi ); + at(i).htest()->GetXaxis()->SetRangeUser( m_lo, m_hi ); + } + } + + + void limits() { + double rmax = realmax(); + double rmin = realmin(); + if ( rmin<0 ) { + std::cout << "\tlimits \t" << m_name << "\tmin " << rmin << "\tmax " << rmax << std::endl; + std::cout << "\tlimits \t" << m_name << "\tmin " << rmin << "\tmax " << rmax << std::endl; + } + } + + + void Draw( Legend& leg, bool means=false ) { + // Max(); + + // std::cout << "\thref() " << href() << "\thtest() " << htest() << std::endl; + + /// plotting range options etc + // std::cout << "Plotter::Draw() " << m_name << "\tsize " << size() << "\txaxis: log: " << m_logx; + + // if ( m_rangeset ) std::cout << "\trange: " << m_lo << " - " << m_hi; + + // std::cout << "\tyaxis: log:" << m_logy; + // if ( m_minset ) std::cout << "\tymin: " << m_min; + // if ( m_maxset ) std::cout << "\tymax: " << m_max; + // std::cout << std::endl; + + bool first = true; + + // for ( unsigned i=size() ; i-- ; first=false ) at(i).Draw( i, leg, means, first ); + for ( unsigned i=0 ; i<size() ; i++, first=false ) at(i).Draw( i, leg, means, first ); + if ( watermark ) DrawLabel(0.1, 0.02, "built on "+stime()+release, kBlack, 0.03 ); + + /// std::cout << "\txlimits : " << m_lo << " " << m_hi << std::endl; + + gPad->SetLogy(m_logy); + gPad->SetLogx(m_logx); + } + + void SetLogx( bool b=true ) { m_logx=b; } + void SetLogy( bool b=true ) { m_logy=b; } + + std::string GetXaxisTitle() { + if ( size()>0 ) return at(0).htest()->GetXaxis()->GetTitle(); + return ""; + } + + std::string GetYaxisTitle() { + if ( size()>0 ) return at(0).htest()->GetYaxis()->GetTitle(); + return ""; + } + + void SetXaxisTitle(std::string s) { + if ( size()>0 ) at(0).htest()->GetXaxis()->SetTitle(s.c_str()); + } + + void SetYaxisTitle(std::string s) { + if ( size()>0 ) at(0).htest()->GetYaxis()->SetTitle(s.c_str()); + } + + + /// this is so that we can update the stats as we go along, + /// but no updating isn't done at the moment + void push_back(const Plotter& val) { + std::vector<Plotter>::push_back( val ); + } + +public: + + static void setwatermark(bool b) { watermark = b; } + +private: + + std::string m_name; + + /// canvas log setting + bool m_logx; + bool m_logy; + + /// yaxis range setting + bool m_maxset; + double m_max; + + bool m_minset; + double m_min; + + /// xaxis range setting + bool m_rangeset; + double m_lo; + double m_hi; + +private: + + static bool watermark; + +}; + + + + +/// details of the histogram axes etc + +class HistDetails { + +public: + + HistDetails( const std::vector<std::string>& v ) : m_xinfo(v[2]), m_yinfo(v[4]) { + if ( v.size() < 6 ) throw std::exception(); + m_details.reserve(6); + for ( size_t i=0 ; i<6 ; i++ ) m_details.push_back(v[i]); + } + + HistDetails( const std::string* vp ) : m_xinfo(vp[2]), m_yinfo(vp[4]) { + m_details.reserve(6); + for ( size_t i=0 ; i<6 ; i++ ) m_details.push_back(vp[i]); + } + + + std::string name() const { return m_details[0]; } + + std::string info() const { return m_details[1]; } + + std::string xtitle() const { return m_details[3]; } + std::string ytitle() const { return m_details[5]; } + + const AxisInfo& xaxis() const { return m_xinfo; } + const AxisInfo& yaxis() const { return m_yinfo; } + +private: + + std::vector<std::string> m_details; + + AxisInfo m_xinfo; + AxisInfo m_yinfo; + +}; + + + +inline std::ostream& operator<<( std::ostream& s, const HistDetails& h ) { + return s << "[ " << h.name() << " \tx: \"" << h.xtitle() << "\" " << h.xaxis() << "\t\ty: \"" << h.ytitle() << "\" " << h.yaxis() << " ]"; +} + + + +// plot panel inforamtion + +class Panel { + +public: + + /// don't know how many rows or total hists yet, + /// but do know number of columns + Panel( const std::string& s, int nc ) : + m_name(s), m_nhist(-1), m_nrows(-1), m_ncols(nc) { + m_hist.reserve( nc ); + } + + /// know number of rows and columns + Panel( const std::string& s, int nr, int nc ) : + m_name(s), m_nhist(nr*nc), m_nrows(nr), m_ncols(nc) { + m_hist.reserve( m_nhist ); + } + + void push_back( const HistDetails& h ) { + m_hist.push_back( h ); + m_nhist = m_hist.size(); + m_nrows = m_nhist/m_ncols + (m_nhist%m_ncols ? 1 : 0 ); + } + + std::string name() const { return m_name; } + + size_t size() const { return m_hist.size(); } + + const HistDetails& operator[](int i) const { return m_hist.at(i); } + HistDetails& operator[](int i) { return m_hist.at(i); } + + const HistDetails& back() const { return m_hist.back(); } + HistDetails& back() { return m_hist.back(); } + + int nrows() const { return m_nrows; } + int ncols() const { return m_ncols; } + +private: + + std::string m_name; + + int m_nhist; + + int m_nrows; + int m_ncols; + + std::vector<HistDetails> m_hist; + +}; + + + +inline std::ostream& operator<<( std::ostream& s, const Panel& p ) { + s << "Panel: " << p.name(); + if ( p.size() == 1 ) s << "\t" << p[0]; + else for ( size_t i=0 ; i<p.size() ; i++ ) s << "\n\t" << p[i]; + return s; +} + + + + + +#endif // COMPUTILS_H diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt index d892f42c47f4703567d51826566def4d2720f0a0..b5f57a5be873794698bfdeb6d7754d35e4356f34 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt @@ -27,16 +27,16 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigAnalysis/TrigInDetAnalysis Trigger/TrigEvent/TrigInDetEvent Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigTruthEvent/TrigInDetTruthEvent ) + Trigger/TrigTruthEvent/TrigInDetTruthEvent + Generators/AtlasHepMC ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_library( TrigInDetAnalysisUtils src/*.cxx PUBLIC_HEADERS TrigInDetAnalysisUtils - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel McParticleEvent muonEvent Particle egammaEvent tauEvent TrkParameters TrkTrack TrkTrackSummary TrkExUtils TrkToolInterfaces TrigInDetAnalysis TrigInDetEvent TrigSteeringEvent TrigInDetTruthEvent StoreGateLib SGtests TrigDecisionToolLib ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib GaudiKernel McParticleEvent muonEvent Particle egammaEvent tauEvent TrkParameters TrkTrack TrkTrackSummary TrkExUtils TrkToolInterfaces TrigInDetAnalysis TrigInDetEvent TrigSteeringEvent TrigInDetTruthEvent StoreGateLib SGtests TrigDecisionToolLib ) diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h index 2afbd2bd1f8f4cee9bd9fdd44addc147d8feb461..8da01df22003656ce4b03c1475442086cd4894a7 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h @@ -29,9 +29,9 @@ /// MC truth #include "McParticleEvent/TruthParticleContainer.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" ///// FrameWork includes diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector_old.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector_old.h index d5ba9af1086ffed93622462eb5f951f8944a72d8..d335cd9816526702b8216bd2d4f5c9fcf136ce4e 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector_old.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector_old.h @@ -22,9 +22,9 @@ /// MC truth #include "McParticleEvent/TruthParticleContainer.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" ///// FrameWork includes diff --git a/Trigger/TrigAnalysis/TrigInDetTruthAlgs/CMakeLists.txt b/Trigger/TrigAnalysis/TrigInDetTruthAlgs/CMakeLists.txt index 927914ffee2de8de7f94fb025b9ef3d435adbd29..3bc9d078736f24a0fd5ee20778b2915e49faf680 100644 --- a/Trigger/TrigAnalysis/TrigInDetTruthAlgs/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigInDetTruthAlgs/CMakeLists.txt @@ -12,6 +12,7 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps GaudiKernel Generators/GenzModuleEvent + Generators/AtlasHepMC InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetRawEvent/InDetSimData InnerDetector/InDetRecEvent/InDetPrepRawData @@ -20,14 +21,13 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigTruthEvent/TrigInDetTruthEvent ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_component( TrigInDetTruthAlgs src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} TrigInDetEvent AthenaBaseComps GaudiKernel GenzModuleEvent InDetIdentifier InDetSimData InDetPrepRawData TrkTruthData TrigInDetTruthEvent ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib TrigInDetEvent AthenaBaseComps GaudiKernel GenzModuleEvent InDetIdentifier InDetSimData InDetPrepRawData TrkTruthData TrigInDetTruthEvent ) # Install files from the package: atlas_install_python_modules( python/__init__.py python/TrigInDetTruthAlgsConfig.py ) diff --git a/Trigger/TrigAnalysis/TrigInDetTruthAlgs/src/TrigInDetTrackTruthMaker.cxx b/Trigger/TrigAnalysis/TrigInDetTruthAlgs/src/TrigInDetTrackTruthMaker.cxx index b790508b84562a87d5dc145ba5ef701fb9b8c269..d67356efa4df9b263f31e598e6d3330aaa1c2be6 100644 --- a/Trigger/TrigAnalysis/TrigInDetTruthAlgs/src/TrigInDetTrackTruthMaker.cxx +++ b/Trigger/TrigAnalysis/TrigInDetTruthAlgs/src/TrigInDetTrackTruthMaker.cxx @@ -40,7 +40,7 @@ // monte carlo edm #include "GenzModuleEvent/KineHepMcmap.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" TrigInDetTrackTruthMaker::TrigInDetTrackTruthMaker(const std::string &name, ISvcLocator *pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_trackTruthMapKey("TrigInDetTrackTruthMap"), m_minNrMatchHits(2) diff --git a/Trigger/TrigAnalysis/TrigInDetTruthAlgs/src/TrigL2SpacePointTruthTool.cxx b/Trigger/TrigAnalysis/TrigInDetTruthAlgs/src/TrigL2SpacePointTruthTool.cxx index 5eb535ab16c716d0b36e4be1a7202018f0f1ab0b..08d492a8db2ba9d99c10e3325961464d1e41de2d 100644 --- a/Trigger/TrigAnalysis/TrigInDetTruthAlgs/src/TrigL2SpacePointTruthTool.cxx +++ b/Trigger/TrigAnalysis/TrigInDetTruthAlgs/src/TrigL2SpacePointTruthTool.cxx @@ -28,7 +28,7 @@ // monte carlo edm #include "GenzModuleEvent/KineHepMcmap.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include "TrigInDetToolInterfaces/ITrigL2SpacePointTruthTool.h" #include "TrigL2SpacePointTruthTool.h" diff --git a/Trigger/TrigFake/CMakeLists.txt b/Trigger/TrigFake/CMakeLists.txt index 75cd78001fa9ed6aefa6915ad0f2387c466e6883..8b97b0e7d8f4942a2880022a2149ff272a3aef65 100644 --- a/Trigger/TrigFake/CMakeLists.txt +++ b/Trigger/TrigFake/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE Control/StoreGate Generators/GeneratorObjects + Generators/AtlasHepMC Trigger/TrigConfiguration/TrigConfHLTData Trigger/TrigEvent/TrigNavigation Trigger/TrigSteer/TrigInterfaces @@ -23,21 +24,20 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( CLHEP ) -find_package( HepMC ) # Component(s) in the package: atlas_add_library( TrigFakeLib src/*.cxx PUBLIC_HEADERS TrigFake - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES AthenaBaseComps GaudiKernel TrigInDetEvent TrigSteeringEvent TrigSteeringLib StoreGateLib SGtests TrigNavigationLib TrigInterfacesLib - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GeneratorObjects TrigConfHLTData TrigT1Interfaces TrigT1Result ) + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib GeneratorObjects TrigConfHLTData TrigT1Interfaces TrigT1Result ) atlas_add_component( TrigFake src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel TrigInDetEvent TrigSteeringEvent TrigSteeringLib StoreGateLib SGtests GeneratorObjects TrigConfHLTData TrigNavigationLib TrigInterfacesLib TrigT1Interfaces TrigT1Result TrigFakeLib ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel TrigInDetEvent TrigSteeringEvent TrigSteeringLib StoreGateLib SGtests GeneratorObjects TrigConfHLTData TrigNavigationLib TrigInterfacesLib TrigT1Interfaces TrigT1Result TrigFakeLib ) # Install files from the package: atlas_install_joboptions( share/jobOfragment_TrigFake.* ) diff --git a/Trigger/TrigFake/src/FakeLvl1RoIfromKine.cxx b/Trigger/TrigFake/src/FakeLvl1RoIfromKine.cxx index 674f6f6543257860971b54ee74686a8154d65d5b..d05c4d58a4b0e6c0d0b0e1b12ab06aa09e230fb5 100755 --- a/Trigger/TrigFake/src/FakeLvl1RoIfromKine.cxx +++ b/Trigger/TrigFake/src/FakeLvl1RoIfromKine.cxx @@ -28,8 +28,8 @@ Modified : # include "CLHEP/Units/SystemOfUnits.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" diff --git a/Trigger/TrigFake/src/ZVertexFromKine.cxx b/Trigger/TrigFake/src/ZVertexFromKine.cxx index c67bd5873b9a87882bd6604f96ed5992119cd8b5..d1558205b8a7436b07bde4b70dc2d81d77e3210c 100755 --- a/Trigger/TrigFake/src/ZVertexFromKine.cxx +++ b/Trigger/TrigFake/src/ZVertexFromKine.cxx @@ -18,8 +18,8 @@ Modified : ********************************************************************/ -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/McEventCollection.h" #include "TrigInDetEvent/TrigVertexCollection.h" diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.cxx index 46b0bd0523d5bfc2da2564d22bb4c6b7ce5b816b..5a7d42251cc9f1403cc146dd296f5d560fcd2a7b 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.cxx @@ -5,6 +5,7 @@ #include "GaudiKernel/Property.h" #include "TrigBjetEtHypoAlgMT.h" #include "AthViews/ViewHelper.h" +#include "CxxUtils/phihelper.h" TrigBjetEtHypoAlgMT::TrigBjetEtHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ) : @@ -93,33 +94,55 @@ StatusCode TrigBjetEtHypoAlgMT::execute( const EventContext& context ) const { ATH_MSG_DEBUG("Creating Output Decisions and Linking Stuff to it"); std::vector< TrigCompositeUtils::Decision* > newDecisions; - /* + for ( const TrigCompositeUtils::Decision* inputDecision : *prevDecisionContainer ) { - int index = 0; - if ( index < 0 ) continue; - TrigCompositeUtils::Decision *toAdd = TrigCompositeUtils::newDecisionIn( outputDecisions, - inputDecision, - "", context ); + // Retrieve jet link stored in the navigation upstream and check if the b-jet code is selecting it + // If so, create an output decision and attach the new jet to the output decision + // If not, do not create the output decision and go to the next input decision + ATH_MSG_DEBUG( "Retrieving input jet from the upstream code!" ); + std::vector< TrigCompositeUtils::LinkInfo< xAOD::JetContainer > > inputJetELInfo = TrigCompositeUtils::findLinks< xAOD::JetContainer >( inputDecision, TrigCompositeUtils::featureString(), TrigDefs::lastFeatureOfType ); + ATH_MSG_DEBUG( "Found a jet Link vector of size: " << inputJetELInfo.size() ); + ATH_CHECK( inputJetELInfo.size() == 1 ); + ATH_CHECK( inputJetELInfo.at(0).isValid() ); + + const xAOD::Jet *inputJet = *(inputJetELInfo.at(0).link); + ATH_MSG_DEBUG( " -- pt=" << inputJet->p4().Et() << + " eta=" << inputJet->eta() << + " phi=" << inputJet->phi() ); + + // Do geometrical matching to check if the jet is amidst the selected ones (b-jet applies ID acceptance requirements) + int Jetindex = -1; + double minDr = 9999.; + + for ( unsigned int jeti(0); jeti < jetELs.size(); jeti++ ) { + const ElementLink< xAOD::JetContainer >& jetLink = jetELs.at( jeti ); - // Adding Links - CHECK( attachLinksToDecision( context,*toAdd,index ) ); - newDecisions.push_back( toAdd ); - } - */ - - // Create output decisions - for ( unsigned int index(0); index < jetELs.size(); index++ ) { + double deltaEta = std::abs( inputJet->eta() - (*jetLink)->eta() ); + double deltaPhi = CxxUtils::wrapToPi( inputJet->phi() - (*jetLink)->phi() ); + double dR = sqrt( pow(deltaEta,2) + pow(deltaPhi,2) ); - // Find correct previous decision - const TrigCompositeUtils::Decision *previousDecision = prevDecisionContainer->at(0); + if ( dR < minDr && dR < 0.1 ) { + minDr = dR; + Jetindex = jeti; + } + } + + if ( Jetindex < 0 ) { + ATH_MSG_DEBUG( "No jet matching! The jet was not selected by the b-jet code due to ID acceptance cut." ); + continue; + } else { + ATH_MSG_DEBUG( "The jet has been selected by the b-jet code (ID acceptance)!" ); + ATH_MSG_DEBUG( "Output decision will be created." ); + } + // ========================== - // Create new decisions TrigCompositeUtils::Decision *toAdd = TrigCompositeUtils::newDecisionIn( outputDecisions, - previousDecision, - "", context ); + inputDecision, + "", context ); - // find index of PV + // Retrieve now the primary vertex to be attached to the decision. + // This is only one, but the container has size > 1! int PVindex = -1; for ( unsigned int pvi(0); pvi < vertexELs.size(); pvi++ ) { @@ -130,17 +153,19 @@ StatusCode TrigBjetEtHypoAlgMT::execute( const EventContext& context ) const { } if ( PVindex == -1 ) { - ATH_MSG_DEBUG( "Primary Vertex could not be found!" ); - ATH_MSG_DEBUG( "Using dummy vertex!" ); + ATH_MSG_DEBUG( "Primary Vertex could not be found! Using dummy vertex!" ); PVindex = 0; } + // ========================== // Adding Links - CHECK( attachLinksToDecision( context,*toAdd,index,PVindex ) ); - newDecisions.push_back( toAdd ); + CHECK( attachLinksToDecision( context,*toAdd,Jetindex,PVindex ) ); + newDecisions.push_back( toAdd ); } - + ATH_MSG_DEBUG( "Received " << prevDecisionContainer->size() << " input decisions from upstream!" ); + ATH_MSG_DEBUG( "Created " << newDecisions.size() << " output decisions!" ); + // ========================================================================================================================== // ** Prepare input to Hypo Tools // ========================================================================================================================== diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.icc b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.icc index 18e45ed48cb487bfa1b86fb9ea0f6c1cc7dba617..6a8e02c0149dce7a0916024c885d380bb83e642c 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.icc +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ template < class CONTAINER > @@ -29,12 +29,27 @@ StatusCode TrigBjetHypoAlgBaseMT::retrieveObjectFromEventView( const EventContex ATH_MSG_DEBUG( "Retrieving object from Event View from " << inputKey.key() ); + // This vector is for checking we are not reading more than once from the same View, thus retrieving the same objects multiple times! + std::vector< ElementLink< ViewContainer > > readViews; + for ( const TrigCompositeUtils::Decision* previousDecision: *prevDevisionContainer ) { // get View ElementLink< ViewContainer > viewEL = previousDecision->objectLink< ViewContainer >( TrigCompositeUtils::viewString() ); ATH_CHECK( viewEL.isValid() ); ATH_MSG_DEBUG( "Retrieved View" ); + bool alreadyUsed = false; + for ( const ElementLink< ViewContainer >& storedViews : readViews ) { + if ( viewEL == storedViews ) { + ATH_MSG_DEBUG( "We have already used this view!" ); + alreadyUsed = true; + break; + } + } + if ( alreadyUsed ) continue; + + readViews.push_back( viewEL ); + SG::ReadHandle< CONTAINER > Handle = ViewHelper::makeHandle( *viewEL, inputKey, context ); ATH_CHECK( Handle.isValid() ); ATH_MSG_DEBUG ( "EventView " << (*viewEL)->name() << " has object's container of size: " << Handle->size() ); diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py index ca63cdd44fd53e9c577ff4c9668ac00cbcf660c8..a368fff65cf1bda61fb856e8242033f0d3509f2f 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py @@ -34,8 +34,8 @@ def defaultParameters(parameter, default=''): # default if parameter unknown 'momwidthhi': 'inf', 'smclo': '0', 'smchi': 'inf', - 'jvtlo': '0', - 'jvthi': 'inf', + 'jvtlo': '0', + 'jvthi': 'inf', } if parameter not in defaults: diff --git a/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py b/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py index d99cb7767015324df9bf8feecfab0fcd71063ca5..5850602adb499555e06912f6a7f0e40275771c54 100644 --- a/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py +++ b/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py @@ -4,27 +4,166 @@ from AthenaCommon.Logging import logging log = logging.getLogger('TrigL2TauHypoTool') +from collections import namedtuple + + +# Here we need a large repository of configuration values +# The meaning of the configuration values is as follows: +# ('Id working point', 'pt threshold': ['Maximum number of tracks[0]', 'etmincalib[1]', 'Id level[2]']) +TauCuts = namedtuple('TauCuts','numTrackMax EtCalibMin level') +thresholdsEF = { + ('medium', 20): TauCuts(6, 20000.0, 1), + ('medium', 25): TauCuts(6, 25000.0, 1), + ('medium', 29): TauCuts(6, 29000.0, 1), + ('medium', 38): TauCuts(6, 38000.0, 1), + ('medium', 50): TauCuts(6, 50000.0, 1), + ('medium', 115): TauCuts(6, 115000.0, 1), + ('medium', 125): TauCuts(6, 125000.0, 1), + ('loose1', 20): TauCuts(3, 20000.0, 1), + ('loose1', 25): TauCuts(3, 25000.0, 1), + ('loose1', 29): TauCuts(3, 29000.0, 1), + ('loose1', 35): TauCuts(3, 35000.0, 1), + ('loose1', 38): TauCuts(3, 38000.0, 1), + ('loose1', 50): TauCuts(3, 50000.0, 1), + ('loose1', 60): TauCuts(3, 60000.0, 1), + ('loose1', 80): TauCuts(3, 80000.0, 1), + ('loose1', 115): TauCuts(3, 115000.0, 1), + ('loose1', 125): TauCuts(3, 125000.0, 1), + ('loose1', 160): TauCuts(3, 160000.0, 1), + ('loose1', 200): TauCuts(3, 200000.0, 1), + ('medium1', 0): TauCuts(3, 0000.0, 2), + ('medium1', 12): TauCuts(3, 12000.0, 2), + ('medium1', 20): TauCuts(3, 20000.0, 2), + ('medium1', 25): TauCuts(3, 25000.0, 2), + ('medium1', 29): TauCuts(3, 29000.0, 2), + ('medium1', 35): TauCuts(3, 35000.0, 2), + ('medium1', 38): TauCuts(3, 38000.0, 2), + ('medium1', 40): TauCuts(3, 40000.0, 2), + ('medium1', 50): TauCuts(3, 50000.0, 2), + ('medium1', 60): TauCuts(3, 60000.0, 2), + ('medium1', 80): TauCuts(3, 80000.0, 2), + ('medium1', 115): TauCuts(3, 115000.0, 2), + ('medium1', 125): TauCuts(3, 125000.0, 2), + ('medium1', 160): TauCuts(3, 160000.0, 2), + ('medium1', 200): TauCuts(3, 200000.0, 2), + ('tight1', 20): TauCuts(3, 20000.0, 3), + ('tight1', 25): TauCuts(3, 25000.0, 3), + ('tight1', 29): TauCuts(3, 29000.0, 3), + ('tight1', 35): TauCuts(3, 35000.0, 3), + ('tight1', 38): TauCuts(3, 38000.0, 3), + ('tight1', 50): TauCuts(3, 50000.0, 3), + ('tight1', 60): TauCuts(3, 60000.0, 3), + ('tight1', 80): TauCuts(3, 80000.0, 3), + ('tight1', 115): TauCuts(3, 115000.0, 3), + ('tight1', 125): TauCuts(3, 125000.0, 3), + ('tight1', 160): TauCuts(3, 160000.0, 3), + ('tight1', 200): TauCuts(3, 200000.0, 3), + ('verylooseRNN', 20): TauCuts(3, 20000.0, 0), + ('verylooseRNN', 25): TauCuts(3, 25000.0, 0), + ('verylooseRNN', 29): TauCuts(3, 29000.0, 0), + ('verylooseRNN', 35): TauCuts(3, 35000.0, 0), + ('verylooseRNN', 38): TauCuts(3, 38000.0, 0), + ('verylooseRNN', 50): TauCuts(3, 50000.0, 0), + ('verylooseRNN', 60): TauCuts(3, 60000.0, 0), + ('verylooseRNN', 80): TauCuts(3, 80000.0, 0), + ('verylooseRNN', 115): TauCuts(3, 115000.0, 0), + ('verylooseRNN', 125): TauCuts(3, 125000.0, 0), + ('verylooseRNN', 160): TauCuts(3, 160000.0, 0), + ('verylooseRNN', 200): TauCuts(3, 200000.0, 0), + ('looseRNN', 20): TauCuts(3, 20000.0, 1), + ('looseRNN', 25): TauCuts(3, 25000.0, 1), + ('looseRNN', 29): TauCuts(3, 29000.0, 1), + ('looseRNN', 35): TauCuts(3, 35000.0, 1), + ('looseRNN', 38): TauCuts(3, 38000.0, 1), + ('looseRNN', 50): TauCuts(3, 50000.0, 1), + ('looseRNN', 60): TauCuts(3, 60000.0, 1), + ('looseRNN', 80): TauCuts(3, 80000.0, 1), + ('looseRNN', 115): TauCuts(3, 115000.0, 1), + ('looseRNN', 125): TauCuts(3, 125000.0, 1), + ('looseRNN', 160): TauCuts(3, 160000.0, 1), + ('looseRNN', 200): TauCuts(3, 200000.0, 1), + ('mediumRNN', 0): TauCuts(3, 0000.0, 2), + ('mediumRNN', 12): TauCuts(3, 12000.0, 2), + ('mediumRNN', 20): TauCuts(3, 20000.0, 2), + ('mediumRNN', 25): TauCuts(3, 25000.0, 2), + ('mediumRNN', 29): TauCuts(3, 29000.0, 2), + ('mediumRNN', 35): TauCuts(3, 35000.0, 2), + ('mediumRNN', 38): TauCuts(3, 38000.0, 2), + ('mediumRNN', 40): TauCuts(3, 40000.0, 2), + ('mediumRNN', 50): TauCuts(3, 50000.0, 2), + ('mediumRNN', 60): TauCuts(3, 60000.0, 2), + ('mediumRNN', 80): TauCuts(3, 80000.0, 2), + ('mediumRNN', 115): TauCuts(3, 115000.0, 2), + ('mediumRNN', 125): TauCuts(3, 125000.0, 2), + ('mediumRNN', 160): TauCuts(3, 160000.0, 2), + ('mediumRNN', 200): TauCuts(3, 200000.0, 2), + ('tightRNN', 20): TauCuts(3, 20000.0, 3), + ('tightRNN', 25): TauCuts(3, 25000.0, 3), + ('tightRNN', 29): TauCuts(3, 29000.0, 3), + ('tightRNN', 35): TauCuts(3, 35000.0, 3), + ('tightRNN', 38): TauCuts(3, 38000.0, 3), + ('tightRNN', 40): TauCuts(3, 40000.0, 3), + ('tightRNN', 50): TauCuts(3, 50000.0, 3), + ('tightRNN', 60): TauCuts(3, 60000.0, 3), + ('tightRNN', 80): TauCuts(3, 80000.0, 3), + ('tightRNN', 115): TauCuts(3, 115000.0, 3), + ('tightRNN', 125): TauCuts(3, 125000.0, 3), + ('tightRNN', 160): TauCuts(3, 160000.0, 3), + ('tightRNN', 200): TauCuts(3, 200000.0, 3), + ('perf',0) : TauCuts(3,0.,2), + ('perf',25) : TauCuts(3,25000.,2), + ('perf',160) : TauCuts(3,160000.,2), + ('idperf',0) : TauCuts(3,0.,2), + ('idperf',25) : TauCuts(3,25000.,2), + ('idperf',160): TauCuts(3,160000.,2) + } def TrigEFTauMVHypoToolFromDict( chainDict ): name = chainDict['chainName'] + chainPart = chainDict['chainParts'][0] + + criteria = chainPart['selection'] + threshold = chainPart['threshold'] + from TrigTauHypo.TrigTauHypoConf import TrigEFTauMVHypoTool currentHypo = TrigEFTauMVHypoTool(name) - currentHypo.level = 1 - currentHypo.method = 3 - currentHypo.MonTool = "" + currentHypo.MonTool = "" + + theThresh = thresholdsEF[(criteria, int(threshold))] + currentHypo.numTrackMax = theThresh.numTrackMax + currentHypo.EtCalibMin = theThresh.EtCalibMin + currentHypo.level = theThresh.level + currentHypo.method = 2 + + if criteria in [ 'verylooseRNN', 'looseRNN', 'mediumRNN', 'tightRNN' ]: + currentHypo.numTrackMin = 0 + currentHypo.highptidthr = 280000. + currentHypo.method = 3 + elif 'perf' in criteria: + currentHypo.AcceptAll = True return currentHypo def TrigTauTrackHypoToolFromDict( chainDict ): name = chainDict['chainName'] + chainPart = chainDict['chainParts'][0] + + criteria = chainPart['selection'] + threshold = chainPart['threshold'] from TrigTauHypo.TrigTauHypoConf import TrigTrackPreSelHypoTool currentHypo = TrigTrackPreSelHypoTool(name) currentHypo.MonTool = "" + if criteria == 'cosmic': + currentHypo.LowerPtCut = int(threshold)*1000. + currentHypo.TracksInCoreCut = 9999 + currentHypo.TracksInIsoCut = 9999 + currentHypo.DeltaZ0Cut = 9999. + return currentHypo @@ -33,34 +172,16 @@ def TrigL2TauHypoToolFromDict( chainDict ): name = chainDict['chainName'] chainPart = chainDict['chainParts'][0] - part='calo' - threshold=chainPart['threshold'] - strategy=chainPart['preselection'] - - # Simple implementation of 2015 pre-selection - #currentHypoKey = 'l2'+part+'_tau'+threshold+'_'+criteria+'_'+strategy - - # Re-define the calo part using the generic hypo - if part == 'calo': - from TrigTauHypo.TrigTauHypoConf import TrigTauGenericHypoMT - currentHypo = TrigTauGenericHypoMT(name) - currentHypo.MonTool = "" - currentHypo.AcceptAll = False - if 'idperf' in name: - currentHypo.AcceptAll = True - - # pT cut always defined: ugly string-to-int-to-string conversion, sorry :) - myThreshold = str(int(threshold)*1000.0) - theDetails = [int(-1)] - theFormulas = ['y > '+myThreshold] - - if strategy in [ 'calo', 'ptonly', 'track', 'tracktwo', 'tracktwoEF', 'tracktwoMVA', 'FTK', 'FTKRefit', 'FTKNoPrec' , 'tracktwoEFmvaTES' ]: - # centFrac cut (detail #24: 2nd order fit, turn-off at ~ 55 GeV, 95% efficiency) - theDetails += [24] - theFormulas += ['x > (0.945 - (1.26e-05*TMath::Min(y, 50000.)) + (1.05e-10*TMath::Min(y, 50000.)*TMath::Min(y, 50000.)))'] - # centFrac cut (detail #24: 2nd order fit, turn-off at 50 GeV, 90% efficiency) - # theFormulas += ['x > TMath::Max(0.936 - (8.5e-06*y) + (6.54e-11*y*y), 0.660)'] - currentHypo.Details = theDetails - currentHypo.Formulas = theFormulas + criteria = chainPart['selection'] + threshold = chainPart['threshold'] + + from TrigTauHypo.TrigTauHypoConf import TrigTauGenericHypoMT + currentHypo = TrigTauGenericHypoMT(name) + currentHypo.MonTool = "" + currentHypo.Details = [int(-1)] + currentHypo.Formulas = ['y > '+threshold+'*1000.0'] + + if 'perf' in criteria: + currentHypo.AcceptAll = True return currentHypo diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauMVHypoTool.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauMVHypoTool.cxx index d126229085804de7634dfe1ffd989cc8776b3272..3f70a64908801edcced907372ce789d885bf9df9 100644 --- a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauMVHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauMVHypoTool.cxx @@ -93,6 +93,14 @@ bool TrigEFTauMVHypoTool::decide(const ITrigEFTauMVHypoTool::TauJetInfo& input ) // general reset PassedCuts = 0; + if ( m_acceptAll ) { + pass = true; + ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" ); + } else { + pass = false; + ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" ); + } + //get RoI descriptor auto roiDescriptor = input.roi; float roIEta = roiDescriptor->eta(); diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauMVHypoTool.h b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauMVHypoTool.h index 82df617d98d127d3f24c8ef8434948747f59d5c8..b98bae47882174468c7a29c035beea1d73e7a134 100644 --- a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauMVHypoTool.h +++ b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauMVHypoTool.h @@ -51,6 +51,8 @@ class TrigEFTauMVHypoTool : public extends<AthAlgTool, ITrigEFTauMVHypoTool> { Gaudi::Property<int> m_numTrack{ this, "numTrack", -100, "Tau number of tracks" }; Gaudi::Property<int> m_numWideTrack{ this, "numWideTrack", 1, "Tau number of wide tracks" }; + Gaudi::Property<bool> m_acceptAll{ this, "AcceptAll", false, "Ignore selection" }; + ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Monitoring tool" }; diff --git a/Trigger/TrigMonitoring/TrigCostMonitorMT/CMakeLists.txt b/Trigger/TrigMonitoring/TrigCostMonitorMT/CMakeLists.txt index 0baf431770664fb8f7713e14dd9736f232b04937..2ed82d64fb0eb3634ff0f2861fcf672deaa14e29 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitorMT/CMakeLists.txt +++ b/Trigger/TrigMonitoring/TrigCostMonitorMT/CMakeLists.txt @@ -7,25 +7,19 @@ atlas_subdir( TrigCostMonitorMT ) find_package(TBB) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - PRIVATE - Control/AthenaBaseComps - Control/AthViews - Trigger/TrigTools/TrigTimeAlgs - Trigger/TrigConfiguration/TrigConfHLTData - Trigger/TrigEvent/TrigSteeringEvent - Event/xAOD/xAODTrigger ) - # Component(s) in the package: +atlas_add_library( TrigCostMonitorMTLib + TrigCostMonitorMT/*.h + INTERFACE + PUBLIC_HEADERS TrigCostMonitorMT + LINK_LIBRARIES AthenaBaseComps GaudiKernel StoreGateLib xAODTrigger ) + atlas_add_component( TrigCostMonitorMT src/*.cxx src/components/*.cxx INCLUDE_DIRS ${TBB_INCLUDE_DIRS} - LINK_LIBRARIES GaudiKernel AthenaBaseComps AthViews TrigSteeringEvent TrigTimeAlgsLib xAODTrigger TrigConfHLTData ${TBB_LIBRARIES} ) + LINK_LIBRARIES ${TBB_LIBRARIES} AthContainers AthViews AthenaKernel TrigConfHLTData TrigCostMonitorMTLib TrigSteeringEvent TrigTimeAlgsLib ) # Install files from the package: -atlas_install_headers( TrigCostMonitorMT ) -atlas_install_python_modules( python/*.py) - atlas_install_joboptions( share/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/CMakeLists.txt b/Trigger/TrigMonitoring/TrigEgammaMonitoring/CMakeLists.txt index aa819fa17e53feb02c78bc486d72fea63fadce7f..4c6582517f14a35cb24013a805e9a50ab2c4a122 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/CMakeLists.txt +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/CMakeLists.txt @@ -7,17 +7,68 @@ atlas_subdir( TrigEgammaMonitoring ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC - Trigger/TrigEvent/TrigCaloEvent - Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigEvent/TrigParticle + Control/AthToolSupport/AsgTools + Event/xAOD/xAODCaloEvent + Event/xAOD/xAODEgamma + Event/xAOD/xAODEventInfo + Event/xAOD/xAODJet + Event/xAOD/xAODPrimitives + Event/xAOD/xAODTracking + Event/xAOD/xAODTrigCalo + Event/xAOD/xAODTrigEgamma + Event/xAOD/xAODTrigRinger + Event/xAOD/xAODTrigger + Event/xAOD/xAODTruth + Event/xAOD/xAODMissingET + Event/xAOD/xAODCaloRings + LumiBlock/LumiBlockComps + PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools + Reconstruction/RecoTools/RecoToolInterfaces + Reconstruction/egamma/egammaMVACalib + Trigger/TrigAnalysis/TrigDecisionTool + Trigger/TrigAnalysis/TrigEgammaAnalysisTools + Trigger/TrigAnalysis/TrigEgammaMatchingTool + Trigger/TrigConfiguration/TrigConfHLTData Trigger/TrigEvent/TrigSteeringEvent - Control/AthenaMonitoring ) + Trigger/TrigMonitoring/TrigHLTMonitoring + PhysicsAnalysis/AnalysisCommon/PATCore + PRIVATE + Control/AthenaBaseComps + Control/AthenaMonitoring + Control/StoreGate + GaudiKernel + Trigger/TrigConfiguration/TrigConfxAOD ) +# External dependencies: +find_package( Boost ) +find_package( ROOT COMPONENTS Core Hist Tree ) -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) +atlas_add_component( TrigEgammaMonitoring + src/*.h + src/*.cxx + src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} AsgTools xAODCaloEvent xAODMissingET xAODEgamma xAODEventInfo xAODJet xAODTracking xAODTrigCalo xAODTrigEgamma xAODTrigRinger xAODCaloRings xAODTrigger xAODTruth LumiBlockCompsLib ElectronPhotonSelectorToolsLib egammaMVACalibLib TrigDecisionToolLib TrigEgammaMatchingToolLib TrigConfHLTData TrigSteeringEvent TrigHLTMonitoringLib AthenaBaseComps AthenaMonitoringLib StoreGateLib SGtests GaudiKernel PATCoreLib TrigEgammaAnalysisToolsLib) + +# Install files from the package: + # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) + + + + + + + + + + + + + + + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py index 1416e24a84cf4a3df7881693912df970e854e362..2d84219e60d20faacc6ba619c0c3e5e3707844e2 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py @@ -1,5 +1,24 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +################################ +###### Run-3 develpments ####### +################################ +# Should be removed for future +monitoring_electron_Run3 = ['HLT_e3_etcut_L1EM3','HLT_e5_etcut_L1EM3','HLT_e7_etcut_L1EM3','HLT_e300_etcut_L1EM24VHI'] +monitoring_photon_Run3 = ['HLT_g5_etcut_L1EM3','HLT_g5_loose_L1EM3','HLT_g5_medium_L1EM3','HLT_g5_tight_L1EM3','HLT_g140_loose_L1EM24VH'] +monitoring_tags_Run3 = ['HLT_e26_lhtight_L1EM24VHI'] +monitoringTP_electron_Run3 = ['HLT_e26_lhtight_L1EM24VHI','HLT_e60_lhmedium_L1EM24VHI','HLT_e140_lhloose_L1EM24VHI'] +monitoringTP_Jpsiee_Run3 = [] + + + + +################################################ +# Official triggers +################################################ + + #Categories currently used by offline Egamma TO monitoring tool #Important to keep lists updated primary_single_ele = ['HLT_e24_lhtight_nod0','HLT_e26_lhtight_nod0','HLT_e28_lhtight_nod0','HLT_e60_lhmedium_nod0_L1EM24VHI','HLT_e80_lhmedium_nod0_L1EM24VHI','HLT_e140_lhloose_nod0_L1EM24VHI'] diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py index 681da8a14a93f254527417add884208b7ced7d25..c89e00654f0b2b4e00fd40f8059188e0dfb289aa 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py @@ -18,62 +18,45 @@ log_trigeg = logging.getLogger( 'TrigEgammaMonitorAlgorithm' ) def TrigEgammaMonConfig(inputFlags): '''Function to configures some algorithms in the monitoring system.''' + # The following class will make a sequence, configure algorithms, and link - # them to GenericMonitoringTools from AthenaMonitoring import AthMonitorCfgHelper - #from AthenaConfiguration.ComponentFactory import CompFactory - - - ##from TrigEgammaAnalysisToolsMT.TrigEgammaAnalysisToolsMTConf import TrigEgammaMonAlgorithm helper = AthMonitorCfgHelper(inputFlags,'TrigEgammaAthMonitorCfg') - ##monAlg = helper.addAlgorithm(TrigEgammaMonAlgorithm,'TrigEgammaMonAlg') - - - # configure alg and ana tools - ##from TrigEgammaMonitoring.TrigEgammaMonitoringMTConfig import TrigEgammaMonToolBuilder - # The last arg shold be an config flag for future - # The helper.resobj is the component accumulator created by the helper and will hold all - # algs and tools created by this configuration - ##montoolCfg = TrigEgammaMonToolBuilder( monAlg , "TrigEgammaMonAlg", helper.resobj, '2018') # Using 2018 e/g tunings - - - - - # configure all histograms - ##from TrigEgammaAnalysisToolsMT.TrigEgammaAnalysisMTBuilder import TrigEgammaAnalysisBuilder - ## get the histogram builder for all analysis tools for e/g staff. - ## link the algotihm and helper with the ana builder. - ## All generic monitoring tools will be attached inside of the monAlg and componenet accumulator - ##anatoolCfg = TrigEgammaAnalysisBuilder( helper, monAlg, 'TrigEgammaMonAlg', montoolCfg.basePath , - ## montoolCfg.detailLevel) - - - - - # Get only unique triggers - #triggerList = [] - #for anaTool in montoolCfg.anaTools: - # triggerList.extend(anaTool.TriggerList) - - - # Check there is duplicate trigger into the trigger list. If we have, abort - #if not (len(triggerList) == len(set(triggerList))): - # raise RuntimeError( "There are duplicate trigger into the e/g monitoring list.") - - + from TrigEgammaMonitoring.TrigEgammaMonitoringMTConfig import TrigEgammaMonAlgBuilder + monAlgCfg = TrigEgammaMonAlgBuilder( helper, '2018', detailedHistogram=True ) # Using 2018 e/g tunings + + # Force monitor builder + monAlgCfg.activate_zee=False + monAlgCfg.activate_jpsiee=False + monAlgCfg.activate_electron=True + monAlgCfg.activate_photon=False + # build monitor and book histograms + monAlgCfg.configure() - # Attach the histogram manager my monAlg that pointet to "TrigEgammaMonAlg" - # All hisograms will be "TrigEgammaMonAlg/HLT/Egamma/trigger/..." where - # "TrigEgammaMonAlg" is the monname and HLT/Egamma is the basepath - #for trigger in triggerList: - # anatoolCfg.bookTriggerHistograms( trigger , doJpsiee = True if 'Jpsi' in anaTool.name() else False ) + # Test matching tool + # The following class will make a sequence, configure algorithms, and link + #from AthenaMonitoring import AthMonitorCfgHelper + #helper = AthMonitorCfgHelper(inputFlags,'TrigEgammaAthMonitorCfg') + #from TrigEgammaMatchingTool.TrigEgammaMatchingToolConf import TrigEgammaMatchingToolMTTest, Trig__TrigEgammaMatchingToolMT + #mon = helper.addAlgorithm( TrigEgammaMatchingToolMTTest, "TrigEgammaMatchingToolMTTest" ) + #triggers = [ + # "HLT_e26_etcut_L1EM22VHI", + # "HLT_e26_lhtight_L1EM24VHI", + # "HLT_e300_etcut_L1EM24VHI", + # "HLT_e3_etcut_L1EM3", + # "HLT_e5_etcut_L1EM3", + # "HLT_e7_etcut_L1EM3", + # ] + #tool = Trig__TrigEgammaMatchingToolMT("MatchingTool") + #mon.TrigEgammaMatchingToolMT = tool + #mon.TriggerList = triggers + #helper.resobj.addPublicTool(tool) + - #for anaTool in montoolCfg.anaTools: - # anatoolCfg.bookEventHistograms( anaTool ) @@ -97,15 +80,14 @@ if __name__=='__main__': # Setup logs from AthenaCommon.Logging import log - from AthenaCommon.Constants import DEBUG - log.setLevel(DEBUG) + from AthenaCommon.Constants import INFO + log.setLevel(INFO) # Set the Athena configuration flags from AthenaConfiguration.AllConfigFlags import ConfigFlags - nightly = '/eos/user/f/fernando/data18_13TeV/' - file = 'AOD.15529645._000080.pool.root.1' - ConfigFlags.Input.Files = [nightly+file] + path = '/afs/cern.ch/work/j/jodafons/public/valid_sampleA/AOD.20745922._000041.pool.root.1' + ConfigFlags.Input.Files = [path] ConfigFlags.Input.isMC = False ConfigFlags.Output.HISTFileName = 'TrigEgammaMonitorOutput.root' @@ -123,7 +105,7 @@ if __name__=='__main__': # If you want to turn on more detailed messages ... - trigEgammaMonitorAcc.getEventAlgo('TrigEgammaMonAlg').OutputLevel = 2 # DEBUG - cfg.printConfig(withDetails=True) # set True for exhaustive info + #trigEgammaMonitorAcc.getEventAlgo('TrigEgammaMonAlg').OutputLevel = 2 # DEBUG + cfg.printConfig(withDetails=False) # set True for exhaustive info cfg.run(10) #use cfg.run(20) to only run on first 20 events diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorHelper.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorHelper.py new file mode 100644 index 0000000000000000000000000000000000000000..f45bb179e4cd06cbb0c936e21a7be56fc2aa6378 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorHelper.py @@ -0,0 +1,90 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# + +'''@file TrigEgammaMonitoringConfigRun3.py +@author D. Maximov +@date 2019-07-08 +@brief Run 3 configuration builder. Histograms definitions taken from TrigEgammaPlotTool +''' + + + +class THWrapper(object): + def __init__(self, name): + self.name = name + self.kwargs = {} + + def __setitem__(self, key, value): + self.kwargs[key] = value + + + + +def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs): + + res = THWrapper(name) + res['type'] = 'TH1F' + res['title'] = title + + if isinstance(bins_par2, (list, tuple) ): # signature 2 + res['xbins'] = bins_par2 + else: # signature 1 + res['xbins'] = nxbins + res['xmin'] = bins_par2 + res['xmax'] = bins_par3 + + res['path'] = path + res.kwargs.update(kwargs) + return res + + + + + +def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='/', **kwargs): + + res = THWrapper(name) + res['type'] = 'TH2F' + res['title'] = title + + if isinstance(bins_par2, (list, tuple) ): # signature 2 or 4 + res['xbins'] = bins_par2 + if isinstance(bins_par4, (list, tuple) ): # signature 4 + res['ybins'] = bins_par4 + else: # signature 2 + res['ybins'] = bins_par3 + res['ymin'] = bins_par4 + res['ymax'] = bins_par5 + + else: # signature 1 or 3 + res['xbins'] = nxbins + res['xmin'] = bins_par2 + res['xmax'] = bins_par3 + if isinstance(bins_par5, (list, tuple) ): # signature 3 + res['ybins'] = bins_par5 + else: # signature 1 + res['ybins'] = bins_par4 + res['ymin'] = bins_par5 + res['ymax'] = bins_par6 + + res['path'] = path + res.kwargs.update(kwargs) + return res + + + + + + + +def TProfile(*args, **kwargs): + res = TH1F(*args, **kwargs) + res.name = res.name + res['type'] = 'TProfile' + return res + + + + + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..88818fbf724b9ce7a16097aa2438a875e5054e56 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py @@ -0,0 +1,631 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +'''@file TrigEgammaMonitoringConfigRun3.py +@author D. Maximov (histograms), Joao victor Pinto (core) +@date 2019-07-08 +@brief Run 3 configuration builder. Histograms definitions taken from TrigEgammaPlotTool +''' + +from AthenaCommon.Constants import DEBUG +from TrigEgammaMonitoring.TrigEgammaMonitCategory import monitoring_tags_Run3, monitoring_electron_Run3, monitoring_photon_Run3, monitoringTP_electron_Run3, monitoringTP_Jpsiee_Run3 +#from TrigEgammaAnalysisTools.TrigEgammaProbelist import monitoring_electron, monitoring_photon, monitoringTP_electronJpsiee, monitoringTP_electron +from TrigEgammaHypo.TrigEgammaPidTools import ElectronPidTools +from TrigEgammaHypo.TrigEgammaPidTools import PhotonPidTools +import cppyy + +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaConfiguration.ComponentFactory import CompFactory as CfgMgr + + +if 'DQMonFlags' not in dir(): + from AthenaMonitoring.DQMonFlags import DQMonFlags as dqflags + + + + +class TrigEgammaMonAlgBuilder: + + _configured = False + _get_monitoring_mode_success = False + + data_type = '' + pp_mode = False + pPb_mode = False + HI_mode = False + cosmic_mode = False + mc_mode = False + activate_electron = False + activate_photon = False + activate_zee = False + activate_jpsiee = False + tagItems = [] + JpsitagItems = [] + electronList = [] + photonList = [] + tpList = [] + jpsiList = [] + + # Monitoring algorithms + zeeMonAlg = None + jpsieeMonAlg = None + elMonAlg = None + phMonAlg = None + + + # Add a flag to enable emulation + __acceptable_keys_list=['derivation','emulation', 'debugLevel', 'detailedHistograms','basePath'] + emulation = False + derivation = False + debugLevel = DEBUG + detailedHistograms = False + basePath = 'HLT/EgammaMon' + + + isemnames = ["Tight", "Medium", "Loose"] + lhnames = ["LHTight", "LHMedium", "LHLoose"] + + + def __init__(self, helper, runflag, **kwargs): + + from AthenaCommon.Logging import logging + self.__logger = logging.getLogger( 'TrigEgammaMonAlgBuilder' ) + self.runFlag = runflag + self.helper = helper + if not self._configured: + for key,value in kwargs.items(): + if key in self.__acceptable_keys_list: + setattr(self,key,value) + self.configureMode() + + + + def configureMode(self): + + self.__logger.info("TrigEgammaMonToolBuilder.configureMode()") + self._get_monitoring_mode_success = self.get_monitoring_mode() + if self._get_monitoring_mode_success is False: + self.__logger.warning("HLTMonTriggerList: Error getting monitoring mode, default monitoring lists will be used.") + else: + self.__logger.info("Configuring for %s", self.data_type) + + # Since we load the tools by name below + # Need to ensure the correct tools are configured + # for each monitoring mode + if self.mc_mode is True or self.pp_mode is True: + if(self.derivation is True or self.emulation is True): + self.activate_zee = True + else: + self.activate_zee=True + self.activate_jpsiee=True + self.activate_electron=True + self.activate_photon=True + elif self.HI_mode is True or self.pPb_mode is True or self.cosmic_mode is True: + self.activate_electron=True + self.activate_photon=True + else: + self.activate_zee=True + self.activate_jpsiee=True + self.activate_electron=True + self.activate_photon=True + + + def configure(self): + self.setProperties() + self.configureMonitor() + self.configureHistograms() + + + + + # Implementation of https://its.cern.ch/jira/browse/ATR-13200 + def get_monitoring_mode(self): + + self.__logger.info("TrigEgammaMonToolBuilder.get_monitoring_mode()") + self.data_type = dqflags.monManDataType() + if self.data_type == 'monteCarlo': + self.mc_mode = True + return True + elif self.data_type == 'collisions': + self.pp_mode = True + return True + elif self.data_type == 'heavyioncollisions': + self.HI_mode = True + self.pPb_mode = True + return True + elif self.data_type == 'cosmics': + self.cosmic_mode = True + return True + else: + return False + + + def setProperties(self): + + self.__logger.info("TrigEgammaMonToolBuilder.setProperties()") + self.basePath = 'HLT/EgammaMon' + self.tagItems = monitoring_tags_Run3 + self.JpsitagItems = [] + + if self.pp_mode is True: + self.setDefaultProperties() + elif self.cosmic_mode is True: + # This should be change in future + self.setDefaultProperties() + elif self.HI_mode is True or self.pPb_mode is True: + # This should be change in future + self.setDefaultProperties() + elif self.mc_mode is True: + # This should be change in future + self.setDefaultProperties() + else: + self.__logger.info('No monitoring mode configured, use default') + self.setDefaultProperties() + + + self.__logger.info('Configuring TP electron chains %s',self.tpList) + self.__logger.info('Configuring electron chains %s',self.electronList) + self.__logger.info('Configuring photon chains %s',self.photonList) + + + + def setDefaultProperties(self): + + self.electronList = monitoring_electron_Run3 + self.photonList = monitoring_photon_Run3 + self.tpList = monitoringTP_electron_Run3 + self.jpsiList = monitoringTP_Jpsiee_Run3 + + + # + # Create all minitor algorithms + # + def configureMonitor( self ): + + acc = self.helper.resobj + EgammaMatchTool = CompFactory.TrigEgammaMatchingToolMT() + EgammaMatchTool.OutputLevel=2 + EgammaMatchTool.DeltaR=0.4 + acc.addPublicTool(EgammaMatchTool) + cppyy.loadDictionary('ElectronPhotonSelectorToolsDict') + # Following loads the online selectors + + # setup all pid tools + ElectronPidTools() + PhotonPidTools() + + # Offline selectors -- taken from latest conf + LooseElectronSelector = CfgMgr.AsgElectronIsEMSelector("T0HLTLooseElectronSelector") + MediumElectronSelector = CfgMgr.AsgElectronIsEMSelector("T0HLTMediumElectronSelector") + TightElectronSelector = CfgMgr.AsgElectronIsEMSelector("T0HLTTightElectronSelector") + LooseLHSelector = CfgMgr.AsgElectronLikelihoodTool("T0HLTLooseLHSelector") + MediumLHSelector = CfgMgr.AsgElectronLikelihoodTool("T0HLTMediumLHSelector") + TightLHSelector = CfgMgr.AsgElectronLikelihoodTool("T0HLTTightLHSelector") + VeryLooseLHSelector = CfgMgr.AsgElectronLikelihoodTool("T0HLTVeryLooseLHSelector") + + acc.addPublicTool(LooseElectronSelector) + acc.addPublicTool(MediumElectronSelector) + acc.addPublicTool(TightElectronSelector) + acc.addPublicTool(LooseLHSelector) + acc.addPublicTool(MediumLHSelector) + acc.addPublicTool(TightLHSelector) + acc.addPublicTool(VeryLooseLHSelector) + + if self.runFlag == '2018': + # cut based + LooseElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMLooseSelectorCutDefs.conf" + MediumElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMMediumSelectorCutDefs.conf" + TightElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMTightSelectorCutDefs.conf" + # 2018 (vtest) + LooseLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc16_20170828/ElectronLikelihoodLooseOfflineConfig2017_CutBL_Smooth.conf" + MediumLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc16_20170828/ElectronLikelihoodMediumOfflineConfig2017_Smooth.conf" + TightLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc16_20170828/ElectronLikelihoodTightOfflineConfig2017_Smooth.conf" + VeryLooseLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc16_20170828/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth.conf" + elif self.runFlag == '2017': + # cut based + LooseElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMLooseSelectorCutDefs.conf" + MediumElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMMediumSelectorCutDefs.conf" + TightElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMTightSelectorCutDefs.conf" + # 2017 (v11) + LooseLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodLooseOfflineConfig2016_CutBL_Smooth.conf" + MediumLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodMediumOfflineConfig2016_Smooth.conf" + TightLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodTightOfflineConfig2016_Smooth.conf" + VeryLooseLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodVeryLooseOfflineConfig2016_Smooth.conf" + else: + # raise since the configuration its not defined + raise RuntimeError( 'Wrong run flag configuration' ) + + + if self.activate_zee: + + self.__logger.info( "Creating the Zee monitor algorithm...") + self.zeeMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorTagAndProbeAlgorithm, "TrigEgammaMonitorTagAndProbeAlgorithm_Zee" ) + self.zeeMonAlg.Analysis='Zee' + self.zeeMonAlg.MatchTool = EgammaMatchTool + self.zeeMonAlg.TPTrigger=False + self.zeeMonAlg.ElectronKey = 'Electrons' + self.zeeMonAlg.isEMResultNames=self.isemnames + self.zeeMonAlg.LHResultNames=self.lhnames + self.zeeMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector] + self.zeeMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector] + self.zeeMonAlg.ZeeLowerMass=80 + self.zeeMonAlg.ZeeUpperMass=100 + self.zeeMonAlg.OfflineTagMinEt=25 + self.zeeMonAlg.OfflineTagSelector='LHTight' + self.zeeMonAlg.OfflineProbeSelector='LHLoose' + self.zeeMonAlg.OppositeCharge=True + self.zeeMonAlg.RemoveCrack=False + self.zeeMonAlg.TagTriggerList=self.tagItems + self.zeeMonAlg.TriggerList=self.tpList + self.zeeMonAlg.DetailedHistograms=self.detailHistograms + self.zeeMonAlg.OutputLevel=self.debugLevel + + + if self.activate_jpsiee: + + self.__logger.info( "Creating the Jpsiee monitor algorithm...") + self.jpsieeMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorTagAndProbeAlgorithm, "TrigEgammaMonitorTagAndProbeAlgorithm_Jpsiee" ) + self.jpsieeMonAlg.DoJpsiee=True + self.jpsieeMonAlg.Analysis='Jpsiee' + self.jpsieeMonAlg.MatchTool = EgammaMatchTool + self.jpsieeMonAlg.TPTrigger=False + self.jpsieeMonAlg.ElectronKey = 'Electrons' + self.jpsieeMonAlg.isEMResultNames=self.isemnames + self.jpsieeMonAlg.LHResultNames=self.lhnames + self.jpsieeMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector] + self.jpsieeMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector] + self.jpsieeMonAlg.ZeeLowerMass=2 + self.jpsieeMonAlg.ZeeUpperMass=5 + self.jpsieeMonAlg.OfflineTagMinEt=5 + self.jpsieeMonAlg.OfflineTagSelector='LHTight' + self.jpsieeMonAlg.OfflineProbeSelector='LHLoose' + self.jpsieeMonAlg.OppositeCharge=True + self.jpsieeMonAlg.RemoveCrack=False + self.jpsieeMonAlg.TagTriggerList=self.tagItems + self.jpsieeMonAlg.TriggerList=self.tpList + self.jpsieeMonAlg.DetailedHistograms=self.detailedHistograms + self.jpsieeMonAlg.OutputLevel=self.debugLevel + + + if self.activate_electron: + + self.__logger.info( "Creating the Electron monitor algorithm...") + self.elMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorElectronAlgorithm, "TrigEgammaMonitorElectronAlgorithm" ) + self.elMonAlg.MatchTool = EgammaMatchTool + self.elMonAlg.ElectronKey = 'Electrons' + self.elMonAlg.isEMResultNames=self.isemnames + self.elMonAlg.LHResultNames=self.lhnames + self.elMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector] + self.elMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector] + self.elMonAlg.ForcePidSelection=False + self.elMonAlg.ForceProbeIsolation=False + self.elMonAlg.ForceEtThreshold=True + self.elMonAlg.TriggerList=self.electronList + self.elMonAlg.DetailedHistograms=self.detailedHistograms + self.elMonAlg.OutputLevel=self.debugLevel + + if self.activate_photon: + + self.__logger.info( "Creating the Photon monitor algorithm...") + self.phMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorPhotonAlgorithm, "TrigEgammaMonitorPhotonAlgorithm" ) + self.phMonAlg.MatchTool = EgammaMatchTool + self.phMonAlg.PhotonKey = 'Photons' + self.phMonAlg.isEMResultNames=self.isemnames + self.phMonAlg.LHResultNames=self.lhnames + self.phMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector] + self.phMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector] + self.phMonAlg.TriggerList=self.tpList + self.phMonAlg.DetailedHistograms=self.detailedHistograms + self.phMonAlg.OutputLevel=self.debugLevel + + + + + def configureHistograms(self): + + if self.activate_zee and self.zeeMonAlg: + self.setBinning() + self.bookEvent( self.zeeMonAlg, self.zeeMonAlg.Analysis ) + triggers = self.zeeMonAlg.TriggerList; triggers.extend( self.zeeMonAlg.TagTriggerList ) + self.bookExpertHistograms( self.zeeMonAlg, triggers ) + if self.activate_jpsiee and self.jpsieeMonAlg: + self.setBinning(True) + self.bookEvent( self.jpsieeMonAlg, self.jpsieeMonAlg.Analysis ) + triggers = self.jpsieeMonAlg.TriggerList; triggers.extend( self.jpsieeMonAlg.TagTriggerList ) + self.bookExpertHistograms( self.jpsieeMonAlg, triggers ) + + self.setBinning() + if self.activate_electron and self.elMonAlg: + self.bookExpertHistograms( self.elMonAlg, self.elMonAlg.TriggerList ) + if self.activate_photon and self.phMonAlg: + self.bookExpertHistograms( self.phMonAlg, self.phMonAlg.TriggerList ) + + + + def addGroup( self, monAlg, name, path ): + return self.helper.addGroup( monAlg, name, path ) + + def addHistogram(self, monGroup, hist): + monGroup.defineHistogram(hist.name, **hist.kwargs) + + + # + # Booking all histograms + # + def bookExpertHistograms( self, monAlg, triggers ): + + self.__logger.info( "Booking all histograms for alg: %s", monAlg.name ) + + for trigger in triggers: + self.bookL1CaloDistributions( monAlg, trigger ) + self.bookL2CaloDistributions( monAlg, trigger ) + self.bookL2ElectronDistributions( monAlg, trigger ) + self.bookEFCaloDistributions( monAlg, trigger ) + self.bookShowerShapesAndTrackingDistributions( monAlg, trigger, online=True ) + self.bookShowerShapesAndTrackingDistributions( monAlg, trigger, online=False ) + self.bookEfficiencies( monAlg, trigger, "L1Calo" ) + self.bookEfficiencies( monAlg, trigger, "L2Calo" ) + self.bookEfficiencies( monAlg, trigger, "L2" ) + self.bookEfficiencies( monAlg, trigger, "EFCalo" ) + self.bookEfficiencies( monAlg, trigger, "HLT" ) + + if self.detailedHistograms: + for pid in self.isemnames + self.lhnames: + self.bookEfficiencies( monAlg, trigger, "HLT", pid ) + self.bookEfficiencies( monAlg, trigger, "HLT", pid+"Iso" ) + + + + def bookEvent(self, monAlg, analysis): + + #cutLabels = ["Events","LAr","RetrieveElectrons","TwoElectrons","PassTrigger","EventWise","Success"] + #probeLabels=["Electrons","NotTag","OS","SS","ZMass","HasTrack","HasCluster","Eta","Et","IsGoodOQ","GoodPid","NearbyJet","Isolated"] + # Create mon group. The group name should be the path name for map + monGroup = self.addGroup( monAlg, 'Event', self.basePath+'/Expert/Event' ) + monGroup.defineHistogram(analysis+"_CutCounter", type='TH1I', path='/', title="Event Selection; Cut ; Count",xbins=6, xmin=0, xmax=6) + monGroup.defineHistogram(analysis+"_TagCutCounter", type='TH1F', path='', title="Number of Probes; Cut ; Count",xbins=12, xmin=0, xmax=12) + monGroup.defineHistogram(analysis+"_ProbeCutCounter", type='TH1F', path='', title="Number of Probes; Cut ; Count",xbins=12, xmin=0, xmax=12) + monGroup.defineHistogram(analysis+"_Mee", type='TH1F', path='/', title="Offline M(ee); m_ee [GeV] ; Count",xbins=50, xmin=monAlg.ZeeLowerMass, xmax=monAlg.ZeeUpperMass) + + + # + # Book L1Calo distributions + # + def bookL1CaloDistributions( self , monAlg, trigger ): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F + monGroup = self.addGroup( monAlg, trigger+'_Distributions_L1Calo', self.basePath+'/'+trigger+'/Distributions/L1Calo' ) + + self.addHistogram(monGroup, TH1F("energy", "Cluster Energy; E [GeV] ; Count", 100, 0., 200.)) + self.addHistogram(monGroup, TH1F("roi_eta", "RoI word Cluster Energy; E [GeV] ; Count", 100, 0, 200)) + self.addHistogram(monGroup, TH1F("emIso", "EM Isolation; E [GeV] ; Count", 50, -1., 20.)) + self.addHistogram(monGroup, TH1F("hadCore", "HAD Isolation; E [GeV] ; Count", 50, -1., 20.)) + self.addHistogram(monGroup, TH1F("eta", "eta; eta ; Count", 50, -2.5, 2.5)) + self.addHistogram(monGroup, TH1F("phi", "phi; phi ; Count", 20, -3.2, 3.2)) + + + + # + # Book L2Calo distributions + # + def bookL2CaloDistributions( self , monAlg, trigger ): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F + monGroup = self.addGroup( monAlg, trigger+'_Distributions_L2Calo', self.basePath+'/'+trigger+'/Distributions/L2Calo' ) + + self.addHistogram(monGroup, TH1F("et", "ET; ET [GeV] ; Count", 100, 0., 100.)) + self.addHistogram(monGroup, TH1F("eta", "eta; eta ; Count", self._nEtabins, self._etabins)) + self.addHistogram(monGroup, TH1F("phi", "phi; phi ; Count", 20, -3.2, 3.2)) + + + # + # book L2 Electron distributions + # + def bookL2ElectronDistributions( self, monAlg, trigger ): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F + monGroup = self.addGroup( monAlg, trigger+'_Distributions_L2Electron', self.basePath+'/'+trigger+'/Distributions/L2' ) + + self.addHistogram(monGroup, TH1F("et", "ET; ET [GeV] ; Count", 100, 0., 100.)) + self.addHistogram(monGroup, TH1F("eta", "eta; eta ; Count", self._nEtabins, self._etabins)) + self.addHistogram(monGroup, TH1F("phi", "phi; phi ; Count", 20, -3.2, 3.2)) + + + # + # Book EFCalo distributions + # + def bookEFCaloDistributions( self, monAlg, trigger ): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F + monGroup = self.addGroup( monAlg, trigger+'_Distributions_EFCalo', self.basePath+'/'+trigger+'/Distributions/EFCalo' ) + + self.addHistogram(monGroup, TH1F("et", "ET; ET [GeV] ; Count", 100, 0., 100.)) + self.addHistogram(monGroup, TH1F("eta", "eta; eta ; Count", self._nEtabins, self._etabins)) + self.addHistogram(monGroup, TH1F("phi", "phi; phi ; Count", 20, -3.2, 3.2)) + self.addHistogram(monGroup, TH1F("energy", "Cluster Energy; E [GeV] ; Count", 50, 0., 100.)) + self.addHistogram(monGroup, TH1F("eta_calo", "eta_calo; eta_calo ; Count", 50, -2.47, 2.47)) + self.addHistogram(monGroup, TH1F("phi_calo", "phi_calo; phi_calo ; Count", 50, -3.14, 3.14)) + self.addHistogram(monGroup, TH1F("energyBE0", "Cluster Energy BE0; E [GeV] ; Count", 50, 0., 100.)) + self.addHistogram(monGroup, TH1F("energyBE1", "Cluster Energy BE1; E [GeV] ; Count", 50, 0., 100.)) + self.addHistogram(monGroup, TH1F("energyBE2", "Cluster Energy BE2; E [GeV] ; Count", 50, 0., 100.)) + self.addHistogram(monGroup, TH1F("energyBE3", "Cluster Energy BE3; E [GeV] ; Count", 50, 0., 100.)) + + + + # + # Book Shower shapes + # + def bookShowerShapesAndTrackingDistributions( self, monAlg, trigger, online=True ): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F + monGroup = self.addGroup( monAlg, trigger+'_Distributions_' + ("HLT" if online else "Offline"), + self.basePath+'/'+trigger+'/Distributions/' + ("HLT" if online else "Offline") ) + + self.addHistogram(monGroup, TH1F("ethad", "ethad; ethad ; Count", 20, -10, 10)) + self.addHistogram(monGroup, TH1F("ethad1", "ethad1; ehad1 ; Count", 20, -10, 10)) + self.addHistogram(monGroup, TH1F("Rhad", "Rhad; Rhad ; Count", 35, -0.3, 0.3)) + self.addHistogram(monGroup, TH1F("Rhad1", "Rhad1; Rhad1 ; Count", 30, -0.3, 0.3)) + self.addHistogram(monGroup, TH1F("Reta", "Reta; Reta ; Count", 15, 0., 1.5)) + self.addHistogram(monGroup, TH1F("Rphi", "Rphi; Rphi ; Count", 15, 0., 1.5)) + self.addHistogram(monGroup, TH1F("weta1", "weta1; weta1 ; Count", 12, 0.4, 1.)) + self.addHistogram(monGroup, TH1F("weta2", "weta2; weta2 ; Count", 20, 0., 0.02)) + self.addHistogram(monGroup, TH1F("f1", "f1; f1 ; Count", 11, -0.1, 1.)) + self.addHistogram(monGroup, TH1F("f3", "f3; f3 ; Count", 21, -0.1, 0.2)) + self.addHistogram(monGroup, TH1F("eratio","eratio; eratio; Count",20, 0, 2)) + self.addHistogram(monGroup, TH1F("et", "ET; ET [GeV] ; Count", 100, 0., 100.)) + self.addHistogram(monGroup, TH1F("highet", "Offline E_{T}; E_{T} [GeV] ; Count", 100, 0., 2000.)) + self.addHistogram(monGroup, TH1F("eta", "eta; eta ; Count", self._nEtabins, self._etabins)) + self.addHistogram(monGroup, TH1F("phi", "phi; phi ; Count", 20, -3.2, 3.2)) + self.addHistogram(monGroup, TH1F("topoetcone20", "topoetcone20; topoetcone20 [GeV] ; Count", 100, -10.0, 10.0)) + self.addHistogram(monGroup, TH1F("topoetcone20_rel", "topoetcone20/pt; topoetcone20/pt ; Count", 100, -0.5, 0.5)) + self.addHistogram(monGroup, TH1F("topoetcone40_shift", "topoetcone40-2.45 GeV; topoetcone40-2.45 GeV [GeV] ; Count", 100, -10.0, 10.0)) + self.addHistogram(monGroup, TH1F("topoetcone40_shift_rel", "(topoetcone40-2.45 GeV)/pt; (topoetcone40-2.45 GeV)/pt ; Count", 100, -0.5, 0.5)) + + + # Tracking quantities + self.addHistogram(monGroup, TH1F("deta1", "deta1; deta1 ; Count", 40, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("deta1_EMECA", "deta1 EMEC-A; deta1 ; Count", 40, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("deta1_EMECC", "deta1 EMEC-C; deta1 ; Count", 40, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("deta1_EMEBA", "deta1 EMEB-A; deta1 ; Count", 40, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("deta1_EMEBC", "deta1 EMEB-A; deta1 ; Count", 40, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("deta2", "deta2; deta2 ; Count", 40, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("dphi2", "dphi2; dphi2 ; Count", 40, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("dphiresc", "dphiresc; dphiresc ; Count", 40, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("eprobht","eProbHT; eProbHT; Count",20, 0, 1.)) + self.addHistogram(monGroup, TH1F("npixhits","nPixHit; nPixHits; Count",10, 0, 10)) + self.addHistogram(monGroup, TH1F("nscthits","nSCTHit; nSCTHits; Count",20, 0, 20)) + self.addHistogram(monGroup, TH1F("charge","charge; charge; Count", 4,-2,2)) + self.addHistogram(monGroup, TH1F("ptcone20", "ptcone20; ptcone20; Count", 50, 0.0, 5.0)) + self.addHistogram(monGroup, TH1F("ptvarcone20", "ptcone20; ptcone20; Count", 50, 0.0, 5.0)) + self.addHistogram(monGroup, TH1F("d0", "d0; d0 ; Count", 40, -1, 1)) + self.addHistogram(monGroup, TH1F("d0sig", "d0sig; d0sig ; Count", 40, -10, 10)) + self.addHistogram(monGroup, TH1F("pt", "p_{T}; p_{T} [GeV] ; Count", 100,0.,100.)) + self.addHistogram(monGroup, TH1F("ptcone20_rel", "ptcone20/pt; ptcone20/pt; Count", 50, 0.0, 1.0)) + self.addHistogram(monGroup, TH1F("ptvarcone20_rel", "ptcone20/pt; ptcone20/pt; Count", 50, 0.0, 1.0)) + + + # + # Book efficiencies + # + def bookEfficiencies(self, monAlg, trigger, level, subgroup=None ): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F, TProfile + if subgroup: + monGroup = self.addGroup( monAlg, trigger+'_Efficiency_'+level+'_'+subgroup, self.basePath+'/'+trigger+'/Efficiency/'+level+'/'+subgroup ) + else: + monGroup = self.addGroup( monAlg, trigger+'_Efficiency_'+level, self.basePath+'/'+trigger+'/Efficiency/'+level ) + + + + # Numerator + self.addHistogram(monGroup, TH1F("match_pt", "Trigger Matched Offline p_{T}; p_{T} [GeV] ; Count", self._nEtbins, self._etbins)) + self.addHistogram(monGroup, TH1F("match_et", "Trigger Matched Offline E_{T}; E_{T} [GeV]; Count", self._nEtbins, self._etbins)) + self.addHistogram(monGroup, TH1F("match_highet", "Trigger Matched Offline E_{T}; E_{T} [GeV]; Count", 40, 0., 1000.)) + self.addHistogram(monGroup, TH1F("match_eta", "Trigger Matched Offline #eta; #eta ; Count", self._nEtabins, self._etabins)) + self.addHistogram(monGroup, TH1F("match_phi", "Trigger Matched #phi; #phi ; Count", 20, -3.2, 3.2)) + self.addHistogram(monGroup, TH1F("match_avgmu", "Trigger Matched <#mu>; <#mu> ; Count", 16, 0, 80)) + self.addHistogram(monGroup, TH1F("match_npvtx", "Trigger Matched npvtx; npvtx ; Count", 16, 0, 80)) + + # Denominator + self.addHistogram(monGroup, TH1F("pt", "Offline p_{T}; p_{T} [GeV] ; Count", self._nEtbins, self._etbins)) + self.addHistogram(monGroup, TH1F("et", "Offline E_{T}; E_{T} [GeV] ; Count", self._nEtbins, self._etbins)) + self.addHistogram(monGroup, TH1F("highet", "Offline E_{T}; E_{T} [GeV] ; Count", 40, 0., 1000.)) + self.addHistogram(monGroup, TH1F("eta", "Offline #eta; #eta ; Count", self._nEtabins, self._etabins)) + self.addHistogram(monGroup, TH1F("phi", "Offline #phi; #phi ; Count", 20, -3.2, 3.2)) + self.addHistogram(monGroup, TH1F("avgmu", "<#mu>; <#mu> ; Count", 16, 0, 80)) + self.addHistogram(monGroup, TH1F("npvtx", "npvtx; npvtx ; Count", 16, 0, 80)) + + # Efficiency + self.addHistogram(monGroup, TProfile("pt,pt_passed", "#epsilon(p_T); p_{T} ; Efficiency", self._nEtbins, self._etbins)) + self.addHistogram(monGroup, TProfile("et,et_passed", "#epsilon(E_T); E_{T} [GeV] ; Efficiency", self._nEtbins, self._etbins)) + self.addHistogram(monGroup, TProfile("highet,highet_passed", "#epsilon(E_T); E_{T} [GeV] ; Efficiency", 40, 0., 1000.)) + self.addHistogram(monGroup, TProfile("eta,eta_passed", "#epsilon(#eta); #eta ; Efficiency", self._nEtabins, self._etabins)) + self.addHistogram(monGroup, TProfile("phi,phi_passed", "#epsilon(#phi); #phi ; Efficiency", 20, -3.2, 3.2)) + self.addHistogram(monGroup, TProfile("avgmu,avgmu_passed", "#epsilon(<#mu>); <#mu> ; Efficiency", 16, 0, 80)) + self.addHistogram(monGroup, TProfile("npvtx,npvtx_passed", "#epsilon(npvtx); npvtx ; Efficiency", 16, 0, 80)) + + + + + + + + # + # Set binning + # + def setBinning(self, doJpsiee=False): + + """ Method to define all binning required that is variable""" + + # Binning as defined in TP framework + coarse_eta_bins = [-2.47,-1.52,-1.37,-0.60,0.00,0.60,1.37,1.52,2.47] # 9 items + + coarse_et_bins = [4.,20.,30.,40.,50.,60.,150.] # 7 items + + default_eta_bins = [-2.47,-2.37,-2.01,-1.81,-1.52,-1.37,-1.15,-0.80,-0.60,-0.10,0.00, + 0.10, 0.60, 0.80, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] # 21 items + + default_et_bins = [4.,7.,10.,15.,20.,25.,30.,35.,40.,45.,50.,60.,80.,150.] # 14 items + + etabins = [-2.47,-2.37,-2.01,-1.81,-1.52,-1.37,-1.15,-0.8,-0.6,-0.1, + 0.0,0.1,0.6,0.8,1.15,1.37,1.52,1.81,2.01,2.37,2.47] # 21 items + + # TH2 with variable bin x-Axis, but constant bin y-Axis takes only Double_t arrays + etbins_Zee = [0.,2.,4.,6.,8.,10., + 12.,14.,16.,18.,20.,22.,24.,26.,28., + 30.,32.,34.,36.,38.,40.,42.,44.,46.,48.,50.,55.,60.,65.,70.,100.] # 31 items + + etbins_Jpsiee = [ 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, + 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, + 10,10.5,11,11.5,12,12.5,13,13.5,14,14.5, + 15,15.5,16,16.5,17,17.5,18,18.5,19,19.5, + 20,20.5,21,21.5,22,22.5,23,23.5,24,24.5, + 25,25.5] # 52 items + + + if doJpsiee: + self._nEtbins=51 + self._etbins = etbins_Jpsiee[0:self._nEtbins+1] + else: + self._nEtbins=30 + self._etbins = etbins_Zee[0:self._nEtbins+1] + + # Define the binning + self._nEtabins=20 + self._ndefaultEtbins=13 + self._ndefaultEtabins=20 + self._ncoarseEtbins=6 + self._ncoarseEtabins=8 + + #Fill the arrays + self._etabins = etabins[0:self._nEtabins+1] + self._defaultEtbins = default_et_bins[0:self._ndefaultEtbins+1] + self._defaultEtabins = default_eta_bins[0:self._ndefaultEtabins+1] + self._coarseEtbins = coarse_et_bins[0:self._ncoarseEtbins+1] + self._coarseEtabins = coarse_eta_bins[0:self._ncoarseEtabins+1] + + + + def getTrigInfo( self, trigger ): + + class TrigEgammaInfo(object): + + def __init__(self, trigger): + self.__chain = trigger + + def chain(self): + return self.__chain + + def isL1Item(self): + return True if self.chain().startswith('L1') else False + + def isElectron(self): + return True if (self.isL1Item() or self.chain().startswith('HLT_e')) else False + + def isPhoton(self): + return True if (self.chain().startswith('HLT_g')) else False + + def pidname(self): + return self.chain().split('_')[2] + + return TrigEgammaInfo(trigger) + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6cf0aed54ff4e4904d53773377da72809864a4c8 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx @@ -0,0 +1,695 @@ + + +#include "TrigEgammaMonitorAnalysisAlgorithm.h" + + +TrigEgammaMonitorAnalysisAlgorithm::TrigEgammaMonitorAnalysisAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ): + TrigEgammaMonitorBaseAlgorithm( name, pSvcLocator ) + +{} + +TrigEgammaMonitorAnalysisAlgorithm::~TrigEgammaMonitorAnalysisAlgorithm() +{} + + +StatusCode TrigEgammaMonitorAnalysisAlgorithm::initialize() +{ + + ATH_CHECK(TrigEgammaMonitorBaseAlgorithm::initialize()); + + return StatusCode::SUCCESS; +} + + + + +// ********************************************************************************* + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillLabel( const ToolHandle<GenericMonitoringTool>& groupHandle, + const std::string &histname, + const std::string &label ) const +{ + auto mon = Monitored::Scalar<std::string>( histname, label ); + fill( groupHandle, mon ); +} + + + + +// ********************************************************************************* + +void TrigEgammaMonitorAnalysisAlgorithm::fillEfficiencies( std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs, + const TrigInfo info ) const +{ + + std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pair_vec; + std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pair_iso_vec; + + + for( auto pairObj : pairObjs ){ + + if(pairObj.first->type()==xAOD::Type::Electron){ + const xAOD::Electron* el = static_cast<const xAOD::Electron *> (pairObj.first); + float et = getEt(el)/1e3; + if(et < info.trigThrHLT-5.0) continue; + + }else if(pairObj.first->type()==xAOD::Type::Photon){ + float et = getCluster_et(pairObj.first)/1e3; + if(et < info.trigThrHLT-5.0) continue; + + if(boost::contains(info.trigName,"icalovloose")) { + if (getIsolation_topoetcone20(pairObj.first)/getCluster_et(pairObj.first) >= 0.065) continue; // pass FixedCutLoose offline isolation + } + else { + if ((getIsolation_topoetcone40(pairObj.first)-2450.0)/getCluster_et(pairObj.first) >= 0.022) continue; // pass FixedCutTightCaloOnly offline isolation + } + } // Offline photon + + // Good pair to be measure + pair_vec.push_back(pairObj); + + if( pairObj.first->auxdecor<bool>("Isolated") ){ + pair_iso_vec.push_back(pairObj); + } + } + + + if (info.trigL1){ + fillEfficiency( "L1Calo", "L1Calo" , info.trigPidDecorator, info, pair_vec ); + }else{ + fillEfficiency( "L1Calo" , "L1Calo", info.trigPidDecorator, info, pair_vec ); + fillEfficiency( "L2Calo" , "L2Calo", info.trigPidDecorator, info, pair_vec ); + fillEfficiency( "L2" , "L2" , info.trigPidDecorator, info, pair_vec ); + fillEfficiency( "EFCalo" , "EFCalo", info.trigPidDecorator, info, pair_vec ); + fillEfficiency( "HLT" , "HLT" , info.trigPidDecorator, info, pair_vec ); + + if( m_detailedHists ){ + + for( const auto pid : m_isemname ){ + fillEfficiency( "HLT_" + pid, "HLT", "is"+pid, info, pair_vec ); + fillEfficiency( "HLT_" + pid + "Iso", "HLT", "is"+pid, info, pair_iso_vec ); + } + + for( const auto pid : m_lhname ){ + fillEfficiency( "HLT_" + pid, "HLT", "is"+pid, info, pair_vec ); + fillEfficiency( "HLT_" + pid + "Iso", "HLT", "is"+pid, info, pair_iso_vec ); + } + } + } +} + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillEfficiency( const std::string &subgroup, + const std::string &level, + const std::string &pidword, + const TrigInfo info, + std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision* >> pairObjs) const +{ + + + + const float etthr = info.trigThrHLT; + const std::string trigger = info.trigName; + + + auto monGroup = getGroup( trigger + "_Efficiency_" + subgroup ); + + + std::vector<float> et_vec, highet_vec, pt_vec, eta_vec, phi_vec, avgmu_vec, npvtx_vec; + std::vector<float> match_et_vec, match_highet_vec, match_pt_vec, match_eta_vec, match_phi_vec, match_avgmu_vec, match_npvtx_vec; + std::vector<bool> et_passed_vec, highet_passed_vec, pt_passed_vec, eta_passed_vec, phi_passed_vec, avgmu_passed_vec, npvtx_passed_vec; + + auto et_col = Monitored::Collection( "et" , et_vec ); + auto highet_col = Monitored::Collection( "highet" , highet_vec ); + auto pt_col = Monitored::Collection( "pt" , pt_vec ); + auto eta_col = Monitored::Collection( "eta" , eta_vec ); + auto phi_col = Monitored::Collection( "phi" , phi_vec ); + auto avgmu_col = Monitored::Collection( "avgmu" , avgmu_vec ); + auto npvtx_col = Monitored::Collection( "npvtx" , npvtx_vec ); + + auto match_et_col = Monitored::Collection( "match_et" , match_et_vec ); + auto match_highet_col = Monitored::Collection( "match_ethigh" , match_highet_vec ); + auto match_pt_col = Monitored::Collection( "match_pt" , match_pt_vec ); + auto match_eta_col = Monitored::Collection( "match_eta" , match_eta_vec ); + auto match_phi_col = Monitored::Collection( "match_phi" , match_phi_vec ); + auto match_avgmu_col = Monitored::Collection( "match_avgmu" , match_avgmu_vec ); + auto match_npvtx_col = Monitored::Collection( "match_npvtx" , match_npvtx_vec ); + + auto et_passed_col = Monitored::Collection( "et_passed" , et_passed_vec ); + auto highet_passed_col = Monitored::Collection( "highet_passed" , highet_passed_vec ); + auto pt_passed_col = Monitored::Collection( "pt_passed" , pt_passed_vec ); + auto eta_passed_col = Monitored::Collection( "eta_passed" , eta_passed_vec ); + auto phi_passed_col = Monitored::Collection( "phi_passed" , phi_passed_vec ); + auto avgmu_passed_col = Monitored::Collection( "avgmu_passed" , avgmu_passed_vec ); + auto npvtx_passed_col = Monitored::Collection( "npvtx_passed" , npvtx_passed_vec ); + + + for( auto pairObj : pairObjs ){ + + auto acceptData = setAccept( pairObj.second, info ); + bool pid=true; + bool isPassed = acceptData.getCutResult( level ); + float et=0.; + const auto *eg = pairObj.first; + ATH_MSG_DEBUG("Default pid " << pid << " te " << isPassed); + if(xAOD::EgammaHelpers::isElectron(eg)){ + ATH_MSG_DEBUG("Offline Electron with pidword " << pidword); + const xAOD::Electron* el =static_cast<const xAOD::Electron*> (eg); + pid=el->auxdecor<bool>(pidword); + ATH_MSG_DEBUG("Electron pid " << pid); + et = getEt(el)/1e3; + } + else et=eg->caloCluster()->et()/1e3; + + float eta = eg->caloCluster()->etaBE(2); + float phi = eg->phi(); + float pt = eg->pt()/1e3; + float avgmu=lbAverageInteractionsPerCrossing( Gaudi::Hive::currentContext() ); + float npvtx=0.0; + + ATH_MSG_DEBUG("PID decision efficiency " << eg->auxdecor<bool>(pidword)); + + if(pid){ + et_vec.push_back( et ); + pt_vec.push_back( pt ); + highet_vec.push_back( et ); + + if(et > etthr+1.0){ + eta_vec.push_back(eta); + phi_vec.push_back(phi); + avgmu_vec.push_back(avgmu); + npvtx_vec.push_back(npvtx); + } + + if(isPassed) { + match_et_vec.push_back( et ); + match_pt_vec.push_back( pt ); + match_highet_vec.push_back( et ); + + if(et > etthr+1.0){ + match_eta_vec.push_back(eta); + match_phi_vec.push_back(phi); + match_avgmu_vec.push_back(avgmu); + match_npvtx_vec.push_back(npvtx); + } + + et_passed_vec.push_back( true ); + pt_passed_vec.push_back( true ); + highet_passed_vec.push_back( true ); + + if(et > etthr+1.0){ + eta_passed_vec.push_back( true ); + phi_passed_vec.push_back( true ); + avgmu_passed_vec.push_back( true ); + npvtx_passed_vec.push_back( true ); + } + } // Passes Trigger selection + else { + + et_passed_vec.push_back( false ); + pt_passed_vec.push_back( false ); + highet_passed_vec.push_back( false ); + + if(et > etthr+1.0){ + eta_passed_vec.push_back( false ); + phi_passed_vec.push_back( false ); + avgmu_passed_vec.push_back( false ); + npvtx_passed_vec.push_back( false ); + } + } // Fails Trigger selection + } // Passes offline pid, fill histograms + } + + + fill( monGroup, et_col, highet_col, pt_col, eta_col, phi_col, avgmu_col, npvtx_col, + match_et_col, match_highet_col, match_pt_col, match_eta_col, match_phi_col, match_avgmu_col, match_npvtx_col, + et_passed_col, highet_passed_col, pt_passed_col, eta_passed_col, phi_passed_col, avgmu_passed_col, npvtx_passed_col); + +} + + + +// ********************************************************************************* + + +void TrigEgammaMonitorAnalysisAlgorithm::fillDistributions( std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs, + const TrigInfo info ) const +{ + + const std::string trigger = info.trigName; + + if (info.trigL1){ + + // Fill L1 features + std::vector<const xAOD::EmTauRoI*> l1_vec; + auto initRois = tdt()->features<TrigRoiDescriptorCollection>(trigger,TrigDefs::includeFailedDecisions,"", + TrigDefs::allFeaturesOfType,"initialRoI"); + for( auto &initRoi: initRois ){ + if( !initRoi.link.isValid() ) continue; + auto feat = match()->getL1Feature( initRoi.source ); + if(feat) + l1_vec.push_back(feat); + } + + fillL1Calo( trigger, l1_vec ); + + + }else{ + + + // Offline + std::vector<const xAOD::Egamma*> eg_vec; + std::vector<const xAOD::Electron*> el_vec; + for( auto pairObj: pairObjs ) + { + eg_vec.push_back(pairObj.first); + if( xAOD::EgammaHelpers::isElectron(pairObj.first)){ + const xAOD::Electron* elOff = static_cast<const xAOD::Electron*> (pairObj.first); + el_vec.push_back(elOff); + } + } + + // Offline + fillShowerShapes( trigger, eg_vec, false ); + fillTracking( trigger, el_vec, false ); + + + + if( m_tp ){ + + if( info.trigType == "electron" ){ + // HLT Electron + { + std::vector<const xAOD::Electron*> el_vec; + std::vector<const xAOD::Egamma*> eg_vec; + auto vec = tdt()->features<xAOD::ElectronContainer>(trigger,TrigDefs::includeFailedDecisions ,match()->key("Electron") ); + for( auto &featLinkInfo : vec ){ + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + // If not pass, continue + el_vec.push_back(feat); + eg_vec.push_back(feat); + } + fillShowerShapes( trigger, eg_vec, true ); + fillTracking( trigger, el_vec, true ); + } + + }else{ + ATH_MSG_WARNING( "Chain type not Electron for TP trigger" ); + } + + + }else{ + + // L1Calo + { + // Fill L1 features + std::vector<const xAOD::EmTauRoI*> l1_vec; + auto initRois = tdt()->features<TrigRoiDescriptorCollection>(trigger,TrigDefs::includeFailedDecisions,"", + TrigDefs::allFeaturesOfType,"initialRoI"); + for( auto &initRoi: initRois ){ + if( !initRoi.link.isValid() ) continue; + auto feat = match()->getL1Feature( initRoi.source ); + if(feat) + l1_vec.push_back(feat); + } + + fillL1Calo( trigger, l1_vec ); + } + + + // L2Calo + { + std::vector<const xAOD::TrigEMCluster*> emCluster_vec; + auto vec = tdt()->features<xAOD::TrigEMClusterContainer>(trigger,TrigDefs::includeFailedDecisions ,match()->key("L2Calo") ); + for(auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + emCluster_vec.push_back(feat); + } + fillL2Calo( trigger, emCluster_vec ); + } + + + // EFCalo + { + std::vector<const xAOD::CaloCluster* > clus_vec; + auto vec = tdt()->features<xAOD::CaloClusterContainer>(trigger,TrigDefs::Physics ,match()->key("EFCalo") ); + for(auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + clus_vec.push_back(feat); + } + fillEFCalo( trigger, clus_vec ); + } + + + if ( info.trigType == "electron" ){ + + // L2 Electron + { + std::vector<const xAOD::TrigElectron*> el_vec; + // Get only passed objects + auto vec = tdt()->features<xAOD::TrigElectronContainer>(trigger,TrigDefs::Physics ,match()->key("L2Electron") ); + for( auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + el_vec.push_back(feat); + } + fillL2Electron( trigger, el_vec ); + } + + + // HLT Electron + { + std::vector<const xAOD::Electron*> el_vec; + std::vector<const xAOD::Egamma*> eg_vec; + auto vec = tdt()->features<xAOD::ElectronContainer>(trigger, TrigDefs::Physics ,match()->key("Electron") ); + for( auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + el_vec.push_back(feat); + eg_vec.push_back(feat); + } + fillShowerShapes( trigger, eg_vec, true ); + fillTracking( trigger, el_vec, true ); + } + + + }else if ( info.trigType == "photon"){ + // HLT Photon + { + std::vector<const xAOD::Egamma*> ph_vec; + auto vec = tdt()->features<xAOD::PhotonContainer>(trigger,TrigDefs::Physics ,match()->key("Photon") ); + for( auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + ph_vec.push_back(feat); + } + fillShowerShapes( trigger, ph_vec, true ); + } + }else{ + ATH_MSG_INFO( "Chain type not specified" ); + } + + } + + } +} + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillL1Calo( const std::string &trigger, std::vector< const xAOD::EmTauRoI* > l1_vec ) const +{ + auto monGroup = getGroup(trigger+"_Distributions_L1Calo"); + + std::vector<float> eta_vec, phi_vec, energy_vec, roi_et_vec, emIso_vec, hadCore_vec; + + auto eta_col = Monitored::Collection( "eta" , eta_vec ); + auto phi_col = Monitored::Collection( "phi" , phi_vec ); + auto energy_col = Monitored::Collection( "energy" , energy_vec ); + auto roi_et_col = Monitored::Collection( "roi_et" , roi_et_vec ); + auto emIso_col = Monitored::Collection( "emIso" , emIso_vec ); + auto hadCore_col = Monitored::Collection( "hadCore" , hadCore_vec ); + + for( auto l1 : l1_vec ) + { + if(!l1) continue; + eta_vec.push_back( l1->eta() ); + phi_vec.push_back( l1->phi() ); + energy_vec.push_back( l1->emClus()/1.e3 ); + roi_et_vec.push_back( l1->eT()/1.e3 ); + emIso_vec.push_back( l1->emIsol()/1.e3 ); + hadCore_vec.push_back( l1->hadCore()/1.e3 ); + } + + fill( monGroup, eta_col, phi_col, energy_col, roi_et_col, emIso_col, hadCore_col ); + +} + + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillL2Calo(const std::string &trigger, std::vector< const xAOD::TrigEMCluster *> emCluster_vec) const +{ + auto monGroup = getGroup(trigger+"_Distributions_L2Calo"); + + std::vector<float> et_vec, eta_vec, phi_vec; + + auto et_col = Monitored::Collection("et" , et_vec ); + auto eta_col = Monitored::Collection("eta", eta_vec ); + auto phi_col = Monitored::Collection("phi", phi_vec ); + + for ( auto emCluster : emCluster_vec ) + { + if(!emCluster) continue; + et_vec.push_back( emCluster->et()/1.e3 ); + eta_vec.push_back( emCluster->eta() ); + phi_vec.push_back( emCluster->phi() ); + } + + fill( monGroup, et_col, eta_col, phi_col ); + + +} + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillL2Electron(const std::string &trigger, std::vector< const xAOD::TrigElectron* > el_vec) const +{ + + auto monGroup = getGroup(trigger+"_Distributions_L2Electron"); + + std::vector<float> et_vec, eta_vec, phi_vec; + + auto et_col = Monitored::Collection("et" , et_vec ); + auto eta_col = Monitored::Collection("eta", eta_vec ); + auto phi_col = Monitored::Collection("phi", phi_vec ); + + for ( auto el : el_vec ) + { + if(!el) continue; + et_vec.push_back( el->pt()/1.e3 ); + eta_vec.push_back( el->eta() ); + phi_vec.push_back( el->phi() ); + } + + fill( monGroup, et_col, eta_col, phi_col ); +} + +void TrigEgammaMonitorAnalysisAlgorithm::fillEFCalo(const std::string &trigger, std::vector< const xAOD::CaloCluster*> clus_vec) const +{ + + auto monGroup = getGroup( trigger + "_Distributions_EFCalo" ); + + + std::vector<float> energyBE0_vec, energyBE1_vec, energyBE2_vec, energyBE3_vec, + energy_vec, et_vec, eta_vec, phi_vec, eta_calo_vec, phi_calo_vec; + + + + auto energyBE0_col = Monitored::Collection("energyBE0", energyBE0_vec); + auto energyBE1_col = Monitored::Collection("energyBE1", energyBE1_vec); + auto energyBE2_col = Monitored::Collection("energyBE2", energyBE2_vec); + auto energyBE3_col = Monitored::Collection("energyBE3", energyBE3_vec); + auto energy_col = Monitored::Collection("energy" , energy_vec ); + auto et_col = Monitored::Collection("et" , et_vec ); + auto eta_col = Monitored::Collection("eta" , eta_vec ); + auto phi_col = Monitored::Collection("phi" , phi_vec ); + auto eta_calo_col = Monitored::Collection("eta_calo" , eta_calo_vec ); + auto phi_calo_col = Monitored::Collection("phi_calo" , phi_calo_vec ); + + for ( auto clus : clus_vec ) + { + double tmpeta = -999.; + if(!clus->retrieveMoment(xAOD::CaloCluster::ETACALOFRAME,tmpeta)) + tmpeta=-999.; + double tmpphi = -999.; + if(!clus->retrieveMoment(xAOD::CaloCluster::PHICALOFRAME,tmpphi)) + tmpphi=-999.; + + energyBE0_vec.push_back( clus->energyBE(0)/1.e3 ); + energyBE1_vec.push_back( clus->energyBE(1)/1.e3 ); + energyBE2_vec.push_back( clus->energyBE(2)/1.e3 ); + energyBE3_vec.push_back( clus->energyBE(3)/1.e3 ); + energy_vec.push_back( clus->e()/1.e3 ); + et_vec.push_back( clus->et()/1.e3 ); + eta_vec.push_back( clus->eta() ); + phi_vec.push_back( clus->phi() ); + eta_calo_vec.push_back( tmpeta ); + phi_calo_vec.push_back( tmpphi ); + + } + + + fill( monGroup, energyBE0_col, energyBE1_col, energyBE2_col, energyBE3_col, + energy_col, et_col, eta_col, phi_col, eta_calo_col, phi_calo_col); +} + + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillShowerShapes(const std::string &trigger, std::vector<const xAOD::Egamma*> eg_vec , bool online) const +{ + + ATH_MSG_DEBUG("Fill SS distributions: " << trigger); + auto monGroup = getGroup( trigger + ( online ? "_Distributions_HLT" : "_Distributions_Offline") ); + + std::vector<float> ethad_vec, ethad1_vec, Rhad_vec, Rhad1_vec, Reta_vec, Rphi_vec, weta1_vec, weta2_vec, + f1_vec, f3_vec, eratio_vec, et_vec, highet_vec , eta_vec, phi_vec, topoetcone20_vec, topoetcone40_shift_vec, + topoetcone20_rel_vec, topoetcone40_shift_rel_vec; + + + auto ethad_col = Monitored::Collection("ethad" , ethad_vec ); + auto ethad1_col = Monitored::Collection("ethad1" , ethad1_vec ); + auto Rhad_col = Monitored::Collection("Rhad" , Rhad_vec ); + auto Rhad1_col = Monitored::Collection("Rhad1" , Rhad1_vec ); + auto Reta_col = Monitored::Collection("Reta" , Reta_vec ); + auto Rphi_col = Monitored::Collection("Rphi" , Rphi_vec ); + auto weta1_col = Monitored::Collection("weta1" , weta1_vec ); + auto weta2_col = Monitored::Collection("weta2" , weta2_vec ); + auto f1_col = Monitored::Collection("f1" , f1_vec ); + auto f3_col = Monitored::Collection("f3" , f3_vec ); + auto eratio_col = Monitored::Collection("eratio" , eratio_vec ); + auto et_col = Monitored::Collection("et" , et_vec ); + auto highet_col = Monitored::Collection("highet" , highet_vec ); + auto eta_col = Monitored::Collection("eta" , eta_vec ); + auto phi_col = Monitored::Collection("phi" , phi_vec ); + auto topoetcone20_col = Monitored::Collection("topoetcone20", topoetcone20_vec); + auto topoetcone40_shift_col = Monitored::Collection("topoetcone40_shift", topoetcone40_shift_vec ); + auto topoetcone20_rel_col = Monitored::Collection("topoetcone20_rel", topoetcone20_rel_vec); + auto topoetcone40_shift_rel_col = Monitored::Collection("topoetcone40_shift_rel", topoetcone40_shift_rel_vec ); + + for ( auto eg : eg_vec ){ + + if(!eg) continue; + + ethad_vec.push_back( getShowerShape_ethad(eg)/1e3); + ethad1_vec.push_back( getShowerShape_ethad1(eg)/1e3); + Rhad_vec.push_back( getShowerShape_Rhad(eg)); + Rhad1_vec.push_back( getShowerShape_Rhad(eg)); + Reta_vec.push_back( getShowerShape_Reta(eg)); + Rphi_vec.push_back( getShowerShape_Rphi(eg)); + weta1_vec.push_back( getShowerShape_weta1(eg)); + weta2_vec.push_back( getShowerShape_weta2(eg)); + f1_vec.push_back( getShowerShape_f1(eg)); + f3_vec.push_back( getShowerShape_f3(eg)); + eratio_vec.push_back( getShowerShape_Eratio(eg)); + et_vec.push_back( eg->pt()/1e3); + highet_vec.push_back( eg->pt()/1e3); + eta_vec.push_back( eg->eta()); + phi_vec.push_back( eg->phi()); + topoetcone20_vec.push_back( getIsolation_topoetcone20(eg)/1e3); + topoetcone40_shift_vec.push_back( (getIsolation_topoetcone40(eg)-2450)/1e3 ); + + if (eg->pt() > 0) { + topoetcone20_rel_vec.push_back( getIsolation_topoetcone20(eg)/eg->pt()); + topoetcone40_shift_rel_vec.push_back( (getIsolation_topoetcone40(eg)-2450)/eg->pt() ); + } + + }// Loop over egamma objects + + fill( monGroup, ethad_col, ethad1_col, Rhad_col, Rhad1_col, Reta_col, Rphi_col, weta1_col, weta2_col, + f1_col, f3_col, eratio_col, et_col, highet_col , eta_col, phi_col, topoetcone20_col, topoetcone40_shift_col, + topoetcone20_rel_col, topoetcone40_shift_rel_col ); + +} + + +void TrigEgammaMonitorAnalysisAlgorithm::fillTracking(const std::string &trigger, std::vector< const xAOD::Electron *> eg_vec, bool online ) const +{ + + ATH_MSG_DEBUG("Fill tracking"); + + auto monGroup = getGroup( trigger + ( online ? "_Distributions_HLT" : "_Distributions_Offline") ); + + std::vector<float> deta1_vec, deta1_EMECA_vec, deta1_EMECC_vec, deta1_EMEBA_vec, deta1_EMEBC_vec, deta2_vec, dphi2_vec, + dphiresc_vec, eprobht_vec, npixhits_vec, nscthits_vec, charge_vec, ptcone20_vec, ptvarcone20_vec, d0_vec, d0sig_vec, + pt_vec, ptcone20_rel_vec, ptvarcone20_rel_vec; + + auto deta1_col = Monitored::Collection( "deta1" , deta1_vec ); + auto deta1_EMECA_col = Monitored::Collection( "deta1_EMECA" , deta1_EMECA_vec ); + auto deta1_EMECC_col = Monitored::Collection( "deta1_EMECC" , deta1_EMECC_vec ); + auto deta1_EMEBA_col = Monitored::Collection( "deta1_EMEBA" , deta1_EMEBA_vec ); + auto deta1_EMEBC_col = Monitored::Collection( "deta1_EMEBC" , deta1_EMEBC_vec ); + auto deta2_col = Monitored::Collection( "deta2" , deta2_vec ); + auto dphi2_col = Monitored::Collection( "dphi2" , dphi2_vec ); + auto dphiresc_col = Monitored::Collection( "dphiresc" , dphiresc_vec ); + auto eprobht_col = Monitored::Collection( "eprobht" , eprobht_vec ); + auto npixhits_col = Monitored::Collection( "npixhits" , npixhits_vec ); + auto nscthits_col = Monitored::Collection( "nscthits" , nscthits_vec ); + auto charge_col = Monitored::Collection( "charge" , charge_vec ); + auto ptcone20_col = Monitored::Collection( "ptcone20" , ptcone20_vec ); + auto ptvarcone20_col = Monitored::Collection( "ptvarcone20" , ptvarcone20_vec ); + auto d0_col = Monitored::Collection( "d0" , d0_vec ); + auto d0sig_col = Monitored::Collection( "d0sig" , d0sig_vec ); + auto pt_col = Monitored::Collection( "pt" , pt_vec ); + auto ptcone20_rel_col = Monitored::Collection( "ptcone20_rel", ptcone20_rel_vec ); + auto ptvarcone20_rel_col = Monitored::Collection( "ptvarcone20" , ptvarcone20_rel_vec ); + + + for ( auto eg : eg_vec ){ + + if(!eg) continue; + + float cleta = 0.; + if(eg->caloCluster()) cleta=eg->caloCluster()->eta(); + else cleta=eg->eta(); + + deta1_vec.push_back( getCaloTrackMatch_deltaEta1(eg)); + + if(cleta > 1.375 && cleta < 3.2) + deta1_EMECA_vec.push_back( getCaloTrackMatch_deltaEta1(eg)); + if(cleta < -1.375 && cleta > -3.2) + deta1_EMECC_vec.push_back( getCaloTrackMatch_deltaEta1(eg)); + if(cleta > 0 && cleta < 1.375) + deta1_EMEBA_vec.push_back( getCaloTrackMatch_deltaEta1(eg)); + if(cleta < 0 && cleta > -1.375) + deta1_EMEBC_vec.push_back( getCaloTrackMatch_deltaEta1(eg)); + + deta2_vec.push_back( getCaloTrackMatch_deltaEta2(eg)); + dphi2_vec.push_back( getCaloTrackMatch_deltaPhi2(eg)); + dphiresc_vec.push_back( getCaloTrackMatch_deltaPhiRescaled2(eg)); + eprobht_vec.push_back( getTrackSummaryFloat_eProbabilityHT(eg)); + npixhits_vec.push_back( getTrackSummary_numberOfPixelHits(eg)); + nscthits_vec.push_back( getTrackSummary_numberOfSCTHits(eg)); + charge_vec.push_back( eg->charge()); + ptcone20_vec.push_back( getIsolation_ptcone20(eg)/1e3); + ptvarcone20_vec.push_back( getIsolation_ptvarcone20(eg)/1e3); + + // Quantities directly from tracks + ATH_MSG_DEBUG("Get track Quantities"); + d0_vec.push_back( getTrack_d0(eg)); + d0sig_vec.push_back(getD0sig(eg)); + pt_vec.push_back( getTrack_pt(eg)/1e3); + + if (eg->pt() > 0) { + ptcone20_rel_vec.push_back( getIsolation_ptcone20(eg)/eg->pt()); + ptvarcone20_rel_vec.push_back( getIsolation_ptvarcone20(eg)/eg->pt()); + } + + } + + + fill( monGroup, deta1_col, deta1_EMECA_col, deta1_EMECC_col, deta1_EMEBA_col, deta1_EMEBC_col, deta2_col, dphi2_col, + dphiresc_col, eprobht_col, npixhits_col, nscthits_col, charge_col, ptcone20_col, ptvarcone20_col, d0_col, d0sig_col, + pt_col, ptcone20_rel_col, ptvarcone20_rel_col); + + + +} + + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..20e465d1187471ed3fab68fb93c7fb060fe414fe --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef TrigEgammaMonitorAnalysisAlgorithm_H +#define TrigEgammaMonitorAnalysisAlgorithm_H + +#include "TrigEgammaMonitorBaseAlgorithm.h" + + +class TrigEgammaMonitorAnalysisAlgorithm: public TrigEgammaMonitorBaseAlgorithm +{ + + public: + + TrigEgammaMonitorAnalysisAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual ~TrigEgammaMonitorAnalysisAlgorithm() override; + + virtual StatusCode initialize() override; + + protected: + + void fillLabel( const ToolHandle<GenericMonitoringTool>& groupHandle, const std::string &histname, const std::string &label ) const; + + + // Efficiency monitoring + void fillEfficiencies( std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*> > , TrigInfo ) const; + void fillEfficiency( const std::string &subgroup, const std::string &level, const std::string &pidword, const TrigInfo info, + std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision* >> pairObjs) const; + + + void fillDistributions( std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*> > , TrigInfo ) const; + void fillL1Calo( const std::string &trigger, std::vector< const xAOD::EmTauRoI* > l1_vec ) const; + void fillL2Calo(const std::string &trigger, std::vector< const xAOD::TrigEMCluster*> emCluster_vec ) const; + void fillL2Electron(const std::string &trigger, std::vector<const xAOD::TrigElectron*> el_vec) const; + void fillEFCalo(const std::string &trigger, std::vector<const xAOD::CaloCluster*> clus_vec) const; + void fillShowerShapes(const std::string &trigger, std::vector<const xAOD::Egamma*> eg_vec, bool online ) const; + void fillTracking(const std::string &trigger, std::vector<const xAOD::Electron *> eg_vec, bool online ) const; + + +}; + +#endif diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3e4b5b5e088bc8763daf9081d68f2f98ee8b4cfa --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx @@ -0,0 +1,738 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigEgammaMonitorBaseAlgorithm.h" + + + +TrigEgammaMonitorBaseAlgorithm::TrigEgammaMonitorBaseAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) + : AthMonitorAlgorithm(name,pSvcLocator), + m_trigdec("Trig::TrigDecisionTool/TrigDecisionTool"), + m_matchTool("Trig::TrigEgammaMatchingToolMT/TrigEgammaMatchingToolMT") +{ + declareProperty( "MatchTool" , m_matchTool ); +} + + +TrigEgammaMonitorBaseAlgorithm::~TrigEgammaMonitorBaseAlgorithm() {} + + + + +StatusCode TrigEgammaMonitorBaseAlgorithm::initialize() +{ + + ATH_CHECK(AthMonitorAlgorithm::initialize()); + ATH_CHECK(m_trigdec.retrieve()); + ATH_CHECK(m_electronIsEMTool.retrieve()); + ATH_CHECK(m_electronLHTool.retrieve()); + + m_trigdec->ExperimentalAndExpertMethods()->enable(); + + return StatusCode::SUCCESS; +} + + +// ************************************************************************************************ + + + + +bool TrigEgammaMonitorBaseAlgorithm::ApplyElectronPid( const xAOD::Electron *eg, const std::string pidname) const +{ + auto ctx = Gaudi::Hive::currentContext() ; + if (pidname == "Tight"){ + return (bool) this->m_electronIsEMTool[0]->accept(ctx,eg); + } + else if (pidname == "Medium"){ + return (bool) this->m_electronIsEMTool[1]->accept(ctx,eg); + } + else if (pidname == "Loose"){ + return (bool) this->m_electronIsEMTool[2]->accept(ctx,eg); + } + else if (pidname == "LHTight"){ + return (bool) this->m_electronLHTool[0]->accept(ctx,eg); + } + else if (pidname == "LHMedium"){ + return (bool) this->m_electronLHTool[1]->accept(ctx,eg); + } + else if (pidname == "LHLoose"){ + return (bool) this->m_electronLHTool[2]->accept(ctx,eg); + } + else ATH_MSG_DEBUG("No Pid tool, continue without PID"); + return false; +} + + + + + +// ************************************************************************************************ + + + +bool TrigEgammaMonitorBaseAlgorithm::isIsolated(const xAOD::Electron *eg, const std::string isolation) const { + ATH_MSG_DEBUG("Apply Isolation " << isolation); + float ptcone20; + eg->isolationValue(ptcone20, xAOD::Iso::ptcone20); + ATH_MSG_DEBUG("ptcone20 " << ptcone20); + if (!(fabs(eg->pt()) > 0)) { + ATH_MSG_DEBUG("Electron pt is zero, can't calculate relative isolation"); + return false; + } + float ptcone20_rel = ptcone20/eg->pt(); + ATH_MSG_DEBUG("Relative isolation value " << ptcone20_rel); + if (isolation == "Loose"){ + if (ptcone20_rel > 0.1) { + ATH_MSG_DEBUG("Probe failing isolation"); + return false; + } else { + ATH_MSG_DEBUG("Probe passing isolation"); + return true; + } + } + else { + ATH_MSG_DEBUG("No valid working point defined for " << isolation << " continue without isolation"); + } + return false; +} + + + +bool TrigEgammaMonitorBaseAlgorithm::isPrescaled(const std::string trigger) const { + + bool efprescale=false; + bool l1prescale=false; + bool prescale=false; + bool rerun=true; //assume rerun for l1 + std::string l1item=""; + + if(boost::starts_with(trigger, "L1" )) + l1item=trigger; + if(boost::starts_with(trigger,"HLT")){ + l1item = getL1Item(trigger); + const unsigned int bit=tdt()->isPassedBits(trigger); + efprescale=bit & TrigDefs::EF_prescaled; + rerun=bit&TrigDefs::EF_resurrected; //Rerun, only check for HLT + } + + + ATH_MSG_DEBUG("Checking prescale for " << trigger << " " << l1item); + const unsigned int l1bit=tdt()->isPassedBits(l1item); + bool l1_afterpre=l1bit&TrigDefs::L1_isPassedAfterPrescale; + bool l1_beforepre=l1bit&TrigDefs::L1_isPassedBeforePrescale; + l1prescale=l1_beforepre && !l1_afterpre; + prescale=efprescale || l1prescale; + ATH_MSG_DEBUG("L1 prescale " << l1item << " " << l1prescale << " before " << l1_beforepre << " after " << l1_afterpre); + ATH_MSG_DEBUG("EF prescale " << trigger << " " << efprescale << " Prescale " << prescale); + if(rerun) return false; // Rerun use the event + if(prescale) return true; // Prescaled, reject event + return false; // Not prescaled, use event +} + + + + +asg::AcceptData TrigEgammaMonitorBaseAlgorithm::setAccept( const TrigCompositeUtils::Decision *dec, const TrigInfo info) const { + + ATH_MSG_DEBUG("setAccept"); + + + asg::AcceptInfo accept; + for(const auto cut:m_trigLevel) accept.addCut(cut,cut); + asg::AcceptData acceptData (&accept); + + + bool passedL1Calo=false; + bool passedL2Calo=false; + bool passedEFCalo=false; + bool passedL2=false; + bool passedEFTrk=false; + bool passedEF=false; + + auto trigger = info.trigName; + + passedL1Calo = match()->ancestorPassed<TrigRoiDescriptorCollection>( dec , trigger , "initialRois"); + + if(!info.trigL1){ // HLT item get full decision + ATH_MSG_DEBUG("Check for active features: TrigEMCluster,CaloClusterContainer"); + + passedL2Calo = match()->ancestorPassed<xAOD::TrigEMClusterContainer>(dec, trigger, "HLT_L2CaloEMClusters"); + passedEFCalo = match()->ancestorPassed<xAOD::CaloClusterContainer>(dec, trigger, "HLT_CaloEMClusters"); + + + if(info.trigType == "electron"){ + ATH_MSG_DEBUG("Check for active features: TrigElectron, ElectronContainer, TrackParticleContainer"); + passedL2 = match()->ancestorPassed<xAOD::TrigElectronContainer>(dec, trigger, "HLT_L2Electrons"); + passedEF = match()->ancestorPassed<xAOD::ElectronContainer>(dec, trigger, "HLT_egamma_Electrons"); + passedEFTrk = true; //match()->ancestorPassed<xAOD::TrackParticleContainer>(dec); + } + else if(info.trigType == "photon"){ + ATH_MSG_DEBUG("Check for active features: TrigPhoton, PhotonContainer"); + passedL2 = match()->ancestorPassed<xAOD::TrigPhotonContainer>(dec, trigger, "HLT_L2Photons"); + passedEF = match()->ancestorPassed<xAOD::PhotonContainer>(dec, trigger, "HLT_egamma_Photons"); + passedEFTrk=true;// Assume true for photons + } + } + + acceptData.setCutResult("L1Calo",passedL1Calo); + acceptData.setCutResult("L2Calo",passedL2Calo); + acceptData.setCutResult("L2",passedL2); + acceptData.setCutResult("EFCalo",passedEFCalo); + acceptData.setCutResult("EFTrack",passedEFTrk); + acceptData.setCutResult("HLT",passedEF); + ATH_MSG_DEBUG("Accept results:"); + ATH_MSG_DEBUG("L1: "<< passedL1Calo); + ATH_MSG_DEBUG("L2Calo: " << passedL2Calo); + ATH_MSG_DEBUG("L2: "<< passedL2); + ATH_MSG_DEBUG("EFCalo: "<< passedEFCalo); + ATH_MSG_DEBUG("HLT: "<<passedEF); + + return acceptData; +} + + + + +float TrigEgammaMonitorBaseAlgorithm::dR(const float eta1, const float phi1, const float eta2, const float phi2) const { + float deta = fabs(eta1 - eta2); + float dphi = fabs(phi1 - phi2) < TMath::Pi() ? fabs(phi1 - phi2) : 2*TMath:: \ + Pi() - fabs(phi1 - phi2); + return sqrt(deta*deta + dphi*dphi); +} + + + + +float TrigEgammaMonitorBaseAlgorithm::getEta2(const xAOD::Egamma* eg) const{ + if(eg && (eg->caloCluster())){ + const xAOD::CaloCluster* cluster = eg->caloCluster(); + return fabs(cluster->etaBE(2)); + } + else return -99.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getEt(const xAOD::Electron* eg) const{ + if(eg && (eg->caloCluster()) && (eg->trackParticle())){ + const xAOD::TrackParticle *trk=eg->trackParticle(); + const xAOD::CaloCluster *clus=eg->caloCluster(); + float eta = fabs(trk->eta()); + return clus->e()/cosh(eta); + } + else return -99.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getEtCluster37(const xAOD::Egamma* eg) const{ + if(eg && (eg->caloCluster())){ + const xAOD::CaloCluster* cluster = eg->caloCluster(); + float eta2 = fabs(cluster->etaBE(2)); + return cluster->e()/cosh(eta2); + } + else return -99.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getDEmaxs1(const xAOD::Egamma *eg) const{ + if(eg){ + float emax2=0.; + eg->showerShapeValue(emax2, xAOD::EgammaParameters::e2tsts1); + float emax=0.; + eg->showerShapeValue(emax, xAOD::EgammaParameters::emaxs1); + float val = fabs(emax+emax2)>0. ? (emax-emax2)/(emax+emax2) : 0.; + return val; + } + else return -99.; +} + + +float TrigEgammaMonitorBaseAlgorithm::rTRT (const xAOD::Electron* eg) const{ + if(eg && eg->trackParticle()){ + uint8_t trtHits = 0; + eg->trackParticleSummaryValue(trtHits,xAOD::numberOfTRTHits); + uint8_t trtHTHits = 0; + eg->trackParticleSummaryValue(trtHTHits,xAOD::numberOfTRTHighThresholdHits); + if(trtHits!=0) { + return ( (double)trtHTHits / (double)trtHits ); + } + else return -99.; + } + else return -99.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getSigmaD0(const xAOD::Electron *eg) const{ + const xAOD::TrackParticle* t = eg->trackParticle(); + float d0sigma=0.; + if (t) + { + float vard0 = t->definingParametersCovMatrix()(0,0); + if (vard0 > 0) { + d0sigma=sqrtf(vard0); + } + else return -99.; + return d0sigma; + } + else return -99.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getD0sig(const xAOD::Electron *eg) const{ + const xAOD::TrackParticle* t = eg->trackParticle(); + float d0sigma=0.; + if (t) + { + + float vard0 = t->definingParametersCovMatrix()(0,0); + if (vard0 > 0) { + d0sigma=sqrtf(vard0); + } + else return -99.; + return t->d0()/d0sigma; + } + else return -99.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getEnergyBE0(const xAOD::Egamma *eg) const{ + if(eg && (eg->caloCluster())){ + const xAOD::CaloCluster* cluster = eg->caloCluster(); + return cluster->energyBE(0); + } + else return 0; +} + + +float TrigEgammaMonitorBaseAlgorithm::getEnergyBE1(const xAOD::Egamma *eg) const{ + if(eg && (eg->caloCluster())){ + const xAOD::CaloCluster* cluster = eg->caloCluster(); + return cluster->energyBE(1); + } + else return 0.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getEnergyBE2(const xAOD::Egamma *eg) const{ + if(eg && (eg->caloCluster())){ + const xAOD::CaloCluster* cluster = eg->caloCluster(); + return cluster->energyBE(2); + } + else return 0.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getEnergyBE3(const xAOD::Egamma *eg) const{ + if(eg && (eg->caloCluster())){ + const xAOD::CaloCluster* cluster = eg->caloCluster(); + return cluster->energyBE(3); + } + else return 0.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getEaccordion(const xAOD::Egamma *eg) const{ + if(eg && (eg->caloCluster())){ + const xAOD::CaloCluster* cluster = eg->caloCluster(); + float ebe1 = cluster->energyBE(1); + float ebe2 = cluster->energyBE(2); + float ebe3 = cluster->energyBE(3); + return (ebe1+ebe2+ebe3); + } + else return 0.; +} + + +float TrigEgammaMonitorBaseAlgorithm::getE0Eaccordion(const xAOD::Egamma *eg) const{ + if(eg && (eg->caloCluster())){ + const xAOD::CaloCluster* cluster = eg->caloCluster(); + float ebe0 = cluster->energyBE(0); + float ebe1 = cluster->energyBE(1); + float ebe2 = cluster->energyBE(2); + float ebe3 = cluster->energyBE(3); + float eacc = ebe1+ebe2+ebe3; + if(eacc==0.) return 0.; + return (ebe0/eacc); + } + else return 0.; +} + + + + + + +/*! Macros for plotting */ +#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getShowerShape_##_name_(const xAOD::Egamma* eg) const \ +{ float val{-99}; \ + eg->showerShapeValue(val,xAOD::EgammaParameters::_name_); \ + return val; } + GETTER(e011) + GETTER(e132) + GETTER(e237) + GETTER(e277) + GETTER(ethad) + GETTER(ethad1) + GETTER(weta1) + GETTER(weta2) + GETTER(f1) + GETTER(e2tsts1) + GETTER(emins1) + GETTER(emaxs1) + GETTER(wtots1) + GETTER(fracs1) + GETTER(Reta) + GETTER(Rphi) + GETTER(f3) + GETTER(f3core) + GETTER(Eratio) + GETTER(Rhad) + GETTER(Rhad1) + GETTER(DeltaE) +#undef GETTER + + +// GETTER for Isolation monitoring +#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getIsolation_##_name_(const xAOD::Electron* eg) const\ +{ float val{-99}; \ + eg->isolationValue(val,xAOD::Iso::_name_); \ + return val; } + GETTER(ptcone20) + GETTER(ptcone30) + GETTER(ptcone40) + GETTER(ptvarcone20) + GETTER(ptvarcone30) + GETTER(ptvarcone40) +#undef GETTER + + +#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getIsolation_##_name_(const xAOD::Egamma* eg) const\ +{ float val{-99}; \ + eg->isolationValue(val,xAOD::Iso::_name_); \ + return val; } + GETTER(etcone20) + GETTER(etcone30) + GETTER(etcone40) + GETTER(topoetcone20) + GETTER(topoetcone30) + GETTER(topoetcone40) +#undef GETTER + + +// GETTERs for CaloCluster monitoring +#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getCluster_##_name_(const xAOD::Egamma* eg) const\ +{ if(eg && eg->caloCluster()) \ + return eg->caloCluster()->_name_(); \ + else return -99.;} + GETTER(et) + GETTER(phi) + GETTER(eta) +#undef GETTER + + +// GETTERs for Track monitoring +#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getTrack_##_name_(const xAOD::Electron* eg) const\ +{ if(eg && eg->trackParticle()) \ + return eg->trackParticle()->_name_(); \ + else return -99.;} + GETTER(pt) + GETTER(phi) + GETTER(eta) + GETTER(d0) + GETTER(z0) +#undef GETTER + + +// GETTERs for Track details monitoring +#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getTrackSummary_##_name_(const xAOD::Electron* eg) const \ +{ uint8_t val_uint8{0}; \ + if(eg){ \ + eg->trackParticleSummaryValue(val_uint8,xAOD::_name_); \ + return val_uint8; } \ + else return -99; } + GETTER(numberOfInnermostPixelLayerHits) + GETTER(numberOfInnermostPixelLayerOutliers) + GETTER(numberOfPixelHits) + GETTER(numberOfPixelOutliers) + GETTER(numberOfSCTHits) + GETTER(numberOfSCTOutliers) + GETTER(numberOfTRTHits) + GETTER(numberOfTRTHighThresholdHits) + GETTER(numberOfTRTHighThresholdOutliers) + GETTER(numberOfTRTOutliers) + GETTER(expectInnermostPixelLayerHit) + GETTER(numberOfPixelDeadSensors) + GETTER(numberOfSCTDeadSensors) + GETTER(numberOfTRTXenonHits) +#undef GETTER + + +#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getTrackSummaryFloat_##_name_(const xAOD::Electron* eg) const\ +{ float val_float{0}; \ + if(eg){ \ + eg->trackParticleSummaryValue(val_float,xAOD::_name_); \ + return val_float; } \ + else return -99; } + GETTER(eProbabilityComb) + GETTER(eProbabilityHT) + GETTER(pixeldEdx) +#undef GETTER + + +// GETTERs for Calo-Track monitoring +#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getCaloTrackMatch_##_name_(const xAOD::Electron* eg) const\ +{ float val={-99.}; \ + if(eg){ \ + eg->trackCaloMatchValue(val,xAOD::EgammaParameters::_name_);} \ + return val; } + GETTER(deltaEta0) + GETTER(deltaPhi0) + GETTER(deltaPhiRescaled0) + GETTER(deltaEta1) + GETTER(deltaPhi1) + GETTER(deltaPhiRescaled1) + GETTER(deltaEta2) + GETTER(deltaPhi2) + GETTER(deltaPhiRescaled2) + GETTER(deltaEta3) + GETTER(deltaPhi3) + GETTER(deltaPhiRescaled3) +#undef GETTER + + + +TrigInfo TrigEgammaMonitorBaseAlgorithm::getTrigInfo(const std::string trigger) const{ + return m_trigInfo.at(trigger); +} + + + +// This is not const function and can not be used in execute mode (not thread safe) +// adds entry in TrigInfo map to retrieve later via trigger name +void TrigEgammaMonitorBaseAlgorithm::setTrigInfo(const std::string trigger){ + + /******************************************** + std::string trigName; //Trigger Name + std::string trigType; //Electron or Photon + std::string trigL1Item; //L1 item for HLT + std::string trigL1Type; //VHI + std::string trigPidType; //Loose, Medium, Tight, etc... + bool trigL1; // Level1 Trigger + bool trigPerf; // Performance chain + bool trigEtcut; // Et cut only chain + float trigThrHLT; // HLT Et threshold + float trigThrL1; // L1 Et threshold + *******************************************/ + + std::string type=""; + bool isL1=false; + float etthr=0; + float l1thr=0; + std::string l1type=""; + std::string pidname=""; + bool perf=false; + bool etcut=false; + parseTriggerName(trigger,m_defaultProbePid,isL1,type,etthr,l1thr,l1type,pidname,etcut,perf); // Determines probe PID from trigger + + std::string l1item = ""; + if(isL1) l1item=trigger; + else getL1Item(trigger); + std::string decorator="is"+pidname; + + if(isL1) etthr=l1thr; // Should be handled elsewhere + TrigInfo info{trigger,type,l1item,l1type,pidname,decorator,isL1,perf,etcut,etthr,l1thr,false}; + m_trigInfo[trigger] = info; +} + + + + + + + +bool TrigEgammaMonitorBaseAlgorithm::splitTriggerName(const std::string trigger, + std::string &p1trigger, + std::string &p2trigger) const { + + p1trigger=""; + p2trigger=""; + + std::string hltinfo=trigger; + if(boost::contains(hltinfo,"HLT")) hltinfo.erase(0,4); + std::vector<std::string> strs; + boost::split(strs,hltinfo,boost::is_any_of("_")); + + if((strs.at(0))[0]=='2'){ + ((p1trigger+=("HLT_"+((strs.at(0)).substr(1,(int)strs.at(0).find_last_of(strs.at(0)))))+="_")); + + for(unsigned int i=1; i<strs.size();i++){ + if(strs.at(i)=="Jpsiee") continue; + (p1trigger+="_")+=strs.at(i); + } + + p2trigger=p1trigger; + return true; + } + else{ + + if(strs.size()<4){ + return false; + } + + int index=-1; + p1trigger+=("HLT_"+strs.at(0)); + + for(int i=1; index<0;i++) + { + (p1trigger+="_")+=strs.at(i); + + if(strs.at(i+1)[0]=='e' || strs.at(i+1)[0]=='g') index=(i+1); + } + + p2trigger+=("HLT_"+strs.at(index)); + + for(unsigned int i=index+1; i< strs.size();i++){ + if(strs.at(i)=="Jpsiee") continue; + (p2trigger+="_")+=strs.at(i); + } + return true; + } + + +} + + + +void TrigEgammaMonitorBaseAlgorithm::parseTriggerName(const std::string trigger, + std::string defaultPid, + bool &isL1, + std::string &type, + float &threshold, + float &l1threshold, + std::string &l1type, + std::string &pidname, + bool &etcut, + bool &perf) const { + + // Analyze L1 or HLT item + bool result = boost::starts_with( trigger , "L1" ); + if (result) { + std::string l1info = trigger; + l1info.erase(0,4); + l1type = boost::trim_copy_if(l1info, boost::is_digit()); + std::string l1cut = boost::trim_copy_if(l1info, !boost::is_digit()); + l1threshold = atof(l1cut.c_str()); + threshold = l1threshold; + isL1=true; + pidname = defaultPid; + type = "electron"; // for now only electron L1 studies + } + else { + std::string hltinfo=trigger; + if(boost::contains(hltinfo,"HLT")) hltinfo.erase(0,4); + std::string l1item = getL1Item(trigger); + ATH_MSG_DEBUG("Trigger L1item " << trigger << " " << l1item << " " << hltinfo); + std::vector<std::string> strs; + boost::split(strs,hltinfo,boost::is_any_of("_")); + for (std::vector<std::string>::iterator it = strs.begin(); it != strs.end(); ++it) + { + ATH_MSG_DEBUG("Trigger parse " << *it); + } + // Set probe Pid from second part of trigger name + // Non pid triggers use default Probe which is set as a property + + + if(boost::contains(strs.at(0),"e")) type = "electron"; + else if(boost::contains(strs.at(0),"g")) type = "photon"; + else ATH_MSG_ERROR("Cannot set trigger type from name"); + if(boost::contains(strs.at(1),"perf")){ + pidname = defaultPid; + perf=true; + ATH_MSG_DEBUG("Perf " << perf << " " << pidname ); + } + else if(boost::contains(strs.at(1),"L2Star")){ + pidname = defaultPid; + perf=true; + ATH_MSG_DEBUG("L2Star " << perf << " " << pidname ); + } + else if(boost::contains(strs.at(1),"hiptrt")){ + pidname = defaultPid; + perf=true; + ATH_MSG_DEBUG("hiptrt " << perf << " " << pidname ); + } + else if( strs.at(1)== "etcut"){ + pidname = defaultPid; + etcut=true; + } + + //Get the L1 information + + if(boost::contains(strs.back(),"L1")){ + std::string l1info = strs.back(); + l1info.erase(0,4); + l1type = boost::trim_copy_if(l1info, boost::is_digit()); + std::string l1cut = boost::trim_copy_if(l1info, !boost::is_digit()); + l1threshold = atof(l1cut.c_str()); + + ATH_MSG_DEBUG("L1 item " << l1info << " " << l1threshold << " " << l1type); + } + + // Get the threshold + std::string str_thr = strs.at(0); + str_thr.erase( 0, 1); + threshold = atof(str_thr.c_str()); + + isL1=false; + ATH_MSG_DEBUG(trigger << " " << type << " " << pidname << " " << threshold); + } + +} + + + + +std::string TrigEgammaMonitorBaseAlgorithm::getProbePid(const std::string pidtype) const { + // Note vloose/lhvloose trigger mapped to Loose/LHLoose offline PID + return m_pidMap.at(pidtype); +} + + + +std::string TrigEgammaMonitorBaseAlgorithm::getL1Item(std::string trigger) const{ + auto trig_conf = m_trigdec->ExperimentalAndExpertMethods()->getChainConfigurationDetails(trigger); + std::string L1_seed = ""; + if(trig_conf != nullptr){ + ATH_MSG_DEBUG("TrigConf available"); + L1_seed = trig_conf->lower_chain_name(); //L1 trigger seed + } + return L1_seed; +} + + + + + +const std::vector<std::string> TrigEgammaMonitorBaseAlgorithm::m_trigLevel = {"L1Calo","L2Calo","L2","EFCalo","EFTrack","HLT"}; + +const std::map<std::string,std::string> TrigEgammaMonitorBaseAlgorithm::m_trigLvlMap = {{"L1Calo","Trigger L1Calo step"}, + {"L2Calo","Trigger L2Calo step"}, + {"L2","Trigger L2 step"}, + {"EFCalo","Trigger EFCalo step"}, + {"EFTrack","Trigger EFTrack step"}, + {"HLT","Trigger HLT accept"}}; + +const std::map<std::string, std::string> TrigEgammaMonitorBaseAlgorithm::m_pidMap = { {"vloose" , "Loose" }, + {"loose" , "Loose" }, + {"medium" , "Medium" }, + {"tight" , "Tight" }, + {"loose1" , "Loose" }, + {"medium1" , "Medium" }, + {"tight1" , "Tight" }, + {"lhvloose" , "LHLoose" }, + {"lhloose" , "LHLoose" }, + {"lhmedium" , "LHMedium"}, + {"lhtight" , "LHTight" } }; + + + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..ba63d3ee6fe20aac838f78dfa980d938dade16c7 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.h @@ -0,0 +1,259 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TrigEgammaMonitorBaseAlgorithm_h +#define TrigEgammaMonitorBaseAlgorithm_h + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h" +#include "TrigEgammaAnalysisTools/TrigEgammaInfo.h" + +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" +#include "TrigDecisionTool/TrigDecisionTool.h" +#include "EgammaAnalysisInterfaces/IAsgElectronIsEMSelector.h" +#include "EgammaAnalysisInterfaces/IAsgPhotonIsEMSelector.h" +#include "EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODEgamma/Egamma.h" +#include "xAODEgamma/EgammaxAODHelpers.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODTrigEgamma/TrigElectronContainer.h" +#include "xAODTrigEgamma/TrigPhotonContainer.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTrigCalo/TrigEMClusterContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODTrigger/EmTauRoIContainer.h" + +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "PATCore/AcceptInfo.h" +#include "PATCore/AcceptData.h" + + + + +class TrigEgammaMonitorBaseAlgorithm : public AthMonitorAlgorithm { + public: + + + TrigEgammaMonitorBaseAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); + + + virtual ~TrigEgammaMonitorBaseAlgorithm(); + + virtual StatusCode initialize() override; + + virtual StatusCode fillHistograms(const EventContext& /*ctx*/) const override {return StatusCode::SUCCESS;}; + + private: + + /*! Trigger decision tool */ + ToolHandle<Trig::TrigDecisionTool> m_trigdec; + /*! creates map of trigger name and TrigInfo struct */ + std::map<std::string,TrigInfo> m_trigInfo; + + + static const std::vector<std::string> m_trigLevel; + static const std::map<std::string,std::string> m_trigLvlMap; + static const std::map<std::string, std::string> m_pidMap; + + + + protected: + + /* Trigger e/g matching tool */ + ToolHandle<TrigEgammaMatchingToolMT> m_matchTool; + /*! Offline isEM Selectors */ + ToolHandleArray<IAsgElectronIsEMSelector> m_electronIsEMTool{this,"ElectronIsEMSelector",{}}; + /*! Offline LH Selectors */ + ToolHandleArray<IAsgElectronLikelihoodTool> m_electronLHTool{this,"ElectronLikelihoodTool",{}}; + /*! Offline LH Very loose selector */ + ToolHandle<IAsgElectronLikelihoodTool> m_electronLHVLooseTool{this,"ElectronLHVLooseTool", ""}; + + + /*! TP Trigger Analysis */ + Gaudi::Property<bool> m_tp{this, "TPTrigger", false }; + /*! default probe pid for trigitems that don't have pid in their name */ + Gaudi::Property<std::string> m_defaultProbePid{this, "DefaultProbeSelection", "Loose"}; + /*! isem names */ + Gaudi::Property<std::vector<std::string>> m_isemname{this, "isEMResultNames", {} }; + /*! lh names */ + Gaudi::Property<std::vector<std::string>> m_lhname{this, "LHResultNames", {} }; + /*! Include more detailed histograms */ + Gaudi::Property<bool> m_detailedHists{this, "DetailedHistograms", false}; + + + + /** Helper methods **/ + + /*! Get the trig info map */ + std::map<std::string,TrigInfo> getTrigInfoMap() { return m_trigInfo; } + /*! Get offline electron decision */ + bool ApplyElectronPid(const xAOD::Electron *eg,const std::string) const; + /*! Get the TDT */ + const ToolHandle<Trig::TrigDecisionTool>& tdt() const {return m_trigdec;}; + /*! Get the e/g match tool */ + const ToolHandle<TrigEgammaMatchingToolMT>& match() const {return m_matchTool;} + /*! Set the accept object for all trigger levels */ + asg::AcceptData setAccept(const TrigCompositeUtils::Decision*, const TrigInfo) const; + /*! Get the trigger info parsed from the chain name */ + TrigInfo getTrigInfo(const std::string) const; + /*! Get delta R */ + float dR(const float, const float, const float, const float) const; + /*! Simple setter to pick up correct probe PID for given trigger */ + void parseTriggerName(const std::string,const std::string, bool&, std::string &,float &, float &, std::string &,std::string &, bool&, bool&) const; + /*! Split double object trigger in two simple object trigger */ + bool splitTriggerName(const std::string, std::string &, std::string &) const; + /*! Creates static map to return L1 item from trigger name */ + std::string getL1Item(std::string trigger) const; + /*! Check if electron fulfils isolation criteria */ + bool isIsolated(const xAOD::Electron*, const std::string) const; + /*! Check if the event is prescaled */ + bool isPrescaled(const std::string) const; + /*! Get the pid name */ + std::string getProbePid(const std::string) const; + /*! Set the trigger info parsed from the chain name */ + void setTrigInfo(const std::string); + + + + /** Features helper **/ + + + + /*! Helper functions now part of base class */ + float getEta2(const xAOD::Egamma* eg) const; + float getEt(const xAOD::Electron* eg) const ; + float getEtCluster37(const xAOD::Egamma* eg) const; + float getDEmaxs1(const xAOD::Egamma *eg) const; + float rTRT (const xAOD::Electron* eg) const; + float getSigmaD0(const xAOD::Electron *eg) const; + float getD0sig(const xAOD::Electron *eg) const; + float getEnergyBE0(const xAOD::Egamma *eg) const; + float getEnergyBE1(const xAOD::Egamma *eg) const; + float getEnergyBE2(const xAOD::Egamma *eg) const; + float getEnergyBE3(const xAOD::Egamma *eg) const; + float getEaccordion(const xAOD::Egamma *eg) const; + float getE0Eaccordion(const xAOD::Egamma *eg) const; + + + + + + + + + + /*! C Macros for plotting */ +#define GETTER(_name_) float getShowerShape_##_name_(const xAOD::Egamma* eg) const; + GETTER(e011) + GETTER(e132) + GETTER(e237) + GETTER(e277) + GETTER(ethad) + GETTER(ethad1) + GETTER(weta1) + GETTER(weta2) + GETTER(f1) + GETTER(e2tsts1) + GETTER(emins1) + GETTER(emaxs1) + GETTER(wtots1) + GETTER(fracs1) + GETTER(Reta) + GETTER(Rphi) + GETTER(f3) + GETTER(f3core) + GETTER(Eratio) + GETTER(Rhad) + GETTER(Rhad1) + GETTER(DeltaE) +#undef GETTER + + + // GETTER for Isolation monitoring +#define GETTER(_name_) float getIsolation_##_name_(const xAOD::Electron* eg) const; + GETTER(ptcone20) + GETTER(ptcone30) + GETTER(ptcone40) + GETTER(ptvarcone20) + GETTER(ptvarcone30) + GETTER(ptvarcone40) +#undef GETTER +#define GETTER(_name_) float getIsolation_##_name_(const xAOD::Egamma* eg) const; + GETTER(etcone20) + GETTER(etcone30) + GETTER(etcone40) + GETTER(topoetcone20) + GETTER(topoetcone30) + GETTER(topoetcone40) +#undef GETTER + // GETTERs for CaloCluster monitoring +#define GETTER(_name_) float getCluster_##_name_(const xAOD::Egamma* eg) const; + GETTER(et) + GETTER(phi) + GETTER(eta) +#undef GETTER + + // GETTERs for Track monitoring +#define GETTER(_name_) float getTrack_##_name_(const xAOD::Electron* eg) const; + GETTER(pt) + GETTER(phi) + GETTER(eta) + GETTER(d0) + GETTER(z0) +#undef GETTER + + + // GETTERs for Track details monitoring +#define GETTER(_name_) float getTrackSummary_##_name_(const xAOD::Electron* eg) const; + GETTER(numberOfInnermostPixelLayerHits) + GETTER(numberOfInnermostPixelLayerOutliers) + GETTER(numberOfPixelHits) + GETTER(numberOfPixelOutliers) + GETTER(numberOfSCTHits) + GETTER(numberOfSCTOutliers) + GETTER(numberOfTRTHits) + GETTER(numberOfTRTHighThresholdHits) + GETTER(numberOfTRTHighThresholdOutliers) + GETTER(numberOfTRTOutliers) + GETTER(expectInnermostPixelLayerHit) + GETTER(numberOfPixelDeadSensors) + GETTER(numberOfSCTDeadSensors) + GETTER(numberOfTRTXenonHits) +#undef GETTER + +#define GETTER(_name_) float getTrackSummaryFloat_##_name_(const xAOD::Electron* eg) const; + GETTER(eProbabilityComb) + GETTER(eProbabilityHT) + GETTER(pixeldEdx) +#undef GETTER + + // GETTERs for Calo-Track monitoring +#define GETTER(_name_) float getCaloTrackMatch_##_name_(const xAOD::Electron* eg) const; + GETTER(deltaEta0) + GETTER(deltaPhi0) + GETTER(deltaPhiRescaled0) + GETTER(deltaEta1) + GETTER(deltaPhi1) + GETTER(deltaPhiRescaled1) + GETTER(deltaEta2) + GETTER(deltaPhi2) + GETTER(deltaPhiRescaled2) + GETTER(deltaEta3) + GETTER(deltaPhi3) + GETTER(deltaPhiRescaled3) +#undef GETTER + + + + + +}; +#endif + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..52b9dae1a9cabf735ed75dcd25561fbe8402a86b --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx @@ -0,0 +1,163 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigEgammaMonitorElectronAlgorithm.h" + + +using namespace Trig; + + +TrigEgammaMonitorElectronAlgorithm::TrigEgammaMonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ): + TrigEgammaMonitorAnalysisAlgorithm( name, pSvcLocator ) +{} + +TrigEgammaMonitorElectronAlgorithm::~TrigEgammaMonitorElectronAlgorithm() +{} + + + +StatusCode TrigEgammaMonitorElectronAlgorithm::initialize() +{ + + ATH_CHECK(TrigEgammaMonitorAnalysisAlgorithm::initialize()); + ATH_CHECK(m_offElectronKey.initialize()); + + + for(const auto trigName:m_trigInputList) + { + if(getTrigInfoMap().count(trigName) != 0){ + ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); + }else { + m_trigList.push_back(trigName); + setTrigInfo(trigName); + } + } + + + return StatusCode::SUCCESS; +} + + + +StatusCode TrigEgammaMonitorElectronAlgorithm::fillHistograms( const EventContext& ctx ) const +{ + + ATH_MSG_DEBUG("Executing TrigEgammaMonitorElectronAlgorithm"); + + if(tdt()->ExperimentalAndExpertMethods()->isHLTTruncated()){ + ATH_MSG_WARNING("HLTResult truncated, skip trigger analysis"); + return StatusCode::SUCCESS; + } + + + ATH_MSG_DEBUG("Chains for Analysis " << m_trigList); + + for(const auto trigger : m_trigList){ + + const TrigInfo info = getTrigInfo(trigger); + + ATH_MSG_DEBUG("Start Chain Analysis ============================= " << trigger << " " << info.trigName); + + + std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*>> pairObjs; + + if ( executeNavigation( ctx, info.trigName,info.trigThrHLT,info.trigPidType, pairObjs).isFailure() ) + { + ATH_MSG_WARNING("executeNavigation Fails"); + return StatusCode::SUCCESS; + } + + + + + fillDistributions( pairObjs, info ); + fillEfficiencies( pairObjs, info ); + + + ATH_MSG_DEBUG("End Chain Analysis ============================= " << trigger); + } // End loop over trigger list + + + return StatusCode::SUCCESS; +} + + + + + + + +StatusCode TrigEgammaMonitorElectronAlgorithm::executeNavigation( const EventContext& ctx, + std::string trigItem, + float etthr, + std::string pidname, + std::vector<std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision* >> &pairObjs) const +{ + + ATH_MSG_DEBUG("Apply navigation selection "); + + SG::ReadHandle<xAOD::ElectronContainer> offElectrons(m_offElectronKey, ctx); + + if(!offElectrons.isValid()) + { + ATH_MSG_WARNING("Failed to retrieve offline Electrons "); + return StatusCode::FAILURE; + } + + + const std::string decor="is"+pidname; + for(const auto& eg : *offElectrons ){ + + const TrigCompositeUtils::Decision *dec=nullptr; + + if(!eg->trackParticle()){ + ATH_MSG_DEBUG("No track Particle"); + continue; + } + if(!eg->caloCluster()){ + ATH_MSG_DEBUG("No caloCluster"); + continue; + } + + if(m_forceEtThr){///default is true + if( !( getEt(eg) > (etthr-5.)*1.e3) ) continue; + } + + if(m_rmCrack){///default is true + if ( (fabs(eg->eta())>1.37 && fabs(eg->eta())<1.52) || fabs(eg->eta())>2.47 ) continue; + } + + if(m_forcePidSelection){///default is true + if(!ApplyElectronPid(eg,pidname)){ + ATH_MSG_DEBUG("Fails ElectronID "<< pidname); + continue; + } + ATH_MSG_DEBUG("Passes ElectronID "<< pidname); + } + + if (m_forceProbeIsolation) {///default is false + if (!isIsolated(eg, m_offProbeIsolation)) continue;///default is Loose + } + + if(m_forceVetoVeryLoose){///default is false + bool veto = (bool)this->m_electronLHVLooseTool->accept(eg); + if(veto) continue; + } + + xAOD::Electron *el = new xAOD::Electron(*eg); + el->auxdecor<bool>(decor)=static_cast<bool>(true); + + match()->match(el, trigItem, dec); + std::pair< const xAOD::Electron*, const TrigCompositeUtils::Decision * > pair(el,dec); + pairObjs.push_back(pair); + + } + + ATH_MSG_DEBUG("BaseToolMT::Electron TEs " << pairObjs.size() << " found."); + return StatusCode::SUCCESS; +} + + + + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..c5863b2835b408ac5a30e46317be921b1f0bd9ea --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TrigEgammaMonitorElectronAlgorithm_H +#define TrigEgammaMonitorElectronAlgorithm_H + + +#include "TrigEgammaMonitorAnalysisAlgorithm.h" + + + +class TrigEgammaMonitorElectronAlgorithm: public TrigEgammaMonitorAnalysisAlgorithm +{ + + public: + + TrigEgammaMonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual ~TrigEgammaMonitorElectronAlgorithm() override; + + virtual StatusCode initialize() override; + + virtual StatusCode fillHistograms( const EventContext& ctx) const override; + + + + private: + + + + /*! navigation method called by executeNavigation */ + StatusCode executeNavigation(const EventContext& ctx, const std::string trigItem,float,std::string, + std::vector<std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*>> &) const; + + + /*! List of triggers to study */ + std::vector<std::string> m_trigList; + + /*! List of triggers from menu */ + Gaudi::Property<std::vector<std::string>> m_trigInputList{this, "TriggerList", {}}; + /*! Directory name for each algorithm */ + Gaudi::Property<std::string> m_anatype{this, "Analysis", "Electron"}; + /*! Define isolation working point for Probe electron */ + Gaudi::Property<std::string> m_offProbeIsolation{ this, "OfflineProbeIsolation", "Loose"}; + /*! force probe isolation */ + Gaudi::Property<bool> m_forceProbeIsolation{this, "ForceProbeIsolation", false}; + /*! force pid and crack selection into electron navigation */ + Gaudi::Property<bool> m_forcePidSelection{ this, "ForcePidSelection", true}; + /* force et cluster cut*/ + Gaudi::Property<bool> m_forceEtThr{ this, "ForceEtThreshold", true}; + /* force experimentalSelection selection*/ + Gaudi::Property<bool> m_forceVetoVeryLoose{ this, "ForceVetoVeryLoose", false}; + /*! Remove crack region for Probe default True */ + Gaudi::Property<bool> m_rmCrack{ this, "RemoveCrack", true}; + + // Containers + /*! Event Wise offline ElectronContainer Access and end iterator */ + SG::ReadHandleKey<xAOD::ElectronContainer> m_offElectronKey{ this, "ElectronKey", "Electrons", ""}; + +}; + +#endif diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4092832d1fcefc159470799bc945c13a4849952f --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx @@ -0,0 +1,114 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigEgammaMonitorPhotonAlgorithm.h" + + +using namespace Trig; + + +TrigEgammaMonitorPhotonAlgorithm::TrigEgammaMonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ): + TrigEgammaMonitorAnalysisAlgorithm( name, pSvcLocator ) +{} + +TrigEgammaMonitorPhotonAlgorithm::~TrigEgammaMonitorPhotonAlgorithm() +{} + + + +StatusCode TrigEgammaMonitorPhotonAlgorithm::initialize() +{ + + ATH_CHECK(TrigEgammaMonitorAnalysisAlgorithm::initialize()); + ATH_CHECK(m_offPhotonKey.initialize()); + + return StatusCode::SUCCESS; +} + + +StatusCode TrigEgammaMonitorPhotonAlgorithm::fillHistograms( const EventContext& ctx ) const +{ + + ATH_MSG_DEBUG("Executing TrigEgammaMonitorPhotonAlgorithm"); + + if(tdt()->ExperimentalAndExpertMethods()->isHLTTruncated()){ + ATH_MSG_WARNING("HLTResult truncated, skip trigger analysis"); + return StatusCode::SUCCESS; + } + + + ATH_MSG_DEBUG("Chains for Analysis " << m_trigList); + + for(const auto trigger : m_trigList){ + + const TrigInfo info = getTrigInfo(trigger); + + ATH_MSG_DEBUG("Start Chain Analysis ============================= " << trigger << " " << info.trigName); + + std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs; + + if ( executeNavigation( ctx, info.trigName,info.trigThrHLT,pairObjs).isFailure() ) + { + ATH_MSG_WARNING("executeNavigation Fails"); + return StatusCode::SUCCESS; + } + + + ATH_MSG_DEBUG("End Chain Analysis ============================= " << trigger); + } // End loop over trigger list + + + return StatusCode::SUCCESS; +} + + + + + +StatusCode TrigEgammaMonitorPhotonAlgorithm::executeNavigation( const EventContext& ctx, std::string trigItem, float etthr, + std::vector<std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> &pairObjs) + const +{ + ATH_MSG_DEBUG("Apply navigation selection"); + + + SG::ReadHandle<xAOD::PhotonContainer> offPhotons(m_offPhotonKey, ctx); + + if(!offPhotons.isValid()) + { + ATH_MSG_WARNING("Failed to retrieve offline Electrons "); + return StatusCode::FAILURE; + } + + + const std::string decor="is"+m_photonPid; + + for(const auto& eg : *offPhotons ){ + const TrigCompositeUtils::Decision *dec=nullptr; + if(!eg->caloCluster()){ + ATH_MSG_DEBUG("No caloCluster"); + continue; + } + if( !(getCluster_et(eg) > (etthr-5.)*Gaudi::Units::GeV)) continue; //Take 2GeV above threshold + if(!eg->passSelection(m_photonPid)) continue; + if(m_doUnconverted){ + if (eg->vertex()){ + ATH_MSG_DEBUG("Removing converted photons, continuing..."); + continue; + } + } + xAOD::Photon *ph = new xAOD::Photon(*eg); + ph->auxdecor<bool>(decor)=static_cast<bool>(true); + match()->match(ph, trigItem, dec); + std::pair< const xAOD::Photon*, const TrigCompositeUtils::Decision * > pair(ph,dec); + pairObjs.push_back(pair); + + } + + ATH_MSG_DEBUG("BaseToolMT::Photon TEs " << pairObjs.size() << " found."); + return StatusCode::SUCCESS; +} + + + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..f8d9f1f54c9c6f2846115d8b4585b7564c70bb12 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TrigEgammaMonitorPhotonAlgorithm_H +#define TrigEgammaMonitorPhotonAlgorithm_H + + +#include "TrigEgammaMonitorAnalysisAlgorithm.h" + + + + +class TrigEgammaMonitorPhotonAlgorithm: public TrigEgammaMonitorAnalysisAlgorithm +{ + + public: + + TrigEgammaMonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual ~TrigEgammaMonitorPhotonAlgorithm() override; + + virtual StatusCode initialize() override; + + virtual StatusCode fillHistograms( const EventContext& ctx) const override; + + + + private: + + + + /*! navigation method called by executeNavigation */ + StatusCode executeNavigation(const EventContext& ctx, const std::string trigItem,float, + std::vector<std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*>> &) const; + + /*! List of triggers to study */ + std::vector<std::string> m_trigList; + /*! Photon pid word */ + Gaudi::Property<std::string> m_photonPid{this, "PhotonPid","Tight" }; + /*! doUnconverted analysis */ + Gaudi::Property<bool> m_doUnconverted{this, "DoUnconverted", true}; + /*! List of triggers from menu */ + Gaudi::Property<std::vector<std::string>> m_trigInputList{this, "TriggerList", {}}; + /*! Directory name for each algorithm */ + Gaudi::Property<std::string> m_anatype{this, "Analysis", "Photon"}; + + // Containers + /*! Event Wise offline ElectronContainer Access and end iterator */ + SG::ReadHandleKey<xAOD::PhotonContainer> m_offPhotonKey{ this, "PhotonKey", "Photons", ""}; + +}; + +#endif diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6b3bcb8aadc16e055315ab415c15f06f9fd52e63 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx @@ -0,0 +1,580 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/********************************************************************** + * AsgTool: TrigEgammaNavTPBaseTool + * Authors: + * Joao Victor Pinto <jodafons@cern.ch> + * Description: + * Trigger e/gamma Zee Tag&Probe Base tool class. Inherits from TrigEgammaAnalysisBaseTool. + * Provides methods for selecting T&P pairs, + * matching probes to objects in TE containers. + * Creates a vector of pairs with + * offline electrons probes and the last TE with a match. + * Relies heavily on TrigNavigation, since we use the TriggerDecision. + * All derived classes work with list of probes for a given trigger. + * As input property, pass a list of triggers to study. + **********************************************************************/ + +#include "TrigEgammaMonitorTagAndProbeAlgorithm.h" +#include "TrigConfxAOD/xAODConfigTool.h" +#include "GaudiKernel/SystemOfUnits.h" +#include "string" +#include <algorithm> +#include "boost/algorithm/string.hpp" +#include <boost/tokenizer.hpp> +#include <boost/foreach.hpp> + +//********************************************************************** +using namespace Trig; +using namespace TrigConf; +using namespace xAOD; +using namespace boost; + +TrigEgammaMonitorTagAndProbeAlgorithm::TrigEgammaMonitorTagAndProbeAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ): + TrigEgammaMonitorAnalysisAlgorithm( name, pSvcLocator ) + + +{} + + +TrigEgammaMonitorTagAndProbeAlgorithm::~TrigEgammaMonitorTagAndProbeAlgorithm() +{} + + +StatusCode TrigEgammaMonitorTagAndProbeAlgorithm::initialize() { + + ATH_CHECK(TrigEgammaMonitorBaseAlgorithm::initialize() ); + ATH_CHECK(m_eventInfoKey.initialize()); + ATH_CHECK(m_offElectronKey.initialize()); + ATH_CHECK(m_jetKey.initialize()); + + + ATH_MSG_INFO("Now configuring chains for analysis: " << name() ); + std::vector<std::string> chains = tdt()->getListOfTriggers("HLT_e.*, L1_EM.*, HLT_g.*"); + + for(const auto trigName:m_trigInputList) + { + if (std::find(chains.begin(), chains.end(), trigName) != chains.end()){ + if(getTrigInfoMap().count(trigName) != 0){ + ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); + }else { + m_trigList.push_back(trigName); + setTrigInfo(trigName); + } + } + } + + return StatusCode::SUCCESS; +} + + + + + +StatusCode TrigEgammaMonitorTagAndProbeAlgorithm::fillHistograms( const EventContext& ctx ) const { + + + std::vector<const xAOD::Electron*> probes; + + // Select TP Pairs + ATH_MSG_DEBUG("Execute TP selection"); + if( !executeTandP(ctx, probes) ){ + ATH_MSG_WARNING("Tag and Probe event failed."); + return StatusCode::SUCCESS; + } + + + // Check HLTResult + if(tdt()->ExperimentalAndExpertMethods()->isHLTTruncated()){ + ATH_MSG_WARNING("HLTResult truncated, skip trigger analysis"); + return StatusCode::SUCCESS; + } + + + + for(unsigned int ilist = 0; ilist != m_trigList.size(); ilist++) { + + + std::string probeTrigger = m_trigList.at(ilist); + + /** Pair objects used in executeTool **/ + std::vector<std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*>> pairObjs; + + ATH_MSG_DEBUG("Start Chain Analysis ============================= " << probeTrigger); + + + const TrigInfo info = getTrigInfo(probeTrigger); + std::string trigName=probeTrigger; + + ATH_MSG_DEBUG("Trigger " << probeTrigger << " pidword " << info.trigPidDecorator << " threshold " << info.trigThrHLT); + matchObjects(trigName, probes, pairObjs); + + // Just for counting + ATH_MSG_DEBUG("Probes " << probes.size() << " Pairs " << pairObjs.size() ); + + // Include fill here + + + } // End loop over trigger list + + + return StatusCode::SUCCESS; +} + + + + + + + + +bool TrigEgammaMonitorTagAndProbeAlgorithm::executeTandP( const EventContext& ctx, std::vector<const xAOD::Electron*> &probeElectrons) const +{ + + auto monGroup = getGroup( "Event" ); + + fillLabel(monGroup, m_anatype+"_CutCounter", "Events"); + + + SG::ReadHandle<xAOD::EventInfo> eventInfo( m_eventInfoKey, ctx ); + if( !eventInfo.isValid() ){ + ATH_MSG_WARNING("Failed to retrieve EventInfo"); + return false; + } + + + if (eventInfo->errorState(xAOD::EventInfo::LAr) == xAOD::EventInfo::Error) { + ATH_MSG_WARNING("Event not passing LAr"); + return false; + } + + fillLabel(monGroup, m_anatype+"_CutCounter", "LAr"); + + + + SG::ReadHandle<xAOD::ElectronContainer> offElectrons(m_offElectronKey, ctx); + + if(!offElectrons.isValid()) + { + ATH_MSG_WARNING("Failed to retrieve offline Electrons "); + return false; + } + + fillLabel(monGroup, m_anatype+"_CutCounter", "RetrieveElectrons"); + + + + + + ATH_MSG_DEBUG( "Electron size is " << offElectrons->size() ); + + // Check Size of Electron Container + if ( offElectrons->size() < 2 ) { // Not enough events for T&P + ATH_MSG_DEBUG("Not enough Electrons for T&P"); + return false; + } + + fillLabel(monGroup, m_anatype+"_CutCounter", "TwoElectrons"); + + + + + SG::ReadHandle<xAOD::JetContainer> jets(m_jetKey); + if(!jets.isValid()){ + ATH_MSG_WARNING("Failed to retrieve JetContainer"); + return false; + } + + ATH_MSG_DEBUG( "Jet size is " << jets->size()); + + + if(!m_tagTrigList.empty()){ + if(m_applyMinimalTrigger){ + if ( !minimalTriggerRequirement() ) + return false; + } + fillLabel(monGroup, m_anatype+"_CutCounter", "PassTrigger"); + + }else{ + ATH_MSG_DEBUG("Disable trigger tags because trigger tags list is empty."); + } + + + + + + ATH_MSG_DEBUG("Execute TandP BaseTool " << offElectrons->size()); + for(const auto& elTag : *offElectrons) + { + if( ! isTagElectron( monGroup, elTag) ) continue; + + for(const auto& elProbe : *offElectrons) + { // Dress the probes with updated Pid decision + + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "Electrons"); + + if(elProbe==elTag) continue; + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "NotTags"); + // Check opposite charge + if(m_oppositeCharge && (elProbe->charge() == elTag->charge()) ) continue; + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "OS"); + if(!m_oppositeCharge && (elProbe->charge() != elTag->charge()) ) continue; + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "SS"); + + ATH_MSG_DEBUG("Execute TandP BaseTool OS"); + + if(m_doJpsiee){ + + float Jpsieelifetime = getPseudoLifetime(elTag,elProbe); + + if( dR(elTag->caloCluster()->eta(),elTag->caloCluster()->phi(), + elProbe->caloCluster()->eta(),elProbe->caloCluster()->phi()) <= 0.2 ){ + ATH_MSG_DEBUG("dR(elTag,elProbe)<0.2"); + continue; + + } + else if(Jpsieelifetime<-1 || 0.2<Jpsieelifetime){ + ATH_MSG_DEBUG("tag and probe pair not in Jpsi lifetime window"); + continue; + } + + } + //Must be an easy way with IParticle + TLorentzVector el1; + TLorentzVector el2; + el1.SetPtEtaPhiE(elTag->pt(), elTag->trackParticle()->eta(), elTag->trackParticle()->phi(), elTag->e()); + el2.SetPtEtaPhiE(elProbe->pt(), elProbe->trackParticle()->eta(), elProbe->trackParticle()->phi(), elProbe->e()); + float tpPairMass = (el1 + el2).M(); + if( !((tpPairMass > m_ZeeMassMin*1.e3) && (tpPairMass < m_ZeeMassMax*1.e3))){ + ATH_MSG_DEBUG("tag and probe pair not in Z mass window"); + continue; + } else { + //fill( monGroup, m_anatype+"_ProbeCutCounter", "ZMass"); + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "ZMass"); + + ATH_MSG_DEBUG("tag and probe pair in Z mass window"); + // Probe available. Good Probe? + if(!isGoodProbeElectron(monGroup, elProbe, jets.cptr())) continue; + //fill( monGroup, m_anatype+"_ProbeCutCounter", "GoodProbe"); + + xAOD::Electron *selProbe = new xAOD::Electron(*elProbe); + dressPid(selProbe); + + probeElectrons.push_back(selProbe); + + auto mon_count_probe= Monitored::Scalar<std::string>(m_anatype+"_PorbeCutCounter","GoodProbe"); + auto mon_mee = Monitored::Scalar<float>(m_anatype+"_Mee" , tpPairMass/1.e3 ); + fill( monGroup , mon_count_probe, mon_mee ); + } + } // end of for in Probe + } // end of for in Tags + + + ATH_MSG_DEBUG( "Number of probes found is " << probeElectrons.size() ); + return true; +} + + + +bool TrigEgammaMonitorTagAndProbeAlgorithm::minimalTriggerRequirement() const { + + ATH_MSG_DEBUG("Apply Minimal trigger requirements"); + for(unsigned int ilist = 0; ilist != m_tagTrigList.size(); ilist++) { + std::string tag = m_tagTrigList.at(ilist); + if ( tdt()->isPassed(tag) ) + return true; + } + return false; +} + + + +void TrigEgammaMonitorTagAndProbeAlgorithm::matchObjects(const std::string probeTrigItem, + std::vector<const xAOD::Electron*> probeElectrons, + std::vector<std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision *>> &pairObj ) const +{ + for( const auto *el : probeElectrons) + { + const TrigCompositeUtils::Decision *dec=nullptr; + match()->match(el, probeTrigItem, dec); + std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision *> pairProbe(el,dec); + pairObj.push_back(pairProbe); + } +} + + + + + +bool TrigEgammaMonitorTagAndProbeAlgorithm::isTagElectron( ToolHandle<GenericMonitoringTool> monGroup, + const xAOD::Electron *el) const +{ + fillLabel(monGroup, m_anatype+"_TagCutCounter", "Electrons"); + + + // Tag the event + // Require offline tight electron + // Match to e24_tight1_L1EM20V + ATH_MSG_DEBUG("Selecting Tag Electron"); + + //Check constituents + const xAOD::TrackParticle *trk = el->trackParticle(); + if(!el->trackParticle()){ + ATH_MSG_DEBUG("No track Particle"); + return false; + } + + fillLabel(monGroup, m_anatype+"_TagCutCounter", "HasTrack"); + + + ATH_MSG_DEBUG("Track pt " << trk->pt()); + const xAOD::CaloCluster *clus = el->caloCluster(); + if(!el->caloCluster()){ + ATH_MSG_DEBUG("No caloCluster"); + return false; + } + + fillLabel(monGroup, m_anatype+"_TagCutCounter", "HasCluster"); + + + + ATH_MSG_DEBUG("Cluster E "<<clus->e()); + ATH_MSG_DEBUG("Selecting Tag Electron PID"); + if (!ApplyElectronPid(el, m_offTagTightness)) return false; + fillLabel(monGroup, m_anatype+"_TagCutCounter", "GoodPid"); + + + + + ATH_MSG_DEBUG("Selecting Tag Electron Et"); + //Require Et > 25 GeV + if( !(el->e()/cosh(el->trackParticle()->eta()) > m_tagMinEt*Gaudi::Units::GeV) ){ + return false; + } + + fillLabel(monGroup, m_anatype+"_TagCutCounter", "Et"); + + + + + ATH_MSG_DEBUG("Selecting Tag Electron Eta"); + //fiducial detector acceptance region + float absEta = fabs(el->caloCluster()->etaBE(2)); + if ((absEta > 1.37 && absEta < 1.52) || absEta > 2.47) { + return false; + } + + + fillLabel(monGroup, m_anatype+"_TagCutCounter", "Eta"); + + + + ATH_MSG_DEBUG("Checking electron object quality"); + if (!el->isGoodOQ(xAOD::EgammaParameters::BADCLUSELECTRON)) return false; + + fillLabel(monGroup, m_anatype+"_TagCutCounter", "IsGoodOQ"); + + + + + if(m_tagTrigList.empty()) + { + ATH_MSG_DEBUG("Found a tag electron"); + return true; + } + + + ATH_MSG_DEBUG("Selecting Tag Electron Decision"); + // Check matching to a given trigger + // The statement below is more general + bool tagPassed=false; + for(unsigned int ilist = 0; ilist != m_tagTrigList.size(); ilist++) { + std::string tag = m_tagTrigList.at(ilist); + if(tdt()->isPassed(tag)){ + if(m_tp){ + std::string p1trigger; + std::string p2trigger; + if(splitTriggerName(tag,p1trigger,p2trigger)){ + if(fabs(p1trigger.find("tight"))<14) tag=p1trigger; + if(fabs(p2trigger.find("tight"))<14) tag=p2trigger; + } + if( match()->match(el,tag) ) + tagPassed=true; + } + else{ + tagPassed=true; + } + } + } + if(!tagPassed) { + ATH_MSG_DEBUG("Failed tag trigger "); + return false; + } + + fillLabel(monGroup, m_anatype+"_TagCutCounter", "PassTrigger"); + + + ATH_MSG_DEBUG("Matching Tag Electron FC"); + bool tagMatched=false; + for(unsigned int ilist = 0; ilist != m_tagTrigList.size(); ilist++) { + std::string tag = m_tagTrigList.at(ilist); + if( match()->match(el,tag) ) + tagMatched=true; + } + + if(!tagMatched){ + ATH_MSG_DEBUG("Failed a match "); + return false; // otherwise, someone matched! + } + + fillLabel(monGroup, m_anatype+"_TagCutCounter", "MatchTrigger"); + + ATH_MSG_DEBUG("Found a tag electron"); + return true; +} + + + + + + +bool TrigEgammaMonitorTagAndProbeAlgorithm::isGoodProbeElectron( ToolHandle<GenericMonitoringTool> monGroup, + const xAOD::Electron *el, + const xAOD::JetContainer *jets ) const +{ + + + //Check constituents + if(!el->trackParticle()){ + ATH_MSG_DEBUG("No track Particle"); + return false; + } + + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "HasTrack"); + + if(!el->caloCluster()){ + ATH_MSG_DEBUG("No caloCluster"); + return false; + } + + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "HasCluster"); + + //fiducial detector acceptance region + if(m_rmCrack){ + float absEta = fabs(el->caloCluster()->etaBE(2)); + if ((absEta > 1.37 && absEta < 1.52) || absEta > 2.47) { + return false; + } + } + + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "Eta"); + + + ATH_MSG_DEBUG("Checking electron object quality"); + if (!el->isGoodOQ(xAOD::EgammaParameters::BADCLUSELECTRON)) return false; + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "IsGoodOQ"); + + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "GoodPid"); + + + if(m_applyJetNearProbeSelection){ + TLorentzVector probeCandidate; + probeCandidate.SetPtEtaPhiE(el->pt(), el->trackParticle()->eta(), el->trackParticle()->phi(), el->e()); + Int_t jetsAroundProbeElectron = 0; + for(const auto &i_jet : *jets){ + TLorentzVector jet; + jet.SetPtEtaPhiE(i_jet->pt(), i_jet->eta(), i_jet->phi(), i_jet->e()); + if( (jet.Et() > 20*Gaudi::Units::GeV) && (jet.DeltaR(probeCandidate) < 0.4)) jetsAroundProbeElectron++; + } + //reject if more than 1 jet close to the probe electron + if ( jetsAroundProbeElectron >= 2 ) { + //ATH_MSG_DEBUG("too many jets around object"); + return false; + } + } + fillLabel(monGroup, m_anatype+"_ProbeCutCounter", "NearbyJet"); + + return true; // Good probe electron +} + + + +void TrigEgammaMonitorTagAndProbeAlgorithm::dressPid(const xAOD::Electron *eg) const +{ + auto ctx = Gaudi::Hive::currentContext() ; + for(int ipid=0;ipid<3;ipid++){ + bool accept = (bool) this->m_electronIsEMTool[ipid]->accept(ctx,eg); + const std::string pidname="is"+m_isemname[ipid]; + eg->auxdecor<bool>(pidname)=static_cast<bool>(accept); + } + for(int ipid=0;ipid<2;ipid++){ + bool accept = (bool) this->m_electronLHTool[ipid]->accept(ctx,eg); + const std::string pidname="is"+m_lhname[ipid]; + eg->auxdecor<bool>(pidname)=static_cast<bool>(accept); + } + eg->auxdecor<bool>("Isolated")=isIsolated(eg, m_offProbeIsolation); +} + + + + + + + +float TrigEgammaMonitorTagAndProbeAlgorithm::getPseudoLifetime(const xAOD::Electron *el1,const xAOD::Electron *el2) const +{ + + TLorentzVector el1track; + TLorentzVector el2track; + + float Et1=hypot(el1->caloCluster()->m(),el1->caloCluster()->pt())/cosh(el1->trackParticle()->eta()); + float Et2=hypot(el2->caloCluster()->m(),el2->caloCluster()->pt())/cosh(el1->trackParticle()->eta()); + + el1track.SetPtEtaPhiM(Et1, el1->trackParticle()->eta(), el1->trackParticle()->phi(),0.511); + el2track.SetPtEtaPhiM(Et2, el2->trackParticle()->eta(), el2->trackParticle()->phi(), 0.511); + + float lxy=simple_lxy(0, + el1->trackParticle()->d0() , el2->trackParticle()->d0(), + el1->trackParticle()->phi(), el2->trackParticle()->phi(), + Et1, Et2, + 0.0, 0.0); + + float ptEECalo = (el1track+el2track).Pt(); + + return lxy*3096.916/(0.299792458*ptEECalo); + +} + +double TrigEgammaMonitorTagAndProbeAlgorithm::simple_lxy(int flag, double d1, double d2, double phi1, double phi2, + double pt1, double pt2, double vx, double vy) const +{ + double simple = -99999.; + + //require minimum opening angle of 1 microradian. + if(fabs(phi1 - phi2) < 1e-6) return simple; + + double simpleXv = (-d2*cos(phi1) + d1*cos(phi2)) / sin(phi2-phi1); + double simpleYv = (-d2*sin(phi1) + d1*sin(phi2)) / sin(phi2-phi1); + double rxy = sqrt((simpleXv-vx)*(simpleXv-vx) + + (simpleYv-vy)*(simpleYv-vy) ); + + double f1 = (fabs(pt1)*cos(phi1)+fabs(pt2)*cos(phi2)); + double f2 = (fabs(pt1)*sin(phi1)+fabs(pt2)*sin(phi2)); + double c = sqrt( f1*f1 + f2*f2 ); + + if ( c == 0 ) return simple; + + double a = (simpleXv-vx)*f1; + double b = (simpleYv-vy)*f2; + + if (flag == 1) + return rxy; + else + return (a+b)/c; +} + + + + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..61804d2ae7f1b23dc189303ee9a503d1883bcec4 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.h @@ -0,0 +1,105 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef TrigEgammaMonitorTagAndProbeAlgorithm_H +#define TrigEgammaMonitorTagAndProbeAlgorithm_H + +#include "TrigEgammaMonitorAnalysisAlgorithm.h" + + + + +class TrigEgammaMonitorTagAndProbeAlgorithm: public TrigEgammaMonitorAnalysisAlgorithm +{ + + public: + + TrigEgammaMonitorTagAndProbeAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual ~TrigEgammaMonitorTagAndProbeAlgorithm() override; + + virtual StatusCode initialize() override; + + virtual StatusCode fillHistograms( const EventContext& ctx) const override; + + + protected: + + /*! Tag and Probe method called by derived classes */ + bool executeTandP( const EventContext& ctx, std::vector<const xAOD::Electron*> & ) const; + + /*! Match probes called by derived classes */ + void matchObjects(const std::string trigItem, std::vector<const xAOD::Electron*>, + std::vector<std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*>> &) const; + + + + /*! Trigger for tag and event wise selection */ + std::vector<std::string> m_tagTrigList; + /*! List of triggers from menu */ + std::vector<std::string> m_trigInputList; + /*! List of triggers from menu after filter*/ + std::vector<std::string> m_trigList; + + + private: + + /*! at least one chain should pass. e28_tight_iloose? */ + bool minimalTriggerRequirement () const; + /*! Tag Electron selection */ + bool isTagElectron( ToolHandle<GenericMonitoringTool> monGroup, const xAOD::Electron *el) const; + /*! Probe selection */ + bool isGoodProbeElectron( ToolHandle<GenericMonitoringTool> monGroup, const xAOD::Electron *el, const xAOD::JetContainer *) const; + /*! Return pseudo-lifetime of Jpsi */ + float getPseudoLifetime(const xAOD::Electron*,const xAOD::Electron*) const; + /*! Calculate the displacement of the Jpsi vertex w.r.t. the primary vertex in the transverse plane */ + double simple_lxy(int ,double, double, double , double , double , double , double, double ) const; + /*! Rerun offline selection */ + void dressPid(const xAOD::Electron *eg) const; + + + /** Properties **/ + + + + + /*! Zee lower mass cut */ + Gaudi::Property<float> m_ZeeMassMin{ this, "ZeeLowerMass", 80}; + /*! Zee upper mass cut */ + Gaudi::Property<float> m_ZeeMassMax{ this, "ZeeUpperMass", 100}; + /*! Define the PID for tag electron */ + Gaudi::Property<std::string> m_offTagTightness{ this, "OfflineTagSelector", "Tight"}; + /*! define the Pid of Probe from the user */ + Gaudi::Property<std::string> m_offProbeTightness{ this, "OfflineProbeSelector", "Loose"}; + /*! Select opposite or same-sign pairs -- for background studies */ + Gaudi::Property<bool> m_oppositeCharge{ this, "OppositeCharge", true}; + /*! Minimum tag Et */ + Gaudi::Property<float> m_tagMinEt{ this, "OfflineTagMinEt", 25}; + /*! Minimum probe Et */ + Gaudi::Property<float> m_probeMinEt{this, "OfflineProbeMinEt", 4}; + /*! Probe isolation */ + Gaudi::Property<std::string> m_offProbeIsolation{ this, "OfflineProbeIsolation", "Loose"}; + /*! Remove crack region for Probe default True */ + Gaudi::Property<bool> m_rmCrack{this, "RemoveCrack", true}; + /*! Enable the requirement of triggers */ + Gaudi::Property<bool> m_applyMinimalTrigger{this, "ApplyMinimalTrigger", true}; + /*! Apply nearby jet selection */ + Gaudi::Property<bool> m_applyJetNearProbeSelection{this, "ApplyJetNearProbeSelection", true}; + /*! do jpsiee tag and probe */ + Gaudi::Property<bool> m_doJpsiee{this,"DoJpsiee", false}; + /*! analysis name */ + Gaudi::Property<std::string> m_anatype{ this, "Analysis","Zee"}; + + // Containers + /*! Event Wise offline ElectronContainer Access and end iterator */ + SG::ReadHandleKey<xAOD::ElectronContainer> m_offElectronKey{ this, "ElectronKey", "Electrons", ""}; + /*! Jet container for probe selection */ + SG::ReadHandleKey<xAOD::JetContainer> m_jetKey{ this, "JetKey" , "AntiKt4LCTopoJets", ""}; + /*! Event Info key */ + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{ this, "EventInfoKey", "EventInfo", "" }; + + + +}; + +#endif diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/.__afs533D b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/.__afs533D new file mode 100644 index 0000000000000000000000000000000000000000..7aa2ac6e7edadf269c117be905c1f03992a1ebba --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/.__afs533D @@ -0,0 +1,5 @@ +#include "../TrigEgammaMonitorBaseAlgorithm.h" +#include "../TrigEgammaTapMonitorAlgorithm.h" + +DECLARE_COMPONENT(TrigEgammaMonitorBaseAlgorithm) +DECLARE_COMPONENT(TrigEgammaTaPMonitorAlgorithm) diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/TrigEgammaMonitoring_entries.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/TrigEgammaMonitoring_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cae19181bf9b7c37976842b1db6accba9e6b3a7d --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/TrigEgammaMonitoring_entries.cxx @@ -0,0 +1,14 @@ +#include "../TrigEgammaMonitorBaseAlgorithm.h" +#include "../TrigEgammaMonitorAnalysisAlgorithm.h" +#include "../TrigEgammaMonitorElectronAlgorithm.h" +#include "../TrigEgammaMonitorPhotonAlgorithm.h" +#include "../TrigEgammaMonitorTagAndProbeAlgorithm.h" + +DECLARE_COMPONENT(TrigEgammaMonitorBaseAlgorithm) +DECLARE_COMPONENT(TrigEgammaMonitorAnalysisAlgorithm) +DECLARE_COMPONENT(TrigEgammaMonitorElectronAlgorithm) +DECLARE_COMPONENT(TrigEgammaMonitorPhotonAlgorithm) +DECLARE_COMPONENT(TrigEgammaMonitorTagAndProbeAlgorithm) + + + diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py index 3aea8ce783c1b7d4eaa850d7fb73fcf4a7640141..07cc2d9efa69bc8f5faec9fe176935f9d1b1e172 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py @@ -16,6 +16,7 @@ def createHLTDQConfigFlags(): acf.addFlag('DQ.Steering.HLT.doGeneral', True) acf.addFlag('DQ.Steering.HLT.doEgamma', True) acf.addFlag('DQ.Steering.HLT.doMET', True) + acf.addFlag('DQ.Steering.HLT.doJet', True) acf.addFlag('DQ.Steering.HLT.doBjet', True) acf.addFlag('DQ.Steering.HLT.doCalo', True) acf.addFlag('DQ.Steering.HLT.doMuon', True) @@ -49,6 +50,10 @@ def TrigHLTMonTopConfig(inputFlags): from TrigMETMonitoring.TrigMETMonitorAlgorithm import TrigMETMonConfig result.merge(TrigMETMonConfig(inputFlags)) + if inputFlags.DQ.Steering.HLT.doJet: + from TrigJetMonitoring.TrigJetMonitorAlgorithm import TrigJetMonConfig + result.merge(TrigJetMonConfig(inputFlags)) + if inputFlags.DQ.Steering.HLT.doBjet: from TrigBjetMonitoring.TrigBjetMonitorAlgorithm import TrigBjetMonConfig result.merge(TrigBjetMonConfig(inputFlags)) diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/python/JetCollRemapping.py b/Trigger/TrigMonitoring/TrigJetMonitoring/python/JetCollRemapping.py new file mode 100644 index 0000000000000000000000000000000000000000..cd67696182a74692f7f2379f9ef0ad1b3b1685fd --- /dev/null +++ b/Trigger/TrigMonitoring/TrigJetMonitoring/python/JetCollRemapping.py @@ -0,0 +1,7 @@ +# Corresponding Run 3 jet collection name for each Run 2 jet collection +JetCollRun2ToRun3 = { + 'HLT_xAOD__JetContainer_a4tcemsubjesISFS' : 'HLT_AntiKt4EMTopoJets_subjesIS', # default small-R + 'HLT_xAOD__JetContainer_a10r_tcemsubjesISFS': 'HLT_AntiKt10JetRCJets_subjesIS', # a10r + 'HLT_xAOD__JetContainer_a10tclcwsubjesFS' : 'HLT_AntiKt10LCTopoJets_subjes', # a10 + 'HLT_xAOD__JetContainer_a10ttclcwjesFS' : 'HLT_AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets_jes', # a10t +} diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py index 452d3ae677f9f41efcb691de8cc6fcc5db653e19..4f5484ab31be9ea03d15a1c5af2cfcba4a2ef57e 100644 --- a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py @@ -56,12 +56,53 @@ Chain2JetCollDict['Legacy'] = { } from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, SelectSpec, ToolSpec +from AthenaConfiguration.AllConfigFlags import ConfigFlags + +def TrigJetMonConfig(inputFlags): + + # The following class will make a sequence, configure algorithms, and link + # them to GenericMonitoringTools + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(inputFlags,'TrigJetMonitorAlgorithm') + + # This is the right place to get the info, but the autoconfig of the flag + # is not yet implemented + AthenaMT = ConfigFlags.Trigger.EDMDecodingVersion==3 + + # AthenaMT or Legacy + InputType = 'MT' if AthenaMT else 'Legacy' + + # Loop over offline jet collections + for jetcoll in OfflineJetCollections: + offlineMonitorConf = jetMonitoringConfig(inputFlags,jetcoll,AthenaMT) + offlineMonitorConf.toAlg(helper) + + # Loop over HLT jet collections + for jetcoll in JetCollections[InputType]: + monitorConf = jetMonitoringConfig(inputFlags,jetcoll,AthenaMT) + # then we turn the full specification into properly configured algorithm and tools. + # we use the method 'toAlg()' defined for the specialized dictionnary 'JetMonAlgSpec' + monitorConf.toAlg(helper) + + # Loop over HLT jet chains + for chain,jetcoll in Chain2JetCollDict[InputType].iteritems(): + chainMonitorConf = jetChainMonitoringConfig(inputFlags,jetcoll,chain,AthenaMT) + chainMonitorConf.toAlg(helper) + + # the AthMonitorCfgHelper returns an accumulator to be used by the general configuration system. + return helper.result() # Basic selection of histograms common for online and offline jets -def basicJetMonAlgSpec(jetcoll,isOnline): +def basicJetMonAlgSpec(jetcoll,isOnline,athenaMT): # we use a specialized dictionnary (JetMonAlgSpec) which will be translated into the final C++ tool path = 'NoTriggerSelection' if isOnline else 'standardHistos/' - Conf = JetMonAlgSpec(jetcoll+"Mon",JetContainerName = jetcoll, defaultPath = path) + + # Remap online Run 2 jet collections + from TrigJetMonitoring import JetCollRemapping + jetcollFolder = jetcoll + if jetcoll in JetCollRemapping.JetCollRun2ToRun3 and not athenaMT: + jetcollFolder = JetCollRemapping.JetCollRun2ToRun3[jetcoll] + Conf = JetMonAlgSpec(jetcoll+"Mon",JetContainerName = jetcoll, defaultPath = path, topLevelDir="HLT/JetMon/", bottomLevelDir=jetcollFolder) # Now start filling the histo spec list Conf.appendHistos( @@ -112,6 +153,7 @@ def basicJetMonAlgSpec(jetcoll,isOnline): # "pt", # ] ), ) + return Conf # Additional histograms for offline jets @@ -132,19 +174,12 @@ ExtraSmallROnlineHists = [ ExtraLargeROnlineHists = [ ] -def jetMonitoringConfig(inputFlags,jetcoll): +def jetMonitoringConfig(inputFlags,jetcoll,athenaMT): '''Function to configures some algorithms in the monitoring system.''' - ### STEP 1 ### - # The following class will make a sequence, configure algorithms, and link - # them to GenericMonitoringTools - from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,jetcoll+'AthMonitorCfg') - - ### STEP 2 ### # Declare a configuration dictionnary for a JetContainer isOnline = True if 'HLT' in jetcoll else False - conf = basicJetMonAlgSpec(jetcoll,isOnline) + conf = basicJetMonAlgSpec(jetcoll,isOnline,athenaMT) if isOnline: if 'AntiKt4' in jetcoll: for hist in ExtraSmallROnlineHists: conf.appendHistos(hist) @@ -153,24 +188,16 @@ def jetMonitoringConfig(inputFlags,jetcoll): else: # offline for hist in ExtraOfflineHists: conf.appendHistos(hist) - # then we turn the full specification into properly configured algorithm and tools. - # we use the method 'toAlg()' defined for the specialized dictionnary 'JetMonAlgSpec' - conf.toAlg(helper) - - return helper.result() # the AthMonitorCfgHelper returns an accumulator to be used by the general configuration system. + return conf -def jetChainMonitoringConfig(inputFlags,jetcoll,chain): +def jetChainMonitoringConfig(inputFlags,jetcoll,chain,athenaMT): '''Function to configures some algorithms in the monitoring system.''' - ### STEP 1 ### - # The following class will make a sequence, configure algorithms, and link - # them to GenericMonitoringTools - from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,chain+'AthMonitorCfg') - - ### STEP 2 ### - # Declare a configuration dictionnary for a JetContainer - #from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, SelectSpec, ToolSpec + # Remap online Run 2 jet collections + from TrigJetMonitoring import JetCollRemapping + jetcollFolder = jetcoll + if jetcoll in JetCollRemapping.JetCollRun2ToRun3 and not athenaMT: + jetcollFolder = JetCollRemapping.JetCollRun2ToRun3[jetcoll] # We schedule a new JetAlg which will be acting only when a TriggerChain fired (using the TriggerChain from the base classes). # We'll plot 1 histo build by a dedicated JetHistoTriggEfficiency tool. @@ -179,7 +206,7 @@ def jetChainMonitoringConfig(inputFlags,jetcoll,chain): # this is done here. def defineHistoForJetTrigg(conf, parentAlg, monhelper , path): # create a monitoring group with the histo path starting from the parentAlg - group = monhelper.addGroup(parentAlg, conf.Group, 'Jets/'+jetcoll+'/') + group = monhelper.addGroup(parentAlg, conf.Group, conf.topLevelDir+jetcollFolder+'/') # define the histogram group.defineHistogram('trigPassed,jetVar',title='titletrig', type="TEfficiency", path=chain, xbins=100 , xmin=0, xmax=500000. ,) @@ -189,12 +216,14 @@ def jetChainMonitoringConfig(inputFlags,jetcoll,chain): JetContainerName = jetcoll, TriggerChain = chain, defaultPath = chain, + topLevelDir="HLT/JetMon/", + bottomLevelDir=jetcollFolder, ) trigConf.appendHistos( "pt", "m", "eta", - "et", + "et", # we pass directly the ToolSpec ToolSpec('JetHistoTriggEfficiency', chain, # below we pass the Properties of this JetHistoTriggEfficiency tool : @@ -207,14 +236,14 @@ def jetChainMonitoringConfig(inputFlags,jetcoll,chain): if 'smc' in chain: trigConf.appendHistos( SelectSpec( 'm50', '50<m', chain, FillerTools = [ - ToolSpec('JetHistoTriggEfficiency', chain, + ToolSpec('JetHistoTriggEfficiency', chain, Group='jetTrigGroup_'+chain+'_m50', Var=retrieveVarToolConf("pt"), # In this context we can not just pass a str alias to describe a histo variable ProbeTrigChain=chain,defineHistoFunc=defineHistoForJetTrigg ), - ] ), + ] ), SelectSpec( 'et500', '500<et', chain, FillerTools = [ - ToolSpec('JetHistoTriggEfficiency', chain, + ToolSpec('JetHistoTriggEfficiency', chain, Group='jetTrigGroup_'+chain+'_et500', Var=retrieveVarToolConf("m"), # In this context we can not just pass a str alias to describe a histo variable ProbeTrigChain=chain,defineHistoFunc=defineHistoForJetTrigg @@ -222,9 +251,7 @@ def jetChainMonitoringConfig(inputFlags,jetcoll,chain): ] ), ) - trigConf.toAlg(helper) - - return helper.result() # the AthMonitorCfgHelper returns an accumulator to be used by the general configuration system. + return trigConf if __name__=='__main__': @@ -260,7 +287,6 @@ if __name__=='__main__': log.setLevel(INFO) # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import ConfigFlags ConfigFlags.Input.Files = [inputFile] ConfigFlags.Input.isMC = True ConfigFlags.Output.HISTFileName = 'AthenaMTMonitorOutput.root' if AthenaMT else 'LegacyMonitoringOutput.root' @@ -272,22 +298,31 @@ if __name__=='__main__': cfg = MainServicesSerialCfg() cfg.merge(PoolReadCfg(ConfigFlags)) - # Loop over offline jet collections - for jetcoll in OfflineJetCollections: - offlineMonitorAcc = jetMonitoringConfig(ConfigFlags,jetcoll) - cfg.merge(offlineMonitorAcc) - + # The following class will make a sequence, configure algorithms, and link + # them to GenericMonitoringTools + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(ConfigFlags,'TrigJetMonitorAlgorithm') + # AthenaMT or Legacy InputType = 'MT' if AthenaMT else 'Legacy' + # Loop over offline jet collections + for jetcoll in OfflineJetCollections: + offlineMonitorConf = jetMonitoringConfig(ConfigFlags,jetcoll,AthenaMT) + offlineMonitorConf.toAlg(helper) + # Loop over HLT jet collections for jetcoll in JetCollections[InputType]: - monitorAcc = jetMonitoringConfig(ConfigFlags,jetcoll) - cfg.merge(monitorAcc) + monitorConf = jetMonitoringConfig(ConfigFlags,jetcoll,AthenaMT) + # then we turn the full specification into properly configured algorithm and tools. + # we use the method 'toAlg()' defined for the specialized dictionnary 'JetMonAlgSpec' + monitorConf.toAlg(helper) # Loop over HLT jet chains for chain,jetcoll in Chain2JetCollDict[InputType].iteritems(): - monitorAcc = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain) - cfg.merge(monitorAcc) + chainMonitorConf = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT) + chainMonitorConf.toAlg(helper) + + cfg.merge(helper.result()) cfg.run() diff --git a/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt b/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt index bfcae8d8e48cb789999dd23fa49e2ed58797b1e8..568ab360049d71af54926c91dcaffb1039e217d3 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt +++ b/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt @@ -5,40 +5,6 @@ # Declare the package name: atlas_subdir( TrigOutputHandling ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - PRIVATE - Control/AthContainers - Control/AthLinks - Control/AthenaBaseComps - Control/AthViews - Control/RootUtils - Trigger/TrigEvent/TrigSteeringEvent - Event/xAOD/xAODTrigCalo - Event/xAOD/xAODTrigRinger - Event/xAOD/xAODTrigEgamma - Event/xAOD/xAODEgamma - Event/xAOD/xAODTrigger - Event/xAOD/xAODTracking - Trigger/TrigDataAccess/TrigSerializeResult - Event/xAOD/xAODTrigMuon - Event/xAOD/xAODMuon - Event/xAOD/xAODTrigMissingET - Event/xAOD/xAODTau - Event/xAOD/xAODTrigBphys - Event/xAOD/xAODJet - Event/xAOD/xAODBTagging - Trigger/TrigSteer/DecisionHandling - Trigger/TrigSteer/TrigCompositeUtils - Control/AthenaMonitoringKernel - Trigger/TrigMonitoring/TrigCostMonitorMT - Trigger/TrigAlgorithms/TrigPartialEventBuilding - Trigger/TrigDataAccess/TrigSerializeTP - Trigger/TrigConfiguration/TrigConfData - Control/AthContainersRoot) - - find_package( tdaq-common COMPONENTS eformat ) find_package( Boost ) @@ -47,34 +13,28 @@ atlas_add_library( TrigOutputHandlingLib src/*.cxx PUBLIC_HEADERS TrigOutputHandling INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} GaudiKernel AthViews AthenaBaseComps RootUtils TrigSteeringEvent TrigSerializeResultLib TrigConfData - xAODTrigCalo xAODTrigRinger xAODTrigEgamma xAODEgamma xAODBTagging xAODTrigger xAODTracking xAODTrigMuon xAODMuon xAODTau xAODTrigBphys xAODTrigMissingET DecisionHandlingLib AthenaMonitoringKernelLib TrigPartialEventBuildingLib TrigSerializeTPLib AthContainersRoot TrigCompositeUtilsLib ) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} GaudiKernel AthViews AthenaBaseComps RootUtils TrigSteeringEvent TrigSerializeResultLib TrigConfData xAODTrigCalo xAODTrigRinger xAODTrigEgamma xAODEgamma xAODBTagging xAODTrigger xAODTracking xAODTrigMuon xAODMuon xAODTau xAODTrigBphys xAODTrigMissingET DecisionHandlingLib AthenaMonitoringKernelLib TrigPartialEventBuildingLib TrigSerializeTPLib AthContainersRoot TrigCompositeUtilsLib TrigCostMonitorMTLib ) atlas_add_component( TrigOutputHandling src/components/*.cxx LINK_LIBRARIES TrigOutputHandlingLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) # Tests: atlas_add_test( void_record_test SOURCES test/void_record_test.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} xAODTrigger - AthLinks AthenaKernel StoreGateLib GaudiKernel TestTools xAODCore + LINK_LIBRARIES TrigOutputHandlingLib ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" POST_EXEC_SCRIPT nopost.sh PROPERTIES TIMEOUT 300 ) - atlas_add_test( serial_deserial_test SOURCES test/serial_deserial_test.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} xAODTrigEgamma xAODEgamma TrigSteeringEvent - AthLinks AthenaKernel StoreGateLib GaudiKernel TestTools xAODCore TrigOutputHandlingLib TrigCompositeUtilsLib + LINK_LIBRARIES TrigOutputHandlingLib ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" POST_EXEC_SCRIPT nopost.sh PROPERTIES TIMEOUT 300 @@ -82,9 +42,7 @@ atlas_add_test( serial_deserial_test atlas_add_test( schema_evolution_test SOURCES test/schema_evolution_test.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} xAODTrigEgamma xAODEgamma - AthLinks AthenaKernel StoreGateLib GaudiKernel TestTools xAODCore TrigOutputHandlingLib TrigCompositeUtilsLib + LINK_LIBRARIES TrigOutputHandlingLib ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" POST_EXEC_SCRIPT nopost.sh PROPERTIES TIMEOUT 300 diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py index 4d4efed9a2942c73ec9fb57160f18e28dcf4d98e..7451e62b3f6ed6c0b96e082e2a715322347800d6 100644 --- a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py +++ b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py @@ -47,7 +47,7 @@ from AthenaCommon.AppMgr import ToolSvc as toolSvc from TrigT1CTMonitoring.TrigT1CTMonitoringConf import TrigT1CTMonitoring__BSMonitoring as BSMon #-----------ONLINE CODE--------------------- -if isOnline: +if isOnline and jp.ConcurrencyFlags.NumThreads() == 0: #from TrigServices.TrigServicesConf import TrigMonTHistSvc #THistSvc = TrigMonTHistSvc("THistSvc") #svcMgr += THistSvc @@ -173,7 +173,7 @@ if isOnline: #-----------OFFLINE CODE--------------------- -if not isOnline: +if not isOnline and jp.ConcurrencyFlags.NumThreads() == 0: from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2CPMTowerMaker.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2CPMTowerMaker.h index 1b6d2605e8f391d42124908590f237e98b70a240..052dc928f5b698d9cf149fc6730296fd6dd096a1 100644 --- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2CPMTowerMaker.h +++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2CPMTowerMaker.h @@ -13,17 +13,18 @@ // STL #include <string> -#include <vector> // Athena/Gaudi #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" -#include "AthContainers/DataVector.h" #include "GaudiKernel/ToolHandle.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" #include "xAODTrigL1Calo/CPMTowerContainer.h" #include "xAODTrigL1Calo/CPMTowerAuxContainer.h" #include "xAODTrigL1Calo/TriggerTowerContainer.h" +#include "TrigT1Interfaces/TrigT1CaloDefs.h" + #include "TrigT1CaloToolInterfaces/IL1CPMTowerTools.h" @@ -54,7 +55,6 @@ class Run2CPMTowerMaker : public AthAlgorithm { typedef xAOD::CPMTowerContainer CPMTCollection; typedef xAOD::CPMTowerAuxContainer CPMTAuxCollection; - typedef xAOD::TriggerTowerContainer TTCollection; public: //------------------------- @@ -80,10 +80,10 @@ class Run2CPMTowerMaker : public AthAlgorithm ToolHandle<LVL1::IL1CPMTowerTools> m_CPMTowerTool; - /** location of TriggerTowers in TES */ - std::string m_triggerTowerLocation; /** locations within the TES to store collections of JEs*/ - std::string m_cpmTowerLocation ; + SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_triggerTowerKey{this, "TriggerTowerLocation", TrigT1CaloDefs::xAODTriggerTowerLocation}; + SG::WriteHandleKey<CPMTCollection> m_cpmTowerKey{this, "CPMTowerLocation", TrigT1CaloDefs::CPMTowerLocation}; + }; diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/Run2CPMTowerMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/Run2CPMTowerMaker.cxx index c31525a964584a223ed10eb3dd6879b25bed5433..cd725bf50516b6a566bfa30ec88ab3e1ea630a4a 100644 --- a/Trigger/TrigT1/TrigT1CaloSim/src/Run2CPMTowerMaker.cxx +++ b/Trigger/TrigT1/TrigT1CaloSim/src/Run2CPMTowerMaker.cxx @@ -13,46 +13,24 @@ // This algorithm includes #include "TrigT1CaloSim/Run2CPMTowerMaker.h" -#include "TrigT1Interfaces/TrigT1CaloDefs.h" #include "TrigT1CaloEvent/CPMTower_ClassDEF.h" namespace LVL1 { -/** This is the constructor for JEMaker and is where you define the relevant - parameters. - Currently these are : - - "TriggerTowerLocation" : the location of the jes in Storegate You shouldn't have to touch this. - - "CPMTowerLocation" : the location of the CPMT in StoreGate. You shouldn't have to touch this. - - Alter the values of these in jobOptions.txt -*/ - Run2CPMTowerMaker::Run2CPMTowerMaker( const std::string& name, ISvcLocator* pSvcLocator ) : AthAlgorithm( name, pSvcLocator ), - m_CPMTowerTool("LVL1::L1CPMTowerTools/L1CPMTowerTools") -{ - m_triggerTowerLocation = TrigT1CaloDefs::xAODTriggerTowerLocation; - m_cpmTowerLocation = TrigT1CaloDefs::CPMTowerLocation; - - // This is how you declare the parameters to Gaudi so that - // they can be over-written via the job options file - - declareProperty( "TriggerTowerLocation", m_triggerTowerLocation ) ; - declareProperty( "CPMTowerLocation", m_cpmTowerLocation ) ; -} + m_CPMTowerTool("LVL1::L1CPMTowerTools/L1CPMTowerTools") {} /** the initialise() method is called at the start of processing, so we set up any histograms etc. here*/ StatusCode Run2CPMTowerMaker::initialize() { - // We must here instantiate items which can only be made after - // any job options have been set - - ATH_MSG_INFO ( "Initialising" ) ; ATH_CHECK( m_CPMTowerTool.retrieve() ); + ATH_CHECK(m_triggerTowerKey.initialize()); + ATH_CHECK(m_cpmTowerKey.initialize()); return StatusCode::SUCCESS ; } @@ -80,26 +58,19 @@ There is so little to do that this routine does it all itself: StatusCode Run2CPMTowerMaker::execute( ) { ATH_MSG_DEBUG ( "Executing" ) ; - ATH_MSG_DEBUG ( "looking for trigger towers at " - << m_triggerTowerLocation ) ; // Vectors to store CPMTs in - CPMTCollection* vectorOfCPMTs = new CPMTCollection; - CPMTAuxCollection* cpmtAuxVector = new CPMTAuxCollection; - vectorOfCPMTs->setStore(cpmtAuxVector); + auto CPMTs = SG::makeHandle(m_cpmTowerKey); + auto vectorOfCPMTs = std::make_unique<CPMTCollection>(); + auto cpmtAuxVector = std::make_unique<CPMTAuxCollection>(); + vectorOfCPMTs->setStore(cpmtAuxVector.get()); // Retrieve TriggerTowers from StoreGate - if (evtStore()->contains<xAOD::TriggerTowerContainer>(m_triggerTowerLocation)) { - const DataVector<xAOD::TriggerTower>* vectorOfTTs; - StatusCode sc = evtStore()->retrieve(vectorOfTTs, m_triggerTowerLocation); - if (sc.isSuccess()) { - // Fill a DataVector of CPMTowers using L1CPMTowerTools - m_CPMTowerTool->makeCPMTowers(vectorOfTTs, vectorOfCPMTs, true); - ATH_MSG_DEBUG( vectorOfCPMTs->size()<<" CPMTowers have been generated") ; - } - else ATH_MSG_WARNING("Failed to retrieve TriggerTowers from " << m_triggerTowerLocation ); - } - else ATH_MSG_WARNING("No TriggerTowerContainer at " << m_triggerTowerLocation ); + auto vectorOfTTs = SG::makeHandle(m_triggerTowerKey); + ATH_CHECK(vectorOfTTs.isValid()); + // Fill a DataVector of CPMTowers using L1CPMTowerTools + m_CPMTowerTool->makeCPMTowers(vectorOfTTs.get(), vectorOfCPMTs.get(), true); + ATH_MSG_DEBUG( vectorOfCPMTs->size()<<" CPMTowers have been generated") ; if (msgLvl(MSG::DEBUG)) { ATH_MSG_DEBUG ( "Formed " << vectorOfCPMTs->size() << " CPM Towers " ) ; @@ -109,18 +80,8 @@ StatusCode Run2CPMTowerMaker::execute( ) ATH_MSG_DEBUG("CPMT has coords (" << (*itCPMT)->eta() <<", "<< (*itCPMT)->phi() << ") and energies : " << (*itCPMT)->emEnergy() <<", "<< (*itCPMT)->hadEnergy() <<" (Em,Had)" ); } - - // Finally, store CPMTs and we are done - CHECK( evtStore()->record( cpmtAuxVector, m_cpmTowerLocation + "Aux." ) ); - CHECK( evtStore()->record( vectorOfCPMTs, m_cpmTowerLocation ) ); - - // Report success for debug purposes - ATH_MSG_DEBUG("Stored CPM Towers in TES at "<< m_cpmTowerLocation ); - + ATH_CHECK(CPMTs.record(std::move(vectorOfCPMTs), std::move(cpmtAuxVector))); - // Report success in any case, or else job will terminate - vectorOfCPMTs=0; - cpmtAuxVector=0; return StatusCode::SUCCESS; }//end execute diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/CMakeLists.txt b/Trigger/TrigT1/TrigT1NSWSimTools/CMakeLists.txt index f33073d6a21b6cfc14b311ea2acdb76d0cc2bd88..039d38b9c43a850a5cd7e7606a15be642ff7384d 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1NSWSimTools/CMakeLists.txt @@ -24,12 +24,12 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonSimData MuonSpectrometer/MuonRDO Simulation/G4Sim/TrackRecord - Tools/PathResolver) + Tools/PathResolver + Generators/AtlasHepMC ) # External dependencies: find_package( Boost ) find_package( TBB ) -find_package( HepMC ) find_package( CLHEP ) find_package( Eigen ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) @@ -38,8 +38,8 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minui atlas_add_library( TrigT1NSWSimToolsLib src/*.cxx PUBLIC_HEADERS TrigT1NSWSimTools - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${HEPMC_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} ${Boost_LIBRARIES} ${TBB_LIBRARIES} AtlasHepMCLib SGTools GaudiKernel AthenaBaseComps AthenaKernel AGDDKernel GeoPrimitives Identifier EventInfo MuonAGDDDescription MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimEvent MuonSimData MuonRDO RegSelLUT PathResolver) @@ -48,8 +48,8 @@ atlas_add_library( TrigT1NSWSimToolsLib atlas_add_component( TrigT1NSWSimTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${HEPMC_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} ${Boost_LIBRARIES} ${TBB_LIBRARIES} AtlasHepMCLib SGTools GaudiKernel AthenaBaseComps AthenaKernel AGDDKernel GeoPrimitives Identifier EventInfo MuonAGDDDescription MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimEvent MuonSimData MuonRDO RegSelLUT PathResolver) diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx index a3c46268c25e211406ae13bdbbef2718b6378cb1..a0613dfcb3cbf9cd37ee3f3a4e21193a11a72a9e 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx @@ -11,7 +11,7 @@ #include "MuonSimEvent/MicromegasHitIdHelper.h" #include "MuonSimEvent/MM_SimIdToOfflineId.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "GeneratorObjects/McEventCollection.h" #include "TrackRecord/TrackRecordCollection.h" #include "MuonSimData/MuonSimDataCollection.h" diff --git a/Trigger/TrigT1/TrigT1RPCsteering/CMakeLists.txt b/Trigger/TrigT1/TrigT1RPCsteering/CMakeLists.txt index 41983a1afd9cef5a7ec0bbaa56b5fee401434a75..de0e7a17c787b4c25f5c1571b788643afbcaecf3 100644 --- a/Trigger/TrigT1/TrigT1RPCsteering/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1RPCsteering/CMakeLists.txt @@ -16,20 +16,20 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigT1/TrigT1RPClogic PRIVATE Generators/GeneratorObjects + Generators/AtlasHepMC MuonSpectrometer/MuonDigitContainer MuonSpectrometer/MuonIdHelpers Trigger/TrigT1/TrigT1Interfaces Trigger/TrigT1/TrigT1RPChardware ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_component( TrigT1RPCsteering src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry TrigT1RPClogicLib GeneratorObjects MuonDigitContainer MuonIdHelpersLib TrigT1Interfaces TrigT1RPChardwareLib RPChardware ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry TrigT1RPClogicLib GeneratorObjects MuonDigitContainer MuonIdHelpersLib TrigT1Interfaces TrigT1RPChardwareLib RPChardware ) # Install files from the package: atlas_install_headers( TrigT1RPCsteering ) diff --git a/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx index aea4ad0461b8eebba1d935e9df1af54e0e0007bc..fdff0c9fbac5affd1499880bc45ac5a1ec00cb4f 100755 --- a/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx +++ b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx @@ -5,7 +5,7 @@ #include "TrigT1RPCsteering/TrigT1RPC.h" #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenEvent.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" diff --git a/Trigger/TrigT1/TrigT1ZDC/CMakeLists.txt b/Trigger/TrigT1/TrigT1ZDC/CMakeLists.txt index 6319a6cb32870e7284d3f702b9256a06d7a76e13..54f30ddebf1ceaf50a6e2789817eb0b043baae0a 100644 --- a/Trigger/TrigT1/TrigT1ZDC/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1ZDC/CMakeLists.txt @@ -12,18 +12,18 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigConfiguration/TrigConfInterfaces PRIVATE Generators/GeneratorObjects + Generators/AtlasHepMC Trigger/TrigConfiguration/TrigConfL1Data Trigger/TrigT1/TrigT1Interfaces ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_component( TrigT1ZDC src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel GeneratorObjects TrigConfL1Data TrigT1Interfaces ) + INCLUDE_DIRS + LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps GaudiKernel GeneratorObjects TrigConfL1Data TrigT1Interfaces ) # Install files from the package: atlas_install_headers( TrigT1ZDC ) diff --git a/Trigger/TrigT1/TrigT1ZDC/src/TrigT1ZDC.cxx b/Trigger/TrigT1/TrigT1ZDC/src/TrigT1ZDC.cxx index 93bbd5a8ec51e573f291ef007f4e309424f01407..7be2bb3365c3e7e78f3a7fd6124ecae6c585515f 100644 --- a/Trigger/TrigT1/TrigT1ZDC/src/TrigT1ZDC.cxx +++ b/Trigger/TrigT1/TrigT1ZDC/src/TrigT1ZDC.cxx @@ -11,7 +11,7 @@ #include "GeneratorObjects/McEventCollection.h" #include "GaudiKernel/IPartPropSvc.h" #include "GaudiKernel/ITHistSvc.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <bitset> diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py index 2eb5b7bcbaa72993a6a6ded24057e49acf16c152..12c93898f7230cd516abb077af8f872984f79a7c 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py @@ -17,7 +17,6 @@ if 'InDetTrigFlags' not in dir(): from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags InDetTrigFlags.doNewTracking.set_Value_and_Lock(True) InDetTrigFlags.primaryVertexSetup = "IterativeFinding" - InDetTrigFlags.doiPatRec = False InDetTrigFlags.doRefit = True # switched on for ATR-12226 (z0 uncertainties in bjets) InDetTrigFlags.doPixelClusterSplitting = False InDetTrigFlags.doPrintConfigurables = False diff --git a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/CMakeLists.txt b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/CMakeLists.txt index d1c15606d1fd414c80aa9e4b8db47331e1b52e9d..24127ce1872d3d4385d2664177a785957776611d 100644 --- a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/CMakeLists.txt +++ b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/CMakeLists.txt @@ -11,27 +11,27 @@ atlas_depends_on_subdirs( PUBLIC Control/AthLinks Control/AthenaKernel Generators/GeneratorObjects + Generators/AtlasHepMC Trigger/TrigEvent/TrigInDetEvent Trigger/TrigEvent/TrigSteeringEvent PRIVATE GaudiKernel ) # External dependencies: -find_package( HepMC ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_library( TrigInDetTruthEvent src/*.cxx PUBLIC_HEADERS TrigInDetTruthEvent - INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} + INCLUDE_DIRS PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPMC_LIBRARIES} AthContainers AthLinks AthenaKernel GeneratorObjects TrigInDetEvent TrigSteeringEvent + LINK_LIBRARIES AtlasHepMCLib AthContainers AthLinks AthenaKernel GeneratorObjects TrigInDetEvent TrigSteeringEvent PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} GaudiKernel ) atlas_add_dictionary( TrigInDetTruthEventDict TrigInDetTruthEvent/TrigInDetTruthEventDict.h TrigInDetTruthEvent/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthContainers AthLinks GeneratorObjects TrigInDetEvent TrigSteeringEvent AthenaKernel GaudiKernel TrigInDetTruthEvent ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthContainers AthLinks GeneratorObjects TrigInDetEvent TrigSteeringEvent AthenaKernel GaudiKernel TrigInDetTruthEvent ) diff --git a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruth.h b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruth.h index 50ca026642dd7c0d34adce4fca8dd35f5dd19f8f..e0e9352c078805cf5b878c753a8021a5229f2191 100644 --- a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruth.h +++ b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruth.h @@ -27,8 +27,8 @@ #include "TrigInDetEvent/TrigInDetTrack.h" #include "TrigInDetTruthEvent/TrigIDHitStats.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/HepMcParticleLink.h" #include <iostream> diff --git a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruthMap.h b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruthMap.h index ef1161cd6cc820ebcb39be179bcec924190d2721..2907e1cd1bdaac737230c06c0b13178aba84e47c 100644 --- a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruthMap.h +++ b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruthMap.h @@ -30,7 +30,7 @@ #include "TrigInDetEvent/TrigInDetTrack.h" #include "TrigInDetEvent/TrigInDetTrackCollection.h" #include "TrigInDetTruthEvent/TrigInDetTrackTruth.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" #include <iostream> diff --git a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx index d7ec5861b68b59e9d6289d4c5f1b940f4151d6f6..bcfa97974d199e6b4a024f552a4dcbc779b3c75a 100644 --- a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx +++ b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx @@ -20,8 +20,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" void compare (const TrigIDHitStats& p1, const TrigIDHitStats& p2) diff --git a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx index 117c831846609653241c8fdb2a97525aba92152e..9f35e407de0385d77b26128e71af4a17311de5e4 100644 --- a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx +++ b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx @@ -21,8 +21,8 @@ #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenEvent.h" void compare (const TrigIDHitStats& p1, diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref index 66e28520a16ee926317337dcfe2d4d51df2bbb77..1bd0aee89433c2822eee7e5a750886b63d197fdd 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref @@ -175,9 +175,6 @@ TrigSignatureMoniMT INFO -- #3295122398 Features TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 #868405538 TrigSignatureMoniMT INFO -- #868405538 Events 20 20 19 - - - - 19 TrigSignatureMoniMT INFO -- #868405538 Features 50 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_csskpf_nojcalib_L1J20 #3533281867 -TrigSignatureMoniMT INFO -- #3533281867 Events 19 19 19 - - - - 19 -TrigSignatureMoniMT INFO -- #3533281867 Features 64 - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 #1335156103 TrigSignatureMoniMT INFO -- #1335156103 Events 19 19 16 - - - - 16 TrigSignatureMoniMT INFO -- #1335156103 Features 33 - - - - @@ -317,10 +314,10 @@ TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1T TrigSignatureMoniMT INFO -- #2342716369 Events 0 0 0 - - - - 0 TrigSignatureMoniMT INFO -- #2342716369 Features 0 - - - - TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1TAU12 #372992233 -TrigSignatureMoniMT INFO -- #372992233 Events 18 18 18 - - - - 0 -TrigSignatureMoniMT INFO -- #372992233 Features 39 - - - - +TrigSignatureMoniMT INFO -- #372992233 Events 18 18 18 - - - - 18 +TrigSignatureMoniMT INFO -- #372992233 Features 42 - - - - TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1TAU60 #1376650121 -TrigSignatureMoniMT INFO -- #1376650121 Events 5 5 5 - - - - 0 +TrigSignatureMoniMT INFO -- #1376650121 Events 5 5 5 - - - - 5 TrigSignatureMoniMT INFO -- #1376650121 Features 6 - - - - TrigSignatureMoniMT INFO HLT_tau160_idperf_track_L1TAU100 #714660857 TrigSignatureMoniMT INFO -- #714660857 Events 0 0 0 - - - - 0 @@ -341,56 +338,56 @@ TrigSignatureMoniMT INFO HLT_tau160_perf_tracktwo TrigSignatureMoniMT INFO -- #1799096347 Events 0 0 0 0 - - - 0 TrigSignatureMoniMT INFO -- #1799096347 Features 0 0 - - - TrigSignatureMoniMT INFO HLT_tau25_idperf_track_L1TAU12IM #554271976 -TrigSignatureMoniMT INFO -- #554271976 Events 14 14 14 - - - - 0 +TrigSignatureMoniMT INFO -- #554271976 Events 14 14 14 - - - - 14 TrigSignatureMoniMT INFO -- #554271976 Features 24 - - - - TrigSignatureMoniMT INFO HLT_tau25_idperf_tracktwoMVA_L1TAU12IM #988149859 -TrigSignatureMoniMT INFO -- #988149859 Events 14 14 14 13 - - - 11 +TrigSignatureMoniMT INFO -- #988149859 Events 14 14 14 13 - - - 13 TrigSignatureMoniMT INFO -- #988149859 Features 24 17 - - - TrigSignatureMoniMT INFO HLT_tau25_idperf_tracktwo_L1TAU12IM #3346942453 -TrigSignatureMoniMT INFO -- #3346942453 Events 14 14 14 13 - - - 0 +TrigSignatureMoniMT INFO -- #3346942453 Events 14 14 14 13 - - - 13 TrigSignatureMoniMT INFO -- #3346942453 Features 24 17 - - - TrigSignatureMoniMT INFO HLT_tau25_looseRNN_tracktwoMVA_L1TAU12IM #169452969 TrigSignatureMoniMT INFO -- #169452969 Events 14 14 12 11 - - - 9 -TrigSignatureMoniMT INFO -- #169452969 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #169452969 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_looseRNN_tracktwo_L1TAU12IM #2490017573 TrigSignatureMoniMT INFO -- #2490017573 Events 14 14 12 11 - - - 0 -TrigSignatureMoniMT INFO -- #2490017573 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #2490017573 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwoEF_L1TAU12IM #506456080 -TrigSignatureMoniMT INFO -- #506456080 Events 14 14 12 11 - - - 9 -TrigSignatureMoniMT INFO -- #506456080 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #506456080 Events 14 14 12 11 - - - 0 +TrigSignatureMoniMT INFO -- #506456080 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwoMVA_L1TAU12IM #4055280067 -TrigSignatureMoniMT INFO -- #4055280067 Events 14 14 12 11 - - - 9 -TrigSignatureMoniMT INFO -- #4055280067 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #4055280067 Events 14 14 12 11 - - - 0 +TrigSignatureMoniMT INFO -- #4055280067 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwo_L1TAU12IM #1433975745 -TrigSignatureMoniMT INFO -- #1433975745 Events 14 14 12 11 - - - 0 -TrigSignatureMoniMT INFO -- #1433975745 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #1433975745 Events 14 14 12 11 - - - 3 +TrigSignatureMoniMT INFO -- #1433975745 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM #2222894847 -TrigSignatureMoniMT INFO -- #2222894847 Events 14 14 12 11 - - - 9 -TrigSignatureMoniMT INFO -- #2222894847 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #2222894847 Events 14 14 12 11 - - - 6 +TrigSignatureMoniMT INFO -- #2222894847 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwo_L1TAU12IM #698603885 TrigSignatureMoniMT INFO -- #698603885 Events 14 14 12 11 - - - 0 -TrigSignatureMoniMT INFO -- #698603885 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #698603885 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_perf_tracktwoMVA_L1TAU12IM #112814536 -TrigSignatureMoniMT INFO -- #112814536 Events 14 14 12 11 - - - 9 -TrigSignatureMoniMT INFO -- #112814536 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #112814536 Events 14 14 14 13 - - - 13 +TrigSignatureMoniMT INFO -- #112814536 Features 24 17 - - - TrigSignatureMoniMT INFO HLT_tau25_perf_tracktwo_L1TAU12IM #1129072492 -TrigSignatureMoniMT INFO -- #1129072492 Events 14 14 12 11 - - - 0 -TrigSignatureMoniMT INFO -- #1129072492 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #1129072492 Events 14 14 14 13 - - - 13 +TrigSignatureMoniMT INFO -- #1129072492 Features 24 17 - - - TrigSignatureMoniMT INFO HLT_tau25_tightRNN_tracktwoMVA_L1TAU12IM #2472860683 -TrigSignatureMoniMT INFO -- #2472860683 Events 14 14 12 11 - - - 9 -TrigSignatureMoniMT INFO -- #2472860683 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #2472860683 Events 14 14 12 11 - - - 5 +TrigSignatureMoniMT INFO -- #2472860683 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_tightRNN_tracktwo_L1TAU12IM #2537544560 TrigSignatureMoniMT INFO -- #2537544560 Events 14 14 12 11 - - - 0 -TrigSignatureMoniMT INFO -- #2537544560 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #2537544560 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_verylooseRNN_tracktwoMVA_L1TAU12IM #2992830434 TrigSignatureMoniMT INFO -- #2992830434 Events 14 14 12 11 - - - 9 -TrigSignatureMoniMT INFO -- #2992830434 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #2992830434 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau25_verylooseRNN_tracktwo_L1TAU12IM #1275052132 TrigSignatureMoniMT INFO -- #1275052132 Events 14 14 12 11 - - - 0 -TrigSignatureMoniMT INFO -- #1275052132 Features 21 14 - - - +TrigSignatureMoniMT INFO -- #1275052132 Features 22 15 - - - TrigSignatureMoniMT INFO HLT_tau35_mediumRNN_tracktwoMVA_L1TAU12IM #2456480859 -TrigSignatureMoniMT INFO -- #2456480859 Events 14 14 11 10 - - - 8 -TrigSignatureMoniMT INFO -- #2456480859 Features 19 13 - - - +TrigSignatureMoniMT INFO -- #2456480859 Events 14 14 11 10 - - - 5 +TrigSignatureMoniMT INFO -- #2456480859 Features 20 14 - - - TrigSignatureMoniMT INFO HLT_xe100_mht_L1XE50 #532175988 TrigSignatureMoniMT INFO -- #532175988 Events 10 10 6 - - - - 6 TrigSignatureMoniMT INFO -- #532175988 Features 6 - - - - diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_BStoBStoESDAOD_mt1_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_BStoBStoESDAOD_mt1_build.py new file mode 100755 index 0000000000000000000000000000000000000000..20b559c737ff88b85784f139a1d2cdacf3e97245 --- /dev/null +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_BStoBStoESDAOD_mt1_build.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +# art-description: Run Trigger on data with athena and write ByteStream output, then run offline reco +# art-type: build +# art-include: master/Athena + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps +from TrigAnalysisTest.TrigAnalysisSteps import add_analysis_steps + +def findFile(pattern): + '''Bash inline file name finder''' + return '`find . -name \'{:s}\' | tail -n 1`'.format(pattern) + +# Run athena BS->BS job +BStoBS = ExecStep.ExecStep("BStoBS") +BStoBS.type = 'athena' +BStoBS.job_options = 'TriggerJobOpts/runHLT_standalone.py' +BStoBS.input = 'data' +BStoBS.threads = 1 +BStoBS.args += ' -c "setMenu=\'LS2_v1\';doWriteBS=True;doWriteRDOTrigger=False;forceEnableAllChains=True;"' + +# Extract the Main stream data +filterBS = ExecStep.ExecStep('FilterBS') +filterBS.type = 'other' +filterBS.executable = 'athenaHLT-select-PEB-stream.py' +filterBS.input = '' +filterBS.args = '-s Main ' + findFile('data_test.*.Single_Stream.daq.RAW.*.data') + +# Reconstruction step, BS->ESD->AOD +recoPreExec = ' '.join([ + "from TriggerJobOpts.TriggerFlags import TriggerFlags;", + "TriggerFlags.configForStartup=\'HLToffline\';", + "TriggerFlags.triggerMenuSetup=\'PhysicsP1_pp_run3_v1\';", + "TriggerFlags.inputHLTconfigFile.set_Value_and_Lock(\'NONE\');", + "TriggerFlags.AODEDMSet.set_Value_and_Lock(\'AODFULL\');"]) +reco = ExecStep.ExecStep('Tier0Reco') +reco.type = 'Reco_tf' +reco.threads = 1 +reco.input = '' +reco.explicit_input = True +reco.args = '--inputBSFile=' + findFile('*.physics_Main*.data') # output of the previous step +reco.args += ' --outputESDFile=ESD.pool.root --outputAODFile=AOD.pool.root' +reco.args += ' --conditionsTag=\'CONDBR2-BLKPA-2018-11\' --geometryVersion=\'ATLAS-R2-2016-01-00-01\'' +reco.args += ' --preExec="{:s}"'.format(recoPreExec) +reco.args += ' --postInclude="TriggerTest/disableChronoStatSvcPrintout.py"' + +# Test definition +test = Test.Test() +test.art_type = 'build' +test.exec_steps = [BStoBS, filterBS, reco] +test.check_steps = CheckSteps.default_check_steps(test) +add_analysis_steps(test) + +import sys +sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_Common.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_Common.py index fabd28e8e94fda93ed9b0e44f077f39242fe6d86..898aa3ee288cbd5093f2b3fd445deb99b9dcca06 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_Common.py +++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_Common.py @@ -129,7 +129,6 @@ InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False) InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(False) InDetFlags.doBackTracking=False InDetFlags.doTRTStandalone=False -InDetFlags.doiPatRec=False InDetFlags.doTruth=False InDetFlags.doPRDFormation=doIDNewTracking InDetFlags.doSpacePointFormation=doIDNewTracking diff --git a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt index a58a97fef84b47c8644b727b4eec72755a826ac1..62a312769c9bcf3477e446ac516dd0042e6d8011 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt +++ b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt @@ -24,7 +24,7 @@ atlas_add_component( TrigUpgradeTest atlas_install_joboptions( share/*.py ) atlas_install_data( share/*.ref share/*.conf ) atlas_install_python_modules( python/*.py ) -atlas_install_scripts( test/exec*.sh test/test*.sh test/test*.py ) +atlas_install_scripts( test/exec*.sh test/test*.sh ) # Check python syntax: atlas_add_test( flake8 @@ -36,22 +36,6 @@ atlas_add_test( ViewSchedule1 SCRIPT test/test_view_schedule.sh ENVIRONMENT THR atlas_add_test( ViewSchedule2 SCRIPT test/test_view_schedule.sh ENVIRONMENT THREADS=2 POST_EXEC_SCRIPT nopost.sh ) atlas_add_test( ViewSchedule64 SCRIPT test/test_view_schedule.sh ENVIRONMENT THREADS=64 POST_EXEC_SCRIPT nopost.sh ) - -# Helper to define unit tests running in a separate directory -# The test name is derived from the test script name: test/test_${name}.sh -function( _add_test name ) - set( rundir ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_${name} ) - file( REMOVE_RECURSE ${rundir} ) # cleanup to avoid interference with previous run - file( MAKE_DIRECTORY ${rundir} ) - atlas_add_test( ${name} - SCRIPT test/test_${name}.sh - PROPERTIES TIMEOUT 1000 - PROPERTIES WORKING_DIRECTORY ${rundir} - ${ARGN} ) -endfunction( _add_test ) - - - # Unit tests of the test scripts atlas_add_test( flake8_test_dir SCRIPT flake8 --select=ATL,F,E7,E9,W6 --enable-extension=ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/test diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/HLTCF.py b/Trigger/TrigValidation/TrigUpgradeTest/share/HLTCF.py deleted file mode 100644 index 78fe78142a09a6c4ac2d1a3262752433b3474a66..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/HLTCF.py +++ /dev/null @@ -1,104 +0,0 @@ - -##### obsolete functions for ctests - -allAlgs={} -def useExisting(name): - global allAlgs - return allAlgs[name] - -def AlgExisting(name): - global allAlgs - return name in allAlgs - - -def remember(name, instance): - global allAlgs - allAlgs[name] = instance - return instance - - - - -from AthenaCommon.CFElements import parOR, seqAND, stepSeq -from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import * - -def seqFilter(name, Inputs=[], Outputs=[], Chains=[]): - from DecisionHandling.DecisionHandlingConf import RoRSeqFilter, DumpDecisions - global allAlgs - input_list = list(set(Inputs)) - output_list = list (set(Outputs)) - chain_list = list (set(Chains)) - fname = "F_"+name - f = RoRSeqFilter(fname, Input=input_list, Output=output_list, Chains=chain_list) - if "Step1" in name: # so that we see events running through, will be gone once L1 emulation is included - f.AlwaysPass = True - allAlgs[name] = f - return f - - - -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRecoAlg -def TestRecoAlg(name, Output, FileName="noreco.dat", Input=""): - fname = "R_"+name - a = HLTTest__TestRecoAlg(fname, FileName=FileName, Output=Output, Input=Input) - allAlgs[name] = a - return a - - -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoAlg -def TestHypoAlg(name, Input, Output): - fname = "H_"+name - h = HLTTest__TestHypoAlg(fname, HypoInputDecisions=Input, HypoOutputDecisions=Output) - allAlgs[name] = h - return h - - -def merger(name, Inputs, Output ): - from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestInputMaker - outdec=["%s_decision"%i for i in Output] - return remember(name, HLTTest__TestInputMaker( "M_"+name, InputMakerInputDecisions=Inputs, Output=Output, InputMakerOutputDecisions=outdec, LinkName="initialRoI" ) ) - - -def addSteps(s): - return seqAND("HLTChainsSeq", s) - - - - - -##### new - -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRecoAlg -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoAlg -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoTool -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestComboHypoAlg - - -def TestHypoTool(name, prop): - threshold_value=''.join(filter(lambda x: x.isdigit(), name)) - value = int(threshold_value)*1000 - h = HLTTest__TestHypoTool(name, Threshold=value, Property=prop) - return h - -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestInputMaker -def InputMakerAlg(name): - return HLTTest__TestInputMaker(name, LinkName="initialRoI") - - -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRoRSeqFilter -def SeqFilterNew(name): - return HLTTest__TestRoRSeqFilter(name) - - -def TestRecAlgNew(name, FileName="noreco.dat"): - return HLTTest__TestRecoAlg(name=name, FileName=FileName) - -def TestHypoAlgNew(name): - return HLTTest__TestHypoAlg(name=name) - -def muTestHypoTool(name): - return TestHypoTool(name, "pt") - -def elTestHypoTool(name): - return TestHypoTool(name, "et") - diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/L1CF.py b/Trigger/TrigValidation/TrigUpgradeTest/share/L1CF.py deleted file mode 100644 index 2df71c60f61e694fd3ed3b466a4d08ba3f9fda2c..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/L1CF.py +++ /dev/null @@ -1,33 +0,0 @@ -from AthenaCommon.AlgSequence import AlgSequence, AthSequencer -topSequence = AlgSequence() - -from AthenaCommon.CFElements import parOR, seqAND - -TopHLTSeq = seqAND("TopHLTSeq") -topSequence += TopHLTSeq - - - - -L1UnpackingSeq = parOR("L1UnpackingSeq") -from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder -l1Decoder = L1Decoder( RoIBResult="", L1TriggerResult="" ) - -ctpUnpacker = CTPUnpackingEmulationTool( ForceEnableAllChains=False , InputFilename="ctp.dat" ) -#ctpUnpacker.CTPToChainMapping = [ "0:HLT_g100", "1:HLT_e20", "2:HLT_mu20", "3:HLT_2mu8", "3:HLT_mu8", "33:HLT_2mu8", "15:HLT_mu8_e8" ] -l1Decoder.ctpUnpacker = ctpUnpacker - -from L1Decoder.L1DecoderConfig import mapThresholdToL1DecisionCollection, mapThresholdToL1RoICollection - -emUnpacker = RoIsUnpackingEmulationTool("EMRoIsUnpackingTool", InputFilename="l1emroi.dat", OutputTrigRoIs=mapThresholdToL1RoICollection("EM"), Decisions=mapThresholdToL1DecisionCollection("EM") ) -emUnpacker.ThresholdToChainMapping = ["EM7 : HLT_mu8_e8", "EM20 : HLT_e20", "EM50 : HLT_2g50", "EM100 : HLT_g100" ] - -muUnpacker = RoIsUnpackingEmulationTool("MURoIsUnpackingTool", InputFilename="l1muroi.dat", OutputTrigRoIs=mapThresholdToL1RoICollection("MU"), Decisions=mapThresholdToL1DecisionCollection("MU") ) -muUnpacker.ThresholdToChainMapping = ["MU6 : HLT_mu6", "MU8 : HLT_mu8", "MU8 : HLT_2mu8", "MU8 : HLT_mu8_e8", "MU10 : HLT_mu20", "EM100 : HLT_g100" ] - -l1Decoder.roiUnpackers = [emUnpacker, muUnpacker] - -#print l1Decoder -L1UnpackingSeq += l1Decoder - -TopHLTSeq += L1UnpackingSeq diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/cfTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/cfTest.py deleted file mode 100644 index d6bdfaf53397a7ca2c6fc309888234053202da46..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/cfTest.py +++ /dev/null @@ -1,184 +0,0 @@ -############################################################### -# -# Job options file -# -# Based on AthExStoreGateExamples -# -#============================================================== - -#-------------------------------------------------------------- -# ATLAS default Application Configuration options -#-------------------------------------------------------------- - -# Configure the scheduler -from AthenaCommon.AlgScheduler import AlgScheduler -AlgScheduler.ShowControlFlow( True ) -AlgScheduler.ShowDataFlow( True ) - -# include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" ) -# svcMgr.ByteStreamInputSvc.FullFileName = [ "./input.data" ] - -# # This is the list of proxies to set up so that retrieval attempt will trigger the BS conversion -# if not hasattr( svcMgr, "ByteStreamAddressProviderSvc" ): -# from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc -# svcMgr += ByteStreamAddressProviderSvc() -# svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ "ROIB::RoIBResult/RoIBResult" ] - -# Event-level algorithm sequence - - -# from SGComps.SGCompsConf import SGInputLoader -# topSequence += SGInputLoader( OutputLevel=INFO, ShowEventDump=False ) -# topSequence.SGInputLoader.Load = [ ('ROIB::RoIBResult','RoIBResult') ] - -from AthenaCommon.CFElements import stepSeq - - -data = {'noreco': [';', ';', ';']} # in the lists there are the events - -data['emclusters'] = ['eta:1,phi:1,et:180000; eta:1,phi:-1.2,et:35000;', - 'eta:0.5,phi:0,et:120000; eta:1,phi:-1.2,et:65000;', - 'eta:-0.6,phi:1.7,et:9000;'] - -data['msmu'] = [';', - 'eta:-1.2,phi:0.7,pt:6500; eta:-1.1,phi:0.6,pt:8500;', - 'eta:-1.7,phi:-0.2,pt:9500;'] - -data['ctp'] = [ 'HLT_g100', 'HLT_2g50 HLT_e20', 'HLT_mu20 HLT_mu8 HLT_2mu8 HLT_mu8_e8' ] - -data['l1emroi'] = ['1,1,0,EM3,EM7,EM15,EM20,EM50,EM100; 1,-1.2,0,EM3,EM7', - '-0.6,0.2,0,EM3,EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM7,EM15,EM20,EM50', - '-0.6,1.5,0,EM3,EM7,EM7'] - -data['l1muroi'] = ['0,0,0,MU0;', - '-1,0.5,0,MU6,MU8; -1,0.5,0,MU6,MU8,MU10', - '-1.5,-0.1,0,MU6,MU8'] - -data['tracks'] = ['eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;', - 'eta:0.5,phi:0,pt:130000; eta:1,phi:-1.2,pt:60000;eta:-1.2,phi:0.7,pt:6700; eta:-1.1,phi:0.6,pt:8600;', - 'eta:-0.6,phi:1.7,et:9000;'] # no MU track for MS candidate 'eta:-1.7,phi:-0.2,pt:9500;' - -data['mucomb'] = [';', - 'eta:-1.2,phi:0.7,pt:6600; eta:-1.1,phi:0.6,pt:8600;', - ';'] - -data['electrons'] = ['eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;', - ';', - ';'] -data['photons'] = ['eta:1,phi:1,pt:130000;', - ';', - ';'] - - -from TrigUpgradeTest.TestUtils import writeEmulationFiles -writeEmulationFiles(data) - -include("TrigUpgradeTest/L1CF.py") -include("TrigUpgradeTest/HLTCF.py") - - - -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoTool -def emHTool(name): - v = int(name[5:])*1000 - return HLTTest__TestHypoTool(name, OutputLevel=DEBUG, Threshold=v, Property="et") - - -muChains = [ 'HLT_mu20', 'HLT_mu8', 'HLT_2mu8' ] -eChains = [ 'HLT_e20' ] -gChains = [ 'HLT_g100', 'HLT_2g50' ] -mueChains = [ 'HLT_mu8_e8' ] - - -from L1Decoder.L1DecoderConfig import mapThresholdToL1DecisionCollection, mapThresholdToL1RoICollection - -steps = [ parOR("step%i" % i) for i in range(5)] -stepNo = 0 -steps[stepNo] += seqFilter( "Step1MU", Inputs=[mapThresholdToL1DecisionCollection("MU")], Outputs=["step0MU"], Chains=muChains ) -steps[stepNo] += seqFilter( "Step1MU_E", Inputs=[mapThresholdToL1DecisionCollection("MU"), mapThresholdToL1DecisionCollection("EM")], Outputs=["step0MU","step0EM"], Chains=mueChains ) -steps[stepNo] += seqFilter( "Step1EM", Inputs=[mapThresholdToL1DecisionCollection("EM")], Outputs=["step0EM"], Chains=(eChains + gChains) ) - -emHypo = hypo("Step1ElGamHypo", Input="EMClusters", Output="EMDecisions") -emHypoTools = [ emHTool("HLT_e2"), emHTool("HLT_e3"), emHTool("HLT_e5"), - emHTool("HLT_g5"), emHTool("HLT_g7"), emHTool("HLT_g15") ] -emHypo.HypoTools = emHypoTools -emHypo += emHypoTools - -def msMuHTool(name): - v = int(name[6:])*1000 - return HLTTest__TestHypoTool(name, OutputLevel=DEBUG, Threshold=v, Property="pt") - -msMuHypo = hypo("Step1MuHypo", Input="MSMuons", Output="MSMUonDecisions") -msMuHypoTools = [ msMuHTool("HLT_mu6"), msMuHTool("HLT_mu8"), msMuHTool("HLT_mu10") ] -msMuHypo.HypoTools = msMuHypoTools -msMuHypo += msMuHypoTools - -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestComboHypoAlg - -stepNo += 1 -em1 = stepSeq( "em1", useExisting("Step1EM"), [ reco("EMRoIs", Output="EMRoIs"), - reco("CaloClustering", FileName="emclusters.dat", Output="EMClusters"), - emHypo ] ) -steps[stepNo] += em1 -mu1 = stepSeq("mu1", useExisting("Step1MU"), [ reco("MURoIs", Output="MURoIs"), - reco("muMSRecAlg", FileName="msmu.dat", Output="MSMuons"), - msMuHypo ] ) -steps[stepNo] += mu1 - -mue1 = stepSeq("mue1", useExisting("Step1MU_E"), [ useExisting("CaloClustering"), useExisting("muMSRecAlg"), - HLTTest__TestComboHypoAlg("mueHypo1", OutputLevel=DEBUG, Input1="EMClusters", Input2="MSMuons", - Output1="step1MUEDecisionsEM", Output2="step1MUEDecisionsMU", - Property1="et", Property2="pt", Threshold1=8000, Threshold2=8000, - DecisionLabel="HLT_mu8_e8" ) ]) -steps[stepNo] += mue1 - - -stepNo += 1 -steps[stepNo] += seqFilter("Step2MU", Inputs=["step1MUDecisions"], Outputs=["step2MU"], Chains=muChains ) -steps[stepNo] += seqFilter("Step2MU_E", Inputs=[ "step1MUEDecisionsEM", "step1MUEDecisionsMU"], Outputs=["step2MUE_EM", "step2MUE_MU"], Chains=mueChains ) -steps[stepNo] += seqFilter("Step2E", Inputs=["step1EDecisions"], Outputs=["step2E"], Chains=eChains ) -steps[stepNo] += seqFilter("Step2G", Inputs=["step1GDecisions"], Outputs=["step2G"], Chains=gChains ) - - -muCombHypo = hypo("Step2MuHypo", Input="CombMuons", Output="CombMuonDecisions") -muCombHypoTools = [ msMuHTool("HLT_mu6"), msMuHTool("HLT_mu8"), msMuHTool("HLT_mu10") ] # this tools are the same as MS ones, -muCombHypo.HypoTools = muCombHypoTools -muCombHypo += muCombHypoTools - - -eHypo = hypo("Step2ElHypo", Input="Electrons", Output="ElectronDecisions") -eHypoTools = [ emHTool("HLT_e2"), emHTool("HLT_e3"), emHTool("HLT_e5") ] -eHypo.HypoTools = emHypoTools -eHypo += emHypoTools - -gHypo = hypo("Step2GammHypo", Input="Photons", Output="PhotonDecisions") -gHypoTools = [ emHTool("HLT_e2"), emHTool("HLT_e3"), emHTool("HLT_e5") ] -gHypo.HypoTools = emHypoTools -gHypo += emHypoTools - -from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestMerger -def merger(name, Inputs, Output ): - m = HLTTest__TestMerger( "M_"+name, Inputs=Inputs, Output=Output ) - allAlgs[name] = m - return m - -stepNo += 1 -mu2 = stepSeq("mu2", useExisting("Step2MU"), [ reco("TrigFastTrackFinder", FileName="tracks.dat", Output="Tracks"), reco("MuonRecAlg", FileName="mucomb.dat", Output="CombMuons"), muCombHypo ] ) -steps[stepNo] += mu2 - -e2 = stepSeq( "e2" , useExisting("Step2E"), [ useExisting("TrigFastTrackFinder"), reco("ElectronRecAlg", FileName="electrons.dat", Output="Electrons"), eHypo ] ) -steps[stepNo] += e2 - -g2 = stepSeq("g2", useExisting("Step2G"), [ reco("GRoIs", "noreco.dat"), reco("PhotonRecAlg", FileName="photons.dat", Output="Photons"), gHypo ]) -steps[stepNo] += g2 -stepNo += 1 - -#mue2 = stepSeq("mue2", useExisting("Step2MU_E"), [ useExisting("TrkRoIs", "noreco.dat"), useExisting("TrigFastTrackFinder"), reco("MuonRecAlg", "mucomb.dat"), reco("ElectronRecAlg"), hypo("Step2MuEHypo") ]) -#steps[stepNo] += mue2 - - -theApp.EvtMax = 3 - -TopHLTSeq += addSteps(steps) - - diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/checkAOD.py b/Trigger/TrigValidation/TrigUpgradeTest/share/checkAOD.py deleted file mode 100644 index 2c066b6d5b5780624bb10704cf05edb9b26371fe..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/checkAOD.py +++ /dev/null @@ -1,26 +0,0 @@ -import AthenaPoolCnvSvc.ReadAthenaPool -from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream -Stream1 = AthenaPoolOutputStream( "Stream1") -Stream1.OutputFile = "ESDout.pool.root" - -svcMgr.EventSelector.InputCollections = [ "/eos/atlas/atlascerngroupdisk/data-art/grid-output/21.0/Athena/x86_64-slc6-gcc62-opt/2018-12-08T2201/TrigAnalysisTest/test_physics_pp_v7_rdotoesdaod_grid/AOD.pool.root" ] -#svcMgr.EventSelector.InputCollections = [ "myESD.pool.root" ] -from TrigValAlgs.TrigValAlgsConf import TrigEDMChecker -MessageSvc.defaultLimit = 9999999 -MessageSvc.useColors = True -checker = TrigEDMChecker() -checker.OutputLevel = DEBUG -checker.doDumpAll = False -checker.doDumpStoreGate = False -checker.doDumpNavigation = True -checker.doDumpTrigCompsiteNavigation = True - -checker.Decisions = "exportTest" -checker.dumpTrigCompositeContainers = [ "exportTest" ] - - -from AthenaCommon.AppMgr import topSequence -topSequence += checker - -theApp.EvtMax = 10 -svcMgr.EventSelector.SkipEvents = 9 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py b/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py deleted file mode 100644 index d1f94bfe668ffa108f99f9a2d187a61c64677bb8..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py +++ /dev/null @@ -1,36 +0,0 @@ -import AthenaPoolCnvSvc.ReadAthenaPool -from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream -Stream1 = AthenaPoolOutputStream( "Stream1") -Stream1.OutputFile = "ESDout.pool.root" - -svcMgr.EventSelector.InputCollections = [ "myESD.pool.root" ] - -from AthenaCommon.AppMgr import topSequence -from AthenaCommon.AppMgr import ToolSvc -from AthenaCommon.AppMgr import ServiceMgr as svcMgr -from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc -from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool -from TrigEDMConfig.TriggerEDM import EDMLibraries - -cvgsvc = TrigConf__xAODConfigSvc('xAODConfigSvc') -svcMgr += cvgsvc - -tdt = Trig__TrigDecisionTool('TrigDecisionTool') -tdt.TrigConfigSvc = cvgsvc -tdt.NavigationFormat = "TrigComposite" -tdt.Navigation.Dlls = [e for e in EDMLibraries if 'TPCnv' not in e] -ToolSvc += tdt - -from TrigValAlgs.TrigValAlgsConf import TrigEDMChecker -MessageSvc.defaultLimit = 9999999 -MessageSvc.useColors = True -checker = TrigEDMChecker() -checker.OutputLevel = DEBUG -checker.doDumpAll = False -checker.doDumpxAODTrigElectronContainer = True -checker.doDumpxAODTrackParticle = True -checker.doDumpTrigCompsiteNavigation = True -checker.doDumpAllTrigComposite = True -checker.doDumpStoreGate = False -checker.doTDTCheck = True -topSequence += checker diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/dummy_regtest.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/dummy_regtest.ref deleted file mode 100644 index ef4f2acce475c182a57d3427074d13f44fdd91d9..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/dummy_regtest.ref +++ /dev/null @@ -1 +0,0 @@ -Py:Athena INFO leaving with code 0: "successful run" \ No newline at end of file diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref deleted file mode 100644 index a050e27ac3da76acecd10ce14e39712f69b223b8..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref +++ /dev/null @@ -1,420 +0,0 @@ -TrigSignatureMoniMT INFO HLT_2e17_etcut_L12EM15VH #3136730292 -TrigSignatureMoniMT INFO -- #3136730292 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #3136730292 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_2e17_lhvloose_L12EM3 #1767768251 -TrigSignatureMoniMT INFO -- #1767768251 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #1767768251 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_2e3_etcut_L12EM3 #2613484113 -TrigSignatureMoniMT INFO -- #2613484113 Events 20 20 13 13 13 - - 13 -TrigSignatureMoniMT INFO -- #2613484113 Features 46 156 85 - - -TrigSignatureMoniMT INFO HLT_2g20_tight_L12EM20VH #2426612258 -TrigSignatureMoniMT INFO -- #2426612258 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #2426612258 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_2g35_etcut_L12EM20VH #58053304 -TrigSignatureMoniMT INFO -- #58053304 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #58053304 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_2g35_medium_L12EM20VH #3965466087 -TrigSignatureMoniMT INFO -- #3965466087 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #3965466087 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_2j330_a10t_lcw_jes_35smcINF_L1J100 #1295975955 -TrigSignatureMoniMT INFO -- #1295975955 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #1295975955 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_2mu14_L12MU10 #2619091790 -TrigSignatureMoniMT INFO -- #2619091790 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #2619091790 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_2mu15_L12MU10 #557204938 -TrigSignatureMoniMT INFO -- #557204938 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #557204938 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_2mu4_muonqual_L12MU4 #1584776935 -TrigSignatureMoniMT INFO -- #1584776935 Events 20 20 1 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #1584776935 Features 4 0 0 0 - -TrigSignatureMoniMT INFO HLT_2mu6Comb_L12MU6 #2046267508 -TrigSignatureMoniMT INFO -- #2046267508 Events 20 20 0 0 - - - 0 -TrigSignatureMoniMT INFO -- #2046267508 Features 0 0 - - - -TrigSignatureMoniMT INFO HLT_2mu6_10invm70_L1MU6 #1316992871 -TrigSignatureMoniMT INFO -- #1316992871 Events 20 20 0 0 0 0 0 0 -TrigSignatureMoniMT INFO -- #1316992871 Features 0 0 0 0 0 -TrigSignatureMoniMT INFO HLT_2mu6_Dr_L12MU4 #3304584056 -TrigSignatureMoniMT INFO -- #3304584056 Events 20 20 1 0 - - - 0 -TrigSignatureMoniMT INFO -- #3304584056 Features 4 0 - - - -TrigSignatureMoniMT INFO HLT_2mu6_L12MU6 #1747073535 -TrigSignatureMoniMT INFO -- #1747073535 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #1747073535 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_2mu6_muonqual_L12MU6 #2398136098 -TrigSignatureMoniMT INFO -- #2398136098 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #2398136098 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_3j200_L1J100 #2199422919 -TrigSignatureMoniMT INFO -- #2199422919 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #2199422919 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_3j200_L1J20 #493765146 -TrigSignatureMoniMT INFO -- #493765146 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #493765146 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_3mu6_L13MU6 #1832399408 -TrigSignatureMoniMT INFO -- #1832399408 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #1832399408 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_3mu6_msonly_L13MU6 #1199773318 -TrigSignatureMoniMT INFO -- #1199773318 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #1199773318 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_3mu8_msonly_L13MU6 #424835335 -TrigSignatureMoniMT INFO -- #424835335 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #424835335 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_4mu4_L14MU4 #1834383636 -TrigSignatureMoniMT INFO -- #1834383636 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #1834383636 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_5j70_0eta240_L14J20 #1175391812 -TrigSignatureMoniMT INFO -- #1175391812 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #1175391812 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15 #3989372080 -TrigSignatureMoniMT INFO -- #3989372080 Events 20 20 20 20 - - - 20 -TrigSignatureMoniMT INFO -- #3989372080 Features 20 20 - - - -TrigSignatureMoniMT INFO HLT_costmonitor_CostMonDS_L1All #843341480 -TrigSignatureMoniMT INFO -- #843341480 Events 20 20 20 20 - - - 20 -TrigSignatureMoniMT INFO -- #843341480 Features 20 20 - - - -TrigSignatureMoniMT INFO HLT_e140_lhloose_L1EM24VHI #2512605388 -TrigSignatureMoniMT INFO -- #2512605388 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #2512605388 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_e26_etcut_L1EM22VHI #1703681121 -TrigSignatureMoniMT INFO -- #1703681121 Events 20 20 1 1 0 - - 0 -TrigSignatureMoniMT INFO -- #1703681121 Features 1 5 0 - - -TrigSignatureMoniMT INFO HLT_e26_lhtight_L1EM24VHI #3494457106 -TrigSignatureMoniMT INFO -- #3494457106 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #3494457106 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_e300_etcut_L1EM24VHI #3481091923 -TrigSignatureMoniMT INFO -- #3481091923 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #3481091923 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_e3_etcut1step_mu6fast_L1EM8I_MU10 #2086577378 -TrigSignatureMoniMT INFO -- #2086577378 Events 20 20 - - - - - 0 -TrigSignatureMoniMT INFO -- #2086577378 Features - - - - - -TrigSignatureMoniMT INFO HLT_e3_etcut_L1EM3 #683953566 -TrigSignatureMoniMT INFO -- #683953566 Events 20 20 15 13 13 - - 13 -TrigSignatureMoniMT INFO -- #683953566 Features 48 156 85 - - -TrigSignatureMoniMT INFO HLT_e5_etcut_L1EM3 #324908483 -TrigSignatureMoniMT INFO -- #324908483 Events 20 20 13 12 12 - - 12 -TrigSignatureMoniMT INFO -- #324908483 Features 41 144 47 - - -TrigSignatureMoniMT INFO HLT_e5_lhloose_noringer_L1EM3 #1053337356 -TrigSignatureMoniMT INFO -- #1053337356 Events 20 20 10 9 9 0 - 0 -TrigSignatureMoniMT INFO -- #1053337356 Features 15 48 28 0 - -TrigSignatureMoniMT INFO HLT_e5_lhmedium_noringer_L1EM3 #176627878 -TrigSignatureMoniMT INFO -- #176627878 Events 20 20 9 8 8 0 - 0 -TrigSignatureMoniMT INFO -- #176627878 Features 13 47 27 0 - -TrigSignatureMoniMT INFO HLT_e5_lhtight_noringer_L1EM3 #2758326765 -TrigSignatureMoniMT INFO -- #2758326765 Events 20 20 9 8 8 0 - 0 -TrigSignatureMoniMT INFO -- #2758326765 Features 13 47 27 0 - -TrigSignatureMoniMT INFO HLT_e60_lhmedium_L1EM24VHI #713054523 -TrigSignatureMoniMT INFO -- #713054523 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #713054523 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_e7_etcut_L1EM3 #1959043579 -TrigSignatureMoniMT INFO -- #1959043579 Events 20 20 13 12 11 - - 11 -TrigSignatureMoniMT INFO -- #1959043579 Features 26 96 21 - - -TrigSignatureMoniMT INFO HLT_g140_etcut_L1EM24VHI #1045486446 -TrigSignatureMoniMT INFO -- #1045486446 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #1045486446 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_g140_loose_L1EM24VHI #3534544568 -TrigSignatureMoniMT INFO -- #3534544568 Events 20 20 0 0 0 0 - 0 -TrigSignatureMoniMT INFO -- #3534544568 Features 0 0 0 0 - -TrigSignatureMoniMT INFO HLT_g20_etcut_LArPEB_L1EM15 #2706532790 -TrigSignatureMoniMT INFO -- #2706532790 Events 20 20 4 4 3 3 - 3 -TrigSignatureMoniMT INFO -- #2706532790 Features 5 5 4 4 - -TrigSignatureMoniMT INFO HLT_g35_medium_g25_medium_L12EM20VH #1158879722 -TrigSignatureMoniMT INFO -- #1158879722 Events 20 20 - - - - - 0 -TrigSignatureMoniMT INFO -- #1158879722 Features - - - - - -TrigSignatureMoniMT INFO HLT_g5_etcut_L1EM3 #471243435 -TrigSignatureMoniMT INFO -- #471243435 Events 20 20 13 13 13 - - 13 -TrigSignatureMoniMT INFO -- #471243435 Features 41 41 50 - - -TrigSignatureMoniMT INFO HLT_g5_etcut_LArPEB_L1EM3 #3486231698 -TrigSignatureMoniMT INFO -- #3486231698 Events 20 20 13 13 13 13 - 13 -TrigSignatureMoniMT INFO -- #3486231698 Features 41 41 50 36 - -TrigSignatureMoniMT INFO HLT_g5_loose_L1EM3 #3230088967 -TrigSignatureMoniMT INFO -- #3230088967 Events 20 20 10 10 10 2 - 2 -TrigSignatureMoniMT INFO -- #3230088967 Features 15 15 31 2 - -TrigSignatureMoniMT INFO HLT_g5_medium_L1EM3 #385248610 -TrigSignatureMoniMT INFO -- #385248610 Events 20 20 9 9 9 2 - 2 -TrigSignatureMoniMT INFO -- #385248610 Features 13 13 30 2 - -TrigSignatureMoniMT INFO HLT_g5_tight_L1EM3 #3280865118 -TrigSignatureMoniMT INFO -- #3280865118 Events 20 20 9 9 9 1 - 1 -TrigSignatureMoniMT INFO -- #3280865118 Features 13 13 30 1 - -TrigSignatureMoniMT INFO HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20 #4034799151 -TrigSignatureMoniMT INFO -- #4034799151 Events 20 20 2 - - - - 2 -TrigSignatureMoniMT INFO -- #4034799151 Features 34 - - - - -TrigSignatureMoniMT INFO HLT_j225_ftf_subjesgscIS_bmv2c1040_split_L1J100 #3992507557 -TrigSignatureMoniMT INFO -- #3992507557 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #3992507557 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_j260_320eta490_L1J20 #3084792704 -TrigSignatureMoniMT INFO -- #3084792704 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #3084792704 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j260_320eta490_L1J75_31ETA49 #3769257182 -TrigSignatureMoniMT INFO -- #3769257182 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #3769257182 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j275_ftf_subjesgscIS_bmv2c1060_split_L1J100 #1211559599 -TrigSignatureMoniMT INFO -- #1211559599 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #1211559599 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_j300_ftf_subjesgscIS_bmv2c1070_split_L1J100 #3706723666 -TrigSignatureMoniMT INFO -- #3706723666 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #3706723666 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_j360_ftf_subjesgscIS_bmv2c1077_split_L1J100 #1837565816 -TrigSignatureMoniMT INFO -- #1837565816 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #1837565816 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_j420_L1J100 #2659902019 -TrigSignatureMoniMT INFO -- #2659902019 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #2659902019 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j420_L1J20 #2205518067 -TrigSignatureMoniMT INFO -- #2205518067 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #2205518067 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j420_ftf_subjesgscIS_L1J20 #4179085188 -TrigSignatureMoniMT INFO -- #4179085188 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #4179085188 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j45_L1J15 #1364976160 -TrigSignatureMoniMT INFO -- #1364976160 Events 20 20 6 - - - - 6 -TrigSignatureMoniMT INFO -- #1364976160 Features 6 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 #868405538 -TrigSignatureMoniMT INFO -- #868405538 Events 20 20 6 - - - - 6 -TrigSignatureMoniMT INFO -- #868405538 Features 6 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 #1335156103 -TrigSignatureMoniMT INFO -- #1335156103 Events 20 20 4 - - - - 4 -TrigSignatureMoniMT INFO -- #1335156103 Features 4 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_011jvt_L1J15 #2857031468 -TrigSignatureMoniMT INFO -- #2857031468 Events 20 20 6 - - - - 6 -TrigSignatureMoniMT INFO -- #2857031468 Features 6 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_015jvt_L1J15 #2938374624 -TrigSignatureMoniMT INFO -- #2938374624 Events 20 20 6 - - - - 6 -TrigSignatureMoniMT INFO -- #2938374624 Features 6 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_059jvt_L1J15 #1593009344 -TrigSignatureMoniMT INFO -- #1593009344 Events 20 20 5 - - - - 5 -TrigSignatureMoniMT INFO -- #1593009344 Features 5 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 #3341539267 -TrigSignatureMoniMT INFO -- #3341539267 Events 20 20 7 - - - - 7 -TrigSignatureMoniMT INFO -- #3341539267 Features 7 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 #991419339 -TrigSignatureMoniMT INFO -- #991419339 Events 20 20 5 5 5 - - 5 -TrigSignatureMoniMT INFO -- #991419339 Features 5 5 5 - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 #1961149049 -TrigSignatureMoniMT INFO -- #1961149049 Events 20 20 5 5 5 - - 5 -TrigSignatureMoniMT INFO -- #1961149049 Features 5 5 5 - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_pf_L1J20 #761060030 -TrigSignatureMoniMT INFO -- #761060030 Events 20 20 4 - - - - 4 -TrigSignatureMoniMT INFO -- #761060030 Features 4 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_L1J15 #1509925407 -TrigSignatureMoniMT INFO -- #1509925407 Events 20 20 7 - - - - 7 -TrigSignatureMoniMT INFO -- #1509925407 Features 7 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_pf_L1J20 #4012311417 -TrigSignatureMoniMT INFO -- #4012311417 Events 20 20 4 - - - - 4 -TrigSignatureMoniMT INFO -- #4012311417 Features 4 - - - - -TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J100 #3327656707 -TrigSignatureMoniMT INFO -- #3327656707 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #3327656707 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J20 #215408633 -TrigSignatureMoniMT INFO -- #215408633 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #215408633 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j460_a10r_L1J100 #1151767619 -TrigSignatureMoniMT INFO -- #1151767619 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #1151767619 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j460_a10r_L1J20 #3875082669 -TrigSignatureMoniMT INFO -- #3875082669 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #3875082669 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j460_a10t_lcw_jes_30smcINF_L1J100 #2296827117 -TrigSignatureMoniMT INFO -- #2296827117 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #2296827117 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j460_a10t_lcw_jes_L1J100 #436385969 -TrigSignatureMoniMT INFO -- #436385969 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #436385969 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20 #3634067472 -TrigSignatureMoniMT INFO -- #3634067472 Events 20 20 - - - - - 0 -TrigSignatureMoniMT INFO -- #3634067472 Features - - - - - -TrigSignatureMoniMT INFO HLT_j80_j60_L1J15 #582699527 -TrigSignatureMoniMT INFO -- #582699527 Events 20 20 - - - - - 0 -TrigSignatureMoniMT INFO -- #582699527 Features - - - - - -TrigSignatureMoniMT INFO HLT_j85_L1J20 #510475538 -TrigSignatureMoniMT INFO -- #510475538 Events 20 20 3 - - - - 3 -TrigSignatureMoniMT INFO -- #510475538 Features 3 - - - - -TrigSignatureMoniMT INFO HLT_j85_ftf_L1J20 #877042532 -TrigSignatureMoniMT INFO -- #877042532 Events 20 20 3 - - - - 3 -TrigSignatureMoniMT INFO -- #877042532 Features 3 - - - - -TrigSignatureMoniMT INFO HLT_j85_ftf_pf_L1J20 #1538535401 -TrigSignatureMoniMT INFO -- #1538535401 Events 20 20 2 - - - - 2 -TrigSignatureMoniMT INFO -- #1538535401 Features 2 - - - - -TrigSignatureMoniMT INFO HLT_mb_sptrk_L1RD0_FILLED #4097312640 -TrigSignatureMoniMT INFO -- #4097312640 Events 20 20 - - - - - 20 -TrigSignatureMoniMT INFO -- #4097312640 Features - - - - - -TrigSignatureMoniMT INFO HLT_mu0_muoncalib_L1MU20 #997163309 -TrigSignatureMoniMT INFO -- #997163309 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #997163309 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_mu0_muoncalib_L1MU4_EMPTY #782182242 -TrigSignatureMoniMT INFO -- #782182242 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #782182242 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_mu10_lateMu_L1MU10 #48780310 -TrigSignatureMoniMT INFO -- #48780310 Events 20 20 0 0 - - - 0 -TrigSignatureMoniMT INFO -- #48780310 Features 0 0 - - - -TrigSignatureMoniMT INFO HLT_mu20_ivar_L1MU6 #2083734526 -TrigSignatureMoniMT INFO -- #2083734526 Events 20 20 1 1 1 - - 1 -TrigSignatureMoniMT INFO -- #2083734526 Features 1 1 1 - - -TrigSignatureMoniMT INFO HLT_mu24_idperf_L1MU20 #677658909 -TrigSignatureMoniMT INFO -- #677658909 Events 20 20 1 1 0 0 - 0 -TrigSignatureMoniMT INFO -- #677658909 Features 1 1 0 0 - -TrigSignatureMoniMT INFO HLT_mu26_ivarmedium_L1MU20 #3411723090 -TrigSignatureMoniMT INFO -- #3411723090 Events 20 20 1 1 0 0 0 0 -TrigSignatureMoniMT INFO -- #3411723090 Features 1 1 0 0 0 -TrigSignatureMoniMT INFO HLT_mu28_ivarmedium_L1MU20 #1963262787 -TrigSignatureMoniMT INFO -- #1963262787 Events 20 20 1 1 0 0 0 0 -TrigSignatureMoniMT INFO -- #1963262787 Features 1 1 0 0 0 -TrigSignatureMoniMT INFO HLT_mu35_ivarmedium_L1MU20 #597064890 -TrigSignatureMoniMT INFO -- #597064890 Events 20 20 1 1 0 0 0 0 -TrigSignatureMoniMT INFO -- #597064890 Features 1 1 0 0 0 -TrigSignatureMoniMT INFO HLT_mu50_L1MU20 #3657158931 -TrigSignatureMoniMT INFO -- #3657158931 Events 20 20 1 1 0 0 - 0 -TrigSignatureMoniMT INFO -- #3657158931 Features 1 1 0 0 - -TrigSignatureMoniMT INFO HLT_mu50_RPCPEBSecondaryReadout_L1MU20 #827327262 -TrigSignatureMoniMT INFO -- #827327262 Events 20 20 1 1 0 0 0 0 -TrigSignatureMoniMT INFO -- #827327262 Features 1 1 0 0 0 -TrigSignatureMoniMT INFO HLT_mu60_0eta105_msonly_L1MU20 #1642591450 -TrigSignatureMoniMT INFO -- #1642591450 Events 20 20 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #1642591450 Features 0 0 0 - - -TrigSignatureMoniMT INFO HLT_mu6Comb_L1MU6 #996392590 -TrigSignatureMoniMT INFO -- #996392590 Events 20 20 1 1 - - - 1 -TrigSignatureMoniMT INFO -- #996392590 Features 1 1 - - - -TrigSignatureMoniMT INFO HLT_mu6_L1MU6 #2560542253 -TrigSignatureMoniMT INFO -- #2560542253 Events 20 20 1 1 0 0 - 0 -TrigSignatureMoniMT INFO -- #2560542253 Features 1 1 0 0 - -TrigSignatureMoniMT INFO HLT_mu6_idperf_L1MU6 #934918532 -TrigSignatureMoniMT INFO -- #934918532 Events 20 20 1 1 0 0 - 0 -TrigSignatureMoniMT INFO -- #934918532 Features 1 1 0 0 - -TrigSignatureMoniMT INFO HLT_mu6_ivarmedium_L1MU6 #1012713062 -TrigSignatureMoniMT INFO -- #1012713062 Events 20 20 1 1 0 0 0 0 -TrigSignatureMoniMT INFO -- #1012713062 Features 1 1 0 0 0 -TrigSignatureMoniMT INFO HLT_mu6_msonly_L1MU6 #3895421032 -TrigSignatureMoniMT INFO -- #3895421032 Events 20 20 1 0 0 - - 0 -TrigSignatureMoniMT INFO -- #3895421032 Features 1 0 0 - - -TrigSignatureMoniMT INFO HLT_mu6_mu4_L12MU4 #1713982776 -TrigSignatureMoniMT INFO -- #1713982776 Events 20 20 - - - - - 0 -TrigSignatureMoniMT INFO -- #1713982776 Features - - - - - -TrigSignatureMoniMT INFO HLT_mu6fast_L1MU6 #3518031697 -TrigSignatureMoniMT INFO -- #3518031697 Events 20 20 1 - - - - 1 -TrigSignatureMoniMT INFO -- #3518031697 Features 1 - - - - -TrigSignatureMoniMT INFO HLT_mu6noL1_L1MU6 #1631468602 -TrigSignatureMoniMT INFO -- #1631468602 Events 20 20 - - - 0 0 0 -TrigSignatureMoniMT INFO -- #1631468602 Features - - - 0 0 -TrigSignatureMoniMT INFO HLT_mu80_msonly_3layersEC_L1MU20 #761101109 -TrigSignatureMoniMT INFO -- #761101109 Events 20 20 1 0 0 - - 0 -TrigSignatureMoniMT INFO -- #761101109 Features 1 0 0 - - -TrigSignatureMoniMT INFO HLT_noalg_L1EM3 #4169267792 -TrigSignatureMoniMT INFO -- #4169267792 Events 20 20 - - - - - 20 -TrigSignatureMoniMT INFO -- #4169267792 Features - - - - - -TrigSignatureMoniMT INFO HLT_noalg_L1RD0_EMPTY #914660695 -TrigSignatureMoniMT INFO -- #914660695 Events 20 20 - - - - - 20 -TrigSignatureMoniMT INFO -- #914660695 Features - - - - - -TrigSignatureMoniMT INFO HLT_noalg_L1RD0_FILLED #211699639 -TrigSignatureMoniMT INFO -- #211699639 Events 20 20 - - - - - 20 -TrigSignatureMoniMT INFO -- #211699639 Features - - - - - -TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1TAU100 #2342716369 -TrigSignatureMoniMT INFO -- #2342716369 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #2342716369 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1TAU12 #372992233 -TrigSignatureMoniMT INFO -- #372992233 Events 20 20 4 - - - - 0 -TrigSignatureMoniMT INFO -- #372992233 Features 5 - - - - -TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1TAU60 #1376650121 -TrigSignatureMoniMT INFO -- #1376650121 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #1376650121 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_tau160_idperf_track_L1TAU100 #714660857 -TrigSignatureMoniMT INFO -- #714660857 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #714660857 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_tau160_idperf_tracktwoMVA_L1TAU100 #2725693236 -TrigSignatureMoniMT INFO -- #2725693236 Events 20 20 0 0 - - - 0 -TrigSignatureMoniMT INFO -- #2725693236 Features 0 0 - - - -TrigSignatureMoniMT INFO HLT_tau160_idperf_tracktwo_L1TAU100 #886074432 -TrigSignatureMoniMT INFO -- #886074432 Events 20 20 0 0 - - - 0 -TrigSignatureMoniMT INFO -- #886074432 Features 0 0 - - - -TrigSignatureMoniMT INFO HLT_tau160_mediumRNN_tracktwoMVA_L1TAU100 #1747754287 -TrigSignatureMoniMT INFO -- #1747754287 Events 20 20 0 0 - - - 0 -TrigSignatureMoniMT INFO -- #1747754287 Features 0 0 - - - -TrigSignatureMoniMT INFO HLT_tau160_perf_tracktwoMVA_L1TAU100 #2334140248 -TrigSignatureMoniMT INFO -- #2334140248 Events 20 20 0 0 - - - 0 -TrigSignatureMoniMT INFO -- #2334140248 Features 0 0 - - - -TrigSignatureMoniMT INFO HLT_tau160_perf_tracktwo_L1TAU100 #1799096347 -TrigSignatureMoniMT INFO -- #1799096347 Events 20 20 0 0 - - - 0 -TrigSignatureMoniMT INFO -- #1799096347 Features 0 0 - - - -TrigSignatureMoniMT INFO HLT_tau25_idperf_track_L1TAU12IM #554271976 -TrigSignatureMoniMT INFO -- #554271976 Events 20 20 3 - - - - 0 -TrigSignatureMoniMT INFO -- #554271976 Features 4 - - - - -TrigSignatureMoniMT INFO HLT_tau25_idperf_tracktwoMVA_L1TAU12IM #988149859 -TrigSignatureMoniMT INFO -- #988149859 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #988149859 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_idperf_tracktwo_L1TAU12IM #3346942453 -TrigSignatureMoniMT INFO -- #3346942453 Events 20 20 3 3 - - - 0 -TrigSignatureMoniMT INFO -- #3346942453 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_looseRNN_tracktwoMVA_L1TAU12IM #169452969 -TrigSignatureMoniMT INFO -- #169452969 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #169452969 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_looseRNN_tracktwo_L1TAU12IM #2490017573 -TrigSignatureMoniMT INFO -- #2490017573 Events 20 20 3 3 - - - 0 -TrigSignatureMoniMT INFO -- #2490017573 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwoEF_L1TAU12IM #506456080 -TrigSignatureMoniMT INFO -- #506456080 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #506456080 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwoMVA_L1TAU12IM #4055280067 -TrigSignatureMoniMT INFO -- #4055280067 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #4055280067 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwo_L1TAU12IM #1433975745 -TrigSignatureMoniMT INFO -- #1433975745 Events 20 20 3 3 - - - 0 -TrigSignatureMoniMT INFO -- #1433975745 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM #2222894847 -TrigSignatureMoniMT INFO -- #2222894847 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #2222894847 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwo_L1TAU12IM #698603885 -TrigSignatureMoniMT INFO -- #698603885 Events 20 20 3 3 - - - 0 -TrigSignatureMoniMT INFO -- #698603885 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_perf_tracktwoMVA_L1TAU12IM #112814536 -TrigSignatureMoniMT INFO -- #112814536 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #112814536 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_perf_tracktwo_L1TAU12IM #1129072492 -TrigSignatureMoniMT INFO -- #1129072492 Events 20 20 3 3 - - - 0 -TrigSignatureMoniMT INFO -- #1129072492 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_tightRNN_tracktwoMVA_L1TAU12IM #2472860683 -TrigSignatureMoniMT INFO -- #2472860683 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #2472860683 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_tightRNN_tracktwo_L1TAU12IM #2537544560 -TrigSignatureMoniMT INFO -- #2537544560 Events 20 20 3 3 - - - 0 -TrigSignatureMoniMT INFO -- #2537544560 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_verylooseRNN_tracktwoMVA_L1TAU12IM #2992830434 -TrigSignatureMoniMT INFO -- #2992830434 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #2992830434 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau25_verylooseRNN_tracktwo_L1TAU12IM #1275052132 -TrigSignatureMoniMT INFO -- #1275052132 Events 20 20 3 3 - - - 0 -TrigSignatureMoniMT INFO -- #1275052132 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_tau35_mediumRNN_tracktwoMVA_L1TAU12IM #2456480859 -TrigSignatureMoniMT INFO -- #2456480859 Events 20 20 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #2456480859 Features 4 4 - - - -TrigSignatureMoniMT INFO HLT_xe100_mht_L1XE50 #532175988 -TrigSignatureMoniMT INFO -- #532175988 Events 20 20 2 - - - - 2 -TrigSignatureMoniMT INFO -- #532175988 Features 2 - - - - -TrigSignatureMoniMT INFO HLT_xe100_pfsum_L1XE50 #1890237897 -TrigSignatureMoniMT INFO -- #1890237897 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #1890237897 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_xe100_tcpufit_L1XE50 #2803198799 -TrigSignatureMoniMT INFO -- #2803198799 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #2803198799 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_xe100_trkmht_L1XE50 #1055916731 -TrigSignatureMoniMT INFO -- #1055916731 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #1055916731 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_xe30_cell_L1XE10 #1649696554 -TrigSignatureMoniMT INFO -- #1649696554 Events 20 20 3 - - - - 3 -TrigSignatureMoniMT INFO -- #1649696554 Features 3 - - - - -TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpufit_L1XE10 #3768353779 -TrigSignatureMoniMT INFO -- #3768353779 Events 20 20 - - - - - 2 -TrigSignatureMoniMT INFO -- #3768353779 Features - - - - - -TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 #3626903018 -TrigSignatureMoniMT INFO -- #3626903018 Events 20 20 16 - - - - 16 -TrigSignatureMoniMT INFO -- #3626903018 Features 16 - - - - -TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 #998713382 -TrigSignatureMoniMT INFO -- #998713382 Events 20 20 5 - - - - 5 -TrigSignatureMoniMT INFO -- #998713382 Features 5 - - - - -TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 #1583719916 -TrigSignatureMoniMT INFO -- #1583719916 Events 20 20 2 - - - - 2 -TrigSignatureMoniMT INFO -- #1583719916 Features 2 - - - - -TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 #2468872349 -TrigSignatureMoniMT INFO -- #2468872349 Events 20 20 8 - - - - 8 -TrigSignatureMoniMT INFO -- #2468872349 Features 8 - - - - -TrigSignatureMoniMT INFO HLT_xe65_cell_L1XE50 #531141817 -TrigSignatureMoniMT INFO -- #531141817 Events 20 20 0 - - - - 0 -TrigSignatureMoniMT INFO -- #531141817 Features 0 - - - - -TrigSignatureMoniMT INFO HLT_xe65_cell_xe110_tcpufit_L1XE50 #115518400 -TrigSignatureMoniMT INFO -- #115518400 Events 20 20 - - - - - 0 -TrigSignatureMoniMT INFO -- #115518400 Features - - - - - diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/minbias.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/minbias.ref deleted file mode 100644 index 55c486a829db809ce17fb2a2eb51a3cefa0c2cbc..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/minbias.ref +++ /dev/null @@ -1,150 +0,0 @@ -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : 1784 have cl size == 1 in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : 2365 have cl size == 2 in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : 4399 have cl size >= 3 in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 8548 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 6957 SP in pixel barrel in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 808 SP in pixel ECA in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 783 SP in pixel ECC in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 22469 sct spacepoints in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 6013 sct ECC spacepoints in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 10215 sct Barr spacepoints in total. -TrigCountSpacePointsMT 0 0 DEBUG REGTEST : Formed 6241 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 0 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 0 0 DEBUG REGTEST found 1074 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 0 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : 1764 have cl size == 1 in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : 2252 have cl size == 2 in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : 4012 have cl size >= 3 in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 8028 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 6495 SP in pixel barrel in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 751 SP in pixel ECA in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 782 SP in pixel ECC in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 21397 sct spacepoints in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 5854 sct ECC spacepoints in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 9875 sct Barr spacepoints in total. -TrigCountSpacePointsMT 1 0 DEBUG REGTEST : Formed 5668 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 1 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 1 0 DEBUG REGTEST found 1025 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 1 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : 1361 have cl size == 1 in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : 1807 have cl size == 2 in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : 3173 have cl size >= 3 in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 6341 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 5143 SP in pixel barrel in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 693 SP in pixel ECA in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 505 SP in pixel ECC in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 16996 sct spacepoints in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 3870 sct ECC spacepoints in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 8521 sct Barr spacepoints in total. -TrigCountSpacePointsMT 2 0 DEBUG REGTEST : Formed 4605 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 2 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 2 0 DEBUG REGTEST found 655 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 2 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : 1292 have cl size == 1 in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : 1851 have cl size == 2 in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : 3442 have cl size >= 3 in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 6585 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 5410 SP in pixel barrel in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 611 SP in pixel ECA in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 564 SP in pixel ECC in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 18114 sct spacepoints in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 4784 sct ECC spacepoints in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 7925 sct Barr spacepoints in total. -TrigCountSpacePointsMT 3 0 DEBUG REGTEST : Formed 5405 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 3 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 3 0 DEBUG REGTEST found 719 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 3 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : 1817 have cl size == 1 in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : 2672 have cl size == 2 in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : 4520 have cl size >= 3 in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 9009 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 7422 SP in pixel barrel in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 789 SP in pixel ECA in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 798 SP in pixel ECC in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 26800 sct spacepoints in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 7215 sct ECC spacepoints in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 12765 sct Barr spacepoints in total. -TrigCountSpacePointsMT 4 0 DEBUG REGTEST : Formed 6820 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 4 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 4 0 DEBUG REGTEST found 1299 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 4 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : 1437 have cl size == 1 in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : 1940 have cl size == 2 in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : 3414 have cl size >= 3 in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 6791 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 5495 SP in pixel barrel in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 593 SP in pixel ECA in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 703 SP in pixel ECC in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 18197 sct spacepoints in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 4741 sct ECC spacepoints in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 8564 sct Barr spacepoints in total. -TrigCountSpacePointsMT 5 0 DEBUG REGTEST : Formed 4892 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 5 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 5 0 DEBUG REGTEST found 743 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 5 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : 1715 have cl size == 1 in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : 2174 have cl size == 2 in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : 3973 have cl size >= 3 in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 7862 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 6338 SP in pixel barrel in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 781 SP in pixel ECA in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 743 SP in pixel ECC in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 22098 sct spacepoints in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 5842 sct ECC spacepoints in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 10748 sct Barr spacepoints in total. -TrigCountSpacePointsMT 6 0 DEBUG REGTEST : Formed 5508 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 6 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 6 0 DEBUG REGTEST found 954 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 6 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : 2293 have cl size == 1 in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : 2866 have cl size == 2 in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : 5175 have cl size >= 3 in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 10334 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 8371 SP in pixel barrel in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 946 SP in pixel ECA in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 1017 SP in pixel ECC in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 29795 sct spacepoints in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 8201 sct ECC spacepoints in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 14196 sct Barr spacepoints in total. -TrigCountSpacePointsMT 7 0 DEBUG REGTEST : Formed 7398 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 7 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 7 0 DEBUG REGTEST found 1486 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 7 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : 1554 have cl size == 1 in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : 2010 have cl size == 2 in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : 3659 have cl size >= 3 in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 7223 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 5805 SP in pixel barrel in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 707 SP in pixel ECA in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 711 SP in pixel ECC in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 18566 sct spacepoints in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 4772 sct ECC spacepoints in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 8584 sct Barr spacepoints in total. -TrigCountSpacePointsMT 8 0 DEBUG REGTEST : Formed 5210 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 8 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 8 0 DEBUG REGTEST found 791 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 8 0 DEBUG REGTEST event accepted -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 2048 pixel spacepoints in total before cuts. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : 3560 have cl size == 1 in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : 4699 have cl size == 2 in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : 8696 have cl size >= 3 in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 16955 pixel spacepoints after ToT cut in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 13860 SP in pixel barrel in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 1537 SP in pixel ECA in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 1558 SP in pixel ECC in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 55158 sct spacepoints in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 15401 sct ECC spacepoints in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 24718 sct Barr spacepoints in total. -TrigCountSpacePointsMT 9 0 DEBUG REGTEST : Formed 15039 sct ECA spacepoints in total. -SPCountHypoAlgMT.HLT_mb_sptrk_L1RD0_F... 9 0 DEBUG REGTEST event accepted -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 9 0 DEBUG REGTEST found 3414 tracks for 'min_pt':0.100000 -TrackCountHypoAlgMT.HLT_mb_sptrk_L1RD... 9 0 DEBUG REGTEST event accepted diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/slice_minbias.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/slice_minbias.ref deleted file mode 100644 index 4419e447f0caa2e7a6e8c198396dfa66c0d1e89d..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/slice_minbias.ref +++ /dev/null @@ -1,6 +0,0 @@ -TrigSignatureMoniMT INFO HLT_mb_sp400_trk40_hmt_L1RD0_FILLED20 20 20 19 19 -TrigSignatureMoniMT INFO HLT_mb_sp400_trk40_hmt_L1RD0_FILLED decisions 20 19 -TrigSignatureMoniMT INFO HLT_mb_sp600_trk45_hmt_L1RD0_FILLED20 20 20 19 19 -TrigSignatureMoniMT INFO HLT_mb_sp600_trk45_hmt_L1RD0_FILLED decisions 20 19 -TrigSignatureMoniMT INFO HLT_mb_sptrk_L1RD0_FILLED 20 20 20 19 19 -TrigSignatureMoniMT INFO HLT_mb_sptrk_L1RD0_FILLED decisions 20 19 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_cosmics_cf_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_cosmics_cf_build.sh index 98340e1e8c3dd830bd57f22fd4e300d31c442b99..6d7798da97546ce702400d8c8cae863a45645206 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_cosmics_cf_build.sh +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_cosmics_cf_build.sh @@ -10,9 +10,6 @@ export THREADS=1 export SLOTS=1 export JOBOPTION="TrigUpgradeTest/Cosmic.py" -# This test doesn't produce any output useful for RegTest, so do a dummy reference comparison -export REGTESTEXP="leaving with code" -export REGTESTREF=`find_data.py TrigUpgradeTest/dummy_regtest.ref` #export EXTRA="isOnline=True;doEmptyMenu=True;doWriteBS=False;doWriteRDOTrigger=True;forceEnableAllChains=True" #export EXTRA="isOnline=True;doEmptyMenu=True;doWriteBS=False" export EXTRA="doEmptyMenu=True;doWriteBS=False;doWriteRDOTrigger=True;" diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_decodeBS_build.py b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_decodeBS_build.py deleted file mode 100755 index 0d97978f1c57103eb50420b446cf8d58a3891c31..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_decodeBS_build.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -# art-description: Runs the full_menu test writing BS output and then runs BS decoding -# art-type: build -# art-include: master/Athena - -from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps - -writeBS = ExecStep.ExecStep("WriteBS") -writeBS.type = 'athena' -writeBS.job_options = 'TriggerJobOpts/runHLT_standalone.py' -writeBS.input = 'data' -writeBS.args = '-c "isOnline=True;doWriteBS=True;doWriteRDOTrigger=False;"' - -decodeBS = ExecStep.ExecStep("DecodeBS") -decodeBS.type = 'athena' -decodeBS.job_options = 'TriggerJobOpts/decodeBS.py' -decodeBS.input = '' -decodeBS.explicit_input = True -decodeBS.args = '--filesInput=data_test.00360026.Single_Stream.daq.RAW._lb0151._Athena._0000.data' -decodeBS.perfmon = False # no need to run PerfMon for this step - -test = Test.Test() -test.art_type = 'build' -test.exec_steps = [writeBS, decodeBS] -test.check_steps = CheckSteps.default_check_steps(test) - -import sys -sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_empty_menu_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_empty_menu_build.sh deleted file mode 100755 index 0a7c29012fff62972d3847eb06e9aeb3698c7477..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_empty_menu_build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# art-description: athenaMT trigger test on data running no HLT menu -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -export EVENTS=20 -export THREADS=2 -export SLOTS=2 -export JOBOPTION="TriggerJobOpts/runHLT_standalone.py" -export EXTRA="isOnline=True;doEmptyMenu=True;doWriteBS=False;doWriteRDOTrigger=True;" - -# Skip dumping chain counts because this test doesn't produce the histogram including them -export SKIP_CHAIN_DUMP=1 - -source exec_TrigUpgradeTest_art_athenaMT.sh -source exec_TrigUpgradeTest_art_post.sh diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_empty_menu_mc_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_empty_menu_mc_build.sh deleted file mode 100755 index 572669c04269251b50d3a78866cbfc5583b3418c..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_empty_menu_mc_build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# art-description: athenaMT trigger test on MC running L1 simulation and no HLT menu -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -export EVENTS=20 -export THREADS=1 -export SLOTS=1 -export INPUT="ttbar" -export JOBOPTION="TriggerJobOpts/runHLT_standalone.py" -export EXTRA="doL1Sim=True;doEmptyMenu=True;doWriteBS=False;doWriteRDOTrigger=True;" - -# Skip dumping chain counts because this test doesn't produce the histogram including them -export SKIP_CHAIN_DUMP=1 - -source exec_TrigUpgradeTest_art_athenaMT.sh -source exec_TrigUpgradeTest_art_post.sh diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_build.sh deleted file mode 100755 index 1b31210796c412347e110664257dca72c081c86e..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# art-description: athenaMT trigger test using the full LS2_v1 menu from TriggerMenuMT -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -export EVENTS=20 -export THREADS=1 -export SLOTS=1 -export JOBOPTION="TriggerJobOpts/runHLT_standalone.py" -export REGTESTEXP="TriggerSummaryStep.*HLT_.*|TriggerMonitorFinal.*HLT_.*|TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*" -export EXTRA="isOnline=True;doWriteBS=False;doWriteRDOTrigger=True;forceEnableAllChains=True;fpeAuditor=True" - -# Find the regtest reference installed with the release -export REGTESTREF=`find_data.py TrigUpgradeTest/full_menu_build.ref` - -source exec_TrigUpgradeTest_art_athenaMT.sh -source exec_TrigUpgradeTest_art_post.sh diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_mc_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_mc_build.sh deleted file mode 100755 index b776885f110e11efd2d5b82d8ff0cd80d1b33630..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_mc_build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# art-description: athenaMT trigger test using the full LS2_v1 menu from TriggerMenuMT -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -export EVENTS=20 -export THREADS=1 -export SLOTS=1 -export INPUT="ttbar" -export JOBOPTION="TriggerJobOpts/runHLT_standalone.py" -export REGTESTEXP="TriggerSummaryStep.*HLT_.*|TriggerMonitorFinal.*HLT_.*|TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*" -export EXTRA="doL1Sim=True;doWriteBS=False;doWriteRDOTrigger=True;" - -source exec_TrigUpgradeTest_art_athenaMT.sh -source exec_TrigUpgradeTest_art_post.sh diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_reverse_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_reverse_build.sh deleted file mode 100755 index e4f77a31f7c33bd79e698f780a02e6343f1a9cff..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_reverse_build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# art-description: athenaMT trigger test using the full LS2_v1 menu from TriggerMenuMT. Reverse EventView order to test their independence -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -export EVENTS=20 -export THREADS=1 -export SLOTS=1 -export JOBOPTION="TriggerJobOpts/runHLT_standalone.py" -export REGTESTEXP="TriggerSummaryStep.*HLT_.*|TriggerMonitorFinal.*HLT_.*|TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*" -export EXTRA="isOnline=True;reverseViews=True;doWriteBS=False;doWriteRDOTrigger=True;" - -# Find the regtest reference installed with the release -export REGTESTREF=`find_data.py TrigUpgradeTest/full_menu_build.ref` - -source exec_TrigUpgradeTest_art_athenaMT.sh -source exec_TrigUpgradeTest_art_post.sh diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_peb_ds_build.py b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_peb_ds_build.py deleted file mode 100755 index 8c2429079b9bc87ade23f2d2fca0c32ef4609b82..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_peb_ds_build.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -# art-description: athenaMT trigger test of partial event building and data scouting -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps - -ex = ExecStep.ExecStep() -ex.type = 'athena' -ex.job_options = 'TrigP1Test/PEBDSTest.py' -ex.input = 'data' -ex.args = '-c "forceEnableAllChains=True;"' - -test = Test.Test() -test.art_type = 'build' -test.exec_steps = [ex] -test.check_steps = CheckSteps.default_check_steps(test) - -import sys -sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_py_full_menu_build.py b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_py_full_menu_build.py deleted file mode 100755 index 58ca2512eac00785ceb87bd29d6ba276ae5308ad..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_py_full_menu_build.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -# art-description: athenaMT trigger test using the full LS2_v1 menu from TriggerMenuMT -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps - -ex = ExecStep.ExecStep() -ex.type = 'athena' -ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' -ex.input = 'data' -ex.args = '-c "isOnline=True;doWriteBS=False;doWriteRDOTrigger=True;"' - -test = Test.Test() -test.art_type = 'build' -test.exec_steps = [ex] -test.check_steps = CheckSteps.default_check_steps(test) - -import sys -sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref index 9c9beb080481b1a58ef76e3cdf49e058d935a6b4..0907a8ecac46f782f51b9b278a93eddb7665346c 100644 --- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref +++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref @@ -181,9 +181,6 @@ TrigSignatureMoniMT INFO -- #3295122398 Features TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 #868405538 TrigSignatureMoniMT INFO -- #868405538 Events 20 20 6 - - - - 6 TrigSignatureMoniMT INFO -- #868405538 Features 6 - - - - -TrigSignatureMoniMT INFO HLT_j45_ftf_csskpf_nojcalib_L1J20 #3533281867 -TrigSignatureMoniMT INFO -- #3533281867 Events 20 20 3 - - - - 3 -TrigSignatureMoniMT INFO -- #3533281867 Features 3 - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 #1335156103 TrigSignatureMoniMT INFO -- #1335156103 Events 20 20 5 - - - - 5 TrigSignatureMoniMT INFO -- #1335156103 Features 5 - - - - @@ -335,7 +332,7 @@ TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1 TrigSignatureMoniMT INFO -- #2342716369 Events 20 20 0 - - - - 0 TrigSignatureMoniMT INFO -- #2342716369 Features 0 - - - - TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1TAU12 #372992233 -TrigSignatureMoniMT INFO -- #372992233 Events 20 20 4 - - - - 0 +TrigSignatureMoniMT INFO -- #372992233 Events 20 20 4 - - - - 4 TrigSignatureMoniMT INFO -- #372992233 Features 5 - - - - TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1TAU60 #1376650121 TrigSignatureMoniMT INFO -- #1376650121 Events 20 20 0 - - - - 0 @@ -359,13 +356,13 @@ TrigSignatureMoniMT INFO HLT_tau160_perf_tracktw TrigSignatureMoniMT INFO -- #1799096347 Events 20 20 0 0 - - - 0 TrigSignatureMoniMT INFO -- #1799096347 Features 0 0 - - - TrigSignatureMoniMT INFO HLT_tau25_idperf_track_L1TAU12IM #554271976 -TrigSignatureMoniMT INFO -- #554271976 Events 20 20 3 - - - - 0 +TrigSignatureMoniMT INFO -- #554271976 Events 20 20 3 - - - - 3 TrigSignatureMoniMT INFO -- #554271976 Features 4 - - - - TrigSignatureMoniMT INFO HLT_tau25_idperf_tracktwoMVA_L1TAU12IM #988149859 TrigSignatureMoniMT INFO -- #988149859 Events 20 20 3 3 - - - 3 TrigSignatureMoniMT INFO -- #988149859 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_idperf_tracktwo_L1TAU12IM #3346942453 -TrigSignatureMoniMT INFO -- #3346942453 Events 20 20 3 3 - - - 0 +TrigSignatureMoniMT INFO -- #3346942453 Events 20 20 3 3 - - - 3 TrigSignatureMoniMT INFO -- #3346942453 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_looseRNN_tracktwoMVA_L1TAU12IM #169452969 TrigSignatureMoniMT INFO -- #169452969 Events 20 20 3 3 - - - 3 @@ -374,16 +371,16 @@ TrigSignatureMoniMT INFO HLT_tau25_looseRNN_trac TrigSignatureMoniMT INFO -- #2490017573 Events 20 20 3 3 - - - 0 TrigSignatureMoniMT INFO -- #2490017573 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwoEF_L1TAU12IM #506456080 -TrigSignatureMoniMT INFO -- #506456080 Events 20 20 3 3 - - - 3 +TrigSignatureMoniMT INFO -- #506456080 Events 20 20 3 3 - - - 0 TrigSignatureMoniMT INFO -- #506456080 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwoMVA_L1TAU12IM #4055280067 -TrigSignatureMoniMT INFO -- #4055280067 Events 20 20 3 3 - - - 3 +TrigSignatureMoniMT INFO -- #4055280067 Events 20 20 3 3 - - - 0 TrigSignatureMoniMT INFO -- #4055280067 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwo_L1TAU12IM #1433975745 -TrigSignatureMoniMT INFO -- #1433975745 Events 20 20 3 3 - - - 0 +TrigSignatureMoniMT INFO -- #1433975745 Events 20 20 3 3 - - - 1 TrigSignatureMoniMT INFO -- #1433975745 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM #2222894847 -TrigSignatureMoniMT INFO -- #2222894847 Events 20 20 3 3 - - - 3 +TrigSignatureMoniMT INFO -- #2222894847 Events 20 20 3 3 - - - 1 TrigSignatureMoniMT INFO -- #2222894847 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwo_L1TAU12IM #698603885 TrigSignatureMoniMT INFO -- #698603885 Events 20 20 3 3 - - - 0 @@ -392,10 +389,10 @@ TrigSignatureMoniMT INFO HLT_tau25_perf_tracktwo TrigSignatureMoniMT INFO -- #112814536 Events 20 20 3 3 - - - 3 TrigSignatureMoniMT INFO -- #112814536 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_perf_tracktwo_L1TAU12IM #1129072492 -TrigSignatureMoniMT INFO -- #1129072492 Events 20 20 3 3 - - - 0 +TrigSignatureMoniMT INFO -- #1129072492 Events 20 20 3 3 - - - 3 TrigSignatureMoniMT INFO -- #1129072492 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_tightRNN_tracktwoMVA_L1TAU12IM #2472860683 -TrigSignatureMoniMT INFO -- #2472860683 Events 20 20 3 3 - - - 3 +TrigSignatureMoniMT INFO -- #2472860683 Events 20 20 3 3 - - - 1 TrigSignatureMoniMT INFO -- #2472860683 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_tightRNN_tracktwo_L1TAU12IM #2537544560 TrigSignatureMoniMT INFO -- #2537544560 Events 20 20 3 3 - - - 0 @@ -407,7 +404,7 @@ TrigSignatureMoniMT INFO HLT_tau25_verylooseRNN_ TrigSignatureMoniMT INFO -- #1275052132 Events 20 20 3 3 - - - 0 TrigSignatureMoniMT INFO -- #1275052132 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_tau35_mediumRNN_tracktwoMVA_L1TAU12IM #2456480859 -TrigSignatureMoniMT INFO -- #2456480859 Events 20 20 3 3 - - - 3 +TrigSignatureMoniMT INFO -- #2456480859 Events 20 20 3 3 - - - 1 TrigSignatureMoniMT INFO -- #2456480859 Features 4 3 - - - TrigSignatureMoniMT INFO HLT_xe100_mht_L1XE50 #532175988 TrigSignatureMoniMT INFO -- #532175988 Events 20 20 2 - - - - 2 diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_MT_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_MT_build.py index 0feb6229726bc88e103ee782598065f9533706d9..7aaeba65e3b4b9d852656b9edb14c8928ba48803 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_MT_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_MT_build.py @@ -28,7 +28,7 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) -# Add a step comparing counts in the log against reference +# Add a step comparing counts in the log against reference from test_trig_data_v1Dev_build refcomp = CheckSteps.RegTestStep("CountRefComp") refcomp.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' refcomp.reference = 'TriggerTest/ref_data_v1Dev_build.ref' diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_deps_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_deps_build.py new file mode 100755 index 0000000000000000000000000000000000000000..14336b4b97fe47847f28fcec75321e1f8f7b78ca --- /dev/null +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_deps_build.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# art-description: Test with SGInputLoader.FailIfNoProxy=True to check for unmet data dependencies +# art-type: build +# art-include: master/Athena +# Skipping art-output which has no effect for build tests. +# If you create a grid version, check art-output in existing grid tests. + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps + +ex = ExecStep.ExecStep() +ex.type = 'athena' +ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' +ex.input = 'data' +ex.threads = 1 +precommand = ''.join([ + "setMenu='LS2_v1';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 + "doWriteBS=False;", + "doWriteRDOTrigger=True;", + "forceEnableAllChains=True;", + "fpeAuditor=True;", + "failIfNoProxy=True;" +]) +ex.args = '-c "{:s}"'.format(precommand) + +test = Test.Test() +test.art_type = 'build' +test.exec_steps = [ex] +test.check_steps = CheckSteps.default_check_steps(test) + +# Add a step comparing counts in the log against reference from test_trig_data_v1Dev_build +refcomp = CheckSteps.RegTestStep("CountRefComp") +refcomp.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' +refcomp.reference = 'TriggerTest/ref_data_v1Dev_build.ref' +refcomp.required = True # Final exit code depends on this step +CheckSteps.add_step_after_type(test.check_steps, CheckSteps.LogMergeStep, refcomp) + +import sys +sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_emptyMenu_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_emptyMenu_build.py new file mode 100755 index 0000000000000000000000000000000000000000..e45d152c1f8371729e7ad08bba6d480aaaaec268 --- /dev/null +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_emptyMenu_build.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +# art-description: Trigger BS->RDO_TRIG athena test without any HLT chains +# art-type: build +# art-include: master/Athena +# Skipping art-output which has no effect for build tests. +# If you create a grid version, check art-output in existing grid tests. + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps + +ex = ExecStep.ExecStep() +ex.type = 'athena' +ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' +ex.input = 'data' +ex.max_events = 80 +ex.threads = 4 +ex.concurrent_events = 4 +precommand = ''.join([ + "setMenu='LS2_v1';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 + "doEmptyMenu=True;", + "doWriteBS=False;", + "doWriteRDOTrigger=True;", + "forceEnableAllChains=True;", + "fpeAuditor=True;", + "failIfNoProxy=True;" +]) +ex.args = '-c "{:s}"'.format(precommand) + +test = Test.Test() +test.art_type = 'build' +test.exec_steps = [ex] +test.check_steps = CheckSteps.default_check_steps(test) + +# Skip ZeroCounts check because empty menu has no counts +test.check_steps.remove(test.get_step("ZeroCounts")) + +# Overwrite default MessageCount settings +msgcount = test.get_step("MessageCount") +msgcount.info_threshold = 600 +msgcount.other_threshold = 50 +msgcount.required = True # make the test exit code depend on this step + +import sys +sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_reverseViews_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_reverseViews_build.py new file mode 100755 index 0000000000000000000000000000000000000000..107fea469e8f6b189de45c63abff0f895b3ddc36 --- /dev/null +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_reverseViews_build.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# art-description: Test with reversed order of views to check their independence +# art-type: build +# art-include: master/Athena +# Skipping art-output which has no effect for build tests. +# If you create a grid version, check art-output in existing grid tests. + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps + +ex = ExecStep.ExecStep() +ex.type = 'athena' +ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' +ex.input = 'data' +ex.threads = 1 +precommand = ''.join([ + "setMenu='LS2_v1';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 + "doWriteBS=False;", + "doWriteRDOTrigger=True;", + "forceEnableAllChains=True;", + "fpeAuditor=True;", + "reverseViews=True;" +]) +ex.args = '-c "{:s}"'.format(precommand) + +test = Test.Test() +test.art_type = 'build' +test.exec_steps = [ex] +test.check_steps = CheckSteps.default_check_steps(test) + +# Add a step comparing counts in the log against reference from test_trig_data_v1Dev_build +refcomp = CheckSteps.RegTestStep("CountRefComp") +refcomp.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' +refcomp.reference = 'TriggerTest/ref_data_v1Dev_build.ref' +refcomp.required = True # Final exit code depends on this step +CheckSteps.add_step_after_type(test.check_steps, CheckSteps.LogMergeStep, refcomp) + +import sys +sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_deps_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_emptyMenu_build.py similarity index 60% rename from Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_deps_build.py rename to Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_emptyMenu_build.py index ad2580bde1983773dcd636b6b7209998dfe60c1d..f06b8ae5336d2395ee431dea4f1f07a7a47dc96b 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_full_menu_deps_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_emptyMenu_build.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# art-description: Test with SGInputLoader.FailIfNoProxy=True to check for unmet data dependencies +# art-description: Trigger RDO->RDO_TRIG athena test with L1 simulation but without any HLT chains # art-type: build # art-include: master/Athena # Skipping art-output which has no effect for build tests. @@ -11,13 +11,17 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps ex = ExecStep.ExecStep() ex.type = 'athena' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' -ex.input = 'data' -ex.args = '-c "isOnline=True;doWriteBS=False;doWriteRDOTrigger=True;failIfNoProxy=True;"' +ex.input = 'ttbar' +ex.threads = 1 +ex.args = '-c "setMenu=\'LS2_v1\';doL1Sim=True;doEmptyMenu=True;doWriteBS=False;doWriteRDOTrigger=True;"' test = Test.Test() test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Skip ZeroCounts check because empty menu has no counts +test.check_steps.remove(test.get_step("ZeroCounts")) + import sys sys.exit(test.run()) diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index 3960ee15d542c6e8c7fc9b5013e3f7901eacbba8..37474cdddcef8d6e45a69ace7df8ceb247a005ff 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -14,7 +14,7 @@ from AthenaCommon.Logging import logging __log = logging.getLogger('TriggerEDMRun3Config') -import DataScoutingInfo +from TrigEDMConfig import DataScoutingInfo def recordable( name ): """ @@ -127,13 +127,13 @@ TriggerHLTListRun3 = [ # These are for precision photon and precision Electron Keeping same names as in Run2 ('xAOD::ElectronContainer#HLT_egamma_Electrons', 'BS ESD AODFULL', 'Egamma', 'inViews:precisionElectronViews'), - ('xAOD::ElectronTrigAuxContainer#HLT_egamma_ElectronsAux.', 'BS ESD AODFULL', 'Egamma'), + ('xAOD::ElectronAuxContainer#HLT_egamma_ElectronsAux.', 'BS ESD AODFULL', 'Egamma'), # enable when iso chains are present # ('xAOD::ElectronContainer#HLT_egamma_Iso_Electrons', 'BS ESD AODFULL', 'Egamma', 'inViews:precisionIsoElectronViews'), # ('xAOD::ElectronTrigAuxContainer#HLT_egamma_Iso_ElectronsAux.', 'BS ESD AODFULL', 'Egamma'), ('xAOD::PhotonContainer#HLT_egamma_Photons', 'BS ESD AODFULL', 'Egamma', 'inViews:precisionPhotonViews'), - ('xAOD::PhotonTrigAuxContainer#HLT_egamma_PhotonsAux.', 'BS ESD AODFULL', 'Egamma'), + ('xAOD::PhotonAuxContainer#HLT_egamma_PhotonsAux.', 'BS ESD AODFULL', 'Egamma'), # enable when iso chains are present # ('xAOD::PhotonContainer#HLT_egamma_Iso_Photons', 'BS ESD AODFULL', 'Egamma', 'inViews:precisionIsoPhotonViews'), # ('xAOD::PhotonTrigAuxContainer#HLT_egamma_Iso_PhotonsAux.', 'BS ESD AODFULL', 'Egamma'), diff --git a/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py b/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py index 2d9ef843697fbca1ac39ce9e819d4c48ef16b3b3..e51bb3d334c5a565c4dc38bafac6c57d6a342cc9 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py @@ -234,6 +234,7 @@ def setupMenu(): # ATR-21242 - with L1 in the name, for validation with MT ['xe65_xe110_pufit_L1XE50', 'L1_XE50',[], [PhysicsStream], ['RATE:MET', 'BW:MET'], -1], + ['xe110_tcpufit_L1XE50', 'L1_XE50',[], [PhysicsStream], ['RATE:MET', 'BW:MET'], -1], ] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py index f5451678be46d1f80e44ed2e9bf58b55b50b5c40..90c6273efef14aa1a746eba5946b71093a2be9e4 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py @@ -37,7 +37,7 @@ def bJetStep1Sequence(): InputMakerAlg.Views = "FullScanBjetView" InputMakerAlg.InViewRoIs = "FullScanRoI" InputMakerAlg.ViewFallThrough = True - + InputMakerAlg.mergeUsingFeature = True outputJetName = "HLT_GSCJet" outputRoIName = "HLT_GSCJet_RoIs" diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py index aba42d585d80e96fd6923017649dd037e64466e3..c5fb21c3145c73a07709c150124132c1c6853b61 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py @@ -64,7 +64,7 @@ def precisionElectronRecoSequence(RoIs): electronPrecisionTrack += ViewVerifyPrecisionCluster """ Retrieve the factories now """ - from TriggerMenuMT.HLTMenuConfig.Electron.TrigElectronFactories import TrigEgammaRecElectron, TrigElectronSuperClusterBuilder, TrigTopoEgammaElectron + from TriggerMenuMT.HLTMenuConfig.Electron.TrigElectronFactories import TrigEgammaRecElectron, TrigElectronSuperClusterBuilder, TrigTopoEgammaElectronCfg from TriggerMenuMT.HLTMenuConfig.Egamma.TrigEgammaFactories import TrigEMTrackMatchBuilder @@ -86,7 +86,7 @@ def precisionElectronRecoSequence(RoIs): trigElectronAlgo.InputEgammaRecContainerName = TrigEgammaAlgo.egammaRecContainer thesequence += trigElectronAlgo - trigTopoEgammaAlgo = TrigTopoEgammaElectron() + trigTopoEgammaAlgo = TrigTopoEgammaElectronCfg() trigTopoEgammaAlgo.SuperElectronRecCollectionName = trigElectronAlgo.SuperElectronRecCollectionName collectionOut = trigTopoEgammaAlgo.ElectronOutputName thesequence += trigTopoEgammaAlgo diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/TrigElectronFactories.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/TrigElectronFactories.py index f8ea466a3db5ea7e8284762807d2e511c7f9d1ed..4dbfeb3ae47b69f36925a88384d4aaf2d8110707 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/TrigElectronFactories.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/TrigElectronFactories.py @@ -1,4 +1,5 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from AthenaCommon.Logging import logging __doc__ = "ToolFactories to configure egammaAlgs to be used at the HLT" @@ -45,18 +46,29 @@ TrigElectronSuperClusterBuilder = AlgFactory( egammaAlgsConf.electronSuperCluste ) -TrigTopoEgammaElectron = AlgFactory( egammaAlgsConf.topoEgammaBuilder, name = 'TrigTopoEgammaElectron', - SuperElectronRecCollectionName = TrigEgammaKeys.SuperElectronRecCollectionName, - SuperPhotonRecCollectionName = TrigEgammaKeys.SuperPhotonRecCollectionName, - ElectronOutputName = TrigEgammaKeys.outputElectronKey, - PhotonOutputName = TrigEgammaKeys.outputPhotonKey, - AmbiguityTool = EGammaAmbiguityTool, - EMClusterTool = TrigEMClusterTool, - EMShowerTool=TrigEMShowerBuilder, - egammaTools = FcnWrapper(TrigEgammaDecorationTools), - doAdd = False, - doPhotons = False, - doElectrons = True - ) +def TrigTopoEgammaElectronCfg(name='topoEgammaBuilder_TrigElectrons'): + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram + monTool = GenericMonitoringTool("MonTool_topoEgammaBuilder") + monTool.Histograms = [ defineHistogram('EldeltaEta',type='TH1F', title='#Delta#eta', path='EXPERT',xbins=80, xmin=-0.01,xmax=0.01), + defineHistogram('EldeltaPhi',type='TH1F', title='#Delta#phi', path='EXPERT',xbins=80, xmin=-0.01, xmax=0.01), + defineHistogram('EleT', type='TH1F', title='p#_{T} [GeV]', path='EXPERT',xbins=80, xmin=0., xmax=100)] + + mlog = logging.getLogger("TrigElectronFactories") + mlog.info('Starting configuration') + TrigTopoEgammaElectron = AlgFactory( egammaAlgsConf.topoEgammaBuilder, name = name, + SuperElectronRecCollectionName = TrigEgammaKeys.SuperElectronRecCollectionName, + SuperPhotonRecCollectionName = TrigEgammaKeys.SuperPhotonRecCollectionName, + ElectronOutputName = TrigEgammaKeys.outputElectronKey, + PhotonOutputName = TrigEgammaKeys.outputPhotonKey, + AmbiguityTool = EGammaAmbiguityTool, + EMClusterTool = TrigEMClusterTool, + EMShowerTool=TrigEMShowerBuilder, + egammaTools = FcnWrapper(TrigEgammaDecorationTools), + doAdd = False, + doPhotons = False, + doElectrons = True, + #MonTool = monTool + ) + return TrigTopoEgammaElectron() diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py index eb3926583aa798b1effbba96282d8f4dcf830afa..6f5af91dd3a44295d53f2d6acac1baaf93571ad3 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py @@ -85,7 +85,8 @@ def generateDecisionTree(chains): if filterAlg: filterAlg.Input += filter_input else: - filterAlg = CompFactory.RoRSeqFilter(filterName, Input=filter_input ) + filter_output = [ CFNaming.filterOutName(filterName, i) for i in filter_input ] + filterAlg = CompFactory.RoRSeqFilter(filterName, Input=filter_input, Output=filter_output ) filterAcc.addEventAlgo(filterAlg, sequenceName = stepFilterNodeName) stepReco, stepView = createStepView(chainStep.name) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py index 53ed8426a08d4bf1caf2c440d7a60f0c2a6ecda1..5d401ba88d776ba24452468d2c857f0f49134f61 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py @@ -153,7 +153,7 @@ def setupMenu(): ChainProp(name='HLT_j45_sktc_nojcalib_L1J20', groups=SingleJetGroup), ChainProp(name='HLT_j45_cssktc_nojcalib_L1J20', groups=SingleJetGroup), ChainProp(name='HLT_j45_ftf_pf_nojcalib_L1J20', groups=SingleJetGroup), - ChainProp(name='HLT_j45_ftf_csskpf_nojcalib_L1J20', groups=SingleJetGroup), +# ChainProp(name='HLT_j45_ftf_csskpf_nojcalib_L1J20', groups=SingleJetGroup), ChainProp(name='HLT_j260_320eta490_L1J20', groups=SingleJetGroup), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/scripts/test_HLTmenu.sh b/Trigger/TriggerCommon/TriggerMenuMT/scripts/test_HLTmenu.sh index ced0dad7569c12915d7f9b32e67ee6c144dc111f..01027534d8b4046f4b6c29d9ea84df6ee43d0ebf 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/scripts/test_HLTmenu.sh +++ b/Trigger/TriggerCommon/TriggerMenuMT/scripts/test_HLTmenu.sh @@ -1,5 +1,6 @@ #!/usr/bin/env sh +set -e athena --threads=1 --skipEvents=10 --evtMax=20 --filesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1" TriggerMenuMT/generateMT.py; diff --git a/graphics/VP1/VP1Systems/VP1MCSystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1MCSystems/CMakeLists.txt index faf9e3cf09e5a04b45c42c1cfadddb0b9995ae3d..645c04e21f8a826ab39a3099edfe18208cd2104b 100644 --- a/graphics/VP1/VP1Systems/VP1MCSystems/CMakeLists.txt +++ b/graphics/VP1/VP1Systems/VP1MCSystems/CMakeLists.txt @@ -12,12 +12,12 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaKernel Control/StoreGate GaudiKernel + Generators/AtlasHepMC Generators/GeneratorObjects graphics/VP1/VP1Utils ) # External dependencies: find_package( CLHEP ) -find_package( HepMC ) find_package( HepPDT ) # Generate UI files automatically: @@ -33,8 +33,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # Component(s) in the package: atlas_add_library( VP1MCSystems VP1MCSystems/*.h src/*.h src/*.cxx src/*.qrc PUBLIC_HEADERS VP1MCSystems - PRIVATE_INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES VP1Base StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaKernel GaudiKernel GeneratorObjects VP1Utils ) + PRIVATE_LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaKernel GaudiKernel GeneratorObjects VP1Utils ) diff --git a/graphics/VP1/VP1Systems/VP1MCSystems/src/VP1MCSystem.cxx b/graphics/VP1/VP1Systems/VP1MCSystems/src/VP1MCSystem.cxx index 485516780a35c69c4f080320028658f7aeb9e529..ee86f8c1fab17bbd6ba84a1cbc1570471a613f47 100755 --- a/graphics/VP1/VP1Systems/VP1MCSystems/src/VP1MCSystem.cxx +++ b/graphics/VP1/VP1Systems/VP1MCSystems/src/VP1MCSystem.cxx @@ -18,8 +18,8 @@ #include <QTreeWidget> #include <QTreeWidgetItem> -#include "HepMC/GenVertex.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" #include "CLHEP/Vector/ThreeVector.h" #include "StoreGate/DataHandle.h" #include "GeneratorObjects/McEventCollection.h" diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1TrackSystems/CMakeLists.txt index d7dd67ae84d71ef2a373bce6b1883bd9cfbe0bb8..ac160920e0204f5fc0d48855438be80c607ec2a6 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/CMakeLists.txt +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/CMakeLists.txt @@ -60,12 +60,13 @@ atlas_depends_on_subdirs( Tracking/TrkFitter/TrkFitterInterfaces graphics/VP1/VP1HEPVis graphics/VP1/VP1Systems/VP1GuideLineSystems - graphics/VP1/VP1Systems/VP1PRDSystems ) + graphics/VP1/VP1Systems/VP1PRDSystems + Generators/AtlasHepMC + ) # External dependencies: find_package( CLHEP ) find_package( Coin3D ) -find_package( HepMC ) find_package( Qt5 COMPONENTS Core Gui Widgets ) find_package( GeoModelCore ) @@ -79,13 +80,13 @@ set( CMAKE_AUTOMOC TRUE ) atlas_add_library( VP1TrackSystems VP1TrackSystems/*.h src/*.cxx PUBLIC_HEADERS VP1TrackSystems PRIVATE_INCLUDE_DIRS ${COIN3D_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - ${HEPMC_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} GeoPrimitives Identifier xAODTracking GaudiKernel GeneratorObjects TrkDetDescrInterfaces TrkSurfaces TrkEventPrimitives TrkParameters VP1Base VP1Utils StoreGateLib SGtests MuonIdHelpersLib MuonRecHelperToolsLib Qt5::Core Qt5::Gui PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${CLHEP_LIBRARIES} - ${HEPMC_LIBRARIES} AthContainers AtlasDetDescr EventPrimitives + AtlasHepMCLib AthContainers AtlasDetDescr EventPrimitives ForwardRegion_SimEv InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack InDetSimEvent MuonReadoutGeometry MuonChamberT0s MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonSimEvent Particle diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/AscObj_TruthPoint.h b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/AscObj_TruthPoint.h index d8dd64db021c112e366926a781dd95284e028a4e..c18c7be39ab4dc00bc6f296b97e8499dbd191031 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/AscObj_TruthPoint.h +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/AscObj_TruthPoint.h @@ -20,7 +20,8 @@ #include "VP1TrackSystems/AssociatedObjectHandleBase.h" -namespace HepMC { class GenVertex; class GenParticle; } +#include "AtlasHepMC/GenParticle_fwd.h" +#include "AtlasHepMC/GenVertex_fwd.h" class SimHitHandleBase; class AscObj_TruthPoint : public AssociatedObjectHandleBase { diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/TrackHandle_TruthTrack.h b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/TrackHandle_TruthTrack.h index 8e1dd05154bf61c5ce8c8d1078c8d4ed23f9906a..7a9108728c65f001e2ddf07437186678ab2b6427 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/TrackHandle_TruthTrack.h +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/TrackHandle_TruthTrack.h @@ -23,7 +23,7 @@ #include "GeoPrimitives/GeoPrimitives.h" -namespace HepMC { class GenParticle; } +#include "AtlasHepMC/GenParticle_fwd.h" class TrackHandle_TruthTrack : public TrackHandleBase { public: diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/AscObj_TruthPoint.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/AscObj_TruthPoint.cxx index 012211733f0b5484592349a0dfa7f3a83868a1fd..9372689c3f0e830631a87c6b71c1c861fe5f06e6 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/AscObj_TruthPoint.cxx +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/AscObj_TruthPoint.cxx @@ -15,8 +15,8 @@ #include "VP1TrackSystems/AscObj_TruthPoint.h" #include "VP1TrackSystems/SimHitHandleBase.h" #include "VP1Base/VP1Msg.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" // Eigen migration //#include "TrkEventPrimitives/GlobalPosition.h" diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_SimulationTracks.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_SimulationTracks.cxx index 138c49e52df1eda46e0371fddea808cfe46b4c46..6aa0e7b9ffafc9c826cd46d9e93ad53da9a4737c 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_SimulationTracks.cxx +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_SimulationTracks.cxx @@ -23,9 +23,9 @@ #include "VP1Utils/VP1JobConfigInfo.h" #include "VP1Utils/VP1ParticleData.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/McEventCollection.h" #include "TrackRecord/TrackRecordCollection.h" diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TruthTracks.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TruthTracks.cxx index c55c287f5a97c29bbfb1fd521d8fb1bac1b82226..da876623a4f351bf0387c13c7381c73b604f397f 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TruthTracks.cxx +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TruthTracks.cxx @@ -25,9 +25,9 @@ #include "VP1Utils/VP1JobConfigInfo.h" #include "VP1Utils/VP1ParticleData.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "GeneratorObjects/McEventCollection.h" #include "TrackRecord/TrackRecordCollection.h" diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_FatrasTruthTrack.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_FatrasTruthTrack.cxx index b4bf7493dd8ff30c4d7c60b89d77273599c04380..82c1079516030fb2b31be87e5871592bcd3d36a1 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_FatrasTruthTrack.cxx +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_FatrasTruthTrack.cxx @@ -15,7 +15,7 @@ // #include "VP1TrackSystems/TrackHandle_FatrasTruthTrack.h" // #include "FatrasEvent/TrackParticleState.h" // #include "FatrasEvent/TruthAssociation.h" -// #include "HepMC/GenParticle.h" +// #include "AtlasHepMC/GenParticle.h" // // //____________________________________________________________________ // class TrackHandle_FatrasTruthTrack::Imp { diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_SimulationTrack.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_SimulationTrack.cxx index 3ab9d2d76e24ffdf891e4fc83ba5d8691e1166f0..9569c6286af869d01032b2c95ba0d4d1b63ec61e 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_SimulationTrack.cxx +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_SimulationTrack.cxx @@ -17,14 +17,14 @@ #include "VP1Base/VP1Msg.h" #include "TrkTrack/Track.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Vector/LorentzVector.h" #include "TrkTrack/Track.h" #include "AthContainers/DataVector.h" #include "TrkParameters/TrackParameters.h" #include "TrkSurfaces/PlaneSurface.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" //____________________________________________________________________ class TrackHandle_SimulationTrack::Imp { diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TruthTrack.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TruthTrack.cxx index 4376dc3d7eb489a46fb652fdee8cbed5bcb49e6b..361191f6e9cd36d323882a9fdece265ac58a4355 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TruthTrack.cxx +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TruthTrack.cxx @@ -17,14 +17,14 @@ #include "VP1Base/VP1Msg.h" #include "TrkTrack/Track.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/GenVertex.h" #include "CLHEP/Vector/LorentzVector.h" #include "TrkTrack/Track.h" #include "AthContainers/DataVector.h" #include "TrkParameters/TrackParameters.h" #include "TrkSurfaces/PlaneSurface.h" -#include "HepMC/GenParticle.h" +#include "AtlasHepMC/GenParticle.h" //____________________________________________________________________ class TrackHandle_TruthTrack::Imp { diff --git a/graphics/VP1/VP1Systems/VP1VertexSystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1VertexSystems/CMakeLists.txt index a56ba86f3543428c61003c2f278fbae1125f1f98..3410988d2512d0a8408447552259266042f0a28a 100644 --- a/graphics/VP1/VP1Systems/VP1VertexSystems/CMakeLists.txt +++ b/graphics/VP1/VP1Systems/VP1VertexSystems/CMakeLists.txt @@ -12,6 +12,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/GeoPrimitives GaudiKernel Generators/GeneratorObjects + Generators/AtlasHepMC Tracking/TrkEvent/TrkParticleBase Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTrackLink @@ -21,7 +22,6 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( Coin3D ) find_package( Eigen ) -find_package( HepMC ) find_package( Qt5 COMPONENTS Core Gui Widgets ) # Generate UI files automatically: @@ -38,7 +38,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # Component(s) in the package: atlas_add_library( VP1VertexSystems VP1VertexSystems/*.h src/*.h src/*.cxx src/*.qrc PUBLIC_HEADERS VP1VertexSystems - PRIVATE_INCLUDE_DIRS ${COIN3D_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${COIN3D_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES VP1Base GL Qt5::Core Qt5::Gui - PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} GeoPrimitives GaudiKernel GeneratorObjects TrkParticleBase TrkTrack VxVertex VP1Utils ) + PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${EIGEN_LIBRARIES} AtlasHepMCLib GeoPrimitives GaudiKernel GeneratorObjects TrkParticleBase TrkTrack VxVertex VP1Utils ) diff --git a/graphics/VP1/VP1Systems/VP1VertexSystems/src/VP1TruthVertexCollection.cxx b/graphics/VP1/VP1Systems/VP1VertexSystems/src/VP1TruthVertexCollection.cxx index 6ee2deebf20b96d6f2c5b60fa0ab49ad4251259f..48f567607eee058a7c609f04ce3692a1bb2f5842 100644 --- a/graphics/VP1/VP1Systems/VP1VertexSystems/src/VP1TruthVertexCollection.cxx +++ b/graphics/VP1/VP1Systems/VP1VertexSystems/src/VP1TruthVertexCollection.cxx @@ -31,8 +31,8 @@ #include <QStringList> #include "GeneratorObjects/McEventCollection.h" -#include "HepMC/GenEvent.h" -#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" //#include "CLHEP/Units/SystemOfUnits.h" #include "GaudiKernel/SystemOfUnits.h"