6 '''@file ZdcMonitorAlgorithm.py
10 @brief python configuration for ZDC monitoring under the Run III DQ framework
11 will be run in the ZDC calibration stream & physics MinBias stream
12 see https://acode-browser1.usatlas.bnl.gov/lxr/source/athenAControl/AthenaMonitoring/python/ExampleMonitorAlgorithm.py
13 for details of structure of monitoring-configuration files
20 log_min = np.log10(min_value)
21 log_max = np.log10(max_value)
22 log_bin_edges = np.linspace(log_min, log_max, num_bins + 1)
23 bin_edges = [10 ** edge
for edge
in log_bin_edges]
30 from AthenaMonitoring
import AthMonitorCfgHelper
31 helper = AthMonitorCfgHelper(inputFlags,
'ZdcAthMonitorCfg')
33 from AthenaConfiguration.ComponentFactory
import CompFactory
34 zdcMonAlg = helper.addAlgorithm(CompFactory.ZdcMonitorAlgorithm,
'ZdcMonAlg')
37 zdcMonAlg.EnableTrigger = inputFlags.DQ.useTrigger
38 zdcMonAlg.CalInfoOn = inputFlags.Input.TriggerStream ==
'physics_MinBias' or inputFlags.Input.TriggerStream ==
'express_express'
40 genZdcMonTool = helper.addGroup(
51 n_energy_bins_default = 200
52 n_time_centroid_bins_default = 100
53 n_module_amp_zoomin_bins = 100
54 n_mod_fraction_bins_default = 100
55 module_chisq_min = 0.1
56 module_chisq_max = 800000
57 module_chisq_over_amp_min = 0.01
58 module_chisq_over_amp_max = 100000
60 if run_type ==
"LHCf2022":
61 print (
"looking at 2022 lhcf data")
62 energy_sum_xmax = 3000
63 energy_sum_zoomin_xmax = 3000
64 uncalib_amp_sum_zoomin_xmax = 3000
69 zdc_amp_sum_xmax = 3000
70 rpd_channel_amp_min = - 200.
71 rpd_amp_sum_xmax = 3000
72 rpd_max_adc_sum_xmax = 3000
73 module_amp_xmax = 2000
74 module_calib_amp_xmax = 5000
75 module_amp_1Nmonitor_xmax = 2000
76 module_calib_amp_1Nmonitor_xmax = 5000
78 elif run_type ==
"pp2023":
79 print (
"looking at pp reference run")
80 energy_sum_xmax = 3000
81 energy_sum_zoomin_xmax = 3000
82 uncalib_amp_sum_zoomin_xmax = 3000
87 zdc_amp_sum_xmax = 3000
88 rpd_channel_amp_min = - 200.
89 rpd_amp_sum_xmax = 3000
90 rpd_max_adc_sum_xmax = 3000
91 module_amp_xmax = 2000
92 module_calib_amp_xmax = 5000
93 module_amp_1Nmonitor_xmax = 2000
94 module_calib_amp_1Nmonitor_xmax = 5000
97 elif run_type ==
"PbPb2023":
98 print (
"looking at pbpb run")
99 energy_sum_xmax = 200000.0
100 energy_sum_zoomin_xmax = 20000.0
101 uncalib_amp_sum_zoomin_xmax = 6000.0
106 zdc_amp_sum_xmax = 163840.0
107 rpd_channel_amp_min = - 2048.
108 rpd_amp_sum_xmax = 245760.0
109 rpd_max_adc_sum_xmax = 40960.0
110 module_amp_xmax = 40960.0
111 module_calib_amp_xmax = 100000.0
112 module_amp_1Nmonitor_xmax = 1250.0
113 module_calib_amp_1Nmonitor_xmax = 3400.0
116 n_rpd_amp_bins_full_range =
int((abs(rpd_channel_amp_min) + module_amp_xmax) / module_amp_xmax * n_energy_bins_default)
117 n_rpd_amp_bins_half_range =
int((abs(rpd_channel_amp_min) + module_amp_xmax/2.) / (module_amp_xmax/2.) * n_energy_bins_default)
118 rpd_sub_amp_min = - module_amp_xmax / 4.
119 rpd_sub_amp_max = module_amp_xmax / 2.
120 n_rpd_sub_amp_bins =
int((abs(rpd_sub_amp_min) + rpd_sub_amp_max) / rpd_sub_amp_max * n_energy_bins_default)
122 genZdcMonTool.defineHistogram(
'zdcEnergySumA',title=
'ZDC Side A Energy Sum;E_{ZDC,A}[GeV];Events',
123 path=
'ZDC/ZDC/PerArm/Energy/SideA',
124 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_xmax)
125 genZdcMonTool.defineHistogram(
'zdcEnergySumC',title=
'ZDC Side C Energy Sum;E_{ZDC,C}[GeV];Events',
126 path=
'ZDC/ZDC/PerArm/Energy/SideC',
127 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_xmax)
128 genZdcMonTool.defineHistogram(
'zdcEnergySumA;zdcEnergySumA_zoomin_wTrigSelec',title=
'ZDC Side A Energy Sum (few neutrons, triggered on side C);E_{ZDC,A}[GeV];Events',
129 path=
'ZDC/ZDC/PerArm/Energy/SideA',
130 cutmask =
'passTrigSideC',
131 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_zoomin_xmax)
132 genZdcMonTool.defineHistogram(
'zdcEnergySumC;zdcEnergySumC_zoomin_wTrigSelec',title=
'ZDC Side C Energy Sum (few neutrons, triggered on side A);E_{ZDC,C}[GeV];Events',
133 path=
'ZDC/ZDC/PerArm/Energy/SideC',
134 cutmask =
'passTrigSideA',
135 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_zoomin_xmax)
136 genZdcMonTool.defineHistogram(
'zdcEnergySumA;zdcEnergySumA_zoomin_noTrigSelec',title=
'ZDC Side A Energy Sum (few neutrons, no trigger selection);E_{ZDC,A}[GeV];Events',
137 path=
'ZDC/ZDC/PerArm/Energy/SideA',
138 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_zoomin_xmax)
139 genZdcMonTool.defineHistogram(
'zdcEnergySumC;zdcEnergySumC_zoomin_noTrigSelec',title=
'ZDC Side C Energy Sum (few neutrons, no trigger selection);E_{ZDC,C}[GeV];Events',
140 path=
'ZDC/ZDC/PerArm/Energy/SideC',
141 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_zoomin_xmax)
143 genZdcMonTool.defineHistogram(
'zdcUncalibSumA',title=
'ZDC Side A Uncalibrated Sum;[ADC Counts];Events',
144 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideA',
145 xbins=n_energy_bins_default,xmin=0.0,xmax=zdc_amp_sum_xmax)
146 genZdcMonTool.defineHistogram(
'zdcUncalibSumC',title=
'ZDC Side C Uncalibrated Sum;[ADC Counts];Events',
147 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideC',
148 xbins=n_energy_bins_default,xmin=0.0,xmax=zdc_amp_sum_xmax)
152 genZdcMonTool.defineHistogram(
'lumiBlock, zdcEnergySumA;zdcEnergySumA_vs_lb_noTrig', type=
'TH2F', title=
';lumi block;E_{ZDC,A} [GeV]',
153 path=
'ZDC/ZDC/PerArm/Energy/SideA',
154 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
155 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_zoomin_xmax)
156 genZdcMonTool.defineHistogram(
'lumiBlock, zdcEnergySumC;zdcEnergySumC_vs_lb_noTrig', type=
'TH2F', title=
';lumi block;E_{ZDC,C} [GeV]',
157 path=
'ZDC/ZDC/PerArm/Energy/SideC',
158 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
159 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_zoomin_xmax)
160 genZdcMonTool.defineHistogram(
'lumiBlock, zdcEnergySumA;zdcEnergySumA_vs_lb_wTrig', type=
'TH2F', title=
';lumi block;E_{ZDC,A} [GeV]',
161 path=
'ZDC/ZDC/PerArm/Energy/SideA',
162 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max, cutmask =
'passTrigSideC',
163 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_zoomin_xmax)
164 genZdcMonTool.defineHistogram(
'lumiBlock, zdcEnergySumC;zdcEnergySumC_vs_lb_wTrig', type=
'TH2F', title=
';lumi block;E_{ZDC,C} [GeV]',
165 path=
'ZDC/ZDC/PerArm/Energy/SideC',
166 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max, cutmask =
'passTrigSideA',
167 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_zoomin_xmax)
169 genZdcMonTool.defineHistogram(
'lumiBlock, zdcUncalibSumA;zdcUncalibSumA_vs_lb_noTrig', type=
'TH2F', title=
';lumi block;ZDC amp A[ADC counts]',
170 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideA',
171 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
172 ybins=n_energy_bins_default,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
173 genZdcMonTool.defineHistogram(
'lumiBlock, zdcUncalibSumC;zdcUncalibSumC_vs_lb_noTrig', type=
'TH2F', title=
';lumi block;ZDC amp C[ADC counts]',
174 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideC',
175 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
176 ybins=n_energy_bins_default,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
177 genZdcMonTool.defineHistogram(
'lumiBlock, zdcUncalibSumA;zdcUncalibSumA_vs_lb_wTrig', type=
'TH2F', title=
';lumi block;ZDC amp A[ADC counts]',
178 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideA',
179 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max, cutmask =
'passTrigSideC',
180 ybins=n_energy_bins_default,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
181 genZdcMonTool.defineHistogram(
'lumiBlock, zdcUncalibSumC;zdcUncalibSumC_vs_lb_wTrig', type=
'TH2F', title=
';lumi block;ZDC amp C[ADC counts]',
182 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideC',
183 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max, cutmask =
'passTrigSideA',
184 ybins=n_energy_bins_default,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
186 genZdcMonTool.defineHistogram(
'bcid, zdcEnergySumA;zdcEnergySumA_vs_bcid_noTrig', type=
'TH2F', title=
';BCID;E_{ZDC,A} [GeV]',
187 path=
'ZDC/ZDC/PerArm/Energy/SideA',
188 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
189 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_zoomin_xmax)
190 genZdcMonTool.defineHistogram(
'bcid, zdcEnergySumC;zdcEnergySumC_vs_bcid_noTrig', type=
'TH2F', title=
';BCID;E_{ZDC,C} [GeV]',
191 path=
'ZDC/ZDC/PerArm/Energy/SideC',
192 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
193 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_zoomin_xmax)
194 genZdcMonTool.defineHistogram(
'bcid, zdcEnergySumA;zdcEnergySumA_vs_bcid_wTrig', type=
'TH2F', title=
';BCID;E_{ZDC,A} [GeV]',
195 path=
'ZDC/ZDC/PerArm/Energy/SideA',
196 xbins=bcid_max,xmin=0.0,xmax=bcid_max, cutmask =
'passTrigSideC',
197 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_zoomin_xmax)
198 genZdcMonTool.defineHistogram(
'bcid, zdcEnergySumC;zdcEnergySumC_vs_bcid_wTrig', type=
'TH2F', title=
';BCID;E_{ZDC,C} [GeV]',
199 path=
'ZDC/ZDC/PerArm/Energy/SideC',
200 xbins=bcid_max,xmin=0.0,xmax=bcid_max, cutmask =
'passTrigSideA',
201 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_zoomin_xmax)
203 genZdcMonTool.defineHistogram(
'bcid, zdcUncalibSumA;zdcUncalibSumA_vs_bcid_noTrig', type=
'TH2F', title=
';BCID;ZDC amp A[ADC counts]',
204 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideA',
205 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
206 ybins=n_energy_bins_default,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
207 genZdcMonTool.defineHistogram(
'bcid, zdcUncalibSumC;zdcUncalibSumC_vs_bcid_noTrig', type=
'TH2F', title=
';BCID;ZDC amp C[ADC counts]',
208 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideC',
209 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
210 ybins=n_energy_bins_default,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
211 genZdcMonTool.defineHistogram(
'bcid, zdcUncalibSumA;zdcUncalibSumA_vs_bcid_wTrig', type=
'TH2F', title=
';BCID;ZDC amp A[ADC counts]',
212 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideA',
213 xbins=bcid_max,xmin=0.0,xmax=bcid_max, cutmask =
'passTrigSideC',
214 ybins=n_energy_bins_default,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
215 genZdcMonTool.defineHistogram(
'bcid, zdcUncalibSumC;zdcUncalibSumC_vs_bcid_wTrig', type=
'TH2F', title=
';BCID;ZDC amp C[ADC counts]',
216 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideC',
217 xbins=bcid_max,xmin=0.0,xmax=bcid_max, cutmask =
'passTrigSideA',
218 ybins=n_energy_bins_default,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
220 genZdcMonTool.defineHistogram(
'lumiBlock, zdcUncalibSumA;zdcUncalibSumA_vs_lb_160bins_noTrig', type=
'TH2F', title=
';lumi block;E_{ZDC,A} [GeV]',
221 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideA',
222 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
223 ybins=160,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
224 genZdcMonTool.defineHistogram(
'lumiBlock, zdcUncalibSumC;zdcUncalibSumC_vs_lb_160bins_noTrig', type=
'TH2F', title=
';lumi block;E_{ZDC,C} [GeV]',
225 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideC',
226 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
227 ybins=160,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
228 genZdcMonTool.defineHistogram(
'lumiBlock, zdcUncalibSumA;zdcUncalibSumA_vs_lb_160bins_wTrig', type=
'TH2F', title=
';lumi block;E_{ZDC,A} [GeV]',
229 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideA',
230 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max, cutmask =
'passTrigSideC',
231 ybins=160,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
232 genZdcMonTool.defineHistogram(
'lumiBlock, zdcUncalibSumC;zdcUncalibSumC_vs_lb_160bins_wTrig', type=
'TH2F', title=
';lumi block;E_{ZDC,C} [GeV]',
233 path=
'ZDC/ZDC/PerArm/UncalibAmp/SideC',
234 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max, cutmask =
'passTrigSideA',
235 ybins=160,ymin=0.0,ymax=uncalib_amp_sum_zoomin_xmax)
237 genZdcMonTool.defineHistogram(
'zdcEnergySumA, zdcEnergySumC', type=
'TH2F', title=
';E_{ZDC,A} [GeV];E_{ZDC,C} [GeV]',
238 path=
'ZDC/Global/SideACCorr',
239 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_xmax,
240 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_xmax)
242 genZdcMonTool.defineHistogram(
'rpdCosDeltaReactionPlaneAngle', title=
';Cos (#Delta #phi_{AorC});Events',
243 path=
'ZDC/Global/ReactionPlane',
244 cutmask=
'bothHasCentroid',
245 xbins=n_time_centroid_bins_default,xmin=-1,xmax=1)
246 genZdcMonTool.defineHistogram(
'rpdCosDeltaReactionPlaneAngle;rpdCosDeltaReactionPlaneAngle_requireValid', title=
';Cos (#Delta #phi_{AorC});Events',
247 path=
'ZDC/Global/ReactionPlane',
248 cutmask=
'bothReactionPlaneAngleValid',
249 xbins=n_time_centroid_bins_default,xmin=-1,xmax=1)
253 if (zdcMonAlg.CalInfoOn):
254 genZdcMonTool.defineHistogram(
'fcalEtA, zdcEnergySumA', type=
'TH2F', title=
';E_{FCal, A} [GeV];E_{ZDC,A} [GeV]',
255 path=
'ZDC/Global/ZDCFcalCorr',
256 xbins=n_energy_bins_default,xmin=0.0,xmax=5000,
257 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_xmax)
258 genZdcMonTool.defineHistogram(
'fcalEtC, zdcEnergySumC', type=
'TH2F', title=
';E_{FCal, C} [GeV];E_{ZDC,C} [GeV]',
259 path=
'ZDC/Global/ZDCFcalCorr',
260 xbins=n_energy_bins_default,xmin=0.0,xmax=5000,
261 ybins=n_energy_bins_default,ymin=0.0,ymax=energy_sum_xmax)
262 genZdcMonTool.defineHistogram(
'fcalEtA, fcalEtC', type=
'TH2F', title=
';E_{FCal, A} [GeV];E_{FCal, C} [GeV]',
263 path=
'ZDC/Global/SideACCorr',
264 xbins=n_energy_bins_default,xmin=0.0,xmax=5000,
265 ybins=n_energy_bins_default,ymin=0.0,ymax=5000)
274 nRpdCentroidStatusBits = 21
278 zdcSideMonToolArr = helper.addArray([nSides],zdcMonAlg,
'ZdcSideMonitor')
281 zdcSideMonToolArr.defineHistogram(
'zdcAvgTime',title=
'ZDC Side Average Time;t[ns];Events', cutmask =
'zdcModuleMask',
282 path=
'ZDC/ZDC/PerArm/AvgTime',
283 xbins=n_time_centroid_bins_default,xmin=-10.0,xmax=10.0)
285 zdcSideMonToolArr.defineHistogram(
'lumiBlock, zdcAvgTime;zdcAvgTime_vs_lb', type=
'TH2F', title=
'ZDC Side Average Time versus Lumi block;lumi block;t[ns]',
286 path=
'ZDC/ZDC/PerArm/AvgTime',
287 cutmask =
'zdcModuleMask',
288 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
289 ybins=n_time_centroid_bins_default,ymin=-10.0,ymax=10.0)
291 zdcSideMonToolArr.defineHistogram(
'centroidStatusBits',title=
';;Events',
292 path=
'ZDC/Global/Centroid',
293 xbins=nRpdCentroidStatusBits,xmin=0.0,xmax=nRpdCentroidStatusBits,opt=
'kVec',
294 xlabels=[
'ValidBit',
'HasCentroidBit',
'ZDCInvalidBit',
'InsufficientZDCEnergyBit',
'ExcessiveZDCEnergyBit',
'EMInvalidBit',
'InsufficientEMEnergyBit',
'ExcessiveEMEnergyBit',
'RPDInvalidBit',
'PileupBit',
'ExcessivePileupBit',
'ZeroSumBit',
'ExcessiveSubtrUnderflowBit',
'Row0ValidBit',
'Row1ValidBit',
'Row2ValidBit',
'Row3ValidBit',
'Col0ValidBit',
'Col1ValidBit',
'Col2ValidBit',
'Col3ValidBit'])
296 zdcSideMonToolArr.defineHistogram(
'xCentroid, yCentroid',type=
'TH2F',title=
';Centroid x position [mm];Centroid y position [mm]',
297 path=
'ZDC/Global/Centroid',
298 xbins=n_time_centroid_bins_default,xmin=x_centroid_min,xmax=x_centroid_max,
299 ybins=n_time_centroid_bins_default,ymin=y_centroid_min,ymax=y_centroid_max)
300 zdcSideMonToolArr.defineHistogram(
'ReactionPlaneAngle',title=
';Reaction Plane Angle;Events',
301 path=
'ZDC/Global/ReactionPlane',
302 xbins=64,xmin=-3.141593,xmax=3.141593)
304 zdcSideMonToolArr.defineHistogram(
'xCentroid, yCentroid;yCentroid_vs_xCentroid_requireValid',type=
'TH2F',title=
';Centroid x position [mm];Centroid y position [mm]',
305 path=
'ZDC/Global/Centroid',
306 cutmask=
'centroidValid',
307 xbins=n_time_centroid_bins_default,xmin=x_centroid_min,xmax=x_centroid_max,
308 ybins=n_time_centroid_bins_default,ymin=y_centroid_min,ymax=y_centroid_max)
309 zdcSideMonToolArr.defineHistogram(
'ReactionPlaneAngle;ReactionPlaneAngle_requireValid',title=
';Reaction Plane Angle;Events',
310 path=
'ZDC/Global/ReactionPlane',
311 cutmask=
'centroidValid',
312 xbins=64,xmin=-3.141593,xmax=3.141593)
315 zdcSideMonToolArr.defineHistogram(
'lumiBlock, xCentroid;xCentroid_vs_lb', type=
'TH2F', title=
';lumi block;Centroid x position [mm]',
316 path=
'ZDC/Global/CentroidLBdep',
317 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
318 ybins=n_time_centroid_bins_default,ymin=x_centroid_min,ymax=x_centroid_max)
319 zdcSideMonToolArr.defineHistogram(
'lumiBlock, yCentroid;yCentroid_vs_lb', type=
'TH2F', title=
';lumi block;Centroid y position [mm]',
320 path=
'ZDC/Global/CentroidLBdep',
321 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
322 ybins=n_time_centroid_bins_default,ymin=y_centroid_min,ymax=y_centroid_max)
324 zdcSideMonToolArr.defineHistogram(
'lumiBlock, xCentroid;xCentroid_vs_lb_requireValid', type=
'TH2F', title=
';lumi block;Centroid x position [mm]',
325 path=
'ZDC/Global/CentroidLBdep',
326 cutmask=
'centroidValid',
327 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
328 ybins=n_time_centroid_bins_default,ymin=x_centroid_min,ymax=x_centroid_max)
329 zdcSideMonToolArr.defineHistogram(
'lumiBlock, yCentroid;yCentroid_vs_lb_requireValid', type=
'TH2F', title=
';lumi block;Centroid y position [mm]',
330 path=
'ZDC/Global/CentroidLBdep',
331 cutmask=
'centroidValid',
332 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
333 ybins=n_time_centroid_bins_default,ymin=y_centroid_min,ymax=y_centroid_max)
335 zdcSideMonToolArr.defineHistogram(
'rpdSubAmpSum', title=
';RPD Subtracted Amp Sum (AorC) [ADC counts]',
336 path=
'ZDC/RPD/PerArm',
337 cutmask=
'centroidValid',
338 xbins=n_energy_bins_default,xmin = - rpd_amp_sum_xmax / 16., xmax=rpd_amp_sum_xmax / 4.)
340 zdcSideMonToolArr.defineHistogram(
'zdcEnergySum, rpdMaxADCSum', type=
'TH2F', title=
';E ZDC side [TeV];RPD Max ADC Sum (AorC) [ADC counts]',
341 path=
'ZDC/ZdcRpdPerSideCorr',
342 cutmask=
'RPDSideValid',
343 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_xmax,
344 ybins=n_energy_bins_default,ymin=0.0,ymax=rpd_max_adc_sum_xmax)
345 zdcSideMonToolArr.defineHistogram(
'zdcEnergySum, rpdAmplitudeCalibSum', type=
'TH2F', title=
';E ZDC side [GeV];RPD Calib Amp Sum (AorC) [ADC counts]',
346 path=
'ZDC/ZdcRpdPerSideCorr',
347 cutmask=
'RPDSideValid',
348 xbins=n_energy_bins_default,xmin=0.0,xmax=energy_sum_xmax,
349 ybins=n_energy_bins_default,ymin=0.0,ymax=rpd_amp_sum_xmax)
350 zdcSideMonToolArr.defineHistogram(
'zdcEMModuleEnergy, rpdAmplitudeCalibSum', type=
'TH2F', title=
';E EM module AorC [GeV];RPD Calib Amp Sum (AorC) [ADC counts]',
351 path=
'ZDC/ZdcRpdPerSideCorr',
352 cutmask=
'RPDSideValid',
353 xbins=n_energy_bins_default,xmin=0.0,xmax=module_calib_amp_xmax / 2.,
354 ybins=n_energy_bins_default,ymin=0.0,ymax=rpd_amp_sum_xmax)
358 zdcModuleMonToolArr = helper.addArray([nSides,nModules],zdcMonAlg,
'ZdcModuleMonitor', topPath=
'ZDC/ZDC/ZdcModule/')
360 zdcModuleMonToolArr.defineHistogram(
'zdcStatusBits',title=
';;Events',
361 path=
'ModuleStatusBits',
362 xbins=nZdcStatusBits,xmin=0.0,xmax=nZdcStatusBits,opt=
'kVec',
363 xlabels=[
'PulseBit',
'LowGainBit',
'FailBit',
'HGOverflowBit',
'HGUnderflowBit',
'PSHGOverUnderflowBit',
'LGOverflowBit',
'LGUnderflowBit',
'PrePulseBit',
'PostPulseBit',
'FitFailedBit',
'BadChisqBit',
'BadT0Bit',
'ExcludeEarlyLGBit',
'ExcludeLateLGBit',
'preExpTailBit',
'FitMinAmpBit',
'RepassPulseBit'])
366 zdcModuleMonToolArr.defineHistogram(
'zdcModuleAmp',title=
';Module Amplitude [ADC Counts];Events',
368 xbins=n_energy_bins_default,xmin=0.0,xmax=module_amp_xmax)
369 zdcModuleMonToolArr.defineHistogram(
'zdcModuleAmp;zdcModuleAmp_halfrange',title=
';Module Amplitude [ADC Counts];Events',
371 xbins=n_energy_bins_default,xmin=0.0,xmax=module_amp_xmax / 2.)
372 zdcModuleMonToolArr.defineHistogram(
'zdcModuleFract',title=
';Module Amplitude Fraction;Events',
373 path=
'ModuleFraction',
374 xbins=n_mod_fraction_bins_default,xmin=0.0,xmax=1.)
375 zdcModuleMonToolArr.defineHistogram(
'zdcModuleFract;zdcModuleFract_above20N',title=
';Module Amplitude Fraction;Events',
376 path=
'ModuleFraction',
377 cutmask=
'zdcAbove20NCurrentSide',
378 xbins=n_mod_fraction_bins_default,xmin=0.0,xmax=1.)
379 zdcModuleMonToolArr.defineHistogram(
'lumiBlock, zdcModuleFract;zdcModuleFract_above20N_vs_lb', type=
'TH2F',title=
';lumi block;Module Amplitude Fraction',
380 path=
'ModuleFractionLBdep',
381 cutmask=
'zdcAbove20NCurrentSide',
382 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
383 ybins=n_mod_fraction_bins_default,ymin=0.0,ymax=1.)
384 zdcModuleMonToolArr.defineHistogram(
'zdcUncalibSumCurrentSide, zdcModuleFract', type=
'TH2F', title=
';Amplitude Sum Current Side [ADC Counts];Module Amplitude Fraction',
385 path=
'ModuleFraction',
386 xbins=n_energy_bins_default,xmin=0.0,xmax=zdc_amp_sum_xmax / 2.,
387 ybins=n_mod_fraction_bins_default,ymin=0.0,ymax=1.)
388 zdcModuleMonToolArr.defineHistogram(
'zdcUncalibSumCurrentSide, zdcModuleFract;zdcModuleFract_vs_zdcUncalibSumCurrentSide_zoomedin', type=
'TH2F', title=
';Amplitude Sum Current Side [ADC Counts];Module Amplitude Fraction',
389 path=
'ModuleFraction',
390 xbins=n_energy_bins_default,xmin=0.0,xmax=5000,
391 ybins=n_mod_fraction_bins_default,ymin=0.0,ymax=1.)
393 zdcModuleMonToolArr.defineHistogram(
'zdcModuleCalibAmp',title=
';Module Calibrated Amplitude [GeV];Events',
394 path=
'ModuleCalibAmp',
395 xbins=2*n_energy_bins_default,xmin=0.0,xmax=module_calib_amp_xmax)
396 zdcModuleMonToolArr.defineHistogram(
'zdcModuleCalibAmp;zdcModuleCalibAmp_halfrange',title=
';Module Calibrated Amplitude [GeV];Events',
397 path=
'ModuleCalibAmp',
398 xbins=2*n_energy_bins_default,xmin=0.0,xmax=module_calib_amp_xmax / 2.)
399 zdcModuleMonToolArr.defineHistogram(
'zdcModuleTime',title=
';Module Time [ns];Events',
401 xbins=n_time_centroid_bins_default,xmin=-10.0,xmax=10.0)
402 zdcModuleMonToolArr.defineHistogram(
'zdcModuleTime;zdcModuleTime_LG',title=
';Module Time [ns];Events',
404 cutmask=
'zdcModuleLG',
405 xbins=n_time_centroid_bins_default,xmin=-10.0,xmax=10.0)
406 zdcModuleMonToolArr.defineHistogram(
'zdcModuleTime;zdcModuleTime_HG',title=
';Module Time [ns];Events',
408 cutmask=
'zdcModuleHG',
409 xbins=n_time_centroid_bins_default,xmin=-10.0,xmax=10.0)
410 zdcModuleMonToolArr.defineHistogram(
'zdcModuleCalibTime',title=
';Module Calibrated Time [ns];Events',
411 path=
'ModuleCalibTime',
412 xbins=n_time_centroid_bins_default,xmin=-10.0,xmax=10.0)
413 zdcModuleMonToolArr.defineHistogram(
'zdcModuleChisq',title=
';Module Chi-square;Events',
416 zdcModuleMonToolArr.defineHistogram(
'zdcModuleChisqOverAmp',title=
';Module Chi-square / Amplitude;Events',
418 xbins=
create_log_bins(module_chisq_over_amp_min, module_chisq_over_amp_max, 80))
420 zdcModuleMonToolArr.defineHistogram(
'lumiBlock, zdcModuleAmp;zdcModuleAmp_vs_lb', type=
'TH2F', title=
';lumi block;Module Amplitude [ADC counts]',
421 path=
'ModuleAmpLBdep',
422 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
423 ybins=n_module_amp_zoomin_bins, ymin=0.0, ymax=module_amp_1Nmonitor_xmax)
424 zdcModuleMonToolArr.defineHistogram(
'lumiBlock, zdcModuleCalibAmp;zdcModuleCalibAmp_vs_lb', type=
'TH2F', title=
';lumi block;Module Calib Amplitude',
425 path=
'ModuleCalibAmpLBdep',
426 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
427 ybins=n_module_amp_zoomin_bins, ymin=0.0, ymax=module_calib_amp_1Nmonitor_xmax)
429 zdcModuleMonToolArr.defineHistogram(
'bcid, zdcModuleCalibAmp', type=
'TH2F', title=
';BCID;Module Calib Amplitude',
430 path=
'ModuleCalibAmpBCIDdep',
431 xbins=bcid_max,xmin=0.0,xmax=bcid_max,
432 ybins=n_module_amp_zoomin_bins, ymin=0.0, ymax=module_calib_amp_1Nmonitor_xmax)
434 zdcModuleMonToolArr.defineHistogram(
'lumiBlock, zdcModuleTime;zdcModuleTime_vs_lb', type=
'TH2F', title=
';lumi block;Module Time [ns]',
435 path=
'ModuleTimeLBdep',
436 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
437 ybins=n_time_centroid_bins_default, ymin=-10.0, ymax=10.0)
438 zdcModuleMonToolArr.defineHistogram(
'lumiBlock, zdcModuleTime;zdcModuleTime_LG_vs_lb', type=
'TH2F', title=
';lumi block;Module Time [ns]',
439 path=
'ModuleTimeLBdep',
440 cutmask=
'zdcModuleLG',
441 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
442 ybins=n_time_centroid_bins_default, ymin=-10.0, ymax=10.0)
443 zdcModuleMonToolArr.defineHistogram(
'lumiBlock, zdcModuleTime;zdcModuleTime_HG_vs_lb', type=
'TH2F', title=
';lumi block;Module Time [ns]',
444 path=
'ModuleTimeLBdep',
445 cutmask=
'zdcModuleHG',
446 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
447 ybins=n_time_centroid_bins_default, ymin=-10.0, ymax=10.0)
451 rpdChannelMonToolArr = helper.addArray([nSides,nChannels],zdcMonAlg,
'RpdChannelMonitor', topPath=
'ZDC/RPD/RPDChannel/')
453 rpdChannelMonToolArr.defineHistogram(
'RPDStatusBits',title=
';;Events',
455 xbins=nRpdStatusBits,xmin=0,xmax=nRpdStatusBits,opt=
'kVec',
456 xlabels=[
'ValidBit',
'OutOfTimePileupBit',
'OverflowBit',
'PrePulseBit',
'PostPulseBit',
'NoPulseBit',
'BadAvgBaselineSubtrBit',
'InsufficientPileupFitPointsBit',
'PileupStretchedExpFitFailBit',
'PileupStretchedExpGrowthBit',
'PileupBadStretchedExpSubtrBit',
'PileupExpFitFailBit',
'PileupExpGrowthBit',
'PileupBadExpSubtrBit',
'PileupStretchedExpPulseLike'])
458 rpdChannelMonToolArr.defineHistogram(
'RPDChannelAmplitudeCalib', title=
';RPD Channel Calibrated Amplitude;Events',
460 cutmask=
'RPDChannelValid',
461 xbins=n_rpd_amp_bins_full_range,xmin=rpd_channel_amp_min,xmax=module_amp_xmax)
462 rpdChannelMonToolArr.defineHistogram(
'RPDChannelAmplitudeCalib;RPDChannelAmplitudeCalib_halfrange', title=
';RPD Channel Calibrated Amplitude;Events',
464 cutmask=
'RPDChannelValid',
465 xbins=n_rpd_amp_bins_half_range,xmin=rpd_channel_amp_min,xmax=module_amp_xmax / 2.)
466 rpdChannelMonToolArr.defineHistogram(
'RPDChannelSubAmp', title=
';RPD Channel Subtracted Amplitude;Events',
468 cutmask=
'RPDChannelCentroidValid',
469 xbins=n_rpd_sub_amp_bins,xmin=rpd_sub_amp_min,xmax=rpd_sub_amp_max)
470 rpdChannelMonToolArr.defineHistogram(
'RPDChannelMaxADC', title=
';Max ADC [ADC Counts];Events',
472 cutmask=
'RPDChannelValid',
473 xbins=n_energy_bins_default,xmin=0.0,xmax=4096.0)
474 rpdChannelMonToolArr.defineHistogram(
'lumiBlock, RPDChannelAmplitudeCalib;RPDChannelAmplitudeCalib_vs_lb', type=
'TH2F', title=
';lumi block;RPD Channel Calibrated Amplitude',
475 path=
'CalibAmpLBdep',
476 cutmask=
'RPDChannelValid',
477 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
478 ybins=n_rpd_amp_bins_full_range,ymin=rpd_channel_amp_min,ymax=module_amp_xmax)
479 rpdChannelMonToolArr.defineHistogram(
'lumiBlock, RPDChannelAmplitudeCalib;RPDChannelAmplitudeCalib_halfrange_vs_lb', type=
'TH2F', title=
';lumi block;RPD Channel Calibrated Amplitude',
480 path=
'CalibAmpLBdep',
481 cutmask=
'RPDChannelValid',
482 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
483 ybins=n_rpd_amp_bins_half_range,ymin=rpd_channel_amp_min,ymax=module_amp_xmax / 2.)
484 rpdChannelMonToolArr.defineHistogram(
'lumiBlock, RPDChannelMaxADC;RPDChannelMaxADC_vs_lb', type=
'TH2F', title=
';lumi block;Max ADC [ADC Counts]',
486 cutmask=
'RPDChannelValid',
487 xbins=lumi_block_max,xmin=0.0,xmax=lumi_block_max,
488 ybins=n_energy_bins_default,ymin=0.0,ymax=4096.0)
492 rpdChannelMonToolArr.defineHistogram(
'RPDChannelPileupFrac;RPDChannelPileupFrac_negative_amp', title=
';;Events',
493 path=
'NegativeAmpDistrs',
494 cutmask=
'RPDChannelNegativeAmp',
495 xlabels=[
'pileup',
'no pileup'],
496 xbins=2,xmin=-1.5,xmax=0.5)
498 rpdChannelMonToolArr.defineHistogram(
'zdcEMModuleSameSideHasPulse;zdcEMModuleSameSideHasPulse_negative_amp', title=
';;Events',
499 path=
'NegativeAmpDistrs',
500 cutmask=
'RPDChannelNegativeAmp',
501 xlabels=[
'EM pulse bit false',
'EM pulse bit true'],
502 xbins=2,xmin=-0.5,xmax=1.5)
504 rpdChannelMonToolArr.defineHistogram(
'RPDChannelMaxADC;RPDChannelMaxADC_negative_amp', title=
';Max ADC [ADC Counts];Events',
505 path=
'NegativeAmpDistrs',
506 cutmask=
'RPDChannelNegativeAmp',
507 xbins=n_energy_bins_default,xmin=0.0,xmax=4096.0)
509 rpdChannelMonToolArr.defineHistogram(
'zdcEMModuleEnergySameSide;zdcEMModuleEnergySameSide_negative_amp', title=
';E EM module AorC [GeV];Events',
510 path=
'NegativeAmpDistrs',
511 cutmask=
'RPDChannelNegativeAmp',
512 xbins=n_energy_bins_default,xmin=0.0,xmax=module_calib_amp_xmax / 2.)
514 rpdChannelMonToolArr.defineHistogram(
'zdcEMModuleEnergySameSide, RPDChannelPileupFitSlope;RPDChannelPileupFitSlope_vs_zdcEMModuleEnergySameSide_negative_amp', type=
'TH2F', title=
';E EM module AorC [GeV];RPD Pileup Fitted Slope',
515 path=
'NegativeAmpDistrs',
516 cutmask=
'RPDChannelNegativePileup',
517 xbins=n_energy_bins_default,xmin=0.0,xmax=module_calib_amp_xmax / 2.,
518 ybins=n_energy_bins_default,ymin=-100.,ymax=10.)
521 rpdChannelMonToolArr.defineHistogram(
'RPDChannelAmplitudeCalib;RPDChannelAmplitudeCalib_EMbelow0', title=
';RPD Channel Calibrated Amplitude;Events',
522 path=
'CalibAmp/RpdChanAmpDistrAtLowEMModuleEnergy',
523 cutmask=
'rpdValidZdcEMModuleEnergySameSideBelow0',
524 xbins=n_rpd_amp_bins_half_range,xmin=rpd_channel_amp_min,xmax=module_amp_xmax / 2.)
525 rpdChannelMonToolArr.defineHistogram(
'RPDChannelAmplitudeCalib;RPDChannelAmplitudeCalib_EMbelow70', title=
';RPD Channel Calibrated Amplitude;Events',
526 path=
'CalibAmp/RpdChanAmpDistrAtLowEMModuleEnergy',
527 cutmask=
'rpdValidZdcEMModuleEnergySameSideBelow70',
528 xbins=n_rpd_amp_bins_half_range,xmin=rpd_channel_amp_min,xmax=module_amp_xmax / 2.)
536 return helper.result()
543 if __name__==
'__main__':
545 from AthenaCommon.Logging
import log
547 log.setLevel(WARNING)
550 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
553 inputfile =
'myAOD.pool.root'
554 flags.Input.Files = [directory+inputfile]
556 parser = flags.getArgumentParser()
557 parser.add_argument(
'--runNumber',default=
None,help=
"specify to select a run number")
558 parser.add_argument(
'--streamTag',default=
"ZDCCalib",help=
"ZDCCalib or MinBias")
559 parser.add_argument(
'--outputHISTFile',default=
None,help=
"specify output HIST file name")
560 args = flags.fillFromArgs(parser=parser)
562 flags.DQ.useTrigger =
False if flags.Input.isMC
else True
563 if args.runNumber
is not None:
564 flags.Output.HISTFileName = f
'ZdcMonitorOutput_HI2023_{args.streamTag}_{args.runNumber}.root'
566 flags.Output.HISTFileName = f
'ZdcMonitorOutput_HI2023_{args.streamTag}.root'
568 if args.outputHISTFile
is not None:
569 flags.Output.HISTFileName = f
'{args.outputHISTFile}'
572 print(
'Output', flags.Output.HISTFileName)
574 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
575 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
579 run_type =
"PbPb2023"
582 cfg.merge(zdcMonitorAcc)
585 zdcMonitorAcc.getEventAlgo(
'ZdcMonAlg').OutputLevel = 2
588 cfg.printConfig(withDetails=
False)