LDMX Software
CompositePulse.h
1#ifndef RECON_EVENT_COMPOSITEPULSE_H_
2#define RECON_EVENT_COMPOSITEPULSE_H_
3
4#include <Rtypes.h> // For ClassDef
5
6#include <vector>
7
8#include "TF1.h"
9
10namespace ldmx {
11
20 public:
28 CompositePulse(TF1 func, const double& gain, const double& pedestal)
29 : pulse_func_{func}, gain_{gain}, pedestal_{pedestal} {}
30
31 CompositePulse() = default;
32
33 virtual ~CompositePulse() = default;
34
35 void clear() {};
36
47 void addOrMerge(const std::pair<double, double>& hit, double hit_merge_ns);
48
61 double findCrossing(double low, double high, double level,
62 double prec = 0.01);
63
65 void setGainPedestal(double gain, double pedestal) {
66 gain_ = gain;
67 pedestal_ = pedestal;
68 }
69
76 double operator()(double time) const { return at(time); }
77
87 double at(double time) const {
88 double signal = gain_ * pedestal_;
89 for (auto hit : hits_)
90 signal += hit.first * pulse_func_.Eval(time - hit.second);
91 return signal;
92 };
93
95 const std::vector<std::pair<double, double>>& hits() const { return hits_; }
96
97 private:
103 std::vector<std::pair<double, double>> hits_;
104
107
109 double gain_;
110
112 double pedestal_;
113
114 ClassDef(CompositePulse, 2);
115
116}; // CompositePulse
117
118} // namespace ldmx
119
120#endif
CompositePulse.
const std::vector< std::pair< double, double > > & hits() const
Get list of individual pulses that are entering the chip.
std::vector< std::pair< double, double > > hits_
pulses entering the chip
double operator()(double time) const
Evaluating this object as a function gives the same result as at.
double gain_
gain for current chip we are emulating
CompositePulse(TF1 func, const double &gain, const double &pedestal)
Constructore.
void setGainPedestal(double gain, double pedestal)
Configure the pulses for the current chip.
TF1 pulse_func_
reference to pulse shape function shared by all pulses
double pedestal_
pedestal for current chip we are emulating
double at(double time) const
Measure the voltage at the input time.
void addOrMerge(const std::pair< double, double > &hit, double hit_merge_ns)
Put another hit into this composite pulse.
double findCrossing(double low, double high, double level, double prec=0.01)
Find the time at which we cross the input level.