CMS 3D CMS Logo

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

CaloGeometry Class Reference

#include <CaloGeometry.h>

List of all members.

Public Member Functions

 CaloGeometry ()
const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id.
const GlobalPointgetPosition (const DetId &id) const
 Get the position of a given detector id.
const CaloSubdetectorGeometrygetSubdetectorGeometry (DetId::Detector det, int subdet) const
 access the subdetector geometry for the given subdetector directly
const CaloSubdetectorGeometrygetSubdetectorGeometry (const DetId &id) const
 access the subdetector geometry for the given subdetector directly
std::vector< DetIdgetValidDetIds () const
 Get the list of all valid detector ids.
const std::vector< DetId > & getValidDetIds (DetId::Detector det, int subdet) const
 Get the list of valid detector ids for the given subdetector.
bool present (const DetId &id) const
 is this detid present in the geometry?
void setSubdetGeometry (DetId::Detector det, int subdet, const CaloSubdetectorGeometry *geom)
 Register a subdetector geometry.

Private Types

enum  {
  kMaxDet = 5, kMinDet = 3, kNDets = kMaxDet - kMinDet + 1, kMaxSub = 4,
  kLength = kNDets*kMaxSub
}

Private Member Functions

unsigned int makeIndex (DetId::Detector det, int subdet, bool &ok) const

Private Attributes

std::vector< const
CaloSubdetectorGeometry * > 
m_geos

Static Private Attributes

static const std::vector< DetIdk_emptyVec

Detailed Description

Interface class to the geometry information for all calorimetry subdetectors.

Date:
2012/11/01 13:36:24
Revision:
1.8
Author:
J. Mans and P. Meridiani

Definition at line 23 of file CaloGeometry.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
kMaxDet 
kMinDet 
kNDets 
kMaxSub 
kLength 

Definition at line 69 of file CaloGeometry.h.

           { kMaxDet = 5 ,
             kMinDet = 3 ,
             kNDets  = kMaxDet - kMinDet + 1 ,
             kMaxSub = 4 ,
             kLength = kNDets*kMaxSub } ;

Constructor & Destructor Documentation

CaloGeometry::CaloGeometry ( )

Definition at line 7 of file CaloGeometry.cc.

                           :
   m_geos ( kLength, 0 )
{
}

Member Function Documentation

const CaloCellGeometry * CaloGeometry::getGeometry ( const DetId id) const
const GlobalPoint & CaloGeometry::getPosition ( const DetId id) const
const CaloSubdetectorGeometry * CaloGeometry::getSubdetectorGeometry ( DetId::Detector  det,
int  subdet 
) const

access the subdetector geometry for the given subdetector directly

Definition at line 54 of file CaloGeometry.cc.

References getHLTprescales::index, m_geos, makeIndex(), and convertSQLiteXML::ok.

{
   bool ok ;

   const unsigned int index ( makeIndex( det,
                                         subdet,
                                         ok             ) ) ;
   return ( ok ? m_geos[ index ] : 0 ) ;
}
const CaloSubdetectorGeometry * CaloGeometry::getSubdetectorGeometry ( const DetId id) const

access the subdetector geometry for the given subdetector directly

Definition at line 43 of file CaloGeometry.cc.

References getHLTprescales::index, m_geos, makeIndex(), and convertSQLiteXML::ok.

Referenced by HcalCorrPFCalculation::analyze(), IsolatedTracksCone::analyze(), EcalHaloAlgo::Calculate(), spr::chargeIsolationEcal(), EcalClusterPUCleaningTools::CleanedSuperCluster(), EcalClusterTools::covariances(), HcalRecHitsMaker::createVectorOfSubdetectorCells(), egammaisolation::EgammaRecHitExtractor::deposit(), InvRingCalib::EERingDef(), EgammaRecHitIsolation::EgammaRecHitIsolation(), EcalClusterLazyTools::eseffsirir(), EcalClusterLazyTools::eseffsixix(), EcalClusterLazyTools::eseffsiyiy(), HCALRecHitAnalyzer::FillGeometry(), spr::findDetIdECAL(), spr::findDetIdHCAL(), BetaCalculatorECAL::getDetailedTrackLengthInXtals(), HCaloDetIdAssociator::getDetIdPoints(), CaloDetIdAssociator::getDetIdPoints(), EcalClusterTools::getEnergyDepTopology(), EcalClusterLazyTools::getESHits(), getGeometry(), HoECalculator::getHoE(), getPosition(), CaloDetIdAssociator::getPosition(), HCaloDetIdAssociator::getPosition(), PhotonFixCMS::initialise(), EcalRingCalibrationTools::initializeFromGeometry(), CaloDetIdAssociator::insideElement(), HCaloDetIdAssociator::insideElement(), spr::matrixECALIds(), EcalClusterTools::meanClusterPosition(), PhysicsTowerOrganizer::PhysicsTowerOrganizer(), present(), HcalHitRelabeller::process(), CastorEventDisplay::processEvent(), HybridClusterProducer::produce(), EgammaHLTHybridClusterProducer::produce(), spr::propagateCALO(), CaloConeSelector::select(), CaloDualConeSelector::select(), CaloTowersCreationAlgo::setGeometry(), EcalGeomPhiSymHelper::setup(), Calorimeter::setupGeometry(), CaloHitResponse::timeOfFlight(), and EcalDigiProducer::updateGeometry().

{
   bool ok ;

   const unsigned int index ( makeIndex( id.det(),
                                         id.subdetId(),
                                         ok             ) ) ;
   return ( ok ? m_geos[ index ] : 0 ) ;
}
std::vector< DetId > CaloGeometry::getValidDetIds ( ) const

Get the list of all valid detector ids.

Definition at line 90 of file CaloGeometry.cc.

References DetId::Hcal, i, kLength, m_geos, and funct::true.

Referenced by cms::HcalConstantsASCIIWriter::analyze(), EcalMixingModuleValidation::computeSDBunchDigi(), EcalEleCalibLooper::duringLoop(), InvRingCalib::duringLoop(), Pi0FixedMassWindowCalibration::duringLoop(), HEcalDetIdAssociator::getASetOfValidDetIds(), HCaloDetIdAssociator::getASetOfValidDetIds(), HHcalDetIdAssociator::getASetOfValidDetIds(), ParticleTowerProducer::getNearestTower(), CaloDetIdAssociator::getValidDetIds(), HcalDetIdAssociator::getValidDetIds(), PreshowerDetIdAssociator::getValidDetIds(), EcalDetIdAssociator::getValidDetIds(), getValidDetIds(), HODetIdAssociator::getValidDetIds(), EcalRingCalibrationTools::initializeFromGeometry(), ParticleTowerProducer::resetTowers(), EcalGeomPhiSymHelper::setup(), PileUpSubtractor::setupGeometryMap(), ParametrizedSubtractor::setupGeometryMap(), HcalTBDigiProducer::updateGeometry(), and HcalDigitizer::updateGeometry().

{
   std::vector<DetId> returnValue ;
   returnValue.reserve( kLength ) ;

   bool doneHcal ( false ) ;
   for( unsigned int i ( 0 ) ; i != m_geos.size() ; ++i ) 
   {
      if( 0    != m_geos[i] )
      {
         const std::vector< DetId >& aVec ( m_geos[i]->getValidDetIds() ) ;
         const bool isHcal ( DetId::Hcal == aVec.front().det() ) ;
         if( !doneHcal ||
             !isHcal      )
         {
            returnValue.insert( returnValue.end(), aVec.begin(), aVec.end() ) ;
            if( !doneHcal &&
                isHcal        ) doneHcal = true ;
         }
      }
   }
   return returnValue ;
}
const std::vector< DetId > & CaloGeometry::getValidDetIds ( DetId::Detector  det,
int  subdet 
) const

Get the list of valid detector ids for the given subdetector.

Definition at line 115 of file CaloGeometry.cc.

References getValidDetIds(), getHLTprescales::index, k_emptyVec, m_geos, makeIndex(), and convertSQLiteXML::ok.

{
   bool ok ;

   const unsigned int index ( makeIndex( det,
                                         subdet,
                                         ok             ) ) ;

   return ( ok && ( 0 != m_geos[ index ] ) ?
            m_geos[ index ]->getValidDetIds( det, subdet ) :
            k_emptyVec ) ;
}
unsigned int CaloGeometry::makeIndex ( DetId::Detector  det,
int  subdet,
bool &  ok 
) const [private]

Definition at line 13 of file CaloGeometry.cc.

References kMaxDet, kMaxSub, and kMinDet.

Referenced by getSubdetectorGeometry(), getValidDetIds(), and setSubdetGeometry().

{
   const unsigned int idet ( det ) ;

   ok = ( kMinDet <= idet   &&
          kMaxDet >= idet   &&
          0       <  subdet &&
          kMaxSub >= subdet    ) ;

   return ( ( det - kMinDet )*kMaxSub + subdet - 1 ) ;
}
bool CaloGeometry::present ( const DetId id) const

is this detid present in the geometry?

Definition at line 84 of file CaloGeometry.cc.

References relativeConstraints::geom, getSubdetectorGeometry(), and CaloSubdetectorGeometry::present().

{
   const CaloSubdetectorGeometry* geom ( getSubdetectorGeometry( id ) ) ;
   return ( 0 == geom ? false : geom->present( id ) ) ;
}
void CaloGeometry::setSubdetGeometry ( DetId::Detector  det,
int  subdet,
const CaloSubdetectorGeometry geom 
)

Register a subdetector geometry.

Definition at line 28 of file CaloGeometry.cc.

References relativeConstraints::geom, getHLTprescales::index, m_geos, makeIndex(), and convertSQLiteXML::ok.

{
   bool ok ;
   const unsigned int index = makeIndex( det, subdet, ok ) ;
   if( ok ) m_geos[index] = geom ;

//   std::cout<<"Detector="<<(int)det<<", subset="<<subdet<<", index="<<index
//          <<", size="<<m_geos.size()<<std::endl;

   assert( ok ) ;
}

Member Data Documentation

const std::vector< DetId > CaloGeometry::k_emptyVec [static, private]

Definition at line 61 of file CaloGeometry.h.

Referenced by getValidDetIds().

std::vector< const CaloSubdetectorGeometry* > CaloGeometry::m_geos [private]

Definition at line 63 of file CaloGeometry.h.

Referenced by getSubdetectorGeometry(), getValidDetIds(), and setSubdetGeometry().