Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:42

0001 /**
0002  *  Class: MTDTransientTrackingRecHitBuilder
0003  *
0004  *  Description:
0005  *
0006  *
0007  *
0008  *  Authors :
0009  *  L. Gray               FNAL
0010  *
0011  **/
0012 
0013 #include "RecoMTD/TransientTrackingRecHit/interface/MTDTransientTrackingRecHitBuilder.h"
0014 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0015 
0016 MTDTransientTrackingRecHitBuilder::MTDTransientTrackingRecHitBuilder(
0017     edm::ESHandle<GlobalTrackingGeometry> trackingGeometry)
0018     : theTrackingGeometry(trackingGeometry) {}
0019 
0020 MTDTransientTrackingRecHitBuilder::RecHitPointer MTDTransientTrackingRecHitBuilder::build(
0021     const TrackingRecHit* p, edm::ESHandle<GlobalTrackingGeometry> trackingGeometry) const {
0022   if (p->geographicalId().det() == DetId::Forward && p->geographicalId().subdetId() == FastTime) {
0023     return p->cloneSH();
0024   }
0025 
0026   return RecHitPointer();
0027 }
0028 
0029 MTDTransientTrackingRecHitBuilder::RecHitPointer MTDTransientTrackingRecHitBuilder::build(
0030     const TrackingRecHit* p) const {
0031   if (theTrackingGeometry.isValid())
0032     return build(p, theTrackingGeometry);
0033   else
0034     throw cms::Exception("MTD|RecoMTD|MTDTransientTrackingRecHitBuilder")
0035         << "ERROR! You are trying to build a MTDTransientTrackingRecHit with a non valid GlobalTrackingGeometry";
0036 }
0037 
0038 MTDTransientTrackingRecHitBuilder::ConstRecHitContainer MTDTransientTrackingRecHitBuilder::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 }