CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IdealCastorTrapezoid.cc
Go to the documentation of this file.
2 #include "CLHEP/Geometry/Plane3D.h"
3 #include "CLHEP/Geometry/Transform3D.h"
4 #include <math.h>
5 
10 
13 {
14 }
15 
17  : CaloCellGeometry( idct )
18 {
19  *this = idct ;
20 }
21 
24 {
25  if( &idct != this ) CaloCellGeometry::operator=( idct ) ;
26  return *this ;
27 }
28 
30  const CornersMgr* mgr ,
31  const CCGFloat* parm )
32  : CaloCellGeometry ( faceCenter, mgr, parm )
33 {initSpan();}
34 
36 {
37 }
38 
39 CCGFloat
41 {
42  return param()[0] ;
43 }
44 
45 CCGFloat
47 {
48  return param()[1] ;
49 }
50 
51 CCGFloat
53 {
54  return ( dxl()+dxh() )/2. ;
55 }
56 
57 CCGFloat
59 {
60  return param()[2] ;
61 }
62 
63 CCGFloat
65 {
66  return dh()*sin(an()) ;
67 }
68 
69 CCGFloat
71 {
72  return param()[3] ;
73 }
74 
75 CCGFloat
77 {
78  return dh()*cos(an()) ;
79 }
80 
81 CCGFloat
83 {
84  return dz() + dhz() ;
85 }
86 
87 CCGFloat
89 {
90  return dz() - dhz() ;
91 }
92 
93 CCGFloat
95 {
96  return param()[4] ;
97 }
98 
99 CCGFloat
101 {
102  return param()[5] ;
103 }
104 
105 void
107  const CCGFloat* pv ,
108  Pt3D& ref ) const
109 {
110  localCorners( vec, pv, ref ) ;
111 }
112 
113 void
115  const CCGFloat* pv ,
116  Pt3D& ref )
117 {
118  assert( 8 == lc.size() ) ;
119  assert( 0 != pv ) ;
120 
121  const CCGFloat dxl ( pv[0] ) ;
122  const CCGFloat dxh ( pv[1] ) ;
123  const CCGFloat dh ( pv[2] ) ;
124  const CCGFloat dz ( pv[3] ) ;
125  const CCGFloat an ( pv[4] ) ;
126  const CCGFloat dx ( ( dxl +dxh )/2. ) ;
127  const CCGFloat dy ( dh*sin(an) ) ;
128  const CCGFloat dhz ( dh*cos(an) ) ;
129  const CCGFloat dzb ( dz + dhz ) ;
130  const CCGFloat dzs ( dz - dhz ) ;
131 
132  assert( 0 < (dxl*dxh) ) ;
133 
134  lc[ 0 ] = Pt3D ( -dx, -dy , dzb ) ;
135  lc[ 1 ] = Pt3D ( -dx, +dy , dzs ) ;
136  lc[ 2 ] = Pt3D ( +2*dxh -dx, +dy , dzs ) ;
137  lc[ 3 ] = Pt3D ( +2*dxl -dx, -dy , dzb ) ;
138  lc[ 4 ] = Pt3D ( -dx, -dy , -dzs ) ;
139  lc[ 5 ] = Pt3D ( -dx, +dy , -dzb ) ;
140  lc[ 6 ] = Pt3D ( +2*dxh -dx, +dy , -dzb ) ;
141  lc[ 7 ] = Pt3D ( +2*dxl -dx, -dy , -dzs ) ;
142 
143  ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
144 }
145 
148 {
149  const CornersVec& co ( CaloCellGeometry::getCorners() ) ;
150  if( co.uninitialized() )
151  {
153  const GlobalPoint& p ( getPosition() ) ;
154  const CCGFloat zsign ( 0 < p.z() ? 1. : -1. ) ;
155  const Pt3D gf ( p.x(), p.y(), p.z() ) ;
156 
157  Pt3D lf ;
158  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
159  localCorners( lc, param(), lf ) ;
160  const Pt3D lb ( lf.x() , lf.y() , lf.z() - 2.*dz() ) ;
161  const Pt3D ls ( lf.x() - dx(), lf.y(), lf.z() ) ;
162 
163 
164  const CCGFloat fphi ( atan( dx()/( dR() + dy() ) ) ) ;
165  const Pt3D gb ( gf.x() , gf.y() , gf.z() + 2.*zsign*dz() ) ;
166 
167  const CCGFloat rho ( dR() + dy() ) ;
168  const CCGFloat phi ( gf.phi() + fphi ) ;
169  const Pt3D gs ( rho*cos(phi) ,
170  rho*sin(phi) ,
171  gf.z() ) ;
172 
173  const Tr3D tr ( lf, lb, ls,
174  gf, gb, gs ) ;
175 
176  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
177  {
178  const Pt3D gl ( tr*lc[i] ) ;
179  corners[i] = GlobalPoint( gl.x(), gl.y(), gl.z() ) ;
180  }
181  }
182  return co ;
183 }
184 
185 std::ostream& operator<<( std::ostream& s, const IdealCastorTrapezoid& cell )
186 {
187  s << "Center: " << cell.getPosition() << std::endl ;
188 // s << ", dx = " << cell.dx()
189 //<< "TiltAngle = " << cell.an()
190 // << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
191  return s;
192 }
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::Pt3D Pt3D
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
HepGeom::Transform3D Tr3D
std::vector< Pt3D > Pt3DVec
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
const CCGFloat * param() const
virtual void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual const CornersVec & getCorners() const
Returns the corner points of this cell&#39;s volume.
IdealCastorTrapezoid & operator=(const IdealCastorTrapezoid &idct)
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::Pt3D Pt3D
void initSpan() const
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
CaloCellGeometry::Tr3D Tr3D
CornersVec & setCorners() const
bool uninitialized() const
Definition: EZArrayFL.h:77
double gf
Definition: hdecay.h:34
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T x() const
Definition: PV3DBase.h:62
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.
Definition: DDAxes.h:10