Track Jets
From ATLAS-TRIUMF
[edit] Job Options to make Track Jets
This works in 14.5.1, probably in any 14.X.Y. It is much simpler than Track Jets in 13.0.20.
First, I borrowed Pierre-Antoine's options for Rerunning jets in release 14: rerunJets_AOD_14.py and rerunJets_ESD_14.py in /afs/cern.ch/user/d/delsart/public/rerunJets.
Then I added a custom builder following the examples in CVS:
AOD example:
# Adapted by I. Trigger from rerunJets_AOD_14.py by P-A Delsart to add track jet examples
# import the data types
import EventKernel.ParticleDataType
# get a handle on the ServiceManager which holds all the services
from AthenaCommon.AppMgr import ServiceMgr
# load additional libraries for back navigation
from AnalysisExamples.AnalysisFlags import AnalysisFlags
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
import AthenaPoolCnvSvc.ReadAthenaPool
# the Dlls
include ( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" )
include ( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py" )
include ( "EventAthenaPool/EventAthenaPool_joboptions.py" )
# write out a summary of the time spent
from GaudiSvc.GaudiSvcConf import AuditorSvc
ServiceMgr.AuditorSvc.Auditors += [ "ChronoAuditor", "MemStatAuditor"]
ServiceMgr.StoreGateSvc.Dump = True
ServiceMgr.EventSelector.InputCollections = ["AOD.pool.root"]
theApp.EvtMax = -1
# ********************************************************
## Run private jet finders *******************************
# ********************************************************
from JetRec.JetGetters import *
from JetRec.JetRecFlags import jetFlags
jetFlags.inputFileType.set_Value('AOD')
#Kt7alg = make_StandardJetGetter('Kt', 0.7, 'LCTopo').jetAlgorithmHandle()
#Kt7alg.OutputLevel = 3
#Kt5alg = make_StandardJetGetter('Kt', 0.5, 'LCTopo').jetAlgorithmHandle()
#Kt5alg.OutputLevel = 3
#Kt5alg = make_StandardJetGetter('Kt', 0.5, 'Truth').jetAlgorithmHandle()
#Kt5alg.OutputLevel = 2
# Example using the custom builder ###############################################
# Here we will do 0.4 Cone Jets with Tracks:
# Step 1 : build a list of Jet tools-----------------------------------
# here use the standard helper functions to get input and finder tools
mytoollist = getStandardInputTools('LCTopo',False,False) + getStandardFinderTools('Cone',0.4)
## Now build a private tool, set options, insert it in the list
#finalT = JetSignalSelectorTool('JetFinalEtCut')
#finalT.OutputLevel = 2
#finalT.MinimumSignal = 15*GeV
#mytoollist += [finalT] # inserted in the list
## build an other tool
#sortT = JetSorterTool('JetSorter')
#sortT.SortOrder="ByEDown"
#mytoollist += [sortT]
# Step 2 : prepare a dictionary of jet alg attributes ------------------------
# the attributes will be used to build a unique name.
# Be consistant !
my_att_dict = dict(jet_attribute_dict) # copy the default dict (it only contains keys)
my_att_dict['_finderType'] = 'Cone'
#my_att_dict['_finderSuff'] = 'Track'
my_att_dict['_finderParams'] = [0.4]
my_att_dict['_inputType'] = 'Track'
my_att_dict['_inputColl'] = ['TrackParticleCandidate']
# Step 3 call the builder with the attribute dict and the tool list as parameter.
mygetter2 = make_customJetGetter(my_att_dict, mytoollist)
mygetter2.OutputLevel = 2
# Here we will do 0.5 Kt Jets with Tracks:
# Step 1 : build a list of Jet tools-----------------------------------
# here use the standard helper functions to get input and finder tools
mytoollist2 = getStandardInputTools('LCTopo',False,False) + getStandardFinderTools('Kt',0.4)
## Now build a private tool, set options, insert it in the list
#finalT = JetSignalSelectorTool('JetFinalEtCut')
#finalT.OutputLevel = 2
#finalT.MinimumSignal = 15*GeV
#mytoollist += [finalT] # inserted in the list
## build an other tool
#sortT = JetSorterTool('JetSorter')
#sortT.SortOrder="ByEDown"
#mytoollist += [sortT]
# Step 2 : prepare a dictionary of jet alg attributes ------------------------
# the attributes will be used to build a unique name.
# Be consistent !
my_att_dict2 = dict(jet_attribute_dict) # copy the default dict (it only contains keys)
my_att_dict2['_finderType'] = 'Kt'
#my_att_dict2['_finderSuff'] = 'Track'
my_att_dict2['_finderParams'] = [0.4]
my_att_dict2['_inputType'] = 'Track'
#my_att_dict2['_inputColl'] = ['TrackParticleCandidate']
my_att_dict2['_inputColl'] = ['Tracks']
# Step 3 call the builder with the attribute dict and the tool list as parameter.
mygetter3 = make_customJetGetter(my_att_dict2, mytoollist2)
mygetter3.OutputLevel = 2
# ********************************************************
## Now schedule whatever algorithm using Jet
## add vp1 so you can look at your jets:
from VP1Algs.VP1AlgsConf import VP1Alg
topSequence += VP1Alg()
# ********************************************************
# Scheduling CBNTAA algorithms
# (optional, just remove these lines if not needed)
# ********************************************************
# the following is not necessary if doCBNT==True
include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py")
include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py")
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='RECREATE'" ]
from AnalysisTools.AnalysisToolsConf import AANTupleStream
topSequence += AANTupleStream()
AANTupleStream = AANTupleStream()
AANTupleStream.WriteInputDataHeader = True
AANTupleStream.OutputLevel = WARNING
## ---
from JetRec.CBNTJets import schedule_CBNTJets_fromJetAlgs
# schedule CBNT output for all jet alg we defined in this job :
schedule_CBNTJets_fromJetAlgs()
# if we want to exclude some jetcollection from the output, just tell the function :
# schedule_CBNTJets_fromJetAlgs(excludeList= [ "JetColectionToBeExcludedName1", "JetColectionToBeExcludedName2" ])
# ********************************************************
and ESD example:
# Adapted by I. Trigger from rerunJets_ESD_14.py by P-A Delsart to add track jet examples
# Skeleton jobOptions to re-run jet finders from an ESD
# based on myToption.py
#
# Here we set usual RecExCommon flags
AllAlgs = False
doTrigger = False # for example do not run trigger simulation
readRDO=False
readESD=True
doESD=False #
doWriteESD=False #
doAOD=False # Change the switches if needed
doWriteAOD=False #
doWriteTAG=False #
doCBNT = False #
doCaloTopoCluster=False
EvtMax=-1
PoolESDInput=["ESD.pool.root"]
PoolAODOutput = "reruntest.AOD.root" # used only if doAOD=True
# ********************************************************
# schedule your jet algs and private algs in the jobOption listed bellow
UserAlgs = ["myAlgs_14.py"]
DetDescrVersion = "ATLAS-GEO-02-01-00"
from JetRec.JetGetters import *
from JetRec.JetRecFlags import jetFlags
jetFlags.inputFileType.set_Value('ESD')
# Example using the custom builder ###############################################
# Step 1 : build a list of Jet tools-----------------------------------
# here use the standard helper functions to get input and finder tools
mytoollist = getStandardInputTools('LCTopo',False,False) + getStandardFinderTools('Kt',0.5)
## Now build a private tool, set options, insert it in the list
#finalT = JetSignalSelectorTool('JetFinalEtCut')
#finalT.OutputLevel = 2
#finalT.MinimumSignal = 15*GeV
#mytoollist += [finalT] # inserted in the list
## build an other tool
#sortT = JetSorterTool('JetSorter')
#sortT.SortOrder="ByEDown"
#mytoollist += [sortT]
# Step 2 : prepare a dictionary of jet alg attributes ------------------------
# the attributes will be used to build a unique name.
# Be consistant !
my_att_dict = dict(jet_attribute_dict) # copy the default dict (it only contains keys)
#my_att_dict['_finderType'] = 'Cone'
my_att_dict['_finderType'] = 'Kt'
#my_att_dict['_finderSuff'] = 'Track'
my_att_dict['_finderParams'] = [0.5]
my_att_dict['_inputType'] = 'Track'
my_att_dict['_inputColl'] = ['TrackParticleCandidate']
# Step 3 call the builder with the attribute dict and the tool list as parameter.
mygetter2 = make_customJetGetter(my_att_dict, mytoollist)
mygetter2.OutputLevel = 2
# Step 1 : build a list of Jet tools-----------------------------------
# here use the standard helper functions to get input and finder tools
mytoollist2 = getStandardInputTools('LCTopo',False,False) + getStandardFinderTools('Cone',0.4)
## Now build a private tool, set options, insert it in the list
#finalT = JetSignalSelectorTool('JetFinalEtCut')
#finalT.OutputLevel = 2
#finalT.MinimumSignal = 15*GeV
#mytoollist += [finalT] # inserted in the list
## build an other tool
#sortT = JetSorterTool('JetSorter')
#sortT.SortOrder="ByEDown"
#mytoollist += [sortT]
# Step 2 : prepare a dictionary of jet alg attributes ------------------------
# the attributes will be used to build a unique name.
# Be consistant !
my_att_dict2 = dict(jet_attribute_dict) # copy the default dict (it only contains keys)
my_att_dict2['_finderType'] = 'Cone'
#my_att_dict2['_finderSuff'] = 'Track'
my_att_dict2['_finderParams'] = [0.4]
my_att_dict2['_inputType'] = 'Track'
my_att_dict2['_inputColl'] = ['TrackParticleCandidate']
#my_att_dict2['_inputColl'] = ['Tracks']
# Step 3 call the builder with the attribute dict and the tool list as parameter.
mygetter3 = make_customJetGetter(my_att_dict2, mytoollist2)
mygetter3.OutputLevel = 2
# ********************************************************
## from ParticleBuilderOptions.AODFlags import AODFlags
## AODFlags.Muon = False
## AODFlags.FastSimulation = False
## AODFlags.ParticleJet = False
## AODFlags.TruthParticleJet = False
## AODFlags.Trigger = False
## This is important for jets rerunning.
## It completely remove the standard jet configuration.
from JetRec.JetRecFlags import jetFlags
jetFlags.noStandardConfig = True
# main jobOption
include ("RecExCommon/RecExCommon_topOptions.py")
## add vp1:
from VP1Algs.VP1AlgsConf import VP1Alg
topSequence += VP1Alg()
# ********************************************************
# Scheduling CBNTAA algorithms
# (optional, just remove these lines if not needed)
# ********************************************************
# the following is not necessary if doCBNT==True
include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py")
include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py")
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='RECREATE'" ]
from AnalysisTools.AnalysisToolsConf import AANTupleStream
topSequence += AANTupleStream()
AANTupleStream = AANTupleStream()
AANTupleStream.WriteInputDataHeader = True
AANTupleStream.OutputLevel = WARNING
## ---
from JetRec.CBNTJets import schedule_CBNTJets_fromJetAlgs
# schedule CBNT output for all jet alg we defined in this job :
schedule_CBNTJets_fromJetAlgs()
# if we want to exclude some jetcollection from the output, just tell the function :
# schedule_CBNTJets_fromJetAlgs(excludeList= [ "JetColectionToBeExcludedName1", "JetColectionToBeExcludedName2" ])
# ********************************************************
# MSG Level
MessageSvc = Service( "MessageSvc" )
MessageSvc.OutputLevel = INFO
#ServiceMgr.StoreGateSvc.Dump = True
--Isabel 15:13, 2 February 2009 (PST)

