#include <MuonDetIdAssociator.h>
Public Member Functions | |
virtual const GeomDet * | getGeomDet (const DetId &id) const |
MuonDetIdAssociator () | |
MuonDetIdAssociator (const int nPhi, const int nEta, const double etaBinSize) | |
MuonDetIdAssociator (const edm::ParameterSet &pSet) | |
virtual const char * | name () const |
virtual void | setConditions (const DetIdAssociatorRecord &iRecord) |
virtual void | setCSCBadChambers (const CSCBadChambers *ptr) |
virtual void | setGeometry (const DetIdAssociatorRecord &iRecord) |
virtual void | setGeometry (const GlobalTrackingGeometry *ptr) |
Protected Member Functions | |
virtual void | check_setup () const |
virtual std::pair < const_iterator, const_iterator > | getDetIdPoints (const DetId &id) const |
virtual GlobalPoint | getPosition (const DetId &id) const |
virtual const std::vector < DetId > & | getValidDetIds (unsigned int) const |
virtual bool | insideElement (const GlobalPoint &point, const DetId &id) const |
Protected Attributes | |
const CSCBadChambers * | cscbadchambers_ |
const GlobalTrackingGeometry * | geometry_ |
bool | includeBadChambers_ |
std::vector< GlobalPoint > | points_ |
std::vector< DetId > | validIds_ |
Definition at line 33 of file MuonDetIdAssociator.h.
MuonDetIdAssociator::MuonDetIdAssociator | ( | ) | [inline] |
Definition at line 35 of file MuonDetIdAssociator.h.
:DetIdAssociator(48, 48 , 0.125),geometry_(0),cscbadchambers_(0),includeBadChambers_(0){};
MuonDetIdAssociator::MuonDetIdAssociator | ( | const int | nPhi, |
const int | nEta, | ||
const double | etaBinSize | ||
) | [inline] |
Definition at line 36 of file MuonDetIdAssociator.h.
:DetIdAssociator(nPhi, nEta, etaBinSize),geometry_(0),cscbadchambers_(0),includeBadChambers_(0){};
MuonDetIdAssociator::MuonDetIdAssociator | ( | const edm::ParameterSet & | pSet | ) | [inline] |
Definition at line 39 of file MuonDetIdAssociator.h.
:DetIdAssociator(pSet.getParameter<int>("nPhi"),pSet.getParameter<int>("nEta"),pSet.getParameter<double>("etaBinSize")),geometry_(0),cscbadchambers_(0),includeBadChambers_(pSet.getParameter<bool>("includeBadChambers")){};
void MuonDetIdAssociator::check_setup | ( | ) | const [protected, virtual] |
Reimplemented from DetIdAssociator.
Definition at line 29 of file MuonDetIdAssociator.cc.
References cscbadchambers_, Exception, and geometry_.
{ if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n"; if (cscbadchambers_==0) throw cms::Exception("ConfigurationProblem") << "CSCBadChambers is not set\n"; DetIdAssociator::check_setup(); }
std::pair< DetIdAssociator::const_iterator, DetIdAssociator::const_iterator > MuonDetIdAssociator::getDetIdPoints | ( | const DetId & | id | ) | const [protected, virtual] |
Implements DetIdAssociator.
Definition at line 80 of file MuonDetIdAssociator.cc.
References BoundSurface::bounds(), geometry_, getGeomDet(), GlobalTrackingGeometry::idToDet(), Bounds::length(), points_, GeomDet::surface(), Bounds::thickness(), GeomDet::toGlobal(), and Bounds::width().
{ points_.clear(); const GeomDet* geomDet = getGeomDet( id ); // the coners of muon detector elements are not stored and can be only calculated // based on methods defined in the interface class Bounds: // width() - x // length() - y // thinkness() - z // NOTE: this convention is implementation specific and can fail. Both // RectangularPlaneBounds and TrapezoidalPlaneBounds use it. // Even though the CSC geomtry is more complicated (trapezoid), it's enough // to estimate which bins should contain this element. For the distance // calculation from the edge, we will use exact geometry to get it right. const Bounds* bounds = &(geometry_->idToDet(id)->surface().bounds()); points_.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,+bounds->length()/2,+bounds->thickness()/2))); points_.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,+bounds->length()/2,+bounds->thickness()/2))); points_.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,-bounds->length()/2,+bounds->thickness()/2))); points_.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,-bounds->length()/2,+bounds->thickness()/2))); points_.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,+bounds->length()/2,-bounds->thickness()/2))); points_.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,+bounds->length()/2,-bounds->thickness()/2))); points_.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,-bounds->length()/2,-bounds->thickness()/2))); points_.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,-bounds->length()/2,-bounds->thickness()/2))); return std::pair<const_iterator,const_iterator>(points_.begin(),points_.end()); }
Implements DetIdAssociator.
Definition at line 35 of file MuonDetIdAssociator.cc.
References Exception, geometry_, and GlobalTrackingGeometry::idToDet().
Referenced by getDetIdPoints(), and getPosition().
{ if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n"; const GeomDet* gd = geometry_->idToDet(id); if (gd == 0) throw cms::Exception("NoGeometry") << "Cannot find GeomDet for DetID: " << id.rawId() <<"\n"; return gd; }
GlobalPoint MuonDetIdAssociator::getPosition | ( | const DetId & | id | ) | const [protected, virtual] |
Implements DetIdAssociator.
Definition at line 44 of file MuonDetIdAssociator.cc.
References getGeomDet(), point, position, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ Surface::PositionType point(getGeomDet(id)->surface().position()); return GlobalPoint(point.x(),point.y(),point.z()); }
const std::vector< DetId > & MuonDetIdAssociator::getValidDetIds | ( | unsigned int | subDectorIndex | ) | const [protected, virtual] |
Implements DetIdAssociator.
Definition at line 49 of file MuonDetIdAssociator.cc.
References cscbadchambers_, CSCDetId, TrackingGeometry::dets(), dt, DTChamberId, Exception, geometry_, includeBadChambers_, CSCBadChambers::isInBadChamber(), GlobalTrackingGeometry::slaveGeometry(), and validIds_.
{ validIds_.clear(); if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n"; if (subDectorIndex!=0) throw cms::Exception("FatalError") << "Muon sub-dectors are all handle as one sub-system, but subDetectorIndex is not zero.\n"; // CSC if (! geometry_->slaveGeometry(CSCDetId()) ) throw cms::Exception("FatalError") << "Cannnot CSCGeometry\n"; const std::vector<GeomDet*>& geomDetsCSC = geometry_->slaveGeometry(CSCDetId())->dets(); for(std::vector<GeomDet*>::const_iterator it = geomDetsCSC.begin(); it != geomDetsCSC.end(); ++it) if (CSCChamber* csc = dynamic_cast< CSCChamber*>(*it)) { if ((! includeBadChambers_) && (cscbadchambers_->isInBadChamber(CSCDetId(csc->id())))) continue; validIds_.push_back(csc->id()); } // DT if (! geometry_->slaveGeometry(DTChamberId()) ) throw cms::Exception("FatalError") << "Cannnot DTGeometry\n"; const std::vector<GeomDet*>& geomDetsDT = geometry_->slaveGeometry(DTChamberId())->dets(); for(std::vector<GeomDet*>::const_iterator it = geomDetsDT.begin(); it != geomDetsDT.end(); ++it) if (DTChamber* dt = dynamic_cast< DTChamber*>(*it)) validIds_.push_back(dt->id()); return validIds_; }
bool MuonDetIdAssociator::insideElement | ( | const GlobalPoint & | point, |
const DetId & | id | ||
) | const [protected, virtual] |
Implements DetIdAssociator.
Definition at line 73 of file MuonDetIdAssociator.cc.
References BoundSurface::bounds(), Exception, geometry_, GlobalTrackingGeometry::idToDet(), Bounds::inside(), GeomDet::surface(), and GeomDet::toLocal().
virtual const char* MuonDetIdAssociator::name | ( | void | ) | const [inline, virtual] |
Implements DetIdAssociator.
Definition at line 56 of file MuonDetIdAssociator.h.
{ return "AllMuonDetectors"; }
virtual void MuonDetIdAssociator::setConditions | ( | const DetIdAssociatorRecord & | iRecord | ) | [inline, virtual] |
Reimplemented from DetIdAssociator.
Definition at line 48 of file MuonDetIdAssociator.h.
References edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::ESHandle< T >::product(), and setCSCBadChambers().
{ edm::ESHandle<CSCBadChambers> cscbadchambersH; iRecord.getRecord<CSCBadChambersRcd>().get(cscbadchambersH); setCSCBadChambers(cscbadchambersH.product()); };
virtual void MuonDetIdAssociator::setCSCBadChambers | ( | const CSCBadChambers * | ptr | ) | [inline, virtual] |
Definition at line 46 of file MuonDetIdAssociator.h.
References cscbadchambers_.
Referenced by setConditions().
{ cscbadchambers_ = ptr; }
virtual void MuonDetIdAssociator::setGeometry | ( | const GlobalTrackingGeometry * | ptr | ) | [inline, virtual] |
Definition at line 42 of file MuonDetIdAssociator.h.
References geometry_.
Referenced by setGeometry().
{ geometry_ = ptr; }
void MuonDetIdAssociator::setGeometry | ( | const DetIdAssociatorRecord & | iRecord | ) | [virtual] |
Implements DetIdAssociator.
Definition at line 109 of file MuonDetIdAssociator.cc.
References edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::ESHandle< T >::product(), and setGeometry().
{ edm::ESHandle<GlobalTrackingGeometry> geometryH; iRecord.getRecord<GlobalTrackingGeometryRecord>().get(geometryH); setGeometry(geometryH.product()); }
const CSCBadChambers* MuonDetIdAssociator::cscbadchambers_ [protected] |
Definition at line 72 of file MuonDetIdAssociator.h.
Referenced by check_setup(), getValidDetIds(), and setCSCBadChambers().
const GlobalTrackingGeometry* MuonDetIdAssociator::geometry_ [protected] |
Definition at line 70 of file MuonDetIdAssociator.h.
Referenced by check_setup(), getDetIdPoints(), getGeomDet(), getValidDetIds(), insideElement(), and setGeometry().
bool MuonDetIdAssociator::includeBadChambers_ [protected] |
Definition at line 73 of file MuonDetIdAssociator.h.
Referenced by getValidDetIds().
std::vector<GlobalPoint> MuonDetIdAssociator::points_ [mutable, protected] |
Definition at line 74 of file MuonDetIdAssociator.h.
Referenced by getDetIdPoints().
std::vector<DetId> MuonDetIdAssociator::validIds_ [mutable, protected] |
Definition at line 75 of file MuonDetIdAssociator.h.
Referenced by getValidDetIds().