def declareDefaultTools(): from JetRecConfig.JetRecFlags import jetFlags from JetRecConfig.JetRecStandardToolManager import jtm from JetRec.JetRecConf import PseudoJetGetter #-------------------------------------------------------------- # Pseudojet builders. #-------------------------------------------------------------- # Prepare a sequence of input constituent modifiers from JetRecToolsConfig import ctm jtm += ctm.buildConstitModifSequence( "JetConstitSeq_LCOrigin", OutputContainer='LCOriginTopoClusters', InputContainer='CaloCalTopoClusters', modList=['lc_origin']) jtm += ctm.buildConstitModifSequence( "JetConstitSeq_EMOrigin", OutputContainer='EMOriginTopoClusters', InputContainer='CaloCalTopoClusters', modList=['em_origin']) jtm += PseudoJetGetter( "lcoriginget", InputContainer=jtm.JetConstitSeq_LCOrigin.OutputContainer, Label="LCTopoOrigin", OutputContainer=jtm.JetConstitSeq_LCOrigin.OutputContainer + "PseudoJet", SkipNegativeEnergy=True, GhostScale=0.0) jtm += PseudoJetGetter( "emoriginget", InputContainer=jtm.JetConstitSeq_EMOrigin.OutputContainer, Label="EMTopoOrigin", OutputContainer=jtm.JetConstitSeq_EMOrigin.OutputContainer + "PseudoJet", SkipNegativeEnergy=True, GhostScale=0.0)
#jetrec_trimm.JetModifiers += [energycorrelatorratios] # jetrec_trimm.JetModifiers += [pull] # jetrec_trimm.JetModifiers += [charge] # jetrec_trimm.JetModifiers += [subjetmaker] # jetrec_trimm.JetModifiers += [subjetfinder] ToolSvc += jetrec_trimm # Add the algorithm. It runs the demo tools. jetalg = JetAlgorithm("JetAlg_" + name) # jetalg.OutputLevel = INFO jetalg.Tools += [jetrec, jetrec_trimm] topSequence += jetalg # Find jet inputs. from JetRec.JetRecConf import PseudoJetGetter psjget = PseudoJetGetter("PseudoJetGetter") psjget.InputContainer = "TimedCaloCalTopoClusters" psjget.Label = "LCTopoOrigin" psjget.OutputContainer = "PseudoJetLCTopoOrigin" # psjget.OutputLevel = INFO psjget.SkipNegativeEnergy = True ToolSvc += psjget psjget2 = PseudoJetGetter("cget_ghost") psjget2.InputContainer = "InDetTrackParticles" psjget2.Label = "GhostTrack" psjget2.OutputContainer = "PseudoJetGhostTrack" # psjget.OutputLevel = INFO psjget2.GhostScale = 1e-40 ToolSvc += psjget2
from JetRec.JetRecConf import PseudoJetGetter ClusterKey=HIJetFlags.HIClusterKey() from HIJetRec.HIJetRecConf import HIClusterPseudoJetGetter jtm += HIClusterPseudoJetGetter("get_HI", InputContainer = ClusterKey, Label = "LCTopo", #Label = "Tower", OutputContainer = "PseudoJet" + ClusterKey, SkipNegativeEnergy = False, TreatNegativeEnergyAsGhost=True, GhostScale = 1.e-20 ) jtm += PseudoJetGetter("gakt4trackget_HI", InputContainer = HIJetFlags.TrackJetContainerName(), Label = "Ghost" + HIJetFlags.TrackJetContainerName(), SkipNegativeEnergy = True, OutputContainer = "PseudoJetGhost" + HIJetFlags.TrackJetContainerName(), GhostScale = 1.e-20) HIgetters_ghost_track = [] HIgetters_common=[] if jetFlags.useMuonSegments(): HIgetters_common += [jtm.gmusegget] if jetFlags.useTracks(): HIgetters_ghost_track += [jtm.gakt4trackget_HI] if HIJetFlags.UseHITracks() : HIgetters_ghost_track += [jtm.gtrackget_HI] else: HIgetters_ghost_track += [jtm.gtrackget] if jetFlags.useTruth(): #HIgetters_common += [jtm.gtruthget] flavorgetters=[] for ptype in jetFlags.truthFlavorTags():
jtm.modifiersMap["largevr_track_modifiers"] = [jtm.ktsplitter] # (nikola: what is this used for?) jfind_smallvr_track = jtm.addJetFinder("AntiKtVR50Rmax4Rmin0TrackJets", "AntiKt", 0.4, "pv0track", "smallvr_track_modifiers", ghostArea = 0 , ptmin = 2000, ptminFilter = 7000, variableRMinRadius = 0, variableRMassScale = 50000, calibOpt = "none") from JetRec.JetRecConf import JetAlgorithm jetalg_smallvr_track= JetAlgorithm("jfind_smallvr_track", Tools = [jfind_smallvr_track]) FTAG5Seq += jetalg_smallvr_track from JetRec.JetRecConf import PseudoJetGetter jtm += PseudoJetGetter( "gvr50rmax4rmin0trackget", # give a unique name InputContainer = jetFlags.containerNamePrefix() + "AntiKtVR50Rmax4Rmin0TrackJets", # SG key Label = "GhostVR50Rmax4Rmin0TrackJet", # this is the name you'll use to retrieve ghost associated VR track jets OutputContainer = "PseudoJetGhostVR50Rmax4Rmin0TrackJet", SkipNegativeEnergy = True, GhostScale = 1.e-20, # this makes the PseudoJet Ghosts, and thus the reco flow will treat them as such ) jtm.gettersMap["lctopo"]+= [jtm.gvr50rmax4rmin0trackget] # has to happen before the trimmed jet gets clustered for the VR track jets to be ghost associated #=================================================================== # Build Trimmed large-R jet #=================================================================== # trim the large-R jets - the VR track jets will become ghost associated to the large-R jets and stored in the trimmed large-R jet collection (nikola: confirm) addDefaultTrimmedJets(FTAG5Seq, "FTAG5") applyJetCalibration_CustomColl("AntiKt10LCTopoTrimmedPtFrac5SmallR20", FTAG5Seq) #===================================================================
inpdmp.OutputLevel = INFO jetalg.Tools += [inpdmp] # JetRec tool for finding. if 0: from JetRec.JetRecConf import JetRecTool ToolSvc += JetRecTool("jetrec") jetrec = ToolSvc.jetrec jetrec.OutputContainer = "MyNewJets" jetrec.OutputLevel = INFO jetalg.Tools += [jetrec] # Find jet inputs. if 0: from JetRec.JetRecConf import PseudoJetGetter ToolSvc += PseudoJetGetter("psjget") psjget = ToolSvc.psjget psjget.InputContainer = clname psjget.Label = "Cluster" psjget.OutputContainer = "PseudoJetClusters" psjget.OutputLevel = INFO psjget.SkipNegativeEnergy = True jetrec.PseudoJetGetters += [psjget] # Find jets. if 0: from JetRec.JetRecConf import JetFinder ToolSvc += JetFinder("jfind") jfind = ToolSvc.jfind jfind.JetAlgorithm = "AntiKt" jfind.JetRadius = 0.8
# Prepare a sequence of input constituent modifiers from JetRecTools.JetRecToolsConfig import ctm jtm += ctm.buildConstitModifSequence("JetConstitSeq_LCOrigin", OutputContainer='LCOriginTopoClusters', InputContainer='CaloCalTopoClusters', modList=['lc_origin']) jtm += ctm.buildConstitModifSequence("JetConstitSeq_EMOrigin", OutputContainer='EMOriginTopoClusters', InputContainer='CaloCalTopoClusters', modList=['em_origin']) jtm += PseudoJetGetter( "lcoriginget", InputContainer=jtm.JetConstitSeq_LCOrigin.OutputContainer, Label="LCTopo", OutputContainer=jtm.JetConstitSeq_LCOrigin.OutputContainer + "PseudoJet", SkipNegativeEnergy=True, GhostScale=0.0) jtm += PseudoJetGetter( "emoriginget", InputContainer=jtm.JetConstitSeq_EMOrigin.OutputContainer, Label="EMTopo", OutputContainer=jtm.JetConstitSeq_EMOrigin.OutputContainer + "PseudoJet", SkipNegativeEnergy=True, GhostScale=0.0) # Clusters. jtm += PseudoJetGetter("lcget", InputContainer="CaloCalTopoClusters",
# Now we can run the UFO building taking our unified PFlow container as input from TrackCaloClusterRecTools.TrackCaloClusterConfig import runUFOReconstruction emufoAlg = runUFOReconstruction(jetm15Seq, ToolSvc, PFOPrefix="CHS", caloClusterName="LCOriginTopoClusters") emcsskufoAlg = runUFOReconstruction(jetm15Seq, ToolSvc, PFOPrefix="CSSK", caloClusterName='LCOriginTopoClusters') from JetRec.JetRecConf import PseudoJetGetter csskufopjgetter = PseudoJetGetter("csskufoPJGetter", InputContainer="CSSKUFO", OutputContainer="CSSKUFOPJ", Label="UFO", SkipNegativeEnergy=True) jtm += csskufopjgetter ufopjgetter = PseudoJetGetter("ufoPJGetter", InputContainer="CHSUFO", OutputContainer="CHSUFOPJ", Label="UFO", SkipNegativeEnergy=True) jtm += ufopjgetter # These lines make sure that we also retrieve all of the other getters, like track association # addConstModJets doesn't have a good way of dealing with UFOs at the moment unfortunately csskufogetters = [csskufopjgetter] + list(jtm.gettersMap["tcc"])[1:] chsufogetters = [ufopjgetter] + list(jtm.gettersMap["tcc"])[1:] addStandardJets("AntiKt",
def declareDefaultTools(): from JetRecConfig.JetRecFlags import jetFlags from JetRecConfig.JetRecStandardToolManager import jtm from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier from JetRec.JetRecConf import PseudoJetGetter try: from ParticleJetTools.ParticleJetToolsConf import Analysis__JetQuarkLabel jtm.haveParticleJetTools = True except: jtm.haveParticleJetTools = False if jtm.haveParticleJetTools: from ParticleJetTools.ParticleJetToolsConf import Analysis__JetConeLabeling from ParticleJetTools.ParticleJetToolsConf import Analysis__JetPartonTruthLabel from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles from ParticleJetTools.ParticleJetToolsConf import ParticleJetDeltaRLabelTool ghostScaleFactor = 1e-40 #-------------------------------------------------------------- # Truth selection. #-------------------------------------------------------------- if jetFlags.useTruth: truthClassifier = MCTruthClassifier(name="JetMCTruthClassifier", ParticleCaloExtensionTool="") jtm += truthClassifier jtm += CopyTruthJetParticles("truthpartcopy", OutputName="JetInputTruthParticles", MCTruthClassifier=truthClassifier) jtm += CopyTruthJetParticles("truthpartcopywz", OutputName="JetInputTruthParticlesNoWZ", MCTruthClassifier=truthClassifier, IncludePromptLeptons=False, IncludeMuons=True, IncludeNeutrinos=True) # Truth. if jetFlags.useTruth and jtm.haveParticleJetTools: # ParticleJetTools tools may be omitted in analysi releases. #ift jtm.haveParticleJetTools: # Delta-R truth parton label: truthpartondr. jtm += Analysis__JetQuarkLabel("jetquarklabel", McEventCollection="TruthEvents") jtm += Analysis__JetConeLabeling("truthpartondr", JetTruthMatchTool=jtm.jetquarklabel) # Parton truth label. jtm += Analysis__JetPartonTruthLabel("partontruthlabel") # Cone matching for B, C and tau truth for all but track jets. jtm += ParticleJetDeltaRLabelTool( "jetdrlabeler", LabelName="HadronConeExclTruthLabelID", DoubleLabelName="HadronConeExclExtendedTruthLabelID", BLabelName="ConeExclBHadronsFinal", CLabelName="ConeExclCHadronsFinal", TauLabelName="ConeExclTausFinal", BParticleCollection="TruthLabelBHadronsFinal", CParticleCollection="TruthLabelCHadronsFinal", TauParticleCollection="TruthLabelTausFinal", PartPtMin=5000.0, JetPtMin=0.0, DRMax=0.3, MatchMode="MinDR") # Cone matching for B, C and tau truth for track jets. jtm += ParticleJetDeltaRLabelTool( "trackjetdrlabeler", LabelName="HadronConeExclTruthLabelID", DoubleLabelName="HadronConeExclExtendedTruthLabelID", BLabelName="ConeExclBHadronsFinal", CLabelName="ConeExclCHadronsFinal", TauLabelName="ConeExclTausFinal", BParticleCollection="TruthLabelBHadronsFinal", CParticleCollection="TruthLabelCHadronsFinal", TauParticleCollection="TruthLabelTausFinal", PartPtMin=5000.0, JetPtMin=4500.0, DRMax=0.3, MatchMode="MinDR") jtm += PseudoJetGetter( "truthget", Label="Truth", InputContainer=jtm.truthpartcopy.OutputName, OutputContainer="PseudoJetTruth", GhostScale=0.0, SkipNegativeEnergy=True, ) jtm += PseudoJetGetter( "truthwzget", Label="TruthWZ", InputContainer=jtm.truthpartcopywz.OutputName, OutputContainer="PseudoJetTruthWZ", GhostScale=0.0, SkipNegativeEnergy=True, ) jtm += PseudoJetGetter( "gtruthget", Label="GhostTruth", InputContainer=jtm.truthpartcopy.OutputName, OutputContainer="PseudoJetGhostTruth", GhostScale=ghostScaleFactor, SkipNegativeEnergy=True, ) # Truth flavor tags. for ptype in jetFlags.truthFlavorTags(): jtm += PseudoJetGetter( "gtruthget_" + ptype, InputContainer="TruthLabel" + ptype, Label="Ghost" + ptype, OutputContainer="PseudoJetGhost" + ptype, SkipNegativeEnergy=True, GhostScale=ghostScaleFactor, )
0.4, "empflow_reduced", "pflow_ungroomed", ghostArea=0.01, ptmin=5000, ptminFilter=10000, calibOpt="arj:pflow") ############################################################################################ #Use a sequence and PseudoJetGetter to reconstruct PF jets from JetRec.JetRecConf import PseudoJetGetter jtm += PseudoJetGetter( "PFGetter", Label="EMPFlow", InputContainer="MyParticleFlowObjects", OutputContainer="PFPseudoJet", SkipNegativeEnergy=True, ) import cppyy try: cppyy.loadDictionary('xAODBaseObjectTypeDict') except: pass from ROOT import xAODType xAODType.ObjectType #this tool does much of the PFO manipulations in PFlowPseudoJetGetter from JetRecTools.JetRecToolsConf import CorrectPFOTool correctPFOTool = CorrectPFOTool("correctPFOTool", WeightPFOTool=jtm.pflowweighter,
def buildVRJets(sequence, do_ghost, logger=None, doFlipTagger=False, training='201810'): from AthenaCommon import Logging if logger is None: logger = Logging.logging.getLogger('VRLogger') supported_trainings = ['201810', '201903'] # Check allowed trainings # Is there a better way to do this with a central DB? if training not in ['201810', '201903']: logger.warning( "WARNING: Using an unsupported training tag! This is UNDEFINED and will probably break. Please choose a training tag from" ) logger.warning(supported_trainings) from JetRec.JetRecStandard import jtm # Making Chris Happy: all VR track-jet b-tagging should have the training campaign label trainingTag = '_BTagging%s' % (training) VRJetName = "AntiKtVR30Rmax4Rmin02Track%s" % (trainingTag) VRGhostLabel = "GhostVR30Rmax4Rmin02TrackJet%s" % (trainingTag) VRJetAlg = "AntiKt" VRJetRadius = 0.4 VRJetInputs = 'pv0track' VRJetOptions = dict(ghostArea=0, ptmin=4000, variableRMinRadius=0.02, variableRMassScale=30000, calibOpt="none") # Change some options if we have do_ghost set to true. Hopefully # this will be the only VR collection in the future. if do_ghost: ghost_suffix = "GhostTag" VRJetName += ghost_suffix VRGhostLabel += ghost_suffix #========================================================== # Build VR jets #========================================================== from DerivationFrameworkJetEtMiss.ExtendedJetCommon import nameJetsFromAlg VRJetRecToolName = nameJetsFromAlg(VRJetName) VRJetAlgName = "jfind_%s" % (VRJetRecToolName) VRJetBTagName = "BTagging_%s" % (VRJetName.replace('BTagging', '')) logger.info("VR Btag name: %s" % VRJetBTagName) logger.info("VR jet name: %s" % VRJetRecToolName) from AthenaCommon.AppMgr import ToolSvc #make the btagging tool for VR jets from BTagging.BTaggingFlags import BTaggingFlags BTaggingFlags.CalibrationChannelAliases += [ "AntiKtVR30Rmax4Rmin02Track->AntiKtVR30Rmax4Rmin02Track,AntiKt4EMTopo" ] BTaggingFlags.CalibrationChannelAliases += [ "%s->AntiKtVR30Rmax4Rmin02Track,AntiKt4EMTopo" % (VRJetName) ] btag_vrjets = ConfInst.setupJetBTaggerTool( ToolSvc, JetCollection=VRJetRecToolName, AddToToolSvc=True, Verbose=True, options={ "name": VRJetBTagName.lower(), "BTagName": VRJetBTagName, "BTagJFVtxName": "JFVtx", "BTagSVName": "SecVtx", }, SetupScheme="", TaggerList=BTaggingFlags.ExpertTaggers if doFlipTagger else BTaggingFlags.StandardTaggers, TrackAssociatorName="GhostTrack" if do_ghost else "MatchedTracks", ) # add Ghost label id from ParticleJetTools.ParticleJetToolsConf import ( ParticleJetGhostLabelTool as GhostLabelTool) gl_tool = GhostLabelTool(name=VRJetRecToolName + "_GhostLabeling") ToolSvc += gl_tool from BTagging.BTaggingConfiguration import defaultTrackAssoc, defaultMuonAssoc # Slice the array - this forces a copy so that if we modify it we don't also # change the array in jtm. pseudoJetGetters = jtm.gettersMap[VRJetInputs][:] # We want to include ghost associated tracks in the pv0 tracks so that # we can use the looser ghost association criteria for b-tagging. if VRJetInputs == "pv0track": pseudoJetGetters.append(jtm["gtrackget"]) if VRJetAlgName in DFJetAlgs: logger.info("Algorithm %s already built before" % VRJetAlgName) if hasattr(sequence, VRJetAlgName): logger.info("Sequence %s already has an instance of algorithm %s" % (sequence, VRJetAlgName)) else: logger.info("Add algorithm %s to sequence %s" % (VRJetAlgName, sequence)) sequence += DFJetAlgs[VRJetAlgName] else: logger.info("Create algorithm %s" % VRJetAlgName) if hasattr(jtm, VRJetRecToolName): logger.info("JetRecTool %s is alredy in jtm.tools in sequence %s" % (VRJetRecToolName, sequence)) else: logger.info("Create JetRecTool %s" % VRJetRecToolName) #can only run trackjetdrlabeler with truth labels, so MC only mods = [defaultTrackAssoc, defaultMuonAssoc, btag_vrjets] if isMC: mods += [jtm.trackjetdrlabeler, gl_tool] jtm.addJetFinder(VRJetRecToolName, VRJetAlg, VRJetRadius, pseudoJetGetters, modifiersin=mods, ivtxin=0, **VRJetOptions) from JetRec.JetRecConf import JetAlgorithm jetalg_smallvr30_track = JetAlgorithm(VRJetAlgName, Tools=[jtm[VRJetRecToolName]]) sequence += jetalg_smallvr30_track DFJetAlgs[VRJetAlgName] = jetalg_smallvr30_track #========================================================== # Build PseudoJet Getter #========================================================== pjgettername = VRGhostLabel.lower() from DerivationFrameworkJetEtMiss.ExtendedJetCommon import nameJetsFromAlg if hasattr(jtm, pjgettername): logger.info("Found %s in jtm in sequence %s" % (pjgettername, sequence)) else: logger.info("Add %s to jtm in sequence %s" % (pjgettername, sequence)) inputContainerName = jetFlags.containerNamePrefix() + nameJetsFromAlg( VRJetName) from JetRec.JetRecConf import PseudoJetGetter jtm += PseudoJetGetter( pjgettername, # give a unique name InputContainer=inputContainerName, # SG key Label= VRGhostLabel, # this is the name you'll use to retrieve ghost associated VR track jets OutputContainer="PseudoJet" + VRGhostLabel, SkipNegativeEnergy=True, GhostScale= 1.e-20, # this makes the PseudoJet Ghosts, and thus the reco flow will treat them as such ) return VRJetName, VRGhostLabel
def addTruthJetsEVNT(kernel=None, decorationDressing=None): # Ensure that we are running on something if kernel is None: from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob kernel = DerivationFrameworkJob # Add jet algorithms if they aren't there from JetRec.JetRecStandard import jtm from JetRec.JetRecConf import JetAlgorithm truth_modifiers = [ jtm.truthpartondr, jtm.partontruthlabel, jtm.jetdrlabeler, jtm.trackjetdrlabeler ] if not objKeyStore.isInInput("xAOD::JetContainer", "AntiKt4TruthJets") and not hasattr( kernel, 'jetalgAntiKt4Truth'): # Standard truth jets # To remove jet constituents add the modifier jtm.removeconstit from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets addStandardJets("AntiKt", 0.4, "Truth", 15000, mods=truth_modifiers, algseq=kernel, outputGroup="DFCommonMCTruthJets") if not objKeyStore.isInInput("xAOD::JetContainer", "AntiKt4TruthWZJets") and not hasattr( kernel, 'jetalgAntiKt4TruthWZ'): # WZ Truth Jets - handle non-dressed case from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets addStandardJets("AntiKt", 0.4, "TruthWZ", 15000, mods=truth_modifiers, algseq=kernel, outputGroup="DFCommonMCTruthJets") if not objKeyStore.isInInput( "xAOD::JetContainer", "AntiKt4TruthDressedWZJets") and decorationDressing is not None: # WZ Dressed Truth Jets - handle dressed case from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets addStandardJets("AntiKt", 0.4, "TruthDressedWZ", ptmin=15000, mods="truth_ungroomed", algseq=kernel, outputGroup="DFCommonMCTruthJets") if not objKeyStore.isInInput("xAOD::JetContainer", "AntiKt2TruthChargedJets"): # R=0.2 truth charged jets from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets addStandardJets("AntiKt", 0.2, "TruthCharged", 5000, mods=truth_modifiers, algseq=kernel, outputGroup="DFCommonMCTruthJets") if not objKeyStore.isInInput("xAOD::JetContainer", "AntiKt10TruthJets") and not hasattr( kernel, 'jetalgAntiKt10Truth'): # AntiKt2 truth charged jets ghost association from JetRec.JetRecConf import PseudoJetGetter if not 'gakt2truthchargedget' in jtm.tools: jtm += PseudoJetGetter( "gakt2truthchargedget", # give a unique name InputContainer="AntiKt2TruthChargedJets", # SG key Label= "GhostAntiKt2TruthChargedJets", # this is the name you'll use to retrieve associated ghosts OutputContainer="PseudoJetGhostAntiKt2TruthChargedJet", SkipNegativeEnergy=True, GhostScale= 1.e-20, # This makes the PseudoJet Ghosts, and thus the reco flow will treat them as so. ) trackjetgetters = [] trackjetgetters += [jtm.gakt2truthchargedget] truthgetters = [jtm.truthget] truthgetters += trackjetgetters flavorgetters = [] for ptype in jetFlags.truthFlavorTags(): flavorgetters += [getattr(jtm, "gtruthget_" + ptype)] truthgetters += flavorgetters jtm.gettersMap["truth"] = list(truthgetters) # NB! This line works together with the next block. Some care is required here! # If we build groomed jets, the jet code will automatically build ungroomed jets, so no need to add them separately #Large R ungroomed jets if objKeyStore.isInInput("xAOD::JetContainer", "AntiKt10TruthTrimmedPtFrac5SmallR20Jets"): from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets addStandardJets('AntiKt', 1.0, 'Truth', ptmin=50000, mods=truth_modifiers, algseq=kernel, outputGroup="DFCommonMCTruthJets") if not objKeyStore.isInInput( "xAOD::JetContainer", "AntiKt10TruthTrimmedPtFrac5SmallR20Jets") and not hasattr( kernel, 'jetalgAntiKt10TruthTrimmedPtFrac5SmallR20'): #Large R jets from DerivationFrameworkJetEtMiss.JetCommon import addTrimmedJets
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)
from JetRec.JetRecConf import JetFinder from JetRec.JetRecConf import JetFromPseudojet from AthenaCommon.AppMgr import ToolSvc # ParticleJetMaps # schedule one standard jetfinder on which all others depend # the weirdo "ParticleJetMap thingy should then be existing for all. Still a race condition problem, but much less I hope... # Note: add dependencies in the CaloHiveDeps.py # anti-kt 4 standardjets jalg4 = JetAlgorithm("jetalg4") j4 = JetRecTool("jetrectool4", OutputContainer="AntiKt4EMTopoJets") g4 = PseudoJetGetter("emget4", InputContainer="CaloTopoCluster", Label="EMTopo", OutputContainer="PseudoJetEMTopo4", SkipNegativeEnergy=True, GhostScale=0.0) f4 = JetFinder("fastjet-4") f4.JetAlgorithm = "AntiKt" f4.JetRadius = 0.4 f4.GhostArea = 0.0 f4.PtMin = 10.0 o4 = JetFromPseudojet("out4") ToolSvc += JetRecTool("jetrectool4") ToolSvc += PseudoJetGetter("emget4") ToolSvc += JetFinder("fastjet-4") ToolSvc += JetFromPseudojet("out4") j4.PseudoJetGetters += [g4] j4.JetFinder = f4
ServiceMgr.MessageSvc.verboseLimit = 100000 #jtm.setOutputLevel("jblda", VERBOSE) #jtm.setOutputLevel("jetens", VERBOSE) #-------------------------------------------------------------- # Configure jet reconstruction. #-------------------------------------------------------------- # Special flag to create jet containers in trigger format. #jtm.useTriggerStore = True if r19data: from JetRec.JetRecConf import PseudoJetGetter jtm += PseudoJetGetter("lcgetr19", InputContainer="CaloCalTopoCluster", Label="LCTopo", OutputContainer="PseudoJetLCTopo", SkipNegativeEnergy=True, GhostScale=0.0) # Build a new list of jet inputs. # See JetRec/python/JetRecStandardTools.py for standard definitions # and syntax for adding more. # Here we add a new list of inputs with the name "mygetters". jtm.gettersMap["mygetters"] = [jtm.lcgetr19] print jtm.gettersMap.keys() # Add tools to find or groom jets. # Each call to addJetFinder adds one JetRecTool so that one jet # container will be added to the event. # The first argument is the name of that container. # The next two are the jet algorithm (Kt, AntiKt, CamKt) and