6 from AthenaCommon.Logging
import logging
7 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
8 from AthenaConfiguration.ComponentFactory
import CompFactory
9 mlog = logging.getLogger(
'LArSuperCellMonConfig' )
12 from AthenaMonitoring.AthMonitorCfgHelper
import AthMonitorCfgHelper
13 helper = AthMonitorCfgHelper(flags,
'LArSuperCellMonAlgCfg')
15 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
18 if not flags.DQ.enableLumiAccess
and not flags.DQ.Environment ==
'online':
19 mlog.warning(
'This algo needs Lumi access, returning empty config')
22 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
24 from TileGeoModel.TileGMConfig
import TileGMCfg
27 from DetDescrCnvSvc.DetDescrCnvSvcConfig
import DetDescrCnvSvcCfg
30 if flags.Common.isOnline:
31 cfg.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg(
'CaloSuperCellAlignCondAlg'))
33 from LumiBlockComps.BunchCrossingCondAlgConfig
import BunchCrossingCondAlgCfg
36 from CaloTools.CaloNoiseCondAlgConfig
import CaloNoiseCondAlgCfg
41 from LArByteStream.LArRawSCDataReadingConfig
import LArRawSCDataReadingCfg
44 from TrigT1CaloFexPerf.EmulationConfig
import emulateSC_Cfg
47 from LArCellRec.LArRAWtoSuperCellConfig
import LArRAWtoSuperCellCfg
53 from LArCabling.LArCablingConfig
import LArOnOffIdMappingSCCfg
57 from LArConfiguration.LArElecCalibDBConfig
import LArElecCalibDBSCCfg
59 larLATOMEBuilderAlg=CompFactory.LArLATOMEBuilderAlg(
"LArLATOMEBuilderAlg")
62 runinfo=
getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring=
"COOLONL_LAR/CONDBR2")
63 streamTypes=runinfo.streamTypes()
64 except Exception
as e:
65 mlog.warning(
"Could not get DT run info, using defaults !")
67 streamTypes=[
"RawADC"]
69 for i
in range(0,len(streamTypes)):
70 mlog.info(
"runinfo.streamTypes()[i]: "+
str(streamTypes[i]))
71 if streamTypes[i] ==
"RawADC":
72 larLATOMEBuilderAlg.LArDigitKey =
"SC"
73 larLATOMEBuilderAlg.isADCBas =
False
74 if streamTypes[i] ==
"ADC":
75 larLATOMEBuilderAlg.isADCBas =
True
76 larLATOMEBuilderAlg.LArDigitKey =
"SC_ADC_BAS"
78 cfg.addEventAlgo(larLATOMEBuilderAlg)
79 cfg.merge(
LArRAWtoSuperCellCfg(flags,name=
"LArRAWRecotoSuperCell",mask=mask,doReco=
True,SCIn=
"SC_ET_RECO",SCellContainerOut=
"SCell_ET_RECO") )
82 cfg.merge(
LArElecCalibDBSCCfg(flags, condObjs=[
"Ramp",
"DAC2uA",
"Pedestal",
"uA2MeV",
"MphysOverMcal",
"OFC",
"Shape",
"HVScaleCorr"]))
86 algname=
'LArSuperCellMonAlg'
87 lArCellMonAlg=CompFactory.LArSuperCellMonAlg(algname,CaloCellContainerReco=
"SCell_ET_RECO",CaloCellContainerRef=flags.Trigger.L1.L1CaloSuperCellContainerName,doSCReco=
True,CaloCellContainer=
'EmulatedSuperCells')
89 if flags.Input.isMC
is False and not flags.Common.isOnline:
90 from LumiBlockComps.LuminosityCondAlgConfig
import LuminosityCondAlgCfg
92 from LumiBlockComps.LBDurationCondAlgConfig
import LBDurationCondAlgCfg
96 from AthenaConfiguration.Enums
import BeamType
97 if flags.Beam.Type
is BeamType.Cosmics:
98 algname=algname+
'Cosmics'
101 flags.Beam.Type
is BeamType.Cosmics,
102 flags.Input.isMC, algname, RemoveMasked=mask)
104 cfg.merge(helper.result())
113 LArSuperCellMonAlg = helper.addAlgorithm(algclass, algname)
116 GroupName=
"LArSuperCellMon"
117 LArSuperCellMonAlg.MonGroupName = GroupName
119 LArSuperCellMonAlg.EnableLumi =
False
120 LArSuperCellMonAlg.CaloCellContainer =
'EmulatedSuperCells'
121 LArSuperCellMonAlg.CaloCellContainerRef = flags.Trigger.L1.L1CaloSuperCellContainerName
122 LArSuperCellMonAlg.RemoveMasked = RemoveMasked
123 LArSuperCellMonAlg.doDatabaseNoiseVsEtaPhi=
True
132 cellMonGroup = helper.addGroup(
135 '/LAr/LArSuperCellMon_NoTrigSel/'
138 cellMonGroup=
defineHistograms(cellMonGroup,LArSuperCellMonAlg.LayerNames,isHLT=
False)
139 return LArSuperCellMonAlg
143 from AthenaConfiguration.ComponentFactory
import CompFactory
144 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
145 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringTool
147 if flags.Common.isOnline:
148 cfg.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg(
'CaloSuperCellAlignCondAlg'))
151 from CaloTools.CaloNoiseCondAlgConfig
import CaloNoiseCondAlgCfg
155 from TrigT1CaloFexPerf.EmulationConfig
import emulateSC_Cfg
158 from LArCellRec.LArRAWtoSuperCellConfig
import LArRAWtoSuperCellCfg
162 from LArCabling.LArCablingConfig
import LArOnOffIdMappingSCCfg
165 SCellsToCheck=
"SCellFromBS"
166 if flags.Common.isOnline:
168 cfg.merge(
LArRAWtoSuperCellCfg(flags,name=
"LArRAWtoSuperCellFromBS",SCellContainerOut=SCellsToCheck,mask=mask) )
170 SCellsToCheck=
"SCell"
172 algname=
'LArSuperCellMonAlg'
173 lArCellMonAlg=CompFactory.LArSuperCellMonAlg(algname,CaloCellContainerReco=
"",CaloCellContainerRef=
"EmulatedSCells",doSCReco=
False,CaloCellContainer=SCellsToCheck,TrigDecisionTool=
"",EnableLumi =
False, RemoveMasked = RemoveMasked)
175 if flags.Input.isMC
is False and not flags.Common.isOnline:
176 from LumiBlockComps.LuminosityCondAlgConfig
import LuminosityCondAlgCfg
178 from LumiBlockComps.LBDurationCondAlgConfig
import LBDurationCondAlgCfg
183 lArCellMonAlg.GMTools = [monTool]
184 lArCellMonAlg.MonGroupName=
'LArSuperCellMonTool'
185 lArCellMonAlg.BunchCrossingCondDataKey=
""
187 lArCellMonAlg.doDatabaseNoiseVsEtaPhi =
True
189 cfg.addEventAlgo(lArCellMonAlg)
195 from LArMonitoring.GlobalVariables
import lArDQGlobals
198 if isHLT: sc_hist_path=
'EXPERT'
201 cellMonGroup.defineHistogram(
'superCellEt;h_SuperCellEt',
202 title=
'Super Cell E_T [MeV]; MeV; # entries',
203 type=
'TH1F', path=sc_hist_path,
204 xbins = 100,xmin=0,xmax=50000)
205 cellMonGroup.defineHistogram(
'superCellEta;h_SuperCellEta',
206 title=
'Super Cell eta; #eta; # entries',
207 type=
'TH1F', path=sc_hist_path,
208 xbins = 100,xmin=-5,xmax=5)
209 cellMonGroup.defineHistogram(
'superCelltime;h_SuperCelltime',
210 title=
'Super Cell time [ns]; ns; # entries',
211 type=
'TH1F', path=sc_hist_path,
212 xbins = 100, xmin=-400,xmax=400)
213 cellMonGroup.defineHistogram(
'superCelltimeReco;h_SuperCelltimeReco',
214 title=
'Reco Super Cell time [ns]; ns; # entries',
215 type=
'TH1F', path=sc_hist_path,
216 xbins = 100, xmin=-400,xmax=400)
217 cellMonGroup.defineHistogram(
'superCellprovenance;h_SuperCellprovenance',
218 title=
'Super Cell provenance; bitmask ; # entries',
219 type=
'TH1F', path=sc_hist_path,
220 xbins = 700, xmin=0,xmax=700)
221 cellMonGroup.defineHistogram(
'BCID,superCellEt;h_SuperCellEt_vs_BCID',
222 title=
'Super Cell ET [MeV] vs BCID ; BCID from train front; %',
223 type=
'TH2F', path=sc_hist_path,
224 xbins = 50, xmin=0,xmax=50,
225 ybins = 80, ymin=-1000,ymax=1000)
226 cellMonGroup.defineHistogram(
'BCID,superCellEtRef;h_SuperCellEtRef_vs_BCID',
227 title=
'Super Cell ET [MeV] vs BCID ; BCID from train front; %',
228 type=
'TH2F', path=sc_hist_path,
229 xbins = 50, xmin=0,xmax=50,
230 ybins = 80, ymin=-1000,ymax=1000)
232 cellMonGroup.defineHistogram(
'resolution;h_SuperCellResolution',
233 title=
'Super Cell reconstruction resolution ; %; # entries',
234 type=
'TH1F', path=sc_hist_path,
235 xbins = 70, xmin=-20,xmax=120)
236 cellMonGroup.defineHistogram(
'resolutionPass;h_SuperCellResolutionPass',
237 title=
'Super Cell reconstruction resolution for BCIDed ; %; # entries',
238 type=
'TH1F', path=sc_hist_path,
239 xbins = 70, xmin=-20,xmax=120)
240 cellMonGroup.defineHistogram(
'superCellEt,resolution;h_SuperCellResolution_vs_ET',
241 title=
'Super Cell reconstruction resolution vs ET ; [MeV]; %',
242 type=
'TH2F', path=sc_hist_path,
243 xbins = 100, xmin=0,xmax=50000,
244 ybins = 70, ymin=-20,ymax=120)
245 cellMonGroup.defineHistogram(
'superCellEta,resolutionHET;h_SuperCellResolution_vs_eta',
246 title=
'Super Cell reconstruction resolution vs #eta ; #eta; %',
247 type=
'TH2F', path=sc_hist_path,
248 xbins = 100, xmin=-5,xmax=5,
249 ybins = 40, ymin=-20,ymax=20)
250 cellMonGroup.defineHistogram(
'BCID,resolution;h_SuperCellResolution_vs_BCID',
251 title=
'Super Cell reconstruction resolution vs BCID ; BCID from train front; %',
252 type=
'TH2F', path=sc_hist_path,
253 xbins = 50, xmin=0,xmax=50,
254 ybins = 80, ymin=-120,ymax=120)
256 cellMonGroup.defineHistogram(
'superCellEtRef,superCellEt;h_SuperCellEtLin',
257 title=
'Super Cell E_T Linearity; Ref SC E_T [MeV]; SC E_T [MeV]',
258 type=
'TH2F', path=sc_hist_path,
259 xbins = 100,xmin=0,xmax=50000,
260 ybins = 100,ymin=0,ymax=50000)
261 cellMonGroup.defineHistogram(
'superCelltimeRef,superCelltimeReco;h_SuperCelltimeLin',
262 title=
'Super Cell time Linearity; Ref SC time [ns]; Reco SC time [ns]',
263 type=
'TH2F', path=sc_hist_path,
264 xbins = 100, xmin=-200,xmax=200,
265 ybins = 100, ymin=-200,ymax=200)
266 cellMonGroup.defineHistogram(
'superCellprovenanceRef,superCellprovenance;h_SuperCellprovenanceLin',
267 title=
'Super Cell provenance Linearity; Ref SC bitmask ; SC bitmask',
268 type=
'TH2F', path=sc_hist_path,
269 xbins = 17, xmin=0,xmax=680,
270 ybins = 17, ymin=0,ymax=680)
271 cellMonGroup.defineHistogram(
'BCID;h_BCID',
272 title=
'BCID from the front of the train; BCID ; # entries',
273 type=
'TH1F', path=sc_hist_path,
274 xbins = 120, xmin=0,xmax=120)
277 partxbins=lArDQGlobals.SuperCell_Variables[
"etaRange"][
"All"][
"All"]
278 partybins=lArDQGlobals.SuperCell_Variables[
"phiRange"][
"All"][
"All"]
279 cellMonGroup.defineHistogram(
'superCellEta,superCellPhi,superCellEtDiff;h_SuperCellCoverage_EtDiff',
280 title=
'ET Diff: #phi vs #eta;#eta;#phi',
281 type=
'TProfile2D', path=sc_hist_path,
282 xbins = partxbins, ybins = partybins)
285 sc_hist_path=
'SC_Layer/'
286 if isHLT: sc_hist_path=
'EXPERT'
287 for part
in LayerNames:
297 partxbins=lArDQGlobals.SuperCell_Variables[
"etaRange"][Part][Side][Sampling]
298 partybins=lArDQGlobals.SuperCell_Variables[
"phiRange"][Part][Side][Sampling]
299 cellMonGroup.defineHistogram(
'superCellEta_'+part+
',superCellPhi_'+part+
',superCellEtDiff_'+part+
';h_SuperCellCoverage_EtDiff_'+part,
300 title=
'ET Diff '+part+
': #phi vs #eta;#eta;#phi',
301 type=
'TProfile2D', path=sc_hist_path,
302 xbins = partxbins, ybins = partybins)
305 cellMonGroup.defineHistogram(
'superCellEt_'+part+
';h_SuperCellEt'+part,
306 title=
'Super Cell E_T [MeV] '+partp+
'; MeV; # entries',
307 type=
'TH1F', path=sc_hist_path,
308 xbins = 100,xmin=0,xmax=50000)
309 cellMonGroup.defineHistogram(
'superCellEta_'+part+
';h_SuperCellEta'+part,
310 title=
'Super Cell eta '+partp+
'; #eta; # entries',
311 type=
'TH1F', path=sc_hist_path,
312 xbins = 100,xmin=-5,xmax=5)
313 cellMonGroup.defineHistogram(
'superCelltime_'+part+
';h_SuperCelltime'+part,
314 title=
'Super Cell time [ns] '+partp+
'; ns; # entries',
315 type=
'TH1F', path=sc_hist_path,
316 xbins = 100, xmin=-400,xmax=400)
317 cellMonGroup.defineHistogram(
'superCelltimeReco_'+part+
';h_SuperCelltimeReco'+part,
318 title=
'Reco Super Cell time [ns] '+partp+
'; ns; # entries',
319 type=
'TH1F', path=sc_hist_path,
320 xbins = 100, xmin=-400,xmax=400)
321 cellMonGroup.defineHistogram(
'superCellprovenance_'+part+
';h_SuperCellprovenance'+part,
322 title=
'Super Cell provenance '+partp+
'; bitmask ; # entries',
323 type=
'TH1F', path=sc_hist_path,
324 xbins = 700, xmin=0,xmax=700)
325 cellMonGroup.defineHistogram(
'BCID,superCellEt_'+part+
';h_SuperCellET_vs_BCID'+part,
326 title=
'Super Cell ET [MeV] vs BCID '+partp+
'; BCID from train front; %',
327 type=
'TH2F', path=sc_hist_path,
328 xbins = 50, xmin=0,xmax=50,
329 ybins = 100, ymin=-1000,ymax=1000)
330 cellMonGroup.defineHistogram(
'BCID,superCellEtRef_'+part+
';h_SuperCellRefET_vs_BCID'+part,
331 title=
'Super Cell ET [MeV] vs BCID '+partp+
'; BCID from train front; %',
332 type=
'TH2F', path=sc_hist_path,
333 xbins = 50, xmin=0,xmax=50,
334 ybins = 100, ymin=-1000,ymax=1000)
336 cellMonGroup.defineHistogram(
'resolution_'+part+
';h_SuperCellResolution'+part,
337 title=
'Super Cell reconstruction resolution '+partp+
'; %; # entries',
338 type=
'TH1F', path=sc_hist_path,
339 xbins = 70, xmin=-20,xmax=120)
340 cellMonGroup.defineHistogram(
'resolutionPass_'+part+
';h_SuperCellResolutionPass'+part,
341 title=
'Super Cell reconstruction resolution for BCIDed '+partp+
'; %; # entries',
342 type=
'TH1F', path=sc_hist_path,
343 xbins = 70, xmin=-20,xmax=120)
344 cellMonGroup.defineHistogram(
'superCellEt_'+part+
',resolution_'+part+
';h_SuperCellResolution_vs_ET'+part,
345 title=
'Super Cell reconstruction resolution vs ET '+partp+
'; [MeV]; %',
346 type=
'TH2F', path=sc_hist_path,
347 xbins = 100, xmin=0,xmax=50000,
348 ybins = 70, ymin=-20,ymax=120)
349 cellMonGroup.defineHistogram(
'superCellEta_'+part+
',resolutionHET_'+part+
';h_SuperCellResolution_vs_eta'+part,
350 title=
'Super Cell reconstruction resolution vs #eta '+partp+
'; #eta; %',
351 type=
'TH2F', path=sc_hist_path,
352 xbins = 100, xmin=-5,xmax=5,
353 ybins = 40, ymin=-20,ymax=20)
354 cellMonGroup.defineHistogram(
'BCID,resolution_'+part+
';h_SuperCellResolution_vs_BCID'+part,
355 title=
'Super Cell reconstruction resolution vs BCID '+partp+
'; BCID from train front; %',
356 type=
'TH2F', path=sc_hist_path,
357 xbins = 50, xmin=0,xmax=50,
358 ybins = 80, ymin=-120,ymax=120)
360 cellMonGroup.defineHistogram(
'superCellEtRef_'+part+
',superCellEt_'+part+
';h_SuperCellEtLin'+part,
361 title=
'Super Cell E_T Linearity '+partp+
'; Ref SC E_T [MeV]; SC E_T [MeV]',
362 type=
'TH2F', path=sc_hist_path,
363 xbins = 100,xmin=0,xmax=50000,
364 ybins = 100,ymin=0,ymax=50000)
365 cellMonGroup.defineHistogram(
'superCelltimeRef_'+part+
',superCelltimeReco_'+part+
';h_SuperCelltimeLin'+part,
366 title=
'Super Cell time Linearity '+partp+
'; Ref SC time [ns]; Reco SC time [ns]',
367 type=
'TH2F', path=sc_hist_path,
368 xbins = 100, xmin=-200,xmax=200,
369 ybins = 100, ymin=-200,ymax=200)
370 cellMonGroup.defineHistogram(
'superCellprovenanceRef_'+part+
',superCellprovenance_'+part+
';h_SuperCellprovenanceLin'+part,
371 title=
'Super Cell provenance Linearity '+partp+
'; Ref SC bitmask ; SC bitmask',
372 type=
'TH2F', path=sc_hist_path,
373 xbins = 17, xmin=0,xmax=680,
374 ybins = 17, ymin=0,ymax=680)
377 cellMonGroup.defineHistogram(
'cellEnergy_'+part+
';CellEnergy_'+part,
378 title=
'Cell Energy in ' +part+
';Cell Energy [MeV];Cell Events',
379 type=
'TH1F', path=sc_hist_path,
380 xbins = 100,xmin=0,xmax=50000
383 for part
in LayerNames:
385 cellMonGroup.defineHistogram(
'celleta_'+part+
';NCellsActiveVsEta_'+part,
386 title=
"No. of Active Cells in #eta for "+part+
";cell #eta",
387 type=
'TH1F', path=sc_hist_path,
388 xbins = 100,xmin=-5,xmax=5
391 cellMonGroup.defineHistogram(
'cellphi_'+part+
';NCellsActiveVsPhi_'+part,
392 title=
"No. of Active Cells in #phi for "+part+
";cell #phi",
393 type=
'TH1F', path=sc_hist_path,
394 xbins = 100,xmin=-5,xmax=5
397 cellMonGroup.defineHistogram(
'celleta_'+part+
',cellphi_'+part+
';DatabaseNoiseVsEtaPhi_'+part,
398 title=
"Map of Noise Values from the Database vs (#eta,#phi) for "+part+
";cell #eta;cell #phi",
399 weight=
'cellnoisedb_'+part,
400 cutmask=
'doDatabaseNoisePlot',
401 type=
'TH2F', path=
"DatabaseNoise/",
402 xbins = 100,xmin=-5,xmax=5,
403 ybins = 100,ymin=-5,ymax=5,
404 merge=
'weightedAverage')
411 if __name__==
'__main__':
416 from AthenaConfiguration.Enums
import LHCPeriod, BunchStructureSource
417 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
418 from AthenaCommon.Logging
import log
422 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
428 flags.Input.Files = [
'/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data24_13p6TeV.00475321.physics_EnhancedBias.merge.RAW._lb0231._SFO-11._0001.1']
430 flags.Output.HISTFileName =
'LArSuperCellMonOutput.root'
431 flags.DQ.enableLumiAccess =
True
432 flags.DQ.useTrigger =
False
433 flags.DQ.Environment =
'tier0'
435 flags.IOVDb.GlobalTag =
"CONDBR2-ES1PA-2022-07"
436 flags.Common.isOnline =
True
437 flags.GeoModel.Run=LHCPeriod.Run3
438 flags.Exec.OutputLevel=WARNING
439 flags.Beam.BunchStructureSource=BunchStructureSource.FILLPARAMS
441 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
443 flags.fillFromArgs(sys.argv[1:])
447 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
459 if not flags.DQ.Environment ==
'online':
460 from LumiBlockComps.BunchCrossingCondAlgConfig
import BunchCrossingCondAlgCfg
466 f=
open(
"LArSuperCellMon.pkl",
"wb")