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  if myMonAlg.doOnlineMon:
98  streamhitmaprecent = "mapsOfHitsOnTracksrecent" + abbreviations[isub] + "_" + "trackhitsmap_" + str(i//2) + "_" + str(i%2)
99  histotitlerecent = "SCT hits on tracks for recent event for " + names[isub] + " " + Title(i,isub)
100  MonGroupArray[isub].defineHistogram(varname= "eta_"+streamhitmap + ",phi_"+streamhitmap + ";"+streamhitmaprecent,
101  type= "TH2F",
102  title= histotitlerecent + ";Index in the direction of #eta;Index in the direction of #phi",
103  path= path[isub] + "/hits/mapsOfHitsOnTracks/",
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  occMap = "occupancymap" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
109  hitoccupancy = "hitoccupancymap" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
110  histotitleR = "SCT Hit Occupancy map for " + names[isub] + ": " + Title(i,isub)
111  MonGroupArray[isub].defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",HO_"+occMap+";" + hitoccupancy,
112  type= "TProfile2D",
113  title= histotitleR + ";Index in the direction of #eta;Index in the direction of #phi",
114  path= path[isub] + "/Noise",
115  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
116  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5, ymax=sctMon.l_phibin[isub]+0.5,
117  opt='kAlwaysCreate')
118 
119  noiseoccupancy = "noiseoccupancymaptrigger" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
120  m_NOTriggerItem = "L1_RD0_EMPTY"
121  histotitletrigger = "SCT Noise Occupancy map for " + m_NOTriggerItem + " Trigger and " + names[isub] + ": " + Title(i,isub)
122  MonGroupArray[isub].defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",NO_"+occMap+";" + noiseoccupancy,
123  type= "TProfile2D",
124  title= histotitletrigger + ";Index in the direction of #eta;Index in the direction of #phi",
125  cutmask= "IsSelectedTrigger_"+occMap,
126  path= path[isub] + "/Noise",
127  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
128  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5, ymax=sctMon.l_phibin[isub]+0.5,
129  opt='kAlwaysCreate')
130 
131  if myMonAlg.doOnlineMon:
132  noiseoccupancyrecent = "noiseoccupancymaprecent" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
133  histotitlerecent = "SCT Noise Occupancy map for " + m_NOTriggerItem + " recent events and " + names[isub] + ": " + Title(i,isub)
134  MonGroupArray[isub].defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",NO_"+occMap+";" + noiseoccupancyrecent,
135  type= "TProfile2D",
136  title= histotitlerecent + ";Index in the direction of #eta;Index in the direction of #phi",
137  cutmask= "IsSelectedTriggerRecent_"+occMap,
138  path= path[isub] + "/Noise",
139  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
140  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5, ymax=sctMon.l_phibin[isub]+0.5,
141  opt = 'kLBNHistoryDepth=30,kAlwaysCreate')
142 
143 
144 
145  #End i Loop
146 
147  MonGroupArray[isub].defineHistogram(varname= "LB,HO;"+ noiseAbbreviations[isub] + "HO_vsLB",
148  type= "TProfile",
149  title= "HO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
150  path= path[isub] + "/Noise",
151  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
152  opt='kAlwaysCreate')
153 
154  MonGroupArray[isub].defineHistogram(varname= "LB,HO;"+ noiseAbbreviations[isub] + "HOTrigger_vsLB",
155  type= "TProfile",
156  title= "HO with trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
157  cutmask= "IsSelectedTrigger",
158  path= path[isub] + "/Noise",
159  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
160  opt='kAlwaysCreate')
161 
162  MonGroupArray[isub].defineHistogram(varname= "LB,NO;"+ noiseAbbreviations[isub] + "NO_vsLB",
163  type= "TProfile",
164  title= "NO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
165  path= path[isub] + "/Noise",
166  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
167  opt='kAlwaysCreate')
168 
169  MonGroupArray[isub].defineHistogram(varname= "LB,NO;"+ noiseAbbreviations[isub] + "NOTrigger_vsLB",
170  type= "TProfile",
171  title= "NO with Trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
172  cutmask= "IsSelectedTrigger",
173  path= path[isub] + "/Noise",
174  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
175  opt='kAlwaysCreate')
176 
177  MonGroupArray[isub].defineHistogram(varname= "LBHits,numberOfHitsFromSPs;" + "h_HSPHitsTrigger"+titleAbbreviations[isub]+"_vsLB",
178  type= "TProfile",
179  title= "Average num of SP Hits in " + titleAbbreviations[isub] + " with trigger vs LB" + ";LumiBlock;Average number of SP Hits",
180  cutmask= "isSelectedTriggerHits",
181  path= path[isub] + "/Noise",
182  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5)
183 
184  MonGroupArray[isub].defineHistogram(varname= "LBHits,numberOfHitsFromSPs;" + "h_HSPHits"+titleAbbreviations[isub]+"_vsLB",
185  type= "TProfile",
186  title= "Average num of SP Hits in " + titleAbbreviations[isub] + " vs LB" + ";LumiBlock;Average number of SP Hits",
187  path= path[isub] + "/Noise",
188  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
189  opt='kAlwaysCreate')
190 
191  MonGroupArray[isub].defineHistogram(varname= "LBHits,numberOfHitsFromAllRDOs;" + "h_HallHitsTrigger"+titleAbbreviations[isub]+"_vsLB",
192  type= "TProfile",
193  title= "Average num of all Hits in " + titleAbbreviations[isub] + " with trigger vs LB" + ";LumiBlock;Average number of SP Hits",
194  cutmask= "isSelectedTriggerHits",
195  path= path[isub] + "/Noise",
196  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
197  opt='kAlwaysCreate')
198 
199  MonGroupArray[isub].defineHistogram(varname= "LBHits,numberOfHitsFromAllRDOs;" + "h_HallHits"+titleAbbreviations[isub]+"_vsLB",
200  type= "TProfile",
201  title= "Average num of all Hits in " + titleAbbreviations[isub] + " vs LB" + ";LumiBlock;Average number of SP Hits",
202  path= path[isub] + "/Noise",
203  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
204  opt='kAlwaysCreate')
205 
206  #GENERAL
207  myMonGroupGeneral.defineHistogram(varname= "clu_size",
208  type= "TH1F",
209  title= "SCT Cluster Size" + ";Cluster Size;Num of Events",
210  path= "/hits",
211  xbins=200, xmin = 0, xmax = 200,
212  opt='kAlwaysCreate')
213 
214  myMonGroupGeneral.defineHistogram(varname= "LB,HO;"+ "HO_vsLB",
215  type= "TProfile",
216  title= "HO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
217  path= "/noise",
218  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
219  opt='kAlwaysCreate')
220 
221  myMonGroupGeneral.defineHistogram(varname= "LB,HO;"+ "HOTrigger_vsLB",
222  type= "TProfile",
223  title= "HO with trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
224  cutmask= "IsSelectedTrigger",
225  path= "/noise",
226  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
227  opt='kAlwaysCreate')
228 
229  myMonGroupGeneral.defineHistogram(varname= "LB,NO;"+ "NO_vsLB",
230  type= "TProfile",
231  title= "NO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
232  path= "/noise",
233  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
234  opt='kAlwaysCreate')
235 
236  myMonGroupGeneral.defineHistogram(varname= "LB,NO;"+ "NOTrigger_vsLB",
237  type= "TProfile",
238  title= "NO with Trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
239  cutmask= "IsSelectedTrigger",
240  path= "/noise",
241  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
242  opt='kAlwaysCreate')
243 
244  myMonGroupGeneral.defineHistogram(varname= "Bec_TBinFracAll,TBin_TBinFracAll;" + "TBinFracAll",
245  type= "TProfile",
246  title= "fraction of 01X for each region" + "; ;Fraction of 01X",
247  path= "/tbin",
248  xbins= sctMon.N_REGIONS, xmin = 0., xmax = sctMon.N_REGIONS,
249  xlabels= names,
250  opt='kAlwaysCreate')
251 
252  myMonGroupGeneral.defineHistogram(varname= "sct_hits",
253  type= "TH1F",
254  title= "Total SCT Hits;Total SCT Hits;Entries",
255  path= "/hits/summary",
256  xbins= sctMon.N_NOISE_HIT_BINS, xmin = sctMon.FIRST_NOISE_HIT_BIN, xmax = sctMon.LAST_NOISE_HIT_BIN,
257  opt='kAlwaysCreate')
258 
259  result.merge(helper.result())
260  return result
261 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
SCTHitsNoiseMonAlg.SCTHitsNoiseMonAlgConfig
def SCTHitsNoiseMonAlgConfig(inputFlags)
Definition: SCTHitsNoiseMonAlg.py:21
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
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