Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ struct TPCZSHDR {
static constexpr unsigned int TPC_ZS_NBITS_V1 = 10;
static constexpr unsigned int TPC_ZS_NBITS_V2 = 12;

unsigned char version;
unsigned char version; // ZS format version:
// 1: original row-based format with 10-bit ADC values
// 2: original row-based format with 12-bit ADC values
// 3: improved link-based format with extra META header
unsigned char nTimeBins;
unsigned short cruID;
unsigned short timeOffset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ TPCTrackingDigitsPreCheck::precheckModifiedData TPCTrackingDigitsPreCheck::runPr
}
for (int j = 0; j < d->nTPCDigits[i]; j++) {
if (maxContTimeBin && d->tpcDigits[i][j].getTimeStamp() >= maxContTimeBin) {
static bool filterOutOfTF = getenv("TPC_WORKFLOW_FILTER_DIGITS_OUTSIDE_OF_TF") && atoi(getenv("TPC_WORKFLOW_FILTER_DIGITS_OUTSIDE_OF_TF"));
if (filterOutOfTF) {
continue;
}
throw std::runtime_error("Digit time bin exceeds time frame length");
}
if (updateDigits) {
Expand Down
4 changes: 2 additions & 2 deletions Detectors/TPC/workflow/src/ZSSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ DataProcessorSpec getZSEncoderSpec(std::vector<int> const& tpcSectors, bool outR
sizes.resize(NSectors * NEndpoints);
const auto* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(pc.inputs().getFirstValid(true));
o2::InteractionRecord ir{0, dh->firstTForbit};
o2::gpu::GPUReconstructionConvert::RunZSEncoder<o2::tpc::Digit, DigitArray>(inputs->inputDigits, &zsoutput, sizes.data(), nullptr, &ir, _GPUParam, true, verify, config.configReconstruction.tpc.zsThreshold);
o2::gpu::GPUReconstructionConvert::RunZSEncoder<DigitArray>(inputs->inputDigits, &zsoutput, sizes.data(), nullptr, &ir, _GPUParam, true, verify, config.configReconstruction.tpc.zsThreshold);
ZeroSuppressedContainer8kb* page = reinterpret_cast<ZeroSuppressedContainer8kb*>(zsoutput.get());
unsigned int offset = 0;
for (unsigned int i = 0; i < NSectors; i++) {
Expand Down Expand Up @@ -155,7 +155,7 @@ DataProcessorSpec getZSEncoderSpec(std::vector<int> const& tpcSectors, bool outR
writer.useCaching();
}
ir = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
o2::gpu::GPUReconstructionConvert::RunZSEncoder<o2::tpc::Digit>(inputs->inputDigits, nullptr, nullptr, &writer, &ir, _GPUParam, true, false, config.configReconstruction.tpc.zsThreshold);
o2::gpu::GPUReconstructionConvert::RunZSEncoder(inputs->inputDigits, nullptr, nullptr, &writer, &ir, _GPUParam, true, false, config.configReconstruction.tpc.zsThreshold);
writer.writeConfFile("TPC", "RAWDATA", fmt::format("{}tpcraw.cfg", outDir));
}
zsoutput.reset(nullptr);
Expand Down
2 changes: 1 addition & 1 deletion Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void convert(DigitArray& inputDigits, ProcessAttributes* processAttributes, o2::

o2::InteractionRecord ir = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
ir.bc = 0; // By convention the TF starts at BC = 0
o2::gpu::GPUReconstructionConvert::RunZSEncoder<o2::tpc::Digit>(inputDigits, nullptr, nullptr, &writer, &ir, mGPUParam, zs12bit, false, zsThreshold, processAttributes->padding);
o2::gpu::GPUReconstructionConvert::RunZSEncoder(inputDigits, nullptr, nullptr, &writer, &ir, mGPUParam, zs12bit, false, zsThreshold, processAttributes->padding);
}

int main(int argc, char** argv)
Expand Down
757 changes: 441 additions & 316 deletions GPU/GPUTracking/Base/GPUReconstructionConvert.cxx

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions GPU/GPUTracking/Base/GPUReconstructionConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,13 @@ class GPUReconstructionConvert
constexpr static unsigned int NSLICES = GPUCA_NSLICES;
static void ConvertNativeToClusterData(o2::tpc::ClusterNativeAccess* native, std::unique_ptr<GPUTPCClusterData[]>* clusters, unsigned int* nClusters, const TPCFastTransform* transform, int continuousMaxTimeBin = 0);
static void ConvertRun2RawToNative(o2::tpc::ClusterNativeAccess& native, std::unique_ptr<o2::tpc::ClusterNative[]>& nativeBuffer, const AliHLTTPCRawCluster** rawClusters, unsigned int* nRawClusters);
template <class T, class S>
template <class S>
static void RunZSEncoder(const S& in, std::unique_ptr<unsigned long long int[]>* outBuffer, unsigned int* outSizes, o2::raw::RawFileWriter* raw, const o2::InteractionRecord* ir, const GPUParam& param, bool zs12bit, bool verify, float threshold = 0.f, bool padding = false);
static void RunZSEncoderCreateMeta(const unsigned long long int* buffer, const unsigned int* sizes, void** ptrs, GPUTrackingInOutZS* out);
static void RunZSFilter(std::unique_ptr<o2::tpc::Digit[]>* buffers, const o2::tpc::Digit* const* ptrs, size_t* nsb, const size_t* ns, const GPUParam& param, bool zs12bit, float threshold);
static int GetMaxTimeBin(const o2::tpc::ClusterNativeAccess& native);
static int GetMaxTimeBin(const GPUTrackingInOutDigits& digits);
static int GetMaxTimeBin(const GPUTrackingInOutZS& zspages);

private:
static void ZSstreamOut(unsigned short* bufIn, unsigned int& lenIn, unsigned char* bufOut, unsigned int& lenOut, unsigned int nBits);
static void ZSfillEmpty(void* ptr, int shift, unsigned int feeId, int orbit);
};
} // namespace gpu
} // namespace GPUCA_NAMESPACE
Expand Down
7 changes: 6 additions & 1 deletion GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ std::pair<unsigned int, unsigned int> GPUChainTracking::TPCClusterizerDecodeZSCo
continue;
}
const TPCZSHDR* const hdr = (const TPCZSHDR*)(page + sizeof(o2::header::RAWDataHeader));
mCFContext->zsVersion = hdr->version;
nDigits += hdr->nADCsamples;
unsigned int timeBin = (hdr->timeOffset + (o2::raw::RDHUtils::getHeartBeatOrbit(*rdh) - firstHBF) * o2::constants::lhc::LHCMaxBunches) / LHCBCPERTIMEBIN;
if (timeBin + hdr->nTimeBins > mCFContext->tpcMaxTimeBin) {
Expand Down Expand Up @@ -524,7 +525,11 @@ int GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)

if (mIOPtrs.tpcZS) {
int firstHBF = (mIOPtrs.settingsTF && mIOPtrs.settingsTF->hasTfStartOrbit) ? mIOPtrs.settingsTF->tfStartOrbit : (mIOPtrs.tpcZS->slice[iSlice].count[0] && mIOPtrs.tpcZS->slice[iSlice].nZSPtr[0][0]) ? o2::raw::RDHUtils::getHeartBeatOrbit(*(const o2::header::RAWDataHeader*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[0][0]) : 0;
runKernel<GPUTPCCFDecodeZS, GPUTPCCFDecodeZS::decodeZS>(GetGridBlk(doGPU ? clusterer.mPmemory->counters.nPagesSubslice : GPUTrackingInOutZS::NENDPOINTS, lane), {iSlice}, {}, firstHBF);
if (mCFContext->zsVersion >= 1 || mCFContext->zsVersion <= 2) {
runKernel<GPUTPCCFDecodeZS, GPUTPCCFDecodeZS::decodeZS>(GetGridBlk(doGPU ? clusterer.mPmemory->counters.nPagesSubslice : GPUTrackingInOutZS::NENDPOINTS, lane), {iSlice}, {}, firstHBF);
} else {
GPUFatal("Data with invalid TPC ZS mode received");
}
TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mMemoryId, lane);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void GPUChainTracking::ConvertZSEncoder(bool zs12bit)
mIOMem.tpcZSmeta2.reset(new GPUTrackingInOutZS::GPUTrackingInOutZSMeta);
mIOMem.tpcZSmeta.reset(new GPUTrackingInOutZS);
o2::InteractionRecord ir{0, mIOPtrs.settingsTF && mIOPtrs.settingsTF->hasTfStartOrbit ? mIOPtrs.settingsTF->tfStartOrbit : 0u};
GPUReconstructionConvert::RunZSEncoder<o2::tpc::Digit>(*mIOPtrs.tpcPackedDigits, &mIOMem.tpcZSpages, &mIOMem.tpcZSmeta2->n[0][0], nullptr, &ir, param(), zs12bit, true);
GPUReconstructionConvert::RunZSEncoder(*mIOPtrs.tpcPackedDigits, &mIOMem.tpcZSpages, &mIOMem.tpcZSmeta2->n[0][0], nullptr, &ir, param(), zs12bit, true);
GPUReconstructionConvert::RunZSEncoderCreateMeta(mIOMem.tpcZSpages.get(), &mIOMem.tpcZSmeta2->n[0][0], &mIOMem.tpcZSmeta2->ptr[0][0], mIOMem.tpcZSmeta.get());
mIOPtrs.tpcZS = mIOMem.tpcZSmeta.get();
if (GetProcessingSettings().registerStandaloneInputMemory) {
Expand Down
1 change: 1 addition & 0 deletions GPU/GPUTracking/TPCClusterFinder/GPUTPCCFChainContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct GPUTPCCFChainContext {
unsigned char* zsDevice;
};

unsigned int zsVersion;
std::vector<FragmentData> fragmentData;
unsigned int nPagesTotal;
unsigned int nPagesSectorMax;
Expand Down