CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes

CaloCellGeometry Class Reference

#include <CaloCellGeometry.h>

Inheritance diagram for CaloCellGeometry:
IdealCastorTrapezoid IdealObliquePrism IdealZDCTrapezoid IdealZPrism PreshowerStrip TruncatedPyramid

List of all members.

Public Types

typedef float CCGFloat
typedef EZMgrFL< GlobalPointCornersMgr
enum  CornersSize { k_cornerSize = 8 }
typedef EZArrayFL< GlobalPointCornersVec
typedef EZMgrFL< CCGFloatParMgr
typedef EZArrayFL< CCGFloatParVec
typedef std::vector< ParVecParVecVec
typedef HepGeom::Point3D
< CCGFloat
Pt3D
typedef std::vector< Pt3DPt3DVec
typedef HepGeom::Transform3D Tr3D

Public Member Functions

bool emptyCorners () const
virtual const CornersVecgetCorners () const =0
const GlobalPointgetPosition () const
virtual void getTransform (Tr3D &tr, Pt3DVec *lptr) const
bool inside (const GlobalPoint &point) const
const CCGFloatparam () const
virtual void vocalCorners (Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref) const =0
virtual ~CaloCellGeometry ()

Static Public Member Functions

static const CCGFloatcheckParmPtr (const std::vector< CCGFloat > &vd, ParVecVec &pvv)
static const CCGFloatgetParmPtr (const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)

Static Public Attributes

static const CCGFloat k_ScaleFromDDDtoGeant

Protected Member Functions

 CaloCellGeometry (CornersVec::const_reference gp, const CornersMgr *mgr, const CCGFloat *par)
 CaloCellGeometry (const CornersVec &cv, const CCGFloat *par)
 CaloCellGeometry (const CaloCellGeometry &cell)
 CaloCellGeometry ()
CaloCellGeometryoperator= (const CaloCellGeometry &cell)
CornersVecsetCorners () const

Private Attributes

CornersVec m_corners
const CCGFloatm_parms
GlobalPoint m_refPoint

Detailed Description

Abstract base class for an individual cell's geometry.

Date:
2011/05/29 18:06:58
Revision:
1.19
Author:
J. Mans, P. Meridiani

Definition at line 21 of file CaloCellGeometry.h.


Member Typedef Documentation

Definition at line 31 of file CaloCellGeometry.h.

Definition at line 30 of file CaloCellGeometry.h.

Definition at line 35 of file CaloCellGeometry.h.

Definition at line 33 of file CaloCellGeometry.h.

typedef std::vector<ParVec> CaloCellGeometry::ParVecVec

Definition at line 34 of file CaloCellGeometry.h.

typedef std::vector<Pt3D> CaloCellGeometry::Pt3DVec
typedef HepGeom::Transform3D CaloCellGeometry::Tr3D

Reimplemented in PreshowerStrip, TruncatedPyramid, IdealCastorTrapezoid, and IdealZDCTrapezoid.

Definition at line 26 of file CaloCellGeometry.h.


Member Enumeration Documentation

Enumerator:
k_cornerSize 

Definition at line 37 of file CaloCellGeometry.h.

{ k_cornerSize = 8 };

Constructor & Destructor Documentation

CaloCellGeometry::~CaloCellGeometry ( ) [virtual]

Definition at line 43 of file CaloCellGeometry.cc.

{
}
CaloCellGeometry::CaloCellGeometry ( CornersVec::const_reference  gp,
const CornersMgr mgr,
const CCGFloat par 
) [protected]

Definition at line 65 of file CaloCellGeometry.cc.

                                                                      :
   m_refPoint ( gp  ),
   m_corners  ( mgr ),
   m_parms    ( par ) 
{
}
CaloCellGeometry::CaloCellGeometry ( const CornersVec cv,
const CCGFloat par 
) [protected]

Definition at line 74 of file CaloCellGeometry.cc.

                                                            : 
   m_refPoint ( 0.25*( cv[0].x() + cv[1].x() + cv[2].x() + cv[3].x() ),
                0.25*( cv[0].y() + cv[1].y() + cv[2].y() + cv[3].y() ),
                0.25*( cv[0].z() + cv[1].z() + cv[2].z() + cv[3].z() )  ), 
   m_corners  ( cv ),
   m_parms    ( par ) 
{
}
CaloCellGeometry::CaloCellGeometry ( ) [protected]

Definition at line 19 of file CaloCellGeometry.cc.

                                   :
   m_refPoint ( 0., 0., 0. ),
   m_corners  (  ) ,
   m_parms    ( (CCGFloat*) 0 ) 
{
}
CaloCellGeometry::CaloCellGeometry ( const CaloCellGeometry cell) [protected]

Definition at line 26 of file CaloCellGeometry.cc.

{
   *this = cell ;
}

Member Function Documentation

const float * CaloCellGeometry::checkParmPtr ( const std::vector< CCGFloat > &  vd,
CaloCellGeometry::ParVecVec pvv 
) [static]

Definition at line 165 of file CaloCellGeometry.cc.

References EZArrayFL< T >::begin(), j, EZArrayFL< T >::size(), and v.

Referenced by getParmPtr().

{
   const float* pP ( 0 ) ;

   for( unsigned int ii ( 0 ) ; ii != pvv.size() ; ++ii )
   {
      const ParVec& v ( pvv[ii] ) ;
      assert( v.size() == vv.size() ) ;

      bool same ( true ) ;
      for( unsigned int j ( 0 ) ; j != vv.size() ; ++j )
      {
         same = same && ( fabs( vv[j] - v[j] )<1.e-6 ) ;
         if( !same ) break ;
      }
      if( same )
      {
         pP = &(*v.begin()) ;
         break ;
      }
   }
   return pP ;
}
bool CaloCellGeometry::emptyCorners ( ) const

Definition at line 54 of file CaloCellGeometry.cc.

References EZArrayFL< T >::empty(), and m_corners.

Referenced by operator<<().

{
   return m_corners.empty() ;
}
const CaloCellGeometry::CornersVec & CaloCellGeometry::getCorners ( ) const [pure virtual]
const float * CaloCellGeometry::getParmPtr ( const std::vector< CCGFloat > &  vd,
CaloCellGeometry::ParMgr mgr,
CaloCellGeometry::ParVecVec pvv 
) [static]

Definition at line 192 of file CaloCellGeometry.cc.

References prof2calltree::back, checkParmPtr(), and i.

Referenced by CaloTowerHardcodeGeometryLoader::makeCell(), HcalHardcodeGeometryLoader::makeCell(), CastorHardcodeGeometryLoader::makeCell(), HcalDDDGeometryLoader::makeCell(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), and CaloGeometryDBEP< T, U >::produceAligned().

{
   const float* pP ( checkParmPtr( vv, pvv ) ) ;

   if( 0 == pP )
   {
      pvv.push_back( ParVec( mgr ) ) ;
      ParVec& back ( pvv.back() ) ;
      for( unsigned int i ( 0 ) ; i != vv.size() ; ++i )
      {
         back[i] = vv[i] ;
      }
      pP = &(*back.begin()) ;
   }
   return pP ;
}
const GlobalPoint & CaloCellGeometry::getPosition ( ) const

Definition at line 48 of file CaloCellGeometry.cc.

References m_refPoint.

Referenced by EcalTPGParamBuilder::analyze(), HcalRecHitsValidation::analyze(), CaloTowersCreationAlgo::assignHit(), EcalEndcapGeometry::avgAbsZFrontFaceCenter(), EcalBarrelGeometry::avgRadiusXYFrontFaceCenter(), CaloRecoTauAlgorithm::buildCaloTau(), CaloGeometryHelper::buildCrystalArray(), EcalHaloAlgo::Calculate(), SuperClusterShapeAlgo::Calculate_Covariances(), ClusterShapeAlgo::Calculate_Covariances(), ClusterShapeAlgo::Calculate_EnergyDepTopology(), compEcalEnergySum(), compHcalEnergySum(), CaloTowersCreationAlgo::convert(), EcalClusterTools::covariances(), PFRecHitProducerECAL::createEcalRecHit(), PFRecHitProducerHCAL::createHcalRecHit(), DistanceToCell::DistanceToCell(), EcalHitMaker::EcalHitMaker(), InvRingCalib::EERingDef(), CaloTowersCreationAlgo::emCrystalShwrPos(), GlobalHitsProducer::fillECal(), GlobalHitsProdHist::fillECal(), GlobalHitsAnalyzer::fillECal(), ECALRecHitAnalyzer::FillGeometry(), HCALRecHitAnalyzer::FillGeometry(), GlobalRecHitsAnalyzer::fillHCal(), GlobalHitsAnalyzer::fillHCal(), GlobalHitsProducer::fillHCal(), GlobalHitsProdHist::fillHCal(), GlobalRecHitsProducer::fillHCal(), PFRecHitProducerECAL::findEcalRecHitGeometry(), TCTauAlgorithm::getCellMomentum(), CaloSubdetectorGeometry::getCells(), EcalEndcapGeometry::getCells(), HcalGeometry::getCells(), EcalBarrelGeometry::getCells(), HcalGeometry::getClosestCell(), CaloSubdetectorGeometry::getClosestCell(), CaloGeometryHelper::getClosestCell(), EcalBarrelGeometry::getClosestCell(), EcalEndcapGeometry::getClosestCell(), EcalPreshowerGeometry::getClosestCellInPlane(), IdealCastorTrapezoid::getCorners(), IdealZDCTrapezoid::getCorners(), IdealZPrism::getCorners(), IdealObliquePrism::getCorners(), PreshowerStrip::getCorners(), L2TauModularIsolationProducer::getECALHits(), L2TauNarrowConeIsolationProducer::getECALHits(), L2TauIsolationProducer::getECALHits(), EcalClusterTools::getEnergyDepTopology(), CaloGeometry::getPosition(), CaloDetIdAssociator::getPosition(), HCaloDetIdAssociator::getPosition(), TruncatedPyramid::getPosition(), CaloSubdetectorGeometry::getSummary(), TruncatedPyramid::getTransform(), getTransform(), CaloTowersCreationAlgo::hadSegmentShwrPos(), CaloTowersCreationAlgo::hadShwPosFromCells(), EcalEndcapRecHitsMaker::init(), EcalBarrelRecHitsMaker::init(), CaloGeometryHelper::initialize(), EcalRingCalibrationTools::initializeFromGeometry(), EcalEndcapGeometry::initializeParms(), EcalPreshowerGeometry::initializeParms(), TruncatedPyramid::makeAxis(), CosmicClusterAlgo::makeClusters(), HybridClusterAlgo::makeClusters(), Multi5x5ClusterAlgo::makeClusters(), IslandClusterAlgo::makeClusters(), PreshowerClusterAlgo::makeOneCluster(), EcalClusterTools::meanClusterPosition(), DistanceToCell::operator()(), operator<<(), PlotEcalRecHits::printEcalRecHit(), CastorEventDisplay::processEvent(), JetCrystalsAssociator::produce(), EcalRecHitWorkerRecover::run(), EcalGeomPhiSymHelper::setup(), EcalHitResponse::timeOfFlight(), CaloHitResponse::timeOfFlight(), and CaloHitRespoNew::timeOfFlight().

{
   return m_refPoint ; 
}
void CaloCellGeometry::getTransform ( Tr3D tr,
Pt3DVec lptr 
) const [virtual]

Reimplemented in TruncatedPyramid.

Definition at line 116 of file CaloCellGeometry.cc.

References angle(), getCorners(), getPosition(), i, mag(), AlCaHLTBitMon_ParallelJobs::p, param(), csvLumiCalc::unit, vocalCorners(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by CaloSubdetectorGeometry::getSummary().

{
   const GlobalPoint& p ( CaloCellGeometry::getPosition() ) ;
   const Pt3D gFront ( p.x(), p.y(), p.z() ) ;
   const DPt3D dgFront ( p.x(), p.y(), p.z() ) ;

   Pt3D lFront ;
   assert( 0 != param() ) ;
   Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
   vocalCorners( lc, param(), lFront ) ;

   DPt3D dlFront ( lFront.x(), lFront.y(), lFront.z() ) ;

   const Pt3D lBack ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7]) ) ;
   const DPt3D dlBack ( lBack.x(), lBack.y(), lBack.z() ) ;

   const Pt3D dlOne ( lc[0].x(), lc[0].y(), lc[0].z() ) ;

   const CornersVec& cor ( getCorners() ) ;
   DPt3DVec dkor ( 8, DPt3D(0,0,0) ) ;
   for( unsigned int i ( 0 ) ; i != 8 ; ++i )
   {
      dkor[i] = DPt3D ( cor[i].x(), cor[i].y(), cor[i].z() ) ;
   }

   DPt3D  dgBack ( 0.25*( dkor[4]+dkor[5]+dkor[6]+dkor[7] ) ) ;

   const DVec3D dgAxis ( (dgBack-dgFront).unit() ) ;

   dgBack = ( dgFront + (dlBack-dlFront).mag()*dgAxis ) ;
   const DPt3D  dgOneT ( dgFront + ( dlOne - dlFront ).mag()*( dkor[0] - dgFront ).unit() ) ;

   const double dlangle ( ( dlBack - dlFront).angle( dlOne - dlFront ) ) ;
   const double dgangle ( ( dgBack - dgFront).angle( dgOneT- dgFront ) ) ;
   const double ddangle ( dlangle - dgangle ) ;

   const DPlane3D dgPl ( dgFront, dgOneT, dgBack ) ;
   const DPt3D    dp2  ( dgFront + dgPl.normal().unit() ) ;

   const DPt3D  dgOne ( dgFront + HepGeom::Rotate3D( -ddangle, dgFront, dp2 )*
                      DVec3D ( dgOneT - dgFront ) ) ;

   tr = Tr3D( dlFront , dlBack , dlOne ,
              dgFront , dgBack , dgOne    ) ;

   if( 0 != lptr ) (*lptr) = lc ;
}
bool CaloCellGeometry::inside ( const GlobalPoint point) const

Definition at line 213 of file CaloCellGeometry.cc.

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

Referenced by CastorGeometry::getClosestCell(), CaloDetIdAssociator::insideElement(), and HCaloDetIdAssociator::insideElement().

{
   bool ans ( false ) ;
   const Pt3D  p ( point.x(), point.y(), point.z() ) ;
   const CornersVec& cog ( getCorners() ) ;
   Pt3D  co[8] ;
   for( unsigned int i ( 0 ) ; i != 8 ; ++i )
   {
      co[i] = Pt3D ( cog[i].x(), cog[i].y(), cog[i].z() ) ;
   }

   const Plane3D  AA ( co[0], co[1], co[2] ) ; // z<0
   const Plane3D  BB ( co[6], co[5], co[4] ) ; // z>0

   if( AA.distance(p)*BB.distance(p) >= 0 )
   {
     const Plane3D  CC ( co[0], co[4], co[5] ) ; // x<0
     const Plane3D  DD ( co[2], co[6], co[7] ) ; // x>0
     if( CC.distance(p)*DD.distance(p) >= 0 )
     {
       const Plane3D  EE ( co[3], co[7], co[4] ) ; // y<0
       const Plane3D  FF ( co[1], co[5], co[6] ) ; // y>0
       if( EE.distance(p)*FF.distance(p) >= 0 )
       {
           ans = true ;
       }
      }
   }
   return ans ;
}
CaloCellGeometry & CaloCellGeometry::operator= ( const CaloCellGeometry cell) [protected]

Definition at line 32 of file CaloCellGeometry.cc.

References m_corners, m_parms, and m_refPoint.

{
   if( this != &cell )
   {
      m_refPoint = cell.m_refPoint ;
      m_corners  = cell.m_corners  ;
      m_parms    = cell.m_parms    ;
   }
   return *this ;
}
const CCGFloat * CaloCellGeometry::param ( ) const
CaloCellGeometry::CornersVec & CaloCellGeometry::setCorners ( ) const [protected]
virtual void CaloCellGeometry::vocalCorners ( Pt3DVec vec,
const CCGFloat pv,
Pt3D ref 
) const [pure virtual]

Member Data Documentation

Definition at line 91 of file CaloCellGeometry.h.

Referenced by emptyCorners(), getCorners(), operator=(), and setCorners().

Definition at line 93 of file CaloCellGeometry.h.

Referenced by operator=(), and param().

Definition at line 89 of file CaloCellGeometry.h.

Referenced by getPosition(), and operator=().