LDMX Software
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 iInt (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 99 of file QIEInputPulse.cxx.

99{}

◆ 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 106 of file QIEInputPulse.cxx.

106 {
107 k_ = k;
108 tmax_ = tmax;
109
110 rt_ = (log(9 + exp(-k_ * tmax_)) - log(1 + 9 * exp(-k_ * tmax_))) / k_;
111 ft_ = log(9) / k_;
112}
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 156 of file QIEInputPulse.cxx.

156 {
157 if (id >= ampl_.size()) return 0;
158 if (T <= toff_[id]) return 0;
159
160 float t = T - toff_[id];
161 // Normalization constant
162 float nc = ampl_[id] / tmax_;
163
164 if (t <= tmax_) return (nc * k_ * exp(-k_ * t));
165 return (-nc * k_ * (1 - exp(-k_ * tmax_)) * exp(k_ * (tmax_ - t)));
166}
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 123 of file QIEInputPulse.cxx.

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

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_.

◆ iInt()

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

Indefinite integral at time T.

Definition at line 168 of file QIEInputPulse.cxx.

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

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 146 of file QIEInputPulse.cxx.

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

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

◆ max()

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

maximum of the pulse

Implements trigscint::QIEInputPulse.

Definition at line 140 of file QIEInputPulse.cxx.

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

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 115 of file QIEInputPulse.cxx.

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

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(), iInt(), 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(), iInt(), max(), and setRiseFall().


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