CbmRoot
Loading...
Searching...
No Matches
mvd/ReadoutConfig.h
Go to the documentation of this file.
1/* Copyright (C) 2025 IKF Frankfurt University, Frankfurt am Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Ajit Kumar [committer] */
4
5#ifndef ALGO_DETECTORS_MVD_READOUTCONFIG_H
6#define ALGO_DETECTORS_MVD_READOUTCONFIG_H
7
8#include "CbmYaml.h"
9
10#include <cstddef>
11#include <cstdint>
12#include <map>
13#include <vector>
14
15namespace cbm::algo::mvd
16{
21 struct ReadoutSetup {
22 struct Crob {
23 std::vector<uint32_t> sensorAddress;
24
26 yaml::Property(&Crob::sensorAddress, "sensorAddress", "Sensor address per eLink"));
27 };
28 struct Component {
29 std::vector<Crob> crobs;
30
32 yaml::Property(&Component::crobs, "crobs","eLink to address mapping per CROB", {}, YAML::Flow));
33 };
34
35 int32_t timeOffset;
36 uint64_t frameLengthNs;
37 std::map<uint16_t, Component> components;
38
39 CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::timeOffset, "timeOffset", "Time offset in ns of the MVD data relative to the reference/trigger"),
40 yaml::Property(&ReadoutSetup::frameLengthNs, "frameLengthNs", "Length of the Mimosis frame in ns"),
41 yaml::Property(&ReadoutSetup::components, "components", "Components", {}, YAML::Flow));
42 };
43
45
46 public:
49
51 ReadoutConfig(const ReadoutSetup& pars);
52
56 int32_t GetSystemTimeOffset() const { return fTimeOffset; }
57
61 uint64_t GetFrameLength() { return fulFrameLengthNs; };
62
66 std::vector<uint16_t> GetEquipmentIds();
67
72 size_t GetNumElinks(uint16_t equipmentId);
73
79 std::vector<uint32_t> Map(uint16_t equipId, uint16_t elink);
80
86 std::vector<uint8_t> MaskMap(uint16_t equipId, uint16_t elink);
87
88 private:
90 void Init(const ReadoutSetup&);
91
93 void InitHardcoded();
94
96 static constexpr uint16_t numComp = 2;
97 static constexpr uint16_t numCrobPerComp = 1;
98 static constexpr uint16_t numElinksPerCrob = 1;
99
100
102 // --- BMon system time offset
103 int32_t fTimeOffset = 0;
104 // --- MVD frame length in ns
105 uint64_t fulFrameLengthNs = 5000;
106
107 // --- MVD readout map
108 // --- Map index: (equipment, crob, elink), map value: (MVD address)
109 std::map<uint16_t, std::vector<std::vector<uint32_t>>> fReadoutMap = {};
110
111 // --- MVD channel mask map
112 // --- Map index: (equipment, elink), map value: (vector of mask flags for channels per asic)
113 std::map<uint16_t, std::map<size_t, std::vector<uint8_t>>> fMaskMap = {};
114 };
115
116} // namespace cbm::algo::mvd
117
118#endif // ALGO_DETECTORS_MVD_READOUTCONFIG_H
void InitHardcoded()
Initialisation of readout map from hardcoded valus, backup if YAML missing.
int32_t GetSystemTimeOffset() const
System time offset for BMon.
ReadoutConfig()
Default Constructor if no valid YAMl file available.
static constexpr uint16_t numElinksPerCrob
Number of elinks in each CROB ?
uint64_t GetFrameLength()
Frame length in ns.
std::vector< uint16_t > GetEquipmentIds()
Equipment in the configuration.
std::vector< uint8_t > MaskMap(uint16_t equipId, uint16_t elink)
API: Mapping from component and elink to channel mask flags.
std::vector< uint32_t > Map(uint16_t equipId, uint16_t elink)
API: Mapping from component and elink to addresses per channel.
void Init(const ReadoutSetup &)
Initialisation of readout map with hardcoded values.
size_t GetNumElinks(uint16_t equipmentId)
Number of elinks of a component.
static constexpr uint16_t numCrobPerComp
Number of CROBs possible per DPB.
static constexpr uint16_t numComp
Constants used for hardcoded defaults.
std::map< uint16_t, std::vector< std::vector< uint32_t > > > fReadoutMap
std::map< uint16_t, std::map< size_t, std::vector< uint8_t > > > fMaskMap
CBM_YAML_PROPERTIES(yaml::Property(&Component::crobs, "crobs","eLink to address mapping per CROB", {}, YAML::Flow))
CBM_YAML_PROPERTIES(yaml::Property(&Crob::sensorAddress, "sensorAddress", "Sensor address per eLink"))
std::vector< uint32_t > sensorAddress
Readout setup / Hardware cabling for MVD Used to create the hardware mapping for the MVD unpacker.
CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::timeOffset, "timeOffset", "Time offset in ns of the MVD data relative to the reference/trigger"), yaml::Property(&ReadoutSetup::frameLengthNs, "frameLengthNs", "Length of the Mimosis frame in ns"), yaml::Property(&ReadoutSetup::components, "components", "Components", {}, YAML::Flow))
std::map< uint16_t, Component > components