CMS 3D CMS Logo

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::Tr3D
HepGeom::Transform3D Tr3D
Definition: CaloCellGeometry.h:53
CaloCellGeometry::Pt3DVec
std::vector< Pt3D > Pt3DVec
Definition: CaloCellGeometry.h:55
eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
gf
double gf
Definition: hdecay.h:34
mps_fire.i
i
Definition: mps_fire.py:428
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: IdealCastorTrapezoid.cc:6
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
IdealCastorTrapezoid::dhz
CCGFloat dhz() const
Definition: IdealCastorTrapezoid.cc:40
IdealCastorTrapezoid
Definition: IdealCastorTrapezoid.h:32
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::cuda::assert
assert(be >=bs)
IdealCastorTrapezoid::initCorners
void initCorners(CornersVec &) override
Definition: IdealCastorTrapezoid.cc:83
IdealCastorTrapezoid::dx
CCGFloat dx() const
Definition: IdealCastorTrapezoid.cc:32
EZArrayFL< GlobalPoint >
IdealCastorTrapezoid::IdealCastorTrapezoid
IdealCastorTrapezoid()
Definition: IdealCastorTrapezoid.cc:11
gs
Definition: AbsArchive.cc:45
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
alignCSCRings.s
s
Definition: alignCSCRings.py:92
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
IdealCastorTrapezoid::dh
CCGFloat dh() const
Definition: IdealCastorTrapezoid.cc:34
IdealCastorTrapezoid::dR
CCGFloat dR() const
Definition: IdealCastorTrapezoid.cc:48
IdealCastorTrapezoid::dxh
CCGFloat dxh() const
Definition: IdealCastorTrapezoid.cc:30
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Pt3DVec
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: IdealCastorTrapezoid.cc:8
Point3DBase< float, GlobalTag >
CaloCellGeometry::Pt3D
HepGeom::Point3D< CCGFloat > Pt3D
Definition: CaloCellGeometry.h:54
CaloCellGeometry::initSpan
void initSpan()
Definition: CaloCellGeometry.h:120
DDAxes::rho
CaloCellGeometry::getPosition
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Definition: CaloCellGeometry.h:80
IdealCastorTrapezoid::localCorners
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealCastorTrapezoid.cc:54
IdealCastorTrapezoid::dzb
CCGFloat dzb() const
Definition: IdealCastorTrapezoid.cc:42
CaloCellGeometry
Definition: CaloCellGeometry.h:50
CaloCellGeometry::param
const CCGFloat * param() const
Definition: CaloCellGeometry.h:99
IdealCastorTrapezoid::an
CCGFloat an() const
Definition: IdealCastorTrapezoid.cc:46
IdealCastorTrapezoid::dz
CCGFloat dz() const
Definition: IdealCastorTrapezoid.cc:38
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
IdealCastorTrapezoid::~IdealCastorTrapezoid
~IdealCastorTrapezoid() override
Definition: IdealCastorTrapezoid.cc:26
IdealCastorTrapezoid::vocalCorners
void vocalCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const override
Definition: IdealCastorTrapezoid.cc:50
IdealCastorTrapezoid::dy
CCGFloat dy() const
Definition: IdealCastorTrapezoid.cc:36
operator<<
std::ostream & operator<<(std::ostream &s, const IdealCastorTrapezoid &cell)
Definition: IdealCastorTrapezoid.cc:111
DDAxes::phi
IdealCastorTrapezoid::dxl
CCGFloat dxl() const
Definition: IdealCastorTrapezoid.cc:28
IdealCastorTrapezoid::Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: IdealCastorTrapezoid.h:35
EZMgrFL
Definition: EZMgrFL.h:8
Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: IdealCastorTrapezoid.cc:7
IdealCastorTrapezoid::dzs
CCGFloat dzs() const
Definition: IdealCastorTrapezoid.cc:44
Tr3D
CaloCellGeometry::Tr3D Tr3D
Definition: IdealCastorTrapezoid.cc:9
IdealCastorTrapezoid.h
IdealCastorTrapezoid::operator=
IdealCastorTrapezoid & operator=(const IdealCastorTrapezoid &idct)
Definition: IdealCastorTrapezoid.cc:15
EZArrayFL::uninitialized
bool uninitialized() const
Definition: EZArrayFL.h:63