LDMX Software
TrackerPedestals.h
1#ifndef TRACKING_RECO_TRACKERPEDESTALS_H_
2#define TRACKING_RECO_TRACKERPEDESTALS_H_
3
4#include <array>
5#include <cstdint>
6#include <numeric>
7#include <string>
8#include <unordered_map>
9
11#include "Tracking/Reco/SiStripChannelMap.h"
12
13namespace tracking::reco {
14
29 public:
31 static const std::string CONDITIONS_NAME;
32
34 struct Channel {
35 std::array<float, channelmap::K_SAMPLES_PER_APV_TRIGGER> mean_{};
36 std::array<float, channelmap::K_SAMPLES_PER_APV_TRIGGER> noise_{};
37 };
38
40
42 void add(uint8_t feb, uint8_t hybrid, uint8_t apv, uint8_t channel,
43 const Channel& ped) {
44 channels_[channelmap::channelId(feb, hybrid, apv, channel)] = ped;
45 }
46
48 const Channel* find(uint8_t feb, uint8_t hybrid, uint8_t apv,
49 uint8_t channel) const {
50 auto it = channels_.find(channelmap::channelId(feb, hybrid, apv, channel));
51 return it == channels_.end() ? nullptr : &it->second;
52 }
53
56 float noise(uint8_t feb, uint8_t hybrid, uint8_t apv, uint8_t channel) const {
57 const Channel* c = find(feb, hybrid, apv, channel);
58 if (!c) return 0.f;
59 const float sum =
60 std::accumulate(c->noise_.begin(), c->noise_.end(), 0.f);
61 return sum / static_cast<float>(c->noise_.size());
62 }
63
65 std::size_t size() const { return channels_.size(); }
66
67 private:
68 std::unordered_map<uint32_t, Channel> channels_;
69};
70
71} // namespace tracking::reco
72
73#endif // TRACKING_RECO_TRACKERPEDESTALS_H_
Base class for conditions information like pedestals, gains, electronics maps, etc.
Base class for all conditions objects, very simple.
ConditionsObject(const std::string &name)
Class constructor.
Per-channel tracker pedestal conditions: the per-sample pedestal mean and RMS noise for every silicon...
void add(uint8_t feb, uint8_t hybrid, uint8_t apv, uint8_t channel, const Channel &ped)
Insert the pedestal for one electronics channel.
std::size_t size() const
Number of channels in the table.
const Channel * find(uint8_t feb, uint8_t hybrid, uint8_t apv, uint8_t channel) const
Look up a channel; returns nullptr if the channel is not in the table.
static const std::string CONDITIONS_NAME
Name of the conditions object (must match the python registration).
float noise(uint8_t feb, uint8_t hybrid, uint8_t apv, uint8_t channel) const
Scalar per-channel noise (mean of the three per-sample noises); 0 if the channel is absent.
All classes in the ldmx-sw project use this namespace.
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,...
Per-channel pedestal mean and RMS noise for the three APV25 samples.