CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IdealObliquePrism.cc
Go to the documentation of this file.
2 #include <cmath>
3 
7 
9 
11 
13  if (&idop != this)
14  CaloCellGeometry::operator=(idop);
15  return *this;
16 }
17 
19  : CaloCellGeometry(faceCenter, mgr, parm) {
20  initSpan();
21 }
22 
24 
26 
28 
30 
32 
34 
35 void IdealObliquePrism::vocalCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref) const { localCorners(vec, pv, ref); }
36 
38  return GlobalPoint(perp * cosf(phi), perp * sinf(phi), perp * sinhf(eta));
39 }
40 
42  return GlobalPoint(z * cosf(phi) / sinhf(eta), z * sinf(phi) / sinhf(eta), z);
43 }
44 
46  assert(8 == lc.size());
47  assert(nullptr != pv);
48 
54 
55  std::vector<GlobalPoint> gc(8, GlobalPoint(0, 0, 0));
56 
57  const GlobalPoint p(etaPhiZ(eta, 0, z));
58 
59  if (0 < dz) {
60  const CCGFloat r_near(p.perp() / cos(dPhi));
61  const CCGFloat r_far(r_near * ((p.mag() + 2 * dz) / p.mag()));
62  gc[0] = etaPhiPerp(eta + dEta, +dPhi, r_near); // (+,+,near)
63  gc[1] = etaPhiPerp(eta + dEta, -dPhi, r_near); // (+,-,near)
64  gc[2] = etaPhiPerp(eta - dEta, -dPhi, r_near); // (-,-,near)
65  gc[3] = etaPhiPerp(eta - dEta, +dPhi, r_near); // (-,+,near)
66  gc[4] = etaPhiPerp(eta + dEta, +dPhi, r_far); // (+,+,far)
67  gc[5] = etaPhiPerp(eta + dEta, -dPhi, r_far); // (+,-,far)
68  gc[6] = etaPhiPerp(eta - dEta, -dPhi, r_far); // (-,-,far)
69  gc[7] = etaPhiPerp(eta - dEta, +dPhi, r_far); // (-,+,far)
70  } else {
71  const CCGFloat z_near(z);
72  const CCGFloat z_far(z * (1 - 2 * dz / p.mag()));
73  gc[0] = etaPhiZ(eta + dEta, +dPhi, z_near); // (+,+,near)
74  gc[1] = etaPhiZ(eta + dEta, -dPhi, z_near); // (+,-,near)
75  gc[2] = etaPhiZ(eta - dEta, -dPhi, z_near); // (-,-,near)
76  gc[3] = etaPhiZ(eta - dEta, +dPhi, z_near); // (-,+,near)
77  gc[4] = etaPhiZ(eta + dEta, +dPhi, z_far); // (+,+,far)
78  gc[5] = etaPhiZ(eta + dEta, -dPhi, z_far); // (+,-,far)
79  gc[6] = etaPhiZ(eta - dEta, -dPhi, z_far); // (-,-,far)
80  gc[7] = etaPhiZ(eta - dEta, +dPhi, z_far); // (-,+,far)
81  }
82  for (unsigned int i(0); i != 8; ++i) {
83  lc[i] = Pt3D(gc[i].x(), gc[i].y(), gc[i].z());
84  }
85 
86  ref = 0.25 * (lc[0] + lc[1] + lc[2] + lc[3]);
87 }
88 
90  if (co.uninitialized()) {
91  CornersVec& corners(co);
92  if (dz() > 0) {
93  /* In this case, the faces are parallel to the zaxis.
94  This implies that all corners will have the same
95  cylindrical radius.
96  */
97  const GlobalPoint p(getPosition());
98  const CCGFloat r_near(p.perp() / cos(dPhi()));
99  const CCGFloat r_far(r_near * ((p.mag() + 2 * dz()) / p.mag()));
100  const CCGFloat eta(p.eta());
101  const CCGFloat phi(p.phi());
102  corners[0] = etaPhiPerp(eta + dEta(), phi + dPhi(), r_near); // (+,+,near)
103  corners[1] = etaPhiPerp(eta + dEta(), phi - dPhi(), r_near); // (+,-,near)
104  corners[2] = etaPhiPerp(eta - dEta(), phi - dPhi(), r_near); // (-,-,near)
105  corners[3] = etaPhiPerp(eta - dEta(), phi + dPhi(), r_near); // (-,+,near)
106  corners[4] = etaPhiPerp(eta + dEta(), phi + dPhi(), r_far); // (+,+,far)
107  corners[5] = etaPhiPerp(eta + dEta(), phi - dPhi(), r_far); // (+,-,far)
108  corners[6] = etaPhiPerp(eta - dEta(), phi - dPhi(), r_far); // (-,-,far)
109  corners[7] = etaPhiPerp(eta - dEta(), phi + dPhi(), r_far); // (-,+,far)
110  } else {
111  /* In this case, the faces are perpendicular to the zaxis.
112  This implies that all corners will have the same
113  z-dimension.
114  */
115  const GlobalPoint p(getPosition());
116  const CCGFloat z_near(p.z());
117  const CCGFloat mag(p.mag());
118  const CCGFloat z_far(z_near * (1 - 2 * dz() / mag)); // negative to correct sign
119  const CCGFloat eta(p.eta());
120  const CCGFloat phi(p.phi());
121 
122  corners[0] = etaPhiZ(eta + dEta(), phi + dPhi(), z_near); // (+,+,near)
123  corners[1] = etaPhiZ(eta + dEta(), phi - dPhi(), z_near); // (+,-,near)
124  corners[2] = etaPhiZ(eta - dEta(), phi - dPhi(), z_near); // (-,-,near)
125  corners[3] = etaPhiZ(eta - dEta(), phi + dPhi(), z_near); // (-,+,near)
126  corners[4] = etaPhiZ(eta + dEta(), phi + dPhi(), z_far); // (+,+,far)
127  corners[5] = etaPhiZ(eta + dEta(), phi - dPhi(), z_far); // (+,-,far)
128  corners[6] = etaPhiZ(eta - dEta(), phi - dPhi(), z_far); // (-,-,far)
129  corners[7] = etaPhiZ(eta - dEta(), phi + dPhi(), z_far); // (-,+,far)
130  }
131  }
132 }
133 
134 std::ostream& operator<<(std::ostream& s, const IdealObliquePrism& cell) {
135  s << "Center: " << cell.getPosition() << std::endl;
136  s << "dEta = " << cell.dEta() << ", dPhi = " << cell.dPhi() << ", dz = " << cell.dz() << std::endl;
137  return s;
138 }
static GlobalPoint etaPhiZ(float eta, float phi, float z)
T perp() const
Definition: PV3DBase.h:69
CCGFloat dEta() const
static constexpr uint32_t k_Eta
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Pt3D > Pt3DVec
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
assert(be >=bs)
__host__ __device__ VT * co
Definition: prefixScan.h:47
float float float z
CCGFloat eta() const
const CCGFloat * param() const
T mag() const
Definition: PV3DBase.h:64
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
static constexpr uint32_t k_dPhi
T z() const
Definition: PV3DBase.h:61
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
static constexpr uint32_t k_Z
void initCorners(CornersVec &) override
~IdealObliquePrism() override
CaloCellGeometry::Pt3D Pt3D
static GlobalPoint etaPhiPerp(float eta, float phi, float perp)
void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const override
CCGFloat dPhi() const
CCGFloat z() const
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
T eta() const
Definition: PV3DBase.h:73
T perp() const
Magnitude of transverse component.
bool uninitialized() const
Definition: EZArrayFL.h:63
static constexpr uint32_t k_dEta
IdealObliquePrism & operator=(const IdealObliquePrism &idop)
CCGFloat dz() const
static constexpr uint32_t k_dZ
CaloCellGeometry::Pt3DVec Pt3DVec