CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtSemiSimpleBestJetComb.cc
Go to the documentation of this file.
1 //
2 // $Id: TtSemiSimpleBestJetComb.cc,v 1.3 2007/09/20 18:03:20 lowette Exp $
3 //
4 
6 
8 {
9 }
10 
12 {
13 }
14 
15 int TtSemiSimpleBestJetComb::operator()(std::vector<TtSemiEvtSolution> & sols)
16 {
17  // search the highest probChi^2 value in the among the different jet combination solutions
18  double maxProbChi2 = 0;
19  for(unsigned int s=0; s<sols.size(); s++) maxProbChi2 = std::max(maxProbChi2,sols[s].getProbChi2());
20 
21  //search indices of original solutions with highest probChi2 value
22  std::vector<unsigned int> indices;
23  indices.clear();
24  for(unsigned int s=0; s<sols.size(); s++){
25  if(fabs(sols[s].getProbChi2()-maxProbChi2) < 0.0001) indices.push_back(s);
26  }
27 
28  int bestSol = -999;
29  if(maxProbChi2 > 0.){
30  if(indices.size() == 1) bestSol = indices[0];
31  if(indices.size() == 2) {
32  //typically only light jets constraints applied, so still b-jet ambiguity to resolve
33  // -> look at DPhi(Whadr,bhadr) and choose smallest value
34  double DPhi_Wb0 = fabs(sols[indices[0]].getFitHadW().phi()-sols[indices[0]].getFitHadb().phi());
35  double DPhi_Wb1 = fabs(sols[indices[1]].getFitHadW().phi()-sols[indices[1]].getFitHadb().phi());
36  if(DPhi_Wb0>3.1415) DPhi_Wb0 = 2.*3.1415-DPhi_Wb0;
37  if(DPhi_Wb1>3.1415) DPhi_Wb1 = 2.*3.1415-DPhi_Wb1;
38  if(DPhi_Wb0 < DPhi_Wb1){
39  bestSol = indices[0];
40  }
41  else{
42  bestSol = indices[1];
43  }
44  }
45  }
46  return bestSol;
47 }
const T & max(const T &a, const T &b)
int operator()(std::vector< TtSemiEvtSolution > &)
string s
Definition: asciidump.py:422
Definition: DDAxes.h:10