ATLAS Offline Software
Loading...
Searching...
No Matches
LArCellMonAlg.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4
5def LArCellMonConfig(flags):
6
7 from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper
8 helper = AthMonitorCfgHelper(flags,'LArCellMonAlgCfg')
9
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 cfg=ComponentAccumulator()
12
13
14 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
15 cfg.merge(LArGMCfg(flags))
16 from TileGeoModel.TileGMConfig import TileGMCfg
17 cfg.merge(TileGMCfg(flags))
18
19 from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg
20 cfg.merge(DetDescrCnvSvcCfg(flags))
21
22 from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg
23 cfg.merge(LArCollisionTimeCfg(flags))
24
25 from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
26 cfg.merge(CaloNoiseCondAlgCfg(flags))
27
28
29 from AthenaConfiguration.ComponentFactory import CompFactory
30 lArCellMonAlg=CompFactory.LArCellMonAlg
31
32 algname='LArCellMonAlg'
33 from AthenaConfiguration.Enums import BeamType
34 if flags.Beam.Type is BeamType.Cosmics:
35 algname=algname+'Cosmics'
36
37 algo = LArCellMonConfigCore(helper, lArCellMonAlg, flags,
38 flags.Beam.Type is BeamType.Cosmics,
39 flags.Input.TriggerStream,
40 flags.Input.isMC, flags.Common.isOnline,
41 algname)
42 algo.useTrigger = flags.DQ.useTrigger
43
44 #copied from LArCellMonTool
45 algo.rndmTriggerNames = "L1_RD0, L1_RD0_FILLED, L1_RD0_EMPTY, L1_RD1, L1_RD1_NOISE, L1_RD1_HIST, L1_RD1_BGRP4, L1_RD1_BGRP5"
46 algo.caloTriggerNames = "L1_EM[0-9]+, L1_HA[0-9]+, L1_J[0-9]+.*, L1_JB[0-9]+, L1_JF[0-9]+, L1_TE[0-9]+, L1_JE[0-9]+, L1_XE[0-9]+, L1_2EM[0-9]+, L1_2FJ[0-9]+, L1_2J[0-9]+,L1_3J[0-9]+.*,L1_4J[0-9]+.*,L1_5J[0-9]+,L1_6J[0-9]+,L1_FJ[0-9]+.*"
47 algo.minBiasTriggerNames = "L1_RD0_FILLED, L1_MBTS_1, L1_MBTS_2, L1_MBTS_1_1"
48 algo.metTriggerNames = "EF_xe[0-9]+.*"
49 algo.miscTriggerNames = ""
50
51 from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg
52 algo.ReadyFilterTool = cfg.popToolsAndMerge(AtlasReadyFilterCfg(flags))
53
54 if not flags.Input.isMC:
55 from AthenaMonitoring.BadLBFilterToolConfig import LArBadLBFilterToolCfg
56 algo.BadLBTool=cfg.popToolsAndMerge(LArBadLBFilterToolCfg(flags))
57
58 from LArBadChannelTool.LArBadChannelConfig import LArBadChannelCfg
59 cfg.merge(LArBadChannelCfg(flags))
60
61 cfg.merge(helper.result())
62
63 return cfg
64
65
66def LArCellMonConfigCore(helper, algclass, flags, isCosmics=False, TriggerStream='CosmicCalo', isMC=False, isOnline=False, algname='LArCellMonAlg'):
67
68
69 LArCellMonAlg = helper.addAlgorithm(algclass, algname)
70
71 if isCosmics:
72 badChanMaskProblems=["deadReadout","deadPhys","short","sporadicBurstNoise","highNoiseHG","highNoiseMG","highNoiseLG"]
73 else:
74 badChanMaskProblems=["deadReadout","deadPhys","almostDead","short","sporadicBurstNoise","unstableNoiseLG","unstableNoiseMG","unstableNoiseHG","highNoiseHG","highNoiseMG","highNoiseLG"]
75
76 LArCellMonAlg.ProblemsToMask=badChanMaskProblems
77
78 if not isCosmics and not isMC:
79 LArCellMonAlg.useReadyFilterTool=True
80 else:
81 LArCellMonAlg.useReadyFilterTool=False
82
83 if isMC:
84 LArCellMonAlg.useBadLBTool=False
85 else:
86 LArCellMonAlg.useBadLBTool=True
87
88 if isCosmics or TriggerStream!='physics_CosmicCalo':
89 LArCellMonAlg.useBeamBackgroundRemoval = False
90 LArCellMonAlg.useLArCollisionFilterTool = False
91 else:
92 LArCellMonAlg.useBeamBackgroundRemoval = True
93 LArCellMonAlg.useLArCollisionFilterTool = True
94
95 if isOnline:
96 LArCellMonAlg.useLArNoisyAlg = False
97 else:
98 LArCellMonAlg.useLArNoisyAlg = True
99
100 GroupName="LArCellMon"
101 LArCellMonAlg.MonGroupName = GroupName
102 LArCellMonAlg.MonGroupName_perJob = GroupName+"PerJob"
103 LArCellMonAlg.MonGroupName_OccupancyEtaPhi = GroupName+"_OccupancyEtaPhi"
104 LArCellMonAlg.MonGroupName_PercentageOccupancyEtaPhi = GroupName+"_PercentageOccupancyEtaPhi"
105 LArCellMonAlg.MonGroupName_OccupancyEta = GroupName+"_OccupancyEta"
106 LArCellMonAlg.MonGroupName_OccupancyPhi = GroupName+"_OccupancyPhi"
107 LArCellMonAlg.MonGroupName_TotEnergyEtaPhi = GroupName+"_TotEnergyEtaPhi"
108 LArCellMonAlg.MonGroupName_AvgQualityEtaPhi = GroupName+"_AvgQualityEtaPhi"
109 LArCellMonAlg.MonGroupName_FractionOverQthEtaPhi = GroupName+"_FractionOverQthEtaPhi"
110 LArCellMonAlg.MonGroupName_AvgTimeEtaPhi = GroupName+"_AvgTimeEtaPhi"
111 LArCellMonAlg.MonGroupName_FractionPastTthEtaPhi = GroupName+"_FractionPastTthEtaPhi"
112
113
114 LArCellMonAlg.EnableLumi = True
115
116 LArCellMonAlg.Sporadic_switch = isCosmics
117
118
119 LArCellMonAlg.Threshold_EM_S0S1=5000.
120 LArCellMonAlg.Threshold_HECFCALEMS2S3=15000.
121
122 from CaloMonitoring.LArCellBinning import lArCellBinningScheme
123
124 binlabels=["TotalEvents","ATLAS Ready","with Good LAr LB","with No LAr Collision","with No Beam Background", "with No Trigger Filter","with No LArError"]
125
126 # triggers to use
127 LArCellMonAlg.rndmTriggerNames = "L1_RD0, L1_RD0_FILLED, L1_RD0_EMPTY, L1_RD1, L1_RD1_NOISE, L1_RD1_HIST, L1_RD1_BGRP4, L1_RD1_BGRP5"
128 LArCellMonAlg.caloTriggerNames = "L1_EM[0-9]+, L1_HA[0-9]+, L1_J[0-9]+.*, L1_JB[0-9]+, L1_JF[0-9]+, L1_TE[0-9]+, L1_JE[0-9]+, L1_XE[0-9]+, L1_2EM[0-9]+, L1_2FJ[0-9]+, L1_2J[0-9]+,L1_3J[0-9]+.*,L1_4J[0-9]+.*,L1_5J[0-9]+,L1_6J[0-9]+,L1_FJ[0-9]+.*"
129 LArCellMonAlg.minBiasTriggerNames = "L1_RD0_FILLED, L1_MBTS_1, L1_MBTS_2, L1_MBTS_1_1"
130 LArCellMonAlg.metTriggerNames = "EF_xe[0-9]+.*"
131 LArCellMonAlg.miscTriggerNames = ""
132
133 # Global Settings:
134
135 # All 2D plot occupancy are activated only for some streams
136 if (isCosmics or TriggerStream=='physics_CosmicCalo' or TriggerStream=='express_express' or TriggerStream=='physics_Main' or TriggerStream=='physics_ZeroBias') or isOnline:
137 do2DOcc = True
138 else:
139 do2DOcc = False
140
141 thresholdDict = {}
142 thresholdDict["ThresholdType"] = [ "noEth_CSCveto", "noEth_rndm_CSCveto", "medEth_CSCveto", "5Sigma_CSCveto", "hiEth_CSCveto", "hiEth_noVeto", "met_CSCveto" ]
143 thresholdDict["ThresholdDirection"] = [ "none" , "none" , "both" , "both" , "over" , "over" , "over" ]
144 thresholdDict["TriggersToInclude"] = [ "all" , "all" , "all" , "all" , "all" , "all" , "met" ]
145 thresholdDict["TriggersToExclude"] = [ "none" , "none" , "none" , "none" , "none" , "none" , "none" ]
146
147 thresholdDict["DoPercentageOccupancy"] = [ True , False , True , False , False , False , False ]
148 thresholdDict["DoEtaPhiOccupancy"] = [ True , False , do2DOcc , do2DOcc,do2DOcc, do2DOcc , False ]
149 thresholdDict["DoEtaOccupancy"] = [ False , False , isCosmics , False , False , False , False ]
150 thresholdDict["DoPhiOccupancy"] = [ False , False , True , False , False , False , False ]
151
152 thresholdDict["DoEtaPhiAverageEnergy"] = [ False , do2DOcc , False , do2DOcc , False , False , False ]
153 thresholdDict["DoEtaPhiTotalEnergy"] = [ False , False , False , False , False , False , False ]
154 thresholdDict["DoEtaPhiEnergyRMS"] = [ False , False , False , False , False , False , False ]
155 thresholdDict["DoEtaPhiRMSvsDBnoise"] = [ False , False , False , False , False , False , False ]
156
157 thresholdDict["DoEtaPhiAverageQuality"] = [ False , False , False , False , False , False , False ]
158 thresholdDict["DoEtaPhiFractionOverQth"]= [ False , False , False , do2DOcc , do2DOcc , do2DOcc , False ]
159 thresholdDict["QualityFactorThreshold"] = [ 4000. ]*7
160
161 thresholdDict["DoEtaPhiAverageTime"] = [ False , False , False , (not isCosmics) , False , False , False ]
162 thresholdDict["DoEtaPhiFractionPastTth"]= [ False , False , False , (not isCosmics) , False , False , False ]
163 thresholdDict["TimeThreshold"] = [ 4. ]*7
164 thresholdDict["ThresholdTitleTemplates"]= ["no Threshold",
165 "no Threshold",
166 "|E_{cell}| > %0.f#sigma_{noise}^{database}",
167 "E_{cell} beyond %0.f#sigma_{noise}^{database}",
168 "E_{cell} > %0.f MeV",
169 "E_{cell} > %0.f MeV",
170 "E_{cell} > %0.f MeV, MET trigger"]
171
172 thresholdDict["DefaultThresholds"] = [-4000000.,-4000000. , 3. , 5. , 500. , 500. , 1000. ]
173 thresholdDict["ThresholdinSigNoise"] = [ False , False , True , True , False , False , False ]
174
175
176 #check that thresholds are set properly before passing them to the algorithm
177 nthr = len(thresholdDict["ThresholdType"])
178 if not all(len(thrProp)==nthr for thrProp in thresholdDict.values()):
179 from AthenaCommon.Logging import logging
180 mlog = logging.getLogger( 'LArCellMonLog' )
181 mlog.error("LArCellMonAlg:: CONFIGURATION ERROR, threshold properties have different lenght. Please check CaloMonitoring/python/LArCellMonAlg.py")
182 exit(1)
183 pass
184
185
186 LArCellMonAlg.ThresholdType = thresholdDict["ThresholdType"]
187
188 LArCellMonAlg.ThresholdDirection = thresholdDict["ThresholdDirection"]
189 LArCellMonAlg.TriggersToInclude = thresholdDict["TriggersToInclude"]
190 LArCellMonAlg.TriggersToExclude = thresholdDict["TriggersToExclude"]
191
192 LArCellMonAlg.QualityFactorThreshold = thresholdDict["QualityFactorThreshold"]
193
194 LArCellMonAlg.TimeThreshold = thresholdDict["TimeThreshold"]
195
196 LArCellMonAlg.DoBeamBackgroundRemoval=[( "CSCveto" in thr ) for thr in thresholdDict["ThresholdType"]]
197
198 # Defaults: (Can be over ridden by layer specific values) ; plots will be made for all layers with DefaultThreshold != -9999999
199 LArCellMonAlg.ThresholdTitleTemplates= thresholdDict["ThresholdTitleTemplates"]
200
201 LArCellMonAlg.DefaultThresholds = thresholdDict["DefaultThresholds"]
202 LArCellMonAlg.ThresholdinSigNoise = thresholdDict["ThresholdinSigNoise"]
203
204 LArCellMonAlg.ThresholdColumnType = ["hiEth_CSCveto", "hiEth_noVeto"]
205 # EMB
206 LArCellMonAlg.EMBP_Thresh = [ 800. , 800. ]
207 LArCellMonAlg.EMB1_Thresh = [ 600. , 600. ]
208 LArCellMonAlg.EMB2_Thresh = [ 600. , 600. ]
209 LArCellMonAlg.EMB3_Thresh = [ 600. , 600. ]
210 # EMEC
211 LArCellMonAlg.EMECP_Thresh = [ 1200. , 1200. ]
212 LArCellMonAlg.EMEC1_Thresh = [ 800. , 800. ]
213 LArCellMonAlg.EMEC2_Thresh = [ 800. , 800. ]
214 LArCellMonAlg.EMEC3_Thresh = [ 800. , 800. ]
215 # HEC
216 LArCellMonAlg.HEC0_Thresh = [ 4000. , 4000. ]
217 LArCellMonAlg.HEC1_Thresh = [ 4000. , 4000. ]
218 LArCellMonAlg.HEC2_Thresh = [ 4000. , 4000. ]
219 LArCellMonAlg.HEC3_Thresh = [ 4000. , 4000. ]
220 # FCAL
221 LArCellMonAlg.FCAL1_Thresh = [ 6000. , 6000. ]
222 LArCellMonAlg.FCAL2_Thresh = [ 6000. , 6000. ]
223 LArCellMonAlg.FCAL3_Thresh = [ 6000. , 6000. ]
224
225 #set the string arrays for the groups
226 LArCellMonAlg.DoEtaPhiTotalOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if ( thresholdDict["DoEtaPhiOccupancy"][i_thr] and not thresholdDict["DoPercentageOccupancy"][i_thr] )
227 or thresholdDict["DoEtaPhiAverageEnergy"][i_thr]
228 or thresholdDict["DoEtaPhiAverageQuality"][i_thr]
229 or thresholdDict["DoEtaPhiAverageTime"][i_thr]]
230
231 LArCellMonAlg.DoEtaPhiPercentageOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiOccupancy"][i_thr] and thresholdDict["DoPercentageOccupancy"][i_thr]]
232
233 LArCellMonAlg.DoEtaOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaOccupancy"][i_thr]]
234 LArCellMonAlg.DoPhiOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoPhiOccupancy"][i_thr]]
235 LArCellMonAlg.DoEtaPhiTotEnergyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiTotalEnergy"][i_thr] or thresholdDict["DoEtaPhiAverageEnergy"][i_thr]]
236 LArCellMonAlg.DoEtaPhiAvgQualityNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiAverageQuality"][i_thr]]
237 LArCellMonAlg.DoEtaPhiFractionOverQthNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiFractionOverQth"][i_thr]]
238 LArCellMonAlg.DoEtaPhiAvgTimeNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiAverageTime"][i_thr]]
239 LArCellMonAlg.DoEtaPhiFractionPastTthNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiFractionPastTth"][i_thr]]
240
241 #---Groups and arrays
242
243
244#FIXME: need option to switch between weightedEfficiency and weightedAverage (depends on when the average is computed: if post-processing is done after merging, I don't want 'weightedMerge' options, otherwise I do. Not implemented for now)
245
246 #---single Group for non threshold histograms
247 cellMonGroup = helper.addGroup(
248 LArCellMonAlg,
249 GroupName,
250 '/CaloMonitoring/LArCellMon_NoTrigSel/'
251
252 )
253
254
255 #--define histograms
256 # Summary
257 summ_hist_path='Summary/'
258
259 from CaloMonitoring.CaloMonAlgBase import CaloBaseHistConfig
260 CaloBaseHistConfig(cellMonGroup,summ_hist_path,binlabels)
261
262 cellMonGroup.defineHistogram('trigType;nEvtsByTrigger',
263 title='Total Events: bin 0, RNDM Trigger: 1, Calo Trigger: 2, MinBias Trigger: 3, MET Trigger: 4, Misc Trigger: 5, Events Selected for Noise Plots: 6 ',
264 type='TH1I', path=summ_hist_path,
265 xbins=lArCellBinningScheme.larCellSummary["xbins"][0], xmin=lArCellBinningScheme.larCellSummary["xbins"][1], xmax=lArCellBinningScheme.larCellSummary["xbins"][2],
266 xlabels=lArCellBinningScheme.larCellSummary["xlabels"])
267
268 #total events, saved if percentage occupancy is required
269 cellMonGroup.defineHistogram('eventCounter;nEvtsPerThreshold',
270 title='Events events passed Trigger and Background removal for each threshold (for normalisation)',
271 type='TH1I', path=summ_hist_path,
272 xbins=len(thresholdDict["ThresholdType"]),xmin=-0.5, xmax=(len(thresholdDict["ThresholdType"])-0.5),
273 xlabels=thresholdDict["ThresholdType"])
274
275 # En.
276 LArCellMonAlg.doUnnormalized1DEnergy=True
277 energy_hist_path='Energy/'
278 if not isCosmics:
279 for part in LArCellMonAlg.LayerNames:
280 cellMonGroup.defineHistogram('cellEnergy_nocuts_'+part+';CellEnergy_'+part,
281 title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events',
282 type='TH1F', path=energy_hist_path,
283 xbins=lArCellBinningScheme.logEnergyBins)
284 pass
285 elif isCosmics:
286 for part in LArCellMonAlg.LayerNames:
287 cellMonGroup.defineHistogram('cellEnergy_nocuts_'+part+';CellEnergy_'+part,
288 title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events',
289 type='TH1F', path=energy_hist_path,
290 xbins=lArCellBinningScheme.cosmicEneBinning[part][0], xmin=lArCellBinningScheme.cosmicEneBinning[part][1], xmax=lArCellBinningScheme.cosmicEneBinning[part][2])
291 pass
292 else:
293 for part in LArCellMonAlg.LayerNames:
294 cellMonGroup.defineHistogram('cellEnergy_nocuts_'+part+';CellEnergy_'+part,
295 title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events',
296 type='TH1F', path=energy_hist_path,
297 xbins=lArCellBinningScheme.defaultEnergyBins[0],xmin=lArCellBinningScheme.defaultEnergyBins[1],xmax=lArCellBinningScheme.defaultEnergyBins[2])
298 pass
299
300 #En vs. Time
301 energyvstime_hist_path='EnergyVsTime/'
302
303# eCutForTiming = [1000., 1000., 3000., 1500., 3500., 3500., 3500., 3500., 1500., 3000., 3000., 2000., 10000., 10000., 10000.]
304 eCutForTiming = LArCellMonAlg.EcutForTiming #taken from the values hardcoded in the .h, only way to prevent mixing everything up with the enum in the code
305 idx=0
306 for part in LArCellMonAlg.LayerNames:
307 cellMonGroup.defineHistogram('cellTime_'+part+',cellEnergy_'+part+';CellEnergyVsTime_'+part,
308 title='Cell Energy vs Cell Time in '+part+' with CSC veto;Cell Time [ns];Cell Energy [MeV]',
309 type='TH2F', path=energyvstime_hist_path,
310 xbins=lArCellBinningScheme.timescale, ybins=lArCellBinningScheme.energyscale)
311
312 cellMonGroup.defineHistogram('cellTime_'+part+';CellEnergyVsTime_'+part+'_'+str(int(eCutForTiming[idx//2])),
313 title='Cell Energy vs Cell Time in '+part+' with CSC veto - Cell Time (E>'+str(int(eCutForTiming[idx//2]))+' [MeV]);Cell Time [ns]; NEvents',
314 weight='cellEnergy_'+part,
315 cutmask='enGreaterThanCut_'+part,
316 type='TH1F', path=energyvstime_hist_path,
317 xbins=lArCellBinningScheme.timescale)
318 idx=idx+1
319 pass
320
321
322 cellMonGroupPerJob = helper.addGroup(
323 LArCellMonAlg,
324 LArCellMonAlg.MonGroupName_perJob,
325 '/CaloMonitoring/LArCellMon_NoTrigSel/'
326 )
327
328 LArCellMonAlg.doKnownBadChannelsVsEtaPhi = True
329 LArCellMonAlg.doDatabaseNoiseVsEtaPhi = True
330
331 for part in LArCellMonAlg.LayerNames:
332 cellMonGroupPerJob.defineHistogram('celleta_'+part+',cellphi_'+part+';KnownBadChannelsVsEtaPhi_'+part,
333 title="Map of known bad channels in (#eta,#phi) for "+part+";cell #eta;cell #phi",
334 weight='badCellWord_'+part,
335 cutmask='fillBadChannelPlot',
336 type='TH2F', path="KnownBadChannels/",
337 xbins = lArCellBinningScheme.etaRange[part],
338 ybins = lArCellBinningScheme.phiRange[part],
339 merge='weightedAverage'
340)
341
342 cellMonGroupPerJob.defineHistogram('celleta_'+part+',cellphi_'+part+';DatabaseNoiseVsEtaPhi_'+part,
343 title="Map of Noise Values from the Database vs (#eta,#phi) for "+part+";cell #eta;cell #phi",
344 weight='cellnoisedb_'+part,
345 cutmask='doDatabaseNoisePlot',
346 type='TH2F', path="DatabaseNoise/",
347 xbins = lArCellBinningScheme.etaRange[part],
348 ybins = lArCellBinningScheme.phiRange[part],
349 merge='weightedAverage')
350
351 cellMonGroupPerJob.defineHistogram('celleta_'+part+';NCellsActiveVsEta_'+part,
352 title="No. of Active Cells in #eta for "+part+";cell #eta",
353 cutmask='doCellsActiveEtaPlot',
354 type='TH1F', path="ActiveCells/",
355 xbins = lArCellBinningScheme.etaRange[part],
356 merge='weightedAverage')
357
358 cellMonGroupPerJob.defineHistogram('cellphi_'+part+';NCellsActiveVsPhi_'+part,
359 title="No. of Active Cells in #phi for "+part+";cell #phi",
360 cutmask='doCellsActivePhiPlot',
361 type='TH1F', path="ActiveCells/",
362 xbins = lArCellBinningScheme.phiRange[part],
363 merge='weightedAverage')
364
365
366 pass #part loop
367
368 #--- group array for threshold dependent histograms
369 allMonArray = helper.addArray([LArCellMonAlg.LayerNames, LArCellMonAlg.ThresholdType], LArCellMonAlg, "allMon",
370 "/CaloMonitoring/LArCellMon_NoTrigSel/")
371
372 allMonArray.defineHistogram('dummy', type='TH1F', xbins=1, xmin=0, xmax=1) # dummy to have at least 1 plot defined
373
374 #now histograms
375 for part in LArCellMonAlg.LayerNames:
376
377 allMonArray.defineHistogram('celleta,cellphi;CellOccupancyVsEtaPhi',
378 title='No. of events in (#eta,#phi) for '+part+';cell #eta;cell #phi',
379 type='TH2F', path="2d_Occupancy/",
380 cutmask='passThrCut',
381 xbins = lArCellBinningScheme.etaRange[part],
382 ybins = lArCellBinningScheme.phiRange[part],
383 pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiTotalOccupancyNames])
384
385 allMonArray.defineHistogram('celleta;RAW_CellOccupancyVsEta', #needs weightedAverage/weightedEff
386 title='No. of events in (#eta) for '+part+';cell #eta;',
387 type='TH1F', path="1d_Occupancy/",
388 cutmask='passThrCut',
389 xbins = lArCellBinningScheme.etaRange[part],
390 pattern=[(part, _) for _ in LArCellMonAlg.DoEtaOccupancyNames])
391
392 allMonArray.defineHistogram('cellphi;RAW_CellOccupancyVsPhi',
393 title='No. of events in (#phi) for '+part+';cell #phi;',
394 type='TH1F', path="1d_Occupancy/",
395 cutmask='passThrCut',
396 xbins = lArCellBinningScheme.phiRange[part],
397 pattern=[(part, _) for _ in LArCellMonAlg.DoPhiOccupancyNames])
398
399 allMonArray.defineHistogram('celleta,cellphi;TotalEnergyVsEtaPhi',
400 title="Total Cell Energy vs (#eta,#phi) in "+part+";cell #eta;cell #phi",
401 weight='cellEnergy',
402 type='TH2D', path="2d_TotalEnergy/",
403 cutmask='passThrCut',
404 xbins = lArCellBinningScheme.etaRange[part],
405 ybins = lArCellBinningScheme.phiRange[part],
406 pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiTotEnergyNames])
407
408 allMonArray.defineHistogram('celleta,cellphi;TotalQualityVsEtaPhi',
409 title="Cell Quality vs (#eta,#phi) in "+part+";cell #eta;cell #phi",
410 weight='cellQuality',
411 type='TH2F', path="2d_AvgQuality/", #needs to be divided by '2D_occupancy' at post processing stage
412 cutmask='passThrCut',
413 xbins = lArCellBinningScheme.etaRange[part],
414 ybins = lArCellBinningScheme.phiRange[part],
415 pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiAvgQualityNames])
416
417 allMonArray.defineHistogram('celleta,cellphi;TotalTimeVsEtaPhi',
418 title="Cell Time vs (#eta,#phi) in "+part+";cell #eta;cell #phi",
419 weight='cellTime',
420 type='TH2F', path="2d_AvgTime/", #needs to be divided by '2D_occupancy' at post processing stage
421 cutmask='passThrCut',
422 xbins = lArCellBinningScheme.etaRange[part],
423 ybins = lArCellBinningScheme.phiRange[part],
424 pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiAvgTimeNames])
425
426 allMonArray.defineHistogram('celleta,cellphi;RAW_fractionOverQthVsEtaPhi',
427 title="Fraction of Events in "+part+" for which the Quality Factor exceeds Threshold;cell #eta;cell #phi",
428 weight='isPoorQuality',
429 type='TH2F', path="2d_PoorQualityFraction/", # needs postprocessing
430 cutmask='passThrCut',
431 xbins = lArCellBinningScheme.etaRange[part],
432 ybins = lArCellBinningScheme.phiRange[part],
433 pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiFractionOverQthNames])
434
435 allMonArray.defineHistogram('celleta,cellphi;RAW_fractionPastTthVsEtaPhi',
436 title="Fraction of Events in "+part+" for which the Time is further than Threshold;cell #eta;cell #phi",
437 weight='isLateTime',
438 type='TH2F', path="2d_FractionOutOfTime/", # needs postprocessing
439 cutmask='passThrCut',
440 xbins = lArCellBinningScheme.etaRange[part],
441 ybins = lArCellBinningScheme.phiRange[part],
442 pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiFractionPastTthNames])
443
444 pass #part loop for occupancy
445
446
447
448 #-- TTree for sporadic
449 if LArCellMonAlg.Sporadic_switch:
450 sporadic_hist_path='/Sporadic_'+str(LArCellMonAlg.Threshold_EM_S0S1)+'*1e-3_'+str(LArCellMonAlg.Threshold_HECFCALEMS2S3)+'*1e-3GeV/'
451 cellMonGroup.defineTree('sporadicCellE,sporadicCellTime,sporadicCellQuality,sporadicCellID,lumiBlock,adoptedEThreshold;SporadicNoisyCellsTree', path=sporadic_hist_path,
452 treedef='sporadicCellE/F:sporadicCellTime/F:sporadicCellQuality/s:sporadicCellID/l:lumiBlock/i')
453
454 return LArCellMonAlg
455
456
457if __name__=='__main__':
458
459 # Set the Athena configuration flags
460 from AthenaConfiguration.AllConfigFlags import initConfigFlags
461 flags = initConfigFlags()
462 flags.Input.Files = ['/eos/atlas/atlastier0/rucio//data18_13TeV/physics_Main/00357750/data18_13TeV.00357750.physics_Main.daq.RAW/data18_13TeV.00357750.physics_Main.daq.RAW._lb0123._SFO-3._0004.data']
463 # to test tier0 workflow:
464 #flags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayTests/data15_13TeV.00278748.physics_ZeroBias.merge.RAW._lb0384._SFO-ALL._0001.1']
465 #flags.Calo.Cell.doPileupOffsetBCIDCorr=True
466 flags.Output.HISTFileName = 'LArCellMonOutput.root'
467 flags.DQ.enableLumiAccess = True
468 flags.DQ.useTrigger = True
469 flags.DQ.Environment = 'tier0'
470 flags.lock()
471
472
473 # Initialize configuration object, add accumulator, merge, and run.
474 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
475 cfg = MainServicesCfg(flags)
476
477 # in case of tier0 workflow:
478 from CaloRec.CaloRecoConfig import CaloRecoCfg
479 cfg.merge(CaloRecoCfg(flags))
480
481 #for reading an ESD
482# from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
483# cfg.merge(PoolReadCfg(flags))
484
485 cfg.merge(LArCellMonConfig(flags))
486
487 f=open("LArCellMon.pkl","wb")
488 cfg.store(f)
489 f.close()
490
491# cfg.run(10) #use cfg.run() to run on all events
LArCellMonConfigCore(helper, algclass, flags, isCosmics=False, TriggerStream='CosmicCalo', isMC=False, isOnline=False, algname='LArCellMonAlg')
LArCellMonConfig(flags)