CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
CaloCellGeometry Class Referenceabstract

#include <CaloCellGeometry.h>

Inheritance diagram for CaloCellGeometry:
FlatTrd IdealCastorTrapezoid IdealObliquePrism IdealZDCTrapezoid IdealZPrism PreshowerStrip TruncatedPyramid

Public Types

typedef float CCGFloat
 
typedef EZMgrFL< GlobalPointCornersMgr
 
typedef EZArrayFL< GlobalPointCornersVec
 
typedef EZMgrFL< CCGFloatParMgr
 
typedef EZArrayFL< CCGFloatParVec
 
typedef std::vector< ParVecParVecVec
 
typedef HepGeom::Point3D
< CCGFloat
Pt3D
 
typedef std::vector< Pt3DPt3DVec
 
using RepCorners = std::array< RhoEtaPhi, k_cornerSize >
 
typedef HepGeom::Transform3D Tr3D
 

Public Member Functions

bool emptyCorners () const
 
float etaPos () const
 
float etaSpan () const
 
const GlobalPointgetBackPoint () const
 
CornersVec const & getCorners () const
 Returns the corner points of this cell's volume. More...
 
RepCorners const & getCornersREP () const
 
const GlobalPointgetPosition () const
 Returns the position of reference for this cell. More...
 
virtual void getTransform (Tr3D &tr, Pt3DVec *lptr) const
 --------— only needed by specific utility; overloaded when needed -— More...
 
bool inside (const GlobalPoint &point) const
 Returns true if the specified point is inside this cell. More...
 
const CCGFloatparam () const
 
float phiPos () const
 
float phiSpan () const
 
RhoEtaPhi const & repPos () const
 
float rhoPos () const
 
virtual void vocalCorners (Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const =0
 
virtual ~CaloCellGeometry ()
 

Static Public Member Functions

static const CCGFloatcheckParmPtr (const std::vector< CCGFloat > &vd, ParVecVec &pvv)
 
static const CCGFloatgetParmPtr (const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
 

Static Public Attributes

static constexpr unsigned int k_cornerSize = 8
 
static const CCGFloat k_ScaleFromDDDtoGeant
 

Protected Member Functions

 CaloCellGeometry (CornersVec::const_reference gp, CornersMgr *mgr, const CCGFloat *par)
 
 CaloCellGeometry (const CornersVec &cv, const CCGFloat *par)
 
 CaloCellGeometry (void)
 
virtual void initCorners (CornersVec &)=0
 
void initSpan ()
 

Private Member Functions

void initBack ()
 
void initReps ()
 

Private Attributes

GlobalPoint m_backPoint
 
CornersVec m_corners
 
float m_dEta
 
float m_dPhi
 
const CCGFloatm_parms
 
GlobalPoint m_refPoint
 
RhoEtaPhi m_rep
 
std::array< RhoEtaPhi,
k_cornerSize
m_repCorners
 

Detailed Description

Abstract base class for an individual cell's geometry.

The base class declares a pure virtual function and also writes a definition (body) to force conscious acceptance of default behaviour.

If a derived class doesn't choose to override a normal virtual, it just inherits the base version's behaviour by default. If you want to provide a default behaviour but not let derived classes just inherit it "silently" like this, you can make it pure virtual but still provide a default that the derived class author has to call deliberately if he wants it:

class B {
public:
virtual bool f() = 0;
};
bool B::f() {
return true; // this is a good default, but
} // shouldn't be used blindly
class D : public B {
public:
bool f() {
return B::f(); // if D wants the default
} // behaviour, it has to say so
};
Author
J. Mans, P. Meridiani

Definition at line 53 of file CaloCellGeometry.h.

Member Typedef Documentation

Definition at line 57 of file CaloCellGeometry.h.

Definition at line 63 of file CaloCellGeometry.h.

Definition at line 62 of file CaloCellGeometry.h.

Definition at line 67 of file CaloCellGeometry.h.

Definition at line 65 of file CaloCellGeometry.h.

typedef std::vector<ParVec> CaloCellGeometry::ParVecVec

Definition at line 66 of file CaloCellGeometry.h.

Definition at line 59 of file CaloCellGeometry.h.

typedef std::vector<Pt3D> CaloCellGeometry::Pt3DVec

Definition at line 60 of file CaloCellGeometry.h.

Definition at line 71 of file CaloCellGeometry.h.

typedef HepGeom::Transform3D CaloCellGeometry::Tr3D

Definition at line 58 of file CaloCellGeometry.h.

Constructor & Destructor Documentation

CaloCellGeometry::~CaloCellGeometry ( )
virtual

Definition at line 26 of file CaloCellGeometry.cc.

27 {}
CaloCellGeometry::CaloCellGeometry ( CornersVec::const_reference  gp,
CornersMgr mgr,
const CCGFloat par 
)
protected

Definition at line 31 of file CaloCellGeometry.cc.

33  :
34  m_refPoint ( gp ),
35  m_corners ( mgr ),
36  m_parms ( par ),
37  m_rep(gp.perp(),gp.eta(),gp.barePhi())
38 {}
const CCGFloat * m_parms
GlobalPoint m_refPoint
CaloCellGeometry::CaloCellGeometry ( const CornersVec cv,
const CCGFloat par 
)
protected

Definition at line 40 of file CaloCellGeometry.cc.

41  :
42  m_refPoint ( 0.25*( cv[0].x() + cv[1].x() + cv[2].x() + cv[3].x() ),
43  0.25*( cv[0].y() + cv[1].y() + cv[2].y() + cv[3].y() ),
44  0.25*( cv[0].z() + cv[1].z() + cv[2].z() + cv[3].z() ) ),
45  m_corners ( cv ),
46  m_parms ( par ),
48 {}
T perp() const
Definition: PV3DBase.h:72
const CCGFloat * m_parms
T barePhi() const
Definition: PV3DBase.h:68
GlobalPoint m_refPoint
dictionary cv
Definition: cuy.py:362
T eta() const
Definition: PV3DBase.h:76
CaloCellGeometry::CaloCellGeometry ( void  )
protected

Definition at line 19 of file CaloCellGeometry.cc.

19  :
20  m_refPoint ( 0., 0., 0. ),
21  m_corners ( ) ,
22  m_parms ( (CCGFloat*) 0 )
23 {}
const CCGFloat * m_parms
CaloCellGeometry::CCGFloat CCGFloat
GlobalPoint m_refPoint

Member Function Documentation

const float * CaloCellGeometry::checkParmPtr ( const std::vector< CCGFloat > &  vd,
CaloCellGeometry::ParVecVec pvv 
)
static

Definition at line 119 of file CaloCellGeometry.cc.

References assert(), EZArrayFL< T >::begin(), cuy::ii, j, EZArrayFL< T >::size(), and findQualityFiles::v.

Referenced by getParmPtr().

122 {
123  const float* pP ( 0 ) ;
124 
125  for( unsigned int ii ( 0 ) ; ii != pvv.size() ; ++ii )
126  {
127  const ParVec& v ( pvv[ii] ) ;
128  assert( v.size() == vv.size() ) ;
129 
130  bool same ( true ) ;
131  for( unsigned int j ( 0 ) ; j != vv.size() ; ++j )
132  {
133  same = same && ( fabs( vv[j] - v[j] )<1.e-6 ) ;
134  if( !same ) break ;
135  }
136  if( same )
137  {
138  pP = &(*v.begin()) ;
139  break ;
140  }
141  }
142  return pP ;
143 }
EZArrayFL< CCGFloat > ParVec
assert(m_qm.get())
int ii
Definition: cuy.py:588
int j
Definition: DBlmapReader.cc:9
bool CaloCellGeometry::emptyCorners ( ) const
inline

Definition at line 99 of file CaloCellGeometry.h.

References EZArrayFL< T >::empty(), and m_corners.

Referenced by operator<<().

99 { return m_corners.empty() ;}
bool empty() const
Definition: EZArrayFL.h:79
float CaloCellGeometry::etaPos ( ) const
inline

Definition at line 89 of file CaloCellGeometry.h.

References RhoEtaPhi::eta(), and m_rep.

89 { return m_rep.eta();}
float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:51
float CaloCellGeometry::etaSpan ( ) const
inline

Definition at line 92 of file CaloCellGeometry.h.

References m_dEta.

92 { return m_dEta;}
const GlobalPoint& CaloCellGeometry::getBackPoint ( ) const
inline

Definition at line 85 of file CaloCellGeometry.h.

References m_backPoint.

85 {return m_backPoint;}
GlobalPoint m_backPoint
CornersVec const& CaloCellGeometry::getCorners ( ) const
inline

Returns the corner points of this cell's volume.

Definition at line 79 of file CaloCellGeometry.h.

References assert(), m_corners, and EZArrayFL< T >::uninitialized().

Referenced by reco::PFRecHit::getCornersXYZ(), HCaloDetIdAssociator::getDetIdPoints(), getTransform(), initBack(), initReps(), initSpan(), inside(), operator<<(), and EcalGeomPhiSymHelper::setup().

79 { assert(not m_corners.uninitialized()); return m_corners; }
assert(m_qm.get())
bool uninitialized() const
Definition: EZArrayFL.h:77
RepCorners const& CaloCellGeometry::getCornersREP ( ) const
inline

Definition at line 80 of file CaloCellGeometry.h.

References m_repCorners.

Referenced by reco::PFRecHit::getCornersREP().

80 { return m_repCorners;}
std::array< RhoEtaPhi, k_cornerSize > m_repCorners
const float * CaloCellGeometry::getParmPtr ( const std::vector< CCGFloat > &  vd,
CaloCellGeometry::ParMgr mgr,
CaloCellGeometry::ParVecVec pvv 
)
static

Definition at line 146 of file CaloCellGeometry.cc.

References checkParmPtr(), and i.

Referenced by CaloTowerHardcodeGeometryLoader::makeCell(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), and CaloGeometryDBEP< T, U >::produceAligned().

150 {
151  const float* pP ( checkParmPtr( vv, pvv ) ) ;
152 
153  if( 0 == pP )
154  {
155  pvv.push_back( ParVec( mgr ) ) ;
156  ParVec& back ( pvv.back() ) ;
157  for( unsigned int i ( 0 ) ; i != vv.size() ; ++i )
158  {
159  back[i] = vv[i] ;
160  }
161  pP = &(*back.begin()) ;
162  }
163  return pP ;
164 }
int i
Definition: DBlmapReader.cc:9
EZArrayFL< CCGFloat > ParVec
static const CCGFloat * checkParmPtr(const std::vector< CCGFloat > &vd, ParVecVec &pvv)
const GlobalPoint& CaloCellGeometry::getPosition ( ) const
inline
void CaloCellGeometry::getTransform ( Tr3D tr,
Pt3DVec lptr 
) const
virtual

--------— only needed by specific utility; overloaded when needed -—

Reimplemented in TruncatedPyramid, FlatTrd, and PreshowerStrip.

Definition at line 70 of file CaloCellGeometry.cc.

References angle(), assert(), getCorners(), getPosition(), i, mag(), AlCaHLTBitMon_ParallelJobs::p, param(), csvLumiCalc::unit, vocalCorners(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by CaloTowerGeometry::getSummary().

71 {
73  const Pt3D gFront ( p.x(), p.y(), p.z() ) ;
74  const DPt3D dgFront ( p.x(), p.y(), p.z() ) ;
75 
76  Pt3D lFront ;
77  assert( 0 != param() ) ;
78  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
79  vocalCorners( lc, param(), lFront ) ;
80 
81  DPt3D dlFront ( lFront.x(), lFront.y(), lFront.z() ) ;
82 
83  const Pt3D lBack ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7]) ) ;
84  const DPt3D dlBack ( lBack.x(), lBack.y(), lBack.z() ) ;
85 
86  const Pt3D dlOne ( lc[0].x(), lc[0].y(), lc[0].z() ) ;
87 
88  const CornersVec& cor ( getCorners() ) ;
89  DPt3DVec dkor ( 8, DPt3D(0,0,0) ) ;
90  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
91  {
92  dkor[i] = DPt3D ( cor[i].x(), cor[i].y(), cor[i].z() ) ;
93  }
94 
95  DPt3D dgBack ( 0.25*( dkor[4]+dkor[5]+dkor[6]+dkor[7] ) ) ;
96 
97  const DVec3D dgAxis ( (dgBack-dgFront).unit() ) ;
98 
99  dgBack = ( dgFront + (dlBack-dlFront).mag()*dgAxis ) ;
100  const DPt3D dgOneT ( dgFront + ( dlOne - dlFront ).mag()*( dkor[0] - dgFront ).unit() ) ;
101 
102  const double dlangle ( ( dlBack - dlFront).angle( dlOne - dlFront ) ) ;
103  const double dgangle ( ( dgBack - dgFront).angle( dgOneT- dgFront ) ) ;
104  const double ddangle ( dlangle - dgangle ) ;
105 
106  const DPlane3D dgPl ( dgFront, dgOneT, dgBack ) ;
107  const DPt3D dp2 ( dgFront + dgPl.normal().unit() ) ;
108 
109  const DPt3D dgOne ( dgFront + HepGeom::Rotate3D( -ddangle, dgFront, dp2 )*
110  DVec3D ( dgOneT - dgFront ) ) ;
111 
112  tr = Tr3D( dlFront , dlBack , dlOne ,
113  dgFront , dgBack , dgOne ) ;
114 
115  if( 0 != lptr ) (*lptr) = lc ;
116 }
EZArrayFL< GlobalPoint > CornersVec
int i
Definition: DBlmapReader.cc:9
HepGeom::Point3D< double > DPt3D
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
assert(m_qm.get())
HepGeom::Transform3D Tr3D
const CCGFloat * param() const
string unit
Definition: csvLumiCalc.py:46
HepGeom::Vector3D< double > DVec3D
virtual void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const =0
CaloCellGeometry::Pt3D Pt3D
HepGeom::Plane3D< double > DPlane3D
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
std::vector< DPt3D > DPt3DVec
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void CaloCellGeometry::initBack ( )
inlineprivate

Definition at line 143 of file CaloCellGeometry.h.

References cuy::cv, getCorners(), m_backPoint, x, y, and z.

Referenced by initSpan().

143  {
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  }
EZArrayFL< GlobalPoint > CornersVec
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint m_backPoint
dictionary cv
Definition: cuy.py:362
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
virtual void CaloCellGeometry::initCorners ( CornersVec )
protectedpure virtual
void CaloCellGeometry::initReps ( )
inlineprivate

Definition at line 150 of file CaloCellGeometry.h.

References getCorners(), i, k_cornerSize, and m_repCorners.

Referenced by initSpan().

150  {
151  for (auto i=0U;i<k_cornerSize; ++i) m_repCorners[i]= {getCorners()[i].perp(), getCorners()[i].eta(), getCorners()[i].barePhi()};
152 
153  }
int i
Definition: DBlmapReader.cc:9
static constexpr unsigned int k_cornerSize
std::array< RhoEtaPhi, k_cornerSize > m_repCorners
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
void CaloCellGeometry::initSpan ( )
inlineprotected

Definition at line 131 of file CaloCellGeometry.h.

References funct::abs(), eta, getCorners(), initBack(), initCorners(), initReps(), m_corners, m_dEta, m_dPhi, and phi.

Referenced by IdealCastorTrapezoid::IdealCastorTrapezoid(), IdealZDCTrapezoid::IdealZDCTrapezoid(), IdealZPrism::IdealZPrism(), and PreshowerStrip::PreshowerStrip().

131  {
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  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual void initCorners(CornersVec &)=0
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
bool CaloCellGeometry::inside ( const GlobalPoint point) const

Returns true if the specified point is inside this cell.

Definition at line 167 of file CaloCellGeometry.cc.

References EE, getCorners(), i, AlCaHLTBitMon_ParallelJobs::p, funct::true, x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by CastorGeometry::getClosestCell(), CaloDetIdAssociator::insideElement(), and HCaloDetIdAssociator::insideElement().

168 {
169  bool ans ( false ) ;
170  const Pt3D p ( point.x(), point.y(), point.z() ) ;
171  const CornersVec& cog ( getCorners() ) ;
172  Pt3D co[8] ;
173  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
174  {
175  co[i] = Pt3D ( cog[i].x(), cog[i].y(), cog[i].z() ) ;
176  }
177 
178  const Plane3D AA ( co[0], co[1], co[2] ) ; // z<0
179  const Plane3D BB ( co[6], co[5], co[4] ) ; // z>0
180 
181  if( AA.distance(p)*BB.distance(p) >= 0 )
182  {
183  const Plane3D CC ( co[0], co[4], co[5] ) ; // x<0
184  const Plane3D DD ( co[2], co[6], co[7] ) ; // x>0
185  if( CC.distance(p)*DD.distance(p) >= 0 )
186  {
187  const Plane3D EE ( co[3], co[7], co[4] ) ; // y<0
188  const Plane3D FF ( co[1], co[5], co[6] ) ; // y>0
189  if( EE.distance(p)*FF.distance(p) >= 0 )
190  {
191  ans = true ;
192  }
193  }
194  }
195  return ans ;
196 }
EZArrayFL< GlobalPoint > CornersVec
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
CaloCellGeometry::Pt3D Pt3D
HepGeom::Point3D< CCGFloat > Pt3D
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
T x() const
Definition: PV3DBase.h:62
ROOT::Math::Plane3D Plane3D
const CCGFloat* CaloCellGeometry::param ( ) const
inline
float CaloCellGeometry::phiPos ( ) const
inline

Definition at line 90 of file CaloCellGeometry.h.

References m_rep, and RhoEtaPhi::phi().

90 { return m_rep.phi();}
float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:53
float CaloCellGeometry::phiSpan ( ) const
inline

Definition at line 93 of file CaloCellGeometry.h.

References m_dPhi.

93 { return m_dPhi;}
RhoEtaPhi const& CaloCellGeometry::repPos ( ) const
inline

Definition at line 87 of file CaloCellGeometry.h.

References m_rep.

Referenced by reco::PFRecHit::positionREP().

87 { return m_rep;}
float CaloCellGeometry::rhoPos ( ) const
inline

Definition at line 88 of file CaloCellGeometry.h.

References m_rep, and RhoEtaPhi::rho().

88 { return m_rep.rho();}
float rho() const
transverse momentum
Definition: PtEtaPhiMass.h:49
virtual void CaloCellGeometry::vocalCorners ( Pt3DVec vec,
const CCGFloat pv,
Pt3D ref 
) const
pure virtual

Member Data Documentation

constexpr unsigned int CaloCellGeometry::k_cornerSize = 8
static

Definition at line 69 of file CaloCellGeometry.h.

Referenced by initReps().

const float CaloCellGeometry::k_ScaleFromDDDtoGeant
static
GlobalPoint CaloCellGeometry::m_backPoint
private

Definition at line 157 of file CaloCellGeometry.h.

Referenced by getBackPoint(), and initBack().

CornersVec CaloCellGeometry::m_corners
private

Definition at line 158 of file CaloCellGeometry.h.

Referenced by emptyCorners(), getCorners(), and initSpan().

float CaloCellGeometry::m_dEta
private

Definition at line 161 of file CaloCellGeometry.h.

Referenced by etaSpan(), and initSpan().

float CaloCellGeometry::m_dPhi
private

Definition at line 162 of file CaloCellGeometry.h.

Referenced by initSpan(), and phiSpan().

const CCGFloat* CaloCellGeometry::m_parms
private

Definition at line 159 of file CaloCellGeometry.h.

Referenced by param().

GlobalPoint CaloCellGeometry::m_refPoint
private

Definition at line 156 of file CaloCellGeometry.h.

Referenced by getPosition().

RhoEtaPhi CaloCellGeometry::m_rep
private

Definition at line 160 of file CaloCellGeometry.h.

Referenced by etaPos(), phiPos(), repPos(), and rhoPos().

std::array<RhoEtaPhi,k_cornerSize> CaloCellGeometry::m_repCorners
private

Definition at line 163 of file CaloCellGeometry.h.

Referenced by getCornersREP(), and initReps().