ATLAS Offline Software
SCTHitsNoiseMonAlg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''@file SCTHitNoiseMonAlg.py
6 @author Susumu Oda
7 @date 2020-10-08
8 @brief New style configuration of SCTHitNoiseMonAlg
9 '''
10 
11 def Title( i, isub):
12  m_layerStr = i / 2
13  m_sideStr = i % 2
14  m_region = isub
15  if m_region == 1 :
16  return "Layer " + str(m_layerStr) + " Side " + str(m_sideStr)
17  else:
18  return "Disk " + str(m_layerStr) + " Side " + str(m_sideStr)
19 
20 
21 def SCTHitsNoiseMonAlgConfig(inputFlags):
22 
23  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
24  result = ComponentAccumulator()
25 
26  from AthenaMonitoring import AthMonitorCfgHelper
27  helper = AthMonitorCfgHelper(inputFlags, 'SCTHitsNoiseMonCfg')
28 
29  from AthenaConfiguration.ComponentFactory import CompFactory
30  myMonAlg = helper.addAlgorithm(CompFactory.SCTHitsNoiseMonAlg, 'SCTHitsNoiseMonAlg')
31  myMonAlg.TriggerChain = ""
32 
33  # Trigger histogram will be made only for data.
34  myMonAlg.doTrigger = (not inputFlags.Input.isMC and inputFlags.DQ.useTrigger)
35 
36  myMonAlg.doOnlineMon = inputFlags.Common.isOnline
37 
38  from ROOT import SCT_Monitoring as sctMon #import SCT_MonitoringNumbers.h
39 
40  # Add a generic monitoring tool (a "group" in old language). The returned
41  # object here is the standard GenericMonitoringTool.
42  dimension = [sctMon.N_REGIONS]
43 
44  MonGroupArray = helper.addArray(dimension,myMonAlg,"SCTHitsNoiseMonitor","SCT") # SCTHitsNoiseMonitor_3 on index 0 !!
45 
46  myMonGroupGeneral = helper.addGroup(
47  myMonAlg,
48  "SCTHitsNoiseMonitorGeneral",
49  "SCT/GENERAL/"
50  )
51 
52  # Configure histograms
53 
54  abbreviations = ["ECm", "", "ECp"]
55  names = ["Endcap C", "Barrel", "Endcap A"]
56  path = ["SCTEC", "SCTB", "SCTEA"]
57  noiseAbbreviations = ["ECC","BAR","ECA"]
58  titleAbbreviations = ["ECm","BAR","ECp"]
59  limits = [ sctMon.N_DISKS*2, sctMon.N_BARRELS*2, sctMon.N_DISKS*2 ]
60 
61  for isub in range(sctMon.N_REGIONS):
62  for i in range(limits[isub]):
63 
64  HitsMapName = "hitsmap" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
65  HitsMapTitle = "SCT Hitmap for " + names[isub] + ": " + Title(i,isub)
66  MonGroupArray[isub].defineHistogram(varname= "eta_"+HitsMapName+",phi_"+HitsMapName+";"+HitsMapName,
67  type= "TH2F",
68  title= HitsMapTitle + ";Index in the direction of #eta;Index in the direction of #phi",
69  path= path[isub] + "/hits",
70  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
71  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5 , ymax=sctMon.l_phibin[isub]+0.5,
72  weight="numberOfStrips_"+HitsMapName,
73  opt='kAlwaysCreate')
74 
75  if myMonAlg.doOnlineMon:
76  HitsMapRecentName = "hitsmaprecent" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
77  HitsMapRecentTitle = "SCT Hitmap for recent event for " + names[isub] + ": " + Title(i,isub)
78  MonGroupArray[isub].defineHistogram(varname= "eta_"+HitsMapName+",phi_"+HitsMapName+";"+HitsMapRecentName,
79  type= "TH2F",
80  title= HitsMapRecentTitle + ";Index in the direction of #eta;Index in the direction of #phi",
81  path= path[isub] + "/hits",
82  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
83  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5 , ymax=sctMon.l_phibin[isub]+0.5,
84  weight="numberOfStrips_"+HitsMapName,
85  opt='kLBNHistoryDepth=30,kAlwaysCreate')
86 
87  streamhitmap = "mapsOfHitsOnTracks" + abbreviations[isub] + "_" + "trackhitsmap_" + str(i//2) + "_" + str(i%2)
88  histotitle = "SCT hits on tracks for " + names[isub] + " " + Title(i,isub)
89  MonGroupArray[isub].defineHistogram(varname= "eta_"+streamhitmap + ",phi_"+streamhitmap + ";"+streamhitmap,
90  type= "TH2F",
91  title= histotitle + ";Index in the direction of #eta;Index in the direction of #phi",
92  path= path[isub] + "/hits/mapsOfHitsOnTracks/",
93  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
94  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5 , ymax=sctMon.l_phibin[isub]+0.5,
95  opt='kAlwaysCreate')
96 
97  occMap = "occupancymap" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
98  hitoccupancy = "hitoccupancymap" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
99  histotitleR = "SCT Hit Occupancy map for " + names[isub] + ": " + Title(i,isub)
100  MonGroupArray[isub].defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",HO_"+occMap+";" + hitoccupancy,
101  type= "TProfile2D",
102  title= histotitleR + ";Index in the direction of #eta;Index in the direction of #phi",
103  path= path[isub] + "/Noise",
104  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
105  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5, ymax=sctMon.l_phibin[isub]+0.5,
106  opt='kAlwaysCreate')
107 
108  noiseoccupancy = "noiseoccupancymaptrigger" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
109  m_NOTriggerItem = "L1_RD0_EMPTY"
110  histotitletrigger = "SCT Noise Occupancy map for " + m_NOTriggerItem + " Trigger and " + names[isub] + ": " + Title(i,isub)
111  MonGroupArray[isub].defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",NO_"+occMap+";" + noiseoccupancy,
112  type= "TProfile2D",
113  title= histotitletrigger + ";Index in the direction of #eta;Index in the direction of #phi",
114  cutmask= "IsSelectedTrigger_"+occMap,
115  path= path[isub] + "/Noise",
116  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
117  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5, ymax=sctMon.l_phibin[isub]+0.5,
118  opt='kAlwaysCreate')
119 
120  if myMonAlg.doOnlineMon:
121  noiseoccupancyrecent = "noiseoccupancymaprecent" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
122  histotitlerecent = "SCT Noise Occupancy map for " + m_NOTriggerItem + " recent events and " + names[isub] + ": " + Title(i,isub)
123  MonGroupArray[isub].defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",NO_"+occMap+";" + noiseoccupancyrecent,
124  type= "TProfile2D",
125  title= histotitlerecent + ";Index in the direction of #eta;Index in the direction of #phi",
126  cutmask= "IsSelectedTriggerRecent_"+occMap,
127  path= path[isub] + "/Noise",
128  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
129  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5, ymax=sctMon.l_phibin[isub]+0.5,
130  opt = 'kLBNHistoryDepth=30,kAlwaysCreate')
131 
132 
133 
134  #End i Loop
135 
136  MonGroupArray[isub].defineHistogram(varname= "LB,HO;"+ noiseAbbreviations[isub] + "HO_vsLB",
137  type= "TProfile",
138  title= "HO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
139  path= path[isub] + "/Noise",
140  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
141  opt='kAlwaysCreate')
142 
143  MonGroupArray[isub].defineHistogram(varname= "LB,HO;"+ noiseAbbreviations[isub] + "HOTrigger_vsLB",
144  type= "TProfile",
145  title= "HO with trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
146  cutmask= "IsSelectedTrigger",
147  path= path[isub] + "/Noise",
148  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
149  opt='kAlwaysCreate')
150 
151  MonGroupArray[isub].defineHistogram(varname= "LB,NO;"+ noiseAbbreviations[isub] + "NO_vsLB",
152  type= "TProfile",
153  title= "NO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
154  path= path[isub] + "/Noise",
155  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
156  opt='kAlwaysCreate')
157 
158  MonGroupArray[isub].defineHistogram(varname= "LB,NO;"+ noiseAbbreviations[isub] + "NOTrigger_vsLB",
159  type= "TProfile",
160  title= "NO with Trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
161  cutmask= "IsSelectedTrigger",
162  path= path[isub] + "/Noise",
163  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
164  opt='kAlwaysCreate')
165 
166  MonGroupArray[isub].defineHistogram(varname= "LBHits,numberOfHitsFromSPs;" + "h_HSPHitsTrigger"+titleAbbreviations[isub]+"_vsLB",
167  type= "TProfile",
168  title= "Average num of SP Hits in " + titleAbbreviations[isub] + " with trigger vs LB" + ";LumiBlock;Average number of SP Hits",
169  cutmask= "isSelectedTriggerHits",
170  path= path[isub] + "/Noise",
171  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5)
172 
173  MonGroupArray[isub].defineHistogram(varname= "LBHits,numberOfHitsFromSPs;" + "h_HSPHits"+titleAbbreviations[isub]+"_vsLB",
174  type= "TProfile",
175  title= "Average num of SP Hits in " + titleAbbreviations[isub] + " vs LB" + ";LumiBlock;Average number of SP Hits",
176  path= path[isub] + "/Noise",
177  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
178  opt='kAlwaysCreate')
179 
180  MonGroupArray[isub].defineHistogram(varname= "LBHits,numberOfHitsFromAllRDOs;" + "h_HallHitsTrigger"+titleAbbreviations[isub]+"_vsLB",
181  type= "TProfile",
182  title= "Average num of all Hits in " + titleAbbreviations[isub] + " with trigger vs LB" + ";LumiBlock;Average number of SP Hits",
183  cutmask= "isSelectedTriggerHits",
184  path= path[isub] + "/Noise",
185  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
186  opt='kAlwaysCreate')
187 
188  MonGroupArray[isub].defineHistogram(varname= "LBHits,numberOfHitsFromAllRDOs;" + "h_HallHits"+titleAbbreviations[isub]+"_vsLB",
189  type= "TProfile",
190  title= "Average num of all Hits in " + titleAbbreviations[isub] + " vs LB" + ";LumiBlock;Average number of SP Hits",
191  path= path[isub] + "/Noise",
192  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
193  opt='kAlwaysCreate')
194 
195  #GENERAL
196  myMonGroupGeneral.defineHistogram(varname= "clu_size",
197  type= "TH1F",
198  title= "SCT Cluster Size" + ";Cluster Size;Num of Events",
199  path= "/hits",
200  xbins=200, xmin = 0, xmax = 200,
201  opt='kAlwaysCreate')
202 
203  myMonGroupGeneral.defineHistogram(varname= "LB,HO;"+ "HO_vsLB",
204  type= "TProfile",
205  title= "HO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
206  path= "/noise",
207  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
208  opt='kAlwaysCreate')
209 
210  myMonGroupGeneral.defineHistogram(varname= "LB,HO;"+ "HOTrigger_vsLB",
211  type= "TProfile",
212  title= "HO with trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
213  cutmask= "IsSelectedTrigger",
214  path= "/noise",
215  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
216  opt='kAlwaysCreate')
217 
218  myMonGroupGeneral.defineHistogram(varname= "LB,NO;"+ "NO_vsLB",
219  type= "TProfile",
220  title= "NO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
221  path= "/noise",
222  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
223  opt='kAlwaysCreate')
224 
225  myMonGroupGeneral.defineHistogram(varname= "LB,NO;"+ "NOTrigger_vsLB",
226  type= "TProfile",
227  title= "NO with Trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
228  cutmask= "IsSelectedTrigger",
229  path= "/noise",
230  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
231  opt='kAlwaysCreate')
232 
233  myMonGroupGeneral.defineHistogram(varname= "Bec_TBinFracAll,TBin_TBinFracAll;" + "TBinFracAll",
234  type= "TProfile",
235  title= "fraction of 01X for each region" + "; ;Fraction of 01X",
236  path= "/tbin",
237  xbins= sctMon.N_REGIONS, xmin = 0., xmax = sctMon.N_REGIONS,
238  xlabels= names,
239  opt='kAlwaysCreate')
240 
241  myMonGroupGeneral.defineHistogram(varname= "sct_hits",
242  type= "TH1F",
243  title= "Total SCT Hits;Total SCT Hits;Entries",
244  path= "/hits/summary",
245  xbins= sctMon.N_NOISE_HIT_BINS, xmin = sctMon.FIRST_NOISE_HIT_BIN, xmax = sctMon.LAST_NOISE_HIT_BIN,
246  opt='kAlwaysCreate')
247 
248  result.merge(helper.result())
249  return result
250 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
SCTHitsNoiseMonAlg.SCTHitsNoiseMonAlgConfig
def SCTHitsNoiseMonAlgConfig(inputFlags)
Definition: SCTHitsNoiseMonAlg.py:21
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
GenericMonitoringTool.defineHistogram
def defineHistogram(flags, varname, type='TH1F', path=None, title=None, weight=None, xbins=100, xmin=0, xmax=1, xlabels=None, ybins=None, ymin=None, ymax=None, ylabels=None, zmin=None, zmax=None, zlabels=None, opt=None, convention=None, cutmask=None, treedef=None, merge=None)
Generate histogram definition string for the GenericMonitoringTool.Histograms property.
Definition: GenericMonitoringTool.py:306
str
Definition: BTagTrackIpAccessor.cxx:11
SCTHitsNoiseMonAlg.Title
def Title(i, isub)
Definition: SCTHitsNoiseMonAlg.py:11