Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:39

0001 #ifndef GeometryCaloGeometryFlatTrd_h
0002 #define GeometryCaloGeometryFlatTrd_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 <vector>
0010 
0011 /**
0012 
0013    \class FlatTrd
0014 
0015    \brief A base class to handle the particular shape of HGCal volumes.
0016    
0017 */
0018 
0019 class FlatTrd : public CaloCellGeometry {
0020 public:
0021   typedef CaloCellGeometry::CCGFloat CCGFloat;
0022   typedef CaloCellGeometry::Pt3D Pt3D;
0023   typedef CaloCellGeometry::Pt3DVec Pt3DVec;
0024   typedef CaloCellGeometry::Tr3D Tr3D;
0025 
0026   static constexpr uint32_t k_dZ = 0;     //Half-length along the z-axis
0027   static constexpr uint32_t k_Theta = 1;  //Polar angle of the line joining the
0028                                           //centres of the faces at -/+ dZ
0029   static constexpr uint32_t k_Phi = 2;    //Azimuthal angle of the line joing the
0030                                           //centres of the faces at -/+ dZ
0031   static constexpr uint32_t k_dY1 = 3;    //Half-length along y of the face at -dZ
0032   static constexpr uint32_t k_dX1 = 4;    //Half-length along x of the side at
0033                                           //y=-dY1 of the face at -dZ
0034   static constexpr uint32_t k_dX2 = 5;    //Half-length along x of the side at
0035                                           //y=+dY1 of the face at -dZ
0036   static constexpr uint32_t k_Alp1 = 6;   //Angle w.r.t the y axis from the center
0037                                           //of the sides at y=-dY1 to at y=+dY1
0038   static constexpr uint32_t k_dY2 = 7;    //Half-length along y of the face at +dZ
0039   static constexpr uint32_t k_dX3 = 8;    //Half-length along x of the side at
0040                                           //y=-dY2 of the face at +dZ
0041   static constexpr uint32_t k_dX4 = 9;    //Half-length along x of the side at
0042                                           //y=+dY2 of the face at +dZ
0043   static constexpr uint32_t k_Alp2 = 10;  //Angle w.r.t the y axis from the center
0044                                           //of the sides at y=-dY2 to at y=+dY2
0045   static constexpr uint32_t k_Cell = 11;  //Cell size
0046   //Assumes dY2=dY1; dX3=dX1; dX4=dX2; Alp2=Alp1=Theta=Phi=0
0047 
0048   FlatTrd(void);
0049 
0050   FlatTrd(const FlatTrd& tr);
0051 
0052   FlatTrd& operator=(const FlatTrd& tr);
0053 
0054   FlatTrd(CornersMgr* cMgr,
0055           const GlobalPoint& fCtr,
0056           const GlobalPoint& bCtr,
0057           const GlobalPoint& cor1,
0058           const CCGFloat* parV);
0059 
0060   FlatTrd(const CornersVec& corn, const CCGFloat* par);
0061 
0062   FlatTrd(const FlatTrd& tr, const Pt3D& local);
0063 
0064   ~FlatTrd() override;
0065 
0066   GlobalPoint const& getPosition() const override { return m_global; }
0067   GlobalPoint getPosition(const Pt3D& local) const override;
0068   float etaPos() const override { return m_global.eta(); }
0069   float phiPos() const override { return m_global.phi(); }
0070   float etaSpan() const override;
0071   float phiSpan() const override;
0072   float zPos() const { return m_global.z(); }
0073   float dz() const { return param()[k_dZ]; }
0074   Pt3D getLocal(const GlobalPoint& global) const;
0075 
0076   // Return thetaAxis polar angle of axis of the crystal
0077   CCGFloat getThetaAxis() const;
0078 
0079   // Return phiAxis azimuthal angle of axis of the crystal
0080   CCGFloat getPhiAxis() const;
0081 
0082   void vocalCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref) const override;
0083 
0084   const GlobalVector& axis() const;
0085 
0086   static void createCorners(const std::vector<CCGFloat>& pv, const Tr3D& tr, std::vector<GlobalPoint>& co);
0087 
0088   static void localCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref);
0089 
0090   void getTransform(Tr3D& tr, Pt3DVec* lptr) const override;
0091 
0092   void setPosition(const GlobalPoint& p) {
0093     m_global = p;
0094     setRefPoint(p);
0095   }
0096 
0097   static constexpr unsigned int ncorner_ = 8;
0098   static constexpr unsigned int ncornerBy2_ = 4;
0099 
0100 private:
0101   void initCorners(CornersVec&) override;
0102 
0103   GlobalVector makeAxis(void);
0104 
0105   GlobalPoint backCtr(void) const;
0106   GlobalVector m_axis;
0107   Pt3D m_corOne, m_local;
0108   GlobalPoint m_global;
0109   Tr3D m_tr;
0110 };
0111 
0112 std::ostream& operator<<(std::ostream& s, const FlatTrd& cell);
0113 
0114 #endif