ATLAS Offline Software
Loading...
Searching...
No Matches
ZDCFitWrapper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ZDCANALYSIS_ZDCFITWRAPPER_H
6#define ZDCANALYSIS_ZDCFITWRAPPER_H
7
9
10// Base class that defines the interface
11//
12#include <TF1.h>
13#include <memory>
14#include <cmath>
15#include <stdexcept>
16#include <algorithm> //std::max
17
18inline double ZDCFermiExpFit(const double* xvec, const double* pvec);
19inline double ZDCFermiExpFitRefl(const double* xvec, const double* pvec);
20inline double ZDCFermiExpFitInduct(const double* xvec, const double* pvec);
21inline double getInductFuncTimeMax(const TF1* theTF1);
22
24{
25private:
26 std::shared_ptr<TF1> m_wrapperTF1{};
27
28 float m_tmin{0};
29 float m_tmax{0};
30
31 float m_ampMin{0};
32 float m_ampMax{0};
33
34 float m_t0Min{0};
35 float m_t0Max{0};
36
37 bool m_adjTLimitsEvent{false};
38 float m_tminAdjust{0};
39 float m_tempTmin{0};
40 float m_tempTmax{0};
41
42 bool m_finalized{false};
43
44protected:
45 // Actually sets the t0 parameter limits in the fit function
46 //
47 virtual void SetT0FitLimits(float tMin, float tMax) = 0;
48
49public:
50 ZDCFitWrapper(const std::shared_ptr<TF1>& wrapperTF1) : m_wrapperTF1(wrapperTF1),
51 m_ampMin(0),
52 m_adjTLimitsEvent(true) // true here forces a setting of T0 par limits on first event
53 {
54 m_tmin = m_wrapperTF1->GetXmin();
55 m_tmax = m_wrapperTF1->GetXmax();
56
59 }
60
61 virtual ~ZDCFitWrapper() {}
62
63 void Initialize(float initialAmp, float initialT0, float ampMin, float ampMax);
64 void Initialize(float initialAmp, float initialT0, float ampMin, float ampMax, float fitTmin, float fitTmax, float fitTRef);
65
66 bool finalized() const {return m_finalized;}
67
68 virtual void Finalize()
69 {
70 DoFinalize();
71 m_finalized = true;
72 }
73
74 // Performs the class-specific event initialization
75 //
76 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) = 0;
77 virtual void DoFinalize() {}
78
79 void SetAmpMinMax(float minAmp, float maxAmp)
80 {
81 m_ampMin = minAmp;
82 m_ampMax = maxAmp;
83 }
84
85 void SetT0Range(float t0Min, float t0Max)
86 {
87 m_t0Min = t0Min;
88 m_t0Max = t0Max;
89
90 SetT0FitLimits(t0Min, t0Max);
91 }
92
93 virtual void ConstrainFit() = 0;
94 virtual void UnconstrainFit() = 0;
95
96 virtual float GetAmplitude() const = 0;
97 virtual float GetAmpError() const = 0;
98 virtual float GetTime() const = 0;
99 virtual float GetTau1() const = 0;
100 virtual float GetTau2() const = 0;
101
102
103 float GetMinAmp() const {return m_ampMin;}
104 float GetMaxAmp() const {return m_ampMax;}
105
106 float GetTMin() const {return m_tmin;}
107 float GetTMax() const {return m_tmax;}
108
109 float GetT0Min() const {
110 if (m_adjTLimitsEvent) return m_tempTmin;
111 else return m_t0Min;
112 }
113
114 float GetT0Max() const {
115 if (m_adjTLimitsEvent) return m_tempTmax;
116 else return m_t0Max;
117 }
118
119 float GetTMinAdjust() const {return m_tminAdjust;}
120
121 virtual float GetBkgdMaxFraction() const = 0;
122
123 virtual unsigned int GetNumShapeParameters() const = 0;
124 virtual float GetShapeParameter(size_t index) const = 0;
125
126 virtual double operator()(const double *x, const double *p) = 0;
127
128 virtual std::shared_ptr<TF1> GetWrapperTF1() {return m_wrapperTF1;}
129 virtual const TF1* GetWrapperTF1() const {return m_wrapperTF1.get();}
130 virtual TF1* GetWrapperTF1RawPtr() const {return m_wrapperTF1.get();}
131};
132
134{
135protected:
138public:
139 ZDCPrePulseFitWrapper(std::shared_ptr<TF1> wrapperTF1) : ZDCFitWrapper(wrapperTF1)
140 {
143 }
144
145 virtual void SetInitialPrePulse(float amp, float t0, float expamp, bool fixPrePulseToZero) = 0;
146
147 virtual void SetPrePulseT0Range(float tmin, float tmax) = 0;
148 virtual void SetPostPulseT0Range(float tmin, float tmax, float initialPostT0) = 0;
149
150 virtual unsigned int GetPreT0ParIndex() const = 0;
151
152 virtual float GetPreT0() const = 0;
153 virtual float GetPreAmp() const = 0;
154
155 virtual float GetPostT0() const = 0;
156 virtual float GetPostAmp() const = 0;
157
158 virtual float GetExpAmp() const = 0;
159};
160
162{
163protected:
166
167public:
168 ZDCPreExpFitWrapper(std::shared_ptr<TF1> wrapperTF1, float defaultExpTau, bool fixTau) :
169 ZDCFitWrapper(wrapperTF1), m_defaultTau(defaultExpTau), m_fixTau(fixTau)
170 {}
171
172 virtual void SetInitialExpPulse(float expamp) = 0;
173
174 bool fixExpTau() const {return m_fixTau;}
175 float getDefaultExpTau() const {return m_defaultTau;}
176
177 virtual float GetExpAmp() const = 0;
178 virtual float GetExpTau() const = 0;
179};
180
182{
183protected:
184 bool m_fixTau1{false};
185 bool m_fixTau2{false};
186
187 float m_tau1{0};
188 float m_tau2{0};
189
190public:
191
192 ZDCFitExpFermiVariableTaus(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2);
193
194 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
195 virtual void SetT0FitLimits(float tMin, float tMax) override;
196
197 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
198 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
199
200 virtual float GetTau1() const override {return GetWrapperTF1()->GetParameter(2);}
201 virtual float GetTau2() const override {return GetWrapperTF1()->GetParameter(3);}
202
203 virtual float GetTime() const override {
204 const TF1* theTF1 = GetWrapperTF1();
205
206 float fitT0 = theTF1->GetParameter(1);
207
208 float tau1 = theTF1->GetParameter(2);
209 float tau2 = theTF1->GetParameter(3);
210
211 // Correct the time to the maximum
212 //
213 if (tau2 > tau1) fitT0 += tau1 * std::log(tau2 / tau1 - 1.0);
214 return fitT0;
215 }
216
217 virtual unsigned int GetNumShapeParameters() const override {return 1;}
218
219 virtual float GetShapeParameter(size_t index) const override
220 {
221 if (index == 0) return GetWrapperTF1()->GetParameter(4);
222 else throw std::runtime_error("Fit parameter does not exist.");
223 }
224
225 virtual float GetBkgdMaxFraction() const override
226 {
227 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
228 double amp = theTF1->GetParameter(0);
229 double constant = theTF1->GetParameter(4);
230
231 if (amp > 0) return constant / amp;
232 else return -1;
233 }
234
235 virtual double operator()(const double *x, const double *p) override{
236 return ZDCFermiExpFit(x, p);
237 }
238
239 virtual void ConstrainFit() override;
240 virtual void UnconstrainFit() override;
241};
242
243//
244// A special version of the fermi*negative exponential function that includes a term to describe
245// the "reflection" effects we see in the ZDC+LHCf joint run due to the splitting of the ZDC
246// signals to send a copy to LHCf DAQ. It's not really a reflection but an artifact introduced
247// by the bandwidth limit of the linear fan-in/fan-out module that we used.
248//
250{
251protected:
252 bool m_fixTau1{false};
253 bool m_fixTau2{false};
254
255 float m_tau1{0};
256 float m_tau2{0};
257
258public:
259
260 ZDCFitExpFermiVariableTausLHCf(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2);
261
262 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
263 virtual void SetT0FitLimits(float tMin, float tMax) override;
264
265 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
266 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
267
268 virtual float GetTau1() const override {return GetWrapperTF1()->GetParameter(2);}
269 virtual float GetTau2() const override {return GetWrapperTF1()->GetParameter(3);}
270
271 virtual float GetTime() const override {
272 const TF1* theTF1 = GetWrapperTF1();
273
274 float fitT0 = theTF1->GetParameter(1);
275
276 float tau1 = theTF1->GetParameter(2);
277 float tau2 = theTF1->GetParameter(3);
278
279 // Correct the time to the maximum
280 //
281 if (tau2 > tau1) fitT0 += tau1 * std::log(tau2 / tau1 - 1.0);
282 return fitT0;
283 }
284
285 virtual unsigned int GetNumShapeParameters() const override {return 5;}
286
287 virtual float GetShapeParameter(size_t index) const override
288 {
289 if (index < 5) return GetWrapperTF1()->GetParameter(5+index);
290 else throw std::runtime_error("Fit parameter does not exist.");
291 }
292
293 virtual float GetBkgdMaxFraction() const override
294 {
295 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
296 double amp = theTF1->GetParameter(0);
297 double constant = theTF1->GetParameter(4);
298
299 if (amp > 0) return constant / amp;
300 else return 1;
301 }
302
303 virtual double operator()(const double *x, const double *p) override{
304 return ZDCFermiExpFitRefl(x, p);
305 }
306
307 virtual void ConstrainFit() override;
308 virtual void UnconstrainFit() override;
309};
310
312{
313protected:
314 bool m_fixTau1{false};
315 bool m_fixTau2{false};
316 bool m_fixDelta{false};
317
318 float m_tau1{0};
319 float m_tau2{0};
320
321 float m_tFuncMax{-999};
322 float m_funcMax{-999};
323
324 virtual void DoFinalize() override
325 {
326 TF1* theTF1 = GetWrapperTF1RawPtr();
327 theTF1->SetNpx(20);
330 theTF1->SetNpx(1000);
331 }
332
333public:
334
335 ZDCFitExpFermiVariableTausInduct(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2);
336
337 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
338 virtual void SetT0FitLimits(float tMin, float tMax) override;
339
340 void FixDelta(float value)
341 {
342 m_fixDelta = true;
343 ZDCFitWrapper::GetWrapperTF1()->FixParameter(9, value);
344 }
345
346 virtual float GetAmplitude() const override {
347 if (finalized()) return m_funcMax;
349 }
350
351 virtual float GetAmpError() const override {
352 return GetWrapperTF1()->GetParError(0);
353 }
354
355 virtual float GetTau1() const override {return GetWrapperTF1()->GetParameter(2);}
356 virtual float GetTau2() const override {return GetWrapperTF1()->GetParameter(3);}
357
358 virtual float GetTime() const override {
359 if (finalized()) return m_tFuncMax;
360 else return getInductFuncTimeMax(GetWrapperTF1());
361 }
362
363 virtual unsigned int GetNumShapeParameters() const override {return 5;}
364
365 virtual float GetShapeParameter(size_t index) const override
366 {
367 if (index < 5) return GetWrapperTF1()->GetParameter(4+index);
368 else throw std::runtime_error("Fit parameter does not exist.");
369 }
370
371 virtual float GetBkgdMaxFraction() const override
372 {
373
374 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
375 double amp = GetAmplitude();
376 double constant = theTF1->GetParameter(4);
377
378 if (amp > 1e-6) return constant / amp;
379 else return -1;
380 }
381
382 virtual double operator()(const double *x, const double *p) override{
383 return ZDCFermiExpFitInduct(x, p);
384 }
385
386 virtual void ConstrainFit() override;
387 virtual void UnconstrainFit() override;
388};
389
391{
392public:
393 ZDCFitExpFermiVariableTausRun3(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2);
394};
395
397{
398private:
399 float m_tau1{0};
400 float m_tau2{0};
401
402 float m_norm{0};
403 float m_timeCorr{0};
404
405 std::shared_ptr<TF1> m_expFermiFunc{};
406
407public:
408
409 ZDCFitExpFermiFixedTaus(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
410
412
413 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
414 virtual void SetT0FitLimits(float tMin, float tMax) override;
415
416 virtual void ConstrainFit() override;
417 virtual void UnconstrainFit() override;
418
419 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
420 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
421
422 virtual float GetTau1() const override {return m_tau1;}
423 virtual float GetTau2() const override {return m_tau2;}
424
425 virtual float GetTime() const override {
426 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
427 }
428
429 virtual unsigned int GetNumShapeParameters() const override {return 2;}
430
431 virtual float GetShapeParameter(size_t index) const override
432 {
433 if (index == 0) return m_tau1;
434 else if (index == 1) return m_tau2;
435 else throw std::runtime_error("Fit parameter does not exist.");
436 }
437
438 virtual float GetBkgdMaxFraction() const override
439 {
440 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
441 double amp = theTF1->GetParameter(0);
442 if (amp <= 0) return -1;
443
444 double C = theTF1->GetParameter(2);
445 return C / amp;
446 }
447
448 virtual double operator() (const double *x, const double *p) override
449 {
450 double amp = p[0];
451 double t0 = p[1];
452 double C = p[2];
453
454 double deltaT = x[0] - t0;
455
456 double expFermi = amp * m_norm * m_expFermiFunc->operator()(deltaT);
457
458 return expFermi + C; // + bckgd;
459 }
460};
461
463{
464private:
465 float m_tau1{0};
466 float m_tau2{0};
467 float m_norm{0};
468 float m_timeCorr{0};
469
470 std::shared_ptr<TF1> m_expFermiFunc = 0;
471 std::shared_ptr<TF1> m_expFermiPreFunc = 0;
472
473public:
474 ZDCFitExpFermiPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
476
477 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
478 virtual void SetT0FitLimits(float tMin, float tMax) override;
479
480
481 virtual void SetInitialPrePulse(float amp, float t0, float /*expamp = 0*/, bool /*fixPrePulseToZero = false*/) override {
482 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 1.5)); //1.5 here ensures that we're above lower limit
483 GetWrapperTF1()->SetParameter(3, t0);
484 }
485
486 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
487 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
488
489 virtual void ConstrainFit() override;
490 virtual void UnconstrainFit() override;
491
492 virtual unsigned int GetPreT0ParIndex() const override {return 3;}
493
494 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
495 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
496
497 virtual float GetTau1() const override {return m_tau1;}
498 virtual float GetTau2() const override {return m_tau2;}
499
500 virtual float GetPreT0() const override {return 0;}
501 virtual float GetPreAmp() const override {return 0;}
502
503 virtual float GetPostT0() const override {return 0;}
504 virtual float GetPostAmp() const override {return 0;}
505
506 virtual float GetExpAmp() const override {return 0;}
507
508 virtual float GetTime() const override {
509 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
510 }
511
512 virtual unsigned int GetNumShapeParameters() const override {return 1;}
513
514 virtual float GetShapeParameter(size_t index) const override
515 {
516 if (index < 1) return GetWrapperTF1()->GetParameter(4);
517 else throw std::runtime_error("Fit parameter does not exist.");
518 }
519
520 virtual float GetBkgdMaxFraction() const override
521 {
522 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
523
524 double maxTime = GetTime();
525
526 double amp = theTF1->GetParameter(0);
527 if (amp <= 0) return -1;
528
529 double preAmp = theTF1->GetParameter(2);
530 double preT0 = theTF1->GetParameter(3);
531
532 double deltaTPre = maxTime - preT0;
533 double background = preAmp * m_norm * m_expFermiFunc->operator()(deltaTPre);
534
535 return background / (amp + background);
536 }
537
538 virtual double operator() (const double *x, const double *p) override
539 {
540 double t = x[0];
541
542 double amp = p[0];
543 double t0 = p[1];
544 double preAmp = p[2];
545 double preT0 = p[3];
546 double C = p[4];
547
548 double deltaT = t - t0;
549 double deltaTPre = t - preT0;
550
551 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
552 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
553 //
554 double deltaPresamp = GetTMinAdjust() - preT0;
555
556 // double bckgd = linSlope*t;
557
558 double pulse1 = amp*m_norm*m_expFermiFunc->operator()(deltaT);
559 double pulse2 = preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
560 m_expFermiFunc->operator()(deltaPresamp));
561
562 return C + pulse1 + pulse2;// + bckgd;
563 }
564};
565
567{
568private:
569 float m_tau1{0};
570 float m_tau2{0};
571 float m_timeCorr{0};
572
573 double m_preNorm{1.};
574
575 std::shared_ptr<TF1> m_expFermiLHCfFunc = 0;
576 std::shared_ptr<TF1> m_expFermiPreFunc = 0;
577
578public:
579 ZDCFitExpFermiLHCfPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
581
582 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
583 virtual void SetT0FitLimits(float tMin, float tMax) override;
584
585
586 virtual void SetInitialPrePulse(float amp, float t0, float /*expamp = 0*/, bool /*fixPrePulseToZero = false*/) override
587 {
588 double ampMin, ampMax;
589
590 GetWrapperTF1()->GetParLimits(2, ampMin, ampMax);
591 double initialAmp = std::min<double>(std::max<double>(amp, ampMin), ampMax);
592
593 GetWrapperTF1()->SetParameter(4, initialAmp);
594 GetWrapperTF1()->SetParameter(5, t0);
595 }
596
597 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
598 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
599
600 virtual void ConstrainFit() override;
601 virtual void UnconstrainFit() override;
602
603 virtual unsigned int GetPreT0ParIndex() const override {return 3;}
604
605 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
606 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
607
608 virtual float GetTau1() const override {return m_tau1;}
609 virtual float GetTau2() const override {return m_tau2;}
610
611 virtual float GetPreT0() const override {return GetWrapperTF1()->GetParameter(3);}
612 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(3);}
613
614 virtual float GetPostT0() const override {return 0;}
615 virtual float GetPostAmp() const override {return 0;}
616
617 virtual float GetExpAmp() const override {return 0;}
618
619 virtual float GetTime() const override {
620 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
621 }
622
623 virtual unsigned int GetNumShapeParameters() const override {return 1;}
624
625 virtual float GetShapeParameter(size_t index) const override
626 {
627 if (index < 1) return GetWrapperTF1()->GetParameter(6);
628 else throw std::runtime_error("Fit parameter does not exist.");
629 }
630
631 virtual float GetBkgdMaxFraction() const override
632 {
633 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
634
635 double maxTime = GetTime();
636
637 double amp = theTF1->GetParameter(0);
638 if (amp <= 0) return -1;
639
640 double preAmp = theTF1->GetParameter(2);
641 double preT0 = theTF1->GetParameter(3);
642
643 double deltaTPre = maxTime - preT0;
644 double background = preAmp * m_preNorm * m_expFermiLHCfFunc->operator()(deltaTPre);
645
646 return background / (amp + background);
647 }
648
649 virtual double operator() (const double *x, const double *p) override
650 {
651 double t = x[0];
652
653 double amp = p[0];
654 double t0 = p[1];
655 double tau1 = p[2];
656 double tau2 = p[3];
657 double preAmp = p[4];
658 double preT0 = p[5];
659 double C = p[6];
660
661 m_expFermiLHCfFunc->SetParameter(0, amp);
662 m_expFermiLHCfFunc->SetParameter(2, tau1);
663 m_expFermiLHCfFunc->SetParameter(3, tau2);
664 m_expFermiLHCfFunc->SetParameter(4, tau2);
665
666 double deltaT = t - t0;
667 double deltaTPre = t - preT0;
668
669 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
670 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
671 //
672 double deltaPresamp = GetTMinAdjust() - preT0;
673
674 double pulse1 = m_expFermiLHCfFunc->operator()(deltaT);
675 double pulse2 = preAmp * m_preNorm * (m_expFermiPreFunc->operator()(deltaTPre) -
676 m_expFermiPreFunc->operator()(deltaPresamp));
677
678 return C + pulse1 + pulse2;
679 }
680};
681
683{
684private:
685 float m_tau1{0};
686 float m_tau2{0};
687 float m_timeCorr{0};
688 double m_norm{};
689
690 std::shared_ptr<TF1> m_expFermiFunc{0};
691 std::shared_ptr<TF1> m_expFermiPreFunc{0};
692
693public:
694 ZDCFitExpFermiPreExp(const std::string& tag, float tmin, float tmax, float tau1, float tau2,
695 float defExpTau, float fixExpTau);
697
698 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
699 virtual void SetT0FitLimits(float tMin, float tMax) override;
700
701 virtual void SetInitialExpPulse(float amp) override
702 {
703 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 0.5)); //0.5 here ensures that we're above lower limit (0)
704 }
705
706 virtual void ConstrainFit() override;
707 virtual void UnconstrainFit() override;
708
709 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
710 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
711
712 virtual float GetTau1() const override {return m_tau1;}
713 virtual float GetTau2() const override {return m_tau2;}
714
715 virtual float GetTime() const override {
716 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
717 }
718
719 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(2);}
720 virtual float GetExpTau() const override {return GetWrapperTF1()->GetParameter(3);}
721
722 virtual unsigned int GetNumShapeParameters() const override {return 2;}
723
724 virtual float GetShapeParameter(size_t index) const override
725 {
726 if (index < 2) return GetWrapperTF1()->GetParameter(index + 4);
727 else throw std::runtime_error("Fit parameter does not exist.");
728 }
729
730 virtual float GetBkgdMaxFraction() const override
731 {
732 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
733 double maxTime = GetTime();
734
735 double amp = theTF1->GetParameter(0);
736 if (amp <= 0) return -1;
737
738 double preAmp = theTF1->GetParameter(2);
739 double preT0 = theTF1->GetParameter(3);
740
741 double deltaTPre = maxTime - preT0;
742 double background = preAmp * m_norm * m_expFermiFunc->operator()(deltaTPre);
743
744 return background / (amp + background);
745 }
746
747 virtual double operator() (const double *x, const double *p) override
748 {
749 double t = x[0];
750
751 double amp = p[0];
752 double t0 = p[1];
753 double expAmp = p[2];
754 double expTau = p[3];
755 double expSqrtTau = p[4];
756 double C = p[5];
757
758 double deltaT = t - t0;
759 double pulse = amp * m_norm * m_expFermiFunc->operator()(deltaT);
760
761 // We subtract off the value of the exponential pulse at the minimum time (nominally 0),
762 // because it would have been included in the baseline subtraction
763 //
764 double tRef = GetTMinAdjust();
765 double expPre = 0;
766 if (t > 0 && std::abs(expSqrtTau)>1e-6) expPre = expAmp * (std::exp(-t/expTau-expSqrtTau*std::sqrt(t)) - std::exp(-tRef/expTau));
767 else expPre = expAmp * (std::exp(-t/expTau) - std::exp(-tRef/expTau));
768
769 return C + pulse + expPre;
770 }
771};
772
774{
775private:
776 float m_tau1{0};
777 float m_tau2{0};
778 float m_timeCorr{0};
779
780 std::shared_ptr<TF1> m_expFermiLHCfFunc{};
781 std::shared_ptr<TF1> m_expFermiLHCfPreFunc{};
782
783public:
784 ZDCFitExpFermiLHCfPreExp(const std::string& tag, float tmin, float tmax, float tau1, float tau2,
785 float defExpTau, float fixExpTau);
787
788 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
789 virtual void SetT0FitLimits(float tMin, float tMax) override;
790
791 virtual void SetInitialExpPulse(float amp) override
792 {
793 GetWrapperTF1()->SetParameter(4, std::max(amp, (float) 0.5)); //0.5 here ensures that we're above lower limit (0)
794 }
795
796 virtual void ConstrainFit() override;
797 virtual void UnconstrainFit() override;
798
799 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
800 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
801
802 virtual float GetTau1() const override {return m_tau1;}
803 virtual float GetTau2() const override {return m_tau2;}
804
805 virtual float GetTime() const override {
806 const TF1* theTF1 = GetWrapperTF1();
807
808 float fitT0 = theTF1->GetParameter(1);
809
810 float tau1 = theTF1->GetParameter(2);
811 float tau2 = theTF1->GetParameter(3);
812
813 // Correct the time to the maximum
814 //
815 if (tau2 > tau1) fitT0 += tau1 * std::log(tau2 / tau1 - 1.0);
816 return fitT0;
817 }
818
819 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(4);}
820 virtual float GetExpTau() const override {return GetWrapperTF1()->GetParameter(5);}
821
822 virtual unsigned int GetNumShapeParameters() const override {return 1;}
823 virtual float GetShapeParameter(size_t index) const override
824 {
825 if (index < 1) return GetWrapperTF1()->GetParameter(5);
826 else throw std::runtime_error("Fit parameter does not exist.");
827 }
828
829 virtual float GetBkgdMaxFraction() const override
830 {
831 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
832 double amp = theTF1->GetParameter(0);
833 if (amp <= 0) return -1;
834
835 double maxTime = GetTime();
836
837 double expAmp = theTF1->GetParameter(4);
838 double expTau = theTF1->GetParameter(5);
839 double bexpSqrt = theTF1->GetParameter(6);
840
841 double tRef = GetTMinAdjust();
842 double expPre = expAmp * (std::exp(-maxTime/expTau - bexpSqrt*maxTime*maxTime) - std::exp(-tRef/expTau - bexpSqrt*tRef*tRef));
843
844 return expPre / (amp + expPre);
845 }
846
847 virtual double operator() (const double *x, const double *p) override
848 {
849 double t = x[0];
850
851 double amp = p[0];
852 double t0 = p[1];
853
854 double tau1 = p[2];
855 double tau2 = p[3];
856
857 double expAmp = p[4];
858 double expTau = p[5];
859 double bexpSqrt = p[6];
860 double reflFrac = p[7];
861
862 m_expFermiLHCfFunc->SetParameter(0, amp);
863 m_expFermiLHCfFunc->SetParameter(2, tau1);
864 m_expFermiLHCfFunc->SetParameter(3, tau2);
865 m_expFermiLHCfFunc->SetParameter(6, reflFrac);
866
867 m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
868
869 double deltaT = t - t0;
870 double pulse = m_expFermiLHCfFunc->operator()(deltaT);
871
872 // We subtract off the value of the exponential pulse at the minimum time (nominally 0),
873 // because it would have been included in the baseline subtraction
874 //
875 double tRef = GetTMinAdjust();
876 double expPre = 0;
877
878 expPre = expAmp * (std::exp(-t/expTau - bexpSqrt*t*t) - std::exp(-tRef/expTau - bexpSqrt*tRef*tRef));
879
880 return pulse + expPre;
881 }
882};
883
885{
886private:
887 float m_tau1{0};
888 float m_tau2{0};
889 float m_timeCorr{0};
890
891 float m_tFuncMax{-999};
892 float m_funcMax{-999};
893
894 std::shared_ptr<TF1> m_expFermiInductFunc{0};
895 std::shared_ptr<TF1> m_expFermiPreFunc{0};
896
897 virtual void DoFinalize() override
898 {
899 m_expFermiInductFunc->SetNpx(20);
900 double t0 = GetWrapperTF1()->GetParameter(1);
901 double tsubtr = getInductFuncTimeMax(m_expFermiInductFunc.get());
902
903 m_tFuncMax = tsubtr + t0;
904 m_funcMax = m_expFermiInductFunc->Eval(tsubtr);
905 }
906
907public:
908 ZDCFitExpFermiInductPreExp(const std::string& tag, float tmin, float tmax, float tau1, float tau2,
909 float defExpTau, float fixExpTau);
911
912 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
913 virtual void SetT0FitLimits(float tMin, float tMax) override;
914
915 virtual void SetInitialExpPulse(float amp) override
916 {
917 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 0.5)); //0.5 here ensures that we're above lower limit (0)
918 }
919
920 virtual void ConstrainFit() override;
921 virtual void UnconstrainFit() override;
922
923 virtual float GetAmplitude() const override {
924 if (finalized()) return m_funcMax;
926 }
927
928 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
929
930 virtual float GetTau1() const override {return m_tau1;}
931 virtual float GetTau2() const override {return m_tau2;}
932
933 virtual float GetTime() const override {
934 if (finalized()) return m_tFuncMax;
935 return getInductFuncTimeMax(m_expFermiInductFunc.get()) + GetWrapperTF1()->GetParameter(1);
936 }
937
938 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(2);}
939 virtual float GetExpTau() const override {return GetWrapperTF1()->GetParameter(3);}
940
941 virtual unsigned int GetNumShapeParameters() const override {return 3;}
942
943 virtual float GetShapeParameter(size_t index) const override
944 {
945 if (index < 3) {
946 if (index == 0) return GetWrapperTF1()->GetParameter(4);
947 if (index == 1) return GetWrapperTF1()->GetParameter(6);
948 if (index == 2) return GetWrapperTF1()->GetParameter(7);
949 }
950 throw std::runtime_error("Fit parameter does not exist.");
951 }
952
953 virtual float GetBkgdMaxFraction() const override
954 {
955 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
956 double amp = theTF1->GetParameter(0);
957 if (amp < 1e-6) return -1;
958
959 double maxTime = GetTime();
960
961 double expAmp = theTF1->GetParameter(2);
962 double expTau = theTF1->GetParameter(3);
963 double bexpSqrt = theTF1->GetParameter(4);
964
965 double tRef = GetTMinAdjust();
966 double expPre = expAmp * (std::exp(-maxTime/expTau - bexpSqrt*maxTime*maxTime) - std::exp(-tRef/expTau - bexpSqrt*tRef*tRef));
967
968 return expPre / (amp + expPre);
969 }
970
971 virtual double operator() (const double *x, const double *p) override
972 {
973 double t = x[0];
974
975 double amp = p[0];
976 double t0 = p[1];
977
978 double expAmp = p[2];
979 double expTau = p[3];
980 double bexpSqrt = p[4];
981 double C = p[5];
982 double inductA = p[6];
983 double inductB = p[7];
984
985 m_expFermiInductFunc->SetParameter(0, amp);
986 m_expFermiInductFunc->SetParameter(6, inductA);
987 m_expFermiInductFunc->SetParameter(7, inductB);
988
989 double deltaT = t - t0;
990 double pulse = m_expFermiInductFunc->operator()(deltaT);
991
992 // We subtract off the value of the exponential pulse at the minimum time (nominally 0),
993 // because it would have been included in the baseline subtraction
994 //
995 double tRef = GetTMinAdjust();
996 double expPre = 0;
997
998 expPre = expAmp * (std::exp(-t/expTau - bexpSqrt*t*t) - std::exp(-tRef/expTau - bexpSqrt*tRef*tRef));
999
1000 return pulse + C + expPre;
1001 }
1002};
1003
1005{
1006private:
1007 float m_tau1{0};
1008 float m_tau2{0};
1009
1010 float m_tFuncMax{-999};
1011 float m_funcMax{-999};
1012
1013 double m_preNorm{1.};
1014
1015 std::shared_ptr<TF1> m_expFermiInductFunc = 0;
1016 std::shared_ptr<TF1> m_expFermiPreFunc = 0;
1017
1018 virtual void DoFinalize() override
1019 {
1020 m_expFermiInductFunc->SetNpx(20);
1021 double t0 = GetWrapperTF1()->GetParameter(1);
1022 double tsubtr = getInductFuncTimeMax(m_expFermiInductFunc.get());
1023
1024 m_tFuncMax = tsubtr + t0;
1025 m_funcMax = m_expFermiInductFunc->Eval(tsubtr);
1026 }
1027
1028public:
1029 ZDCFitExpFermiInductPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1031
1032 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1033 virtual void SetT0FitLimits(float tMin, float tMax) override;
1034
1035
1036 virtual void SetInitialPrePulse(float amp, float t0, float /*expamp = 0*/, bool /*fixPrePulseToZero = false*/) override
1037 {
1038 double ampMin, ampMax;
1039
1040 GetWrapperTF1()->GetParLimits(2, ampMin, ampMax);
1041 double initialAmp = std::min<double>(std::max<double>(amp, ampMin), ampMax);
1042
1043 GetWrapperTF1()->SetParameter(2, initialAmp);
1044 GetWrapperTF1()->SetParameter(3, t0);
1045 }
1046
1047 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
1048 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
1049
1050 virtual void ConstrainFit() override;
1051 virtual void UnconstrainFit() override;
1052
1053 virtual unsigned int GetPreT0ParIndex() const override {return 3;}
1054
1055 virtual float GetAmplitude() const override {
1056 if (finalized()) return m_funcMax;
1058 }
1059
1060 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1061
1062 virtual float GetTau1() const override {return m_tau1;}
1063 virtual float GetTau2() const override {return m_tau2;}
1064
1065 virtual float GetPreT0() const override {return GetWrapperTF1()->GetParameter(3);}
1066 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(3);}
1067
1068 virtual float GetPostT0() const override {return 0;}
1069 virtual float GetPostAmp() const override {return 0;}
1070
1071 virtual float GetExpAmp() const override {return 0;}
1072
1073 virtual float GetTime() const override {
1074 if (finalized()) return m_tFuncMax;
1075 return getInductFuncTimeMax(m_expFermiInductFunc.get()) + GetWrapperTF1()->GetParameter(1);
1076 }
1077
1078 virtual unsigned int GetNumShapeParameters() const override {return 3;}
1079
1080 virtual float GetShapeParameter(size_t index) const override
1081 {
1082 if (index < 3) {
1083 if (index == 0) return GetWrapperTF1()->GetParameter(4);
1084 if (index == 1) return GetWrapperTF1()->GetParameter(6);
1085 if (index == 2) return GetWrapperTF1()->GetParameter(7);
1086 }
1087 throw std::runtime_error("Fit parameter does not exist.");
1088 }
1089
1090 virtual float GetBkgdMaxFraction() const override
1091 {
1092 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1093
1094 double maxTime = GetTime();
1095
1096 double amp = theTF1->GetParameter(0);
1097 if (amp < 1e-6) return -1;
1098
1099 double preAmp = theTF1->GetParameter(2);
1100 double preT0 = theTF1->GetParameter(3);
1101
1102 double deltaTPre = maxTime - preT0;
1103 double background = preAmp * m_preNorm * m_expFermiInductFunc->operator()(deltaTPre);
1104
1105 return background / (amp + background);
1106 }
1107
1108 virtual double operator() (const double *x, const double *p) override
1109 {
1110 double t = x[0];
1111
1112 double amp = p[0];
1113 double t0 = p[1];
1114 double preAmp = p[2];
1115 double preT0 = p[3];
1116 double C = p[4];
1117 double indA = p[5];
1118 double indBFact = p[6];
1119
1120 m_expFermiInductFunc->SetParameter(0, amp);
1121 m_expFermiInductFunc->SetParameter(6, indA);
1122 m_expFermiInductFunc->SetParameter(7, indBFact);
1123
1124 double deltaT = t - t0;
1125 double deltaTPre = t - preT0;
1126
1127 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
1128 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
1129 //
1130 double deltaPresamp = GetTMinAdjust() - preT0;
1131
1132 double pulse1 = m_expFermiInductFunc->operator()(deltaT);
1133 double pulse2 = preAmp * m_preNorm * (m_expFermiPreFunc->operator()(deltaTPre) -
1134 m_expFermiPreFunc->operator()(deltaPresamp));
1135
1136 return C + pulse1 + pulse2;
1137 }
1138};
1139
1140
1141// ----------------------------------------------------------------------
1143{
1144private:
1145 float m_tau1{};
1146 float m_tau2{};
1147
1148 float m_norm{};
1149 float m_timeCorr{};
1150
1151 std::shared_ptr<TF1> m_expFermiFunc;
1152
1153public:
1154
1155 ZDCFitExpFermiLinearFixedTaus(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1156
1158
1159 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1160 virtual void SetT0FitLimits(float tMin, float tMax) override;
1161
1162 virtual void ConstrainFit() override;
1163 virtual void UnconstrainFit() override;
1164
1165 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
1166 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1167
1168 virtual float GetTau1() const override {return m_tau1;}
1169 virtual float GetTau2() const override {return m_tau2;}
1170
1171 virtual float GetTime() const override {
1172 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
1173 }
1174
1175 virtual unsigned int GetNumShapeParameters() const override {return 2;}
1176 virtual float GetShapeParameter(size_t index) const override
1177 {
1178 if (index < 2) return GetWrapperTF1()->GetParameter(index + 2);
1179 else throw std::runtime_error("Fit parameter does not exist.");
1180 }
1181
1182 virtual float GetBkgdMaxFraction() const override
1183 {
1184 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1185 double amp = theTF1->GetParameter(0);
1186 if (amp <= 0) return -1;
1187
1188 double slope = theTF1->GetParameter(2);
1189
1190 double background = slope * GetTime();
1191 return background / amp;
1192 }
1193
1194 virtual double operator() (const double *x, const double *p) override
1195 {
1196 double amp = p[0];
1197 double t0 = p[1];
1198 double deltaT = x[0] - t0;
1199
1200 double bckgd = p[2] * x[0] + p[3];
1201
1202 double expFermi = amp * m_norm * m_expFermiFunc->operator()(deltaT);
1203
1204 return expFermi + bckgd;
1205 }
1206};
1207
1208// ----------------------------------------------------------------------
1210{
1211private:
1212 float m_tau1{};
1213 float m_tau2{};
1214 float m_norm{};
1215 float m_timeCorr{};
1216 std::shared_ptr<TF1> m_expFermiFunc;
1217
1218public:
1219 ZDCFitExpFermiLinearPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1221
1222 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1223 virtual void SetT0FitLimits(float tMin, float tMax) override;
1224
1225 virtual void ConstrainFit() override;
1226 virtual void UnconstrainFit() override;
1227
1228 virtual void SetInitialPrePulse(float amp, float t0, float /*expamp = 0*/, bool /*fixPrePulseToZero = false*/) override {
1229 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 1.5)); //1.5 here ensures that we're above lower limit
1230 GetWrapperTF1()->SetParameter(3, t0);
1231 }
1232
1233 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
1234 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
1235
1236 unsigned int GetPreT0ParIndex() const override {return 3;}
1237
1238 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
1239 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1240
1241 virtual float GetTau1() const override {return m_tau1;}
1242 virtual float GetTau2() const override {return m_tau2;}
1243
1244 virtual float GetPreT0() const override {
1245 float fitPreT0 = GetWrapperTF1()->GetParameter(3);
1246
1247 // Correct the time to the maximum
1248 //
1249 fitPreT0 += m_timeCorr;
1250
1251 return fitPreT0;
1252 }
1253 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(2);}
1254
1255 virtual float GetPostT0() const override {return 0;}
1256 virtual float GetPostAmp() const override {return 0;}
1257
1258 virtual float GetExpAmp() const override {return 0;}
1259
1260 virtual float GetTime() const override {
1261 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
1262 }
1263
1264 virtual unsigned int GetNumShapeParameters() const override {return 1;}
1265
1266 virtual float GetShapeParameter(size_t index) const override
1267 {
1268 if (index < 1) return GetWrapperTF1()->GetParameter(index + 4);
1269 else throw std::runtime_error("Fit parameter does not exist.");
1270 }
1271
1272 virtual float GetBkgdMaxFraction() const override
1273 {
1274 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1275
1276 double maxTime = GetTime();
1277
1278 double amp = theTF1->GetParameter(0);
1279 if (amp <= 0) return -1;
1280
1281 double preAmp = theTF1->GetParameter(2);
1282 double preT0 = theTF1->GetParameter(3);
1283 double slope = theTF1->GetParameter(4);
1284
1285 double deltaTPre = maxTime - preT0;
1286
1287 double background = slope * maxTime + preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
1288 m_expFermiFunc->operator()(-preT0));
1289
1290 return background / amp;
1291 }
1292
1293 virtual double operator() (const double *x, const double *p) override
1294 {
1295 double t = x[0];
1296
1297 double amp = p[0];
1298 double t0 = p[1];
1299 double preAmp = p[2];
1300 double preT0 = p[3];
1301 double linSlope = p[4];
1302
1303 double deltaT = t - t0;
1304 double deltaTPre = t - preT0;
1305
1306 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
1307 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
1308 //
1309 double deltaPresamp = GetTMinAdjust() - preT0;
1310
1311 double pulse1 = amp * m_norm * m_expFermiFunc->operator()(deltaT);
1312 double pulse2 = preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
1313 m_expFermiFunc->operator()(deltaPresamp));
1314
1315 double bckgd = linSlope * (t - deltaPresamp) + p[5];
1316
1317 return pulse1 + pulse2 + bckgd;
1318 }
1319};
1320
1321
1322
1323// ----------------------------------------------------------------------
1325{
1326private:
1327 float m_tau1{};
1328 float m_tau2{};
1329 float m_norm{};
1330 float m_timeCorr{};
1331 std::shared_ptr<TF1> m_expFermiFunc;
1332
1333public:
1334 ZDCFitComplexPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1336
1337 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1338 virtual void SetT0FitLimits(float tMin, float tMax) override;
1339
1340 virtual void SetInitialPrePulse(float amp, float t0, float expamp, bool /*fixPrePulseToZero = false*/) override {
1341 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 1.5)); //1.5 here ensures that we're above lower limit
1342 GetWrapperTF1()->SetParameter(3, t0);
1343 GetWrapperTF1()->SetParameter(6, std::max(std::abs(expamp), (float) 1.5));
1344 }
1345
1346 virtual void ConstrainFit() override;
1347 virtual void UnconstrainFit() override;
1348
1349 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
1350 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
1351
1352 unsigned int GetPreT0ParIndex() const override {return 3;}
1353
1354 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
1355 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1356
1357 virtual float GetTau1() const override {return m_tau1;}
1358 virtual float GetTau2() const override {return m_tau2;}
1359
1360 virtual float GetPreT0() const override {
1361 float fitPreT0 = GetWrapperTF1()->GetParameter(3);
1362
1363 // Correct the time to the maximum
1364 //
1365 fitPreT0 += m_timeCorr;
1366
1367 return fitPreT0;
1368 }
1369 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(2);}
1370
1371 virtual float GetPostT0() const override {return 0;}
1372 virtual float GetPostAmp() const override {return 0;}
1373
1374 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(6);}
1375
1376 virtual float GetTime() const override {
1377 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
1378 }
1379
1380 virtual unsigned int GetNumShapeParameters() const override {return 3;}
1381
1382 virtual float GetShapeParameter(size_t index) const override
1383 {
1384 if (index < 3) return GetWrapperTF1()->GetParameter(4 + index);
1385 else throw std::runtime_error("Fit parameter does not exist.");
1386 }
1387
1388 virtual float GetBkgdMaxFraction() const override
1389 {
1390 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1391
1392 double maxTime = GetTime();
1393
1394 double amp = theTF1->GetParameter(0);
1395 if (amp <= 0) return -1;
1396
1397 double preAmp = theTF1->GetParameter(2);
1398 double preT0 = theTF1->GetParameter(3);
1399 double slope = theTF1->GetParameter(4);
1400
1401 double deltaTPre = maxTime - preT0;
1402
1403 double background = slope * maxTime + preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
1404 m_expFermiFunc->operator()(-preT0));
1405
1406 return background / amp;
1407 }
1408
1409 virtual double operator() (const double *x, const double *p) override
1410 {
1411 double t = x[0];
1412
1413 double amp = p[0];
1414 double t0 = p[1];
1415 double preAmp = p[2];
1416 double preT0 = p[3];
1417 double linSlope = p[4];
1418 double linConst = p[5];
1419 double expamp = p[6];
1420
1421 double deltaT = t - t0;
1422 double deltaTPre = t - preT0;
1423
1424 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
1425 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
1426 //
1427 double deltaPresamp = GetTMinAdjust() - preT0;
1428
1429 double pulse1 = amp * m_norm * m_expFermiFunc->operator()(deltaT);
1430 double pulse2 = preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) - m_expFermiFunc->operator()(deltaPresamp));
1431
1432 double linBG = linSlope * (t - deltaPresamp) + linConst;
1433 double expBG = expamp * std::exp(-(t) / m_tau2) - expamp; // deltaPresamp
1434
1435 return pulse1 + pulse2 + linBG + expBG;
1436 }
1437};
1438
1439
1440// ----------------------------------------------------------------------
1442{
1443private:
1444 float m_tau1{};
1445 float m_tau2{};
1446 float m_norm{};
1447 float m_timeCorr{};
1448 std::shared_ptr<TF1> m_expFermiFunc;
1449
1450public:
1451 ZDCFitGeneralPulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1453
1454 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1455 virtual void SetT0FitLimits(float tMin, float tMax) override;
1456
1457 virtual void SetInitialPrePulse(float amp, float t0, float expamp, bool fixPrePulseToZero) override {
1458 GetWrapperTF1()->ReleaseParameter(2);
1459 GetWrapperTF1()->ReleaseParameter(3);
1460 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 1.5)); //1.5 here ensures that we're above lower limit
1461 GetWrapperTF1()->SetParameter(3, std::max(t0, (float) 20.0));
1462 GetWrapperTF1()->SetParameter(6, std::max(std::abs(expamp), (float) 1.5));
1463
1464 if (fixPrePulseToZero) {
1465 GetWrapperTF1()->FixParameter(2, 0. );
1466 GetWrapperTF1()->FixParameter(3, 20.);
1467 }
1468 }
1469
1470 virtual void ConstrainFit() override;
1471 virtual void UnconstrainFit() override;
1472
1473 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
1474 virtual void SetPostPulseT0Range(float tmin, float tmax, float initialPostT0) override;
1475
1476 unsigned int GetPreT0ParIndex() const override {return 3;}
1477
1478 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
1479 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1480
1481 virtual float GetTau1() const override {return m_tau1;}
1482 virtual float GetTau2() const override {return m_tau2;}
1483
1484 virtual float GetPreT0() const override {
1485 float fitPreT0 = GetWrapperTF1()->GetParameter(3);
1486
1487 // Correct the time to the maximum
1488 //
1489 fitPreT0 += m_timeCorr;
1490
1491 return fitPreT0;
1492 }
1493 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(2);}
1494
1495 virtual float GetPostT0() const override {
1496 float fitPostT0 = GetWrapperTF1()->GetParameter(8);
1497
1498 // Correct the time to the maximum
1499 //
1500 fitPostT0 += m_timeCorr;
1501
1502 return fitPostT0;
1503 }
1504 virtual float GetPostAmp() const override {return GetWrapperTF1()->GetParameter(7);}
1505
1506 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(6);}
1507
1508 virtual float GetTime() const override {
1509 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
1510 }
1511
1512 virtual unsigned int GetNumShapeParameters() const override {return 5;}
1513
1514 virtual float GetShapeParameter(size_t index) const override
1515 {
1516 if (index < 5) return GetWrapperTF1()->GetParameter(index + 4);
1517 else throw std::runtime_error("Fit parameter does not exist.");
1518 }
1519
1520 virtual float GetBkgdMaxFraction() const override
1521 {
1522 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1523
1524 double maxTime = GetTime();
1525
1526 double amp = theTF1->GetParameter(0);
1527 if (amp <= 0) return -1;
1528 double preAmp = theTF1->GetParameter(2);
1529 double preT0 = theTF1->GetParameter(3);
1530 double slope = theTF1->GetParameter(4);
1531
1532 double deltaTPre = maxTime - preT0;
1533
1534 double background = slope * maxTime + preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
1535 m_expFermiFunc->operator()(-preT0));
1536
1537 return background / amp;
1538 }
1539
1540 virtual double operator() (const double *x, const double *p) override
1541 {
1542 double t = x[0];
1543
1544 double amp = p[0];
1545 double t0 = p[1];
1546 double preAmp = p[2];
1547 double preT0 = p[3];
1548 double linSlope = p[4];
1549 double linConst = p[5];
1550 double expamp = p[6];
1551 double postAmp = p[7];
1552 double postT0 = p[8];
1553
1554 double deltaT = t - t0;
1555 double deltaTPre = t - preT0;
1556 double deltaTPost = t - postT0;
1557
1558 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
1559 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
1560 //
1561 double deltaPresamp = GetTMinAdjust() - preT0;
1562
1563 double pulse1 = amp * m_norm * m_expFermiFunc->operator()(deltaT);
1564 double pulse2 = preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) - m_expFermiFunc->operator()(deltaPresamp));
1565 double pulse3 = postAmp * m_norm * m_expFermiFunc->operator()(deltaTPost);
1566
1567 double linBG = linSlope * t + linConst;
1568 double expBG = expamp * std::exp(-(t) / m_tau2) - expamp * std::exp(-(GetTMinAdjust()) / m_tau2); // deltaPresamp
1569
1570 return pulse1 + pulse2 + pulse3 + linBG + expBG;
1571 }
1572};
1573
1574double getInductFuncTimeMax(const TF1* theTF1)
1575{
1576 float fitT0 = theTF1->GetParameter(1);
1577
1578 float tau1 = theTF1->GetParameter(2);
1579 float tau2 = theTF1->GetParameter(3);
1580
1581 // Correct the time to the maximum
1582 //
1583 double corrT0 = fitT0;
1584 if (tau2 > tau1) corrT0 += tau1 * std::log(tau2 / tau1 - 1.0);
1585
1586 double deltaT = theTF1->GetParameter(5)/8;
1587 double tmin = corrT0 - deltaT;
1588 double tmax = corrT0 + deltaT;
1589
1590 return theTF1->GetMaximumX(tmin, tmax, 1e-4, 20, false);
1591}
1592
1593
1594 double ZDCFermiExpFit(const double* xvec, const double* pvec)
1595{
1596 double t = xvec[0];
1597
1598 double amp = pvec[0];
1599 double t0 = pvec[1];
1600 double tau1 = pvec[2];
1601 double tau2 = pvec[3];
1602 double C = pvec[4];
1603
1604 double tauRatio = tau2 / tau1;
1605 double tauRatioMinunsOne = tauRatio - 1;
1606
1607 double norm = (std::pow(1. / tauRatioMinunsOne, 1. / (1 + tauRatio)) /
1608 ( 1 + std::pow(1. / tauRatioMinunsOne, 1. / (1 + 1 / tauRatio))));
1609
1610 double deltaT = t - t0;
1611 if (deltaT < 0) deltaT = 0;
1612
1613 double expTerm = std::exp(-deltaT / tau2);
1614 double fermiTerm = 1. / (1. + std::exp(-(t - t0) / tau1));
1615
1616 return amp * expTerm * fermiTerm / norm + C;
1617}
1618
1619 double ZDCFermiExpFitRefl(const double* xvec, const double* pvec)
1620{
1621 double t = xvec[0];
1622
1623 double amp = pvec[0];
1624 double t0 = pvec[1];
1625 double tau1 = pvec[2];
1626 double tau2 = pvec[3];
1627 double C = pvec[4];
1628
1629 double refldelay = pvec[5];
1630 double reflFrac = pvec[6];
1631 double reflwidth = pvec[7];
1632 double delta = pvec[8];
1633
1634 double tauRatio = tau2 / tau1;
1635 double tauRatioMinunsOne = tauRatio - 1;
1636
1637 double norm = std::pow(1. / tauRatioMinunsOne, 1. / (1 + tauRatio)) /
1638 ( 1 + std::pow(1. / tauRatioMinunsOne, 1. / (1 + 1 / tauRatio))) ;
1639
1640 double deltaT = t - t0;
1641 if (deltaT < 0) deltaT = 0;
1642
1643 // Note: the small constant added here accounts for the very long tail on the pulse
1644 // which doesn't go to zero over the time range that we sample
1645 //
1646 double expTerm = delta + std::exp(-deltaT / tau2);
1647 double fermiTerm = 1. / (1. + std::exp(-(t - t0) / tau1));
1648
1649 double deltaTRefl = deltaT - refldelay;
1650 double reflTerm = -reflFrac*amp*std::exp(-0.5*deltaTRefl*deltaTRefl/reflwidth/reflwidth);
1651
1652 return amp * expTerm * fermiTerm / norm + C + reflTerm;
1653}
1654
1655double ZDCFermiExpFitInduct(const double* xvec, const double* pvec)
1656{
1657 double t = xvec[0];
1658
1659 double amp = pvec[0];
1660 double t0 = pvec[1];
1661 double tau1 = pvec[2];
1662 double tau2 = pvec[3];
1663 double C = pvec[4];
1664
1665 double period = pvec[5];
1666 double Acos = pvec[6];
1667 double Bsin = pvec[7];
1668 double tauI = pvec[8];
1669 double delta = pvec[9];
1670
1671 double twoPiOverPeriod = 2.0*M_PI/period;
1672
1673 double deltaT = t - t0;
1674 double norm = 1, expTerm = 1, fermiTerm = 1, inductTerm = 1;
1675
1676 if (deltaT > 0) {
1677 expTerm = delta + std::exp(-deltaT / tau2);
1678 inductTerm = (1.0 + exp(-deltaT/tauI)*(Acos*std::cos(deltaT*twoPiOverPeriod) +
1679 Bsin*std::sin(deltaT*twoPiOverPeriod)))/(1+Acos);
1680 }
1681 if (deltaT/tau1 < 7) fermiTerm = 1. / (1. + std::exp(-deltaT / tau1));
1682
1683 return amp * expTerm * fermiTerm * inductTerm/ norm + C;
1684}
1685
1686#endif
#define M_PI
std::array< fp_t, 2 > pvec
static Double_t t0
#define x
double ZDCFermiExpFit(const double *xvec, const double *pvec)
double getInductFuncTimeMax(const TF1 *theTF1)
double ZDCFermiExpFitRefl(const double *xvec, const double *pvec)
double ZDCFermiExpFitInduct(const double *xvec, const double *pvec)
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
virtual float GetPreAmp() const override
virtual float GetTau1() const override
virtual float GetShapeParameter(size_t index) const override
virtual float GetBkgdMaxFraction() const override
virtual float GetPostAmp() const override
virtual float GetExpAmp() const override
virtual float GetTime() const override
virtual void SetPostPulseT0Range(float, float, float) override
virtual float GetAmpError() const override
virtual float GetPreT0() const override
virtual float GetTau2() const override
virtual float GetPostT0() const override
ZDCFitComplexPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
virtual void SetInitialPrePulse(float amp, float t0, float expamp, bool) override
unsigned int GetPreT0ParIndex() const override
std::shared_ptr< TF1 > m_expFermiFunc
virtual float GetAmplitude() const override
virtual unsigned int GetNumShapeParameters() const override
ZDCFitExpFermiFixedTaus(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
virtual float GetAmplitude() const override
virtual float GetBkgdMaxFraction() const override
virtual float GetTau1() const override
virtual float GetTime() const override
virtual float GetAmpError() const override
virtual unsigned int GetNumShapeParameters() const override
virtual float GetShapeParameter(size_t index) const override
std::shared_ptr< TF1 > m_expFermiFunc
virtual float GetTau2() const override
virtual float GetExpTau() const override
virtual unsigned int GetNumShapeParameters() const override
std::shared_ptr< TF1 > m_expFermiInductFunc
virtual float GetTime() const override
virtual float GetTau1() const override
virtual float GetTau2() const override
virtual float GetShapeParameter(size_t index) const override
virtual float GetExpAmp() const override
virtual void SetInitialExpPulse(float amp) override
virtual float GetAmpError() const override
std::shared_ptr< TF1 > m_expFermiPreFunc
ZDCFitExpFermiInductPreExp(const std::string &tag, float tmin, float tmax, float tau1, float tau2, float defExpTau, float fixExpTau)
virtual float GetAmplitude() const override
virtual float GetBkgdMaxFraction() const override
virtual void DoFinalize() override
virtual float GetPostT0() const override
virtual void SetPostPulseT0Range(float, float, float) override
virtual float GetExpAmp() const override
virtual float GetPreT0() const override
virtual float GetTime() const override
virtual float GetBkgdMaxFraction() const override
virtual float GetPostAmp() const override
ZDCFitExpFermiInductPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
std::shared_ptr< TF1 > m_expFermiPreFunc
std::shared_ptr< TF1 > m_expFermiInductFunc
virtual void DoFinalize() override
virtual float GetPreAmp() const override
virtual unsigned int GetNumShapeParameters() const override
virtual float GetAmplitude() const override
virtual float GetTau1() const override
virtual void SetInitialPrePulse(float amp, float t0, float, bool) override
virtual float GetAmpError() const override
virtual float GetShapeParameter(size_t index) const override
virtual float GetTau2() const override
virtual unsigned int GetPreT0ParIndex() const override
virtual float GetTau1() const override
virtual float GetExpTau() const override
virtual float GetTau2() const override
virtual unsigned int GetNumShapeParameters() const override
std::shared_ptr< TF1 > m_expFermiLHCfFunc
std::shared_ptr< TF1 > m_expFermiLHCfPreFunc
virtual float GetShapeParameter(size_t index) const override
virtual float GetTime() const override
virtual float GetBkgdMaxFraction() const override
virtual float GetExpAmp() const override
ZDCFitExpFermiLHCfPreExp(const std::string &tag, float tmin, float tmax, float tau1, float tau2, float defExpTau, float fixExpTau)
virtual float GetAmplitude() const override
virtual float GetAmpError() const override
virtual void SetInitialExpPulse(float amp) override
virtual unsigned int GetPreT0ParIndex() const override
std::shared_ptr< TF1 > m_expFermiPreFunc
virtual float GetBkgdMaxFraction() const override
virtual float GetAmpError() const override
virtual unsigned int GetNumShapeParameters() const override
virtual float GetExpAmp() const override
virtual float GetTau2() const override
std::shared_ptr< TF1 > m_expFermiLHCfFunc
virtual float GetPreT0() const override
virtual void SetPostPulseT0Range(float, float, float) override
virtual float GetPostT0() const override
virtual float GetShapeParameter(size_t index) const override
virtual float GetTime() const override
virtual float GetPreAmp() const override
ZDCFitExpFermiLHCfPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
virtual float GetTau1() const override
virtual float GetPostAmp() const override
virtual float GetAmplitude() const override
virtual void SetInitialPrePulse(float amp, float t0, float, bool) override
std::shared_ptr< TF1 > m_expFermiFunc
virtual float GetBkgdMaxFraction() const override
virtual float GetAmpError() const override
virtual float GetTime() const override
virtual unsigned int GetNumShapeParameters() const override
ZDCFitExpFermiLinearFixedTaus(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
virtual float GetTau1() const override
virtual float GetShapeParameter(size_t index) const override
virtual float GetTau2() const override
virtual float GetAmplitude() const override
virtual unsigned int GetNumShapeParameters() const override
virtual float GetShapeParameter(size_t index) const override
virtual float GetPreT0() const override
virtual float GetPostAmp() const override
virtual float GetBkgdMaxFraction() const override
virtual float GetAmplitude() const override
virtual void SetInitialPrePulse(float amp, float t0, float, bool) override
virtual float GetPostT0() const override
virtual float GetPreAmp() const override
virtual float GetTau1() const override
unsigned int GetPreT0ParIndex() const override
virtual float GetExpAmp() const override
virtual float GetTime() const override
virtual void SetPostPulseT0Range(float, float, float) override
virtual float GetAmpError() const override
virtual float GetTau2() const override
ZDCFitExpFermiLinearPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
std::shared_ptr< TF1 > m_expFermiFunc
virtual float GetExpAmp() const override
virtual unsigned int GetNumShapeParameters() const override
virtual float GetTau1() const override
virtual float GetAmpError() const override
std::shared_ptr< TF1 > m_expFermiFunc
virtual float GetShapeParameter(size_t index) const override
std::shared_ptr< TF1 > m_expFermiPreFunc
virtual float GetBkgdMaxFraction() const override
virtual float GetAmplitude() const override
virtual void SetInitialExpPulse(float amp) override
virtual float GetExpTau() const override
ZDCFitExpFermiPreExp(const std::string &tag, float tmin, float tmax, float tau1, float tau2, float defExpTau, float fixExpTau)
virtual float GetTime() const override
virtual float GetTau2() const override
std::shared_ptr< TF1 > m_expFermiPreFunc
virtual float GetPostT0() const override
virtual float GetExpAmp() const override
virtual float GetTau1() const override
virtual float GetAmplitude() const override
virtual float GetAmpError() const override
virtual float GetBkgdMaxFraction() const override
virtual unsigned int GetNumShapeParameters() const override
std::shared_ptr< TF1 > m_expFermiFunc
virtual void SetInitialPrePulse(float amp, float t0, float, bool) override
virtual void SetPostPulseT0Range(float, float, float) override
virtual float GetPreT0() const override
virtual float GetPostAmp() const override
virtual unsigned int GetPreT0ParIndex() const override
ZDCFitExpFermiPrePulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
virtual float GetTime() const override
virtual float GetPreAmp() const override
virtual float GetTau2() const override
virtual float GetShapeParameter(size_t index) const override
virtual void DoFinalize() override
virtual float GetTime() const override
virtual float GetTau1() const override
ZDCFitExpFermiVariableTausInduct(const std::string &tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2)
virtual double operator()(const double *x, const double *p) override
virtual float GetTau2() const override
virtual float GetShapeParameter(size_t index) const override
virtual unsigned int GetNumShapeParameters() const override
virtual float GetAmplitude() const override
virtual float GetAmpError() const override
virtual float GetBkgdMaxFraction() const override
virtual float GetTime() const override
virtual double operator()(const double *x, const double *p) override
virtual float GetAmplitude() const override
ZDCFitExpFermiVariableTausLHCf(const std::string &tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2)
virtual float GetShapeParameter(size_t index) const override
virtual float GetBkgdMaxFraction() const override
virtual float GetTau1() const override
virtual float GetAmpError() const override
virtual float GetTau2() const override
virtual unsigned int GetNumShapeParameters() const override
ZDCFitExpFermiVariableTausRun3(const std::string &tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2)
virtual float GetTime() const override
virtual float GetShapeParameter(size_t index) const override
virtual float GetTau2() const override
virtual float GetAmplitude() const override
virtual double operator()(const double *x, const double *p) override
virtual float GetTau1() const override
ZDCFitExpFermiVariableTaus(const std::string &tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2)
virtual float GetBkgdMaxFraction() const override
virtual unsigned int GetNumShapeParameters() const override
virtual float GetAmpError() const override
virtual float GetPreAmp() const override
virtual float GetAmpError() const override
virtual float GetPostT0() const override
virtual float GetPreT0() const override
virtual float GetAmplitude() const override
virtual float GetTau2() const override
unsigned int GetPreT0ParIndex() const override
virtual float GetPostAmp() const override
std::shared_ptr< TF1 > m_expFermiFunc
virtual unsigned int GetNumShapeParameters() const override
virtual float GetShapeParameter(size_t index) const override
virtual float GetExpAmp() const override
virtual float GetTime() const override
virtual void SetInitialPrePulse(float amp, float t0, float expamp, bool fixPrePulseToZero) override
virtual float GetBkgdMaxFraction() const override
virtual float GetTau1() const override
ZDCFitGeneralPulse(const std::string &tag, float tmin, float tmax, float tau1, float tau2)
virtual float GetTau1() const =0
bool finalized() const
void Initialize(float initialAmp, float initialT0, float ampMin, float ampMax)
float GetTMin() const
virtual float GetBkgdMaxFraction() const =0
virtual void ConstrainFit()=0
virtual TF1 * GetWrapperTF1RawPtr() const
virtual std::shared_ptr< TF1 > GetWrapperTF1()
virtual float GetAmpError() const =0
virtual void UnconstrainFit()=0
float GetT0Max() const
virtual float GetTime() const =0
virtual float GetShapeParameter(size_t index) const =0
virtual ~ZDCFitWrapper()
float GetMinAmp() const
virtual void DoFinalize()
virtual float GetTau2() const =0
float GetMaxAmp() const
virtual const TF1 * GetWrapperTF1() const
float GetT0Min() const
virtual void SetT0FitLimits(float tMin, float tMax)=0
ZDCFitWrapper(const std::shared_ptr< TF1 > &wrapperTF1)
virtual void Finalize()
virtual float GetAmplitude() const =0
void SetAmpMinMax(float minAmp, float maxAmp)
virtual unsigned int GetNumShapeParameters() const =0
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)=0
virtual double operator()(const double *x, const double *p)=0
float GetTMinAdjust() const
void SetT0Range(float t0Min, float t0Max)
float GetTMax() const
std::shared_ptr< TF1 > m_wrapperTF1
virtual float GetExpAmp() const =0
virtual float GetExpTau() const =0
virtual void SetInitialExpPulse(float expamp)=0
float getDefaultExpTau() const
ZDCPreExpFitWrapper(std::shared_ptr< TF1 > wrapperTF1, float defaultExpTau, bool fixTau)
bool fixExpTau() const
virtual float GetPreAmp() const =0
virtual void SetPostPulseT0Range(float tmin, float tmax, float initialPostT0)=0
virtual unsigned int GetPreT0ParIndex() const =0
virtual float GetPreT0() const =0
virtual float GetPostT0() const =0
virtual float GetExpAmp() const =0
virtual void SetPrePulseT0Range(float tmin, float tmax)=0
virtual void SetInitialPrePulse(float amp, float t0, float expamp, bool fixPrePulseToZero)=0
ZDCPrePulseFitWrapper(std::shared_ptr< TF1 > wrapperTF1)
virtual float GetPostAmp() const =0
struct color C
Definition index.py:1