SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
GeometryHandler.hh
1 #ifndef GEOMETRYHANDLER_HH
2 #define GEOMETRYHANDLER_HH
3 
4 // Cpp includes
5 #include <iostream>
6 #include <string>
7 #include <fstream>
8 #include <iterator>
9 #include <map>
10 
11 // ROOT includes
12 #include "TVector3.h"
13 
14 // Other includes
15 #include "Exception.hh"
16 
17 // Mapping between the names and geometry tags
18 static std::map<std::string, std::string> geo_mapping =
19  {{"tof0","TOF0"}, {"tof1","TOF1"}, {"tof2","TOF2"},
20  {"ckova","Ckov1"}, {"ckovb","Ckov2"}, {"tku","Tracker0"}, {"tkd", "Tracker1"},
21  {"kl","KL"}, {"emr","EMR"}, {"abs","Disk_LiH LH2-Empty LH2-Full NeAbs"}};
22 
23 // Tracker stations offset from centre point
24 static std::vector<double> station_offsets = {-550., -350., -100., 200., 550.};
25 
32  public:
33 
36 
42  DetectorGlobals(const std::string& filename,
43  const std::string& name);
44 
46  DetectorGlobals(const DetectorGlobals& detector_globals);
47 
49  DetectorGlobals& operator=(const DetectorGlobals& detector_globals);
50 
53 
55  const TVector3& operator[](const size_t i) const { return _subpos[i]; }
56 
58  TVector3& operator[](const size_t i) { return _subpos[i]; }
59 
65  void Load(const std::string& filename,
66  const std::string& name);
67 
69  void SetPosition(const TVector3& pos);
70 
72  const TVector3& Position() const { return _pos; }
73 
75  void SetAngles(const TVector3& angles) { _angles = angles; }
76 
78  const TVector3& Angles() const { return _angles; }
79 
81  double x() const { return _pos.x(); }
82 
84  double y() const { return _pos.y(); }
85 
87  double z() const { return _pos.z(); }
88 
90  double alpha() const { return _angles.x(); }
91 
93  double beta() const { return _angles.y(); }
94 
96  double gamma() const { return _angles.z(); }
97 
98  private:
99 
100  TVector3 _pos;
101  TVector3 _angles;
102  std::vector<TVector3> _subpos;
103 };
104 
110  public:
111 
113  GeometryHandler();
114 
119  GeometryHandler(const std::string& filename);
120 
126  GeometryHandler(const std::string& filename,
127  const std::vector<std::string>& names);
128 
130  GeometryHandler(const GeometryHandler& geohandler);
131 
133  GeometryHandler& operator=(const GeometryHandler& geohandler);
134 
137 
139  const DetectorGlobals& operator[](const std::string& name) const;
140 
142  DetectorGlobals& operator[](const std::string& name);
143 
144  private:
145 
146  std::vector<std::string> _names;
147  std::map<std::string, DetectorGlobals> _detectors;
148 };
149 
150 #endif
const TVector3 & operator[](const size_t i) const
Overload the subscript operator, return a value.
Definition: GeometryHandler.hh:55
TVector3 _pos
Position of module.
Definition: GeometryHandler.hh:100
~DetectorGlobals()
Destructor.
Definition: GeometryHandler.cc:32
DetectorGlobals & operator=(const DetectorGlobals &detector_globals)
Equality operator.
Definition: GeometryHandler.cc:21
DetectorGlobals()
Default constructor, initilizes everything to 0.
Definition: GeometryHandler.cc:3
double z() const
Returns the global z coordinate of the detector.
Definition: GeometryHandler.hh:87
const DetectorGlobals & operator[](const std::string &name) const
Overload the subscript operator, return a value.
Definition: GeometryHandler.cc:168
std::vector< TVector3 > _subpos
Positions of submodules.
Definition: GeometryHandler.hh:102
Stores the positions of all the requested MICE detectors.
Definition: GeometryHandler.hh:109
double y() const
Returns the global y coordinate of the detector.
Definition: GeometryHandler.hh:84
void Load(const std::string &filename, const std::string &name)
Loads the global constants from the parent geometry file.
Definition: GeometryHandler.cc:34
const TVector3 & Angles() const
Returns the global rotation angles of the detector.
Definition: GeometryHandler.hh:78
double x() const
Returns the global x coordinate of the detector.
Definition: GeometryHandler.hh:81
GeometryHandler()
Default constructor, initilizes everything to 0.
Definition: GeometryHandler.cc:118
GeometryHandler & operator=(const GeometryHandler &geohandler)
Equality operator.
Definition: GeometryHandler.cc:156
~GeometryHandler()
Destructor.
Definition: GeometryHandler.cc:166
double gamma() const
Returns the global roll of the detector.
Definition: GeometryHandler.hh:96
void SetAngles(const TVector3 &angles)
Sets the global rotation angles of the detector.
Definition: GeometryHandler.hh:75
double beta() const
Returns the global yaw of the detector.
Definition: GeometryHandler.hh:93
TVector3 & operator[](const size_t i)
Overload the subscript operator, return a value, allows mods.
Definition: GeometryHandler.hh:58
const TVector3 & Position() const
Returns the global position of the detector.
Definition: GeometryHandler.hh:72
Stores the positions of a MICE detector in global coordinates.
Definition: GeometryHandler.hh:31
std::vector< std::string > _names
Short names of modules.
Definition: GeometryHandler.hh:146
std::map< std::string, DetectorGlobals > _detectors
List of detector globals.
Definition: GeometryHandler.hh:147
double alpha() const
Returns the global pitch of the detector.
Definition: GeometryHandler.hh:90
void SetPosition(const TVector3 &pos)
Sets the global position of the detector.
Definition: GeometryHandler.cc:109
TVector3 _angles
Rotation angles of module.
Definition: GeometryHandler.hh:101