CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IdealZPrism.cc
Go to the documentation of this file.
2 #include <math.h>
3 
7 
10 {}
11 
13  : CaloCellGeometry( idzp )
14 {
15  *this = idzp ;
16 }
17 
20 {
21  if( &idzp != this ) CaloCellGeometry::operator=( idzp ) ;
22  return *this ;
23 }
24 
26  const CornersMgr* mgr ,
27  const CCGFloat* parm )
28  : CaloCellGeometry ( faceCenter, mgr, parm )
29 {}
30 
32 {}
33 
34 CCGFloat
36 {
37  return param()[0] ;
38 }
39 
40 CCGFloat
42 {
43  return param()[1] ;
44 }
45 
46 CCGFloat
48 {
49  return param()[2] ;
50 }
51 
52 CCGFloat
54 {
55  return param()[3] ;
56 }
57 
58 CCGFloat
60 {
61  return param()[4] ;
62 }
63 
64 void
66  const CCGFloat* pv ,
67  Pt3D& ref ) const
68 {
69  localCorners( vec, pv, ref ) ;
70 }
71 
74  float phi ,
75  float rad )
76 {
77  return GlobalPoint( rad*cosf( phi )/coshf( eta ) ,
78  rad*sinf( phi )/coshf( eta ) ,
79  rad*tanhf( eta ) ) ;
80 }
81 
84  float phi ,
85  float perp )
86 {
87  return GlobalPoint( perp*cosf( phi ) ,
88  perp*sinf( phi ) ,
89  perp*sinhf( eta ) );
90 }
91 
94  float phi ,
95  float z )
96 {
97  return GlobalPoint( z*cosf( phi )/sinhf( eta ) ,
98  z*sinf( phi )/sinhf( eta ) ,
99  z ) ;
100 }
101 
102 void
104  const CCGFloat* pv ,
105  Pt3D& ref )
106 {
107  assert( 8 == lc.size() ) ;
108  if( false )
109  {
110  GlobalPoint g1 ( etaPhiR(0,0,0) ) ;
111  GlobalPoint g2 ( etaPhiPerp(0,0,0) ) ;
112  }
113  assert( 0 != pv ) ;
114 
115  const CCGFloat dEta ( pv[0] ) ;
116  const CCGFloat dPhi ( pv[1] ) ;
117  const CCGFloat dz ( pv[2] ) ;
118  const CCGFloat eta ( pv[3] ) ;
119  const CCGFloat z ( pv[4] ) ;
120 
121  std::vector<GlobalPoint> gc ( 8, GlobalPoint(0,0,0) ) ;
122 
123  const GlobalPoint p ( etaPhiZ( eta, 0, z ) ) ;
124 
125  const float z_near ( z ) ;
126  const float z_far ( z*( 1 - 2*dz/p.mag() ) ) ;
127  gc[ 0 ] = etaPhiZ( eta + dEta , +dPhi , z_near ) ; // (+,+,near)
128  gc[ 1 ] = etaPhiZ( eta + dEta , -dPhi , z_near ) ; // (+,-,near)
129  gc[ 2 ] = etaPhiZ( eta - dEta , -dPhi , z_near ) ; // (-,-,near)
130  gc[ 3 ] = etaPhiZ( eta - dEta , +dPhi , z_near ) ; // (-,+,far)
131  gc[ 4 ] = GlobalPoint( gc[0].x(), gc[0].y(), z_far ); // (+,+,far)
132  gc[ 5 ] = GlobalPoint( gc[1].x(), gc[1].y(), z_far ); // (+,-,far)
133  gc[ 6 ] = GlobalPoint( gc[2].x(), gc[2].y(), z_far ); // (-,-,far)
134  gc[ 7 ] = GlobalPoint( gc[3].x(), gc[3].y(), z_far ); // (-,+,far)
135 
136  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
137  {
138  lc[i] = Pt3D( gc[i].x(), gc[i].y(), gc[i].z() ) ;
139  }
140 
141  ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
142 }
143 
146 {
147  const CornersVec& co ( CaloCellGeometry::getCorners() ) ;
148  if( co.uninitialized() )
149  {
150  CornersVec& corners ( setCorners() ) ;
151 
152  const GlobalPoint p ( getPosition() ) ;
153  const CCGFloat z_near ( p.z() ) ;
154  const CCGFloat z_far ( z_near + 2*dz()*p.z()/fabs( p.z() ) ) ;
155  const CCGFloat eta ( p.eta() ) ;
156  const CCGFloat phi ( p.phi() ) ;
157 
158  corners[ 0 ] = etaPhiZ( eta + dEta(), phi + dPhi(), z_near ); // (+,+,near)
159  corners[ 1 ] = etaPhiZ( eta + dEta(), phi - dPhi(), z_near ); // (+,-,near)
160  corners[ 2 ] = etaPhiZ( eta - dEta(), phi - dPhi(), z_near ); // (-,-,near)
161  corners[ 3 ] = etaPhiZ( eta - dEta(), phi + dPhi(), z_near ); // (-,+,near)
162  corners[ 4 ] = GlobalPoint( corners[0].x(), corners[0].y(), z_far ); // (+,+,far)
163  corners[ 5 ] = GlobalPoint( corners[1].x(), corners[1].y(), z_far ); // (+,-,far)
164  corners[ 6 ] = GlobalPoint( corners[2].x(), corners[2].y(), z_far ); // (-,-,far)
165  corners[ 7 ] = GlobalPoint( corners[3].x(), corners[3].y(), z_far ); // (-,+,far)
166  }
167  return co ;
168 }
169 
170 std::ostream& operator<<( std::ostream& s, const IdealZPrism& cell )
171 {
172  s << "Center: " << cell.getPosition() << std::endl ;
173  s << "dEta = " << cell.dEta() << ", dPhi = " << cell.dPhi() << ", dz = " << cell.dz() << std::endl ;
174  return s;
175 }
virtual const CornersVec & getCorners() const
Returns the corner points of this cell&#39;s volume.
Definition: IdealZPrism.cc:145
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::CCGFloat CCGFloat
Definition: IdealZPrism.h:31
CCGFloat eta() const
Definition: IdealZPrism.cc:53
static GlobalPoint etaPhiZ(float eta, float phi, float z)
Definition: IdealZPrism.cc:93
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const
Definition: IdealZPrism.cc:65
static GlobalPoint etaPhiR(float eta, float phi, float rad)
Definition: IdealZPrism.cc:73
std::vector< Pt3D > Pt3DVec
T eta() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
CCGFloat dz() const
Definition: IdealZPrism.cc:47
float float float z
const CCGFloat * param() const
T mag() const
Definition: PV3DBase.h:67
virtual ~IdealZPrism()
Definition: IdealZPrism.cc:31
T z() const
Definition: PV3DBase.h:64
CaloCellGeometry::CCGFloat CCGFloat
IdealZPrism & operator=(const IdealZPrism &idzp)
Definition: IdealZPrism.cc:19
CaloCellGeometry::Pt3D Pt3D
CCGFloat dEta() const
Definition: IdealZPrism.cc:35
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealZPrism.cc:103
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: IdealZPrism.h:32
Definition: EZMgrFL.h:8
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: IdealZPrism.h:33
CCGFloat dPhi() const
Definition: IdealZPrism.cc:41
T eta() const
Definition: PV3DBase.h:76
T perp() const
Magnitude of transverse component.
static GlobalPoint etaPhiPerp(float eta, float phi, float perp)
Definition: IdealZPrism.cc:83
CornersVec & setCorners() const
bool uninitialized() const
Definition: EZArrayFL.h:77
Definition: DDAxes.h:10
CCGFloat z() const
Definition: IdealZPrism.cc:59
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.
Definition: DDAxes.h:10