ATLAS Offline Software
L1JetMonitoringConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 
3 class 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 
107  if self.matched:
108  for matchcoll,tag in [ [self.matchedOJ, 'off'], [self.matchedHLTJ, 'hlt'] ]:
109  Path = self.L1JetContainer + '/NoTriggerSelection/MatchedJets_' + matchcoll + '/'
110 
111  # define which variable difference will be plotted,
112  # mass difference makes no sense for L1 as m=0
113  for histname in [ 'ptdiff', 'energydiff' ]:
114  myGroup.defineHistogram(tag+histname+';'+histname,
115  title=histname, type="TH1F", path=Path,
116  xbins=140 , xmin=-120000., xmax=80000. ,)
117 
118  for histname in [ 'ptresp', 'energyresp' ]:
119  myGroup.defineHistogram(tag+histname+';'+histname,
120  title=histname,
121  type="TH1F", path=Path,
122  xbins=100 , xmin=-1., xmax=2. ,)
123 
124  myGroup.defineHistogram(tag+'ptresp,'+tag+'ptref;ptresp_vs_ptRef',
125  title='ptresponse vs ptRef', type="TH2F", path=Path,
126  xbins=10 , xmin=-1., xmax=2.,
127  ybins=10, ymin=0., ymax=500000.,)
128 
129  myGroup.defineHistogram(tag+'ptresp,'+tag+'etaref;ptresp_vs_etaRef',
130  title='ptresponse vs etaRef', type="TH2F", path=Path,
131  xbins=10, xmin=-1., xmax=2.,
132  ybins=10, ymin=-5., ymax=5.,)
133 
134 
135  return alg
L1JetMonitoringConfig.L1JetMonAlg.__init__
def __init__(self, name, jetColl, jetCollKey='', triggerChain='', matched=False, matchedOfflineJets='', matchedHLTJets='')
Definition: L1JetMonitoringConfig.py:4
L1JetMonitoringConfig.L1JetMonAlg.matchedOJ
matchedOJ
Definition: L1JetMonitoringConfig.py:12
L1JetMonitoringConfig.L1JetMonAlg.name
name
Definition: L1JetMonitoringConfig.py:6
L1JetMonitoringConfig.L1JetMonAlg.matched
matched
Definition: L1JetMonitoringConfig.py:10
L1JetMonitoringConfig.L1JetMonAlg
Definition: L1JetMonitoringConfig.py:3
L1JetMonitoringConfig.L1JetMonAlg.L1JetContainer
L1JetContainer
Definition: L1JetMonitoringConfig.py:7
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
L1JetMonitoringConfig.L1JetMonAlg.__str__
def __str__(self)
Definition: L1JetMonitoringConfig.py:23
L1JetMonitoringConfig.L1JetMonAlg.matchedHLTJ
matchedHLTJ
Definition: L1JetMonitoringConfig.py:13
L1JetMonitoringConfig.L1JetMonAlg.L1JetKey
L1JetKey
Definition: L1JetMonitoringConfig.py:8
L1JetMonitoringConfig.L1JetMonAlg.triggerChain
triggerChain
Definition: L1JetMonitoringConfig.py:9
str
Definition: BTagTrackIpAccessor.cxx:11
L1JetMonitoringConfig.L1JetMonAlg.toAlg
def toAlg(self, monhelper)
Definition: L1JetMonitoringConfig.py:28