CMS 3D CMS Logo

IdealZPrism.cc
Go to the documentation of this file.
2 #include <cmath>
3 
7 
10 {}
11 
12 namespace {
13 
14  // magic numbers determined by ParticleFlow
15  constexpr float EMDepthCorrection = 22.;
16  constexpr float HADDepthCorrection = 25.;
17 
18  GlobalPoint correct(GlobalPoint const & ori, IdealZPrism::DEPTH depth) {
19  if (depth==IdealZPrism::None) return ori;
20  float zcorr = depth==IdealZPrism::EM ?EMDepthCorrection : HADDepthCorrection;
21  if (ori.z()<0) zcorr = -zcorr;
22  return ori + GlobalVector(0.,0.,zcorr);
23  }
24 }
25 
27  : CaloCellGeometry( idzp )
28 {
29  if (idzp.forPF()) m_geoForPF.reset(new IdealZPrism(*idzp.forPF()));
30 }
31 
34 {
35  if( &idzp != this ) {
36  CaloCellGeometry::operator=( idzp ) ;
37  if (idzp.forPF()) m_geoForPF.reset(new IdealZPrism(*idzp.forPF()));
38  }
39  return *this ;
40 }
41 
43  CornersMgr* mgr ,
44  const CCGFloat* parm ,
46  : CaloCellGeometry ( faceCenter, mgr, parm ),
47  m_geoForPF(depth==None ? nullptr : new IdealZPrism(correct(faceCenter,depth), mgr, parm, None ))
48 {initSpan();}
49 
51 {}
52 
53 CCGFloat
55 {
56  return param()[IdealZPrism::k_dEta] ;
57 }
58 
59 CCGFloat
61 {
62  return param()[IdealZPrism::k_dPhi] ;
63 }
64 
65 CCGFloat
67 {
68  return param()[IdealZPrism::k_dZ] ;
69 }
70 
71 CCGFloat
73 {
74  return param()[IdealZPrism::k_Eta] ;
75 }
76 
77 CCGFloat
79 {
80  return param()[IdealZPrism::k_Z] ;
81 }
82 
83 void
85  const CCGFloat* pv ,
86  Pt3D& ref ) const
87 {
88  localCorners( vec, pv, ref ) ;
89 }
90 
93  float phi ,
94  float rad )
95 {
96  return GlobalPoint( rad*cosf( phi )/coshf( eta ) ,
97  rad*sinf( phi )/coshf( eta ) ,
98  rad*tanhf( eta ) ) ;
99 }
100 
103  float phi ,
104  float perp )
105 {
106  return GlobalPoint( perp*cosf( phi ) ,
107  perp*sinf( phi ) ,
108  perp*sinhf( eta ) );
109 }
110 
113  float phi ,
114  float z )
115 {
116  return GlobalPoint( z*cosf( phi )/sinhf( eta ) ,
117  z*sinf( phi )/sinhf( eta ) ,
118  z ) ;
119 }
120 
121 void
123  const CCGFloat* pv ,
124  Pt3D& ref )
125 {
126  assert( 8 == lc.size() ) ;
127  assert( nullptr != pv ) ;
128 
129  const CCGFloat dEta ( pv[IdealZPrism::k_dEta] ) ;
130  const CCGFloat dPhi ( pv[IdealZPrism::k_dPhi] ) ;
131  const CCGFloat dz ( pv[IdealZPrism::k_dZ] ) ;
132  const CCGFloat eta ( pv[IdealZPrism::k_Eta] ) ;
133  const CCGFloat z ( pv[IdealZPrism::k_Z] ) ;
134 
135  std::vector<GlobalPoint> gc ( 8, GlobalPoint(0,0,0) ) ;
136 
137  const GlobalPoint p ( etaPhiZ( eta, 0, z ) ) ;
138 
139  const float z_near ( z ) ;
140  const float z_far ( z*( 1 - 2*dz/p.mag() ) ) ;
141  gc[ 0 ] = etaPhiZ( eta + dEta , +dPhi , z_near ) ; // (+,+,near)
142  gc[ 1 ] = etaPhiZ( eta + dEta , -dPhi , z_near ) ; // (+,-,near)
143  gc[ 2 ] = etaPhiZ( eta - dEta , -dPhi , z_near ) ; // (-,-,near)
144  gc[ 3 ] = etaPhiZ( eta - dEta , +dPhi , z_near ) ; // (-,+,far)
145  gc[ 4 ] = GlobalPoint( gc[0].x(), gc[0].y(), z_far ); // (+,+,far)
146  gc[ 5 ] = GlobalPoint( gc[1].x(), gc[1].y(), z_far ); // (+,-,far)
147  gc[ 6 ] = GlobalPoint( gc[2].x(), gc[2].y(), z_far ); // (-,-,far)
148  gc[ 7 ] = GlobalPoint( gc[3].x(), gc[3].y(), z_far ); // (-,+,far)
149 
150  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
151  {
152  lc[i] = Pt3D( gc[i].x(), gc[i].y(), gc[i].z() ) ;
153  }
154 
155  ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
156 }
157 
158 void
160 {
161  if( co.uninitialized() )
162  {
163  CornersVec& corners ( co ) ;
164 
165  const GlobalPoint p ( getPosition() ) ;
166  const CCGFloat z_near ( p.z() ) ;
167  const CCGFloat z_far ( z_near + 2*dz()*p.z()/fabs( p.z() ) ) ;
168  const CCGFloat eta ( p.eta() ) ;
169  const CCGFloat phi ( p.phi() ) ;
170 
171  corners[ 0 ] = etaPhiZ( eta + dEta(), phi + dPhi(), z_near ); // (+,+,near)
172  corners[ 1 ] = etaPhiZ( eta + dEta(), phi - dPhi(), z_near ); // (+,-,near)
173  corners[ 2 ] = etaPhiZ( eta - dEta(), phi - dPhi(), z_near ); // (-,-,near)
174  corners[ 3 ] = etaPhiZ( eta - dEta(), phi + dPhi(), z_near ); // (-,+,near)
175  corners[ 4 ] = GlobalPoint( corners[0].x(), corners[0].y(), z_far ); // (+,+,far)
176  corners[ 5 ] = GlobalPoint( corners[1].x(), corners[1].y(), z_far ); // (+,-,far)
177  corners[ 6 ] = GlobalPoint( corners[2].x(), corners[2].y(), z_far ); // (-,-,far)
178  corners[ 7 ] = GlobalPoint( corners[3].x(), corners[3].y(), z_far ); // (-,+,far)
179  }
180 }
181 
182 std::ostream& operator<<( std::ostream& s, const IdealZPrism& cell )
183 {
184  s << "Center: " << cell.getPosition() << std::endl ;
185  s << "dEta = " << cell.dEta() << ", dPhi = " << cell.dPhi() << ", dz = " << cell.dz() << std::endl ;
186  return s;
187 }
static constexpr uint32_t k_dEta
Definition: IdealZPrism.h:36
CaloCellGeometry::CCGFloat CCGFloat
Definition: IdealZPrism.h:32
CCGFloat eta() const
Definition: IdealZPrism.cc:72
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
static GlobalPoint etaPhiZ(float eta, float phi, float z)
Definition: IdealZPrism.cc:112
#define nullptr
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
IdealZPrism::Pt3DVec Pt3DVec
Definition: IdealZPrism.cc:6
void initCorners(CornersVec &) override
Definition: IdealZPrism.cc:159
static constexpr uint32_t k_dZ
Definition: IdealZPrism.h:38
void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const override
Definition: IdealZPrism.cc:84
std::shared_ptr< const IdealZPrism > forPF() const
Definition: IdealZPrism.h:73
static GlobalPoint etaPhiR(float eta, float phi, float rad)
Definition: IdealZPrism.cc:92
std::vector< Pt3D > Pt3DVec
IdealZPrism::CCGFloat CCGFloat
Definition: IdealZPrism.cc:4
CCGFloat dz() const
Definition: IdealZPrism.cc:66
IdealZPrism::Pt3D Pt3D
Definition: IdealZPrism.cc:5
const CCGFloat * param() const
T mag() const
Definition: PV3DBase.h:67
T z() const
Definition: PV3DBase.h:64
std::unique_ptr< IdealZPrism > m_geoForPF
Definition: IdealZPrism.h:98
static constexpr uint32_t k_Z
Definition: IdealZPrism.h:40
def pv(vc)
Definition: MetAnalyzer.py:7
static constexpr uint32_t k_Eta
Definition: IdealZPrism.h:39
IdealZPrism & operator=(const IdealZPrism &idzp)
Definition: IdealZPrism.cc:33
~IdealZPrism() override
Definition: IdealZPrism.cc:50
static constexpr uint32_t k_dPhi
Definition: IdealZPrism.h:37
CCGFloat dEta() const
Definition: IdealZPrism.cc:54
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealZPrism.cc:122
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: IdealZPrism.h:33
Definition: EZMgrFL.h:8
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: IdealZPrism.h:34
CCGFloat dPhi() const
Definition: IdealZPrism.cc:60
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:102
bool uninitialized() const
Definition: EZArrayFL.h:77
CCGFloat z() const
Definition: IdealZPrism.cc:78
std::ostream & operator<<(std::ostream &s, const IdealZPrism &cell)
Definition: IdealZPrism.cc:182
#define constexpr
Global3DVector GlobalVector
Definition: GlobalVector.h:10