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;
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;
106 m_t0Max = m_tmax;
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);
414 theTF1->SetNpx(1000);
415 }
416
417public:
418
419 ZDCFitExpFermiVariableTausInduct(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2);
420
421 ZDCFitExpFermiVariableTausInduct(const std::string& tag, const std::string & paramSet, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2);
422
423 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
424 virtual void SetT0FitLimits(float tMin, float tMax) override;
425
426 void FixDelta(float value)
427 {
428 m_fixDelta = true;
429 ZDCFitWrapper::GetWrapperTF1()->FixParameter(9, value);
430 }
431
432 virtual float GetAmplitude() const override {
433 if (finalized()) return m_funcMax;
434 double time = getInductFuncTimeMax(GetWrapperTF1());
435 if (std::isnan(time)) return 0;
436 return GetWrapperTF1()->Eval(time);
437 }
438
439 virtual float GetAmpError() const override {
440 return GetWrapperTF1()->GetParError(0);
441 }
442
443 virtual float GetTau1() const override {return GetWrapperTF1()->GetParameter(2);}
444 virtual float GetTau2() const override {return GetWrapperTF1()->GetParameter(3);}
445
446 virtual float GetTime() const override {
447 if (finalized()) return m_tFuncMax;
448 else return getInductFuncTimeMax(GetWrapperTF1());
449 }
450
451 virtual unsigned int GetNumShapeParameters() const override {return 5;}
452
453 virtual float GetShapeParameter(size_t index) const override
454 {
455 if (index < 5) return GetWrapperTF1()->GetParameter(4+index);
456 else throw std::runtime_error("Fit parameter does not exist.");
457 }
458
459 virtual float GetBkgdMaxFraction() const override
460 {
461
462 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
463 double amp = GetAmplitude();
464 double constant = theTF1->GetParameter(4);
465
466 if (amp > 1e-6) return constant / amp;
467 else return -1;
468 }
469
470 virtual double operator()(const double *x, const double *p) override{
471 return ZDCFermiExpFitInduct(x, p);
472 }
473
474 virtual void doConstrainFit() override;
475 virtual void doUnconstrainFit() override;
476};
477
479{
480public:
481 ZDCFitExpFermiVariableTausRun3(const std::string& tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2);
482};
483
485{
486private:
487 float m_tau1{0};
488 float m_tau2{0};
489
490 float m_norm{0};
491 float m_timeCorr{0};
492
493 std::shared_ptr<TF1> m_expFermiFunc{};
494
495public:
496
497 ZDCFitExpFermiFixedTaus(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
498
500
501 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
502 virtual void SetT0FitLimits(float tMin, float tMax) override;
503
504 virtual void doConstrainFit() override;
505 virtual void doUnconstrainFit() override;
506
507 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
508 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
509
510 virtual float GetTau1() const override {return m_tau1;}
511 virtual float GetTau2() const override {return m_tau2;}
512
513 virtual float GetTime() const override {
514 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
515 }
516
517 virtual unsigned int GetNumShapeParameters() const override {return 2;}
518
519 virtual float GetShapeParameter(size_t index) const override
520 {
521 if (index == 0) return m_tau1;
522 else if (index == 1) return m_tau2;
523 else throw std::runtime_error("Fit parameter does not exist.");
524 }
525
526 virtual float GetBkgdMaxFraction() const override
527 {
528 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
529 double amp = theTF1->GetParameter(0);
530 if (amp <= 0) return -1;
531
532 double C = theTF1->GetParameter(2);
533 return C / amp;
534 }
535
536 virtual double operator() (const double *x, const double *p) override
537 {
538 double amp = p[0];
539 double t0 = p[1];
540 double C = p[2];
541
542 double deltaT = x[0] - t0;
543
544 double expFermi = amp * m_norm * m_expFermiFunc->operator()(deltaT);
545
546 return expFermi + C; // + bckgd;
547 }
548};
549
551{
552private:
553 float m_tau1{0};
554 float m_tau2{0};
555 float m_norm{0};
556 float m_timeCorr{0};
557
558 std::shared_ptr<TF1> m_expFermiFunc = 0;
559 std::shared_ptr<TF1> m_expFermiPreFunc = 0;
560
561public:
562 ZDCFitExpFermiPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
564
565 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
566 virtual void SetT0FitLimits(float tMin, float tMax) override;
567
568
569 virtual void SetInitialPrePulse(float amp, float t0, float /*expamp = 0*/, bool /*fixPrePulseToZero = false*/) override {
570 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 1.5)); //1.5 here ensures that we're above lower limit
571 GetWrapperTF1()->SetParameter(3, t0);
572 }
573
574 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
575 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
576
577 virtual void doConstrainFit() override;
578 virtual void doUnconstrainFit() override;
579
580 virtual unsigned int GetPreT0ParIndex() const override {return 3;}
581
582 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
583 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
584
585 virtual float GetTau1() const override {return m_tau1;}
586 virtual float GetTau2() const override {return m_tau2;}
587
588 virtual float GetPreT0() const override {return 0;}
589 virtual float GetPreAmp() const override {return 0;}
590
591 virtual float GetPostT0() const override {return 0;}
592 virtual float GetPostAmp() const override {return 0;}
593
594 virtual float GetExpAmp() const override {return 0;}
595
596 virtual float GetTime() const override {
597 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
598 }
599
600 virtual unsigned int GetNumShapeParameters() const override {return 1;}
601
602 virtual float GetShapeParameter(size_t index) const override
603 {
604 if (index < 1) return GetWrapperTF1()->GetParameter(4);
605 else throw std::runtime_error("Fit parameter does not exist.");
606 }
607
608 virtual float GetBkgdMaxFraction() const override
609 {
610 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
611
612 double maxTime = GetTime();
613
614 double amp = theTF1->GetParameter(0);
615 if (amp <= 0) return -1;
616
617 double preAmp = theTF1->GetParameter(2);
618 double preT0 = theTF1->GetParameter(3);
619
620 double deltaTPre = maxTime - preT0;
621 double background = preAmp * m_norm * m_expFermiFunc->operator()(deltaTPre);
622
623 return background / (amp + background);
624 }
625
626 virtual double operator() (const double *x, const double *p) override
627 {
628 double t = x[0];
629
630 double amp = p[0];
631 double t0 = p[1];
632 double preAmp = p[2];
633 double preT0 = p[3];
634 double C = p[4];
635
636 double deltaT = t - t0;
637 double deltaTPre = t - preT0;
638
639 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
640 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
641 //
642 double deltaPresamp = GetTMinAdjust() - preT0;
643
644 // double bckgd = linSlope*t;
645
646 double pulse1 = amp*m_norm*m_expFermiFunc->operator()(deltaT);
647 double pulse2 = preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
648 m_expFermiFunc->operator()(deltaPresamp));
649
650 return C + pulse1 + pulse2;// + bckgd;
651 }
652};
653
655{
656private:
657 float m_tau1{0};
658 float m_tau2{0};
659 float m_timeCorr{0};
660
661 double m_preNorm{1.};
662
663 std::shared_ptr<TF1> m_expFermiLHCfFunc = 0;
664 std::shared_ptr<TF1> m_expFermiPreFunc = 0;
665
666public:
667 ZDCFitExpFermiLHCfPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
669
670 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
671 virtual void SetT0FitLimits(float tMin, float tMax) override;
672
673
674 virtual void SetInitialPrePulse(float amp, float t0, float /*expamp = 0*/, bool /*fixPrePulseToZero = false*/) override
675 {
676 double ampMin, ampMax;
677
678 GetWrapperTF1()->GetParLimits(2, ampMin, ampMax);
679 double initialAmp = std::min<double>(std::max<double>(amp, ampMin), ampMax);
680
681 GetWrapperTF1()->SetParameter(4, initialAmp);
682 GetWrapperTF1()->SetParameter(5, t0);
683 }
684
685 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
686 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
687
688 virtual void doConstrainFit() override;
689 virtual void doUnconstrainFit() override;
690
691 virtual unsigned int GetPreT0ParIndex() const override {return 3;}
692
693 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
694 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
695
696 virtual float GetTau1() const override {return m_tau1;}
697 virtual float GetTau2() const override {return m_tau2;}
698
699 virtual float GetPreT0() const override {return GetWrapperTF1()->GetParameter(3);}
700 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(3);}
701
702 virtual float GetPostT0() const override {return 0;}
703 virtual float GetPostAmp() const override {return 0;}
704
705 virtual float GetExpAmp() const override {return 0;}
706
707 virtual float GetTime() const override {
708 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
709 }
710
711 virtual unsigned int GetNumShapeParameters() const override {return 1;}
712
713 virtual float GetShapeParameter(size_t index) const override
714 {
715 if (index < 1) return GetWrapperTF1()->GetParameter(6);
716 else throw std::runtime_error("Fit parameter does not exist.");
717 }
718
719 virtual float GetBkgdMaxFraction() const override
720 {
721 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
722
723 double maxTime = GetTime();
724
725 double amp = theTF1->GetParameter(0);
726 if (amp <= 0) return -1;
727
728 double preAmp = theTF1->GetParameter(2);
729 double preT0 = theTF1->GetParameter(3);
730
731 double deltaTPre = maxTime - preT0;
732 double background = preAmp * m_preNorm * m_expFermiLHCfFunc->operator()(deltaTPre);
733
734 return background / (amp + background);
735 }
736
737 virtual double operator() (const double *x, const double *p) override
738 {
739 double t = x[0];
740
741 double amp = p[0];
742 double t0 = p[1];
743 double tau1 = p[2];
744 double tau2 = p[3];
745 double preAmp = p[4];
746 double preT0 = p[5];
747 double C = p[6];
748
749 m_expFermiLHCfFunc->SetParameter(0, amp);
750 m_expFermiLHCfFunc->SetParameter(2, tau1);
751 m_expFermiLHCfFunc->SetParameter(3, tau2);
752 m_expFermiLHCfFunc->SetParameter(4, tau2);
753
754 double deltaT = t - t0;
755 double deltaTPre = t - preT0;
756
757 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
758 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
759 //
760 double deltaPresamp = GetTMinAdjust() - preT0;
761
762 double pulse1 = m_expFermiLHCfFunc->operator()(deltaT);
763 double pulse2 = preAmp * m_preNorm * (m_expFermiPreFunc->operator()(deltaTPre) -
764 m_expFermiPreFunc->operator()(deltaPresamp));
765
766 return C + pulse1 + pulse2;
767 }
768};
769
771{
772private:
773 float m_tau1{0};
774 float m_tau2{0};
775 float m_timeCorr{0};
776 double m_norm{};
777
778 std::shared_ptr<TF1> m_expFermiFunc{0};
779 std::shared_ptr<TF1> m_expFermiPreFunc{0};
780
781public:
782 ZDCFitExpFermiPreExp(const std::string& tag, float tmin, float tmax, float tau1, float tau2,
783 float defExpTau, float fixExpTau);
785
786 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
787 virtual void SetT0FitLimits(float tMin, float tMax) override;
788
789 virtual void SetInitialExpPulse(float amp) override
790 {
791 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 0.5)); //0.5 here ensures that we're above lower limit (0)
792 }
793
794 virtual void doConstrainFit() override;
795 virtual void doUnconstrainFit() override;
796
797 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
798 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
799
800 virtual float GetTau1() const override {return m_tau1;}
801 virtual float GetTau2() const override {return m_tau2;}
802
803 virtual float GetTime() const override {
804 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
805 }
806
807 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(2);}
808 virtual float GetExpTau() const override {return GetWrapperTF1()->GetParameter(3);}
809
810 virtual unsigned int GetNumShapeParameters() const override {return 2;}
811
812 virtual float GetShapeParameter(size_t index) const override
813 {
814 if (index < 2) return GetWrapperTF1()->GetParameter(index + 4);
815 else throw std::runtime_error("Fit parameter does not exist.");
816 }
817
818 virtual float GetBkgdMaxFraction() const override
819 {
820 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
821 double maxTime = GetTime();
822
823 double amp = theTF1->GetParameter(0);
824 if (amp <= 0) return -1;
825
826 double preAmp = theTF1->GetParameter(2);
827 double preT0 = theTF1->GetParameter(3);
828
829 double deltaTPre = maxTime - preT0;
830 double background = preAmp * m_norm * m_expFermiFunc->operator()(deltaTPre);
831
832 return background / (amp + background);
833 }
834
835 virtual double operator() (const double *x, const double *p) override
836 {
837 double t = x[0];
838
839 double amp = p[0];
840 double t0 = p[1];
841 double expAmp = p[2];
842 double expTau = p[3];
843 double expSqrtTau = p[4];
844 double C = p[5];
845
846 double deltaT = t - t0;
847 double pulse = amp * m_norm * m_expFermiFunc->operator()(deltaT);
848
849 // We subtract off the value of the exponential pulse at the minimum time (nominally 0),
850 // because it would have been included in the baseline subtraction
851 //
852 double tRef = GetTMinAdjust();
853 double expPre = 0;
854 if (t > 0 && std::abs(expSqrtTau)>1e-6) expPre = expAmp * (std::exp(-t/expTau-expSqrtTau*std::sqrt(t)) - std::exp(-tRef/expTau));
855 else expPre = expAmp * (std::exp(-t/expTau) - std::exp(-tRef/expTau));
856
857 return C + pulse + expPre;
858 }
859};
860
862{
863private:
864 float m_tau1{0};
865 float m_tau2{0};
866 float m_timeCorr{0};
867
868 std::shared_ptr<TF1> m_expFermiLHCfFunc{};
869 std::shared_ptr<TF1> m_expFermiLHCfPreFunc{};
870
871public:
872 ZDCFitExpFermiLHCfPreExp(const std::string& tag, float tmin, float tmax, float tau1, float tau2,
873 float defExpTau, float fixExpTau);
875
876 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
877 virtual void SetT0FitLimits(float tMin, float tMax) override;
878
879 virtual void SetInitialExpPulse(float amp) override
880 {
881 GetWrapperTF1()->SetParameter(4, std::max(amp, (float) 0.5)); //0.5 here ensures that we're above lower limit (0)
882 }
883
884 virtual void doConstrainFit() override;
885 virtual void doUnconstrainFit() override;
886
887 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
888 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
889
890 virtual float GetTau1() const override {return m_tau1;}
891 virtual float GetTau2() const override {return m_tau2;}
892
893 virtual float GetTime() const override {
894 const TF1* theTF1 = GetWrapperTF1();
895
896 float fitT0 = theTF1->GetParameter(1);
897
898 float tau1 = theTF1->GetParameter(2);
899 float tau2 = theTF1->GetParameter(3);
900
901 // Correct the time to the maximum
902 //
903 if (tau2 > tau1) fitT0 += tau1 * std::log(tau2 / tau1 - 1.0);
904 return fitT0;
905 }
906
907 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(4);}
908 virtual float GetExpTau() const override {return GetWrapperTF1()->GetParameter(5);}
909
910 virtual unsigned int GetNumShapeParameters() const override {return 1;}
911 virtual float GetShapeParameter(size_t index) const override
912 {
913 if (index < 1) return GetWrapperTF1()->GetParameter(5);
914 else throw std::runtime_error("Fit parameter does not exist.");
915 }
916
917 virtual float GetBkgdMaxFraction() const override
918 {
919 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
920 double amp = theTF1->GetParameter(0);
921 if (amp <= 0) return -1;
922
923 double maxTime = GetTime();
924
925 double expAmp = theTF1->GetParameter(4);
926 double expTau = theTF1->GetParameter(5);
927 double bexpSqrt = theTF1->GetParameter(6);
928
929 double tRef = GetTMinAdjust();
930 double expPre = expAmp * (std::exp(-maxTime/expTau - bexpSqrt*maxTime*maxTime) - std::exp(-tRef/expTau - bexpSqrt*tRef*tRef));
931
932 return expPre / (amp + expPre);
933 }
934
935 virtual double operator() (const double *x, const double *p) override
936 {
937 double t = x[0];
938
939 double amp = p[0];
940 double t0 = p[1];
941
942 double tau1 = p[2];
943 double tau2 = p[3];
944
945 double expAmp = p[4];
946 double expTau = p[5];
947 double bexpSqrt = p[6];
948 double reflFrac = p[7];
949
950 m_expFermiLHCfFunc->SetParameter(0, amp);
951 m_expFermiLHCfFunc->SetParameter(2, tau1);
952 m_expFermiLHCfFunc->SetParameter(3, tau2);
953 m_expFermiLHCfFunc->SetParameter(6, reflFrac);
954
955 m_timeCorr = m_tau1 * std::log(m_tau2 / m_tau1 - 1.0);
956
957 double deltaT = t - t0;
958 double pulse = m_expFermiLHCfFunc->operator()(deltaT);
959
960 // We subtract off the value of the exponential pulse at the minimum time (nominally 0),
961 // because it would have been included in the baseline subtraction
962 //
963 double tRef = GetTMinAdjust();
964 double expPre = 0;
965
966 expPre = expAmp * (std::exp(-t/expTau - bexpSqrt*t*t) - std::exp(-tRef/expTau - bexpSqrt*tRef*tRef));
967
968 return pulse + expPre;
969 }
970};
971
973{
974 static const std::map<std::string, std::vector<ZDCFitWrapper::FitParameter>> s_ConfigParamMap;
975
976 float m_tau1{0};
977 float m_tau2{0};
978
979 float m_tFuncMax{-999};
980 float m_funcMax{-999};
981
982 std::shared_ptr<TF1> m_expFermiInductFunc{0};
983 std::shared_ptr<TF1> m_expFermiPreFunc{0};
984
985 virtual void DoFinalize() override
986 {
987 m_expFermiInductFunc->SetNpx(20);
988 double t0 = GetWrapperTF1()->GetParameter(1);
989 double tsubtr = getInductFuncTimeMax(m_expFermiInductFunc.get());
990 if (std::isnan(tsubtr)) {
991 m_tFuncMax = -100;
992 m_funcMax = 0;
993 }
994 else {
995 m_tFuncMax = tsubtr + t0;
996 m_funcMax = m_expFermiInductFunc->Eval(tsubtr);
997 }
998 }
999
1000public:
1001 ZDCFitExpFermiInductPreExp(const std::string& tag, float tmin, float tmax, float tau1, float tau2,
1002 float defExpTau, float fixExpTau);
1003 ZDCFitExpFermiInductPreExp(const std::string& tag, const std::string & overRideParams, float tmin, float tmax,
1004 float tau1, float tau2);
1006
1007 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1008 virtual void SetT0FitLimits(float tMin, float tMax) override;
1009
1010 virtual void SetInitialExpPulse(float amp) override
1011 {
1012 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 0.5)); //0.5 here ensures that we're above lower limit (0)
1013 }
1014
1015 virtual void doConstrainFit() override;
1016 virtual void doUnconstrainFit() override;
1017
1018 virtual float GetAmplitude() const override {
1019 if (finalized()) return m_funcMax;
1021 }
1022
1023 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1024
1025 virtual float GetTau1() const override {return m_tau1;}
1026 virtual float GetTau2() const override {return m_tau2;}
1027
1028 virtual float GetTime() const override {
1029 if (finalized()) return m_tFuncMax;
1030 double timeMax = getInductFuncTimeMax(m_expFermiInductFunc.get());
1031 if (std::isnan(timeMax)) return -100;
1032 else return + GetWrapperTF1()->GetParameter(1);
1033 }
1034
1035 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(2);}
1036 virtual float GetExpTau() const override {return GetWrapperTF1()->GetParameter(3);}
1037
1038 virtual unsigned int GetNumShapeParameters() const override {return 3;}
1039
1040 virtual float GetShapeParameter(size_t index) const override
1041 {
1042 if (index < 3) {
1043 if (index == 0) return GetWrapperTF1()->GetParameter(4);
1044 if (index == 1) return GetWrapperTF1()->GetParameter(6);
1045 if (index == 2) return GetWrapperTF1()->GetParameter(7);
1046 }
1047 throw std::runtime_error("Fit parameter does not exist.");
1048 }
1049
1050 virtual float GetBkgdMaxFraction() const override
1051 {
1052 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1053 double amp = theTF1->GetParameter(0);
1054 if (amp < 1e-6) return -1;
1055
1056 double maxTime = GetTime();
1057
1058 double expAmp = theTF1->GetParameter(2);
1059 double expTau = theTF1->GetParameter(3);
1060 double bexpSqrt = theTF1->GetParameter(4);
1061
1062 double tRef = GetTMinAdjust();
1063 double expPre = expAmp * (std::exp(-maxTime/expTau - bexpSqrt*maxTime*maxTime) - std::exp(-tRef/expTau - bexpSqrt*tRef*tRef));
1064
1065 return expPre / (amp + expPre);
1066 }
1067
1068 virtual double operator() (const double *x, const double *p) override
1069 {
1070 double t = x[0];
1071
1072 double amp = p[0];
1073 double t0 = p[1];
1074
1075 double expAmp = p[2];
1076 double expTau = p[3];
1077 double bexpSqrt = p[4];
1078 double C = p[5];
1079 double period = p[6];
1080 double inductA = p[7];
1081 double inductB = p[8];
1082 double bI = p[9];
1083
1084 m_expFermiInductFunc->SetParameter(0, amp);
1085 m_expFermiInductFunc->SetParameter(5, period);
1086 m_expFermiInductFunc->SetParameter(6, inductA);
1087 m_expFermiInductFunc->SetParameter(7, inductB);
1088 m_expFermiInductFunc->SetParameter(8, bI);
1089
1090 double deltaT = t - t0;
1091 double pulse = m_expFermiInductFunc->operator()(deltaT);
1092
1093 // We subtract off the value of the exponential pulse at the minimum time (nominally 0),
1094 // because it would have been included in the baseline subtraction
1095 //
1096 double tRef = GetTMinAdjust();
1097 double expPre = 0;
1098
1099 expPre = expAmp * (std::exp(-t/expTau - bexpSqrt*t*t) - std::exp(-tRef/expTau - bexpSqrt*tRef*tRef));
1100
1101 return pulse + C + expPre;
1102 }
1103};
1104
1106{
1107 static const std::map<std::string, std::vector<ZDCFitWrapper::FitParameter>> s_ConfigParamMap;
1108
1109 float m_tau1{0};
1110 float m_tau2{0};
1111
1112 float m_tFuncMax{-999};
1113 float m_funcMax{-999};
1114
1115 double m_preNorm{1.};
1116
1117 std::shared_ptr<TF1> m_expFermiInductFunc = 0;
1118 std::shared_ptr<TF1> m_expFermiPreFunc = 0;
1119
1120 virtual void DoFinalize() override
1121 {
1122 m_expFermiInductFunc->SetNpx(20);
1123 double t0 = GetWrapperTF1()->GetParameter(1);
1124 double tsubtr = getInductFuncTimeMax(m_expFermiInductFunc.get());
1125
1126 m_tFuncMax = tsubtr + t0;
1127 m_funcMax = m_expFermiInductFunc->Eval(tsubtr);
1128 }
1129
1130public:
1131 ZDCFitExpFermiInductPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1132 ZDCFitExpFermiInductPrePulse(const std::string& tag, const std::string & overRideParams, float tmin, float tmax,
1133 float tau1, float tau2);
1134
1136
1137 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1138 virtual void SetT0FitLimits(float tMin, float tMax) override;
1139
1140
1141 virtual void SetInitialPrePulse(float amp, float t0, float /*expamp = 0*/, bool /*fixPrePulseToZero = false*/) override
1142 {
1143 double ampMin, ampMax;
1144
1145 GetWrapperTF1()->GetParLimits(2, ampMin, ampMax);
1146 double initialAmp = std::min<double>(std::max<double>(amp, ampMin), ampMax);
1147
1148 GetWrapperTF1()->SetParameter(2, initialAmp);
1149 GetWrapperTF1()->SetParameter(3, t0);
1150 }
1151
1152 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
1153 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
1154
1155 virtual void doConstrainFit() override;
1156 virtual void doUnconstrainFit() override;
1157
1158 virtual unsigned int GetPreT0ParIndex() const override {return 3;}
1159
1160 virtual float GetAmplitude() const override {
1161 if (finalized()) return m_funcMax;
1163 }
1164
1165 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1166
1167 virtual float GetTau1() const override {return m_tau1;}
1168 virtual float GetTau2() const override {return m_tau2;}
1169
1170 virtual float GetPreT0() const override {return GetWrapperTF1()->GetParameter(3);}
1171 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(3);}
1172
1173 virtual float GetPostT0() const override {return 0;}
1174 virtual float GetPostAmp() const override {return 0;}
1175
1176 virtual float GetExpAmp() const override {return 0;}
1177
1178 virtual float GetTime() const override {
1179 if (finalized()) return m_tFuncMax;
1180 return getInductFuncTimeMax(m_expFermiInductFunc.get()) + GetWrapperTF1()->GetParameter(1);
1181 }
1182
1183 virtual unsigned int GetNumShapeParameters() const override {return 5;}
1184
1185 virtual float GetShapeParameter(size_t index) const override
1186 {
1187 if (index < 5) {
1188 return GetWrapperTF1()->GetParameter(index + 4);
1189 }
1190 throw std::runtime_error("Fit parameter does not exist.");
1191 }
1192
1193 virtual float GetBkgdMaxFraction() const override
1194 {
1195 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1196
1197 double maxTime = GetTime();
1198
1199 double amp = theTF1->GetParameter(0);
1200 if (amp < 1e-6) return -1;
1201
1202 double preAmp = theTF1->GetParameter(2);
1203 double preT0 = theTF1->GetParameter(3);
1204
1205 double deltaTPre = maxTime - preT0;
1206 double background = preAmp * m_preNorm * m_expFermiInductFunc->operator()(deltaTPre);
1207
1208 return background / (amp + background);
1209 }
1210
1211 virtual double operator() (const double *x, const double *p) override
1212 {
1213 double t = x[0];
1214
1215 double amp = p[0];
1216 double t0 = p[1];
1217 double preAmp = p[2];
1218 double preT0 = p[3];
1219 double C = p[4];
1220 double period = p[5];
1221 double indA = p[6];
1222 double indB = p[7];
1223 double bI = p[8];
1224
1225 m_expFermiInductFunc->SetParameter(0, amp);
1226 m_expFermiInductFunc->SetParameter(5, period);
1227 m_expFermiInductFunc->SetParameter(6, indA);
1228 m_expFermiInductFunc->SetParameter(7, indB);
1229 m_expFermiInductFunc->SetParameter(8, bI);
1230
1231 double deltaT = t - t0;
1232 double deltaTPre = t - preT0;
1233
1234 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
1235 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
1236 //
1237 double deltaPresamp = GetTMinAdjust() - preT0;
1238
1239 double pulse1 = m_expFermiInductFunc->operator()(deltaT);
1240 double pulse2 = preAmp * m_preNorm * (m_expFermiPreFunc->operator()(deltaTPre) -
1241 m_expFermiPreFunc->operator()(deltaPresamp));
1242
1243 return C + pulse1 + pulse2;
1244 }
1245};
1246
1247
1248// ----------------------------------------------------------------------
1250{
1251private:
1252 float m_tau1{};
1253 float m_tau2{};
1254
1255 float m_norm{};
1256 float m_timeCorr{};
1257
1258 std::shared_ptr<TF1> m_expFermiFunc;
1259
1260public:
1261
1262 ZDCFitExpFermiLinearFixedTaus(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1263
1265
1266 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1267 virtual void SetT0FitLimits(float tMin, float tMax) override;
1268
1269 virtual void doConstrainFit() override;
1270 virtual void doUnconstrainFit() override;
1271
1272 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
1273 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1274
1275 virtual float GetTau1() const override {return m_tau1;}
1276 virtual float GetTau2() const override {return m_tau2;}
1277
1278 virtual float GetTime() const override {
1279 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
1280 }
1281
1282 virtual unsigned int GetNumShapeParameters() const override {return 2;}
1283 virtual float GetShapeParameter(size_t index) const override
1284 {
1285 if (index < 2) return GetWrapperTF1()->GetParameter(index + 2);
1286 else throw std::runtime_error("Fit parameter does not exist.");
1287 }
1288
1289 virtual float GetBkgdMaxFraction() const override
1290 {
1291 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1292 double amp = theTF1->GetParameter(0);
1293 if (amp <= 0) return -1;
1294
1295 double slope = theTF1->GetParameter(2);
1296
1297 double background = slope * GetTime();
1298 return background / amp;
1299 }
1300
1301 virtual double operator() (const double *x, const double *p) override
1302 {
1303 double amp = p[0];
1304 double t0 = p[1];
1305 double deltaT = x[0] - t0;
1306
1307 double bckgd = p[2] * x[0] + p[3];
1308
1309 double expFermi = amp * m_norm * m_expFermiFunc->operator()(deltaT);
1310
1311 return expFermi + bckgd;
1312 }
1313};
1314
1315// ----------------------------------------------------------------------
1317{
1318private:
1319 float m_tau1{};
1320 float m_tau2{};
1321 float m_norm{};
1322 float m_timeCorr{};
1323 std::shared_ptr<TF1> m_expFermiFunc;
1324
1325public:
1326 ZDCFitExpFermiLinearPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1328
1329 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1330 virtual void SetT0FitLimits(float tMin, float tMax) override;
1331
1332 virtual void doConstrainFit() override;
1333 virtual void doUnconstrainFit() override;
1334
1335 virtual void SetInitialPrePulse(float amp, float t0, float /*expamp = 0*/, bool /*fixPrePulseToZero = false*/) override {
1336 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 1.5)); //1.5 here ensures that we're above lower limit
1337 GetWrapperTF1()->SetParameter(3, t0);
1338 }
1339
1340 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
1341 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
1342
1343 unsigned int GetPreT0ParIndex() const override {return 3;}
1344
1345 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
1346 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1347
1348 virtual float GetTau1() const override {return m_tau1;}
1349 virtual float GetTau2() const override {return m_tau2;}
1350
1351 virtual float GetPreT0() const override {
1352 float fitPreT0 = GetWrapperTF1()->GetParameter(3);
1353
1354 // Correct the time to the maximum
1355 //
1356 fitPreT0 += m_timeCorr;
1357
1358 return fitPreT0;
1359 }
1360 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(2);}
1361
1362 virtual float GetPostT0() const override {return 0;}
1363 virtual float GetPostAmp() const override {return 0;}
1364
1365 virtual float GetExpAmp() const override {return 0;}
1366
1367 virtual float GetTime() const override {
1368 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
1369 }
1370
1371 virtual unsigned int GetNumShapeParameters() const override {return 1;}
1372
1373 virtual float GetShapeParameter(size_t index) const override
1374 {
1375 if (index < 1) return GetWrapperTF1()->GetParameter(index + 4);
1376 else throw std::runtime_error("Fit parameter does not exist.");
1377 }
1378
1379 virtual float GetBkgdMaxFraction() const override
1380 {
1381 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1382
1383 double maxTime = GetTime();
1384
1385 double amp = theTF1->GetParameter(0);
1386 if (amp <= 0) return -1;
1387
1388 double preAmp = theTF1->GetParameter(2);
1389 double preT0 = theTF1->GetParameter(3);
1390 double slope = theTF1->GetParameter(4);
1391
1392 double deltaTPre = maxTime - preT0;
1393
1394 double background = slope * maxTime + preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
1395 m_expFermiFunc->operator()(-preT0));
1396
1397 return background / amp;
1398 }
1399
1400 virtual double operator() (const double *x, const double *p) override
1401 {
1402 double t = x[0];
1403
1404 double amp = p[0];
1405 double t0 = p[1];
1406 double preAmp = p[2];
1407 double preT0 = p[3];
1408 double linSlope = p[4];
1409
1410 double deltaT = t - t0;
1411 double deltaTPre = t - preT0;
1412
1413 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
1414 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
1415 //
1416 double deltaPresamp = GetTMinAdjust() - preT0;
1417
1418 double pulse1 = amp * m_norm * m_expFermiFunc->operator()(deltaT);
1419 double pulse2 = preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
1420 m_expFermiFunc->operator()(deltaPresamp));
1421
1422 double bckgd = linSlope * (t - deltaPresamp) + p[5];
1423
1424 return pulse1 + pulse2 + bckgd;
1425 }
1426};
1427
1428
1429
1430// ----------------------------------------------------------------------
1432{
1433private:
1434 float m_tau1{};
1435 float m_tau2{};
1436 float m_norm{};
1437 float m_timeCorr{};
1438 std::shared_ptr<TF1> m_expFermiFunc;
1439
1440public:
1441 ZDCFitComplexPrePulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1443
1444 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1445 virtual void SetT0FitLimits(float tMin, float tMax) override;
1446
1447 virtual void SetInitialPrePulse(float amp, float t0, float expamp, bool /*fixPrePulseToZero = false*/) override {
1448 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 1.5)); //1.5 here ensures that we're above lower limit
1449 GetWrapperTF1()->SetParameter(3, t0);
1450 GetWrapperTF1()->SetParameter(6, std::max(std::abs(expamp), (float) 1.5));
1451 }
1452
1453 virtual void doConstrainFit() override;
1454 virtual void doUnconstrainFit() override;
1455
1456 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
1457 virtual void SetPostPulseT0Range(float /*tmin*/, float /*tmax*/, float /*initialPostT0*/) override {return;}
1458
1459 unsigned int GetPreT0ParIndex() const override {return 3;}
1460
1461 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
1462 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1463
1464 virtual float GetTau1() const override {return m_tau1;}
1465 virtual float GetTau2() const override {return m_tau2;}
1466
1467 virtual float GetPreT0() const override {
1468 float fitPreT0 = GetWrapperTF1()->GetParameter(3);
1469
1470 // Correct the time to the maximum
1471 //
1472 fitPreT0 += m_timeCorr;
1473
1474 return fitPreT0;
1475 }
1476 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(2);}
1477
1478 virtual float GetPostT0() const override {return 0;}
1479 virtual float GetPostAmp() const override {return 0;}
1480
1481 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(6);}
1482
1483 virtual float GetTime() const override {
1484 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
1485 }
1486
1487 virtual unsigned int GetNumShapeParameters() const override {return 3;}
1488
1489 virtual float GetShapeParameter(size_t index) const override
1490 {
1491 if (index < 3) return GetWrapperTF1()->GetParameter(4 + index);
1492 else throw std::runtime_error("Fit parameter does not exist.");
1493 }
1494
1495 virtual float GetBkgdMaxFraction() const override
1496 {
1497 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1498
1499 double maxTime = GetTime();
1500
1501 double amp = theTF1->GetParameter(0);
1502 if (amp <= 0) return -1;
1503
1504 double preAmp = theTF1->GetParameter(2);
1505 double preT0 = theTF1->GetParameter(3);
1506 double slope = theTF1->GetParameter(4);
1507
1508 double deltaTPre = maxTime - preT0;
1509
1510 double background = slope * maxTime + preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
1511 m_expFermiFunc->operator()(-preT0));
1512
1513 return background / amp;
1514 }
1515
1516 virtual double operator() (const double *x, const double *p) override
1517 {
1518 double t = x[0];
1519
1520 double amp = p[0];
1521 double t0 = p[1];
1522 double preAmp = p[2];
1523 double preT0 = p[3];
1524 double linSlope = p[4];
1525 double linConst = p[5];
1526 double expamp = p[6];
1527
1528 double deltaT = t - t0;
1529 double deltaTPre = t - preT0;
1530
1531 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
1532 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
1533 //
1534 double deltaPresamp = GetTMinAdjust() - preT0;
1535
1536 double pulse1 = amp * m_norm * m_expFermiFunc->operator()(deltaT);
1537 double pulse2 = preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) - m_expFermiFunc->operator()(deltaPresamp));
1538
1539 double linBG = linSlope * (t - deltaPresamp) + linConst;
1540 double expBG = expamp * std::exp(-(t) / m_tau2) - expamp; // deltaPresamp
1541
1542 return pulse1 + pulse2 + linBG + expBG;
1543 }
1544};
1545
1546
1547// ----------------------------------------------------------------------
1549{
1550private:
1551 float m_tau1{};
1552 float m_tau2{};
1553 float m_norm{};
1554 float m_timeCorr{};
1555 std::shared_ptr<TF1> m_expFermiFunc;
1556
1557public:
1558 ZDCFitGeneralPulse(const std::string& tag, float tmin, float tmax, float tau1, float tau2);
1560
1561 virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax) override;
1562 virtual void SetT0FitLimits(float tMin, float tMax) override;
1563
1564 virtual void SetInitialPrePulse(float amp, float t0, float expamp, bool fixPrePulseToZero) override {
1565 GetWrapperTF1()->ReleaseParameter(2);
1566 GetWrapperTF1()->ReleaseParameter(3);
1567 GetWrapperTF1()->SetParameter(2, std::max(amp, (float) 1.5)); //1.5 here ensures that we're above lower limit
1568 GetWrapperTF1()->SetParameter(3, std::max(t0, (float) 20.0));
1569 GetWrapperTF1()->SetParameter(6, std::max(std::abs(expamp), (float) 1.5));
1570
1571 if (fixPrePulseToZero) {
1572 GetWrapperTF1()->FixParameter(2, 0. );
1573 GetWrapperTF1()->FixParameter(3, 20.);
1574 }
1575 }
1576
1577 virtual void doConstrainFit() override;
1578 virtual void doUnconstrainFit() override;
1579
1580 virtual void SetPrePulseT0Range(float tmin, float tmax) override;
1581 virtual void SetPostPulseT0Range(float tmin, float tmax, float initialPostT0) override;
1582
1583 unsigned int GetPreT0ParIndex() const override {return 3;}
1584
1585 virtual float GetAmplitude() const override {return GetWrapperTF1()->GetParameter(0); }
1586 virtual float GetAmpError() const override {return GetWrapperTF1()->GetParError(0); }
1587
1588 virtual float GetTau1() const override {return m_tau1;}
1589 virtual float GetTau2() const override {return m_tau2;}
1590
1591 virtual float GetPreT0() const override {
1592 float fitPreT0 = GetWrapperTF1()->GetParameter(3);
1593
1594 // Correct the time to the maximum
1595 //
1596 fitPreT0 += m_timeCorr;
1597
1598 return fitPreT0;
1599 }
1600 virtual float GetPreAmp() const override {return GetWrapperTF1()->GetParameter(2);}
1601
1602 virtual float GetPostT0() const override {
1603 float fitPostT0 = GetWrapperTF1()->GetParameter(8);
1604
1605 // Correct the time to the maximum
1606 //
1607 fitPostT0 += m_timeCorr;
1608
1609 return fitPostT0;
1610 }
1611 virtual float GetPostAmp() const override {return GetWrapperTF1()->GetParameter(7);}
1612
1613 virtual float GetExpAmp() const override {return GetWrapperTF1()->GetParameter(6);}
1614
1615 virtual float GetTime() const override {
1616 return GetWrapperTF1()->GetParameter(1) + m_timeCorr; // Correct the time to the maximum
1617 }
1618
1619 virtual unsigned int GetNumShapeParameters() const override {return 5;}
1620
1621 virtual float GetShapeParameter(size_t index) const override
1622 {
1623 if (index < 5) return GetWrapperTF1()->GetParameter(index + 4);
1624 else throw std::runtime_error("Fit parameter does not exist.");
1625 }
1626
1627 virtual float GetBkgdMaxFraction() const override
1628 {
1629 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
1630
1631 double maxTime = GetTime();
1632
1633 double amp = theTF1->GetParameter(0);
1634 if (amp <= 0) return -1;
1635 double preAmp = theTF1->GetParameter(2);
1636 double preT0 = theTF1->GetParameter(3);
1637 double slope = theTF1->GetParameter(4);
1638
1639 double deltaTPre = maxTime - preT0;
1640
1641 double background = slope * maxTime + preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) -
1642 m_expFermiFunc->operator()(-preT0));
1643
1644 return background / amp;
1645 }
1646
1647 virtual double operator() (const double *x, const double *p) override
1648 {
1649 double t = x[0];
1650
1651 double amp = p[0];
1652 double t0 = p[1];
1653 double preAmp = p[2];
1654 double preT0 = p[3];
1655 double linSlope = p[4];
1656 double linConst = p[5];
1657 double expamp = p[6];
1658 double postAmp = p[7];
1659 double postT0 = p[8];
1660
1661 double deltaT = t - t0;
1662 double deltaTPre = t - preT0;
1663 double deltaTPost = t - postT0;
1664
1665 // We subtract off the value of the pre-pulse at the minimum time (nominally 0,
1666 // but can change if we exclude early samples) to account for the subtraction of the pre-sample
1667 //
1668 double deltaPresamp = GetTMinAdjust() - preT0;
1669
1670 double pulse1 = amp * m_norm * m_expFermiFunc->operator()(deltaT);
1671 double pulse2 = preAmp * m_norm * (m_expFermiFunc->operator()(deltaTPre) - m_expFermiFunc->operator()(deltaPresamp));
1672 double pulse3 = postAmp * m_norm * m_expFermiFunc->operator()(deltaTPost);
1673
1674 double linBG = linSlope * t + linConst;
1675 double expBG = expamp * std::exp(-(t) / m_tau2) - expamp * std::exp(-(GetTMinAdjust()) / m_tau2); // deltaPresamp
1676
1677 return pulse1 + pulse2 + pulse3 + linBG + expBG;
1678 }
1679};
1680
1681double getInductFuncTimeMax(const TF1* theTF1)
1682{
1683 float fitT0 = theTF1->GetParameter(1);
1684
1685 float tau1 = theTF1->GetParameter(2);
1686 float tau2 = theTF1->GetParameter(3);
1687
1688 // Correct the time to the maximum
1689 //
1690 double corrT0 = fitT0;
1691 if (tau2 > tau1) corrT0 += tau1 * std::log(tau2 / tau1 - 1.0);
1692
1693 double deltaT = theTF1->GetParameter(5)/8;
1694 double tmin = corrT0 - deltaT;
1695 double tmax = corrT0 + deltaT;
1696
1697 return theTF1->GetMaximumX(tmin, tmax, 1e-4, 20, false);
1698}
1699
1700
1701 double ZDCFermiExpFit(const double* xvec, const double* pvec)
1702{
1703 double t = xvec[0];
1704
1705 double amp = pvec[0];
1706 double t0 = pvec[1];
1707 double tau1 = pvec[2];
1708 double tau2 = pvec[3];
1709 double C = pvec[4];
1710
1711 double tauRatio = tau2 / tau1;
1712 double tauRatioMinunsOne = tauRatio - 1;
1713
1714 double norm = (std::pow(1. / tauRatioMinunsOne, 1. / (1 + tauRatio)) /
1715 ( 1 + std::pow(1. / tauRatioMinunsOne, 1. / (1 + 1 / tauRatio))));
1716
1717 double deltaT = t - t0;
1718 if (deltaT < 0) deltaT = 0;
1719
1720 double expTerm = std::exp(-deltaT / tau2);
1721 double fermiTerm = 1. / (1. + std::exp(-(t - t0) / tau1));
1722
1723 return amp * expTerm * fermiTerm / norm + C;
1724}
1725
1726 double ZDCFermiExpFitRefl(const double* xvec, const double* pvec)
1727{
1728 double t = xvec[0];
1729
1730 double amp = pvec[0];
1731 double t0 = pvec[1];
1732 double tau1 = pvec[2];
1733 double tau2 = pvec[3];
1734 double C = pvec[4];
1735
1736 double refldelay = pvec[5];
1737 double reflFrac = pvec[6];
1738 double reflwidth = pvec[7];
1739 double delta = pvec[8];
1740
1741 double tauRatio = tau2 / tau1;
1742 double tauRatioMinunsOne = tauRatio - 1;
1743
1744 double norm = std::pow(1. / tauRatioMinunsOne, 1. / (1 + tauRatio)) /
1745 ( 1 + std::pow(1. / tauRatioMinunsOne, 1. / (1 + 1 / tauRatio))) ;
1746
1747 double deltaT = t - t0;
1748 if (deltaT < 0) deltaT = 0;
1749
1750 // Note: the small constant added here accounts for the very long tail on the pulse
1751 // which doesn't go to zero over the time range that we sample
1752 //
1753 double expTerm = delta + std::exp(-deltaT / tau2);
1754 double fermiTerm = 1. / (1. + std::exp(-(t - t0) / tau1));
1755
1756 double deltaTRefl = deltaT - refldelay;
1757 double reflTerm = -reflFrac*amp*std::exp(-0.5*deltaTRefl*deltaTRefl/reflwidth/reflwidth);
1758
1759 return amp * expTerm * fermiTerm / norm + C + reflTerm;
1760}
1761
1762double ZDCFermiExpFitInduct(const double* xvec, const double* pvec)
1763{
1764 double t = xvec[0];
1765
1766 double amp = pvec[0];
1767 double t0 = pvec[1];
1768 double tau1 = pvec[2];
1769 double tau2 = pvec[3];
1770 double C = pvec[4];
1771
1772 double period = pvec[5];
1773 double Acos = pvec[6];
1774 double Bsin = pvec[7];
1775 double bI = pvec[8];
1776 double delta = pvec[9];
1777
1778 double twoPiOverPeriod = 2.0*M_PI/period;
1779
1780 double deltaT = t - t0;
1781 double norm = 1, expTerm = 1, fermiTerm = 1, inductTerm = 1;
1782
1783 if (deltaT > 0) {
1784 inductTerm = (1.0 + exp(-bI*deltaT)*(Acos*std::cos(deltaT*twoPiOverPeriod) +
1785 Bsin*std::sin(deltaT*twoPiOverPeriod)))/(1+Acos);
1786 expTerm = delta + std::exp(-deltaT / tau2)*inductTerm;
1787 }
1788 if (deltaT/tau1 < 7) fermiTerm = 1. / (1. + std::exp(-deltaT / tau1));
1789
1790 return amp * expTerm * fermiTerm * inductTerm/ norm + C;
1791}
1792
1793#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