CMS 3D CMS Logo

MuonDetIdAssociator Class Reference

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

Inheritance diagram for MuonDetIdAssociator:

DetIdAssociator

List of all members.

Public Member Functions

virtual const GeomDetgetGeomDet (const DetId &id) const
 MuonDetIdAssociator (const edm::ParameterSet &pSet)
 MuonDetIdAssociator (const int nPhi, const int nEta, const double etaBinSize)
 MuonDetIdAssociator ()
virtual void setGeometry (const DetIdAssociatorRecord &iRecord)
virtual void setGeometry (const GlobalTrackingGeometry *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 GlobalTrackingGeometrygeometry_


Detailed Description

Definition at line 32 of file MuonDetIdAssociator.h.


Constructor & Destructor Documentation

MuonDetIdAssociator::MuonDetIdAssociator (  )  [inline]

Definition at line 34 of file MuonDetIdAssociator.h.

00034 :DetIdAssociator(48, 48 , 0.125),geometry_(0){};

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

Definition at line 35 of file MuonDetIdAssociator.h.

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

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

Definition at line 38 of file MuonDetIdAssociator.h.

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


Member Function Documentation

void MuonDetIdAssociator::check_setup (  )  const [protected, virtual]

Reimplemented from DetIdAssociator.

Definition at line 29 of file MuonDetIdAssociator.cc.

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

00029                                             {
00030    if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
00031    DetIdAssociator::check_setup();
00032 }

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

Implements DetIdAssociator.

Definition at line 48 of file MuonDetIdAssociator.cc.

References TrackingGeometry::dets(), Exception, geometry_, it, and GlobalTrackingGeometry::slaveGeometry().

00048                                                               {
00049    std::set<DetId> setOfValidIds;
00050    if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
00051    // we need to store only DTChambers as well as CSCChambers
00052    // Let's get all GeomDet by dets() and select only DTChambers and CSCChambers
00053 
00054    // comment this for now, till the fix of GlobalTrackingGeometry is in a release
00055    // std::vector<GeomDet*> vectOfGeomDetPtrs = geometry_->dets();
00056    // LogTrace("TrackAssociator") << "Number of GeomDet found: " << vectOfGeomDetPtrs.size();
00057    // for(std::vector<GeomDet*>::const_iterator it = vectOfGeomDetPtrs.begin(); it != vectOfGeomDetPtrs.end(); ++it)
00058    //  {
00059    //   if ((*it)->subDetector() == GeomDetEnumerators::CSC || (*it)->subDetector() == GeomDetEnumerators::DT)
00060    //     {
00061    //        if (DTChamber* dt = dynamic_cast< DTChamber*>(*it)) {
00062    //           setOfValidIds.insert(dt->id());
00063    //        }else{
00064    //           if (CSCChamber* csc = dynamic_cast< CSCChamber*>(*it)) {
00065    //              setOfValidIds.insert(csc->id());
00066    //           }
00067    //        }
00068    //     }
00069    //   }
00070    
00071    // CSC 
00072    if (! geometry_->slaveGeometry(CSCDetId()) ) throw cms::Exception("FatalError") << "Cannnot CSCGeometry\n";
00073    std::vector<GeomDet*> geomDetsCSC = geometry_->slaveGeometry(CSCDetId())->dets();
00074    for(std::vector<GeomDet*>::const_iterator it = geomDetsCSC.begin(); it != geomDetsCSC.end(); ++it)
00075      if (CSCChamber* csc = dynamic_cast< CSCChamber*>(*it)) setOfValidIds.insert(csc->id());
00076    
00077    // DT
00078    if (! geometry_->slaveGeometry(DTChamberId()) ) throw cms::Exception("FatalError") << "Cannnot DTGeometry\n";
00079    std::vector<GeomDet*> geomDetsDT = geometry_->slaveGeometry(DTChamberId())->dets();
00080    for(std::vector<GeomDet*>::const_iterator it = geomDetsDT.begin(); it != geomDetsDT.end(); ++it)
00081      if (DTChamber* dt = dynamic_cast< DTChamber*>(*it)) setOfValidIds.insert(dt->id());
00082 
00083    return setOfValidIds;
00084 }

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

Implements DetIdAssociator.

Definition at line 92 of file MuonDetIdAssociator.cc.

References BoundSurface::bounds(), geometry_, getGeomDet(), GlobalTrackingGeometry::idToDet(), Bounds::length(), GeomDet::surface(), Bounds::thickness(), GeomDet::toGlobal(), and Bounds::width().

00092                                                                                 {
00093    std::vector<GlobalPoint> points;
00094    const GeomDet* geomDet = getGeomDet( id );
00095    
00096    // the coners of muon detector elements are not stored and can be only calculated
00097    // based on methods defined in the interface class Bounds:
00098    //   width() - x
00099    //   length() - y 
00100    //   thinkness() - z
00101    // NOTE: this convention is implementation specific and can fail. Both
00102    //       RectangularPlaneBounds and TrapezoidalPlaneBounds use it.
00103    // Even though the CSC geomtry is more complicated (trapezoid),  it's enough 
00104    // to estimate which bins should contain this element. For the distance
00105    // calculation from the edge, we will use exact geometry to get it right.
00106             
00107    const Bounds* bounds = &(geometry_->idToDet(id)->surface().bounds());
00108    points.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,+bounds->length()/2,+bounds->thickness()/2)));
00109    points.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,+bounds->length()/2,+bounds->thickness()/2)));
00110    points.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,-bounds->length()/2,+bounds->thickness()/2)));
00111    points.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,-bounds->length()/2,+bounds->thickness()/2)));
00112    points.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,+bounds->length()/2,-bounds->thickness()/2)));
00113    points.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,+bounds->length()/2,-bounds->thickness()/2)));
00114    points.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,-bounds->length()/2,-bounds->thickness()/2)));
00115    points.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,-bounds->length()/2,-bounds->thickness()/2)));
00116    
00117    return  points;
00118 }

const GeomDet * MuonDetIdAssociator::getGeomDet ( const DetId id  )  const [virtual]

Implements DetIdAssociator.

Definition at line 34 of file MuonDetIdAssociator.cc.

References Exception, geometry_, and GlobalTrackingGeometry::idToDet().

Referenced by getDetIdPoints(), and getPosition().

00035 {
00036    if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
00037    const GeomDet* gd = geometry_->idToDet(id);
00038    if (gd == 0) throw cms::Exception("NoGeometry") << "Cannot find GeomDet for DetID: " << id.rawId() <<"\n";
00039    return gd;
00040 }

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

Implements DetIdAssociator.

Definition at line 43 of file MuonDetIdAssociator.cc.

References getGeomDet(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00043                                                                   {
00044    Surface::PositionType point(getGeomDet(id)->surface().position());
00045    return GlobalPoint(point.x(),point.y(),point.z());
00046 }

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

Implements DetIdAssociator.

Definition at line 86 of file MuonDetIdAssociator.cc.

References BoundSurface::bounds(), Exception, geometry_, GlobalTrackingGeometry::idToDet(), Bounds::inside(), lp, GeomDet::surface(), and GeomDet::toLocal().

00086                                                                                        {
00087    if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
00088    LocalPoint lp = geometry_->idToDet(id)->toLocal(point);
00089    return geometry_->idToDet(id)->surface().bounds().inside(lp);
00090 }

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

Implements DetIdAssociator.

Definition at line 43 of file MuonDetIdAssociator.h.

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

00043                                                                  {
00044       edm::ESHandle<GlobalTrackingGeometry> geometryH;
00045       iRecord.getRecord<GlobalTrackingGeometryRecord>().get(geometryH);
00046       setGeometry(geometryH.product());
00047    };

virtual void MuonDetIdAssociator::setGeometry ( const GlobalTrackingGeometry ptr  )  [inline, virtual]

Definition at line 41 of file MuonDetIdAssociator.h.

References geometry_.

Referenced by setGeometry().

00041 { geometry_ = ptr; }


Member Data Documentation

const GlobalTrackingGeometry* MuonDetIdAssociator::geometry_ [protected]

Definition at line 63 of file MuonDetIdAssociator.h.

Referenced by check_setup(), getASetOfValidDetIds(), getDetIdPoints(), getGeomDet(), insideElement(), and setGeometry().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:41 2009 for CMSSW by  doxygen 1.5.4