A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code. More...
#include <TruncatedPyramid.h>
Public Types | |
typedef std::vector < HepGeom::Plane3D< double > > | BoundaryVec |
Public Member Functions | |
const GlobalVector & | axis () const |
virtual const CornersVec & | getCorners () const |
float | getPhiAxis () const |
const GlobalPoint | getPosition (float depth) const |
float | getThetaAxis () const |
virtual HepGeom::Transform3D | getTransform (std::vector< HepGeom::Point3D< double > > *lptr) const |
TruncatedPyramid (const CornersVec &corn, const double *par) | |
TruncatedPyramid (const CornersMgr *cMgr, const GlobalPoint &fCtr, const GlobalPoint &bCtr, const GlobalPoint &cor1, const double *parV) | |
virtual std::vector < HepGeom::Point3D< double > > | vocalCorners (const double *pv, HepGeom::Point3D< double > &ref) const |
virtual | ~TruncatedPyramid () |
Static Public Member Functions | |
static void | createCorners (const std::vector< double > &pv, const HepGeom::Transform3D &tr, CornersVec &co) |
static std::vector < HepGeom::Point3D< double > > | localCorners (const double *pv, HepGeom::Point3D< double > &ref) |
static std::vector < HepGeom::Point3D< double > > | localCornersReflection (const double *pv, HepGeom::Point3D< double > &ref) |
static std::vector < HepGeom::Point3D< double > > | localCornersSwap (const double *pv, HepGeom::Point3D< double > &ref) |
Private Member Functions | |
const GlobalPoint | backCtr () const |
GlobalVector | makeAxis () |
Private Attributes | |
GlobalVector | m_axis |
HepGeom::Point3D< double > * | m_corOne |
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code.
Definition at line 25 of file TruncatedPyramid.h.
typedef std::vector< HepGeom::Plane3D<double> > TruncatedPyramid::BoundaryVec |
Definition at line 29 of file TruncatedPyramid.h.
TruncatedPyramid::TruncatedPyramid | ( | const CornersMgr * | cMgr, |
const GlobalPoint & | fCtr, | ||
const GlobalPoint & | bCtr, | ||
const GlobalPoint & | cor1, | ||
const double * | parV | ||
) | [inline] |
Definition at line 31 of file TruncatedPyramid.h.
TruncatedPyramid::TruncatedPyramid | ( | const CornersVec & | corn, |
const double * | par | ||
) | [inline] |
Definition at line 41 of file TruncatedPyramid.h.
virtual TruncatedPyramid::~TruncatedPyramid | ( | ) | [inline, virtual] |
const GlobalVector& TruncatedPyramid::axis | ( | ) | const [inline] |
Definition at line 67 of file TruncatedPyramid.h.
References m_axis.
Referenced by getTransform().
{ return m_axis ; }
const GlobalPoint TruncatedPyramid::backCtr | ( | ) | const [inline, private] |
Definition at line 98 of file TruncatedPyramid.h.
References getCorners(), x, detailsBasic3DVector::y, and z.
Referenced by makeAxis().
{ return GlobalPoint( 0.25*( getCorners()[4].x() + getCorners()[5].x() + getCorners()[6].x() + getCorners()[7].x() ), 0.25*( getCorners()[4].y() + getCorners()[5].y() + getCorners()[6].y() + getCorners()[7].y() ), 0.25*( getCorners()[4].z() + getCorners()[5].z() + getCorners()[6].z() + getCorners()[7].z() ) ) ; }
void TruncatedPyramid::createCorners | ( | const std::vector< double > & | pv, |
const HepGeom::Transform3D & | tr, | ||
CaloCellGeometry::CornersVec & | co | ||
) | [static] |
Definition at line 209 of file TruncatedPyramid.cc.
References filterCSVwithJSON::copy, cross(), dot(), i, localCorners(), L1TEmulatorMonitor_cff::p, truncPyr::refl(), tmp, x, detailsBasic3DVector::y, and z.
{ assert( 11 == pv.size() ) ; // to get the ordering right for fast sim, we have to use their convention // which were based on the old static geometry. Some gymnastics required here. const double dz ( pv[0] ) ; const double h1 ( pv[3] ) ; const double h2 ( pv[7] ) ; std::vector<HepGeom::Point3D<double> > ko ( 8, HepGeom::Point3D<double> (0,0,0) ) ; // if reflection, different things for barrel and endcap static const HepGeom::Vector3D<double> x ( 1, 0, 0 ) ; static const HepGeom::Vector3D<double> y ( 0, 1, 0 ) ; static const HepGeom::Vector3D<double> z ( 0, 0, 1 ) ; const bool refl ( ( ( tr*x ).cross( tr*y ) ).dot( tr*z ) < 0 ) ; // has reflection! HepGeom::Point3D<double> tmp ; std::vector<HepGeom::Point3D<double> > to ( localCorners( &pv.front(), tmp ) ) ; for( unsigned int i ( 0 ) ; i != 8 ; ++i ) { ko[i] = tr * to[i] ; // apply transformation } if( refl || h1>h2 ) { if( 11.2 < dz ) //barrel { if( !refl ) { to[0] = ko[3] ; to[1] = ko[2] ; to[2] = ko[1] ; to[3] = ko[0] ; to[4] = ko[7] ; to[5] = ko[6] ; to[6] = ko[5] ; to[7] = ko[4] ; } else { to[0] = ko[0] ; to[1] = ko[1] ; to[2] = ko[2] ; to[3] = ko[3] ; to[4] = ko[4] ; to[5] = ko[5] ; to[6] = ko[6] ; to[7] = ko[7] ; } } else //endcap { to[0] = ko[0] ; to[1] = ko[3] ; to[2] = ko[2] ; to[3] = ko[1] ; to[4] = ko[4] ; to[5] = ko[7] ; to[6] = ko[6] ; to[7] = ko[5] ; } copy( to.begin(), to.end(), ko.begin() ) ; // faster than ko = to ? maybe. } for( unsigned int i ( 0 ) ; i != 8 ; ++i ) { const HepGeom::Point3D<double> & p ( ko[i] ) ; co[ i ] = GlobalPoint( p.x(), p.y(), p.z() ) ; } }
const CaloCellGeometry::CornersVec & TruncatedPyramid::getCorners | ( | ) | const [virtual] |
Implements CaloCellGeometry.
Definition at line 69 of file TruncatedPyramid.cc.
References CaloCellGeometry::getCorners(), getTransform(), i, m_corOne, CaloCellGeometry::setCorners(), and EZArrayFL< T >::uninitialized().
Referenced by backCtr(), and operator<<().
{ const CornersVec& co ( CaloCellGeometry::getCorners() ) ; if( co.uninitialized() ) { CornersVec& corners ( setCorners() ) ; std::vector<HepGeom::Point3D<double> > lc ; const HepGeom::Transform3D tr ( getTransform( &lc ) ) ; for( unsigned int i ( 0 ) ; i != 8 ; ++i ) { const HepGeom::Point3D<double> corn ( tr*lc[i] ) ; corners[i] = GlobalPoint( corn.x(), corn.y(), corn.z() ) ; } delete m_corOne ; // no longer needed m_corOne = 0 ; } return co ; }
float TruncatedPyramid::getPhiAxis | ( | ) | const [inline] |
Definition at line 65 of file TruncatedPyramid.h.
References m_axis, and PV3DBase< T, PVType, FrameType >::phi().
Referenced by operator<<().
const GlobalPoint TruncatedPyramid::getPosition | ( | float | depth | ) | const [inline] |
Position corresponding to the center of the front face at a certain depth (default is zero) along the crystal axis. If "depth" is <=0, the nomial position of the cell is returned (center of the front face).
Definition at line 56 of file TruncatedPyramid.h.
References CaloCellGeometry::getPosition(), and m_axis.
Referenced by EcalSimple2007H4TBAnalyzer::analyze(), PFRecHitProducerECAL::createEcalRecHit(), and PFRecHitProducerECAL::findEcalRecHitGeometry().
{ return CaloCellGeometry::getPosition() + depth*m_axis ; }
float TruncatedPyramid::getThetaAxis | ( | ) | const [inline] |
Definition at line 62 of file TruncatedPyramid.h.
References m_axis, and PV3DBase< T, PVType, FrameType >::theta().
Referenced by operator<<().
HepGeom::Transform3D TruncatedPyramid::getTransform | ( | std::vector< HepGeom::Point3D< double > > * | lptr | ) | const [virtual] |
Reimplemented from CaloCellGeometry.
Definition at line 9 of file TruncatedPyramid.cc.
References angle(), axis(), CaloCellGeometry::getPosition(), localCorners(), localCornersReflection(), localCornersSwap(), m_corOne, mag(), L1TEmulatorMonitor_cff::p, p2, CaloCellGeometry::param(), csvLumiCalc::unit, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by getCorners().
{ const GlobalPoint& p ( CaloCellGeometry::getPosition() ) ; const HepGeom::Point3D<double> gFront ( p.x(), p.y(), p.z() ) ; const double dz ( param()[0] ) ; HepGeom::Point3D<double> lFront ; assert( 0 != param() ) ; std::vector<HepGeom::Point3D<double> > lc ( 11.2 > dz ? localCorners( param(), lFront ) : localCornersSwap( param(), lFront ) ) ; // figure out if reflction volume or not HepGeom::Point3D<double> lBack ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7]) ) ; assert( 0 != m_corOne ) ; const double disl ( ( lFront - lc[0] ).mag() ) ; const double disr ( ( lFront - lc[3] ).mag() ) ; const double disg ( ( gFront - (*m_corOne) ).mag() ) ; const double dell ( fabs( disg - disl ) ) ; const double delr ( fabs( disg - disr ) ) ; if( 11.2<dz && delr < dell ) // reflection volume if true { lc = localCornersReflection( param(), lFront ) ; lBack = 0.25*( lc[4] + lc[5] + lc[6] + lc[7] ) ; } const HepGeom::Point3D<double> lOne ( lc[0] ) ; const HepGeom::Vector3D<double> gAxis ( axis().x(), axis().y(), axis().z() ) ; const HepGeom::Point3D<double> gBack ( gFront + (lBack-lFront).mag()*gAxis ) ; const HepGeom::Point3D<double> gOneT ( gFront + ( lOne - lFront ).mag()*( (*m_corOne) - gFront ).unit() ) ; const double langle ( ( lBack - lFront).angle( lOne - lFront ) ) ; const double gangle ( ( gBack - gFront).angle( gOneT- gFront ) ) ; const double dangle ( langle - gangle ) ; const HepGeom::Plane3D<double> gPl ( gFront, gOneT, gBack ) ; const HepGeom::Point3D<double> p2 ( gFront + gPl.normal().unit() ) ; const HepGeom::Point3D<double> gOne ( gFront + HepGeom::Rotate3D( -dangle, gFront, p2 )* HepGeom::Vector3D<double> ( gOneT - gFront ) ) ; const HepGeom::Transform3D tr ( lFront , lBack , lOne , gFront , gBack , gOne ) ; if( 0 != lptr ) (*lptr) = lc ; return tr ; }
std::vector< HepGeom::Point3D< double > > TruncatedPyramid::localCorners | ( | const double * | pv, |
HepGeom::Point3D< double > & | ref | ||
) | [static] |
Definition at line 137 of file TruncatedPyramid.cc.
References funct::cos(), funct::sin(), and funct::tan().
Referenced by createCorners(), getTransform(), EcalEndcapGeometry::localCorners(), localCornersReflection(), localCornersSwap(), and vocalCorners().
{ assert( 0 != pv ) ; const double dz ( pv[0] ) ; const double th ( pv[1] ) ; const double ph ( pv[2] ) ; const double h1 ( pv[3] ) ; const double b1 ( pv[4] ) ; const double t1 ( pv[5] ) ; const double a1 ( pv[6] ) ; const double h2 ( pv[7] ) ; const double b2 ( pv[8] ) ; const double t2 ( pv[9] ) ; const double a2 ( pv[10]) ; const double ta1 ( tan( a1 ) ) ; // lower plane const double ta2 ( tan( a2 ) ) ; // upper plane const double tth ( tan( th ) ) ; const double tthcp ( tth * cos( ph ) ) ; const double tthsp ( tth * sin( ph ) ) ; const unsigned int off ( h1<h2 ? 0 : 4 ) ; std::vector<HepGeom::Point3D<double> > lc ( 8, HepGeom::Point3D<double> (0,0,0) ) ; lc[0+off] = HepGeom::Point3D<double> ( -dz*tthcp - h1*ta1 - b1, -dz*tthsp - h1 , -dz ); // (-,-,-) lc[1+off] = HepGeom::Point3D<double> ( -dz*tthcp + h1*ta1 - t1, -dz*tthsp + h1 , -dz ); // (-,+,-) lc[2+off] = HepGeom::Point3D<double> ( -dz*tthcp + h1*ta1 + t1, -dz*tthsp + h1 , -dz ); // (+,+,-) lc[3+off] = HepGeom::Point3D<double> ( -dz*tthcp - h1*ta1 + b1, -dz*tthsp - h1 , -dz ); // (+,-,-) lc[4-off] = HepGeom::Point3D<double> ( dz*tthcp - h2*ta2 - b2, dz*tthsp - h2 , dz ); // (-,-,+) lc[5-off] = HepGeom::Point3D<double> ( dz*tthcp + h2*ta2 - t2, dz*tthsp + h2 , dz ); // (-,+,+) lc[6-off] = HepGeom::Point3D<double> ( dz*tthcp + h2*ta2 + t2, dz*tthsp + h2 , dz ); // (+,+,+) lc[7-off] = HepGeom::Point3D<double> ( dz*tthcp - h2*ta2 + b2, dz*tthsp - h2 , dz ); // (+,-,+) ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ; return lc ; }
std::vector< HepGeom::Point3D< double > > TruncatedPyramid::localCornersReflection | ( | const double * | pv, |
HepGeom::Point3D< double > & | ref | ||
) | [static] |
Definition at line 101 of file TruncatedPyramid.cc.
References localCorners(), truncPyr::refl(), and tmp.
Referenced by getTransform(), and EcalBarrelGeometry::localCorners().
{ // using namespace truncPyr ; std::vector<HepGeom::Point3D<double> > lc ( localCorners( pv, ref ) ) ; HepGeom::Point3D<double> tmp ; /* tmp = lc[0] ; lc[0] = refl( lc[2] ) ; lc[2] = refl( tmp ) ; tmp = lc[1] ; lc[1] = refl( lc[3] ) ; lc[3] = refl( tmp ) ; tmp = lc[4] ; lc[4] = refl( lc[6] ) ; lc[6] = refl( tmp ) ; tmp = lc[5] ; lc[5] = refl( lc[7] ) ; lc[7] = refl( tmp ) ; */ lc[0] = truncPyr::refl( lc[0] ) ; lc[1] = truncPyr::refl( lc[1] ) ; lc[2] = truncPyr::refl( lc[2] ) ; lc[3] = truncPyr::refl( lc[3] ) ; lc[4] = truncPyr::refl( lc[4] ) ; lc[5] = truncPyr::refl( lc[5] ) ; lc[6] = truncPyr::refl( lc[6] ) ; lc[7] = truncPyr::refl( lc[7] ) ; ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ; return lc ; }
std::vector< HepGeom::Point3D< double > > TruncatedPyramid::localCornersSwap | ( | const double * | pv, |
HepGeom::Point3D< double > & | ref | ||
) | [static] |
Definition at line 180 of file TruncatedPyramid.cc.
References localCorners(), and tmp.
Referenced by getTransform(), and EcalBarrelGeometry::localCorners().
{ std::vector<HepGeom::Point3D<double> > lc ( localCorners( pv, ref ) ) ; HepGeom::Point3D<double> tmp ; tmp = lc[0] ; lc[0] = lc[3] ; lc[3] = tmp ; tmp = lc[1] ; lc[1] = lc[2] ; lc[2] = tmp ; tmp = lc[4] ; lc[4] = lc[7] ; lc[7] = tmp ; tmp = lc[5] ; lc[5] = lc[6] ; lc[6] = tmp ; ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ; return lc ; }
GlobalVector TruncatedPyramid::makeAxis | ( | ) | [inline, private] |
Definition at line 92 of file TruncatedPyramid.h.
References backCtr(), CaloCellGeometry::getPosition(), and Vector3DBase< T, FrameTag >::unit().
{ return GlobalVector( backCtr() - CaloCellGeometry::getPosition() ).unit() ; }
virtual std::vector<HepGeom::Point3D<double> > TruncatedPyramid::vocalCorners | ( | const double * | pv, |
HepGeom::Point3D< double > & | ref | ||
) | const [inline, virtual] |
Implements CaloCellGeometry.
Definition at line 75 of file TruncatedPyramid.h.
References localCorners().
{ return localCorners( pv, ref ) ; }
GlobalVector TruncatedPyramid::m_axis [private] |
Definition at line 108 of file TruncatedPyramid.h.
Referenced by axis(), getPhiAxis(), getPosition(), and getThetaAxis().
HepGeom::Point3D<double>* TruncatedPyramid::m_corOne [mutable, private] |
Definition at line 110 of file TruncatedPyramid.h.
Referenced by getCorners(), getTransform(), and ~TruncatedPyramid().