ATLAS Offline Software
Loading...
Searching...
No Matches
L1JetMonitoringConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3class L1JetMonAlg():
4 def __init__(self,
5 name,
6 jetColl,
7 jetCollKey='', # actual jet collection name to use for SG retrieval, in case different to original jet container
8 # (as can be the case for copied containers on which jet matching applied)
9 triggerChain='',
10 matched=False,
11 matchedOfflineJets='',
12 matchedHLTJets=''):
13
14 self.name = name
15 self.L1JetContainer = jetColl
16 self.L1JetKey = jetColl if jetCollKey == '' else jetCollKey
17 self.triggerChain = triggerChain
18 self.matched = matched
19 # self.matched = False
20 self.matchedOJ = matchedOfflineJets
21 self.matchedHLTJ = matchedHLTJets
22
23 def __str__(self):
24 text = ' '.join(['%s: %s' % (str(k), str(v)) for k, v in self.__dict__.items()])
25 return self.__class__.__name__ + ':: ' + text
26
27
28 def toAlg(self,monhelper):
29 from AthenaConfiguration.ComponentFactory import CompFactory
30
31 jFexSR = self.L1JetContainer == 'L1_jFexSRJetRoI'
32 jFexLR = self.L1JetContainer == 'L1_jFexLRJetRoI'
33 gFexSR = self.L1JetContainer == 'L1_gFexSRJetRoI'
34 gFexLR = self.L1JetContainer == 'L1_gFexLRJetRoI'
35
36 noFex = self.L1JetContainer == 'LVL1JetRoIs'
37
38 L1Fex = jFexSR or jFexLR or gFexSR or gFexLR
39
40 assert L1Fex or noFex, 'unsupported L1Container %s' % self.L1JetContainer
41
42 def container2tool_class_name():
43
44 # Note: there are two gFex names, both correspond to the
45 # same container type.
46
47 # The strangeness of the class names in the following dict are
48 # due to them arising from template instantiations.
49 # They can be found in the TrigJetMonitoringConf.py module
50 # which is constructed at build time.
51 return {
52 'L1_jFexSRJetRoI': 'TrigL1FexJetMonitorTool_JTM_jFexSRJetRoIContainer_',
53 'L1_jFexLRJetRoI': 'TrigL1FexJetMonitorTool_JTM_jFexLRJetRoIContainer_',
54 'L1_gFexSRJetRoI': 'TrigL1FexJetMonitorTool_JTM_gFexJetRoIContainer_',
55 'L1_gFexLRJetRoI': 'TrigL1FexJetMonitorTool_JTM_gFexJetRoIContainer_',
56 'LVL1JetRoIs': 'TrigL1FexJetMonitorTool_JTM_JetRoIContainer_',
57 }[self.L1JetContainer]
58
59 def container2tool_inst_name():
60
61 return {'L1_jFexSRJetRoI': 'jFexSRDataRetriever',
62 'L1_jFexLRJetRoI': 'jFexLRDataRetriever',
63 'L1_gFexSRJetRoI': 'gFexSRDataRetriever',
64 'L1_gFexLRJetRoI': 'gFexLRDataRetriever',
65 'LVL1JetRoIs': 'JetRoIDataRetriever',
66 }[self.L1JetContainer]
67
68
69 def container2_monitorgroup():
70
71 return {'L1_jFexSRJetRoI': 'TrigL1JFexSRJetMonitor',
72 'L1_jFexLRJetRoI': 'TrigL1JFexLRJetMonitor',
73 'L1_gFexSRJetRoI': 'TrigL1GFexSRJetMonitor',
74 'L1_gFexLRJetRoI': 'TrigL1GFexLRJetMonitor',
75 'LVL1JetRoIs': 'TrigL1JetMonitor'}[self.L1JetContainer]
76
77
78 alg = monhelper.addAlgorithm(CompFactory.TrigL1FexJetMonitorAlgorithm,
79 self.name)
80 toolClass = getattr(CompFactory, container2tool_class_name())
81
82 tool = toolClass(container2tool_inst_name())
83 tool.do_matching = self.matched
84 tool.offlineJetsToMatch = self.matchedOJ
85 tool.HLTJetsToMatch = self.matchedHLTJ
86 tool.l1container = self.L1JetKey
87 alg.group_name = container2_monitorgroup()
88 alg.filler = tool
89 alg.TriggerChain = self.triggerChain
90
91 # Add a generic monitoring tool (a "group" in old language). The returned
92 # object here is the standard GenericMonitoringTool
93
94 Path = self.L1JetContainer+'/'
95 Path += 'NoTriggerSelection/' if self.triggerChain == '' else self.triggerChain+'/'
96 myGroup = monhelper.addGroup(alg, container2_monitorgroup(),'HLT/JetMon/L1/')
97
98 if L1Fex:
99 myGroup.defineHistogram('et',title='et',path=Path,xbins=400,xmin=0.0,xmax=400.0)
100 else:
101 myGroup.defineHistogram('et8x8',title='et8x8',path=Path,xbins=400,xmin=0.0,xmax=400.0)
102
103
104 myGroup.defineHistogram('eta',title='eta',path=Path,xbins=50,xmin=-5,xmax=5)
105 myGroup.defineHistogram('phi',title='phi',path=Path,xbins=50,xmin=-3.3,xmax=3.3)
106 myGroup.defineHistogram('eta,phi',title='map eta vs phi',type="TH2F",path=Path,xbins=100,xmin=-5,xmax=5,ybins=100,ymin=-3.2,ymax=3.2)
107
108 if self.matched:
109 for matchcoll,tag in [ [self.matchedOJ, 'off'], [self.matchedHLTJ, 'hlt'] ]:
110 Path = self.L1JetContainer + '/NoTriggerSelection/MatchedJets_' + matchcoll + '/'
111
112 # define which variable difference will be plotted,
113 # mass difference makes no sense for L1 as m=0
114 for histname in [ 'ptdiff', 'energydiff' ]:
115 myGroup.defineHistogram(tag+histname+';'+histname,
116 title=histname, type="TH1F", path=Path,
117 xbins=140 , xmin=-120000., xmax=80000. ,)
118
119 for histname in [ 'ptresp', 'energyresp' ]:
120 myGroup.defineHistogram(tag+histname+';'+histname,
121 title=histname,
122 type="TH1F", path=Path,
123 xbins=100 , xmin=-1., xmax=2. ,)
124
125 myGroup.defineHistogram(tag+'ptresp,'+tag+'ptref;ptresp_vs_ptRef',
126 title='ptresponse vs ptRef', type="TH2F", path=Path,
127 xbins=10 , xmin=-1., xmax=2.,
128 ybins=10, ymin=0., ymax=500000.,)
129
130 myGroup.defineHistogram(tag+'ptresp,'+tag+'etaref;ptresp_vs_etaRef',
131 title='ptresponse vs etaRef', type="TH2F", path=Path,
132 xbins=10, xmin=-1., xmax=2.,
133 ybins=10, ymin=-5., ymax=5.,)
134
135 myGroup.defineHistogram(tag+'ptref,'+tag+'ptresp;ptRef_vs_ptresp',
136 title='ptRef vs ptresponse', type="TH2F", path=Path,
137 xbins=100, xmin=0., xmax=400000.,
138 ybins=100, ymin=-5., ymax=5.,)
139
140 myGroup.defineHistogram(tag+'etaref,'+tag+'ptresp;etaRef_vs_ptresp',
141 title='etaRef vs ptresponse', type="TH2F", path=Path,
142 xbins=100, xmin=-5., xmax=5.,
143 ybins=100, ymin=-5., ymax=5.,)
144
145
146 return alg
__init__(self, name, jetColl, jetCollKey='', triggerChain='', matched=False, matchedOfflineJets='', matchedHLTJets='')