File indexing completed on 2024-04-06 11:58:32
0001
0002
0003
0004
0005
0006 #ifndef CalibPPS_AlignmentRelative_AlignmentGeometry_h
0007 #define CalibPPS_AlignmentRelative_AlignmentGeometry_h
0008
0009 #include "FWCore/Utilities/interface/Exception.h"
0010
0011 #include <map>
0012 #include <set>
0013 #include <string>
0014
0015
0016
0017
0018
0019
0020 struct DetGeometry {
0021 double z;
0022
0023 double sx, sy;
0024
0025 struct DirectionData {
0026 double dx, dy, dz;
0027 double s;
0028 };
0029
0030 std::map<unsigned int, DirectionData> directionData;
0031
0032 bool isU;
0033
0034
0035 DetGeometry(double _z = 0., double _sx = 0., double _sy = 0., bool _isU = false)
0036 : z(_z), sx(_sx), sy(_sy), isU(_isU) {}
0037
0038 void setDirection(unsigned int idx, double dx, double dy, double dz) {
0039 directionData[idx] = {dx, dy, dz, dx * sx + dy * sy};
0040 }
0041
0042 const DirectionData& getDirectionData(unsigned int idx) const {
0043 auto it = directionData.find(idx);
0044 if (it == directionData.end())
0045 throw cms::Exception("PPS") << "direction index " << idx << " not in the mapping.";
0046
0047 return it->second;
0048 }
0049 };
0050
0051
0052
0053
0054
0055
0056 class AlignmentGeometry {
0057 protected:
0058 std::map<unsigned int, DetGeometry> sensorGeometry;
0059
0060 public:
0061
0062 double z0;
0063
0064
0065 void insert(unsigned int id, const DetGeometry& g);
0066
0067
0068 const DetGeometry& get(unsigned int id) const;
0069
0070 const std::map<unsigned int, DetGeometry>& getSensorMap() const { return sensorGeometry; }
0071
0072
0073 unsigned int getNumberOfDetectors() const { return sensorGeometry.size(); }
0074
0075
0076 bool isValidSensorId(unsigned int id) const { return (sensorGeometry.find(id) != sensorGeometry.end()); }
0077
0078
0079 void print() const;
0080 };
0081
0082 #endif