TrigBjetMonitorAlgorithm.py 25.7 KB
Newer Older
1
2
3
4
5
6
7
#
#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
#

'''@file TrigBjetMonitorAlgorithm.py
@author E. Nagy
@author T. Bold
8
@date 2020-05-27
9
10
11
12
13
14
@brief Example trigger python configuration for the Run III AthenaMonitoring package, based on the example by C Burton and P Onyisi
'''

def TrigBjetMonConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

15
16
17
    # from AthenaCommon.Logging import logging
    # log = logging.getLogger( 'TrigBjetMonitorAlgorithm.py' )

18
19
20
    ### STEP 1 ###
    # Define one top-level monitoring algorithm. The new configuration 
    # framework uses a component accumulator.
21
22
    # EN: Not needed for the moment
    # from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
23
    # result = ComponentAccumulator()
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags,'TrigBjetAthMonitorCfg')


    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the example 
    # algorithm in the AthenaMonitoring package. Just pass the type to the 
    # helper. Then, the helper will instantiate an instance and set up the 
    # base class configuration following the inputFlags. The returned object 
    # is the algorithm.
    #The added algorithm must exist as a .h file 

39
40
    from AthenaConfiguration.ComponentFactory import CompFactory
    trigBjetMonAlg = helper.addAlgorithm(CompFactory.TrigBjetMonitorAlgorithm,'TrigBjetMonAlg')
41
42
43

    # You can actually make multiple instances of the same algorithm and give 
    # them different configurations
44
    #shifterTrigBjetMonAlg = helper.addAlgorithm(TrigBjetMonitorAlgorithm,'ShifterTrigBjetMonAlg')
45
46
47
48
49
50
51
52
53
54
55
56
57

    # # If for some really obscure reason you need to instantiate an algorithm
    # # yourself, the AddAlgorithm method will still configure the base 
    # # properties and add the algorithm to the monitoring sequence.
    # helper.AddAlgorithm(myExistingAlg)


    ### STEP 3 ###
    # Edit properties of a algorithm
    # some generic property
    # trigBjetMonAlg.RandomHist = True
    # to enable a trigger filter, for example:
    #trigBjetMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
58
59
    #trigBjetMonAlg.TriggerChain = 'HLT_e24_lhtight_nod0'
    trigBjetMonAlg.TriggerChain = ''
60
61

    ### STEP 4 ###
62
    # Read in the Bjet trigger chain names
63
64
65
66

    # Directly from TrigBjetMonitCategory
    #from TrigBjetMonitoring import TrigBjetMonitCategory
    #bjet_triglist = TrigBjetMonitCategory.monitoring_bjet
67
68
    #bjet_triglist += TrigBjetMonitCategory.monitoring_mujet
    #print " ==> bjet_triglist: ", bjet_triglist
69
70
71
72

    # From the hltmonList where TrigHLTMonitoring filtered the run type
    from TrigHLTMonitoring.HLTMonTriggerList import hltmonList
    bjet_triglist = hltmonList.monitoring_bjet
73
    bjet_triglist += hltmonList.monitoring_mujet
74
    # print " ==> bjet_triglist: ", bjet_triglist
75

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # # First, add a tool that's set up by a different configuration function. 
    # # In this case, CaloNoiseToolCfg returns its own component accumulator, 
    # # which must be merged with the one from this function.
    # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg
    # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
    # result.merge(caloNoiseAcc)
    # trigBjetMonAlg.CaloNoiseTool = caloNoiseTool

    # # Then, add a tool that doesn't have its own configuration function. In
    # # this example, no accumulator is returned, so no merge is necessary.
    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
    # trigBjetMonAlg.MyDomainTool = MyDomainTool()

    # Add a generic monitoring tool (a "group" in old language). The returned 
    # object here is the standard GenericMonitoringTool.
94
    BjetMonGroup = helper.addGroup(trigBjetMonAlg,'TrigBjetMonitor','HLT/BjetMon/')
95
96

    # Add a GMT for the other example monitor algorithm
97
    #shifterGroup = helper.addGroup(shifterTrigBjetMonAlg,'TrigBjetMonitor','HLT/BjetMon/Shifter/')
98
99
100
101

    ### STEP 5 ###
    # Configure histograms
    #NB! The histograms defined here must match the ones in the cxx file exactly
102

103
    # Offline PV histograms - common for all trigger chains
104

105
106
107
108
109
110
111
    BjetMonGroup.defineHistogram('Off_NVtx', title='Number of Offline Vertices;NVtx;Events',
                                 path='Shifter/Offline',xbins=100,xmin=0.0,xmax=100.)
    BjetMonGroup.defineHistogram('Off_xVtx', title='Offline xVtx;xVtx;Events',
                                 path='Shifter/Offline',xbins=200,xmin=-1.5,xmax=+1.5)
    BjetMonGroup.defineHistogram('Off_yVtx', title='Offline yVtx;yVtx;Events',
                                 path='Shifter/Offline',xbins=200,xmin=-1.5,xmax=+1.5)
    BjetMonGroup.defineHistogram('Off_zVtx', title='Offline zVtx;zVtx;Events',
Elemer Nagy's avatar
Elemer Nagy committed
112
                                 path='Shifter/Offline',xbins=500,xmin=-250.0,xmax=+250.0)
113

114
115
    # Histograms which depend on the trigger chain

116
    # mu-jet histograms
117

Elemer Nagy's avatar
Elemer Nagy committed
118
    doRun2 = False
119
120
121
    AllChains = []
    for chain in bjet_triglist :
        AllChains.append(chain[2:])
122
        # print " inside bjet_triglist chain[2:8] : " , chain[2:8]
123
        if chain[2:8] == 'HLT_mu' : # mu-jets
124
            # print "        mu-jet histogram is defined for ", chain[2:]
125
126
127

            HistName = 'jetPt_' + chain[2:]
            if chain[0:1] == "E" :
128
                BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
129
                                             path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
130
                # print " ==> histogram ",HistName," is defined for Expert folder"
131
            if chain[0:1] == "S" :
132
                BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
133
                                             path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
134
135
136

            continue
        else :                      # b-jets
137
            # print "        b-jet histogram is defined for ", chain[2:]
138

139
140
141
142
143
144
      # b-jet histograms

         # Primary vertex histograms

            # PV associated to jets

145
146
147
            HistName = 'PVz_jet_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV from jets;zPV from jets;Events',
Elemer Nagy's avatar
Elemer Nagy committed
148
                                             path='Expert/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0)
149
150
151
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV from jets;zPV from jets;Events',
Elemer Nagy's avatar
Elemer Nagy committed
152
                                             path='Shifter/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0)
153

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
            HistName = 'PVx_jet_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV from jets;xPV from jets;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV from jets;xPV from jets;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)

            HistName = 'PVy_jet_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV from jets;yPV from jets;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV from jets;yPV from jets;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
171
172

            # PV directly from SG
173
174
175
176
177
178
179
180
181
182

            HistName = 'nPV_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Number of online PV per event;nPV;Events',
                                             path='Expert/'+chain[2:],xbins=101,xmin=-1.0,xmax=100.0)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Number of online PV per event;nPV;Events',
                                             path='Shifter/'+chain[2:],xbins=101,xmin=-1.0,xmax=100.0)

183
184
            HistName = 'PVz_tr_' + chain[2:]
            if chain[0:1] == "E" :
185
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV;zPV;Events',
Elemer Nagy's avatar
Elemer Nagy committed
186
                                             path='Expert/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0)
187
                # print " ==> histogram ",HistName," is defined for Expert folder"
188
            if chain[0:1] == "S" :
189
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV;zPV;Events',
Elemer Nagy's avatar
Elemer Nagy committed
190
                                             path='Shifter/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0)
191

192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
            HistName = 'PVx_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV;xPV from jets;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV;xPV from jets;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)

            HistName = 'PVy_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV;yPV from jets;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV;yPV from jets;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5)
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237

         # track histograms

            HistName = 'nTrack_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Number of tracks;nTrack;Events',
                                             path='Expert/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Number of tracks;nTrack;Events',
                                             path='Shifter/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)

            HistName = 'trkPt_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Pt of tracks;Pt;Events',
                                             path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=50.0)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Pt of tracks;Pt;Events',
                                             path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=50.0)

            HistName = 'trkEta_' + chain[2:] + ',trkPhi_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of tracks;Eta;Phi',
                                             path='Expert/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of tracks;Eta;Phi',
                                             path='Shifter/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416)
238

239
240
            HistName = 'd0_' + chain[2:]
            if chain[0:1] == "E" :
241
242
                BjetMonGroup.defineHistogram(HistName, title='Distribution of d0;d0;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-2.0,xmax=2.0)
243
                # print " ==> histogram ",HistName," is defined for Expert folder"
244
            if chain[0:1] == "S" :
245
246
                BjetMonGroup.defineHistogram(HistName, title='Distribution of d0;d0;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-2.0,xmax=2.0)
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

            HistName = 'ed0_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of sig(d0);sig(d0);Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=0.,xmax=1.0)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of sig(d0);sig(d0);Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=0.,xmax=1.0)

            HistName = 'z0_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of z0;z0;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-250.0,xmax=250.0)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of z0;z0;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-250.0,xmax=250.0)

            HistName = 'ez0_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of sig(z0);sig(z0);Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=0.,xmax=5.0)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of sig(z0);sig(z0);Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=0.,xmax=5.0)

         # jet histograms
276

277
278
279
280
281
282
283
284
285
            HistName = 'nJet_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Number of jets;nJet;Events',
                                             path='Expert/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Number of jets;nJet;Events',
                                             path='Shifter/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)

286
287
            HistName = 'jetPt_' + chain[2:]
            if chain[0:1] == "E" :
288
                BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
289
                                             path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
290
                # print " ==> histogram ",HistName," is defined for Expert folder"
291
            if chain[0:1] == "S" :
292
                BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
293
                                             path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0)
294

295
296
297
298
299
300
301
302
            HistName = 'jetEta_' + chain[2:] + ',jetPhi_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of jets;Eta_jet;Phi_jet',
                                             path='Expert/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416)
                # print " ==> histogram ",HistName," is defined for Expert folder"
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of jets;Eta_jet;Phi_jet',
                                             path='Shifter/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416)
303
304
305

      # b-tagging quantities

306

307
            HistName = 'IP3D_pu_tr_' + chain[2:]
308
            if chain[0:1] == "E" :
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
                BjetMonGroup.defineHistogram(HistName, title='IP3D_pu probability distribution;IP3D_pu;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='IP3D_pu probability distribution;IP3D_pu;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)

            HistName = 'IP3D_pb_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='IP3D_pb probability distribution;IP3D_pb;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='IP3D_pb probability distribution;IP3D_pb;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)

            HistName = 'IP3D_pc_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='IP3D_pc probability distribution;IP3D_pc;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='IP3D_pc probability distribution;IP3D_pc;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=0.0,xmax=1.0)

            HistName = 'wIP3D_Rbu_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='LogLH IP3D_pb/IP3D_pu probability ratio distribution;LogLH IP3D_pb/IP3D_pu;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-4.0,xmax=6.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='LogLH IP3D_pb/IP3D_pu probability ratio distribution;LogLH IP3D_pb/IP3D_pu;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-4.0,xmax=6.0)

            HistName = 'wSV1_Rbu_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='LogLH SV1_pb/SV1_pu probability ratio distribution;LogLH SV1_pb/SV1_pu;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-4.0,xmax=6.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='LogLH SV1_pb/SV1_pu probability ratio distribution;LogLH SV1_pb/SV1_pu;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-4.0,xmax=6.0)

            HistName = 'wCOMB_Rbu_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='LogLH IP3D+SV1 probability ratio distribution;LogLH IP3D+SV1 probability ratio;Events',
                                             path='Expert/'+chain[2:],xbins=200,xmin=-4.0,xmax=6.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='LogLH IP3D+SV1 probability ratio distribution;LogLH IP3D+SV1 probability ratio;Events',
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-4.0,xmax=6.0)

            HistName = 'wMV2c10_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of MV2c10 discriminant;MV2c10;Events',
358
                                             path='Expert/'+chain[2:],xbins=200,xmin=-1.0,xmax=1.0)
359
            if chain[0:1] == "S" :
360
                BjetMonGroup.defineHistogram(HistName, title='Distribution of MV2c10 discriminant;MV2c10;Events',
361
                                             path='Shifter/'+chain[2:],xbins=200,xmin=-1.0,xmax=1.0)
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385

            HistName = 'xMVtx_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='SV1 mass distribution;SV1 mass;Events',
                                             path='Expert/'+chain[2:],xbins=50,xmin=0.0,xmax=10.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='SV1 mass distribution;SV1 mass;Events',
                                             path='Shifter/'+chain[2:],xbins=50,xmin=0.0,xmax=10.0)

            HistName = 'xEVtx_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='SV1 E-fraction distribution;SV1 E-fraction;Events',
                                             path='Expert/'+chain[2:],xbins=50,xmin=0.0,xmax=1.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='SV1 E-fraction distribution;SV1 E-fraction;Events',
                                             path='Shifter/'+chain[2:],xbins=50,xmin=0.0,xmax=1.0)

            HistName = 'xNVtx_tr_' + chain[2:]
            if chain[0:1] == "E" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of number of 2-track SV1;Number of 2-track SV1;Events',
                                             path='Expert/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
            if chain[0:1] == "S" :
                BjetMonGroup.defineHistogram(HistName, title='Distribution of number of 2-track SV1;Number of 2-track SV1;Events',
                                             path='Shifter/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0)
386
387
388
            continue


389
    # print " ==> In TrigBjetMonitorAlgorithm.py: AllChains list: ", AllChains
390
    trigBjetMonAlg.AllChains = AllChains
Elemer Nagy's avatar
Elemer Nagy committed
391
    trigBjetMonAlg.doRun2 = doRun2
392

393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412

    ### STEP 6 ###
    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can 
    # just return directly (and not create "result" above)
    return helper.result()
    
    # # Otherwise, merge with result object and return
    # acc = helper.result()
    # result.merge(acc)
    # return result

if __name__=='__main__':
    # Setup the Run III behavior
    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior = 1

    # Setup logs
    from AthenaCommon.Logging import log
413
    from AthenaCommon.Constants import DEBUG
414
    log.setLevel(DEBUG)
415
    # from AthenaCommon.Constants import INFO
416
    # log.setLevel(INFO)
417
418
419

    # Set the Athena configuration flags
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
420
421
422
423
424
425
426
427
428
429

    # Input files

    # Original data input file from P.Onyisi and C.Burton:
    #nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/'
    #file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'
    #ConfigFlags.Input.Files = [nightly+file]
    #ConfigFlags.Input.isMC = False

    # MC file found by me but can be used only w/ asetup Athena,r2019-06-28,master
430
431
432
433
    #nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/'
    #file = 'mc16_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.AOD.e5458_s3126_r9364_r9315/AOD.11182705._000001.pool.root.1'
    #ConfigFlags.Input.Files = [nightly+file]
    #ConfigFlags.Input.isMC = True
434
435

    # MC input files proposed by Tim Martin in https://its.cern.ch/jira/browse/ATR-19881 for Run-3
436
    # file = '/afs/cern.ch/work/e/enagy/public/GenerateAOD/AOD.pool.root'
Elemer Nagy's avatar
Elemer Nagy committed
437
    # file to be run w/ doRun2 = False
438
    # file = '/afs/cern.ch/user/e/ebergeas/work/public/triggermonitoring/nightly_2019-10-20T2130/AOD.pool.root'
Elemer Nagy's avatar
Elemer Nagy committed
439
    # file = '/afs/cern.ch/work/e/enagy/public/GenerateAOD/Gen_MT_240919/AOD.pool.root'
440
    file = '/afs/cern.ch/work/e/enagy/public/ARTfiles/MCtest310720.AOD.pool.root'
Elemer Nagy's avatar
Elemer Nagy committed
441
442
443
    # file to be run w/ doRun2 = True
    # file = '/afs/cern.ch/work/e/enagy/public/GenerateAOD/Gen_ST_240919/AOD.pool.root'
    # file = '/eos/atlas/atlascerngroupdisk/data-art/build-output/master/Athena/x86_64-centos7-gcc8-opt/2019-09-16T2129/TrigAnalysisTest/test_trigAna_q221_RDOtoAOD_mt1_build/AOD.pool.root'
444
445
446
447
448
    ConfigFlags.Input.Files = [file]
    ConfigFlags.Input.isMC = True

    # Output file (root)

449
    ConfigFlags.Output.HISTFileName = 'TrigBjetMonitorOutput.root'
450

451
    # ConfigFlags.Trigger.triggerMenuSetup="Physics_pp_v7_primaries"
452
453
454
455
    
    ConfigFlags.lock()

    # Initialize configuration object, add accumulator, merge, and run.
456
    from AthenaConfiguration.MainServicesConfig import MainServicesCfg 
457
    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
458
    cfg = MainServicesCfg(ConfigFlags)
459
460
461
462
463
464
465
466
467
    cfg.merge(PoolReadCfg(ConfigFlags))

    trigBjetMonitorAcc = TrigBjetMonConfig(ConfigFlags)
    cfg.merge(trigBjetMonitorAcc)

    # If you want to turn on more detailed messages ...
    #trigBjetMonitorAcc.getEventAlgo('TrigBjetMonAlg').OutputLevel = 2 # DEBUG
    cfg.printConfig(withDetails=True) # set True for exhaustive info

468
    Nevents = 25
469
    #cfg.run(Nevents)
470
    cfg.run() #use cfg.run(20) to only run on first 20 events
471