CbmRoot
CbmLitFieldFitter.h
Go to the documentation of this file.
1 
8 #ifndef CBMLITFIELDFITTER_H_
9 #define CBMLITFIELDFITTER_H_
10 
11 #include "../../parallel/LitFieldSlice.h"
12 #include <vector>
13 class FairField;
14 
22 public:
27 
31  virtual ~CbmLitPolynom() {}
32 
40  virtual double Calculate(double x, double y, double c[]) const = 0;
41 
46  virtual unsigned int GetNofCoefficients() const = 0;
47 };
48 
61 public:
66  CbmLitFieldFitter(unsigned int polynomDegree);
67 
71  virtual ~CbmLitFieldFitter();
72 
78  template<class T>
79  void FitSlice(float Z, lit::parallel::LitFieldSlice<T>& slice);
80 
85 
89  void FitSliceVec(float Z, lit::parallel::LitFieldSlice<fvec>& slice);
90 
91  /* Setters */
92  void SetXangle(double xangle) { fXangle = xangle; }
93  void SetYangle(double yangle) { fYangle = yangle; }
94  void SetNofBinsX(int nofBinsX) { fNofBinsX = nofBinsX; }
95  void SetNofBinsY(int nofBinsY) { fNofBinsY = nofBinsY; }
96  void SetUseEllipseAcc(bool useEllipseAcc) { fUseEllipseAcc = useEllipseAcc; }
97 
98 private:
106  void FitSlice(double Z,
107  std::vector<double>& parBx,
108  std::vector<double>& parBy,
109  std::vector<double>& parBz);
110 
118  void FitSlice(const std::vector<double>& x,
119  const std::vector<double>& y,
120  const std::vector<double>& z,
121  std::vector<double>& par);
122 
130  void FitSliceMy(double Z,
131  std::vector<double>& parBx,
132  std::vector<double>& parBy,
133  std::vector<double>& parBz);
134 
139  const CbmLitPolynom* GetPolynom() const { return fPolynom; }
140 
141 private:
142  FairField* fField; // Magnetic field
143 
144  double fXangle; // Acceptance angle for X [grad]
145  double fYangle; // Acceptance angle for Y [grad]
146 
147  int fNofBinsX; // Number of bins for X [cm]
148  int fNofBinsY; // Number of bins for Y [cm]
149 
150  bool
151  fUseEllipseAcc; // If true than only values inside an ellipse will be fitted
152 
153  unsigned int
154  fPolynomDegree; // Degree of the polynomial to be used for the field approximation
155  CbmLitPolynom* fPolynom; // Polynomial to be used for field approximation
156 };
157 
158 #endif /* CBMLITFIELDFITTER_H_ */
CbmLitFieldFitter::fPolynomDegree
unsigned int fPolynomDegree
Definition: CbmLitFieldFitter.h:154
CbmLitPolynom::Calculate
virtual double Calculate(double x, double y, double c[]) const =0
Returns calculated value.
CbmLitPolynom::CbmLitPolynom
CbmLitPolynom()
Constructor.
Definition: CbmLitFieldFitter.h:26
lit::parallel::LitFieldSlice
Approximated magnetic field slice in XY plane perpendicular to Z.
Definition: LitFieldSlice.h:35
CbmLitFieldFitter::fUseEllipseAcc
bool fUseEllipseAcc
Definition: CbmLitFieldFitter.h:151
CbmLitFieldFitter::CbmLitFieldFitter
CbmLitFieldFitter(unsigned int polynomDegree)
Constructor.
Definition: CbmLitFieldFitter.cxx:786
CbmLitFieldFitter::GetPolynom
const CbmLitPolynom * GetPolynom() const
Return polynomial which is used for approximation.
Definition: CbmLitFieldFitter.h:139
CbmLitFieldFitter::fXangle
double fXangle
Definition: CbmLitFieldFitter.h:144
CbmLitFieldFitter::fField
FairField * fField
Definition: CbmLitFieldFitter.h:142
CbmLitFieldFitter::SetNofBinsX
void SetNofBinsX(int nofBinsX)
Definition: CbmLitFieldFitter.h:94
CbmLitFieldFitter::fPolynom
CbmLitPolynom * fPolynom
Definition: CbmLitFieldFitter.h:155
CbmLitFieldFitter::SetNofBinsY
void SetNofBinsY(int nofBinsY)
Definition: CbmLitFieldFitter.h:95
CbmLitFieldFitter::FitSliceMy
void FitSliceMy(double Z, std::vector< double > &parBx, std::vector< double > &parBy, std::vector< double > &parBz)
Fit (X, Y) slice of the magnetic field at Z position.
Definition: CbmLitFieldFitter.cxx:917
CbmLitFieldFitter::SetUseEllipseAcc
void SetUseEllipseAcc(bool useEllipseAcc)
Definition: CbmLitFieldFitter.h:96
CbmLitFieldFitter::FitSliceScal
void FitSliceScal(float Z, lit::parallel::LitFieldSlice< fscal > &slice)
FitSlice implementation using fscal data type.
Definition: CbmLitFieldFitter.cxx:827
CbmLitPolynom::GetNofCoefficients
virtual unsigned int GetNofCoefficients() const =0
Return number of coefficients for this polynomial function.
CbmLitFieldFitter::fNofBinsY
int fNofBinsY
Definition: CbmLitFieldFitter.h:148
CbmLitFieldFitter::SetXangle
void SetXangle(double xangle)
Definition: CbmLitFieldFitter.h:92
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmLitFieldFitter
Implementation of the polynomial field approximation.
Definition: CbmLitFieldFitter.h:60
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmLitFieldFitter::SetYangle
void SetYangle(double yangle)
Definition: CbmLitFieldFitter.h:93
CbmLitFieldFitter::fYangle
double fYangle
Definition: CbmLitFieldFitter.h:145
CbmLitFieldFitter::fNofBinsX
int fNofBinsX
Definition: CbmLitFieldFitter.h:147
CbmLitPolynom
Abstract class for polynomial function.
Definition: CbmLitFieldFitter.h:21
CbmLitFieldFitter::~CbmLitFieldFitter
virtual ~CbmLitFieldFitter()
Destructor.
Definition: CbmLitFieldFitter.cxx:810
CbmLitFieldFitter::FitSliceVec
void FitSliceVec(float Z, lit::parallel::LitFieldSlice< fvec > &slice)
FitSlice implementation using fvec data type.
Definition: CbmLitFieldFitter.cxx:833
CbmLitPolynom::~CbmLitPolynom
virtual ~CbmLitPolynom()
Destructor.
Definition: CbmLitFieldFitter.h:31
CbmLitFieldFitter::FitSlice
void FitSlice(float Z, lit::parallel::LitFieldSlice< T > &slice)
Fits (X, Y) slice of the magnetic field at Z position.
Definition: CbmLitFieldFitter.cxx:813