def addJetFinderTool(self, toolname, alg, radius, ivtx=None, ghostArea=0.0, ptmin=0.0, rndseed=1, variableRMinRadius=-1.0, variableRMassScale=-1.0, constmods=[]): myname = "JetToolManager:addJetFinderTool: " if toolname in self.tools: m = "Tool " + myname + " is already registered" self.msg(0, m) raise LookupError(m) self.msg(2, "Adding finder tool") if ghostArea == 0.0: self.m_jetBuilder = self.jetBuilderWithoutArea else: self.m_jetBuilder = self.jetBuilderWithArea if self.m_jetBuilder == None: self.msg(0, "Jet builder must be specified") raise Error from JetRec.JetRecConf import JetFinder areaSuffix = "Area" if ghostArea > 0.0 else "" finder = JetFinder(toolname) finder.JetAlgorithm = alg finder.JetRadius = radius finder.VariableRMinRadius = variableRMinRadius finder.VariableRMassScale = variableRMassScale finder.RandomOption = rndseed finder.GhostArea = ghostArea if ptmin > 0.0: finder.PtMin = ptmin else: finder.PtMin = self.ptminFinder finder.JetBuilder = self.m_jetBuilder self += finder self.finders += [finder] hifinder = finder if type(ivtx) is int: from JetRec.JetRecConf import JetByVertexFinder vfinder = JetByVertexFinder(toolname + "ByVertex", JetFinder=finder, Vertex=ivtx) self += vfinder self.finders += [vfinder] hifinder = vfinder return (finder, hifinder)
def addJetFinderTool(self, toolname, alg, radius, ivtx =None, ghostArea =0.0, ptmin =0.0, rndseed =1, variableRMinRadius =-1.0, variableRMassScale =-1.0): myname = "JetToolManager:addJetFinderTool: " if toolname in self.tools: self.msg(0, "Tool " + myname + " is already registered") raise LookupError self.msg(2, "Adding finder tool") if ghostArea == 0.0: self.m_jetBuilder = self.jetBuilderWithoutArea else: self.m_jetBuilder = self.jetBuilderWithArea if self.m_jetBuilder == None: self.msg(0, "Jet builder must be specified") raise Error from JetRec.JetRecConf import JetFinder areaSuffix= "Area" if ghostArea>0.0 else "" finder = JetFinder(toolname); finder.JetAlgorithm = alg finder.JetRadius = radius finder.VariableRMinRadius = variableRMinRadius finder.VariableRMassScale = variableRMassScale finder.RandomOption = rndseed finder.GhostArea = ghostArea if ptmin > 0.0: finder.PtMin = ptmin else: finder.PtMin = self.ptminFinder finder.JetBuilder = self.m_jetBuilder self += finder self.finders += [finder] hifinder = finder; if type(ivtx) is int: from JetRec.JetRecConf import JetByVertexFinder vfinder = JetByVertexFinder( toolname + "ByVertex", JetFinder = finder, Vertex = ivtx ) self += vfinder self.finders += [vfinder] hifinder = vfinder; return (finder, hifinder)
# Find jet inputs. from JetRecTools.JetRecToolsConf import TCCPseudoJetGetter psjget = TCCPseudoJetGetter("TCCPseudoJetGetter_" + name) psjget.InputContainer = name psjget.Label = "TrackCaloCluster" psjget.OutputContainer = "PseudoJetClusters" + name # psjget.OutputLevel = INFO psjget.SkipNegativeEnergy = True ToolSvc += psjget # Find jets. from JetRec.JetRecConf import JetFinder jfind = JetFinder("JetFinder_" + name) jfind.JetAlgorithm = "AntiKt" jfind.JetRadius = 1.0 jfind.GhostArea = 0.01 jfind.PtMin = 200000.0 # jfind.OutputLevel = VERBOSE ToolSvc += jfind # JetRec tool for finding. jetrec = JetRecTool("JetRecTool_" + name) jetrec.OutputContainer = "AntiKt10" + name + "Jets" # jetrec.OutputLevel = INFO jetrec.PseudoJetGetters += [psjget] jetrec.JetFinder = jfind #jetrec.JetModifiers += [nsubjettiness] #jetrec.JetModifiers += [nsubjettinessratios] # jetrec.JetModifiers += [ktsplittingscale] # jetrec.JetModifiers += [dipolarity]
def addTriggerJetBuildTool( self, name, # passed to modifiers- might be used for SG?? alg, # jetFinderTool radius, # jetFinderTool # getter_label is passed to modifiers, # and also labels ParticleExtractors getter_label, concrete_type, iParticleRejectionTool, modifiersin=None, ivtxin=None, # jetFinderTool ghostArea=0.0, # jetFinderTool ptmin=0.0, # jetFinderTool ptminFilter=0.0, # ? rndseed=1, # jetFinderTool variableRMinRadius=-1.0, # jetFinderTool variableRMassScale=-1.0, # jetFinderTool calibOpt="", noNegE=False, OutputLevel=0): self.msg(2, "Adding TriggerJetBuildTool") #### TO BE REMOVED start # lofinder,hifinder = self.addJetFinderTool(name+"Finder", # alg, # radius, # ivtxin, # ghostArea, # ptmin, # rndseed, # variableRMinRadius, # variableRMassScale) # print 'called addJetFinderTool with arguments ' + ' ,'.join( # ( # str(name+"Finder"), # str(alg), # str(radius), # str(ivtxin), # str(ghostArea), # str(ptmin), # str(rndseed), # str(variableRMinRadius), # str(variableRMassScale), # )) + ' class ' + hifinder.__class__.__name__ #### TO BE REMOVED end from JetRec.JetRecConf import JetFromPseudojet jetFromPseudoJet = JetFromPseudojet(name + 'jFp') if ghostArea == 0.0: jetFromPseudoJet.Attributes = [] else: jetFromPseudoJet.Attributes = ["ActiveArea", "ActiveArea4vec"] jetFromPseudoJet.OutputLevel = OutputLevel self += jetFromPseudoJet from JetRec.JetRecConf import JetFinder finder = JetFinder(name + 'Finder') finder.JetBuilder = jetFromPseudoJet finder.OutputLevel = OutputLevel finder.JetAlgorithm = alg finder.VariableRMinRadius = variableRMinRadius finder.VariableRMassScale = variableRMassScale finder.GhostArea = ghostArea finder.JetRadius = radius finder.PtMin = ptmin finder.RandomOption = 1 # 1: used run/evt number to make seed # !!! note RandomOption not set FIXME self += finder # self.ptminFilter used in self.buildModifiers ptminSave = self.ptminFilter if ptminFilter > 0.0: self.ptminFilter = ptminFilter # getters supply a label to the modifiers. class Dummy(object): def __init__(self): pass dummyGetter = Dummy() dummyGetter.Label = getter_label getters = [dummyGetter] #class DummyGetter(object): # def __init__(self, label): # self.Label = label # getters = [DummyGetter(getter_label)] gettersin = 'mymods' # from Run2 code dummyFinder = Dummy() dummyFinder.JetAlgorithm = alg dummyFinder.JetRadius = radius modifiers = self.buildModifiers( modifiersin=modifiersin, # finder=lofinder, finder=dummyFinder, getters=getters, altname=gettersin, calibOpt=calibOpt, output='', ) for m in modifiers: self.setOutputLevel(m, OutputLevel) # Temporary hard-coded solution until this config is deprecated. triggerPrefix = "HLT_xAOD__JetContainer_" self.autoconfigureModifiers(modifiers, triggerPrefix + name.split('_')[1]) self.ptminFilter = ptminSave # Retrieve/build the jet finder. from TrigHLTJetRec.TrigHLTJetRecConf import TriggerJetBuildTool builder = TriggerJetBuildTool(name) # print ('setting builder name to ', name) print('adding new trigger jet finder ', name) # self.setOutputLevel(hifinder, OutputLevel) # builder.JetFinder = hifinder builder.JetFinder = finder builder.JetModifiers = modifiers # builder.NoNegE = noNegE # builder.label = getter_label builder.OutputLevel = OutputLevel builder.concrete_type = concrete_type builder.iParticleRejecter = iParticleRejectionTool self += builder return builder
# 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 f4.JetBuilder = o4 jalg4.Tools += [j4] topSequence += jalg4 jetFlags.jetAODList += ["xAOD::JetContainer#AntiKt4EMTopoJets"]
def addJetFinder(self, output, alg, radius, gettersin, modifiersin =None, ivtxin =None, ghostArea =0.0, ptmin =0.0, ptminFilter =0.0, rndseed =1, isTrigger =False, useTriggerStore =False, variableRMinRadius =-1.0, variableRMassScale =-1.0, calibOpt =""): from JetRec.JetRecConf import JetByVertexFinder self.msg(2, "Adding finder") if ghostArea == 0.0: self.m_jetBuilder = self.jetBuilderWithoutArea else: self.m_jetBuilder = self.jetBuilderWithArea if self.m_jetBuilder == None: self.msg(0, "Jet builder must be specified") raise Error from JetRec.JetRecConf import JetFinder from JetRec.JetRecConf import JetSplitter from JetRec.JetRecConf import JetRecTool if type(gettersin) == str: getters = self.gettersMap[gettersin] else: getters = gettersin areaSuffix= "Area" if ghostArea>0.0 else "" finder = JetFinder(output + areaSuffix+ "Finder") finder.JetAlgorithm = alg finder.JetRadius = radius finder.VariableRMinRadius = variableRMinRadius finder.VariableRMassScale = variableRMassScale finder.RandomOption = rndseed finder.GhostArea = ghostArea if ptmin > 0.0: finder.PtMin = ptmin else: finder.PtMin = self.ptminFinder finder.JetBuilder = self.m_jetBuilder self += finder jrfinder = finder; # If jet finding by vertex is not specified, check for special input type names ivtx = ivtxin if ivtx == None: if gettersin == "ztrack": ivtx = -1 # Find tracs separatesly for each vertex elif gettersin == "pv0track": ivtx = 0 # Find tracks only for 1st vertex # If jet finding by vertex is requested, change the finder if type(ivtx) is int: vfinder = JetByVertexFinder( output + "VertexFinder", JetFinder = finder, Vertex = ivtx ) self += vfinder jrfinder = vfinder; jetrec = JetRecTool(output) jetrec.PseudoJetGetters = getters jetrec.JetFinder = jrfinder jetrec.OutputContainer = output ptminSave = self.ptminFilter if ptminFilter > 0.0: self.ptminFilter = ptminFilter jetrec.JetModifiers = self.buildModifiers(modifiersin, finder, getters, gettersin, output, calibOpt) self.ptminFilter = ptminSave jetrec.Trigger = isTrigger or useTriggerStore jetrec.Timer = self.timer self += jetrec self.finders += [finder] if isTrigger: self.trigjetrecs += [jetrec] else: self.jetrecs += [jetrec] self.jetcons += [output] return jetrec