CMS 3D CMS Logo

IdealZDCTrapezoid.cc
Go to the documentation of this file.
2 #include <cmath>
3 
7 
10 {
11 }
12 
14  : CaloCellGeometry( idzt )
15 {
16  *this = idzt ;
17 }
18 
21 {
22  if( &idzt != this ) CaloCellGeometry::operator=( idzt ) ;
23  return *this ;
24 }
25 
27  CornersMgr* mgr ,
28  const CCGFloat* parm ) :
29  CaloCellGeometry ( faceCenter, mgr, parm )
30 {initSpan();}
31 
33 
34 CCGFloat
35 IdealZDCTrapezoid::an() const { return param()[0] ; }
36 
37 CCGFloat
39 {
40  return param()[1] ;
41 }
42 
43 CCGFloat
45 {
46  return param()[2] ;
47 }
48 
49 CCGFloat
51 {
52  return param()[3] ;
53 }
54 
55 CCGFloat
57 {
58  return tan( an() ) ;
59 }
60 
61 CCGFloat
63 {
64  return dy()*ta() ;
65 }
66 
67 void
69  const CCGFloat* pv ,
70  Pt3D& ref ) const
71 {
72  localCorners( vec, pv, ref ) ;
73 }
74 
75 void
77  const CCGFloat* pv ,
78  Pt3D& ref )
79 {
80  assert( 8 == lc.size() ) ;
81  assert( nullptr != pv ) ;
82 
83  const CCGFloat an ( pv[0] ) ;
84  const CCGFloat dx ( pv[1] ) ;
85  const CCGFloat dy ( pv[2] ) ;
86  const CCGFloat dz ( pv[3] ) ;
87  const CCGFloat ta ( tan( an ) ) ;
88  const CCGFloat dt ( dy*ta ) ;
89 
90  lc[0] = Pt3D ( -dx, -dy, +dz+dt ) ;
91  lc[1] = Pt3D ( -dx, +dy, +dz-dt ) ;
92  lc[2] = Pt3D ( +dx, +dy, +dz-dt ) ;
93  lc[3] = Pt3D ( +dx, -dy, +dz+dt ) ;
94  lc[4] = Pt3D ( -dx, -dy, -dz+dt ) ;
95  lc[5] = Pt3D ( -dx, +dy, -dz-dt ) ;
96  lc[6] = Pt3D ( +dx, +dy, -dz-dt ) ;
97  lc[7] = Pt3D ( +dx, -dy, -dz+dt ) ;
98 
99  ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
100 }
101 
102 void
104 {
105  if( corners.uninitialized() )
106  {
107  const GlobalPoint& p ( getPosition() ) ;
108  const CCGFloat zsign ( 0 < p.z() ? 1. : -1. ) ;
109  const Pt3D gf ( p.x(), p.y(), p.z() ) ;
110 
111  Pt3D lf ;
112  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
113  localCorners( lc, param(), lf ) ;
114  const Pt3D lb ( lf.x() , lf.y() , lf.z() - 2.*dz() ) ;
115  const Pt3D ls ( lf.x() - dx(), lf.y(), lf.z() ) ;
116 
117  const Pt3D gb ( gf.x() , gf.y() , gf.z() + 2.*zsign*dz() ) ;
118 
119  const Pt3D gs ( gf.x() - zsign*dx(),
120  gf.y() ,
121  gf.z() ) ;
122 
123  const HepGeom::Transform3D tr ( lf, lb, ls,
124  gf, gb, gs ) ;
125 
126  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
127  {
128  const Pt3D gl ( tr*lc[i] ) ;
129  corners[i] = GlobalPoint( gl.x(), gl.y(), gl.z() ) ;
130  }
131  }
132 }
133 
134 std::ostream& operator<<( std::ostream& s, const IdealZDCTrapezoid& cell )
135 {
136  s << "Center: " << cell.getPosition() << std::endl ;
137  s << "TiltAngle = " << cell.an()*180./M_PI << " deg, dx = "
138  << cell.dx()
139  << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
140  return s;
141 }
CaloCellGeometry::CCGFloat CCGFloat
CCGFloat dy() const
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
CCGFloat dx() const
void initCorners(CaloCellGeometry::CornersVec &) override
std::vector< Pt3D > Pt3DVec
std::ostream & operator<<(std::ostream &s, const IdealZDCTrapezoid &cell)
IdealZDCTrapezoid & operator=(const IdealZDCTrapezoid &idzt)
const CCGFloat * param() const
T z() const
Definition: PV3DBase.h:64
CCGFloat an() const
CCGFloat ta() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
def pv(vc)
Definition: MetAnalyzer.py:6
CaloCellGeometry::Pt3D Pt3D
#define M_PI
def ls(path, rec=False)
Definition: eostools.py:348
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
CCGFloat dt() const
void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const override
CCGFloat dz() const
~IdealZDCTrapezoid() override
bool uninitialized() const
Definition: EZArrayFL.h:77
double gf
Definition: hdecay.h:34
Definition: AbsArchive.cc:53
T x() const
Definition: PV3DBase.h:62
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Pt3D Pt3D