float ReconstructionMCMatching::DrQ2(Interpretation& i){
    float dr=999;
    if(q2.Pt()>0.01 && i.Q2().Pt()>0.01){
	dr=q2.DeltaR(i.Q2());
    }
    return dr;
}
int ReconstructionMCMatching::MatchNWHad(Interpretation& i){
  if(setupMC<1){
    cerr << "need to setup mc matching (incl Higgs) first!" << endl;
    return false;
  }
  int nQ=0;
  if(q1.E()>1.&&q2.E()>1.&&i.Q1().E()>1.&&i.Q2().E()>1.){
    if(q1.DeltaR(i.Q1())<maxdr || q2.DeltaR(i.Q1())<maxdr) nQ++;
    if(q1.DeltaR(i.Q2())<maxdr || q2.DeltaR(i.Q2())<maxdr) nQ++;
  }
  return nQ++;
}
bool ReconstructionMCMatching::MatchWHad(Interpretation& i){
  if(setupMC==0){
    cerr << "need to setup mc matching first!" << endl;
    return false;
  }
  bool matchWhad=q1.E()>1.&&q2.E()>1.&&i.Q1().E()>1.&&i.Q2().E()>1.
		   && 
    ( (q1.DeltaR(i.Q1())<maxdr && q2.DeltaR(i.Q2())<maxdr) || (q1.DeltaR(i.Q2())<maxdr && q2.DeltaR(i.Q1())<maxdr) );
  //  cout << "1 " << q1.DeltaR(i.Q1()) << ", " <<  q2.DeltaR(i.Q2()) << " 2 " << q2.DeltaR(i.Q1()) << ", " <<  q1.DeltaR(i.Q2()) << endl;
  //  cout << "q1 pt " << i.Q1().Pt() << " q2 pt " << i.Q2().Pt()  << " blep pt " << i.BLep().Pt()   << " bhad pt " << i.BHad().Pt() << " nu pz " << i.Nu().Pz() << endl;
  //  if(matchWhad)   cout << "matched" << endl;
  //  else cout << "not matched" << endl;
  return matchWhad;
}
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;
}