LDMX Software
TrackerDaqMap.h
1#ifndef TRACKING_RECO_TRACKERDAQMAP_H_
2#define TRACKING_RECO_TRACKERDAQMAP_H_
3
4#include <cstdint>
5#include <map>
6#include <string>
7
8namespace tracking::reco {
9
16 public:
18 struct SensorInfo {
19 int layer_id_{-1};
20 int n_strips_{0};
21 int first_strip_{0};
22 bool reversed_{false};
23 };
24
25 TrackerDaqMap() = default;
26
43 static TrackerDaqMap fromJsonFile(const std::string& path);
44
46 bool has(uint8_t feb, uint8_t hybrid) const {
47 return sensors_.find(key(feb, hybrid)) != sensors_.end();
48 }
49
55 const SensorInfo& at(uint8_t feb, uint8_t hybrid) const;
56
58 std::size_t size() const { return sensors_.size(); }
59
63 const std::map<uint16_t, SensorInfo>& sensors() const { return sensors_; }
64
65 private:
66 static uint16_t key(uint8_t feb, uint8_t hybrid) {
67 return static_cast<uint16_t>((static_cast<uint16_t>(feb) << 8) | hybrid);
68 }
69
70 std::map<uint16_t, SensorInfo> sensors_;
71};
72
73} // namespace tracking::reco
74
75#endif // TRACKING_RECO_TRACKERDAQMAP_H_
Tracker DAQ map: the correspondence between an electronics sensor address (feb, hybrid) and the detec...
std::map< uint16_t, SensorInfo > sensors_
key = (feb << 8) | hybrid
const SensorInfo & at(uint8_t feb, uint8_t hybrid) const
Look up the sensor read by (feb, hybrid).
std::size_t size() const
Number of sensors in the map.
const std::map< uint16_t, SensorInfo > & sensors() const
All sensors, keyed by (feb << 8) | hybrid.
bool has(uint8_t feb, uint8_t hybrid) const
True if the map has an entry for this electronics sensor.
static TrackerDaqMap fromJsonFile(const std::string &path)
Load a DAQ map from a JSON file.
Everything the mapper needs to know about one physical sensor.
int n_strips_
Number of bonded strips on the sensor.
int first_strip_
Sensor strip index that pchannel 0 maps to.
int layer_id_
Acts surface id (volume*1000 + layer*100 + sensor).
bool reversed_
True if the hybrid reads the sensor descending.