Skip to content

Commit cbf166f

Browse files
matthias-kleinerdavidrohr
authored andcommitted
removing remaining pointers and classdef from TPCFastTransformPOD
1 parent f7b143e commit cbf166f

File tree

17 files changed

+603
-738
lines changed

17 files changed

+603
-738
lines changed

Detectors/TPC/workflow/src/TPCScalerSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class TPCScalerSpec : public Task
220220
Output corrMapOutput{header::gDataOriginTPC, "TPCCORRMAP", 0};
221221
auto outputBuffer = o2::pmr::vector<char>(pc.outputs().getMemoryResource(corrMapOutput));
222222
outputBuffer.resize(TPCFastTransformPOD::estimateSize(finalMap.getCorrection()));
223-
auto* pod = TPCFastTransformPOD::create(outputBuffer.data(), outputBuffer.size(), finalMap.getCorrection());
223+
auto* pod = TPCFastTransformPOD::create(outputBuffer.data(), outputBuffer.size(), finalMap);
224224
const auto& vd = mTPCVDriftHelper.getVDriftObject();
225225
o2::tpc::TPCFastTransformHelperO2::instance()->updateCalibration(*pod, 0, vd.corrFact, vd.refVDrift, vd.getTimeOffset());
226226
pc.outputs().adoptContainer(corrMapOutput, std::move(outputBuffer));

GPU/GPUTracking/SectorTracker/GPUTPCTrackletConstructor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class GPUTPCTrackletConstructor : public GPUKernelTemplate
6363

6464
struct GPUSharedMemory {
6565
GPUCA_SHARED_STORAGE(GPUTPCRow mRows[GPUTPCGeometry::NROWS]); // rows
66-
uint32_t mNStartHits; // Total number of start hits
66+
uint32_t mNStartHits; // Total number of start hits
6767

6868
#ifdef GPUCA_TRACKLET_CONSTRUCTOR_DO_PROFILE
6969
int32_t fMaxSync; // temporary shared variable during profile creation

GPU/TPCFastTransformation/Spline.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ class Spline
8181
typedef SplineSpec<DataT, XdimT, YdimT, SplineUtil::getSpec(XdimT, YdimT)> TBase;
8282

8383
public:
84-
typedef typename TVeryBase::SafetyLevel SafetyLevel;
85-
typedef typename TVeryBase::Knot Knot;
84+
using KnotType = Knot<DataT>;
8685

8786
#if !defined(GPUCA_GPUCODE)
8887
using TBase::TBase; // inherit constructors

GPU/TPCFastTransformation/Spline1D.h

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,24 +140,19 @@ class Spline1DBase
140140
: public Spline1DSpec<DataT, YdimT, SplineUtil::getSpec(YdimT), FlatBase>
141141
{
142142
protected:
143-
typedef Spline1DContainerBase<DataT, FlatBase> TVeryBase;
144-
typedef Spline1DSpec<DataT, YdimT, SplineUtil::getSpec(YdimT), FlatBase> TBase;
143+
using Container = Spline1DContainer<DataT, FlatBase>;
144+
using ParentSpec = Spline1DSpec<DataT, YdimT, SplineUtil::getSpec(YdimT), FlatBase>;
145145

146146
public:
147-
typedef typename TVeryBase::SafetyLevel SafetyLevel;
148-
typedef typename TVeryBase::Knot Knot;
149-
150147
#if !defined(GPUCA_GPUCODE)
151-
using TBase::TBase; // inherit constructors
152-
153148
Spline1DBase() = default;
154-
Spline1DBase(const Spline1DBase& v) : TBase(v)
149+
Spline1DBase(const Spline1DBase& v) : ParentSpec(v)
155150
{
156-
static_cast<TVeryBase*>(this)->cloneFromObject(v, nullptr);
151+
static_cast<Container*>(this)->cloneFromObject(v, nullptr);
157152
}
158153
Spline1DBase& operator=(const Spline1DBase& v)
159154
{
160-
static_cast<TVeryBase*>(this)->cloneFromObject(v, nullptr);
155+
static_cast<Container*>(this)->cloneFromObject(v, nullptr);
161156
return *this;
162157
}
163158
#else
@@ -168,7 +163,7 @@ class Spline1DBase
168163
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
169164
static Spline1DBase* readFromFile(TFile& inpf, const char* name)
170165
{
171-
return (Spline1DBase*)TVeryBase::readFromFile(inpf, name);
166+
return (Spline1DBase*)Container::readFromFile(inpf, name);
172167
}
173168
#endif
174169
};
@@ -182,11 +177,10 @@ template <typename DataT, int32_t YdimT>
182177
class Spline1D<DataT, YdimT, FlatObject> : public Spline1DBase<DataT, YdimT, FlatObject>
183178
{
184179
public:
185-
using Spline1DBase<DataT, YdimT, FlatObject>::Spline1DBase;
186180
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
187181
static Spline1D* readFromFile(TFile& inpf, const char* name)
188182
{
189-
return (Spline1D*)Spline1DContainerBase<DataT, FlatObject>::readFromFile(inpf, name);
183+
return (Spline1D*)Spline1DContainer<DataT, FlatObject>::readFromFile(inpf, name);
190184
}
191185
#endif
192186
ClassDefNV(Spline1D, 0);
@@ -196,8 +190,6 @@ class Spline1D<DataT, YdimT, FlatObject> : public Spline1DBase<DataT, YdimT, Fla
196190
template <typename DataT, int32_t YdimT>
197191
class Spline1D<DataT, YdimT, NoFlatObject> : public Spline1DBase<DataT, YdimT, NoFlatObject>
198192
{
199-
public:
200-
using Spline1DBase<DataT, YdimT, NoFlatObject>::Spline1DBase;
201193
};
202194

203195
} // namespace gpu

GPU/TPCFastTransformation/Spline1DHelper.cxx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int32_t Spline1DHelper<DataT>::storeError(int32_t code, const char* msg)
5050
}
5151

5252
template <typename DataT>
53-
void Spline1DHelper<DataT>::getScoefficients(const typename Spline1D<double>::Knot& knotL, double u,
53+
void Spline1DHelper<DataT>::getScoefficients(const typename Spline1D<double>::KnotType& knotL, double u,
5454
double& cSl, double& cDl, double& cSr, double& cDr)
5555
{
5656
/// Get derivatives of the interpolated value {S(u): 1D -> nYdim} at the segment [knotL, next knotR]
@@ -70,7 +70,7 @@ void Spline1DHelper<DataT>::getScoefficients(const typename Spline1D<double>::Kn
7070
}
7171

7272
template <typename DataT>
73-
void Spline1DHelper<DataT>::getDScoefficients(const typename Spline1D<double>::Knot& knotL, double u,
73+
void Spline1DHelper<DataT>::getDScoefficients(const typename Spline1D<double>::KnotType& knotL, double u,
7474
double& cSl, double& cDl, double& cSr, double& cDr)
7575
{
7676
u = u - knotL.u;
@@ -86,7 +86,7 @@ void Spline1DHelper<DataT>::getDScoefficients(const typename Spline1D<double>::K
8686
}
8787

8888
template <typename DataT>
89-
void Spline1DHelper<DataT>::getDDScoefficients(const typename Spline1D<double>::Knot& knotL, double u,
89+
void Spline1DHelper<DataT>::getDDScoefficients(const typename Spline1D<double>::KnotType& knotL, double u,
9090
double& cSl, double& cDl, double& cSr, double& cDr)
9191
{
9292
u = u - knotL.u;
@@ -99,7 +99,7 @@ void Spline1DHelper<DataT>::getDDScoefficients(const typename Spline1D<double>::
9999
}
100100

101101
template <typename DataT>
102-
void Spline1DHelper<DataT>::getDDScoefficientsLeft(const typename Spline1D<double>::Knot& knotL,
102+
void Spline1DHelper<DataT>::getDDScoefficientsLeft(const typename Spline1D<double>::KnotType& knotL,
103103
double& cSl, double& cDl, double& cSr, double& cDr)
104104
{
105105
double dv = double(knotL.Li);
@@ -110,7 +110,7 @@ void Spline1DHelper<DataT>::getDDScoefficientsLeft(const typename Spline1D<doubl
110110
}
111111

112112
template <typename DataT>
113-
void Spline1DHelper<DataT>::getDDScoefficientsRight(const typename Spline1D<double>::Knot& knotL,
113+
void Spline1DHelper<DataT>::getDDScoefficientsRight(const typename Spline1D<double>::KnotType& knotL,
114114
double& cSl, double& cDl, double& cSr, double& cDr)
115115
{
116116
double dv = double(knotL.Li);
@@ -121,7 +121,7 @@ void Spline1DHelper<DataT>::getDDScoefficientsRight(const typename Spline1D<doub
121121
}
122122

123123
template <typename DataT>
124-
void Spline1DHelper<DataT>::getDDDScoefficients(const typename Spline1D<double>::Knot& knotL,
124+
void Spline1DHelper<DataT>::getDDDScoefficients(const typename Spline1D<double>::KnotType& knotL,
125125
double& cSl, double& cDl, double& cSr, double& cDr)
126126
{
127127
double dv = double(knotL.Li);
@@ -133,7 +133,7 @@ void Spline1DHelper<DataT>::getDDDScoefficients(const typename Spline1D<double>:
133133

134134
template <typename DataT>
135135
void Spline1DHelper<DataT>::approximateDataPoints(
136-
Spline1DContainerBase<DataT, FlatObject>& spline,
136+
Spline1DContainer<DataT, FlatObject>& spline,
137137
double xMin, double xMax,
138138
const double vx[], const double vf[], int32_t nDataPoints)
139139
{
@@ -155,7 +155,7 @@ void Spline1DHelper<DataT>::approximateDataPoints(
155155
for (int32_t iPoint = 0; iPoint < nDataPoints; ++iPoint) {
156156
double u = mSpline.convXtoU(vx[iPoint]);
157157
int32_t iKnot = mSpline.getLeftKnotIndexForU(u);
158-
const typename Spline1D<double>::Knot& knot0 = mSpline.getKnot(iKnot);
158+
const typename Spline1D<double>::KnotType& knot0 = mSpline.getKnot(iKnot);
159159
double cS0, cZ0, cS1, cZ1;
160160
getScoefficients(knot0, u, cS0, cZ0, cS1, cZ1);
161161
double c[4] = {cS0, cZ0, cS1, cZ1};
@@ -177,9 +177,9 @@ void Spline1DHelper<DataT>::approximateDataPoints(
177177
}
178178

179179
for (int32_t iKnot = 0; iKnot < spline.getNumberOfKnots() - 2; ++iKnot) {
180-
const typename Spline1D<double>::Knot& knot0 = mSpline.getKnot(iKnot);
181-
const typename Spline1D<double>::Knot& knot1 = mSpline.getKnot(iKnot + 1);
182-
// const typename Spline1D<double>::Knot& knot2 = mSpline.getKnot(iKnot + 2);
180+
const typename Spline1D<double>::KnotType& knot0 = mSpline.getKnot(iKnot);
181+
const typename Spline1D<double>::KnotType& knot1 = mSpline.getKnot(iKnot + 1);
182+
// const typename Spline1D<double>::KnotType& knot2 = mSpline.getKnot(iKnot + 2);
183183

184184
// set S'' and S''' at knot1 equal at both sides
185185
// chi2 += w^2*(S''from the left - S'' from the right)^2
@@ -215,8 +215,8 @@ void Spline1DHelper<DataT>::approximateDataPoints(
215215
// experimental: set slopes at neighbouring knots equal - doesn't work
216216
/*
217217
for (int32_t iKnot = 0; iKnot < spline.getNumberOfKnots() - 2; ++iKnot) {
218-
const typename Spline1D<double>::Knot& knot0 = mSpline.getKnot(iKnot);
219-
const typename Spline1D<double>::Knot& knot1 = mSpline.getKnot(iKnot + 1);
218+
const typename Spline1D<double>::KnotType& knot0 = mSpline.getKnot(iKnot);
219+
const typename Spline1D<double>::KnotType& knot1 = mSpline.getKnot(iKnot + 1);
220220
double w = 1.;
221221
int32_t i = 2 * iKnot; // index of parameter S0
222222
double d = knot1.u - knot0.u;
@@ -246,7 +246,7 @@ void Spline1DHelper<DataT>::approximateDataPoints(
246246

247247
template <typename DataT>
248248
void Spline1DHelper<DataT>::approximateDerivatives(
249-
Spline1DContainerBase<DataT, FlatObject>& spline,
249+
Spline1DContainer<DataT, FlatObject>& spline,
250250
const double vx[], const double vf[], int32_t nDataPoints)
251251
{
252252
/// Create best-fit spline parameters for a given input function F
@@ -265,7 +265,7 @@ void Spline1DHelper<DataT>::approximateDerivatives(
265265
for (int32_t iPoint = 0; iPoint < nDataPoints; ++iPoint) {
266266
double u = mSpline.convXtoU(vx[iPoint]);
267267
int32_t iKnot = mSpline.getLeftKnotIndexForU(u);
268-
const typename Spline1D<double>::Knot& knot0 = mSpline.getKnot(iKnot);
268+
const typename Spline1D<double>::KnotType& knot0 = mSpline.getKnot(iKnot);
269269
double cS0, cZ0, cS1, cZ1;
270270
getScoefficients(knot0, u, cS0, cZ0, cS1, cZ1);
271271
double c[2] = {cZ0, cZ1};
@@ -298,7 +298,7 @@ void Spline1DHelper<DataT>::approximateDerivatives(
298298
}
299299

300300
template <typename DataT>
301-
void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<DataT, FlatObject>& spline,
301+
void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainer<DataT, FlatObject>& spline,
302302
double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F)
303303
{
304304
/// Create classic spline parameters for a given input function F
@@ -322,7 +322,7 @@ void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<Dat
322322

323323
// second derivative at knot0 is 0
324324
{
325-
const typename Spline1D<DataT>::Knot& knot0 = spline.getKnot(0);
325+
const typename Spline1D<DataT>::KnotType& knot0 = spline.getKnot(0);
326326
double cZ0 = (-4) * knot0.Li;
327327
double cZ1 = (-2) * knot0.Li;
328328
// f''(u) = cS1*(f1-f0) + cZ0*z0 + cZ1*z1;
@@ -332,7 +332,7 @@ void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<Dat
332332

333333
// second derivative at knot nKnots-1 is 0
334334
{
335-
const typename Spline1D<DataT>::Knot& knot0 = spline.getKnot(nKnots - 2);
335+
const typename Spline1D<DataT>::KnotType& knot0 = spline.getKnot(nKnots - 2);
336336
double cZ0 = (6 - 4) * knot0.Li;
337337
double cZ1 = (6 - 2) * knot0.Li;
338338
// f''(u) = cS1*(f1-f0) + cZ0*z0 + cZ1*z1;
@@ -342,12 +342,12 @@ void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<Dat
342342

343343
// second derivative at other knots is same from the left and from the right
344344
for (int32_t i = 1; i < nKnots - 1; i++) {
345-
const typename Spline1D<DataT>::Knot& knot0 = spline.getKnot(i - 1);
345+
const typename Spline1D<DataT>::KnotType& knot0 = spline.getKnot(i - 1);
346346
double cZ0 = (6 - 4) * knot0.Li;
347347
double cZ1_0 = (6 - 2) * knot0.Li;
348348
// f''(u) = cS1*(f1-f0) + cZ0*z0 + cZ1*z1;
349349

350-
const typename Spline1D<DataT>::Knot& knot1 = spline.getKnot(i);
350+
const typename Spline1D<DataT>::KnotType& knot1 = spline.getKnot(i);
351351
double cZ1_1 = (-4) * knot1.Li;
352352
double cZ2 = (-2) * knot1.Li;
353353
// f''(u) = cS2*(f2-f1) + cZ1_1*z1 + cZ2*z2;
@@ -367,7 +367,7 @@ void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<Dat
367367
double uToXscale = (((double)xMax) - xMin) / spline.getUmax();
368368

369369
for (int32_t i = 0; i < nKnots; ++i) {
370-
const typename Spline1D<DataT>::Knot& knot = spline.getKnot(i);
370+
const typename Spline1D<DataT>::KnotType& knot = spline.getKnot(i);
371371
double u = knot.u;
372372
double f[Ndim];
373373
F(xMin + u * uToXscale, f);
@@ -382,7 +382,7 @@ void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<Dat
382382
{
383383
double f0 = parameters[(2 * 0) * Ndim + dim];
384384
double f1 = parameters[(2 * 1) * Ndim + dim];
385-
const typename Spline1D<DataT>::Knot& knot0 = spline.getKnot(0);
385+
const typename Spline1D<DataT>::KnotType& knot0 = spline.getKnot(0);
386386
double cS1 = (6) * knot0.Li * knot0.Li;
387387
// f''(u) = cS1*(f1-f0) + cZ0*z0 + cZ1*z1;
388388
b(0) = -cS1 * (f1 - f0);
@@ -392,7 +392,7 @@ void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<Dat
392392
{
393393
double f0 = parameters[2 * (nKnots - 2) * Ndim + dim];
394394
double f1 = parameters[2 * (nKnots - 1) * Ndim + dim];
395-
const typename Spline1D<DataT>::Knot& knot0 = spline.getKnot(nKnots - 2);
395+
const typename Spline1D<DataT>::KnotType& knot0 = spline.getKnot(nKnots - 2);
396396
double cS1 = (6 - 12) * knot0.Li * knot0.Li;
397397
// f''(u) = cS1*(f1-f0) + cZ0*z0 + cZ1*z1;
398398
b(nKnots - 1) = -cS1 * (f1 - f0);
@@ -403,11 +403,11 @@ void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<Dat
403403
double f0 = parameters[2 * (i - 1) * Ndim + dim];
404404
double f1 = parameters[2 * (i)*Ndim + dim];
405405
double f2 = parameters[2 * (i + 1) * Ndim + dim];
406-
const typename Spline1D<DataT>::Knot& knot0 = spline.getKnot(i - 1);
406+
const typename Spline1D<DataT>::KnotType& knot0 = spline.getKnot(i - 1);
407407
double cS1 = (6 - 12) * knot0.Li * knot0.Li;
408408
// f''(u) = cS1*(f1-f0) + cZ0*z0 + cZ1*z1;
409409

410-
const typename Spline1D<DataT>::Knot& knot1 = spline.getKnot(i);
410+
const typename Spline1D<DataT>::KnotType& knot1 = spline.getKnot(i);
411411
double cS2 = (6) * knot1.Li * knot1.Li;
412412
// f''(u) = cS2*(f2-f1) + cZ1_1*z1 + cZ2*z2;
413413
b(i) = -cS1 * (f1 - f0) + cS2 * (f2 - f1);
@@ -422,7 +422,7 @@ void Spline1DHelper<DataT>::approximateFunctionClassic(Spline1DContainerBase<Dat
422422

423423
template <typename DataT>
424424
void Spline1DHelper<DataT>::makeDataPoints(
425-
Spline1DContainerBase<DataT, FlatObject>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
425+
Spline1DContainer<DataT, FlatObject>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
426426
int32_t nAuxiliaryDataPoints, std::vector<double>& vx, std::vector<double>& vf)
427427
{
428428
/// Create best-fit spline parameters for a given input function F
@@ -451,7 +451,7 @@ void Spline1DHelper<DataT>::makeDataPoints(
451451

452452
template <typename DataT>
453453
void Spline1DHelper<DataT>::approximateFunction(
454-
Spline1DContainerBase<DataT, FlatObject>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
454+
Spline1DContainer<DataT, FlatObject>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
455455
int32_t nAuxiliaryDataPoints)
456456
{
457457
/// Create best-fit spline parameters for a given input function F
@@ -463,7 +463,7 @@ void Spline1DHelper<DataT>::approximateFunction(
463463

464464
template <typename DataT>
465465
void Spline1DHelper<DataT>::approximateFunctionGradually(
466-
Spline1DContainerBase<DataT, FlatObject>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
466+
Spline1DContainer<DataT, FlatObject>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
467467
int32_t nAuxiliaryDataPoints)
468468
{
469469
/// Create best-fit spline parameters for a given input function F
@@ -479,7 +479,7 @@ void Spline1DHelper<DataT>::approximateFunctionGradually(
479479

480480
// set F values at knots
481481
for (int32_t iKnot = 0; iKnot < mSpline.getNumberOfKnots(); ++iKnot) {
482-
const typename Spline1D<double>::Knot& knot = mSpline.getKnot(iKnot);
482+
const typename Spline1D<double>::KnotType& knot = mSpline.getKnot(iKnot);
483483
double x = mSpline.convUtoX(knot.u);
484484
double s[nFdimensions];
485485
F(x, s);
@@ -491,7 +491,7 @@ void Spline1DHelper<DataT>::approximateFunctionGradually(
491491
}
492492

493493
template <typename DataT>
494-
void Spline1DHelper<DataT>::setSpline(const Spline1DContainerBase<DataT, FlatObject>& spline)
494+
void Spline1DHelper<DataT>::setSpline(const Spline1DContainer<DataT, FlatObject>& spline)
495495
{
496496
const int32_t nKnots = spline.getNumberOfKnots();
497497
std::vector<int32_t> knots(nKnots);

0 commit comments

Comments
 (0)