Project
Loading...
Searching...
No Matches
TPCFastSpaceChargeCorrectionHelper.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
20
21#ifndef ALICEO2_TPC_TPCFastSpaceChargeCorrectionHelper_H_
22#define ALICEO2_TPC_TPCFastSpaceChargeCorrectionHelper_H_
23
24#include "Rtypes.h"
25#include <functional>
28#include "TPCFastTransformGeo.h"
30
31class TTree;
32
33namespace o2
34{
35namespace tpc
36{
37
38class TrackResiduals;
39
40using namespace o2::gpu;
41
43{
44 public:
46
47 public:
49
52
55
58
61
64
66
68 void setNthreads(int n);
69
72
74 int getNthreads() const { return mNthreads; }
75
77
79 std::unique_ptr<TPCFastSpaceChargeCorrection> createFromLocalCorrection(
80 std::function<void(int roc, int irow, double y, double z, double& dx, double& dy, double& dz)> correctionLocal,
81 const int nKnotsY = 10, const int nKnotsZ = 20);
82
84 std::unique_ptr<TPCFastSpaceChargeCorrection> createFromGlobalCorrection(
85 std::function<void(int roc, double gx, double gy, double gz,
86 double& dgx, double& dgy, double& dgz)>
87 correctionGlobal,
88 const int nKnotsY = 10, const int nKnotsZ = 20);
89
101 std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> createFromTrackResiduals(
102 const o2::tpc::TrackResiduals& trackResiduals, TTree* voxResTree, TTree* voxResTreeInverse, //
103 bool useSmoothed, bool invertSigns, //
104 TPCFastSpaceChargeCorrectionMap* fitPointsDirect = nullptr,
105 TPCFastSpaceChargeCorrectionMap* fitPointsInverse = nullptr);
106
108
109 const TPCFastTransformGeo& getGeometry() { return mGeo; }
110
112
113 void testGeometry(const TPCFastTransformGeo& geo) const;
114
116 void initInverse(o2::gpu::TPCFastSpaceChargeCorrection& correction, bool prn);
117
119 void initInverse(std::vector<o2::gpu::TPCFastSpaceChargeCorrection*>& corrections, const std::vector<float>& scaling, bool prn);
120
126 void addCorrections(
127 o2::gpu::TPCFastSpaceChargeCorrection& mainCorrection, double scale,
128 const std::vector<std::pair<const o2::gpu::TPCFastSpaceChargeCorrection*, double>>& additionalCorrections);
129
135 void addCorrections(
137 const std::vector<std::pair<const o2::gpu::TPCFastSpaceChargeCorrection*, SectorScales>>& additionalCorrections);
138
144 void mergeCorrections(
145 o2::gpu::TPCFastSpaceChargeCorrection& destinationCorrection, const o2::gpu::TPCFastSpaceChargeCorrection& sourceCorrection,
146 const std::vector<int>& sectors);
147
150 {
151 mVoxelMeanValidityRange = range;
152 }
153
154 double getVoxelMeanValidityRange() const { return mVoxelMeanValidityRange; }
155
158
159 bool isDebugUseVoxelCenters() const { return mDebugUseVoxelCenters; }
160
163
164 bool isDebugMirrorAdata2C() const { return mDebugMirrorAdata2C; }
165
166 private:
168 void initGeometry();
169
170 void fillSpaceChargeCorrectionFromMap(TPCFastSpaceChargeCorrection& correction, bool processingInverseCorrection);
171
172 static TPCFastSpaceChargeCorrectionHelper* sInstance;
173 bool mIsInitialized = 0;
174 int mNthreads = 1;
176
177 TPCFastSpaceChargeCorrectionMap mCorrectionMap{0, 0};
178
179 double mVoxelMeanValidityRange{1.1};
180
181 bool mDebugUseVoxelCenters{false};
182 bool mDebugMirrorAdata2C{false};
183
185};
186
187} // namespace tpc
188} // namespace o2
189#endif
uint32_t roc
Definition RawData.h:3
Definition of TPCFastSpaceChargeCorrectionMap class.
Definition of TPCFastSpaceChargeCorrection class.
Definition of TPCFastTransformGeo class.
Definition of the TrackResiduals class.
static constexpr int32_t getNumberOfSectors()
_______________ Getters _________________________________
std::unique_ptr< TPCFastSpaceChargeCorrection > createFromLocalCorrection(std::function< void(int roc, int irow, double y, double z, double &dx, double &dy, double &dz)> correctionLocal, const int nKnotsY=10, const int nKnotsZ=20)
_______________ Main functionality ________________________
const TPCFastTransformGeo & getGeometry()
_______________ Utilities ________________________
std::array< double, TPCFastTransformGeo::getNumberOfSectors()> SectorScales
void setVoxelMeanValidityRange(double range)
how far the voxel mean is allowed to be outside of the voxel (1.1 means 10%)
void initInverse(o2::gpu::TPCFastSpaceChargeCorrection &correction, bool prn)
initialise inverse transformation
std::unique_ptr< o2::gpu::TPCFastSpaceChargeCorrection > createFromTrackResiduals(const o2::tpc::TrackResiduals &trackResiduals, TTree *voxResTree, TTree *voxResTreeInverse, bool useSmoothed, bool invertSigns, TPCFastSpaceChargeCorrectionMap *fitPointsDirect=nullptr, TPCFastSpaceChargeCorrectionMap *fitPointsInverse=nullptr)
void mergeCorrections(o2::gpu::TPCFastSpaceChargeCorrection &destinationCorrection, const o2::gpu::TPCFastSpaceChargeCorrection &sourceCorrection, const std::vector< int > &sectors)
~TPCFastSpaceChargeCorrectionHelper()=default
Destructor.
std::unique_ptr< TPCFastSpaceChargeCorrection > createFromGlobalCorrection(std::function< void(int roc, double gx, double gy, double gz, double &dgx, double &dgy, double &dgz)> correctionGlobal, const int nKnotsY=10, const int nKnotsZ=20)
creates TPCFastSpaceChargeCorrection object from a continious space charge correction in global coord...
void testGeometry(const TPCFastTransformGeo &geo) const
void setDebugMirrorAdata2C()
debug: if true, mirror the data from the A side to the C side of the TPC
TPCFastSpaceChargeCorrectionHelper()=default
_____________ Constructors / destructors __________________________
void setNthreads(int n)
_______________ Settings ________________________
TPCFastSpaceChargeCorrectionHelper(const TPCFastSpaceChargeCorrectionHelper &)=delete
Copy constructor: disabled.
void setDebugUseVoxelCenters()
debug: if true, use voxel centers instead of the fitted positions for correction
void setNthreadsToMaximum()
sets number of threads to N cpu cores
static TPCFastSpaceChargeCorrectionHelper * instance()
Singleton.
TPCFastSpaceChargeCorrectionHelper & operator=(const TPCFastSpaceChargeCorrectionHelper &)=delete
Assignment operator: disabled.
void addCorrections(o2::gpu::TPCFastSpaceChargeCorrection &mainCorrection, double scale, const std::vector< std::pair< const o2::gpu::TPCFastSpaceChargeCorrection *, double > > &additionalCorrections)
GLdouble n
Definition glcorearb.h:1982
GLenum GLint * range
Definition glcorearb.h:1899
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...