diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py index 032ada00886b84a84aa1ec9656ab4b81d48a8186..27788af6515d03301ed50100a593089d667d5929 100644 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py +++ b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py @@ -1302,8 +1302,7 @@ if ( rec.doAOD() or rec.doWriteAOD()) and not rec.readAOD() : StreamName = 'StreamAOD', Cells = 'AllCalo', CellLinks = 'CaloCalTopoClusters_links', - Taus = "TauJets", - UseSubtractedCluster = tauFlags.useSubtractedCluster()) + Taus = "TauJets") topSequence += tauCellAlg3 except Exception: diff --git a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py index 0813b0abb0204113bb691ab6954d13e8f618347c..a9e7f9e57f96696c5270f38d4c31980d8d7dfe30 100644 --- a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py +++ b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py @@ -115,11 +115,9 @@ def getCellVariables(cellConeSize=0.2, prefix=''): from tauRecTools.tauRecToolsConf import TauCellVariables TauCellVariables = TauCellVariables(name = _name, - CellEthreshold = 0.2*GeV, StripEthreshold = 0.2*GeV, CellCone = cellConeSize, - VertexCorrection = True, - UseSubtractedCluster = tauFlags.useSubtractedCluster() ) + VertexCorrection = True) cached_instances[_name] = TauCellVariables return TauCellVariables @@ -318,8 +316,7 @@ def getElectronVetoVars(): TauElectronVetoVariables = TauElectronVetoVariables(name = _name, VertexCorrection = True, ParticleCaloExtensionTool = getParticleCaloExtensionTool(), - tauEVParticleCache = getParticleCache(), - UseSubtractedCluster = tauFlags.useSubtractedCluster() ) + tauEVParticleCache = getParticleCache()) cached_instances[_name] = TauElectronVetoVariables return TauElectronVetoVariables @@ -376,10 +373,7 @@ def getPi0ClusterCreator(): return cached_instances[_name] from tauRecTools.tauRecToolsConf import TauPi0ClusterCreator - TauPi0ClusterCreator = TauPi0ClusterCreator(name = _name, - TauVertexCorrection = getTauVertexCorrection(), - UseSubtractedCluster = tauFlags.useSubtractedCluster() - ) + TauPi0ClusterCreator = TauPi0ClusterCreator(name = _name) cached_instances[_name] = TauPi0ClusterCreator return TauPi0ClusterCreator @@ -693,8 +687,7 @@ def getMvaTESVariableDecorator(): from tauRecTools.tauRecToolsConf import MvaTESVariableDecorator MvaTESVariableDecorator = MvaTESVariableDecorator(name = _name, Key_vertexInputContainer=_DefaultVertexContainer, - TauVertexCorrection = getTauVertexCorrection(), - UseSubtractedCluster = tauFlags.useSubtractedCluster() ) + VertexCorrection = True) cached_instances[_name] = MvaTESVariableDecorator return MvaTESVariableDecorator @@ -902,13 +895,13 @@ def getTauJetRNNEvaluator(_n, NetworkFile0P="", NetworkFile1P="", NetworkFile3P= MaxTracks=MaxTracks, MaxClusters=MaxClusters, MaxClusterDR=MaxClusterDR, + VertexCorrection=True, InputLayerScalar=InputLayerScalar, InputLayerTracks=InputLayerTracks, InputLayerClusters=InputLayerClusters, OutputLayer=OutputLayer, - OutputNode=OutputNode, - TauVertexCorrection = getTauVertexCorrection(), - UseSubtractedCluster = tauFlags.useSubtractedCluster() ) + OutputNode=OutputNode) + cached_instances[_name] = myTauJetRNNEvaluator return myTauJetRNNEvaluator @@ -931,8 +924,7 @@ def getTauIDVarCalculator(): from tauRecTools.tauRecToolsConf import TauIDVarCalculator myTauIDVarCalculator = TauIDVarCalculator(name=_name, - UseSubtractedCluster = tauFlags.useSubtractedCluster(), - TauVertexCorrection = getTauVertexCorrection()) + VertexCorrection = True) cached_instances[_name] = myTauIDVarCalculator return myTauIDVarCalculator @@ -952,13 +944,12 @@ def getTauEleRNNEvaluator(_n, MaxTracks=MaxTracks, MaxClusters=MaxClusters, MaxClusterDR=MaxClusterDR, + VertexCorrection=True, InputLayerScalar=InputLayerScalar, InputLayerTracks=InputLayerTracks, InputLayerClusters=InputLayerClusters, OutputLayer=OutputLayer, - OutputNode=OutputNode, - TauVertexCorrection = getTauVertexCorrection(), - UseSubtractedCluster = tauFlags.useSubtractedCluster()) + OutputNode=OutputNode) cached_instances[_name] = tool return tool @@ -999,30 +990,6 @@ def getTauDecayModeNNClassifier(): cached_instances[_name] = TauDecayModeNNClassifier return TauDecayModeNNClassifier -def getTauVertexCorrection(): - from tauRec.tauRecFlags import tauFlags - from tauRecTools.tauRecToolsConf import TauVertexCorrection - from JetRec.JetRecFlags import jetFlags - - _name = sPrefix + 'TauVertexCorrection' - - if _name in cached_instances: - return cached_instances[_name] - - doJetVertexCorrection = False - if tauFlags.isStandalone: - doJetVertexCorrection = True - if jetFlags.useVertices() and jetFlags.useTracks(): - doJetVertexCorrection = True - - myTauVertexCorrection = TauVertexCorrection(name = _name, - SeedJet = tauFlags.tauRecSeedJetCollection(), - VertexCorrection = True, - JetVertexCorrection = doJetVertexCorrection) - - cached_instances[_name] = myTauVertexCorrection - return myTauVertexCorrection - def getTauVertexedClusterDecorator(): from tauRec.tauRecFlags import tauFlags from tauRecTools.tauRecToolsConf import TauVertexedClusterDecorator diff --git a/Reconstruction/tauRec/python/tauRecFlags.py b/Reconstruction/tauRec/python/tauRecFlags.py index 1fbaaee61353cb495e6211de70be28dd3ef9230f..72490b28b994d73115b487d48c9a180be97c6d08 100644 --- a/Reconstruction/tauRec/python/tauRecFlags.py +++ b/Reconstruction/tauRec/python/tauRecFlags.py @@ -221,13 +221,6 @@ class useOldVertexFitterAPI(JobProperty): allowedTypes=['bool'] StoredValue=False -class useSubtractedCluster(JobProperty): - """ switch on use of shower subtracted clusters - """ - statusOn=True - allowedTypes=['bool'] - StoredValue=False - # Defines a sub-container for the algorithm switches class tauRecFlags(JobPropertyContainer): """ tau information """ @@ -236,7 +229,7 @@ class tauRecFlags(JobPropertyContainer): jobproperties.add_Container(tauRecFlags) # I want always the following flags in the Rec container -_list_tau=[Enabled,doTauRec,isStandalone,tauRecSeedJetCollection,tauRecToolsCVMFSPath,doTJVA,useLargeD0Tracks,removeDuplicateCoreTracks,tauRecMVATrackClassification,tauRecRNNTrackClassification,tauRecMVATrackClassificationConfig,tauRecRNNTrackClassificationConfig,tauRecDecayModeNNClassifierConfig,tauRecSeedMinPt,tauRecSeedMaxEta,tauRecMaxNTracks,tauRecToolsDevToolList,tauRecToolsDevToolListProcessor,doRunTauDiscriminant,useVertexBasedConvFinder,useNewPIDBasedConvFinder,doPanTau,doPi0,pi0EtCuts,pi0MVACuts_1prong,pi0MVACuts_mprong,shotPtCut_1Photon,shotPtCut_2Photons,useOldVertexFitterAPI,useSubtractedCluster] +_list_tau=[Enabled,doTauRec,isStandalone,tauRecSeedJetCollection,tauRecToolsCVMFSPath,doTJVA,useLargeD0Tracks,removeDuplicateCoreTracks,tauRecMVATrackClassification,tauRecRNNTrackClassification,tauRecMVATrackClassificationConfig,tauRecRNNTrackClassificationConfig,tauRecDecayModeNNClassifierConfig,tauRecSeedMinPt,tauRecSeedMaxEta,tauRecMaxNTracks,tauRecToolsDevToolList,tauRecToolsDevToolListProcessor,doRunTauDiscriminant,useVertexBasedConvFinder,useNewPIDBasedConvFinder,doPanTau,doPi0,pi0EtCuts,pi0MVACuts_1prong,pi0MVACuts_mprong,shotPtCut_1Photon,shotPtCut_2Photons,useOldVertexFitterAPI] for j in _list_tau: jobproperties.tauRecFlags.add_JobProperty(j) del _list_tau diff --git a/Reconstruction/tauRec/src/TauCellThinningAlg.cxx b/Reconstruction/tauRec/src/TauCellThinningAlg.cxx index 83f32876faaf241025e80852706c22035fb90bf5..9f5013dfcd8b592d9239c4cc43b8783f7cdc1099 100644 --- a/Reconstruction/tauRec/src/TauCellThinningAlg.cxx +++ b/Reconstruction/tauRec/src/TauCellThinningAlg.cxx @@ -40,12 +40,22 @@ StatusCode TauCellThinningAlg::execute (const EventContext& ctx) const } for (const xAOD::TauJet* tau : *taus) { - std::vector<const xAOD::CaloCluster*> clusters; - ATH_CHECK( tauRecTools::GetJetClusterList(tau->jet(), clusters, m_useSubtractedCluster) ); + // Assume we always do the vertex correction + TLorentzVector tauAxis = tauRecTools::getTauAxis(*tau); + const xAOD::Vertex* tauVertex = tauRecTools::getTauVertex(*tau); - for (const xAOD::CaloCluster* cluster : clusters) { - // only keep cells for clusters within 0.2 - if (cluster->p4().DeltaR(tau->p4())>0.2) continue; + auto clusterList = tau->clusters(); + for (const xAOD::IParticle* particle : clusterList) { + const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>(particle); + TLorentzVector clusterP4 = cluster->p4(); + + // Correct the four momentum to point at the tau vertex + if (tauVertex) { + xAOD::CaloVertexedTopoCluster vertexedCluster(*cluster, tauVertex->position()); + clusterP4 = vertexedCluster.p4(); + } + + if (clusterP4.DeltaR(tauAxis) > 0.2) continue; const CaloClusterCellLink* cellLinks = cluster->getCellLinks(); if (!cellLinks) { diff --git a/Reconstruction/tauRec/src/TauCellThinningAlg.h b/Reconstruction/tauRec/src/TauCellThinningAlg.h index a202feee001d8b16f6a2e384728c81ed9cd34379..d946b9ba71a3b205a91b9c67219e5b2cc7922fac 100644 --- a/Reconstruction/tauRec/src/TauCellThinningAlg.h +++ b/Reconstruction/tauRec/src/TauCellThinningAlg.h @@ -53,11 +53,6 @@ class TauCellThinningAlg : public AthReentrantAlgorithm // Tau container SG::ReadHandleKey<xAOD::TauJetContainer> m_taus { this, "Taus", "TauJets", "Container of taus for which cells should be saved" }; - - // Use shower subtracted clusters, only relevant for PFlow seed jets - Gaudi::Property<bool> m_useSubtractedCluster - { this, "UseSubtractedCluster", false, "Use shower subtracted clusters" }; - }; #endif // not TAUREC_TAUCELLTHINNING_H diff --git a/Reconstruction/tauRecTools/CMakeLists.txt b/Reconstruction/tauRecTools/CMakeLists.txt index 589a385fb53452093998cc32ae7ad6842e8ad733..ae8f23cedb7fae0703fdc373f37d088e40d313e0 100644 --- a/Reconstruction/tauRecTools/CMakeLists.txt +++ b/Reconstruction/tauRecTools/CMakeLists.txt @@ -26,7 +26,6 @@ atlas_add_root_dictionary( tauRecToolsLib tauRecToolsLibCintDict tauRecTools/TauJetRNNEvaluator.h tauRecTools/TauIDVarCalculator.h tauRecTools/TauDecayModeNNClassifier.h - tauRecTools/TauVertexCorrection.h tauRecTools/TauVertexedClusterDecorator.h Root/LinkDef.h EXTERNAL_PACKAGES ROOT diff --git a/Reconstruction/tauRecTools/Root/HelperFunctions.cxx b/Reconstruction/tauRecTools/Root/HelperFunctions.cxx index 980c6aad09f6cf74ca4cdf15da65288465e04201..1e9088f13b26e5794d8d2ef4cec83b71f6cd6612 100644 --- a/Reconstruction/tauRecTools/Root/HelperFunctions.cxx +++ b/Reconstruction/tauRecTools/Root/HelperFunctions.cxx @@ -216,73 +216,3 @@ TLorentzVector tauRecTools::GetConstituentP4(const xAOD::JetConstituent& constit return constituentP4; } - - - -const StatusCode tauRecTools::GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool useSubtractedCluster) { - 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 constituents = jet->getConstituents(); - for(const xAOD::JetConstituent* constituent : constituents){ - ANA_MSG_DEBUG("JetConstituent: "); - ANA_MSG_DEBUG("eta: " << constituent->eta() << " phi: " << constituent->phi() << " e: " << constituent->e()); - - if( constituent->type() == xAOD::Type::CaloCluster ) { - const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( constituent->rawConstituent() ); - ANA_MSG_DEBUG("CaloCluster: "); - ANA_MSG_DEBUG("eta: " << cluster->eta() << " phi: " << cluster->phi() << " e: " << cluster->e()); - clusterList.push_back(cluster); - } - else if ( constituent->type() == xAOD::Type::ParticleFlow ) { - const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( constituent->rawConstituent() ); - - if (pfo->isCharged()) continue; - if (pfo->nCaloCluster()!=1){ - ANA_MSG_WARNING("Neutral PFO has " << std::to_string(pfo->nCaloCluster()) << " clusters, expected exactly 1!\n"); - continue; - } - - if (useSubtractedCluster){ - ElementLink<xAOD::CaloClusterContainer> subClusLink; - pfo->attribute("PFOShowerSubtractedClusterLink", subClusLink); - if ( !subClusLink.isValid() ){ - ANA_MSG_ERROR("Tau HelperFunctions: Found invalid link to shower subtracted cluster"); - return StatusCode::FAILURE; - } - else { - clusterList.push_back( (*subClusLink) ); - } - } - else { - clusterList.push_back(pfo->cluster(0)); - } - } - else { - ANA_MSG_ERROR("GetJetConstCluster: Seed jet constituent type not supported!"); - return StatusCode::FAILURE; - } - } - - if (useSubtractedCluster) return StatusCode::SUCCESS; - - for (const xAOD::JetConstituent* constituent : constituents){ - if ( constituent->type() != xAOD::Type::ParticleFlow ) break; - - const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( constituent->rawConstituent() ); - if (! pfo->isCharged()) continue; - - for (u_int index=0; index<pfo->nCaloCluster(); index++){ - const xAOD::CaloCluster* cluster = pfo->cluster(index); - // check it is not duplicate of one in neutral list - if ( std::find(clusterList.begin(), clusterList.end(), cluster) == clusterList.end() ) { - clusterList.push_back(cluster); - } - } - } - - return StatusCode::SUCCESS; -} diff --git a/Reconstruction/tauRecTools/Root/LinkDef.h b/Reconstruction/tauRecTools/Root/LinkDef.h index 9078305d94444e124e319b7e8ee198fe06fed84f..2861a22edbf6465acb8115b656cbc1f3d7cd0870 100644 --- a/Reconstruction/tauRecTools/Root/LinkDef.h +++ b/Reconstruction/tauRecTools/Root/LinkDef.h @@ -17,7 +17,6 @@ #include "tauRecTools/TauIDVarCalculator.h" #include "tauRecTools/TauJetRNNEvaluator.h" #include "tauRecTools/TauDecayModeNNClassifier.h" -#include "tauRecTools/TauVertexCorrection.h" #ifdef __CINT__ @@ -43,7 +42,5 @@ #pragma link C++ class TauIDVarCalculator+; #pragma link C++ class TauJetRNNEvaluator+; #pragma link C++ class TauDecayModeNNClassifier+; -#pragma link C++ class ITauVertexCorrection+; -#pragma link C++ class TauVertexCorrection+; #endif diff --git a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx index 169ead2075a75e9036262e953e0d52ba177b707d..25c566020dfe15eebeedf070273ea24493d8e13d 100644 --- a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx @@ -11,27 +11,25 @@ #define GeV 1000 -//_____________________________________________________________________________ + + MvaTESVariableDecorator::MvaTESVariableDecorator(const std::string& name) : TauRecToolBase(name) { - declareProperty("UseSubtractedCluster", m_useSubtractedCluster = true, "use shower subtracted clusters in calo calculations"); + declareProperty("VertexCorrection", m_doVertexCorrection = true); } -//_____________________________________________________________________________ -MvaTESVariableDecorator::~MvaTESVariableDecorator() { -} StatusCode MvaTESVariableDecorator::initialize() { - ATH_CHECK(m_tauVertexCorrection.retrieve()); ATH_CHECK(m_aveIntPerXKey.initialize()); ATH_CHECK(m_vertexContainerKey.initialize(SG::AllowEmpty)); return StatusCode::SUCCESS; } -//_____________________________________________________________________________ + + StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const { // Decorate event info @@ -79,55 +77,43 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const { TLorentzVector clusters_had_P4; clusters_had_P4.SetPtEtaPhiM(0,0,0,0); - if (! xTau.jetLink().isValid()) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return StatusCode::FAILURE; - } - const xAOD::Jet *jetSeed = xTau.jet(); - - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); - - const xAOD::Vertex* tauVertex = nullptr; - if (xTau.vertexLink().isValid()) tauVertex = xTau.vertex(); - - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(xTau); - - // Loop through jets, get links to clusters - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(jetSeed, clusterList, m_useSubtractedCluster)); - + TLorentzVector tauAxis = tauRecTools::getTauAxis(xTau, m_doVertexCorrection); // Loop through clusters and jet constituents - for (const xAOD::CaloCluster* cluster : clusterList){ - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = xTau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + TLorentzVector clusterP4 = vertexedCluster.p4(); if (clusterP4.DeltaR(tauAxis) > 0.2) continue; - clE = cluster->calE(); + // FIXME: should we use calE for EMTopo clusters ? + // what's the energy scale when calculating thee cluster momentum + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); + clE = cluster.calE(); Etot += clE; - if(clE>lead_cluster_frac) lead_cluster_frac = clE; - if(cluster->retrieveMoment(xAOD::CaloCluster::MomentType::CENTER_LAMBDA,center_lambda)) + if(cluster.retrieveMoment(xAOD::CaloCluster::MomentType::CENTER_LAMBDA,center_lambda)) mean_center_lambda += clE*center_lambda; else ATH_MSG_WARNING("Failed to retrieve moment: CENTER_LAMBDA"); - if(cluster->retrieveMoment(xAOD::CaloCluster::MomentType::FIRST_ENG_DENS,first_eng_dens)) + if(cluster.retrieveMoment(xAOD::CaloCluster::MomentType::FIRST_ENG_DENS,first_eng_dens)) mean_first_eng_dens += clE*first_eng_dens; else ATH_MSG_WARNING("Failed to retrieve moment: FIRST_ENG_DENS"); - if(cluster->retrieveMoment(xAOD::CaloCluster::MomentType::EM_PROBABILITY,em_probability)) { + if(cluster.retrieveMoment(xAOD::CaloCluster::MomentType::EM_PROBABILITY,em_probability)) { mean_em_probability += clE*em_probability; - if(em_probability>0.5) clusters_EM_P4 += cluster->p4(xAOD::CaloCluster::State::CALIBRATED); - else clusters_had_P4 += cluster->p4(xAOD::CaloCluster::State::CALIBRATED); + // FIXME: should we use calE for EMTopo clusters ? + // what's the energy scale when calculating thee cluster momentum + if(em_probability>0.5) clusters_EM_P4 += cluster.p4(xAOD::CaloCluster::State::CALIBRATED); + else clusters_had_P4 += cluster.p4(xAOD::CaloCluster::State::CALIBRATED); } else ATH_MSG_WARNING("Failed to retrieve moment: EM_PROBABILITY"); - if(cluster->retrieveMoment(xAOD::CaloCluster::MomentType::SECOND_LAMBDA,second_lambda)) + if(cluster.retrieveMoment(xAOD::CaloCluster::MomentType::SECOND_LAMBDA,second_lambda)) mean_second_lambda += clE*second_lambda; else ATH_MSG_WARNING("Failed to retrieve moment: SECOND_LAMBDA"); - mean_presampler_frac += (cluster->eSample(CaloSampling::PreSamplerB) + cluster->eSample(CaloSampling::PreSamplerE)); + mean_presampler_frac += (cluster.eSample(CaloSampling::PreSamplerB) + cluster.eSample(CaloSampling::PreSamplerE)); } // ----calculate mean values @@ -167,6 +153,12 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const { } // ----retrieve Ghost Muon Segment Count (for punch-through studies) + if (! xTau.jetLink().isValid()) { + ATH_MSG_ERROR("Tau jet link is invalid."); + return StatusCode::FAILURE; + } + const xAOD::Jet* jetSeed = xTau.jet(); + int nMuSeg=0; if(!jetSeed->getAttribute<int>("GhostMuonSegmentCount", nMuSeg)) nMuSeg=0; xTau.setDetail(xAOD::TauJetParameters::GhostMuonSegmentCount, nMuSeg); diff --git a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx index b2606be19621dc043ebb987a7cfcb939ab2e9e1c..fc301e8e15d9eff44813989dcff3e9b775699743 100644 --- a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx +++ b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx @@ -20,22 +20,14 @@ const float TauIDVarCalculator::LOW_NUMBER = -1111.; TauIDVarCalculator::TauIDVarCalculator(const std::string& name): - TauRecToolBase(name), - m_useSubtractedCluster(true) -{ - declareProperty("UseSubtractedCluster", m_useSubtractedCluster); + TauRecToolBase(name) { + declareProperty("VertexCorrection", m_doVertexCorrection = true); } -StatusCode TauIDVarCalculator::initialize() -{ - ATH_CHECK(m_tauVertexCorrection.retrieve()); - return StatusCode::SUCCESS; -} -StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) const -{ - static const SG::AuxElement::Accessor<float> acc_absipSigLeadTrk("absipSigLeadTrk"); +StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) const { + static const SG::AuxElement::Accessor<float> acc_absipSigLeadTrk("absipSigLeadTrk"); acc_absipSigLeadTrk(tau) = (tau.nTracks()>0) ? std::abs(tau.track(0)->d0SigTJVA()) : 0.; if(inTrigger()) return StatusCode::SUCCESS; @@ -79,37 +71,25 @@ StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) const std::vector<CaloSampling::CaloSample> Had1Samps = { CaloSampling::HEC0, CaloSampling::TileBar0, CaloSampling::TileGap1, CaloSampling::TileExt0}; - if (! tau.jetLink().isValid()) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return StatusCode::FAILURE; - } - const xAOD::Jet *jetSeed = tau.jet(); - - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); - - const xAOD::Vertex* tauVertex = nullptr; - if (tau.vertexLink().isValid()) tauVertex = tau.vertex(); - - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(tau); - - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(jetSeed, clusterList, m_useSubtractedCluster)); - float eEMAtEMScaleFixed = 0.; float eHadAtEMScaleFixed = 0.; float eHad1AtEMScaleFixed = 0.; - for (const xAOD::CaloCluster* cluster : clusterList) { - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - - if( tauAxis.DeltaR(clusterP4) > 0.2 ) continue; + TLorentzVector tauAxis = tauRecTools::getTauAxis(tau, m_doVertexCorrection); + + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = tau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + TLorentzVector clusterP4 = vertexedCluster.p4(); + if( clusterP4.DeltaR(tauAxis) > 0.2 ) continue; + + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); for( auto samp : EMSamps ) - eEMAtEMScaleFixed += cluster->eSample(samp); + eEMAtEMScaleFixed += cluster.eSample(samp); for( auto samp : HadSamps ) - eHadAtEMScaleFixed += cluster->eSample(samp); + eHadAtEMScaleFixed += cluster.eSample(samp); for( auto samp : Had1Samps ) - eHad1AtEMScaleFixed += cluster->eSample(samp); + eHad1AtEMScaleFixed += cluster.eSample(samp); } acc_EMFracFixed(tau) = ( eEMAtEMScaleFixed + eHadAtEMScaleFixed ) != 0. ? eEMAtEMScaleFixed / ( eEMAtEMScaleFixed + eHadAtEMScaleFixed ) : LOW_NUMBER; diff --git a/Reconstruction/tauRecTools/Root/TauJetRNN.cxx b/Reconstruction/tauRecTools/Root/TauJetRNN.cxx index 9a04d19cfa981f95201063c8677bfdcd1879676f..810a18eb45fd4c08b9293975bccd6dccf0172a80 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNN.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNN.cxx @@ -90,7 +90,7 @@ TauJetRNN::~TauJetRNN() {} float TauJetRNN::compute(const xAOD::TauJet &tau, const std::vector<const xAOD::TauTrack *> &tracks, - const std::vector<const xAOD::CaloCluster *> &clusters) const { + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters) const { InputMap scalarInputs; InputSequenceMap vectorInputs; if (!calculateInputVariables(tau, tracks, clusters, scalarInputs, vectorInputs)) { @@ -104,7 +104,7 @@ float TauJetRNN::compute(const xAOD::TauJet &tau, bool TauJetRNN::calculateInputVariables(const xAOD::TauJet &tau, const std::vector<const xAOD::TauTrack *> &tracks, - const std::vector<const xAOD::CaloCluster *> &clusters, + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters, std::map<std::string, std::map<std::string, double>>& scalarInputs, std::map<std::string, std::map<std::string, std::vector<double>>>& vectorInputs) const { scalarInputs.clear(); @@ -137,4 +137,4 @@ bool TauJetRNN::calculateInputVariables(const xAOD::TauJet &tau, } } return true; -} \ No newline at end of file +} diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx index 347086ea491597b146ba40547114855e9cbba0b3..d22d5c73969b2509c399156ea048dc9282ecfa19 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx @@ -24,6 +24,7 @@ TauJetRNNEvaluator::TauJetRNNEvaluator(const std::string &name): declareProperty("MaxTracks", m_max_tracks = 10); declareProperty("MaxClusters", m_max_clusters = 6); declareProperty("MaxClusterDR", m_max_cluster_dr = 1.0f); + declareProperty("VertexCorrection", m_doVertexCorrection = true); // Naming conventions for the network weight files: declareProperty("InputLayerScalar", m_input_layer_scalar = "scalar"); @@ -31,8 +32,6 @@ TauJetRNNEvaluator::TauJetRNNEvaluator(const std::string &name): declareProperty("InputLayerClusters", m_input_layer_clusters = "clusters"); declareProperty("OutputLayer", m_output_layer = "rnnid_output"); declareProperty("OutputNode", m_output_node = "sig_prob"); - - declareProperty("UseSubtractedCluster", m_useSubtractedCluster = true, "use shower subtracted clusters in calo calculations"); } TauJetRNNEvaluator::~TauJetRNNEvaluator() {} @@ -40,8 +39,6 @@ TauJetRNNEvaluator::~TauJetRNNEvaluator() {} StatusCode TauJetRNNEvaluator::initialize() { ATH_MSG_INFO("Initializing TauJetRNNEvaluator"); - ATH_CHECK(m_tauVertexCorrection.retrieve()); - std::string weightfile_0p(""); std::string weightfile_1p(""); std::string weightfile_3p(""); @@ -127,7 +124,7 @@ StatusCode TauJetRNNEvaluator::execute(xAOD::TauJet &tau) const { // Get input objects std::vector<const xAOD::TauTrack *> tracks; ATH_CHECK(get_tracks(tau, tracks)); - std::vector<const xAOD::CaloCluster *> clusters; + std::vector<xAOD::CaloVertexedTopoCluster> clusters; ATH_CHECK(get_clusters(tau, clusters)); // Evaluate networks @@ -178,50 +175,29 @@ StatusCode TauJetRNNEvaluator::get_tracks( } StatusCode TauJetRNNEvaluator::get_clusters( - const xAOD::TauJet &tau, std::vector<const xAOD::CaloCluster *> &out) const { + const xAOD::TauJet &tau, std::vector<xAOD::CaloVertexedTopoCluster> &clusters) const { - if (! tau.jetLink().isValid()) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return StatusCode::FAILURE; - } - const xAOD::Jet *jetSeed = tau.jet(); - - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); - - const xAOD::Vertex* tauVertex = nullptr; - if (tau.vertexLink().isValid()) tauVertex = tau.vertex(); - - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(tau); + TLorentzVector tauAxis = tauRecTools::getTauAxis(tau, m_doVertexCorrection); - std::vector<const xAOD::CaloCluster*> clusters; - ATH_CHECK(tauRecTools::GetJetClusterList(jetSeed, clusters, m_useSubtractedCluster)); - - // remove clusters that do not meet dR requirement - auto cItr = clusters.begin(); - while( cItr != clusters.end() ){ - const xAOD::CaloCluster* cluster = (*cItr); - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - - if (tauAxis.DeltaR(clusterP4) > m_max_cluster_dr) { - clusters.erase(cItr); - } - else { - ++cItr; - } + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = tau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList) { + TLorentzVector clusterP4 = vertexedCluster.p4(); + if (clusterP4.DeltaR(tauAxis) > m_max_cluster_dr) continue; + + clusters.push_back(vertexedCluster); } // Sort by descending et - auto et_cmp = [](const xAOD::CaloCluster *lhs, - const xAOD::CaloCluster *rhs) { - return lhs->et() > rhs->et(); + auto et_cmp = [](const xAOD::CaloVertexedTopoCluster& lhs, + const xAOD::CaloVertexedTopoCluster& rhs) { + return lhs.p4().Et() > rhs.p4().Et(); }; std::sort(clusters.begin(), clusters.end(), et_cmp); // Truncate clusters if (clusters.size() > m_max_clusters) { - clusters.resize(m_max_clusters); + clusters.resize(m_max_clusters, clusters[0]); } - out = std::move(clusters); return StatusCode::SUCCESS; } diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx index 5418e2a5db42b42019b6e1447df5de3225d5b738..90a634b4f6cd056aa0c4f3c46785a0b6167153d6 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx @@ -53,7 +53,7 @@ bool VarCalc::compute(const std::string &name, const xAOD::TauJet &tau, } bool VarCalc::compute(const std::string &name, const xAOD::TauJet &tau, - const std::vector<const xAOD::CaloCluster *> &clusters, + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters, std::vector<double> &out) const { out.clear(); @@ -69,8 +69,8 @@ bool VarCalc::compute(const std::string &name, const xAOD::TauJet &tau, // Calculate variables for selected clusters bool success = true; double value; - for (const auto cls : clusters) { - success = success && func(tau, *cls, value); + for (const auto cluster : clusters) { + success = success && func(tau, cluster, value); out.push_back(value); } @@ -450,67 +450,67 @@ bool eProbabilityHT(const xAOD::TauJet& /*tau*/, const xAOD::TauTrack &track, namespace Cluster { using MomentType = xAOD::CaloCluster::MomentType; -bool et_log(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster, +bool et_log(const xAOD::TauJet& /*tau*/, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { - out = std::log10(cluster.et()); + out = std::log10(cluster.p4().Et()); return true; } -bool pt_jetseed_log(const xAOD::TauJet &tau, const xAOD::CaloCluster& /*cluster*/, +bool pt_jetseed_log(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster& /*cluster*/, double &out) { out = std::log10(tau.ptJetSeed()); return true; } -bool dEta(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, +bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { out = cluster.eta() - tau.eta(); return true; } -bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, +bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { out = cluster.p4().DeltaPhi(tau.p4()); return true; } -bool SECOND_R(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster, +bool SECOND_R(const xAOD::TauJet& /*tau*/, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { - const auto success = cluster.retrieveMoment(MomentType::SECOND_R, out); + const auto success = cluster.clust().retrieveMoment(MomentType::SECOND_R, out); out = std::log10(out + 0.1); return success; } -bool SECOND_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster, +bool SECOND_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { - const auto success = cluster.retrieveMoment(MomentType::SECOND_LAMBDA, out); + const auto success = cluster.clust().retrieveMoment(MomentType::SECOND_LAMBDA, out); out = std::log10(out + 0.1); return success; } -bool CENTER_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster, +bool CENTER_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { - const auto success = cluster.retrieveMoment(MomentType::CENTER_LAMBDA, out); + const auto success = cluster.clust().retrieveMoment(MomentType::CENTER_LAMBDA, out); out = std::log10(out + 1e-6); return success; } -bool SECOND_LAMBDAOverClustersMeanSecondLambda(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out) { +bool SECOND_LAMBDAOverClustersMeanSecondLambda(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { float ClustersMeanSecondLambda = tau.auxdata<float>("ClustersMeanSecondLambda"); double secondLambda(0); - const auto success = cluster.retrieveMoment(MomentType::SECOND_LAMBDA, secondLambda); + const auto success = cluster.clust().retrieveMoment(MomentType::SECOND_LAMBDA, secondLambda); out = secondLambda/ClustersMeanSecondLambda; return success; } -bool CENTER_LAMBDAOverClustersMeanCenterLambda(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out) { +bool CENTER_LAMBDAOverClustersMeanCenterLambda(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { float ClustersMeanCenterLambda = tau.auxdata<float>("ClustersMeanCenterLambda"); double centerLambda(0); - const auto success = cluster.retrieveMoment(MomentType::CENTER_LAMBDA, centerLambda); + const auto success = cluster.clust().retrieveMoment(MomentType::CENTER_LAMBDA, centerLambda); if (ClustersMeanCenterLambda == 0.){ out = 250.; }else { @@ -523,12 +523,12 @@ bool CENTER_LAMBDAOverClustersMeanCenterLambda(const xAOD::TauJet &tau, const xA } -bool FirstEngDensOverClustersMeanFirstEngDens(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out) { +bool FirstEngDensOverClustersMeanFirstEngDens(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { // the ClustersMeanFirstEngDens is the log10 of the energy weighted average of the First_ENG_DENS // divided by ETot to make it dimension-less, // so we need to evaluate the differance of log10(clusterFirstEngDens/clusterTotalEnergy) and the ClustersMeanFirstEngDens double clusterFirstEngDens = 0.0; - bool status = cluster.retrieveMoment(MomentType::FIRST_ENG_DENS, clusterFirstEngDens); + bool status = cluster.clust().retrieveMoment(MomentType::FIRST_ENG_DENS, clusterFirstEngDens); if (clusterFirstEngDens < 1e-6) clusterFirstEngDens = 1e-6; float clusterTotalEnergy = tau.auxdata<float>("ClusterTotalEnergy"); diff --git a/Reconstruction/tauRecTools/Root/TauVertexCorrection.cxx b/Reconstruction/tauRecTools/Root/TauVertexCorrection.cxx deleted file mode 100644 index 2522a3cd2b9c1fc53b657b2f795e1f8639dbd5a4..0000000000000000000000000000000000000000 --- a/Reconstruction/tauRecTools/Root/TauVertexCorrection.cxx +++ /dev/null @@ -1,231 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "tauRecTools/TauVertexCorrection.h" - -#include "xAODCaloEvent/CaloVertexedTopoCluster.h" - -TauVertexCorrection::TauVertexCorrection(const std::string& name): - asg::AsgTool(name) { - declareProperty("SeedJet", m_seedJet = ""); - declareProperty("VertexCorrection", m_doVertexCorrection = true); - declareProperty("JetVertexCorrection", m_doJetVertexCorrection = true); -} - - - -StatusCode TauVertexCorrection::initialize() { - ATH_MSG_INFO("in initialize"); - - // For AntiKt4LCTopoJets: CALIBRATED -- jet vertex corrected at LCScale, UNCALIBRATED -- EMScale - // For AntiKt4EMTopoJets: CALIBRATED -- jet vertex corrected at EMScale, UNCALIBRATED -- EMScale - if (m_seedJet == "AntiKt4LCTopoJets") { - m_isPFO = false; - m_clusterState = xAOD::CaloCluster::State::CALIBRATED; - } - else if (m_seedJet == "AntiKt4EMTopoJets") { - m_isPFO = false; - m_clusterState = xAOD::CaloCluster::State::CALIBRATED; - } - else if (m_seedJet == "AntiKt4EMPFlowJets") { - m_isPFO = true; - m_clusterState = xAOD::CaloCluster::State::UNCALIBRATED; - } - else { - ATH_MSG_ERROR("Seed jet " << m_seedJet << " not supported !"); - return StatusCode::FAILURE; - } - - ATH_MSG_INFO("VertexCorrection: " << m_doVertexCorrection); - ATH_MSG_INFO("JetVertexCorrection: " << m_doJetVertexCorrection); - ATH_MSG_INFO("SeedJet: " << m_seedJet); - ATH_MSG_INFO("PFO: " << m_isPFO); - ATH_MSG_INFO("Cluster Calibraction State: " << m_clusterState); - - return StatusCode::SUCCESS; -} - - - -const xAOD::Vertex* TauVertexCorrection::getJetVertex(const xAOD::Jet& jet) const { - - const xAOD::Vertex* jetVertex = nullptr; - - if (m_doJetVertexCorrection) { - bool isAvailable = jet.getAssociatedObject("OriginVertex", jetVertex); - if (!isAvailable) { - ATH_MSG_WARNING("OriginVertex not available !"); - jetVertex = nullptr; - } - } - - return jetVertex; -} - - - -TLorentzVector TauVertexCorrection::getTauAxis(const xAOD::TauJet& tau) const { - TLorentzVector tauAxis; - if (m_doVertexCorrection) { - tauAxis = tau.p4(xAOD::TauJetParameters::IntermediateAxis); - } - else { - tauAxis = tau.p4(xAOD::TauJetParameters::DetectorAxis); - } - - return tauAxis; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const Amg::Vector3D& position) const { - - TLorentzVector vertexCorrectedP4 = xAOD::CaloVertexedTopoCluster(cluster, m_clusterState, position).p4(); - - ATH_MSG_DEBUG("Cluster: " << &cluster); - ATH_MSG_DEBUG("Original cluster four momentum, pt: " << cluster.pt(m_clusterState) << - " eta: " << cluster.eta(m_clusterState) << " phi: " << cluster.phi(m_clusterState) << - " e: " << cluster.e(m_clusterState)); - ATH_MSG_DEBUG("Vertex corrected four momentum, pt: " << vertexCorrectedP4.Pt() << - " eta: " << vertexCorrectedP4.Eta() << " phi: " << vertexCorrectedP4.Phi() << - " e: " << vertexCorrectedP4.E()); - - return vertexCorrectedP4; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::PFO& pfo, - const Amg::Vector3D& position) const { - TLorentzVector vertexCorrectedP4; - - if (!pfo.isCharged()) { - TVector3 pos(position.x(), position.y(), position.z()); - - // If there is a vertex correction in jet reconstruction, then pfo.p4() is the four momentum - // at EM scale. Otherwise, pfo.p4() is at LC scale (not clear), and pfo.p4EM() is the four - // momentum at EM scale. - // TODO: May need further modifications, depending on how the jet reconstruction fix ATLJETMET-1280 - // The strategy only works for PFlow at EM scale. - if (m_doJetVertexCorrection) { - vertexCorrectedP4 = pfo.GetVertexCorrectedFourVec(pos); - } - else { - vertexCorrectedP4 = pfo.GetVertexCorrectedEMFourVec(pos); - } - } - else { - vertexCorrectedP4 = pfo.p4(); - } - - ATH_MSG_DEBUG("Original pfo four momentum, pt: " << pfo.pt() << - " eta: " << pfo.eta() << " phi: " << pfo.phi() << " e: " << pfo.e()); - ATH_MSG_DEBUG("Vertex corrected four momentum, pt: " << vertexCorrectedP4.Pt() << - " eta: " << vertexCorrectedP4.Eta() << " phi: " << vertexCorrectedP4.Phi() << " e: " << vertexCorrectedP4.E()); - - return vertexCorrectedP4; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex) const { - TLorentzVector vertexCorrectedP4 = cluster.p4(m_clusterState); - Amg::Vector3D position; - - // In jet reconstruction: - // Clusters in Topo jets are corrected to point at PV0 when m_doJetVertexCorrection is true - // Clusters in PFlow jets are not corrected in jet reconstruction - // In tau reconstruction: - // If we want to do the vertex correction using tau vertexs, use the position of the tau vertex - // for PFlow jets, while the relative position of the tau vertex and default vertex for Topo jets - // If not, use the default vertex to correct clusters from PFlow jets - if (m_doVertexCorrection) { - if (m_isPFO) { - // use the position of tau vertex if we want to correct to tau vertex and seed is PFO jets - if (tauVertex) { - position = tauVertex->position(); - vertexCorrectedP4 = getVertexCorrectedP4(cluster, position); - } - // use the position of jet vertex if tau vertex not available - else if (m_doJetVertexCorrection && jetVertex) { - position = jetVertex->position(); - vertexCorrectedP4 = getVertexCorrectedP4(cluster, position); - } - } - else { - // use the relative position of tau vertex and default vertex for Topo jets - if (tauVertex && tauVertex != jetVertex) { - position = tauVertex->position(); - if (m_doJetVertexCorrection && jetVertex) { - position -= jetVertex->position(); - } - vertexCorrectedP4 = getVertexCorrectedP4(cluster, position); - } - } - } - else if (m_doJetVertexCorrection && m_isPFO) { - // use the position of jet vertex for PFO jets when no tau vertex correction is requried - if (jetVertex) { - position = jetVertex->position(); - vertexCorrectedP4 = getVertexCorrectedP4(cluster, position); - } - } - - return vertexCorrectedP4; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::PFO& pfo, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex) const { - TLorentzVector vertexCorrectedP4 = pfo.p4(); - Amg::Vector3D position; - - // In jet reconstruction: - // PFOs are corrected to point at PV0 when m_doJetVertexCorrection is true - - // In tau reconstruction: - // If we want to do the vertex correction using tau vertexs, use the relative position - // of the tau vertex and default vertex - - if (m_doVertexCorrection) { - // use the relative position of tau vertex and default vertex - if (tauVertex) { - position = tauVertex->position(); - if (m_doJetVertexCorrection && jetVertex) { - position -= jetVertex->position(); - } - vertexCorrectedP4 = getVertexCorrectedP4(pfo, position); - } - } - - return vertexCorrectedP4; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::JetConstituent& constituent, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex) const { - TLorentzVector vertexCorrectedP4; - - if (constituent.type() == xAOD::Type::CaloCluster) { - const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( constituent.rawConstituent() ); - vertexCorrectedP4 = getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - } - else if (constituent.type() == xAOD::Type::ParticleFlow) { - const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( constituent.rawConstituent() ); - vertexCorrectedP4 = getVertexCorrectedP4(*pfo, tauVertex, jetVertex); - } - else { - ATH_MSG_WARNING("Seed jet constituent type not supported, will not do vertex correction !"); - vertexCorrectedP4.SetPtEtaPhiE(constituent.pt(), constituent.eta(), constituent.phi(), constituent.e()); - } - - return vertexCorrectedP4; -} diff --git a/Reconstruction/tauRecTools/src/TauCellVariables.cxx b/Reconstruction/tauRecTools/src/TauCellVariables.cxx index 51caf877e02e895109b4cd7e137b27d491cadada..016b1cd9f1c1eaf16cbbf1953570aea85109f6a4 100644 --- a/Reconstruction/tauRecTools/src/TauCellVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauCellVariables.cxx @@ -15,28 +15,16 @@ #include <cmath> #include <vector> -//______________________________________________________________________________ + TauCellVariables::TauCellVariables(const std::string& name) : TauRecToolBase(name) { } -//______________________________________________________________________________ -TauCellVariables::~TauCellVariables() { -} -//______________________________________________________________________________ -StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { - if (! pTau.jetLink().isValid()) { - ATH_MSG_ERROR("tau does not have jet seed for cell variable calculation"); - return StatusCode::FAILURE; - } - const xAOD::Jet* pJetSeed = pTau.jet(); - - ATH_MSG_VERBOSE("cluster position is eta=" << pTau.eta() << " phi=" << pTau.phi() ); +StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { int numStripCell = 0; - int numEMCell = 0; double sumCellET = 0.; double sumCellET01 = 0; @@ -51,15 +39,16 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { std::vector<double> cellRingEnergys(7,0.); - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(pJetSeed, clusterList, m_useSubtractedCluster)); - int numCells = 0; std::bitset<200000> cellSeen; + TLorentzVector tauAxis = tauRecTools::getTauAxis(pTau, m_doVertexCorrection); + // loop over cells in all the clusters and calculate the variables - for (auto cluster : clusterList){ - const CaloClusterCellLink* cellLinks = cluster->getCellLinks(); + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = pTau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); + const CaloClusterCellLink* cellLinks = cluster.getCellLinks(); for (const CaloCell* cell : *cellLinks) { ++numCells; @@ -72,26 +61,24 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { cellSeen.set(cell->caloDDE()->calo_hash()); } + // cell four momentum corrected to point at the required vertex double cellPhi = cell->phi(); double cellEta = cell->eta(); double cellET = cell->et(); double cellEnergy = cell->energy(); - TLorentzVector tauAxis = pTau.p4(xAOD::TauJetParameters::DetectorAxis); - - // correct cell four momentum based on tau vertex - if (m_doVertexCorrection && pTau.vertexLink().isValid()) { + + const xAOD::Vertex* vertex = tauRecTools::getTauVertex(pTau, inTrigger()); + if (m_doVertexCorrection && vertex) { CaloVertexedCell vxCell (*cell, pTau.vertex()->position()); cellPhi = vxCell.phi(); cellEta = vxCell.eta(); cellET = vxCell.et(); cellEnergy = vxCell.energy(); - tauAxis = pTau.p4(xAOD::TauJetParameters::IntermediateAxis); } - + double dR = Tau1P3PKineUtils::deltaR(tauAxis.Eta(), tauAxis.Phi(), cellEta, cellPhi); CaloSampling::CaloSample calo = cell->caloDDE()->getSampling(); - // use cells with dR < m_cellCone relative to tau intermediate axis: if (dR < m_cellCone) { sumCellET += cellET; @@ -104,7 +91,6 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { if (isEMLayer(calo)) { EMRadius += dR*cellET; sumEMCellET += cellET; - if (cellEnergy > m_cellEthr) numEMCell += 1; // Strip layer: EMB1 and EME1 if (isStripLayer(calo) && (std::abs(cellEta) < 2.5)) { diff --git a/Reconstruction/tauRecTools/src/TauCellVariables.h b/Reconstruction/tauRecTools/src/TauCellVariables.h index ba548d0c63ee8809cd64f27fff075bc3212d1718..c75a46533ece994e434fd88f69fa338288e645ac 100644 --- a/Reconstruction/tauRecTools/src/TauCellVariables.h +++ b/Reconstruction/tauRecTools/src/TauCellVariables.h @@ -23,7 +23,7 @@ class TauCellVariables : public TauRecToolBase { TauCellVariables(const std::string& name); /** @brief Destructor */ - ~TauCellVariables(); + virtual ~TauCellVariables() = default; /** @brief Perform the calculation of cell variables for each tau candidate */ virtual StatusCode execute(xAOD::TauJet& pTau) const override; @@ -36,11 +36,9 @@ class TauCellVariables : public TauRecToolBase { /** @brief Check whether the CaloSample is a Strip layer */ bool isStripLayer(const CaloSampling::CaloSample& calo) const; - Gaudi::Property<double> m_cellEthr {this, "CellEthreshold", 0.2 * Gaudi::Units::GeV, "energy threshould of EM cell"}; Gaudi::Property<double> m_stripEthr {this, "StripEthreshold", 0.2 * Gaudi::Units::GeV, "energy threshould for strip cell"}; Gaudi::Property<double> m_cellCone {this, "CellCone", 0.2, "outer cone for cells used in calculation"}; Gaudi::Property<bool> m_doVertexCorrection {this, "VertexCorrection", true, "switch of vertex correction"}; - Gaudi::Property<bool> m_useSubtractedCluster {this, "UseSubtractedCluster", true, "use shower subtracted clusters in calo calculations"}; }; //______________________________________________________________________________ diff --git a/Reconstruction/tauRecTools/src/TauClusterFinder.h b/Reconstruction/tauRecTools/src/TauClusterFinder.h index 3d11cda80cd5fda14c330e8a7080e20cf460d212..cfb4a9a32b80caa8b56879739f4cbf2213f3cf84 100644 --- a/Reconstruction/tauRecTools/src/TauClusterFinder.h +++ b/Reconstruction/tauRecTools/src/TauClusterFinder.h @@ -6,7 +6,6 @@ #define TAUCLUSTERFINDER_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" #include "AsgTools/ToolHandle.h" diff --git a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx index 9816326736b008a9988da4e162ccd5b4db0f441c..bbe13122a7ad5b82e3eaef151c76203f606f4e2e 100644 --- a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx @@ -4,42 +4,31 @@ #ifndef XAOD_ANALYSIS - - -#include "GaudiKernel/SystemOfUnits.h" -#include "CaloUtils/CaloVertexedCell.h" - -#include "xAODTau/TauJet.h" -#include "xAODJet/Jet.h" +#include "TauElectronVetoVariables.h" #include "tauRecTools/KineUtils.h" -#include "tauRecTools/HelperFunctions.h" +#include "xAODTau/TauJet.h" +#include "CaloUtils/CaloVertexedCell.h" #include "TrkParametersIdentificationHelpers/TrackParametersIdHelper.h" #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" -#include "TauElectronVetoVariables.h" + +#include "GaudiKernel/SystemOfUnits.h" + #include <algorithm> #include <cmath> #include <unordered_map> #include <array> + using Gaudi::Units::GeV; -//------------------------------------------------------------------------- -// Constructor -//------------------------------------------------------------------------- + TauElectronVetoVariables::TauElectronVetoVariables(const std::string &name) : TauRecToolBase(name) { } -//------------------------------------------------------------------------- -// Destructor -//------------------------------------------------------------------------- -TauElectronVetoVariables::~TauElectronVetoVariables() { } -//------------------------------------------------------------------------- -// Initializer -//------------------------------------------------------------------------- -StatusCode TauElectronVetoVariables::initialize() -{ + +StatusCode TauElectronVetoVariables::initialize() { ATH_CHECK( m_caloExtensionTool.retrieve() ); if (!m_ParticleCacheKey.key().empty()) { ATH_CHECK(m_ParticleCacheKey.initialize()); @@ -49,11 +38,9 @@ StatusCode TauElectronVetoVariables::initialize() return StatusCode::SUCCESS; } -//------------------------------------------------------------------------- -// Execution -//------------------------------------------------------------------------- -StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) const -{ + + +StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) const { if (pTau.nTracks() < 1) { return StatusCode::SUCCESS; } @@ -152,23 +139,21 @@ StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) const return StatusCode::SUCCESS; } } - if (! pTau.jetLink().isValid()) { - ATH_MSG_ERROR("tau does not have jet seed for electron veto cell variable calculation"); - return StatusCode::FAILURE; - } - const xAOD::Jet* pJetSeed = pTau.jet(); + // Loop through jets, get links to clusters - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(pJetSeed, clusterList, m_useSubtractedCluster)); std::bitset<200000> cellSeen{}; const std::unordered_map<int, int> samplingLookup{ {4,0}, {5,1}, {6,2}, {7,3}, {8,12}, {15, 12}, {16,13}, {17,14}, {18,12}, {19, 13}, {20,14} }; const auto notFound{samplingLookup.end()}; - for (auto cluster : clusterList){ - CaloClusterCellLink::const_iterator pCellIter = cluster->getCellLinks()->begin(); - CaloClusterCellLink::const_iterator pCellIterE = cluster->getCellLinks()->end(); + + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = pTau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); + CaloClusterCellLink::const_iterator pCellIter = cluster.getCellLinks()->begin(); + CaloClusterCellLink::const_iterator pCellIterE = cluster.getCellLinks()->end(); for (; pCellIter != pCellIterE; ++pCellIter) { double cellEta{}, cellPhi{}, cellET{}; pCell = *pCellIter; diff --git a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h index d31230f6cf3972488f1d98fa20424fa667c8b1af..33c64fa60537d6a42433471db6695df58e7f25c5 100644 --- a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h +++ b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h @@ -2,13 +2,15 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#ifndef TAUREC_TAU1P3PELEVETO_H -#define TAUREC_TAU1P3PELEVETO_H +#ifndef TAURECTOOLS_TAUELECTRONVETOVARIABLES_H +#define TAURECTOOLS_TAUELECTRONVETOVARIABLES_H #include "tauRecTools/TauRecToolBase.h" + +#include "TrkCaloExtension/CaloExtensionCollection.h" + #include "GaudiKernel/ToolHandle.h" #include "StoreGate/ReadHandleKey.h" -#include "TrkCaloExtension/CaloExtensionCollection.h" namespace Trk { class IParticleCaloExtensionTool; @@ -23,23 +25,27 @@ namespace Trk { */ class TauElectronVetoVariables : public TauRecToolBase { + public: + + ASG_TOOL_CLASS2(TauElectronVetoVariables, TauRecToolBase, ITauToolBase) + + TauElectronVetoVariables(const std::string& name); - TauElectronVetoVariables(const std::string& name); - ASG_TOOL_CLASS2(TauElectronVetoVariables, TauRecToolBase, ITauToolBase); + virtual ~TauElectronVetoVariables() = default; - virtual ~TauElectronVetoVariables(); - virtual StatusCode execute(xAOD::TauJet& pTau) const override; - virtual StatusCode initialize() override; + virtual StatusCode initialize() override; + + virtual StatusCode execute(xAOD::TauJet& pTau) const override; private: - Gaudi::Property<bool> m_doVertexCorrection {this, "VertexCorrection", true, "switch of vertex correction"}; - Gaudi::Property<bool> m_useOldCalo{this,"useOldCalo",false,"If true, it uses the CaloExtensionTool for calculating track extrapolation. Otherwise, it allows the code to read from the cache created by CaloExtensionBuilderalg."}; - Gaudi::Property<bool> m_useSubtractedCluster {this, "UseSubtractedCluster", true, "use shower subtracted clusters in calo calculations"}; - ToolHandle<Trk::IParticleCaloExtensionTool> m_caloExtensionTool {this, - "ParticleCaloExtensionTool", "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool", "Tool for calculating track extrapolation"}; - SG::ReadHandleKey<CaloExtensionCollection> m_ParticleCacheKey{this, - "tauEVParticleCache", "ParticleCaloExtension", "Name of the particle measurement extrapolation cache for TauEV Algorithm"}; + + Gaudi::Property<bool> m_doVertexCorrection {this, "VertexCorrection", true, "switch of vertex correction"}; + Gaudi::Property<bool> m_useOldCalo{this,"useOldCalo",false,"If true, it uses the CaloExtensionTool for calculating track extrapolation. Otherwise, it allows the code to read from the cache created by CaloExtensionBuilderalg."}; + ToolHandle<Trk::IParticleCaloExtensionTool> m_caloExtensionTool {this, + "ParticleCaloExtensionTool", "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool", "Tool for calculating track extrapolation"}; + SG::ReadHandleKey<CaloExtensionCollection> m_ParticleCacheKey{this, + "tauEVParticleCache", "ParticleCaloExtension", "Name of the particle measurement extrapolation cache for TauEV Algorithm"}; }; #endif diff --git a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx index 241dc39b8b00e66d38daab8109dd5a9c8517a783..226987b143ac0ad19c28590d0cd44ff61e0133e1 100644 --- a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx +++ b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx @@ -12,20 +12,12 @@ #include "xAODJet/Jet.h" - TauPi0ClusterCreator::TauPi0ClusterCreator(const std::string& name) : TauRecToolBase(name) { } -StatusCode TauPi0ClusterCreator::initialize() { - ATH_CHECK(m_tauVertexCorrection.retrieve()); - return StatusCode::SUCCESS; -} - - - StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicPFOContainer, const xAOD::CaloClusterContainer& pi0ClusterContainer) const { @@ -51,21 +43,24 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAO // Map shot to the pi0 cluster std::map<unsigned, const xAOD::CaloCluster*> shotToClusterMap = getShotToClusterMap(shotPFOs, pi0ClusterContainer, tau); - // FIXME: These clusters are custom ones, so could be corrected using tau vertex directly - if (! tau.jetLink().isValid()) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return StatusCode::FAILURE; - } - const xAOD::Jet *jetSeed = tau.jet(); - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); - const xAOD::Vertex* tauVertex = nullptr; - if (tau.vertexLink().isValid()) tauVertex = tau.vertex(); - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(tau); + // We will always perform the vertex correction + const xAOD::Vertex* vertex = tauRecTools::getTauVertex(tau); + + // Tau custom PFO reconstruction is only used in offline reconstrution + TLorentzVector tauAxis = tauRecTools::getTauAxis(tau); - // Loop over clusters, and create neutral PFOs + // Loop over custom pi0 clusters, and create neutral PFOs for (const xAOD::CaloCluster* cluster: pi0ClusterContainer) { - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - + // custom clusters could be correctd directly using the tau vertex + TLorentzVector clusterP4; + if (vertex) { + xAOD::CaloVertexedTopoCluster vertexedCluster(*cluster, vertex->position()); + clusterP4 = vertexedCluster.p4(); + } + else { + clusterP4 = cluster->p4(); + } + // Clusters must have enough energy, and within 0.4 cone of the tau candidate if (clusterP4.Pt() < m_clusterEtCut) continue; if (clusterP4.DeltaR(tauAxis) > 0.4) continue; @@ -82,18 +77,19 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAO ATH_CHECK(configureNeutralPFO(*cluster, pi0ClusterContainer, tau, shotPFOs, shotToClusterMap, *neutralPFO)); } - // Loop over clusters, and create hadronic PFOs - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(jetSeed, clusterList, m_useSubtractedCluster)); - for (const xAOD::CaloCluster* cluster: clusterList) { - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); + // Loop over clusters from jet seed, and create hadronic PFOs + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = tau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + TLorentzVector clusterP4 = vertexedCluster.p4(); // Clusters must have positive energy, and within 0.2 cone of the tau candidate if(clusterP4.E()<=0.) continue; if(clusterP4.DeltaR(tauAxis) > 0.2) continue; double clusterEnergyHad = 0.; - const CaloClusterCellLink* cellLinks = cluster->getCellLinks(); + + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); + const CaloClusterCellLink* cellLinks = cluster.getCellLinks(); CaloClusterCellLink::const_iterator cellLink = cellLinks->begin(); for (; cellLink != cellLinks->end(); ++cellLink) { const CaloCell* cell = static_cast<const CaloCell*>(*cellLink); @@ -101,6 +97,7 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAO int sampling = cell->caloDDE()->getSampling(); if (sampling < 8) continue; + // TODO: what is the weight for EMTopo double cellEnergy = cell->e() * cellLink.weight(); clusterEnergyHad += cellEnergy; } @@ -117,7 +114,7 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAO PFOElementLink.toContainedElement( hadronicPFOContainer, hadronicPFO ); tau.addHadronicPFOLink( PFOElementLink ); - ATH_CHECK(configureHadronicPFO(*cluster, clusterEnergyHad, *hadronicPFO)); + ATH_CHECK(configureHadronicPFO(cluster, clusterEnergyHad, *hadronicPFO)); } return StatusCode::SUCCESS; @@ -138,24 +135,26 @@ std::map<unsigned, const xAOD::CaloCluster*> TauPi0ClusterCreator::getShotToClus } const IdentifierHash seedHash = static_cast<const IdentifierHash>(seedHashInt); - const xAOD::Jet *jetSeed = tau.jet(); - if (!jetSeed) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return shotToClusterMap; - } - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); + // We will always perform the vertex correction + const xAOD::Vertex* vertex = tauRecTools::getTauVertex(tau); - const xAOD::Vertex* tauVertex = nullptr; - if (tau.vertexLink().isValid()) tauVertex = tau.vertex(); + // Tau custom PFO reconstruction is only used in offline reconstrution + TLorentzVector tauAxis = tauRecTools::getTauAxis(tau); - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(tau); - float weightInCluster = -1.; float weightInPreviousCluster = -1; - for (const xAOD::CaloCluster* cluster : pi0ClusterContainer) { - // FIXME: cluster here is not corrected - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); + // Loop over custom pi0 clusters, and map shot to the cluster + for (const xAOD::CaloCluster* cluster: pi0ClusterContainer) { + // custom clusters could be correctd directly using the tau vertex + TLorentzVector clusterP4; + if (vertex) { + xAOD::CaloVertexedTopoCluster vertexedCluster(*cluster, vertex->position()); + clusterP4 = vertexedCluster.p4(); + } + else { + clusterP4 = cluster->p4(); + } weightInCluster = -1.; if (clusterP4.Et() < m_clusterEtCut) continue; diff --git a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h index fcb8c415b532cb25f71b4ad9c741b6735de82fcc..e1d474c33af99da934119cefb52177562af99781 100644 --- a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h +++ b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h @@ -6,7 +6,6 @@ #define TAUREC_TAUPI0CLUSTERCREATOR_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" #include "xAODPFlow/PFOContainer.h" #include "xAODCaloEvent/CaloClusterContainer.h" @@ -30,12 +29,12 @@ class TauPi0ClusterCreator : public TauRecToolBase { public: - ASG_TOOL_CLASS2(TauPi0ClusterCreator, TauRecToolBase, ITauToolBase); + ASG_TOOL_CLASS2(TauPi0ClusterCreator, TauRecToolBase, ITauToolBase) - TauPi0ClusterCreator(const std::string& name) ; + TauPi0ClusterCreator(const std::string& name); + virtual ~TauPi0ClusterCreator() = default; - virtual StatusCode initialize() override; virtual StatusCode executePi0ClusterCreator(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicClusterPFOContainer, const xAOD::CaloClusterContainer& pi0CaloClusContainer) const override; @@ -81,10 +80,6 @@ private: std::vector<float> get2ndEtaMomWRTCluster(const xAOD::CaloCluster& cluster) const; Gaudi::Property<double> m_clusterEtCut {this, "ClusterEtCut", 0.5 * Gaudi::Units::GeV, "Et threshould for pi0 candidate clusters"}; - Gaudi::Property<bool> m_useSubtractedCluster {this, "UseSubtractedCluster", true, "use shower subtracted clusters in calo calculations"}; - - ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, - "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"}; }; #endif /* TAUPI0CLUSTERCREATOR_H */ diff --git a/Reconstruction/tauRecTools/src/components/tauRecTools_entries.cxx b/Reconstruction/tauRecTools/src/components/tauRecTools_entries.cxx index 2a2d8a9a02b06940e3bff744bd016a3360b958f8..a66ec3712bc05033eb2cafaa95316a0847bf544d 100644 --- a/Reconstruction/tauRecTools/src/components/tauRecTools_entries.cxx +++ b/Reconstruction/tauRecTools/src/components/tauRecTools_entries.cxx @@ -28,7 +28,6 @@ #include "tauRecTools/TauIDVarCalculator.h" #include "tauRecTools/TauJetRNNEvaluator.h" #include "tauRecTools/TauDecayModeNNClassifier.h" -#include "tauRecTools/TauVertexCorrection.h" #include "tauRecTools/TauVertexedClusterDecorator.h" #ifndef XAOD_ANALYSIS @@ -63,5 +62,4 @@ DECLARE_COMPONENT( TauJetBDTEvaluator ) DECLARE_COMPONENT( TauIDVarCalculator ) DECLARE_COMPONENT( TauJetRNNEvaluator ) DECLARE_COMPONENT( TauDecayModeNNClassifier ) -DECLARE_COMPONENT( TauVertexCorrection ) DECLARE_COMPONENT( TauVertexedClusterDecorator ) diff --git a/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h b/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h index f0d1636a7b51db61c82813859eb87089688f620f..d4a12570939a095b45d20065bbf82a15786a3ac9 100644 --- a/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h +++ b/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h @@ -5,10 +5,7 @@ #ifndef CALOCLUSTERVARIABLES_H #define CALOCLUSTERVARIABLES_H -#include "tauRecTools/ITauVertexCorrection.h" - #include "xAODTau/TauJet.h" -#include "AsgTools/ToolHandle.h" #include "CxxUtils/fpcompare.h" #include "TLorentzVector.h" diff --git a/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h b/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h index b7b1c92c8d8043370d4703cf9a26ab0663a49a28..7bf233bfcfe43b098a7421026e1d6da04876ff64 100644 --- a/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h +++ b/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h @@ -49,8 +49,6 @@ namespace tauRecTools TLorentzVector GetConstituentP4(const xAOD::JetConstituent& constituent); - const StatusCode GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool useSubtractedCluster); - xAOD::TauTrack::TrackFlagType isolateClassifiedBits(xAOD::TauTrack::TrackFlagType flag); bool sortTracks(const ElementLink<xAOD::TauTrackContainer> &l1, const ElementLink<xAOD::TauTrackContainer> &l2); diff --git a/Reconstruction/tauRecTools/tauRecTools/ITauVertexCorrection.h b/Reconstruction/tauRecTools/tauRecTools/ITauVertexCorrection.h deleted file mode 100644 index 35fa425b67bca528de1558217d051be7a6ec28e3..0000000000000000000000000000000000000000 --- a/Reconstruction/tauRecTools/tauRecTools/ITauVertexCorrection.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ITAUVERTEXCORRECTION_H -#define ITAUVERTEXCORRECTION_H - -#include "AsgTools/IAsgTool.h" - -#include "xAODTracking/VertexContainer.h" -#include "xAODPFlow/PFOContainer.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODTau/TauJet.h" - - -/** - * @brief Tool to perform the vertex correction for the tau candidate - */ - -class ITauVertexCorrection : virtual public asg::IAsgTool { - -public: - - ASG_TOOL_INTERFACE(ITauVertexCorrection) - - virtual ~ITauVertexCorrection() = default; - - virtual StatusCode initialize() = 0; - - /** Get the jet vertex */ - virtual const xAOD::Vertex* getJetVertex(const xAOD::Jet& jet) const = 0; - - /** Get the tau axis */ - virtual TLorentzVector getTauAxis(const xAOD::TauJet& tau) const = 0; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param cluster input cluster - * @param vertex the vertex of the tau candidate - * @param relativeVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const xAOD::Vertex* vertex, - const xAOD::Vertex* relativeVertex = nullptr) const = 0; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param pfo input PFO - * @param vertex the vertex of the tau candidate - * @param relativeVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::PFO& pfo, - const xAOD::Vertex* vertex, - const xAOD::Vertex* relativeVertex = nullptr) const = 0; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param constituent input constituent - * @param vertex the vertex of the tau candiate - * @param relativeVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::JetConstituent& constituent, - const xAOD::Vertex* vertex, - const xAOD::Vertex* relativeVertex = nullptr) const = 0; - -private: - - /**@brief Get the vertex corrected four momentum - * @param cluster input cluster - * @param position position of the vertex - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const Amg::Vector3D& position) const = 0; - - /**@brief Get the vertex corrected four momentum - * @param pfo input PFO - * @param position position of the vertex - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::PFO& pfo, - const Amg::Vector3D& position) const = 0; -}; - -#endif // ITAUVERTEXCORRECTION_H diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h index 5e07b0c4267553f576ad3d7871e2f3b46d212beb..a72ffba9df8a77c649aa951ebca0157679d354e9 100644 --- a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h @@ -6,30 +6,29 @@ #define TAURECTOOLSDEV_MVATESVARIABLEDECORATOR_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" #include "xAODEventInfo/EventInfo.h" #include "AsgDataHandles/ReadHandleKey.h" #include "AsgDataHandles/ReadDecorHandleKey.h" -#include "AsgTools/ToolHandle.h" -class MvaTESVariableDecorator -: public TauRecToolBase -{ - public: +class MvaTESVariableDecorator : public TauRecToolBase { + +public: ASG_TOOL_CLASS2( MvaTESVariableDecorator, TauRecToolBase, ITauToolBase ) MvaTESVariableDecorator(const std::string& name="MvaTESVariableDecorator"); - virtual ~MvaTESVariableDecorator(); + + virtual ~MvaTESVariableDecorator() = default; virtual StatusCode initialize() override; + virtual StatusCode execute(xAOD::TauJet& xTau) const override; - private: +private: - bool m_useSubtractedCluster; + bool m_doVertexCorrection; SG::ReadDecorHandleKey<xAOD::EventInfo> m_aveIntPerXKey {this, "averageInteractionsPerCrossingKey", @@ -40,10 +39,6 @@ class MvaTESVariableDecorator "Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; - - ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, - "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"}; }; - #endif // TAURECTOOLSDEV_MVATESVARIABLEDECORATOR_H diff --git a/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h b/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h index 1afa6101d677c0a839950f981f3c1f227d0e05b3..e6ebcde9fe96a14261455dc104fc35fa604505c7 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h @@ -13,32 +13,25 @@ #define TAUIDVARCALCULATOR_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" -#include "AsgTools/ToolHandle.h" -class TauIDVarCalculator: public TauRecToolBase -{ - ASG_TOOL_CLASS2(TauIDVarCalculator, TauRecToolBase, ITauToolBase) +class TauIDVarCalculator: public TauRecToolBase { - public: +public: + + ASG_TOOL_CLASS2(TauIDVarCalculator, TauRecToolBase, ITauToolBase) TauIDVarCalculator(const std::string& name = "TauIDVarCalculator"); - virtual ~TauIDVarCalculator() {} - - virtual StatusCode initialize() override; + virtual ~TauIDVarCalculator() = default; virtual StatusCode execute(xAOD::TauJet&) const override; static const float LOW_NUMBER; - - private: - bool m_useSubtractedCluster; +private: - ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, - "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"}; + bool m_doVertexCorrection; }; #endif diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNN.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNN.h index 6db5ee4a8cc2dae37ff19895d03244a02bad0c91..09b75c9ae152150002af34bc74c7d56ccd00164b 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNN.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNN.h @@ -5,12 +5,12 @@ #ifndef TAUREC_TAUJETRNN_H #define TAUREC_TAUJETRNN_H -#include <memory> +#include "xAODTau/TauJet.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include "AsgMessaging/AsgMessaging.h" -#include "xAODTau/TauJet.h" - +#include <memory> // Forward declaration namespace lwt { @@ -51,12 +51,12 @@ public: // Compute the signal probability in [0, 1] or a default value float compute(const xAOD::TauJet &tau, const std::vector<const xAOD::TauTrack *> &tracks, - const std::vector<const xAOD::CaloCluster *> &clusters) const; + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters) const; // Compute all input variables and store them in the maps that are passed by reference bool calculateInputVariables(const xAOD::TauJet &tau, const std::vector<const xAOD::TauTrack *> &tracks, - const std::vector<const xAOD::CaloCluster *> &clusters, + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters, std::map<std::string, std::map<std::string, double>>& scalarInputs, std::map<std::string, std::map<std::string, std::vector<double>>>& vectorInputs) const; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h index 0898241c9e7e993f79ffcb23c196666c90fd3b0e..cbca4bc20c0ad994ef60b7415b3059fa7677f0cb 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h @@ -6,11 +6,9 @@ #define TAUREC_TAUJETRNNEVALUATOR_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" #include "xAODTau/TauJet.h" - -#include "AsgTools/ToolHandle.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include <memory> @@ -40,14 +38,13 @@ public: const TauJetRNN* get_rnn_1p() const; const TauJetRNN* get_rnn_3p() const; -public: // Selects tracks to be used as input to the network StatusCode get_tracks(const xAOD::TauJet &tau, std::vector<const xAOD::TauTrack *> &out) const; // Selects clusters to be used as input to the network StatusCode get_clusters(const xAOD::TauJet &tau, - std::vector<const xAOD::CaloCluster *> &out) const; + std::vector<xAOD::CaloVertexedTopoCluster> &out) const; private: std::string m_output_varname; @@ -57,6 +54,7 @@ private: std::size_t m_max_tracks; std::size_t m_max_clusters; float m_max_cluster_dr; + bool m_doVertexCorrection; // Configuration of the weight file std::string m_input_layer_scalar; @@ -69,12 +67,6 @@ private: std::unique_ptr<TauJetRNN> m_net_0p; //! std::unique_ptr<TauJetRNN> m_net_1p; //! std::unique_ptr<TauJetRNN> m_net_3p; //! - - bool m_useSubtractedCluster; - - ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, - "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"}; }; - #endif // TAUREC_TAUJETRNNEVALUATOR_H diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h index f53752499a62b0af53fbe6fb975fb8a0749940b3..5de645b43206576924d9a67fe3bac104d92c4e26 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h @@ -5,11 +5,12 @@ #ifndef TAUREC_TAUJETRNNUTILS_H #define TAUREC_TAUJETRNNUTILS_H -#include <unordered_map> +#include "xAODTau/TauJet.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include "AsgMessaging/AsgMessaging.h" -#include "xAODTau/TauJet.h" +#include <unordered_map> namespace TauJetRNNUtils { @@ -34,7 +35,7 @@ public: double &); using ClusterCalc = bool (*)(const xAOD::TauJet &, - const xAOD::CaloCluster &, double &); + const xAOD::CaloVertexedTopoCluster &, double &); public: VarCalc(); @@ -52,7 +53,7 @@ public: // Computes cluster variables bool compute(const std::string &name, const xAOD::TauJet &tau, - const std::vector<const xAOD::CaloCluster *> &clusters, + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters, std::vector<double> &out) const; // Methods to insert calculator functions into the lookup table @@ -176,29 +177,29 @@ namespace Cluster { // Returns a status code indicating success bool et_log( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool pt_jetseed_log( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool dEta( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool dPhi( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool SECOND_R( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool SECOND_LAMBDA( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool CENTER_LAMBDA( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); -bool SECOND_LAMBDAOverClustersMeanSecondLambda (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); -bool CENTER_LAMBDAOverClustersMeanCenterLambda (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); -bool FirstEngDensOverClustersMeanFirstEngDens (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); +bool SECOND_LAMBDAOverClustersMeanSecondLambda (const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); +bool CENTER_LAMBDAOverClustersMeanCenterLambda (const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); +bool FirstEngDensOverClustersMeanFirstEngDens (const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); } // namespace Cluster } // namespace Variables diff --git a/Reconstruction/tauRecTools/tauRecTools/TauVertexCorrection.h b/Reconstruction/tauRecTools/tauRecTools/TauVertexCorrection.h deleted file mode 100644 index 4b4d53d4bcaedfdfd62923bd825a272d2cc3b34e..0000000000000000000000000000000000000000 --- a/Reconstruction/tauRecTools/tauRecTools/TauVertexCorrection.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TAUVERTEXCORRECTION_H -#define TAUVERTEXCORRECTION_H - -#include "tauRecTools/ITauVertexCorrection.h" - -#include "AsgTools/AsgTool.h" -#include "AsgDataHandles/ReadHandleKey.h" - -/** - * @brief Tool to perform the vertex correction for the tau candidate - * @author Xiaozhong Huang <xiaozhong.huang@cern.ch> - */ - -class TauVertexCorrection : public asg::AsgTool, virtual public ITauVertexCorrection { - -public: - - ASG_TOOL_INTERFACE(TauVertexCorrection) - ASG_TOOL_CLASS1(TauVertexCorrection, ITauVertexCorrection) - - TauVertexCorrection(const std::string& name); - virtual ~TauVertexCorrection() = default; - - virtual StatusCode initialize() override; - - /** Get the jet vertex */ - virtual const xAOD::Vertex* getJetVertex(const xAOD::Jet& jet) const override; - - /** Get the tau axis */ - virtual TLorentzVector getTauAxis(const xAOD::TauJet& tau) const override; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param cluster input cluster - * @param tauVertex the vertex of the tau candidate - * @param jetVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex = nullptr) const override; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param pfo input PFO - * @param tauVertex the vertex of the tau candidate - * @param jetVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::PFO& pfo, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex = nullptr) const override; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param constituent input constituent - * @param tauVertex the vertex of the tau candiate - * @param jetVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::JetConstituent& constituent, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex = nullptr) const override; - -private: - - /**@brief Get the vertex corrected four momentum - * @param cluster input cluster - * @param position position of the vertex - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const Amg::Vector3D& position) const override; - - /**@brief Get the vertex corrected four momentum - * @param pfo input PFO - * @param position position of the vertex - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::PFO& pfo, - const Amg::Vector3D& position) const override; - - /// Name of the seed jet - std::string m_seedJet; - - /// Switch of the tau vertex correction - bool m_doVertexCorrection; - - /// Switch of the jet vertex correction - bool m_doJetVertexCorrection; - - /// Whehter the seed jet is PFO - bool m_isPFO = false; //! - - /// Calibration state of cluster - xAOD::CaloCluster::State m_clusterState; //! - -}; - -#endif // ITAUVERTEXCORRECTION_H diff --git a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py index 8fd01362166d534ea16bf1ea0c189553637df7c4..335f740404724062ff38a12a2ee9ec842aebd486 100644 --- a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py +++ b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py @@ -51,30 +51,6 @@ def getAtlasExtrapolator(): cached_instances[_name] = theAtlasExtrapolator return theAtlasExtrapolator -######################################################################## -def getTauVertexCorrection(): - from tauRec.tauRecFlags import tauFlags - from tauRecTools.tauRecToolsConf import TauVertexCorrection - - _name = sPrefix + 'TauVertexCorrection' - - if _name in cached_instances: - return cached_instances[_name] - - # FIXME:doJetVertexCorrection need to be False even though origin correction - # is turned on in jet reconstruction. - # If the seed jet is PFlow jets, then the tau axis will be corrected to point - # at PV0, but the clusters will not be corrected. - - doJetVertexCorrection = False - - myTauVertexCorrection = TauVertexCorrection(name = _name, - SeedJet = tauFlags.tauRecSeedJetCollection(), - VertexCorrection = doVertexCorrection, - JetVertexCorrection = doJetVertexCorrection) - - cached_instances[_name] = myTauVertexCorrection - return myTauVertexCorrection # JetSeedBuilder def getJetSeedBuilder(): @@ -142,7 +118,7 @@ def getMvaTESVariableDecorator(): from AthenaCommon.AppMgr import ToolSvc from tauRecTools.tauRecToolsConf import MvaTESVariableDecorator MvaTESVariableDecorator = MvaTESVariableDecorator(name = _name, - TauVertexCorrection = getTauVertexCorrection()) + VertexCorrection = doVertexCorrection) MvaTESVariableDecorator.Key_vertexInputContainer = "" @@ -179,7 +155,6 @@ def getCellVariables(cellConeSize=0.2): from tauRecTools.tauRecToolsConf import TauCellVariables TauCellVariables = TauCellVariables(name = _name, - CellEthreshold = 0.2*GeV, StripEthreshold = 0.2*GeV, CellCone = cellConeSize, VertexCorrection = doVertexCorrection) @@ -419,87 +394,6 @@ def getCellWeightTool(): cached_instances[_name] = CaloWeightTool return CaloWeightTool -######################################################################### -# Bonn Pi0 algo -# Cluster finder for Pi0 algo -def getBonnPi0ClusterFinder(): - _name = sPrefix + 'BonnPi0ClusterFinder' - - if _name in cached_instances: - return cached_instances[_name] - - from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool - TauCellContainerFinalizer = CaloCellContainerFinalizerTool(name=sPrefix+'tauPi0CellContainerFinalizer') - - from AthenaCommon.AppMgr import ToolSvc - ToolSvc += TauCellContainerFinalizer - - from tauRecTools.tauRecToolsConf import TauPi0BonnCreateROI - TauPi0BonnCreateROI = TauPi0BonnCreateROI(name = _name, - CaloWeightTool = getCellWeightTool(), - CellMakerTool = TauCellContainerFinalizer, - #LonParFile = "longitudinal_para.dat", - #LatParFile = "lateral_para.dat", - LatParFile = "lateral_para.root", - #OriginCorrectionTool = getTauCellCorrection(), - ChargedPFOContainerName = 'TauPi0BonnChargedPFOContainer', - ) - - cached_instances[_name] = TauPi0BonnCreateROI - return TauPi0BonnCreateROI - -##################### -# create Pi0 clusters -def getBonnPi0ClusterCreator(): - _name = sPrefix + 'BonnPi0ClusterCreator' - - if _name in cached_instances: - return cached_instances[_name] - - from tauRecTools.tauRecToolsConf import TauPi0BonnClusterCreator - TauPi0BonnClusterCreator = TauPi0BonnClusterCreator(name = _name, - InputPi0ClusterContainerName = 'TauPi0BonnSubtractedClusterContainer', - OutputPi0ClusterContainerName = 'TauPi0BonnClusterContainer', - NeutralPFOContainerName= 'TauPi0BonnNeutralPFOContainer', - ) - - cached_instances[_name] = TauPi0BonnClusterCreator - return TauPi0BonnClusterCreator - -##################### -# calculate MVA scores of pi0 clusters -def getPi0BonnScoreCalculator(): - _name = sPrefix + 'BonnPi0ScoreCalculator' - - if _name in cached_instances: - return cached_instances[_name] - - from tauRecTools.tauRecToolsConf import TauPi0BonnScoreCalculator - TauPi0BonnScoreCalculator = TauPi0BonnScoreCalculator(name = _name, - ReaderOption = 'Silent:!Color', - BDTWeightFile = 'TauPi0BonnBDTWeights.xml', - ) - - cached_instances[_name] = TauPi0BonnScoreCalculator - return TauPi0BonnScoreCalculator - -##################### -# select pi0 clusters -def getPi0BonnSelector(): - _name = sPrefix + 'BonnPi0Selector' - - if _name in cached_instances: - return cached_instances[_name] - - from tauRecTools.tauRecToolsConf import TauPi0BonnSelector - TauPi0BonnSelector = TauPi0BonnSelector(name = _name, - ClusterEtCut = (2100.*MeV,2500.*MeV,2600.*MeV,2400.*MeV,1900.*MeV), - ClusterBDTCut_1prong = (0.46,0.39,0.51,0.47,0.54), - ClusterBDTCut_mprong = (0.47,0.52,0.60,0.55,0.50), - ) - - cached_instances[_name] = TauPi0BonnSelector - return TauPi0BonnSelector ######################################################################### # Photon Shot Finder algo @@ -796,7 +690,7 @@ def getTauIDVarCalculator(): from AthenaCommon.AppMgr import ToolSvc from tauRecTools.tauRecToolsConf import TauIDVarCalculator TauIDVarCalculator = TauIDVarCalculator(name=_name, - TauVertexCorrection=getTauVertexCorrection()) + VertexCorrection = doVertexCorrection) ToolSvc += TauIDVarCalculator cached_instances[_name] = TauIDVarCalculator @@ -844,12 +738,12 @@ def getTauJetRNNEvaluator(NetworkFile0P="", NetworkFile1P="", NetworkFile3P="", MaxTracks=MaxTracks, MaxClusters=MaxClusters, MaxClusterDR=MaxClusterDR, + VertexCorrection=doVertexCorrection, InputLayerScalar=InputLayerScalar, InputLayerTracks=InputLayerTracks, InputLayerClusters=InputLayerClusters, OutputLayer=OutputLayer, - OutputNode=OutputNode, - TauVertexCorrection=getTauVertexCorrection()) + OutputNode=OutputNode) ToolSvc += TauJetRNNEvaluator cached_instances[_name] = TauJetRNNEvaluator diff --git a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMerged.cxx b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMerged.cxx index 78333bc108cb99c2cc5f91b691795743b5437925..7b615deee6f4697c90b7aced4d47e1e6e8d3b748 100755 --- a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMerged.cxx +++ b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMerged.cxx @@ -41,6 +41,7 @@ #include "xAODTau/TauDefs.h" #include "xAODTau/TauTrackContainer.h" #include "xAODTau/TauTrackAuxContainer.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include "LumiBlockComps/ILumiBlockMuTool.h" @@ -845,7 +846,7 @@ HLT::ErrorCode TrigTauRecMerged::hltExecute(const HLT::TriggerElement* inputTE, std::map<std::string, std::map<std::string, std::vector<double>> > rnn_vector; std::vector<const xAOD::TauTrack *> tracks; - std::vector<const xAOD::CaloCluster *> clusters; + std::vector<xAOD::CaloVertexedTopoCluster> clusters; // TODO: these lines are commented out since the check returns "StatusCode", while "HLT::ErrorCode" is expected. This means no cluster or track variables are monitored //ATH_CHECK(m_rnn_evaluator->get_tracks(*p_tau, tracks)); //ATH_CHECK(m_rnn_evaluator->get_clusters(*p_tau, clusters));