00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <assert.h>
00016 #include <cmath>
00017 #include <algorithm>
00018
00019
00020 #include "Geometry/CaloGeometry/interface/EcalTrapezoidParameters.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 EcalTrapezoidParameters::EcalTrapezoidParameters(
00038 double aHalfLengthXNegZLoY ,
00039 double aHalfLengthXPosZLoY ,
00040 double aHalfLengthXPosZHiY ,
00041 double aHalfLengthYNegZ ,
00042 double aHalfLengthYPosZ ,
00043 double aHalfLengthZ ,
00044 double aAngleAD ,
00045 double aCoord15X ,
00046 double aCoord15Y
00047 )
00048 {
00049 m_dz = aHalfLengthZ ;
00050 m_h1 = aHalfLengthYNegZ ;
00051 m_bl1 = aHalfLengthXNegZLoY ;
00052 m_h2 = aHalfLengthYPosZ ;
00053 m_bl2 = aHalfLengthXPosZLoY ;
00054 m_tl2 = aHalfLengthXPosZHiY ;
00055
00056 m_a1 = aAngleAD ;
00057 m_y15 = aCoord15Y ;
00058 m_x15 = aCoord15X ;
00059
00060 m_hAa = fabs( m_y15 ) ;
00061
00062 m_L = 2*m_dz ;
00063 m_h = 2*m_h2 ;
00064 m_a = 2*m_bl2 ;
00065 m_b = 2*m_tl2 ;
00066 m_H = 2*m_h1 ;
00067 m_A = 2*m_bl1 ;
00068
00069
00070 const double sina1 ( sin( m_a1 ) ) ;
00071 const double cosa1 ( cos( m_a1 ) ) ;
00072 const double tana1 ( tan( m_a1 - M_PI_2 ) ) ;
00073
00074 const double tana4 ( ( m_tl2 - m_bl2 - m_h2*tana1 )/m_h2 ) ;
00075
00076 m_a4 = M_PI_2 + atan( tana4 ) ;
00077
00078 m_tl1 = m_bl1 + m_h1*( tana1 + tana4 ) ;
00079
00080 m_d = m_h/sina1 ;
00081 m_D = m_H/sina1 ;
00082
00083 const double tanalp1 ( ( m_D*cosa1 + m_tl1 - m_bl1 )/m_H ) ;
00084 const double tanalp2 ( ( m_d*cosa1 + m_tl2 - m_bl2 )/m_h ) ;
00085 m_alp1 = atan( tanalp1 ) ;
00086 m_alp2 = atan( tanalp2 ) ;
00087
00088 const double sina4 ( sin( m_a4 ) ) ;
00089 m_c = m_h/sina4 ;
00090 m_C = m_H/sina4 ;
00091 m_B = 2*m_tl1 ;
00092
00093 m_hDd = fabs( m_x15 )*sina1 - m_hAa*cosa1 ;
00094
00095 const double xd5 ( ( m_hAa + m_hDd*cosa1 )/sina1 ) ;
00096 const double xd6 ( m_D - m_d - xd5 ) ;
00097 const double z6 ( sqrt( m_hDd*m_hDd + xd6*xd6 ) ) ;
00098 double gb6 ;
00099 if( 0. == z6 || 1. < fabs( m_hDd/z6 ) )
00100 {
00101 gb6 = 0 ;
00102 }
00103 else
00104 {
00105 gb6 = M_PI - m_a1 - asin( m_hDd/z6 ) ;
00106 }
00107 m_hBb = z6*sin( gb6 ) ;
00108
00109 const double xb6 ( z6*cos( gb6 ) ) ;
00110 const double xb7 ( m_B - xb6 - m_b ) ;
00111 const double z7 ( sqrt( m_hBb*m_hBb + xb7*xb7 ) ) ;
00112 double gc7 ;
00113 if( 0 == z7 || 1. < fabs( m_hBb/z7 ) )
00114 {
00115 gc7 = 0 ;
00116 }
00117 else
00118 {
00119 gc7 = M_PI - m_a4 - asin( m_hBb/z7 ) ;
00120 }
00121 m_hCc = z7*sin( gc7 ) ;
00122
00123 const HepPoint3D fc ( m_bl2 + m_h2*tanalp2, m_h2, 0 ) ;
00124 const HepPoint3D v5 ( m_x15 , m_y15 , -m_L ) ;
00125 const HepPoint3D bc ( v5 +
00126 HepPoint3D( m_bl1 + m_h1*tanalp1, m_h1, 0 ) ) ;
00127 const HepPoint3D dc ( fc - bc ) ;
00128
00129 m_th = dc.theta() ;
00130 m_ph = dc.phi() ;
00131 }
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 double EcalTrapezoidParameters::dz() const { return m_dz ; }
00166 double EcalTrapezoidParameters::theta() const { return m_th ; }
00167 double EcalTrapezoidParameters::phi() const { return m_ph ; }
00168 double EcalTrapezoidParameters::h1() const { return m_h1 ; }
00169 double EcalTrapezoidParameters::bl1() const { return m_bl1 ; }
00170 double EcalTrapezoidParameters::tl1() const { return m_tl1 ; }
00171 double EcalTrapezoidParameters::alp1() const { return m_alp1 ; }
00172 double EcalTrapezoidParameters::h2() const { return m_h2 ; }
00173 double EcalTrapezoidParameters::bl2() const { return m_bl2 ; }
00174 double EcalTrapezoidParameters::tl2() const { return m_tl2 ; }
00175 double EcalTrapezoidParameters::alp2() const { return m_alp2 ; }
00176
00177 double EcalTrapezoidParameters::x15() const { return m_x15 ; }
00178 double EcalTrapezoidParameters::y15() const { return m_y15 ; }
00179 double EcalTrapezoidParameters::hAa() const { return m_hAa ; }
00180 double EcalTrapezoidParameters::hBb() const { return m_hBb ; }
00181 double EcalTrapezoidParameters::hCc() const { return m_hCc ; }
00182 double EcalTrapezoidParameters::hDd() const { return m_hDd ; }
00183 double EcalTrapezoidParameters::a1() const { return m_a1 ; }
00184 double EcalTrapezoidParameters::a4() const { return m_a4 ; }
00185 double EcalTrapezoidParameters::L() const { return m_L ; }
00186 double EcalTrapezoidParameters::a() const { return m_a ; }
00187 double EcalTrapezoidParameters::b() const { return m_b ; }
00188 double EcalTrapezoidParameters::c() const { return m_c ; }
00189 double EcalTrapezoidParameters::d() const { return m_d ; }
00190 double EcalTrapezoidParameters::h() const { return m_h ; }
00191 double EcalTrapezoidParameters::A() const { return m_A ; }
00192 double EcalTrapezoidParameters::B() const { return m_B ; }
00193 double EcalTrapezoidParameters::C() const { return m_C ; }
00194 double EcalTrapezoidParameters::D() const { return m_D ; }
00195 double EcalTrapezoidParameters::H() const { return m_H ; }
00196
00197 EcalTrapezoidParameters::VertexList
00198 EcalTrapezoidParameters::vertexList() const
00199 {
00200 VertexList vtx ;
00201 vtx.reserve( 8 ) ;
00202
00203 const double dztanth ( dz()*tan( theta() ) ) ;
00204
00205 const double ph ( phi() ) ;
00206 const HepPoint3D fc ( dztanth*cos(ph), dztanth*sin(ph), dz() ) ;
00207
00208 const double h_ ( h() ) ;
00209 const double H_ ( H() ) ;
00210 const double b_ ( b() ) ;
00211 const double B_ ( B() ) ;
00212 const double a_ ( a() ) ;
00213 const double A_ ( A() ) ;
00214
00215
00216
00217 const double tanalp1 ( tan(alp1()) ) ;
00218
00219 const double tanalp2 ( tan(alp2()) ) ;
00220
00221 const double tana1 ( tan( a1() - M_PI_2 ) ) ;
00222
00223 const HepPoint3D f1 ( -HepPoint3D( bl2() + h2()*tanalp2, h2(), 0 ) ) ;
00224
00225 const HepPoint3D f2 ( HepPoint3D( -h_*tana1, h_, 0 ) + f1 ) ;
00226
00227 const HepPoint3D f3 ( f2 + HepPoint3D( b_,0,0 ) ) ;
00228
00229 const HepPoint3D f4 ( HepPoint3D( a_,0,0 ) + f1 ) ;
00230
00231
00232 const HepPoint3D f5 ( -HepPoint3D( bl1() + h1()*tanalp1, h1(), 0 ) ) ;
00233
00234 const HepPoint3D f6 ( HepPoint3D( -H_*tana1, H_, 0 ) + f5 ) ;
00235
00236 const HepPoint3D f7 ( f6 + HepPoint3D( B_,0,0 ) ) ;
00237
00238 const HepPoint3D f8 ( HepPoint3D( A_,0,0 ) + f5 ) ;
00239
00240 vtx.push_back( fc + f1 ) ;
00241 vtx.push_back( fc + f2 ) ;
00242 vtx.push_back( fc + f3 ) ;
00243 vtx.push_back( fc + f4 ) ;
00244 vtx.push_back( -fc + f5 ) ;
00245 vtx.push_back( -fc + f6 ) ;
00246 vtx.push_back( -fc + f7 ) ;
00247 vtx.push_back( -fc + f8 ) ;
00248
00249 return vtx ;
00250 }
00251
00252
00253