float ReconstructionMCMatching::DrB1(Interpretation& i){
    float dr=999;
    if(b1.Pt()>0.01 && i.B1().Pt()>0.01){
	dr=b1.DeltaR(i.B1());
    }
    return dr;
}
bool ReconstructionMCMatching::MatchH(Interpretation& i){
  if(setupMC<2){
    cerr << "need to setup mc matching (incl Higgs) first!" << endl;
    return false;
  }
  bool matchH=b1.E()>1.&&b2.E()>1.&&i.B1().E()>1.&&i.B2().E()>1.
    && ( (b1.DeltaR(i.B1())<maxdr && b2.DeltaR(i.B2())<maxdr) || (b1.DeltaR(i.B2())<maxdr && b2.DeltaR(i.B1())<maxdr) );
  return matchH;
}
int ReconstructionMCMatching::MatchNH(Interpretation& i){
  if(setupMC<2){
    cerr << "need to setup mc matching (incl Higgs) first!" << endl;
    return false;
  }
  int nQ=0;
  if(b1.E()>1.&&b2.E()>1.&&i.B1().E()>1.&&i.B2().E()>1.){
    if(b1.DeltaR(i.B1())<maxdr || b2.DeltaR(i.B1())<maxdr) nQ++;
    if(b1.DeltaR(i.B2())<maxdr || b2.DeltaR(i.B2())<maxdr) nQ++;
  }
  return nQ;
}
float ReconstructionMCMatching::SumDrTTH(Interpretation& i){
  if(setupMC<2){
    cerr << "need to setup mc matching (incl Higgs) first!" << endl;
    return false;
  }
  float sumDr=0;
  sumDr+=b_had.DeltaR(i.BHad());
  sumDr+=q1.DeltaR(i.Q1());
  sumDr+=q2.DeltaR(i.Q2());
  sumDr+=b_lep.DeltaR(i.BLep());
  sumDr+=lep.DeltaR(i.Lep());
  sumDr+=nu.DeltaR(i.Nu());
  sumDr+=b1.DeltaR(i.B1());
  sumDr+=b2.DeltaR(i.B1());

  return sumDr;
}
float ReconstructionQuality::TTHBB_ME(Interpretation& i){
  if(i.HasTag("TTHBB_ME")) return i.GetTag("TTHBB_ME");
  float tag=me.GetTTHBBMEsq(i.TopHad(),i.TopLep(),i.B1(),i.B2());
  i.SetTag("TTHBB_ME",tag);
  return tag;
}