CMS 3D CMS Logo

CaloDetIdAssociator Class Reference

#include <TrackingTools/TrackAssociator/interface/CaloDetIdAssociator.h>

Inheritance diagram for CaloDetIdAssociator:

DetIdAssociator EcalDetIdAssociator HcalDetIdAssociator HODetIdAssociator

List of all members.

Public Member Functions

 CaloDetIdAssociator (const edm::ParameterSet &pSet)
 CaloDetIdAssociator (const int nPhi, const int nEta, const double etaBinSize)
 CaloDetIdAssociator ()
virtual const GeomDetgetGeomDet (const DetId &id) const
virtual void setGeometry (const DetIdAssociatorRecord &iRecord)
virtual void setGeometry (const CaloGeometry *ptr)

Protected Member Functions

virtual void check_setup () const
virtual std::set< DetIdgetASetOfValidDetIds () const
virtual std::vector< GlobalPointgetDetIdPoints (const DetId &id) const
virtual GlobalPoint getPosition (const DetId &id) const
virtual bool insideElement (const GlobalPoint &point, const DetId &id) const

Protected Attributes

const CaloGeometrygeometry_


Detailed Description

Definition at line 34 of file CaloDetIdAssociator.h.


Constructor & Destructor Documentation

CaloDetIdAssociator::CaloDetIdAssociator (  )  [inline]

Definition at line 36 of file CaloDetIdAssociator.h.

00036 :DetIdAssociator(72, 70 ,0.087),geometry_(0){};

CaloDetIdAssociator::CaloDetIdAssociator ( const int  nPhi,
const int  nEta,
const double  etaBinSize 
) [inline]

Definition at line 37 of file CaloDetIdAssociator.h.

00038      :DetIdAssociator(nPhi, nEta, etaBinSize),geometry_(0){};

CaloDetIdAssociator::CaloDetIdAssociator ( const edm::ParameterSet pSet  )  [inline]

Definition at line 40 of file CaloDetIdAssociator.h.

00041      :DetIdAssociator(pSet.getParameter<int>("nPhi"),pSet.getParameter<int>("nEta"),pSet.getParameter<double>("etaBinSize")),geometry_(0){};


Member Function Documentation

virtual void CaloDetIdAssociator::check_setup (  )  const [inline, protected, virtual]

Reimplemented from DetIdAssociator.

Definition at line 54 of file CaloDetIdAssociator.h.

References DetIdAssociator::check_setup(), Exception, and geometry_.

00055      {
00056         DetIdAssociator::check_setup();
00057         if (geometry_==0) throw cms::Exception("CaloGeometry is not set");
00058      };

virtual std::set<DetId> CaloDetIdAssociator::getASetOfValidDetIds (  )  const [inline, protected, virtual]

Implements DetIdAssociator.

Reimplemented in EcalDetIdAssociator, HcalDetIdAssociator, and HODetIdAssociator.

Definition at line 64 of file CaloDetIdAssociator.h.

References DetId::Calo, geometry_, CaloGeometry::getValidDetIds(), and it.

00064                                                       {
00065       std::set<DetId> setOfValidIds;
00066       std::vector<DetId> vectOfValidIds = geometry_->getValidDetIds(DetId::Calo, 1);
00067       for(std::vector<DetId>::const_iterator it = vectOfValidIds.begin(); it != vectOfValidIds.end(); ++it)
00068          setOfValidIds.insert(*it);
00069 
00070       return setOfValidIds;
00071    };

virtual std::vector<GlobalPoint> CaloDetIdAssociator::getDetIdPoints ( const DetId id  )  const [inline, protected, virtual]

Implements DetIdAssociator.

Definition at line 73 of file CaloDetIdAssociator.h.

References e5, geometry_, CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), DetIdInfo::info(), edm::isnan(), and LogDebug.

00073                                                                         {
00074       if(! geometry_->getSubdetectorGeometry(id)){
00075          LogDebug("TrackAssociator") << "Cannot find sub-detector geometry for " << id.rawId() <<"\n";
00076       } else {
00077          if(! geometry_->getSubdetectorGeometry(id)->getGeometry(id)) {
00078             LogDebug("TrackAssociator") << "Cannot find CaloCell geometry for " << id.rawId() <<"\n";
00079          } else {
00080             const CaloCellGeometry::CornersVec& cor (geometry_->getSubdetectorGeometry(id)->getGeometry(id)->getCorners() ) ; 
00081             const std::vector<GlobalPoint> points( cor.begin(), cor.end() ) ;
00082             for(std::vector<GlobalPoint>::const_iterator itr=points.begin();itr!=points.end();itr++)
00083               {
00084                  //FIX ME
00085                  // the following is a protection from the NaN bug in CaloGeometry
00086                  if(isnan(itr->mag())||itr->mag()>1e5) { //Detector parts cannot be 1 km away or be NaN
00087                     edm::LogWarning("TrackAssociator") << "Critical error! Bad calo detector unit geometry:\n\tDetId:" 
00088                       << id.rawId() << "\t mag(): " << itr->mag() << "\n" << DetIdInfo::info( id )
00089                         << "\nSkipped the element";
00090                     return std::vector<GlobalPoint>();
00091                  }
00092               }
00093             return points;
00094             // points.push_back(getPosition(id));
00095          }
00096       }
00097       return std::vector<GlobalPoint>();
00098    };

virtual const GeomDet* CaloDetIdAssociator::getGeomDet ( const DetId id  )  const [inline, virtual]

Implements DetIdAssociator.

Definition at line 51 of file CaloDetIdAssociator.h.

00051 { return 0; };

virtual GlobalPoint CaloDetIdAssociator::getPosition ( const DetId id  )  const [inline, protected, virtual]

Implements DetIdAssociator.

Definition at line 60 of file CaloDetIdAssociator.h.

References geometry_, CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), and CaloGeometry::getSubdetectorGeometry().

00060                                                           {
00061       return geometry_->getSubdetectorGeometry(id)->getGeometry(id)->getPosition();
00062    };

virtual bool CaloDetIdAssociator::insideElement ( const GlobalPoint point,
const DetId id 
) const [inline, protected, virtual]

Implements DetIdAssociator.

Definition at line 100 of file CaloDetIdAssociator.h.

References geometry_, CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), and CaloCellGeometry::inside().

00100                                                                                {
00101       return  geometry_->getSubdetectorGeometry(id)->getGeometry(id)->inside(point);
00102    };

virtual void CaloDetIdAssociator::setGeometry ( const DetIdAssociatorRecord iRecord  )  [inline, virtual]

Implements DetIdAssociator.

Definition at line 45 of file CaloDetIdAssociator.h.

References edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::ESHandle< T >::product(), and setGeometry().

00045                                                                  {
00046       edm::ESHandle<CaloGeometry> geometryH;
00047       iRecord.getRecord<CaloGeometryRecord>().get(geometryH);
00048       setGeometry(geometryH.product());
00049    };

virtual void CaloDetIdAssociator::setGeometry ( const CaloGeometry ptr  )  [inline, virtual]

Definition at line 43 of file CaloDetIdAssociator.h.

References geometry_.

Referenced by setGeometry().

00043 { geometry_ = ptr; };


Member Data Documentation

const CaloGeometry* CaloDetIdAssociator::geometry_ [protected]

Definition at line 102 of file CaloDetIdAssociator.h.

Referenced by check_setup(), EcalDetIdAssociator::getASetOfValidDetIds(), HcalDetIdAssociator::getASetOfValidDetIds(), getASetOfValidDetIds(), HODetIdAssociator::getASetOfValidDetIds(), getDetIdPoints(), getPosition(), insideElement(), and setGeometry().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:15:44 2009 for CMSSW by  doxygen 1.5.4