ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHField3DCylindrical.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHField3DCylindrical.h
1 //
2 // *************************************
3 // * *
4 // * PHField3DCylindrical.h *
5 // * *
6 // *************************************
7 //
8 // **************************************************************
9 //
10 // GEANT Field Map, for use in converting ROOT maps of
11 // PHENIX magnetic field. Written by Michael Stone, July 2011
12 //
13 // **************************************************************
14 //
15 // The structure of the indices has little to do with physics and
16 // has much more to do with the way the PHENIX field map is formatted
17 // in SimMap3D++.root i.e. The z value is incremented only after
18 // every phi and r point has been accounted for in that plane.
19 
20 #ifndef PHFIELD_PHFIELD3DCYLINDRICAL_H
21 #define PHFIELD_PHFIELD3DCYLINDRICAL_H
22 
23 #include "PHField.h"
24 
25 #include <boost/tuple/tuple.hpp>
26 
27 #include <map>
28 #include <string>
29 #include <vector>
30 
32 {
33  typedef boost::tuple<float, float, float> trio;
34 
35  public:
36  PHField3DCylindrical(const std::string& filename, int verb = 0, const float magfield_rescale = 1.0);
37  ~PHField3DCylindrical() override {}
38  void GetFieldValue(const double Point[4], double* Bfield) const override;
39  void GetFieldCyl(const double CylPoint[4], double* Bfield) const;
40 
41  protected:
42  // < i, j, k > , this allows i and i+1 to be neighbors ( <i,j,k>=<z,r,phi> )
43  std::vector<std::vector<std::vector<float> > > BFieldZ_;
44  std::vector<std::vector<std::vector<float> > > BFieldR_;
45  std::vector<std::vector<std::vector<float> > > BFieldPHI_;
46 
47  // maps indices to values z_map[i] = z_value that corresponds to ith index
48  std::vector<float> z_map_; // < i >
49  std::vector<float> r_map_; // < j >
50  std::vector<float> phi_map_; // < k >
51 
52  float maxz_, minz_; // boundaries of magnetic field map cyl
53 
54  private:
55  bool bin_search(const std::vector<float>& vec, unsigned start, unsigned end, const float& key, unsigned& index) const;
56  void print_map(std::map<trio, trio>::iterator& it) const;
57 };
58 
59 #endif