CMS 3D CMS Logo

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 
33 void
35 {
36  if( corners.uninitialized() )
37  {
38  const GlobalPoint& ctr ( getPosition() ) ;
39  const CCGFloat x ( ctr.x() ) ;
40  const CCGFloat y ( ctr.y() ) ;
41  const CCGFloat z ( ctr.z() ) ;
42 
43  const double st ( sin(tilt()) ) ;
44  const double ct ( cos(tilt()) ) ;
45 
46  for( unsigned int ix ( 0 ) ; ix !=2 ; ++ix )
47  {
48  const double sx ( 0 == ix ? -1.0 : +1.0 ) ;
49  for( unsigned int iy ( 0 ) ; iy !=2 ; ++iy )
50  {
51  const double sy ( 0 == iy ? -1.0 : +1.0 ) ;
52  for( unsigned int iz ( 0 ) ; iz !=2 ; ++iz )
53  {
54  const double sz ( 0 == iz ? -1.0 : +1.0 ) ;
55  const unsigned int i ( 4*iz + 2*ix +
56  ( 1 == ix ? 1-iy : iy ) ) ;//keeps ordering same as before
57 
58  corners[ i ] = GlobalPoint(
59  dy()>dx() ?
60  x + sx*dx() :
61  x + sx*dx()*ct - sz*dz()*st ,
62  dy()<dx() ?
63  y + sy*dy() :
64  y + sy*dy()*ct - sz*dz()*st ,
65  dy()>dx() ?
66  z + sz*dz()*ct + sy*dy()*st :
67  z + sz*dz()*ct + sx*dx()*st ) ;
68  }
69  }
70  }
71  }
72 }
73 
74 std::ostream& operator<<( std::ostream& s, const PreshowerStrip& cell )
75 {
76  s << "Center: " << cell.getPosition() << std::endl ;
77  if( cell.param() != nullptr )
78  {
79  s << "dx = " << cell.dx() << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
80 
81  const CaloCellGeometry::CornersVec& corners ( cell.getCorners() ) ;
82  for( unsigned int ci ( 0 ) ; ci != corners.size(); ci++ )
83  {
84  s << "Corner: " << corners[ci] << std::endl;
85  }
86  }
87  else
88  {
89  s << " with empty parameters." << std::endl;
90  }
91 
92  return s;
93 }
94 
95 void
97  const CCGFloat* pv ,
98  Pt3D& ref )
99 {
100  assert( 8 == lc.size() ) ;
101  assert( nullptr != pv ) ;
102 
103  const CCGFloat dx ( pv[0] ) ;
104  const CCGFloat dy ( pv[1] ) ;
105  const CCGFloat dz ( pv[2] ) ;
106 
107  lc[0] = Pt3D( -dx, -dy, -dz ) ;
108  lc[1] = Pt3D( -dx, dy, -dz ) ;
109  lc[2] = Pt3D( dx, dy, -dz ) ;
110  lc[3] = Pt3D( dx, -dy, -dz ) ;
111  lc[4] = Pt3D( -dx, -dy, dz ) ;
112  lc[5] = Pt3D( -dx, dy, dz ) ;
113  lc[6] = Pt3D( dx, dy, dz ) ;
114  lc[7] = Pt3D( dx, -dy, dz ) ;
115 
116  ref = Pt3D(0,0,0) ;
117 }
CaloCellGeometry::Pt3DVec Pt3DVec
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
CaloCellGeometry::Tr3D Tr3D
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
CaloCellGeometry::Pt3D Pt3D
#define nullptr
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
CaloCellGeometry::CCGFloat CCGFloat
std::vector< Pt3D > Pt3DVec
void initCorners(CaloCellGeometry::CornersVec &) override
A base class to handle the shape of preshower strips.
PreshowerStrip::Pt3D Pt3D
const CCGFloat * param() const
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def pv(vc)
Definition: MetAnalyzer.py:7
CCGFloat dx() const
std::ostream & operator<<(std::ostream &s, const PreshowerStrip &cell)
PreshowerStrip::Tr3D Tr3D
PreshowerStrip::CCGFloat CCGFloat
CCGFloat tilt() const
HepGeom::Point3D< CCGFloat > Pt3D
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
CCGFloat dy() const
CCGFloat dz() const
bool uninitialized() const
Definition: EZArrayFL.h:77
PreshowerStrip::Pt3DVec Pt3DVec
T x() const
Definition: PV3DBase.h:62
~PreshowerStrip() override
PreshowerStrip & operator=(const PreshowerStrip &tr)