CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/TrackingTools/TransientTrack/src/TransientTrackBuilder.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00002 #include "DataFormats/Common/interface/Handle.h" 
00003 #include "TrackingTools/TransientTrack/interface/GsfTransientTrack.h"
00004 #include "TrackingTools/TransientTrack/interface/TransientTrackFromFTS.h"
00005 
00006 using namespace reco;
00007 using namespace std;
00008 using namespace edm;
00009 
00010 TransientTrack TransientTrackBuilder::build (const Track * t) const {
00011   return TransientTrack(*t, theField, theTrackingGeometry);
00012 }
00013 
00014 TransientTrack TransientTrackBuilder::build (const Track & t) const {
00015   return TransientTrack(t, theField, theTrackingGeometry);
00016 }
00017 
00018 TransientTrack TransientTrackBuilder::build (const GsfTrack * t) const {
00019   return TransientTrack(new GsfTransientTrack(*t, theField, theTrackingGeometry));
00020 }
00021 
00022 TransientTrack TransientTrackBuilder::build (const GsfTrack & t) const {
00023   return TransientTrack(new GsfTransientTrack(t, theField, theTrackingGeometry));
00024 }
00025 
00026 TransientTrack TransientTrackBuilder::build (const TrackRef * t) const {
00027   return TransientTrack(*t, theField, theTrackingGeometry);
00028 }
00029 
00030 TransientTrack TransientTrackBuilder::build (const TrackRef & t) const {
00031   return TransientTrack(t, theField, theTrackingGeometry);
00032 }
00033 
00034 
00035 TransientTrack TransientTrackBuilder::build (const GsfTrackRef * t) const {
00036   return TransientTrack(new GsfTransientTrack(*t, theField, theTrackingGeometry));
00037 }
00038 
00039 TransientTrack TransientTrackBuilder::build (const GsfTrackRef & t) const {
00040   return TransientTrack(new GsfTransientTrack(t, theField, theTrackingGeometry));
00041 }
00042 
00043 vector<TransientTrack> 
00044 TransientTrackBuilder::build ( const edm::Handle<reco::TrackCollection> & trkColl) const
00045 {
00046   vector<TransientTrack> ttVect;
00047   ttVect.reserve((*trkColl).size());
00048   for (unsigned int i = 0; i < (*trkColl).size() ; i++) {
00049     ttVect.push_back(TransientTrack(TrackRef(trkColl, i), theField, theTrackingGeometry));
00050   }
00051   return ttVect;
00052 }
00053 
00054 vector<TransientTrack> 
00055 TransientTrackBuilder::build (const edm::Handle<reco::GsfTrackCollection> & trkColl) const
00056 {
00057   vector<TransientTrack> ttVect;
00058   ttVect.reserve((*trkColl).size());
00059   for (unsigned int i = 0; i < (*trkColl).size() ; i++) {
00060     ttVect.push_back( TransientTrack(
00061         new GsfTransientTrack(GsfTrackRef(trkColl, i), theField, theTrackingGeometry)) );
00062   }
00063   return ttVect;
00064 }
00065 
00066 vector<TransientTrack> 
00067 TransientTrackBuilder::build (const edm::Handle<edm::View<Track> > & trkColl) const
00068 {
00069   vector<TransientTrack> ttVect;
00070   ttVect.reserve((*trkColl).size());
00071   for (unsigned int i = 0; i < (*trkColl).size() ; i++) {
00072     const Track * trk = &(*trkColl)[i];
00073     const GsfTrack * gsfTrack = dynamic_cast<const GsfTrack *>(trk);
00074     if (gsfTrack) {
00075       ttVect.push_back( TransientTrack(
00076           new GsfTransientTrack(RefToBase<Track>(trkColl, i).castTo<GsfTrackRef>(), theField, theTrackingGeometry)) );
00077     } else { // gsf
00078       ttVect.push_back(TransientTrack(RefToBase<Track>(trkColl, i).castTo<TrackRef>(), theField, theTrackingGeometry));
00079     }
00080   }
00081   return ttVect;
00082 }
00083 
00084 vector<TransientTrack> 
00085 TransientTrackBuilder::build ( const edm::Handle<reco::TrackCollection> & trkColl,
00086         const reco::BeamSpot & beamSpot) const
00087 {
00088   vector<TransientTrack> ttVect = build(trkColl);
00089   for (unsigned int i = 0; i < ttVect.size() ; i++) {
00090     ttVect[i].setBeamSpot(beamSpot);
00091   }
00092   return ttVect;
00093 }
00094 
00095 vector<TransientTrack> 
00096 TransientTrackBuilder::build (const edm::Handle<reco::GsfTrackCollection> & trkColl,
00097         const reco::BeamSpot & beamSpot) const
00098 {
00099   vector<TransientTrack> ttVect = build(trkColl);
00100   for (unsigned int i = 0; i < ttVect.size() ; i++) {
00101     ttVect[i].setBeamSpot(beamSpot);
00102   }
00103   return ttVect;
00104 }
00105 
00106 vector<TransientTrack> 
00107 TransientTrackBuilder::build (const edm::Handle<edm::View<Track> > & trkColl,
00108         const reco::BeamSpot & beamSpot) const
00109 {
00110   vector<TransientTrack> ttVect = build(trkColl);
00111   for (unsigned int i = 0; i < ttVect.size() ; i++) {
00112     ttVect[i].setBeamSpot(beamSpot);
00113   }
00114   return ttVect;
00115 }
00116 
00117 TransientTrack TransientTrackBuilder::build (const FreeTrajectoryState & fts) const {
00118   return TransientTrack(new TransientTrackFromFTS(fts));
00119 }