1#include "Tools/PulseShape.h"
3#include "Framework/Exception/Exception.h"
11FourPoleShape::FourPoleShape(
double tp,
double tp2) : tp_(tp), tp2_(tp2) {
12 if (tp2_ <= 0.0 || tp_ <= tp2_) {
13 EXCEPTION_RAISE(
"InvalidArgument",
"FourPoleShape: requires tp > tp2 > 0");
16 a_ = (tp_ * tp_) / std::pow(tp_ - tp2_, 3.0);
17 b_ = (tp_ - tp2_) / (tp_ * tp2_);
20 const double t_peak = 3.0 * std::pow(tp_ * std::pow(tp2_, 3.0), 0.25);
23 peak_amp_ = a_ * (std::exp(-t_peak / tp_) -
24 std::exp(-t_peak / tp2_) *
25 (1.0 + t_peak * b_ + 0.5 * t_peak * t_peak * b_ * b_));
28double FourPoleShape::eval(
double t)
const {
29 if (t <= 0.0)
return 0.0;
31 a_ * (std::exp(-t / tp_) -
32 std::exp(-t / tp2_) * (1.0 + t * b_ + 0.5 * t * t * b_ * b_));
40std::unique_ptr<PulseShape> PulseShape::make(
const std::string& name,
double tp,
43 return std::make_unique<CRRCShape>(tp);
44 }
else if (name ==
"FourPole") {
45 return std::make_unique<FourPoleShape>(tp, tp2);
47 EXCEPTION_RAISE(
"InvalidArgument",
"PulseShape::make: unknown shape '" +
48 name +
"'. Use 'CRRC' or 'FourPole'.");
55HgcrocShape::HgcrocShape(
double rate_up,
double time_up,
double rate_dn,
56 double time_dn,
double time_peak)
61 time_peak_(time_peak) {
62 norm_ = (1.0 + std::exp(rate_up_ * (time_peak_ - time_up_))) *
63 (1.0 + std::exp(rate_dn_ * (time_peak_ - time_dn_)));
67 return norm_ / ((1.0 + std::exp(rate_up_ * (t - time_up_ + time_peak_))) *
68 (1.0 + std::exp(rate_dn_ * (t - time_dn_ + time_peak_))));
double eval(double t) const override
Evaluate the peak-normalised pulse amplitude at time t [ns] after charge arrival.
double norm_
makes eval(0) = 1