CMS 3D CMS Logo

IdealZDCTrapezoid.cc
Go to the documentation of this file.
2 #include <cmath>
3 
7 
9 
11 
13  if (&idzt != this)
15  return *this;
16 }
17 
19  : CaloCellGeometry(faceCenter, mgr, parm) {
20  initSpan();
21 }
22 
24 
25 CCGFloat IdealZDCTrapezoid::an() const { return param()[0]; }
26 
27 CCGFloat IdealZDCTrapezoid::dx() const { return param()[1]; }
28 
29 CCGFloat IdealZDCTrapezoid::dy() const { return param()[2]; }
30 
31 CCGFloat IdealZDCTrapezoid::dz() const { return param()[3]; }
32 
33 CCGFloat IdealZDCTrapezoid::ta() const { return tan(an()); }
34 
35 CCGFloat IdealZDCTrapezoid::dt() const { return dy() * ta(); }
36 
37 void IdealZDCTrapezoid::vocalCorners(Pt3DVec& vec, const CCGFloat* pv, Pt3D& ref) const { localCorners(vec, pv, ref); }
38 
40  assert(8 == lc.size());
41  assert(nullptr != pv);
42 
43  const CCGFloat an(pv[0]);
44  const CCGFloat dx(pv[1]);
45  const CCGFloat dy(pv[2]);
46  const CCGFloat dz(pv[3]);
47  const CCGFloat ta(tan(an));
48  const CCGFloat dt(dy * ta);
49 
50  lc[0] = Pt3D(-dx, -dy, +dz + dt);
51  lc[1] = Pt3D(-dx, +dy, +dz - dt);
52  lc[2] = Pt3D(+dx, +dy, +dz - dt);
53  lc[3] = Pt3D(+dx, -dy, +dz + dt);
54  lc[4] = Pt3D(-dx, -dy, -dz + dt);
55  lc[5] = Pt3D(-dx, +dy, -dz - dt);
56  lc[6] = Pt3D(+dx, +dy, -dz - dt);
57  lc[7] = Pt3D(+dx, -dy, -dz + dt);
58 
59  ref = 0.25 * (lc[0] + lc[1] + lc[2] + lc[3]);
60 }
61 
63  if (corners.uninitialized()) {
64  const GlobalPoint& p(getPosition());
65  const CCGFloat zsign(0 < p.z() ? 1. : -1.);
66  const Pt3D gf(p.x(), p.y(), p.z());
67 
68  Pt3D lf;
69  Pt3DVec lc(8, Pt3D(0, 0, 0));
70  localCorners(lc, param(), lf);
71  const Pt3D lb(lf.x(), lf.y(), lf.z() - 2. * dz());
72  const Pt3D ls(lf.x() - dx(), lf.y(), lf.z());
73 
74  const Pt3D gb(gf.x(), gf.y(), gf.z() + 2. * zsign * dz());
75 
76  const Pt3D gs(gf.x() - zsign * dx(), gf.y(), gf.z());
77 
78  const HepGeom::Transform3D tr(lf, lb, ls, gf, gb, gs);
79 
80  for (unsigned int i(0); i != 8; ++i) {
81  const Pt3D gl(tr * lc[i]);
82  corners[i] = GlobalPoint(gl.x(), gl.y(), gl.z());
83  }
84  }
85 }
86 
87 std::ostream& operator<<(std::ostream& s, const IdealZDCTrapezoid& cell) {
88  s << "Center: " << cell.getPosition() << std::endl;
89  s << "TiltAngle = " << cell.an() * 180. / M_PI << " deg, dx = " << cell.dx() << ", dy = " << cell.dy()
90  << ", dz = " << cell.dz() << std::endl;
91  return s;
92 }
CaloCellGeometry::CCGFloat CCGFloat
CCGFloat ta() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void initCorners(CaloCellGeometry::CornersVec &) override
std::vector< Pt3D > Pt3DVec
assert(be >=bs)
std::ostream & operator<<(std::ostream &s, const IdealZDCTrapezoid &cell)
CCGFloat an() const
IdealZDCTrapezoid & operator=(const IdealZDCTrapezoid &idzt)
CaloCellGeometry & operator=(CaloCellGeometry &&)=default
CCGFloat dz() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
CCGFloat dy() const
CaloCellGeometry::Pt3D Pt3D
#define M_PI
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const override
~IdealZDCTrapezoid() override
double gf
Definition: hdecay.h:34
CCGFloat dt() const
Definition: AbsArchive.cc:46
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Pt3D Pt3D
bool uninitialized() const
Definition: EZArrayFL.h:61
const CCGFloat * param() const
CCGFloat dx() const