def JetAlgFromTools(rtools, suffix="HI", persistify=True): #insert exe tools at front of list, e.g. tracksel and tvassoc for HI etc. HIJet_exe_tools = [] from JetRec.JetRecFlags import jetFlags if jetFlags.useTruth() and not jetFlags.Enabled(): HIJet_exe_tools += HITruthParticleCopy() #if jetFlags.useCells(): HIJet_exe_tools += [jtm.missingcells] if HIJetFlags.UseHITracks(): HIJet_exe_tools += [jtm.tracksel_HI, jtm.gtracksel_HI, jtm.tvassoc_HI] rtools = HIJet_exe_tools + rtools from JetRec.JetRecConf import JetToolRunner runner = JetToolRunner("jetrun" + suffix, Tools=rtools, Timer=jetFlags.timeJetToolRunner()) jtm.add(runner) from JetRec.JetRecConf import JetAlgorithm theAlg = JetAlgorithm("jetalg" + suffix) theAlg.Tools = [runner] from AthenaCommon.AlgSequence import AlgSequence topsequence = AlgSequence() topsequence += theAlg from GaudiKernel.Constants import DEBUG if jetFlags.debug > 0: jtm.setOutputLevel(runner, DEBUG) theAlg.OutputLevel = DEBUG if jetFlags.debug > 3: jtm.setOutputLevel(jtm.jetBuilderWithoutArea, DEBUG) if persistify: for t in rtools: if hasattr(t, "OutputContainer"): AddToOutputList(t.OutputContainer) return theAlg
def addJetRecoToAlgSequence(job=None, useTruth=None, eventShapeTools=None, separateJetAlgs=None, debug=None): myname = "JetAlgorithm: " # We need this to modify the global variable. global jetalg # Import message level flags. from GaudiKernel.Constants import DEBUG # Import the jet reconstruction control flags. from JetRec.JetRecFlags import jetFlags # Import the standard jet tool manager. from JetRec.JetRecStandardToolManager import jtm # Set sequence and flags as needed. if job == None: from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() if useTruth == None: useTruth = jetFlags.useTruth() if eventShapeTools == None: eventShapeTools = jetFlags.eventShapeTools() if eventShapeTools == None: eventShapeTools = [] if separateJetAlgs == None: separateJetAlgs = jetFlags.separateJetAlgs() # Event shape tools. evstools = [] evsDict = { "emtopo": ("EMTopoEventShape", jtm.emget), "lctopo": ("LCTopoEventShape", jtm.lcget), "empflow": ("EMPFlowEventShape", jtm.empflowget), "emcpflow": ("EMCPFlowEventShape", jtm.emcpflowget), "lcpflow": ("LCPFlowEventShape", jtm.lcpflowget), } if jetFlags.useTracks(): evsDict["emtopo"] = ("EMTopoOriginEventShape", jtm.emoriginget) evsDict["lctopo"] = ("LCTopoOriginEventShape", jtm.lcoriginget) jetlog.info(myname + "Event shape tools: " + str(eventShapeTools)) from RecExConfig.AutoConfiguration import IsInInputFile for evskey in eventShapeTools: from EventShapeTools.EventDensityConfig import configEventDensityTool if evskey in evsDict: (toolname, getter) = evsDict[evskey] if toolname in jtm.tools: jetlog.info(myname + "Skipping duplicate event shape: " + toolname) else: jetlog.info(myname + "Adding event shape " + evskey) if not IsInInputFile("xAOD::EventShape", "Kt4" + toolname): jtm += configEventDensityTool(toolname, getter, 0.4) evstools += [jtm.tools[toolname]] else: jetlog.info(myname + "Invalid event shape key: " + evskey) raise Exception # Add the tool runner. It runs the jetrec tools. rtools = [] # Add the truth tools. if useTruth: from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles rtools += scheduleCopyTruthParticles() # build truth jet input : rtools += [jtm.truthpartcopy, jtm.truthpartcopywz] ## if jetFlags.useCells(): ## rtools += [jtm.missingcells] commented out : incompatible with trigger : ATR-9696 if jetFlags.useTracks: rtools += [ jtm.tracksel, jtm.tvassoc, jtm.trackselloose_trackjets, ] # Add the algorithm. It runs the jetrec tools. from JetRec.JetRecConf import JetAlgorithm ctools = [] if jetFlags.useTracks: if not IsInInputFile("xAOD::CaloClusterContainer", "LCOriginTopoClusters"): ctools += [jtm.JetConstitSeq_LCOrigin] if not IsInInputFile("xAOD::CaloClusterContainer", "EMOriginTopoClusters"): ctools += [jtm.JetConstitSeq_EMOrigin] from JetRec.JetRecConf import JetToolRunner runners = [] if len(ctools) > 0: jtm += JetToolRunner("jetconstit", EventShapeTools=[], Tools=ctools, Timer=jetFlags.timeJetToolRunner()) jtm.jetconstit runners = [jtm.jetconstit] if jetFlags.separateJetAlgs(): jtm += JetToolRunner("jetrun", EventShapeTools=evstools, Tools=rtools, Timer=jetFlags.timeJetToolRunner()) runners += [jetrun] job += JetAlgorithm("jetalg") jetalg = job.jetalg jetalg.Tools = runners for t in jtm.jetrecs: jalg = JetAlgorithm("jetalg" + t.name()) jalg.Tools = [t] job += jalg else: from JetRec.JetRecConf import JetToolRunner jtm += JetToolRunner("jetrun", EventShapeTools=evstools, Tools=rtools + jtm.jetrecs, Timer=jetFlags.timeJetToolRunner()) runners += [jtm.jetrun] job += JetAlgorithm("jetalg") jetalg = job.jetalg jetalg.Tools = runners if jetFlags.debug > 0: jtm.setOutputLevel(jtm.jetrun, DEBUG) jetalg.OutputLevel = DEBUG if jetFlags.debug > 1: for tool in jtm.jetrecs: jtm.setOutputLevel(tool, DEBUG) if jetFlags.debug > 2: for tool in jtm.finders: jtm.setOutputLevel(tool, DEBUG) if jetFlags.debug > 3: jtm.setOutputLevel(jtm.jetBuilderWithArea, DEBUG) jtm.setOutputLevel(jtm.jetBuilderWithoutArea, DEBUG)
def addTruthJetsIfNotExising(truth_jets_name): ''' Add algorithm to create the truth jets collection unless the collection exists already, or a truth jet finder is already running ''' from RecExConfig.AutoConfiguration import IsInInputFile # the jet collection name does not exist in the input file # add a jet finder algorithm in front of the monitoring if the algorithm # does not yet exist. if not IsInInputFile('xAOD::JetContainer', truth_jets_name): try: from AthenaCommon.Logging import logging log = logging.getLogger('InDetPhysValMonitoring/addTruthJets.py') from PyUtils.MetaReaderPeeker import convert_itemList, metadata eventdata_itemsDic = convert_itemList(layout='dict') log.info( 'DEBUG addTruthJetsIfNotExising {} not in {} [file_type={}]'. format(truth_jets_name, eventdata_itemsDic, metadata['file_type'])) if truth_jets_name in eventdata_itemsDic: return except: pass # Access the algorithm sequence: from AthenaCommon.AlgSequence import AlgSequence, AthSequencer topSequence = AlgSequence() # extract the jet finder type and main parameter import re extract_alg = re.search('^([^0-9]+)([0-9]+)TruthJets', truth_jets_name) if extract_alg != None: alg_type = extract_alg.group(1) alg_param_str = extract_alg.group(2) else: alg_type = 'AntiKt' alg_param_str = 4 jet_finder_alg_name = "jetalg" + alg_type + alg_param_str + 'TruthJets' # add the jet finder unless it exists already in the alg sequence from InDetPhysValDecoration import findAlg, findMonMan alg_pos = findAlg([jet_finder_alg_name]) if alg_pos == None: from JetRec.JetRecStandard import jtm mon_man_index = findMonMan() # configure truth jet finding ? from JetRec.JetRecFlags import jetFlags jetFlags.useTruth = True jetFlags.useTracks = False jetFlags.truthFlavorTags = [ "BHadronsInitial", "BHadronsFinal", "BQuarksFinal", "CHadronsInitial", "CHadronsFinal", "CQuarksFinal", "TausFinal", "Partons", ] # tool to create truth jet finding inputs truth_part_copy_name = 'truthpartcopy' dir(jtm) create_truth_jet_input = None if not hasattr(jtm, truth_part_copy_name): from MCTruthClassifier.MCTruthClassifierConfig import firstSimCreatedBarcode from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier truth_classifier_name = 'JetMCTruthClassifier' if not hasattr(jtm, truth_classifier_name): from AthenaCommon.AppMgr import ToolSvc if not hasattr(ToolSvc, truth_classifier_name): truthClassifier = MCTruthClassifier( name=truth_classifier_name, barcodeG4Shift=firstSimCreatedBarcode(), ParticleCaloExtensionTool="") else: truthClassifier = getattr(ToolSvc, truth_classifier_name) truthClassifier.barcodeG4Shift = firstSimCreatedBarcode( ) jtm += truthClassifier else: truthClassifier = getattr(jtm, truth_classifier_name) truthClassifier.barcodeG4Shift = firstSimCreatedBarcode() from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles create_truth_jet_input = CopyTruthJetParticles( truth_part_copy_name, OutputName="JetInputTruthParticles", MCTruthClassifier=truthClassifier) jtm += create_truth_jet_input else: create_truth_jet_input = getattr(jtm, truth_part_copy_name) jet_finder_tool = jtm.addJetFinder(truth_jets_name, alg_type, float(alg_param_str) / 10., "truth", ptmin=5000) jet_tools = [] from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles jet_tools += scheduleCopyTruthParticles() jet_tools += [create_truth_jet_input] jet_tools += jtm.jetrecs # add the jet finder in front of the monitoring from JetRec.JetRecConf import JetAlgorithm from JetRec.JetRecConf import JetToolRunner jtm += JetToolRunner( "jetrun", Tools=jet_tools, EventShapeTools=[], # OutputLevel = 1, Timer=jetFlags.timeJetToolRunner()) # jet_finder_alg = JetAlgorithm(jet_finder_alg_name, jet_tools) jet_finder_alg = JetAlgorithm(jet_finder_alg_name) # jet_finder_alg.OutputLevel = 1 jet_finder_alg.Tools = [jtm.jetrun] if mon_man_index != None: topSequence.insert(mon_man_index, jet_finder_alg) else: topSequence += jet_finder_alg
def JetAlgFromTools(rtools, suffix="HI", persistify=True): from HIJetRec.HIJetRecTools import jtm #insert exe tools at front of list, e.g. tracksel and tvassoc for HI etc. HIJet_exe_tools = [] from JetRec.JetRecFlags import jetFlags if jetFlags.useTruth() and not jetFlags.Enabled(): HIJet_exe_tools += HITruthParticleCopy() #if jetFlags.useCells(): HIJet_exe_tools += [jtm.missingcells] if HIJetFlags.UseHITracks(): HIJet_exe_tools += [jtm.tracksel_HI, jtm.gtracksel_HI, jtm.tvassoc_HI] #Now we split in two algorithms to provide input to PseudoJetAlgorithm #rtools=HIJet_exe_tools+rtools from AthenaCommon.AlgSequence import AlgSequence topsequence = AlgSequence() JetToolRunner = CompFactory.JetToolRunner JetAlgorithm = CompFactory.JetAlgorithm if len(HIJet_exe_tools) > 0: jtm += JetToolRunner("jetrunconstit" + suffix, Tools=HIJet_exe_tools, Timer=jetFlags.timeJetToolRunner()) topsequence += JetAlgorithm("jetalgconstit" + suffix, Tools=[jtm.jetrunconstitHI]) # Add the PseudoJetAlgorithm # To avoid massive refactoring and to preserve familiarity, # jet guys kept calling things "getters", but these are already # PseudoJetAlgorithms as they eliminated the wrappers for getter in jtm.allGetters: print('Adding PseudoJetAlgorithm %s' % getter.name) print('Input Container %s' % getter.InputContainer) print('Output Container %s' % getter.OutputContainer) print('Label %s' % getter.Label) topsequence += getter runner = JetToolRunner("jetrun" + suffix, Tools=rtools, Timer=jetFlags.timeJetToolRunner()) jtm.add(runner) theAlg = JetAlgorithm("jetalg" + suffix) theAlg.Tools = [runner] topsequence += theAlg from GaudiKernel.Constants import DEBUG if jetFlags.debug > 0: jtm.setOutputLevel(runner, DEBUG) theAlg.OutputLevel = DEBUG if jetFlags.debug > 3: jtm.setOutputLevel(jtm.jetBuilderWithoutArea, DEBUG) if persistify: for t in rtools: if hasattr(t, "OutputContainer"): AddToOutputList(t.OutputContainer) return theAlg
def addTruthJets(kernel=None, decorationDressing=None): # In case it's requested, set up the use of photon decorations from dressing code from JetRec.JetRecStandardToolManager import jtm if decorationDressing is not None and not hasattr(jtm, 'truthpartdressedwz'): # Ensure that we are adding it to something, and that we haven't run it already if kernel is None: from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob kernel = DerivationFrameworkJob # make sure if we are using EVNT that we don't try to check sim metadata barCodeFromMetadata = 2 if objKeyStore.isInInput("McEventCollection", "GEN_EVENT"): barCodeFromMetadata = 0 from JetRec.JetRecStandardToolManager import jtm from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles if not 'truthpartdressedwz' in jtm.tools: jtm += CopyTruthJetParticles( "truthpartdressedwz", OutputName="JetInputTruthParticlesDressedWZ", MCTruthClassifier=jtm.JetMCTruthClassifier, #IncludePromptLeptons=False,#IncludePromptPhotons=False, #IncludeMuons=True,IncludeNeutrinos=True,BarCodeFromMetadata=barCodeFromMetadata, #FSRPhotonCone=-1. #, DressingDecorationName=decorationDressing ) # Add a jet tool runner for this thing from JetRec.JetRecConf import JetToolRunner, JetAlgorithm, PseudoJetGetter jtm += JetToolRunner("jetdressedwzrun", EventShapeTools=[], Tools=[jtm.truthpartdressedwz], Timer=jetFlags.timeJetToolRunner()) # And an algorithm to run in kernel += JetAlgorithm("jetdressedwzalg") jetdressedwzalg = kernel.jetdressedwzalg jetdressedwzalg.Tools = [jtm.jetdressedwzrun] if not 'truthdressedwzget' in jtm.tools: jtm += PseudoJetGetter( "truthdressedwzget", Label="TruthDressedWZ", InputContainer=jtm.truthpartdressedwz.OutputName, OutputContainer="PseudoJetTruthDressedWZ", GhostScale=0.0, SkipNegativeEnergy=True) jtm.gettersMap['truthdressedwz'] = list(jtm.gettersMap['truth']) jtm.gettersMap['truthdressedwz'][0] = jtm.truthdressedwzget if not hasattr(jtm, 'truthpartcharged'): # Ensure that we are adding it to something, and that we haven't run it already if kernel is None: from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob kernel = DerivationFrameworkJob # make sure if we are using EVNT that we don't try to check sim metadata barCodeFromMetadata = 2 if objKeyStore.isInInput("McEventCollection", "GEN_EVENT"): barCodeFromMetadata = 0 from JetRec.JetRecStandardToolManager import jtm from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles if not 'truthpartcharged' in jtm.tools: jtm += CopyTruthJetParticles( "truthpartcharged", OutputName="JetInputTruthParticlesCharged", MCTruthClassifier=jtm.JetMCTruthClassifier, #ChargedParticlesOnly=True, #BarCodeFromMetadata=barCodeFromMetadata ) # Add a jet tool runner for this thing from JetRec.JetRecConf import JetToolRunner, JetAlgorithm, PseudoJetGetter jtm += JetToolRunner("jetchargedrun", EventShapeTools=[], Tools=[jtm.truthpartcharged], Timer=jetFlags.timeJetToolRunner()) # And an algorithm to run in kernel += JetAlgorithm("jetchargedalg") jetchargedalg = kernel.jetchargedalg jetchargedalg.Tools = [jtm.jetchargedrun] if not 'truthchargedget' in jtm.tools: jtm += PseudoJetGetter( "truthchargedget", Label="TruthCharged", InputContainer=jtm.truthpartcharged.OutputName, OutputContainer="PseudoJetTruthCharged", GhostScale=0.0, SkipNegativeEnergy=True) jtm.gettersMap['truthcharged'] = [jtm.truthchargedget] # Propagate that downward if dfInputIsEVNT: addTruthJetsEVNT(kernel, decorationDressing) else: addTruthJetsAOD(kernel, decorationDressing)
print myname + "Invalid event shape key: " + name raise Exception # Add the tool runner. It runs the jetrec tools. rtools = [] if jetFlags.useCells(): rtools += [jtm.missingcells] if jetFlags.useTracks: rtools += [jtm.tracksel] rtools += [jtm.tvassoc] rtools += jtm.jetrecs from JetRec.JetRecConf import JetToolRunner jtm += JetToolRunner("jetrun", EventShapeTools=evstools, Tools=rtools, Timer=jetFlags.timeJetToolRunner() ) jetrun = jtm.jetrun # Add the algorithm. It runs the jetrec tools. from JetRec.JetRecConf import JetAlgorithm if jetFlags.separateJetAlgs(): for t in rtools: jalg = JetAlgorithm("jetalg"+t.name()) jalg.Tools = [t] job+= jalg else: job += JetAlgorithm("jetalg") jetalg = job.jetalg jetalg.Tools = [jtm.jetrun]
def addJetRecoToAlgSequence(job =None, useTruth =None, eventShapeTools =None, separateJetAlgs= None, debug =None): myname = "JetAlgorithm: " # We need this to modify the global variable. global jetalg # Import message level flags. from GaudiKernel.Constants import DEBUG # Import the jet reconstruction control flags. from JetRec.JetRecFlags import jetFlags # Import the standard jet tool manager. from JetRec.JetRecStandardToolManager import jtm # Set sequence and flags as needed. if job == None: from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() if useTruth == None: useTruth = jetFlags.useTruth() if eventShapeTools == None: eventShapeTools = jetFlags.eventShapeTools() if eventShapeTools == None: eventShapeTools = [] if separateJetAlgs == None: separateJetAlgs = jetFlags.separateJetAlgs() # Event shape tools. evstools = [] evsDict = { "emtopo" : ("EMTopoEventShape", jtm.emget), "lctopo" : ("LCTopoEventShape", jtm.lcget), "empflow" : ("EMPFlowEventShape", jtm.empflowget), "emcpflow" : ("EMCPFlowEventShape", jtm.emcpflowget), "lcpflow" : ("LCPFlowEventShape", jtm.lcpflowget), } print myname + "Event shape tools: " + str(eventShapeTools) for evskey in eventShapeTools: from EventShapeTools.EventDensityConfig import configEventDensityTool if evskey in evsDict: (toolname, getter) = evsDict[evskey] if toolname in jtm.tools: print myname + "Skipping duplicate event shape: " + toolname else: print myname + "Adding event shape " + evskey jtm += configEventDensityTool(toolname, getter, 0.4) evstools += [jtm.tools[toolname]] else: print myname + "Invalid event shape key: " + evskey raise Exception # Add the tool runner. It runs the jetrec tools. rtools = [] # Add the truth tools. if useTruth: from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles rtools += scheduleCopyTruthParticles() # build truth jet input : rtools += [ jtm.truthpartcopy, jtm.truthpartcopywz ] ## if jetFlags.useCells(): ## rtools += [jtm.missingcells] commented out : incompatible with trigger : ATR-9696 if jetFlags.useTracks: rtools += [jtm.tracksel, jtm.tvassoc, jtm.trackselloose_trackjets, jtm.JetConstitSeq_LCOrigin, jtm.JetConstitSeq_EMOrigin, ] # Add the algorithm. It runs the jetrec tools. from JetRec.JetRecConf import JetAlgorithm if jetFlags.separateJetAlgs(): from JetRec.JetRecConf import JetToolRunner jtm += JetToolRunner("jetrun", EventShapeTools=evstools, Tools=rtools, Timer=jetFlags.timeJetToolRunner() ) jetrun = jtm.jetrun job += JetAlgorithm("jetalg") jetalg = job.jetalg jetalg.Tools = [jtm.jetrun] for t in jtm.jetrecs: # from JetRec.JetRecConf import JetToolRunner # jetrun_rec = JetToolRunner("jetrun"+t.name(), # EventShapeTools=[], # Tools=[t], # Timer=jetFlags.timeJetToolRunner() # ) # jtm += jetrun_rec jalg = JetAlgorithm("jetalg"+t.name()) jalg.Tools = [t] job+= jalg else: from JetRec.JetRecConf import JetToolRunner jtm += JetToolRunner("jetrun", EventShapeTools=evstools, Tools=rtools+jtm.jetrecs, Timer=jetFlags.timeJetToolRunner() ) jetrun = jtm.jetrun job += JetAlgorithm("jetalg") jetalg = job.jetalg jetalg.Tools = [jtm.jetrun] if jetFlags.debug > 0: jtm.setOutputLevel(jtm.jetrun, DEBUG) jetalg.OutputLevel = DEBUG if jetFlags.debug > 1: for tool in jtm.jetrecs: jtm.setOutputLevel(tool, DEBUG) if jetFlags.debug > 2: for tool in jtm.finders: jtm.setOutputLevel(tool, DEBUG) if jetFlags.debug > 3: jtm.setOutputLevel(jtm.jetBuilderWithArea, DEBUG) jtm.setOutputLevel(jtm.jetBuilderWithoutArea, DEBUG)
def addJetRecoToAlgSequence(job=None, useTruth=None, eventShapeTools=None, separateJetAlgs=None, debug=None): myname = "JetAlgorithm: " # We need this to modify the global variable. global jetalg # Import message level flags. from GaudiKernel.Constants import DEBUG # Import the jet reconstruction control flags. from JetRec.JetRecFlags import jetFlags # Import the standard jet tool manager. from JetRec.JetRecStandard import jtm # Set sequence and flags as needed. if job == None: from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() if useTruth == None: useTruth = jetFlags.useTruth() if eventShapeTools == None: eventShapeTools = jetFlags.eventShapeTools() if eventShapeTools == None: eventShapeTools = [] if separateJetAlgs == None: separateJetAlgs = jetFlags.separateJetAlgs() # Event shape tools. evsDict = { "emtopo": ("EMTopoEventShape", jtm.emget), "lctopo": ("LCTopoEventShape", jtm.lcget), "empflow": ("EMPFlowEventShape", jtm.empflowget), } if jetFlags.useTracks(): if jetFlags.useVertices(): evsDict["emtopo"] = ("EMTopoOriginEventShape", jtm.emoriginget) evsDict["lctopo"] = ("LCTopoOriginEventShape", jtm.lcoriginget) else: evsDict["emtopo"] = ("EMTopoOriginEventShape", jtm.emget) evsDict["lctopo"] = ("LCTopoOriginEventShape", jtm.lcget) jetlog.info(myname + "Event shape tools: " + str(eventShapeTools)) from RecExConfig.AutoConfiguration import IsInInputFile for evskey in eventShapeTools: from EventShapeTools.EventDensityConfig import configEventDensityTool if evskey in evsDict: (toolname, getter) = evsDict[evskey] if toolname in jtm.tools: jetlog.info(myname + "Skipping duplicate event shape: " + toolname) else: jetlog.info(myname + "Adding event shape " + evskey) if not IsInInputFile("xAOD::EventShape", toolname): jtm += configEventDensityTool(toolname, getter.Label, 0.4) jtm.allEDTools += [jtm.tools[toolname]] else: jetlog.info(myname + "Invalid event shape key: " + evskey) raise Exception # Add the tool runner. It runs the jetrec tools. ctools = [] # Add the truth tools. if useTruth: from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles ctools += scheduleCopyTruthParticles() # build truth jet input : ctools += [jtm.truthpartcopy, jtm.truthpartcopywz] ## if jetFlags.useCells(): ## ctools += [jtm.missingcells] commented out : incompatible with trigger : ATR-9696 if jetFlags.useTracks: ctools += [jtm.tracksel, jtm.trackselloose_trackjets] if jetFlags.useVertices: ctools += [jtm.tvassoc] # LCOriginTopoClusters and EMOriginTopoClusters are shallow copies # of CaloCalTopoClusters. This means that if CaloCalTopoClusters gets # thinned on output, the the two derived containers need to be thinned # in the same way, else they'll be corrupted in the output. # FIXME: this should be automatic somehow. postalgs = [] thinneg = False from RecExConfig.RecFlags import rec if rec.doWriteAOD() and not rec.readAOD(): from ParticleBuilderOptions.AODFlags import AODFlags if AODFlags.ThinNegativeEnergyCaloClusters: thinneg = True if jetFlags.useTracks and jetFlags.useVertices: if not IsInInputFile("xAOD::CaloClusterContainer", "LCOriginTopoClusters"): ctools += [jtm.JetConstitSeq_LCOrigin] if thinneg: from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyCaloClustersAlg postalgs.append( ThinNegativeEnergyCaloClustersAlg( 'ThinNegLCOriginTopoClusters', ThinNegativeEnergyCaloClusters=True, CaloClustersKey='LCOriginTopoClusters', StreamName='StreamAOD')) if not IsInInputFile("xAOD::CaloClusterContainer", "EMOriginTopoClusters"): ctools += [jtm.JetConstitSeq_EMOrigin] if thinneg: from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyCaloClustersAlg postalgs.append( ThinNegativeEnergyCaloClustersAlg( 'ThinNegEMOriginTopoClusters', ThinNegativeEnergyCaloClusters=True, CaloClustersKey='EMOriginTopoClusters', StreamName='StreamAOD')) if not IsInInputFile("xAOD::PFOContainer", "CHSParticleFlowObjects"): if not hasattr(job, "jetalgCHSPFlow"): ctools += [jtm.JetConstitSeq_PFlowCHS] if thinneg: from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyNeutralPFOsAlg CHSnPFOsThinAlg = ThinNegativeEnergyNeutralPFOsAlg( "ThinNegativeEnergyCHSNeutralPFOsAlg", NeutralPFOsKey="CHSNeutralParticleFlowObjects", ThinNegativeEnergyNeutralPFOs=True, StreamName='StreamAOD') postalgs.append(CHSnPFOsThinAlg) from JetRec.JetRecConf import JetToolRunner from JetRec.JetRecConf import JetAlgorithm runners = [] if len(ctools) > 0: jtm += JetToolRunner("jetconstit", EventShapeTools=[], Tools=ctools, Timer=jetFlags.timeJetToolRunner()) job += JetAlgorithm("jetalgConstituents", Tools=[jtm.jetconstit]) # Add all the PseudoJetAlgorithms now # To avoid massive refactoring and to preserve familiarity, # kept calling things "getters", but these are already # PseudoJetAlgorithms as we eliminated the wrappers for getter in jtm.allGetters: job += getter # Then, add all event shape tools in separate algs for evstool in jtm.allEDTools: from EventShapeTools.EventShapeToolsConf import EventDensityAthAlg job += EventDensityAthAlg("edalg_" + evstool.OutputContainer, EventDensityTool=evstool) if separateJetAlgs: for t in jtm.jetrecs: jalg = JetAlgorithm("jetalg" + t.name(), Tools=[t]) job += jalg else: from JetRec.JetRecConf import JetToolRunner jtm += JetToolRunner("jetrun", EventShapeTools=[], Tools=rtools + jtm.jetrecs, Timer=jetFlags.timeJetToolRunner()) runners += [jtm.jetrun] job += JetAlgorithm("jetalg") jetalg = job.jetalg jetalg.Tools = runners if jetFlags.debug > 0: # jtm.setOutputLevel(jtm.jetrun, DEBUG) jetalg.OutputLevel = DEBUG if jetFlags.debug > 1: for tool in jtm.jetrecs: jtm.setOutputLevel(tool, DEBUG) if jetFlags.debug > 2: for tool in jtm.finders: jtm.setOutputLevel(tool, DEBUG) if jetFlags.debug > 3: jtm.setOutputLevel(jtm.jetBuilderWithArea, DEBUG) jtm.setOutputLevel(jtm.jetBuilderWithoutArea, DEBUG) for postalg in postalgs: job += postalg