16#ifndef O2_FDD_CTFCODER_H
17#define O2_FDD_CTFCODER_H
43 template <typename VEC>
47 template <typename VDIG, typename VCHAN>
48 o2::ctf::CTFIOSize
decode(const
CTF::base& ec, VDIG& digitVec, VCHAN& channelVec);
54 template <
int MAJOR_VERSION,
int MINOR_VERSION>
59 template <
int MAJOR_VERSION,
int MINOR_VERSION, typename VDIG, typename VCHAN>
60 void decompress(const
CompressedDigits& cd, VDIG& digitVec, VCHAN& channelVec);
62 void appendToTree(TTree&
tree,
CTF& ec);
64 void assignDictVersion(
o2::ctf::CTFDictHeader&
h) const final;
68template <typename VEC>
87 compress<1, 0>(cd, digitVec, channelVec);
89 compress<1, 1>(cd, digitVec, channelVec);
92 compress<1, 1>(cd, digitVec, channelVec);
95 auto szIni = estimateCompressedSize(cd);
101 ec->setHeader(cd.header);
107#define ENCODEFDD(part, slot, bits) CTF::get(buff.data())->encode(part, int(slot), bits, optField[int(slot)], &buff, mCoders[int(slot)], getMemMarginFactor());
120 finaliseCTFOutput<CTF>(buff);
126template <
typename VDIG,
typename VCHAN>
135#define DECODEFDD(part, slot) ec.decode(part, int(slot), mCoders[int(slot)])
148 if (hd.minorVersion == 0 && hd.majorVersion == 1) {
149 decompress<1, 0>(cd, digitVec, channelVec);
151 decompress<1, 1>(cd, digitVec, channelVec);
158template <
int MAJOR_VERSION,
int MINOR_VERSION,
typename VDIG,
typename VCHAN>
159void CTFCoder::decompress(
const CompressedDigits& cd, VDIG& digitVec, VCHAN& channelVec)
164 channelVec.reserve(cd.
idChan.size());
166 uint32_t firstEntry = 0, clCount = 0, chipCount = 0;
179 firstEntry = channelVec.size();
185 auto icc = channelVec.size();
186 if constexpr (MINOR_VERSION == 0 && MAJOR_VERSION == 1) {
193 const auto& chan = channelVec.emplace_back(chID, cd.
time[icc], cd.
charge[icc], cd.
feeBits[icc]);
195 if (chan.mPMNumber > 7) {
196 amplA += chan.mChargeADC;
201 amplC += chan.mChargeADC;
222 digitVec.emplace_back(firstEntry, cd.
nChan[idig],
ir, trig);
227template <
int MAJOR_VERSION,
int MINOR_VERSION>
228void CTFCoder::compress(CompressedDigits& cd,
const gsl::span<const Digit>& digitVec,
const gsl::span<const ChannelData>& channelVec)
232 cd.header.det =
mDet;
233 if (!digitVec.size()) {
236 uint32_t firstDig = digitVec.size(), nDigSel = digitVec.size(), nChanSel = channelVec.size();
237 std::vector<bool> reject(digitVec.size());
239 for (
size_t id = 0;
id < digitVec.size();
id++) {
243 nChanSel -= digitVec[
id].ref.getEntries();
244 }
else if (firstDig == digitVec.size()) {
254 const auto& dig0 = digitVec[firstDig];
255 cd.header.nTriggers = nDigSel;
256 cd.header.firstOrbit = dig0.mIntRecord.orbit;
257 cd.header.firstBC = dig0.mIntRecord.bc;
259 cd.trigger.resize(cd.header.nTriggers);
260 cd.bcInc.resize(cd.header.nTriggers);
261 cd.orbitInc.resize(cd.header.nTriggers);
262 cd.nChan.resize(cd.header.nTriggers);
264 cd.idChan.resize(nChanSel);
265 cd.time.resize(nChanSel);
266 cd.charge.resize(nChanSel);
267 cd.feeBits.resize(nChanSel);
269 uint16_t prevBC = cd.header.firstBC;
270 uint32_t prevOrbit = cd.header.firstOrbit;
272 for (
uint32_t idig = 0; idig < digitVec.size(); idig++) {
276 const auto& digit = digitVec[idig];
277 const auto chanels = digit.getBunchChannelData(channelVec);
280 cd.trigger[dcount] = digit.mTriggers.getTriggersignals();
281 if (prevOrbit == digit.mIntRecord.orbit) {
282 cd.bcInc[dcount] = digit.mIntRecord.bc - prevBC;
283 cd.orbitInc[dcount] = 0;
285 cd.bcInc[dcount] = digit.mIntRecord.bc;
286 cd.orbitInc[dcount] = digit.mIntRecord.orbit - prevOrbit;
288 prevBC = digit.mIntRecord.bc;
289 prevOrbit = digit.mIntRecord.orbit;
291 cd.nChan[dcount] = chanels.size();
292 if (!cd.nChan[dcount]) {
293 LOG(
debug) <<
"Digits with no channels";
298 for (
uint8_t ic = 0; ic < cd.nChan[dcount]; ic++) {
299 if constexpr (MINOR_VERSION == 0 && MAJOR_VERSION == 1) {
300 cd.idChan[ccount] = chanels[ic].mPMNumber - prevChan;
302 cd.idChan[ccount] = chanels[ic].mPMNumber;
304 cd.time[ccount] = chanels[ic].mTime;
305 cd.charge[ccount] = chanels[ic].mChargeADC;
306 cd.feeBits[ccount] = chanels[ic].mFEEBits;
307 prevChan = chanels[ic].mPMNumber;
Declarations for CTFCoderBase class (support of external dictionaries)
Base definition of FIT-FDD geometry.
#define DECODEFDD(part, slot)
#define ENCODEFDD(part, slot, bits)
unsigned short int uint16_t
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
Class for time synchronization of RawReader instances.
void checkDictVersion(const CTFDictHeader &h) const
ctf::ANSHeader mANSVersion
std::string getPrefix() const
o2::utils::IRFrameSelector mIRFrameSelector
<<======================== Auxiliary classes =======================<<
static auto get(void *head)
cast arbitrary buffer head to container class. Head is supposed to respect the alignment
const H & getHeader() const
void print(const std::string &prefix="", int verbosity=1) const
print itself
static constexpr int getNBlocks()
EncodedBlocks< CTFHeader, N, uint32_t > base
static auto create(void *head, size_t sz)
create container from arbitrary buffer of predefined size (in bytes!!!). Head is supposed to respect ...
Static class with identifiers, bitmasks and names for ALICE detectors.
o2::ctf::CTFIOSize decode(const CTF::base &ec, VDIG &digitVec, VCHAN &channelVec)
entropy decode clusters from buffer with CTF
o2::ctf::CTFIOSize encode(VEC &buff, const gsl::span< const Digit > &digitVec, const gsl::span< const ChannelData > &channelVec)
entropy-encode digits to buffer with CTF
void createCoders(const std::vector< char > &bufVec, o2::ctf::CTFCoderBase::OpType op) final
CTFCoder(o2::ctf::CTFCoderBase::OpType op, const std::string &ctfdictOpt="none")
~CTFCoder() final=default
static const int16_t DEFAULT_AMP
static const int16_t DEFAULT_TIME
void setTriggers(uint8_t trgsig, uint8_t chanA, uint8_t chanC, int32_t aamplA, int32_t aamplC, int16_t atimeA, int16_t atimeC)
long check(o2::dataformats::IRFrame fr, size_t bwd=0, size_t fwd=0)
o2::fit::Triggers Triggers
struct o2::upgrades_utils::@478 fdd
Collision labels.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint16_t bc
bunch crossing ID of interaction
wrapper for the Entropy-encoded clusters of the TF
Intermediate, compressed but not yet entropy-encoded digits.
std::vector< int32_t > orbitInc
std::vector< uint8_t > feeBits
std::vector< int16_t > time
std::vector< uint8_t > trigger
std::vector< int16_t > charge
std::vector< int16_t > bcInc
std::vector< uint8_t > idChan
std::vector< uint8_t > nChan
std::vector< o2::mch::ChannelCode > cc
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))