CMS 3D CMS Logo

CaloCellGeometry.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOGEOMETRY_CALOCELLGEOMETRY_H
2 #define GEOMETRY_CALOGEOMETRY_CALOCELLGEOMETRY_H 1
3 
7 #include <CLHEP/Geometry/Point3D.h>
8 #include <CLHEP/Geometry/Transform3D.h>
10 
11 #include <vector>
12 #include <array>
13 #include <string>
14 #include <cassert>
15 
16 
17 
18 
54 {
55 public:
56 
57  typedef float CCGFloat ;
58  typedef HepGeom::Transform3D Tr3D ;
59  typedef HepGeom::Point3D<CCGFloat> Pt3D ;
60  typedef std::vector<Pt3D> Pt3DVec ;
61 
64 
66  typedef std::vector<ParVec> ParVecVec ;
68 
69  static constexpr unsigned int k_cornerSize = 8;
70 
71  using RepCorners = std::array<RhoEtaPhi,k_cornerSize>;
72 
73 
74  static const CCGFloat k_ScaleFromDDDtoGeant ;
75 
76  virtual ~CaloCellGeometry() ;
77 
79  CornersVec const & getCorners() const { assert(not m_corners.uninitialized()); return m_corners; }
80  RepCorners const & getCornersREP() const { return m_repCorners;}
81 
82 
84  virtual const GlobalPoint& getPosition() const {return m_refPoint;}
85  const GlobalPoint& getBackPoint() const {return m_backPoint;}
86 
87  RhoEtaPhi const & repPos() const { return m_rep;}
88  float rhoPos() const { return m_rep.rho();}
89  float etaPos() const { return m_rep.eta();}
90  float phiPos() const { return m_rep.phi();}
91 
92  float etaSpan() const { return m_dEta;}
93  float phiSpan() const { return m_dPhi;}
94 
95 
97  bool inside( const GlobalPoint & point ) const ;
98 
99  bool emptyCorners() const { return m_corners.empty() ;}
100 
101  const CCGFloat* param() const { return m_parms ;}
102 
103  static const CCGFloat* checkParmPtr( const std::vector<CCGFloat>& vd ,
104  ParVecVec& pvv ) ;
105 
106  static const CCGFloat* getParmPtr( const std::vector<CCGFloat>& vd ,
107  ParMgr* mgr ,
108  ParVecVec& pvv ) ;
109 
110 
112  virtual void getTransform( Tr3D& tr, Pt3DVec* lptr ) const ;
113  //------------------------------------------------------------------------
114 
115  virtual void vocalCorners( Pt3DVec& vec ,
116  const CCGFloat* pv ,
117  Pt3D& ref ) const = 0 ;
118 
119 protected:
120 
122  CornersMgr* mgr,
123  const CCGFloat* par ) ;
124 
125  CaloCellGeometry( const CornersVec& cv,
126  const CCGFloat* par ) ;
127 
128  CaloCellGeometry( void );
129 
130  // MUST be called by children constructors
131  void initSpan() {
133  m_dEta = std::abs(getCorners()[0].eta()-
134  getCorners()[2].eta());
135  m_dPhi = std::abs(getCorners()[0].phi() -
136  getCorners()[2].phi());
137  initBack();
138  initReps();
139  }
140 
141  virtual void initCorners(CornersVec&) = 0;
142 private:
143  void initBack() {
144  // from CaloTower code
145  CornersVec const & cv = getCorners();
146  m_backPoint = GlobalPoint(0.25 * (cv[4].x() + cv[5].x() + cv[6].x() + cv[7].x()),
147  0.25 * (cv[4].y() + cv[5].y() + cv[6].y() + cv[7].y()),
148  0.25 * (cv[4].z() + cv[5].z() + cv[6].z() + cv[7].z()));
149  }
150  void initReps() {
151  for (auto i=0U;i<k_cornerSize; ++i) m_repCorners[i]= {getCorners()[i].perp(), getCorners()[i].eta(), getCorners()[i].barePhi()};
152 
153  }
154 
155 
158  CornersVec m_corners ;
159  const CCGFloat* m_parms ;
161  float m_dEta;
162  float m_dPhi;
163  std::array<RhoEtaPhi,k_cornerSize> m_repCorners;
164 };
165 
166 std::ostream& operator<<( std::ostream& s, const CaloCellGeometry& cell ) ;
167 
168 
169 #endif
float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:53
EZArrayFL< GlobalPoint > CornersVec
float rho() const
transverse momentum
Definition: PtEtaPhiMass.h:49
bool emptyCorners() const
EZArrayFL< CCGFloat > ParVec
float etaSpan() const
const GlobalPoint & getBackPoint() const
std::vector< ParVec > ParVecVec
virtual void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const =0
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
float phiPos() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const CCGFloat * m_parms
float rhoPos() const
HepGeom::Transform3D Tr3D
cv
Definition: cuy.py:362
std::vector< Pt3D > Pt3DVec
EZMgrFL< GlobalPoint > CornersMgr
#define constexpr
RhoEtaPhi const & repPos() const
static constexpr unsigned int k_cornerSize
RepCorners const & getCornersREP() const
MgrType::const_reference const_reference
Definition: EZArrayFL.h:29
const CCGFloat * param() const
std::vector< DeviationSensor2D * > vd
std::ostream & operator<<(std::ostream &s, const CaloCellGeometry &cell)
GlobalPoint m_backPoint
virtual void getTransform(Tr3D &tr, Pt3DVec *lptr) const
--------— only needed by specific utility; overloaded when needed -—
virtual ~CaloCellGeometry()
def pv(vc)
Definition: MetAnalyzer.py:6
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
GlobalPoint m_refPoint
static const CCGFloat k_ScaleFromDDDtoGeant
float phiSpan() const
bool inside(const GlobalPoint &point) const
Returns true if the specified point is inside this cell.
virtual void initCorners(CornersVec &)=0
bool empty() const
Definition: EZArrayFL.h:79
std::array< RhoEtaPhi, k_cornerSize > m_repCorners
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
bool uninitialized() const
Definition: EZArrayFL.h:77
float etaPos() const
std::array< RhoEtaPhi, k_cornerSize > RepCorners
float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:51
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
EZMgrFL< CCGFloat > ParMgr
static const CCGFloat * checkParmPtr(const std::vector< CCGFloat > &vd, ParVecVec &pvv)