LDMX Software
SiStripWaveform.h
1#ifndef TRACKING_EVENT_SISTRIPWAVEFORM_H_
2#define TRACKING_EVENT_SISTRIPWAVEFORM_H_
3
4#include <algorithm>
5#include <iostream>
6#include <vector>
7
8#include "TObject.h"
9
10namespace ldmx {
11
25 public:
26 SiStripWaveform() = default;
27
28 SiStripWaveform(std::vector<short> samples, int16_t pchannel,
29 uint8_t hybrid_id, uint8_t feb_id, uint8_t n_triggers);
30
31 virtual ~SiStripWaveform() {}
32
33 void clear();
34
35 const std::vector<short>& getSamples() const { return samples_; }
36 int16_t getPchannel() const { return pchannel_; }
37 uint8_t getHybridId() const { return hybrid_id_; }
38 uint8_t getFebId() const { return feb_id_; }
39 uint8_t getNTriggers() const { return n_triggers_; }
40
42 short getSample(uint8_t t, uint8_t s) const { return samples_[t * 3 + s]; }
43
47 short peakAmplitude() const {
48 if (samples_.empty()) return 0;
49 return *std::max_element(samples_.begin(), samples_.end());
50 }
51
53 uint8_t peakTrigger() const {
54 if (samples_.empty()) return 0;
55 auto it = std::max_element(samples_.begin(), samples_.end());
56 return static_cast<uint8_t>(std::distance(samples_.begin(), it) / 3);
57 }
58
59 friend std::ostream& operator<<(std::ostream& o, const SiStripWaveform& w);
60
61 protected:
62 std::vector<short>
64 int16_t pchannel_{0};
65 uint8_t hybrid_id_{0};
66 uint8_t feb_id_{0};
67 uint8_t n_triggers_{0};
68
69 ClassDef(SiStripWaveform, 3);
70};
71
72} // namespace ldmx
73
74#endif // TRACKING_EVENT_SISTRIPWAVEFORM_H_
Full multi-trigger waveform for one silicon strip channel.
std::vector< short > samples_
n_triggers * 3 pedestal-subtracted ADC samples
short getSample(uint8_t t, uint8_t s) const
Sample at trigger index t (0-based), APV sample s (0-2).
uint8_t peakTrigger() const
Trigger index (0-based) of the sample with the maximum ADC value.
int16_t pchannel_
physical strip number within hybrid [0, 639]
short peakAmplitude() const
Peak amplitude: the maximum (pedestal-subtracted) ADC sample.
uint8_t n_triggers_
number of APV triggers assembled