LDMX Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
trigscint::Expo Class Reference

piece-wise exponential pulse, modelled as an output of a capacitor More...

#include <QIEInputPulse.h>

Public Member Functions

 Expo ()
 The default constructor.
 
 Expo (float k, float tmax)
 Main constructor.
 
virtual ~Expo ()=default
 main constructor
 
float GetRise ()
 Get Rise time of the pulse.
 
float GetFall ()
 Get Fall time of the pulse.
 
void SetRiseFall (float rr, float ff)
 Set Rise and Fall time of the pulse.
 
float EvalSingle (float T, int id) override
 Evaluate the pulse at time T.
 
float Integrate (float T1, float T2) override
 Integrate the pulse from T1 to T2.
 
float Max (int id) override
 maximum of the pulse
 
float Derivative (float T, int id) override
 Differentiate pulse at time T.
 
- Public Member Functions inherited from trigscint::QIEInputPulse
virtual ~QIEInputPulse ()=default
 Destructor.
 
float Eval (float T)
 Evaluate the pulse train at time T.
 
void AddPulse (float toff, float ampl)
 To add a pulse to the collection.
 
int GetNPulses ()
 Get the number of pulses in the collection.
 

Private Member Functions

float I_Int (float T, int id)
 Indefinite integral at time T.
 

Private Attributes

float k_
 1/RC time constant (for the capacitor)
 
float tmax_
 time when pulse attains maximum
 
float rt_ {-1}
 Rise Time.
 
float ft_ {-1}
 Fall Time.
 

Additional Inherited Members

- Protected Attributes inherited from trigscint::QIEInputPulse
std::vector< float > toff_
 collection of pulse time offsets
 
std::vector< float > ampl_
 collection of pulse amplitudes
 

Detailed Description

piece-wise exponential pulse, modelled as an output of a capacitor

Note
This is the preferred inpute pulse shape

Definition at line 122 of file QIEInputPulse.h.

Constructor & Destructor Documentation

◆ Expo() [1/2]

trigscint::Expo::Expo ( )

The default constructor.

Definition at line 100 of file QIEInputPulse.cxx.

100{}

◆ Expo() [2/2]

trigscint::Expo::Expo ( float  k,
float  tmax 
)

Main constructor.

Parameters
k= 1/(RC time const)
tmax= relative time of the pulse maximum (in ns)

Definition at line 107 of file QIEInputPulse.cxx.

107 {
108 k_ = k;
109 tmax_ = tmax;
110
111 rt_ = (log(9 + exp(-k_ * tmax_)) - log(1 + 9 * exp(-k_ * tmax_))) / k_;
112 ft_ = log(9) / k_;
113}
float k_
1/RC time constant (for the capacitor)
float ft_
Fall Time.
float rt_
Rise Time.
float tmax_
time when pulse attains maximum

References ft_, k_, rt_, and tmax_.

◆ ~Expo()

virtual trigscint::Expo::~Expo ( )
virtualdefault

main constructor

Destructor

Member Function Documentation

◆ Derivative()

float trigscint::Expo::Derivative ( float  T,
int  id 
)
overridevirtual

Differentiate pulse at time T.

Implements trigscint::QIEInputPulse.

Definition at line 157 of file QIEInputPulse.cxx.

157 {
158 if (id >= ampl_.size()) return 0;
159 if (T <= toff_[id]) return 0;
160
161 float t = T - toff_[id];
162 // Normalization constant
163 float nc = ampl_[id] / tmax_;
164
165 if (t <= tmax_) return (nc * k_ * exp(-k_ * t));
166 return (-nc * k_ * (1 - exp(-k_ * tmax_)) * exp(k_ * (tmax_ - t)));
167}
std::vector< float > ampl_
collection of pulse amplitudes
std::vector< float > toff_
collection of pulse time offsets

References trigscint::QIEInputPulse::ampl_, k_, tmax_, and trigscint::QIEInputPulse::toff_.

◆ EvalSingle()

float trigscint::Expo::EvalSingle ( float  T,
int  id 
)
overridevirtual

Evaluate the pulse at time T.

Implements trigscint::QIEInputPulse.

Definition at line 124 of file QIEInputPulse.cxx.

124 {
125 if (id >= ampl_.size()) return 0;
126 if (t_ <= toff_[id]) return 0;
127 if (ampl_[id] == 0) return 0;
128
129 // Normalization constant
130 float nc = ampl_[id] / tmax_;
131 // time relative to the offset
132 float T = t_ - toff_[id];
133 if (T < tmax_) {
134 return (nc * (1 - exp(-k_ * T)));
135 } else {
136 return (nc * (1 - exp(-k_ * tmax_)) * exp(k_ * (tmax_ - T)));
137 }
138 return -1;
139}

References trigscint::QIEInputPulse::ampl_, k_, tmax_, and trigscint::QIEInputPulse::toff_.

◆ GetFall()

float trigscint::Expo::GetFall ( )
inline

Get Fall time of the pulse.

Definition at line 148 of file QIEInputPulse.h.

148{ return ft_; }

References ft_.

◆ GetRise()

float trigscint::Expo::GetRise ( )
inline

Get Rise time of the pulse.

Definition at line 143 of file QIEInputPulse.h.

143{ return rt_; }

References rt_.

◆ I_Int()

float trigscint::Expo::I_Int ( float  T,
int  id 
)
private

Indefinite integral at time T.

Definition at line 169 of file QIEInputPulse.cxx.

169 {
170 if (T <= toff_[id]) return 0;
171 float t = T - toff_[id];
172 // Normalization constant
173 float nc = ampl_[id] / tmax_;
174 if (t < tmax_) return (nc * (k_ * t + exp(-k_ * t) - 1) / k_);
175
176 float c1 = (1 - exp(-k_ * tmax_)) / k_;
177 float c2 = tmax_ - c1 * exp(k_ * (tmax_ - t));
178 return nc * c2;
179}

References trigscint::QIEInputPulse::ampl_, k_, tmax_, and trigscint::QIEInputPulse::toff_.

Referenced by Integrate().

◆ Integrate()

float trigscint::Expo::Integrate ( float  T1,
float  T2 
)
overridevirtual

Integrate the pulse from T1 to T2.

Implements trigscint::QIEInputPulse.

Definition at line 147 of file QIEInputPulse.cxx.

147 {
148 float val = 0;
149 for (int id = 0; id < ampl_.size(); id++) {
150 if (ampl_[id] > 0 && T2 > toff_[id]) {
151 val += I_Int(T2, id) - I_Int(T1, id);
152 }
153 }
154 return val;
155}
float I_Int(float T, int id)
Indefinite integral at time T.

References trigscint::QIEInputPulse::ampl_, I_Int(), and trigscint::QIEInputPulse::toff_.

◆ Max()

float trigscint::Expo::Max ( int  id)
overridevirtual

maximum of the pulse

Implements trigscint::QIEInputPulse.

Definition at line 141 of file QIEInputPulse.cxx.

141 {
142 // Normalization constant
143 float nc = ampl_[id] / tmax_;
144 return nc * (1 - exp(-k_ * tmax_));
145}

References trigscint::QIEInputPulse::ampl_, k_, and tmax_.

◆ SetRiseFall()

void trigscint::Expo::SetRiseFall ( float  rr,
float  ff 
)

Set Rise and Fall time of the pulse.

Parameters
rrRise time
ffFall time

Definition at line 116 of file QIEInputPulse.cxx.

116 {
117 rt_ = rr;
118 ft_ = ff;
119
120 k_ = log(9) / ft_;
121 tmax_ = (log(9 - exp(-k_ * rt_)) - log(9 * exp(-k_ * rt_) - 1)) / k_;
122}

References ft_, k_, rt_, and tmax_.

Member Data Documentation

◆ ft_

float trigscint::Expo::ft_ {-1}
private

Fall Time.

Definition at line 185 of file QIEInputPulse.h.

185{-1};

Referenced by Expo(), GetFall(), and SetRiseFall().

◆ k_

float trigscint::Expo::k_
private

1/RC time constant (for the capacitor)

Definition at line 179 of file QIEInputPulse.h.

Referenced by Derivative(), EvalSingle(), Expo(), I_Int(), Max(), and SetRiseFall().

◆ rt_

float trigscint::Expo::rt_ {-1}
private

Rise Time.

Definition at line 183 of file QIEInputPulse.h.

183{-1};

Referenced by Expo(), GetRise(), and SetRiseFall().

◆ tmax_

float trigscint::Expo::tmax_
private

time when pulse attains maximum

Definition at line 181 of file QIEInputPulse.h.

Referenced by Derivative(), EvalSingle(), Expo(), I_Int(), Max(), and SetRiseFall().


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