Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#include "AnalysisDataFormats/TrackInfo/interface/RecoTracktoTP.h"

// Constructors
RecoTracktoTP::RecoTracktoTP() {
  SetBeamSpot(math::XYZPoint(-9999.0, -9999.0, -9999.0));
  SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
  SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
}

RecoTracktoTP::~RecoTracktoTP() {}

TrackingParticle RecoTracktoTP::TPMother(unsigned short i) const {
  std::vector<TrackingParticle> result;

  if (TP().parentVertex().isNonnull()) {
    if (TP().parentVertex()->nSourceTracks() > 0) {
      for (TrackingParticleRefVector::iterator si = TP().parentVertex()->sourceTracks_begin();
           si != TP().parentVertex()->sourceTracks_end();
           ++si) {
        for (TrackingParticleRefVector::iterator di = TP().parentVertex()->daughterTracks_begin();
             di != TP().parentVertex()->daughterTracks_end();
             ++di) {
          if (si != di) {
            result.push_back(**si);
            break;
          }
        }
        if (!result.empty())
          break;
      }
    } else {
      return TrackingParticle();
    }
  } else {
    return TrackingParticle();
  }

  return i < result.size() ? result[i] : TrackingParticle();
}

int RecoTracktoTP::numTPMothers() const {
  int count = 0;
  for (TrackingParticleRefVector::iterator si = TP().parentVertex()->sourceTracks_begin();
       si != TP().parentVertex()->sourceTracks_end();
       ++si) {
    for (TrackingParticleRefVector::iterator di = TP().parentVertex()->daughterTracks_begin();
         di != TP().parentVertex()->daughterTracks_end();
         ++di) {
      if (si != di)
        count++;
      break;
    }
    if (count > 0)
      break;
  }
  return count;
}