CbmRoot
Loading...
Searching...
No Matches
trd2d/ReadoutConfig.h
Go to the documentation of this file.
1/* Copyright (C) 2023-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese, Dominik Smith [committer], Alex Bercuci */
4
5#pragma once
6
7#include "UnpackMS.h"
8#include "yaml/Property.h"
9#include "yaml/Yaml.h"
10
11#include <map>
12#include <sstream>
13#include <utility>
14#include <vector>
15
16namespace cbm::algo::trd2d
17{
18
19
33
34 public:
35 struct CompMapping {
36 uint16_t moduleId;
37 uint8_t fiberId;
38
39 CBM_YAML_FORMAT(YAML::Flow);
41 yaml::Property(&CompMapping::fiberId, "fiberId", "Optical Fibre ID"));
42 };
43
44 struct ChanMapping {
45 int32_t padAddress;
46 bool maskFlag;
47 uint8_t tOffset;
48 uint16_t lThreshold;
49
50 CBM_YAML_FORMAT(YAML::Flow);
52 yaml::Property(&ChanMapping::padAddress, "address", "Pad address"),
53 yaml::Property(&ChanMapping::maskFlag, "mask", "Channel masking flag"),
54 yaml::Property(&ChanMapping::tOffset, "toff", "Channel wise time offset"),
55 yaml::Property(&ChanMapping::lThreshold, "thres", "SW masking by threshold"));
56 };
57
60
61
64
65
69 std::vector<uint16_t> GetEquipmentIds();
70
71
76 size_t GetNumAsics(uint16_t equipmentId);
77
78
83 std::vector<uint8_t> GetAsicList(uint16_t equipmentId);
84
85
91 size_t GetNumChans(uint16_t equipmentId, uint16_t asicId);
92
94
99 CompMapping CompMap(uint16_t equipId);
100
101
108 ChanMapping ChanMap(uint16_t equipId, uint16_t asic, uint16_t chan);
109
110
112 std::string PrintReadoutMap();
113
115 void InitComponentMap(const std::map<uint32_t, std::vector<uint16_t>>& map);
116
118 void InitChannelMap(
119 const std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, uint8_t, uint16_t>>>>&
120 channelMap);
121
124
126 void SetSystemTimeOffset(int64_t offsetNs) { fSystemTimeOffset = offsetNs; };
127
128 private:
129 // --- System time offset
130 int64_t fSystemTimeOffset = 0;
131
132 // --- TRD2D readout map
133 // --- Map index: (equipment), map value: (module id, crob id)
134 std::map<uint16_t, CompMapping> fReadoutMap = {};
135
136 // --- TRD2D channel map
137 // --- Map index: (equipment, asic, chan), map value: (pad address, mask flag, daq offset)
138 std::map<uint16_t, std::map<uint8_t, std::vector<ChanMapping>>> fChannelMap = {};
139
141 yaml::Property(&ReadoutConfig::fSystemTimeOffset, "timeOffset", "System time offset for TRD2D"),
142 yaml::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "Maps equipment to module and Optical fibre Id", YAML::Hex),
144 "Maps equipment, ASIC and channel to pad address, mask flag and DAQ offset",
145 YAML::Hex));
146 };
147
148} // namespace cbm::algo::trd2d
149
#define CBM_YAML_EXTERN_DECL(type)
Declare the external instantiation of the Read and Dump functions for a type.
Definition Yaml.h:297
Provides the hardware-to-software address mapping for the CBM-TRD2D.
ChanMapping ChanMap(uint16_t equipId, uint16_t asic, uint16_t chan)
API: Mapping from component, asic and channel to tuple (pad address, R pairing flag,...
size_t GetNumAsics(uint16_t equipmentId)
Number of ASICS of a component.
CBM_YAML_PROPERTIES(yaml::Property(&ReadoutConfig::fSystemTimeOffset, "timeOffset", "System time offset for TRD2D"), yaml::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "Maps equipment to module and Optical fibre Id", YAML::Hex), yaml::Property(&ReadoutConfig::fChannelMap, "channelMap", "Maps equipment, ASIC and channel to pad address, mask flag and DAQ offset", YAML::Hex))
void SetSystemTimeOffset(int64_t offsetNs)
Get system time offset.
std::string PrintReadoutMap()
Debug output of readout map.
size_t GetNumChans(uint16_t equipmentId, uint16_t asicId)
Number of channels of a component - ASIC pair.
void InitComponentMap(const std::map< uint32_t, std::vector< uint16_t > > &map)
Initialisation of readout map.
std::vector< uint8_t > GetAsicList(uint16_t equipmentId)
Number of ASICS of a component.
std::vector< uint16_t > GetEquipmentIds()
Equipment in the configuration.
void InitChannelMap(const std::map< size_t, std::map< size_t, std::map< size_t, std::tuple< int32_t, bool, uint8_t, uint16_t > > > > &channelMap)
Initialisation of channel map.
std::map< uint16_t, CompMapping > fReadoutMap
int64_t GetSystemTimeOffset()
Get system time offset.
std::map< uint16_t, std::map< uint8_t, std::vector< ChanMapping > > > fChannelMap
CompMapping CompMap(uint16_t equipId)
API: Mapping from component to pair (module id, crob id)
CBM_YAML_PROPERTIES(yaml::Property(&ChanMapping::padAddress, "address", "Pad address"), yaml::Property(&ChanMapping::maskFlag, "mask", "Channel masking flag"), yaml::Property(&ChanMapping::tOffset, "toff", "Channel wise time offset"), yaml::Property(&ChanMapping::lThreshold, "thres", "SW masking by threshold"))
CBM_YAML_FORMAT(YAML::Flow)
SW threshold for ringing channels.
bool maskFlag
map pad and pairing to FASP channel
CBM_YAML_PROPERTIES(yaml::Property(&CompMapping::moduleId, "moduleId", "Module ID"), yaml::Property(&CompMapping::fiberId, "fiberId", "Optical Fibre ID"))