ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ZDCWaveformLTLinStep Class Reference

#include <ZDCWaveformLTLinStep.h>

Inheritance diagram for ZDCWaveformLTLinStep:
Collaboration diagram for ZDCWaveformLTLinStep:

Public Member Functions

 ZDCWaveformLTLinStep ()
 
 ZDCWaveformLTLinStep (const std::string &tag, double initialTauRise, double initialTauFall, double initialTauLin)
 
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 15 of file ZDCWaveformLTLinStep.h.

Constructor & Destructor Documentation

◆ ZDCWaveformLTLinStep() [1/2]

ZDCWaveformLTLinStep::ZDCWaveformLTLinStep ( )
inline

Definition at line 23 of file ZDCWaveformLTLinStep.h.

23  :
24  ZDCWaveformBase("default", 1, 6, std::vector<std::string>({"tauLin"}), std::vector<double>({1.0}))
25  { }

◆ ZDCWaveformLTLinStep() [2/2]

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

Definition at line 27 of file ZDCWaveformLTLinStep.h.

27  :
28  ZDCWaveformBase(tag, initialTauRise, initialTauFall, std::vector<std::string>({"tauLin"}), std::vector<double>({initialTauLin}))
29  {}

Member Function Documentation

◆ doEvaluate()

double ZDCWaveformLTLinStep::doEvaluate ( double  time) const
overrideprotectedvirtual

Implements ZDCWaveformBase.

Definition at line 7 of file ZDCWaveformLTLinStep.cxx.

8 {
9  double tauRise = getTauRise();
10  double tauFall = getTauFall();
11  double tauLin = getAddtlShapeValue(0);
12 
13  // The maximum occurs after the turnon of the pulse, that should be t = 0
14  //
15  double timeMax = std::log((1.0 - std::exp(tauLin/tauRise))/(1.0 - std::exp(tauLin/tauFall)))/(1./tauRise-1./tauFall);
16  double timeAdj = time + timeMax;
17 
18  if (timeAdj < 0) return 0;
19 
20  double term1 = (tauFall*(1.0 - std::exp(-timeAdj/tauFall)) - tauRise*(1.0 - std::exp(-timeAdj/tauRise)));
21  double term2 = 0.;
22 
23  if (timeAdj > tauLin) term2 = (-tauFall*(1.0 - std::exp(-(timeAdj-tauLin)/tauFall)) +
24  tauRise*(1.0 - std::exp(-(timeAdj-tauLin)/tauRise)));
25 
26  return tauRise/tauLin*(term1 + term2)/ (tauFall-tauRise);
27 }

◆ 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  }

◆ 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  }

◆ 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  }

◆ 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);}

◆ 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;}

◆ getNumAddtlShapeValues()

unsigned int ZDCWaveformBase::getNumAddtlShapeValues ( ) const
inlineinherited

Definition at line 107 of file ZDCWaveform.h.

107 {return m_numAddtlShapePars;}

◆ 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 }

◆ 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 }

◆ name()

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

Implements ZDCWaveformBase.

Definition at line 20 of file ZDCWaveformLTLinStep.h.

20 {return "LTLinStep";}

◆ 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  }

◆ restoreInitial()

void ZDCWaveformBase::restoreInitial ( )
inherited

◆ 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  {
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  {
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:
ZDCWaveformBase::doEvaluate
virtual double doEvaluate(double time) const =0
ZDCWaveformBase::operator()
double operator()(double *x, double *p)
Definition: ZDCWaveform.h:95
ZDCWaveformBase::ZDCWaveformBase
ZDCWaveformBase()=delete
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::m_addtlShapeInitialValues
std::vector< double > m_addtlShapeInitialValues
Definition: ZDCWaveform.h:38
athena.value
value
Definition: athena.py:124
ZDCWaveformBase::getNumAddtlShapeValues
unsigned int getNumAddtlShapeValues() const
Definition: ZDCWaveform.h:107
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
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:805
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
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
xmax
double xmax
Definition: listroot.cxx:61
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