ATLAS Offline Software
ZDCFitWrapper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <numeric>
7 #include <memory>
8 
9 void ZDCFitWrapper::Initialize(float initialAmp, float initialT0, float ampMin, float ampMax)
10 {
11  // Clear the errors on the TF1 because retaining the errors seems to affect
12  // the convergence of fits
13  //
14  unsigned int npar = GetWrapperTF1()->GetNpar();
15  std::vector<double> zeroVec(npar, 0.0);
16  GetWrapperTF1()->SetParErrors(&zeroVec[0]);
17 
18  // If we adjusted the time range on the previous event, restore to default
19  //
20  if (m_adjTLimitsEvent) {
22 
23  m_adjTLimitsEvent = false;
24  m_tminAdjust = 0;
25  }
26 
27  SetAmpMinMax(ampMin, ampMax);
28 
29  DoInitialize(initialAmp, initialT0, ampMin, ampMax);
30 }
31 
32 void ZDCFitWrapper::Initialize(float initialAmp, float initialT0, float ampMin, float ampMax, float fitTmin, float fitTmax, float fitTRef)
33 {
34  // Clear the errors on the TF1 because retaining the errors seems to affect
35  // the convergence of fits
36  //
37  unsigned int npar = GetWrapperTF1()->GetNpar();
38  std::vector<double> zeroVec(npar, 0.0);
39  GetWrapperTF1()->SetParErrors(&zeroVec[0]);
40 
41  m_adjTLimitsEvent = true;
42 
43  m_tminAdjust = fitTRef; // Note: this is the time corresponding to the sample used for presample subtraction
44 
45  m_tempTmin = std::max(m_t0Min, fitTmin);
46  m_tempTmax = std::min(m_t0Max, fitTmax);
47 
48  SetAmpMinMax(ampMin, ampMax);
50 
51  DoInitialize(initialAmp, initialT0, ampMin, ampMax);
52 }
53 
54 ZDCFitExpFermiVariableTaus::ZDCFitExpFermiVariableTaus(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2) :
55  ZDCFitWrapper(std::make_shared<TF1>(("ExpFermiVariableTaus" + tag).c_str(), ZDCFermiExpFit, tmin, tmax, 5)),
56  m_fixTau1(fixTau1), m_fixTau2(fixTau2), m_tau1(tau1), m_tau2(tau2)
57 {
58  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
59 
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");
65 
66  // BAC, parameter 0 limits now is set in DoInitialize
67  theTF1->SetParLimits(1, tmin, tmax);
68  theTF1->SetParLimits(2, 3, 6);
69  theTF1->SetParLimits(3, 10, 40);
70 
71  if (m_fixTau1) theTF1->FixParameter(2, m_tau1);
72  if (m_fixTau2) theTF1->FixParameter(3, m_tau2);
73 }
74 
75 void ZDCFitExpFermiVariableTaus::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
76 {
77  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
78 
79  theTF1->SetParameter(0, initialAmp);
80  theTF1->SetParameter(1, initialT0);
81  theTF1->SetParameter(4, 0);
82 
83  theTF1->SetParLimits(0, ampMin, ampMax);
84 
85  if (!m_fixTau1) theTF1->SetParameter(2, m_tau1);
86  if (!m_fixTau2) theTF1->SetParameter(3, m_tau2);
87 }
88 
89 void ZDCFitExpFermiVariableTaus::SetT0FitLimits(float t0Min, float t0Max)
90 {
91  // Set the parameter limits accordingly on the TF1
92  //
93  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
94  theTF1->SetParLimits(1, t0Min, t0Max);
95 }
96 
98 {
99  // We force the constant terms to zero
100  //
101  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
102 
103  theTF1->FixParameter(4, 0);
104 }
106 {
107  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
108  theTF1->ReleaseParameter(4);
109 }
110 
111 ZDCFitExpFermiVariableTausRun3::ZDCFitExpFermiVariableTausRun3(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2) :
112  ZDCFitExpFermiVariableTaus(tag, tmin, tmax, fixTau1, fixTau2, tau1, tau2)
113 {
114  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
115  theTF1->SetParLimits(2, 0.5, 3);
116  theTF1->SetParLimits(3, 4, 10);
117 
118  // Since we st parameter ranges, we have to redo the fixing (or not) again here
119  //
120  if (m_fixTau1) theTF1->FixParameter(2, m_tau1);
121  if (m_fixTau2) theTF1->FixParameter(3, m_tau2);
122 }
123 
124 
125 ZDCFitExpFermiVariableTausLHCf::ZDCFitExpFermiVariableTausLHCf(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2) :
126  ZDCFitWrapper(std::make_shared<TF1>(("ExpFermiVariableTausLHCf" + tag).c_str(), ZDCFermiExpFitRefl, tmin, tmax, 9)),
127  m_fixTau1(fixTau1), m_fixTau2(fixTau2), m_tau1(tau1), m_tau2(tau2)
128 {
129  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
130 
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");
140 
141  theTF1->SetParLimits(1, tmin, tmax);
142  theTF1->SetParLimits(4, -100, 100);
143  theTF1->SetParLimits(6, -1e-4, 0.35);
144 
145  theTF1->FixParameter(5, 6.5);
146  theTF1->FixParameter(7, 1.5);
147  theTF1->FixParameter(8, 0.01);
148 
149  if (m_fixTau1) theTF1->FixParameter(2, m_tau1);
150  else theTF1->SetParLimits(2, 1, 2);
151 
152  if (m_fixTau2) theTF1->FixParameter(3, m_tau2);
153  else theTF1->SetParLimits(3, 3.5, 6);
154 }
155 
156 void ZDCFitExpFermiVariableTausLHCf::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
157 {
158  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
159 
160  theTF1->SetParameter(0, initialAmp);
161 
162  float t0 = initialT0;
163  if (t0 < GetT0Min()) t0 = GetT0Min()*1.1;
164  if (t0 > GetT0Max()) t0 = GetT0Max()/1.1;
165  theTF1->SetParameter(1, t0);
166 
167  theTF1->SetParameter(1, initialT0);
168  theTF1->SetParameter(4, 0);
169  theTF1->SetParameter(6, 0.1);
170 
171  theTF1->SetParLimits(0, ampMin, ampMax);
172 
173  if (!m_fixTau1) theTF1->SetParameter(2, m_tau1);
174  if (!m_fixTau2) theTF1->SetParameter(3, m_tau2);
175 
176  // Set the parameter errors which ROOT now uses <<<to set the initial step sizes>>>
177  //
178  double ampStep = std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
179 
180  theTF1->SetParError(0, ampStep);
181  theTF1->SetParError(1, 1.0);
182 
183  if (!m_fixTau1) theTF1->SetParError(2, 0.05);
184  if (!m_fixTau2) theTF1->SetParError(3, 0.25);
185 
186  theTF1->SetParError(4, 2);
187  theTF1->SetParError(5, 0.25);
188  theTF1->SetParError(6, 0.05);
189 }
190 
192 {
193  // Set the parameter limits accordingly on the TF1
194  //
195  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
196  theTF1->SetParLimits(1, t0Min, t0Max);
197 }
198 
200 {
201  // We force the constant and reflection terms to zero
202  //
203  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
204 
205  theTF1->FixParameter(4, 0);
206  theTF1->FixParameter(6, 0);
207 }
209 {
210  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
211  theTF1->ReleaseParameter(4);
212  theTF1->SetParameter(4, 0);
213 
214  theTF1->ReleaseParameter(6);
215  theTF1->SetParLimits(6, -1e-4, 0.35);
216  theTF1->SetParameter(6, 0.1);
217 }
218 
219 ZDCFitExpFermiFixedTaus::ZDCFitExpFermiFixedTaus(const std::string& tag, float tmin, float tmax, float tau1, float tau2) :
220  ZDCFitWrapper(std::make_shared<TF1>(("ExpFermiFixedTaus" + tag).c_str(), this, tmin, tmax, 3)),
221  m_tau1(tau1), m_tau2(tau2)
222 {
223  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
224 
225  // BAC, parameter 0 limits now is set in DoInitialize
226  theTF1->SetParLimits(1, tmin, tmax);
227 
228  theTF1->SetParName(0, "Amp");
229  theTF1->SetParName(1, "T0");
230  theTF1->SetParName(2, "C");
231 
232  // Now create the reference function that we use to evaluate ExpFermiFit more efficiently
233  //
234  std::string funcNameRefFunc = "ExpFermiFixedTausRefFunc" + tag;
235  m_expFermiFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFit, -50, 100, 5);
236 
237  m_expFermiFunc->SetParameter(0, 1);
238  m_expFermiFunc->SetParameter(1, 0);
239  m_expFermiFunc->SetParameter(2, m_tau1);
240  m_expFermiFunc->SetParameter(3, m_tau2);
241  m_expFermiFunc->SetParameter(4, 0);
242 
243  m_norm = 1. / m_expFermiFunc->GetMaximum();
244  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
245 }
246 
247 void ZDCFitExpFermiFixedTaus::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
248 {
249  GetWrapperTF1()->SetParameter(0, initialAmp);
250  GetWrapperTF1()->SetParameter(1, initialT0);
251 
252  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
253 }
255 {
256  // We force the constant tersm to zero
257  //
258  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
259 
260  theTF1->FixParameter(2, 0);
261 }
263 {
264  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
265  theTF1->ReleaseParameter(2);
266 }
267 
268 void ZDCFitExpFermiFixedTaus::SetT0FitLimits(float t0Min, float t0Max)
269 {
270  GetWrapperTF1()->SetParLimits(1, t0Min, t0Max);
271 }
272 
273 ZDCFitExpFermiPrePulse::ZDCFitExpFermiPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2) :
274  ZDCPrePulseFitWrapper(std::make_shared<TF1>(("ExpFermiPrePulse" + tag).c_str(), this, tmin, tmax, 5)),
275  m_tau1(tau1), m_tau2(tau2)
276 {
277  // Create the reference function that we use to evaluate ExpFermiFit more efficiently
278  //
279  std::string funcNameRefFunc = "ExpFermiPrePulseRefFunc" + tag;
280 
281  m_expFermiFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFit, -50, 100, 5);
282 
283  m_expFermiFunc->SetParameter(0, 1);
284  m_expFermiFunc->SetParameter(1, 0);
285  m_expFermiFunc->SetParameter(2, m_tau1);
286  m_expFermiFunc->SetParameter(3, m_tau2);
287  m_expFermiFunc->SetParameter(4, 0);
288 
289  m_norm = 1. / m_expFermiFunc->GetMaximum();
290  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
291 
292  // Now set up the actual TF1
293  //
294  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
295 
296  // BAC, parameter 0 limits now is set in DoInitialize
297  theTF1->SetParLimits(1, tmin, tmax);
298  theTF1->SetParLimits(2, 1, 8196); // Increase the upper range to 2 times of ADC range to deal with large exponential tail case of pre-pulse.
299  theTF1->SetParLimits(3, -20, 10);
300 
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");
306 }
307 
309 {
310  // We force the constant term and per-pulse amplitude to zero
311  //
312  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
313 
314  theTF1->FixParameter(2, 0);
315  theTF1->FixParameter(4, 0);
316 }
318 {
319  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
320  theTF1->ReleaseParameter(2);
321  theTF1->ReleaseParameter(4);
322 
323  theTF1->SetParLimits(2, 1, 8196); // Increase the upper range to 2 times of ADC range to deal with large exponential tail case of pre-pulse.
324 }
325 
326 void ZDCFitExpFermiPrePulse::SetPrePulseT0Range(float tmin, float tmax)
327 {
328  if (tmin > GetTMin()) {
329  m_preT0Min = tmin;
330  GetWrapperTF1()->ReleaseParameter(3);
331  GetWrapperTF1()->SetParLimits(3, tmin, tmax);
332  }
333  else {
334  m_preT0Min = -25;
335  GetWrapperTF1()->SetParLimits(3, -25, tmax);
336  }
337  m_preT0Max = tmax;
338 }
339 
340 void ZDCFitExpFermiPrePulse::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
341 {
342  GetWrapperTF1()->SetParameter(0, initialAmp);
343  GetWrapperTF1()->SetParameter(1, initialT0);
344  GetWrapperTF1()->SetParameter(2, 5);
345  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
346 
347  // Set parameter errors for fit step size
348  //
349  double ampStep = std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
350  GetWrapperTF1()->SetParError(0, ampStep);
351  GetWrapperTF1()->SetParError(1, 1.0);
352  GetWrapperTF1()->SetParError(2, 2);
353  GetWrapperTF1()->SetParError(3, 1.0);
354  GetWrapperTF1()->SetParError(4, 1.0);
355 }
356 
357 void ZDCFitExpFermiPrePulse::SetT0FitLimits(float t0Min, float t0Max)
358 {
359  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
360  theTF1->SetParLimits(1, t0Min, t0Max);
361 }
362 
363 ZDCFitExpFermiPreExp::ZDCFitExpFermiPreExp(const std::string& tag, float tmin, float tmax, float tau1, float tau2,
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)
367 {
368  // Create the reference function that we use to evaluate ExpFermiFit more efficiently
369  //
370  std::string funcNameRefFunc = "ExpFermiPreExpRefFunc" + tag;
371 
372  m_expFermiFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFit, tmin, tmax, 8);
373 
374  // The parameters for the FermiExp
375  //
376  m_expFermiFunc->SetParameter(0, 1);
377  m_expFermiFunc->SetParameter(1, 0);
378  m_expFermiFunc->SetParameter(2, m_tau1);
379  m_expFermiFunc->SetParameter(3, m_tau2);
380  m_expFermiFunc->SetParameter(4, 0);
381 
382  m_norm = 1. / m_expFermiFunc->GetMaximum();
383  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
384 
385  // Now set up the actual TF1
386  //
387  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
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");
394 
395  theTF1->SetParLimits(1, tmin, tmax);
396  theTF1->SetParLimits(2, -1, 8196); // Increase the upper range to 2 times of ADC range to deal with large exponential tail case of pre-pulse.
397  theTF1->SetParLimits(3, 6, 30);
398  theTF1->SetParLimits(4, -0.2, 0.2);
399  theTF1->SetParLimits(5, -50, 50);
400 }
401 
403 {
404  // We force the constant term and per-pulse amplitude to zero
405  //
406  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
407 
408  theTF1->FixParameter(2, 0);
409  theTF1->FixParameter(3, getDefaultExpTau());
410  theTF1->FixParameter(5, 0);
411 }
413 {
414  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
415 
416  theTF1->ReleaseParameter(2);
417  theTF1->SetParLimits(2, -1, 8196); // Increase the upper range to 2 times of ADC range to deal with large exponential tail case of pre-pulse.
418 
419  theTF1->ReleaseParameter(3);
420  theTF1->SetParLimits(3, 6, 30);
421  theTF1->SetParameter(3, getDefaultExpTau());
422 
423  theTF1->ReleaseParameter(5);
424  theTF1->SetParLimits(5, -50, 50);
425  theTF1->SetParameter(5, 0);
426 }
427 
428 void ZDCFitExpFermiPreExp::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
429 {
430  GetWrapperTF1()->SetParameter(0, initialAmp);
431  GetWrapperTF1()->SetParameter(1, initialT0);
432  GetWrapperTF1()->SetParameter(2, 0);
433  GetWrapperTF1()->SetParameter(3, getDefaultExpTau());
434  GetWrapperTF1()->SetParameter(4, 0.);
435  GetWrapperTF1()->SetParameter(5, 0);
436 
437  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
438 
439  // Set parameter errors for fit step size
440  //
441  double ampStep = std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
442  GetWrapperTF1()->SetParError(0, ampStep);
443  GetWrapperTF1()->SetParError(1, 1.0);
444  GetWrapperTF1()->SetParError(2, ampStep/2);
445  GetWrapperTF1()->SetParError(3, 1.0);
446  GetWrapperTF1()->SetParError(4, 0.025);
447  GetWrapperTF1()->SetParError(5, 1.0);
448 }
449 
450 void ZDCFitExpFermiPreExp::SetT0FitLimits(float t0Min, float t0Max)
451 {
452  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
453  theTF1->SetParLimits(1, t0Min, t0Max);
454 }
455 
456 ZDCFitExpFermiLHCfPreExp::ZDCFitExpFermiLHCfPreExp(const std::string& tag, float tmin, float tmax, float tau1, float tau2,
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)
460 {
461  // Create the reference function that we use to evaluate ExpFermiFit more efficiently
462  //
463  std::string funcNameRefFunc = "ExpFermiLHCfPreExpRefFunc" + tag;
464 
465  m_expFermiLHCfFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFitRefl, tmin, tmax, 9);
466 
467  // The parameters for the FermiExpRefl
468  //
469  m_expFermiLHCfFunc->SetParameter(0, 1);
470  m_expFermiLHCfFunc->SetParameter(1, 0);
471  m_expFermiLHCfFunc->SetParameter(2, m_tau1);
472  m_expFermiLHCfFunc->SetParameter(3, m_tau2);
473  m_expFermiLHCfFunc->SetParameter(4, 0);
474  m_expFermiLHCfFunc->SetParameter(5, 6.5);
475  m_expFermiLHCfFunc->SetParameter(6, 0.1);
476  m_expFermiLHCfFunc->SetParameter(7, 1.5);
477  m_expFermiLHCfFunc->SetParameter(8, 0.01);
478 
479  m_norm = 1. / m_expFermiLHCfFunc->GetMaximum();
480  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
481 
482  // Now set up the actual TF1
483  //
484  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
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");
493 
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); // Increase the upper range to 2 times of ADC range to deal with large exponential tail case of pre-pulse.
498  theTF1->SetParLimits(5, 4, 12);
499  theTF1->SetParLimits(6, -0.001, 0.001);
500  theTF1->SetParLimits(7, -1.0e-4, 0.3);
501 }
502 
503 void ZDCFitExpFermiLHCfPreExp::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
504 {
505  GetWrapperTF1()->SetParameter(0, std::max(initialAmp, ampMin));
506 
507  float t0 = initialT0;
508  if (t0 < GetT0Min()) t0 = GetT0Min()*1.1;
509  if (t0 > GetT0Max()) t0 = GetT0Max()/1.1;
510  GetWrapperTF1()->SetParameter(1, t0);
511 
512  GetWrapperTF1()->SetParameter(2, std::max(m_tau1, (float) 1.01));
513  GetWrapperTF1()->SetParameter(3, m_tau2);
514  GetWrapperTF1()->SetParameter(4, 0.);
515  GetWrapperTF1()->SetParameter(5, std::max(getDefaultExpTau(), (float) 6.01));
516  GetWrapperTF1()->SetParameter(6, 0);
517  GetWrapperTF1()->SetParameter(7, 0.2);
518 
519  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
520 
521  // Set parameter errors for fit step size
522  //
523  double ampStep = std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
524  GetWrapperTF1()->SetParError(0, ampStep);
525  GetWrapperTF1()->SetParError(1, 1.0);
526  GetWrapperTF1()->SetParError(2, 0.1);
527  GetWrapperTF1()->SetParError(3, 0.1);
528  GetWrapperTF1()->SetParError(4, 1.0);
529  GetWrapperTF1()->SetParError(5, 0.5);
530  GetWrapperTF1()->SetParError(6, 0.001);
531  GetWrapperTF1()->SetParError(7, 0.01);
532 }
533 
535 {
536  // We force the constant term and per-pulse amplitude to zero
537  //
538  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
539 
540  theTF1->FixParameter(5, std::max(getDefaultExpTau(), (float) 6.01));
541  theTF1->FixParameter(6, 0);
542  theTF1->FixParameter(7, 0.20);
543 }
545 {
546  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
547 
548  theTF1->ReleaseParameter(5);
549  theTF1->SetParLimits(5, 6, 12);
550 
551  theTF1->ReleaseParameter(6);
552  theTF1->SetParLimits(6, -0.001, 0.001);
553  GetWrapperTF1()->SetParameter(6, 0);
554 
555  theTF1->ReleaseParameter(7);
556  theTF1->SetParLimits(7, -1.0e-4, 0.3);
557  GetWrapperTF1()->SetParameter(7, 0.2);
558 
559 }
560 
561 void ZDCFitExpFermiLHCfPreExp::SetT0FitLimits(float t0Min, float t0Max)
562 {
563  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
564  theTF1->SetParLimits(1, t0Min, t0Max);
565 }
566 
567 ZDCFitExpFermiLHCfPrePulse::ZDCFitExpFermiLHCfPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2) :
568  ZDCPrePulseFitWrapper(std::make_shared<TF1>(("ExpFermiLHCfPrePulse" + tag).c_str(), this, tmin, tmax, 5)),
569  m_tau1(tau1), m_tau2(tau2)
570 {
571  // Create the reference function that we use to evaluate ExpFermiFit more efficiently
572  //
573  std::string funcNameRefFunc = "ExpFermiLHCfPrePulseRefFunc" + tag;
574 
575  m_expFermiLHCfFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFitRefl, tmin, tmax, 9);
576 
577  m_expFermiLHCfFunc->SetParameter(0, 1);
578  m_expFermiLHCfFunc->SetParameter(1, 0);
579  m_expFermiLHCfFunc->SetParameter(2, m_tau1);
580  m_expFermiLHCfFunc->SetParameter(3, m_tau2);
581  m_expFermiLHCfFunc->SetParameter(4, 0);
582  m_expFermiLHCfFunc->SetParameter(5, 6.5);
583  m_expFermiLHCfFunc->SetParameter(6, 0.2);
584  m_expFermiLHCfFunc->SetParameter(7, 1.5);
585  m_expFermiLHCfFunc->SetParameter(8, 0.01);
586 
587  m_norm = 1. / m_expFermiLHCfFunc->GetMaximum();
588  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
589 
590  // Now set up the actual TF1
591  //
592  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
593 
594  // BAC, parameter 0 limits now is set in DoInitialize
595  theTF1->SetParLimits(1, tmin, tmax);
596  theTF1->SetParLimits(2, 1, 8196); // Increase the upper range to 2 times of ADC range to deal with large exponential tail case of pre-pulse.
597  theTF1->SetParLimits(3, -20, 10);
598 
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");
604 }
605 
607 {
608  // We force the constant term and per-pulse amplitude to zero
609  //
610  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
611 
612  theTF1->FixParameter(2, 0);
613  theTF1->FixParameter(4, 0);
614 }
616 {
617  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
618  theTF1->ReleaseParameter(2);
619  theTF1->ReleaseParameter(4);
620 
621  theTF1->SetParLimits(2, 1, 8196); // Increase the upper range to 2 times of ADC range to deal with large exponential tail case of pre-pulse.
622 }
623 
625 {
626  if (tmin > GetTMin()) {
627  m_preT0Min = tmin;
628  GetWrapperTF1()->ReleaseParameter(3);
629  GetWrapperTF1()->SetParLimits(3, tmin, tmax);
630  }
631  else {
632  m_preT0Min = -25;
633  GetWrapperTF1()->SetParLimits(3, -25, tmax);
634  }
635  m_preT0Max = tmax;
636 }
637 
638 void ZDCFitExpFermiLHCfPrePulse::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
639 {
640  GetWrapperTF1()->SetParameter(0, initialAmp);
641  GetWrapperTF1()->SetParameter(1, initialT0);
642  GetWrapperTF1()->SetParameter(2, 5);
643 
644  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
645  // Set parameter errors for fit step size
646  //
647  double ampStep = std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
648  GetWrapperTF1()->SetParError(0, ampStep);
649  GetWrapperTF1()->SetParError(1, 1.0);
650  GetWrapperTF1()->SetParError(2, 2);
651  GetWrapperTF1()->SetParError(3, 1.0);
652  GetWrapperTF1()->SetParError(4, 1.0);
653 }
654 
655 void ZDCFitExpFermiLHCfPrePulse::SetT0FitLimits(float t0Min, float t0Max)
656 {
657  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
658  theTF1->SetParLimits(1, t0Min, t0Max);
659 }
660 
661 
662 
663 // --------------------------------------------------------------------------------------------------------------------------------------------
664 //
665 ZDCFitExpFermiLinearFixedTaus::ZDCFitExpFermiLinearFixedTaus(const std::string& tag, float tmin, float tmax, float tau1, float tau2) :
666  ZDCFitWrapper(std::make_shared<TF1>(("ExpFermiFixedTaus" + tag).c_str(), this, tmin, tmax, 4)),
667  m_tau1(tau1), m_tau2(tau2)
668 {
669  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
670 
671  // BAC, parameter 0 limits now is set in DoInitialize
672  theTF1->SetParLimits(1, tmin, tmax);
673 
674  theTF1->SetParName(0, "Amp");
675  theTF1->SetParName(1, "T0");
676  theTF1->SetParName(2, "s_{b}");
677  theTF1->SetParName(3, "c_{b}");
678 
679  // Now create the reference function that we use to evaluate ExpFermiFit more efficiently
680  //
681  std::string funcNameRefFunc = "ExpFermiFixedTausRefFunc" + tag;
682 
683  m_expFermiFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFit, -50, 100, 5);
684 
685  m_expFermiFunc->SetParameter(0, 1);
686  m_expFermiFunc->SetParameter(1, 0);
687  m_expFermiFunc->SetParameter(2, m_tau1);
688  m_expFermiFunc->SetParameter(3, m_tau2);
689  m_expFermiFunc->FixParameter(4, 0);
690 
691  m_norm = 1. / m_expFermiFunc->GetMaximum();
692  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
693 }
694 
696 {
697  // We force the linear terms to zero
698  //
699  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
700 
701  theTF1->FixParameter(2, 0);
702  theTF1->FixParameter(3, 0);
703 }
704 
706 {
707  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
708  theTF1->ReleaseParameter(2);
709  theTF1->ReleaseParameter(3);
710 }
711 
712 void ZDCFitExpFermiLinearFixedTaus::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
713 {
714  float slope = std::abs(0.1 * initialAmp / initialT0);
715  float intercept = std::abs(0.1 * initialAmp);
716  GetWrapperTF1()->SetParLimits(2, -slope , slope );
717  GetWrapperTF1()->SetParLimits(3, -intercept, intercept);
718 
719  GetWrapperTF1()->SetParameter(0, initialAmp);
720  GetWrapperTF1()->SetParameter(1, initialT0);
721  GetWrapperTF1()->SetParameter(2, 0);
722  GetWrapperTF1()->SetParameter(3, 0);
723 
724  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
725 
726  double ampStep = std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
727 
728  GetWrapperTF1()->SetParError(0, ampStep);
729  GetWrapperTF1()->SetParError(1, 1);
730  GetWrapperTF1()->SetParError(2, 1);
731  GetWrapperTF1()->SetParError(3, 0.5);
732 }
733 
734 void ZDCFitExpFermiLinearFixedTaus::SetT0FitLimits(float t0Min, float t0Max)
735 {
736  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
737  theTF1->SetParLimits(1, t0Min, t0Max);
738 }
739 
740 // --------------------------------------------------------------------------------------------------------------------------------------------
741 //
742 ZDCFitExpFermiLinearPrePulse::ZDCFitExpFermiLinearPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2) :
743  ZDCPrePulseFitWrapper(std::make_shared<TF1>(("ExpFermiLinearPrePulse" + tag).c_str(), this, tmin, tmax, 6)),
744  m_tau1(tau1), m_tau2(tau2)
745 {
746  // Create the reference function that we use to evaluate ExpFermiFit more efficiently
747  //
748  std::string funcNameRefFunc = "ExpFermiPerPulseRefFunc" + tag;
749 
750  m_expFermiFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFit, -50, 100, 5);
751 
752  m_expFermiFunc->SetParameter(0, 1);
753  m_expFermiFunc->SetParameter(1, 0);
754  m_expFermiFunc->SetParameter(2, m_tau1);
755  m_expFermiFunc->SetParameter(3, m_tau2);
756  m_expFermiFunc->FixParameter(4, 0);
757 
758  m_norm = 1. / m_expFermiFunc->GetMaximum();
759  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
760 
761  // Now set up the actual TF1
762  //
763  std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
764 
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}");
771 
772  // BAC, parameter 0 limits now is set in DoInitialize
773  theTF1->SetParLimits(1, tmin, tmax);
774  theTF1->SetParLimits(2, 1, 4096); // Increase the upper range to 4 times of ADC range to deal with large exponential tail case of pre-pulse.
775  theTF1->SetParLimits(3, -20, 10);
776 }
777 
779 {
780  // We force the linear terms and prepulse terms to zero
781  //
782  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
783 
784  theTF1->FixParameter(4, 0);
785  theTF1->FixParameter(5, 0);
786 }
788 {
789  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
790 
791  theTF1->ReleaseParameter(4);
792  theTF1->ReleaseParameter(5);
793 }
794 
796 {
797  GetWrapperTF1()->SetParLimits(3, tmin, tmax);
798 }
799 
800 void ZDCFitExpFermiLinearPrePulse::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
801 {
802  float slope = std::abs(initialAmp / initialT0); // to be studied more ??? limit 0.1 0.05
803  float intercept = std::abs(0.5 * initialAmp);
804  GetWrapperTF1()->SetParLimits(4, -slope , slope );
805  GetWrapperTF1()->SetParLimits(5, -intercept, intercept);
806 
807  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
808 
809  GetWrapperTF1()->SetParameter(0, initialAmp);
810  GetWrapperTF1()->SetParameter(1, initialT0);
811  GetWrapperTF1()->SetParameter(2, 5);
812  GetWrapperTF1()->SetParameter(5, 0);
813 
814  double ampStep = std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
815 
816  GetWrapperTF1()->SetParError(0, ampStep);
817  GetWrapperTF1()->SetParError(1, 1.0);
818  GetWrapperTF1()->SetParError(2, 1);
819  GetWrapperTF1()->SetParError(3, 1);
820  GetWrapperTF1()->SetParError(4, 0.1);
821  GetWrapperTF1()->SetParError(5, 1);
822 }
823 
824 void ZDCFitExpFermiLinearPrePulse::SetT0FitLimits(float t0Min, float t0Max)
825 {
826  GetWrapperTF1()->SetParLimits(1, t0Min, t0Max);
827 }
828 
829 
830 // --------------------------------------------------------------------------------------------------------------------------------------------
831 //
832 ZDCFitComplexPrePulse::ZDCFitComplexPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2) :
833  ZDCPrePulseFitWrapper(std::make_shared<TF1>(("ExpFermiPrePulse" + tag).c_str(), this, tmin, tmax, 7)),
834  m_tau1(tau1), m_tau2(tau2)
835 {
836  // Create the reference function that we use to evaluate ExpFermiFit more efficiently
837  //
838  std::string funcNameRefFunc = "ExpFermiPerPulseRefFunc" + tag;
839 
840  m_expFermiFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFit, -50, 100, 4);
841 
842  m_expFermiFunc->SetParameter(0, 1);
843  m_expFermiFunc->SetParameter(1, 0);
844  m_expFermiFunc->SetParameter(2, m_tau1);
845  m_expFermiFunc->SetParameter(3, m_tau2);
846 
847  m_norm = 1. / m_expFermiFunc->GetMaximum();
848  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
849 
850  // Now set up the actual TF1
851  //
852  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
853 
854  // BAC, parameter 0 limits now is set in DoInitialize
855  theTF1->SetParLimits(1, tmin, tmax);
856  theTF1->SetParLimits(2, 0, 2048); // Pre-pulse upper bound should not be greater 2 times of ADC range with overflow constrains.
857  theTF1->SetParLimits(3, 0, 40);
858  theTF1->SetParLimits(6, 0, 4096); // Increase the upper range to 4 times of ADC range to deal with large exponential tail case of pre-pulse.
859 
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}");
867 }
868 
870 {
871  // We force the linear terms and prepulse terms to zero
872  //
873  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
874 
875  theTF1->FixParameter(2, 0);
876  theTF1->FixParameter(4, 0);
877  theTF1->FixParameter(5, 0);
878 }
880 {
881  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
882  theTF1->ReleaseParameter(2);
883  theTF1->ReleaseParameter(4);
884  theTF1->ReleaseParameter(5);
885 }
886 
887 void ZDCFitComplexPrePulse::SetPrePulseT0Range(float tmin, float tmax)
888 {
889  if (tmin > GetTMin()) {
890  GetWrapperTF1()->ReleaseParameter(3);
891  GetWrapperTF1()->SetParLimits(3, tmin, tmax);
892  }
893  else {
894  GetWrapperTF1()->SetParLimits(3, 0, tmax);
895  }
896 }
897 
898 void ZDCFitComplexPrePulse::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
899 {
900  float slope = std::abs(initialAmp / initialT0); // to be studied more ??? limit 0.1 0.05
901  float intercept = std::abs(0.1 * initialAmp); // reduce from 0.25 to 0.1 fix some fail issue
902  GetWrapperTF1()->SetParLimits(4, -slope , slope ); // if the lower limit is set to 0, there will be some fit fail issue...
903  GetWrapperTF1()->SetParLimits(5, -intercept, intercept);
904 
905  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
906 
907  GetWrapperTF1()->SetParameter(0, initialAmp);
908  GetWrapperTF1()->SetParameter(1, initialT0);
909  GetWrapperTF1()->SetParameter(2, 5);
910  GetWrapperTF1()->SetParameter(3, 10);
911  GetWrapperTF1()->SetParameter(4, 0);
912  GetWrapperTF1()->SetParameter(5, 0);
913  GetWrapperTF1()->SetParameter(6, 1);
914 }
915 
916 void ZDCFitComplexPrePulse::SetT0FitLimits(float t0Min, float t0Max)
917 {
918  GetWrapperTF1()->SetParLimits(1, t0Min, t0Max);
919 }
920 
921 
922 
923 // --------------------------------------------------------------------------------------------------------------------------------------------
924 //
925 ZDCFitGeneralPulse::ZDCFitGeneralPulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2) :
926  ZDCPrePulseFitWrapper(std::make_shared<TF1>(("ExpFermiPrePulse" + tag).c_str(), this, tmin, tmax, 9)),
927  m_tau1(tau1), m_tau2(tau2)
928 {
929  // Create the reference function that we use to evaluate ExpFermiFit more efficiently
930  //
931  std::string funcNameRefFunc = "ExpFermiPerPulseRefFunc" + tag;
932 
933  m_expFermiFunc = std::make_shared<TF1>(funcNameRefFunc.c_str(), ZDCFermiExpFit, -50, 100, 4);
934 
935  m_expFermiFunc->SetParameter(0, 1);
936  m_expFermiFunc->SetParameter(1, 0);
937  m_expFermiFunc->SetParameter(2, m_tau1);
938  m_expFermiFunc->SetParameter(3, m_tau2);
939 
940  m_norm = 1. / m_expFermiFunc->GetMaximum();
941  m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
942 
943  // Now set up the actual TF1
944  //
945  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
946 
947  // BAC, parameter 0 limits now is set in DoInitialize
948  theTF1->SetParLimits(1, tmin, tmax);
949  theTF1->SetParLimits(2, 0, 2048); // Pre-pulse upper bound should not be greater 2 times of ADC range with overflow constrains.
950  theTF1->SetParLimits(3, 0, 40);
951  theTF1->SetParLimits(6, 0, 4096); // Increase the upper range to 4 times of ADC range to deal with large exponential tail case of pre-pulse.
952  theTF1->SetParLimits(7, 0, 2048); // Post-pulse upper bound should not be greater 2 times of ADC range with overflow constrains.
953  theTF1->SetParLimits(8, 100, 163);
954 
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}");
964 }
965 
967 {
968  // We force the linear terms and prepulse terms to zero
969  //
970  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
971 
972  theTF1->FixParameter(2, 0);
973  theTF1->FixParameter(4, 0);
974  theTF1->FixParameter(5, 0);
975 }
977 {
978  std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
979  theTF1->ReleaseParameter(2);
980  theTF1->ReleaseParameter(4);
981  theTF1->ReleaseParameter(5);
982 }
983 
984 void ZDCFitGeneralPulse::SetPrePulseT0Range(float tmin, float tmax)
985 {
986  if (tmin > GetTMin()) {
987  if (tmin < 0) tmin = 0;
988  GetWrapperTF1()->SetParLimits(3, tmin, tmax);
989  }
990  else {
991  GetWrapperTF1()->SetParLimits(3, 0, tmax);
992  }
993 }
994 
995 void ZDCFitGeneralPulse::SetPostPulseT0Range(float tmin, float tmax, float initialPostT0)
996 {
997  GetWrapperTF1()->SetParLimits(8, tmin, tmax);
998  float iniPostT0 = initialPostT0;
999  GetWrapperTF1()->SetParameter(8, iniPostT0);
1000 }
1001 
1002 void ZDCFitGeneralPulse::DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)
1003 {
1004  float slope = std::abs(initialAmp / initialT0); // to be studied more ??? limit 0.1 0.05
1005  float intercept = std::abs(0.1 * initialAmp); // reduce from 0.25 to 0.1 fix some fail issue
1006  GetWrapperTF1()->SetParLimits(4, -slope , slope ); // if the lower limit is set to 0, there will be some fit fail issue...
1007  GetWrapperTF1()->SetParLimits(5, -intercept, intercept);
1008 
1009  GetWrapperTF1()->SetParLimits(0, ampMin, ampMax);
1010 
1011  GetWrapperTF1()->SetParameter(0, initialAmp);
1012  GetWrapperTF1()->SetParameter(1, initialT0);
1013  GetWrapperTF1()->SetParameter(4, 0);
1014  GetWrapperTF1()->SetParameter(5, 0);
1015  GetWrapperTF1()->SetParameter(7, 5);
1016 }
1017 
1018 void ZDCFitGeneralPulse::SetT0FitLimits(float t0Min, float t0Max)
1019 {
1020  GetWrapperTF1()->SetParLimits(1, t0Min, t0Max);
1021 }
ZDCFitExpFermiLHCfPreExp::m_expFermiLHCfFunc
std::shared_ptr< TF1 > m_expFermiLHCfFunc
Definition: ZDCFitWrapper.h:660
ZDCFitExpFermiFixedTaus::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:254
ZDCFitExpFermiLinearPrePulse::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:834
ZDCFitExpFermiVariableTaus::ZDCFitExpFermiVariableTaus
ZDCFitExpFermiVariableTaus(const std::string &tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:54
ZDCFitExpFermiLHCfPreExp::m_norm
float m_norm
Definition: ZDCFitWrapper.h:657
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ZDCFitComplexPrePulse::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:916
ZDCFitWrapper::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax)=0
ZDCFitExpFermiFixedTaus::ZDCFitExpFermiFixedTaus
ZDCFitExpFermiFixedTaus(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:219
ZDCFitExpFermiVariableTausLHCf::ZDCFitExpFermiVariableTausLHCf
ZDCFitExpFermiVariableTausLHCf(const std::string &tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:125
ZDCFitExpFermiVariableTausRun3::ZDCFitExpFermiVariableTausRun3
ZDCFitExpFermiVariableTausRun3(const std::string &tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:111
ZDCFitExpFermiPrePulse::m_expFermiFunc
std::shared_ptr< TF1 > m_expFermiFunc
Definition: ZDCFitWrapper.h:367
ZDCFitExpFermiFixedTaus::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:268
ZDCFitExpFermiFixedTaus::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:262
ZDCFitExpFermiFixedTaus::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:247
ZDCFitComplexPrePulse::ZDCFitComplexPrePulse
ZDCFitComplexPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:832
ZDCFitExpFermiLinearFixedTaus::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:734
ZDCFitGeneralPulse::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:976
max
#define max(a, b)
Definition: cfImp.cxx:41
ZDCFitGeneralPulse::m_norm
float m_norm
Definition: ZDCFitWrapper.h:1063
ZDCFitWrapper::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)=0
ZDCFitExpFermiVariableTaus::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:105
ZDCFitExpFermiLHCfPrePulse::m_expFermiLHCfFunc
std::shared_ptr< TF1 > m_expFermiLHCfFunc
Definition: ZDCFitWrapper.h:469
ZDCPrePulseFitWrapper
Definition: ZDCFitWrapper.h:116
ZDCFitExpFermiVariableTausLHCf::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:199
ZDCFitGeneralPulse::SetPrePulseT0Range
virtual void SetPrePulseT0Range(float tmin, float tmax) override
Definition: ZDCFitWrapper.cxx:984
ZDCFitComplexPrePulse::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:949
ZDCFitExpFermiLHCfPrePulse::SetPrePulseT0Range
virtual void SetPrePulseT0Range(float tmin, float tmax) override
Definition: ZDCFitWrapper.cxx:624
ZDCFitGeneralPulse::m_expFermiFunc
std::shared_ptr< TF1 > m_expFermiFunc
Definition: ZDCFitWrapper.h:1065
ZDCFitExpFermiLinearPrePulse::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:824
ZDCFitWrapper
Definition: ZDCFitWrapper.h:19
ZDCFitExpFermiLinearPrePulse::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:800
ZDCPreExpFitWrapper::getDefaultExpTau
float getDefaultExpTau() const
Definition: ZDCFitWrapper.h:157
ZDCFitExpFermiVariableTausLHCf::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:237
ZDCPrePulseFitWrapper::m_preT0Max
float m_preT0Max
Definition: ZDCFitWrapper.h:119
ZDCFitExpFermiLinearFixedTaus::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:772
ZDCFitGeneralPulse::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:1061
ZDCFitExpFermiPrePulse::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:340
ZDCFitExpFermiLinearFixedTaus::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:712
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
ZDCFitExpFermiFixedTaus::m_expFermiFunc
std::shared_ptr< TF1 > m_expFermiFunc
Definition: ZDCFitWrapper.h:306
ZDCFitExpFermiPreExp::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:568
ZDCFitExpFermiLinearPrePulse::ZDCFitExpFermiLinearPrePulse
ZDCFitExpFermiLinearPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:742
ZDCFitExpFermiLinearPrePulse::m_norm
float m_norm
Definition: ZDCFitWrapper.h:835
ZDCFitExpFermiLHCfPrePulse::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:606
ZDCFitWrapper::m_t0Max
float m_t0Max
Definition: ZDCFitWrapper.h:30
ZDCPreExpFitWrapper
Definition: ZDCFitWrapper.h:144
ZDCFitExpFermiLHCfPrePulse::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:638
ZDCFitComplexPrePulse::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:879
ZDCFitExpFermiPrePulse::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:364
ZDCFitWrapper::GetWrapperTF1
virtual std::shared_ptr< TF1 > GetWrapperTF1()
Definition: ZDCFitWrapper.h:110
ZDCFitWrapper::m_adjTLimitsEvent
bool m_adjTLimitsEvent
Definition: ZDCFitWrapper.h:32
ZDCFitWrapper::m_tempTmax
float m_tempTmax
Definition: ZDCFitWrapper.h:35
ZDCFitExpFermiLinearFixedTaus::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:769
ZDCFitExpFermiVariableTausLHCf::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:236
ZDCFitExpFermiLinearFixedTaus::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:705
ZDCFitExpFermiLinearPrePulse::m_expFermiFunc
std::shared_ptr< TF1 > m_expFermiFunc
Definition: ZDCFitWrapper.h:837
ZDCFitExpFermiLHCfPreExp::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:544
ZDCFitExpFermiPrePulse::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:363
ZDCFitExpFermiPreExp::m_expFermiFunc
std::shared_ptr< TF1 > m_expFermiFunc
Definition: ZDCFitWrapper.h:570
ZDCFitExpFermiLinearPrePulse::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:778
ZDCFitExpFermiFixedTaus::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:301
ZDCFitExpFermiPrePulse::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:357
ZDCFitExpFermiPreExp::ZDCFitExpFermiPreExp
ZDCFitExpFermiPreExp(const std::string &tag, float tmin, float tmax, float tau1, float tau2, float defExpTau, float fixExpTau)
Definition: ZDCFitWrapper.cxx:363
ZDCFitExpFermiVariableTaus::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:97
ZDCFitExpFermiPreExp::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:428
ZDCFermiExpFitRefl
double ZDCFermiExpFitRefl(const double *xvec, const double *pvec)
Definition: ZDCFitWrapper.h:1215
ZDCFitExpFermiVariableTausLHCf::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:208
ZDCFitGeneralPulse::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:1064
ZDCFitExpFermiLHCfPreExp::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:534
ZDCFitExpFermiPreExp::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:566
ZDCFitComplexPrePulse::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:946
ZDCFitExpFermiLHCfPreExp::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:503
ZDCFitExpFermiPrePulse::SetPrePulseT0Range
virtual void SetPrePulseT0Range(float tmin, float tmax) override
Definition: ZDCFitWrapper.cxx:326
ZDCFitExpFermiPrePulse::m_norm
float m_norm
Definition: ZDCFitWrapper.h:365
ZDCFitWrapper::GetT0Max
float GetT0Max() const
Definition: ZDCFitWrapper.h:97
ZDCFitExpFermiVariableTaus::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:169
ZDCFitWrapper::GetTMin
float GetTMin() const
Definition: ZDCFitWrapper.h:89
ZDCFitExpFermiVariableTausLHCf::m_fixTau1
bool m_fixTau1
Definition: ZDCFitWrapper.h:233
ZDCFitGeneralPulse::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:966
ZDCFitExpFermiVariableTaus::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:75
ZDCFitExpFermiLHCfPreExp::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:655
ZDCFitWrapper.h
ZDCFitExpFermiVariableTausLHCf::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:156
ZDCFitExpFermiVariableTaus
Definition: ZDCFitWrapper.h:164
ZDCFitExpFermiFixedTaus::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:304
ZDCFitExpFermiLHCfPrePulse::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:468
ZDCFitExpFermiPreExp::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:412
min
#define min(a, b)
Definition: cfImp.cxx:40
ZDCFitExpFermiLinearPrePulse::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:787
ZDCFitExpFermiVariableTaus::m_fixTau1
bool m_fixTau1
Definition: ZDCFitWrapper.h:166
ZDCFitExpFermiPreExp::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:565
ZDCFitExpFermiLinearFixedTaus::m_norm
float m_norm
Definition: ZDCFitWrapper.h:771
ZDCFitExpFermiLHCfPreExp::ZDCFitExpFermiLHCfPreExp
ZDCFitExpFermiLHCfPreExp(const std::string &tag, float tmin, float tmax, float tau1, float tau2, float defExpTau, float fixExpTau)
Definition: ZDCFitWrapper.cxx:456
ZDCFitWrapper::m_t0Min
float m_t0Min
Definition: ZDCFitWrapper.h:29
ZDCFitWrapper::m_tminAdjust
float m_tminAdjust
Definition: ZDCFitWrapper.h:33
ZDCFitGeneralPulse::ZDCFitGeneralPulse
ZDCFitGeneralPulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:925
ZDCFitExpFermiLHCfPrePulse::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:465
ZDCFitWrapper::Initialize
void Initialize(float initialAmp, float initialT0, float ampMin, float ampMax)
Definition: ZDCFitWrapper.cxx:9
ZDCFitExpFermiLHCfPrePulse::ZDCFitExpFermiLHCfPrePulse
ZDCFitExpFermiLHCfPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:567
ZDCFitComplexPrePulse::m_expFermiFunc
std::shared_ptr< TF1 > m_expFermiFunc
Definition: ZDCFitWrapper.h:950
ZDCFitExpFermiPreExp::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:450
ZDCFitExpFermiLinearFixedTaus::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:695
ZDCFitWrapper::GetT0Min
float GetT0Min() const
Definition: ZDCFitWrapper.h:92
ZDCFitExpFermiLinearPrePulse::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:836
ZDCFitComplexPrePulse::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:947
ZDCFitExpFermiVariableTausLHCf::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:191
ZDCFitExpFermiLHCfPrePulse::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:615
ZDCFitExpFermiLHCfPreExp::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:658
ZDCFitComplexPrePulse::SetPrePulseT0Range
virtual void SetPrePulseT0Range(float tmin, float tmax) override
Definition: ZDCFitWrapper.cxx:887
ZDCFitWrapper::SetAmpMinMax
void SetAmpMinMax(float minAmp, float maxAmp)
Definition: ZDCFitWrapper.h:63
ZDCFitExpFermiPrePulse::UnconstrainFit
virtual void UnconstrainFit() override
Definition: ZDCFitWrapper.cxx:317
ZDCFitExpFermiLinearFixedTaus::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:768
ZDCFitComplexPrePulse::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:869
ZDCFitGeneralPulse::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:1062
ZDCFitComplexPrePulse::m_norm
float m_norm
Definition: ZDCFitWrapper.h:948
ZDCFitExpFermiLinearPrePulse::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:833
ZDCFitGeneralPulse::SetPostPulseT0Range
virtual void SetPostPulseT0Range(float tmin, float tmax, float initialPostT0) override
Definition: ZDCFitWrapper.cxx:995
ZDCFitExpFermiFixedTaus::m_tau1
float m_tau1
Definition: ZDCFitWrapper.h:300
ZDCFitExpFermiLinearFixedTaus::ZDCFitExpFermiLinearFixedTaus
ZDCFitExpFermiLinearFixedTaus(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:665
ZDCFitExpFermiVariableTaus::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:89
ZDCFitExpFermiLHCfPrePulse::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:466
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ZDCFitExpFermiLinearFixedTaus::m_expFermiFunc
std::shared_ptr< TF1 > m_expFermiFunc
Definition: ZDCFitWrapper.h:774
ZDCFitExpFermiLinearPrePulse::SetPrePulseT0Range
virtual void SetPrePulseT0Range(float tmin, float tmax) override
Definition: ZDCFitWrapper.cxx:795
ZDCFitExpFermiLHCfPrePulse::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:655
ZDCFitExpFermiPreExp::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:402
ZDCFitExpFermiLHCfPreExp::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:561
ZDCFitExpFermiPrePulse::ZDCFitExpFermiPrePulse
ZDCFitExpFermiPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
Definition: ZDCFitWrapper.cxx:273
ZDCFitExpFermiPreExp::m_norm
float m_norm
Definition: ZDCFitWrapper.h:567
ZDCPrePulseFitWrapper::m_preT0Min
float m_preT0Min
Definition: ZDCFitWrapper.h:118
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
ZDCFitGeneralPulse::SetT0FitLimits
virtual void SetT0FitLimits(float tMin, float tMax) override
Definition: ZDCFitWrapper.cxx:1018
ZDCFitExpFermiPrePulse::m_timeCorr
float m_timeCorr
Definition: ZDCFitWrapper.h:366
ZDCFitWrapper::m_tempTmin
float m_tempTmin
Definition: ZDCFitWrapper.h:34
ZDCFitExpFermiPrePulse::ConstrainFit
virtual void ConstrainFit() override
Definition: ZDCFitWrapper.cxx:308
ZDCFitExpFermiVariableTaus::m_fixTau2
bool m_fixTau2
Definition: ZDCFitWrapper.h:167
ZDCFitGeneralPulse::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:1002
ZDCFitExpFermiLHCfPrePulse::m_norm
float m_norm
Definition: ZDCFitWrapper.h:467
ZDCFitExpFermiFixedTaus::m_norm
float m_norm
Definition: ZDCFitWrapper.h:303
ZDCFitExpFermiLHCfPreExp::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:656
ZDCFermiExpFit
double ZDCFermiExpFit(const double *xvec, const double *pvec)
Definition: ZDCFitWrapper.h:1190
ZDCFitExpFermiVariableTaus::m_tau2
float m_tau2
Definition: ZDCFitWrapper.h:170
ZDCFitExpFermiVariableTausLHCf::m_fixTau2
bool m_fixTau2
Definition: ZDCFitWrapper.h:234
ZDCFitComplexPrePulse::DoInitialize
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override
Definition: ZDCFitWrapper.cxx:898