00001 00015 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHitBuilder.h" 00016 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h" 00017 00018 MuonTransientTrackingRecHitBuilder::MuonTransientTrackingRecHitBuilder(edm::ESHandle<GlobalTrackingGeometry> trackingGeometry): 00019 theTrackingGeometry(trackingGeometry) 00020 {} 00021 00022 00023 MuonTransientTrackingRecHitBuilder::RecHitPointer 00024 MuonTransientTrackingRecHitBuilder::build (const TrackingRecHit* p, 00025 edm::ESHandle<GlobalTrackingGeometry> trackingGeometry) const { 00026 00027 if ( p->geographicalId().det() == DetId::Muon ) { 00028 return (MuonTransientTrackingRecHit::specificBuild(trackingGeometry->idToDet(p->geographicalId()),p).get()); 00029 } 00030 00031 return 0; 00032 00033 } 00034 00035 MuonTransientTrackingRecHitBuilder::RecHitPointer 00036 MuonTransientTrackingRecHitBuilder::build(const TrackingRecHit * p) const { 00037 if(theTrackingGeometry.isValid()) return build(p,theTrackingGeometry); 00038 else 00039 throw cms::Exception("Muon|RecoMuon|MuonTransientTrackingRecHitBuilder") 00040 <<"ERROR! You are trying to build a MuonTransientTrackingRecHit with a non valid GlobalTrackingGeometry"; 00041 } 00042 00043 MuonTransientTrackingRecHitBuilder::ConstRecHitContainer 00044 MuonTransientTrackingRecHitBuilder::build(const trackingRecHit_iterator start, const trackingRecHit_iterator stop) const { 00045 00046 ConstRecHitContainer result; 00047 for(trackingRecHit_iterator hit = start; hit != stop; ++hit ) 00048 result.push_back(build(&**hit)); 00049 00050 return result; 00051 } 00052