CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/AnalysisDataFormats/TrackInfo/src/RecoTracktoTP.cc

Go to the documentation of this file.
00001 #include "AnalysisDataFormats/TrackInfo/interface/RecoTracktoTP.h"
00002 
00003 
00004 // Constructors
00005 RecoTracktoTP::RecoTracktoTP() 
00006 {
00007     SetBeamSpot(math::XYZPoint(-9999.0, -9999.0, -9999.0)); 
00008     SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
00009     SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
00010 }
00011 
00012 
00013 RecoTracktoTP::~RecoTracktoTP()
00014 {
00015 }
00016 
00017 
00018 TrackingParticle RecoTracktoTP::TPMother(unsigned short i) const
00019 {
00020     std::vector<TrackingParticle>  result;
00021 
00022     if( TP().parentVertex().isNonnull())
00023     {
00024         if(TP().parentVertex()->nSourceTracks() > 0)
00025         {
00026         for(TrackingParticleRefVector::iterator si = TP().parentVertex()->sourceTracks_begin();
00027             si != TP().parentVertex()->sourceTracks_end(); si++)
00028             {
00029             for(TrackingParticleRefVector::iterator di = TP().parentVertex()->daughterTracks_begin();
00030                 di != TP().parentVertex()->daughterTracks_end(); di++)
00031                 {
00032                     if(si != di)
00033                     {
00034                         result.push_back(**si);
00035                         break;
00036                     }
00037                 }
00038                 if(result.size()) break;
00039             }
00040         }
00041         else
00042         {
00043             return TrackingParticle();
00044         }
00045     }
00046     else
00047     {
00048         return TrackingParticle();
00049     }
00050 
00051     return i < result.size() ? result[i] : TrackingParticle();
00052 }
00053 
00054 
00055 int RecoTracktoTP::numTPMothers() const
00056 {
00057     int count = 0;
00058     for(TrackingParticleRefVector::iterator si = TP().parentVertex()->sourceTracks_begin();
00059         si != TP().parentVertex()->sourceTracks_end(); si++)
00060     {
00061         for(TrackingParticleRefVector::iterator di = TP().parentVertex()->daughterTracks_begin();
00062             di != TP().parentVertex()->daughterTracks_end(); di++)
00063         {
00064             if(si != di) count++;
00065             break;
00066         }
00067         if(count>0) break;
00068     }
00069     return count;
00070 }
00071 
00072 
00073