test
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  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 
146 void
148 {
149  if( corners.uninitialized() )
150  {
151  const GlobalPoint& p ( getPosition() ) ;
152  const CCGFloat zsign ( 0 < p.z() ? 1. : -1. ) ;
153  const Pt3D gf ( p.x(), p.y(), p.z() ) ;
154 
155  Pt3D lf ;
156  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
157  localCorners( lc, param(), lf ) ;
158  const Pt3D lb ( lf.x() , lf.y() , lf.z() - 2.*dz() ) ;
159  const Pt3D ls ( lf.x() - dx(), lf.y(), lf.z() ) ;
160 
161 
162  const CCGFloat fphi ( atan( dx()/( dR() + dy() ) ) ) ;
163  const Pt3D gb ( gf.x() , gf.y() , gf.z() + 2.*zsign*dz() ) ;
164 
165  const CCGFloat rho ( dR() + dy() ) ;
166  const CCGFloat phi ( gf.phi() + fphi ) ;
167  const Pt3D gs ( rho*cos(phi) ,
168  rho*sin(phi) ,
169  gf.z() ) ;
170 
171  const Tr3D tr ( lf, lb, ls,
172  gf, gb, gs ) ;
173 
174  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
175  {
176  const Pt3D gl ( tr*lc[i] ) ;
177  corners[i] = GlobalPoint( gl.x(), gl.y(), gl.z() ) ;
178  }
179  }
180 }
181 
182 std::ostream& operator<<( std::ostream& s, const IdealCastorTrapezoid& cell )
183 {
184  s << "Center: " << cell.getPosition() << std::endl ;
185 // s << ", dx = " << cell.dx()
186 //<< "TiltAngle = " << cell.an()
187 // << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
188  return s;
189 }
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::Pt3D Pt3D
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
assert(m_qm.get())
def ls
Definition: eostools.py:348
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
IdealCastorTrapezoid & operator=(const IdealCastorTrapezoid &idct)
virtual void initCorners(CornersVec &) override
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::Pt3D Pt3D
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
CaloCellGeometry::Tr3D Tr3D
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