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;
485 theTF1->SetParName(0,
"Amp");
486 theTF1->SetParName(1,
"T0");
487 theTF1->SetParName(2,
"Tau1");
488 theTF1->SetParName(3,
"Tau2");
489 theTF1->SetParName(4,
"Amp_{pre}");
490 theTF1->SetParName(5,
"tau_{pre}");
491 theTF1->SetParName(6,
"bsqrt_{pre}");
492 theTF1->SetParName(7,
"ReflFrac");
494 theTF1->SetParLimits(1, tmin, tmax);
495 theTF1->SetParLimits(2, 1.0, 2);
496 theTF1->SetParLimits(3, 3.5, 5.5);
497 theTF1->SetParLimits(4, -1, 8196);
498 theTF1->SetParLimits(5, 4, 12);
499 theTF1->SetParLimits(6, -0.001, 0.001);
500 theTF1->SetParLimits(7, -1.0
e-4, 0.3);
507 float t0 = initialT0;
523 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
541 theTF1->FixParameter(6, 0);
542 theTF1->FixParameter(7, 0.20);
548 theTF1->ReleaseParameter(5);
549 theTF1->SetParLimits(5, 6, 12);
551 theTF1->ReleaseParameter(6);
552 theTF1->SetParLimits(6, -0.001, 0.001);
555 theTF1->ReleaseParameter(7);
556 theTF1->SetParLimits(7, -1.0
e-4, 0.3);
564 theTF1->SetParLimits(1, t0Min, t0Max);
569 m_tau1(tau1), m_tau2(tau2)
573 std::string funcNameRefFunc =
"ExpFermiLHCfPrePulseRefFunc" +
tag;
595 theTF1->SetParLimits(1, tmin, tmax);
596 theTF1->SetParLimits(2, 1, 8196);
597 theTF1->SetParLimits(3, -20, 10);
599 theTF1->SetParName(0,
"Amp");
600 theTF1->SetParName(1,
"T0");
601 theTF1->SetParName(2,
"Amp_{pre}");
602 theTF1->SetParName(3,
"T0_{pre}");
603 theTF1->SetParName(4,
"C");
612 theTF1->FixParameter(2, 0);
613 theTF1->FixParameter(4, 0);
618 theTF1->ReleaseParameter(2);
619 theTF1->ReleaseParameter(4);
621 theTF1->SetParLimits(2, 1, 8196);
647 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
658 theTF1->SetParLimits(1, t0Min, t0Max);
666 ZDCFitWrapper(std::make_shared<TF1>((
"ExpFermiFixedTaus" +
tag).c_str(), this, tmin, tmax, 4)),
667 m_tau1(tau1), m_tau2(tau2)
672 theTF1->SetParLimits(1, tmin, tmax);
674 theTF1->SetParName(0,
"Amp");
675 theTF1->SetParName(1,
"T0");
676 theTF1->SetParName(2,
"s_{b}");
677 theTF1->SetParName(3,
"c_{b}");
681 std::string funcNameRefFunc =
"ExpFermiFixedTausRefFunc" +
tag;
701 theTF1->FixParameter(2, 0);
702 theTF1->FixParameter(3, 0);
708 theTF1->ReleaseParameter(2);
709 theTF1->ReleaseParameter(3);
714 float slope = std::abs(0.1 * initialAmp / initialT0);
715 float intercept = std::abs(0.1 * initialAmp);
726 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
737 theTF1->SetParLimits(1, t0Min, t0Max);
744 m_tau1(tau1), m_tau2(tau2)
748 std::string funcNameRefFunc =
"ExpFermiPerPulseRefFunc" +
tag;
765 theTF1->SetParName(0,
"Amp");
766 theTF1->SetParName(1,
"T0");
767 theTF1->SetParName(2,
"Amp_{pre}");
768 theTF1->SetParName(3,
"T0_{pre}");
769 theTF1->SetParName(4,
"s_{b}");
770 theTF1->SetParName(5,
"c_{b}");
773 theTF1->SetParLimits(1, tmin, tmax);
774 theTF1->SetParLimits(2, 1, 4096);
775 theTF1->SetParLimits(3, -20, 10);
784 theTF1->FixParameter(4, 0);
785 theTF1->FixParameter(5, 0);
791 theTF1->ReleaseParameter(4);
792 theTF1->ReleaseParameter(5);
802 float slope = std::abs(initialAmp / initialT0);
803 float intercept = std::abs(0.5 * initialAmp);
814 double ampStep =
std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
834 m_tau1(tau1), m_tau2(tau2)
838 std::string funcNameRefFunc =
"ExpFermiPerPulseRefFunc" +
tag;
855 theTF1->SetParLimits(1, tmin, tmax);
856 theTF1->SetParLimits(2, 0, 2048);
857 theTF1->SetParLimits(3, 0, 40);
858 theTF1->SetParLimits(6, 0, 4096);
860 theTF1->SetParName(0,
"Amp");
861 theTF1->SetParName(1,
"T0");
862 theTF1->SetParName(2,
"Amp_{pre}");
863 theTF1->SetParName(3,
"T0_{pre}");
864 theTF1->SetParName(4,
"s_{b}");
865 theTF1->SetParName(5,
"c_{b}");
866 theTF1->SetParName(6,
"Amp_{exp}");
875 theTF1->FixParameter(2, 0);
876 theTF1->FixParameter(4, 0);
877 theTF1->FixParameter(5, 0);
882 theTF1->ReleaseParameter(2);
883 theTF1->ReleaseParameter(4);
884 theTF1->ReleaseParameter(5);
900 float slope = std::abs(initialAmp / initialT0);
901 float intercept = std::abs(0.1 * initialAmp);
927 m_tau1(tau1), m_tau2(tau2)
931 std::string funcNameRefFunc =
"ExpFermiPerPulseRefFunc" +
tag;
948 theTF1->SetParLimits(1, tmin, tmax);
949 theTF1->SetParLimits(2, 0, 2048);
950 theTF1->SetParLimits(3, 0, 40);
951 theTF1->SetParLimits(6, 0, 4096);
952 theTF1->SetParLimits(7, 0, 2048);
953 theTF1->SetParLimits(8, 100, 163);
955 theTF1->SetParName(0,
"Amp");
956 theTF1->SetParName(1,
"T0");
957 theTF1->SetParName(2,
"Amp_{pre}");
958 theTF1->SetParName(3,
"T0_{pre}");
959 theTF1->SetParName(4,
"s_{b}");
960 theTF1->SetParName(5,
"c_{b}");
961 theTF1->SetParName(6,
"Amp_{exp}");
962 theTF1->SetParName(7,
"Amp_{post}");
963 theTF1->SetParName(8,
"T0_{post}");
972 theTF1->FixParameter(2, 0);
973 theTF1->FixParameter(4, 0);
974 theTF1->FixParameter(5, 0);
979 theTF1->ReleaseParameter(2);
980 theTF1->ReleaseParameter(4);
981 theTF1->ReleaseParameter(5);
987 if (tmin < 0) tmin = 0;
998 float iniPostT0 = initialPostT0;
1004 float slope = std::abs(initialAmp / initialT0);
1005 float intercept = std::abs(0.1 * initialAmp);