6 '''@file ZdcLEDMonitorAlgorithm.py
10 @brief python configuration for ZDC LED monitoring under the Run III DQ framework
11 will be run in the ZDC LED calibration stream
12 see ExampleMonitorAlgorithm.py in AthenaMonitoring package for detailed step explanations
17 from AthenaMonitoring
import AthMonitorCfgHelper
18 helper = AthMonitorCfgHelper(inputFlags,
'ZdcAthMonitorCfg')
20 from AthenaConfiguration.ComponentFactory
import CompFactory
21 zdcLEDMonAlg = helper.addAlgorithm(CompFactory.ZdcLEDMonitorAlgorithm,
'ZdcLEDMonAlg')
30 n_energy_bins_default = 200
31 n_time_bins_default = 150
32 n_sample_bins_default = 25
35 l1TriggerType_max = 256
42 zdcLEDAllEventsDiagMonTool = helper.addGroup(zdcLEDMonAlg,
'ZdcLEDAllEventsDiagnosis',
'ZDC/AllLEDEventsDiagnosis/')
44 zdcModLEDMonToolArr = helper.addArray([nLEDs,nSides,nModules],zdcLEDMonAlg,
'ZdcModLEDMonitor', topPath=
'ZDC/ZDCLED/')
45 rpdChanLEDMonToolArr = helper.addArray([nLEDs,nSides,nChannels],zdcLEDMonAlg,
'RPDChanLEDMonitor', topPath=
'ZDC/RPDLED/')
50 zdcLEDAllEventsDiagMonTool.defineHistogram(
'bcid', title=
';BCID;Events',
52 xbins=bcid_max,xmin=0.0,xmax=bcid_max)
54 zdcLEDAllEventsDiagMonTool.defineHistogram(
'l1TriggerType', title=
';L1TriggerType;Events',
56 xbins=l1TriggerType_max,xmin=0.0,xmax=l1TriggerType_max)
58 zdcLEDAllEventsDiagMonTool.defineHistogram(
'lumiBlock, bcid', type=
'TH2F', title=
';lumi block;BCID',
60 xbins=
int(lumi_block_max/10),xmin=0.0,xmax=lumi_block_max,
61 ybins=bcid_max,ymin=0.0,ymax=bcid_max)
63 zdcLEDAllEventsDiagMonTool.defineHistogram(
'lumiBlock, l1TriggerType', type=
'TH2F', title=
';lumi block;L1TriggerType',
65 xbins=
int(lumi_block_max/10),xmin=0.0,xmax=lumi_block_max,
66 ybins=l1TriggerType_max,ymin=0.0,ymax=l1TriggerType_max)
71 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDADCSum', title=
'LED ADC Sum [ADC Counts];Events',
73 xbins=n_energy_bins_default,xmin=0.0,xmax=adc_sum_max)
74 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDMaxADC', title=
'LED Max ADC [ADC Counts];Events',
76 xbins=n_energy_bins_default,xmin=0.0,xmax=max_adc_max)
77 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDMaxSample', title=
'LED Max Sample [ADC Counts];Events',
78 path=
'zdcLEDMaxSample',
79 xbins=n_sample_bins_default,xmin=0.0,xmax=nsamples_max)
80 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDAvgTime', title=
'LED Average Time [ns];Events',
82 xbins=n_time_bins_default,xmin=0.0,xmax=time_max)
83 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDADCSum', title=
'LED ADC Sum [ADC Counts];Events',
85 xbins=n_energy_bins_default,xmin=0.0,xmax=adc_sum_max)
86 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDMaxADC', title=
'LED Max ADC [ADC Counts];Events',
88 xbins=n_energy_bins_default,xmin=0.0,xmax=max_adc_max)
89 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDMaxSample', title=
'LED Max Sample [ADC Counts];Events',
90 path=
'rpdLEDMaxSample',
91 xbins=n_sample_bins_default,xmin=0.0,xmax=nsamples_max)
92 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDAvgTime', title=
'LED Average Time [ns];Events',
94 xbins=n_time_bins_default,xmin=0.0,xmax=time_max)
98 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDADCSum;zdcLEDADCSum_vs_lb', type=
'TH2F', title=
';lumi block;LED ADC Sum [ADC Counts]',
99 path=
'zdcLEDADCSumLBdep',
100 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
101 ybins=n_energy_bins_default,ymin=0.0,ymax=adc_sum_max)
102 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDMaxADC;zdcLEDMaxADC_vs_lb', type=
'TH2F', title=
';lumi block;LED Max ADC [ADC Counts]',
103 path=
'zdcLEDMaxADCLBdep',
104 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
105 ybins=n_energy_bins_default,ymin=0.0,ymax=max_adc_max)
106 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDMaxSample;zdcLEDMaxSample_vs_lb', type=
'TH2F', title=
';lumi block;LED Max Sample [ADC Counts]',
107 path=
'zdcLEDMaxSampleLBdep',
108 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
109 ybins=n_sample_bins_default,ymin=0.0,ymax=nsamples_max)
110 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDAvgTime;zdcLEDAvgTime_vs_lb', type=
'TH2F', title=
';lumi block;LED Average Time [ns]',
111 path=
'zdcLEDAvgTimeLBdep',
112 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
113 ybins=n_time_bins_default,ymin=0.0,ymax=time_max)
114 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDADCSum;rpdLEDADCSum_vs_lb', type=
'TH2F', title=
';lumi block;LED ADC Sum [ADC Counts]',
115 path=
'rpdLEDADCSumLBdep',
116 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
117 ybins=n_energy_bins_default,ymin=0.0,ymax=adc_sum_max)
118 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDMaxADC;rpdLEDMaxADC_vs_lb', type=
'TH2F', title=
';lumi block;LED Max ADC [ADC Counts]',
119 path=
'rpdLEDMaxADCLBdep',
120 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
121 ybins=n_energy_bins_default,ymin=0.0,ymax=max_adc_max)
122 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDMaxSample;rpdLEDMaxSample_vs_lb', type=
'TH2F', title=
';lumi block;LED Max Sample [ADC Counts]',
123 path=
'rpdLEDMaxSampleLBdep',
124 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
125 ybins=n_sample_bins_default,ymin=0.0,ymax=nsamples_max)
126 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDAvgTime;rpdLEDAvgTime_vs_lb', type=
'TH2F', title=
';lumi block;LED Average Time [ns]',
127 path=
'rpdLEDAvgTimeLBdep',
128 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
129 ybins=n_time_bins_default,ymin=0.0,ymax=time_max)
134 zdcModLEDMonToolArr.defineHistogram(
'bcid, zdcLEDADCSum', type=
'TH2F', title=
';BCID;LED ADC Sum [ADC Counts]',
135 path=
'zdcLEDADCSumBCIDdep',
136 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
137 ybins=n_energy_bins_default,ymin=0.0,ymax=adc_sum_max)
138 zdcModLEDMonToolArr.defineHistogram(
'bcid, zdcLEDMaxADC', type=
'TH2F', title=
';BCID;LED Max ADC [ADC Counts]',
139 path=
'zdcLEDMaxADCBCIDdep',
140 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
141 ybins=n_energy_bins_default,ymin=0.0,ymax=max_adc_max)
142 zdcModLEDMonToolArr.defineHistogram(
'bcid, zdcLEDMaxSample', type=
'TH2F', title=
';BCID;LED Max Sample [ADC Counts]',
143 path=
'zdcLEDMaxSampleBCIDdep',
144 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
145 ybins=n_sample_bins_default,ymin=0.0,ymax=nsamples_max)
146 zdcModLEDMonToolArr.defineHistogram(
'bcid, zdcLEDAvgTime', type=
'TH2F', title=
';BCID;LED Average Time [ns]',
147 path=
'zdcLEDAvgTimeBCIDdep',
148 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
149 ybins=n_time_bins_default,ymin=0.0,ymax=time_max)
150 rpdChanLEDMonToolArr.defineHistogram(
'bcid, rpdLEDADCSum', type=
'TH2F', title=
';BCID;LED ADC Sum [ADC Counts]',
151 path=
'rpdLEDADCSumBCIDdep',
152 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
153 ybins=n_energy_bins_default,ymin=0.0,ymax=adc_sum_max)
154 rpdChanLEDMonToolArr.defineHistogram(
'bcid, rpdLEDMaxADC', type=
'TH2F', title=
';BCID;LED Max ADC [ADC Counts]',
155 path=
'rpdLEDMaxADCBCIDdep',
156 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
157 ybins=n_energy_bins_default,ymin=0.0,ymax=max_adc_max)
158 rpdChanLEDMonToolArr.defineHistogram(
'bcid, rpdLEDMaxSample', type=
'TH2F', title=
';BCID;LED Max Sample [ADC Counts]',
159 path=
'rpdLEDMaxSampleBCIDdep',
160 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
161 ybins=n_sample_bins_default,ymin=0.0,ymax=nsamples_max)
162 rpdChanLEDMonToolArr.defineHistogram(
'bcid, rpdLEDAvgTime', type=
'TH2F', title=
';BCID;LED Average Time [ns]',
163 path=
'rpdLEDAvgTimeBCIDdep',
164 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
165 ybins=n_time_bins_default,ymin=0.0,ymax=time_max)
168 return helper.result()
171 if __name__==
'__main__':
173 from AthenaCommon.Logging
import log
175 log.setLevel(WARNING)
178 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
181 inputfile =
'myLEDAOD.pool.root'
182 flags.Input.Files = [directory+inputfile]
183 flags.Input.isMC =
False
184 flags.Output.HISTFileName =
'ZdcLEDMonitorOutput_2018PbPb.root'
185 parser = flags.getArgumentParser()
186 parser.add_argument(
'--runNumber',default=
None,help=
"specify to select a run number")
187 parser.add_argument(
'--outputHISTFile',default=
None,help=
"specify output HIST file name")
188 args = flags.fillFromArgs(parser=parser)
189 if args.runNumber
is not None:
190 flags.Output.HISTFileName = f
'ZdcLEDMonitorOutput_HI2023_{args.runNumber}.root'
192 flags.Output.HISTFileName =
'ZdcLEDMonitorOutput_HI2023.root'
194 if args.outputHISTFile
is not None:
195 flags.Output.HISTFileName = f
'{args.outputHISTFile}'
199 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
200 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
207 cfg.merge(zdcLEDMonitorAcc)
210 zdcLEDMonitorAcc.getEventAlgo(
'ZdcLEDMonAlg').OutputLevel = 2
213 cfg.printConfig(withDetails=
False)