ATLAS Offline Software
ZDCDataAnalyzer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include <sstream>
9 #include <utility>
10 
11 #include "CxxUtils/trapping_fp.h"
14 
15 ZDCDataAnalyzer::ZDCDataAnalyzer(ZDCMsg::MessageFunctionPtr msgFunc_p, int nSample, float deltaTSample, size_t preSampleIdx, std::string fitFunction,
16  const ZDCModuleIntArray& peak2ndDerivMinSamples,
17  const ZDCModuleFloatArray& peak2ndDerivMinThresholdsHG,
18  const ZDCModuleFloatArray& peak2ndDerivMinThresholdsLG,
19  unsigned int LGMode) :
20  m_msgFunc_p(msgFunc_p),
21  m_nSample(nSample), m_deltaTSample(deltaTSample), m_preSampleIdx(preSampleIdx),
22  m_fitFunction(std::move(fitFunction)),
23  m_LGMode(LGMode),
24  m_repassEnabled(false),
25  m_eventCount(0),
26  m_haveECalib(false),
27  m_haveT0Calib(false),
28  m_currentLB(-1),
29 
30  // Default "calibrations"
31  m_currentECalibCoeff ({{{{1, 1, 1, 1}}, {{1, 1, 1, 1}}}}),
32  m_currentT0OffsetsHG ({{{{0, 0, 0, 0}}, {{0, 0, 0, 0}}}}),
33  m_currentT0OffsetsLG ({{{{0, 0, 0, 0}}, {{0, 0, 0, 0}}}}),
34 
35  m_moduleMask(0),
36  m_moduleSum({{0, 0}}),
37  m_moduleSumErrSq({{0, 0}}),
38  m_moduleSumPreSample({{0, 0}}),
39  m_calibModuleSum({{0, 0}}),
40  m_calibModuleSumErrSq({{0, 0}}),
41  m_averageTime({{0, 0}}),
42  m_fail({{false, false}})
43 {
44  m_moduleDisabled[0] = {{false, false, false, false}};
45  m_moduleDisabled[1] = {{false, false, false, false}};
46 
47  m_moduleAnalyzers[0] = {{0, 0, 0, 0}};
48  m_moduleAnalyzers[1] = {{0, 0, 0, 0}};
49 
50  m_calibAmplitude[0] = {{0, 0, 0, 0}};
51  m_calibAmplitude[1] = {{0, 0, 0, 0}};
52 
53  m_calibTime[0] = {{0, 0, 0, 0}};
54  m_calibTime[1] = {{0, 0, 0, 0}};
55 
56  m_dataLoaded[0] = {{false, false, false, false}};
57  m_dataLoaded[1] = {{false, false, false, false}};
58 
59  m_delayedOrder[0] = {0, 0, 0, 0};
60  m_delayedOrder[1] = {0, 0, 0, 0};
61 
62  // For now we are using hard-coded gain factors and pedestals
63  //
64  m_HGGains[0] = {{10, 10, 10, 10}};
65  m_HGGains[1] = {{10, 10, 10, 10}};
66 
67  m_pedestals[0] = {{100, 100, 100, 100}};
68  m_pedestals[1] = {{100, 100, 100, 100}};
69 
70 
71  // Construct the per-module pulse analyzers
72  //
73  for (size_t side : {0, 1}) {
74  for (size_t module : {0, 1, 2, 3}) {
75  std::ostringstream moduleTag;
76  moduleTag << "_s" << side << "_m" << module;
77 
78  m_moduleAnalyzers[side][module].reset (new ZDCPulseAnalyzer(m_msgFunc_p, moduleTag.str(), m_nSample, m_deltaTSample, m_preSampleIdx,
79  m_pedestals[side][module], m_HGGains[side][module], m_fitFunction,
80  peak2ndDerivMinSamples[side][module],
81  peak2ndDerivMinThresholdsHG[side][module],
82  peak2ndDerivMinThresholdsLG[side][module]));
83  m_moduleAnalyzers[side][module]->setLGMode(m_LGMode);
84  }
85  }
86 }
87 
89 {
90 }
91 
93 {
94  if (side < 2 && module < 4) {
95  //
96  // Can't disable in the middle of analysis
97  //
98  if (m_dataLoaded[side][module]) return false;
99  else {
100  m_moduleDisabled[side][module] = true;
101  return true;
102  }
103  }
104  else {
105  return false;
106  }
107 }
108 
109 void ZDCDataAnalyzer::enableDelayed(float deltaT, const ZDCModuleFloatArray& undelayedDelayedPedestalDiff)
110 {
111  int delayedOrder = deltaT < 0 ? -1 : 1;
112  for (size_t side : {0, 1}) {
113  for (size_t module : {0, 1, 2, 3}) {
114  m_delayedOrder[side][module] = delayedOrder;
115  m_moduleAnalyzers[side][module]->enableDelayed(std::abs(deltaT), undelayedDelayedPedestalDiff[side][module]);
116  }
117  }
118 }
119 
120 void ZDCDataAnalyzer::enableDelayed(const ZDCModuleFloatArray& delayDeltaTArray, const ZDCModuleFloatArray& undelayedDelayedPedestalDiff)
121 {
122  for (size_t side : {0, 1}) {
123  for (size_t module : {0, 1, 2, 3}) {
124  if (delayDeltaTArray[side][module] < 0) m_delayedOrder[side][module] = -1;
125  else m_delayedOrder[side][module] = 1;
126 
127  (*m_msgFunc_p)(ZDCMsg::Verbose, "Enabling use of delayed samples on side, module = " + std::to_string(side) + ", " +
128  std::to_string(module) + ", delta t = " + std::to_string(delayDeltaTArray[side][module]));
129 
130  m_moduleAnalyzers[side][module]->enableDelayed(std::abs(delayDeltaTArray[side][module]), undelayedDelayedPedestalDiff[side][module]);
131  }
132  }
133 }
134 
135 void ZDCDataAnalyzer::enablePreExclusion(unsigned int maxSamplesExcl, const ZDCModuleIntArray& HGADCThresh, const ZDCModuleIntArray& LGADCThresh)
136 {
137  for (size_t side : {0, 1}) {
138  for (size_t module : {0, 1, 2, 3}) {
139  m_moduleAnalyzers[side][module]->enablePreExclusion(maxSamplesExcl, HGADCThresh[side][module], LGADCThresh[side][module]);
140  }
141  }
142 }
143 
144 void ZDCDataAnalyzer::enablePreExclusion(unsigned int maxSamplesExcl, unsigned int HGADCThresh, unsigned int LGADCThresh)
145 {
146  for (size_t side : {0, 1}) {
147  for (size_t module : {0, 1, 2, 3}) {
148  m_moduleAnalyzers[side][module]->enablePreExclusion(maxSamplesExcl, HGADCThresh, LGADCThresh);
149  }
150  }
151 }
152 
153 void ZDCDataAnalyzer::enablePostExclusion(unsigned int maxSamplesExcl, const ZDCModuleIntArray& HGADCThresh, const ZDCModuleIntArray& LGADCThresh)
154 {
155  for (size_t side : {0, 1}) {
156  for (size_t module : {0, 1, 2, 3}) {
157  m_moduleAnalyzers[side][module]->enablePostExclusion(maxSamplesExcl, HGADCThresh[side][module], LGADCThresh[side][module]);
158  }
159  }
160 }
161 
162 void ZDCDataAnalyzer::enablePostExclusion(unsigned int maxSamplesExcl, unsigned int HGADCThresh, unsigned int LGADCThresh)
163 {
164  for (size_t side : {0, 1}) {
165  for (size_t module : {0, 1, 2, 3}) {
166  m_moduleAnalyzers[side][module]->enablePostExclusion(maxSamplesExcl, HGADCThresh, LGADCThresh);
167  }
168  }
169 }
170 
171 
172 void ZDCDataAnalyzer::enableRepass(const ZDCModuleFloatArray& peak2ndDerivMinRepassHG, const ZDCModuleFloatArray& peak2ndDerivMinRepassLG)
173 {
174  m_repassEnabled = true;
175  for (size_t side : {0, 1}) {
176  for (size_t module : {0, 1, 2, 3}) {
177  m_moduleAnalyzers[side][module]->enableRepass(peak2ndDerivMinRepassHG[side][module], peak2ndDerivMinRepassLG[side][module]);
178  }
179  }
180 }
181 
183 {
184  for (size_t side : {0, 1}) {
185  for (size_t module : {0, 1, 2, 3}) {
186  m_moduleAnalyzers[side][module]->set2ndDerivStep(step);
187  }
188  }
189 }
190 
191 void ZDCDataAnalyzer::SetGainFactorsHGLG(float gainFactorHG, float gainFactorLG)
192 {
193  for (size_t side : {0, 1}) {
194  for (size_t module : {0, 1, 2, 3}) {
195  m_moduleAnalyzers[side][module]->SetGainFactorsHGLG(gainFactorHG, gainFactorLG);
196  }
197  }
198 }
199 
200 void ZDCDataAnalyzer::SetGainFactorsHGLG(const ZDCModuleFloatArray& gainFactorsHG, const ZDCModuleFloatArray& gainFactorsLG)
201 {
202  for (size_t side : {0, 1}) {
203  for (size_t module : {0, 1, 2, 3}) {
204  m_moduleAnalyzers[side][module]->SetGainFactorsHGLG(gainFactorsHG[side][module], gainFactorsLG[side][module]);
205  }
206  }
207 }
208 
210  for (size_t side : {0, 1}) {
211  for (size_t module : {0, 1, 2, 3}) {
212  m_moduleAnalyzers[side][module]->SetPeak2ndDerivMinTolerance(tolerance);
213  }
214  }
215 }
216 
217 
219  for (size_t side : {0, 1}) {
220  for (size_t module : {0, 1, 2, 3}) {
221  m_moduleAnalyzers[side][module]->SetFitTimeMax(tmax);
222  }
223  }
224 }
225 
226 
229 }
230 
231 
233  const ZDCModuleFloatArray& tau1, const ZDCModuleFloatArray& tau2,
234  const ZDCModuleFloatArray& t0HG, const ZDCModuleFloatArray& t0LG)
235 {
236  for (size_t side : {0, 1}) {
237  for (size_t module : {0, 1, 2, 3}) {
238  m_moduleAnalyzers[side][module]->SetTauT0Values(fixTau1[side][module], fixTau2[side][module],
239  tau1[side][module], tau2[side][module], t0HG[side][module], t0LG[side][module]);
240  }
241  }
242 }
243 
244 void ZDCDataAnalyzer::SetNoiseSigmas(const ZDCModuleFloatArray& noiseSigmasHG, const ZDCModuleFloatArray& noiseSigmasLG)
245 {
246  for (size_t side : {0, 1}) {
247  for (size_t module : {0, 1, 2, 3}) {
248  m_moduleAnalyzers[side][module]->SetNoiseSigmas(noiseSigmasHG[side][module], noiseSigmasLG[side][module]);
249  }
250  }
251 }
252 
254  for (size_t side : {0, 1}) {
255  for (size_t module : {0, 1, 2, 3}) {
256  m_moduleAmpFractionLG[side][module] = moduleAmpFractionLG[side][module];
257  }
258  }
259 }
260 
262  const ZDCModuleFloatArray& maxAmpHG, const ZDCModuleFloatArray& maxAmpLG)
263 {
264  for (size_t side : {0, 1}) {
265  for (size_t module : {0, 1, 2, 3}) {
266  m_moduleAnalyzers[side][module]->SetFitMinMaxAmp(minAmpHG[side][module], minAmpLG[side][module],
267  maxAmpHG[side][module], maxAmpLG[side][module]);
268 
269  }
270  }
271 }
272 
273 void ZDCDataAnalyzer::SetFitMinMaxAmpValues(float minHG, float minLG, float maxHG, float maxLG)
274 {
275  for (size_t side : {0, 1}) {
276  for (size_t module : {0, 1, 2, 3}) {
277  m_moduleAnalyzers[side][module]->SetFitMinMaxAmp(minHG, minLG, maxHG, maxLG);
278  }
279  }
280 }
281 
283  const ZDCModuleFloatArray& LGOverflowADC)
284 {
285  for (size_t side : {0, 1}) {
286  for (size_t module : {0, 1, 2, 3}) {
287  m_moduleAnalyzers[side][module]->SetADCOverUnderflowValues(HGOverflowADC[side][module], HGUnderflowADC[side][module], LGOverflowADC[side][module]);
288  }
289  }
290 }
291 
292 void ZDCDataAnalyzer::SetCutValues(const ZDCModuleFloatArray& chisqDivAmpCutHG, const ZDCModuleFloatArray& chisqDivAmpCutLG,
293  const ZDCModuleFloatArray& deltaT0MinHG, const ZDCModuleFloatArray& deltaT0MaxHG,
294  const ZDCModuleFloatArray& deltaT0MinLG, const ZDCModuleFloatArray& deltaT0MaxLG)
295 {
296  for (size_t side : {0, 1}) {
297  for (size_t module : {0, 1, 2, 3}) {
298  m_moduleAnalyzers[side][module]->SetCutValues(chisqDivAmpCutHG[side][module], chisqDivAmpCutLG[side][module],
299  deltaT0MinHG[side][module], deltaT0MaxHG[side][module],
300  deltaT0MinLG[side][module], deltaT0MaxLG[side][module]);
301  }
302  }
303 }
304 
306  const std::array<std::array<std::vector<float>, 4>, 2>& HGParamArr,
307  const std::array<std::array<std::vector<float>, 4>, 2>& LGParamArr)
308 {
309  for (size_t side : {0, 1}) {
310  for (size_t module : {0, 1, 2, 3}) {
311  m_moduleAnalyzers[side][module]->SetTimingCorrParams(mode, refADC, refScale,
312  HGParamArr.at(side).at(module), LGParamArr.at(side).at(module));
313  }
314  }
315 
316 }
317 
318 void ZDCDataAnalyzer::SetNonlinCorrParams(float refADC, float refScale,
319  const std::array<std::array<std::vector<float>, 4>, 2>& HGNonlinCorrParams,
320  const std::array<std::array<std::vector<float>, 4>, 2>& LGNonlinCorrParams)
321 {
322  for (size_t side : {0, 1}) {
323  for (size_t module : {0, 1, 2, 3}) {
324  m_moduleAnalyzers[side][module]->SetNonlinCorrParams(refADC, refScale,
325  HGNonlinCorrParams[side][module],
326  LGNonlinCorrParams[side][module]);
327  }
328  }
329 }
330 
331 void ZDCDataAnalyzer::enableTimeSigCut(bool AND, float sigCut, const std::string& TF1String,
332  const std::array<std::array<std::vector<double>, 4>, 2>& parsHGArr,
333  const std::array<std::array<std::vector<double>, 4>, 2>& parsLGArr)
334 {
335  for (size_t side : {0, 1}) {
336  for (size_t module : {0, 1, 2, 3}) {
337  m_moduleAnalyzers[side][module]->enableTimeSigCut(AND, sigCut, TF1String, parsHGArr[side][module], parsLGArr[side][module]);
338  }
339  }
340 }
341 
343 {
344  (*m_msgFunc_p)(ZDCMsg::Verbose, ("Starting new event, event index = " + std::to_string(m_eventCount)));
345 
346  // By default we perform quiet pulse fits
347  //
349  else {ZDCPulseAnalyzer::SetQuietFits(true);}
350 
351  // See if we have to load up new calibrations
352  //
353  if (lumiBlock != m_currentLB) {
354  (*m_msgFunc_p)(ZDCMsg::Verbose, ("Starting new luminosity block " + std::to_string(lumiBlock)));
355 
356  if (m_haveECalib) {
357  (*m_msgFunc_p)(ZDCMsg::Verbose, ("Loading energy calibrations for event " + std::to_string(m_eventCount) + ", lumi block " +
359 
360  for (size_t side : {0, 1}) {
361  for (size_t module : {0, 1, 2, 3}) {
362  float splineLBMin = m_LBDepEcalibSplines[side][module]->GetXmin();
363  float splineLBMax = m_LBDepEcalibSplines[side][module]->GetXmax();
364 
365  if (lumiBlock >= splineLBMin && lumiBlock <= splineLBMax) {
367  }
368  else if (lumiBlock < splineLBMin) {
370  }
371  else {
373  }
374  }
375  }
376  } // end of if (_haveEcalib) {
377 
378  if (m_haveT0Calib) {
379  (*m_msgFunc_p)(ZDCMsg::Verbose, ("Loading timing calibrations for event " + std::to_string(m_eventCount) + ", lumi block " + std::to_string(lumiBlock)));
380 
381  for (size_t side : {0, 1}) {
382  for (size_t module : {0, 1, 2, 3}) {
383  float splineLBMin = m_T0HGOffsetSplines[side][module]->GetXmin();
384  float splineLBMax = m_T0HGOffsetSplines[side][module]->GetXmax();
385 
386  if (lumiBlock >= splineLBMin && lumiBlock <= splineLBMax) {
389  }
390  else if (lumiBlock < splineLBMin) {
393  }
394  else {
397  }
398  }
399  }
400  } // end of if (m_haveT0Calib)
401  }
402 
403  // Initialize transient results
404  //
405  for (size_t side : {0, 1}) {
406  for (size_t module : {0, 1, 2, 3}) {
407  m_dataLoaded[side][module] = false;
408  m_moduleStatus[side][module] = 0;
410  m_calibTime[side][module] = 0;
411  // _moduleFail[side][module] = false;
412  }
413 
414  m_moduleSum[side] = 0;
415  m_moduleSumErrSq[side] = 0;
418 
419  m_calibModuleSum[side] = 0;
422  m_averageTime[side] = 0;
423  m_fail[side] = false;
424  }
425 
426  m_moduleMask = 0;
428 }
429 
430 void ZDCDataAnalyzer::LoadAndAnalyzeData(size_t side, size_t module, const std::vector<float>& HGSamples, const std::vector<float>& LGSamples)
431 {
432 
433  // We immediately return if this module is disabled
434  //
435  if (m_moduleDisabled[side][module]) {
436  (*m_msgFunc_p)(ZDCMsg::Verbose, ("Skipping analysis of disabled module for event index " + std::to_string(m_eventCount) + ", side, module = " + std::to_string(side) + ", " + std::to_string(module)));
437 
438  return;
439  }
440 
441  (*m_msgFunc_p)(ZDCMsg::Verbose, ("/n Loading data for event index " + std::to_string(m_eventCount) + ", side, module = " + std::to_string(side) + ", " + std::to_string(module)));
442 
443  ZDCPulseAnalyzer* pulseAna_p = m_moduleAnalyzers[side][module].get();
444  pulseAna_p->LoadAndAnalyzeData(HGSamples, LGSamples);
445  m_dataLoaded[side][module] = true;
446 
447  if (pulseAna_p->Failed()) {
448  (*m_msgFunc_p)(ZDCMsg::Debug, ("ZDCPulseAnalyzer::LoadData() returned fail for event " + std::to_string(m_eventCount) + ", side, module = " + std::to_string(side) + ", " + std::to_string(module)));
449 
450  m_fail[side] = true;
451  }
452 
453  m_moduleStatus[side][module] = pulseAna_p->GetStatusMask();
454 }
455 
456 void ZDCDataAnalyzer::LoadAndAnalyzeData(size_t side, size_t module, const std::vector<float>& HGSamples, const std::vector<float>& LGSamples,
457  const std::vector<float>& HGSamplesDelayed, const std::vector<float>& LGSamplesDelayed)
458 {
459  // We immediately return if this module is disabled
460  //
461  if (m_moduleDisabled[side][module]) {
462  (*m_msgFunc_p)(ZDCMsg::Debug, ("Skipping analysis of disabled mofule for event index " + std::to_string(m_eventCount) + ", side, module = " + std::to_string(side) + ", " + std::to_string(module)));
463 
464  return;
465  }
466 
467  if (m_delayedOrder[side][module] == 0) {
468  (*m_msgFunc_p)(ZDCMsg::Error, ("Handling of delayed pulses not enabled, on side, module = " + std::to_string(side) + ", " + std::to_string(module) + ", skipping processing for event index " + std::to_string(m_eventCount)));
469  return;
470  }
471 
472  (*m_msgFunc_p)(ZDCMsg::Verbose, ("Loading undelayed and delayed data for event index " + std::to_string(m_eventCount) + ", side, module = " + std::to_string(side) + ", " + std::to_string(module)));
473 
474  ZDCPulseAnalyzer* pulseAna_p = m_moduleAnalyzers[side][module].get();
475  if (m_delayedOrder[side][module] > 0) {
476  pulseAna_p->LoadAndAnalyzeData(HGSamples, LGSamples, HGSamplesDelayed, LGSamplesDelayed);
477  }
478  else {
479  pulseAna_p->LoadAndAnalyzeData(HGSamplesDelayed, LGSamplesDelayed, HGSamples, LGSamples);
480  }
481  m_dataLoaded[side][module] = true;
482 
483  if (pulseAna_p->Failed()) {
484  (*m_msgFunc_p)(ZDCMsg::Debug, ("ZDCPulseAnalyzer::LoadData() returned fail for event " + std::to_string(m_eventCount) + ", side, module = " + std::to_string(side) + ", " + std::to_string(module)));
485 
486  m_fail[side] = true;
487  }
488 
489  m_moduleStatus[side][module] = pulseAna_p->GetStatusMask();
490 }
491 
493 {
494  // First make sure that all data is loaded. while we're at it, count how many modules on each side have a pulse
495  //
496  unsigned int sideNPulsesMod[2] = {0, 0};
497 
498  for (size_t side : {0, 1}) {
499  for (size_t module : {0, 1, 2, 3}) {
500  if (!m_dataLoaded[side][module] && !m_moduleDisabled[side][module]) {return false;}
501  if (m_moduleAnalyzers[side][module]->ArmSumInclude()) {sideNPulsesMod[side]++;}
502  }
503  }
504 
505  // Are we doing a repass? If so, reanalyze modules for which no pulse was found the first time
506  // as long as we have one module with a pulse on the given side
507  //
508  if (m_repassEnabled) {
509  for (size_t side : {0, 1}) {
510  if (sideNPulsesMod[side] == 0) continue;
511 
512  for (size_t module : {0, 1, 2, 3}) {
513  if (m_moduleDisabled[side][module]) continue;
514 
515  ZDCPulseAnalyzer* pulseAna_p = m_moduleAnalyzers[side][module].get();
516 
517  // If this module had no pulse the first time, reanalyze it (with a lower 2nd derivative threshold)
518  //
519  if (!pulseAna_p->HavePulse()) {
520  (*m_msgFunc_p)(ZDCMsg::Debug, ("ZDCPulseAnalyzer:: performing a repass on data for side, module = " + std::to_string(side) + ", " + std::to_string(module)));
521  pulseAna_p->ReanalyzeData();
522  m_moduleStatus[side][module] = pulseAna_p->GetStatusMask();
523  }
524  }
525  }
526  }
527 
528  // Now sum up amplitudes etc
529  //
530  for (size_t side : {0, 1}) {
531  float tempFraction = 1.0;
532  double sumAmpTimesBkgdFrac = 0.0;
533  double sumCalibAmpTimesBkgdFrac = 0.0;
534 
535  for (size_t module : {0, 1, 2, 3}) {
536  ZDCPulseAnalyzer* pulseAna_p = m_moduleAnalyzers[side][module].get();
537 
538  if (pulseAna_p->ArmSumInclude()) {
539  int moduleMaskBit = 4 * side + module;
540  m_moduleMask |= 1 << moduleMaskBit;
541 
542  float amplitude = pulseAna_p->GetAmplitude();
543  float ampError = pulseAna_p->GetAmpError();
544  float bkgdFraction = pulseAna_p->GetBkgdMaxFraction();
545 
547 
548  float calibAmpError = ampError * m_currentECalibCoeff[side][module];
549 
550  float timeCalib = pulseAna_p->GetT0Corr();
551  if (pulseAna_p->UseLowGain()) {timeCalib -= m_currentT0OffsetsLG[side][module];}
552  else {timeCalib -= m_currentT0OffsetsHG[side][module];}
553 
554  m_calibTime[side][module] = timeCalib;
555 
556  m_moduleSum[side] += amplitude;
557  m_moduleSumErrSq[side] += ampError * ampError;
558  sumAmpTimesBkgdFrac += amplitude*bkgdFraction;
559 
560  m_moduleSumPreSample[side] += pulseAna_p->GetPreSampleAmp();
561 
563  m_calibModuleSumErrSq[side] += calibAmpError * calibAmpError;
564 
566  sumCalibAmpTimesBkgdFrac += amplitude*bkgdFraction;
567  }
568 
569  // subtract the fraction of LGOverflow events if we have fraction available (<0 means unavailable)
570  if (pulseAna_p->LGOverflow() && m_moduleAmpFractionLG[side][module] > 0) {tempFraction -= m_moduleAmpFractionLG[side][module];}
571  }
572 
573  {
575  if (m_moduleSum[side] > 0) m_moduleSumBkgdFrac[side] = sumAmpTimesBkgdFrac/m_moduleSum[side];
576  else m_moduleSumBkgdFrac[side] = 0;
577  }
578 
579  if (m_calibModuleSum[side] > 1e-6) {
581  m_calibModSumBkgdFrac[side] = sumCalibAmpTimesBkgdFrac/m_calibModuleSum[side];
582  }
583  else {
584  m_averageTime[side] = 0;
586  }
587 
588  if (tempFraction < 1.0) {m_moduleSum[side] /= tempFraction;}
589  }
590 
591  m_eventCount++;
592  return true;
593 }
ZDCDataAnalyzer::m_T0LGOffsetSplines
std::array< std::array< std::unique_ptr< TSpline >, 4 >, 2 > m_T0LGOffsetSplines
Definition: ZDCDataAnalyzer.h:51
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ZDCDataAnalyzer::m_calibAmplitude
std::array< std::array< float, 4 >, 2 > m_calibAmplitude
Definition: ZDCDataAnalyzer.h:66
ZDCDataAnalyzer::m_dataLoaded
std::array< std::array< bool, 4 >, 2 > m_dataLoaded
Definition: ZDCDataAnalyzer.h:60
CXXUTILS_TRAPPING_FP
#define CXXUTILS_TRAPPING_FP
Definition: trapping_fp.h:24
ZDCPulseAnalyzer::UseLowGain
bool UseLowGain() const
Definition: ZDCPulseAnalyzer.h:534
ZDCDataAnalyzer::m_moduleMask
unsigned int m_moduleMask
Definition: ZDCDataAnalyzer.h:63
ZDCPulseAnalyzer::ArmSumInclude
bool ArmSumInclude() const
Definition: ZDCPulseAnalyzer.h:554
ZDCDataAnalyzer::enableTimeSigCut
void enableTimeSigCut(bool AND, float sigCut, const std::string &TF1String, const std::array< std::array< std::vector< double >, 4 >, 2 > &parsHGArr, const std::array< std::array< std::vector< double >, 4 >, 2 > &parsLGArr)
Definition: ZDCDataAnalyzer.cxx:331
ZDCPulseAnalyzer::ReanalyzeData
bool ReanalyzeData()
Definition: ZDCPulseAnalyzer.cxx:647
ZDCPulseAnalyzer::Failed
bool Failed() const
Definition: ZDCPulseAnalyzer.h:535
ZDCDataAnalyzer::m_moduleAnalyzers
std::array< std::array< std::unique_ptr< ZDCPulseAnalyzer >, 4 >, 2 > m_moduleAnalyzers
Definition: ZDCDataAnalyzer.h:39
ZDCPulseAnalyzer.h
ZDCDataAnalyzer::ZDCModuleFloatArray
std::array< std::array< float, 4 >, 2 > ZDCModuleFloatArray
Definition: ZDCDataAnalyzer.h:22
ZDCPulseAnalyzer::GetAmpError
float GetAmpError() const
Definition: ZDCPulseAnalyzer.h:579
ZDCPulseAnalyzer::LGOverflow
bool LGOverflow() const
Definition: ZDCPulseAnalyzer.h:540
ZDCPulseAnalyzer::GetStatusMask
unsigned int GetStatusMask() const
Definition: ZDCPulseAnalyzer.cxx:1920
ZDCDataAnalyzer::m_repassEnabled
bool m_repassEnabled
Definition: ZDCDataAnalyzer.h:34
ZDCPulseAnalyzer::HavePulse
bool HavePulse() const
Definition: ZDCPulseAnalyzer.h:533
ZDCDataAnalyzer::m_moduleSum
std::array< float, 2 > m_moduleSum
Definition: ZDCDataAnalyzer.h:69
ZDCDataAnalyzer::m_T0HGOffsetSplines
std::array< std::array< std::unique_ptr< TSpline >, 4 >, 2 > m_T0HGOffsetSplines
Definition: ZDCDataAnalyzer.h:50
ZDCDataAnalyzer::ZDCModuleIntArray
std::array< std::array< int, 4 >, 2 > ZDCModuleIntArray
Definition: ZDCDataAnalyzer.h:24
Root::AND
@ AND
Definition: TGRLCollection.h:32
ZDCPulseAnalyzer
Definition: ZDCPulseAnalyzer.h:24
ZDCPulseAnalyzer::GetAmplitude
float GetAmplitude() const
Definition: ZDCPulseAnalyzer.h:578
ZDCDataAnalyzer::m_msgFunc_p
ZDCMsg::MessageFunctionPtr m_msgFunc_p
Definition: ZDCDataAnalyzer.h:27
ZDCPulseAnalyzer::SetQuietFits
static void SetQuietFits(bool quiet)
Definition: ZDCPulseAnalyzer.h:430
ZDCPulseAnalyzer::GetT0Corr
float GetT0Corr() const
Definition: ZDCPulseAnalyzer.h:565
ZDCDataAnalyzer::set2ndDerivStep
void set2ndDerivStep(size_t step)
Definition: ZDCDataAnalyzer.cxx:182
ZDCDataAnalyzer::SetCutValues
void SetCutValues(const ZDCModuleFloatArray &chisqDivAmpCutHG, const ZDCModuleFloatArray &chisqDivAmpCutLG, const ZDCModuleFloatArray &deltaT0MinHG, const ZDCModuleFloatArray &deltaT0MaxHG, const ZDCModuleFloatArray &deltaT0MinLG, const ZDCModuleFloatArray &deltaT0MaxLG)
Definition: ZDCDataAnalyzer.cxx:292
TRT::Hit::side
@ side
Definition: HitInfo.h:83
ZDCPulseAnalyzer::LoadAndAnalyzeData
bool LoadAndAnalyzeData(const std::vector< float > &ADCSamplesHG, const std::vector< float > &ADCSamplesLG)
Definition: ZDCPulseAnalyzer.cxx:570
ZDCDataAnalyzer::m_calibTime
std::array< std::array< float, 4 >, 2 > m_calibTime
Definition: ZDCDataAnalyzer.h:67
ZDCDataAnalyzer.h
python.PyAthena.module
module
Definition: PyAthena.py:131
ZDCDataAnalyzer::m_haveECalib
bool m_haveECalib
Definition: ZDCDataAnalyzer.h:46
ZDCMsg::Verbose
@ Verbose
Definition: ZDCMsg.h:18
ZDCDataAnalyzer::m_eventCount
int m_eventCount
Definition: ZDCDataAnalyzer.h:41
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
ZDCDataAnalyzer::m_moduleSumBkgdFrac
std::array< float, 2 > m_moduleSumBkgdFrac
Definition: ZDCDataAnalyzer.h:72
ZDCDataAnalyzer::m_haveT0Calib
bool m_haveT0Calib
Definition: ZDCDataAnalyzer.h:49
ZDCDataAnalyzer::LoadAndAnalyzeData
void LoadAndAnalyzeData(size_t side, size_t module, const std::vector< float > &HGSamples, const std::vector< float > &LGSamples)
Definition: ZDCDataAnalyzer.cxx:430
ZDCDataAnalyzer::m_fail
std::array< bool, 2 > m_fail
Definition: ZDCDataAnalyzer.h:79
ZDCDataAnalyzer::m_calibModuleSumErrSq
std::array< float, 2 > m_calibModuleSumErrSq
Definition: ZDCDataAnalyzer.h:75
ZDCDataAnalyzer::SetNoiseSigmas
void SetNoiseSigmas(const ZDCModuleFloatArray &noiseSigmasHG, const ZDCModuleFloatArray &noiseSigmasLG)
Definition: ZDCDataAnalyzer.cxx:244
ZDCDataAnalyzer::m_averageTime
std::array< float, 2 > m_averageTime
Definition: ZDCDataAnalyzer.h:78
ZDCDataAnalyzer::SetADCOverUnderflowValues
void SetADCOverUnderflowValues(const ZDCModuleFloatArray &HGOverflowADC, const ZDCModuleFloatArray &HGUnderflowADC, const ZDCModuleFloatArray &LGOverflowADC)
Definition: ZDCDataAnalyzer.cxx:282
ZDCDataAnalyzer::m_currentLB
int m_currentLB
Definition: ZDCDataAnalyzer.h:55
ZDCDataAnalyzer::m_moduleSumPreSample
std::array< float, 2 > m_moduleSumPreSample
Definition: ZDCDataAnalyzer.h:71
ZDCPulseAnalyzer::SetSaveFitFunc
static void SetSaveFitFunc(bool save)
Definition: ZDCPulseAnalyzer.h:431
Preparation.mode
mode
Definition: Preparation.py:94
ZDCPulseAnalyzer::TimingCorrMode
TimingCorrMode
Definition: ZDCPulseAnalyzer.h:59
ZDCDataAnalyzer::m_calibModuleSum
std::array< float, 2 > m_calibModuleSum
Definition: ZDCDataAnalyzer.h:74
ZDCDataAnalyzer::SetFitMinMaxAmpValues
void SetFitMinMaxAmpValues(const ZDCModuleFloatArray &minAmpHG, const ZDCModuleFloatArray &minAmpLG, const ZDCModuleFloatArray &maxAmpHG, const ZDCModuleFloatArray &maxAmpLG)
Definition: ZDCDataAnalyzer.cxx:261
ZDCDataAnalyzer::SetTauT0Values
void SetTauT0Values(const ZDCModuleBoolArray &fxiTau1, const ZDCModuleBoolArray &fxiTau2, const ZDCModuleFloatArray &tau1, const ZDCModuleFloatArray &tau2, const ZDCModuleFloatArray &t0HG, const ZDCModuleFloatArray &t0LG)
Definition: ZDCDataAnalyzer.cxx:232
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: ZDCDataAnalyzer.cxx:13
ZDCDataAnalyzer::enableDelayed
void enableDelayed(float deltaT, const ZDCModuleFloatArray &undelayedDelayedPedestalDiff)
Definition: ZDCDataAnalyzer.cxx:109
ZDCDataAnalyzer::m_calibModSumBkgdFrac
std::array< float, 2 > m_calibModSumBkgdFrac
Definition: ZDCDataAnalyzer.h:76
lumiFormat.array
array
Definition: lumiFormat.py:91
ZDCMsg::Error
@ Error
Definition: ZDCMsg.h:22
tolerance
Definition: suep_shower.h:17
trapping_fp.h
Tell the compiler to optimize assuming that FP may trap.
ZDCDataAnalyzer::enablePostExclusion
void enablePostExclusion(unsigned int maxSamplesExcl, const ZDCModuleIntArray &HGADCThresh, const ZDCModuleIntArray &LGADCThresh)
Definition: ZDCDataAnalyzer.cxx:153
ZDCDataAnalyzer::ZDCDataAnalyzer
ZDCDataAnalyzer(ZDCMsg::MessageFunctionPtr messageFunc_p, int nSample, float deltaTSample, size_t preSampleIdx, std::string fitFunction, const ZDCModuleIntArray &peak2ndDerivMinSamples, const ZDCModuleFloatArray &peak2ndDerivMinThresholdsHG, const ZDCModuleFloatArray &peak2ndDerivMinThresholdsLG, unsigned int LGMode=ZDCPulseAnalyzer::LGModeNormal)
Definition: ZDCDataAnalyzer.cxx:15
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
ZDCDataAnalyzer::m_moduleSumErrSq
std::array< float, 2 > m_moduleSumErrSq
Definition: ZDCDataAnalyzer.h:70
ZDCMsg::MessageFunctionPtr
std::shared_ptr< MessageFunction > MessageFunctionPtr
Definition: ZDCMsg.h:14
ZDCDataAnalyzer::m_currentT0OffsetsHG
ZDCModuleFloatArray m_currentT0OffsetsHG
Definition: ZDCDataAnalyzer.h:57
ZDCDataAnalyzer::enablePreExclusion
void enablePreExclusion(unsigned int maxSamplesExcl, const ZDCModuleIntArray &HGADCThresh, const ZDCModuleIntArray &LGADCThresh)
Definition: ZDCDataAnalyzer.cxx:135
ZDCDataAnalyzer::SetNonlinCorrParams
void SetNonlinCorrParams(float refADC, float refScale, const std::array< std::array< std::vector< float >, 4 >, 2 > &HGNonlinCorrParams, const std::array< std::array< std::vector< float >, 4 >, 2 > &LHGNonlinCorrParams)
Definition: ZDCDataAnalyzer.cxx:318
ZDCDataAnalyzer::m_moduleStatus
std::array< std::array< unsigned int, 4 >, 2 > m_moduleStatus
Definition: ZDCDataAnalyzer.h:65
ZDCPulseAnalyzer::GetBkgdMaxFraction
float GetBkgdMaxFraction() const
Definition: ZDCPulseAnalyzer.h:633
ZDCDataAnalyzer::~ZDCDataAnalyzer
~ZDCDataAnalyzer()
Definition: ZDCDataAnalyzer.cxx:88
ZDCDataAnalyzer::disableModule
bool disableModule(size_t side, size_t module)
Definition: ZDCDataAnalyzer.cxx:92
ZDCDataAnalyzer::FinishEvent
bool FinishEvent()
Definition: ZDCDataAnalyzer.cxx:492
ZDCDataAnalyzer::ZDCModuleBoolArray
std::array< std::array< bool, 4 >, 2 > ZDCModuleBoolArray
Definition: ZDCDataAnalyzer.h:23
ZDCDataAnalyzer::m_currentECalibCoeff
ZDCModuleFloatArray m_currentECalibCoeff
Definition: ZDCDataAnalyzer.h:56
ZDCDataAnalyzer::m_currentT0OffsetsLG
ZDCModuleFloatArray m_currentT0OffsetsLG
Definition: ZDCDataAnalyzer.h:58
ZDCDataAnalyzer::m_LBDepEcalibSplines
std::array< std::array< std::unique_ptr< TSpline >, 4 >, 2 > m_LBDepEcalibSplines
Definition: ZDCDataAnalyzer.h:47
ZDCDataAnalyzer::SetFitTimeMax
void SetFitTimeMax(float tmax)
Definition: ZDCDataAnalyzer.cxx:218
LArCellBinning.step
step
Definition: LArCellBinning.py:158
ZDCMsg::Debug
@ Debug
Definition: ZDCMsg.h:19
ZDCDataAnalyzer::enableRepass
void enableRepass(const ZDCModuleFloatArray &peak2ndDerivMinRepassHG, const ZDCModuleFloatArray &peak2ndDerivMinRepassLG)
Definition: ZDCDataAnalyzer.cxx:172
ZDCDataAnalyzer::m_moduleDisabled
ZDCModuleBoolArray m_moduleDisabled
Definition: ZDCDataAnalyzer.h:38
ZDCDataAnalyzer::SetPeak2ndDerivMinTolerances
void SetPeak2ndDerivMinTolerances(size_t tolerance)
Definition: ZDCDataAnalyzer.cxx:209
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
checker_macros.h
Define macros for attributes used to control the static checker.
ZDCDataAnalyzer::SetSaveFitFunc
void SetSaveFitFunc(bool save)
Definition: ZDCDataAnalyzer.cxx:227
ZDCDataAnalyzer::SetGainFactorsHGLG
void SetGainFactorsHGLG(float gainFactorHG, float gainFactorLG)
Definition: ZDCDataAnalyzer.cxx:191
ZDCDataAnalyzer::SetTimingCorrParams
void SetTimingCorrParams(ZDCPulseAnalyzer::TimingCorrMode mode, float refADC, float refScale, const std::array< std::array< std::vector< float >, 4 >, 2 > &HGParamArr, const std::array< std::array< std::vector< float >, 4 >, 2 > &LGParamArr)
Definition: ZDCDataAnalyzer.cxx:305
ZDCDataAnalyzer::StartEvent
void StartEvent(int lumiBlock)
Definition: ZDCDataAnalyzer.cxx:342
ZDCDataAnalyzer::m_moduleAmpFractionLG
std::array< std::array< float, 4 >, 2 > m_moduleAmpFractionLG
Definition: ZDCDataAnalyzer.h:81
ZDCDataAnalyzer::m_delayedOrder
std::array< std::array< int, 4 >, 2 > m_delayedOrder
Definition: ZDCDataAnalyzer.h:36
ZDCPulseAnalyzer::GetPreSampleAmp
float GetPreSampleAmp() const
Definition: ZDCPulseAnalyzer.h:632
ZDCDataAnalyzer::SetModuleAmpFractionLG
void SetModuleAmpFractionLG(const ZDCDataAnalyzer::ZDCModuleFloatArray &moduleAmpFractionLG)
Definition: ZDCDataAnalyzer.cxx:253