15 std::vector<double> zeroVec(npar, 0.0);
32 void ZDCFitWrapper::Initialize(
float initialAmp,
float initialT0,
float ampMin,
float ampMax,
float fitTmin,
float fitTmax,
float fitTRef)
38 std::vector<double> zeroVec(npar, 0.0);
56 m_fixTau1(fixTau1), m_fixTau2(fixTau2), m_tau1(tau1), m_tau2(tau2)
60 theTF1->SetParName(0,
"Amp");
61 theTF1->SetParName(1,
"T0");
62 theTF1->SetParName(2,
"#tau_{1}");
63 theTF1->SetParName(3,
"#tau_{2}");
64 theTF1->SetParName(4,
"C");
67 theTF1->SetParLimits(1, tmin, tmax);
68 theTF1->SetParLimits(2, 3, 6);
69 theTF1->SetParLimits(3, 10, 40);
79 theTF1->SetParameter(0, initialAmp);
80 theTF1->SetParameter(1, initialT0);
81 theTF1->SetParameter(4, 0);
83 theTF1->SetParLimits(0, ampMin, ampMax);
94 theTF1->SetParLimits(1, t0Min, t0Max);
103 theTF1->FixParameter(4, 0);
108 theTF1->ReleaseParameter(4);
115 theTF1->SetParLimits(2, 0.5, 3);
116 theTF1->SetParLimits(3, 4, 10);
127 m_fixTau1(fixTau1), m_fixTau2(fixTau2), m_tau1(tau1), m_tau2(tau2)
131 theTF1->SetParName(0,
"Amp");
132 theTF1->SetParName(1,
"T0");
133 theTF1->SetParName(2,
"#tau_{1}");
134 theTF1->SetParName(3,
"#tau_{2}");
135 theTF1->SetParName(4,
"C");
136 theTF1->SetParName(5,
"refdelay");
137 theTF1->SetParName(6,
"reflAmpFrac");
138 theTF1->SetParName(7,
"reflWidth");
139 theTF1->SetParName(8,
"delta");
141 theTF1->SetParLimits(1, tmin, tmax);
142 theTF1->SetParLimits(4, -100, 100);
143 theTF1->SetParLimits(6, -1
e-4, 0.35);
145 theTF1->FixParameter(5, 6.5);
146 theTF1->FixParameter(7, 1.5);
147 theTF1->FixParameter(8, 0.01);
150 else theTF1->SetParLimits(2, 1, 2);
153 else theTF1->SetParLimits(3, 3.5, 6);
160 theTF1->SetParameter(0, initialAmp);
162 float t0 = initialT0;
165 theTF1->SetParameter(1,
t0);
167 theTF1->SetParameter(1, initialT0);
168 theTF1->SetParameter(4, 0);
169 theTF1->SetParameter(6, 0.1);
171 theTF1->SetParLimits(0, ampMin, ampMax);
178 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
180 theTF1->SetParError(0, ampStep);
181 theTF1->SetParError(1, 1.0);
183 if (!
m_fixTau1) theTF1->SetParError(2, 0.05);
184 if (!
m_fixTau2) theTF1->SetParError(3, 0.25);
186 theTF1->SetParError(4, 2);
187 theTF1->SetParError(5, 0.25);
188 theTF1->SetParError(6, 0.05);
196 theTF1->SetParLimits(1, t0Min, t0Max);
205 theTF1->FixParameter(4, 0);
206 theTF1->FixParameter(6, 0);
211 theTF1->ReleaseParameter(4);
212 theTF1->SetParameter(4, 0);
214 theTF1->ReleaseParameter(6);
215 theTF1->SetParLimits(6, -1
e-4, 0.35);
216 theTF1->SetParameter(6, 0.1);
220 ZDCFitWrapper(std::make_shared<TF1>((
"ExpFermiFixedTaus" +
tag).c_str(), this, tmin, tmax, 3)),
221 m_tau1(tau1), m_tau2(tau2)
226 theTF1->SetParLimits(1, tmin, tmax);
228 theTF1->SetParName(0,
"Amp");
229 theTF1->SetParName(1,
"T0");
230 theTF1->SetParName(2,
"C");
234 std::string funcNameRefFunc =
"ExpFermiFixedTausRefFunc" +
tag;
260 theTF1->FixParameter(2, 0);
265 theTF1->ReleaseParameter(2);
275 m_tau1(tau1), m_tau2(tau2)
279 std::string funcNameRefFunc =
"ExpFermiPrePulseRefFunc" +
tag;
297 theTF1->SetParLimits(1, tmin, tmax);
298 theTF1->SetParLimits(2, 1, 8196);
299 theTF1->SetParLimits(3, -20, 10);
301 theTF1->SetParName(0,
"Amp");
302 theTF1->SetParName(1,
"T0");
303 theTF1->SetParName(2,
"Amp_{pre}");
304 theTF1->SetParName(3,
"T0_{pre}");
305 theTF1->SetParName(4,
"C");
314 theTF1->FixParameter(2, 0);
315 theTF1->FixParameter(4, 0);
320 theTF1->ReleaseParameter(2);
321 theTF1->ReleaseParameter(4);
323 theTF1->SetParLimits(2, 1, 8196);
349 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
360 theTF1->SetParLimits(1, t0Min, t0Max);
364 float defExpTau,
float fixExpTau) :
365 ZDCPreExpFitWrapper(std::make_shared<TF1>((
"ExpFermiPreExp" +
tag).c_str(), this, tmin, tmax, 6), defExpTau, fixExpTau),
366 m_tau1(tau1), m_tau2(tau2)
370 std::string funcNameRefFunc =
"ExpFermiPreExpRefFunc" +
tag;
388 theTF1->SetParName(0,
"Amp");
389 theTF1->SetParName(1,
"T0");
390 theTF1->SetParName(2,
"Amp_{pre}");
391 theTF1->SetParName(3,
"tau_{pre}");
392 theTF1->SetParName(4,
"tausqrt_{pre}");
393 theTF1->SetParName(5,
"C");
395 theTF1->SetParLimits(1, tmin, tmax);
396 theTF1->SetParLimits(2, -1, 8196);
397 theTF1->SetParLimits(3, 6, 30);
398 theTF1->SetParLimits(4, -0.2, 0.2);
399 theTF1->SetParLimits(5, -50, 50);
408 theTF1->FixParameter(2, 0);
410 theTF1->FixParameter(5, 0);
416 theTF1->ReleaseParameter(2);
417 theTF1->SetParLimits(2, -1, 8196);
419 theTF1->ReleaseParameter(3);
420 theTF1->SetParLimits(3, 6, 30);
423 theTF1->ReleaseParameter(5);
424 theTF1->SetParLimits(5, -50, 50);
425 theTF1->SetParameter(5, 0);
441 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
453 theTF1->SetParLimits(1, t0Min, t0Max);
457 float defExpTau,
float fixExpTau) :
458 ZDCPreExpFitWrapper(std::make_shared<TF1>((
"ExpFermiLHCfPreExp" +
tag).c_str(), this, tmin, tmax, 8), defExpTau, fixExpTau),
459 m_tau1(tau1), m_tau2(tau2)
463 std::string funcNameRefFunc =
"ExpFermiLHCfPreExpRefFunc" +
tag;
482 theTF1->SetParName(0,
"Amp");
483 theTF1->SetParName(1,
"T0");
484 theTF1->SetParName(2,
"Tau1");
485 theTF1->SetParName(3,
"Tau2");
486 theTF1->SetParName(4,
"Amp_{pre}");
487 theTF1->SetParName(5,
"tau_{pre}");
488 theTF1->SetParName(6,
"bsqrt_{pre}");
489 theTF1->SetParName(7,
"ReflFrac");
491 theTF1->SetParLimits(1, tmin, tmax);
492 theTF1->SetParLimits(2, 1.0, 2);
493 theTF1->SetParLimits(3, 3.5, 5.5);
494 theTF1->SetParLimits(4, -1, 8196);
495 theTF1->SetParLimits(5, 4, 12);
496 theTF1->SetParLimits(6, -0.001, 0.001);
497 theTF1->SetParLimits(7, -1.0
e-4, 0.3);
504 float t0 = initialT0;
520 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
538 theTF1->FixParameter(6, 0);
539 theTF1->FixParameter(7, 0.20);
545 theTF1->ReleaseParameter(5);
546 theTF1->SetParLimits(5, 6, 12);
548 theTF1->ReleaseParameter(6);
549 theTF1->SetParLimits(6, -0.001, 0.001);
552 theTF1->ReleaseParameter(7);
553 theTF1->SetParLimits(7, -1.0
e-4, 0.3);
561 theTF1->SetParLimits(1, t0Min, t0Max);
566 m_tau1(tau1), m_tau2(tau2)
570 std::string funcNameRefFunc =
"ExpFermiLHCfPrePulseRefFunc" +
tag;
571 std::string funcNamePreFunc =
"ExpFermiLHCfPrePulsePreFunc" +
tag;
599 theTF1->SetParName(0,
"Amp");
600 theTF1->SetParName(1,
"T0");
601 theTF1->SetParName(2,
"tau1");
602 theTF1->SetParName(3,
"tau2");
603 theTF1->SetParName(4,
"Amp_{pre}");
604 theTF1->SetParName(5,
"T0_{pre}");
605 theTF1->SetParName(6,
"C");
608 theTF1->SetParLimits(1, tmin, tmax);
609 theTF1->SetParLimits(2, 1.0, 2);
610 theTF1->SetParLimits(3, 3.5, 5.5);
611 theTF1->SetParLimits(4, 1, 8196);
612 theTF1->SetParLimits(5, -20, 10);
613 theTF1->SetParLimits(6, -50, 50);
623 theTF1->FixParameter(4, 0);
624 theTF1->FixParameter(6, 0);
629 theTF1->ReleaseParameter(4);
630 theTF1->ReleaseParameter(6);
632 theTF1->SetParLimits(4, 1, 8196);
633 theTF1->SetParLimits(6, -50, 50);
663 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
676 theTF1->SetParLimits(1, t0Min, t0Max);
684 ZDCFitWrapper(std::make_shared<TF1>((
"ExpFermiFixedTaus" +
tag).c_str(), this, tmin, tmax, 4)),
685 m_tau1(tau1), m_tau2(tau2)
690 theTF1->SetParLimits(1, tmin, tmax);
692 theTF1->SetParName(0,
"Amp");
693 theTF1->SetParName(1,
"T0");
694 theTF1->SetParName(2,
"s_{b}");
695 theTF1->SetParName(3,
"c_{b}");
699 std::string funcNameRefFunc =
"ExpFermiFixedTausRefFunc" +
tag;
719 theTF1->FixParameter(2, 0);
720 theTF1->FixParameter(3, 0);
726 theTF1->ReleaseParameter(2);
727 theTF1->ReleaseParameter(3);
732 float slope = std::abs(0.1 * initialAmp / initialT0);
733 float intercept = std::abs(0.1 * initialAmp);
744 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
755 theTF1->SetParLimits(1, t0Min, t0Max);
762 m_tau1(tau1), m_tau2(tau2)
766 std::string funcNameRefFunc =
"ExpFermiPerPulseRefFunc" +
tag;
783 theTF1->SetParName(0,
"Amp");
784 theTF1->SetParName(1,
"T0");
785 theTF1->SetParName(2,
"Amp_{pre}");
786 theTF1->SetParName(3,
"T0_{pre}");
787 theTF1->SetParName(4,
"s_{b}");
788 theTF1->SetParName(5,
"c_{b}");
791 theTF1->SetParLimits(1, tmin, tmax);
792 theTF1->SetParLimits(2, 1, 4096);
793 theTF1->SetParLimits(3, -20, 10);
802 theTF1->FixParameter(4, 0);
803 theTF1->FixParameter(5, 0);
809 theTF1->ReleaseParameter(4);
810 theTF1->ReleaseParameter(5);
820 float slope = std::abs(initialAmp / initialT0);
821 float intercept = std::abs(0.5 * initialAmp);
832 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
852 m_tau1(tau1), m_tau2(tau2)
856 std::string funcNameRefFunc =
"ExpFermiPerPulseRefFunc" +
tag;
873 theTF1->SetParLimits(1, tmin, tmax);
874 theTF1->SetParLimits(2, 0, 2048);
875 theTF1->SetParLimits(3, 0, 40);
876 theTF1->SetParLimits(6, 0, 4096);
878 theTF1->SetParName(0,
"Amp");
879 theTF1->SetParName(1,
"T0");
880 theTF1->SetParName(2,
"Amp_{pre}");
881 theTF1->SetParName(3,
"T0_{pre}");
882 theTF1->SetParName(4,
"s_{b}");
883 theTF1->SetParName(5,
"c_{b}");
884 theTF1->SetParName(6,
"Amp_{exp}");
893 theTF1->FixParameter(2, 0);
894 theTF1->FixParameter(4, 0);
895 theTF1->FixParameter(5, 0);
900 theTF1->ReleaseParameter(2);
901 theTF1->ReleaseParameter(4);
902 theTF1->ReleaseParameter(5);
918 float slope = std::abs(initialAmp / initialT0);
919 float intercept = std::abs(0.1 * initialAmp);
945 m_tau1(tau1), m_tau2(tau2)
949 std::string funcNameRefFunc =
"ExpFermiPerPulseRefFunc" +
tag;
966 theTF1->SetParLimits(1, tmin, tmax);
967 theTF1->SetParLimits(2, 0, 2048);
968 theTF1->SetParLimits(3, 0, 40);
969 theTF1->SetParLimits(6, 0, 4096);
970 theTF1->SetParLimits(7, 0, 2048);
971 theTF1->SetParLimits(8, 100, 163);
973 theTF1->SetParName(0,
"Amp");
974 theTF1->SetParName(1,
"T0");
975 theTF1->SetParName(2,
"Amp_{pre}");
976 theTF1->SetParName(3,
"T0_{pre}");
977 theTF1->SetParName(4,
"s_{b}");
978 theTF1->SetParName(5,
"c_{b}");
979 theTF1->SetParName(6,
"Amp_{exp}");
980 theTF1->SetParName(7,
"Amp_{post}");
981 theTF1->SetParName(8,
"T0_{post}");
990 theTF1->FixParameter(2, 0);
991 theTF1->FixParameter(4, 0);
992 theTF1->FixParameter(5, 0);
997 theTF1->ReleaseParameter(2);
998 theTF1->ReleaseParameter(4);
999 theTF1->ReleaseParameter(5);
1005 if (tmin < 0) tmin = 0;
1016 float iniPostT0 = initialPostT0;
1022 float slope = std::abs(initialAmp / initialT0);
1023 float intercept = std::abs(0.1 * initialAmp);