CMS 3D CMS Logo

CTPPSGeometry.h
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * Authors:
4 * Jan Kašpar (jan.kaspar@gmail.com)
5 *
6 ****************************************************************************/
7 
8 #ifndef Geometry_VeryForwardGeometryBuilder_CTPPSGeometry
9 #define Geometry_VeryForwardGeometryBuilder_CTPPSGeometry
10 
12 
15 
16 #include "CLHEP/Vector/ThreeVector.h"
17 #include "CLHEP/Vector/Rotation.h"
18 
19 #include <map>
20 #include <set>
21 
34 public:
35  typedef std::map<unsigned int, const DetGeomDesc*> mapType;
36  typedef std::map<int, const DetGeomDesc*> RPDeviceMapType;
37  typedef std::map<unsigned int, std::set<unsigned int> > mapSetType;
38 
41 
43  CTPPSGeometry(const DetGeomDesc* gd) { build(gd); }
44 
46  void build(const DetGeomDesc*);
47 
48  //----- setters and getters
49 
53  bool addSensor(unsigned int, const DetGeomDesc*&);
54 
57  bool addRP(unsigned int id, const DetGeomDesc*&);
58 
61  const DetGeomDesc* sensor(unsigned int id) const;
62  const DetGeomDesc* sensorNoThrow(unsigned int id) const noexcept;
63 
65  const DetGeomDesc* rp(unsigned int id) const;
66  const DetGeomDesc* rpNoThrow(unsigned int id) const noexcept;
67 
68  //----- objects iterators
69 
71  mapType::const_iterator beginSensor() const { return sensors_map_.begin(); }
73  mapType::const_iterator endSensor() const { return sensors_map_.end(); }
74 
76  RPDeviceMapType::const_iterator beginRP() const { return rps_map_.begin(); }
78  RPDeviceMapType::const_iterator endRP() const { return rps_map_.end(); }
79 
80  //----- translators
81 
85  CLHEP::Hep3Vector localToGlobal(const DetGeomDesc*, const CLHEP::Hep3Vector&) const;
86  CLHEP::Hep3Vector globalToLocal(const DetGeomDesc*, const CLHEP::Hep3Vector&) const;
87  CLHEP::Hep3Vector localToGlobal(unsigned int, const CLHEP::Hep3Vector&) const;
88  CLHEP::Hep3Vector globalToLocal(unsigned int, const CLHEP::Hep3Vector&) const;
89 
92  CLHEP::Hep3Vector localToGlobalDirection(unsigned int id, const CLHEP::Hep3Vector&) const;
95  CLHEP::Hep3Vector globalToLocalDirection(unsigned int id, const CLHEP::Hep3Vector&) const;
96 
99  CLHEP::Hep3Vector sensorTranslation(unsigned int id) const;
100 
103  CLHEP::Hep3Vector rpTranslation(unsigned int id) const;
104 
106  const std::set<unsigned int>& stationsInArm(unsigned int) const;
107 
109  const std::set<unsigned int>& rpsInStation(unsigned int) const;
110 
112  const std::set<unsigned int>& sensorsInRP(unsigned int) const;
113 
114 protected:
116  mapType sensors_map_;
117 
119  RPDeviceMapType rps_map_;
120 
124 };
125 
126 #endif
CTPPSGeometry(const DetGeomDesc *gd)
build up from DetGeomDesc
Definition: CTPPSGeometry.h:43
mapSetType stations_in_arm_
map: parent ID -> set of subelements E.g. stations_in_arm_ is map of arm ID -> set of stations (in th...
const DetGeomDesc * rpNoThrow(unsigned int id) const
const DetGeomDesc * rp(unsigned int id) const
returns geometry of a RP box
std::map< int, const DetGeomDesc * > RPDeviceMapType
Definition: CTPPSGeometry.h:36
mapType::const_iterator beginSensor() const
begin iterator over sensors
Definition: CTPPSGeometry.h:71
const std::set< unsigned int > & rpsInStation(unsigned int) const
after checks returns set of RP ids corresponding to the given station id
CLHEP::Hep3Vector sensorTranslation(unsigned int id) const
std::map< unsigned int, const DetGeomDesc * > mapType
Definition: CTPPSGeometry.h:35
CLHEP::Hep3Vector rpTranslation(unsigned int id) const
void build(const DetGeomDesc *)
build up from DetGeomDesc structure
RPDeviceMapType::const_iterator beginRP() const
begin iterator over RPs
Definition: CTPPSGeometry.h:76
Geometrical description of a sensor.
Definition: DetGeomDesc.h:35
CLHEP::Hep3Vector localToGlobal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:33
#define noexcept
const std::set< unsigned int > & sensorsInRP(unsigned int) const
after checks returns set of sensor ids corresponding to the given RP id
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
mapSetType rps_in_station_
CLHEP::Hep3Vector localToGlobalDirection(unsigned int id, const CLHEP::Hep3Vector &) const
mapType::const_iterator endSensor() const
end iterator over sensors
Definition: CTPPSGeometry.h:73
RPDeviceMapType::const_iterator endRP() const
end iterator over RPs
Definition: CTPPSGeometry.h:78
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc
CLHEP::Hep3Vector globalToLocalDirection(unsigned int id, const CLHEP::Hep3Vector &) const
const std::set< unsigned int > & stationsInArm(unsigned int) const
after checks returns set of station ids corresponding to the given arm id
bool addSensor(unsigned int, const DetGeomDesc *&)
adds an item to the map (detector ID –> DetGeomDesc) performs necessary checks
std::map< unsigned int, std::set< unsigned int > > mapSetType
Definition: CTPPSGeometry.h:37
mapSetType dets_in_rp_
mapType sensors_map_
map: sensor id –> DetGeomDesc
CLHEP::Hep3Vector globalToLocal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
bool addRP(unsigned int id, const DetGeomDesc *&)
adds a RP box to a map
const DetGeomDesc * sensorNoThrow(unsigned int id) const