CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IdealZDCTrapezoid.cc
Go to the documentation of this file.
2 #include <math.h>
3 
4 namespace calogeom {
5 
6  std::vector<HepGeom::Point3D<double> >
7  IdealZDCTrapezoid::localCorners( const double* pv ,
8  HepGeom::Point3D<double> & ref )
9  {
10  assert( 0 != pv ) ;
11 
12  const double an ( pv[0] ) ;
13  const double dx ( pv[1] ) ;
14  const double dy ( pv[2] ) ;
15  const double dz ( pv[3] ) ;
16  const double ta ( tan( an ) ) ;
17  const double dt ( dy*ta ) ;
18 
19  std::vector<HepGeom::Point3D<double> > lc ( 8, HepGeom::Point3D<double> ( 0,0,0) ) ;
20 
21  lc[0] = HepGeom::Point3D<double> ( -dx, -dy, +dz+dt ) ;
22  lc[1] = HepGeom::Point3D<double> ( -dx, +dy, +dz-dt ) ;
23  lc[2] = HepGeom::Point3D<double> ( +dx, +dy, +dz-dt ) ;
24  lc[3] = HepGeom::Point3D<double> ( +dx, -dy, +dz+dt ) ;
25  lc[4] = HepGeom::Point3D<double> ( -dx, -dy, -dz+dt ) ;
26  lc[5] = HepGeom::Point3D<double> ( -dx, +dy, -dz-dt ) ;
27  lc[6] = HepGeom::Point3D<double> ( +dx, +dy, -dz-dt ) ;
28  lc[7] = HepGeom::Point3D<double> ( +dx, -dy, -dz+dt ) ;
29 
30  ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
31  return lc ;
32  }
33 
36  {
38  if( co.uninitialized() )
39  {
41  const GlobalPoint& p ( getPosition() ) ;
42  const double zsign ( 0 < p.z() ? 1. : -1. ) ;
43  const HepGeom::Point3D<double> gf ( p.x(), p.y(), p.z() ) ;
44 
45  HepGeom::Point3D<double> lf ;
46  const std::vector<HepGeom::Point3D<double> > lc ( localCorners( param(), lf ) ) ;
47  const HepGeom::Point3D<double> lb ( lf.x() , lf.y() , lf.z() - 2.*dz() ) ;
48  const HepGeom::Point3D<double> ls ( lf.x() - dx(), lf.y(), lf.z() ) ;
49 
50  const HepGeom::Point3D<double> gb ( gf.x() , gf.y() , gf.z() + 2.*zsign*dz() ) ;
51 
52  const HepGeom::Point3D<double> gs ( gf.x() - zsign*dx(),
53  gf.y() ,
54  gf.z() ) ;
55 
56  const HepGeom::Transform3D tr ( lf, lb, ls,
57  gf, gb, gs ) ;
58 
59  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
60  {
61  const HepGeom::Point3D<double> gl ( tr*lc[i] ) ;
62  corners[i] = GlobalPoint( gl.x(), gl.y(), gl.z() ) ;
63  }
64  }
65  return co ;
66  }
67 
68  std::ostream& operator<<( std::ostream& s, const IdealZDCTrapezoid& cell )
69  {
70  s << "Center: " << cell.getPosition() << std::endl ;
71  s << "TiltAngle = " << cell.an()*180./M_PI << " deg, dx = "
72  << cell.dx()
73  << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
74  return s;
75  }
76 }
int i
Definition: DBlmapReader.cc:9
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:57
const double an() const
const double * param() const
const double dz() const
virtual const CornersVec & getCorners() const
T z() const
Definition: PV3DBase.h:58
const double ta() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static std::vector< HepGeom::Point3D< double > > localCorners(const double *pv, HepGeom::Point3D< double > &ref)
#define M_PI
Definition: BFit3D.cc:3
const double dx() const
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 double dt() const
const GlobalPoint & getPosition() const
T x() const
Definition: PV3DBase.h:56
virtual const CornersVec & getCorners() const =0
const double dy() const