CbmRoot
Loading...
Searching...
No Matches
sts/ReadoutConfig.h
Go to the documentation of this file.
1/* Copyright (C) 2022-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer], Felix Weiglhofer */
4#ifndef CBM_ALGO_DETECTOR_STS_READOUT_CONFIG_H
5#define CBM_ALGO_DETECTOR_STS_READOUT_CONFIG_H
6
7#include "CbmYaml.h"
9
10#include <map>
11#include <string>
12#include <vector>
13
14namespace cbm::algo::sts
15{
16
17 struct ChannelMaskSet;
18
19 enum class FEBType
20 {
23 };
24
29 struct ReadoutSetup {
30
31 struct Module {
34
36 yaml::Property(&Module::address, "address", "HW address of module", YAML::Hex),
37 yaml::Property(&Module::type, "type",
38 "Type 0 had the connector at the right side, type 1 at the left side. For type 0, the mapping "
39 "of FEB to module side as above applies, for type 1, it has to be inverted."));
40 };
41
42 struct Component {
44 std::vector<std::vector<i16>> feb2module;
45 std::vector<std::vector<i16>> feb2moduleSide;
46 std::vector<std::vector<bool>> febIsPulser;
47
48 FEBType GetFEBType() const;
49 size_t FEBsPerCrob() const { return feb2module.at(0).size(); }
50
52 yaml::Property(&Component::equipmentId, "equipmentId",
53 "Equipment ID of component. Written to the data stream (MicrosliceDescriptor).", YAML::Hex),
54 yaml::Property(&Component::feb2module, "feb2module",
55 "Mapping of FEB within CROB to module index (-1 = inactive)"),
56 yaml::Property(&Component::feb2moduleSide, "feb2moduleSide",
57 "Mapping of FEB within CROB to module side (0 = left, 1 = right)"),
58 yaml::Property(&Component::febIsPulser, "febIsPulser", "Flag if FEB is pulser (true) or not (false)"));
59 };
60
61 struct Elink {
65
67 yaml::Property(&Elink::toFeb, "toFeb", "Mapping of elink to FEB within CROB (-1 = inactive)"),
68 yaml::Property(&Elink::toAsicFebA, "toAsicFebA", "Mapping of eLink to ASIC for FEB Type A", YAML::Hex),
69 yaml::Property(&Elink::toAsicFebB, "toAsicFebB", "Mapping of eLink to ASIC for FEB Type B", YAML::Hex));
70 };
71
73 std::vector<Module> modules;
74 std::vector<Component> components;
75 std::vector<Elink> elinksFeb8_1;
76 std::vector<Elink> elinksFeb8_5;
77
78 const std::vector<Elink>& GetElinks(FEBType type) const;
79
80 CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::numAsicsPerFeb, "numAsicsPerFeb", "Number of ASICs per FEB"),
81 yaml::Property(&ReadoutSetup::modules, "modules", "Modules", {}, YAML::Flow),
82 yaml::Property(&ReadoutSetup::components, "components", "Components", {}, YAML::Flow),
83 yaml::Property(&ReadoutSetup::elinksFeb8_1, "elinksFeb8_1",
84 "Elinks for FEB8_1 (1:1 elink:ASIC, 5 FEB / ROB)", {}, YAML::Flow),
85 yaml::Property(&ReadoutSetup::elinksFeb8_5, "elinksFeb8_5",
86 "Elinks for FEB8_5 (5:1 elink:ASIC, 1 FEB / ROB)", {}, YAML::Flow));
87 };
88
100
101 public:
107
109 ReadoutConfig() = default;
110
113
117 std::vector<u16> GetEquipmentIds();
118
123 size_t GetNumElinks(u16 equipmentId);
124
128 size_t GetNumElinks();
129
135 Entry Map(u16 equipId, u16 elink);
136
142 std::vector<bool> MaskMap(uint16_t equipId, uint16_t elink);
143
149 uint32_t AdcCutMap(uint16_t equipId, uint16_t elink);
150
151
153 std::string PrintReadoutMap();
154
155 private:
156 // --- STS readout map
157 // --- Map index: (equipment, elink)
158 std::map<u16, std::vector<Entry>> fReadoutConfig = {};
159
160 // --- STS adc cut map
161 // --- Map index: (equipment, elink), map value: adc cut
162 std::map<uint16_t, std::map<size_t, uint32_t>> fAdcCutMap = {};
163
164 // --- STS channel mask map
165 // --- Map index: (equipment, elink), map value: (vector of mask flags for channels per asic)
166 std::map<uint16_t, std::map<size_t, std::vector<bool>>> fMaskMap = {};
167
168
170 void Init(const ReadoutSetup&, const ChannelMaskSet&);
171 };
172
173} // namespace cbm::algo::sts
174
176
177#endif // CBM_ALGO_DETECTOR_STS_READOUT_CONFIG_H
#define CBM_YAML_EXTERN_DECL(type)
Declare the external instantiation of the Read and Dump functions for a type.
Definition CbmYaml.h:342
void Init(const ReadoutSetup &, const ChannelMaskSet &)
Initialisation of readout map.
std::map< uint16_t, std::map< size_t, std::vector< bool > > > fMaskMap
std::string PrintReadoutMap()
Debug output of readout map.
ReadoutConfig()=default
Empty mapping.
std::map< uint16_t, std::map< size_t, uint32_t > > fAdcCutMap
std::vector< bool > MaskMap(uint16_t equipId, uint16_t elink)
API: Mapping from component and elink to channel mask flags.
std::map< u16, std::vector< Entry > > fReadoutConfig
Entry Map(u16 equipId, u16 elink)
API: Mapping from component and elink to address / ASIC number + pulser flag.
std::vector< u16 > GetEquipmentIds()
Equipment in the configuration.
size_t GetNumElinks()
Total number of elinks for STS.
uint32_t AdcCutMap(uint16_t equipId, uint16_t elink)
API: Mapping from component and elink to minimum adc cut.
uint16_t u16
Definition Definitions.h:19
int16_t i16
Definition Definitions.h:18
int32_t i32
Definition Definitions.h:20
uint32_t u32
Definition Definitions.h:21
CBM_YAML_PROPERTIES(yaml::Property(&Component::equipmentId, "equipmentId", "Equipment ID of component. Written to the data stream (MicrosliceDescriptor).", YAML::Hex), yaml::Property(&Component::feb2module, "feb2module", "Mapping of FEB within CROB to module index (-1 = inactive)"), yaml::Property(&Component::feb2moduleSide, "feb2moduleSide", "Mapping of FEB within CROB to module side (0 = left, 1 = right)"), yaml::Property(&Component::febIsPulser, "febIsPulser", "Flag if FEB is pulser (true) or not (false)"))
std::vector< std::vector< i16 > > feb2module
std::vector< std::vector< bool > > febIsPulser
std::vector< std::vector< i16 > > feb2moduleSide
CBM_YAML_PROPERTIES(yaml::Property(&Module::address, "address", "HW address of module", YAML::Hex), yaml::Property(&Module::type, "type", "Type 0 had the connector at the right side, type 1 at the left side. For type 0, the mapping " "of FEB to module side as above applies, for type 1, it has to be inverted."))
Readout setup / Hardware cabling for STS Used to create the hardware mapping for the STS unpacker.
std::vector< Module > modules
const std::vector< Elink > & GetElinks(FEBType type) const
std::vector< Elink > elinksFeb8_5
CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::numAsicsPerFeb, "numAsicsPerFeb", "Number of ASICs per FEB"), yaml::Property(&ReadoutSetup::modules, "modules", "Modules", {}, YAML::Flow), yaml::Property(&ReadoutSetup::components, "components", "Components", {}, YAML::Flow), yaml::Property(&ReadoutSetup::elinksFeb8_1, "elinksFeb8_1", "Elinks for FEB8_1 (1:1 elink:ASIC, 5 FEB / ROB)", {}, YAML::Flow), yaml::Property(&ReadoutSetup::elinksFeb8_5, "elinksFeb8_5", "Elinks for FEB8_5 (5:1 elink:ASIC, 1 FEB / ROB)", {}, YAML::Flow))
std::vector< Elink > elinksFeb8_1
std::vector< Component > components