Analysis Software
Documentation for sPHENIX simulation 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 <map>
26 #include <string>
27 #include <tuple>
28 #include <vector>
29 
31 {
32  typedef std::tuple<float, float, float> trio;
33 
34  public:
35  PHField3DCylindrical(const std::string& filename, int verb = 0, const float magfield_rescale = 1.0);
36  ~PHField3DCylindrical() override {}
37  void GetFieldValue(const double Point[4], double* Bfield) const override;
38  void GetFieldCyl(const double CylPoint[4], double* Bfield) const;
39 
40  protected:
41  // < i, j, k > , this allows i and i+1 to be neighbors ( <i,j,k>=<z,r,phi> )
42  std::vector<std::vector<std::vector<float> > > BFieldZ_;
43  std::vector<std::vector<std::vector<float> > > BFieldR_;
44  std::vector<std::vector<std::vector<float> > > BFieldPHI_;
45 
46  // maps indices to values z_map[i] = z_value that corresponds to ith index
47  std::vector<float> z_map_; // < i >
48  std::vector<float> r_map_; // < j >
49  std::vector<float> phi_map_; // < k >
50 
51  float maxz_, minz_; // boundaries of magnetic field map cyl
52 
53  private:
54  bool bin_search(const std::vector<float>& vec, unsigned start, unsigned end, const float& key, unsigned& index) const;
55  void print_map(std::map<trio, trio>::iterator& it) const;
56 };
57 
58 #endif