1#include "Tracking/Digitization/PulseShape.h"
3#include "Framework/Exception/Exception.h"
5namespace tracking::digitization {
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'.");