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

Implemented system time offsets for all unpackers in cbm::algo.

parent d2283f42
No related branches found
No related tags found
1 merge request!1210System time offsets for unpackers in cbm::algo.
Pipeline #22876 passed
......@@ -258,7 +258,7 @@ namespace cbm::algo
double ToTcorr = fbDoToTCorr ? fParams.fElinkParams[fpgaID].fToTshift[channel] : 0.;
int32_t pixelUID = GetPixelUID(fpgaID, channel);
//check ordering
double finalTime = time + (double) fMsRefTime - fSystemTimeOffset;
double finalTime = time + (double) fMsRefTime - fParams.fElinkParams[fpgaID].fTimeOffset;
// Do not accept digis, where the MS und TS differs by more than 6 sec (mainly TS0)
if (6e9 < finalTime) return;
......
......@@ -46,6 +46,7 @@ namespace cbm::algo
**/
struct UnpackRichElinkPar {
std::vector<double> fToTshift; ///< TOT shift for different channels
uint64_t fTimeOffset = 0.; ///< Time calibration parameter
};
......@@ -178,12 +179,6 @@ namespace cbm::algo
/** @brief Storage of monitoring data. */
UnpackRichMonitorData fMonitor;
/**
* @brief Time offset for the system
* @todo This should be module and channel dependent and included into the asic parameters
*/
std::int32_t fSystemTimeOffset = 0;
};
......
......@@ -404,7 +404,7 @@ namespace cbm::algo
fLastFulltime = raw.GetFullTime();
// Get the time information and apply the necessary correction
uint64_t time = raw.GetTime() - fSystemTimeOffset;
uint64_t time = raw.GetTime() - elinkPar.fTimeOffset;
// Get the timeshift and set the member, which is required for some of the rtd methods
uint64_t currentTimeshift = GetBinTimeShift(raw.GetSamples());
......
......@@ -250,12 +250,6 @@ namespace cbm::algo
/** @brief Number of streams per word **/
static const std::uint8_t fStreamsPerWord = 2;
/**
** @brief Time offset for the system
** @todo This should be module and channel dependent and included into the asic parameters
**/
std::int32_t fSystemTimeOffset = 0;
/** @brief Start time of the current µSlice relative to the Timeslice start time in Spadic CC. */
size_t fMsStartTimeRelCC = 0;
......
......@@ -39,7 +39,7 @@ namespace cbm::algo
// - relative offset of the MS wrt the TS
// - FASP epoch offset for current CROB
// - TRD2D system offset wrt to experiment time (e.g. T0)
uint64_t time = uint64_t((msDescr.idx - tTimeslice - fSystemTimeOffset) / 12.5);
uint64_t time = uint64_t((msDescr.idx - tTimeslice - fParams.fSystemTimeOffset) / 12.5);
// Get parameters for current eq id.
const uint8_t crob_id = fParams.fCrobId;
......
......@@ -73,6 +73,7 @@ namespace cbm::algo
** @brief Parameters required for the TRD unpacking (specific to one component)
**/
struct UnpackTrd2dPar {
int32_t fSystemTimeOffset = 0; ///< Time calibration parameter
uint16_t fModId = 0; ///< Module ID of component
uint8_t fCrobId = 0; ///< CROB ID of component
std::vector<UnpackTrd2dAsicPar> fAsicParams = {}; ///< Parameters for each ASIC
......@@ -141,12 +142,6 @@ namespace cbm::algo
UnpackTrd2dMonitorData fMonitor; ///< Container for monitoring data
/**
** @brief Time offset for the system
** @todo This should be module and channel dependent and included into the asic parameters
**/
std::int32_t fSystemTimeOffset = 0;
bool pushDigis(std::vector<CbmTrdFaspMessage> messages, const uint64_t time);
/** @brief Finalize component (e.g. copy from temp buffers) */
......
......@@ -146,7 +146,7 @@ namespace cbm::algo
auto mapEntry = fStsConfig.Map(equip, elink);
elinkPar.fAddress = mapEntry.first; // Module address for this elink
elinkPar.fAsicNr = mapEntry.second; // ASIC number within module
elinkPar.fTimeOffset = 0.;
elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::STS];
elinkPar.fAdcOffset = 1.;
elinkPar.fAdcGain = 1.;
elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress, elinkPar.fAsicNr);
......@@ -165,7 +165,7 @@ namespace cbm::algo
for (size_t elink = 0; elink < numElinks; elink++) {
UnpackMuchElinkPar elinkPar;
elinkPar.fAddress = fMuchConfig.Map(equip, elink); // Vector of MUCH addresses for this elink
elinkPar.fTimeOffset = 0.;
elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::MUCH];
par->fElinkParams.push_back(elinkPar);
}
fAlgoMuch[equip].SetParams(std::move(par));
......@@ -180,7 +180,7 @@ namespace cbm::algo
for (size_t elink = 0; elink < numElinks; elink++) {
UnpackTofElinkPar elinkPar;
elinkPar.fChannelUId = fTofConfig.Map(equip, elink); // Vector of TOF addresses for this elink
elinkPar.fTimeOffset = 0.;
elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::RPC];
par->fElinkParams.push_back(elinkPar);
}
fAlgoTof[equip].SetParams(std::move(par));
......@@ -195,7 +195,7 @@ namespace cbm::algo
for (size_t elink = 0; elink < numElinks; elink++) {
UnpackBmonElinkPar elinkPar;
elinkPar.fChannelUId = fBmonConfig.Map(equip, elink); // Vector of T0 addresses for this elink
elinkPar.fTimeOffset = 0.;
elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::T0];
par->fElinkParams.push_back(elinkPar);
}
fAlgoBmon[equip].SetParams(std::move(par));
......@@ -210,6 +210,7 @@ namespace cbm::algo
for (auto const& val : compMap) {
uint32_t address = val.first;
par->fElinkParams[address].fToTshift = val.second;
par->fElinkParams[address].fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::RICH];
}
fAlgoRich[equip].SetParams(std::move(par));
L_(info) << "--- Configured equipment " << equip << " with " << fRichConfig.GetNumElinks(equip) << " elinks";
......@@ -231,6 +232,7 @@ namespace cbm::algo
auto addresses = fTrdConfig.Map(equip, crob, elink);
elinkPar.fAddress = addresses.first; // Asic address for this elink
elinkPar.fChanAddress = addresses.second; // Channel addresses for this elink
elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::TRD];
crobPar.fElinkParams.push_back(elinkPar);
}
par->fCrobParams.push_back(crobPar);
......@@ -259,6 +261,7 @@ namespace cbm::algo
asicPar.fChanParams.push_back(chanPar);
}
auto comppars = fTrd2dConfig.CompMap(equip);
par->fSystemTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::TRD2D];
par->fModId = comppars.first;
par->fCrobId = comppars.second;
par->fAsicParams.push_back(asicPar);
......
......@@ -132,6 +132,13 @@ namespace cbm::algo
/** @brief RICH unpackers **/
std::map<uint16_t, UnpackRich> fAlgoRich = {};
/** @brief System time offsets **/
std::map<fles::SubsystemIdentifier, int32_t> fSystemTimeOffset = {
{fles::SubsystemIdentifier::STS, -970}, {fles::SubsystemIdentifier::MUCH, -980},
{fles::SubsystemIdentifier::RICH, 100}, {fles::SubsystemIdentifier::RPC, 40},
{fles::SubsystemIdentifier::T0, 0}, {fles::SubsystemIdentifier::TRD, 1300},
{fles::SubsystemIdentifier::TRD2D, -510}};
};
} // namespace cbm::algo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment