Skip to content
Snippets Groups Projects
Commit 2bb07117 authored by Alexandru Bercuci's avatar Alexandru Bercuci
Browse files

add channel time-offset calibration at ns level

parent 82c41335
Branches
Tags
1 merge request!2028Trd2d online - finner time calibration
......@@ -44,7 +44,7 @@ namespace cbm::algo::trd2d
struct ChanMapping {
int32_t padAddress; /// map pad and pairing to FASP channel
bool maskFlag; /// HW mask flag for channel
uint8_t tOffset; /// time correction in clk
int8_t tOffset; /// time correction in clk
uint16_t lThreshold; /// SW threshold for ringing channels
CBM_YAML_FORMAT(YAML::Flow);
......
......@@ -51,6 +51,7 @@ Unpack::Unpack(const Config& config) : fConfig(config)
{calCh.noise.tDelay, calCh.noise.tWindow, calCh.noise.lDThres, calCh.noise.lSThres}};
chanPar.fMask = pars.maskFlag; // Flag channel mask
chanPar.fDaqOffset = pars.tOffset; // Time calibration parameter
par.toff[ch/2] = pars.tOffset;
chanPar.fSignalThres = pars.lThreshold; // Threshold cut
asicPar.fChanParams.push_back(chanPar);
}
......
......@@ -442,7 +442,9 @@ namespace cbm::algo::trd2d
* Correct the time with the system time offset which is derived in calibration.*/
uint64_t gtime = id.GetTime() * fAsicClockPeriod;
gtime >>= 1;
if (gtime >= uint64_t(fParams.fSystemTimeOffset)) gtime -= fParams.fSystemTimeOffset;
int toffGlobalCorrection = fParams.fSystemTimeOffset + fParams.toff[ipad];
if (toffGlobalCorrection > 0 && gtime < uint64_t(toffGlobalCorrection)) gtime = 0;
else gtime -= (fParams.fSystemTimeOffset + fParams.toff[ipad]);
id.SetTime(gtime);
outputDigis.emplace_back(std::move(id));
}
......@@ -474,7 +476,7 @@ namespace cbm::algo::trd2d
if (calPar.noise.fSignalThres && imess.data <= calPar.noise.fSignalThres) continue;
const uint32_t pad = mch / 2;
const bool hasPairingR = bool(chPar.fPadAddress > 0);
const uint64_t lTime = time + imess.tlab + calPar.fDaqOffset;
const uint64_t lTime = time + imess.tlab;
const uint16_t sgn =
uint16_t((imess.data - fParams.fRefSignal) * calPar.fGainFee - calPar.fBaseline + fParams.fRefSignal);
const uint16_t lchR = hasPairingR ? sgn : 0;
......
......@@ -171,6 +171,7 @@ namespace cbm::algo::trd2d
std::map<uint8_t, UnpackAsicPar> fAsicParams = {}; ///< Parameters for each ASIC
std::array<CalibChannelPar, NFASPMOD* NFASPCH> fCalibParams =
{}; ///< Parameters for each ASIC channel for each module
int toff[NFASPMOD * NFASPPAD];
/** \brief Write to the debug stream the content of the current param object*/
void dump() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment