CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes
CaloCellGeometry Class Referenceabstract

#include <CaloCellGeometry.h>

Inheritance diagram for CaloCellGeometry:
calogeom::IdealCastorTrapezoid calogeom::IdealObliquePrism calogeom::IdealZDCTrapezoid calogeom::IdealZPrism PreshowerStrip TruncatedPyramid

Public Types

typedef EZMgrFL< GlobalPointCornersMgr
 
enum  CornersSize { k_cornerSize = 8 }
 
typedef EZArrayFL< GlobalPointCornersVec
 
typedef EZMgrFL< double > ParMgr
 
typedef EZArrayFL< double > ParVec
 
typedef std::vector< ParVecParVecVec
 

Public Member Functions

bool emptyCorners () const
 
virtual const CornersVecgetCorners () const =0
 
const GlobalPointgetPosition () const
 
virtual HepGeom::Transform3D getTransform (std::vector< HepGeom::Point3D< double > > *lptr) const
 
bool inside (const GlobalPoint &point) const
 
const double * param () const
 
virtual std::vector
< HepGeom::Point3D< double > > 
vocalCorners (const double *pv, HepGeom::Point3D< double > &ref) const =0
 
virtual ~CaloCellGeometry ()
 

Static Public Member Functions

static const double * checkParmPtr (const std::vector< double > &vd, ParVecVec &pvv)
 
static const double * getParmPtr (const std::vector< double > &vd, ParMgr *mgr, ParVecVec &pvv)
 

Static Public Attributes

static const float k_ScaleFromDDDtoGeant
 

Protected Member Functions

 CaloCellGeometry (CornersVec::const_reference gp, const CornersMgr *mgr, const double *par)
 
 CaloCellGeometry (const CornersVec &cv, const double *par)
 
CornersVecsetCorners () const
 

Private Attributes

CornersVec m_corners
 
const double * m_parms
 
const GlobalPoint m_refPoint
 

Detailed Description

Abstract base class for an individual cell's geometry.

Date:
2009/05/25 09:06:11
Revision:
1.17
Author
J. Mans, P. Meridiani

Definition at line 25 of file CaloCellGeometry.h.

Member Typedef Documentation

Definition at line 30 of file CaloCellGeometry.h.

Definition at line 29 of file CaloCellGeometry.h.

typedef EZMgrFL< double > CaloCellGeometry::ParMgr

Definition at line 34 of file CaloCellGeometry.h.

Definition at line 32 of file CaloCellGeometry.h.

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

Definition at line 33 of file CaloCellGeometry.h.

Member Enumeration Documentation

Enumerator
k_cornerSize 

Definition at line 36 of file CaloCellGeometry.h.

Constructor & Destructor Documentation

virtual CaloCellGeometry::~CaloCellGeometry ( )
inlinevirtual

Definition at line 40 of file CaloCellGeometry.h.

40 {}
CaloCellGeometry::CaloCellGeometry ( CornersVec::const_reference  gp,
const CornersMgr mgr,
const double *  par 
)
inlineprotected

Definition at line 72 of file CaloCellGeometry.h.

74  :
75  m_refPoint ( gp ),
76  m_corners ( mgr ),
77  m_parms ( par ) {}
CornersVec m_corners
const double * m_parms
const GlobalPoint m_refPoint
const double par[8 *NPar][4]
CaloCellGeometry::CaloCellGeometry ( const CornersVec cv,
const double *  par 
)
inlineprotected

Definition at line 79 of file CaloCellGeometry.h.

80  :
81  m_refPoint ( GlobalPoint( 0.25*( cv[0].x() + cv[1].x() + cv[2].x() + cv[3].x() ),
82  0.25*( cv[0].y() + cv[1].y() + cv[2].y() + cv[3].y() ),
83  0.25*( cv[0].z() + cv[1].z() + cv[2].z() + cv[3].z() ) ) ),
84  m_corners ( cv ),
85  m_parms ( par ) {}
CornersVec m_corners
const double * m_parms
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double double double z
const GlobalPoint m_refPoint
Definition: DDAxes.h:10
const double par[8 *NPar][4]

Member Function Documentation

const double * CaloCellGeometry::checkParmPtr ( const std::vector< double > &  vd,
CaloCellGeometry::ParVecVec pvv 
)
static

Definition at line 78 of file CaloCellGeometry.cc.

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

Referenced by getParmPtr().

81 {
82  const double* pP ( 0 ) ;
83 
84  for( unsigned int ii ( 0 ) ; ii != pvv.size() ; ++ii )
85  {
86  const ParVec& v ( pvv[ii] ) ;
87  assert( v.size() == vv.size() ) ;
88 
89  bool same ( true ) ;
90  for( unsigned int j ( 0 ) ; j != vv.size() ; ++j )
91  {
92  same = same && ( fabs( vv[j] - v[j] )<1.e-6 ) ;
93  if( !same ) break ;
94  }
95  if( same )
96  {
97  pP = &(*v.begin()) ;
98  break ;
99  }
100  }
101  return pP ;
102 }
EZArrayFL< double > ParVec
int j
Definition: DBlmapReader.cc:9
mathSSE::Vec4< T > v
bool CaloCellGeometry::emptyCorners ( ) const
inline

Definition at line 51 of file CaloCellGeometry.h.

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

Referenced by operator<<().

51 { return m_corners.empty() ; }
CornersVec m_corners
bool empty() const
Definition: EZArrayFL.h:76
const CaloCellGeometry::CornersVec & CaloCellGeometry::getCorners ( ) const
pure virtual
const double * CaloCellGeometry::getParmPtr ( const std::vector< double > &  vd,
CaloCellGeometry::ParMgr mgr,
CaloCellGeometry::ParVecVec pvv 
)
static

Definition at line 105 of file CaloCellGeometry.cc.

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

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

109 {
110  const double* pP ( checkParmPtr( vv, pvv ) ) ;
111 
112  if( 0 == pP )
113  {
114  pvv.push_back( ParVec( mgr ) ) ;
115  ParVec& back ( pvv.back() ) ;
116  for( unsigned int i ( 0 ) ; i != vv.size() ; ++i )
117  {
118  back[i] = vv[i] ;
119  }
120  pP = &(*back.begin()) ;
121  }
122  return pP ;
123 }
int i
Definition: DBlmapReader.cc:9
EZArrayFL< double > ParVec
static const double * checkParmPtr(const std::vector< double > &vd, ParVecVec &pvv)
const GlobalPoint& CaloCellGeometry::getPosition ( ) const
inline

Definition at line 46 of file CaloCellGeometry.h.

References m_refPoint.

Referenced by HcalRecHitsValidation::analyze(), EcalTPGParamBuilder::analyze(), CaloTowersCreationAlgo::assignHit(), 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(), PFRecHitProducerPS::createRecHits(), DistanceToCell::DistanceToCell(), EcalHitMaker::EcalHitMaker(), InvRingCalib::EERingDef(), CaloTowersCreationAlgo::emCrystalShwrPos(), GlobalHitsAnalyzer::fillECal(), GlobalHitsProdHist::fillECal(), GlobalHitsProducer::fillECal(), HCALRecHitAnalyzer::FillGeometry(), ECALRecHitAnalyzer::FillGeometry(), GlobalHitsAnalyzer::fillHCal(), GlobalHitsProdHist::fillHCal(), GlobalHitsProducer::fillHCal(), GlobalRecHitsAnalyzer::fillHCal(), GlobalRecHitsProducer::fillHCal(), PFRecHitProducerECAL::findEcalRecHitGeometry(), TCTauAlgorithm::getCellMomentum(), HcalGeometry::getCells(), EcalEndcapGeometry::getCells(), EcalBarrelGeometry::getCells(), CaloGeometryHelper::getClosestCell(), HcalGeometry::getClosestCell(), EcalEndcapGeometry::getClosestCell(), EcalBarrelGeometry::getClosestCell(), calogeom::IdealZDCTrapezoid::getCorners(), PreshowerStrip::getCorners(), calogeom::IdealZPrism::getCorners(), calogeom::IdealObliquePrism::getCorners(), calogeom::IdealCastorTrapezoid::getCorners(), L2TauModularIsolationProducer::getECALHits(), L2TauIsolationProducer::getECALHits(), L2TauNarrowConeIsolationProducer::getECALHits(), EcalClusterTools::getEnergyDepTopology(), CaloGeometry::getPosition(), HCaloDetIdAssociator::getPosition(), CaloDetIdAssociator::getPosition(), TruncatedPyramid::getPosition(), getTransform(), TruncatedPyramid::getTransform(), CaloTowersCreationAlgo::hadSegmentShwrPos(), CaloTowersCreationAlgo::hadShwPosFromCells(), EcalBarrelRecHitsMaker::init(), EcalEndcapRecHitsMaker::init(), CaloGeometryHelper::initialize(), EcalRingCalibrationTools::initializeFromGeometry(), TruncatedPyramid::makeAxis(), IslandClusterAlgo::makeClusters(), CosmicClusterAlgo::makeClusters(), Multi5x5ClusterAlgo::makeClusters(), HybridClusterAlgo::makeClusters(), PreshowerClusterAlgo::makeOneCluster(), EcalClusterTools::meanClusterPosition(), DistanceToCell::operator()(), operator<<(), calogeom::operator<<(), PlotEcalRecHits::printEcalRecHit(), CastorEventDisplay::processEvent(), JetCrystalsAssociator::produce(), EcalRecHitWorkerRecover::run(), EcalGeomPhiSymHelper::setup(), CaloHitRespoNew::timeOfFlight(), and CaloHitResponse::timeOfFlight().

46 { return m_refPoint ; }
const GlobalPoint m_refPoint
HepGeom::Transform3D CaloCellGeometry::getTransform ( std::vector< HepGeom::Point3D< double > > *  lptr) const
virtual

Reimplemented in TruncatedPyramid, and PreshowerStrip.

Definition at line 32 of file CaloCellGeometry.cc.

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

33 {
35  const HepGeom::Point3D<double> gFront ( p.x(), p.y(), p.z() ) ;
36 
37  HepGeom::Point3D<double> lFront ;
38  assert( 0 != param() ) ;
39  std::vector<HepGeom::Point3D<double> > lc ( vocalCorners( param(), lFront ) ) ;
40 
41  HepGeom::Point3D<double> lBack ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7]) ) ;
42 
43  const HepGeom::Point3D<double> lOne ( lc[0] ) ;
44 
45  const CornersVec& cor ( getCorners() ) ;
46  std::vector<HepGeom::Point3D<double> > kor ( 8, HepGeom::Point3D<double> (0,0,0) ) ;
47  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
48  {
49  kor[i] = HepGeom::Point3D<double> ( cor[i].x(), cor[i].y(), cor[i].z() ) ;
50  }
51 
52  HepGeom::Point3D<double> gBack ( 0.25*( kor[4]+kor[5]+kor[6]+kor[7] ) ) ;
53 
54  const HepGeom::Vector3D<double> gAxis ( (gBack-gFront).unit() ) ;
55 
56  gBack = ( gFront + (lBack-lFront).mag()*gAxis ) ;
57  const HepGeom::Point3D<double> gOneT ( gFront + ( lOne - lFront ).mag()*( kor[0] - gFront ).unit() ) ;
58 
59  const double langle ( ( lBack - lFront).angle( lOne - lFront ) ) ;
60  const double gangle ( ( gBack - gFront).angle( gOneT- gFront ) ) ;
61  const double dangle ( langle - gangle ) ;
62 
63  const HepGeom::Plane3D<double> gPl ( gFront, gOneT, gBack ) ;
64  const HepGeom::Point3D<double> p2 ( gFront + gPl.normal().unit() ) ;
65 
66  const HepGeom::Point3D<double> gOne ( gFront + HepGeom::Rotate3D( -dangle, gFront, p2 )*
67  HepGeom::Vector3D<double> ( gOneT - gFront ) ) ;
68 
69  const HepGeom::Transform3D tr ( lFront , lBack , lOne ,
70  gFront , gBack , gOne ) ;
71 
72  if( 0 != lptr ) (*lptr) = lc ;
73 
74  return tr ;
75 }
EZArrayFL< GlobalPoint > CornersVec
int i
Definition: DBlmapReader.cc:9
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
virtual std::vector< HepGeom::Point3D< double > > vocalCorners(const double *pv, HepGeom::Point3D< double > &ref) const =0
const double * param() const
string unit
Definition: csvLumiCalc.py:46
double p2[4]
Definition: TauolaWrapper.h:90
const GlobalPoint & getPosition() const
virtual const CornersVec & getCorners() const =0
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
bool CaloCellGeometry::inside ( const GlobalPoint point) const

Definition at line 126 of file CaloCellGeometry.cc.

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

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

127 {
128  bool ans ( false ) ;
129  const HepGeom::Point3D<double> p ( point.x(), point.y(), point.z() ) ;
130  const CornersVec& cog ( getCorners() ) ;
131  HepGeom::Point3D<double> co[8] ;
132  for( unsigned int i ( 0 ) ; i != 8 ; ++i )
133  {
134  co[i] = HepGeom::Point3D<double> ( cog[i].x(), cog[i].y(), cog[i].z() ) ;
135  }
136 
137  const HepGeom::Plane3D<double> AA ( co[0], co[1], co[2] ) ; // z<0
138  const HepGeom::Plane3D<double> BB ( co[6], co[5], co[4] ) ; // z>0
139 
140  if( AA.distance(p)*BB.distance(p) >= 0 )
141  {
142  const HepGeom::Plane3D<double> CC ( co[0], co[4], co[5] ) ; // x<0
143  const HepGeom::Plane3D<double> DD ( co[2], co[6], co[7] ) ; // x>0
144  if( CC.distance(p)*DD.distance(p) >= 0 )
145  {
146  const HepGeom::Plane3D<double> EE ( co[3], co[7], co[4] ) ; // y<0
147  const HepGeom::Plane3D<double> FF ( co[1], co[5], co[6] ) ; // y>0
148  if( EE.distance(p)*FF.distance(p) >= 0 )
149  {
150  ans = true ;
151  }
152  }
153  }
154  return ans ;
155 }
EZArrayFL< GlobalPoint > CornersVec
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV3DBase.h:57
T z() const
Definition: PV3DBase.h:58
T x() const
Definition: PV3DBase.h:56
virtual const CornersVec & getCorners() const =0
const double* CaloCellGeometry::param ( ) const
inline
CornersVec& CaloCellGeometry::setCorners ( ) const
inlineprotected
virtual std::vector<HepGeom::Point3D<double> > CaloCellGeometry::vocalCorners ( const double *  pv,
HepGeom::Point3D< double > &  ref 
) const
pure virtual

Member Data Documentation

const float CaloCellGeometry::k_ScaleFromDDDtoGeant
static
CornersVec CaloCellGeometry::m_corners
mutableprivate

Definition at line 93 of file CaloCellGeometry.h.

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

const double* CaloCellGeometry::m_parms
private

Definition at line 95 of file CaloCellGeometry.h.

Referenced by param().

const GlobalPoint CaloCellGeometry::m_refPoint
private

Definition at line 91 of file CaloCellGeometry.h.

Referenced by getPosition().