CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PreshowerStrip.cc
Go to the documentation of this file.
2 #include <iostream>
3 
8 
9 
12 {}
13 
15  : CaloCellGeometry( tr )
16 {
17  *this = tr ;
18 }
19 
21 {}
22 
25 {
26  if( &tr != this )
27  {
28  CaloCellGeometry::operator=( tr ) ;
29  }
30  return *this ;
31 }
32 
35 {
37  if( co.uninitialized() )
38  {
39  CornersVec& corners ( setCorners() ) ;
40 
41  const GlobalPoint& ctr ( getPosition() ) ;
42  const CCGFloat x ( ctr.x() ) ;
43  const CCGFloat y ( ctr.y() ) ;
44  const CCGFloat z ( ctr.z() ) ;
45 
46  const double st ( sin(tilt()) ) ;
47  const double ct ( cos(tilt()) ) ;
48 
49  for( unsigned int ix ( 0 ) ; ix !=2 ; ++ix )
50  {
51  const double sx ( 0 == ix ? -1.0 : +1.0 ) ;
52  for( unsigned int iy ( 0 ) ; iy !=2 ; ++iy )
53  {
54  const double sy ( 0 == iy ? -1.0 : +1.0 ) ;
55  for( unsigned int iz ( 0 ) ; iz !=2 ; ++iz )
56  {
57  const double sz ( 0 == iz ? -1.0 : +1.0 ) ;
58  const unsigned int i ( 4*iz + 2*ix +
59  ( 1 == ix ? 1-iy : iy ) ) ;//keeps ordering same as before
60 
61  corners[ i ] = GlobalPoint(
62  dy()>dx() ?
63  x + sx*dx() :
64  x + sx*dx()*ct - sz*dz()*st ,
65  dy()<dx() ?
66  y + sy*dy() :
67  y + sy*dy()*ct - sz*dz()*st ,
68  dy()>dx() ?
69  z + sz*dz()*ct + sy*dy()*st :
70  z + sz*dz()*ct + sx*dx()*st ) ;
71  }
72  }
73  }
74  }
75  return co ;
76 }
77 
78 std::ostream& operator<<( std::ostream& s, const PreshowerStrip& cell )
79 {
80  s << "Center: " << cell.getPosition() << std::endl ;
81  if( cell.param() != 0 )
82  {
83  s << "dx = " << cell.dx() << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
84 
85  const CaloCellGeometry::CornersVec& corners ( cell.getCorners() ) ;
86  for( unsigned int ci ( 0 ) ; ci != corners.size(); ci++ )
87  {
88  s << "Corner: " << corners[ci] << std::endl;
89  }
90  }
91  else
92  {
93  s << " with empty parameters." << std::endl;
94  }
95 
96  return s;
97 }
98 
99 void
101  const CCGFloat* pv ,
102  Pt3D& ref )
103 {
104  assert( 8 == lc.size() ) ;
105  assert( 0 != pv ) ;
106 
107  const CCGFloat dx ( pv[0] ) ;
108  const CCGFloat dy ( pv[1] ) ;
109  const CCGFloat dz ( pv[2] ) ;
110 
111  lc[0] = Pt3D( -dx, -dy, -dz ) ;
112  lc[1] = Pt3D( -dx, dy, -dz ) ;
113  lc[2] = Pt3D( dx, dy, -dz ) ;
114  lc[3] = Pt3D( dx, -dy, -dz ) ;
115  lc[4] = Pt3D( -dx, -dy, dz ) ;
116  lc[5] = Pt3D( -dx, dy, dz ) ;
117  lc[6] = Pt3D( dx, dy, dz ) ;
118  lc[7] = Pt3D( dx, -dy, dz ) ;
119 
120  ref = Pt3D(0,0,0) ;
121 }
CaloCellGeometry::Pt3DVec Pt3DVec
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::Tr3D Tr3D
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual const CornersVec & getCorners() const
Returns the corner points of this cell&#39;s volume.
CaloCellGeometry::Pt3D Pt3D
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
CaloCellGeometry::CCGFloat CCGFloat
std::vector< Pt3D > Pt3DVec
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
float float float z
A base class to handle the shape of preshower strips.
const CCGFloat * param() const
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CCGFloat dx() const
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::Pt3D Pt3D
CCGFloat tilt() const
virtual ~PreshowerStrip()
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Tr3D Tr3D
CCGFloat dy() const
CCGFloat dz() const
CornersVec & setCorners() const
bool uninitialized() const
Definition: EZArrayFL.h:77
Definition: DDAxes.h:10
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T x() const
Definition: PV3DBase.h:62
PreshowerStrip & operator=(const PreshowerStrip &tr)
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.