ATLAS Offline Software
SCTHitsNoiseMonAlg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2020 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.__getitem__(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  streamhitmap = "mapsOfHitsOnTracks" + abbreviations[isub] + "_" + "trackhitsmap_" + str(i//2) + "_" + str(i%2)
76  histotitle = "SCT hits on tracks for " + names[isub] + " " + Title(i,isub)
77  MonGroupArray.__getitem__(isub).defineHistogram(varname= "eta_"+streamhitmap + ",phi_"+streamhitmap + ";"+streamhitmap,
78  type= "TH2F",
79  title= histotitle + ";Index in the direction of #eta;Index in the direction of #phi",
80  path= path[isub] + "/hits/mapsOfHitsOnTracks/",
81  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
82  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5 , ymax=sctMon.l_phibin[isub]+0.5,
83  opt='kAlwaysCreate')
84 
85  occMap = "occupancymap" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
86  hitoccupancy = "hitoccupancymap" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
87  histotitleR = "SCT Hit Occupancy map for " + names[isub] + ": " + Title(i,isub)
88  MonGroupArray.__getitem__(isub).defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",HO_"+occMap+";" + hitoccupancy,
89  type= "TProfile2D",
90  title= histotitleR + ";Index in the direction of #eta;Index in the direction of #phi",
91  path= path[isub] + "/Noise",
92  xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub]-0.5, xmax=sctMon.l_etabin[isub]+0.5,
93  ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub]-0.5, ymax=sctMon.l_phibin[isub]+0.5,
94  opt='kAlwaysCreate')
95 
96  noiseoccupancy = "noiseoccupancymaptrigger" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
97  m_NOTriggerItem = "L1_RD0_EMPTY"
98  histotitletrigger = "SCT Noise Occupancy map for " + m_NOTriggerItem + " Trigger and " + names[isub] + ": " + Title(i,isub)
99  MonGroupArray.__getitem__(isub).defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",NO_"+occMap+";" + noiseoccupancy,
100  type= "TProfile2D",
101  title= histotitletrigger + ";Index in the direction of #eta;Index in the direction of #phi",
102  cutmask= "IsSelectedTrigger_"+occMap,
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 
107  if myMonAlg.doOnlineMon:
108  noiseoccupancyrecent = "noiseoccupancymaprecent" + abbreviations[isub] + "_" + str(i//2) + "_" + str(i%2)
109  histotitlerecent = "SCT Noise Occupancy map for " + m_NOTriggerItem + " recent events and " + names[isub] + ": " + Title(i,isub)
110  MonGroupArray.__getitem__(isub).defineHistogram(varname= "eta_"+occMap + ",phi_"+occMap + ",NO_"+occMap+";" + noiseoccupancyrecent,
111  type= "TProfile2D",
112  title= histotitlerecent + ";Index in the direction of #eta;Index in the direction of #phi",
113  cutmask= "IsSelectedTriggerRecent_"+occMap,
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 = 'kLBNHistoryDepth=30,kAlwaysCreate')
118 
119  #End i Loop
120 
121  MonGroupArray.__getitem__(isub).defineHistogram(varname= "LB,HO;"+ noiseAbbreviations[isub] + "HO_vsLB",
122  type= "TProfile",
123  title= "HO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
124  path= path[isub] + "/Noise",
125  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
126  opt='kAlwaysCreate')
127 
128  MonGroupArray.__getitem__(isub).defineHistogram(varname= "LB,HO;"+ noiseAbbreviations[isub] + "HOTrigger_vsLB",
129  type= "TProfile",
130  title= "HO with trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
131  cutmask= "IsSelectedTrigger",
132  path= path[isub] + "/Noise",
133  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5)
134 
135  MonGroupArray.__getitem__(isub).defineHistogram(varname= "LB,NO;"+ noiseAbbreviations[isub] + "NO_vsLB",
136  type= "TProfile",
137  title= "NO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
138  path= path[isub] + "/Noise",
139  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
140  opt='kAlwaysCreate')
141 
142  MonGroupArray.__getitem__(isub).defineHistogram(varname= "LB,NO;"+ noiseAbbreviations[isub] + "NOTrigger_vsLB",
143  type= "TProfile",
144  title= "NO with Trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
145  cutmask= "IsSelectedTrigger",
146  path= path[isub] + "/Noise",
147  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5)
148 
149  MonGroupArray.__getitem__(isub).defineHistogram(varname= "LBHits,numberOfHitsFromSPs;" + "h_HSPHitsTrigger"+titleAbbreviations[isub]+"_vsLB",
150  type= "TProfile",
151  title= "Average num of SP Hits in " + titleAbbreviations[isub] + " with trigger vs LB" + ";LumiBlock;Average number of SP Hits",
152  cutmask= "isSelectedTriggerHits",
153  path= path[isub] + "/Noise",
154  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5)
155 
156  MonGroupArray.__getitem__(isub).defineHistogram(varname= "LBHits,numberOfHitsFromSPs;" + "h_HSPHits"+titleAbbreviations[isub]+"_vsLB",
157  type= "TProfile",
158  title= "Average num of SP Hits in " + titleAbbreviations[isub] + " vs LB" + ";LumiBlock;Average number of SP Hits",
159  path= path[isub] + "/Noise",
160  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
161  opt='kAlwaysCreate')
162 
163  MonGroupArray.__getitem__(isub).defineHistogram(varname= "LBHits,numberOfHitsFromAllRDOs;" + "h_HallHitsTrigger"+titleAbbreviations[isub]+"_vsLB",
164  type= "TProfile",
165  title= "Average num of all Hits in " + titleAbbreviations[isub] + " with trigger vs LB" + ";LumiBlock;Average number of SP Hits",
166  cutmask= "isSelectedTriggerHits",
167  path= path[isub] + "/Noise",
168  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5)
169 
170  MonGroupArray.__getitem__(isub).defineHistogram(varname= "LBHits,numberOfHitsFromAllRDOs;" + "h_HallHits"+titleAbbreviations[isub]+"_vsLB",
171  type= "TProfile",
172  title= "Average num of all Hits in " + titleAbbreviations[isub] + " vs LB" + ";LumiBlock;Average number of SP Hits",
173  path= path[isub] + "/Noise",
174  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
175  opt='kAlwaysCreate')
176 
177  #GENERAL
178  myMonGroupGeneral.defineHistogram(varname= "clu_size",
179  type= "TH1F",
180  title= "SCT Cluster Size" + ";Cluster Size;Num of Events",
181  path= "/hits",
182  xbins=200, xmin = 0, xmax = 200,
183  opt='kAlwaysCreate')
184 
185  myMonGroupGeneral.defineHistogram(varname= "LB,HO;"+ "HO_vsLB",
186  type= "TProfile",
187  title= "HO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
188  path= "/noise",
189  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
190  opt='kAlwaysCreate')
191 
192  myMonGroupGeneral.defineHistogram(varname= "LB,HO;"+ "HOTrigger_vsLB",
193  type= "TProfile",
194  title= "HO with trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
195  cutmask= "IsSelectedTrigger",
196  path= "/noise",
197  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5)
198 
199  myMonGroupGeneral.defineHistogram(varname= "LB,NO;"+ "NO_vsLB",
200  type= "TProfile",
201  title= "NO vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
202  path= "/noise",
203  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5,
204  opt='kAlwaysCreate')
205 
206  myMonGroupGeneral.defineHistogram(varname= "LB,NO;"+ "NOTrigger_vsLB",
207  type= "TProfile",
208  title= "NO with Trigger vs LB for all region (SP noise)" + ";LumiBlock;Hit Occupancy [10^{-5}]",
209  cutmask= "IsSelectedTrigger",
210  path= "/noise",
211  xbins=sctMon.NBINS_LBs, xmin = 0.5, xmax = sctMon.NBINS_LBs + 0.5)
212 
213  myMonGroupGeneral.defineHistogram(varname= "Bec_TBinFracAll,TBin_TBinFracAll;" + "TBinFracAll",
214  type= "TProfile",
215  title= "fraction of 01X for each region" + "; ;Fraction of 01X",
216  path= "/tbin",
217  xbins= sctMon.N_REGIONS, xmin = 0., xmax = sctMon.N_REGIONS,
218  xlabels= names,
219  opt='kAlwaysCreate')
220 
221  myMonGroupGeneral.defineHistogram(varname= "sct_hits",
222  type= "TH1F",
223  title= "Total SCT Hits;Total SCT Hits;Entries",
224  path= "/hits/summary",
225  xbins= sctMon.N_NOISE_HIT_BINS, xmin = sctMon.FIRST_NOISE_HIT_BIN, xmax = sctMon.LAST_NOISE_HIT_BIN,
226  opt='kAlwaysCreate')
227 
228  result.merge(helper.result())
229  return result
230 
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