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 
52 {
53 public:
54 
55  typedef float CCGFloat ;
56  typedef HepGeom::Transform3D Tr3D ;
57  typedef HepGeom::Point3D<CCGFloat> Pt3D ;
58  typedef std::vector<Pt3D> Pt3DVec ;
59 
62 
64  typedef std::vector<ParVec> ParVecVec ;
66 
67  static constexpr unsigned int k_cornerSize = 8;
68 
69  using RepCorners = std::array<RhoEtaPhi,k_cornerSize>;
70 
71 
72  static const CCGFloat k_ScaleFromDDDtoGeant ;
73 
74  virtual ~CaloCellGeometry() ;
75 
77  CornersVec const& getCorners() const { assert(not m_corners.uninitialized()); return m_corners; }
78  RepCorners const& getCornersREP() const { return m_repCorners;}
79 
80 
82  virtual const GlobalPoint& getPosition() const {return m_refPoint;}
83  virtual GlobalPoint getPosition( CCGFloat) const {return m_refPoint;}
84  virtual GlobalPoint getPosition( const Pt3D&) const {return m_refPoint;}
85 
86  GlobalPoint const& getBackPoint() const {return m_backPoint;}
87 
88  RhoEtaPhi const& repPos() const { return m_rep;}
89  float rhoPos() const { return m_rep.rho();}
90  float etaPos() const { return m_rep.eta();}
91  float phiPos() const { return m_rep.phi();}
92 
93  float etaSpan() const { return m_dEta;}
94  float phiSpan() const { return m_dPhi;}
95 
96 
98  bool inside( const GlobalPoint & point ) const ;
99 
100  bool emptyCorners() const { return m_corners.empty() ;}
101 
102  const CCGFloat* param() const { return m_parms ;}
103 
104  static const CCGFloat* checkParmPtr( const std::vector<CCGFloat>& vd ,
105  ParVecVec& pvv ) ;
106 
107  static const CCGFloat* getParmPtr( const std::vector<CCGFloat>& vd ,
108  ParMgr* mgr ,
109  ParVecVec& pvv ) ;
110 
111 
113  virtual void getTransform( Tr3D& tr, Pt3DVec* lptr ) const ;
114  //------------------------------------------------------------------------
115  void setBackPoint (const GlobalPoint& pos) {m_backPoint = pos;}
116 
117  virtual void vocalCorners( Pt3DVec& vec ,
118  const CCGFloat* pv ,
119  Pt3D& ref ) const = 0 ;
120 
121 protected:
122 
124  CornersMgr* mgr,
125  const CCGFloat* par ) ;
126 
127  CaloCellGeometry( const CornersVec& cv,
128  const CCGFloat* par ) ;
129 
130  CaloCellGeometry( void );
131 
132  // MUST be called by children constructors
133  void initSpan() {
135  m_dEta = std::abs(getCorners()[0].eta()-
136  getCorners()[2].eta());
137  m_dPhi = std::abs(getCorners()[0].phi() -
138  getCorners()[2].phi());
139  initBack();
140  initReps();
141  }
142 
143  virtual void initCorners(CornersVec&) = 0;
144 
145  void setRefPoint (const GlobalPoint& pos) {m_refPoint = pos;}
146  void setCornerVec (const std::vector<GlobalPoint>& cor) {
147  for (unsigned int k=0; k<cor.size(); ++k)
148  m_corners[k] = cor[k];
149  }
150 
151 private:
152 
153  void initBack() {
154  // from CaloTower code
155  CornersVec const & cv = getCorners();
156  m_backPoint = GlobalPoint(0.25 * (cv[4].x() + cv[5].x() + cv[6].x() + cv[7].x()),
157  0.25 * (cv[4].y() + cv[5].y() + cv[6].y() + cv[7].y()),
158  0.25 * (cv[4].z() + cv[5].z() + cv[6].z() + cv[7].z()));
159  }
160  void initReps() {
161  for (auto i=0U;i<k_cornerSize; ++i) m_repCorners[i]= {getCorners()[i].perp(), getCorners()[i].eta(), getCorners()[i].barePhi()};
162 
163  }
164 
165 
168  CornersVec m_corners ;
169  const CCGFloat* m_parms ;
171  float m_dEta;
172  float m_dPhi;
173  std::array<RhoEtaPhi,k_cornerSize> m_repCorners;
174 };
175 
176 std::ostream& operator<<( std::ostream& s, const CaloCellGeometry& cell ) ;
177 
178 
179 #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
std::vector< ParVec > ParVecVec
void setRefPoint(const GlobalPoint &pos)
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
void setCornerVec(const std::vector< GlobalPoint > &cor)
HepGeom::Transform3D Tr3D
cv
Definition: cuy.py:364
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
virtual GlobalPoint getPosition(CCGFloat) const
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:7
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GlobalPoint const & getBackPoint() const
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
GlobalPoint m_refPoint
static const CCGFloat k_ScaleFromDDDtoGeant
float phiSpan() const
int k[5][pyjets_maxn]
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
void setBackPoint(const GlobalPoint &pos)
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
virtual GlobalPoint getPosition(const Pt3D &) const
EZMgrFL< CCGFloat > ParMgr
static const CCGFloat * checkParmPtr(const std::vector< CCGFloat > &vd, ParVecVec &pvv)