Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:32

0001 #include "AnalysisDataFormats/TrackInfo/interface/RecoTracktoTP.h"
0002 
0003 // Constructors
0004 RecoTracktoTP::RecoTracktoTP() {
0005   SetBeamSpot(math::XYZPoint(-9999.0, -9999.0, -9999.0));
0006   SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
0007   SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
0008 }
0009 
0010 RecoTracktoTP::~RecoTracktoTP() {}
0011 
0012 TrackingParticle RecoTracktoTP::TPMother(unsigned short i) const {
0013   std::vector<TrackingParticle> result;
0014 
0015   if (TP().parentVertex().isNonnull()) {
0016     if (TP().parentVertex()->nSourceTracks() > 0) {
0017       for (TrackingParticleRefVector::iterator si = TP().parentVertex()->sourceTracks_begin();
0018            si != TP().parentVertex()->sourceTracks_end();
0019            ++si) {
0020         for (TrackingParticleRefVector::iterator di = TP().parentVertex()->daughterTracks_begin();
0021              di != TP().parentVertex()->daughterTracks_end();
0022              ++di) {
0023           if (si != di) {
0024             result.push_back(**si);
0025             break;
0026           }
0027         }
0028         if (!result.empty())
0029           break;
0030       }
0031     } else {
0032       return TrackingParticle();
0033     }
0034   } else {
0035     return TrackingParticle();
0036   }
0037 
0038   return i < result.size() ? result[i] : TrackingParticle();
0039 }
0040 
0041 int RecoTracktoTP::numTPMothers() const {
0042   int count = 0;
0043   for (TrackingParticleRefVector::iterator si = TP().parentVertex()->sourceTracks_begin();
0044        si != TP().parentVertex()->sourceTracks_end();
0045        ++si) {
0046     for (TrackingParticleRefVector::iterator di = TP().parentVertex()->daughterTracks_begin();
0047          di != TP().parentVertex()->daughterTracks_end();
0048          ++di) {
0049       if (si != di)
0050         count++;
0051       break;
0052     }
0053     if (count > 0)
0054       break;
0055   }
0056   return count;
0057 }