diff --git a/Event/xAOD/xAODJet/Root/JetContainerInfo.cxx b/Event/xAOD/xAODJet/Root/JetContainerInfo.cxx index cb57358b46b81cce2c5d39dcf2e75a8d57671004..1a8895d64b030b1054c6235b6025a282655dac45 100644 --- a/Event/xAOD/xAODJet/Root/JetContainerInfo.cxx +++ b/Event/xAOD/xAODJet/Root/JetContainerInfo.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 */ #include "xAODJet/JetContainerInfo.h" @@ -74,28 +74,63 @@ namespace xAOD { static bool inited = false; if(inited) return; // name in the atlas convention - nameToTypemap["LCTopo"] = LCTopo; - nameToTypemap["EMTopo"] = EMTopo; - nameToTypemap["LCTopoOrigin"] = LCTopoOrigin; - nameToTypemap["EMTopoOrigin"] = EMTopoOrigin; - nameToTypemap["TopoTower"] = TopoTower; - nameToTypemap["Tower"] = Tower; - nameToTypemap["Truth"] = Truth; - nameToTypemap["TruthWZ"] = TruthWZ; - nameToTypemap["Track"] = Track; - nameToTypemap["PFlow"] = PFlow; - nameToTypemap["LCPFlow"] = LCPFlow; - nameToTypemap["EMPFlow"] = EMPFlow; - nameToTypemap["EMCPFlow"] = EMCPFlow; - nameToTypemap["TrackCaloCluster"] = TrackCaloCluster; - nameToTypemap[c_unCategorized] = Uncategorized; - + nameToTypemap["LCTopo"] = LCTopo; + nameToTypemap["EMTopo"] = EMTopo; + nameToTypemap["LCTopoOrigin"] = LCTopoOrigin; + nameToTypemap["EMTopoOrigin"] = EMTopoOrigin; + nameToTypemap["TopoTower"] = TopoTower; + nameToTypemap["Tower"] = Tower; + nameToTypemap["Truth"] = Truth; + nameToTypemap["TruthWZ"] = TruthWZ; + nameToTypemap["TruthDressedWZ"] = TruthDressedWZ; + nameToTypemap["TruthCharged"] = TruthCharged; + nameToTypemap["Track"] = Track; + nameToTypemap["PFlow"] = PFlow; + nameToTypemap["LCPFlow"] = LCPFlow; + nameToTypemap["EMPFlow"] = EMPFlow; + nameToTypemap["EMCPFlow"] = EMCPFlow; + nameToTypemap["TrackCaloCluster"] = TrackCaloCluster; + nameToTypemap["EMTopoOriginSK"] = EMTopoOriginSK; + nameToTypemap["EMTopoOriginCS"] = EMTopoOriginCS; + nameToTypemap["EMTopoOriginCSSK"] = EMTopoOriginCSSK; + nameToTypemap["EMTopoOriginVorSK"] = EMTopoOriginVorSK; + nameToTypemap["EMTopoOriginTime"] = EMTopoOriginTime; + nameToTypemap["EMTopoOriginSKTime"] = EMTopoOriginSKTime; + nameToTypemap["EMTopoOriginCSSKTime"] = EMTopoOriginCSSKTime; + nameToTypemap["EMTopoOriginVorSKTime"] = EMTopoOriginVorSKTime; + nameToTypemap["LCTopoOriginSK"] = LCTopoOriginSK; + nameToTypemap["LCTopoOriginCS"] = LCTopoOriginCS; + nameToTypemap["LCTopoOriginCSSK"] = LCTopoOriginCSSK; + nameToTypemap["LCTopoOriginVorSK"] = LCTopoOriginVorSK; + nameToTypemap["EMPFlowSK"] = EMPFlowSK; + nameToTypemap["EMPFlowCS"] = EMPFlowCS; + nameToTypemap["EMPFlowCSSK"] = EMPFlowCSSK; + nameToTypemap["EMPFlowVorSK"] = EMPFlowVorSK; + nameToTypemap["EMPFlowTime"] = EMPFlowTime; + nameToTypemap["EMPFlowSKTime"] = EMPFlowSKTime; + nameToTypemap["EMPFlowCSSKTime"] = EMPFlowCSSKTime; + nameToTypemap["EMPFlowVorSKTime"] = EMPFlowVorSKTime; + nameToTypemap[c_unCategorized] = Uncategorized; std::map<std::string, Type>::iterator it = nameToTypemap.begin(); std::map<std::string, Type>::iterator itE = nameToTypemap.end(); for( ; it!=itE; ++it) typeToNamemap[ it->second ] = it->first; } + bool isValidConstitType(Type t) { + const static std::unordered_set<Type> validJetContitTypes = { LCTopo, EMTopo, + LCTopoOrigin, EMTopoOrigin, EMTopoOriginTime, + LCTopoOriginSK, EMTopoOriginSK, EMTopoOriginSKTime, + LCTopoOriginCS, EMTopoOriginCS, + LCTopoOriginVor, EMTopoOriginVor, + LCTopoOriginCSSK, EMTopoOriginCSSK, EMTopoOriginCSSKTime, + LCTopoOriginVorSK, EMTopoOriginVorSK, EMTopoOriginVorSKTime, + EMPFlowSK, EMPFlowSKTime, + EMPFlowCS, EMPFlowCSSK, EMPFlowCSSKTime, + EMPFlowVor, EMPFlowVorSK, EMPFlowVorSKTime + }; + return validJetContitTypes.count(t)==1; + } const std::string & typeName(Type id){ initMap(); diff --git a/Event/xAOD/xAODJet/xAODJet/JetContainerInfo.h b/Event/xAOD/xAODJet/xAODJet/JetContainerInfo.h index 8061513a23a95cdd216c707514a4f1ca0cde6b1f..f9ab2af4f4bc666aeb5cf988121fa1b5838113b5 100644 --- a/Event/xAOD/xAODJet/xAODJet/JetContainerInfo.h +++ b/Event/xAOD/xAODJet/xAODJet/JetContainerInfo.h @@ -1,7 +1,7 @@ // 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 */ #ifndef XAODJET_JETALGORITHMTYPE_H @@ -17,6 +17,7 @@ /// /////////////////////////////// #include <string> +#include <unordered_set> namespace xAOD { @@ -66,9 +67,36 @@ namespace xAOD { LCTopoOrigin, EMTopoOrigin, TrackCaloCluster, + TruthDressedWZ, // Truth jets without prompt e/mu (or dressed photons) or prompt gammas + EMTopoOriginSK, + EMTopoOriginCS, + EMTopoOriginVor, + EMTopoOriginCSSK, + EMTopoOriginVorSK, + LCTopoOriginSK, + LCTopoOriginCS, + LCTopoOriginVor, + LCTopoOriginCSSK, + LCTopoOriginVorSK, + EMPFlowSK, + EMPFlowCS, + EMPFlowVor, + EMPFlowCSSK, + EMPFlowVorSK, + TruthCharged, // Truth jets with only charged particles + EMTopoOriginTime, + EMTopoOriginSKTime, + EMTopoOriginCSSKTime, + EMTopoOriginVorSKTime, + EMPFlowTime, + EMPFlowSKTime, + EMPFlowCSSKTime, + EMPFlowVorSKTime, Other = 100, Uncategorized= 1000 }; + + bool isValidConstitType(Type t); const std::string& typeName(Type t); diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetConstitFourMomTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetConstitFourMomTool.cxx index cff4cd021939085fd2bbee50fa1282f89f3a5c4d..d52eb13aa4d908e67cb69e306a023ce26182654a 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetConstitFourMomTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetConstitFourMomTool.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 */ // JetConstitFourMomTool.cxx @@ -93,8 +93,7 @@ int JetConstitFourMomTool::modify(xAOD::JetContainer& jets) const { // if(!m_altColls[iScale].empty()) { // retrieve alternate constituent collections if(!m_altColls_keys[iScale].key().empty()) { // retrieve alternate constituent collections const xAOD::Jet& leadjet = *jets.front(); - if(leadjet.getInputType()==xAOD::JetInput::LCTopo || leadjet.getInputType()==xAOD::JetInput::EMTopo - || leadjet.getInputType()==xAOD::JetInput::LCTopoOrigin || leadjet.getInputType()==xAOD::JetInput::EMTopoOrigin) { + if(isValidConstitType(leadjet.getInputType())) { auto handle = SG::makeHandle(m_altColls_keys[iScale]); if(!handle.isValid()){ diff --git a/Reconstruction/Jet/JetRec/Root/JetFromPseudojet.cxx b/Reconstruction/Jet/JetRec/Root/JetFromPseudojet.cxx index 03dd6d3ce91ee10325d4be5774c25190a848be55..19e2acb79c408a9c788f1f288053272140bf305d 100644 --- a/Reconstruction/Jet/JetRec/Root/JetFromPseudojet.cxx +++ b/Reconstruction/Jet/JetRec/Root/JetFromPseudojet.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 */ // JetFromPseudojet.cxx @@ -70,11 +70,7 @@ buildAndSetEMScaleMom(xAOD::Jet* jet, // If constituents are already uncalibrated, the momentum is the same. jet->setJetP4(xAOD::JetEMScaleMomentum, jet->jetP4()); ATH_MSG_DEBUG(" EM scale momentum set to jet scale"); - } else if ( (inputtype == xAOD::JetInput::EMTopoOrigin) || - (inputtype == xAOD::JetInput::LCTopoOrigin) || - (inputtype == xAOD::JetInput::LCTopo) || - (inputtype == xAOD::JetInput::LCPFlow)|| - (inputtype == xAOD::JetInput::EMCPFlow) ) { + } else if (isValidConstitType(inputtype) || (inputtype == xAOD::JetInput::LCPFlow) || (inputtype == xAOD::JetInput::EMCPFlow)) { // fetch and sum the uncalibrated constituent momenta xAOD::JetConstituentVector vec = jet->getConstituents(); if(! vec.isValid() ) { diff --git a/Reconstruction/Jet/JetRecTools/JetRecTools/ConstitTimeCutTool.h b/Reconstruction/Jet/JetRecTools/JetRecTools/ConstitTimeCutTool.h index 0951cc4dc134b2fb0c33eee432feaeb412cb1794..fda1903b5b86eac51a2c9b94465ff12c8f90bfa7 100644 --- a/Reconstruction/Jet/JetRecTools/JetRecTools/ConstitTimeCutTool.h +++ b/Reconstruction/Jet/JetRecTools/JetRecTools/ConstitTimeCutTool.h @@ -1,3 +1,7 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + #ifndef JETRECTOOLS_CONSTITTIMECUTTOOL_H #define JETRECTOOLS_CONSTITTIMECUTTOOL_H @@ -25,7 +29,7 @@ class ConstitTimeCutTool : public JetConstituentModifierBase{ private: StatusCode process_impl(xAOD::IParticleContainer* cont) const; - StatusCode applyTimingCut(xAOD::IParticle* part, float time) const; + StatusCode applyTimingCut(xAOD::IParticle* part, const float& time, const float& quality, const float& lambda_center) const; // Properties. float m_lambdaCalDivide; @@ -34,6 +38,7 @@ class ConstitTimeCutTool : public JetConstituentModifierBase{ float m_timeCutSmallQ; float m_etaMax; + bool m_ignoreChargedPFOs; }; diff --git a/Reconstruction/Jet/JetRecTools/Root/ConstitTimeCutTool.cxx b/Reconstruction/Jet/JetRecTools/Root/ConstitTimeCutTool.cxx index 6d5a24e2af705a87aeaaad901a5ff0134b70bcbd..c8ea2582d7efb8d51adab131b7921deb61c57899 100644 --- a/Reconstruction/Jet/JetRecTools/Root/ConstitTimeCutTool.cxx +++ b/Reconstruction/Jet/JetRecTools/Root/ConstitTimeCutTool.cxx @@ -1,7 +1,12 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + #include <vector> #include "JetRecTools/ConstitTimeCutTool.h" #include "xAODCaloEvent/CaloClusterContainer.h" #include "xAODPFlow/PFOContainer.h" +#include "xAODPFlow/PFODefs.h" using namespace std; @@ -13,6 +18,9 @@ ConstitTimeCutTool::ConstitTimeCutTool(const std::string& name) : JetConstituent declareProperty("TimeCutLargeQ", m_timeCutLargeQ = 5); declareProperty("TimeCutSmallQ", m_timeCutSmallQ = 15); declareProperty("MaxEtaForCut", m_etaMax = 2.5); + + declareProperty("IgnoreChargedPFO", m_ignoreChargedPFOs); + } StatusCode ConstitTimeCutTool::initialize() { @@ -22,6 +30,12 @@ StatusCode ConstitTimeCutTool::initialize() { ATH_MSG_ERROR("Incompatible configuration: ApplyToNeutralPFO=False -- what kind of pileup do you wish to suppress?"); return StatusCode::FAILURE; } + else if(m_ignoreChargedPFOs && m_applyToChargedPFO) { + ATH_MSG_ERROR("Incompatible configuration: setting both IgnoreChargedPFO and ApplyToChargedPFO to true" + << "will set all cPFOs to zero"); + return StatusCode::FAILURE; + } + } else { if(m_inputType!=xAOD::Type::CaloCluster) { ATH_MSG_ERROR("Incompatible configuration: ConstitTimeCutTool is not specialised for inputs of type " @@ -38,10 +52,13 @@ StatusCode ConstitTimeCutTool::process_impl(xAOD::IParticleContainer* cont) cons switch(m_inputType) { case xAOD::Type::CaloCluster: { - xAOD::CaloClusterContainer* clusters = static_cast<xAOD::CaloClusterContainer*> (cont); - for(xAOD::CaloCluster* cl : *clusters) { - float time = cl->time(); - ATH_CHECK( applyTimingCut(cl, time) ); + xAOD::CaloClusterContainer* clusters = static_cast<xAOD::CaloClusterContainer*> (cont); + const static SG::AuxElement::ConstAccessor<float> acc_larq("AVG_LAR_Q"); + const static SG::AuxElement::ConstAccessor<float> acc_clambda("CENTER_LAMBDA"); + + for(xAOD::CaloCluster* cl : *clusters) { + //quality is on [0,2^16-1] scale + ATH_CHECK( applyTimingCut(cl, cl->time(), acc_larq(*cl)/65535, acc_clambda(*cl))); } } break; @@ -49,13 +66,19 @@ StatusCode ConstitTimeCutTool::process_impl(xAOD::IParticleContainer* cont) cons { xAOD::PFOContainer* pfos = static_cast<xAOD::PFOContainer*> (cont); for(xAOD::PFO* pfo : *pfos) { - if(fabs(pfo->charge())<FLT_MIN) { // only apply to neutrals - float time(0); + if(fabs(pfo->charge())<FLT_MIN || m_applyToChargedPFO) { // only apply to neutrals if m_applyToChargedPFO is false. If m_applyToChargedPFO is true then apply to all POs. + float time(0.); + float quality(0.); + float lambda_center(0.); // Only apply cut if retrieval succeeded, else warn - if(pfo->attribute<float>(xAOD::PFODetails::eflowRec_TIMING,time)) { - ATH_CHECK( applyTimingCut(pfo, time) ); + if(pfo->attribute(xAOD::PFODetails::eflowRec_TIMING,time) && + pfo->attribute(xAOD::PFODetails::eflowRec_AVG_LAR_Q,quality) && + pfo->attribute(xAOD::PFODetails::eflowRec_CENTER_LAMBDA,lambda_center) + ) { + //quality is on [0,2^16-1] scale + ATH_CHECK( applyTimingCut(pfo, time, quality/65535, lambda_center) ); } else { - ATH_MSG_WARNING("Failed to retrieve PFO timing for PFO #" << pfo->index()); + ATH_MSG_WARNING("Failed to retrieve the PFO informations necessary for timing cut at PFO #" << pfo->index()); } } } @@ -71,14 +94,8 @@ StatusCode ConstitTimeCutTool::process_impl(xAOD::IParticleContainer* cont) cons } -StatusCode ConstitTimeCutTool::applyTimingCut(xAOD::IParticle* part, float time) const { - const static SG::AuxElement::ConstAccessor<float> acc_larq("AVG_LAR_Q"); - const static SG::AuxElement::ConstAccessor<float> acc_clambda("CENTER_LAMBDA"); - +StatusCode ConstitTimeCutTool::applyTimingCut(xAOD::IParticle* part, const float& time, const float& quality, const float& lambda_center) const { if(abs( part->eta() ) < m_etaMax){ - //quality is on [0,2^16-1] scale - float quality = acc_larq(*part) / 65535; - float lambda_center = acc_clambda(*part); // Only apply to ECal by default (with depth cut) // Should switch to a test on the dominant sampling?? @@ -86,7 +103,7 @@ StatusCode ConstitTimeCutTool::applyTimingCut(xAOD::IParticle* part, float time) // Apply variable timing cut based on he cluster quality // -- a larger spread is observed for clusters with small Q float timeCut = quality > m_qualityCut ? m_timeCutLargeQ : m_timeCutSmallQ; - if( abs(time) > timeCut ) {setEnergyPt( part, 0., 0. );} + if( abs(time) > timeCut ) { ATH_CHECK( setEnergyPt( part, 0., 0. )); } } } diff --git a/Reconstruction/MET/METReconstruction/python/METAssocConfig.py b/Reconstruction/MET/METReconstruction/python/METAssocConfig.py index 9320d10c24d4ef5b4cde7f49fe963a4775ad0007..4e217139083f6ded89158e5d0d48aa4224d7bbe0 100644 --- a/Reconstruction/MET/METReconstruction/python/METAssocConfig.py +++ b/Reconstruction/MET/METReconstruction/python/METAssocConfig.py @@ -1,8 +1,7 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - - +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from AthenaCommon import CfgMgr +from GaudiKernel.Constants import INFO ################################################################################# # Define some default values @@ -195,7 +194,7 @@ class METAssocConfig: self.setupAssociators(buildconfigs) # Set up a top-level tool with mostly defaults -def getMETAssocTool(topconfig): +def getMETAssocTool(topconfig,msglvl): assocTool = None from METReconstruction.METRecoFlags import metFlags if topconfig.doTruth: @@ -211,13 +210,14 @@ def getMETAssocTool(topconfig): METAssociators = topconfig.assoclist, METSuffix = topconfig.suffix, TCSignalState=tcstate, - TimingDetail=0) + TimingDetail=0, + OutputLevel=msglvl) if metFlags.AllowOverwrite: assocTool.AllowOverwrite = True return assocTool # Allow user to configure reco tools directly or get more default configurations -def getMETAssocAlg(algName='METAssociation',configs={},tools=[]): +def getMETAssocAlg(algName='METAssociation',configs={},tools=[],msglvl=INFO): assocTools = [] assocTools += tools @@ -229,7 +229,7 @@ def getMETAssocAlg(algName='METAssociation',configs={},tools=[]): print configs for key,conf in configs.iteritems(): print prefix, 'Generate METAssocTool for MET_'+key - assoctool = getMETAssocTool(conf) + assoctool = getMETAssocTool(conf,msglvl) assocTools.append(assoctool) metFlags.METAssocTools()[key] = assoctool