CMS 3D CMS Logo

EcalTrapezoidParameters.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalCommonData
4 // Module: EcalTrapezoidParameters
5 //
6 // Description: Do trigonometry to figure out all useful dimensions/angles
7 //
8 // Implementation: Compute everything in constructor, put in member data
9 //
10 // Author: Brian K. Heltsley
11 // Created: Wed Aug 12 09:24:56 EDT 1998
12 //
13 
14 #include <cassert>
15 #include <cmath>
16 #include <algorithm>
17 
19 
23 
25  TPFloat aHalfLengthXPosZLoY, // bl2
26  TPFloat aHalfLengthXPosZHiY, // tl2
27  TPFloat aHalfLengthYNegZ, // h1
28  TPFloat aHalfLengthYPosZ, // h2
29  TPFloat aHalfLengthZ, // dz, L/2
30  TPFloat aAngleAD, // alfa1
31  TPFloat aCoord15X, // x15
32  TPFloat aCoord15Y // y15
33 ) {
34  m_dz = aHalfLengthZ;
35  m_h1 = aHalfLengthYNegZ;
36  m_bl1 = aHalfLengthXNegZLoY;
37  m_h2 = aHalfLengthYPosZ;
38  m_bl2 = aHalfLengthXPosZLoY;
39  m_tl2 = aHalfLengthXPosZHiY;
40 
41  m_a1 = aAngleAD;
42  m_y15 = aCoord15Y;
43  m_x15 = aCoord15X;
44 
45  m_hAa = fabs(m_y15);
46 
47  m_L = 2 * m_dz;
48  m_h = 2 * m_h2;
49  m_a = 2 * m_bl2;
50  m_b = 2 * m_tl2;
51  m_H = 2 * m_h1;
52  m_A = 2 * m_bl1;
53 
54  // derive everything else
55  const TPFloat sina1(sin(m_a1));
56  const TPFloat cosa1(cos(m_a1));
57  const TPFloat tana1(tan(m_a1 - M_PI_2));
58 
59  const TPFloat tana4((m_tl2 - m_bl2 - m_h2 * tana1) / m_h2);
60 
61  m_a4 = M_PI_2 + atan(tana4);
62 
63  m_tl1 = m_bl1 + m_h1 * (tana1 + tana4);
64 
65  m_d = m_h / sina1;
66  m_D = m_H / sina1;
67 
68  const TPFloat tanalp1((m_D * cosa1 + m_tl1 - m_bl1) / m_H);
69  const TPFloat tanalp2((m_d * cosa1 + m_tl2 - m_bl2) / m_h);
70  m_alp1 = atan(tanalp1);
71  m_alp2 = atan(tanalp2);
72 
73  const TPFloat sina4(sin(m_a4));
74  m_c = m_h / sina4;
75  m_C = m_H / sina4;
76  m_B = 2 * m_tl1; // same as m_A - m_D*cosa1 - m_C*cos( m_a4 ) ;
77 
78  m_hDd = fabs(m_x15) * sina1 - m_hAa * cosa1;
79 
80  const TPFloat xd5((m_hAa + m_hDd * cosa1) / sina1);
81  const TPFloat xd6(m_D - m_d - xd5);
82  const TPFloat z6(sqrt(m_hDd * m_hDd + xd6 * xd6));
83  TPFloat gb6;
84  if (0. == z6 || 1. < fabs(m_hDd / z6)) {
85  gb6 = 0;
86  } else {
87  gb6 = M_PI - m_a1 - asin(m_hDd / z6);
88  }
89  m_hBb = z6 * sin(gb6);
90 
91  const TPFloat xb6(z6 * cos(gb6));
92  const TPFloat xb7(m_B - xb6 - m_b);
93  const TPFloat z7(sqrt(m_hBb * m_hBb + xb7 * xb7));
94  TPFloat gc7;
95  if (0 == z7 || 1. < fabs(m_hBb / z7)) {
96  gc7 = 0;
97  } else {
98  gc7 = M_PI - m_a4 - asin(m_hBb / z7);
99  }
100  m_hCc = z7 * sin(gc7);
101 
102  const Pt3D fc(m_bl2 + m_h2 * tanalp2, m_h2, 0);
103  const Pt3D v5(m_x15, m_y15, -m_L);
104  const Pt3D bc(v5 + Pt3D(m_bl1 + m_h1 * tanalp1, m_h1, 0));
105  const Pt3D dc(fc - bc);
106 
107  m_th = dc.theta();
108  m_ph = dc.phi();
109 }
110 // m_hBb, m_hCc, m_hDd ;
111 
112 // EcalTrapezoidParameters::EcalTrapezoidParameters( const EcalTrapezoidParameters& rhs )
113 // {
114 // // do actual copying here; if you implemented
115 // // operator= correctly, you may be able to use just say
116 // *this = rhs;
117 // }
118 
119 //EcalTrapezoidParameters::~EcalTrapezoidParameters()
120 //{
121 //}
122 
123 //
124 // assignment operators
125 //
126 // const EcalTrapezoidParameters& EcalTrapezoidParameters::operator=( const EcalTrapezoidParameters& rhs )
127 // {
128 // if( this != &rhs ) {
129 // // do actual copying here, plus:
130 // // "SuperClass"::operator=( rhs );
131 // }
132 //
133 // return *this;
134 // }
135 
136 //
137 // member functions
138 //
139 
140 //
141 // const member functions
142 //
154 
174 
176  VertexList vtx;
177  vtx.reserve(8);
178 
179  const TPFloat dztanth(dz() * tan(theta()));
180 
181  const TPFloat ph(phi());
182  const Pt3D fc(dztanth * cos(ph), dztanth * sin(ph), dz());
183 
184  const TPFloat h_(h());
185  const TPFloat H_(H());
186  const TPFloat b_(b());
187  const TPFloat B_(B());
188  const TPFloat a_(a());
189  const TPFloat A_(A());
190 
191  // const TPFloat tl1 ( tl1() ) ;
192 
193  const TPFloat tanalp1(tan(alp1()));
194 
195  const TPFloat tanalp2(tan(alp2()));
196 
197  const TPFloat tana1(tan(a1() - M_PI_2));
198 
199  const Pt3D f1(-Pt3D(bl2() + h2() * tanalp2, h2(), 0));
200 
201  const Pt3D f2(Pt3D(-h_ * tana1, h_, 0) + f1);
202 
203  const Pt3D f3(f2 + Pt3D(b_, 0, 0));
204 
205  const Pt3D f4(Pt3D(a_, 0, 0) + f1);
206 
207  const Pt3D f5(-Pt3D(bl1() + h1() * tanalp1, h1(), 0));
208 
209  const Pt3D f6(Pt3D(-H_ * tana1, H_, 0) + f5);
210 
211  const Pt3D f7(f6 + Pt3D(B_, 0, 0));
212 
213  const Pt3D f8(Pt3D(A_, 0, 0) + f5);
214 
215  vtx.emplace_back(fc + f1);
216  vtx.emplace_back(fc + f2);
217  vtx.emplace_back(fc + f3);
218  vtx.emplace_back(fc + f4);
219  vtx.emplace_back(-fc + f5);
220  vtx.emplace_back(-fc + f6);
221  vtx.emplace_back(-fc + f7);
222  vtx.emplace_back(-fc + f8);
223 
224  return vtx;
225 }
226 //
227 // static member functions
228 //
EcalTrapezoidParameters::m_h
TPFloat m_h
Definition: EcalTrapezoidParameters.h:123
TPFloat
EcalTrapezoidParameters::TPFloat TPFloat
Definition: EcalTrapezoidParameters.cc:20
EcalTrapezoidParameters::m_hDd
TPFloat m_hDd
Definition: EcalTrapezoidParameters.h:122
EcalTrapezoidParameters::m_bl2
TPFloat m_bl2
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters::hBb
TPFloat hBb() const
Definition: EcalTrapezoidParameters.cc:158
EcalTrapezoidParameters::m_hAa
TPFloat m_hAa
Definition: EcalTrapezoidParameters.h:121
EcalTrapezoidParameters::bl1
TPFloat bl1() const
Definition: EcalTrapezoidParameters.cc:147
EcalTrapezoidParameters::c
TPFloat c() const
Definition: EcalTrapezoidParameters.cc:166
EcalTrapezoidParameters::alp1
TPFloat alp1() const
Definition: EcalTrapezoidParameters.cc:149
EcalTrapezoidParameters::vertexList
VertexList vertexList() const
Definition: EcalTrapezoidParameters.cc:175
EcalTrapezoidParameters::d
TPFloat d() const
Definition: EcalTrapezoidParameters.cc:167
EcalTrapezoidParameters::m_hCc
TPFloat m_hCc
Definition: EcalTrapezoidParameters.h:122
Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: EcalTrapezoidParameters.cc:22
EcalTrapezoidParameters::hCc
TPFloat hCc() const
Definition: EcalTrapezoidParameters.cc:159
EcalTrapezoidParameters::a
TPFloat a() const
Definition: EcalTrapezoidParameters.cc:164
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: CaloCellGeometry.cc:5
EcalTrapezoidParameters::theta
TPFloat theta() const
Definition: EcalTrapezoidParameters.cc:144
EcalTrapezoidParameters::C
TPFloat C() const
Definition: EcalTrapezoidParameters.cc:171
EcalTrapezoidParameters::B
TPFloat B() const
Definition: EcalTrapezoidParameters.cc:170
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
EcalTrapezoidParameters::m_y15
TPFloat m_y15
Definition: EcalTrapezoidParameters.h:121
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
EcalTrapezoidParameters::m_a4
TPFloat m_a4
Definition: EcalTrapezoidParameters.h:122
EcalTrapezoidParameters::tl2
TPFloat tl2() const
Definition: EcalTrapezoidParameters.cc:152
benchmark_cfg.fc
fc
Definition: benchmark_cfg.py:15
CaloCellGeometry::Pt3D
HepGeom::Point3D< CCGFloat > Pt3D
Definition: CaloCellGeometry.h:54
EcalTrapezoidParameters::a1
TPFloat a1() const
Definition: EcalTrapezoidParameters.cc:161
EcalTrapezoidParameters::m_C
TPFloat m_C
Definition: EcalTrapezoidParameters.h:123
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
EcalTrapezoidParameters::h2
TPFloat h2() const
Definition: EcalTrapezoidParameters.cc:150
EcalTrapezoidParameters::y15
TPFloat y15() const
Definition: EcalTrapezoidParameters.cc:156
EcalTrapezoidParameters::TPFloat
CaloCellGeometry::CCGFloat TPFloat
Definition: EcalTrapezoidParameters.h:65
EcalTrapezoidParameters::m_alp2
TPFloat m_alp2
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters::h1
TPFloat h1() const
Definition: EcalTrapezoidParameters.cc:146
EcalTrapezoidParameters::m_c
TPFloat m_c
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::m_h1
TPFloat m_h1
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters::m_alp1
TPFloat m_alp1
Definition: EcalTrapezoidParameters.h:120
DeadROC_duringRun.f2
f2
Definition: DeadROC_duringRun.py:220
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
EcalTrapezoidParameters::m_h2
TPFloat m_h2
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters::m_b
TPFloat m_b
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::m_tl2
TPFloat m_tl2
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters::m_B
TPFloat m_B
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::tl1
TPFloat tl1() const
Definition: EcalTrapezoidParameters.cc:148
EcalTrapezoidParameters::alp2
TPFloat alp2() const
Definition: EcalTrapezoidParameters.cc:153
EcalTrapezoidParameters::m_tl1
TPFloat m_tl1
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters::h
TPFloat h() const
Definition: EcalTrapezoidParameters.cc:168
EcalTrapezoidParameters::m_ph
TPFloat m_ph
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters::phi
TPFloat phi() const
Definition: EcalTrapezoidParameters.cc:145
VertexList
EcalTrapezoidParameters::VertexList VertexList
Definition: EcalTrapezoidParameters.cc:21
EcalTrapezoidParameters::hAa
TPFloat hAa() const
Definition: EcalTrapezoidParameters.cc:157
EcalTrapezoidParameters::m_A
TPFloat m_A
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::m_th
TPFloat m_th
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters.h
EcalTrapezoidParameters::D
TPFloat D() const
Definition: EcalTrapezoidParameters.cc:172
EcalTrapezoidParameters::m_H
TPFloat m_H
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::m_L
TPFloat m_L
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::m_dz
TPFloat m_dz
Definition: EcalTrapezoidParameters.h:120
EcalTrapezoidParameters::m_a
TPFloat m_a
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::L
TPFloat L() const
Definition: EcalTrapezoidParameters.cc:163
EcalTrapezoidParameters::bl2
TPFloat bl2() const
Definition: EcalTrapezoidParameters.cc:151
EcalTrapezoidParameters::m_d
TPFloat m_d
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::EcalTrapezoidParameters
EcalTrapezoidParameters()=delete
M_PI_2
#define M_PI_2
Definition: CSCGattiFunction.cc:6
EcalTrapezoidParameters::m_a1
TPFloat m_a1
Definition: EcalTrapezoidParameters.h:121
EcalTrapezoidParameters::VertexList
CaloCellGeometry::Pt3DVec VertexList
Definition: EcalTrapezoidParameters.h:64
EcalTrapezoidParameters::m_hBb
TPFloat m_hBb
Definition: EcalTrapezoidParameters.h:122
EcalTrapezoidParameters::hDd
TPFloat hDd() const
Definition: EcalTrapezoidParameters.cc:160
EcalTrapezoidParameters::m_x15
TPFloat m_x15
Definition: EcalTrapezoidParameters.h:121
EcalTrapezoidParameters::dz
TPFloat dz() const
Definition: EcalTrapezoidParameters.cc:143
EcalTrapezoidParameters::m_bl1
TPFloat m_bl1
Definition: EcalTrapezoidParameters.h:120
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
EcalTrapezoidParameters::A
TPFloat A() const
Definition: EcalTrapezoidParameters.cc:169
EcalTrapezoidParameters::m_D
TPFloat m_D
Definition: EcalTrapezoidParameters.h:123
EcalTrapezoidParameters::x15
TPFloat x15() const
Definition: EcalTrapezoidParameters.cc:155
EcalTrapezoidParameters::a4
TPFloat a4() const
Definition: EcalTrapezoidParameters.cc:162
EcalTrapezoidParameters::b
TPFloat b() const
Definition: EcalTrapezoidParameters.cc:165
EcalTrapezoidParameters::H
TPFloat H() const
Definition: EcalTrapezoidParameters.cc:173