ATLAS Offline Software
Loading...
Searching...
No Matches
TrigFwdZDCMonitoring.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentFactory import CompFactory
4from AthenaMonitoring import AthMonitorCfgHelper
5
6def TrigFwdZDCMonitoringAlg(configFlags):
7 """ Configure general ZDC chains monitoring algs """
8 monConfig = AthMonitorCfgHelper(configFlags,'FwdZDCMonitoringAlgs')
9
10 zdcMonAlg = monConfig.addAlgorithm(CompFactory.FwdZDCMonitoringAlg, 'FwdZDCTrigMonitoringAlg')
11
12 zdcMonAlg.triggerList += ['L1_ZDC_A','L1_ZDC_C','L1_ZDC_A_C','L1_ZDC_XOR']
13 # this creates a 'Group' called 'zdcMonitor' which will put its histograms into the subdirectory 'L1/FwdZDC/'
14
15 length = len(zdcMonAlg.triggerList)
16
17 zdcCountsGroup = monConfig.addGroup(zdcMonAlg, 'ZDCall', topPath='L1/FwdZDC/')
18 zdcCountsGroup.defineHistogram('TrigCounts', title='Trigger counts;;Event rate',
19 xbins=length, xmin=0, xmax=length, xlabels=list(zdcMonAlg.triggerList))
20 zdcCountsGroup.defineHistogram('moduleNum,moduleEnergy', type='TH2F', title= ';channel ID;CalibEnergy per channel [GeV]',
21 xbins=8, xmin=-0.5, xmax=7.5,
22 ybins=120, ymin=0, ymax=6e4)
23 zdcCountsGroup.defineHistogram('e_A,e_C', type='TH2F', title= ';Low Gain ADC counts on side A [GeV];Low Gain ADC counts on side C [GeV]',
24 xbins=160, xmin=0.0, xmax=8e4,
25 ybins=160, ymin=0.0, ymax=8e4)
26 zdcCountsGroup.defineHistogram('e_A', title=';CalibEnergy on side A [GeV];counts',
27 xbins=160, xmin=0.0, xmax=8e4)
28 zdcCountsGroup.defineHistogram('e_C', title=';CalibEnergy on side C [GeV];counts',
29 xbins=160, xmin=0.0, xmax=8e4)
30
31
32 for chain in zdcMonAlg.triggerList:
33 zdcExpGroup = monConfig.addGroup(zdcMonAlg, chain+'_expert', topPath='L1/FwdZDC/'+chain+'/' )
34 zdcExpGroup.defineHistogram('moduleNum,moduleEnergy', type='TH2F', title= 'occupancy for {};channel ID;CalibEnergy per channel [GeV]'.format(chain),
35 xbins=8, xmin=-0.5, xmax=7.5,
36 ybins=120, ymin=0, ymax=6e4)
37 zdcExpGroup.defineHistogram('e_A,e_C', type='TH2F', title= 'occupancy for {};CalibEnergy on side A [GeV];CalibEnergy on side C [GeV]'.format(chain),
38 xbins=160, xmin=0.0, xmax=8e4,
39 ybins=160, ymin=0.0, ymax=8e4)
40 zdcExpGroup.defineHistogram('e_A', title='occupancy for {};CalibEnergy on side A [GeV];counts'.format(chain),
41 xbins=160,xmin=0.0,xmax=8e4)
42 zdcExpGroup.defineHistogram('e_C', title='occupancy for {};CalibEnergy on side C [GeV];counts'.format(chain),
43 xbins=160,xmin=0.0,xmax=8e4)
44
45
46 return monConfig.result()
47
48
49if __name__=='__main__':
50 # Setup logs
51 from AthenaCommon.Logging import log
52 from AthenaCommon.Constants import INFO, DEBUG
53 log.setLevel(INFO)
54
55 # Set the Athena configuration flags
56 from AthenaConfiguration.AllConfigFlags import initConfigFlags
57 flags = initConfigFlags()
58 flags.Output.HISTFileName = 'ExampleMonitorOutput.root'
59 flags.fillFromArgs()
60 flags.lock()
61
62 # Initialize configuration object, add accumulator, merge, and run.
63 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
64 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
65 cfg = MainServicesCfg(flags)
66 cfg.merge(PoolReadCfg(flags))
67 cfg.merge(TrigFwdZDCMonitoringAlg(flags))
68
69 # If you want to turn on more detailed messages ...
70 cfg.getEventAlgo('FwdZDCTrigMonitoringAlg').OutputLevel = DEBUG
71 cfg.printConfig(withDetails=False) # set True for exhaustive info
72 with open("cfg.pkl", "wb") as f:
73 cfg.store(f)
74
75 cfg.run() #use cfg.run(20) to only run on first 20 events
76 # to run:
77 # python -m TrigMinBiasMonitoring.TrigFwdZDCMonitoring --filesInput=
TrigFwdZDCMonitoringAlg(configFlags)