ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ZDCWaveformBase Class Referenceabstract

#include <ZDCWaveform.h>

Inheritance diagram for ZDCWaveformBase:
Collaboration diagram for ZDCWaveformBase:

Public Member Functions

 ZDCWaveformBase (std::string tag, double initialTauRise, double initialTauFall, const std::vector< std::string > &addtlShapeNames, const std::vector< double > &addtlShapeValues)
 
virtual ~ZDCWaveformBase ()=default
 
 ZDCWaveformBase (const ZDCWaveformBase &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

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)
 
virtual double doEvaluate (double time) const =0
 
virtual std::string name () const =0
 
 ZDCWaveformBase ()=delete
 

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 30 of file ZDCWaveform.h.

Constructor & Destructor Documentation

◆ ZDCWaveformBase() [1/3]

ZDCWaveformBase::ZDCWaveformBase ( )
protecteddelete

◆ ZDCWaveformBase() [2/3]

ZDCWaveformBase::ZDCWaveformBase ( std::string  tag,
double  initialTauRise,
double  initialTauFall,
const std::vector< std::string > &  addtlShapeNames,
const std::vector< double > &  addtlShapeValues 
)

Definition at line 8 of file ZDCWaveform.cxx.

9  :
10  m_tag( std::move(tag) ),
11  m_initialTauRise(initialTauRise),
12  m_initialTauFall(initialTauFall),
13  m_numAddtlShapePars(addtlShapeNames.size()),
14  m_tauRise(initialTauRise),
15  m_tauFall(initialTauFall)
16 {
17  setAddtlShapeParameters(addtlShapeNames, addtlShapeValues);
18 }

◆ ~ZDCWaveformBase()

virtual ZDCWaveformBase::~ZDCWaveformBase ( )
virtualdefault

◆ ZDCWaveformBase() [3/3]

ZDCWaveformBase::ZDCWaveformBase ( const ZDCWaveformBase instance)

Definition at line 20 of file ZDCWaveform.cxx.

20  :
21  m_tag( std::move(instance.m_tag) ),
22  m_addtlShapeNames(instance.m_addtlShapeNames),
23  m_initialTauRise(instance.m_initialTauRise),
24  m_initialTauFall(instance.m_initialTauFall),
25  m_numAddtlShapePars(instance.m_numAddtlShapePars),
26  m_addtlShapeInitialValues(instance.m_addtlShapeInitialValues),
27  m_tauRise(instance.m_tauRise),
28  m_tauFall(instance.m_tauFall)
29 {
30 }

Member Function Documentation

◆ doEvaluate()

virtual double ZDCWaveformBase::doEvaluate ( double  time) const
protectedpure virtual

◆ Duplicate()

ZDCWaveformBase* ZDCWaveformBase::Duplicate ( )

◆ evaluate()

double ZDCWaveformBase::evaluate ( double  time) const
inline

Definition at line 81 of file ZDCWaveform.h.

82  {
83  return doEvaluate(time)/doEvaluate(0);
84  }

◆ evaluateRoot()

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

Definition at line 86 of file ZDCWaveform.h.

86  {
87  return this->operator()(x,p);
88  }

◆ evaluateRootNoTF1Par()

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

Definition at line 90 of file ZDCWaveform.h.

90  {
91  (void)p;
92  return evaluate(x[0]);
93  }

◆ getAddtlShapeValue() [1/2]

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

Definition at line 108 of file ZDCWaveform.h.

108 {return m_addtlShapeValues.at(m_addtlShapeNames.find(name)->second);}

◆ getAddtlShapeValue() [2/2]

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

Definition at line 109 of file ZDCWaveform.h.

109 {return m_addtlShapeValues.at(index);}

◆ getName()

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

Definition at line 103 of file ZDCWaveform.h.

103 {return name();}

◆ getNameTag()

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

Definition at line 102 of file ZDCWaveform.h.

102 {return name() + "_" + m_tag;}

◆ getNumAddtlShapeValues()

unsigned int ZDCWaveformBase::getNumAddtlShapeValues ( ) const
inline

Definition at line 107 of file ZDCWaveform.h.

107 {return m_numAddtlShapePars;}

◆ getTag()

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

Definition at line 101 of file ZDCWaveform.h.

101 {return m_tag;}

◆ getTauFall()

double ZDCWaveformBase::getTauFall ( ) const
inline

Definition at line 105 of file ZDCWaveform.h.

105 {return m_tauFall;}

◆ getTauRise()

double ZDCWaveformBase::getTauRise ( ) const
inline

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 
)
inline

Definition at line 163 of file ZDCWaveform.h.

164 {
165  return makeWaveformTF1(&instance, xmin, xmax, useTF1Params);
166 }

◆ makeWaveformTF1() [2/2]

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

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 }

◆ name()

virtual std::string ZDCWaveformBase::name ( ) const
protectedpure virtual

◆ operator()()

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

Definition at line 95 of file ZDCWaveform.h.

95  {
96  setTaus(p[0], p[1]);
98  return evaluate(x[0]);
99  }

◆ restoreInitial()

void ZDCWaveformBase::restoreInitial ( )

◆ setAddtlShapeParameters()

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

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 
)

◆ setAddtlShapeValue() [2/2]

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

Definition at line 113 of file ZDCWaveform.h.

113  {
115  }

◆ setAddtlShapeValues() [1/2]

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

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)
inlineprotected

Definition at line 53 of file ZDCWaveform.h.

53  {
55  }

◆ setTaus()

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

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
private

Definition at line 38 of file ZDCWaveform.h.

◆ m_addtlShapeNames

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

Definition at line 33 of file ZDCWaveform.h.

◆ m_addtlShapeValues

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

Definition at line 45 of file ZDCWaveform.h.

◆ m_initialTauFall

double ZDCWaveformBase::m_initialTauFall
private

Definition at line 36 of file ZDCWaveform.h.

◆ m_initialTauRise

double ZDCWaveformBase::m_initialTauRise
private

Definition at line 35 of file ZDCWaveform.h.

◆ m_numAddtlShapePars

unsigned int ZDCWaveformBase::m_numAddtlShapePars
private

Definition at line 37 of file ZDCWaveform.h.

◆ m_tag

std::string ZDCWaveformBase::m_tag
private

Definition at line 32 of file ZDCWaveform.h.

◆ m_tauFall

double ZDCWaveformBase::m_tauFall
protected

Definition at line 43 of file ZDCWaveform.h.

◆ m_tauRise

double ZDCWaveformBase::m_tauRise
protected

Definition at line 42 of file ZDCWaveform.h.


The documentation for this class was generated from the following files:
ZDCWaveformBase::doEvaluate
virtual double doEvaluate(double time) const =0
ZDCWaveformBase::operator()
double operator()(double *x, double *p)
Definition: ZDCWaveform.h:95
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ZDCWaveformBase::m_initialTauFall
double m_initialTauFall
Definition: ZDCWaveform.h:36
ZDCWaveformBase::evaluateRootNoTF1Par
double evaluateRootNoTF1Par(double *x, double *p)
Definition: ZDCWaveform.h:90
index
Definition: index.py:1
ZDCWaveformBase::setAddtlShapeParameters
void setAddtlShapeParameters(const std::vector< std::string > &addtlShapeNames, const std::vector< double > &addtlShapeValues)
Definition: ZDCWaveform.cxx:32
ZDCWaveformBase::m_addtlShapeInitialValues
std::vector< double > m_addtlShapeInitialValues
Definition: ZDCWaveform.h:38
athena.value
value
Definition: athena.py:122
ZDCWaveformBase::getNumAddtlShapeValues
unsigned int getNumAddtlShapeValues() const
Definition: ZDCWaveform.h:107
ZDCWaveformBase::m_addtlShapeValues
std::vector< double > m_addtlShapeValues
Definition: ZDCWaveform.h:45
x
#define x
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:797
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
ZDCWaveformBase::evaluate
double evaluate(double time) const
Definition: ZDCWaveform.h:81
ZDCWaveformBase::m_addtlShapeNames
std::map< std::string, unsigned int > m_addtlShapeNames
Definition: ZDCWaveform.h:33
ZDCWaveformBase::m_tauRise
double m_tauRise
Definition: ZDCWaveform.h:42
xmin
double xmin
Definition: listroot.cxx:60
ZDCWaveformBase::makeWaveformTF1
TF1 * makeWaveformTF1(ZDCWaveformBase *ptr, double xmin, double xmax, bool useTF1Params=true)
Definition: ZDCWaveform.h:133
ZDCWaveformBase::getTauRise
double getTauRise() const
Definition: ZDCWaveform.h:104
ZDCWaveformBase::getAddtlShapeValue
double getAddtlShapeValue(const std::string &name) const
Definition: ZDCWaveform.h:108
ZDCWaveformBase::setAddtlShapeValues
void setAddtlShapeValues(const double *values)
Definition: ZDCWaveform.cxx:54
ZDCWaveformBase::setTaus
void setTaus(double tauRise, double tauFall)
Definition: ZDCWaveform.h:117
ZDCWaveformBase::m_initialTauRise
double m_initialTauRise
Definition: ZDCWaveform.h:35
ZDCWaveformBase::evaluateRoot
double evaluateRoot(double *x, double *p)
Definition: ZDCWaveform.h:86
ZDCWaveformBase::m_tauFall
double m_tauFall
Definition: ZDCWaveform.h:43
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
xmax
double xmax
Definition: listroot.cxx:61
ZDCWaveformBase::getNameTag
std::string getNameTag() const
Definition: ZDCWaveform.h:102
ZDCWaveformBase::name
virtual std::string name() const =0
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
ZDCWaveformBase::getTauFall
double getTauFall() const
Definition: ZDCWaveform.h:105
ZDCWaveformBase::m_tag
std::string m_tag
Definition: ZDCWaveform.h:32
ZDCWaveformBase::m_numAddtlShapePars
unsigned int m_numAddtlShapePars
Definition: ZDCWaveform.h:37