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