ATLAS Offline Software
PixelAthHitMonAlgCfg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''
6 @file PixelAthHitMonAlgCfg.py
7 @brief Configuration of Pixel Hit Monitoring Histograms for Run 3
8 '''
9 
10 from PixelMonitoring.PixelAthMonitoringBase import define2DProfHist, definePP0Histos, getLayerGroup
11 from PixelMonitoring.PixelAthMonitoringBase import define1DProfLumiLayers, define2DProfPerFEHist
12 from PixelMonitoring.PixelAthMonitoringBase import define1DLayers
13 from PixelMonitoring.PixelAthMonitoringBase import layers, lumibinsx, bcidbinsx
14 from PixelMonitoring.PixelAthMonitoringBase import addOnTrackTxt, addOnTrackToPath, fullDressTitle
15 from PixelMonitoring.PixelAthMonitoringBase import runtext, ReadingDataErrLabels
16 
17 def PixelAthHitMonAlgCfg(helper, alg, **kwargs):
18  '''
19  Arguments:
20  helper -- AthMonitorCfgHelper(Old) instance
21  alg -- algorithm Configurable object returned from addAlgorithm
22  kwargs -- jo agruments
23  '''
24  doOnline = kwargs.get('doOnline', False)
25  doLumiBlock = kwargs.get('doLumiBlock', False)
26  doFEPlots = kwargs.get('doFEPlots', False)
27 
28  ontrack = False
29 
30  path = '/Pixel/Hits/'
31  pathLowStat = '/Pixel/LumiBlock/'
32  pathGroup = addOnTrackToPath(path, ontrack)
33 
34  hitGroup = helper.addGroup(alg, 'Hit')
35 
36  varName = 'hitdataread_err;ReadingHitDataErr'
37  title = 'Number of Hit data reading errors;error type;# events'
38  hitGroup.defineHistogram(varName,
39  type='TH1I', path=pathGroup, title=title,
40  xbins=len(ReadingDataErrLabels), xmin=-0.5, xmax=-0.5+len(ReadingDataErrLabels), xlabels=ReadingDataErrLabels)
41 
42  varName = 'pixhitsmontool_lb;EventsPerLumi'
43  title = 'nEvents per LB;lumi block;# events'
44  hitGroup.defineHistogram(varName,
45  type='TH1I', path=pathGroup, title=title,
46  xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx)
47 
48  varName = 'pixhitsmontool_lb,nhits_per_event'
49  title = fullDressTitle('Average number of pixel hits per event per LB', ontrack, ';lumi block', ';# hits/event')
50  varName += ';'+ addOnTrackTxt('HitsPerLumi', ontrack)
51  hitGroup.defineHistogram(varName,
52  type='TProfile', path=pathGroup, title=title,
53  xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx)
54 
55  histoGroupName = addOnTrackTxt('HitsPerLumi', ontrack)
56  title = addOnTrackTxt('Average number of pixel hits per event per LB', ontrack, True)
57  yaxistext = ';# hits/event'
58  define1DProfLumiLayers(helper, alg, histoGroupName, title, pathGroup, yaxistext, type='TProfile')
59 
60  histoGroupName = addOnTrackTxt('AvgOccActivePerLumi', ontrack)
61  title = addOnTrackTxt('Average pixel occupancy for active modules per event per LB', ontrack, True)
62  yaxistext = ';# hits/pixel/event'
63  define1DProfLumiLayers(helper, alg, histoGroupName, title, pathGroup, yaxistext, type='TProfile')
64 
65  histoGroupName = addOnTrackTxt('AvgOccGoodPerLumi', ontrack)
66  title = addOnTrackTxt('Average pixel occupancy for good modules per event per LB', ontrack, True)
67  yaxistext = ';# hits/pixel/event'
68  define1DProfLumiLayers(helper, alg, histoGroupName, title, pathGroup, yaxistext, type='TProfile')
69 
70  histoGroupName = addOnTrackTxt('AvgOccRatioToIBLPerLumi', ontrack)
71  if not doOnline:
72  title = addOnTrackTxt('Relative to IBL pixel occupancy per event per LB', ontrack, True)
73  yaxistext = ';occ. ratio to IBL'
74  define1DProfLumiLayers(helper, alg, histoGroupName, title, pathGroup, yaxistext, type='TProfile')
75  else:
76  title = addOnTrackTxt('Relative to IBL pixel occupancy per event per LB for last 100LB', ontrack, True)
77  histname = addOnTrackTxt('AvgOccRatioToIBLPerLumiLast100LB', ontrack)
78  define1DProfLumiLayers(helper, alg, histoGroupName, title, pathGroup, ';occ. ratio to IBL', type='TProfile', opt='kLive=100', histname=histname)
79 
80  histoGroupName = 'HitToT'
81  title = 'Hit ToT'
82  define1DLayers(helper, alg, histoGroupName, title, pathGroup, ';ToT [BC]', ';# hits', xbins=[300]*5+[20]*2, xmins=[-0.5]*7, binsizes=[1.0]*7)
83 
84  histoGroupName = 'HitMap'
85  title = 'hit map'
86  define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F')
87 
88  if doFEPlots:
89  histoGroupName = 'HitFEMap'
90  title = 'hit map per FE'
91  define2DProfPerFEHist(helper, alg, histoGroupName, title, path, type='TH2F')
92 
93  if doLumiBlock:
94  if not doFEPlots:
95  define2DProfHist(helper, alg, histoGroupName, title, pathLowStat, type='TH2F', lifecycle='lumiblock', histname='HitMapLB')
96  else:
97  define2DProfPerFEHist(helper, alg, histoGroupName, title, pathLowStat, type='TH2F', lifecycle='lumiblock', histname='HitFEMapLB')
98 
99 
100 
101  histoname = 'AvgOccPerBCID'
102  for layer in layers:
103  title = 'Average pixel occupancy per BCID, {0}'.format(layer) + runtext + ';BCID;# hits/pixel/event'
104  layerGroup = getLayerGroup(helper, alg, layer)
105  fullvarstr = 'pixhitsmontool_bcid'
106  fullvarstr+= ',{0}_{1}'.format(histoname, 'val')
107  fullvarstr+= ';' + histoname + '_{0}'.format(layer)
108  layerGroup.defineHistogram(fullvarstr,
109  type='TProfile', path=pathGroup, title=title,
110  xbins=bcidbinsx, xmin=-0.5, xmax=-0.5+bcidbinsx)
111 
112  if doOnline:
113  histoGroupName = 'HitOccupancyPP0'
114  title = 'Average per module(FE) hit occupancy per PP0 reset every 5 LBs'
115  definePP0Histos(helper, alg, histoGroupName, title, path=pathGroup, opt='kLBNHistoryDepth=5')
116  histoGroupName ='OccupancyPerPixelEvent'
117  title = '#hits / pixel / event reset every 2 LBs'
118  define2DProfHist(helper, alg, histoGroupName, title, path=pathGroup, type='TProfile2D', zmin=0, zmax=1.0, opt='kLBNHistoryDepth=2')
119  else:
120  histoGroupName = 'HitOccupancyPP0'
121  title = 'Average per module(FE) hit occupancy per PP0'
122  definePP0Histos(helper, alg, histoGroupName, title, path=pathGroup)
123  histoGroupName ='OccupancyPerPixelEvent'
124  title = '#hits / pixel / event'
125  define2DProfHist(helper, alg, histoGroupName, title, path=pathGroup, type='TProfile2D', zmin=0, zmax=1.0)
126 
127 
130  pathTiming = '/Pixel/Timing'
131  varName = 'Hit_LVL1A_pixel'
132  title = fullDressTitle('Hit Level 1 Accept', False, ';Level 1 Accept',';# hits')
133  varName += ';HitLVL1A'
134  hitGroup.defineHistogram(varName,
135  type='TH1F', path=pathTiming, title=title,
136  xbins=14, xmin=-1.5, xmax=12.5)
137  varName = 'Hit_LVL1A_layer'
138  for layer in layers:
139  histoname = 'HitLVL1A_{0}'.format(layer)
140  title = 'Hit Level 1 Accept, {0}'.format(layer) + runtext + ';Level 1 Accept;# hits'
141  layerGroup = getLayerGroup(helper, alg, layer)
142  fullvarstr = varName + ';' + histoname
143  layerGroup.defineHistogram(fullvarstr,
144  type='TH1F', path=pathTiming, title=title,
145  xbins=14, xmin=-1.5, xmax=12.5)
146  if doLumiBlock:
147  histonameLB = 'HitLVL1ALB_{0}'.format(layer)
148  titleLB = 'Hit Level 1 Accept lowstat, {0}'.format(layer) + runtext + ';Level 1 Accept;# hits'
149  fullvarstrLB = varName + ';' + histonameLB
150  layerGroup.defineHistogram(fullvarstrLB,
151  type='TH1F', path=pathLowStat, title=titleLB,
152  xbins=14, xmin=-1.5, xmax=12.5, duration='lowStat')
153 
154 
vtune_athena.format
format
Definition: vtune_athena.py:14
PixelAthMonitoringBase.definePP0Histos
def definePP0Histos(helper, alg, name, title, path, opt='')
Definition: PixelAthMonitoringBase.py:361
PixelAthMonitoringBase.addOnTrackToPath
def addOnTrackToPath(name, ontrack)
Definition: PixelAthMonitoringBase.py:524
PixelAthMonitoringBase.define1DProfLumiLayers
def define1DProfLumiLayers(helper, alg, name, title, path, yaxistext, type='TProfile', opt='', histname=None, onlylayers=layers)
Definition: PixelAthMonitoringBase.py:396
PixelAthMonitoringBase.getLayerGroup
def getLayerGroup(helper, alg, layer)
Definition: PixelAthMonitoringBase.py:268
PixelAthHitMonAlgCfg.PixelAthHitMonAlgCfg
def PixelAthHitMonAlgCfg(helper, alg, **kwargs)
Definition: PixelAthHitMonAlgCfg.py:17
PixelAthMonitoringBase.define1DLayers
def define1DLayers(helper, alg, name, title, path, xaxistext, yaxistext, xbins, xmins, binsizes=[1.0], type='TH1F', histname=None, onlylayers=layers)
Definition: PixelAthMonitoringBase.py:481
PixelAthMonitoringBase.define2DProfHist
def define2DProfHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers)
Definition: PixelAthMonitoringBase.py:276
PixelAthMonitoringBase.addOnTrackTxt
def addOnTrackTxt(name, ontrack, wSpace=False)
Definition: PixelAthMonitoringBase.py:516
PixelAthMonitoringBase.define2DProfPerFEHist
def define2DProfPerFEHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers)
Definition: PixelAthMonitoringBase.py:318
PixelAthMonitoringBase.fullDressTitle
def fullDressTitle(name, ontrack, xaxistext, yaxistext)
Definition: PixelAthMonitoringBase.py:531