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 {
34 }
35 
37 {
38 }
39 
40 CCGFloat
42 {
43  return param()[0] ;
44 }
45 
46 CCGFloat
48 {
49  return param()[1] ;
50 }
51 
52 CCGFloat
54 {
55  return ( dxl()+dxh() )/2. ;
56 }
57 
58 CCGFloat
60 {
61  return param()[2] ;
62 }
63 
64 CCGFloat
66 {
67  return dh()*sin(an()) ;
68 }
69 
70 CCGFloat
72 {
73  return param()[3] ;
74 }
75 
76 CCGFloat
78 {
79  return dh()*cos(an()) ;
80 }
81 
82 CCGFloat
84 {
85  return dz() + dhz() ;
86 }
87 
88 CCGFloat
90 {
91  return dz() - dhz() ;
92 }
93 
94 CCGFloat
96 {
97  return param()[4] ;
98 }
99 
100 CCGFloat
102 {
103  return param()[5] ;
104 }
105 
106 void
108  const CCGFloat* pv ,
109  Pt3D& ref ) const
110 {
111  localCorners( vec, pv, ref ) ;
112 }
113 
114 void
116  const CCGFloat* pv ,
117  Pt3D& ref )
118 {
119  assert( 8 == lc.size() ) ;
120  assert( 0 != pv ) ;
121 
122  const CCGFloat dxl ( pv[0] ) ;
123  const CCGFloat dxh ( pv[1] ) ;
124  const CCGFloat dh ( pv[2] ) ;
125  const CCGFloat dz ( pv[3] ) ;
126  const CCGFloat an ( pv[4] ) ;
127  const CCGFloat dx ( ( dxl +dxh )/2. ) ;
128  const CCGFloat dy ( dh*sin(an) ) ;
129  const CCGFloat dhz ( dh*cos(an) ) ;
130  const CCGFloat dzb ( dz + dhz ) ;
131  const CCGFloat dzs ( dz - dhz ) ;
132 
133  assert( 0 < (dxl*dxh) ) ;
134 
135  lc[ 0 ] = Pt3D ( -dx, -dy , dzb ) ;
136  lc[ 1 ] = Pt3D ( -dx, +dy , dzs ) ;
137  lc[ 2 ] = Pt3D ( +2*dxh -dx, +dy , dzs ) ;
138  lc[ 3 ] = Pt3D ( +2*dxl -dx, -dy , dzb ) ;
139  lc[ 4 ] = Pt3D ( -dx, -dy , -dzs ) ;
140  lc[ 5 ] = Pt3D ( -dx, +dy , -dzb ) ;
141  lc[ 6 ] = Pt3D ( +2*dxh -dx, +dy , -dzb ) ;
142  lc[ 7 ] = Pt3D ( +2*dxl -dx, -dy , -dzs ) ;
143 
144  ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
145 }
146 
149 {
150  const CornersVec& co ( CaloCellGeometry::getCorners() ) ;
151  if( co.uninitialized() )
152  {
154  const GlobalPoint& p ( getPosition() ) ;
155  const CCGFloat zsign ( 0 < p.z() ? 1. : -1. ) ;
156  const Pt3D gf ( p.x(), p.y(), p.z() ) ;
157 
158  Pt3D lf ;
159  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
160  localCorners( lc, param(), lf ) ;
161  const Pt3D lb ( lf.x() , lf.y() , lf.z() - 2.*dz() ) ;
162  const Pt3D ls ( lf.x() - dx(), lf.y(), lf.z() ) ;
163 
164 
165  const CCGFloat fphi ( atan( dx()/( dR() + dy() ) ) ) ;
166  const Pt3D gb ( gf.x() , gf.y() , gf.z() + 2.*zsign*dz() ) ;
167 
168  const CCGFloat rho ( dR() + dy() ) ;
169  const CCGFloat phi ( gf.phi() + fphi ) ;
170  const Pt3D gs ( rho*cos(phi) ,
171  rho*sin(phi) ,
172  gf.z() ) ;
173 
174  const Tr3D tr ( lf, lb, ls,
175  gf, gb, gs ) ;
176 
177  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
178  {
179  const Pt3D gl ( tr*lc[i] ) ;
180  corners[i] = GlobalPoint( gl.x(), gl.y(), gl.z() ) ;
181  }
182  }
183  return co ;
184 }
185 
186 std::ostream& operator<<( std::ostream& s, const IdealCastorTrapezoid& cell )
187 {
188  s << "Center: " << cell.getPosition() << std::endl ;
189 // s << ", dx = " << cell.dx()
190 //<< "TiltAngle = " << cell.an()
191 // << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
192  return s;
193 }
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:62
HepGeom::Transform3D Tr3D
std::vector< Pt3D > Pt3DVec
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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:63
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
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
CaloCellGeometry::Tr3D Tr3D
CornersVec & setCorners() const
bool uninitialized() const
Definition: EZArrayFL.h:77
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
T x() const
Definition: PV3DBase.h:61
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.
Definition: DDAxes.h:10
CaloCellGeometry & operator=(const CaloCellGeometry &cell)