ATLAS Offline Software
TrigBjetMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''@file TrigBjetMonitorAlgorithm.py
6 @author E. Nagy
7 @author T. Bold
8 @date 2020-05-27
9 @brief Example trigger python configuration for the Run III AthenaMonitoring package, based on the example by C Burton and P Onyisi
10 '''
11 
12 def TrigBjetMonConfig(inputFlags):
13  '''Function to configures some algorithms in the monitoring system.'''
14 
15  from AthenaCommon.Logging import logging
16  log = logging.getLogger( 'TrigBjetMonitorAlgorithm.py' )
17 
18 
24 
25  # The following class will make a sequence, configure algorithms, and link
26  # them to GenericMonitoringTools
27  from AthenaMonitoring import AthMonitorCfgHelper
28  helper = AthMonitorCfgHelper(inputFlags,'TrigBjetAthMonitorCfg')
29 
30 
31 
38 
39  from AthenaConfiguration.ComponentFactory import CompFactory
40  trigBjetMonAlg = helper.addAlgorithm(CompFactory.TrigBjetMonitorAlgorithm,'TrigBjetMonAlg')
41 
42  # You can actually make multiple instances of the same algorithm and give
43  # them different configurations
44  #shifterTrigBjetMonAlg = helper.addAlgorithm(TrigBjetMonitorAlgorithm,'ShifterTrigBjetMonAlg')
45 
46  # # If for some really obscure reason you need to instantiate an algorithm
47  # # yourself, the AddAlgorithm method will still configure the base
48  # # properties and add the algorithm to the monitoring sequence.
49  # helper.AddAlgorithm(myExistingAlg)
50 
51 
52 
59  trigBjetMonAlg.TriggerChain = ''
60 
61 
63 
64  bjet_triglist = []
65  # Trigger list from monitoring groups
66  from TrigConfigSvc.TriggerConfigAccess import getHLTMonitoringAccess
67  moniAccess=getHLTMonitoringAccess(inputFlags)
68  BjetChainsE=moniAccess.monitoredChains(signatures="bJetMon",monLevels=["t0"])
69  log.info (" ==> bjet_chainlist t0: %s", BjetChainsE)
70  for chain in BjetChainsE:
71  chain = "E_"+chain
72  bjet_triglist.append(chain)
73  BjetChainsS=moniAccess.monitoredChains(signatures="bJetMon",monLevels=["shifter"])
74  log.info (" ==> bjet_chainlist shifter: %s", BjetChainsS)
75  for chain in BjetChainsS:
76  chain = "S_"+chain
77  bjet_triglist.append(chain)
78  log.info (" ==> bjet_triglist: %s", bjet_triglist)
79 
80  # Check if BeamType is 'collisions'
81  # P.Onyisi's suggestion
82  from AthenaConfiguration.Enums import BeamType
83  CollisionRun = (inputFlags.Beam.Type == BeamType.Collisions)
84  if CollisionRun:
85  log.info (" ==> BeamType is collision: %s", inputFlags.Beam.Type)
86  else:
87  log.info (" ==> BeamType is not collision: %s", inputFlags.Beam.Type)
88  trigBjetMonAlg.CollisionRun = CollisionRun
89 
90 
91  # Set Express Stream Flag
92  ExpressStreamFlag = inputFlags.Common.doExpressProcessing
93  trigBjetMonAlg.ExpressStreamFlag = ExpressStreamFlag
94 
95  # Add some tools. N.B. Do not use your own trigger decion tool. Use the
96  # standard one that is included with AthMonitorAlgorithm.
97 
98  # # Add a tool that doesn't have its own configuration function. In
99  # # this example, no accumulator is returned, so no merge is necessary.
100  # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
101  # trigBjetMonAlg.MyDomainTool = MyDomainTool()
102 
103  # Add a generic monitoring tool (a "group" in old language). The returned
104  # object here is the standard GenericMonitoringTool.
105  BjetMonGroup = helper.addGroup(trigBjetMonAlg,'TrigBjetMonitor','HLT/BjetMon/')
106 
107  # Add a GMT for the other example monitor algorithm
108  #shifterGroup = helper.addGroup(shifterTrigBjetMonAlg,'TrigBjetMonitor','HLT/BjetMon/Shifter/')
109 
110 
111 
114 
115 
116  # Offline PV histograms - common for all trigger chains
117 
118  BjetMonGroup.defineHistogram('Off_NVtx', title='Number of Offline Vertices;NVtx;Events',
119  path='Shifter/Offline',xbins=100,xmin=0.0,xmax=100.)
120  BjetMonGroup.defineHistogram('Off_xVtx', title='Offline xVtx;xVtx;Events',
121  path='Shifter/Offline',xbins=200,xmin=-1.5,xmax=+1.5)
122  BjetMonGroup.defineHistogram('Off_yVtx', title='Offline yVtx;yVtx;Events',
123  path='Shifter/Offline',xbins=200,xmin=-1.5,xmax=+1.5)
124  BjetMonGroup.defineHistogram('Off_zVtx', title='Offline zVtx;zVtx;Events',
125  path='Shifter/Offline',xbins=500,xmin=-250.0,xmax=+250.0)
126 
127  # Histograms which depend on the trigger chain
128 
129  # mu-jet histograms
130 
131  AllChains = []
132  for chain in bjet_triglist :
133  AllChains.append(chain[2:])
134 
135  if chain[2:8] == 'HLT_mu' : # mu-jets
136 
137  HistName = 'nMuon_' + chain[2:]
138  if chain[0:1] == "E" :
139  BjetMonGroup.defineHistogram(HistName, title='Distribution of N_muon;N_muon;Events',
140  path='Expert/'+chain[2:],xbins=10,xmin=0.,xmax=10.)
141 
142  if chain[0:1] == "S" :
143  BjetMonGroup.defineHistogram(HistName, title='Distribution of N_muon;N_muon;Events',
144  path='Shifter/'+chain[2:],xbins=10,xmin=0.,xmax=10.)
145 
146  HistName = 'muonPt_' + chain[2:]
147  if chain[0:1] == "E" :
148  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_muon;Pt_muon;Events',
149  path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
150 
151  if chain[0:1] == "S" :
152  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_muon;Pt_muon;Events',
153  path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
154 
155  HistName = 'muonEta_' + chain[2:]
156  if chain[0:1] == "E" :
157  BjetMonGroup.defineHistogram(HistName, title='Distribution of Eta_muon;Eta_muon;Events',
158  path='Expert/'+chain[2:],xbins=100,xmin=-7.5,xmax=7.5)
159 
160  if chain[0:1] == "S" :
161  BjetMonGroup.defineHistogram(HistName, title='Distribution of Eta_muon;Eta_muon;Events',
162  path='Shifter/'+chain[2:],xbins=100,xmin=-7.5,xmax=7.5)
163 
164  HistName = 'nJet_' + chain[2:]
165  if chain[0:1] == "E" :
166  BjetMonGroup.defineHistogram(HistName, title='Number of jets;nJet;Events',
167  path='Expert/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
168 
169  if chain[0:1] == "S" :
170  BjetMonGroup.defineHistogram(HistName, title='Number of jets;nJet;Events',
171  path='Shifter/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
172 
173  HistName = 'jetPt_' + chain[2:]
174  if chain[0:1] == "E" :
175  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
176  path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
177 
178  if chain[0:1] == "S" :
179  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
180  path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
181 
182  HistName = 'jetEta_' + chain[2:]
183  if chain[0:1] == "E" :
184  BjetMonGroup.defineHistogram(HistName, title='Distribution of Eta_jet;Eta_jet;Events',
185  path='Expert/'+chain[2:],xbins=100,xmin=-7.5,xmax=7.5)
186 
187  if chain[0:1] == "S" :
188  BjetMonGroup.defineHistogram(HistName, title='Distribution of Eta_jet;Eta_jet;Events',
189  path='Shifter/'+chain[2:],xbins=100,xmin=-7.5,xmax=7.5)
190 
191  HistName = 'RatioPt_' + chain[2:]
192  if chain[0:1] == "E" :
193  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_muon/Pt_jet;Pt_muon/Pt_jet;Events',
194  path='Expert/'+chain[2:],xbins=100,xmin=0.,xmax=2.0)
195 
196  if chain[0:1] == "S" :
197  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_muon/Pt_jet;Pt_muon/Pt_jet;Events',
198  path='Shifter/'+chain[2:],xbins=100,xmin=0.,xmax=2.0)
199 
200  HistName = 'RelPt_' + chain[2:]
201  if chain[0:1] == "E" :
202  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_muon wrt jet direction;RelPt_muon;Events',
203  path='Expert/'+chain[2:],xbins=100,xmin=0.,xmax=20.0)
204 
205  if chain[0:1] == "S" :
206  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_muon wrt jet direction;RelPt_muon;Events',
207  path='Shifter/'+chain[2:],xbins=100,xmin=0.,xmax=20.0)
208 
209 
210  HistName = 'wGN1_' + chain[2:] + ',RelPt_' + chain[2:]
211  if chain[0:1] == "E" :
212  BjetMonGroup.defineHistogram(HistName,type='TH2F',title='RelPt vs GN1 weight;GN1 weight;RelPt',
213  path='Expert/'+chain[2:],xbins=20,xmin=-20.0,xmax=+20.0,ybins=20,ymin=0.,ymax=20.)
214 
215  if chain[0:1] == "S" :
216  BjetMonGroup.defineHistogram(HistName,type='TH2F',title='RelPt vs GN1 weight;GN1 weight;RelPt',
217  path='Shifter/'+chain[2:],xbins=20,xmin=-20.0,xmax=+20.0,ybins=20,ymin=0.,ymax=20.)
218 
219  HistName = 'wGN2_' + chain[2:] + ',RelPt_' + chain[2:]
220  if chain[0:1] == "E" :
221  BjetMonGroup.defineHistogram(HistName,type='TH2F',title='RelPt vs GN2 weight;GN2 weight;RelPt',
222  path='Expert/'+chain[2:],xbins=20,xmin=-20.0,xmax=+20.0,ybins=20,ymin=0.,ymax=20.)
223 
224  if chain[0:1] == "S" :
225  BjetMonGroup.defineHistogram(HistName,type='TH2F',title='RelPt vs GN2 weight;GN2 weight;RelPt',
226  path='Shifter/'+chain[2:],xbins=20,xmin=-20.0,xmax=+20.0,ybins=20,ymin=0.,ymax=20.)
227 
228 
229  HistName = 'DeltaR_' + chain[2:]
230  if chain[0:1] == "E" :
231  BjetMonGroup.defineHistogram(HistName, title='Distribution of DeltaR(muon,jet);Delta R;Events',
232  path='Expert/'+chain[2:],xbins=100,xmin=0.,xmax=6.0)
233 
234  if chain[0:1] == "S" :
235  BjetMonGroup.defineHistogram(HistName, title='Distribution of DeltaR(muon,jet);Delta R;Events',
236  path='Shifter/'+chain[2:],xbins=100,xmin=0.,xmax=6.0)
237 
238  HistName = 'DeltaZ_' + chain[2:]
239  if chain[0:1] == "E" :
240  BjetMonGroup.defineHistogram(HistName, title='Distribution of DeltaZ(muon,jet);Delta Z;Events',
241  path='Expert/'+chain[2:],xbins=100,xmin=0.,xmax=10.0)
242 
243  if chain[0:1] == "S" :
244  BjetMonGroup.defineHistogram(HistName, title='Distribution of DeltaZ(muon,jet);Delta Z;Events',
245  path='Shifter/'+chain[2:],xbins=100,xmin=0.,xmax=10.0)
246 
247 
248 
249  continue
250  else : # b-jets
251 
252  # b-jet histograms
253 
254  # Primary vertex histograms
255 
256  # PV associated to jets
257 
258  HistName = 'PVz_jet_' + chain[2:]
259  if chain[0:1] == "E" :
260  BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV from jets;zPV from jets;Events',
261  path='Expert/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0)
262 
263  if chain[0:1] == "S" :
264  BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV from jets;zPV from jets;Events',
265  path='Shifter/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0)
266 
267  HistName = 'PVx_jet_' + chain[2:]
268  if chain[0:1] == "E" :
269  BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV from jets;xPV from jets;Events',
270  path='Expert/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
271 
272  if chain[0:1] == "S" :
273  BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV from jets;xPV from jets;Events',
274  path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
275 
276  HistName = 'PVy_jet_' + chain[2:]
277  if chain[0:1] == "E" :
278  BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV from jets;yPV from jets;Events',
279  path='Expert/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
280 
281  if chain[0:1] == "S" :
282  BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV from jets;yPV from jets;Events',
283  path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
284 
285  # PV directly from SG
286 
287  HistName = 'nPV_tr_' + chain[2:]
288  if chain[0:1] == "E" :
289  BjetMonGroup.defineHistogram(HistName, title='Number of online PV per event;nPV;Events',
290  path='Expert/'+chain[2:],xbins=101,xmin=-1.0,xmax=100.0)
291 
292  if chain[0:1] == "S" :
293  BjetMonGroup.defineHistogram(HistName, title='Number of online PV per event;nPV;Events',
294  path='Shifter/'+chain[2:],xbins=101,xmin=-1.0,xmax=100.0)
295 
296  HistName = 'PVz_tr_' + chain[2:]
297  if chain[0:1] == "E" :
298  BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV;zPV;Events',
299  path='Expert/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0)
300 
301  if chain[0:1] == "S" :
302  BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV;zPV;Events',
303  path='Shifter/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0)
304 
305  HistName = 'PVx_tr_' + chain[2:]
306  if chain[0:1] == "E" :
307  BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV;xPV;Events',
308  path='Expert/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
309 
310  if chain[0:1] == "S" :
311  BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV;xPV;Events',
312  path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
313 
314  HistName = 'PVy_tr_' + chain[2:]
315  if chain[0:1] == "E" :
316  BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV;yPV;Events',
317  path='Expert/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
318 
319  if chain[0:1] == "S" :
320  BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV;yPV;Events',
321  path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
322 
323 
324 
325  # Difference of the online and offline PV coordinates
326 
327  HistName = 'DiffOnOffPVz_tr_' + chain[2:]
328  if chain[0:1] == "E" :
329  BjetMonGroup.defineHistogram(HistName, title='Difference of online and offline zPV;zPVonline-zPVoffline;Events',
330  path='Expert/'+chain[2:],xbins=400,xmin=-2.0,xmax=2.0)
331 
332  if chain[0:1] == "S" :
333  BjetMonGroup.defineHistogram(HistName, title='Difference of online and offline zPV;zPVonline-zPVoffline;Events',
334  path='Shifter/'+chain[2:],xbins=400,xmin=-2.0,xmax=2.0)
335 
336  HistName = 'DiffOnOffPVx_tr_' + chain[2:]
337  if chain[0:1] == "E" :
338  BjetMonGroup.defineHistogram(HistName, title='Difference of online and offline xPV;xPVonline-xPVoffline;Events',
339  path='Expert/'+chain[2:],xbins=200,xmin=-0.1,xmax=0.1)
340 
341  if chain[0:1] == "S" :
342  BjetMonGroup.defineHistogram(HistName, title='Difference of online and offline xPV;xPVonline-xPVoffline;Events',
343  path='Shifter/'+chain[2:],xbins=200,xmin=-0.1,xmax=0.1)
344 
345  HistName = 'DiffOnOffPVy_tr_' + chain[2:]
346  if chain[0:1] == "E" :
347  BjetMonGroup.defineHistogram(HistName, title='Difference of online and offline yPV;yPVonline-yPVoffline;Events',
348  path='Expert/'+chain[2:],xbins=200,xmin=-0.1,xmax=0.1)
349 
350  if chain[0:1] == "S" :
351  BjetMonGroup.defineHistogram(HistName, title='Difference of online and offline yPV;yPVonline-yPVoffline;Events',
352  path='Shifter/'+chain[2:],xbins=200,xmin=-0.1,xmax=0.1)
353 
354 
355 
356  # track histograms
357 
358  HistName = 'nTrack_' + chain[2:]
359  if chain[0:1] == "E" :
360  BjetMonGroup.defineHistogram(HistName, title='Number of tracks;nTrack;Events',
361  path='Expert/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
362 
363  if chain[0:1] == "S" :
364  BjetMonGroup.defineHistogram(HistName, title='Number of tracks;nTrack;Events',
365  path='Shifter/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
366 
367  HistName = 'trkPt_' + chain[2:]
368  if chain[0:1] == "E" :
369  BjetMonGroup.defineHistogram(HistName, title='Pt of tracks;Pt;Events',
370  path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=50.0)
371 
372  if chain[0:1] == "S" :
373  BjetMonGroup.defineHistogram(HistName, title='Pt of tracks;Pt;Events',
374  path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=50.0)
375 
376  HistName = 'trkEta_' + chain[2:] + ',trkPhi_' + chain[2:]
377  if chain[0:1] == "E" :
378  BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of tracks;Eta;Phi',
379  path='Expert/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416)
380 
381  if chain[0:1] == "S" :
382  BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of tracks;Eta;Phi',
383  path='Shifter/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416)
384 
385  HistName = 'd0_' + chain[2:]
386  if chain[0:1] == "E" :
387  BjetMonGroup.defineHistogram(HistName, title='Distribution of d0;d0;Events',
388  path='Expert/'+chain[2:],xbins=200,xmin=-2.0,xmax=2.0)
389 
390  if chain[0:1] == "S" :
391  BjetMonGroup.defineHistogram(HistName, title='Distribution of d0;d0;Events',
392  path='Shifter/'+chain[2:],xbins=200,xmin=-2.0,xmax=2.0)
393 
394  HistName = 'ed0_' + chain[2:]
395  if chain[0:1] == "E" :
396  BjetMonGroup.defineHistogram(HistName, title='Distribution of d0 uncertainty;sigma(d0);Events',
397  path='Expert/'+chain[2:],xbins=200,xmin=0.,xmax=1.0)
398 
399  if chain[0:1] == "S" :
400  BjetMonGroup.defineHistogram(HistName, title='Distribution of d0 uncertainty;sigma(d0);Events',
401  path='Shifter/'+chain[2:],xbins=200,xmin=0.,xmax=1.0)
402 
403  HistName = 'sd0_' + chain[2:]
404  if chain[0:1] == "E" :
405  BjetMonGroup.defineHistogram(HistName, title='Distribution of d0 significance;significance(d0);Events',
406  path='Expert/'+chain[2:],xbins=200,xmin=0.,xmax=20.0)
407 
408  if chain[0:1] == "S" :
409  BjetMonGroup.defineHistogram(HistName, title='Distribution of d0 significance;significance(d0);Events',
410  path='Shifter/'+chain[2:],xbins=200,xmin=0.,xmax=20.0)
411 
412  HistName = 'z0_' + chain[2:]
413  if chain[0:1] == "E" :
414  BjetMonGroup.defineHistogram(HistName, title='Distribution of z0;z0;Events',
415  path='Expert/'+chain[2:],xbins=200,xmin=-250.0,xmax=250.0)
416 
417  if chain[0:1] == "S" :
418  BjetMonGroup.defineHistogram(HistName, title='Distribution of z0;z0;Events',
419  path='Shifter/'+chain[2:],xbins=200,xmin=-250.0,xmax=250.0)
420 
421  HistName = 'ez0_' + chain[2:]
422  if chain[0:1] == "E" :
423  BjetMonGroup.defineHistogram(HistName, title='Distribution of z0 uncertainty;sigma(z0);Events',
424  path='Expert/'+chain[2:],xbins=200,xmin=0.,xmax=5.0)
425 
426  if chain[0:1] == "S" :
427  BjetMonGroup.defineHistogram(HistName, title='Distribution of z0 uncertainty;sigma(z0);Events',
428  path='Shifter/'+chain[2:],xbins=200,xmin=0.,xmax=5.0)
429 
430  # jet histograms
431 
432  HistName = 'nJet_' + chain[2:]
433  if chain[0:1] == "E" :
434  BjetMonGroup.defineHistogram(HistName, title='Number of jets;nJet;Events',
435  path='Expert/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
436 
437  if chain[0:1] == "S" :
438  BjetMonGroup.defineHistogram(HistName, title='Number of jets;nJet;Events',
439  path='Shifter/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
440 
441  HistName = 'jetPt_' + chain[2:]
442  if chain[0:1] == "E" :
443  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
444  path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
445 
446  if chain[0:1] == "S" :
447  BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
448  path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
449 
450  HistName = 'jetEta_' + chain[2:]
451  if chain[0:1] == "E" :
452  BjetMonGroup.defineHistogram(HistName, title='Distribution of Eta_jet;Eta_jet;Events',
453  path='Expert/'+chain[2:],xbins=100,xmin=-7.5,xmax=7.5)
454 
455  if chain[0:1] == "S" :
456  BjetMonGroup.defineHistogram(HistName, title='Distribution of Eta_jet;Eta_jet;Events',
457  path='Shifter/'+chain[2:],xbins=100,xmin=-7.5,xmax=7.5)
458 
459  HistName = 'jetEta_' + chain[2:] + ',jetPhi_' + chain[2:]
460  if chain[0:1] == "E" :
461  BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of jets;Eta_jet;Phi_jet',
462  path='Expert/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416)
463 
464  if chain[0:1] == "S" :
465  BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of jets;Eta_jet;Phi_jet',
466  path='Shifter/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416)
467 
468  # b-tagging quantities
469 
470 
471  HistName = 'GN1_pu_tr_' + chain[2:]
472  if chain[0:1] == "E" :
473  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN1_pu probability;GN1_pu;Events',
474  path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
475  if chain[0:1] == "S" :
476  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN1_pu probability;GN1_pu;Events',
477  path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
478 
479  HistName = 'GN1_pc_tr_' + chain[2:]
480  if chain[0:1] == "E" :
481  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN1_pc probability;GN1_pc;Events',
482  path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
483  if chain[0:1] == "S" :
484  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN1_pc probability;GN1_pc;Events',
485  path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
486 
487  HistName = 'GN1_pb_tr_' + chain[2:]
488  if chain[0:1] == "E" :
489  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN1_pb probability;GN1_pb;Events',
490  path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
491  if chain[0:1] == "S" :
492  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN1_pb probability;GN1_pb;Events',
493  path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
494 
495  HistName = 'GN1_mv_tr_' + chain[2:]
496  if chain[0:1] == "E" :
497  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN1_mv LLR;GN1_mv;Events',
498  path='Expert/'+chain[2:],xbins=200,xmin=-50.,xmax=50.)
499  if chain[0:1] == "S" :
500  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN1_mv LLR;GN1_mv;Events',
501  path='Shifter/'+chain[2:],xbins=200,xmin=-50.,xmax=50.)
502 
503 
504  HistName = 'GN2_pu_tr_' + chain[2:]
505  if chain[0:1] == "E" :
506  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN2_pu probability;GN2_pu;Events',
507  path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
508  if chain[0:1] == "S" :
509  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN2_pu probability;GN2_pu;Events',
510  path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
511 
512  HistName = 'GN2_pc_tr_' + chain[2:]
513  if chain[0:1] == "E" :
514  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN2_pc probability;GN2_pc;Events',
515  path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
516  if chain[0:1] == "S" :
517  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN2_pc probability;GN2_pc;Events',
518  path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
519 
520  HistName = 'GN2_pb_tr_' + chain[2:]
521  if chain[0:1] == "E" :
522  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN2_pb probability;GN2_pb;Events',
523  path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
524  if chain[0:1] == "S" :
525  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN2_pb probability;GN2_pb;Events',
526  path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
527 
528  HistName = 'GN2_mv_tr_' + chain[2:]
529  if chain[0:1] == "E" :
530  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN2_mv LLR;GN2_mv;Events',
531  path='Expert/'+chain[2:],xbins=200,xmin=-50.,xmax=50.)
532  if chain[0:1] == "S" :
533  BjetMonGroup.defineHistogram(HistName, title='Distribution of GN2_mv LLR;GN2_mv;Events',
534  path='Shifter/'+chain[2:],xbins=200,xmin=-50.,xmax=50.)
535 
536 
537 
538  continue
539 
540 
541  log.info (" ==> In TrigBjetMonitorAlgorithm.py: AllChains list: %s", AllChains)
542  trigBjetMonAlg.AllChains = AllChains
543 
544 
545 
550  return helper.result()
551 
552  # # Otherwise, merge with result object and return
553  # acc = helper.result()
554  # result.merge(acc)
555  # return result
556 
557 if __name__=='__main__':
558  # Setup logs
559  from AthenaCommon.Logging import log
560  from AthenaCommon.Constants import DEBUG
561  log.setLevel(DEBUG)
562 
563  # Set the Athena configuration flags
564  from AthenaConfiguration.AllConfigFlags import initConfigFlags
565  flags = initConfigFlags()
566 
567  # Input files
568  # AOD file to be run w/ MT access and Mon Groups implemented
569  file = '/eos/user/e/enagy/ARTfiles/MCtest271022.AOD.pool.root'
570 
571  flags.Input.Files = [file]
572  flags.Input.isMC = True
573 
574  # Output file (root)
575 
576  flags.Output.HISTFileName = 'TrigBjetMonitorOutput.root'
577 
578  # flags.Trigger.triggerMenuSetup="Physics_pp_v7_primaries"
579 
580  flags.lock()
581 
582  # Initialize configuration object, add accumulator, merge, and run.
583  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
584  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
585  cfg = MainServicesCfg(flags)
586  cfg.merge(PoolReadCfg(flags))
587 
588  trigBjetMonitorAcc = TrigBjetMonConfig(flags)
589  cfg.merge(trigBjetMonitorAcc)
590 
591  # If you want to turn on more detailed messages ...
592  #trigBjetMonitorAcc.getEventAlgo('TrigBjetMonAlg').OutputLevel = 2 # DEBUG
593  cfg.printConfig(withDetails=True) # set True for exhaustive info
594 
595  Nevents = 200
596  cfg.run(Nevents)
597  #cfg.run() #for all events. Use cfg.run(20) to only run on first 20 events
598 
599 
python.TriggerConfigAccess.getHLTMonitoringAccess
HLTMonitoringAccess getHLTMonitoringAccess(flags=None)
Definition: TriggerConfigAccess.py:256
python.TrigBjetMonitorAlgorithm.TrigBjetMonConfig
def TrigBjetMonConfig(inputFlags)
Definition: TrigBjetMonitorAlgorithm.py:12
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69