Skip to content
Snippets Groups Projects
Commit 61ae7c2e authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

[online] add SystemTimeOffset parameter for BMon unpacker

parent 0f87a54d
No related branches found
No related tags found
1 merge request!1969Add more time offsets to parameters of online unpackers for BMon and TOF
......@@ -79,6 +79,8 @@ namespace cbm::algo::bmon
void ReadoutConfig::Init(const ReadoutSetup& pars)
{
fTimeOffset = pars.timeOffset;
// Constructing the map (equipmentId, eLink, channel) -> (TOF address)
const uint32_t numChanPerComp = pars.NChansPerComponent();
......
......@@ -16,6 +16,10 @@
namespace cbm::algo::bmon
{
/**
* @brief Readout setup / Hardware cabling for BMon
* Used to create the hardware mapping for the BMon unpacker.
*/
struct ReadoutSetup {
struct CROB {
......@@ -30,9 +34,10 @@ namespace cbm::algo::bmon
yaml::Property(&CROB::rpcType, "rpcType", "add explanation."),
yaml::Property(&CROB::rpcSide, "rpcSide", "add explanation."),
yaml::Property(&CROB::nRPC, "nRPC", "number of RPCs."),
yaml::Property(&CROB::timeOffset, "timeOffset", "time offset for CROB"));
yaml::Property(&CROB::timeOffset, "timeOffset", "time offset for CROB"));
};
i32 timeOffset;
i32 nFebsPerComponent;
i32 nAsicsPerFeb;
i32 nChannelsPerAsic;
......@@ -40,7 +45,8 @@ namespace cbm::algo::bmon
std::vector<CROB> crobs;
std::vector<u16> eqIds;
CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::nFebsPerComponent, "nFebsPerComponent", "Number of FEBs per component"),
CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::timeOffset, "timeOffset", "Time offset for BMon"),
yaml::Property(&ReadoutSetup::nFebsPerComponent, "nFebsPerComponent", "Number of FEBs per component"),
yaml::Property(&ReadoutSetup::nAsicsPerFeb, "nAsicsPerFeb", "Number of ASICs per FEB"),
yaml::Property(&ReadoutSetup::nChannelsPerAsic, "nChannelsPerAsic", "Number of channels per ASIC"),
yaml::Property(&ReadoutSetup::nCrobPerComponent, "nCrobPerComponent", "Number of CROBs per component"),
......@@ -70,6 +76,11 @@ namespace cbm::algo::bmon
/** @brief Destructor **/
virtual ~ReadoutConfig();
/** @brief System time offset for BMon
** @return Value of system time offset
**/
i32 TimeOffset() const { return fTimeOffset; }
/** @brief Equipment in the configuration
** @return Vector of equipment IDs
**/
......@@ -96,6 +107,9 @@ namespace cbm::algo::bmon
int32_t TimeOffsetMap(uint16_t equipId, uint16_t elink);
private:
// --- BMon system time offset
int32_t fTimeOffset = 0;
// --- Bmon elink time offsets
// --- Map index: (equipment, elink), map value: (time offset)
std::map<uint16_t, std::vector<int32_t>> fTimeOffsetMap = {};
......
......@@ -12,6 +12,7 @@ using fles::Subsystem;
Unpack::Unpack(const ReadoutConfig& readout) : fReadout(readout)
{
constexpr u8 SystemVersion = 0x00;
i32 SysTimeOffset = fReadout.TimeOffset();
// Create one algorithm per component for Bmon and configure it with parameters
auto equipIdsBmon = fReadout.GetEquipmentIds();
......@@ -21,7 +22,7 @@ Unpack::Unpack(const ReadoutConfig& readout) : fReadout(readout)
for (size_t elink = 0; elink < numElinks; elink++) {
bmon::UnpackElinkPar elinkPar;
elinkPar.fChannelUId = fReadout.Map(equip, elink); // Vector of Bmon addresses for this elink
elinkPar.fTimeOffset = fReadout.TimeOffsetMap(equip, elink); // Time offset for this elink
elinkPar.fTimeOffset = SysTimeOffset + fReadout.TimeOffsetMap(equip, elink); // Time offset for this elink
par.fElinkParams.push_back(elinkPar);
}
auto algo = std::make_unique<UnpackMS>(par);
......
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