ATLAS Offline Software
Loading...
Searching...
No Matches
LArRODMonAlg.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4
5def LArRODMonConfig(flags,cellDebug=False, dspDebug=False):
6 from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper
7 helper = AthMonitorCfgHelper(flags,'LArRODMonAlgCfg')
8
9 from AthenaConfiguration.ComponentFactory import CompFactory
10
11
12 LArRODMonConfigCore(helper, CompFactory.LArRODMonAlg,flags,cellDebug, dspDebug)
13
14 return helper.result()
15
16
17def LArRODMonConfigCore(helper, algoinstance,flags, cellDebug=False, dspDebug=False):
18
19 larRODMonAlg = helper.addAlgorithm(algoinstance,'larRODMonAlg')
20
21 from LArMonitoring.GlobalVariables import lArDQGlobals
22
23
24 GroupName="RODMon"
25 nslots=[]
26 for i in range(0,len(lArDQGlobals.FEB_Slot)):
27 nslots.append(lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[i]][1])
28
29 larRODMonAlg.MonGroup=GroupName
30 larRODMonAlg.LArRODSubDetNames=lArDQGlobals.SubDet
31 larRODMonAlg.LArRODPartitionNames=lArDQGlobals.Partitions
32 larRODMonAlg.LArRODNslots=nslots
33
34 larRODMonAlg.ADCthreshold = 0
35 larRODMonAlg.peakTimeCut = 5.
36 larRODMonAlg.SkipNullQT=True
37
38 # for detailed debugging
39 if cellDebug:
40 larRODMonAlg.DoCellsDump=True
41
42 if dspDebug:
43 larRODMonAlg.DoDspTestDump=True
44
45 if flags.Common.isOnline:
46 larRODMonAlg.MaxEvDump=100
47
48 #from AthenaCommon.Constants import VERBOSE
49 #larRODMonAlg.OutputLevel=VERBOSE
50 larRODMonAlg.ProblemsToMask=["highNoiseHG","highNoiseMG","highNoiseLG","deadReadout","deadPhys","almostDead","short","sporadicBurstNoise"]
51
52 Group = helper.addGroup(
53 larRODMonAlg,
54 GroupName,
55 '/LAr/DSPMonitoring'
56 )
57
58
59 #Summary histos
60 summary_hist_path='Summary/'
61
62 Group.defineHistogram('partition,gain;Summary_E',
63 title='Summary of errors on Energy per partition and per gain',
64 type='TH2F',
65 path=summary_hist_path,
66 weight='weight_e',
67 xbins=lArDQGlobals.N_Partitions, xmin=-0.5, xmax=lArDQGlobals.N_Partitions-0.5,
68 ybins=lArDQGlobals.N_Gains,ymin=-0.5,ymax=lArDQGlobals.N_Gains-0.5,
69 xlabels=lArDQGlobals.Partitions,ylabels=lArDQGlobals.Gains)
70
71 Group.defineHistogram('partition,gain;Summary_Q',
72 title='Summary of errors on Quality per partition and per gain',
73 type='TH2F',
74 path=summary_hist_path,
75 weight='weight_q',
76 xbins=lArDQGlobals.N_Partitions, xmin=-0.5, xmax=lArDQGlobals.N_Partitions-0.5,
77 ybins=lArDQGlobals.N_Gains,ymin=-0.5,ymax=lArDQGlobals.N_Gains-0.5,
78 xlabels=lArDQGlobals.Partitions,ylabels=lArDQGlobals.Gains)
79
80 Group.defineHistogram('partition,gain;Summary_T',
81 title='Summary of errors on Time per partition and per gain',
82 type='TH2F',
83 path=summary_hist_path,
84 weight='weight_t',
85 xbins=lArDQGlobals.N_Partitions, xmin=-0.5, xmax=lArDQGlobals.N_Partitions-0.5,
86 ybins=lArDQGlobals.N_Gains,ymin=-0.5,ymax=lArDQGlobals.N_Gains-0.5,
87 xlabels=lArDQGlobals.Partitions,ylabels=lArDQGlobals.Gains)
88
89 Group.defineHistogram('Ediff;E_all',
90 title='E_offline - E_online for all partitions;E_offline - E_online (MeV)',
91 type='TH1F',
92 path=summary_hist_path,
93 xbins=lArDQGlobals.DSPEnergy_Bins, xmin=lArDQGlobals.DSPEnergy_Min, xmax=lArDQGlobals.DSPEnergy_Max)
94 Group.defineHistogram('Tdiff;T_all',
95 title='T_offline - T_online for all partitions;T_offline - T_online (ps)',
96 type='TH1F',
97 path=summary_hist_path,
98 xbins=lArDQGlobals.DSPTime_Bins, xmin=lArDQGlobals.DSPTime_Min, xmax=lArDQGlobals.DSPTime_Max)
99 Group.defineHistogram('Qdiff;Q_all',
100 title='Q_offline - Q_online / sqrt(Q_offline) for all partitions;Q_offline - Q_online / sqrt(Q_offline) (ps)',
101 type='TH1F',
102 path=summary_hist_path,
103 xbins=lArDQGlobals.DSPQuality_Bins, xmin=lArDQGlobals.DSPQuality_Min, xmax=lArDQGlobals.DSPQuality_Max)
104
105 #Infos histos (vs. LB)
106 info_hist_path='Infos/'
107 cut = "#delta ADC>"+str(larRODMonAlg.ADCthreshold)+" and |T_offline| < "+str(larRODMonAlg.peakTimeCut)+" ns"
108 Group.defineHistogram('LBN,partitionI;EErrorsPerLB',
109 title='Nb of errors in E per LB -' +cut+';Luminosity Block;Partition',
110 type='TH2I',
111 weight='numE',
112 path=info_hist_path,
113 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max,
114 ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
115 ylabels = lArDQGlobals.Partitions
116 )
117 Group.defineHistogram('LBN,partitionI;TErrorsPerLB',
118 title='Nb of errors in T per LB - ' +cut+';Luminosity Block;Partition',
119 type='TH2I',
120 weight='numT',
121 path=info_hist_path,
122 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max,
123 ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
124 ylabels = lArDQGlobals.Partitions
125 )
126 Group.defineHistogram('LBN,partitionI;QErrorsPerLB',
127 title='Nb of errors in Q per LB - ' +cut+';Luminosity Block;Partition',
128 type='TH2I',
129 weight='numQ',
130 path=info_hist_path,
131 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max,
132 ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
133 ylabels = lArDQGlobals.Partitions
134 )
135
136 #DQMD histos
137 dqmd_hist_path='/LAr/DSPMonitoring/DQMD/'
138 darray = helper.addArray([lArDQGlobals.Partitions],larRODMonAlg,"RODMon",topPath='/')
139 darray.defineHistogram('Ediff,Erange;DE_ranges', title='E_offline - E_online for all ranges ; E_offline - E_online (MeV) ; Energy range',
140 type='TH2F', path=dqmd_hist_path,
141 xbins=lArDQGlobals.DSP1Energy_Bins, xmin=lArDQGlobals.DSP1Energy_Min, xmax=lArDQGlobals.DSP1Energy_Max,
142 ybins=lArDQGlobals.DSPRanges_Bins, ymin=lArDQGlobals.DSPRanges_Min, ymax=lArDQGlobals.DSPRanges_Max,
143 ylabels=lArDQGlobals.DSPRanges
144 )
145 Group.defineHistogram('Ediff,Erange;E_ranges_all', title='E_online - E_offline for all ranges ; E_offline - E_online (MeV) ; Energy range',
146 type='TH2F', path='DQMD/',
147 xbins=lArDQGlobals.DSP1Energy_Bins, xmin=lArDQGlobals.DSP1Energy_Min, xmax=lArDQGlobals.DSP1Energy_Max,
148 ybins=lArDQGlobals.DSPRanges_Bins, ymin=lArDQGlobals.DSPRanges_Min, ymax=lArDQGlobals.DSPRanges_Max,
149 ylabels=lArDQGlobals.DSPRanges
150 )
151
152
153 #per partition, currently in one dir only
154 part_hist_path='/LAr/DSPMonitoring/perPartition/'
155 darray.defineHistogram('Ediff;DE', title='E_offline - E_online;E_offline - E_online (MeV)',
156 type='TH1F', path=part_hist_path,
157 xbins=lArDQGlobals.DSPEnergy_Bins, xmin=lArDQGlobals.DSPEnergy_Min, xmax=lArDQGlobals.DSPEnergy_Max)
158 darray.defineHistogram('Tdiff;DT', title='T_offline - T_online;T_offline - T_online (ps)',
159 type='TH1F', path=part_hist_path,
160 xbins=lArDQGlobals.DSPTime_Bins, xmin=lArDQGlobals.DSPTime_Min, xmax=lArDQGlobals.DSPTime_Max)
161 darray.defineHistogram('Qdiff;DQ', title='Q_offline - Q_online / sqrt(Q_offline);Q_offline - Q_online / sqrt(Q_offline)' ,
162 type='TH1F', path=part_hist_path,
163 xbins=lArDQGlobals.DSPTime_Bins, xmin=lArDQGlobals.DSPTime_Min, xmax=lArDQGlobals.DSPTime_Max)
164
165 darray.defineHistogram('slot,FT;RAW_Out_E_FT_vs_SLOT',title='# of cells with E_offline - E_online > numerical precision ; Slot ; Feedthrough',
166 type='TH2I', path=part_hist_path,
167 opt='kAlwaysCreate',
168 weight='weight_e',
169 xbins=lArDQGlobals.FEB_Slot["EMECA"][1], xmin=lArDQGlobals.FEB_Slot["EMECA"][0]-0.5, xmax=lArDQGlobals.FEB_Slot["EMECA"][1]+0.5,
170 ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1]+1, ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0]-0.5, ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1]+0.5)
171
172 darray.defineHistogram('slot,FT;RAW_Out_T_FT_vs_SLOT',title='# of cells with T_offline - T_online > numerical precision ; Slot ; Feedthrough',
173 type='TH2I', path=part_hist_path,
174 opt='kAlwaysCreate',
175 weight='weight_t',
176 xbins=lArDQGlobals.FEB_Slot["EMECA"][1], xmin=lArDQGlobals.FEB_Slot["EMECA"][0]-0.5, xmax=lArDQGlobals.FEB_Slot["EMECA"][1]+0.5,
177 ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1]+1, ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0]-0.5, ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1]+0.5)
178
179 darray.defineHistogram('slot,FT;RAW_Out_Q_FT_vs_SLOT',title='# of cells with Q_offline - Q_online > numerical precision ; Slot ; Feedthrough',
180 type='TH2I', path=part_hist_path,
181 opt='kAlwaysCreate',
182 weight='weight_q',
183 xbins=lArDQGlobals.FEB_Slot["EMECA"][1], xmin=lArDQGlobals.FEB_Slot["EMECA"][0]-0.5, xmax=lArDQGlobals.FEB_Slot["EMECA"][1]+0.5,
184 ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1]+1, ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0]-0.5, ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1]+0.5)
185
186 darray.defineHistogram('Eoff,Eon;Eon_VS_Eoff', title='E_online VS E_offline;E_offline (MeV);E_online (MeV)',
187 type='TH2F', path=part_hist_path,
188 xbins=lArDQGlobals.DSPEonEoff_Bins, xmin=-lArDQGlobals.DSPEonEoff_Max, xmax=lArDQGlobals.DSPEonEoff_Max,
189 ybins=lArDQGlobals.DSPEonEoff_Bins, ymin=-lArDQGlobals.DSPEonEoff_Max, ymax=lArDQGlobals.DSPEonEoff_Max)
190
191 darray.defineHistogram('Toff,Ton;Ton_VS_Toff', title='T_online VS T_offline;T_offline (ps);T_online (ps)',
192 type='TH2F', path=part_hist_path,
193 xbins=lArDQGlobals.DSPTonToff_Bins, xmin=-lArDQGlobals.DSPTonToff_Max, xmax=lArDQGlobals.DSPTonToff_Max,
194 ybins=lArDQGlobals.DSPTonToff_Bins, ymin=-lArDQGlobals.DSPTonToff_Max, ymax=lArDQGlobals.DSPTonToff_Max)
195
196 darray.defineHistogram('Qoff,Qon;Qon_VS_Qoff', title='Q_online VS Q_offline;Q_offline ;Q_online ',
197 type='TH2F', path=part_hist_path,
198 xbins=lArDQGlobals.DSPQonQoff_Bins, xmin=-lArDQGlobals.DSPQonQoff_Max, xmax=lArDQGlobals.DSPQonQoff_Max,
199 ybins=lArDQGlobals.DSPQonQoff_Bins, ymin=-lArDQGlobals.DSPQonQoff_Max, ymax=lArDQGlobals.DSPQonQoff_Max)
200
201 darray.defineHistogram('Sweetc;Sweet_cells', title='Number of sweet Cells in LAr;Sweet cells per feb',
202 type='TH1F', path=part_hist_path,
203 xbins=lArDQGlobals.FEB_N_channels, xmin=lArDQGlobals.FEB_channels_Min, xmax=lArDQGlobals.FEB_channels_Max)
204
205
206
207if __name__=='__main__':
208
209 from AthenaConfiguration.AllConfigFlags import initConfigFlags
210 flags = initConfigFlags()
211
212 from AthenaCommon.Logging import log
213 from AthenaCommon.Constants import DEBUG
214 log.setLevel(DEBUG)
215
216 from LArMonitoring.LArMonConfigFlags import addLArMonFlags
217 flags.addFlagsCategory("LArMon", addLArMonFlags)
218
219 from AthenaConfiguration.TestDefaults import defaultTestFiles
220 flags.Input.Files = defaultTestFiles.RAW_RUN2
221
222 flags.Output.HISTFileName = 'LArRODMonOutput.root'
223 flags.DQ.enableLumiAccess = False
224 flags.DQ.useTrigger = False
225 flags.lock()
226
227
228 from CaloRec.CaloRecoConfig import CaloRecoCfg
229 cfg=CaloRecoCfg(flags)
230
231 #from CaloD3PDMaker.CaloD3PDConfig import CaloD3PDCfg,CaloD3PDAlg
232 #cfg.merge(CaloD3PDCfg(flags, filename=flags.Output.HISTFileName, streamname='CombinedMonitoring'))
233
234 aff_acc = LArRODMonConfig(flags)
235 cfg.merge(aff_acc)
236
237 cfg.printConfig()
238
239 flags.dump()
240 f=open("LArRODMon.pkl","wb")
241 cfg.store(f)
242 f.close()
243
244 #cfg.run(100)
LArRODMonConfig(flags, cellDebug=False, dspDebug=False)
LArRODMonConfigCore(helper, algoinstance, flags, cellDebug=False, dspDebug=False)