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
#include "AnalysisDataFormats/SUSYBSMObjects/interface/HSCParticle.h"

namespace susybsm {

  int HSCParticle::type() const {
    if (hasTrackRef() && !hasMuonRef()) {
      return HSCParticleType::innerTrack;
    } else if (!hasTrackRef() && hasMuonRef()) {
      return HSCParticleType::standAloneMuon;
    } else if (hasTrackRef() && hasMuonRef() && muonRef()->isGlobalMuon()) {
      return HSCParticleType::globalMuon;
    } else if (hasTrackRef() && hasMuonRef() && muonRef()->isStandAloneMuon()) {
      return HSCParticleType::matchedStandAloneMuon;
    } else if (hasTrackRef() && hasMuonRef() && muonRef()->isTrackerMuon()) {
      return HSCParticleType::trackerMuon;
    } else
      return HSCParticleType::unknown;
  }

  float HSCParticle::p() const {
    if (hasMuonRef() && muonRef()->combinedMuon().isNonnull()) {
      return muonRef()->combinedMuon()->p();
    } else if (hasMuonRef() && muonRef()->innerTrack().isNonnull()) {
      return muonRef()->innerTrack()->p();
    } else if (hasMuonRef() && muonRef()->standAloneMuon().isNonnull()) {
      return muonRef()->standAloneMuon()->p();
    } else if (hasTrackRef() && trackRef().isNonnull()) {
      return trackRef()->p();
    } else
      return 0.0f;
  }

  float HSCParticle::pt() const {
    if (hasMuonRef() && muonRef()->combinedMuon().isNonnull()) {
      return muonRef()->combinedMuon()->pt();
    } else if (hasMuonRef() && muonRef()->innerTrack().isNonnull()) {
      return muonRef()->innerTrack()->pt();
    } else if (hasMuonRef() && muonRef()->standAloneMuon().isNonnull()) {
      return muonRef()->standAloneMuon()->pt();
    } else if (hasTrackRef() && trackRef().isNonnull()) {
      return trackRef()->pt();
    } else
      return 0.0f;
  }

}  // namespace susybsm