Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::Shaper Class Reference

Class for signal processing. More...

#include <Shaper.hh>

Public Member Functions

 Shaper ()=delete
 Default constructor.
 
 Shaper (const unsigned int n, const double tau, const double g, std::string shaperType)
 Constructor.
 
 ~Shaper ()
 Destructor.
 
double Shape (const double t) const
 Evaluate the transfer function.
 
double UnipolarShaper (const double t) const
 Transfer function for a unipolar shaper.
 
double BipolarShaper (const double t) const
 Transfer function for a bipolar shaper.
 
double PeakingTime () const
 Time for the transfer function to rise from zero to peak height.
 
double TransferFuncSq () const
 Return the integral of the transfer function squared.
 
bool IsUnipolar () const
 Is it a unipolar shaper?
 
bool IsBipolar () const
 Is it a bipolar shaper?
 
void GetParameters (unsigned int &n, double &tp)
 Retrieve the parameters.
 

Detailed Description

Class for signal processing.

Definition at line 11 of file Shaper.hh.

Constructor & Destructor Documentation

◆ Shaper() [1/2]

Garfield::Shaper::Shaper ( )
delete

Default constructor.

◆ Shaper() [2/2]

Garfield::Shaper::Shaper ( const unsigned int  n,
const double  tau,
const double  g,
std::string  shaperType 
)

Constructor.

Definition at line 24 of file Shaper.cc.

25 :
26 m_n(n),
27 m_tau(tau),
28 m_g(g) {
29
30 std::transform(shaperType.begin(), shaperType.end(),
31 shaperType.begin(), toupper);
32 if (shaperType == "UNIPOLAR") {
33 m_type = ShaperType::Unipolar;
34 m_tp = m_n * m_tau;
35 m_prefactor = exp(m_n);
36 m_transfer_func_sq = (exp(2 * m_n) / pow(2 * m_n, 2 * m_n)) * m_tp *
37 ROOT::Math::tgamma(2 * m_n);
38 } else if (shaperType == "BIPOLAR") {
39 m_type = ShaperType::Bipolar;
40 const double r = m_n - sqrt(m_n);
41 m_tp = r * m_tau;
42 m_prefactor = exp(r) / sqrt(m_n);
43 m_transfer_func_sq = (exp(2 * r) / pow(2 * r, 2 * m_n)) * r * m_tp *
44 ROOT::Math::tgamma(2 * m_n - 1);
45 } else {
46 std::cerr << m_className << ": Unknown shaper type.\n";
47 }
48}
DoubleAc pow(const DoubleAc &f, double p)
Definition: DoubleAc.cpp:337
DoubleAc exp(const DoubleAc &f)
Definition: DoubleAc.cpp:377
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:314

◆ ~Shaper()

Garfield::Shaper::~Shaper ( )
inline

Destructor.

Definition at line 19 of file Shaper.hh.

19{}

Member Function Documentation

◆ BipolarShaper()

double Garfield::Shaper::BipolarShaper ( const double  t) const

Transfer function for a bipolar shaper.

Definition at line 67 of file Shaper.cc.

67 {
68 double f = m_prefactor * (m_n - t / m_tau) * pow(t / m_tp, m_n - 1) * exp(-t / m_tau) * Heaviside(t, 0.);
69 return m_g * f;
70}

Referenced by Shape().

◆ GetParameters()

void Garfield::Shaper::GetParameters ( unsigned int &  n,
double &  tp 
)
inline

Retrieve the parameters.

Definition at line 38 of file Shaper.hh.

38 {
39 n = m_n;
40 tp = m_tp;
41 }

Referenced by Garfield::Sensor::PrintTransferFunction().

◆ IsBipolar()

bool Garfield::Shaper::IsBipolar ( ) const
inline

Is it a bipolar shaper?

Definition at line 36 of file Shaper.hh.

36{ return (m_type == ShaperType::Bipolar); }

Referenced by Garfield::Sensor::PrintTransferFunction().

◆ IsUnipolar()

bool Garfield::Shaper::IsUnipolar ( ) const
inline

Is it a unipolar shaper?

Definition at line 34 of file Shaper.hh.

34{ return (m_type == ShaperType::Unipolar); }

Referenced by Garfield::Sensor::PrintTransferFunction().

◆ PeakingTime()

double Garfield::Shaper::PeakingTime ( ) const
inline

Time for the transfer function to rise from zero to peak height.

Definition at line 28 of file Shaper.hh.

28{ return m_tp; }

◆ Shape()

double Garfield::Shaper::Shape ( const double  t) const

Evaluate the transfer function.

Definition at line 50 of file Shaper.cc.

50 {
51 switch (m_type) {
52 case ShaperType::Unipolar:
53 return UnipolarShaper(t);
54 case ShaperType::Bipolar:
55 return BipolarShaper(t);
56 default:
57 break;
58 }
59 return 0;
60}
double BipolarShaper(const double t) const
Transfer function for a bipolar shaper.
Definition: Shaper.cc:67
double UnipolarShaper(const double t) const
Transfer function for a unipolar shaper.
Definition: Shaper.cc:62

Referenced by Garfield::Sensor::GetTransferFunction().

◆ TransferFuncSq()

double Garfield::Shaper::TransferFuncSq ( ) const
inline

Return the integral of the transfer function squared.

Definition at line 31 of file Shaper.hh.

31{ return m_transfer_func_sq; }

◆ UnipolarShaper()

double Garfield::Shaper::UnipolarShaper ( const double  t) const

Transfer function for a unipolar shaper.

Definition at line 62 of file Shaper.cc.

62 {
63 double f = m_prefactor * pow(t / m_tp, m_n) * exp(-t / m_tau) * Heaviside(t, 0.);
64 return m_g * f;
65}

Referenced by Shape().


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