CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtHadSimpleBestJetComb.cc
Go to the documentation of this file.
2 //
3 // $Id: TtHadSimpleBestJetComb.cc,v 1.3 2008/02/17 11:27:55 rwolf Exp $
4 // adapted Id: TtSemiSimpleBestJetComb.cc,v 1.2 2007/06/09 01:17:40 lowette Exp
5 // for fully hadronic channel
6 
21 {
22 }
23 
25 {
26 }
27 
28 int TtHadSimpleBestJetComb::operator()(std::vector<TtHadEvtSolution> & sols)
29 {
30  // search the highest probChi^2 value in the among the different jet combination solutions
31  double maxProbChi2 = 0.;
32  for(unsigned int s=0; s<sols.size(); s++){
33  maxProbChi2 = std::max(maxProbChi2,sols[s].getProbChi2());
34  }
35 
36  //search indices of original solutions with highest probChi2 value and select those solutionsthat are close to the highest Chi^2
37  std::vector<unsigned int> indices;
38  indices.clear();
39  for(unsigned int s=0; s<sols.size(); s++){
40  if(fabs(sols[s].getProbChi2()-maxProbChi2) < 0.0001) indices.push_back(s);
41  }
42 
43  // TtHadSolutionMaker takes light jet combinations into account, but not b-jet ambiguity...
44  int bestSol = -999;
45  double prev_W1b = 999.;
46  double prev_W2b = 999.;
47  if(maxProbChi2 > 0.){
48  if(indices.size() == 1) bestSol = indices[0];
49  if(indices.size() > 1){ //for more than one solution...
50  for(unsigned int i=0;i!=indices.size();i++){
51  double DPhi_W1b0 = fabs(sols[indices[i]].getFitHadW_plus().phi()-sols[indices[i]].getFitHadb().phi());
52  double DPhi_W1b1 = fabs(sols[indices[i]].getFitHadW_plus().phi()-sols[indices[i]].getFitHadbbar().phi());
53  double DPhi_W2b0 = fabs(sols[indices[i]].getFitHadW_minus().phi()-sols[indices[i]].getFitHadb().phi());
54  double DPhi_W2b1 = fabs(sols[indices[i]].getFitHadW_minus().phi()-sols[indices[i]].getFitHadbbar().phi());
55 
56  if(DPhi_W1b0>3.1415) DPhi_W1b0 = 2.*3.1415-DPhi_W1b0;
57  if(DPhi_W1b1>3.1415) DPhi_W1b1 = 2.*3.1415-DPhi_W1b1;
58  if(DPhi_W2b0>3.1415) DPhi_W2b0 = 2.*3.1415-DPhi_W2b0;
59  if(DPhi_W2b1>3.1415) DPhi_W2b1 = 2.*3.1415-DPhi_W2b1;
60  // Select as best solution the one which either has both b-jets closer to a particular W-jet
61  // or the one in which the two angles added together are lower than the other.....FIXME!!!
62  // W1b0 and W1b1 is a pair, W2b0 and W2b1
63  if(DPhi_W1b0<DPhi_W2b0 && DPhi_W1b1<DPhi_W2b1){
64  if(DPhi_W1b0<prev_W1b && DPhi_W1b1<prev_W2b){
65  bestSol = indices[i];
66  }
67  }
68  if(DPhi_W1b0>DPhi_W2b0 && DPhi_W1b1>DPhi_W2b1){
69  if(DPhi_W2b0<prev_W1b && DPhi_W2b1<prev_W2b){
70  bestSol = indices[i];
71  }
72  }
73  if((DPhi_W1b0<DPhi_W2b0 && DPhi_W1b1>DPhi_W2b1)||(DPhi_W1b0>DPhi_W2b0 && DPhi_W1b1<DPhi_W2b1)){
74  if((DPhi_W1b0+DPhi_W1b1)<(DPhi_W2b0+DPhi_W2b1)){
75  if(DPhi_W1b0<prev_W1b && DPhi_W1b1<prev_W2b){
76  bestSol = indices[i];
77  }
78  }else{
79  if(DPhi_W2b0<prev_W1b && DPhi_W2b1<prev_W2b){
80  bestSol = indices[i];
81  }
82  }
83  }
84  }
85  }
86  }
87  return bestSol;
88 }
int i
Definition: DBlmapReader.cc:9
const T & max(const T &a, const T &b)
int operator()(std::vector< TtHadEvtSolution > &)
Definition: DDAxes.h:10