12 const HepGeom::Point3D<double> gFront ( p.
x(), p.
y(), p.
z() ) ;
14 const double dz (
param()[0] ) ;
16 HepGeom::Point3D<double> lFront ;
17 assert( 0 !=
param() ) ;
18 std::vector<HepGeom::Point3D<double> > lc ( 11.2 > dz ?
24 HepGeom::Point3D<double> lBack ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7]) ) ;
28 const double disl ( ( lFront - lc[0] ).
mag() ) ;
29 const double disr ( ( lFront - lc[3] ).
mag() ) ;
30 const double disg ( ( gFront - (*
m_corOne) ).
mag() ) ;
32 const double dell ( fabs( disg - disl ) ) ;
33 const double delr ( fabs( disg - disr ) ) ;
39 lBack = 0.25*( lc[4] + lc[5] + lc[6] + lc[7] ) ;
42 const HepGeom::Point3D<double> lOne ( lc[0] ) ;
44 const HepGeom::Vector3D<double> gAxis (
axis().
x(),
axis().
y(),
axis().
z() ) ;
47 const HepGeom::Point3D<double> gBack ( gFront + (lBack-lFront).
mag()*gAxis ) ;
48 const HepGeom::Point3D<double> gOneT ( gFront + ( lOne - lFront ).
mag()*( (*
m_corOne) - gFront ).
unit() ) ;
50 const double langle ( ( lBack - lFront).
angle( lOne - lFront ) ) ;
51 const double gangle ( ( gBack - gFront).
angle( gOneT- gFront ) ) ;
52 const double dangle ( langle - gangle ) ;
54 const HepGeom::Plane3D<double> gPl ( gFront, gOneT, gBack ) ;
55 const HepGeom::Point3D<double>
p2 ( gFront + gPl.normal().unit() ) ;
57 const HepGeom::Point3D<double> gOne ( gFront + HepGeom::Rotate3D( -dangle, gFront,
p2 )*
58 HepGeom::Vector3D<double> ( gOneT - gFront ) ) ;
60 const HepGeom::Transform3D tr ( lFront , lBack , lOne ,
61 gFront , gBack , gOne ) ;
63 if( 0 != lptr ) (*lptr) = lc ;
76 std::vector<HepGeom::Point3D<double> > lc ;
80 for(
unsigned int i ( 0 ) ;
i != 8 ; ++
i )
82 const HepGeom::Point3D<double> corn ( tr*lc[
i] ) ;
83 corners[
i] =
GlobalPoint( corn.x(), corn.y(), corn.z() ) ;
94 HepGeom::Point3D<double>
refl(
const HepGeom::Point3D<double> &
p )
96 return HepGeom::Point3D<double> ( -p.x(), p.y(), p.z() ) ;
100 std::vector<HepGeom::Point3D<double> >
102 HepGeom::Point3D<double> & ref )
106 std::vector<HepGeom::Point3D<double> > lc (
localCorners( pv, ref ) ) ;
107 HepGeom::Point3D<double>
tmp ;
132 ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
136 std::vector<HepGeom::Point3D<double> >
138 HepGeom::Point3D<double> & ref )
142 const double dz ( pv[0] ) ;
143 const double th ( pv[1] ) ;
144 const double ph ( pv[2] ) ;
145 const double h1 ( pv[3] ) ;
146 const double b1 ( pv[4] ) ;
147 const double t1 ( pv[5] ) ;
148 const double a1 ( pv[6] ) ;
149 const double h2 ( pv[7] ) ;
150 const double b2 ( pv[8] ) ;
151 const double t2 ( pv[9] ) ;
152 const double a2 ( pv[10]) ;
154 const double ta1 (
tan( a1 ) ) ;
155 const double ta2 (
tan( a2 ) ) ;
157 const double tth (
tan( th ) ) ;
158 const double tthcp ( tth *
cos( ph ) ) ;
159 const double tthsp ( tth *
sin( ph ) ) ;
161 const unsigned int off ( h1<h2 ? 0 : 4 ) ;
163 std::vector<HepGeom::Point3D<double> > lc ( 8, HepGeom::Point3D<double> (0,0,0) ) ;
165 lc[0+off] = HepGeom::Point3D<double> ( -dz*tthcp - h1*ta1 - b1, -dz*tthsp - h1 , -dz );
166 lc[1+off] = HepGeom::Point3D<double> ( -dz*tthcp + h1*ta1 - t1, -dz*tthsp + h1 , -dz );
167 lc[2+off] = HepGeom::Point3D<double> ( -dz*tthcp + h1*ta1 + t1, -dz*tthsp + h1 , -dz );
168 lc[3+off] = HepGeom::Point3D<double> ( -dz*tthcp - h1*ta1 + b1, -dz*tthsp - h1 , -dz );
169 lc[4-off] = HepGeom::Point3D<double> ( dz*tthcp - h2*ta2 - b2, dz*tthsp - h2 , dz );
170 lc[5-off] = HepGeom::Point3D<double> ( dz*tthcp + h2*ta2 - t2, dz*tthsp + h2 , dz );
171 lc[6-off] = HepGeom::Point3D<double> ( dz*tthcp + h2*ta2 + t2, dz*tthsp + h2 , dz );
172 lc[7-off] = HepGeom::Point3D<double> ( dz*tthcp - h2*ta2 + b2, dz*tthsp - h2 , dz );
174 ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
179 std::vector<HepGeom::Point3D<double> >
181 HepGeom::Point3D<double> & ref )
183 std::vector<HepGeom::Point3D<double> > lc (
localCorners( pv, ref ) ) ;
185 HepGeom::Point3D<double>
tmp ;
199 ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
210 const HepGeom::Transform3D& tr ,
213 assert( 11 == pv.size() ) ;
218 const double dz ( pv[0] ) ;
219 const double h1 ( pv[3] ) ;
220 const double h2 ( pv[7] ) ;
221 std::vector<HepGeom::Point3D<double> > ko ( 8, HepGeom::Point3D<double> (0,0,0) ) ;
224 static const HepGeom::Vector3D<double>
x ( 1, 0, 0 ) ;
225 static const HepGeom::Vector3D<double>
y ( 0, 1, 0 ) ;
226 static const HepGeom::Vector3D<double>
z ( 0, 0, 1 ) ;
227 const bool refl ( ( ( tr*x ).
cross( tr*y ) ).
dot( tr*z ) < 0 ) ;
230 HepGeom::Point3D<double>
tmp ;
233 for(
unsigned int i ( 0 ) ;
i != 8 ; ++
i )
277 copy( to.begin(), to.end(), ko.begin() ) ;
279 for(
unsigned int i ( 0 ) ;
i != 8 ; ++
i )
281 const HepGeom::Point3D<double> &
p ( ko[
i] ) ;
290 s <<
"Center: " << ( (
const CaloCellGeometry&) cell).getPosition() << std::endl;
293 s <<
"Axis: " << thetaaxis <<
" " << phiaxis << std::endl ;
295 for (
unsigned int i=0 ;
i != corners.size() ; ++
i )
297 s <<
"Corner: " << corners[
i] << std::endl;
HepGeom::Point3D< double > refl(const HepGeom::Point3D< double > &p)
static std::vector< HepGeom::Point3D< double > > localCornersSwap(const double *pv, HepGeom::Point3D< double > &ref)
static std::vector< HepGeom::Point3D< double > > localCornersReflection(const double *pv, HepGeom::Point3D< double > &ref)
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
static void createCorners(const std::vector< double > &pv, const HepGeom::Transform3D &tr, CornersVec &co)
const double * param() const
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
const GlobalVector & axis() const
virtual HepGeom::Transform3D getTransform(std::vector< HepGeom::Point3D< double > > *lptr) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
HepGeom::Point3D< double > * m_corOne
CornersVec & setCorners() const
virtual const CornersVec & getCorners() const
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
std::vector< std::vector< double > > tmp
bool uninitialized() const
static std::vector< HepGeom::Point3D< double > > localCorners(const double *pv, HepGeom::Point3D< double > &ref)
const GlobalPoint & getPosition() const
float getThetaAxis() const
virtual const CornersVec & getCorners() const =0
T angle(T x1, T y1, T z1, T x2, T y2, T z2)