Skip to content

Commit 7e98ba7

Browse files
sgorbunoktf
authored andcommitted
make FlatObject streamer work for GPUTracker library
1 parent 3c1c97c commit 7e98ba7

10 files changed

Lines changed: 76 additions & 40 deletions

File tree

GPU/Common/FlatObject.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
#include <cassert>
2626
#endif
2727

28-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
29-
#include "TFile.h"
30-
#endif
31-
3228
#include "GPUCommonDef.h"
3329
#include "GPUCommonRtypes.h"
3430
#include "GPUCommonLogger.h"
@@ -285,14 +281,14 @@ class FlatObject
285281
return (ptr != nullptr) ? reinterpret_cast<T*>(newBase + (reinterpret_cast<const char*>(ptr) - oldBase)) : nullptr;
286282
}
287283

288-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU
284+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU
289285

290286
/// write a child class object to the file
291-
template <class T>
287+
template <class T, class TFile>
292288
static int writeToFile(T& obj, TFile& outf, const char* name);
293289

294290
/// read a child class object from the file
295-
template <class T>
291+
template <class T, class TFile>
296292
static T* readFromFile(TFile& inpf, const char* name);
297293
#endif
298294

@@ -454,8 +450,8 @@ inline void FlatObject::setFutureBufferAddress(char* futureFlatBufferPtr)
454450
mFlatBufferContainer = nullptr;
455451
}
456452

457-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU
458-
template <class T>
453+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU
454+
template <class T, class TFile>
459455
inline int FlatObject::writeToFile(T& obj, TFile& outf, const char* name)
460456
{
461457
/// store to file
@@ -477,7 +473,7 @@ inline int FlatObject::writeToFile(T& obj, TFile& outf, const char* name)
477473
return 0;
478474
}
479475

480-
template <class T>
476+
template <class T, class TFile>
481477
inline T* FlatObject::readFromFile(TFile& inpf, const char* name)
482478
{
483479
/// read from file

GPU/TPCFastTransformation/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ if(${ALIGPU_BUILD_TYPE} STREQUAL "ALIROOT")
8484
set(SRCS ${SRCS} TPCFastTransformManager.cxx TPCFastTransformQA.cxx
8585
${AliRoot_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCGeometry.cxx
8686
${AliRoot_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCLog.cxx)
87-
set(HDRS_CINT ${HDRS_CINT} TPCFastTransformManager.h TPCFastTransformQA.h)
87+
#set(HDRS_CINT ${HDRS_CINT_O2} TPCFastTransformManager.h TPCFastTransformQA.h )
88+
set(HDRS_CINT TPCFastTransformManager.h TPCFastTransformQA.h )
8889

8990
# Enable Vc
9091
alice_usevc()
9192

9293
include_directories(SYSTEM ${ROOT_INCLUDE_DIR})
9394
include_directories(${AliRoot_SOURCE_DIR}/GPU/TPCFastTransformation
95+
${AliRoot_SOURCE_DIR}/GPU/TPCFastTransformation/devtools
9496
${AliRoot_SOURCE_DIR}/GPU/Common
9597
${AliRoot_SOURCE_DIR}/HLT/BASE
9698
${AliRoot_SOURCE_DIR}/HLT/TPCLib
@@ -99,7 +101,7 @@ if(${ALIGPU_BUILD_TYPE} STREQUAL "ALIROOT")
99101

100102
# Generate the dictionary
101103
get_directory_property(incdirs INCLUDE_DIRECTORIES)
102-
generate_dictionary("Ali${MODULE}" "TPCFastTransformationLinkDef_AliRoot.h"
104+
generate_dictionary_flat("Ali${MODULE}" "TPCFastTransformationLinkDef_AliRoot.h"
103105
"${HDRS_CINT}" "${incdirs}")
104106

105107
# Generate the ROOT map Dependecies

GPU/TPCFastTransformation/Spline1D.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
///
1414
/// \author Sergey Gorbunov <sergey.gorbunov@cern.ch>
1515

16+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
17+
#include "Rtypes.h"
18+
#endif
19+
1620
#include "Spline1D.h"
1721
#include <cmath>
1822

@@ -228,7 +232,7 @@ void Spline1D<DataT>::print() const
228232
printf("\n");
229233
}
230234

231-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
235+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
232236
template <typename DataT>
233237
int Spline1D<DataT>::writeToFile(TFile& outf, const char* name)
234238
{
@@ -244,7 +248,7 @@ Spline1D<DataT>* Spline1D<DataT>::readFromFile(TFile& inpf, const char* name)
244248
}
245249
#endif
246250

247-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
251+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
248252

249253
template <typename DataT>
250254
void Spline1D<DataT>::approximateFunction(DataT xMin, DataT xMax,

GPU/TPCFastTransformation/Spline1D.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class Spline1D : public FlatObject
156156
void recreate(int numberOfKnots, const int knots[], int nFDimensions);
157157
#endif
158158

159-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
159+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
160160
/// approximate a function F with this spline.
161161
void approximateFunction(DataT xMin, DataT xMax, std::function<void(DataT x, DataT f[/*mFdimensions*/])> F,
162162
int nAxiliaryDataPoints = 4);
@@ -172,7 +172,7 @@ class Spline1D : public FlatObject
172172

173173
/// _______________ IO ________________________
174174

175-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
175+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
176176
/// write a class object to the file
177177
int writeToFile(TFile& outf, const char* name);
178178

@@ -276,7 +276,7 @@ class Spline1D : public FlatObject
276276
/// Print method
277277
void print() const;
278278

279-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
279+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
280280
/// Test the class functionality
281281
static int test(const bool draw = 0, const bool drawDataPoints = 1);
282282
#endif
@@ -385,10 +385,10 @@ GPUhd() DataT Spline1D<DataT>::interpolate(DataT x) const
385385

386386
template <typename DataT>
387387
template <typename T>
388-
GPUhdi() void Spline1D<DataT>::interpolateU(int nFdim, const Spline1D<DataT>::Knot& knotL,
389-
GPUgeneric() const T Sl[/*nFdim*/], GPUgeneric() const T Dl[/*nFdim*/],
390-
GPUgeneric() const T Sr[/*nFdim*/], GPUgeneric() const T Dr[/*nFdim*/],
391-
DataT u, GPUgeneric() T Su[/*nFdim*/])
388+
GPUhd() void Spline1D<DataT>::interpolateU(int nFdim, const Spline1D<DataT>::Knot& knotL,
389+
GPUgeneric() const T Sl[/*nFdim*/], GPUgeneric() const T Dl[/*nFdim*/],
390+
GPUgeneric() const T Sr[/*nFdim*/], GPUgeneric() const T Dr[/*nFdim*/],
391+
DataT u, GPUgeneric() T Su[/*nFdim*/])
392392
{
393393
/// A static method.
394394
/// Gives interpolated value of N-dimensional S(u) at u

GPU/TPCFastTransformation/Spline2D.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
///
1414
/// \author Sergey Gorbunov <sergey.gorbunov@cern.ch>
1515

16+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
17+
#include "Rtypes.h"
18+
#endif
19+
1620
#include "Spline2D.h"
1721

1822
#if !defined(GPUCA_GPUCODE)
@@ -208,7 +212,7 @@ void Spline2DBase<DataT, isConsistentT>::recreate(
208212

209213
#endif
210214

211-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
215+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
212216

213217
template <typename DataT, bool isConsistentT>
214218
int Spline2DBase<DataT, isConsistentT>::writeToFile(TFile& outf, const char* name)
@@ -226,7 +230,7 @@ Spline2DBase<DataT, isConsistentT>* Spline2DBase<DataT, isConsistentT>::readFrom
226230
}
227231
#endif
228232

229-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
233+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
230234

231235
template <typename DataT, bool isConsistentT>
232236
void Spline2DBase<DataT, isConsistentT>::approximateFunction(
@@ -255,7 +259,7 @@ int Spline2DBase<DataT, isConsistentT>::test(const bool draw, const bool drawDat
255259
constexpr int uMax = nKnots * 3;
256260

257261
auto F = [&](DataT u, DataT v, DataT Fuv[]) {
258-
constexpr double scale = TMath::Pi() / uMax;
262+
const double scale = TMath::Pi() / uMax;
259263
double uu = u * scale;
260264
double vv = v * scale;
261265
double cosu[Fdegree + 1], sinu[Fdegree + 1], cosv[Fdegree + 1], sinv[Fdegree + 1];
@@ -496,7 +500,7 @@ int Spline2DBase<DataT, isConsistentT>::test(const bool draw, const bool drawDat
496500
return 0;
497501
}
498502

499-
#endif // GPUCA_ALIGPUCODE
503+
#endif // GPUCA_GPUCODE
500504

501505
template class GPUCA_NAMESPACE::gpu::Spline2DBase<float, false>;
502506
template class GPUCA_NAMESPACE::gpu::Spline2DBase<float, true>;

GPU/TPCFastTransformation/Spline2D.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Spline2DBase : public FlatObject
9191
void recreate(int numberOfKnotsU1, const int knotsU1[], int numberOfKnotsU2, const int knotsU2[]);
9292
#endif
9393

94-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
94+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
9595
/// approximate a function F with this spline.
9696
void approximateFunction(DataT x1Min, DataT x1Max, DataT x2Min, DataT x2Max,
9797
std::function<void(DataT x1, DataT x2, DataT f[])> F,
@@ -100,7 +100,7 @@ class Spline2DBase : public FlatObject
100100

101101
/// _______________ IO ________________________
102102

103-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
103+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
104104
/// write a class object to the file
105105
int writeToFile(TFile& outf, const char* name);
106106

@@ -163,7 +163,7 @@ class Spline2DBase : public FlatObject
163163
/// Print method
164164
void print() const;
165165

166-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
166+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
167167
/// Test the class functionality
168168
static int test(const bool draw = 0, const bool drawDataPoints = 1);
169169
#endif
@@ -257,7 +257,7 @@ class Spline2D : public Spline2DBase<DataT, isConsistentT>
257257

258258
/// _______________ IO ________________________
259259

260-
#if !defined(GPUCA_ALIGPUCODE) && !defined(GPUCA_STANDALONE)
260+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
261261
/// write a class object to the file
262262
using TBase::writeToFile;
263263

@@ -339,8 +339,8 @@ GPUhdi() Spline2D<DataT, nFdimT, isConsistentT>::
339339
}
340340

341341
template <typename DataT, int nFdimT, bool isConsistentT>
342-
GPUhdi() Spline2D<DataT, nFdimT, isConsistentT>& Spline2D<DataT, nFdimT, isConsistentT>::
343-
operator=(const Spline2D& spline)
342+
GPUhd() Spline2D<DataT, nFdimT, isConsistentT>& Spline2D<DataT, nFdimT, isConsistentT>::
343+
operator=(const Spline2D<DataT, nFdimT, isConsistentT>& spline)
344344
{
345345
this->cloneFromObject(spline, nullptr);
346346
return *this;

GPU/TPCFastTransformation/SplineHelper1D.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ class SplineHelper1D
5555
SplineHelper1D();
5656

5757
/// Copy constructor: disabled
58-
SplineHelper1D(const SplineHelper1D&) CON_DELETE;
58+
SplineHelper1D(const SplineHelper1D&) CON_DEFAULT;
5959

6060
/// Assignment operator: disabled
61-
SplineHelper1D& operator=(const SplineHelper1D&) CON_DELETE;
61+
SplineHelper1D& operator=(const SplineHelper1D&) CON_DEFAULT;
6262

6363
/// Destructor
6464
~SplineHelper1D() CON_DEFAULT;

GPU/TPCFastTransformation/TPCFastTransform.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
///
1414
/// \author Sergey Gorbunov <sergey.gorbunov@cern.ch>
1515

16+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
17+
#include "Rtypes.h"
18+
#endif
19+
1620
#include "TPCFastTransform.h"
1721

1822
#if !defined(GPUCA_GPUCODE)
@@ -147,7 +151,7 @@ void TPCFastTransform::print() const
147151
#endif
148152
}
149153

150-
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) && !defined(GPUCA_ALIROOT_LIB)
154+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
151155

152156
int TPCFastTransform::writeToFile(std::string outFName, std::string name)
153157
{

GPU/TPCFastTransformation/TPCFastTransform.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
#include <string>
2626
#endif // !GPUCA_GPUCODE
2727

28-
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
29-
//#include "Rtypes.h"
30-
#endif
31-
3228
namespace GPUCA_NAMESPACE
3329
{
3430
namespace gpu
@@ -186,7 +182,7 @@ class TPCFastTransform : public FlatObject
186182
/// Return a value of the last timebin where correction map is valid
187183
GPUd() float getLastCalibratedTimeBin(int slice) const;
188184

189-
#if !defined(GPUCA_GPUCODE)
185+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
190186

191187
int writeToFile(std::string outFName = "", std::string name = "");
192188

GPU/TPCFastTransformation/TPCFastTransformationLinkDef_AliRoot.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,37 @@
1616
#pragma link off all globals;
1717
#pragma link off all classes;
1818
#pragma link off all functions;
19+
/*
20+
#pragma link C++ nestedclasses;
21+
#pragma link C++ nestedtypedef;
1922
20-
//#pragma link C++ class AliGPU::gpu::IrregularSpline1D+;
23+
#pragma link C++ namespace AliGPU::gpu;
24+
25+
#pragma link C++ class AliGPU::gpu::Spline1D < float> + ;
26+
#pragma link C++ class AliGPU::gpu::Spline1D < double> + ;
27+
#pragma link C++ class AliGPU::gpu::Spline2DBase < float, false> + ;
28+
#pragma link C++ class AliGPU::gpu::Spline2DBase < double, false> + ;
29+
#pragma link C++ class AliGPU::gpu::Spline2DBase < float, true> + ;
30+
#pragma link C++ class AliGPU::gpu::Spline2DBase < double, true> + ;
31+
32+
#pragma link C++ class AliGPU::gpu::Spline2D < float, 1> - ;
33+
34+
#pragma link C++ class AliGPU::gpu::SplineHelper1D < float>;
35+
#pragma link C++ class AliGPU::gpu::SplineHelper1D < double>;
36+
#pragma link C++ class AliGPU::gpu::SplineHelper2D < float>;
37+
#pragma link C++ class AliGPU::gpu::SplineHelper2D < double>;
38+
39+
#pragma link C++ class AliGPU::gpu::RegularSpline1D + ;
40+
#pragma link C++ class AliGPU::gpu::IrregularSpline1D + ;
41+
#pragma link C++ class AliGPU::gpu::IrregularSpline2D3D + ;
42+
#pragma link C++ class AliGPU::gpu::SemiregularSpline2D3D + ;
43+
#pragma link C++ class AliGPU::gpu::IrregularSpline2D3DCalibrator + ;
44+
#pragma link C++ class AliGPU::gpu::TPCFastTransformGeo + ;
45+
#pragma link C++ class AliGPU::gpu::TPCFastTransformGeo::SliceInfo + ;
46+
#pragma link C++ class AliGPU::gpu::TPCFastTransformGeo::RowInfo + ;
47+
#pragma link C++ class AliGPU::gpu::TPCFastTransform + ;
48+
49+
#pragma link C++ class AliGPU::gpu::TPCFastSpaceChargeCorrection + ;
50+
*/
2151

2252
#endif

0 commit comments

Comments
 (0)