25 m_writeAux(false), m_eventReady(false),
26 m_runNumber(0), m_lumiBlock(0),
27 m_zdcTriggerEfficiency(0)
30 #ifndef XAOD_STANDALONE
31 declareInterface<IZdcAnalysisTool>(
this);
77 declareProperty(
"RpdPostPulseFracThresh",
m_rpdPostPulseFracThresh = 0.15,
"If there is a good pulse and post-pulse and size of post-pulse as a fraction of good pulse is less than or equal to this number, ignore post-pulse");
111 std::unique_ptr<TFile>
file (TFile::Open(
filename.c_str(),
"READ"));
112 if (
file ==
nullptr ||
file->IsZombie())
122 std::stringstream Aalpha_name;
124 TSpline3* par_A_alpha = (TSpline3*)
file->GetObjectChecked(Aalpha_name.str().c_str(),
"TSpline3");
132 std::stringstream Abeta_name;
134 TSpline3* par_A_beta = (TSpline3*)
file->GetObjectChecked(Abeta_name.str().c_str(),
"TSpline3");
135 std::stringstream Atheta_name;
137 TSpline3* par_A_theta = (TSpline3*)
file->GetObjectChecked(Atheta_name.str().c_str(),
"TSpline3");
139 std::stringstream Calpha_name;
141 TSpline3* par_C_alpha = (TSpline3*)
file->GetObjectChecked(Calpha_name.str().c_str(),
"TSpline3");
142 std::stringstream Cbeta_name;
144 TSpline3* par_C_beta = (TSpline3*)
file->GetObjectChecked(Cbeta_name.str().c_str(),
"TSpline3");
145 std::stringstream Ctheta_name;
147 TSpline3* par_C_theta = (TSpline3*)
file->GetObjectChecked(Ctheta_name.str().c_str(),
"TSpline3");
149 std::stringstream Err_Aalpha_name;
150 Err_Aalpha_name <<
"A_alpha_error_" <<
runNumber;
151 TSpline3* parErr_A_alpha = (TSpline3*)
file->GetObjectChecked(Err_Aalpha_name.str().c_str(),
"TSpline3");
152 std::stringstream Err_Abeta_name;
153 Err_Abeta_name <<
"A_beta_error_" <<
runNumber;
154 TSpline3* parErr_A_beta = (TSpline3*)
file->GetObjectChecked(Err_Abeta_name.str().c_str(),
"TSpline3");
155 std::stringstream Err_Atheta_name;
156 Err_Atheta_name <<
"A_theta_error_" <<
runNumber;
157 TSpline3* parErr_A_theta = (TSpline3*)
file->GetObjectChecked(Err_Atheta_name.str().c_str(),
"TSpline3");
159 std::stringstream Err_Calpha_name;
160 Err_Calpha_name <<
"C_alpha_error_" <<
runNumber;
161 TSpline3* parErr_C_alpha = (TSpline3*)
file->GetObjectChecked(Err_Calpha_name.str().c_str(),
"TSpline3");
162 std::stringstream Err_Cbeta_name;
163 Err_Cbeta_name <<
"C_beta_error_" <<
runNumber;
164 TSpline3* parErr_C_beta = (TSpline3*)
file->GetObjectChecked(Err_Cbeta_name.str().c_str(),
"TSpline3");
165 std::stringstream Err_Ctheta_name;
166 Err_Ctheta_name <<
"C_theta_error_" <<
runNumber;
167 TSpline3* parErr_C_theta = (TSpline3*)
file->GetObjectChecked(Err_Ctheta_name.str().c_str(),
"TSpline3");
170 std::stringstream Cov_A_alpha_beta_name;
171 Cov_A_alpha_beta_name <<
"cov_A_alpha_beta_" <<
runNumber;
172 TSpline3* cov_A_alpha_beta = (TSpline3*)
file->GetObjectChecked(Cov_A_alpha_beta_name.str().c_str(),
"TSpline3");
173 std::stringstream Cov_A_alpha_theta_name;
174 Cov_A_alpha_theta_name <<
"cov_A_alpha_theta_" <<
runNumber;
175 TSpline3* cov_A_alpha_theta = (TSpline3*)
file->GetObjectChecked(Cov_A_alpha_theta_name.str().c_str(),
"TSpline3");
176 std::stringstream Cov_A_beta_theta_name;
177 Cov_A_beta_theta_name <<
"cov_A_beta_theta_" <<
runNumber;
178 TSpline3* cov_A_beta_theta = (TSpline3*)
file->GetObjectChecked(Cov_A_beta_theta_name.str().c_str(),
"TSpline3");
180 std::stringstream Cov_C_alpha_beta_name;
181 Cov_C_alpha_beta_name <<
"cov_C_alpha_beta_" <<
runNumber;
182 TSpline3* cov_C_alpha_beta = (TSpline3*)
file->GetObjectChecked(Cov_C_alpha_beta_name.str().c_str(),
"TSpline3");
183 std::stringstream Cov_C_alpha_theta_name;
184 Cov_C_alpha_theta_name <<
"cov_C_alpha_theta_" <<
runNumber;
185 TSpline3* cov_C_alpha_theta = (TSpline3*)
file->GetObjectChecked(Cov_C_alpha_theta_name.str().c_str(),
"TSpline3");
186 std::stringstream Cov_C_beta_theta_name;
187 Cov_C_beta_theta_name <<
"cov_C_beta_theta_" <<
runNumber;
188 TSpline3* cov_C_beta_theta = (TSpline3*)
file->GetObjectChecked(Cov_C_beta_theta_name.str().c_str(),
"TSpline3");
190 std::array<std::vector<TSpline3*>, 2> effparams;
191 std::array<std::vector<TSpline3*>, 2> effparamErrors;
192 std::array<std::vector<TSpline3*>, 2> effparamsCorrCoeffs;
194 effparams[0] = {par_C_alpha, par_C_beta, par_C_theta};
195 effparams[1] = {par_A_alpha, par_A_beta, par_A_theta};
196 effparamErrors[0] = {parErr_C_alpha, parErr_C_beta, parErr_C_theta};
197 effparamErrors[1] = {parErr_A_alpha, parErr_A_beta, parErr_A_theta};
198 effparamsCorrCoeffs[0] = {cov_C_alpha_beta, cov_C_alpha_theta, cov_C_beta_theta};
199 effparamsCorrCoeffs[1] = {cov_A_alpha_beta, cov_A_alpha_theta, cov_A_beta_theta};
223 {0, 1.1, 1.1, 1.1}}};
231 for (
size_t side : {0, 1}) {
232 for (
size_t module : {0, 1, 2, 3}) {
236 peak2ndDerivMinThresholdsHG[
side][
module] = -35;
237 peak2ndDerivMinThresholdsLG[
side][
module] = -16;
245 ATH_MSG_DEBUG(
"LHCF2022: delta t cut, value low = " << deltaT0CutLow[0][0] <<
", high = " << deltaT0CutHigh[0][0] );
260 peak2ndDerivMinSamples,
261 peak2ndDerivMinThresholdsHG,
262 peak2ndDerivMinThresholdsLG,
267 zdcDataAnalyzer->
SetTauT0Values(fixTau1Arr, fixTau2Arr, tau1, tau2, t0HG, t0LG);
268 zdcDataAnalyzer->
SetCutValues(chisqDivAmpCut, chisqDivAmpCut, deltaT0CutLow, deltaT0CutHigh, deltaT0CutLow, deltaT0CutHigh);
280 {-12, -12, -12, -12}}};
285 zdcDataAnalyzer->
enableRepass(peak2ndDerivMinRepassHG, peak2ndDerivMinRepassLG);
298 rpdConfig.nColumns = 4;
314 return zdcDataAnalyzer;
331 {1.1, 1.1, 1.1, 1.1}}};
339 const int deriv2ndThreshDSHG = -35;
340 const int deriv2ndThreshDSLG = -10;
342 const float deltaTcutLow = -10;
343 const float deltaTcutHigh = 10;
344 const float chisqDivAmpCutVal = 10;
346 for (
size_t side : {0, 1}) {
347 for (
size_t module : {0, 1, 2, 3}) {
351 peak2ndDerivMinThresholdsHG[
side][
module] = deriv2ndThreshDSHG;
352 peak2ndDerivMinThresholdsLG[
side][
module] = deriv2ndThreshDSLG;
356 chisqDivAmpCut[
side][
module] = chisqDivAmpCutVal;
360 ATH_MSG_DEBUG(
"pp2023: delta t cut, value low = " << deltaT0CutLow[0][0] <<
", high = " << deltaT0CutHigh[0][0] );
371 peak2ndDerivMinSamples,
372 peak2ndDerivMinThresholdsHG,
373 peak2ndDerivMinThresholdsLG,
378 zdcDataAnalyzer->
SetTauT0Values(fixTau1Arr, fixTau2Arr, tau1, tau2, t0HG, t0LG);
379 zdcDataAnalyzer->
SetCutValues(chisqDivAmpCut, chisqDivAmpCut, deltaT0CutLow, deltaT0CutHigh, deltaT0CutLow, deltaT0CutHigh);
391 {-12, -12, -12, -12}}};
396 zdcDataAnalyzer->
enableRepass(peak2ndDerivMinRepassHG, peak2ndDerivMinRepassLG);
405 rpdConfig.nColumns = 4;
421 return zdcDataAnalyzer;
432 const int deriv2ndThreshDSHG = -25;
433 const int deriv2ndThreshDSLG = -10;
434 const unsigned int peakSample = 10;
436 const float deltaTcutLow = -10;
437 const float deltaTcutHigh = 10;
438 const float chisqDivAmpCutHGVal = 30;
439 const float chisqDivAmpCutLGVal = 50;
449 {1.1, 1.1, 1.1, 1.1}}};
456 for (
size_t side : {0, 1}) {
457 for (
size_t module : {0, 1, 2, 3}) {
461 peak2ndDerivMinSamples[
side][
module] = peakSample;
462 peak2ndDerivMinThresholdsHG[
side][
module] = deriv2ndThreshDSHG;
463 peak2ndDerivMinThresholdsLG[
side][
module] = deriv2ndThreshDSLG;
467 chisqDivAmpCutLG[
side][
module] = chisqDivAmpCutLGVal;
468 chisqDivAmpCutHG[
side][
module] = chisqDivAmpCutHGVal;
472 ATH_MSG_DEBUG(
"PbPb2023: delta t cut, value low = " << deltaT0CutLow[0][0] <<
", high = " << deltaT0CutHigh[0][0] );
479 peak2ndDerivMinSamples,
480 peak2ndDerivMinThresholdsHG,
481 peak2ndDerivMinThresholdsLG,
506 zdcDataAnalyzer->
SetTauT0Values(fixTau1Arr, fixTau2Arr, tau1, tau2, t0HG, t0LG);
507 zdcDataAnalyzer->
SetCutValues(chisqDivAmpCutHG, chisqDivAmpCutLG, deltaT0CutLow, deltaT0CutHigh, deltaT0CutLow, deltaT0CutHigh);
512 {-10, -10, -10, -10}}};
517 zdcDataAnalyzer->
enableRepass(peak2ndDerivMinRepassHG, peak2ndDerivMinRepassLG);
526 std::array<std::array<std::vector<float>, 4>, 2> nonLinearCorrCoefficHG, nonLinearCorrCoefficLG;
528 nonLinearCorrCoefficHG = {{ {{{-0.039464, 0.013250, -0.003676},
529 {-0.050573, 0.019664, -0.004340},
530 {-0.052816, 0.016221, -0.003364},
531 {-0.014327, 0.000226, -0.000943}}},
532 {{{-0.059663, 0.019482, -0.004615},
533 {-0.036908, 0.008920, -0.002805},
534 {-0.046814, 0.019434, -0.004207},
535 {-0.060879, 0.026635, -0.004833}}} }};
539 nonLinearCorrCoefficLG = {{ {{{0},
548 zdcDataAnalyzer->
SetNonlinCorrParams(0, 1000, nonLinearCorrCoefficHG, nonLinearCorrCoefficLG);
550 std::array<std::array<std::vector<float>, 4>, 2> timeCorrCoefficHG, timeCorrCoefficLG;
551 timeCorrCoefficHG[0][0] = {0.07, -0.020672, 0.070206, 0.004961, -0.010821, -0.001835};
552 timeCorrCoefficHG[0][1] = {0.04, -0.012961, 0.008204, 0.010771, 0.011593, 0.002045};
553 timeCorrCoefficHG[0][2] = {0.04, 0.017393, 0.017597, 0.003736, -0.001696, -0.000465};
554 timeCorrCoefficHG[0][3] = {0.04, 0.018463, 0.009862, -0.000277, -0.000268, 0.000192};
556 timeCorrCoefficHG[1][0] = {0.13, -0.106068, 0.078153, 0.034479, -0.004964, -0.001688};
557 timeCorrCoefficHG[1][1] = {0.03, -0.007518, 0.008937, 0.015319, 0.012290, 0.001889};
558 timeCorrCoefficHG[1][2] = {-0.01, 0.006711, -0.001652, -0.004223, -0.000573, 0.000161};
559 timeCorrCoefficHG[1][3] = {0.015, 0.017993, 0.006339, 0.003122, 0.002980, 0.000735};
561 timeCorrCoefficLG[0][0] = {0.035, -0.126189, 0.022724, 0.039116, -0.098255};
562 timeCorrCoefficLG[0][1] = {0.022, -0.165988, -0.014125, 0.057323, -0.205109};
563 timeCorrCoefficLG[0][2] = {0.01, -0.136087, -0.007248, -0.014452, -0.060469};
564 timeCorrCoefficLG[0][3] = {0.0, -0.131067, 0.025579, 0.059994, -0.065595};
566 timeCorrCoefficLG[1][0] = {0.076, -0.300587, -0.041827, 0.641108, -0.594157};
567 timeCorrCoefficLG[1][1] = {0.057, -0.223443, -0.125013, -0.176900, 0.348081};
568 timeCorrCoefficLG[1][2] = {0.015, -0.141721, 0.023936, 0.099657, -0.188526};
569 timeCorrCoefficLG[1][3] = {0.01, -0.152589, 0.016122, -0.086580, 0.563625};
579 rpdConfig.nColumns = 4;
595 return zdcDataAnalyzer;
619 for (
size_t side : {0, 1}) {
620 for (
size_t module : {0, 1, 2, 3}) {
637 ATH_MSG_DEBUG(
"Default: delta t cut, value low = " << deltaT0CutLow[0][0] <<
", high = " << deltaT0CutHigh[0][0] );
646 peak2ndDerivMinThresholdsHG, peak2ndDerivMinThresholdsLG,
m_lowGainOnly));
650 zdcDataAnalyzer->
SetCutValues(chisqDivAmpCut, chisqDivAmpCut, deltaT0CutLow, deltaT0CutHigh, deltaT0CutLow, deltaT0CutHigh);
658 return zdcDataAnalyzer;
669 const int peakSample = 4;
670 const float peak2ndDerivThreshHG = -12;
671 const float peak2ndDerivThreshLG = -10;
673 {4.000, 4.000, 4.000, 4.000}}};
675 {25.11, 25.08, 25.18, 25.48}}};
678 {57.28, 57.29, 57.31, 57.33}}};
680 {57.28, 57.29, 57.31, 57.33}}};
688 for (
size_t side : {0, 1}) {
689 for (
size_t module : {0, 1, 2, 3}) {
693 peak2ndDerivMinSamples[
side][
module] = peakSample;
694 peak2ndDerivMinThresholdsHG[
side][
module] = peak2ndDerivThreshHG;
695 peak2ndDerivMinThresholdsLG[
side][
module] = peak2ndDerivThreshLG;
708 peak2ndDerivMinThresholdsHG, peak2ndDerivMinThresholdsLG,
m_lowGainOnly));
715 zdcDataAnalyzer->
SetTauT0Values(fixTau1Arr, fixTau2Arr, tau1Arr, tau2Arr, t0HG, t0LG);
716 zdcDataAnalyzer->
SetCutValues(chisqDivAmpCut, chisqDivAmpCut, DeltaT0CutLowHG, DeltaT0CutHighHG, DeltaT0CutLowLG, DeltaT0CutHighLG);
721 return zdcDataAnalyzer;
737 const int peakSample = 5;
738 const float peak2ndDerivThreshHG = -12;
739 const float peak2ndDerivThreshLG = -10;
741 {4.472, 4.656, 3.871, 4.061}
745 {24.17, 24.22, 25.46, 24.45}
749 {75.11, 74.94, 73.93, 74.45}
752 {76.28, 76.07, 74.98, 76.54}
762 for (
size_t side : {0, 1}) {
763 for (
size_t module : {0, 1, 2, 3}) {
767 peak2ndDerivMinSamples[
side][
module] = peakSample;
768 peak2ndDerivMinThresholdsHG[
side][
module] = peak2ndDerivThreshHG;
769 peak2ndDerivMinThresholdsLG[
side][
module] = peak2ndDerivThreshLG;
779 std::array<std::array<std::vector<float>, 4>, 2> slewingParamsHG, slewingParamsLG;
781 slewingParamsHG[0][0] = {0, 0, 0, 0};
782 slewingParamsHG[0][1] = { -4.780244e-01, -7.150874e-02, 4.614585e-02, 8.015731e-04};
783 slewingParamsHG[0][2] = { -5.253412e-01, -5.718167e-02, 5.243121e-02, 2.128398e-03};
784 slewingParamsHG[0][3] = { -5.773952e-01, -5.687478e-02, 4.564267e-02, 1.462294e-03};
786 slewingParamsHG[1][0] = { 7.105115e-01, -3.686143e-02, 7.727447e-02, 5.924152e-03};
787 slewingParamsHG[1][1] = { 4.052120e-02, 4.450686e-03, 8.031615e-02, 4.038097e-03};
788 slewingParamsHG[1][2] = { 3.389476e-02, -2.056782e-02, 4.805321e-02, -2.627999e-03};
789 slewingParamsHG[1][3] = { 2.069765e-01, -2.890419e-02, 6.084375e-02, 3.742011e-03};
791 slewingParamsLG[0][0] = {0, 0, 0, 0};
792 slewingParamsLG[0][1] = { -1.632547e+00, -4.827813e-01, -1.379131e-01, -2.522607e-02};
793 slewingParamsLG[0][2] = { -7.254288e+00, -5.454064e+00, -1.619126e+00, -1.739665e-01};
794 slewingParamsLG[0][3] = { -1.548400e+01, -1.277708e+01, -3.729333e+00, -3.700458e-01};
796 slewingParamsLG[1][0] = { 1.142767e-01, -3.608906e-02, 9.642735e-02, -3.097043e-03};
797 slewingParamsLG[1][1] = { -5.615388e-01, -1.655047e-02, 8.327350e-02, -4.231348e-03};
798 slewingParamsLG[1][2] = { -7.370728e-01, -2.887482e-02, 8.293875e-02, -4.482743e-03};
799 slewingParamsLG[1][3] = { -1.270636e+00, -2.791777e-01, -5.807295e-02, -2.332612e-02};
806 peak2ndDerivMinThresholdsHG, peak2ndDerivMinThresholdsLG,
m_lowGainOnly));
817 zdcDataAnalyzer->
SetTauT0Values(fixTau1Arr, fixTau2Arr, tau1Arr, tau2Arr, t0HG, t0LG);
818 zdcDataAnalyzer->
SetCutValues(chisqDivAmpCut, chisqDivAmpCut, DeltaT0CutLowHG, DeltaT0CutHighHG, DeltaT0CutLowLG, DeltaT0CutHighLG);
826 zdcDataAnalyzer->
enableDelayed(-12.5, defaultPedestalShifts);
830 slewingParamsHG, slewingParamsLG);
833 return zdcDataAnalyzer;
843 static constexpr
int peakSample = 5;
844 static constexpr
float peak2ndDerivThreshHG = -35;
845 static constexpr
float peak2ndDerivThreshLG = -20;
846 static constexpr
float peak2ndDerivRepassHG = -10;
847 static constexpr
float peak2ndDerivRepassLG = -6;
850 {4.296, 4.064, 3.497, 3.642}
854 {24.42, 24.99, 25.72, 25.29}
858 {74.18, 72.79, 71.77, 72.62}
861 {75.16, 73.71, 72.25, 73.61}
865 {0.3216, 0.2593, 0.2511, 0.1680}
874 for (
size_t side : {0, 1}) {
875 for (
size_t module : {0, 1, 2, 3}) {
879 peak2ndDerivMinSamples[
side][
module] = peakSample;
880 peak2ndDerivMinThresholdsHG[
side][
module] = peak2ndDerivThreshHG;
881 peak2ndDerivMinThresholdsLG[
side][
module] = peak2ndDerivThreshLG;
882 peak2ndDerivMinRepassHG [
side][
module] = peak2ndDerivRepassHG;
883 peak2ndDerivMinRepassLG [
side][
module] = peak2ndDerivRepassLG;
897 std::array<std::array<std::vector<float>, 4>, 2> slewingParamsHG, slewingParamsLG;
899 slewingParamsHG[0][0] = { -1.335560e-01, -6.071869e-03, 5.858193e-02, 2.473300e-03};
900 slewingParamsHG[0][1] = { -1.223062e-01, -4.379469e-02, 4.452285e-02, 2.130210e-03};
901 slewingParamsHG[0][2] = { -1.021415e-01, -4.254239e-02, 4.939866e-02, 3.849738e-03};
902 slewingParamsHG[0][3] = { -8.234056e-02, -3.938803e-02, 4.689029e-02, 2.784816e-03};
904 slewingParamsHG[1][0] = { -1.640979e-01, -2.780350e-02, 5.755065e-02, -4.244651e-04};
905 slewingParamsHG[1][1] = { -1.422324e-01, 2.663803e-02, 7.295366e-02, 3.740496e-03};
906 slewingParamsHG[1][2] = { -9.858124e-02, -2.426132e-02, 4.895967e-02, 2.291393e-03};
907 slewingParamsHG[1][3] = { -1.070401e-01, -2.256383e-03, 5.833770e-02, 2.255208e-03};
909 slewingParamsLG[0][0] = { -2.588446e-01, -3.241086e-02, 7.828661e-02, 1.945547e-03};
910 slewingParamsLG[0][1] = { -3.112495e-01, -7.419508e-02, 6.825776e-02, 2.148860e-03};
911 slewingParamsLG[0][2] = { -3.470650e-01, -5.836748e-02, 6.204396e-02, 1.550421e-03};
912 slewingParamsLG[0][3] = { -4.485435e-01, -4.603790e-02, 5.944799e-02, -1.174585e-03};
914 slewingParamsLG[1][0] = { -3.291676e-01, -4.023732e-02, 8.608755e-02, -3.958167e-03};
915 slewingParamsLG[1][1] = { -2.608969e-01, -2.129786e-03, 6.930791e-02, -4.141910e-03};
916 slewingParamsLG[1][2] = { -2.505712e-01, -2.195804e-02, 5.137261e-02, -4.058378e-03};
917 slewingParamsLG[1][3] = { -5.083206e-01, 3.776601e-02, 1.284275e-01, 1.014067e-02};
923 std::unique_ptr<ZDCDataAnalyzer> zdcDataAnalyzer = std::make_unique<ZDCDataAnalyzer>(
MakeMessageFunction(), 7, 25, 0,
"FermiExpLinear", peak2ndDerivMinSamples,
924 peak2ndDerivMinThresholdsHG, peak2ndDerivMinThresholdsLG,
m_lowGainOnly);
934 zdcDataAnalyzer->
SetTauT0Values(fixTau1Arr, fixTau2Arr, tau1Arr, tau2Arr, t0HG, t0LG);
936 zdcDataAnalyzer->
SetCutValues(chisqDivAmpCut, chisqDivAmpCut, DeltaT0CutLowHG, DeltaT0CutHighHG, DeltaT0CutLowLG, DeltaT0CutHighLG);
946 {{ -12.5, -12.5, -12.5, -12.5}}
950 zdcDataAnalyzer->
enableDelayed(delayDeltaTs, defaultPedestalShifts);
953 zdcDataAnalyzer->
enableRepass(peak2ndDerivMinRepassHG, peak2ndDerivMinRepassLG);
955 slewingParamsHG, slewingParamsLG);
960 return zdcDataAnalyzer;
969 {{5.0, 3.7, 3.5, 3.5}}
975 {{19.1, 21.9, 22.6, 23.4}}
1001 bool fixTau1 =
true;
1002 bool fixTau2 =
true;
1004 for (
size_t side : {0, 1}) {
1005 for (
size_t module : {0, 1, 2, 3}) {
1012 {{46.314, 42.267, 50.327, 41.605}}
1016 {{44.295, 41.755, 48.081, 40.175}}
1028 std::array<std::array<std::vector<float>, 4>, 2> slewingParamsHG, slewingParamsLG;
1030 slewingParamsHG[0][0] = {0, -7.904e-02, 4.686e-02, 1.530e-03 };
1031 slewingParamsHG[0][1] = {0, 2.250e-02, 4.732e-02, 6.050e-03 };
1032 slewingParamsHG[0][2] = {0, 4.388e-02, 6.707e-02, -5.526e-05 };
1033 slewingParamsHG[0][3] = {0, 1.205e-01, 2.726e-02, 2.610e-03 };
1035 slewingParamsHG[1][0] = {0, 6.861e-02, 5.175e-03, -9.018e-04 };
1036 slewingParamsHG[1][1] = {0, 3.855e-01, -4.442e-02, -2.022e-02 };
1037 slewingParamsHG[1][2] = {0, -4.337e-03, 3.841e-02, 4.661e-03 };
1038 slewingParamsHG[1][3] = {0, 3.623e-01, -3.882e-02, -1.805e-02 };
1040 slewingParamsLG[0][0] = {0, 1.708e-02, 7.929e-02, 5.079e-03 };
1041 slewingParamsLG[0][1] = {0, 1.406e-01, 1.209e-01, -1.922e-04 };
1042 slewingParamsLG[0][2] = {0, 1.762e-01, 1.118e-01, 1.679e-04 };
1043 slewingParamsLG[0][3] = {0, 1.361e-02, -2.685e-02, -4.168e-02 };
1045 slewingParamsLG[1][0] = {0, 1.962e-01, -5.025e-03, -2.001e-02 };
1046 slewingParamsLG[1][1] = {0, 3.258e-01, 1.229e-02, -2.925e-02 };
1047 slewingParamsLG[1][2] = {0, 1.393e-01, 8.113e-02, -2.594e-03 };
1048 slewingParamsLG[1][3] = {0, 1.939e-01, 2.188e-02, -5.579e-02 };
1051 peak2ndDerivMinThresholdsHG, peak2ndDerivMinThresholdsLG,
m_lowGainOnly));
1055 m_zdcDataAnalyzer_40MHz->SetCutValues(chisqDivAmpCutHG, chisqDivAmpCutLG, DeltaT0CutLowHG, DeltaT0CutHighHG, DeltaT0CutLowLG, DeltaT0CutHighLG);
1057 slewingParamsHG, slewingParamsLG);
1059 std::array<std::array<std::vector<float>, 4>, 2> moduleHGNonLinCorr, moduleLGNonLinCorr;
1060 moduleHGNonLinCorr[0][0] = { -3.76800e-02, 4.63597e-02};
1061 moduleHGNonLinCorr[0][1] = { -1.02185e-01, -1.17548e-01};
1062 moduleHGNonLinCorr[0][2] = { -8.78451e-02, -1.52174e-01};
1063 moduleHGNonLinCorr[0][3] = { -1.04835e-01, -1.96514e-01};
1064 moduleHGNonLinCorr[1][0] = { -6.83115e-02, 3.57802e-02};
1065 moduleHGNonLinCorr[1][1] = { -1.08162e-01, -1.91413e-01};
1066 moduleHGNonLinCorr[1][2] = { -7.82514e-02, -1.21218e-01};
1067 moduleHGNonLinCorr[1][3] = { -2.34354e-02, -2.52033e-01};
1069 moduleLGNonLinCorr = {{ {{{0},
1110 bool fixTau1 =
true;
1111 bool fixTau2 =
true;
1113 for (
size_t side : {0, 1}) {
1114 for (
size_t module : {0, 1, 2, 3}) {
1121 {{4.2, 3.6, 3.3, 3.4}}
1126 {{19.1, 21.9, 22.6, 23.4}}
1131 {{36.0, 31.1, 40.75, 30.5}}
1136 {{33.7, 29.9, 39.0, 29.3}}
1147 std::array<std::array<std::vector<float>, 4>, 2> slewingParamsHG, slewingParamsLG;
1149 slewingParamsHG[0][0] = {0, -6.5e-2, 2.85e-2, -2.83e-3};
1150 slewingParamsHG[0][1] = {0, -5.5e-2, 5.13e-2, 5.6e-3};
1151 slewingParamsHG[0][2] = {0, -1.45e-3, 9.3e-2, 3.9e-3};
1152 slewingParamsHG[0][3] = {0, -2.36e-2, 8.3e-2, 1.1e-3};
1154 slewingParamsHG[1][0] = {0, -6.5e-2, 4.84e-2, -3.7e-3};
1155 slewingParamsHG[1][1] = {0, 1.34e-2, 6.57e-2, 5.37e-3};
1156 slewingParamsHG[1][2] = {0, -5.37e-2, 3.49e-2, 3.8e-3};
1157 slewingParamsHG[1][3] = {0, -3.3e-2, 3.9e-2, 2.2e-3};
1159 slewingParamsLG[0][0] = {0, -9.6e-2, 4.39e-2, 2.93e-3 };
1160 slewingParamsLG[0][1] = {0, -5.0e-2, 14.9e-2, 20.6e-3 };
1161 slewingParamsLG[0][2] = {0, -4.4e-2, 5.3e-2, 0, };
1162 slewingParamsLG[0][3] = {0, -9.90e-2, 4.08e-2, 0, };
1164 slewingParamsLG[1][0] = {0, -8.7e-2, 4.2e-2, -3.2e-3 };
1165 slewingParamsLG[1][1] = {0, -3.26e-2, 3.84e-2, -2.32e-3};
1166 slewingParamsLG[1][2] = {0, -26.8e-2, -2.64e-2, -5.3e-3 };
1167 slewingParamsLG[1][3] = {0, -13.2e-2, 0.45e-2, -2.4e-3 };
1175 m_zdcDataAnalyzer_80MHz->SetCutValues(chisqDivAmpCutHG, chisqDivAmpCutLG, DeltaT0CutLowHG, DeltaT0CutHighHG, DeltaT0CutLowLG, DeltaT0CutHighLG);
1177 slewingParamsHG, slewingParamsLG);
1179 std::array<std::array<std::vector<float>, 4>, 2> moduleHGNonLinCorr, moduleLGNonLinCorr;
1180 moduleHGNonLinCorr[0][0] = { -3.76800e-02, 4.63597e-02};
1181 moduleHGNonLinCorr[0][1] = { -1.02185e-01, -1.17548e-01};
1182 moduleHGNonLinCorr[0][2] = { -8.78451e-02, -1.52174e-01};
1183 moduleHGNonLinCorr[0][3] = { -1.04835e-01, -1.96514e-01};
1184 moduleHGNonLinCorr[1][0] = { -6.83115e-02, 3.57802e-02};
1185 moduleHGNonLinCorr[1][1] = { -1.08162e-01, -1.91413e-01};
1186 moduleHGNonLinCorr[1][2] = { -7.82514e-02, -1.21218e-01};
1187 moduleHGNonLinCorr[1][3] = { -2.34354e-02, -2.52033e-01};
1189 moduleLGNonLinCorr = {{ {{{0},
1224 ATH_MSG_ERROR(
"Invalid settings: Forced run > 0 but lumi block < 0");
1225 return StatusCode::FAILURE;
1260 return StatusCode::FAILURE;
1379 return StatusCode::SUCCESS;
1403 return StatusCode::SUCCESS;
1410 if (moduleContainer.
size()==0)
return StatusCode::SUCCESS;
1413 if (!eventInfo.
isValid())
return StatusCode::FAILURE;
1417 unsigned int thisRunNumber = eventInfo->
runNumber();
1419 ATH_MSG_DEBUG(
"ZDC analysis tool will be configured for run " << thisRunNumber);
1429 unsigned int calibRunNumber = thisRunNumber;
1461 const std::vector<unsigned short>* adcUndelayLG = 0;
1462 const std::vector<unsigned short>* adcUndelayHG = 0;
1464 const std::vector<unsigned short>* adcDelayLG = 0;
1465 const std::vector<unsigned short>* adcDelayHG = 0;
1468 for (
const auto zdcModule : moduleContainer)
1471 if (zdcModule->zdcSide() == -1)
side = 0;
1472 else if (zdcModule->zdcSide() == 1)
side = 1;
1476 ATH_MSG_WARNING(
"Invalid side value found for module number: " << zdcModule->zdcModule() <<
", side value = " <<
side);
1480 if(zdcModule->zdcModule() > 4)
continue;
1482 if (zdcModule->zdcType() == 1) {
1488 unsigned int rpdChannel = zdcModule->zdcChannel();
1489 if (rpdChannel > 15) {
1493 ATH_MSG_WARNING(
"Invalid RPD channel found on side " <<
side <<
", channel number = " << rpdChannel <<
", skipping this module");
1501 g0dataAcc (*zdcModule));
1510 adcUndelayLG = &g0dataAcc(*zdcModule);
1511 adcUndelayHG = &g1dataAcc(*zdcModule);
1515 if (zdcModule->zdcType() == 1)
continue;
1524 adcUndelayLG = &g0d1dataAcc(*zdcModule);
1525 adcUndelayHG = &g1d1dataAcc(*zdcModule);
1526 adcDelayLG = &g0d0dataAcc(*zdcModule);
1527 adcDelayHG = &g1d0dataAcc(*zdcModule);
1531 adcUndelayLG = &g0d0dataAcc(*zdcModule);
1532 adcUndelayHG = &g1d0dataAcc(*zdcModule);
1533 adcDelayLG = &g0d1dataAcc(*zdcModule);
1534 adcDelayHG = &g1d1dataAcc(*zdcModule);
1540 return StatusCode::FAILURE;
1544 std::vector<float> HGUndelADCSamples(
m_numSample);
1545 std::vector<float> LGUndelADCSamples(
m_numSample);
1547 std::copy(adcUndelayLG->begin(), adcUndelayLG->end(), LGUndelADCSamples.begin());
1548 std::copy(adcUndelayHG->begin(), adcUndelayHG->end(), HGUndelADCSamples.begin());
1550 int side = (zdcModule->zdcSide() == -1) ? 0 : 1 ;
1553 m_zdcDataAnalyzer->LoadAndAnalyzeData(
side, zdcModule->zdcModule(), HGUndelADCSamples, LGUndelADCSamples);
1556 std::vector<float> HGDelayADCSamples(
m_numSample);
1557 std::vector<float> LGDelayADCSamples(
m_numSample);
1558 if (adcDelayLG and adcDelayHG){
1559 std::copy(adcDelayLG->begin(), adcDelayLG->end(), LGDelayADCSamples.begin());
1560 std::copy(adcDelayHG->begin(), adcDelayHG->end(), HGDelayADCSamples.begin());
1562 ATH_MSG_ERROR(
"adcDelayLG or adcDelayHG pointers are null");
1563 return StatusCode::FAILURE;
1570 HGUndelADCSamples, LGUndelADCSamples,
1571 HGDelayADCSamples, LGDelayADCSamples);
1631 for (
const auto zdcModule : moduleContainer)
1633 int side = (zdcModule->zdcSide() == -1) ? 0 : 1 ;
1634 int mod = zdcModule->zdcModule();
1636 if(
mod > 4)
continue;
1638 if (zdcModule->zdcType() == 1 &&
m_LHCRun==3) {
1641 int rpdChannel = zdcModule->zdcChannel();
1643 rpdChannelPileupExpFitParams(*zdcModule) =
m_rpdDataAnalyzer.at(
side)->getChPileupExpFitParams(rpdChannel);
1644 rpdChannelPileupStretchedExpFitParams(*zdcModule) =
m_rpdDataAnalyzer.at(
side)->getChPileupStretchedExpFitParams(rpdChannel);
1645 rpdChannelPileupExpFitParamErrs(*zdcModule) =
m_rpdDataAnalyzer.at(
side)->getChPileupExpFitParamErrs(rpdChannel);
1646 rpdChannelPileupStretchedExpFitParamErrs(*zdcModule) =
m_rpdDataAnalyzer.at(
side)->getChPileupStretchedExpFitParamErrs(rpdChannel);
1647 rpdChannelPileupExpFitMSE(*zdcModule) =
m_rpdDataAnalyzer.at(
side)->getChPileupExpFitMSE(rpdChannel);
1648 rpdChannelPileupStretchedExpFitMSE(*zdcModule) =
m_rpdDataAnalyzer.at(
side)->getChPileupStretchedExpFitMSE(rpdChannel);
1657 }
else if (zdcModule->zdcType() == 0) {
1662 zdcModuleCalibEnergy(*zdcModule) = calibEnergy;
1667 zdcModuleCalibEnergy(*zdcModule) = -1000;
1668 zdcModuleCalibTime(*zdcModule) = -1000;
1676 zdcModuleChisq(*zdcModule) = pulseAna_p->
GetChisq();
1678 zdcModuleFitAmpError(*zdcModule) = pulseAna_p->
GetAmpError();
1679 zdcModuleFitT0(*zdcModule) = pulseAna_p->
GetFitT0();
1682 zdcModulePresample(*zdcModule) = pulseAna_p->
GetPresample();
1684 zdcModuleMaxADC(*zdcModule) = pulseAna_p->
GetMaxADC();
1705 for (
const auto zdc_sum: moduleSumContainer)
1707 ATH_MSG_DEBUG(
"Extracting ZDC side " << zdc_sum->zdcSide());
1709 if (zdc_sum->zdcSide()==0)
continue;
1711 int iside = (zdc_sum->zdcSide()==-1) ? 0 : 1;
1714 zdcSumUncalibSum(*zdc_sum) = uncalibSum;
1716 zdcSumUncalibSumErr(*zdc_sum) = uncalibSumErr;
1719 zdcSumCalibEnergy(*zdc_sum) = calibEnergy;
1721 zdcSumCalibEnergyErr(*zdc_sum) = calibEnergyErr;
1723 float finalEnergy = calibEnergy;
1724 zdcSumFinalEnergy(*zdc_sum) = finalEnergy;
1727 zdcSumModuleMask(*zdc_sum) = (
getModuleMask() >> (4 * iside)) & 0xF;
1734 return StatusCode::SUCCESS;
1758 std::unique_ptr<TFile> fCalib (TFile::Open(
filename.c_str(),
"READ"));
1760 if (fCalib ==
nullptr || fCalib->IsZombie())
1763 throw std::runtime_error (
"failed to open file " +
filename);
1766 std::array<std::array<std::unique_ptr<TSpline>, 4>, 2> splines;
1769 TString calibVersion;
1772 for (
int iside = 0; iside < 2; iside++)
1774 for (
int imod = 0; imod < 4; imod++)
1776 sprintf(
name,
"ZDC_Ecalib_run%u_s%d_m%d",
runNumber, iside, imod);
1778 TSpline3*
s = (TSpline3*) fCalib->GetObjectChecked(calibVersion+TString(
name),
"TSpline3");
1787 splines[iside][imod].reset (
s);
1816 ATH_MSG_WARNING(
"No LHC Run defined, so no time calibration allowed");
1820 char name[128] = {0};
1822 std::unique_ptr<TFile> fCalib (TFile::Open(
filename.c_str(),
"READ"));
1825 TString calibVersion =
"";
1828 if (fCalib && !fCalib->IsZombie())
1830 bool success =
true;
1831 std::array<std::array<std::unique_ptr<TSpline>, 4>, 2> T0HGOffsetSplines;
1832 std::array<std::array<std::unique_ptr<TSpline>, 4>, 2> T0LGOffsetSplines;
1833 std::unique_ptr<TSpline3> spline;
1834 for (
int iside = 0; iside < 2; iside++)
1836 for (
int imod = 0; imod < 4; imod++)
1838 sprintf(
name,
"ZDC_T0calib_run%u_HG_s%d_m%d",
runNumber, iside, imod);
1839 spline.reset (
static_cast<TSpline3*
>(fCalib->GetObjectChecked(calibVersion+TString(
name),
"TSpline3")));
1842 T0HGOffsetSplines[iside][imod] = std::move (spline);
1850 sprintf(
name,
"ZDC_T0calib_run%u_LG_s%d_m%d",
runNumber, iside, imod);
1851 spline.reset (
static_cast<TSpline3*
>(fCalib->GetObjectChecked(calibVersion+TString(
name),
"TSpline3")));
1854 T0LGOffsetSplines[iside][imod] = std::move (spline);
1882 return StatusCode::FAILURE;
1897 return StatusCode::SUCCESS;
1902 size_t nsamp =
adc.size();
1903 float presamp =
adc.at(0);
1904 unsigned short max_adc = 0;
1906 for (
size_t i = 0;
i < nsamp;
i++)
1908 if (
adc[
i] > max_adc)
1914 amp = max_adc - presamp;
1915 time = max_index * deltaT;
1918 if (max_index == -1)
1929 size_t nsamp =
adc.size();
1930 float presamp =
adc.at(0);
1932 for (
size_t i = 0;
i < nsamp;
i++)
2007 return eff_pair.second;