ATLAS Offline Software
LArAffectedRegionsAlg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 
6  '''Function to configures some algorithms in the monitoring system.'''
7 
8  from AthenaMonitoring import AthMonitorCfgHelper
9  helper = AthMonitorCfgHelper(flags,'LArAffectedRegionsAlgCfg')
10 
11  from AthenaConfiguration.ComponentFactory import CompFactory
12  LArAffectedRegionsConfigCore(helper, CompFactory.LArAffectedRegionsAlg, flags)
13 
14  return helper.result()
15 
16 
17 def LArAffectedRegionsConfigCore(helper, algoinstance, flags):
18 
19  larAffectedRegAlg = helper.addAlgorithm(algoinstance,'larAffectedRegAlg')
20 
21  #define the group names here, as you'll use them multiple times
22  affectedRegGroupName="LArAffectedRegionsMonGroup"
23 
24 
25  # Edit properties of a algorithm
26  larAffectedRegAlg.AffectedRegionsGroupName=affectedRegGroupName
27  larAffectedRegAlg.IsOnline = flags.DQ.Environment=='online'
28 
29 
30  from LArMonitoring.GlobalVariables import lArDQGlobals #to define the ranges
31  larAffReg_hist_path='AffectedRegions/' #histogram path
32 
33 
34  #EMBPS
35  group_name_ending="EMBPS"
36  larAffectedRegAlg.EMBPSname=group_name_ending
37  affectedRegGroupEMBPS = helper.addGroup(
38  larAffectedRegAlg,
39  affectedRegGroupName+group_name_ending,
40  '/LAr/',
41  'run'
42  )
43 
44 
45  affectedRegGroupEMBPS.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsEMBAPS',
46  title='HV Affected Regions - EMBA - Presampler;#eta;#phi',
47  type='TH2F',
48  path=larAffReg_hist_path,
49  weight='problem',
50  xbins=lArDQGlobals.HVeta_EMB["EMBAPS"][0],xmin=lArDQGlobals.HVeta_EMB["EMBAPS"][1],xmax=lArDQGlobals.HVeta_EMB["EMBAPS"][2],
51  ybins=lArDQGlobals.HVphi_EMB["EMBAPS"][0],ymin=lArDQGlobals.HVphi_EMB["EMBAPS"][1],ymax=lArDQGlobals.HVphi_EMB["EMBAPS"][2],
52  merge='weightedAverage'
53  )
54  affectedRegGroupEMBPS.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsEMBCPS',
55  title='HV Affected Regions - EMBC - Presampler;#eta;#phi',
56  type='TH2F',
57  path=larAffReg_hist_path,
58  weight='problem',
59  xbins=lArDQGlobals.HVeta_EMB["EMBCPS"][0],xmin=lArDQGlobals.HVeta_EMB["EMBCPS"][1],xmax=lArDQGlobals.HVeta_EMB["EMBCPS"][2],
60  ybins=lArDQGlobals.HVphi_EMB["EMBCPS"][0],ymin=lArDQGlobals.HVphi_EMB["EMBCPS"][1],ymax=lArDQGlobals.HVphi_EMB["EMBCPS"][2],
61  merge='weightedAverage'
62  )
63 
64 
65  #EMB
66  group_name_ending="EMB"
67  larAffectedRegAlg.EMBname=group_name_ending
68  affectedRegGroupEMB = helper.addGroup(
69  larAffectedRegAlg,
70  affectedRegGroupName+group_name_ending,
71  '/LAr/',
72  'run'
73  )
74 
75  affectedRegGroupEMB.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsEMBA',
76  title='HV Affected Regions - EMBA - Samplings 1-3;#eta;#phi',
77  type='TH2F',
78  path=larAffReg_hist_path,
79  weight='problem',
80  xbins=lArDQGlobals.HVeta_EMB["EMBA"][0],xmin=lArDQGlobals.HVeta_EMB["EMBA"][1],xmax=lArDQGlobals.HVeta_EMB["EMBA"][2],
81  ybins=lArDQGlobals.HVphi_EMB["EMBA"][0],ymin=lArDQGlobals.HVphi_EMB["EMBA"][1],ymax=lArDQGlobals.HVphi_EMB["EMBA"][2],
82  merge='weightedAverage'
83  )
84  affectedRegGroupEMB.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsEMBC',
85  title='HV Affected Regions - EMBC - Samplings 1-3;#eta;#phi',
86  type='TH2F',
87  path=larAffReg_hist_path,
88  weight='problem',
89  xbins=lArDQGlobals.HVeta_EMB["EMBC"][0],xmin=lArDQGlobals.HVeta_EMB["EMBC"][1],xmax=lArDQGlobals.HVeta_EMB["EMBC"][2],
90  ybins=lArDQGlobals.HVphi_EMB["EMBC"][0],ymin=lArDQGlobals.HVphi_EMB["EMBC"][1],ymax=lArDQGlobals.HVphi_EMB["EMBC"][2],
91  merge='weightedAverage'
92  )
93 
94 
95  #EMECPS
96  group_name_ending="EMECPS"
97  larAffectedRegAlg.EMECPSname=group_name_ending
98  affectedRegGroupEMECPS = helper.addGroup(
99  larAffectedRegAlg,
100  affectedRegGroupName+group_name_ending,
101  '/LAr/',
102  'run'
103  )
104 
105  affectedRegGroupEMECPS.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsEMECAPS',
106  title='HV Affected Regions - EMECA - Presampler;#eta;#phi',
107  type='TH2F',
108  path=larAffReg_hist_path,
109  weight='problem',
110  xbins=lArDQGlobals.HVeta_EMEC["EMECAPS"],
111  ybins=lArDQGlobals.HVphi_EMEC["EMECAPS"],
112  merge='weightedAverage'
113  )
114  affectedRegGroupEMECPS.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsEMECCPS',
115  title='HV Affected Regions - EMECC - Presampler;#eta;#phi',
116  type='TH2F',
117  path=larAffReg_hist_path,
118  weight='problem',
119  xbins=lArDQGlobals.HVeta_EMEC["EMECCPS"],
120  ybins=lArDQGlobals.HVphi_EMEC["EMECCPS"],
121  merge='weightedAverage'
122  )
123 
124 
125  #EMEC
126  group_name_ending="EMEC"
127  larAffectedRegAlg.EMECname=group_name_ending
128  affectedRegGroupEMEC = helper.addGroup(
129  larAffectedRegAlg,
130  affectedRegGroupName+group_name_ending,
131  '/LAr/',
132  'run'
133  )
134 
135  affectedRegGroupEMEC.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsEMECA',
136  title='HV Affected Regions - EMECA - Samplings 1-3;#eta;#phi',
137  type='TH2F',
138  path=larAffReg_hist_path,
139  weight='problem',
140  xbins=lArDQGlobals.HVeta_EMEC["EMECA"],
141  ybins=lArDQGlobals.HVphi_EMEC["EMECA"],
142  merge='weightedAverage'
143  )
144  affectedRegGroupEMEC.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsEMECC',
145  title='HV Affected Regions - EMECC - Samplings 1-3;#eta;#phi',
146  type='TH2F',
147  path=larAffReg_hist_path,
148  weight='problem',
149  xbins=lArDQGlobals.HVeta_EMEC["EMECC"],
150  ybins=lArDQGlobals.HVphi_EMEC["EMECC"],
151  merge='weightedAverage'
152  )
153 
154 
155  #HEC0
156  group_name_ending="HEC0"
157  larAffectedRegAlg.HEC0name=group_name_ending
158  affectedRegGroupHEC0 = helper.addGroup(
159  larAffectedRegAlg,
160  affectedRegGroupName+group_name_ending,
161  '/LAr/',
162  'run'
163  )
164 
165  affectedRegGroupHEC0.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsHECA0',
166  title='HV Affected Regions - HECA - Layer 1;#eta;#phi',
167  type='TH2F',
168  path=larAffReg_hist_path,
169  weight='problem',
170  xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
171  ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
172  merge='weightedAverage'
173  )
174  affectedRegGroupHEC0.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsHECC0',
175  title='HV Affected Regions - HECC - Layer 1;#eta;#phi',
176  type='TH2F',
177  path=larAffReg_hist_path,
178  weight='problem',
179  xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
180  ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
181  merge='weightedAverage'
182  )
183 
184  #HEC1
185  group_name_ending="HEC1"
186  larAffectedRegAlg.HEC1name=group_name_ending
187  affectedRegGroupHEC1 = helper.addGroup(
188  larAffectedRegAlg,
189  affectedRegGroupName+group_name_ending,
190  '/LAr/',
191  'run'
192  )
193 
194  affectedRegGroupHEC1.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsHECA1',
195  title='HV Affected Regions - HECA - Layer 2;#eta;#phi',
196  type='TH2F',
197  path=larAffReg_hist_path,
198  weight='problem',
199  xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
200  ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
201  merge='weightedAverage'
202  )
203  affectedRegGroupHEC1.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsHECC1',
204  title='HV Affected Regions - HECC - Layer 2;#eta;#phi',
205  type='TH2F',
206  path=larAffReg_hist_path,
207  weight='problem',
208  xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
209  ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
210  merge='weightedAverage'
211  )
212 
213  #HEC2
214  group_name_ending="HEC2"
215  larAffectedRegAlg.HEC2name=group_name_ending
216  affectedRegGroupHEC2 = helper.addGroup(
217  larAffectedRegAlg,
218  affectedRegGroupName+group_name_ending,
219  '/LAr/',
220  'run'
221  )
222 
223  affectedRegGroupHEC2.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsHECA2',
224  title='HV Affected Regions - HECA - Layer 3;#eta;#phi',
225  type='TH2F',
226  path=larAffReg_hist_path,
227  weight='problem',
228  xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
229  ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
230  merge='weightedAverage'
231  )
232  affectedRegGroupHEC2.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsHECC2',
233  title='HV Affected Regions - HECC - Layer 3;#eta;#phi',
234  type='TH2F',
235  path=larAffReg_hist_path,
236  weight='problem',
237  xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
238  ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
239  merge='weightedAverage'
240  )
241 
242  #HEC3
243  group_name_ending="HEC3"
244  larAffectedRegAlg.HEC3name=group_name_ending
245  affectedRegGroupHEC3 = helper.addGroup(
246  larAffectedRegAlg,
247  affectedRegGroupName+group_name_ending,
248  '/LAr/',
249  'run'
250  )
251 
252  affectedRegGroupHEC3.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsHECA3',
253  title='HV Affected Regions - HECA - Layer 4;#eta;#phi',
254  type='TH2F',
255  path=larAffReg_hist_path,
256  weight='problem',
257  xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
258  ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
259  merge='weightedAverage'
260  )
261  affectedRegGroupHEC3.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsHECC3',
262  title='HV Affected Regions - HECC - Layer 4;#eta;#phi',
263  type='TH2F',
264  path=larAffReg_hist_path,
265  weight='problem',
266  xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
267  ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
268  merge='weightedAverage'
269  )
270 
271  #FCal0
272  group_name_ending="FCal0"
273  larAffectedRegAlg.FCal0name=group_name_ending
274  affectedRegGroupFCal0 = helper.addGroup(
275  larAffectedRegAlg,
276  affectedRegGroupName+group_name_ending,
277  '/LAr/',
278  'run'
279  )
280 
281  affectedRegGroupFCal0.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsFCalA0',
282  title='HV Affected Regions - FCalA - Layer 1;#eta;#phi',
283  type='TH2F',
284  path=larAffReg_hist_path,
285  weight='problem',
286  xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2],
287  ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2],
288  merge='weightedAverage'
289  )
290  affectedRegGroupFCal0.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsFCalC0',
291  title='HV Affected Regions - FCalC - Layer 1;#eta;#phi',
292  type='TH2F',
293  path=larAffReg_hist_path,
294  weight='problem',
295  xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2],
296  ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2],
297  merge='weightedAverage'
298  )
299 
300  #FCal1
301  group_name_ending="FCal1"
302  larAffectedRegAlg.FCal1name=group_name_ending
303  affectedRegGroupFCal1 = helper.addGroup(
304  larAffectedRegAlg,
305  affectedRegGroupName+group_name_ending,
306  '/LAr/',
307  'run'
308  )
309 
310  affectedRegGroupFCal1.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsFCalA1',
311  title='HV Affected Regions - FCalA - Layer 2;#eta;#phi',
312  type='TH2F',
313  path=larAffReg_hist_path,
314  weight='problem',
315  xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2],
316  ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2],
317  merge='weightedAverage'
318  )
319  affectedRegGroupFCal1.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsFCalC1',
320  title='HV Affected Regions - FCalC - Layer 2;#eta;#phi',
321  type='TH2F',
322  path=larAffReg_hist_path,
323  weight='problem',
324  xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2],
325  ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2],
326  merge='weightedAverage'
327  )
328 
329  #FCal2
330  group_name_ending="FCal2"
331  larAffectedRegAlg.FCal2name=group_name_ending
332  affectedRegGroupFCal2 = helper.addGroup(
333  larAffectedRegAlg,
334  affectedRegGroupName+group_name_ending,
335  '/LAr/',
336  'run'
337  )
338 
339  affectedRegGroupFCal2.defineHistogram('etaPOS,phi;RAW_LArAffectedRegionsFCalA2',
340  title='HV Affected Regions - FCalA - Layer 3;#eta;#phi',
341  type='TH2F',
342  path=larAffReg_hist_path,
343  weight='problem',
344  xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2],
345  ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2],
346  merge='weightedAverage'
347  )
348  affectedRegGroupFCal2.defineHistogram('etaNEG,phi;RAW_LArAffectedRegionsFCalC2',
349  title='HV Affected Regions - FCalC - Layer 3;#eta;#phi',
350  type='TH2F',
351  path=larAffReg_hist_path,
352  weight='problem',
353  xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2],
354  ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2],
355  merge='weightedAverage'
356  )
357 
358 
359 if __name__=='__main__':
360 
361  # Set the Athena configuration flags
362  from AthenaConfiguration.AllConfigFlags import initConfigFlags
363  flags = initConfigFlags()
364 
365  from LArMonitoring.LArMonConfigFlags import addLArMonFlags
366  flags.addFlagsCategory("LArMon", addLArMonFlags)
367 
368  from AthenaConfiguration.TestDefaults import defaultTestFiles
369  flags.Input.Files = defaultTestFiles.RAW_RUN2
370 
371  flags.Output.HISTFileName = 'LArAffectedRegionsOutput.root'
372  flags.DQ.enableLumiAccess = False
373  flags.DQ.useTrigger = False
374  flags.lock()
375 
376 
377  from CaloRec.CaloRecoConfig import CaloRecoCfg
378  cfg=CaloRecoCfg(flags)
379 
380  #add affected regions
381  affregmon = LArAffectedRegionsConfig(flags)
382  cfg.merge(affregmon)
383 
384  flags.dump()
385  f=open("AffectedRegionsMonMaker.pkl","wb")
386  cfg.store(f)
387  f.close()
388 
python.CaloRecoConfig.CaloRecoCfg
def CaloRecoCfg(flags, clustersname=None)
Definition: CaloRecoConfig.py:9
LArAffectedRegionsAlg.LArAffectedRegionsConfigCore
def LArAffectedRegionsConfigCore(helper, algoinstance, flags)
Definition: LArAffectedRegionsAlg.py:17
LArAffectedRegionsAlg.LArAffectedRegionsConfig
def LArAffectedRegionsConfig(flags)
Definition: LArAffectedRegionsAlg.py:5
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19