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 
6 namespace calogeom {
7 
8  std::vector<HepGeom::Point3D<double> >
10  HepGeom::Point3D<double> & ref )
11  {
12  assert( 0 != pv ) ;
13 
14  const double dxl ( pv[0] ) ;
15  const double dxh ( pv[1] ) ;
16  const double dh ( pv[2] ) ;
17  const double dz ( pv[3] ) ;
18  const double an ( pv[4] ) ;
19  const double dx ( ( dxl +dxh )/2. ) ;
20  const double dy ( dh*sin(an) ) ;
21  const double dhz ( dh*cos(an) ) ;
22  const double dzb ( dz + dhz ) ;
23  const double dzs ( dz - dhz ) ;
24 
25  assert( 0 < (dxl*dxh) ) ;
26 
27  std::vector<HepGeom::Point3D<double> > lc ( 8, HepGeom::Point3D<double> ( 0,0,0) ) ;
28 
29  lc[ 0 ] = HepGeom::Point3D<double> ( -dx, -dy , dzb ) ;
30  lc[ 1 ] = HepGeom::Point3D<double> ( -dx, +dy , dzs ) ;
31  lc[ 2 ] = HepGeom::Point3D<double> ( +2*dxh -dx, +dy , dzs ) ;
32  lc[ 3 ] = HepGeom::Point3D<double> ( +2*dxl -dx, -dy , dzb ) ;
33  lc[ 4 ] = HepGeom::Point3D<double> ( -dx, -dy , -dzs ) ;
34  lc[ 5 ] = HepGeom::Point3D<double> ( -dx, +dy , -dzb ) ;
35  lc[ 6 ] = HepGeom::Point3D<double> ( +2*dxh -dx, +dy , -dzb ) ;
36  lc[ 7 ] = HepGeom::Point3D<double> ( +2*dxl -dx, -dy , -dzs ) ;
37 
38  ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
39  return lc ;
40  }
41 
44  {
46  if( co.uninitialized() )
47  {
49  const GlobalPoint& p ( getPosition() ) ;
50  const double zsign ( 0 < p.z() ? 1. : -1. ) ;
51  const HepGeom::Point3D<double> gf ( p.x(), p.y(), p.z() ) ;
52 
53  HepGeom::Point3D<double> lf ;
54  const std::vector<HepGeom::Point3D<double> > lc ( localCorners( param(), lf ) ) ;
55  const HepGeom::Point3D<double> lb ( lf.x() , lf.y() , lf.z() - 2.*dz() ) ;
56  const HepGeom::Point3D<double> ls ( lf.x() - dx(), lf.y(), lf.z() ) ;
57 
58 
59  const double fphi ( atan( dx()/( dR() + dy() ) ) ) ;
60  const HepGeom::Point3D<double> gb ( gf.x() , gf.y() , gf.z() + 2.*zsign*dz() ) ;
61 
62  const double rho ( dR() + dy() ) ;
63  const double phi ( gf.phi() + fphi ) ;
64  const HepGeom::Point3D<double> gs ( rho*cos(phi) ,
65  rho*sin(phi) ,
66  gf.z() ) ;
67 
68  const HepGeom::Transform3D tr ( lf, lb, ls,
69  gf, gb, gs ) ;
70 
71  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
72  {
73  const HepGeom::Point3D<double> gl ( tr*lc[i] ) ;
74  corners[i] = GlobalPoint( gl.x(), gl.y(), gl.z() ) ;
75  }
76  }
77  return co ;
78  }
79 
80  std::ostream& operator<<( std::ostream& s, const IdealCastorTrapezoid& cell )
81  {
82  s << "Center: " << cell.getPosition() << std::endl ;
83 // s << ", dx = " << cell.dx()
84 //<< "TiltAngle = " << cell.an()
85 // << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
86  return s;
87  }
88 }
int i
Definition: DBlmapReader.cc:9
static std::vector< HepGeom::Point3D< double > > localCorners(const double *pv, HepGeom::Point3D< double > &ref)
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:57
virtual const CornersVec & getCorners() const
const double * param() const
T z() const
Definition: PV3DBase.h:58
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CornersVec & setCorners() const
bool uninitialized() const
Definition: EZArrayFL.h:74
std::ostream & operator<<(std::ostream &s, const IdealObliquePrism &cell)
double gf
Definition: hdecay.h:34
string s
Definition: asciidump.py:422
const GlobalPoint & getPosition() const
T x() const
Definition: PV3DBase.h:56
virtual const CornersVec & getCorners() const =0
Definition: DDAxes.h:10