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 //
3 
5 
7 {
8 }
9 
11 {
12 }
13 
14 int TtSemiSimpleBestJetComb::operator()(std::vector<TtSemiEvtSolution> & sols)
15 {
16  // search the highest probChi^2 value in the among the different jet combination solutions
17  double maxProbChi2 = 0;
18  for(unsigned int s=0; s<sols.size(); s++) maxProbChi2 = std::max(maxProbChi2,sols[s].getProbChi2());
19 
20  //search indices of original solutions with highest probChi2 value
21  std::vector<unsigned int> indices;
22  indices.clear();
23  for(unsigned int s=0; s<sols.size(); s++){
24  if(fabs(sols[s].getProbChi2()-maxProbChi2) < 0.0001) indices.push_back(s);
25  }
26 
27  int bestSol = -999;
28  if(maxProbChi2 > 0.){
29  if(indices.size() == 1) bestSol = indices[0];
30  if(indices.size() == 2) {
31  //typically only light jets constraints applied, so still b-jet ambiguity to resolve
32  // -> look at DPhi(Whadr,bhadr) and choose smallest value
33  double DPhi_Wb0 = fabs(sols[indices[0]].getFitHadW().phi()-sols[indices[0]].getFitHadb().phi());
34  double DPhi_Wb1 = fabs(sols[indices[1]].getFitHadW().phi()-sols[indices[1]].getFitHadb().phi());
35  if(DPhi_Wb0>3.1415) DPhi_Wb0 = 2.*3.1415-DPhi_Wb0;
36  if(DPhi_Wb1>3.1415) DPhi_Wb1 = 2.*3.1415-DPhi_Wb1;
37  if(DPhi_Wb0 < DPhi_Wb1){
38  bestSol = indices[0];
39  }
40  else{
41  bestSol = indices[1];
42  }
43  }
44  }
45  return bestSol;
46 }
int operator()(std::vector< TtSemiEvtSolution > &)