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
16 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
20 from AthenaMonitoring
import AthMonitorCfgHelper
21 helper = AthMonitorCfgHelper(inputFlags,
'ZdcAthMonitorCfg')
23 from AthenaConfiguration.ComponentFactory
import CompFactory
24 zdcLEDMonAlg = helper.addAlgorithm(CompFactory.ZdcLEDMonitorAlgorithm,
'ZdcLEDMonAlg')
26 zdcLEDMonAlg.EnableZDC = inputFlags.Detector.EnableZDC_ZDC
27 zdcLEDMonAlg.EnableRPD = inputFlags.Detector.EnableZDC_RPD
30 LEDs = [
"Blue1",
"Green",
"Blue2"]
32 modules = [
"0",
"1",
"2",
"3"]
33 channels = [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15"]
35 n_energy_bins_default = 200
36 n_adc_sum_fine_bins = 800
37 n_time_bins_default = 150
38 n_sample_bins_default = 25
40 l1TriggerType_max = 256
46 nDecodingErrorBits = 3
49 zdcLEDAllEventsDiagMonTool = helper.addGroup(zdcLEDMonAlg,
'ZdcLEDAllEventsDiagnosis',
'ZDC/AllLEDEventsDiagnosis/')
51 zdcModLEDMonToolArr = helper.addArray([LEDs,sides,modules],zdcLEDMonAlg,
'ZdcModLEDMonitor', topPath=
'ZDC/ZDCLED/')
52 rpdChanLEDMonToolArr = helper.addArray([LEDs,sides,channels],zdcLEDMonAlg,
'RPDChanLEDMonitor', topPath=
'ZDC/RPDLED/')
57 zdcLEDAllEventsDiagMonTool.defineHistogram(
'decodingErrorBits',title=
';;Events',
58 xbins=nDecodingErrorBits,xmin=0.0,xmax=nDecodingErrorBits,opt=
'kVec',
59 xlabels=[
'No Decoding Error',
'ZDC Decoding Error',
'RPD Decoding Error'])
61 zdcLEDAllEventsDiagMonTool.defineHistogram(
'l1TriggerType', title=
';L1TriggerType;Events',
62 xbins=l1TriggerType_max,xmin=0.0,xmax=l1TriggerType_max)
72 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDADCSum', title=
';LED ADC Sum [ADC Counts];Events',
74 xbins=n_adc_sum_fine_bins,xmin=0.0,xmax=adc_sum_max)
75 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDMaxADC', title=
';LED Max ADC [ADC Counts];Events',
77 xbins=n_energy_bins_default,xmin=0.0,xmax=max_adc_max)
78 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDMaxSample', title=
';LED Max Sample [ADC Counts];Events',
79 path=
'zdcLEDMaxSample',
80 xbins=n_sample_bins_default,xmin=0.0,xmax=nsamples_max)
81 zdcModLEDMonToolArr.defineHistogram(
'zdcLEDAvgTime', title=
';LED Average Time [ns];Events',
83 xbins=n_time_bins_default,xmin=0.0,xmax=time_max)
84 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDADCSum', title=
';LED ADC Sum [ADC Counts];Events',
86 xbins=n_adc_sum_fine_bins,xmin=0.0,xmax=adc_sum_max)
87 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDMaxADC', title=
';LED Max ADC [ADC Counts];Events',
89 xbins=n_energy_bins_default,xmin=0.0,xmax=max_adc_max)
90 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDMaxSample', title=
';LED Max Sample [ADC Counts];Events',
91 path=
'rpdLEDMaxSample',
92 xbins=n_sample_bins_default,xmin=0.0,xmax=nsamples_max)
93 rpdChanLEDMonToolArr.defineHistogram(
'rpdLEDAvgTime', title=
';LED Average Time [ns];Events',
95 xbins=n_time_bins_default,xmin=0.0,xmax=time_max)
99 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDADCSum;zdcLEDADCSum_vs_lb', type=
'TH2F', title=
';lumi block;LED ADC Sum [ADC Counts]',
100 path=
'zdcLEDADCSumLBdep',
101 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
102 ybins=n_adc_sum_fine_bins,ymin=0.0,ymax=adc_sum_max)
103 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDMaxADC;zdcLEDMaxADC_vs_lb', type=
'TH2F', title=
';lumi block;LED Max ADC [ADC Counts]',
104 path=
'zdcLEDMaxADCLBdep',
105 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
106 ybins=n_energy_bins_default,ymin=0.0,ymax=max_adc_max)
107 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDMaxSample;zdcLEDMaxSample_vs_lb', type=
'TH2F', title=
';lumi block;LED Max Sample [ADC Counts]',
108 path=
'zdcLEDMaxSampleLBdep',
109 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
110 ybins=n_sample_bins_default,ymin=0.0,ymax=nsamples_max)
111 zdcModLEDMonToolArr.defineHistogram(
'lumiBlock, zdcLEDAvgTime;zdcLEDAvgTime_vs_lb', type=
'TH2F', title=
';lumi block;LED Average Time [ns]',
112 path=
'zdcLEDAvgTimeLBdep',
113 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
114 ybins=n_time_bins_default,ymin=0.0,ymax=time_max)
115 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDADCSum;rpdLEDADCSum_vs_lb', type=
'TH2F', title=
';lumi block;LED ADC Sum [ADC Counts]',
116 path=
'rpdLEDADCSumLBdep',
117 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
118 ybins=n_adc_sum_fine_bins,ymin=0.0,ymax=adc_sum_max)
119 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDMaxADC;rpdLEDMaxADC_vs_lb', type=
'TH2F', title=
';lumi block;LED Max ADC [ADC Counts]',
120 path=
'rpdLEDMaxADCLBdep',
121 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
122 ybins=n_energy_bins_default,ymin=0.0,ymax=max_adc_max)
123 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDMaxSample;rpdLEDMaxSample_vs_lb', type=
'TH2F', title=
';lumi block;LED Max Sample [ADC Counts]',
124 path=
'rpdLEDMaxSampleLBdep',
125 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
126 ybins=n_sample_bins_default,ymin=0.0,ymax=nsamples_max)
127 rpdChanLEDMonToolArr.defineHistogram(
'lumiBlock, rpdLEDAvgTime;rpdLEDAvgTime_vs_lb', type=
'TH2F', title=
';lumi block;LED Average Time [ns]',
128 path=
'rpdLEDAvgTimeLBdep',
129 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
130 ybins=n_time_bins_default,ymin=0.0,ymax=time_max)
133 acc = helper.result()
138 if __name__==
'__main__':
140 from AthenaCommon.Logging
import log
142 log.setLevel(WARNING)
145 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
148 inputfile =
'myLEDAOD.pool.root'
149 flags.Input.Files = [directory+inputfile]
150 flags.Input.isMC =
False
151 flags.Output.HISTFileName =
'ZdcLEDMonitorOutput_2018PbPb.root'
152 parser = flags.getArgumentParser()
153 parser.add_argument(
'--runNumber',default=
None,help=
"specify to select a run number")
154 parser.add_argument(
'--outputHISTFile',default=
None,help=
"specify output HIST file name")
155 args = flags.fillFromArgs(parser=parser)
156 if args.runNumber
is not None:
157 flags.Output.HISTFileName = f
'ZdcLEDMonitorOutput_HI2023_{args.runNumber}.root'
159 flags.Output.HISTFileName =
'ZdcLEDMonitorOutput_HI2023.root'
161 if args.outputHISTFile
is not None:
162 flags.Output.HISTFileName = f
'{args.outputHISTFile}'
166 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
167 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
174 cfg.merge(zdcLEDMonitorAcc)
177 zdcLEDMonitorAcc.getEventAlgo(
'ZdcLEDMonAlg').OutputLevel = 2
180 cfg.printConfig(withDetails=
False)