EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicBeamLineElementGrad.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicBeamLineElementGrad.h
1 // RMP (rpetti@bnl.gov), 2016/03/02
2 //
3 // EIC IR Beam line element magnetic field gradient handler;
4 //
5 
6 //#include <EicMagneticFieldGrad.h>
7 #include <EicMagneticFieldMap.h>
8 
9 #ifndef _EIC_BEAM_LINE_ELEMENT_GRAD_
10 #define _EIC_BEAM_LINE_ELEMENT_GRAD_
11 
12 #define _CSV_EXTENSION_ (".csv")
13 
14 class Mgrid;
15 
17 {
18  public:
19  // NB: box shape parameters and 3D transformation will be known only after the
20  // file is read in -> just give the file name to EicMagneticFieldGrad constructor;
21  EicBeamLineElementGrad(const char *name = 0, double x = 0.0, double y = 0.0, double z = 0.0, double boreZin = 0.0,
22  double boreZout = 0.0, double dOut = 0.0, double l = 0.0, double angle = 0.0, double b = 0.0, double gradient = 0.0):
24  mCenterX(x), mCenterY(y), mCenterZ(z), mBoreZin(boreZin), mBoreZout(boreZout), mDiaOut(dOut), mLength(l),
25  mAngle(angle), mB(b), mGradient(gradient), mScale(1.), mYoke(0), mTransformation(0) {
26  // Just for debuggning purposes;
27  //Initialize(); exit(0);
28  };
30 
31  // Ok, provide Initialize() ASCII file parser; Contains() call is the
32  // "standard" one since both box shape and 3D transformation are provided;
33  int Initialize();
34 
35  int GetFieldValue(const double xx[], double B[]) const;
36  void SetFieldScale(const double fieldScaler);
37 
38  // Assume, that Stephen's files contain all the required information;
39  bool CapableToBuildYoke() const { return true; };
40  TString GetDetectorName() const {
41  return TString(BasenameWrapper(GetFileName().Data())).ReplaceAll(".txt", "");
42  };
43  const char *BasenameWrapper(const char *fname) const;
44  int ConstructGeometry();
45 
46  TGeoVolume *GetYokeVolume() const { return mYoke; };
47 
48  private:
49  TString mName;
50  Double_t mCenterX;
51  Double_t mCenterY;
52  Double_t mCenterZ;
54  Double_t mLength;
55  Double_t mAngle;
56  Double_t mB;
57  Double_t mGradient;
58  Double_t mScale; // scaling for magnetic fields for different energy running
59 
60  TGeoVolume *mYoke;
61 
62  TGeoCombiTrans *mTransformation;
63 
65 };
66 
67 
68 #endif