CMS 3D CMS Logo

IdealZDCTrapezoid.cc
Go to the documentation of this file.
2 #include <cmath>
3 
7 
9 
11 
13  if (&idzt != this)
14  CaloCellGeometry::operator=(idzt);
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 dy() const
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
CCGFloat dx() const
void initCorners(CaloCellGeometry::CornersVec &) override
std::vector< Pt3D > Pt3DVec
std::ostream & operator<<(std::ostream &s, const IdealZDCTrapezoid &cell)
IdealZDCTrapezoid & operator=(const IdealZDCTrapezoid &idzt)
const CCGFloat * param() const
T z() const
Definition: PV3DBase.h:61
CCGFloat an() const
CCGFloat ta() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
def pv(vc)
Definition: MetAnalyzer.py:7
CaloCellGeometry::Pt3D Pt3D
#define M_PI
def ls(path, rec=False)
Definition: eostools.py:349
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
CCGFloat dt() const
void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const override
CCGFloat dz() const
~IdealZDCTrapezoid() override
bool uninitialized() const
Definition: EZArrayFL.h:63
double gf
Definition: hdecay.h:34
Definition: AbsArchive.cc:45
T x() const
Definition: PV3DBase.h:59
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Pt3D Pt3D