18#include "AliHLTTPCGeometry.h"
19#include "AliTPCParam.h"
20#include "AliTPCRecoParam.h"
21#include "AliTPCTransform.h"
22#include "AliTPCcalibDB.h"
29 : mError(), mOrigTransform(nullptr), fLastTimeBin(0) {}
32 AliTPCTransform* transform,
37 AliTPCcalibDB* pCalib = AliTPCcalibDB::Instance();
40 -1,
"TPCFastTransformManager::Init: No TPC calibration instance found");
43 AliTPCParam* tpcParam = pCalib->GetParameters();
46 -2,
"TPCFastTransformManager::Init: No TPCParam object found");
50 transform = pCalib->GetTransform();
54 -3,
"TPCFastTransformManager::Init: No TPC transformation found");
57 mOrigTransform = transform;
60 tpcParam->ReadGeoMatrices();
62 const AliTPCRecoParam*
rec = transform->GetCurrentRecoParam();
65 "TPCFastTransformManager::Init: No TPC Reco Param "
66 "set in transformation");
69 bool useCorrectionMap =
rec->GetUseCorrectionMap();
71 if (useCorrectionMap) {
72 transform->SetCorrectionMapMode(kTRUE);
79 fLastTimeBin =
rec->GetLastBin();
81 const int32_t nRows = tpcParam->GetNRowLow() + tpcParam->GetNRowUp();
88 float tpcZlengthSideA = tpcParam->GetZLength(0);
89 float tpcZlengthSideC =
90 tpcParam->GetZLength(TPCFastTransformGeo::getNumberOfSlices() / 2);
95 for (int32_t
row = 0;
row < geo.getNumberOfRows();
row++) {
96 int32_t slice = 0, sector = 0, secrow = 0;
97 AliHLTTPCGeometry::Slice2Sector(slice,
row, sector, secrow);
98 Int_t nPads = tpcParam->GetNPads(sector, secrow);
99 float xRow = tpcParam->GetPadRowRadii(sector, secrow);
100 float padWidth = tpcParam->GetInnerPadPitchWidth();
101 if (
row >= tpcParam->GetNRowLow()) {
102 padWidth = tpcParam->GetOuterPadPitchWidth();
113 const int32_t nDistortionScenarios = 1;
118 spline.recreate(8, 20);
120 int32_t scenario = 0;
123 for (int32_t
row = 0;
row < geo.getNumberOfRows();
row++) {
140 const float vDrift = 0.f;
141 const float vdCorrY = 0.;
142 const float ldCorr = 0.;
143 const float tofCorr = 0.;
144 const float primVtxZ = 0.;
145 const int64_t initTimeStamp = -1;
160 long lastTS = fastTransform.getTimeStamp();
172 if (!mOrigTransform) {
173 return storeError(-1,
174 "TPCFastTransformManager::SetCurrentTimeStamp: TPC "
175 "transformation has not been set properly");
178 AliTPCcalibDB* pCalib = AliTPCcalibDB::Instance();
180 return storeError(-2,
181 "TPCFastTransformManager::SetCurrentTimeStamp: No "
182 "TPC calibration found");
185 AliTPCParam* tpcParam = pCalib->GetParameters();
187 return storeError(-3,
188 "TPCFastTransformManager::SetCurrentTimeStamp: No "
189 "TPCParam object found");
192 AliTPCRecoParam* recoParam = mOrigTransform->GetCurrentRecoParamNonConst();
194 return storeError(-5,
195 "TPCFastTransformManager::Init: No TPC Reco Param "
196 "set in transformation");
205 if (lastTS >= 0 && TMath::Abs(lastTS - TimeStamp) < 60) {
211 bool useCorrectionMap = recoParam->GetUseCorrectionMap();
213 if (useCorrectionMap) {
217 mOrigTransform->SetCorrectionMapMode(kTRUE);
222 mOrigTransform->SetCurrentTimeStamp(
static_cast<uint32_t
>(TimeStamp));
227 fLastTimeBin = recoParam->GetLastBin();
229 double t0 = mOrigTransform->GetTBinOffset();
230 double driftCorrPT = mOrigTransform->GetDriftCorrPT();
231 double vdCorrectionTime = mOrigTransform->GetVDCorrectionTime();
232 double vdCorrectionTimeGY = mOrigTransform->GetVDCorrectionTimeGY();
233 double time0CorrTime = mOrigTransform->GetTime0CorrTime();
247 double vDrift = tpcParam->GetZWidth() * driftCorrPT * vdCorrectionTime;
248 double vdCorrY = vDrift * vdCorrectionTimeGY;
249 double ldCorr = -time0CorrTime + 3 * tpcParam->GetZSigma();
251 double tofCorr = (0.01 * tpcParam->GetDriftV()) / TMath::C();
252 double primVtxZ = mOrigTransform->GetPrimVertex()[2];
254 bool useTOFcorrection = recoParam->GetUseTOFCorrection();
256 if (!useTOFcorrection) {
260 fastTransform.
setCalibration(TimeStamp,
t0, vDrift, vdCorrY, ldCorr, tofCorr,
273 recoParam->SetUseTOFCorrection(kFALSE);
275 for (int32_t slice = 0; slice < geo.getNumberOfSlices(); slice++) {
277 for (int32_t
row = 0;
row < geo.getNumberOfRows();
row++) {
282 float*
data = correction.getSplineData(slice,
row);
286 auto F = [&](
double su,
double sv,
double dxuv[3]) {
291 geo.convScaledUVtoUV(slice,
row, su, sv, u,
v);
294 float vertexTime = 0.f;
295 float pad = 0.f,
time = 0.f;
296 fastTransform.convUVtoPadTime(slice,
row, u,
v, pad,
time, vertexTime);
301 geo.convUVtoLocal(slice, u,
v,
y,
z);
305 float ox = 0, oy = 0, oz = 0;
307 int32_t sector = 0, secrow = 0;
308 AliHLTTPCGeometry::Slice2Sector(slice,
row, sector, secrow);
309 int32_t is[] = {sector};
310 double xx[] = {
static_cast<double>(secrow), pad,
time};
311 mOrigTransform->Transform(xx, is, 0, 1);
317 float ou = 0, ov = 0;
318 geo.convLocalToUV(slice, oy, oz, ou, ov);
332 recoParam->SetUseTOFCorrection(useTOFcorrection);
Definition of Spline2DHelper class.
int32_t setSpline(const Spline2DContainer< DataT > &spline, int32_t nAuxiliaryPointsU1, int32_t nAuxiliaryPointsU2)
_______________ Interface for a step-wise construction of the best-fit spline _______________________...
void approximateFunction(Spline2DContainer< DataT > &spline, double x1Min, double x1Max, double x2Min, double x2Max, std::function< void(double x1, double x2, double f[])> F, int32_t nAuxiliaryDataPointsU1=4, int32_t nAuxiliaryDataPointsU2=4)
_______________ Main functionality ________________________
void setSplineScenario(int32_t scenarioIndex, const SplineType &spline)
Sets approximation scenario.
void setRowScenarioID(int32_t iRow, int32_t iScenario)
Initializes a TPC row.
void startConstruction(const TPCFastTransformGeo &geo, int32_t numberOfSplineScenarios)
_______________ Construction interface ________________________
void finishConstruction()
Finishes construction: puts everything to the flat buffer, releases temporary memory.
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
GLdouble GLdouble GLdouble z