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).
 
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

◆ 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 53 of file SiStripChannelMap.h.

54 {
55 return (static_cast<uint32_t>(feb) << 24) |
56 (static_cast<uint32_t>(hybrid) << 16) |
57 (static_cast<uint32_t>(apv) << 8) | static_cast<uint32_t>(channel);
58}

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 45 of file SiStripChannelMap.h.

46 {
47 return std::to_string(feb) + ":" + std::to_string(hybrid) + ":" +
48 std::to_string(apv) + ":" + std::to_string(channel);
49}

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 75 of file SiStripChannelMap.h.

76 {
77 return (static_cast<uint32_t>(feb) << 24) |
78 (static_cast<uint32_t>(hybrid) << 16) |
79 static_cast<uint32_t>(static_cast<uint16_t>(pchannel));
80}

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 62 of file SiStripChannelMap.h.

63 {
64 unsigned f, h, a, c;
65 if (std::sscanf(key.c_str(), "%u:%u:%u:%u", &f, &h, &a, &c) != 4)
66 return false;
67 feb = static_cast<uint8_t>(f);
68 hybrid = static_cast<uint8_t>(h);
69 apv = static_cast<uint8_t>(a);
70 channel = static_cast<uint8_t>(c);
71 return true;
72}

◆ 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}
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, and K_CHANNELS_PER_HYBRID.

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

◆ 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 83 of file SiStripChannelMap.h.

83 {
84 return static_cast<int16_t>(key & 0xFFFF);
85}

Referenced by tracking::reco::SiStripWaveformBuilder::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 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 pchannel().

◆ K_SAMPLES_PER_APV_TRIGGER

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