File indexing completed on 2024-04-06 12:14:22
0001 #ifndef CommonDet_GeomDet_H
0002 #define CommonDet_GeomDet_H
0003
0004
0005
0006
0007
0008
0009 #include "DataFormats/GeometrySurface/interface/Plane.h"
0010 #include "DataFormats/DetId/interface/DetId.h"
0011
0012 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0013 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0014 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0015 #include "DataFormats/GeometryVector/interface/LocalVector.h"
0016 #include "DataFormats/GeometrySurface/interface/LocalError.h"
0017 #include "Geometry/CommonTopologies/interface/GeomDetEnumerators.h"
0018
0019 #include <vector>
0020
0021 class AlignmentPositionError;
0022
0023 class Topology;
0024 class GeomDetType;
0025 class SurfaceDeformation;
0026
0027 class GeomDet {
0028 public:
0029 using SubDetector = GeomDetEnumerators::SubDetector;
0030
0031 explicit GeomDet(Plane* plane) : thePlane(plane) {}
0032 explicit GeomDet(const ReferenceCountingPointer<Plane>& plane) : thePlane(plane) {}
0033
0034 virtual ~GeomDet();
0035
0036
0037 const Plane& surface() const { return *thePlane; }
0038
0039
0040 const Plane& specificSurface() const { return *thePlane; }
0041
0042
0043 const Surface::PositionType& position() const { return surface().position(); }
0044
0045
0046 const Surface::RotationType& rotation() const { return surface().rotation(); }
0047
0048
0049 GlobalPoint toGlobal(const Local2DPoint& lp) const { return surface().toGlobal(lp); }
0050
0051
0052 GlobalPoint toGlobal(const Local3DPoint& lp) const { return surface().toGlobal(lp); }
0053
0054
0055 GlobalVector toGlobal(const LocalVector& lv) const { return surface().toGlobal(lv); }
0056
0057
0058 LocalPoint toLocal(const GlobalPoint& gp) const { return surface().toLocal(gp); }
0059
0060
0061 LocalVector toLocal(const GlobalVector& gv) const { return surface().toLocal(gv); }
0062
0063
0064 DetId geographicalId() const { return m_detId; }
0065
0066
0067 virtual SubDetector subDetector() const;
0068
0069
0070 virtual bool isLeaf() const { return components().empty(); }
0071
0072
0073 virtual std::vector<const GeomDet*> components() const { return std::vector<const GeomDet*>(); }
0074
0075
0076
0077 virtual const GeomDet* component(DetId ) const { return nullptr; }
0078
0079
0080 AlignmentPositionError const* alignmentPositionError() const { return theAlignmentPositionError; }
0081
0082
0083 int index() const { return m_index; }
0084 void setIndex(int i) { m_index = i; }
0085
0086
0087 int gdetIndex() const { return m_gdetIndex; }
0088 void setGdetIndex(int i) { m_gdetIndex = i; }
0089
0090 virtual const Topology& topology() const;
0091
0092 virtual const GeomDetType& type() const;
0093
0094
0095
0096 virtual const SurfaceDeformation* surfaceDeformation() const { return nullptr; }
0097
0098 protected:
0099 void setDetId(DetId id) { m_detId = id; }
0100
0101 private:
0102 ReferenceCountingPointer<Plane> thePlane;
0103 DetId m_detId;
0104 int m_index = -1;
0105 int m_gdetIndex = -1;
0106 AlignmentPositionError* theAlignmentPositionError = nullptr;
0107
0108 protected:
0109
0110
0111 virtual bool setAlignmentPositionError(const AlignmentPositionError& ape);
0112
0113 private:
0114
0115 friend class DetPositioner;
0116
0117
0118
0119 void move(const GlobalVector& displacement);
0120
0121
0122
0123 void rotate(const Surface::RotationType& rotation);
0124
0125
0126
0127
0128
0129 void setPosition(const Surface::PositionType& position, const Surface::RotationType& rotation);
0130
0131 private:
0132
0133
0134
0135 virtual void setSurfaceDeformation(const SurfaceDeformation* deformation);
0136 };
0137
0138 using GeomDetUnit = GeomDet;
0139
0140 #endif