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 
56 class AlignmentGeometry {
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
DetGeometry::DirectionData::dy
double dy
Definition: AlignmentGeometry.h:27
DetGeometry::DirectionData::dz
double dz
x, y and z components of the direction unit vector in global coordinates
Definition: AlignmentGeometry.h:27
AlignmentGeometry::sensorGeometry
std::map< unsigned int, DetGeometry > sensorGeometry
Definition: AlignmentGeometry.h:57
DetGeometry::DetGeometry
DetGeometry(double _z=0., double _sx=0., double _sy=0., bool _isU=false)
Definition: AlignmentGeometry.h:36
AlignmentGeometry::z0
double z0
a characteristic z in mm
Definition: AlignmentGeometry.h:61
DetGeometry::getDirectionData
const DirectionData & getDirectionData(unsigned int idx) const
Definition: AlignmentGeometry.h:43
DetGeometry::isU
bool isU
Definition: AlignmentGeometry.h:33
DetGeometry::sx
double sx
Definition: AlignmentGeometry.h:24
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
DetGeometry
A structure to hold relevant geometrical information about one detector/sensor.
Definition: AlignmentGeometry.h:19
DetGeometry::DirectionData
Definition: AlignmentGeometry.h:26
AlignmentGeometry::getSensorMap
const std::map< unsigned int, DetGeometry > & getSensorMap() const
Definition: AlignmentGeometry.h:69
DetGeometry::DirectionData::dx
double dx
Definition: AlignmentGeometry.h:27
AlignmentGeometry::insert
void insert(unsigned int id, const DetGeometry &g)
puts an element to the map
Definition: AlignmentGeometry.cc:26
PVValHelper::dy
Definition: PVValidationHelpers.h:50
DetGeometry::setDirection
void setDirection(unsigned int idx, double dx, double dy, double dz)
Definition: AlignmentGeometry.h:39
AlignmentGeometry::get
const DetGeometry & get(unsigned int id) const
retrieves sensor geometry
Definition: AlignmentGeometry.cc:16
DetGeometry::DirectionData::s
double s
projection of (sx, sy) to (dx, dy)
Definition: AlignmentGeometry.h:28
DetGeometry::sy
double sy
detector nominal shift = detector center in global coordinates; in mm
Definition: AlignmentGeometry.h:24
DetGeometry::z
double z
z postion at detector centre; mm
Definition: AlignmentGeometry.h:22
PVValHelper::dz
Definition: PVValidationHelpers.h:51
DetGeometry::directionData
std::map< unsigned int, DirectionData > directionData
Definition: AlignmentGeometry.h:31
AlignmentGeometry
Definition: AlignmentGeometry.h:55
Exception.h
AlignmentGeometry::isValidSensorId
bool isValidSensorId(unsigned int id) const
check whether the sensor Id is valid (present in the map)
Definition: AlignmentGeometry.h:75
AlignmentGeometry::print
void print() const
Prints the geometry.
Definition: AlignmentGeometry.cc:30
cms::Exception
Definition: Exception.h:70
PVValHelper::dx
Definition: PVValidationHelpers.h:49
g
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
AlignmentGeometry::getNumberOfDetectors
unsigned int getNumberOfDetectors() const
returns the number of detectors in the collection
Definition: AlignmentGeometry.h:72