CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

MuonDetIdAssociator Class Reference

#include <MuonDetIdAssociator.h>

Inheritance diagram for MuonDetIdAssociator:
DetIdAssociator

List of all members.

Public Member Functions

virtual const GeomDetgetGeomDet (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 CSCBadChamberscscbadchambers_
const GlobalTrackingGeometrygeometry_
bool includeBadChambers_
std::vector< GlobalPointpoints_
std::vector< DetIdvalidIds_

Detailed Description

Definition at line 33 of file MuonDetIdAssociator.h.


Constructor & Destructor Documentation

MuonDetIdAssociator::MuonDetIdAssociator ( ) [inline]

Definition at line 35 of file MuonDetIdAssociator.h.

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

Definition at line 36 of file MuonDetIdAssociator.h.

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")){};

Member Function Documentation

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());
}
const GeomDet * MuonDetIdAssociator::getGeomDet ( const DetId id) const [virtual]

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]
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().

                                                                                       {
   if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
   LocalPoint lp = geometry_->idToDet(id)->toLocal(point);
   return geometry_->idToDet(id)->surface().bounds().inside(lp);
}
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]
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]

Member Data Documentation

Definition at line 72 of file MuonDetIdAssociator.h.

Referenced by check_setup(), getValidDetIds(), and setCSCBadChambers().

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().