CMS 3D CMS Logo

TruncatedPyramid Class Reference

A base class to handle the particular shape of Ecal Xtals. More...

#include <Geometry/CaloGeometry/interface/TruncatedPyramid.h>

Inheritance diagram for TruncatedPyramid:

CaloCellGeometry

List of all members.

Public Types

typedef std::vector< HepPlane3D > BoundaryVec

Public Member Functions

const GlobalVectoraxis () const
virtual const CornersVecgetCorners () const
float getPhiAxis () const
const GlobalPoint getPosition (float depth) const
 Position corresponding to the center of the front face at a certain depth (default is zero) along the crystal axis.
float getThetaAxis () const
virtual bool inside (const GlobalPoint &point) const
 TruncatedPyramid (const CornersVec &corn)
virtual ~TruncatedPyramid ()

Static Public Member Functions

static void createCorners (const std::vector< double > &pv, const HepTransform3D &tr, CornersVec &co)

Private Member Functions

GlobalVector axis ()
 print out the element, with an optional string prefix, maybe OVAL identifier
const GlobalPoint backCtr () const

Private Attributes

GlobalVector m_axis


Detailed Description

A base class to handle the particular shape of Ecal Xtals.

Taken from ORCA Calorimetry Code

Definition at line 20 of file TruncatedPyramid.h.


Member Typedef Documentation

typedef std::vector< HepPlane3D > TruncatedPyramid::BoundaryVec

Definition at line 24 of file TruncatedPyramid.h.


Constructor & Destructor Documentation

TruncatedPyramid::TruncatedPyramid ( const CornersVec corn  )  [inline]

Definition at line 26 of file TruncatedPyramid.h.

00026                                                   :
00027          CaloCellGeometry ( corn ) , 
00028          m_axis           ( axis() ) {} 
/*,

virtual TruncatedPyramid::~TruncatedPyramid (  )  [inline, virtual]

Definition at line 32 of file TruncatedPyramid.h.

00032 {}// delete m_bou ; }


Member Function Documentation

GlobalVector TruncatedPyramid::axis (  )  [inline, private]

print out the element, with an optional string prefix, maybe OVAL identifier

Definition at line 64 of file TruncatedPyramid.h.

References backCtr(), CaloCellGeometry::getPosition(), and Vector3DBase< T, FrameTag >::unit().

00065       { 
00066          return GlobalVector( backCtr() -
00067                               CaloCellGeometry::getPosition() ).unit() ;
00068       }

const GlobalVector& TruncatedPyramid::axis (  )  const [inline]

Definition at line 52 of file TruncatedPyramid.h.

References m_axis.

00052 { return m_axis ; }

const GlobalPoint TruncatedPyramid::backCtr (  )  const [inline, private]

Definition at line 70 of file TruncatedPyramid.h.

References getCorners(), x, y, and z.

Referenced by axis().

00071       {
00072          return GlobalPoint( 0.25*( getCorners()[4].x() + getCorners()[5].x() +
00073                                     getCorners()[6].x() + getCorners()[7].x() ),
00074                              0.25*( getCorners()[4].y() + getCorners()[5].y() +
00075                                     getCorners()[6].y() + getCorners()[7].y() ),
00076                              0.25*( getCorners()[4].z() + getCorners()[5].z() +
00077                                     getCorners()[6].z() + getCorners()[7].z() ) ) ;
00078       }

void TruncatedPyramid::createCorners ( const std::vector< double > &  pv,
const HepTransform3D &  tr,
CaloCellGeometry::CornersVec co 
) [static]

Definition at line 12 of file TruncatedPyramid.cc.

References a1, a2, b1, b2, edmNew::copy(), funct::cos(), dot(), h1, h2, i, CaloCellGeometry::k_ScaleFromDDDtoGeant, off, p, funct::sin(), funct::tan(), x, y, and z.

00015 {
00016    assert( 11 == pv.size() ) ;
00017 
00018    // to get the ordering right for fast sim, we have to use their convention
00019    // which were based on the old static geometry. Some gymnastics required here.
00020 
00021    static const float kf ( CaloCellGeometry::k_ScaleFromDDDtoGeant ) ;
00022 
00023    const double dz ( kf*pv[0] ) ;
00024    const double th (    pv[1] ) ;
00025    const double ph (    pv[2] ) ;
00026    const double h1 ( kf*pv[3] ) ;
00027    const double b1 ( kf*pv[4] ) ;
00028    const double t1 ( kf*pv[5] ) ;
00029    const double a1 (    pv[6] ) ;
00030    const double h2 ( kf*pv[7] ) ;
00031    const double b2 ( kf*pv[8] ) ;
00032    const double t2 ( kf*pv[9] ) ;
00033    const double a2 (    pv[10]) ;
00034 
00035    std::vector<HepPoint3D> to ( 8, HepPoint3D(0,0,0) ) ;
00036    std::vector<HepPoint3D> ko ( 8, HepPoint3D(0,0,0) ) ;
00037   
00038    const double ta1 ( tan( a1 ) ) ; // lower plane
00039    const double ta2 ( tan( a2 ) ) ; // upper plane
00040 
00041    const double tth   ( tan( th )       ) ;
00042    const double tthcp ( tth * cos( ph ) ) ;
00043    const double tthsp ( tth * sin( ph ) ) ;
00044 
00045    const unsigned int off ( h1<h2 ? 0 :  4 ) ;
00046 
00047    to[0+off] = HepPoint3D( -dz*tthcp - h1*ta1 - b1, -dz*tthsp - h1 , -dz ); // (-,-,-)
00048    to[1+off] = HepPoint3D( -dz*tthcp + h1*ta1 - t1, -dz*tthsp + h1 , -dz ); // (-,+,-)
00049    to[2+off] = HepPoint3D( -dz*tthcp + h1*ta1 + t1, -dz*tthsp + h1 , -dz ); // (+,+,-)
00050    to[3+off] = HepPoint3D( -dz*tthcp - h1*ta1 + b1, -dz*tthsp - h1 , -dz ); // (+,-,-)
00051    to[4-off] = HepPoint3D(  dz*tthcp - h2*ta2 - b2,  dz*tthsp - h2 ,  dz ); // (-,-,+)
00052    to[5-off] = HepPoint3D(  dz*tthcp + h2*ta2 - t2,  dz*tthsp + h2 ,  dz ); // (-,+,+)
00053    to[6-off] = HepPoint3D(  dz*tthcp + h2*ta2 + t2,  dz*tthsp + h2 ,  dz ); // (+,+,+)
00054    to[7-off] = HepPoint3D(  dz*tthcp - h2*ta2 + b2,  dz*tthsp - h2 ,  dz ); // (+,-,+)
00055 
00056    for( unsigned int i ( 0 ) ; i != 8 ; ++i )
00057    {
00058       ko[i] = tr * to[i] ; // apply transformation
00059    }
00060 
00061    // if reflection, different things for barrel and endcap
00062    static const HepVector3D x ( 1, 0, 0 ) ;
00063    static const HepVector3D y ( 0, 1, 0 ) ;
00064    static const HepVector3D z ( 0, 0, 1 ) ;
00065    const bool refl ( ( ( tr*x ).cross( tr*y ) ).dot( tr*z ) < 0 ) ; // has reflection!
00066 
00067    if( refl || 
00068        h1>h2  )
00069    {
00070       if( 11.2 < dz ) //barrel
00071       {
00072          if( !refl )
00073          {
00074             to[0] = ko[3] ;
00075             to[1] = ko[2] ;
00076             to[2] = ko[1] ;
00077             to[3] = ko[0] ;
00078             to[4] = ko[7] ;
00079             to[5] = ko[6] ;
00080             to[6] = ko[5] ;      
00081             to[7] = ko[4] ;      
00082          }
00083          else
00084          {
00085             to[0] = ko[0] ;
00086             to[1] = ko[1] ;
00087             to[2] = ko[2] ;
00088             to[3] = ko[3] ;
00089             to[4] = ko[4] ;
00090             to[5] = ko[5] ;
00091             to[6] = ko[6] ;      
00092             to[7] = ko[7] ;      
00093          }
00094       }
00095       else //endcap
00096       {
00097          to[0] = ko[0] ;
00098          to[1] = ko[3] ;
00099          to[2] = ko[2] ;
00100          to[3] = ko[1] ;
00101          to[4] = ko[4] ;
00102          to[5] = ko[7] ;
00103          to[6] = ko[6] ;      
00104          to[7] = ko[5] ;      
00105       }
00106       copy( to.begin(), to.end(), ko.begin() ) ; // faster than ko = to ? maybe.
00107    }
00108    for( unsigned int i ( 0 ) ; i != 8 ; ++i )
00109    {
00110       const HepPoint3D& p ( ko[i] ) ;
00111       co[ i ] = GlobalPoint( p.x(), p.y(), p.z() ) ;
00112    }
00113 }

virtual const CornersVec& TruncatedPyramid::getCorners (  )  const [inline, virtual]

Implements CaloCellGeometry.

Definition at line 44 of file TruncatedPyramid.h.

References CaloCellGeometry::getCorners().

Referenced by backCtr(), inside(), and operator<<().

00044 { return CaloCellGeometry::getCorners() ; }

float TruncatedPyramid::getPhiAxis (  )  const [inline]

Definition at line 50 of file TruncatedPyramid.h.

References m_axis, and PV3DBase< T, PVType, FrameType >::phi().

Referenced by operator<<().

00050 { return m_axis.phi() ; } 

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 41 of file TruncatedPyramid.h.

References CaloCellGeometry::getPosition(), and m_axis.

Referenced by PFRecHitProducerECAL::createEcalRecHit(), and PFRecHitProducerECAL::findEcalRecHitGeometry().

00042       { return CaloCellGeometry::getPosition() + depth*m_axis ; }

float TruncatedPyramid::getThetaAxis (  )  const [inline]

Definition at line 47 of file TruncatedPyramid.h.

References m_axis, and PV3DBase< T, PVType, FrameType >::theta().

Referenced by operator<<().

00047 { return m_axis.theta() ; } 

bool TruncatedPyramid::inside ( const GlobalPoint point  )  const [virtual]

Implements CaloCellGeometry.

Definition at line 117 of file TruncatedPyramid.cc.

References getCorners(), i, p, true, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.

00118 {
00119    bool ans ( false ) ;
00120    const HepPoint3D p ( point.x(), point.y(), point.z() ) ;
00121    const CornersVec& cog ( getCorners() ) ;
00122    HepPoint3D co[8] ;
00123    for( unsigned int i ( 0 ) ; i != 8 ; ++i )
00124    {
00125       co[i] = HepPoint3D( cog[i].x(), cog[i].y(), cog[i].z() ) ;
00126    }
00127 
00128    const HepPlane3D AA ( co[0], co[1], co[2] ) ; // z<0
00129    const HepPlane3D BB ( co[6], co[5], co[4] ) ; // z>0
00130 
00131    if( AA.distance(p)*BB.distance(p) >= 0 )
00132    {
00133      const HepPlane3D CC ( co[0], co[4], co[5] ) ; // x<0
00134      const HepPlane3D DD ( co[2], co[6], co[7] ) ; // x>0
00135      if( CC.distance(p)*DD.distance(p) >= 0 )
00136      {
00137        const HepPlane3D EE ( co[3], co[7], co[4] ) ; // y<0
00138        const HepPlane3D FF ( co[1], co[5], co[6] ) ; // y>0
00139        if( EE.distance(p)*FF.distance(p) >= 0 )
00140        {
00141            ans = true ;
00142        }
00143       }
00144    }
00145    return ans ;
00146 }


Member Data Documentation

GlobalVector TruncatedPyramid::m_axis [private]

Definition at line 80 of file TruncatedPyramid.h.

Referenced by axis(), getPhiAxis(), getPosition(), and getThetaAxis().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:37 2009 for CMSSW by  doxygen 1.5.4