def setupTrackJets(myjetfinder, myjetdr, GroomedDicts, theseq): myGroomingTools, catNames = getGroomingTools(GroomedDicts) sortertool = JetSorterTool('JS_JetSorter', SortOrder="ByPtDown", OutputLevel=3 ) widthtool = JetWidthTool('JS_JetWidthTool') assoc_tool_track = JetSubStructure.JetAssociationTool( name = 'JetAssocToolTrack', AssociatorTools = [], GroomingTools = myGroomingTools, UsedSignalState = 2, JetAlgTools = [sortertool, widthtool], OutputLevel = 3 ) jetsubstructure_tool_track = JetSubStructure.JetSubstructureTool( name = 'JetSubstructureToolTrack', UsedSignalState = 2, OutputLevel=3, SubstructureTools = [JetSubStructure.NSubjettinessTool("myNSubjettinessTool", N=[1,2,3], R0=myjetdr, GroomedjetsAuthor = catNames), JetSubStructure.KtHadSubstructureTool("myhadtool", GroomedjetsAuthor = catNames), JetSubStructure.DipolarityTool("myDipolarityTool",GroomedjetsAuthor = catNames) ]) #---- TrackJet ---- jetFlags.finalMinEt = 30*GeV from QcdD3PDMaker.JSTrackJets import createJSTrackJets mygetter = createJSTrackJets(theseq, myjetfinder,myjetdr) jetFlags.finalMinEt =30*GeV trackjetcontname = mygetter.outputKey() add_jetMoments_to_JetAlg(mygetter, [widthtool]) #---- End TrackJet ---- make_JetMomentGetter(trackjetcontname , [assoc_tool_track, jetsubstructure_tool_track], theseq ) return [ trackjetcontname, catNames ]
def setupTrackJets(myjetfinder, myjetdr, GroomedDicts, theseq): myGroomingTools, catNames = getGroomingTools(GroomedDicts) catNames_trimmed = list(x for x in catNames if 'Trimmed' in x) sortertool = JetSorterTool('myJetSorter', SortOrder="ByPtDown", OutputLevel=3) wrapped_sortertool = JetSubStructure.JetAlgToolWrapper( "JetSorterWrapper", JetAlgTool=sortertool, GroomedjetsAuthor=catNames_trimmed) widthtool = JetWidthTool('JS_JetWidthTool') e_assoc = JetSubStructure.ElectronJetAssociatorTool( "JSEAssocTrack", ContainerName='ElectronAODCollection', UseCluster=False, UseTrack=True, dR=myjetdr, OutputLevel=3) mu_assoc = JetSubStructure.MuonJetAssociatorTool( "JSMuAssocTrack", ContainerName='MuidMuonCollection', UseTrack=True, dR=myjetdr, OutputLevel=3) assoc_tool_track = JetSubStructure.JetAssociationTool( name='JetAssocToolTrack', AssociatorTools=[e_assoc, mu_assoc], GroomingTools=myGroomingTools, UsedSignalState=2, JetAlgTools=[wrapped_sortertool, widthtool], OutputLevel=3) jetsubstructure_tool_track = JetSubStructure.JetSubstructureTool( name='JetSubstructureToolTrack', UsedSignalState=2, OutputLevel=3, SubstructureTools=[ JetSubStructure.NSubjettinessTool( "myNSubjettinessTool", N=[1, 2, 3], R0=myjetdr, GroomedjetsAuthor=catNames_trimmed), JetSubStructure.KtHadSubstructureTool( "myhadtool", GroomedjetsAuthor=catNames_trimmed), JetSubStructure.KtElectronSubstructureTool("myelectool", GroomedjetsAuthor=[]), JetSubStructure.KtMuonSubstructureTool("mymuontool", GroomedjetsAuthor=[]), JetSubStructure.JetPullVectorTool( "myJetPullVectorTool", GroomedjetsAuthor=catNames_trimmed) ]) #---- TrackJet ---- #jetFlags.finalMinEt = 5*GeV from BoostedTopD3PDMaker.JSTrackJets import createJSTrackJets mygetter = createJSTrackJets(theseq, myjetfinder, myjetdr) trackjetcontname = mygetter.outputKey() add_jetMoments_to_JetAlg(mygetter, [widthtool]) #---- End TrackJet ---- sss = make_JetMomentGetter(trackjetcontname, [assoc_tool_track, jetsubstructure_tool_track], theseq) ## for lepton assoc jetcont = trackjetcontname[:-4] #removing the 'Jets' for x in catNames_trimmed: make_JetMomentGetter(jetcont + x + 'Jets', [ JetSubStructure.JetAssociationTool( 'JetAssocToolTrackGr', AssociatorTools=[e_assoc, mu_assoc], GroomingTools=[], UsedSignalState=2, JetAlgTools=[]), JetSubStructure.JetSubstructureTool( 'JetSubstructureToolTrackGr', UsedSignalState=2, SubstructureTools=[ JetSubStructure.KtElectronSubstructureTool( "myelectool", GroomedjetsAuthor=[]), JetSubStructure.KtMuonSubstructureTool( "mymuontool", GroomedjetsAuthor=[]) ]) ], theseq) return [trackjetcontname, catNames]
'Track', outputCollectionName='AntiKt3TrackJets', allTools=[MyJetTrackZClusterTool6, JetSorterTool()]).jetAlgorithmHandle() #TrackJetAlg7=make_StandardJetGetter('AntiKt', 0.8, 'Track', outputCollectionName='AntiKt8TrackJets', allTools=[MyJetTrackZClusterTool7,JetSorterTool()] ).jetAlgorithmHandle() TrackJetAlg8 = make_StandardJetGetter( 'Kt', 0.3, 'Track', outputCollectionName='Kt3TrackJets', allTools=[MyJetTrackZClusterTool8, JetSorterTool()]).jetAlgorithmHandle() from JetRec.JetMomentGetter import add_jetMoments_to_JetAlg from JetMomentTools.JetMomentToolsConf import JetWidthTool widthtool = JetWidthTool('JS_JetWidthTool') add_jetMoments_to_JetAlg(TrackJetAlg1, [widthtool]) #add_jetMoments_to_JetAlg(TrackJetAlg2, [widthtool]) #add_jetMoments_to_JetAlg(TrackJetAlg3, [widthtool]) #add_jetMoments_to_JetAlg(TrackJetAlg4, [widthtool]) add_jetMoments_to_JetAlg(TrackJetAlg5, [widthtool]) add_jetMoments_to_JetAlg(TrackJetAlg6, [widthtool]) #add_jetMoments_to_JetAlg(TrackJetAlg7, [widthtool]) add_jetMoments_to_JetAlg(TrackJetAlg8, [widthtool]) #============================================================== # # End of job options file # ###############################################################
def setupCaloJets(myjetfinder, myjetdr, myjetinput, GroomedDicts, theseq): myGroomingTools, catNames = getGroomingTools(GroomedDicts) sortertool = JetSorterTool('myJetSorter', SortOrder="ByPtDown", OutputLevel=3) grjets_calib = [] ## Origin correction / Eta-Mass-JES hack from JetSubStructure.mySetupJetCalibrators import doEtaMassJESCorrection from JetCalibTools.MakeCalibSequences import calibTags calibTags['ETAMASSJES'] = doEtaMassJESCorrection mydoCalib = False mycalibName = '' if 'LCTopo' in myjetinput: mydoCalib = True if (myjetfinder + '%d' % (myjetdr * 10) == 'AntiKt10') or (myjetfinder + '%d' % (myjetdr * 10) == 'CamKt12'): mycalibName = 'LC:ORIGIN_ETAMASSJES' else: mycalibName = 'LC:ORIGIN' stdcaliblist = [] allowedcalib = [ 'AntiKt10LCTopoTrimmedJets', 'AntiKt10LCTopoTrimmedPtFrac3SmallR30Jets', 'AntiKt10LCTopoTrimmedPtFrac5SmallR30Jets', 'CamKt12LCTopoTrimmedPtFrac5SmallR30Jets' ] for x in catNames: author = myjetfinder + '%d' % (myjetdr * 10) + myjetinput + x + 'Jets' if author in allowedcalib: grjets_calib += [ JetSubStructure.JetAlgToolWrapper( name='calibtool_origin_etamassjes_' + x, JetAlgTool=getStandardCalibTool( myjetfinder, myjetdr, myjetinput + x, doCalib=True, calibName='LC:ORIGIN_ETAMASSJES')[0], GroomedjetsAuthor=[x]) ] else: stdcaliblist += [x] if stdcaliblist != []: grjets_calib += [ JetSubStructure.JetAlgToolWrapper( name='calibtool_origin', JetAlgTool=getStandardCalibTool(myjetfinder, myjetdr, myjetinput, doCalib=True, calibName='LC:ORIGIN')[0], GroomedjetsAuthor=stdcaliblist) ] elif 'Topo' in myjetinput: mydoCalib = True mycalibName = 'EM:ORIGIN' grjets_calib += getStandardCalibTool(myjetfinder, myjetdr, myjetinput, doCalib=True, calibName='EM:ORIGIN') assoc_tools = [] if rec.doTruth(): truthcontname = myjetfinder + '%dTruthJets' % (myjetdr * 10) if hasattr(theseq, truthcontname): truthj_assoc = JetSubStructure.JetJetAssociatorTool( "Truth_JetJetAssociatorTool", ContainerName=truthcontname, AssociationName="TruthJets", MatchOrigin=False) trackjetcontname = myjetfinder + '%dTrackZJets' % (myjetdr * 10) if hasattr(theseq, trackjetcontname): trkj_assoc = JetSubStructure.JetJetAssociatorTool( "Trk_JetJetAssociatorTool", ContainerName=trackjetcontname, AssociationName="TrackJets", MatchOrigin=True) ## batgging ## subjets_names = [x for x in catNames if "Subjets" in x] btag_tool = [] if subjets_names != '': from JetRec.JetGetters import getStandardBTaggerTool from JetRec.JetRecFlags import jetFlags jetFlags.doBTagging = True _btag_tool = getStandardBTaggerTool('AntiKt', 0.4, 'LCTopo') if len(_btag_tool) > 0: btag_tool += [ JetSubStructure.JetAlgToolWrapper( name='JetBTagger_' + ''.join(subjets_names), JetAlgTool=_btag_tool[0], GroomedjetsAuthor=subjets_names) ] jetFlags.doBTagging = False ## btagging end ## assoc_tool = JetSubStructure.JetAssociationTool( name='JetAssocTool', AssociatorTools=assoc_tools, GroomingTools=myGroomingTools, UsedSignalState=2, JetAlgTools=grjets_calib + [sortertool] + btag_tool, OutputLevel=3) myjetgetter = make_StandardJetGetter(myjetfinder, myjetdr, myjetinput, seq=theseq, doCalib=mydoCalib, calibName=mycalibName, addDefaultMoment=False) contname = myjetgetter.outputKey() # ------------------------------------------------ # Associate a vertex and set the JVF moment. Must be placed AFTER vertex correction # ------------------------------------------------ from AthenaCommon.DetFlags import DetFlags from AthenaCommon.AppMgr import ToolSvc noVertex = jobproperties.Beam.beamType == 'cosmics' or jobproperties.Beam.beamType == 'singlebeam' if DetFlags.detdescr.ID_on() and jetFlags.doJVF( ) and 'Truth' not in myjetinput and not noVertex: from JetSubStructure.mySetupJetMomentTools import mygetJetVertexAssociationTool myjvatool = mygetJetVertexAssociationTool(myjetfinder, myjetdr, myjetinput, 'Custom%d' % (myjetdr * 10)) add_jetMoments_to_JetAlg(myjetgetter, [myjvatool]) make_JetMomentGetter(contname, [assoc_tool], theseq) return [contname, catNames]