CMS 3D CMS Logo

IdealZPrism.cc
Go to the documentation of this file.
2 #include <cmath>
3 
7 
9 
10 namespace {
11 
12  // magic numbers determined by ParticleFlow
13  constexpr float EMDepthCorrection = 22.;
14  constexpr float HADDepthCorrection = 25.;
15 
16  GlobalPoint correct(GlobalPoint const& ori, IdealZPrism::DEPTH depth) {
17  if (depth == IdealZPrism::None)
18  return ori;
19  float zcorr = depth == IdealZPrism::EM ? EMDepthCorrection : HADDepthCorrection;
20  if (ori.z() < 0)
21  zcorr = -zcorr;
22  return ori + GlobalVector(0., 0., zcorr);
23  }
24 } // namespace
25 
27  if (idzp.forPF())
28  m_geoForPF.reset(new IdealZPrism(*idzp.forPF()));
29 }
30 
32  if (&idzp != this) {
33  CaloCellGeometry::operator=(idzp);
34  if (idzp.forPF())
35  m_geoForPF.reset(new IdealZPrism(*idzp.forPF()));
36  }
37  return *this;
38 }
39 
41  : CaloCellGeometry(faceCenter, mgr, parm),
42  m_geoForPF(depth == None ? nullptr : new IdealZPrism(correct(faceCenter, depth), mgr, parm, None)) {
43  initSpan();
44 }
45 
47 
49 
51 
53 
55 
57 
58 void IdealZPrism::vocalCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref) const { localCorners(vec, pv, ref); }
59 
60 GlobalPoint IdealZPrism::etaPhiR(float eta, float phi, float rad) {
61  return GlobalPoint(rad * cosf(phi) / coshf(eta), rad * sinf(phi) / coshf(eta), rad * tanhf(eta));
62 }
63 
65  return GlobalPoint(perp * cosf(phi), perp * sinf(phi), perp * sinhf(eta));
66 }
67 
68 GlobalPoint IdealZPrism::etaPhiZ(float eta, float phi, float z) {
69  return GlobalPoint(z * cosf(phi) / sinhf(eta), z * sinf(phi) / sinhf(eta), z);
70 }
71 
73  assert(8 == lc.size());
74  assert(nullptr != pv);
75 
78  const CCGFloat dz(pv[IdealZPrism::k_dZ]);
79  const CCGFloat eta(pv[IdealZPrism::k_Eta]);
80  const CCGFloat z(pv[IdealZPrism::k_Z]);
81 
82  std::vector<GlobalPoint> gc(8, GlobalPoint(0, 0, 0));
83 
84  const GlobalPoint p(etaPhiZ(eta, 0, z));
85 
86  const float z_near(z);
87  const float z_far(z * (1 - 2 * dz / p.mag()));
88  gc[0] = etaPhiZ(eta + dEta, +dPhi, z_near); // (+,+,near)
89  gc[1] = etaPhiZ(eta + dEta, -dPhi, z_near); // (+,-,near)
90  gc[2] = etaPhiZ(eta - dEta, -dPhi, z_near); // (-,-,near)
91  gc[3] = etaPhiZ(eta - dEta, +dPhi, z_near); // (-,+,far)
92  gc[4] = GlobalPoint(gc[0].x(), gc[0].y(), z_far); // (+,+,far)
93  gc[5] = GlobalPoint(gc[1].x(), gc[1].y(), z_far); // (+,-,far)
94  gc[6] = GlobalPoint(gc[2].x(), gc[2].y(), z_far); // (-,-,far)
95  gc[7] = GlobalPoint(gc[3].x(), gc[3].y(), z_far); // (-,+,far)
96 
97  for (unsigned int i(0); i != 8; ++i) {
98  lc[i] = Pt3D(gc[i].x(), gc[i].y(), gc[i].z());
99  }
100 
101  ref = 0.25 * (lc[0] + lc[1] + lc[2] + lc[3]);
102 }
103 
105  if (co.uninitialized()) {
106  CornersVec& corners(co);
107 
108  const GlobalPoint p(getPosition());
109  const CCGFloat z_near(p.z());
110  const CCGFloat z_far(z_near + 2 * dz() * p.z() / fabs(p.z()));
111  const CCGFloat eta(p.eta());
112  const CCGFloat phi(p.phi());
113 
114  corners[0] = etaPhiZ(eta + dEta(), phi + dPhi(), z_near); // (+,+,near)
115  corners[1] = etaPhiZ(eta + dEta(), phi - dPhi(), z_near); // (+,-,near)
116  corners[2] = etaPhiZ(eta - dEta(), phi - dPhi(), z_near); // (-,-,near)
117  corners[3] = etaPhiZ(eta - dEta(), phi + dPhi(), z_near); // (-,+,near)
118  corners[4] = GlobalPoint(corners[0].x(), corners[0].y(), z_far); // (+,+,far)
119  corners[5] = GlobalPoint(corners[1].x(), corners[1].y(), z_far); // (+,-,far)
120  corners[6] = GlobalPoint(corners[2].x(), corners[2].y(), z_far); // (-,-,far)
121  corners[7] = GlobalPoint(corners[3].x(), corners[3].y(), z_far); // (-,+,far)
122  }
123 }
124 
125 std::ostream& operator<<(std::ostream& s, const IdealZPrism& cell) {
126  s << "Center: " << cell.getPosition() << std::endl;
127  s << "dEta = " << cell.dEta() << ", dPhi = " << cell.dPhi() << ", dz = " << cell.dz() << std::endl;
128  return s;
129 }
static constexpr uint32_t k_dEta
Definition: IdealZPrism.h:34
CaloCellGeometry::CCGFloat CCGFloat
Definition: IdealZPrism.h:30
CCGFloat eta() const
Definition: IdealZPrism.cc:54
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:68
#define nullptr
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
IdealZPrism::Pt3DVec Pt3DVec
Definition: IdealZPrism.cc:6
void initCorners(CornersVec &) override
Definition: IdealZPrism.cc:104
static constexpr uint32_t k_dZ
Definition: IdealZPrism.h:36
void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const override
Definition: IdealZPrism.cc:58
std::shared_ptr< const IdealZPrism > forPF() const
Definition: IdealZPrism.h:61
static GlobalPoint etaPhiR(float eta, float phi, float rad)
Definition: IdealZPrism.cc:60
std::vector< Pt3D > Pt3DVec
IdealZPrism::CCGFloat CCGFloat
Definition: IdealZPrism.cc:4
CCGFloat dz() const
Definition: IdealZPrism.cc:52
IdealZPrism::Pt3D Pt3D
Definition: IdealZPrism.cc:5
const CCGFloat * param() const
T mag() const
Definition: PV3DBase.h:64
T z() const
Definition: PV3DBase.h:61
std::unique_ptr< IdealZPrism > m_geoForPF
Definition: IdealZPrism.h:78
static constexpr uint32_t k_Z
Definition: IdealZPrism.h:38
def pv(vc)
Definition: MetAnalyzer.py:7
static constexpr uint32_t k_Eta
Definition: IdealZPrism.h:37
IdealZPrism & operator=(const IdealZPrism &idzp)
Definition: IdealZPrism.cc:31
~IdealZPrism() override
Definition: IdealZPrism.cc:46
static constexpr uint32_t k_dPhi
Definition: IdealZPrism.h:35
CCGFloat dEta() const
Definition: IdealZPrism.cc:48
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealZPrism.cc:72
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: IdealZPrism.h:31
Definition: EZMgrFL.h:8
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: IdealZPrism.h:32
CCGFloat dPhi() const
Definition: IdealZPrism.cc:50
T eta() const
Definition: PV3DBase.h:73
T perp() const
Magnitude of transverse component.
static GlobalPoint etaPhiPerp(float eta, float phi, float perp)
Definition: IdealZPrism.cc:64
bool uninitialized() const
Definition: EZArrayFL.h:63
CCGFloat z() const
Definition: IdealZPrism.cc:56
std::ostream & operator<<(std::ostream &s, const IdealZPrism &cell)
Definition: IdealZPrism.cc:125
#define constexpr
Global3DVector GlobalVector
Definition: GlobalVector.h:10