File indexing completed on 2024-04-06 12:14:16
0001 #ifndef GeometryCaloGeometryFlatHexagon_h
0002 #define GeometryCaloGeometryFlatHexagon_h
0003
0004 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0005 #include <CLHEP/Geometry/Point3D.h>
0006 #include <CLHEP/Geometry/Plane3D.h>
0007 #include <CLHEP/Geometry/Vector3D.h>
0008 #include <CLHEP/Geometry/Transform3D.h>
0009 #include <cmath>
0010 #include <vector>
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 class FlatHexagon : public CaloCellGeometry {
0021 public:
0022 typedef CaloCellGeometry::CCGFloat CCGFloat;
0023 typedef CaloCellGeometry::Pt3D Pt3D;
0024 typedef CaloCellGeometry::Pt3DVec Pt3DVec;
0025 typedef CaloCellGeometry::Tr3D Tr3D;
0026
0027 static constexpr uint32_t k_dZ = 0;
0028 static constexpr uint32_t k_r = 1;
0029 static constexpr uint32_t k_R = 2;
0030
0031 FlatHexagon(void);
0032
0033 FlatHexagon(const FlatHexagon& tr);
0034
0035 FlatHexagon& operator=(const FlatHexagon& tr);
0036
0037 FlatHexagon(CornersMgr* cMgr,
0038 const GlobalPoint& fCtr,
0039 const GlobalPoint& bCtr,
0040 const GlobalPoint& cor1,
0041 const CCGFloat* parV);
0042
0043 FlatHexagon(const CornersVec& corn, const CCGFloat* par);
0044
0045 FlatHexagon(const FlatHexagon& tr, const Pt3D& local);
0046
0047 ~FlatHexagon() override;
0048
0049 GlobalPoint const& getPosition() const override { return m_global; }
0050 GlobalPoint getPosition(const Pt3D& local) const override;
0051 float etaPos() const override { return m_global.eta(); }
0052 float phiPos() const override { return m_global.phi(); }
0053 float etaSpan() const override;
0054 float phiSpan() const override;
0055 float zPos() const { return m_global.z(); }
0056 float dz() const { return param()[k_dZ]; }
0057 Pt3D getLocal(const GlobalPoint& global) const;
0058
0059
0060 CCGFloat getThetaAxis() const;
0061
0062
0063 CCGFloat getPhiAxis() const;
0064
0065 void vocalCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref) const override;
0066
0067 const GlobalVector& axis() const;
0068
0069 static void createCorners(const std::vector<CCGFloat>& pv, const Tr3D& tr, std::vector<GlobalPoint>& co);
0070
0071 static void localCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref);
0072
0073 void getTransform(Tr3D& tr, Pt3DVec* lptr) const override;
0074
0075 void setPosition(const GlobalPoint& p) {
0076 m_global = p;
0077 setRefPoint(p);
0078 }
0079
0080 static constexpr double oneBySix_ = 1.0 / 6.0;
0081 static constexpr unsigned int ncorner_ = 12;
0082 static constexpr unsigned int ncornerBy2_ = 6;
0083
0084 private:
0085 void initCorners(CornersVec&) override;
0086
0087 GlobalVector makeAxis(void);
0088
0089 GlobalPoint backCtr(void) const;
0090 GlobalVector m_axis;
0091 Pt3D m_corOne, m_local;
0092 GlobalPoint m_global;
0093 Tr3D m_tr;
0094 };
0095
0096 std::ostream& operator<<(std::ostream& s, const FlatHexagon& cell);
0097
0098 #endif