LDMX Software
CompositePulse.h
1#ifndef RECON_EVENT_COMPOSITEPULSE_H_
2#define RECON_EVENT_COMPOSITEPULSE_H_
3
4#include <vector>
5
6#include "TF1.h"
7#include "TObject.h" //for ClassDef
8
9namespace ldmx {
10
19 public:
27 CompositePulse(TF1 func, const double& gain, const double& pedestal)
28 : pulse_func_{func}, gain_{gain}, pedestal_{pedestal} {}
29
30 CompositePulse() = default;
31
32 virtual ~CompositePulse() = default;
33
34 void clear() {};
35
46 void addOrMerge(const std::pair<double, double>& hit, double hit_merge_ns);
47
60 double findCrossing(double low, double high, double level,
61 double prec = 0.01);
62
64 void setGainPedestal(double gain, double pedestal) {
65 gain_ = gain;
66 pedestal_ = pedestal;
67 }
68
75 double operator()(double time) const { return at(time); }
76
86 double at(double time) const {
87 double signal = gain_ * pedestal_;
88 for (auto hit : hits_)
89 signal += hit.first * pulse_func_.Eval(time - hit.second);
90 return signal;
91 };
92
94 const std::vector<std::pair<double, double>>& hits() const { return hits_; }
95
96 private:
102 std::vector<std::pair<double, double>> hits_;
103
106
108 double gain_;
109
111 double pedestal_;
112
113 ClassDef(CompositePulse, 2);
114
115}; // CompositePulse
116
117} // namespace ldmx
118
119#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.