17#ifndef ALICEO2_GPU_TPCFastTransformPOD_H
18#define ALICEO2_GPU_TPCFastTransformPOD_H
104 GPUd()
float convDeltaZtoDeltaTimeInTimeFrameAbs(
float deltaZ)
const;
126 GPUd()
long int getTimeStamp()
const {
return mTimeStamp; }
150 GPUd()
void setTimeStamp(
long int v) { mTimeStamp =
v; }
217#if !defined(GPUCA_GPUCODE)
227 std::memcpy(destVector.
get(), &
src,
src.size());
228 return destVector.
get();
251#if !defined(GPUCA_GPUCODE)
252 static constexpr size_t AlignmentBytes = 8;
253 static size_t alignOffset(
size_t offs)
255 auto res = offs % AlignmentBytes;
256 return res ? offs + (AlignmentBytes -
res) : offs;
262 GPUd()
const char* getThis()
const {
return reinterpret_cast<const char*
>(
this); }
265 GPUd() size_t getScenarioOffset(
int s)
const {
return (
reinterpret_cast<const size_t*
>(getThis() + mOffsScenariosOffsets))[
s]; }
267 GPUd() size_t getFlatBufferOffset(
int s)
const {
return (
reinterpret_cast<const size_t*
>(getThis() + mOffsFlatBufferOffsets))[
s]; }
273 const size_t* offs =
reinterpret_cast<const size_t*
>(getThis() + mOffsFlatBufferOffsets);
274 return getThis() + offs[isc];
280 template <
typename SplineT>
283 const size_t g1sz = spline.getGridX1().getFlatBufferSize();
284 const size_t g2align = spline.getGridX2().getBufferAlignmentBytes();
288 bool mApplyCorrection{};
289 int mNumberOfScenarios{};
291 size_t mOffsScenariosOffsets{};
292 size_t mOffsFlatBufferOffsets{};
294 long int mTimeStamp{};
300 TPCFastTransformGeoPOD mGeo;
303 ClassDefNV(TPCFastTransformPOD, 0);
308 const auto&
info = getRowInfo(
row);
310 const SplineType& spline = getSplineForRow(
row);
311 const float* splineData = getCorrectionData(
sector,
row);
316 const char* g1buf = getSplineFlatBuffer(isc);
317 const char* g2buf = getGridX2FlatBuffer(spline, isc);
320 spline.interpolateAtUZeroCopy(g1buf, g2buf, splineData, u,
v, dxyz);
322 if (CAMath::Abs(dxyz[0]) > TPCFastSpaceChargeCorrection::kMaxCorrection || CAMath::Abs(dxyz[1]) > TPCFastSpaceChargeCorrection::kMaxCorrection || CAMath::Abs(dxyz[2]) > TPCFastSpaceChargeCorrection::kMaxCorrection) {
333 const auto&
info = getRowInfo(
row);
335 convRealLocalToGrid(
sector,
row, realY, realZ, u,
v,
s);
338 const auto& spline = getSplineInvXforRow(
row);
339 const char* g1buf = getSplineFlatBuffer(isc);
340 const char* g2buf = getGridX2FlatBuffer(spline, isc);
343 spline.interpolateAtUZeroCopy(g1buf, g2buf, getCorrectionDataInvX(
sector,
row), u,
v, &dx);
344 if (CAMath::Abs(dx) > TPCFastSpaceChargeCorrection::kMaxCorrection) {
354 convRealLocalToGrid(
sector,
row, realY, realZ, u,
v,
s);
355 const auto&
info = getRowInfo(
row);
357 const auto& spline = getSplineInvYZforRow(
row);
358 const char* g1buf = getSplineFlatBuffer(isc);
359 const char* g2buf = getGridX2FlatBuffer(spline, isc);
362 spline.interpolateAtUZeroCopy(g1buf, g2buf, getCorrectionDataInvYZ(
sector,
row), u,
v, dyz);
363 if (CAMath::Abs(dyz[0]) > TPCFastSpaceChargeCorrection::kMaxCorrection || CAMath::Abs(dyz[1]) > TPCFastSpaceChargeCorrection::kMaxCorrection) {
374 const SplineType& spline = getSplineForRow(
row);
375 getRowInfo(
row).gridMeasured.convLocalToGridUntruncated(
sector,
y,
z, u,
v,
s);
377 u = GPUCommonMath::Clamp(u, 0.f, (
float)spline.getGridX1().getUmax());
378 v = GPUCommonMath::Clamp(
v, 0.f, (
float)spline.getGridX2().getUmax());
384 getRowInfo(
row).gridMeasured.convGridToLocal(
sector, gridU, gridV,
y,
z);
390 const SplineType& spline = getSplineForRow(
row);
391 getRowInfo(
row).gridReal.convLocalToGridUntruncated(
sector,
y,
z, u,
v,
s);
393 u = GPUCommonMath::Clamp(u, 0.f, (
float)spline.getGridX1().getUmax());
394 v = GPUCommonMath::Clamp(
v, 0.f, (
float)spline.getGridX2().getUmax());
400 getRowInfo(
row).gridReal.convGridToLocal(
sector, gridU, gridV,
y,
z);
407 getRowInfo(
row).gridMeasured.convLocalToGridUntruncated(
sector,
y,
z, u,
v,
s);
408 const auto& spline = getSplineForRow(
row);
410 if (u < 0.f || u > (
float)spline.getGridX1().getUmax() ||
411 v < 0.f || v > (
float)spline.getGridX2().getUmax()) {
421 getRowInfo(
row).gridReal.convLocalToGridUntruncated(
sector,
y,
z, u,
v,
s);
422 const auto& spline = getSplineForRow(
row);
424 if (u < 0.f || u > (
float)spline.getGridX1().getUmax() ||
425 v < 0.f || v > (
float)spline.getGridX2().getUmax()) {
433 if (!mApplyCorrection) {
440 float lx =
x, ly =
y, lz =
z;
442 getGeometry().convLocalToGlobal(
sector, lx, ly, lz, gx, gy, gz);
447 InverseTransformYZtoX(
sector,
row, lyT, lzT, invYZtoX);
451 InverseTransformYZtoNominalYZ(
sector,
row, lyT, lzT, YZtoNominalY, YZtoNominalZ);
453 o2::utils::DebugStreamer::instance()->getStreamer(
"debug_fasttransform",
"UPDATE") << o2::utils::DebugStreamer::instance()->getUniqueTreeName(
"tree_Transform").data()
473 <<
"invYZtoX=" << invYZtoX
474 <<
"YZtoNominalY=" << YZtoNominalY
475 <<
"YZtoNominalZ=" << YZtoNominalZ
492 x = getGeometry().getRowInfoX(
row);
505 float l = (
time - mT0 - maxTimeBin) * mVdrift;
506 z = getGeometry().convDriftLengthToZ(
sector, l);
517 x = getGeometry().getRowInfoX(
row);
518 convPadTimeToLocalInTimeFrame(
sector,
row, pad,
time,
y,
z, maxTimeBin);
524 convLocalToPadTimeInTimeFrame(
sector,
row,
y,
z, pad,
time, maxTimeBin);
530 InverseTransformInTimeFrame(
sector, 0, 0, 0,
z, pad,
time, maxTimeBin);
543 float l = (
time - mT0 - vertexTime) * mVdrift;
544 z = getGeometry().convDriftLengthToZ(
sector, l);
556 x = getGeometry().getRowInfoX(
row);
557 float driftLength = (
time - mT0 - vertexTime) * mVdrift;
558 getGeometry().convPadDriftLengthToLocal(
sector,
row, pad, driftLength,
y,
z);
570 float v = (
time - mT0 - maxTimeBin) * mVdrift;
571 float z = (
sector < getGeometry().getNumberOfSectorsA()) ? -
v :
v;
578 float v = (
sector < getGeometry().getNumberOfSectorsA()) ? -
z :
z;
579 return mT0 + maxTimeBin +
v / mVdrift;
584 float deltaZ = deltaTime * mVdrift;
585 return sector < getGeometry().getNumberOfSectorsA() ? -deltaZ : deltaZ;
588GPUdi()
float TPCFastTransformPOD::convDeltaZtoDeltaTimeInTimeFrameAbs(
float deltaZ)
const
590 return deltaZ / mVdrift;
595 float deltaT = deltaZ / mVdrift;
596 return sector < getGeometry().getNumberOfSectorsA() ? -deltaT : deltaT;
602 return convDriftLengthToTime(getGeometry().getTPCzLength(), 0.f);
608 return convDriftLengthToTime(getGeometry().getTPCzLength(), 0.f);
614 return convDriftLengthToTime(getGeometry().getTPCzLength(), 0.f);
621 dx = getCorrectionXatRealYZ(
sector,
row, realY, realZ);
622 realX = getGeometry().getRowInfoX(
row) + dx;
625 o2::utils::DebugStreamer::instance()->getStreamer(
"debug_fasttransform",
"UPDATE") << o2::utils::DebugStreamer::instance()->getUniqueTreeName(
"tree_InverseTransformYZtoX").data()
635GPUdi()
void TPCFastTransformPOD::InverseTransformYZtoNominalYZ(
int32_t sector,
int32_t row,
float realY,
float realZ,
float& measuredY,
float& measuredZ)
const
639 getCorrectionYZatRealYZ(
sector,
row, realY, realZ, dy, dz);
640 measuredY = realY - dy;
641 measuredZ = realZ - dz;
644 o2::utils::DebugStreamer::instance()->getStreamer(
"debug_fasttransform",
"UPDATE") << o2::utils::DebugStreamer::instance()->getUniqueTreeName(
"tree_InverseTransformYZtoNominalYZ").data()
647 <<
"real y=" << realY
648 <<
"real z=" << realZ
649 <<
"measured y=" << measuredY
650 <<
"measured z=" << measuredZ
657 float l = (
time - mT0 - vertexTime) * mVdrift;
658 getGeometry().convPadDriftLengthToLocal(
sector,
row, pad, l,
y,
z);
663 float l = getGeometry().getTPCzLength() + (
time - mT0 - maxTimeBin) * mVdrift;
664 getGeometry().convPadDriftLengthToLocal(
sector,
row, pad, l,
y,
z);
671 time = convDriftLengthToTime(
length, maxTimeBin);
674GPUdi()
float TPCFastTransformPOD::convDriftLengthToTime(
float driftLength,
float vertexTime)
const
676 return (mT0 + vertexTime + driftLength / mVdrift);
679GPUdi()
float TPCFastTransformPOD::convZOffsetToVertexTime(
int32_t sector,
float zOffset,
float maxTimeBin)
const
681 if (
sector < getGeometry().getNumberOfSectorsA()) {
682 return maxTimeBin - (getGeometry().getTPCzLength() + zOffset) / mVdrift;
684 return maxTimeBin - (getGeometry().getTPCzLength() - zOffset) / mVdrift;
688GPUdi()
float TPCFastTransformPOD::convVertexTimeToZOffset(
int32_t sector,
float vertexTime,
float maxTimeBin)
const
690 if (
sector < getGeometry().getNumberOfSectorsA()) {
691 return (maxTimeBin - vertexTime) * mVdrift - getGeometry().getTPCzLength();
693 return -((maxTimeBin - vertexTime) * mVdrift - getGeometry().getTPCzLength());
697#ifndef GPUCA_GPUCODE_DEVICE
698GPUdi()
void TPCFastTransformPOD::setCalibration(
int64_t timeStamp,
float t0,
float vDrift)
700 mTimeStamp = timeStamp;
709 if (row2 >= getGeometry().getNumberOfRows()) {
714 nx1 = getGeometry().getRowInfoX(
row);
715 nx2 = getGeometry().getRowInfoX(row2);
716 InverseTransformYZtoNominalYZ(
sector,
row,
y,
z, ny1, nz1);
717 InverseTransformYZtoNominalYZ(
sector, row2,
y,
z, ny2, nz2);
718 float c1 = (nx2 - nx) / (nx2 - nx1);
719 float c2 = (nx - nx1) / (nx2 - nx1);
721 ny = (ny1 * c1 + ny2 * c2);
722 nz = (nz1 * c1 + nz2 * c2);
#define GPUCA_DEBUG_STREAMER_CHECK(...)
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
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
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 bool
configStandalone Reconstruction rec_tpc float
static constexpr size_t alignSize(size_t sizeBytes, size_t alignmentBytes)
_______________ Generic utilities _______________________________________________
Forward declaration — specializations below select ClassDefNV based on FlatBase.
SlimSplineTypeXYZ SlimSplineType
Spline2D< float, 2, NoFlatObject > SlimSplineTypeInvYZ
Spline2D< float, 3, NoFlatObject > SlimSplineTypeXYZ
Slim variants (NoFlatObject base) for use in TPCFastTransformPOD.
Spline2D< float, 1, NoFlatObject > SlimSplineTypeInvX
GLuint GLsizei GLsizei * length
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
GLdouble GLdouble GLdouble z
constexpr unsigned int NROWS
@ streamFastTransform
stream tpc fast transform
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...