CMS 3D CMS Logo

AlignmentGeometry.h
Go to the documentation of this file.
1 /****************************************************************************
2 * Authors:
3 * Jan Kašpar (jan.kaspar@gmail.com)
4 ****************************************************************************/
5 
6 #ifndef CalibPPS_AlignmentRelative_AlignmentGeometry_h
7 #define CalibPPS_AlignmentRelative_AlignmentGeometry_h
8 
10 
11 #include <map>
12 #include <set>
13 #include <string>
14 
15 //----------------------------------------------------------------------------------------------------
16 
20 struct DetGeometry {
21  double z;
22 
23  double sx, sy;
24 
25  struct DirectionData {
26  double dx, dy, dz;
27  double s;
28  };
29 
30  std::map<unsigned int, DirectionData> directionData;
31 
32  bool isU;
33 
35  DetGeometry(double _z = 0., double _sx = 0., double _sy = 0., bool _isU = false)
36  : z(_z), sx(_sx), sy(_sy), isU(_isU) {}
37 
38  void setDirection(unsigned int idx, double dx, double dy, double dz) {
39  directionData[idx] = {dx, dy, dz, dx * sx + dy * sy};
40  }
41 
42  const DirectionData& getDirectionData(unsigned int idx) const {
43  auto it = directionData.find(idx);
44  if (it == directionData.end())
45  throw cms::Exception("PPS") << "direction index " << idx << " not in the mapping.";
46 
47  return it->second;
48  }
49 };
50 
51 //----------------------------------------------------------------------------------------------------
52 
57 protected:
58  std::map<unsigned int, DetGeometry> sensorGeometry;
59 
60 public:
62  double z0;
63 
65  void insert(unsigned int id, const DetGeometry& g);
66 
68  const DetGeometry& get(unsigned int id) const;
69 
70  const std::map<unsigned int, DetGeometry>& getSensorMap() const { return sensorGeometry; }
71 
73  unsigned int getNumberOfDetectors() const { return sensorGeometry.size(); }
74 
76  bool isValidSensorId(unsigned int id) const { return (sensorGeometry.find(id) != sensorGeometry.end()); }
77 
79  void print() const;
80 };
81 
82 #endif
A structure to hold relevant geometrical information about one detector/sensor.
void print() const
Prints the geometry.
void setDirection(unsigned int idx, double dx, double dy, double dz)
const std::map< unsigned int, DetGeometry > & getSensorMap() const
double dz
x, y and z components of the direction unit vector in global coordinates
std::map< unsigned int, DetGeometry > sensorGeometry
const DirectionData & getDirectionData(unsigned int idx) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
double s
projection of (sx, sy) to (dx, dy)
double sy
detector nominal shift = detector center in global coordinates; in mm
double z
z postion at detector centre; mm
bool isValidSensorId(unsigned int id) const
check whether the sensor Id is valid (present in the map)
std::map< unsigned int, DirectionData > directionData
DetGeometry(double _z=0., double _sx=0., double _sy=0., bool _isU=false)
unsigned int getNumberOfDetectors() const
returns the number of detectors in the collection
void insert(unsigned int id, const DetGeometry &g)
puts an element to the map
double z0
a characteristic z in mm