19#ifndef GPUCA_GPUCODE_DEVICE
31 423.f * 423.f, 500.f * 500.f};
35#ifndef GPUCA_STANDALONE
43 if (!inpFName.empty() && !
LoadData(inpFName)) {
44 LOG(fatal) <<
"Failed to initialize from " << inpFName;
52 if (nomField != 2 && nomField != 5) {
53 LOG(fatal) <<
"No parametrization for nominal field of " << nomField <<
" kG";
56 pth.Form(inpFmt.data(), nomField);
58 LOG(fatal) <<
"Failed to initialize from " << pth.Data();
67 std::ifstream in(gSystem->ExpandPathName(inpFName.data()), std::ifstream::in);
69 LOG(fatal) <<
"Failed to open file " << inpFName;
73 int valI, component = -1, nParams = 0, header[4] = {-1, -1, -1, -1};
76 while (std::getline(in, line)) {
77 if (line.empty() || line[0] ==
'#') {
80 std::stringstream ss(line);
84 while (cnt < 4 && (ss >> header[cnt++])) {
88 LOG(fatal) <<
"Wrong header " << line;
91 curParam = &mSolPar[header[0]][header[1]][header[2]];
93 while (cnt < header[3] && (ss >> curParam->
parBxyz[component][cnt++])) {
96 if (cnt != header[3]) {
97 LOG(fatal) <<
"Wrong data (npar=" << cnt <<
") for param " << header[0] <<
" " << header[1] <<
" " << header[2]
98 <<
" " << header[3] <<
" " << line;
109 LOG(info) <<
"Loaded " << nParams <<
" params from " << inpFName;
121 int zSeg, rSeg, quadrant;
125 const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
137 int zSeg, rSeg, quadrant;
141 const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
151 int zSeg, rSeg, quadrant;
152 if (!
GetSegment(xyz.X(), xyz.Y(), xyz.Z(), zSeg, rSeg, quadrant)) {
155 const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
156 b =
CalcPol(par->
parBxyz[comp], xyz.X(), xyz.Y(), xyz.Z()) * mFactorSol;
165 int zSeg, rSeg, quadrant;
166 if (!
GetSegment(xyz.X(), xyz.Y(), xyz.Z(), zSeg, rSeg, quadrant)) {
169 const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
170 b =
CalcPol(par->
parBxyz[comp], xyz.X(), xyz.Y(), xyz.Z()) * mFactorSol;
179 int zSeg, rSeg, quadrant;
183 const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
193 int zSeg, rSeg, quadrant;
197 const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
209 int zSeg, rSeg, quadrant;
210 if (!
GetSegment(xyz.X(), xyz.Y(), xyz.Z(), zSeg, rSeg, quadrant)) {
213 const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
225 int zSeg, rSeg, quadrant;
226 if (!
GetSegment(xyz.X(), xyz.Y(), xyz.Z(), zSeg, rSeg, quadrant)) {
229 const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
253 float xx =
x *
x, yy =
y *
y,
rr = xx + yy;
ClassImp(o2::field::MagFieldFast)
Definition of the fast magnetic field parametrization MagFieldFast.
static const float kSolZMax
bool Field(const double xyz[3], double bxyz[3]) const
bool GetBcomp(EDim comp, const double xyz[3], double &b) const
int GetQuadrant(float x, float y) const
bool GetSegment(float x, float y, float z, int &zSeg, int &rSeg, int &quadrant) const
MagFieldFast(const std::string inpFName="")
float CalcPol(const float *cf, float x, float y, float z) const
bool LoadData(const std::string inpFName)
static const float kSolR2Max[kNSolRRanges]
GLboolean GLboolean GLboolean b
GLdouble GLdouble GLdouble z
Defining DataPointCompositeObject explicitly as copiable.
float parBxyz[kNDim][kNPolCoefs]
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"