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 
51 public:
52  typedef float CCGFloat;
53  typedef HepGeom::Transform3D Tr3D;
54  typedef HepGeom::Point3D<CCGFloat> Pt3D;
55  typedef std::vector<Pt3D> Pt3DVec;
56 
59 
61  typedef std::vector<ParVec> ParVecVec;
63 
64  static constexpr unsigned int k_cornerSize = 8;
65 
66  using RepCorners = std::array<RhoEtaPhi, k_cornerSize>;
67 
69 
70  virtual ~CaloCellGeometry();
71 
73  CornersVec const& getCorners() const {
75  return m_corners;
76  }
77  RepCorners const& getCornersREP() const { return m_repCorners; }
78 
80  virtual const GlobalPoint& getPosition() const { return m_refPoint; }
81  virtual GlobalPoint getPosition(CCGFloat) const { return m_refPoint; }
82  virtual GlobalPoint getPosition(const Pt3D&) const { return m_refPoint; }
83 
84  GlobalPoint const& getBackPoint() const { return m_backPoint; }
85 
86  RhoEtaPhi const& repPos() const { return m_rep; }
87  virtual float rhoPos() const { return m_rep.rho(); }
88  virtual float etaPos() const { return m_rep.eta(); }
89  virtual float phiPos() const { return m_rep.phi(); }
90 
91  virtual float etaSpan() const { return m_dEta; }
92  virtual float phiSpan() const { return m_dPhi; }
93 
95  bool inside(const GlobalPoint& point) const;
96 
97  bool emptyCorners() const { return m_corners.empty(); }
98 
99  const CCGFloat* param() const { return m_parms; }
100 
101  static const CCGFloat* checkParmPtr(const std::vector<CCGFloat>& vd, ParVecVec& pvv);
102 
103  static const CCGFloat* getParmPtr(const std::vector<CCGFloat>& vd, ParMgr* mgr, ParVecVec& pvv);
104 
106  virtual void getTransform(Tr3D& tr, Pt3DVec* lptr) const;
107  //------------------------------------------------------------------------
109 
110  virtual void vocalCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref) const = 0;
111 
112 protected:
114 
115  CaloCellGeometry(const CornersVec& cv, const CCGFloat* par);
116 
117  CaloCellGeometry(void);
118 
119  // MUST be called by children constructors
120  void initSpan() {
122  m_dEta = std::abs(getCorners()[0].eta() - getCorners()[2].eta());
123  m_dPhi = std::abs(getCorners()[0].phi() - getCorners()[2].phi());
124  initBack();
125  initReps();
126  }
127 
128  virtual void initCorners(CornersVec&) = 0;
129 
131  void setCornerVec(const std::vector<GlobalPoint>& cor) {
132  for (unsigned int k = 0; k < cor.size(); ++k)
133  m_corners[k] = cor[k];
134  }
135 
136 private:
137  void initBack() {
138  // from CaloTower code
139  CornersVec const& cv = getCorners();
140  m_backPoint = GlobalPoint(0.25 * (cv[4].x() + cv[5].x() + cv[6].x() + cv[7].x()),
141  0.25 * (cv[4].y() + cv[5].y() + cv[6].y() + cv[7].y()),
142  0.25 * (cv[4].z() + cv[5].z() + cv[6].z() + cv[7].z()));
143  }
144  void initReps() {
145  for (auto i = 0U; i < k_cornerSize; ++i)
146  m_repCorners[i] = {getCorners()[i].perp(), getCorners()[i].eta(), getCorners()[i].barePhi()};
147  }
148 
154  float m_dEta;
155  float m_dPhi;
156  std::array<RhoEtaPhi, k_cornerSize> m_repCorners;
157 };
158 
159 std::ostream& operator<<(std::ostream& s, const CaloCellGeometry& cell);
160 
161 #endif
EZArrayFL< GlobalPoint > CornersVec
EZMgrFL< CCGFloat > ParMgr
EZArrayFL< CCGFloat > ParVec
RhoEtaPhi const & repPos() const
virtual float phiPos() const
std::vector< ParVec > ParVecVec
void setRefPoint(const GlobalPoint &pos)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const CCGFloat * m_parms
void setCornerVec(const std::vector< GlobalPoint > &cor)
HepGeom::Transform3D Tr3D
cv
Definition: cuy.py:363
std::vector< Pt3D > Pt3DVec
assert(be >=bs)
EZMgrFL< GlobalPoint > CornersMgr
virtual GlobalPoint getPosition(const Pt3D &) const
virtual float etaSpan() const
static constexpr unsigned int k_cornerSize
MgrType::const_reference const_reference
Definition: EZArrayFL.h:26
virtual float etaPos() const
virtual float rhoPos() const
std::ostream & operator<<(std::ostream &s, const CaloCellGeometry &cell)
GlobalPoint m_backPoint
virtual ~CaloCellGeometry()
std::array< RhoEtaPhi, k_cornerSize > m_repCorners
float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:54
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CaloCellGeometry::CCGFloat CCGFloat
std::array< RhoEtaPhi, k_cornerSize > RepCorners
virtual float phiSpan() const
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
GlobalPoint m_refPoint
static const CCGFloat k_ScaleFromDDDtoGeant
virtual void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const =0
std::vector< DeviationSensor2D * > vd
CaloCellGeometry::Pt3D Pt3D
virtual void initCorners(CornersVec &)=0
RepCorners const & getCornersREP() const
bool emptyCorners() const
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
void setBackPoint(const GlobalPoint &pos)
virtual GlobalPoint getPosition(CCGFloat) const
float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:52
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
CaloCellGeometry::Tr3D Tr3D
bool inside(const GlobalPoint &point) const
Returns true if the specified point is inside this cell.
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
virtual void getTransform(Tr3D &tr, Pt3DVec *lptr) const
--------— only needed by specific utility; overloaded when needed -—
float rho() const
transverse momentum
Definition: PtEtaPhiMass.h:50
bool empty() const
Definition: EZArrayFL.h:63
bool uninitialized() const
Definition: EZArrayFL.h:61
GlobalPoint const & getBackPoint() const
const CCGFloat * param() const
*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
static const CCGFloat * checkParmPtr(const std::vector< CCGFloat > &vd, ParVecVec &pvv)