17#include <FairParamList.h>
18#include <fairlogger/Logger.h>
40 std::map<uint32_t, uint16_t[NCROBMOD]> crobMap;
42 std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, uint64_t>>>> channelMap;
45 for (
auto entry : digiparset.GetModuleMap()) {
47 const auto moduleId = entry.first;
51 if (!setDet)
continue;
53 auto digipar = entry.second;
56 for (
int icrob(0); icrob <
NCROBMOD; icrob++)
57 crobMap[moduleId][icrob] = crobs[icrob];
60 std::vector<int32_t> addresses;
62 for (
auto add : addresses) {
64 const int32_t fasp_in_mod = add - 1000 * moduleId;
65 const int32_t fasp_in_eq = fasp_in_mod % (
NFASPCROB);
66 const int32_t crob_in_mod = fasp_in_mod / (
NFASPCROB);
67 const uint16_t eq_id = crobMap[moduleId][crob_in_mod];
73 for (
int chan = 0; chan < fasppar->
GetNchannels(); chan++) {
76 const bool isMasked = faspch->
IsMasked();
77 uint64_t daq_offset = 0;
79 channelMap[eq_id][fasp_in_eq][chan] = std::make_tuple(pad, isMasked, daq_offset);
94 std::ofstream(
"Trd2dReadoutSetup.yaml") <<
yaml::Dump{}(trd2dConfig);
102 FairParamList parlist;
103 asicparset.putParams(&parlist);
105 std::vector<int> moduleIds(asicparset.GetNrOfModules());
106 parlist.fill(
"ModuleId", moduleIds.data(), moduleIds.size());
108 std::map<size_t, std::map<size_t, std::map<size_t, size_t>>> addressMap;
109 std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, size_t>>>>
112 for (
auto module : moduleIds) {
118 std::vector<int> asicAddresses;
121 for (
auto address : asicAddresses) {
123 const uint16_t criId = asicPar->
GetCriId();
124 const uint8_t crobId = asicPar->
GetCrobId();
125 const uint8_t elinkId = asicPar->
GetElinkId(0);
129 addressMap[criId][crobId][elinkId] = address;
130 addressMap[criId][crobId][elinkId + 1] = address;
132 const uint8_t numChans = 16;
133 for (uint8_t chan = 0; chan < numChans; chan++) {
134 auto asicChannelId = (elinkId % 2) == 0 ? chan : chan + numChans;
136 channelMap[criId][crobId][elinkId][chan] = chanAddr;
138 for (uint8_t chan = 0; chan < numChans; chan++) {
139 auto asicChannelId = (elinkId + 1 % 2) == 0 ? chan : chan + numChans;
141 channelMap[criId][crobId][elinkId + 1][chan] = chanAddr;
144 <<
"address " << address <<
" key " << criId <<
" " << unsigned(crobId) <<
" " << unsigned(elinkId);
147 trdConfig.
Init(addressMap, channelMap);
160 for (
int elinkId = 0; elinkId < 36; ++elinkId) {
177 std::ofstream(
"TrdReadoutSetup.yaml") <<
yaml::Dump{}(trdConfig);
virtual InitStatus Init()
virtual std::vector< Int_t > GetChannelAddresses() const
virtual size_t GetComponentId() const
Definition of FASP channel calibration container.
Bool_t HasPairingR() const
Query pad pairing type.
Definition of FASP parameters.
const CbmTrdParFaspChannel * GetChannel(Int_t pad_address, UChar_t pair) const
Query the calibration for one FASP RO channel.
int GetPadAddress(Int_t ich) const
virtual Int_t GetNchannels() const
Describe TRD module ASIC settings (electronic gain, delays, etc)
virtual void GetAsicAddresses(std::vector< Int_t > *a) const
Query the ASICs in the module for their DAQ address. It applies to the list of ASICs....
virtual CbmTrdDigi::eCbmTrdAsicType GetAsicType() const
Query the type of ASICs in the list.
virtual const CbmTrdParAsic * GetAsicPar(Int_t address) const
Look for the ASIC parameters of a given DAQ id It applies to the list of ASICs.
virtual const int32_t * GetCrobAddresses() const
Query the type of chamber.
Definition of chamber gain conversion for one TRD module.
Definition of SPADIC parameters.
static std::uint16_t GetCriId(size_t componentId)
Extracts the CriId from a given componentId - Remark when the par files are created from geometries t...
static std::uint8_t GetCrobId(size_t componentId)
Extracts the CrobId from a given componentId.
static std::uint8_t GetElinkId(size_t componentId, Int_t channelId)
eLinkId for the given asicAddress and channelId (in the asic coordinates, i.e. 00....
Provides the hardware-to-software address mapping for the CBM-TRD2D.
void SetSystemTimeOffset(int64_t offsetNs)
Get system time offset.
void InitChannelMap(const std::map< size_t, std::map< size_t, std::map< size_t, std::tuple< int32_t, bool, uint64_t > > > > &channelMap)
Initialisation of channel map.
void InitComponentMap(const std::map< uint32_t, uint16_t[NCROBMOD]> &crob_map)
Initialisation of readout map.
Provides the hardware-to-software address mapping for the CBM-TRD.
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.
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.
void SetSystemTimeOffset(int64_t offsetNs)
Get system time offset.
CbmTrdParSetAsic * asic
parameter list for ASIC characterization
cbm::algo::Setup setup
Setup type.
CbmTrdParSetDigi * digi
parameter list for read-out geometry