Skip to content
Snippets Groups Projects
Commit 68205606 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'master-reconstructTruthJetsInOfflineJetMonitoring' into 'master'

Create truth jets (if requested) in offline MT jet trigger monitoring

See merge request atlas/athena!39202
parents 13a9c0ff f5b7a8fd
No related branches found
No related tags found
No related merge requests found
...@@ -133,6 +133,7 @@ def getEtaRange(chain): ...@@ -133,6 +133,7 @@ def getEtaRange(chain):
# Schedule more histograms for dedicated jet collections # Schedule more histograms for dedicated jet collections
######################################################### #########################################################
from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, EventHistoSpec, SelectSpec, ToolSpec #VarSpec can be added to define specific/custom variables from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, EventHistoSpec, SelectSpec, ToolSpec #VarSpec can be added to define specific/custom variables
from AthenaConfiguration.ComponentFactory import CompFactory
# All offline jet collections # All offline jet collections
ExtraOfflineHists = [ ExtraOfflineHists = [
...@@ -188,7 +189,6 @@ def TrigJetMonConfig(inputFlags): ...@@ -188,7 +189,6 @@ def TrigJetMonConfig(inputFlags):
# Match HLT to offline jets # Match HLT to offline jets
for j1,j2 in JetColls2Match[InputType].items(): for j1,j2 in JetColls2Match[InputType].items():
from AthenaConfiguration.ComponentFactory import CompFactory
name = 'Matching_{}_{}'.format(j1,j2) name = 'Matching_{}_{}'.format(j1,j2)
alg = CompFactory.JetMatcherAlg(name, JetContainerName1=j1,JetContainerName2=j2) alg = CompFactory.JetMatcherAlg(name, JetContainerName1=j1,JetContainerName2=j2)
cfg.addEventAlgo(alg) cfg.addEventAlgo(alg)
...@@ -472,7 +472,7 @@ def jetEfficiencyMonitoringConfig(inputFlags,onlinejetcoll,offlinejetcoll,chain, ...@@ -472,7 +472,7 @@ def jetEfficiencyMonitoringConfig(inputFlags,onlinejetcoll,offlinejetcoll,chain,
# create a monitoring group with the histo path starting from the parentAlg # create a monitoring group with the histo path starting from the parentAlg
group = monhelper.addGroup(parentAlg, conf.Group, conf.topLevelDir+jetcollFolder+'/') group = monhelper.addGroup(parentAlg, conf.Group, conf.topLevelDir+jetcollFolder+'/')
# define the histogram # define the histogram
group.defineHistogram('trigPassed,jetVar',title='titletrig', type="TEfficiency", path=chainFolder, xbins=100 , xmin=0, xmax=500000. ,) group.defineHistogram('trigPassed,jetVar',title='titletrig', type="TEfficiency", path=chainFolder, xbins=1000 , xmin=0, xmax=1000000. ,)
# Get jet index and eta selection for offline jets # Get jet index and eta selection for offline jets
parts = chain.split('j') parts = chain.split('j')
...@@ -528,12 +528,16 @@ if __name__=='__main__': ...@@ -528,12 +528,16 @@ if __name__=='__main__':
# Read arguments # Read arguments
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--athenaMT', action='store_true', dest='athenaMT', default=False) parser.add_argument('--athenaMT', action='store_true', dest='athenaMT', default=False)
parser.add_argument('--legacy', action='store_true', dest='legacy', default=False) parser.add_argument('--legacy', action='store_true', dest='legacy', default=False)
parser.add_argument('--input', action='store', dest='inputFile') parser.add_argument('--runTruthReco', action='store_true', dest='runTruthReco', default=False)
args = parser.parse_args() parser.add_argument('--printDetailedConfig', action='store_true', dest='printDetailedConfig', default=False)
AthenaMT = args.athenaMT parser.add_argument('--input', action='store', dest='inputFile')
Legacy = args.legacy args = parser.parse_args()
AthenaMT = args.athenaMT
Legacy = args.legacy
RunTruth = args.runTruthReco
PrintDetailedConfig = args.printDetailedConfig
# Protections # Protections
if AthenaMT and Legacy: if AthenaMT and Legacy:
print('ERROR: Choose AthenaMT or Legacy, exiting') print('ERROR: Choose AthenaMT or Legacy, exiting')
...@@ -567,15 +571,38 @@ if __name__=='__main__': ...@@ -567,15 +571,38 @@ if __name__=='__main__':
from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaConfiguration.MainServicesConfig import MainServicesCfg
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
cfg = MainServicesCfg(ConfigFlags) cfg = MainServicesCfg(ConfigFlags)
# AthenaMT or Legacy
InputType = 'MT' if AthenaMT else 'Legacy'
# Reconstruct small-R truth jets
if RunTruth:
from JetRecConfig.StandardSmallRJets import AntiKt4Truth # import the standard definitions
# Add the components from our jet reconstruction job
from JetRecConfig.JetRecConfig import JetRecCfg
comp = JetRecCfg(AntiKt4Truth,ConfigFlags)
cfg.merge(comp)
# Write jet collection to AOD
# First define the output list
key = "{0}Jets".format(AntiKt4Truth.basename)
outputlist = ["xAOD::JetContainer#"+key,"xAOD::JetAuxContainer#"+key+"Aux.-PseudoJet"]
# Now get the output stream components
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
cfg.merge(OutputStreamCfg(ConfigFlags,"xAOD",ItemList=outputlist))
cfg.merge(PoolReadCfg(ConfigFlags)) cfg.merge(PoolReadCfg(ConfigFlags))
# The following class will make a sequence, configure algorithms, and link # The following class will make a sequence, configure algorithms, and link
# them to GenericMonitoringTools # them to GenericMonitoringTools
from AthenaMonitoring import AthMonitorCfgHelper from AthenaMonitoring import AthMonitorCfgHelper
helper = AthMonitorCfgHelper(ConfigFlags,'TrigJetMonitorAlgorithm') helper = AthMonitorCfgHelper(ConfigFlags,'TrigJetMonitorAlgorithm')
cfg.merge(helper.result()) # merge it to add the sequence needed to add matchers
# AthenaMT or Legacy # Match HLT to offline jets
InputType = 'MT' if AthenaMT else 'Legacy' for j1,j2 in JetColls2Match[InputType].items():
name = 'Matching_{}_{}'.format(j1,j2)
alg = CompFactory.JetMatcherAlg(name, JetContainerName1=j1,JetContainerName2=j2)
cfg.addEventAlgo(alg,sequenceName='AthMonSeq_TrigJetMonitorAlgorithm') # Add matchers to monitoring alg sequence
# Loop over L1 jet collectoins # Loop over L1 jet collectoins
for jetcoll in L1JetCollections: for jetcoll in L1JetCollections:
...@@ -601,13 +628,13 @@ if __name__=='__main__': ...@@ -601,13 +628,13 @@ if __name__=='__main__':
# Loop over HLT jet chains # Loop over HLT jet chains
for chain,jetcoll in Chain2JetCollDict[InputType].items(): for chain,jetcoll in Chain2JetCollDict[InputType].items():
# kinematic plots
if AthenaMT: if AthenaMT:
chainMonitorConfT = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT,True) chainMonitorConfT = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT,True)
chainMonitorConfT.toAlg(helper) chainMonitorConfT.toAlg(helper)
chainMonitorConfF = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT,False) chainMonitorConfF = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT,False)
chainMonitorConfF.toAlg(helper) chainMonitorConfF.toAlg(helper)
# efficiency plots
# Produce efficiency plots
refChain = 'NONE' refChain = 'NONE'
offlineJetColl = 'NONE' offlineJetColl = 'NONE'
if chain in TurnOnCurves[InputType]: if chain in TurnOnCurves[InputType]:
...@@ -619,4 +646,7 @@ if __name__=='__main__': ...@@ -619,4 +646,7 @@ if __name__=='__main__':
cfg.merge(helper.result()) cfg.merge(helper.result())
# Print config
cfg.printConfig(withDetails=PrintDetailedConfig)
cfg.run() cfg.run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment