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')
22 zdcLEDMonAlg.EnableZDC = inputFlags.Detector.EnableZDC_ZDC
23 zdcLEDMonAlg.EnableRPD = inputFlags.Detector.EnableZDC_RPD
26 LEDs = [
"Blue1",
"Green",
"Blue2"]
28 modules = [
"0",
"1",
"2",
"3"]
29 channels = [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15"]
31 n_energy_bins_default = 200
32 n_adc_sum_fine_bins = 800
33 n_time_bins_default = 150
34 n_sample_bins_default = 25
36 l1TriggerType_max = 256
42 nDecodingErrorBits = 3
45 zdcLEDAllEventsDiagMonTool = helper.addGroup(zdcLEDMonAlg,
'ZdcLEDAllEventsDiagnosis',
'ZDC/AllLEDEventsDiagnosis/')
47 zdcModLEDMonToolArr = helper.addArray([LEDs,sides,modules],zdcLEDMonAlg,
'ZdcModLEDMonitor', topPath=
'ZDC/ZDCLED/')
48 rpdChanLEDMonToolArr = helper.addArray([LEDs,sides,channels],zdcLEDMonAlg,
'RPDChanLEDMonitor', topPath=
'ZDC/RPDLED/')
53 zdcLEDAllEventsDiagMonTool.defineHistogram(
'decodingErrorBits',title=
';;Events',
54 xbins=nDecodingErrorBits,xmin=0.0,xmax=nDecodingErrorBits,opt=
'kVec',
55 xlabels=[
'No Decoding Error',
'ZDC Decoding Error',
'RPD Decoding Error'])
57 zdcLEDAllEventsDiagMonTool.defineHistogram(
'l1TriggerType', title=
';L1TriggerType;Events',
58 xbins=l1TriggerType_max,xmin=0.0,xmax=l1TriggerType_max)
68 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDADCSum', title=
';LED ADC Sum [ADC Counts];Events',
70 xbins=n_adc_sum_fine_bins,xmin=0.0,xmax=adc_sum_max)
71 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDMaxADC', title=
';LED Max ADC [ADC Counts];Events',
73 xbins=n_energy_bins_default,xmin=0.0,xmax=max_adc_max)
74 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDMaxSample', title=
';LED Max Sample [ADC Counts];Events',
75 path=
'zdcLEDMaxSample',
76 xbins=n_sample_bins_default,xmin=0.0,xmax=nsamples_max)
77 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDAvgTime', title=
';LED Average Time [ns];Events',
79 xbins=n_time_bins_default,xmin=0.0,xmax=time_max)
80 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDADCSum', title=
';LED ADC Sum [ADC Counts];Events',
82 xbins=n_adc_sum_fine_bins,xmin=0.0,xmax=adc_sum_max)
83 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDMaxADC', title=
';LED Max ADC [ADC Counts];Events',
85 xbins=n_energy_bins_default,xmin=0.0,xmax=max_adc_max)
86 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDMaxSample', title=
';LED Max Sample [ADC Counts];Events',
87 path=
'rpdLEDMaxSample',
88 xbins=n_sample_bins_default,xmin=0.0,xmax=nsamples_max)
89 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDAvgTime', title=
';LED Average Time [ns];Events',
91 xbins=n_time_bins_default,xmin=0.0,xmax=time_max)
95 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDADCSum;zdcLEDADCSum_vs_lb', type=
'TH2F', title=
';lumi block;LED ADC Sum [ADC Counts]',
96 path=
'zdcLEDADCSumLBdep',
97 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
98 ybins=n_adc_sum_fine_bins,ymin=0.0,ymax=adc_sum_max)
99 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDMaxADC;zdcLEDMaxADC_vs_lb', type=
'TH2F', title=
';lumi block;LED Max ADC [ADC Counts]',
100 path=
'zdcLEDMaxADCLBdep',
101 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
102 ybins=n_energy_bins_default,ymin=0.0,ymax=max_adc_max)
103 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDMaxSample;zdcLEDMaxSample_vs_lb', type=
'TH2F', title=
';lumi block;LED Max Sample [ADC Counts]',
104 path=
'zdcLEDMaxSampleLBdep',
105 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
106 ybins=n_sample_bins_default,ymin=0.0,ymax=nsamples_max)
107 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDAvgTime;zdcLEDAvgTime_vs_lb', type=
'TH2F', title=
';lumi block;LED Average Time [ns]',
108 path=
'zdcLEDAvgTimeLBdep',
109 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
110 ybins=n_time_bins_default,ymin=0.0,ymax=time_max)
111 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDADCSum;rpdLEDADCSum_vs_lb', type=
'TH2F', title=
';lumi block;LED ADC Sum [ADC Counts]',
112 path=
'rpdLEDADCSumLBdep',
113 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
114 ybins=n_adc_sum_fine_bins,ymin=0.0,ymax=adc_sum_max)
115 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDMaxADC;rpdLEDMaxADC_vs_lb', type=
'TH2F', title=
';lumi block;LED Max ADC [ADC Counts]',
116 path=
'rpdLEDMaxADCLBdep',
117 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
118 ybins=n_energy_bins_default,ymin=0.0,ymax=max_adc_max)
119 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDMaxSample;rpdLEDMaxSample_vs_lb', type=
'TH2F', title=
';lumi block;LED Max Sample [ADC Counts]',
120 path=
'rpdLEDMaxSampleLBdep',
121 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
122 ybins=n_sample_bins_default,ymin=0.0,ymax=nsamples_max)
123 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDAvgTime;rpdLEDAvgTime_vs_lb', type=
'TH2F', title=
';lumi block;LED Average Time [ns]',
124 path=
'rpdLEDAvgTimeLBdep',
125 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
126 ybins=n_time_bins_default,ymin=0.0,ymax=time_max)
129 return helper.result()
132 if __name__==
'__main__':
134 from AthenaCommon.Logging
import log
136 log.setLevel(WARNING)
139 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
142 inputfile =
'myLEDAOD.pool.root'
143 flags.Input.Files = [directory+inputfile]
144 flags.Input.isMC =
False
145 flags.Output.HISTFileName =
'ZdcLEDMonitorOutput_2018PbPb.root'
146 parser = flags.getArgumentParser()
147 parser.add_argument(
'--runNumber',default=
None,help=
"specify to select a run number")
148 parser.add_argument(
'--outputHISTFile',default=
None,help=
"specify output HIST file name")
149 args = flags.fillFromArgs(parser=parser)
150 if args.runNumber
is not None:
151 flags.Output.HISTFileName = f
'ZdcLEDMonitorOutput_HI2023_{args.runNumber}.root'
153 flags.Output.HISTFileName =
'ZdcLEDMonitorOutput_HI2023.root'
155 if args.outputHISTFile
is not None:
156 flags.Output.HISTFileName = f
'{args.outputHISTFile}'
160 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
161 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
168 cfg.merge(zdcLEDMonitorAcc)
171 zdcLEDMonitorAcc.getEventAlgo(
'ZdcLEDMonAlg').OutputLevel = 2
174 cfg.printConfig(withDetails=
False)