CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IdealCastorTrapezoid.cc
Go to the documentation of this file.
2 #include "CLHEP/Geometry/Plane3D.h"
3 #include "CLHEP/Geometry/Transform3D.h"
4 #include <cmath>
5 
10 
12 
14 
16  if (&idct != this)
17  CaloCellGeometry::operator=(idct);
18  return *this;
19 }
20 
22  : CaloCellGeometry(faceCenter, mgr, parm) {
23  initSpan();
24 }
25 
27 
28 CCGFloat IdealCastorTrapezoid::dxl() const { return param()[0]; }
29 
30 CCGFloat IdealCastorTrapezoid::dxh() const { return param()[1]; }
31 
32 CCGFloat IdealCastorTrapezoid::dx() const { return (dxl() + dxh()) / 2.; }
33 
34 CCGFloat IdealCastorTrapezoid::dh() const { return param()[2]; }
35 
36 CCGFloat IdealCastorTrapezoid::dy() const { return dh() * sin(an()); }
37 
38 CCGFloat IdealCastorTrapezoid::dz() const { return param()[3]; }
39 
40 CCGFloat IdealCastorTrapezoid::dhz() const { return dh() * cos(an()); }
41 
42 CCGFloat IdealCastorTrapezoid::dzb() const { return dz() + dhz(); }
43 
44 CCGFloat IdealCastorTrapezoid::dzs() const { return dz() - dhz(); }
45 
46 CCGFloat IdealCastorTrapezoid::an() const { return param()[4]; }
47 
48 CCGFloat IdealCastorTrapezoid::dR() const { return param()[5]; }
49 
50 void IdealCastorTrapezoid::vocalCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref) const {
51  localCorners(vec, pv, ref);
52 }
53 
55  assert(8 == lc.size());
56  assert(nullptr != pv);
57 
58  const CCGFloat dxl(pv[0]);
59  const CCGFloat dxh(pv[1]);
60  const CCGFloat dh(pv[2]);
61  const CCGFloat dz(pv[3]);
62  const CCGFloat an(pv[4]);
63  const CCGFloat dx((dxl + dxh) / 2.);
64  const CCGFloat dy(dh * sin(an));
65  const CCGFloat dhz(dh * cos(an));
66  const CCGFloat dzb(dz + dhz);
67  const CCGFloat dzs(dz - dhz);
68 
69  assert(0 < (dxl * dxh));
70 
71  lc[0] = Pt3D(-dx, -dy, dzb);
72  lc[1] = Pt3D(-dx, +dy, dzs);
73  lc[2] = Pt3D(+2 * dxh - dx, +dy, dzs);
74  lc[3] = Pt3D(+2 * dxl - dx, -dy, dzb);
75  lc[4] = Pt3D(-dx, -dy, -dzs);
76  lc[5] = Pt3D(-dx, +dy, -dzb);
77  lc[6] = Pt3D(+2 * dxh - dx, +dy, -dzb);
78  lc[7] = Pt3D(+2 * dxl - dx, -dy, -dzs);
79 
80  ref = 0.25 * (lc[0] + lc[1] + lc[2] + lc[3]);
81 }
82 
84  if (corners.uninitialized()) {
85  const GlobalPoint& p(getPosition());
86  const CCGFloat zsign(0 < p.z() ? 1. : -1.);
87  const Pt3D gf(p.x(), p.y(), p.z());
88 
89  Pt3D lf;
90  Pt3DVec lc(8, Pt3D(0, 0, 0));
91  localCorners(lc, param(), lf);
92  const Pt3D lb(lf.x(), lf.y(), lf.z() - 2. * dz());
93  const Pt3D ls(lf.x() - dx(), lf.y(), lf.z());
94 
95  const CCGFloat fphi(atan(dx() / (dR() + dy())));
96  const Pt3D gb(gf.x(), gf.y(), gf.z() + 2. * zsign * dz());
97 
98  const CCGFloat rho(dR() + dy());
99  const CCGFloat phi(gf.phi() + fphi);
100  const Pt3D gs(rho * cos(phi), rho * sin(phi), gf.z());
101 
102  const Tr3D tr(lf, lb, ls, gf, gb, gs);
103 
104  for (unsigned int i(0); i != 8; ++i) {
105  const Pt3D gl(tr * lc[i]);
106  corners[i] = GlobalPoint(gl.x(), gl.y(), gl.z());
107  }
108  }
109 }
110 
111 std::ostream& operator<<(std::ostream& s, const IdealCastorTrapezoid& cell) {
112  s << "Center: " << cell.getPosition() << std::endl;
113  // s << ", dx = " << cell.dx()
114  //<< "TiltAngle = " << cell.an()
115  // << ", dy = " << cell.dy() << ", dz = " << cell.dz() << std::endl ;
116  return s;
117 }
CaloCellGeometry::Pt3D Pt3D
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const override
def ls
Definition: eostools.py:349
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
HepGeom::Transform3D Tr3D
std::vector< Pt3D > Pt3DVec
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
assert(be >=bs)
const CCGFloat * param() const
T z() const
Definition: PV3DBase.h:61
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
IdealCastorTrapezoid & operator=(const IdealCastorTrapezoid &idct)
void initCorners(CornersVec &) override
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::Pt3D Pt3D
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
CaloCellGeometry::Tr3D Tr3D
bool uninitialized() const
Definition: EZArrayFL.h:63
double gf
Definition: hdecay.h:34
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
T x() const
Definition: PV3DBase.h:59