11 typedef HepGeom::Vector3D<CCGFloat>
FVec3D ;
12 typedef HepGeom::Plane3D<CCGFloat>
Plane3D ;
14 typedef HepGeom::Vector3D<double>
DVec3D ;
16 typedef HepGeom::Point3D<double>
DPt3D ;
20 TruncatedPyramid::TruncatedPyramid() :
22 m_axis ( 0., 0., 0. ),
23 m_corOne ( 0., 0., 0. )
35 CaloCellGeometry::operator=( tr ) ;
39 m_corOne = tr.m_corOne ;
44 TruncatedPyramid::TruncatedPyramid( CornersMgr* cMgr ,
50 m_axis ( ( bCtr - fCtr ).
unit() ) ,
51 m_corOne ( cor1.
x(), cor1.
y(), cor1.
z() )
54 TruncatedPyramid::TruncatedPyramid(
const CornersVec& corn ,
57 m_axis ( makeAxis() ) ,
58 m_corOne ( corn[0].
x(), corn[0].
y(), corn[0].
z() )
61 TruncatedPyramid::~TruncatedPyramid()
65 TruncatedPyramid::getPosition(
CCGFloat depth )
const
71 TruncatedPyramid::getThetaAxis()
const
73 return m_axis.
theta() ;
77 TruncatedPyramid::getPhiAxis()
const
83 TruncatedPyramid::axis()
const
89 TruncatedPyramid::vocalCorners(
Pt3DVec& vec ,
93 localCorners( vec, pv, ref ) ;
97 TruncatedPyramid::makeAxis()
104 TruncatedPyramid::backCtr()
const
106 return GlobalPoint( 0.25*( getCorners()[4].
x() + getCorners()[5].
x() +
107 getCorners()[6].
x() + getCorners()[7].
x() ),
108 0.25*( getCorners()[4].
y() + getCorners()[5].
y() +
109 getCorners()[6].
y() + getCorners()[7].
y() ),
110 0.25*( getCorners()[4].
z() + getCorners()[5].
z() +
111 getCorners()[6].
z() + getCorners()[7].
z() ) ) ;
115 TruncatedPyramid::getTransform(
Tr3D& tr,
Pt3DVec* lptr )
const
118 const Pt3D gFront (
p.x(),
p.y(),
p.z() ) ;
119 const DPt3D dgFront (
p.x(),
p.y(),
p.z() ) ;
121 const double dz ( param()[0] ) ;
124 assert( 0 != param() ) ;
125 std::vector<Pt3D > lc( 8,
Pt3D(0,0,0) ) ;
128 localCorners( lc, param(), lFront ) ;
132 localCornersSwap( lc, param(), lFront ) ;
137 Pt3D lBack ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7]) ) ;
139 const double disl ( ( lFront - lc[0] ).
mag() ) ;
140 const double disr ( ( lFront - lc[3] ).
mag() ) ;
141 const double disg ( ( gFront - m_corOne ).
mag() ) ;
143 const double dell ( fabs( disg - disl ) ) ;
144 const double delr ( fabs( disg - disr ) ) ;
149 localCornersReflection( lc, param(), lFront ) ;
150 lBack = 0.25*( lc[4] + lc[5] + lc[6] + lc[7] ) ;
153 const DPt3D dlFront ( lFront.x(), lFront.y(), lFront.z() ) ;
154 const DPt3D dlBack ( lBack.x() , lBack.y() , lBack.z() ) ;
155 const DPt3D dlOne ( lc[0].
x() , lc[0].
y() , lc[0].
z() ) ;
157 const FVec3D dgAxis ( axis().
x(), axis().
y(), axis().
z() ) ;
159 const DPt3D dmOne ( m_corOne.x(), m_corOne.y(), m_corOne.z() ) ;
161 const DPt3D dgBack ( dgFront + ( dlBack - dlFront ).
mag()*dgAxis ) ;
162 DPt3D dgOne ( dgFront + ( dlOne - dlFront ).
mag()*( dmOne - dgFront ).
unit() ) ;
164 const double dlangle ( ( dlBack - dlFront).
angle( dlOne - dlFront ) ) ;
165 const double dgangle ( ( dgBack - dgFront).
angle( dgOne - dgFront ) ) ;
166 const double dangle ( dlangle - dgangle ) ;
168 if( 1.
e-6 < fabs(dangle) )
170 const DPlane3D dgPl ( dgFront, dgOne, dgBack ) ;
171 const DPt3D dp2 ( dgFront + dgPl.normal().unit() ) ;
173 DPt3D dgOld ( dgOne ) ;
175 dgOne = ( dgFront + HepGeom::Rotate3D( -dangle, dgFront, dp2 )*
176 DVec3D( dgOld - dgFront ) ) ;
179 tr =
Tr3D( dlFront , dlBack , dlOne ,
180 dgFront , dgBack , dgOne ) ;
182 if( 0 != lptr ) (*lptr) = lc ;
193 getTransform( tr, &lc ) ;
195 for(
unsigned int i ( 0 ) ;
i != 8 ; ++
i )
197 const Pt3D corn ( tr*lc[
i] ) ;
198 corners[
i] =
GlobalPoint( corn.x(), corn.y(), corn.z() ) ;
207 return Pt3D ( -p.x(), p.y(), p.z() ) ;
212 TruncatedPyramid::localCornersReflection(
Pt3DVec& lc ,
217 localCorners( lc, pv, ref ) ;
242 ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
246 TruncatedPyramid::localCorners(
Pt3DVec& lc ,
251 assert( 8 == lc.size() ) ;
272 const unsigned int off ( h1<h2 ? 0 : 4 ) ;
274 lc[0+off] =
Pt3D ( -dz*tthcp - h1*ta1 - b1, -dz*tthsp - h1 , -dz );
275 lc[1+off] =
Pt3D ( -dz*tthcp + h1*ta1 - t1, -dz*tthsp + h1 , -dz );
276 lc[2+off] =
Pt3D ( -dz*tthcp + h1*ta1 + t1, -dz*tthsp + h1 , -dz );
277 lc[3+off] =
Pt3D ( -dz*tthcp - h1*ta1 + b1, -dz*tthsp - h1 , -dz );
278 lc[4-off] =
Pt3D ( dz*tthcp - h2*ta2 - b2, dz*tthsp - h2 , dz );
279 lc[5-off] =
Pt3D ( dz*tthcp + h2*ta2 -
t2, dz*tthsp + h2 , dz );
280 lc[6-off] =
Pt3D ( dz*tthcp + h2*ta2 +
t2, dz*tthsp + h2 , dz );
281 lc[7-off] =
Pt3D ( dz*tthcp - h2*ta2 + b2, dz*tthsp - h2 , dz );
283 ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
287 TruncatedPyramid::localCornersSwap(
Pt3DVec& lc ,
291 localCorners( lc, pv, ref ) ;
307 ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ;
315 TruncatedPyramid::createCorners(
const std::vector<CCGFloat>& pv ,
317 std::vector<GlobalPoint>& co )
319 assert( 11 == pv.size() ) ;
320 assert( 8 == co.size() ) ;
330 static const FVec3D x ( 1, 0, 0 ) ;
331 static const FVec3D y ( 0, 1, 0 ) ;
332 static const FVec3D z ( 0, 0, 1 ) ;
337 localCorners(
to, &pv.front(),
tmp ) ;
339 for(
unsigned int i ( 0 ) ;
i != 8 ; ++
i )
383 copy(
to.begin(),
to.end(), ko.begin() ) ;
385 for(
unsigned int i ( 0 ) ;
i != 8 ; ++
i )
387 const Pt3D &
p ( ko[
i] ) ;
396 s <<
"Center: " << ( (
const CaloCellGeometry&) cell).getPosition() << std::endl;
397 const float thetaaxis ( cell.getThetaAxis() ) ;
398 const float phiaxis ( cell.getPhiAxis() ) ;
399 s <<
"Axis: " << thetaaxis <<
" " << phiaxis << std::endl ;
401 for (
unsigned int i=0 ;
i != corners.
size() ; ++
i )
403 s <<
"Corner: " << corners[
i] << std::endl;
HepGeom::Point3D< double > DPt3D
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Geom::Theta< T > theta() const
auto const T2 &decltype(t1.eta()) t2
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
HepGeom::Vector3D< double > DVec3D
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::Pt3D Pt3D
Vector3DBase unit() const
HepGeom::Plane3D< double > DPlane3D
CaloCellGeometry::Pt3DVec Pt3DVec
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
CaloCellGeometry::Tr3D Tr3D
std::vector< std::vector< double > > tmp
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
bool uninitialized() const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
HepGeom::Vector3D< CCGFloat > FVec3D
ROOT::Math::Plane3D Plane3D
Global3DVector GlobalVector
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)