Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:26:19

0001 /**
0002  *  Class: MuonTransientTrackingRecHitBuilder
0003  *
0004  *  Description:
0005  *
0006  *
0007  *
0008  *  Authors :
0009  *  A. Everett               Purdue University
0010  *
0011  **/
0012 
0013 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHitBuilder.h"
0014 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
0015 
0016 MuonTransientTrackingRecHitBuilder::MuonTransientTrackingRecHitBuilder(
0017     edm::ESHandle<GlobalTrackingGeometry> trackingGeometry)
0018     : theTrackingGeometry(trackingGeometry) {}
0019 
0020 MuonTransientTrackingRecHitBuilder::RecHitPointer MuonTransientTrackingRecHitBuilder::build(
0021     const TrackingRecHit* p, edm::ESHandle<GlobalTrackingGeometry> trackingGeometry) const {
0022   if (p->geographicalId().det() == DetId::Muon) {
0023     return MuonTransientTrackingRecHit::specificBuild(trackingGeometry->idToDet(p->geographicalId()), p);
0024   }
0025 
0026   return RecHitPointer();
0027 }
0028 
0029 MuonTransientTrackingRecHitBuilder::RecHitPointer MuonTransientTrackingRecHitBuilder::build(
0030     const TrackingRecHit* p) const {
0031   if (theTrackingGeometry.isValid())
0032     return build(p, theTrackingGeometry);
0033   else
0034     throw cms::Exception("Muon|RecoMuon|MuonTransientTrackingRecHitBuilder")
0035         << "ERROR! You are trying to build a MuonTransientTrackingRecHit with a non valid GlobalTrackingGeometry";
0036 }
0037 
0038 MuonTransientTrackingRecHitBuilder::ConstRecHitContainer MuonTransientTrackingRecHitBuilder::build(
0039     const trackingRecHit_iterator& start, const trackingRecHit_iterator& stop) const {
0040   ConstRecHitContainer result;
0041   for (trackingRecHit_iterator hit = start; hit != stop; ++hit)
0042     result.push_back(build(&**hit));
0043 
0044   return result;
0045 }