ATLAS Offline Software
Loading...
Searching...
No Matches
ZDCFitExpFermiVariableTausLHCf Class Reference

#include <ZDCFitWrapper.h>

Inheritance diagram for ZDCFitExpFermiVariableTausLHCf:
Collaboration diagram for ZDCFitExpFermiVariableTausLHCf:

Public Member Functions

 ZDCFitExpFermiVariableTausLHCf (const std::string &tag, float tmin, float tmax, bool fixTau1, bool fixTau2, float tau1, float tau2)
virtual void DoInitialize (float initialAmp, float initialT0, float ampMin, float ampMax) override
virtual void SetT0FitLimits (float tMin, float tMax) override
virtual float GetAmplitude () const override
virtual float GetAmpError () const override
virtual float GetTau1 () const override
virtual float GetTau2 () const override
virtual float GetTime () const override
virtual float GetShapeParameter (size_t index) const override
virtual float GetBkgdMaxFraction () const override
virtual double operator() (const double *x, const double *p) override
virtual void ConstrainFit () override
virtual void UnconstrainFit () override
void Initialize (float initialAmp, float initialT0, float ampMin, float ampMax)
void Initialize (float initialAmp, float initialT0, float ampMin, float ampMax, float fitTmin, float fitTmax, float fitTRef)
void SetAmpMinMax (float minAmp, float maxAmp)
void SetT0Range (float t0Min, float t0Max)
float GetMinAmp () const
float GetMaxAmp () const
float GetTMin () const
float GetTMax () const
float GetT0Min () const
float GetT0Max () const
float GetTMinAdjust () const
virtual std::shared_ptr< TF1 > GetWrapperTF1 ()
virtual const TF1 * GetWrapperTF1 () const
virtual TF1 * GetWrapperTF1RawPtr () const

Protected Attributes

bool m_fixTau1 {false}
bool m_fixTau2 {false}
float m_tau1 {0}
float m_tau2 {0}

Private Attributes

std::shared_ptr< TF1 > m_wrapperTF1 {}
float m_tmin {0}
float m_tmax {0}
float m_ampMin {0}
float m_ampMax {0}
float m_t0Min {0}
float m_t0Max {0}
bool m_adjTLimitsEvent {false}
float m_tminAdjust {0}
float m_tempTmin {0}
float m_tempTmax {0}

Detailed Description

Definition at line 230 of file ZDCFitWrapper.h.

Constructor & Destructor Documentation

◆ ZDCFitExpFermiVariableTausLHCf()

ZDCFitExpFermiVariableTausLHCf::ZDCFitExpFermiVariableTausLHCf ( const std::string & tag,
float tmin,
float tmax,
bool fixTau1,
bool fixTau2,
float tau1,
float tau2 )

Definition at line 125 of file ZDCFitWrapper.cxx.

125 :
126 ZDCFitWrapper(std::make_shared<TF1>(("ExpFermiVariableTausLHCf" + tag).c_str(), ZDCFermiExpFitRefl, tmin, tmax, 9)),
127 m_fixTau1(fixTau1), m_fixTau2(fixTau2), m_tau1(tau1), m_tau2(tau2)
128{
129 std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
130
131 theTF1->SetParName(0, "Amp");
132 theTF1->SetParName(1, "T0");
133 theTF1->SetParName(2, "#tau_{1}");
134 theTF1->SetParName(3, "#tau_{2}");
135 theTF1->SetParName(4, "C");
136 theTF1->SetParName(5, "refdelay");
137 theTF1->SetParName(6, "reflAmpFrac");
138 theTF1->SetParName(7, "reflWidth");
139 theTF1->SetParName(8, "delta");
140
141 theTF1->SetParLimits(1, tmin, tmax);
142 theTF1->SetParLimits(4, -100, 100);
143 theTF1->SetParLimits(6, -1e-4, 0.35);
144
145 theTF1->FixParameter(5, 6.5);
146 theTF1->FixParameter(7, 1.5);
147 theTF1->FixParameter(8, 0.01);
148
149 if (m_fixTau1) theTF1->FixParameter(2, m_tau1);
150 else theTF1->SetParLimits(2, 1, 2);
151
152 if (m_fixTau2) theTF1->FixParameter(3, m_tau2);
153 else theTF1->SetParLimits(3, 3.5, 6);
154}
double ZDCFermiExpFitRefl(const double *xvec, const double *pvec)
virtual std::shared_ptr< TF1 > GetWrapperTF1()
ZDCFitWrapper(const std::shared_ptr< TF1 > &wrapperTF1)

Member Function Documentation

◆ ConstrainFit()

void ZDCFitExpFermiVariableTausLHCf::ConstrainFit ( )
overridevirtual

Implements ZDCFitWrapper.

Definition at line 199 of file ZDCFitWrapper.cxx.

200{
201 // We force the constant and reflection terms to zero
202 //
203 std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
204
205 theTF1->FixParameter(4, 0);
206 theTF1->FixParameter(6, 0);
207}

◆ DoInitialize()

void ZDCFitExpFermiVariableTausLHCf::DoInitialize ( float initialAmp,
float initialT0,
float ampMin,
float ampMax )
overridevirtual

Implements ZDCFitWrapper.

Definition at line 156 of file ZDCFitWrapper.cxx.

157{
158 std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
159
160 theTF1->SetParameter(0, initialAmp);
161
162 float t0 = initialT0;
163 if (t0 < GetT0Min()) t0 = GetT0Min()*1.1;
164 if (t0 > GetT0Max()) t0 = GetT0Max()/1.1;
165 theTF1->SetParameter(1, t0);
166
167 theTF1->SetParameter(1, initialT0);
168 theTF1->SetParameter(4, 0);
169 theTF1->SetParameter(6, 0.1);
170
171 theTF1->SetParLimits(0, ampMin, ampMax);
172
173 if (!m_fixTau1) theTF1->SetParameter(2, m_tau1);
174 if (!m_fixTau2) theTF1->SetParameter(3, m_tau2);
175
176 // Set the parameter errors which ROOT now uses <<<to set the initial step sizes>>>
177 //
178 double ampStep = std::min(0.05*initialAmp, std::abs(ampMax - initialAmp)/2.);
179
180 theTF1->SetParError(0, ampStep);
181 theTF1->SetParError(1, 1.0);
182
183 if (!m_fixTau1) theTF1->SetParError(2, 0.05);
184 if (!m_fixTau2) theTF1->SetParError(3, 0.25);
185
186 theTF1->SetParError(4, 2);
187 theTF1->SetParError(5, 0.25);
188 theTF1->SetParError(6, 0.05);
189}
static Double_t t0
float GetT0Max() const
float GetT0Min() const

◆ GetAmpError()

virtual float ZDCFitExpFermiVariableTausLHCf::GetAmpError ( ) const
inlineoverridevirtual

Implements ZDCFitWrapper.

Definition at line 247 of file ZDCFitWrapper.h.

247{return GetWrapperTF1()->GetParError(0); }

◆ GetAmplitude()

virtual float ZDCFitExpFermiVariableTausLHCf::GetAmplitude ( ) const
inlineoverridevirtual

Implements ZDCFitWrapper.

Definition at line 246 of file ZDCFitWrapper.h.

246{return GetWrapperTF1()->GetParameter(0); }

◆ GetBkgdMaxFraction()

virtual float ZDCFitExpFermiVariableTausLHCf::GetBkgdMaxFraction ( ) const
inlineoverridevirtual

Implements ZDCFitWrapper.

Definition at line 273 of file ZDCFitWrapper.h.

274 {
275 const TF1* theTF1 = ZDCFitWrapper::GetWrapperTF1();
276 double amp = theTF1->GetParameter(0);
277 double constant = theTF1->GetParameter(4);
278
279 if (amp > 0) return constant / amp;
280 else return -1;
281 }

◆ GetMaxAmp()

float ZDCFitWrapper::GetMaxAmp ( ) const
inlineinherited

Definition at line 87 of file ZDCFitWrapper.h.

87{return m_ampMax;}

◆ GetMinAmp()

float ZDCFitWrapper::GetMinAmp ( ) const
inlineinherited

Definition at line 86 of file ZDCFitWrapper.h.

86{return m_ampMin;}

◆ GetShapeParameter()

virtual float ZDCFitExpFermiVariableTausLHCf::GetShapeParameter ( size_t index) const
inlineoverridevirtual

Implements ZDCFitWrapper.

Definition at line 266 of file ZDCFitWrapper.h.

267 {
268 if (index == 0) return GetWrapperTF1()->GetParameter(2);
269 else if (index == 1) return GetWrapperTF1()->GetParameter(3);
270 else throw std::runtime_error("Fit parameter does not exist.");
271 }

◆ GetT0Max()

float ZDCFitWrapper::GetT0Max ( ) const
inlineinherited

Definition at line 97 of file ZDCFitWrapper.h.

97 {
98 if (m_adjTLimitsEvent) return m_tempTmax;
99 else return m_t0Max;
100 }

◆ GetT0Min()

float ZDCFitWrapper::GetT0Min ( ) const
inlineinherited

Definition at line 92 of file ZDCFitWrapper.h.

92 {
93 if (m_adjTLimitsEvent) return m_tempTmin;
94 else return m_t0Min;
95 }

◆ GetTau1()

virtual float ZDCFitExpFermiVariableTausLHCf::GetTau1 ( ) const
inlineoverridevirtual

Implements ZDCFitWrapper.

Definition at line 249 of file ZDCFitWrapper.h.

249{return GetWrapperTF1()->GetParameter(2);}

◆ GetTau2()

virtual float ZDCFitExpFermiVariableTausLHCf::GetTau2 ( ) const
inlineoverridevirtual

Implements ZDCFitWrapper.

Definition at line 250 of file ZDCFitWrapper.h.

250{return GetWrapperTF1()->GetParameter(3);}

◆ GetTime()

virtual float ZDCFitExpFermiVariableTausLHCf::GetTime ( ) const
inlineoverridevirtual

Implements ZDCFitWrapper.

Definition at line 252 of file ZDCFitWrapper.h.

252 {
253 const TF1* theTF1 = GetWrapperTF1();
254
255 float fitT0 = theTF1->GetParameter(1);
256
257 float tau1 = theTF1->GetParameter(2);
258 float tau2 = theTF1->GetParameter(3);
259
260 // Correct the time to the maximum
261 //
262 if (tau2 > tau1) fitT0 += tau1 * std::log(tau2 / tau1 - 1.0);
263 return fitT0;
264 }

◆ GetTMax()

float ZDCFitWrapper::GetTMax ( ) const
inlineinherited

Definition at line 90 of file ZDCFitWrapper.h.

90{return m_tmax;}

◆ GetTMin()

float ZDCFitWrapper::GetTMin ( ) const
inlineinherited

Definition at line 89 of file ZDCFitWrapper.h.

89{return m_tmin;}

◆ GetTMinAdjust()

float ZDCFitWrapper::GetTMinAdjust ( ) const
inlineinherited

Definition at line 102 of file ZDCFitWrapper.h.

102{return m_tminAdjust;}

◆ GetWrapperTF1() [1/2]

virtual std::shared_ptr< TF1 > ZDCFitWrapper::GetWrapperTF1 ( )
inlinevirtualinherited

Definition at line 110 of file ZDCFitWrapper.h.

110{return m_wrapperTF1;}
std::shared_ptr< TF1 > m_wrapperTF1

◆ GetWrapperTF1() [2/2]

virtual const TF1 * ZDCFitWrapper::GetWrapperTF1 ( ) const
inlinevirtualinherited

Definition at line 111 of file ZDCFitWrapper.h.

111{return m_wrapperTF1.get();}

◆ GetWrapperTF1RawPtr()

virtual TF1 * ZDCFitWrapper::GetWrapperTF1RawPtr ( ) const
inlinevirtualinherited

Definition at line 112 of file ZDCFitWrapper.h.

112{return m_wrapperTF1.get();}

◆ Initialize() [1/2]

void ZDCFitWrapper::Initialize ( float initialAmp,
float initialT0,
float ampMin,
float ampMax )
inherited

Definition at line 9 of file ZDCFitWrapper.cxx.

10{
11 // Clear the errors on the TF1 because retaining the errors seems to affect
12 // the convergence of fits
13 //
14 unsigned int npar = GetWrapperTF1()->GetNpar();
15 std::vector<double> zeroVec(npar, 0.0);
16 GetWrapperTF1()->SetParErrors(&zeroVec[0]);
17
18 // If we adjusted the time range on the previous event, restore to default
19 //
22
23 m_adjTLimitsEvent = false;
24 m_tminAdjust = 0;
25 }
26
27 SetAmpMinMax(ampMin, ampMax);
28
29 DoInitialize(initialAmp, initialT0, ampMin, ampMax);
30}
virtual void SetT0FitLimits(float tMin, float tMax)=0
void SetAmpMinMax(float minAmp, float maxAmp)
virtual void DoInitialize(float initialAmp, float initialT0, float ampMin, float ampMax)=0

◆ Initialize() [2/2]

void ZDCFitWrapper::Initialize ( float initialAmp,
float initialT0,
float ampMin,
float ampMax,
float fitTmin,
float fitTmax,
float fitTRef )
inherited

Definition at line 32 of file ZDCFitWrapper.cxx.

33{
34 // Clear the errors on the TF1 because retaining the errors seems to affect
35 // the convergence of fits
36 //
37 unsigned int npar = GetWrapperTF1()->GetNpar();
38 std::vector<double> zeroVec(npar, 0.0);
39 GetWrapperTF1()->SetParErrors(&zeroVec[0]);
40
41 m_adjTLimitsEvent = true;
42
43 m_tminAdjust = fitTRef; // Note: this is the time corresponding to the sample used for presample subtraction
44
45 m_tempTmin = std::max(m_t0Min, fitTmin);
46 m_tempTmax = std::min(m_t0Max, fitTmax);
47
48 SetAmpMinMax(ampMin, ampMax);
50
51 DoInitialize(initialAmp, initialT0, ampMin, ampMax);
52}

◆ operator()()

virtual double ZDCFitExpFermiVariableTausLHCf::operator() ( const double * x,
const double * p )
inlineoverridevirtual

Implements ZDCFitWrapper.

Definition at line 283 of file ZDCFitWrapper.h.

283 {
284 return ZDCFermiExpFitRefl(x, p);
285 }
#define x

◆ SetAmpMinMax()

void ZDCFitWrapper::SetAmpMinMax ( float minAmp,
float maxAmp )
inlineinherited

Definition at line 63 of file ZDCFitWrapper.h.

64 {
65 m_ampMin = minAmp;
66 m_ampMax = maxAmp;
67 }

◆ SetT0FitLimits()

void ZDCFitExpFermiVariableTausLHCf::SetT0FitLimits ( float tMin,
float tMax )
overridevirtual

Implements ZDCFitWrapper.

Definition at line 191 of file ZDCFitWrapper.cxx.

192{
193 // Set the parameter limits accordingly on the TF1
194 //
195 std::shared_ptr<TF1> theTF1 = ZDCFitWrapper::GetWrapperTF1();
196 theTF1->SetParLimits(1, t0Min, t0Max);
197}

◆ SetT0Range()

void ZDCFitWrapper::SetT0Range ( float t0Min,
float t0Max )
inlineinherited

Definition at line 69 of file ZDCFitWrapper.h.

70 {
71 m_t0Min = t0Min;
72 m_t0Max = t0Max;
73
74 SetT0FitLimits(t0Min, t0Max);
75 }

◆ UnconstrainFit()

void ZDCFitExpFermiVariableTausLHCf::UnconstrainFit ( )
overridevirtual

Implements ZDCFitWrapper.

Definition at line 208 of file ZDCFitWrapper.cxx.

209{
210 std::shared_ptr<TF1> theTF1 = GetWrapperTF1();
211 theTF1->ReleaseParameter(4);
212 theTF1->SetParameter(4, 0);
213
214 theTF1->ReleaseParameter(6);
215 theTF1->SetParLimits(6, -1e-4, 0.35);
216 theTF1->SetParameter(6, 0.1);
217}

Member Data Documentation

◆ m_adjTLimitsEvent

bool ZDCFitWrapper::m_adjTLimitsEvent {false}
privateinherited

Definition at line 32 of file ZDCFitWrapper.h.

32{false};

◆ m_ampMax

float ZDCFitWrapper::m_ampMax {0}
privateinherited

Definition at line 27 of file ZDCFitWrapper.h.

27{0};

◆ m_ampMin

float ZDCFitWrapper::m_ampMin {0}
privateinherited

Definition at line 26 of file ZDCFitWrapper.h.

26{0};

◆ m_fixTau1

bool ZDCFitExpFermiVariableTausLHCf::m_fixTau1 {false}
protected

Definition at line 233 of file ZDCFitWrapper.h.

233{false};

◆ m_fixTau2

bool ZDCFitExpFermiVariableTausLHCf::m_fixTau2 {false}
protected

Definition at line 234 of file ZDCFitWrapper.h.

234{false};

◆ m_t0Max

float ZDCFitWrapper::m_t0Max {0}
privateinherited

Definition at line 30 of file ZDCFitWrapper.h.

30{0};

◆ m_t0Min

float ZDCFitWrapper::m_t0Min {0}
privateinherited

Definition at line 29 of file ZDCFitWrapper.h.

29{0};

◆ m_tau1

float ZDCFitExpFermiVariableTausLHCf::m_tau1 {0}
protected

Definition at line 236 of file ZDCFitWrapper.h.

236{0};

◆ m_tau2

float ZDCFitExpFermiVariableTausLHCf::m_tau2 {0}
protected

Definition at line 237 of file ZDCFitWrapper.h.

237{0};

◆ m_tempTmax

float ZDCFitWrapper::m_tempTmax {0}
privateinherited

Definition at line 35 of file ZDCFitWrapper.h.

35{0};

◆ m_tempTmin

float ZDCFitWrapper::m_tempTmin {0}
privateinherited

Definition at line 34 of file ZDCFitWrapper.h.

34{0};

◆ m_tmax

float ZDCFitWrapper::m_tmax {0}
privateinherited

Definition at line 24 of file ZDCFitWrapper.h.

24{0};

◆ m_tmin

float ZDCFitWrapper::m_tmin {0}
privateinherited

Definition at line 23 of file ZDCFitWrapper.h.

23{0};

◆ m_tminAdjust

float ZDCFitWrapper::m_tminAdjust {0}
privateinherited

Definition at line 33 of file ZDCFitWrapper.h.

33{0};

◆ m_wrapperTF1

std::shared_ptr<TF1> ZDCFitWrapper::m_wrapperTF1 {}
privateinherited

Definition at line 21 of file ZDCFitWrapper.h.

21{};

The documentation for this class was generated from the following files: