27#include <fairlogger/Logger.h>
36TPCFastTransformHelperO2* TPCFastTransformHelperO2::sInstance =
nullptr;
48void TPCFastTransformHelperO2::init()
59 float tpcZlengthSideA = detParam.TPClength;
60 float tpcZlengthSideC = detParam.TPClength;
66 for (
int iRow = 0; iRow < mGeo.getNumberOfRows(); iRow++) {
76 float padWidth = region.getPadWidth();
80 float xRow = padCentre.X();
82 mGeo.
setTPCrow(iRow, xRow, nPads, padWidth);
99 if (!mIsInitialized) {
116 const float vDrift = 0.f;
117 const float vdCorrY = 0.;
118 const float ldCorr = 0.;
119 const float tofCorr = 0.;
120 const float primVtxZ = 0.;
121 const long int initTimeStamp = -1;
122 fastTransform.
setCalibration(initTimeStamp,
t0, vDrift, vdCorrY, ldCorr, tofCorr, primVtxZ);
129 return std::move(fastTransformPtr);
138 if (!mIsInitialized) {
145 return create(TimeStamp, correction);
151 LOGP(
debug,
"Updating calibration: timestamp:{} vdriftFactor:{} vdriftRef:{}", TimeStamp, vDriftFactor, vDriftRef);
152 if (!mIsInitialized) {
168 if (vDriftRef == 0) {
171 const double vDrift = elParam.ZbinWidth * vDriftRef * vDriftFactor;
179 const double t0 = (driftTimeOffset + elParam.getAverageShapingTime()) / elParam.ZbinWidth;
181 const double vdCorrY = 0.;
182 const double ldCorr = 0.;
183 const double tofCorr = 0.;
184 const double primVtxZ = 0.;
186 fastTransform.
setCalibration(TimeStamp,
t0, vDrift, vdCorrY, ldCorr, tofCorr, primVtxZ);
196 LOG(fatal) <<
"Wrong number of sectors :" << geo.getNumberOfSlices() <<
" instead of " <<
Sector::MAXSECTOR << std::endl;
200 LOG(fatal) <<
"Wrong number of rows :" << geo.getNumberOfRows() <<
" instead of " << mapper.
getNumberOfRows() << std::endl;
203 double maxDx = 0, maxDy = 0;
205 for (
int row = 0;
row < geo.getNumberOfRows();
row++) {
207 const int nPads = geo.getRowInfo(
row).maxPad + 1;
213 const double x = geo.getRowInfo(
row).x;
217 for (
int pad = 0; pad < nPads; pad++) {
220 double u = geo.convPadToU(
row, pad);
222 const double dx =
x -
c.X();
223 const double dy = u - (-
c.Y());
225 if (fabs(dx) >= 1.e-6 || fabs(dy) >= 1.e-5) {
226 LOG(warning) <<
"wrong calculated pad position:"
227 <<
" row " <<
row <<
" pad " << pad <<
" x calc " <<
x <<
" x in map " <<
c.X() <<
" dx " << (
x -
c.X())
228 <<
" y calc " << u <<
" y in map " << -
c.Y() <<
" dy " << dy << std::endl;
230 if (fabs(maxDx) < fabs(dx)) {
233 if (fabs(maxDy) < fabs(dy)) {
239 if (fabs(maxDx) >= 1.e-4 || fabs(maxDy) >= 1.e-4) {
240 LOG(fatal) <<
"wrong calculated pad position:"
241 <<
" max Dx " << maxDx <<
" max Dy " << maxDy << std::endl;
Definition of the parameter class for the detector.
Definition of the parameter class for the detector electronics.
Definition of the parameter class for the detector gas.
Definition of Spline2DHelper class.
static const ParameterDetector & Instance()
void constructWithNoCorrection(const TPCFastTransformGeo &geo)
int getNumberOfRows() const
int getNumberOfPadsInRowSector(int row) const
int getGlobalRowOffsetRegion(int region) const
GlobalPadNumber globalPadNumber(const PadPos &globalPadPosition) const
static Mapper & instance(const std::string mappingDir="")
const PadRegionInfo & getPadRegionInfo(const unsigned char region) const
int getNumberOfRowsRegion(int region) const
const PadCentre & padCentre(GlobalPadNumber padNumber) const
static constexpr int MAXSECTOR
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
math_utils::Point2D< float > PadCentre
Pad centres as 2D float.
unsigned short GlobalPadNumber
global pad number
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"