LDMX Software
ldmx::SiStripWaveform Class Reference

Full multi-trigger waveform for one silicon strip channel. More...

#include <SiStripWaveform.h>

Public Member Functions

 SiStripWaveform (std::vector< short > samples, int16_t pchannel, uint8_t hybrid_id, uint8_t feb_id, uint8_t n_triggers)
 
void clear ()
 
const std::vector< short > & getSamples () const
 
int16_t getPchannel () const
 
uint8_t getHybridId () const
 
uint8_t getFebId () const
 
uint8_t getNTriggers () const
 
short getSample (uint8_t t, uint8_t s) const
 Sample at trigger index t (0-based), APV sample s (0-2).
 
short peakAmplitude () const
 Peak amplitude: the maximum (pedestal-subtracted) ADC sample.
 
uint8_t peakTrigger () const
 Trigger index (0-based) of the sample with the maximum ADC value.
 

Protected Member Functions

 ClassDef (SiStripWaveform, 3)
 

Protected Attributes

std::vector< short > samples_
 n_triggers * 3 pedestal-subtracted ADC samples
 
int16_t pchannel_ {0}
 physical strip number within hybrid [0, 639]
 
uint8_t hybrid_id_ {0}
 
uint8_t feb_id_ {0}
 
uint8_t n_triggers_ {0}
 number of APV triggers assembled
 

Friends

std::ostream & operator<< (std::ostream &o, const SiStripWaveform &w)
 

Detailed Description

Full multi-trigger waveform for one silicon strip channel.

Assembled by SiStripWaveformBuilder from the per-trigger pedestal-subtracted RawSiStripHit objects for a single (feb, hybrid, pchannel). Samples are stored in trigger order: [s0_t0, s1_t0, s2_t0, s0_t1, s1_t1, s2_t1, ...], so the total size is n_triggers * 3.

This is the natural input for waveform fitting (APV25 CR-RC pulse shape → hit time with ~2.5 ns resolution) and any per-channel waveform corrections before clustering.

Definition at line 24 of file SiStripWaveform.h.

Constructor & Destructor Documentation

◆ SiStripWaveform()

ldmx::SiStripWaveform::SiStripWaveform ( std::vector< short > samples,
int16_t pchannel,
uint8_t hybrid_id,
uint8_t feb_id,
uint8_t n_triggers )

Definition at line 9 of file SiStripWaveform.cxx.

12 : samples_(std::move(samples)),
13 pchannel_(pchannel),
14 hybrid_id_(hybrid_id),
15 feb_id_(feb_id),
16 n_triggers_(n_triggers) {}
std::vector< short > samples_
n_triggers * 3 pedestal-subtracted ADC samples
int16_t pchannel_
physical strip number within hybrid [0, 639]
uint8_t n_triggers_
number of APV triggers assembled

◆ ~SiStripWaveform()

virtual ldmx::SiStripWaveform::~SiStripWaveform ( )
inlinevirtual

Definition at line 31 of file SiStripWaveform.h.

31{}

Member Function Documentation

◆ clear()

void ldmx::SiStripWaveform::clear ( )

Definition at line 18 of file SiStripWaveform.cxx.

18 {
19 samples_.clear();
20 pchannel_ = 0;
21 hybrid_id_ = 0;
22 feb_id_ = 0;
23 n_triggers_ = 0;
24}

◆ getFebId()

uint8_t ldmx::SiStripWaveform::getFebId ( ) const
inline

Definition at line 38 of file SiStripWaveform.h.

38{ return feb_id_; }

◆ getHybridId()

uint8_t ldmx::SiStripWaveform::getHybridId ( ) const
inline

Definition at line 37 of file SiStripWaveform.h.

37{ return hybrid_id_; }

◆ getNTriggers()

uint8_t ldmx::SiStripWaveform::getNTriggers ( ) const
inline

Definition at line 39 of file SiStripWaveform.h.

39{ return n_triggers_; }

◆ getPchannel()

int16_t ldmx::SiStripWaveform::getPchannel ( ) const
inline

Definition at line 36 of file SiStripWaveform.h.

36{ return pchannel_; }

◆ getSample()

short ldmx::SiStripWaveform::getSample ( uint8_t t,
uint8_t s ) const
inline

Sample at trigger index t (0-based), APV sample s (0-2).

Definition at line 42 of file SiStripWaveform.h.

42{ return samples_[t * 3 + s]; }

References samples_.

◆ getSamples()

const std::vector< short > & ldmx::SiStripWaveform::getSamples ( ) const
inline

Definition at line 35 of file SiStripWaveform.h.

35{ return samples_; }

◆ peakAmplitude()

short ldmx::SiStripWaveform::peakAmplitude ( ) const
inline

Peak amplitude: the maximum (pedestal-subtracted) ADC sample.

Convert to a significance downstream by dividing by the per-channel noise from the TrackerPedestals conditions object.

Definition at line 47 of file SiStripWaveform.h.

47 {
48 if (samples_.empty()) return 0;
49 return *std::max_element(samples_.begin(), samples_.end());
50 }

References samples_.

◆ peakTrigger()

uint8_t ldmx::SiStripWaveform::peakTrigger ( ) const
inline

Trigger index (0-based) of the sample with the maximum ADC value.

Definition at line 53 of file SiStripWaveform.h.

53 {
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 }

References samples_.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
const SiStripWaveform & w )
friend

Definition at line 26 of file SiStripWaveform.cxx.

26 {
27 // Header.
28 output << "[ SiStripWaveform ] FEB=" << static_cast<int>(w.feb_id_)
29 << " Hybrid=" << static_cast<int>(w.hybrid_id_)
30 << " PCh=" << w.pchannel_
31 << " NTrig=" << static_cast<int>(w.n_triggers_)
32 << " PeakAmp=" << w.peakAmplitude() << "\n";
33
34 if (w.samples_.empty()) return output;
35
36 // Determine scale — always include zero so the baseline is visible.
37 short s_min = *std::min_element(w.samples_.begin(), w.samples_.end());
38 short s_max = *std::max_element(w.samples_.begin(), w.samples_.end());
39 s_min = std::min(s_min, static_cast<short>(0));
40 s_max = std::max(s_max, static_cast<short>(0));
41
42 const int bar_width = 50;
43 const float range = static_cast<float>(s_max - s_min);
44
45 output << " Idx ADC |\n";
46
47 for (int i = 0; i < static_cast<int>(w.samples_.size()); ++i) {
48 short val = w.samples_[i];
49 int t = i / 3, s = i % 3;
50
51 const std::string label = "T" + std::to_string(t) + "." + std::to_string(s);
52
53 // Column positions for zero and this sample.
54 int zero_pos =
55 (range > 0) ? static_cast<int>((0.f - s_min) / range * (bar_width - 1))
56 : bar_width / 2;
57 int val_pos = (range > 0)
58 ? static_cast<int>((static_cast<float>(val) - s_min) /
59 range * (bar_width - 1))
60 : zero_pos;
61 val_pos = std::max(0, std::min(bar_width - 1, val_pos));
62
63 std::string bar(bar_width, ' ');
64 // Fill between zero and sample.
65 int lo = std::min(zero_pos, val_pos);
66 int hi = std::max(zero_pos, val_pos);
67 for (int k = lo; k <= hi; ++k) bar[k] = (val >= 0) ? '+' : '-';
68 // Tip marker.
69 bar[val_pos] = (val > 0) ? '>' : (val < 0) ? '<' : '|';
70 // Zero marker (only when sample is non-zero).
71 if (val != 0 && bar[zero_pos] == ' ') bar[zero_pos] = '|';
72
73 output << " " << std::left << std::setw(4) << label << " " << std::right
74 << std::setw(5) << static_cast<int>(val) << " |" << bar << "|\n";
75 }
76 return output;
77}

Member Data Documentation

◆ feb_id_

uint8_t ldmx::SiStripWaveform::feb_id_ {0}
protected

Definition at line 66 of file SiStripWaveform.h.

66{0};

◆ hybrid_id_

uint8_t ldmx::SiStripWaveform::hybrid_id_ {0}
protected

Definition at line 65 of file SiStripWaveform.h.

65{0};

◆ n_triggers_

uint8_t ldmx::SiStripWaveform::n_triggers_ {0}
protected

number of APV triggers assembled

Definition at line 67 of file SiStripWaveform.h.

67{0};

◆ pchannel_

int16_t ldmx::SiStripWaveform::pchannel_ {0}
protected

physical strip number within hybrid [0, 639]

Definition at line 64 of file SiStripWaveform.h.

64{0};

◆ samples_

std::vector<short> ldmx::SiStripWaveform::samples_
protected

n_triggers * 3 pedestal-subtracted ADC samples

Definition at line 63 of file SiStripWaveform.h.

Referenced by getSample(), peakAmplitude(), and peakTrigger().


The documentation for this class was generated from the following files: