Skip to content
Snippets Groups Projects
Commit 21cc462c authored by Dominik Smith's avatar Dominik Smith Committed by Dominik Smith
Browse files

CbmTaskUnpack: Implemented TRD2D FASP remapping. Cleanup. Fixed copyright headers.

parent 190d49ee
No related branches found
No related tags found
1 merge request!1156TRD2D Unpacker in cbm::algo.
/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt /* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese [committer] */ Authors: Volker Friese, Dominik Smith [committer] */
#include "Trd2dReadoutConfig.h" #include "Trd2dReadoutConfig.h"
......
/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt /* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese, Dominik Smith [committer] */ Authors: Volker Friese, Dominik Smith [committer] */
......
/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt /* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only SPDX-License-Identifier: GPL-3.0-only
Authors: Pascal Raisig, Dominik Smith [committer] */ Authors: Pascal Raisig, Alexandru Bercuci, Dominik Smith [committer] */
#include "UnpackTrd2d.h" #include "UnpackTrd2d.h"
...@@ -39,7 +39,6 @@ namespace cbm::algo ...@@ -39,7 +39,6 @@ namespace cbm::algo
uint64_t time = uint64_t((msDescr.idx - tTimeslice - fSystemTimeOffset) / 12.5); uint64_t time = uint64_t((msDescr.idx - tTimeslice - fSystemTimeOffset) / 12.5);
// Get parameters for current eq id. // Get parameters for current eq id.
const uint16_t mod_id = fParams.fModId;
const uint8_t crob_id = fParams.fCrobId; const uint8_t crob_id = fParams.fCrobId;
// Get the number of complete words in the input MS buffer. // Get the number of complete words in the input MS buffer.
...@@ -51,12 +50,11 @@ namespace cbm::algo ...@@ -51,12 +50,11 @@ namespace cbm::algo
unsigned char lFaspOld(0xff); unsigned char lFaspOld(0xff);
std::vector<CbmTrdFaspMessage> vMess; std::vector<CbmTrdFaspMessage> vMess;
for (uint64_t j = 0; j < nwords; j++, wd++) { for (uint64_t j = 0; j < nwords; j++, wd++) {
uint32_t w = *wd; uint32_t w = *wd;
uint8_t ch_id = w & 0xf; uint8_t ch_id = w & 0xf;
uint8_t isaux = (w >> 4) & 0x1; uint8_t isaux = (w >> 4) & 0x1;
uint8_t slice = (w >> 5) & 0x7f; uint8_t slice = (w >> 5) & 0x7f;
uint16_t data = (w >> 12) & 0x3fff; uint16_t data = (w >> 12) & 0x3fff;
// uint8_t fasp_id = ((w >> 26) & 0x3f) + crob_id * NFASPCROB;
uint8_t fasp_id = ((w >> 26) & 0x3f); uint8_t fasp_id = ((w >> 26) & 0x3f);
if (isaux) { if (isaux) {
...@@ -70,8 +68,6 @@ namespace cbm::algo ...@@ -70,8 +68,6 @@ namespace cbm::algo
} }
continue; continue;
} }
//if (fFaspMap) fasp_id = ((*fFaspMap)[mod_id])[fasp_id];
if (lFaspOld != fasp_id) { if (lFaspOld != fasp_id) {
if (vMess.size()) { pushDigis(vMess, time); } if (vMess.size()) { pushDigis(vMess, time); }
vMess.clear(); vMess.clear();
......
/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt /* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only SPDX-License-Identifier: GPL-3.0-only
Authors: Pascal Raisig, Dominik Smith [committer] */ Authors: Pascal Raisig, Alexandru Bercuci, Dominik Smith [committer] */
#ifndef CBM_ALGO_UNPACKTRD2D_H #ifndef CBM_ALGO_UNPACKTRD2D_H
#define CBM_ALGO_UNPACKTRD2D_H 1 #define CBM_ALGO_UNPACKTRD2D_H 1
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "MicrosliceDescriptor.hpp" #include "MicrosliceDescriptor.hpp"
#include "Timeslice.hpp" #include "Timeslice.hpp"
#include <array>
#include <memory> #include <memory>
#include <cmath> #include <cmath>
...@@ -163,8 +164,6 @@ namespace cbm::algo ...@@ -163,8 +164,6 @@ namespace cbm::algo
std::array<std::vector<CbmTrdDigi>, NFASPMOD* NFASPCH> fDigiBuffer = { std::array<std::vector<CbmTrdDigi>, NFASPMOD* NFASPCH> fDigiBuffer = {
{}}; ///> Buffered digi for each pad in CROB component {}}; ///> Buffered digi for each pad in CROB component
std::map<uint32_t, uint8_t[NFASPMOD]>* fFaspMap = nullptr; ///> FASP mapping update wrt the default setting
}; };
......
...@@ -506,6 +506,31 @@ void CbmTaskUnpack::InitTrd2dReadoutConfig() ...@@ -506,6 +506,31 @@ void CbmTaskUnpack::InitTrd2dReadoutConfig()
// Then pass to Trd2dReadoutConfig, will invert to obain map (equipId) -> (module iq, crob id) // Then pass to Trd2dReadoutConfig, will invert to obain map (equipId) -> (module iq, crob id)
fTrd2dConfig.InitComponentMap(crob_map); fTrd2dConfig.InitComponentMap(crob_map);
// FASP mapping update wrt the default setting (optional)
std::map<uint32_t, uint8_t[NFASPMOD]> fasp_map;
{ // Initialize the "fasp remapping"
// Hard coded for run Id >= 2335 (only module Id 5).
uint8_t map[NFASPMOD];
for (uint32_t i(0); i < NFASPMOD; i++) {
map[i] = i;
}
const size_t nfasp0 = 72;
const size_t nfasps = 36;
uint8_t map22[] = {
84, 85, 86, 87, 88, 89, // FEB14/0xffc1
90, 91, 92, 93, 94, 95, // FEB17/0xffc1
96, 97, 98, 99, 100, 101, // FEB18/0xffc1
102, 103, 104, 105, 106, 107, // FEB16/0xffc1
72, 73, 74, 75, 76, 77, // FEB9/0xffc1
78, 79, 80, 81, 82, 83 // FEB8/0xffc1
};
for (uint32_t i(0); i < nfasps; i++) {
map[i + nfasp0] = map22[i];
}
memcpy(fasp_map[5], map, NFASPMOD * sizeof(uint8_t));
}
// Map (equipId, asicId, chanId) -> (pad address, R pairing flag, daq offset) // Map (equipId, asicId, chanId) -> (pad address, R pairing flag, daq offset)
std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, uint64_t>>>> channelMap; std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, uint64_t>>>> channelMap;
...@@ -526,10 +551,15 @@ void CbmTaskUnpack::InitTrd2dReadoutConfig() ...@@ -526,10 +551,15 @@ void CbmTaskUnpack::InitTrd2dReadoutConfig()
for (auto add : addresses) { for (auto add : addresses) {
//Get local IDs for this component / equipment. //Get local IDs for this component / equipment.
const int32_t fasp_in_eq = ((int) add - 1000 * (int) moduleId) % (NFASPCROB); const int32_t fasp_in_mod = add - 1000 * moduleId;
const int32_t crob_in_mod = ((int) add - 1000 * (int) moduleId) / (NFASPCROB); const int32_t fasp_in_eq = fasp_in_mod % (NFASPCROB);
const int32_t crob_in_mod = fasp_in_mod / (NFASPCROB);
const uint16_t eq_id = crob_map[moduleId][crob_in_mod]; const uint16_t eq_id = crob_map[moduleId][crob_in_mod];
// Apply FASP remapping (optional)
const int32_t add_remap = fasp_map[moduleId][fasp_in_mod];
add = add_remap + 1000 * moduleId;
// ASIC parameter set // ASIC parameter set
CbmTrdParFasp* fasppar = (CbmTrdParFasp*) setDet->GetModulePar(add); CbmTrdParFasp* fasppar = (CbmTrdParFasp*) setDet->GetModulePar(add);
...@@ -539,11 +569,12 @@ void CbmTaskUnpack::InitTrd2dReadoutConfig() ...@@ -539,11 +569,12 @@ void CbmTaskUnpack::InitTrd2dReadoutConfig()
const bool hasPairingR = fasppar->GetChannel(chan)->HasPairingR(); const bool hasPairingR = fasppar->GetChannel(chan)->HasPairingR();
const CbmTrdParModDigi* modpar = (CbmTrdParModDigi*) digiparset.GetModulePar(moduleId); const CbmTrdParModDigi* modpar = (CbmTrdParModDigi*) digiparset.GetModulePar(moduleId);
uint64_t daq_offset = 0; uint64_t daq_offset = 0;
if (modpar->GetPadRow(fasppar->GetPadAddress(chan)) % 2 == 0) daq_offset = 3; if (modpar->GetPadRow(pad) % 2 == 0) daq_offset = 3;
channelMap[eq_id][fasp_in_eq][chan] = std::make_tuple(pad, hasPairingR, daq_offset); channelMap[eq_id][fasp_in_eq][chan] = std::make_tuple(pad, hasPairingR, daq_offset);
} }
} }
} }
fTrd2dConfig.InitChannelMap(channelMap); fTrd2dConfig.InitChannelMap(channelMap);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment