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 {
35  public:
36  typedef std::map<unsigned int, const DetGeomDesc* > mapType;
37  typedef std::map<int, const DetGeomDesc* > RPDeviceMapType;
38  typedef std::map<unsigned int, std::set<unsigned int> > mapSetType;
39 
42 
44  CTPPSGeometry( const DetGeomDesc* gd ) { build( gd ); }
45 
47  void build( const DetGeomDesc* );
48 
49  //----- setters and getters
50 
54  bool addSensor( unsigned int, const DetGeomDesc*& );
55 
58  bool addRP( unsigned int id, const DetGeomDesc*& );
59 
62  const DetGeomDesc* getSensor( unsigned int id ) const;
63  const DetGeomDesc* getSensorNoThrow( unsigned int id ) const noexcept;
64 
66  const DetGeomDesc* getRP( unsigned int id ) const;
67  const DetGeomDesc* getRPNoThrow( unsigned int id ) const noexcept;
68 
69  //----- objects iterators
70 
72  mapType::const_iterator beginSensor() const { return sensors_map_.begin(); }
74  mapType::const_iterator endSensor() const { return sensors_map_.end(); }
75 
77  RPDeviceMapType::const_iterator beginRP() const { return rps_map_.begin(); }
79  RPDeviceMapType::const_iterator endRP() const { return rps_map_.end(); }
80 
81  //----- translators
82 
86  CLHEP::Hep3Vector localToGlobal( const DetGeomDesc*, const CLHEP::Hep3Vector& ) const;
87  CLHEP::Hep3Vector globalToLocal( const DetGeomDesc*, const CLHEP::Hep3Vector& ) const;
88  CLHEP::Hep3Vector localToGlobal( unsigned int, const CLHEP::Hep3Vector& ) const;
89  CLHEP::Hep3Vector globalToLocal( unsigned int, const CLHEP::Hep3Vector& ) const;
90 
93  CLHEP::Hep3Vector localToGlobalDirection( unsigned int id, const CLHEP::Hep3Vector& ) const;
96  CLHEP::Hep3Vector globalToLocalDirection( unsigned int id, const CLHEP::Hep3Vector& ) const;
97 
100  CLHEP::Hep3Vector getSensorTranslation( unsigned int id ) const;
101 
104  CLHEP::Hep3Vector getRPTranslation( unsigned int id ) const;
105 
107  const std::set<unsigned int>& getStationsInArm( unsigned int ) const;
108 
110  const std::set<unsigned int>& getRPsInStation( unsigned int ) const;
111 
113  const std::set<unsigned int>& getSensorsInRP( unsigned int ) const;
114 
115  protected:
117  mapType sensors_map_;
118 
120  RPDeviceMapType rps_map_;
121 
125 };
126 
127 #endif
std::map< unsigned int, const DetGeomDesc * > mapType
Definition: CTPPSGeometry.h:36
CTPPSGeometry(const DetGeomDesc *gd)
build up from DetGeomDesc
Definition: CTPPSGeometry.h:44
const std::set< unsigned int > & getStationsInArm(unsigned int) const
after checks returns set of station ids corresponding to the given arm id
const DetGeomDesc * getSensorNoThrow(unsigned int id) const
#define noexcept
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...
mapType::const_iterator beginSensor() const
begin iterator over sensors
Definition: CTPPSGeometry.h:72
const std::set< unsigned int > & getRPsInStation(unsigned int) const
after checks returns set of RP ids corresponding to the given station id
const DetGeomDesc * getSensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
std::map< int, const DetGeomDesc * > RPDeviceMapType
Definition: CTPPSGeometry.h:37
void build(const DetGeomDesc *)
build up from DetGeomDesc structure
RPDeviceMapType::const_iterator beginRP() const
begin iterator over RPs
Definition: CTPPSGeometry.h:77
Geometrical description of a sensor.
Definition: DetGeomDesc.h:35
CLHEP::Hep3Vector localToGlobal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
const DetGeomDesc * getRPNoThrow(unsigned int id) const
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:33
CLHEP::Hep3Vector getRPTranslation(unsigned int id) const
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:74
RPDeviceMapType::const_iterator endRP() const
end iterator over RPs
Definition: CTPPSGeometry.h:79
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc
CLHEP::Hep3Vector globalToLocalDirection(unsigned int id, const CLHEP::Hep3Vector &) const
bool addSensor(unsigned int, const DetGeomDesc *&)
adds an item to the map (detector ID –> DetGeomDesc) performs necessary checks
CLHEP::Hep3Vector getSensorTranslation(unsigned int id) const
std::map< unsigned int, std::set< unsigned int > > mapSetType
Definition: CTPPSGeometry.h:38
mapSetType dets_in_rp_
const std::set< unsigned int > & getSensorsInRP(unsigned int) const
after checks returns set of sensor ids corresponding to the given RP id
mapType sensors_map_
map: sensor id –> DetGeomDesc
CLHEP::Hep3Vector globalToLocal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
const DetGeomDesc * getRP(unsigned int id) const
returns geometry of a RP box
bool addRP(unsigned int id, const DetGeomDesc *&)
adds a RP box to a map