17#ifndef ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_SPLINESPEC_H
18#define ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_SPLINESPEC_H
25#if !defined(__CLING__) && !defined(G__ROOT) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC)
27#include <Vc/SimdArray>
44template <
typename DataT>
68#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
71 std::function<
void(
const double x[],
double f[])> F,
72 const int32_t nAuxiliaryDataPoints[] =
nullptr);
77#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
94 GPUd() static constexpr
size_t getParameterAlignmentBytes() {
return 16; }
97 GPUd()
int32_t getNumberOfParameters()
const {
return this->calcNumberOfParameters(
mYdim); }
100 GPUd() size_t getSizeOfParameters()
const {
return sizeof(DataT) * this->getNumberOfParameters(); }
106 GPUd()
int32_t getNumberOfParametersPerKnot()
const {
return calcNumberOfParametersPerKnot(
mYdim); }
139 return calcNumberOfParametersPerKnot(nYdim) * getNumberOfKnots();
145 return (1 <<
mXdim) * nYdim;
150#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
152 static int32_t test(const bool draw = 0, const bool drawDataPoints = 1);
160#if !defined(GPUCA_GPUCODE)
172#if !defined(GPUCA_GPUCODE)
192template <
typename DataT>
196 for (
int32_t dim = 0; dim < mXdim; dim++) {
197 int32_t n = mGrid[dim].getNumberOfKnots();
198 u[dim] = mGrid[dim].getKnot(iKnot %
n).getU();
203template <
typename DataT>
209 for (
int32_t dim = 1; dim < mXdim; dim++) {
210 n *= mGrid[dim - 1].getNumberOfKnots();
211 ind +=
n * iKnot[dim];
216template <
typename DataT>
218 setXrange(const DataT xMin[], const DataT xMax[])
222 mGrid[
i].setXrange(xMin[
i], xMax[
i]);
248template <
typename DataT,
int32_t XdimT,
int32_t YdimT,
int32_t SpecT>
255template <
typename DataT,
int32_t XdimT,
int32_t YdimT>
268 const auto nXdimTmp = SplineUtil::getNdim<XdimT>(mXdim);
269 const auto nXdim = nXdimTmp.get();
270 const auto maxXdimTmp = SplineUtil::getMaxNdim<XdimT>(mXdim);
271 DataT u[maxXdimTmp.get()];
273 u[
i] = mGrid[
i].convXtoU(
x[
i]);
275 interpolateAtU<SafetyLevel::kSafe>(mXdim, mYdim, mParameters, u,
S);
279 template <SafetyLevel SafeT = SafetyLevel::kSafe>
283 const auto nXdimTmp = SplineUtil::getNdim<XdimT>(mXdim);
284 const auto nXdim = nXdimTmp.get();
285 const auto maxXdimTmp = SplineUtil::getMaxNdim<XdimT>(mXdim);
286 const auto maxXdim = maxXdimTmp.get();
287 const auto nYdimTmp = SplineUtil::getNdim<YdimT>(mYdim);
288 const auto nYdim = nYdimTmp.get();
289 const auto maxYdimTmp = SplineUtil::getMaxNdim<XdimT>(mYdim);
290 const auto maxYdim = maxYdimTmp.get();
293 const auto nKnotParametersPerY = 1 << nXdim;
294 const auto nKnotParameters = (1 << nXdim) * nYdim;
296 DataT iParameters[(1 << (2 * maxXdim)) * maxYdim];
302 indices[
i] = mGrid[
i].getLeftKnotIndexForU(u[
i]);
306 for (
int32_t i = 0;
i < nKnotParametersPerY;
i++) {
307 for (
int32_t k = 0; k < nXdim; k++) {
308 indicestmp[k] =
indices[k] + (
i / (1 << k)) % 2;
312 for (
int32_t j = 0;
j < nKnotParameters;
j++) {
318 constexpr auto maxInterpolations = (1 << (2 * maxXdim - 2)) * maxYdim;
320 DataT S0[maxInterpolations];
321 DataT D0[maxInterpolations];
322 DataT S1[maxInterpolations];
323 DataT D1[maxInterpolations];
325 int32_t nInterpolations = (1 << (2 * nXdim - 2)) * nYdim;
329 DataT*
pointer[4] = {S0, D0, S1, D1};
332 int32_t pointernr = 2 * (
i % 2) + (
j % 2);
333 for (
int32_t k = 0; k < nYdim; k++) {
334 pointer[pointernr][0] = iParameters[(
i * nKnots +
j) * nYdim + k];
343 const GridXBase& gridX = *((
const GridXBase*)&(mGrid[
d]));
344 gridX.interpolateAtU(nInterpolations, knotL, S0, D0, S1, D1,
coordinate, iParameters);
345 nInterpolations /= 4;
350 S[
i] = iParameters[
i];
357 using TBase::mParameters;
367template <
typename DataT,
int32_t XdimT,
int32_t YdimT>
375#if !defined(GPUCA_GPUCODE)
388 recreate(nKnots, knotU);
393 TBase::cloneFromObject(
v,
nullptr);
398 TBase::recreate(XdimT, YdimT, nKnots);
404 TBase::recreate(XdimT, YdimT, nKnots, knotU);
417 template <SafetyLevel SafeT = SafetyLevel::kSafe>
421 TBase::template interpolateAtU<SafeT>(XdimT, YdimT,
Parameters, u,
S);
426#if !defined(GPUCA_GPUCODE)
427 using TBase::recreate;
429 using TBase::interpolateAtU;
436template <
typename DataT,
int32_t XdimT,
int32_t YdimT>
444#if !defined(GPUCA_GPUCODE)
451 this->recreate(nXdim, nYdim, nKnots);
458 this->recreate(nXdim, nYdim, nKnots, knotU);
464 cloneFromObject(
v,
nullptr);
470 checkDimensions(nXdim, nYdim);
471 TBase::recreate(nXdim, nYdim, nKnots);
477 checkDimensions(nXdim, nYdim);
478 TBase::recreate(nXdim, nYdim, nKnots, knotU);
485 using TBase::interpolateAtU;
490 if (XdimT > 0 && nXdim != XdimT) {
494 if (XdimT < 0 && nXdim > abs(XdimT)) {
502 if (YdimT > 0 && nYdim != YdimT) {
506 if (YdimT < 0 && nYdim > abs(YdimT)) {
520template <
typename DataT,
int32_t XdimT>
522 :
public SplineSpec<DataT, XdimT, 1, SplineUtil::getSpec(XdimT, 999)>
530 GPUd() DataT interpolate(const DataT
x[])
const
533 TBase::interpolate(
x, &
S);
539 using TBase::interpolate;
Definition of FlatObject class.
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 Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X coordinate
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 First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
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
Definition of Spline1D class.
char * releaseInternalBuffer()
_____________ Methods for making the data buffer external __________________________
static constexpr size_t getBufferAlignmentBytes()
Gives minimal alignment in bytes required for the flat buffer.
static constexpr size_t getClassAlignmentBytes()
GPUCA_GPUCODE.
Forward declaration — specializations below select ClassDefNV based on FlatBase.
GPUd() void setXrange(const DataT xMin[]
Set X range.
SplineContainer()=default
_____________ C++ constructors / destructors __________________________
GPUd() int32_t getXdimensions() const
_______________ Getters ________________________
int32_t mYdim
dimentionality of Y
GPUd() size_t getGridOffset(int32_t dimX) const
_______________ Technical stuff ________________________
~SplineContainer()=default
Destructor.
GPUd() int32_t getNumberOfKnots() const
Get a number of knots.
int32_t mNknots
number of spline knots
GPUd() size_t getSizeOfParameters() const
Size of the parameter array in bytes.
int32_t writeToFile(TFile &outf, const char *name)
_______________ IO ________________________
void cloneFromObject(const SplineContainer &obj, char *newFlatBufferPtr)
static SplineContainer * readFromFile(TFile &inpf, const char *name)
read a class object from the file
ClassDefNV(SplineContainer, 1)
(transient!!) F-dependent parameters of the spline
void moveBufferTo(char *newBufferPtr)
GPUd() static const expr int32_t getVersion()
_____________ Version control __________________________
void recreate(int32_t nXdim, int32_t nYdim, const int32_t nKnots[])
Constructor for a regular spline.
Spline1D< DataT > * mGrid
void setActualBufferAddress(char *actualFlatBufferPtr)
void setFutureBufferAddress(char *futureFlatBufferPtr)
GPUd() int32_t getNumberOfParametersPerKnot() const
Number of parameters per knot.
int32_t mXdim
_____________ Data members ____________
GPUd() const Spline1D< DataT > &getGrid(int32_t dimX) const
Get 1-D grid for dimX dimension.
DataT * mParameters
(transient!!) mXdim grids
GPUd() int32_t getNumberOfParameters() const
Number of parameters.
void print() const
Print method.
GPUd() int32_t getYdimensions() const
Get number of Y dimensions.
SplineContainer(const SplineContainer &)=delete
Disable all other constructors.
void approximateFunction(const double xMin[], const double xMax[], std::function< void(const double x[], double f[])> F, const int32_t nAuxiliaryDataPoints[]=nullptr)
_______________ Construction interface ________________________
GPUd() const DataT *getParameters() const
Get spline parameters const.
GPUd() int32_t calcNumberOfParametersPerKnot(int32_t nYdim) const
Number of parameters per knot.
GPUd() static const expr size_t getParameterAlignmentBytes()
Get minimal required alignment for the spline parameters.
GPUd() DataT interpolate(const DataT x[]) const
Simplified interface for 1D: return the interpolated value.
GPUd() void interpolate(const DataT x[]
_______________ Interpolation math ________________________
GPUd() void interpolateAtU(int32_t inpXdim
Get interpolated value for S(u):inpXdim->inpYdim using spline parameters Parameters.
GPUd() const expr int32_t getYdimensions() const
Get number of Y dimensions.
void recreate(const int32_t nKnots[], const int32_t *const knotU[])
Constructor for an irregular spline.
SplineSpec()
Default constructor.
GPUd() void interpolateAtU(GPUgeneric() const DataT Parameters[]
_______ Expert tools: interpolation with given nYdim and external Parameters _______
GPUd() const expr int32_t getXdimensions() const
Get number of X dimensions.
SplineSpec(const int32_t nKnots[])
Constructor for a regular spline.
SplineSpec(const SplineSpec &v)
Copy constructor.
void recreate(const int32_t nKnots[])
Constructor for a regular spline.
SplineSpec(const int32_t nKnots[], const int32_t *const knotU[])
Constructor for an irregular spline.
SplineSpec(int32_t nXdim, int32_t nYdim, const int32_t nKnots[])
Constructor for a regular spline.
SplineSpec(const SplineSpec &v)
Copy constructor.
void recreate(int32_t nXdim, int32_t nYdim, const int32_t nKnots[], const int32_t *const knotU[])
Constructor for an irregular spline.
SplineSpec(int32_t nXdim, int32_t nYdim, const int32_t nKnots[], const int32_t *const knotU[])
Constructor for an irregular spline.
SplineSpec()
Default constructor.
void recreate(int32_t nXdim, int32_t nYdim, const int32_t nKnots[])
Constructor for a regular spline.
void checkDimensions(int32_t &nXdim, int32_t &nYdim)
Check dimensions.
static constexpr int32_t getSpec(int32_t nXdim, int32_t nYdim)
GLuint const GLchar * name
GLsizei GLenum const void * indices
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)