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

Pulse made out of difference of two sigmoids. More...

#include <QIEInputPulse.h>

Public Member Functions

 Bimoid (float start, float qq)
 Constructor.
 
virtual ~Bimoid ()=default
 Default Destructor.
 
float EvalSingle (float T, int id) override
 Evaluate the pulse at time T.
 
float I_Int (float T, int id)
 Indefinite integral 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 Attributes

float rt_
 rise time
 
float ft_
 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

Pulse made out of difference of two sigmoids.

Note
The pulse maximum is found numerically

Definition at line 74 of file QIEInputPulse.h.

Constructor & Destructor Documentation

◆ Bimoid()

trigscint::Bimoid::Bimoid ( float  start,
float  qq 
)

Constructor.

Definition at line 32 of file QIEInputPulse.cxx.

32 {
33 rt_ = rise;
34 ft_ = fall;
35}
float ft_
fall time
float rt_
rise time

References ft_, and rt_.

Member Function Documentation

◆ Derivative()

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

Differentiate pulse at time T.

Implements trigscint::QIEInputPulse.

Definition at line 86 of file QIEInputPulse.cxx.

86 {
87 // Normalization constant
88 float nc = (ft_ - rt_) * log(2) / ampl_[id];
89
90 float T_ = T - toff_[id];
91 float E1 = exp(-T_ / rt_);
92 float E2 = exp(-T_ / ft_);
93
94 float v1 = E1 / (rt_ * pow(1 + E1, 2));
95 float v2 = E2 / (ft_ * pow(1 + E2, 2));
96
97 return ((v1 - v2) / nc); // Actual derivative
98}
std::vector< float > ampl_
collection of pulse amplitudes
std::vector< float > toff_
collection of pulse time offsets

References trigscint::QIEInputPulse::ampl_, ft_, rt_, and trigscint::QIEInputPulse::toff_.

Referenced by Max().

◆ EvalSingle()

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

Evaluate the pulse at time T.

Implements trigscint::QIEInputPulse.

Definition at line 37 of file QIEInputPulse.cxx.

37 {
38 if (T < toff_[id]) return 0;
39 // Normalization constant
40 float nc = (ft_ - rt_) * log(2) / ampl_[id];
41
42 float y1 = 1 / (1 + exp((toff_[id] - T) / rt_));
43 float y2 = 1 / (1 + exp((toff_[id] - T) / ft_));
44 return ((y1 - y2) / nc);
45}

References trigscint::QIEInputPulse::ampl_, ft_, rt_, and trigscint::QIEInputPulse::toff_.

◆ I_Int()

float trigscint::Bimoid::I_Int ( float  T,
int  id 
)

Indefinite integral at time T.

Definition at line 57 of file QIEInputPulse.cxx.

57 {
58 if (T <= toff_[id]) return 0;
59 // Normalization constant
60 float nc = (ft_ - rt_) * log(2) / ampl_[id];
61
62 float t = T - toff_[id]; // time relative to offset
63
64 float II = // Integral
65 rt_ * log(1 + exp((t - toff_[id]) / rt_)) -
66 ft_ * log(1 + exp((t - toff_[id]) / ft_));
67
68 return II / nc;
69}

References trigscint::QIEInputPulse::ampl_, ft_, rt_, and trigscint::QIEInputPulse::toff_.

Referenced by Integrate().

◆ Integrate()

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

Integrate the pulse from T1 to T2.

Implements trigscint::QIEInputPulse.

Definition at line 47 of file QIEInputPulse.cxx.

47 {
48 float val = 0;
49 for (int id = 0; id < ampl_.size(); id++) {
50 if (ampl_[id] > 0 && T2 > toff_[id]) {
51 val += I_Int(T2, id) - I_Int(T1, id);
52 }
53 }
54 return val;
55}
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::Bimoid::Max ( int  id)
overridevirtual

maximum of the pulse

Implements trigscint::QIEInputPulse.

Definition at line 71 of file QIEInputPulse.cxx.

71 {
72 float a = 0;
73 float b = 50;
74 float mx = (a + b) / 2; // maximum
75
76 while (std::abs(Derivative(mx, id)) >= 1e-5) {
77 if (Derivative(a, id) * Derivative(mx, id) > 0) {
78 a = mx;
79 } else
80 b = mx;
81 mx = (a + b) / 2;
82 }
83 return (mx);
84}
float Derivative(float T, int id) override
Differentiate pulse at time T.

References Derivative().

Member Data Documentation

◆ ft_

float trigscint::Bimoid::ft_
private

fall time

Definition at line 111 of file QIEInputPulse.h.

Referenced by Bimoid(), Derivative(), EvalSingle(), and I_Int().

◆ rt_

float trigscint::Bimoid::rt_
private

rise time

Definition at line 109 of file QIEInputPulse.h.

Referenced by Bimoid(), Derivative(), EvalSingle(), and I_Int().


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