10#ifndef FIELD_SHIPBFIELDMAP_H_
11#define FIELD_SHIPBFIELDMAP_H_
18#include "TGeoMatrix.h"
19#include "TVirtualMagField.h"
45 ShipBFieldMap(
const std::string& label,
const std::string& mapFileName,
46 Float_t xOffset = 0.0, Float_t yOffset = 0.0,
47 Float_t zOffset = 0.0, Float_t phi = 0.0, Float_t theta = 0.0,
48 Float_t psi = 0.0, Float_t scale = 1.0,
49 Bool_t isSymmetric = kFALSE);
70 Float_t newXOffset, Float_t newYOffset, Float_t newZOffset,
71 Float_t newPhi = 0.0, Float_t newTheta = 0.0,
72 Float_t newPsi = 0.0, Float_t newScale = 1.0);
83 void Field(
const Double_t* position, Double_t* B)
override;
344 Bool_t
insideRange(Float_t x, Float_t y, Float_t z);
366 Int_t
getMapBin(Int_t iX, Int_t iY, Int_t iZ);
373 static Float_t
triLinearInterp(Float_t A, Float_t B, Float_t C, Float_t D,
374 Float_t E, Float_t F, Float_t G, Float_t H,
375 Float_t xFrac, Float_t xFrac1, Float_t yFrac,
376 Float_t yFrac1, Float_t zFrac, Float_t zFrac1);
Float_t xMax_
The maximum value of x for the map.
void SetZOffset(Float_t zValue)
Set the z global coordinate shift.
void SetScale(Float_t scale)
Set the field magnitude scaling factor.
Float_t GetZMin() const
Get the minimum value of z for the map.
Float_t dy_
The bin width along y.
Float_t GetXMax() const
Get the maximum value of x for the map.
static Float_t triLinearInterp(Float_t A, Float_t B, Float_t C, Float_t D, Float_t E, Float_t F, Float_t G, Float_t H, Float_t xFrac, Float_t xFrac1, Float_t yFrac, Float_t yFrac1, Float_t zFrac, Float_t zFrac1)
Float_t psi_
The third Euler rotation angle about the new z axis.
Int_t GetNBins() const
Get the total number of bins.
Float_t dz_
The bin width along z.
Float_t zRange_
The coordinate range along z.
std::pair< Int_t, Float_t > binPair
Typedef for an int-double pair.
ShipBFieldMap(const ShipBFieldMap &rhs)=delete
Bool_t HasSymmetry() const
Get the boolean flag to specify if we have quadrant symmetry.
Float_t GetYOffset() const
Get the y offset coordinate of the map for global positioning.
ShipBFieldMap(const std::string &label, const std::string &mapFileName, Float_t xOffset=0.0, Float_t yOffset=0.0, Float_t zOffset=0.0, Float_t phi=0.0, Float_t theta=0.0, Float_t psi=0.0, Float_t scale=1.0, Bool_t isSymmetric=kFALSE)
Constructor.
Int_t Nz_
The number of bins along z.
Float_t Tesla_
Double converting Tesla to kiloGauss (for VMC/FairRoot B field units).
Float_t GetXRange() const
Get the x coordinate range for the map.
Int_t N_
The total number of bins.
Int_t GetNy() const
Get the number of bins along y.
Float_t yMin_
The minimum value of y for the map.
Float_t zOffset_
The z value of the positional offset for the map.
std::string mapFileName_
The name of the map file.
Bool_t initialised_
Initialisation boolean.
void SetPhi(Float_t phi)
Set the first Euler rotation angle phi about the z axis.
ShipBFieldMap & operator=(const ShipBFieldMap &rhs)=delete
Int_t Ny_
The number of bins along y.
Float_t GetdX() const
Get the bin width along x for the map.
std::string GetMapFileName() const
Get the name of the map file.
Float_t theta_
The second Euler rotation angle about the new x axis.
Bool_t IsACopy() const
Get the boolean flag to specify if we are a "copy".
Float_t xMin_
The minimum value of x for the map.
void Field(const Double_t *position, Double_t *B) override
Implementation of evaluating the B field.
void initialise()
Initialisation.
void SetYOffset(Float_t yValue)
Set the y global coordinate shift.
Int_t GetNz() const
Get the number of bins along z.
CoordAxis
Enumeration to specify the coordinate type.
void SetXOffset(Float_t xValue)
Set the x global coordinate shift.
Float_t GetYRange() const
Get the y coordinate range for the map.
Float_t GetScale() const
Get the field magnitude scaling factor.
void SetPsi(Float_t psi)
Set the third Euler rotation angle psi about the new z axis.
floatArray * getFieldMap() const
Retrieve the field map.
void UseSymmetry(Bool_t flag)
Set the boolean to specify if we have quadrant symmetry.
Int_t Nx_
The number of bins along x.
ClassDefOverride(ShipBFieldMap, 1)
ClassDef for ROOT.
Float_t GetdY() const
Get the bin width along y for the map.
void checkRootFileOrdering(TTree *dTree)
Check that the ROOT map really uses the assumed data ordering.
Float_t xRange_
The coordinate range along x.
Float_t yOffset_
The y value of the positional offset for the map.
void readTextFile()
Process the text file containing the field map data.
Float_t scale_
The B field magnitude scaling factor.
TGeoMatrix * theTrans_
The combined translation and rotation transformation.
binPair getBinInfo(Float_t x, CoordAxis theAxis)
Get the bin number and fractional distance from the leftmost bin edge.
Float_t GetPhi() const
Get the first Euler rotation angle about the z axis for global positioning.
Bool_t insideRange(Float_t x, Float_t y, Float_t z)
Check to see if a point is within the map validity range.
std::vector< std::array< Float_t, 3 > > floatArray
void SetTheta(Float_t theta)
Set the second Euler rotation angle theta about the new x axis.
void readRootFile()
Process the ROOT file containing the field map data.
Float_t GetdZ() const
Get the bin width along z for the map.
~ShipBFieldMap() override
Destructor.
void readMapFile()
Read the field map data and store the information internally.
Float_t GetXOffset() const
Get the x offset coordinate of the map for global positioning.
Int_t getMapBin(Int_t iX, Int_t iY, Int_t iZ)
Find the vector entry of the field map data given the bins iX, iY and iZ.
Float_t yMax_
The maximum value of y for the map.
Float_t yRange_
The coordinate range along y.
Float_t zMax_
The maximum value of z for the map.
Float_t phi_
The first Euler rotation angle about the z axis.
Float_t GetZMax() const
Get the maximum value of z for the map.
Float_t GetYMax() const
Get the maximum value of y for the map.
Float_t zMin_
The minimum value of z for the map.
Float_t GetYMin() const
Get the minimum value of y for the map.
Float_t dx_
The bin width along x.
Float_t GetXMin() const
Get the minimum value of x for the map.
Bool_t isSymmetric_
The boolean specifying if we have quadrant symmetry.
Int_t GetNx() const
Get the number of bins along x.
Float_t xOffset_
The x value of the positional offset for the map.
Float_t GetZRange() const
Get the z coordinate range for the map.
Float_t GetZOffset() const
Get the z offset coordinate of the map for global positioning.