CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IdealZPrism.cc
Go to the documentation of this file.
2 #include <math.h>
3 
7 
10 {}
11 
13  : CaloCellGeometry( idzp )
14 {
15  *this = idzp ;
16 }
17 
20 {
21  if( &idzp != this ) CaloCellGeometry::operator=( idzp ) ;
22  return *this ;
23 }
24 
26  CornersMgr* mgr ,
27  const CCGFloat* parm )
28  : CaloCellGeometry ( faceCenter, mgr, parm )
29 {initSpan();}
30 
32 {}
33 
34 CCGFloat
36 {
37  return param()[0] ;
38 }
39 
40 CCGFloat
42 {
43  return param()[1] ;
44 }
45 
46 CCGFloat
48 {
49  return param()[2] ;
50 }
51 
52 CCGFloat
54 {
55  return param()[3] ;
56 }
57 
58 CCGFloat
60 {
61  return param()[4] ;
62 }
63 
64 void
66  const CCGFloat* pv ,
67  Pt3D& ref ) const
68 {
69  localCorners( vec, pv, ref ) ;
70 }
71 
74  float phi ,
75  float rad )
76 {
77  return GlobalPoint( rad*cosf( phi )/coshf( eta ) ,
78  rad*sinf( phi )/coshf( eta ) ,
79  rad*tanhf( eta ) ) ;
80 }
81 
84  float phi ,
85  float perp )
86 {
87  return GlobalPoint( perp*cosf( phi ) ,
88  perp*sinf( phi ) ,
89  perp*sinhf( eta ) );
90 }
91 
94  float phi ,
95  float z )
96 {
97  return GlobalPoint( z*cosf( phi )/sinhf( eta ) ,
98  z*sinf( phi )/sinhf( eta ) ,
99  z ) ;
100 }
101 
102 void
104  const CCGFloat* pv ,
105  Pt3D& ref )
106 {
107  assert( 8 == lc.size() ) ;
108  assert( 0 != pv ) ;
109 
110  const CCGFloat dEta ( pv[0] ) ;
111  const CCGFloat dPhi ( pv[1] ) ;
112  const CCGFloat dz ( pv[2] ) ;
113  const CCGFloat eta ( pv[3] ) ;
114  const CCGFloat z ( pv[4] ) ;
115 
116  std::vector<GlobalPoint> gc ( 8, GlobalPoint(0,0,0) ) ;
117 
118  const GlobalPoint p ( etaPhiZ( eta, 0, z ) ) ;
119 
120  const float z_near ( z ) ;
121  const float z_far ( z*( 1 - 2*dz/p.mag() ) ) ;
122  gc[ 0 ] = etaPhiZ( eta + dEta , +dPhi , z_near ) ; // (+,+,near)
123  gc[ 1 ] = etaPhiZ( eta + dEta , -dPhi , z_near ) ; // (+,-,near)
124  gc[ 2 ] = etaPhiZ( eta - dEta , -dPhi , z_near ) ; // (-,-,near)
125  gc[ 3 ] = etaPhiZ( eta - dEta , +dPhi , z_near ) ; // (-,+,far)
126  gc[ 4 ] = GlobalPoint( gc[0].x(), gc[0].y(), z_far ); // (+,+,far)
127  gc[ 5 ] = GlobalPoint( gc[1].x(), gc[1].y(), z_far ); // (+,-,far)
128  gc[ 6 ] = GlobalPoint( gc[2].x(), gc[2].y(), z_far ); // (-,-,far)
129  gc[ 7 ] = GlobalPoint( gc[3].x(), gc[3].y(), z_far ); // (-,+,far)
130 
131  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
132  {
133  lc[i] = Pt3D( gc[i].x(), gc[i].y(), gc[i].z() ) ;
134  }
135 
136  ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
137 }
138 
139 void
141 {
142  if( co.uninitialized() )
143  {
144  CornersVec& corners ( co ) ;
145 
146  const GlobalPoint p ( getPosition() ) ;
147  const CCGFloat z_near ( p.z() ) ;
148  const CCGFloat z_far ( z_near + 2*dz()*p.z()/fabs( p.z() ) ) ;
149  const CCGFloat eta ( p.eta() ) ;
150  const CCGFloat phi ( p.phi() ) ;
151 
152  corners[ 0 ] = etaPhiZ( eta + dEta(), phi + dPhi(), z_near ); // (+,+,near)
153  corners[ 1 ] = etaPhiZ( eta + dEta(), phi - dPhi(), z_near ); // (+,-,near)
154  corners[ 2 ] = etaPhiZ( eta - dEta(), phi - dPhi(), z_near ); // (-,-,near)
155  corners[ 3 ] = etaPhiZ( eta - dEta(), phi + dPhi(), z_near ); // (-,+,near)
156  corners[ 4 ] = GlobalPoint( corners[0].x(), corners[0].y(), z_far ); // (+,+,far)
157  corners[ 5 ] = GlobalPoint( corners[1].x(), corners[1].y(), z_far ); // (+,-,far)
158  corners[ 6 ] = GlobalPoint( corners[2].x(), corners[2].y(), z_far ); // (-,-,far)
159  corners[ 7 ] = GlobalPoint( corners[3].x(), corners[3].y(), z_far ); // (-,+,far)
160  }
161 }
162 
163 std::ostream& operator<<( std::ostream& s, const IdealZPrism& cell )
164 {
165  s << "Center: " << cell.getPosition() << std::endl ;
166  s << "dEta = " << cell.dEta() << ", dPhi = " << cell.dPhi() << ", dz = " << cell.dz() << std::endl ;
167  return s;
168 }
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::CCGFloat CCGFloat
Definition: IdealZPrism.h:30
CCGFloat eta() const
Definition: IdealZPrism.cc:53
static GlobalPoint etaPhiZ(float eta, float phi, float z)
Definition: IdealZPrism.cc:93
assert(m_qm.get())
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual void initCorners(CornersVec &) override
Definition: IdealZPrism.cc:140
virtual void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const
Definition: IdealZPrism.cc:65
static GlobalPoint etaPhiR(float eta, float phi, float rad)
Definition: IdealZPrism.cc:73
std::vector< Pt3D > Pt3DVec
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
CCGFloat dz() const
Definition: IdealZPrism.cc:47
float float float z
const CCGFloat * param() const
T mag() const
Definition: PV3DBase.h:67
virtual ~IdealZPrism()
Definition: IdealZPrism.cc:31
T z() const
Definition: PV3DBase.h:64
CaloCellGeometry::CCGFloat CCGFloat
IdealZPrism & operator=(const IdealZPrism &idzp)
Definition: IdealZPrism.cc:19
CaloCellGeometry::Pt3D Pt3D
CCGFloat dEta() const
Definition: IdealZPrism.cc:35
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealZPrism.cc:103
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: IdealZPrism.h:31
Definition: EZMgrFL.h:8
Geom::Phi< T > phi() const
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: IdealZPrism.h:32
CCGFloat dPhi() const
Definition: IdealZPrism.cc:41
T eta() const
Definition: PV3DBase.h:76
T perp() const
Magnitude of transverse component.
static GlobalPoint etaPhiPerp(float eta, float phi, float perp)
Definition: IdealZPrism.cc:83
bool uninitialized() const
Definition: EZArrayFL.h:77
CCGFloat z() const
Definition: IdealZPrism.cc:59
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.