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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
//
//

#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "AnalysisDataFormats/TopObjects/interface/StEvtSolution.h"

StEvtSolution::StEvtSolution() {
  jetCorrScheme_ = 0;
  chi2Prob_ = -999.;
  pTrueCombExist_ = -999.;
  pTrueBJetSel_ = -999.;
  pTrueBhadrSel_ = -999.;
  pTrueJetComb_ = -999.;
  signalPur_ = -999.;
  signalLRTot_ = -999.;
  sumDeltaRjp_ = -999.;
  deltaRB_ = -999.;
  deltaRL_ = -999.;
  changeBL_ = -999;
  bestSol_ = false;
}

StEvtSolution::~StEvtSolution() {}

//-------------------------------------------
// get calibrated base objects
//-------------------------------------------
pat::Jet StEvtSolution::getBottom() const {
  // WARNING this is obsolete and only
  // kept for backwards compatibility
  if (jetCorrScheme_ == 1) {
    //jet calibrated according to MC truth
    return bottom_->correctedJet("HAD", "B");
  } else if (jetCorrScheme_ == 2) {
    return bottom_->correctedJet("HAD", "B");
  } else {
    return *bottom_;
  }
}

pat::Jet StEvtSolution::getLight() const {
  // WARNING this is obsolete and only
  // kept for backwards compatibility
  if (jetCorrScheme_ == 1) {
    //jet calibrated according to MC truth
    return light_->correctedJet("HAD", "UDS");
  } else if (jetCorrScheme_ == 2) {
    return light_->correctedJet("HAD", "UDS");
  } else {
    return *light_;
  }
}

reco::Particle StEvtSolution::getLepW() const {
  // FIXME: the charge from the genevent
  reco::Particle p;
  if (this->getDecay() == "muon")
    p = reco::Particle(0, this->getMuon().p4() + this->getNeutrino().p4(), math::XYZPoint());
  if (this->getDecay() == "electron")
    p = reco::Particle(0, this->getElectron().p4() + this->getNeutrino().p4(), math::XYZPoint());
  return p;
}

reco::Particle StEvtSolution::getLept() const {
  // FIXME: the charge from the genevent
  reco::Particle p;
  if (this->getDecay() == "muon")
    p = reco::Particle(0, this->getMuon().p4() + this->getNeutrino().p4() + this->getBottom().p4(), math::XYZPoint());
  if (this->getDecay() == "electron")
    p = reco::Particle(
        0, this->getElectron().p4() + this->getNeutrino().p4() + this->getBottom().p4(), math::XYZPoint());
  return p;
}

//-------------------------------------------
// get the matched gen particles
//-------------------------------------------
// FIXME: provide defaults if the genevent is invalid
const reco::GenParticle* StEvtSolution::getGenBottom() const {
  if (!theGenEvt_)
    return nullptr;
  else
    return theGenEvt_->decayB();
}

// FIXME: not implemented yet
// const reco::GenParticle * StEvtSolution::getGenLight() const
// {
//   if(!theGenEvt_) return 0;
//   else return theGenEvt_->recoilQuark();
// }

const reco::GenParticle* StEvtSolution::getGenLepton() const {
  if (!theGenEvt_)
    return nullptr;
  else
    return theGenEvt_->singleLepton();
}

const reco::GenParticle* StEvtSolution::getGenNeutrino() const {
  if (!theGenEvt_)
    return nullptr;
  else
    return theGenEvt_->singleNeutrino();
}

const reco::GenParticle* StEvtSolution::getGenLepW() const {
  if (!theGenEvt_)
    return nullptr;
  else
    return theGenEvt_->singleW();
}

const reco::GenParticle* StEvtSolution::getGenLept() const {
  if (!theGenEvt_)
    return nullptr;
  else
    return theGenEvt_->singleTop();
}

//-------------------------------------------
// get uncalibrated reco objects
//-------------------------------------------
reco::Particle StEvtSolution::getRecLept() const {
  // FIXME: the charge from the genevent
  reco::Particle p;
  if (this->getDecay() == "muon")
    p = reco::Particle(
        0, this->getMuon().p4() + this->getNeutrino().p4() + this->getRecBottom().p4(), math::XYZPoint());
  if (this->getDecay() == "electron")
    p = reco::Particle(
        0, this->getElectron().p4() + this->getNeutrino().p4() + this->getRecBottom().p4(), math::XYZPoint());
  return p;
}

//-------------------------------------------
// get objects from kinematic fit
//-------------------------------------------
reco::Particle StEvtSolution::getFitLepW() const {
  // FIXME: provide the correct charge from generated event
  return reco::Particle(0, this->getFitLepton().p4() + this->getFitNeutrino().p4());
}

reco::Particle StEvtSolution::getFitLept() const {
  // FIXME: provide the correct charge from generated event
  return reco::Particle(0, this->getFitLepton().p4() + this->getFitNeutrino().p4() + this->getFitBottom().p4());
}

//-------------------------------------------
// set the generated event
//-------------------------------------------
void StEvtSolution::setGenEvt(const edm::Handle<StGenEvent>& aGenEvt) {
  theGenEvt_ = edm::RefProd<StGenEvent>(aGenEvt);
}

//-------------------------------------------
// set other info on the event
//-------------------------------------------
void StEvtSolution::setScanValues(const std::vector<double>& val) {
  for (unsigned int i = 0; i < val.size(); i++)
    scanValues_.push_back(val[i]);
}