diff --git a/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py b/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py index 727e82cd76996a9682d7375a9bdf3bd2925af53a..464ba9a6138146b5d1689b34902846dfaf5a314a 100644 --- a/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py +++ b/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py @@ -24,23 +24,23 @@ all = ['getJetCalibTool'] pflowcontexts = { "T0":("JES_MC15cRecommendation_PFlow_Aug2016_rel21.config","00-04-77","JetArea_Residual_EtaJES"), # Omit smearing, to avoid any efficiency loss - "AnalysisLatest":("JES_data2017_2016_2015_Consolidated_PFlow_2018_Rel21.config","00-04-82","JetArea_Residual_EtaJES_GSC"), + "AnalysisLatest":("JES_data2017_2016_2015_Consolidated_PFlow_2018_Rel21.config","00-04-82","JetArea_Residual_EtaJES_GSC_InSitu"), } topocontexts = { "T0":("JES_MC15cRecommendation_May2016_rel21.config","00-04-77","JetArea_Residual_EtaJES"), # Placeholder from a vague approximation of the 2017 setup? - "Trigger":("JES_MC15cRecommendation_May2016_Trigger.config","00-04-77","JetArea_Residual_EtaJES"), + "Trigger":("JES_MC15cRecommendation_May2016_Trigger.config","00-04-77","JetArea_Residual_EtaJES_InSitu"), # Omit smearing, to avoid any efficiency loss - "AnalysisLatest":("JES_data2017_2016_2015_Consolidated_EMTopo_2018_Rel21.config","00-04-82","JetArea_Residual_EtaJES_GSC"), + "AnalysisLatest":("JES_data2017_2016_2015_Consolidated_EMTopo_2018_Rel21.config","00-04-82","JetArea_Residual_EtaJES_GSC_InSitu"), } rscanlc2 = { - "RScanLatest":("JES_MC16Recommendation_Rscan2LC_22Feb2018_rel21.config","00-04-81","JetArea_Residual_EtaJES_GSC") + "RScanLatest":("JES_MC16Recommendation_Rscan2LC_22Feb2018_rel21.config","00-04-81","JetArea_Residual_EtaJES_GSC_InSitu") } rscanlc6 = { - "RScanLatest":("JES_MC16Recommendation_Rscan6LC_22Feb2018_rel21.config","00-04-81","JetArea_Residual_EtaJES_GSC") + "RScanLatest":("JES_MC16Recommendation_Rscan6LC_22Feb2018_rel21.config","00-04-81","JetArea_Residual_EtaJES_GSC_InSitu") } fatjetcontexts = { @@ -95,12 +95,15 @@ def getJetCalibTool(jetcollection, context, data_type, calibseq = ""): try: configfile, calibarea, calibseq_def = jetcontexts[context] calibseq_tmp = calibseq if calibseq else calibseq_def - if data_type == 'data' and calibseq_tmp.endswith("GSC") and jetcollection in hasInSitu: - if calibseq_tmp == calibseq_def: - calibseq_tmp += "_InSitu" - # May not be strictly necessary if already checked in JCT - elif not calibseq_tmp.endswith("InSitu"): - jetcaliblog.warning("Calibration of jets requested in data without in situ calibration.") + # Check that the calib sequence requests something sensible for the in situ calibration + # Leave other checks for the tool code. + # Might need to specialise if we decide MC trigger jets should also have in situ. + if calibseq_tmp.endswith("InSitu"): + if data_type == 'data': + if not jetcollection in hasInSitu: + raise ValueError("In situ calibration does not exist for {0}, context {1}".format(jetcollection,context)) + else: + raise ValueError("In situ calibration requested for MC on {0}, context {1}".format(jetcollection,context)) configfile_tmp = configfile if data_type == "afii" and jetcollection in af2configs.keys(): configfile_tmp = af2configs[jetcollection] diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetConstitFourMomTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetConstitFourMomTool.cxx index 04bb13d1b49e03d17e4291aef1c1018611ec2ad3..c34e88a44ca9f41e8609dc9f18da9eb8c04162e1 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetConstitFourMomTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetConstitFourMomTool.cxx @@ -119,13 +119,15 @@ int JetConstitFourMomTool::modify(xAOD::JetContainer& jets) const { citer != constituents.end(constscale); ++citer) { for (size_t iScale=0; iScale<nScales; ++iScale) { // If altJetScales is set, do nothing in the constituent loop. - if(m_altJetScales.empty()) { + if(m_altJetScales[iScale].empty()) { if(altCollections[iScale]) { // get the index-parallel alternative constituent const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>((*altCollections[iScale])[(*citer)->rawConstituent()->index()]); - xAOD::CaloCluster::State currentState= static_cast<xAOD::CaloCluster::State> (m_altConstitScales[iScale]); - constitFourVecs[iScale] += xAOD::JetFourMom_t( cluster->pt(currentState), cluster->eta(currentState), - cluster->phi(currentState), cluster->m(currentState) ); + xAOD::CaloCluster::State currentState= static_cast<xAOD::CaloCluster::State> (m_altConstitScales[iScale]); + constitFourVecs[iScale] += xAOD::JetFourMom_t( cluster->pt(currentState), cluster->eta(currentState), + cluster->phi(currentState), cluster->m(currentState) ); + ATH_MSG_VERBOSE("Add cluster with pt " << cluster->pt() << " to constit fourvec for scale " << m_jetScaleNames[iScale] ); } else { // add the constituent 4-mom + ATH_MSG_VERBOSE("Add raw constituent with pt " << (*citer)->pt() << " to constit fourvec for scale " << m_jetScaleNames[iScale] ); constitFourVecs[iScale] += **citer; } } @@ -133,16 +135,26 @@ int JetConstitFourMomTool::modify(xAOD::JetContainer& jets) const { } // loop over clusters // Now we can set the scales from the various four-vecs we have calculated + ATH_MSG_VERBOSE("Jet has " + << " pt: " << jet->pt() + << ", eta: " << jet->eta() + << ", phi: " << jet->phi()); for (size_t iScale=0; iScale<nScales; ++iScale) { - if(m_altJetScales.empty()) { + if(!m_altJetScales[iScale].empty()) { // Easy case first -- just copy the momentum state constitFourVecs[iScale] = jet->jetP4(m_altJetScales[iScale]); } + ATH_MSG_VERBOSE("Scale " << m_jetScaleNames[iScale] << " has " + << " pt: " << constitFourVecs[iScale].Pt() + << ", eta: " << constitFourVecs[iScale].Eta() + << ", phi: " << constitFourVecs[iScale].Phi()); if(m_isDetectorEtaPhi[iScale]) { const static SG::AuxElement::Accessor<float> acc_modEta("DetectorEta"); const static SG::AuxElement::Accessor<float> acc_modPhi("DetectorPhi"); acc_modEta(*jet) = constitFourVecs[iScale].Eta(); acc_modPhi(*jet) = constitFourVecs[iScale].Phi(); + ATH_MSG_VERBOSE("Detector eta: " << constitFourVecs[iScale].Eta() + << ", phi: " << constitFourVecs[iScale].Phi()); } else { jet->setJetP4(m_jetScaleNames[iScale], constitFourVecs[iScale]); } diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetForwardJvtTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetForwardJvtTool.cxx index db5038e06d11fa91d8c20c3048b64732e42f851a..26ec8189505f12db9160aadd260b7c2066b3c266 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetForwardJvtTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetForwardJvtTool.cxx @@ -20,6 +20,7 @@ static SG::AuxElement::Decorator<char> isHS("isJvtHS"); static SG::AuxElement::Decorator<char> isPU("isJvtPU"); + static SG::AuxElement::Decorator<float> fjvt_dec("fJvt"); /////////////////////////////////////////////////////////////////// // Public methods: @@ -84,10 +85,12 @@ m_pileupMomenta.clear(); for(const auto& jetF : jetCont) { (*m_Dec_out)(*jetF) = 1; + fjvt_dec(*jetF) = 0; if (!forwardJet(jetF)) continue; if (m_pileupMomenta.size()==0) calculateVertexMomenta(&jetCont); double fjvt = getFJVT(jetF)/jetF->pt(); if (fjvt>m_fjvtThresh) (*m_Dec_out)(*jetF) = 0; + fjvt_dec(*jetF) = fjvt; } return 0; } diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetTrackSumMomentsTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetTrackSumMomentsTool.cxx index 7444edd38a6e29610e9114464ca454afcff52eae..5b90d1afd215b54b7592fd67ecb0c326b72e539f 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetTrackSumMomentsTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetTrackSumMomentsTool.cxx @@ -19,7 +19,7 @@ JetTrackSumMomentsTool::JetTrackSumMomentsTool(const std::string& name) : JetModifierBase(name) // , m_vertexContainer("") , m_assocTracksName("") - , m_htsel("") + , m_htsel("",this) , m_vertexContainer_key("") , m_tva_key("") { diff --git a/Reconstruction/Jet/JetMomentTools/python/JetMomentToolsConfig.py b/Reconstruction/Jet/JetMomentTools/python/JetMomentToolsConfig.py index a30b13be9b97ed3c18358767b2a6f0b268aef519..67c2fab050e14b682af57643b13e308b0f50d624 100644 --- a/Reconstruction/Jet/JetMomentTools/python/JetMomentToolsConfig.py +++ b/Reconstruction/Jet/JetMomentTools/python/JetMomentToolsConfig.py @@ -50,16 +50,13 @@ def getConstitFourMomTool(jetdef): pass ### cfourmom = JetMomentToolsConf.JetConstitFourMomTool("constitfourmom_{0}".format(jetdef.basename)) - if "LCTopo" in jetdef.basename: + if "LCTopo" in jetdef.basename or "EMTopo" in jetdef.basename: cfourmom.JetScaleNames = ["DetectorEtaPhi"] cfourmom.AltConstitColls = ["CaloCalTopoClusters"] cfourmom.AltConstitScales = [CaloClusterStates["CALIBRATED"]] cfourmom.AltJetScales = [""] - elif "EMTopo" in jetdef.basename: - cfourmom.JetScaleNames = ["DetectorEtaPhi","JetLCScaleMomentum"] - cfourmom.AltConstitColls = ["CaloCalTopoClusters","LCOriginTopoClusters" if "Origin" in jetdef.inputdef.modifiers else "CaloCalTopoClusters"] - cfourmom.AltConstitScales = [CaloClusterStates["UNCALIBRATED"],CaloClusterStates["CALIBRATED"]] - cfourmom.AltJetScales = ["",""] + # Drop the LC-calibrated four-mom for EMTopo jets as we only wanted it as a possibility + # in MET CST calculations but never used it elif "EMPFlow" in jetdef.basename: cfourmom.JetScaleNames = ["DetectorEtaPhi"] cfourmom.AltConstitColls = [""] diff --git a/Reconstruction/Jet/JetRecConfig/python/ConstModHelpers.py b/Reconstruction/Jet/JetRecConfig/python/ConstModHelpers.py index 11ff4959d654c86c3885888b2fa9e4c308a53754..109f9fdf622d1d2e3c902b732579cc98a33ad044 100644 --- a/Reconstruction/Jet/JetRecConfig/python/ConstModHelpers.py +++ b/Reconstruction/Jet/JetRecConfig/python/ConstModHelpers.py @@ -44,9 +44,7 @@ ConstModConfigs = { "SK": {} } -def ConstitModCfg(inputtype,sequence,suffix=""): - components = ComponentAccumulator() - +def ConstitModAlg(inputtype,sequence,suffix=""): # May wish to pass an empty sequence for regular PFlow modlist = [] if inputtype == xAODType.ParticleFlow: @@ -102,6 +100,5 @@ def ConstitModCfg(inputtype,sequence,suffix=""): constitmodalg = JetRecConf.JetAlgorithm("jetalg_{0}".format(modseq.getName())) constitmodalg.Tools = [modseq] - components.addEventAlgo( constitmodalg ) - return components + return constitmodalg diff --git a/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py b/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py index dfcb2b44acb4675e23e228f900569427545c7980..978024c80eb44cb108367056422bd969bce460a5 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py @@ -178,7 +178,8 @@ class JetGhost(object): class JetDefinition(object): def __init__(self, algorithm, radius, inputdef, ptmin=5000., ptminfilter=5000., - ghostdefs=[], modifiers=[]): + ghostdefs=[], modifiers=[], + extrainputs=[]): # Should add some type checking here # Could use JetContainerInfo conversion @@ -192,11 +193,13 @@ class JetDefinition(object): self.defineName() self.ptmin = ptmin # The pt down to which FastJet is run - self.ptminfilter = ptminfilter # The pt above which xAOD::Jets are kept + self.ptminfilter = ptminfilter # The pt above which xAOD::Jets are kept, may include calibration if ptmin<1000. or ptminfilter<1000.: jetlog.warning("Very low filter threshold set: ptmin {0:.0f} MeV, ptminfilter {1:.0f} MeV. Are you sure?") - self.ghostdefs = ghostdefs - self.modifiers = modifiers + + self.ghostdefs = ghostdefs # Objects to ghost-associate + self.modifiers = modifiers # Tools to modify the jet + self.extrainputs = extrainputs # Any extra input dependencies # Should this be a derived class? self.grooming = None @@ -208,7 +211,7 @@ class JetDefinition(object): pass def __hash__(self): - return hash((self.__radius,self.__inputdef,self.ptmin,self.ptminfilter,str(self.ghostdefs),str(self.modifiers))) + return hash((self.__radius,self.__inputdef,self.ptmin,self.ptminfilter,str(self.ghostdefs),str(self.modifiers),str(extradeps))) def __eq__(self,rhs): return self.__hash__() == rhs.__hash__() diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py index 197b76c5e82358b5a9514f580cf58dad26d56658..1d7904371b4a0e661c13f1fb33a2f3c15b30204e 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py @@ -41,11 +41,15 @@ __all__ = ["xAOD", "JetRecCfg", "resolveDependencies"] # peeking such that we don't attempt to reproduce stuff that's already # in the input file def JetRecCfg(jetdef, configFlags, jetnameprefix="",jetnamesuffix=""): - components = ComponentAccumulator() - jetsfullname = jetnameprefix+jetdef.basename+jetnamesuffix+"Jets" jetlog.info("Setting up to find {0}".format(jetsfullname)) + sequencename = jetsfullname + + components = ComponentAccumulator() + from AthenaCommon.AlgSequence import AthSequencer + components.addSequence( AthSequencer(sequencename) ) + deps = resolveDependencies( jetdef ) # Schedule the various input collections. @@ -54,20 +58,21 @@ def JetRecCfg(jetdef, configFlags, jetnameprefix="",jetnamesuffix=""): # # To facilitate running in serial mode, we also prepare # the constituent PseudoJetGetter here (needed for rho) - inputcomps, constitpjkey = JetInputCfgAndConstitPJName(deps["inputs"], configFlags) + inputcomps, constitpjkey = JetInputCfgAndConstitPJName(deps["inputs"], configFlags, sequenceName=jetsfullname) components.merge(inputcomps) pjs = [constitpjkey] # Schedule the ghost PseudoJetGetterAlgs for ghostdef in deps["ghosts"]: - ghostpjcomps, ghostpjkey = GhostPJGCfgAndOutputName( ghostdef ) - components.merge( ghostpjcomps ) + ghostpjalg = GhostPJGAlg( ghostdef ) + components.addEventAlgo( ghostpjalg, sequencename ) + ghostpjkey = ghostpjalg.PJGetter.OutputContainer pjs.append( ghostpjkey ) # Generate a JetAlgorithm to run the jet finding and modifiers # (via a JetRecTool instance). - reccomps = JetAlgorithmCfg(jetsfullname, jetdef, pjs, deps["mods"]) - components.merge(reccomps) + jetrecalg = getJetAlgorithm(jetsfullname, jetdef, pjs, deps["mods"]) + components.addEventAlgo(jetrecalg, sequencename) jetlog.info("Scheduled JetAlgorithm instance \"jetalg_{0}\"".format(jetsfullname)) return components @@ -86,6 +91,7 @@ def resolveDependencies(jetdef): # We just collect everything and sort out the types later prereqs = set() # Resolve duplication as we go prereqs.update( getConstitPrereqs( jetdef.inputdef ) ) + prereqs.update( set( ["input:"+dep for dep in jetdef.extrainputs] ) ) # Add the Filter modifier if desired (usually it is) # It might be simpler to just eliminate ptminfilter @@ -200,30 +206,18 @@ def expandPrereqs(reqtype,prereqs): # # This includes constituent modifications, track selection, copying of # input truth particles and event density calculations -def JetInputCfgAndConstitPJName(inputdeps, configFlags): +def JetInputCfgAndConstitPJName(inputdeps, configFlags, sequenceName): jetlog.info("Setting up jet inputs.") - components = ComponentAccumulator() + components = ComponentAccumulator(sequenceName) jetlog.info("Inspecting first input file") # Get the list of SG keys for the first input file # I consider it silly to run on a set of mixed file types firstinput = configFlags.Input.Files[0] import os, pickle - # Cache details in a pickle file - cachename = "fpcache.{0}.pkl".format(firstinput) - fileinfo = None - if os.path.isfile(cachename): - jetlog.debug("Reading file info from cache \"{0}\"".format(cachename)) - fpcache = open(cachename) - fileinfo = pickle.load(fpcache) - else: - from FilePeeker.FilePeeker import PeekFiles - fileinfo = PeekFiles([firstinput])[firstinput] - fpcache = open(cachename,'w') - pickle.dump(fileinfo,fpcache) - jetlog.debug("Wrote file info to cache \"{0}\"".format(cachename)) + from AthenaConfiguration.AutoConfigFlags import GetFileMD # PeekFiles returns a dict for each input file - filecontents = fileinfo["SGKeys"].split(' ') + filecontents = GetFileMD([firstinput])["SGKeys"].split(' ') constit = inputdeps[0] # Truth and track particle inputs are handled later @@ -236,12 +230,13 @@ def JetInputCfgAndConstitPJName(inputdeps, configFlags): # May need to generate constituent modifier sequences to # produce the input collection import ConstModHelpers - constitcomps = ConstModHelpers.ConstitModCfg(constit.basetype,constit.modifiers) - components.merge( constitcomps ) + constitalg = ConstModHelpers.ConstitModAlg(constit.basetype,constit.modifiers) + components.addEventAlgo(constitalg) # Schedule the constituent PseudoJetGetterAlg - constitpjcomps, constitpjkey = ConstitPJGCfgAndOutputName( constit ) - components.merge( constitpjcomps ) + constitpjalg = ConstitPJGAlg( constit ) + constitpjkey = constitpjalg.PJGetter.OutputContainer + components.addEventAlgo( constitpjalg ) # Track selection and vertex association kind of go hand in hand, though it's not # completely impossible that one might want one and not the other @@ -340,8 +335,7 @@ def getGhostPrereqs(ghostdef): prereqs = ["input:JetInputTruthParticles"] return prereqs -def ConstitPJGCfgAndOutputName(basedef): - ca = ComponentAccumulator() +def ConstitPJGAlg(basedef): jetlog.debug("Getting PseudoJetAlg for label {0} from {1}".format(basedef.label,basedef.inputname)) # getter = JetRecConf.PseudoJetGetter("pjg_"+basedef.label, @@ -356,11 +350,9 @@ def ConstitPJGCfgAndOutputName(basedef): "pjgalg_"+basedef.label, PJGetter = getter ) - ca.addEventAlgo( pjgalg ) - return ca, getter.OutputContainer + return pjgalg -def GhostPJGCfgAndOutputName(ghostdef): - ca = ComponentAccumulator() +def GhostPJGAlg(ghostdef): label = "Ghost"+ghostdef.inputtype kwargs = { "OutputContainer": "PseudoJet"+label, @@ -395,16 +387,14 @@ def GhostPJGCfgAndOutputName(ghostdef): "pjgalg_"+label, PJGetter = getter ) - ca.addEventAlgo( pjgalg ) - return ca, getter.OutputContainer + return pjgalg ######################################################################## # Function for configuring the jet algorithm and builders, given the # set of dependencies # -def JetAlgorithmCfg(jetname, jetdef, pjs, modlist): +def getJetAlgorithm(jetname, jetdef, pjs, modlist): jetlog.debug("Configuring JetAlgorithm \"jetalg_{0}\"".format(jetname)) - components = ComponentAccumulator() builder = getJetBuilder() @@ -421,9 +411,8 @@ def JetAlgorithmCfg(jetname, jetdef, pjs, modlist): jetalg = JetRecConf.JetAlgorithm("jetalg_"+jetname) jetalg.Tools = [rectool] - components.addEventAlgo(jetalg) - return components + return jetalg ######################################################################## diff --git a/Reconstruction/Jet/JetRecConfig/python/StandardJetMods.py b/Reconstruction/Jet/JetRecConfig/python/StandardJetMods.py index eeaf1f00e57a238ad22d338232020798ae2f08a1..f285cdf171cae8c922b3644345d87bfdf60fa845 100644 --- a/Reconstruction/Jet/JetRecConfig/python/StandardJetMods.py +++ b/Reconstruction/Jet/JetRecConfig/python/StandardJetMods.py @@ -75,8 +75,8 @@ jetmomentmods = { "TrackMoments": JetModifier("JetTrackMomentsTool", "trkmoms", helperfn=JetMomentToolsConfig.getTrackMomentsTool, prereqs = [ "input:JetSelectedTracks","input:JetTrackVtxAssoc","ghost:Track" ]), - "TrackSumMoments": JetModifier("JetTrackMomentsTool", "trksummoms", - helperfn=JetMomentToolsConfig.getTrackMomentsTool, + "TrackSumMoments": JetModifier("JetTrackSumMomentsTool", "trksummoms", + helperfn=JetMomentToolsConfig.getTrackSumMomentsTool, prereqs = [ "input:JetSelectedTracks","input:JetTrackVtxAssoc","ghost:Track" ]), } jetmoddict.update(jetmomentmods) diff --git a/Reconstruction/Jet/JetRecConfig/share/JetRecTestCfg.py b/Reconstruction/Jet/JetRecConfig/share/JetRecTestCfg.py index fdbbdcb49bf2db746123fbdc6feb87e8a2e6c29d..e2e5b9f4572e9e7c3180c1faba2632bd3e6ce56a 100644 --- a/Reconstruction/Jet/JetRecConfig/share/JetRecTestCfg.py +++ b/Reconstruction/Jet/JetRecConfig/share/JetRecTestCfg.py @@ -6,11 +6,10 @@ from pprint import pprint, pformat from AthenaCommon import Logging jetlog = Logging.logging.getLogger("testJetRecDeps") -def JetRecTestCfg(configFlags,args): +def JetRecTestCfg(jetdefs,configFlags,args): - jetlist = configFlags.JetRec.Definitions if args.printDependencies: - for jetdef in jetlist: + for jetdef in jetdefs: deps = JetRecConfig.resolveDependencies(jetdef) jetlog.info("Dumping dependency dict for {0}".format(jetdef)) depstr = pformat(deps) @@ -19,8 +18,8 @@ def JetRecTestCfg(configFlags,args): if args.printAccumulators: jetlog.info("Printing component accumulators for each jet collection") jetcas = [] - for jetdef in jetlist: - jetcomps = JetRecConfig.JetRecCfg(jetdef,configFlags,jetnameprefix=configFlags.JetRec.Prefix) + for jetdef in jetdefs: + jetcomps = JetRecConfig.JetRecCfg(jetdef,configFlags,jetnameprefix="New") if args.printAccumulators: jetcomps.printConfig(withDetails=args.verboseAccumulators,summariseProps=True) jetcas.append(jetcomps) @@ -33,14 +32,14 @@ def JetRecTestCfg(configFlags,args): return components -def DefineJetCollections(): +def DefineJetCollections(configFlags): # Here we define the jet configurations we want to build # These mod and ghost lists should go in a common module standardrecomods = ["Width","TrackMoments","TrackSumMoments","JVF","JVT","OriginSetPV", "CaloEnergies","LArHVCorr"] clustermods = ["ECPSFrac","ClusterMoments"] - truthmods = ["PartonTruthLabel","TruthPartonDR","JetDeltaRLabel:5000"] + truthmods = ["PartonTruthLabel","TruthPartonDR","JetDeltaRLabel:5000"] if configFlags.Input.isMC else [] from JetRecConfig.JetDefinition import JetGhost ghostlist = ["Track","MuonSegment","Truth"] @@ -56,32 +55,34 @@ def DefineJetCollections(): ######################################################################## # First a demonstration of just building jets using standard definitions - from JetRecConfig.StandardJetDefs import AntiKt4LCTopo, AntiKt4EMPFlow, AntiKt4Truth, AntiKt4TruthWZ + from JetRecConfig.StandardJetDefs import AntiKt4EMTopo, AntiKt4EMPFlow, AntiKt4Truth, AntiKt4TruthWZ # This updates the original jet definitions, so might be a little risky # in derivation code. Safer would be to always deepcopy into a local variable. - AntiKt4LCTopo.ptminfilter = 15e3 - AntiKt4LCTopo.modifiers = ["Calib:T0:mc","Sort"] + standardrecomods + clustermods + truthmods - AntiKt4LCTopo.ghostdefs = standardghosts - #AntiKt4LCTopo.modifiers = ["Calib:AnalysisLatest:mc"] + AntiKt4EMTopo.ptminfilter = 15e3 + AntiKt4EMTopo.modifiers = ["Calib:T0:mc","Sort"] + standardrecomods + clustermods + truthmods + AntiKt4EMTopo.ghostdefs = standardghosts + #AntiKt4EMTopo.modifiers = ["Calib:AnalysisLatest:mc"] AntiKt4EMPFlow.ptminfilter = 10e3 AntiKt4EMPFlow.modifiers = ["Calib:T0:mc","Sort"] + standardrecomods + truthmods AntiKt4EMPFlow.ghostdefs = standardghosts #AntiKt4EMPFlow.modifiers = ["Calib:AnalysisLatest:mc"] - from copy import deepcopy AntiKt4Truth.ptminfilter = 2e3 + AntiKt4Truth.extrainputs = ["EventDensity"] AntiKt4TruthWZ.ptminfilter = 2e3 + AntiKt4TruthWZ.extrainputs = ["EventDensity"] ######################################################################## # Now we define our own definitions from JetRecConfig.JetDefinition import JetConstit, JetDefinition, xAODType - LCTopoCSSK = JetConstit(xAODType.CaloCluster, ["LC","Origin","CS","SK"]) - AntiKt4LCTopoCSSK = JetDefinition("AntiKt",0.4,LCTopoCSSK,ptmin=2e3,ptminfilter=2e3) - AntiKt4LCTopoCSSK.modifiers = ["ConstitFourMom"] + standardrecomods + clustermods + truthmods - AntiKt4LCTopoCSSK.ghostdefs = standardghosts + EMTopoCSSK = JetConstit(xAODType.CaloCluster, ["EM","Origin","CS","SK"]) + AntiKt4EMTopoCSSK = JetDefinition("AntiKt",0.4,EMTopoCSSK,ptmin=2e3,ptminfilter=2e3) + AntiKt4EMTopoCSSK.modifiers = ["ConstitFourMom"] + standardrecomods + clustermods + truthmods + AntiKt4EMTopoCSSK.ghostdefs = standardghosts + AntiKt4EMTopoCSSK.extrainputs = ["EventDensity"] ######################################################################## # We can also copy and modify the standard ones @@ -96,13 +97,16 @@ def DefineJetCollections(): AntiKt4EMPFlowCSSK.ptmin = 2e3 AntiKt4EMPFlowCSSK.ptminfilter = 2e3 AntiKt4EMPFlowCSSK.ghostdefs = standardghosts + AntiKt4EMPFlowCSSK.extrainputs = ["EventDensity"] - jetdefs = [#AntiKt4Truth, - #AntiKt4TruthWZ, - AntiKt4LCTopo, + jetdefs = [AntiKt4EMTopo, AntiKt4EMPFlow, - AntiKt4LCTopoCSSK, + AntiKt4EMTopoCSSK, AntiKt4EMPFlowCSSK] + if configFlags.Input.isMC: + jetdefs += [AntiKt4Truth, + AntiKt4TruthWZ] + return jetdefs if __name__=="__main__": @@ -152,15 +156,13 @@ if __name__=="__main__": ConfigFlags.Scheduler.ShowControlFlow = True ConfigFlags.Concurrency.NumConcurrentEvents = args.nThreads - ######################################################################## - # Define flags steering the jet reco config - jetdefs = DefineJetCollections() - ConfigFlags.addFlag("JetRec.Definitions",jetdefs) - ConfigFlags.addFlag("JetRec.Prefix","New") - # Prevent the flags from being modified ConfigFlags.lock() + ######################################################################## + # Define flags steering the jet reco config + jetdefs = DefineJetCollections(ConfigFlags) + # Get a ComponentAccumulator setting up the fundamental Athena job from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg cfg=MainServicesThreadedCfg(ConfigFlags) @@ -170,7 +172,7 @@ if __name__=="__main__": cfg.merge(PoolReadCfg(ConfigFlags)) # Add the components from our jet reconstruction job - cfg.merge(JetRecTestCfg(ConfigFlags,args)) + cfg.merge(JetRecTestCfg(jetdefs,ConfigFlags,args)) # # build eventinfo attribute list # from OutputStreamAthenaPool.OutputStreamAthenaPoolConf import EventInfoAttListTool, EventInfoTagBuilder @@ -180,12 +182,12 @@ if __name__=="__main__": # Write what we produced to AOD # First define the output list outputlist = ["EventInfo#*"] - originaljets = ["AntiKt4EMPFlowJets"] + originaljets = ["AntiKt4EMPFlowJets","AntiKt4EMTopoJets"] for jetcoll in originaljets: outputlist += ["xAOD::JetContainer#"+jetcoll, "xAOD::JetAuxContainer#"+jetcoll+"Aux."] - for jetdef in ConfigFlags.JetRec.Definitions: - key = "{0}{1}Jets".format(ConfigFlags.JetRec.Prefix,jetdef.basename) + for jetdef in jetdefs: + key = "{0}{1}Jets".format("New",jetdef.basename) outputlist += ["xAOD::JetContainer#"+key, "xAOD::JetAuxContainer#"+key+"Aux."] @@ -193,6 +195,7 @@ if __name__=="__main__": from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg cfg.merge(OutputStreamCfg(ConfigFlags,"xAOD",ItemList=outputlist)) pprint( cfg.getEventAlgo("OutputStreamxAOD").ItemList ) + cfg.getEventAlgo("OutputStreamxAOD").ForceRead = True # Optionally, print the contents of the store every event cfg.getService("StoreGateSvc").Dump = args.dumpSG diff --git a/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py b/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py index e52d62176e5b48898a104e35b8d9883dc0568b3a..eacd0f5521bad82450993325bf2f78c856997576 100644 --- a/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py +++ b/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py @@ -22,8 +22,11 @@ def getTrackSelTool(): # Track selector needs its own hierarchical config getter in JetRecTools? idtrackselloose = InDetTrackSelectionToolConf.InDet__InDetTrackSelectionTool( "idtrackselloose", - CutLevel = "Loose", - minPt = 500 + CutLevel = "Loose", + minPt = 500, + UseTrkTrackTools = False, + Extrapolator = "", + TrackSummaryTool = "" ) jettrackselloose = JetRecToolsConf.JetTrackSelectionTool( "jettrackselloose",