CbmRoot
Loading...
Searching...
No Matches
trd/ReadoutConfig.h
Go to the documentation of this file.
1/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
5#pragma once
6
7#include "yaml/Property.h"
8#include "yaml/Yaml.h"
9
10#include <map>
11#include <sstream>
12#include <utility>
13#include <vector>
14
15namespace cbm::algo::trd
16{
17
18
32
33 public:
36
37
40
41
45 std::vector<uint16_t> GetEquipmentIds();
46
47
52 size_t GetNumCrobs(uint16_t equipmentId);
53
54
60 size_t GetNumElinks(uint16_t equipmentId, uint16_t crobId);
61
62
69 std::pair<int32_t, std::vector<uint32_t>> Map(uint16_t equipId, uint16_t crob, uint16_t elink);
70
74 void SetElinkTimeOffset(uint32_t criid, uint8_t elinkid, int32_t offsetNs);
75
76
80 int32_t GetElinkTimeOffset(uint32_t criid, uint8_t elinkid);
81
83 std::string PrintReadoutMap();
84
85
87 void Init(const std::map<size_t, std::map<size_t, std::map<size_t, size_t>>>& addressMap,
88 std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, size_t>>>>& channelMap);
89
91 void SetSystemTimeOffset(int64_t offsetNs) { fSystemTimeOffset = offsetNs; };
92
95
96 private:
97 // --- System time offset
98 int64_t fSystemTimeOffset = 0;
99
100 // --- TRD readout map
101 // --- Map index: (equipment, crob, elink), map value: (ASIC address)
102 std::map<uint16_t, std::vector<std::vector<uint16_t>>> fReadoutMap = {};
103
104 // --- TRD channel map
105 // --- Map index: (equipment, crob, elink, chan), map value: (channel address)
106 std::map<uint16_t, std::vector<std::vector<std::vector<uint32_t>>>> fChannelMap = {};
107
109 std::map<uint32_t, std::vector<int32_t>> fElinkTimeOffsetMap;
110
112 yaml::Property(&ReadoutConfig::fSystemTimeOffset, "timeOffset", "System time offset for TRD1D"),
113 yaml::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "TRD readout map", {}, YAML::Hex),
114 yaml::Property(&ReadoutConfig::fChannelMap, "channelMap", "TRD channel map"),
115 yaml::Property(&ReadoutConfig::fElinkTimeOffsetMap, "elinkTimeOffset", "TRD time offset per CRI&Elink combination")
116 );
117 };
118
119} // namespace cbm::algo::trd
120
#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-TRD.
std::vector< uint16_t > GetEquipmentIds()
Equipment in the configuration.
void Init(const std::map< size_t, std::map< size_t, std::map< size_t, size_t > > > &addressMap, std::map< size_t, std::map< size_t, std::map< size_t, std::map< size_t, size_t > > > > &channelMap)
Initialisation of readout map.
CBM_YAML_PROPERTIES(yaml::Property(&ReadoutConfig::fSystemTimeOffset, "timeOffset", "System time offset for TRD1D"), yaml::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "TRD readout map", {}, YAML::Hex), yaml::Property(&ReadoutConfig::fChannelMap, "channelMap", "TRD channel map"), yaml::Property(&ReadoutConfig::fElinkTimeOffsetMap, "elinkTimeOffset", "TRD time offset per CRI&Elink combination"))
void SetElinkTimeOffset(uint32_t criid, uint8_t elinkid, int32_t offsetNs)
Register a time offeset to be substracted from the digis which come from a specific CRI.
std::pair< int32_t, std::vector< uint32_t > > Map(uint16_t equipId, uint16_t crob, uint16_t elink)
API: Mapping from component, crob and elink to pair (ASIC address, channel addresses)
int32_t GetElinkTimeOffset(uint32_t criid, uint8_t elinkid)
Get the time offeset to be substracted from the digis which come from a specific CRI.
size_t GetNumCrobs(uint16_t equipmentId)
Number of CROBS of a component.
std::string PrintReadoutMap()
Debug output of readout map.
std::map< uint32_t, std::vector< int32_t > > fElinkTimeOffsetMap
Map to store time offsets for each CRI&Elink combination.
std::map< uint16_t, std::vector< std::vector< std::vector< uint32_t > > > > fChannelMap
size_t GetNumElinks(uint16_t equipmentId, uint16_t crobId)
Number of elinks of a component - CROB pair.
void SetSystemTimeOffset(int64_t offsetNs)
Get system time offset.
std::map< uint16_t, std::vector< std::vector< uint16_t > > > fReadoutMap
int64_t GetSystemTimeOffset()
Get system time offset.
Property(T Class::*member, std::string_view key, std::string_view description) -> Property< Class, T >