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

#include <ZDCWaveformFermiExp.h>

Inheritance diagram for ZDCWaveformFermiExp:
Collaboration diagram for ZDCWaveformFermiExp:

Public Member Functions

 ZDCWaveformFermiExp ()=delete
 ZDCWaveformFermiExp (const std::string &tag, double initialTauRise, double initialTauFall)
 ZDCWaveformFermiExp (const ZDCWaveformFermiExp &instance)
ZDCWaveformBaseDuplicate ()
double evaluate (double time) const
double evaluateRoot (double *x, double *p)
double evaluateRootNoTF1Par (double *x, double *p)
double operator() (double *x, double *p)
const std::string & getTag () const
std::string getNameTag () const
const std::string getName () const
double getTauRise () const
double getTauFall () const
unsigned int getNumAddtlShapeValues () const
double getAddtlShapeValue (const std::string &name) const
double getAddtlShapeValue (unsigned int index) const
void setAddtlShapeValue (std::string name, double value)
void setAddtlShapeValue (unsigned int index, double value)
void setTaus (double tauRise, double tauFall)
void restoreInitial ()
TF1 * makeWaveformTF1 (ZDCWaveformBase *ptr, double xmin, double xmax, bool useTF1Params=true)
TF1 * makeWaveformTF1 (ZDCWaveformBase &instance, double xmin, double xmax, bool useTF1Params=true)

Protected Member Functions

double doEvaluate (double time) const override
virtual std::string name () const override
void setAddtlShapeParameters (const std::vector< std::string > &addtlShapeNames, const std::vector< double > &addtlShapeValues)
void setAddtlShapeValues (const double *values)
void setAddtlShapeValues (const std::vector< double > &values)

Protected Attributes

double m_tauRise
double m_tauFall
std::vector< double > m_addtlShapeValues

Private Attributes

std::string m_tag
std::map< std::string, unsigned int > m_addtlShapeNames
double m_initialTauRise
double m_initialTauFall
unsigned int m_numAddtlShapePars
std::vector< double > m_addtlShapeInitialValues

Detailed Description

Definition at line 14 of file ZDCWaveformFermiExp.h.

Constructor & Destructor Documentation

◆ ZDCWaveformFermiExp() [1/3]

ZDCWaveformFermiExp::ZDCWaveformFermiExp ( )
delete

◆ ZDCWaveformFermiExp() [2/3]

ZDCWaveformFermiExp::ZDCWaveformFermiExp ( const std::string & tag,
double initialTauRise,
double initialTauFall )
inline

Definition at line 24 of file ZDCWaveformFermiExp.h.

24 :
25 ZDCWaveformBase(tag, initialTauRise, initialTauFall, std::vector<std::string>(), std::vector<double>())
26 {}
ZDCWaveformBase()=delete

◆ ZDCWaveformFermiExp() [3/3]

ZDCWaveformFermiExp::ZDCWaveformFermiExp ( const ZDCWaveformFermiExp & instance)
inlineexplicit

Definition at line 28 of file ZDCWaveformFermiExp.h.

28 :
29 ZDCWaveformBase(instance.getTag(), instance.getTauRise(),instance.getTauFall(), std::vector<std::string>(), std::vector<double>()) {};
std::map< std::string, double > instance

Member Function Documentation

◆ doEvaluate()

double ZDCWaveformFermiExp::doEvaluate ( double time) const
overrideprotectedvirtual

Implements ZDCWaveformBase.

Reimplemented in ZDCWaveformFermiExpTail.

Definition at line 7 of file ZDCWaveformFermiExp.cxx.

8{
9 double tau1 = getTauRise();
10 double tau2 = getTauFall();
11 double shift = -tau1 * std::log(tau2 / tau1 - 1.0);
12 double timeShift = time - shift;
13
14 double expTerm = std::exp(-timeShift / tau2);
15 double fermiTerm = 1. / (1. + std::exp(-timeShift / tau1));
16
17 return expTerm * fermiTerm;
18}
double getTauFall() const
double getTauRise() const
time(flags, cells_name, *args, **kw)

◆ Duplicate()

ZDCWaveformBase * ZDCWaveformBase::Duplicate ( )
inherited

◆ evaluate()

double ZDCWaveformBase::evaluate ( double time) const
inlineinherited

Definition at line 81 of file ZDCWaveform.h.

82 {
83 return doEvaluate(time)/doEvaluate(0);
84 }
virtual double doEvaluate(double time) const =0

◆ evaluateRoot()

double ZDCWaveformBase::evaluateRoot ( double * x,
double * p )
inlineinherited

Definition at line 86 of file ZDCWaveform.h.

86 {
87 return this->operator()(x,p);
88 }
#define x
double operator()(double *x, double *p)
Definition ZDCWaveform.h:95

◆ evaluateRootNoTF1Par()

double ZDCWaveformBase::evaluateRootNoTF1Par ( double * x,
double * p )
inlineinherited

Definition at line 90 of file ZDCWaveform.h.

90 {
91 (void)p;
92 return evaluate(x[0]);
93 }
double evaluate(double time) const
Definition ZDCWaveform.h:81

◆ getAddtlShapeValue() [1/2]

double ZDCWaveformBase::getAddtlShapeValue ( const std::string & name) const
inlineinherited

Definition at line 108 of file ZDCWaveform.h.

108{return m_addtlShapeValues.at(m_addtlShapeNames.find(name)->second);}
virtual std::string name() const =0
std::vector< double > m_addtlShapeValues
Definition ZDCWaveform.h:45
std::map< std::string, unsigned int > m_addtlShapeNames
Definition ZDCWaveform.h:33

◆ getAddtlShapeValue() [2/2]

double ZDCWaveformBase::getAddtlShapeValue ( unsigned int index) const
inlineinherited

Definition at line 109 of file ZDCWaveform.h.

109{return m_addtlShapeValues.at(index);}

◆ getName()

const std::string ZDCWaveformBase::getName ( ) const
inlineinherited

Definition at line 103 of file ZDCWaveform.h.

103{return name();}

◆ getNameTag()

std::string ZDCWaveformBase::getNameTag ( ) const
inlineinherited

Definition at line 102 of file ZDCWaveform.h.

102{return name() + "_" + m_tag;}
std::string m_tag
Definition ZDCWaveform.h:32

◆ getNumAddtlShapeValues()

unsigned int ZDCWaveformBase::getNumAddtlShapeValues ( ) const
inlineinherited

Definition at line 107 of file ZDCWaveform.h.

107{return m_numAddtlShapePars;}
unsigned int m_numAddtlShapePars
Definition ZDCWaveform.h:37

◆ getTag()

const std::string & ZDCWaveformBase::getTag ( ) const
inlineinherited

Definition at line 101 of file ZDCWaveform.h.

101{return m_tag;}

◆ getTauFall()

double ZDCWaveformBase::getTauFall ( ) const
inlineinherited

Definition at line 105 of file ZDCWaveform.h.

105{return m_tauFall;}

◆ getTauRise()

double ZDCWaveformBase::getTauRise ( ) const
inlineinherited

Definition at line 104 of file ZDCWaveform.h.

104{return m_tauRise;}

◆ makeWaveformTF1() [1/2]

TF1 * ZDCWaveformBase::makeWaveformTF1 ( ZDCWaveformBase & instance,
double xmin,
double xmax,
bool useTF1Params = true )
inlineinherited

Definition at line 163 of file ZDCWaveform.h.

164{
165 return makeWaveformTF1(&instance, xmin, xmax, useTF1Params);
166}
TF1 * makeWaveformTF1(ZDCWaveformBase *ptr, double xmin, double xmax, bool useTF1Params=true)
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60

◆ makeWaveformTF1() [2/2]

TF1 * ZDCWaveformBase::makeWaveformTF1 ( ZDCWaveformBase * ptr,
double xmin,
double xmax,
bool useTF1Params = true )
inlineinherited

Definition at line 133 of file ZDCWaveform.h.

134{
135 std::string name = ptr->getNameTag() + "_TF1";
136
137 TF1* newTF1 = 0;
138
139 if (useTF1Params) {
140 unsigned int numPar = 2 + ptr->getNumAddtlShapeValues();
141
142 newTF1= new TF1(name.c_str(), ptr, &ZDCWaveformBase::evaluateRoot, xmin, xmax, numPar,
143 "ZDCWaveformBase", "evaluateRoot");
144
145 newTF1->SetParameter(0, ptr->getTauRise());
146 newTF1->SetParameter(1, ptr->getTauFall());
147
148 if (numPar > 2) {
149 for (unsigned int idxpar = 2; idxpar < numPar; idxpar++) {
150 newTF1->SetParameter(idxpar, ptr->getAddtlShapeValue(idxpar - 2));
151 }
152 }
153 }
154 else {
155 newTF1= new TF1(name.c_str(), ptr, &ZDCWaveformBase::evaluateRootNoTF1Par, xmin, xmax, 0,
156 "ZDCWaveformBase", "evaluateRoot");
157 }
158
159 newTF1->SetNpx(1000);
160 return newTF1;
161}
double evaluateRoot(double *x, double *p)
Definition ZDCWaveform.h:86
double evaluateRootNoTF1Par(double *x, double *p)
Definition ZDCWaveform.h:90
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ name()

virtual std::string ZDCWaveformFermiExp::name ( ) const
inlineoverrideprotectedvirtual

Implements ZDCWaveformBase.

Reimplemented in ZDCWaveformFermiExpTail.

Definition at line 19 of file ZDCWaveformFermiExp.h.

19{return "FermiExp";}

◆ operator()()

double ZDCWaveformBase::operator() ( double * x,
double * p )
inlineinherited

Definition at line 95 of file ZDCWaveform.h.

95 {
96 setTaus(p[0], p[1]);
98 return evaluate(x[0]);
99 }
void setAddtlShapeValues(const double *values)
void setTaus(double tauRise, double tauFall)
unsigned int getNumAddtlShapeValues() const

◆ restoreInitial()

void ZDCWaveformBase::restoreInitial ( )
inherited

Definition at line 60 of file ZDCWaveform.cxx.

◆ setAddtlShapeParameters()

void ZDCWaveformBase::setAddtlShapeParameters ( const std::vector< std::string > & addtlShapeNames,
const std::vector< double > & addtlShapeValues )
protectedinherited

Definition at line 32 of file ZDCWaveform.cxx.

34{
35 // Enforce consistency in vector lengths
36 //
37 m_numAddtlShapePars = addtlShapeNames.size();
38 if (m_numAddtlShapePars != addtlShapeValues.size()) throw std::runtime_error("ZDCWaveformBase::setAddtlShapeParameters; Shape name and value size mismatch");
39
40 m_addtlShapeNames.clear();
41
42 // Insert names into map with index
43 //
44 for (unsigned int param = 0; param < addtlShapeNames.size(); param++) {
45 m_addtlShapeNames.insert({addtlShapeNames[param], param});
46 }
47
48 // Save shape values, first to "initial", then to the actual
49 //
50 m_addtlShapeInitialValues = addtlShapeValues;
52}

◆ setAddtlShapeValue() [1/2]

void ZDCWaveformBase::setAddtlShapeValue ( std::string name,
double value )
inherited

◆ setAddtlShapeValue() [2/2]

void ZDCWaveformBase::setAddtlShapeValue ( unsigned int index,
double value )
inlineinherited

Definition at line 113 of file ZDCWaveform.h.

113 {
114 m_addtlShapeValues.at(index) = value;
115 }

◆ setAddtlShapeValues() [1/2]

void ZDCWaveformBase::setAddtlShapeValues ( const double * values)
protectedinherited

Definition at line 54 of file ZDCWaveform.cxx.

55{
56 unsigned int nvalues = m_addtlShapeValues.size();
57 std::copy_n(values, nvalues, m_addtlShapeValues.begin());
58}

◆ setAddtlShapeValues() [2/2]

void ZDCWaveformBase::setAddtlShapeValues ( const std::vector< double > & values)
inlineprotectedinherited

Definition at line 53 of file ZDCWaveform.h.

53 {
54 setAddtlShapeValues(&values[0]);
55 }

◆ setTaus()

void ZDCWaveformBase::setTaus ( double tauRise,
double tauFall )
inlineinherited

Definition at line 117 of file ZDCWaveform.h.

118 {
119 m_tauRise = tauRise;
120 m_tauFall = tauFall;
121 }

Member Data Documentation

◆ m_addtlShapeInitialValues

std::vector<double> ZDCWaveformBase::m_addtlShapeInitialValues
privateinherited

Definition at line 38 of file ZDCWaveform.h.

◆ m_addtlShapeNames

std::map<std::string, unsigned int> ZDCWaveformBase::m_addtlShapeNames
privateinherited

Definition at line 33 of file ZDCWaveform.h.

◆ m_addtlShapeValues

std::vector<double> ZDCWaveformBase::m_addtlShapeValues
protectedinherited

Definition at line 45 of file ZDCWaveform.h.

◆ m_initialTauFall

double ZDCWaveformBase::m_initialTauFall
privateinherited

Definition at line 36 of file ZDCWaveform.h.

◆ m_initialTauRise

double ZDCWaveformBase::m_initialTauRise
privateinherited

Definition at line 35 of file ZDCWaveform.h.

◆ m_numAddtlShapePars

unsigned int ZDCWaveformBase::m_numAddtlShapePars
privateinherited

Definition at line 37 of file ZDCWaveform.h.

◆ m_tag

std::string ZDCWaveformBase::m_tag
privateinherited

Definition at line 32 of file ZDCWaveform.h.

◆ m_tauFall

double ZDCWaveformBase::m_tauFall
protectedinherited

Definition at line 43 of file ZDCWaveform.h.

◆ m_tauRise

double ZDCWaveformBase::m_tauRise
protectedinherited

Definition at line 42 of file ZDCWaveform.h.


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