LDMX Software
tracking::reco::channelmap Namespace Reference

Central definition of the tracker silicon-strip channel mapping. More...

Functions

constexpr int16_t pchannel (uint8_t apv_id, uint8_t channel)
 Convert an (APV id, APV channel) pair into the physical strip number (pchannel) within a hybrid, in [0, kChannelsPerHybrid).
 
constexpr void apvChannelFromPchannel (int16_t pchannel, uint8_t &apv_id, uint8_t &channel)
 Inverse of pchannel(): recover the (APV id, APV channel) pair from a physical strip number.
 
constexpr int stripId (int16_t pchannel, int n_strips, int first_strip, bool reversed)
 Map a physical strip number (pchannel) onto a sensor strip index using a DAQ-map transform: an optional readout reversal plus a per-sensor offset.
 
std::string channelKey (uint8_t feb, uint8_t hybrid, uint8_t apv, uint8_t channel)
 Build the per-channel pedestal-map key "feb:hybrid:apv:channel".
 
constexpr uint32_t channelId (uint8_t feb, uint8_t hybrid, uint8_t apv, uint8_t channel)
 Pack the full electronics address (feb, hybrid, apv, channel) into a single 32-bit id, used as the row key of the pedestal conditions table.
 
bool parseChannelKey (const std::string &key, uint8_t &feb, uint8_t &hybrid, uint8_t &apv, uint8_t &channel)
 Parse a "feb:hybrid:apv:channel" key (as produced by channelKey()) back into its electronics fields.
 
constexpr uint32_t groupKey (uint8_t feb, uint8_t hybrid, int16_t pchannel)
 Pack (feb, hybrid, pchannel) into a single 32-bit waveform-grouping key.
 
constexpr int16_t pchannelFromGroupKey (uint32_t key)
 Extract the pchannel back out of a key produced by groupKey().
 

Variables

constexpr int K_CHANNELS_PER_APV = 128
 Number of readout channels per APV25 chip.
 
constexpr int K_APVS_PER_HYBRID = 5
 Number of APV25 chips per hybrid.
 
constexpr int K_CHANNELS_PER_HYBRID
 Number of physical strips per hybrid (kApvsPerHybrid * kChannelsPerApv).
 
constexpr int K_SAMPLES_PER_APV_TRIGGER = 3
 Number of ADC samples the APV25 reads out per channel per trigger.
 

Detailed Description

Central definition of the tracker silicon-strip channel mapping.

Every electronics-id <-> physical-strip conversion (and the keys used to group/lookup channels) lives here so the layout only has to change in one place. All functions are header-only constexpr/inline helpers; there is no per-instance state.

Function Documentation

◆ apvChannelFromPchannel()

void tracking::reco::channelmap::apvChannelFromPchannel ( int16_t pchannel,
uint8_t & apv_id,
uint8_t & channel )
inlineconstexpr

Inverse of pchannel(): recover the (APV id, APV channel) pair from a physical strip number.

Needed because SiStripWaveform stores only the pchannel, but the pedestal table is keyed by the full electronics address.

Round-trips exactly with pchannel() for all valid (apv, channel): apvChannelFromPchannel(pchannel(a, c), a', c') gives a' == a, c' == c.

Definition at line 52 of file SiStripChannelMap.h.

53 {
54 const int x = (K_CHANNELS_PER_HYBRID - 1) - pchannel;
55 apv_id = static_cast<uint8_t>(x / K_CHANNELS_PER_APV);
56 channel =
57 static_cast<uint8_t>((K_CHANNELS_PER_APV - 1) - (x % K_CHANNELS_PER_APV));
58}
constexpr int K_CHANNELS_PER_HYBRID
Number of physical strips per hybrid (kApvsPerHybrid * kChannelsPerApv).
constexpr int K_CHANNELS_PER_APV
Number of readout channels per APV25 chip.

References K_CHANNELS_PER_APV, K_CHANNELS_PER_HYBRID, and pchannel().

Referenced by tracking::reco::SiStripWaveformFitProcessor::produce().

◆ channelId()

uint32_t tracking::reco::channelmap::channelId ( uint8_t feb,
uint8_t hybrid,
uint8_t apv,
uint8_t channel )
inlineconstexpr

Pack the full electronics address (feb, hybrid, apv, channel) into a single 32-bit id, used as the row key of the pedestal conditions table.

Definition at line 85 of file SiStripChannelMap.h.

86 {
87 return (static_cast<uint32_t>(feb) << 24) |
88 (static_cast<uint32_t>(hybrid) << 16) |
89 (static_cast<uint32_t>(apv) << 8) | static_cast<uint32_t>(channel);
90}

Referenced by tracking::reco::TrackerPedestals::add(), and tracking::reco::TrackerPedestals::find().

◆ channelKey()

std::string tracking::reco::channelmap::channelKey ( uint8_t feb,
uint8_t hybrid,
uint8_t apv,
uint8_t channel )
inline

Build the per-channel pedestal-map key "feb:hybrid:apv:channel".

Definition at line 77 of file SiStripChannelMap.h.

78 {
79 return std::to_string(feb) + ":" + std::to_string(hybrid) + ":" +
80 std::to_string(apv) + ":" + std::to_string(channel);
81}

Referenced by tracking::reco::PedestalCalculator::analyze(), and tracking::reco::PedestalSubtractor::produce().

◆ groupKey()

uint32_t tracking::reco::channelmap::groupKey ( uint8_t feb,
uint8_t hybrid,
int16_t pchannel )
inlineconstexpr

Pack (feb, hybrid, pchannel) into a single 32-bit waveform-grouping key.

Definition at line 107 of file SiStripChannelMap.h.

108 {
109 return (static_cast<uint32_t>(feb) << 24) |
110 (static_cast<uint32_t>(hybrid) << 16) |
111 static_cast<uint32_t>(static_cast<uint16_t>(pchannel));
112}

References pchannel().

Referenced by tracking::reco::SiStripWaveformBuilder::produce().

◆ parseChannelKey()

bool tracking::reco::channelmap::parseChannelKey ( const std::string & key,
uint8_t & feb,
uint8_t & hybrid,
uint8_t & apv,
uint8_t & channel )
inline

Parse a "feb:hybrid:apv:channel" key (as produced by channelKey()) back into its electronics fields.

Returns false if the string is malformed.

Definition at line 94 of file SiStripChannelMap.h.

95 {
96 unsigned f, h, a, c;
97 if (std::sscanf(key.c_str(), "%u:%u:%u:%u", &f, &h, &a, &c) != 4)
98 return false;
99 feb = static_cast<uint8_t>(f);
100 hybrid = static_cast<uint8_t>(h);
101 apv = static_cast<uint8_t>(a);
102 channel = static_cast<uint8_t>(c);
103 return true;
104}

◆ pchannel()

int16_t tracking::reco::channelmap::pchannel ( uint8_t apv_id,
uint8_t channel )
inlineconstexpr

Convert an (APV id, APV channel) pair into the physical strip number (pchannel) within a hybrid, in [0, kChannelsPerHybrid).

The APV readout order is reversed relative to the physical strip order, and the APVs are laid out back-to-front along the hybrid, hence the double reversal.

Definition at line 38 of file SiStripChannelMap.h.

38 {
39 return static_cast<int16_t>(
41 (apv_id * K_CHANNELS_PER_APV + (K_CHANNELS_PER_APV - 1) - channel));
42}

References K_CHANNELS_PER_APV, and K_CHANNELS_PER_HYBRID.

Referenced by apvChannelFromPchannel(), groupKey(), tracking::reco::SiStripWaveformBuilder::produce(), and stripId().

◆ pchannelFromGroupKey()

int16_t tracking::reco::channelmap::pchannelFromGroupKey ( uint32_t key)
inlineconstexpr

Extract the pchannel back out of a key produced by groupKey().

Definition at line 115 of file SiStripChannelMap.h.

115 {
116 return static_cast<int16_t>(key & 0xFFFF);
117}

Referenced by tracking::reco::SiStripWaveformBuilder::produce().

◆ stripId()

int tracking::reco::channelmap::stripId ( int16_t pchannel,
int n_strips,
int first_strip,
bool reversed )
inlineconstexpr

Map a physical strip number (pchannel) onto a sensor strip index using a DAQ-map transform: an optional readout reversal plus a per-sensor offset.

Parameters
pchannelphysical strip within the hybrid, [0, kChannelsPerHybrid).
n_stripsnumber of bonded strips on the sensor.
first_stripsensor strip index that pchannel 0 (or the reversed end) maps to.
reversedtrue if the hybrid reads the sensor in descending order.

Definition at line 70 of file SiStripChannelMap.h.

71 {
72 return reversed ? first_strip + n_strips - 1 - pchannel
73 : first_strip + pchannel;
74}
constexpr int16_t pchannel(uint8_t apv_id, uint8_t channel)
Convert an (APV id, APV channel) pair into the physical strip number (pchannel) within a hybrid,...

References pchannel().

Referenced by tracking::reco::SiStripWaveformFitProcessor::produce().

Variable Documentation

◆ K_APVS_PER_HYBRID

int tracking::reco::channelmap::K_APVS_PER_HYBRID = 5
inlineconstexpr

Number of APV25 chips per hybrid.

Definition at line 23 of file SiStripChannelMap.h.

◆ K_CHANNELS_PER_APV

int tracking::reco::channelmap::K_CHANNELS_PER_APV = 128
inlineconstexpr

Number of readout channels per APV25 chip.

Definition at line 21 of file SiStripChannelMap.h.

Referenced by apvChannelFromPchannel(), and pchannel().

◆ K_CHANNELS_PER_HYBRID

int tracking::reco::channelmap::K_CHANNELS_PER_HYBRID
inlineconstexpr
Initial value:
=
constexpr int K_APVS_PER_HYBRID
Number of APV25 chips per hybrid.

Number of physical strips per hybrid (kApvsPerHybrid * kChannelsPerApv).

Definition at line 25 of file SiStripChannelMap.h.

Referenced by apvChannelFromPchannel(), and pchannel().

◆ K_SAMPLES_PER_APV_TRIGGER

int tracking::reco::channelmap::K_SAMPLES_PER_APV_TRIGGER = 3
inlineconstexpr