CMS 3D CMS Logo

TtHadSimpleBestJetComb.cc
Go to the documentation of this file.
2 //
3 // adapted Id: TtSemiSimpleBestJetComb.cc,v 1.2 2007/06/09 01:17:40 lowette Exp
4 // for fully hadronic channel
5 
20 
22 
23 int TtHadSimpleBestJetComb::operator()(std::vector<TtHadEvtSolution>& sols) {
24  // search the highest probChi^2 value in the among the different jet combination solutions
25  double maxProbChi2 = 0.;
26  for (unsigned int s = 0; s < sols.size(); s++) {
27  maxProbChi2 = std::max(maxProbChi2, sols[s].getProbChi2());
28  }
29 
30  //search indices of original solutions with highest probChi2 value and select those solutionsthat are close to the highest Chi^2
31  std::vector<unsigned int> indices;
32  indices.clear();
33  for (unsigned int s = 0; s < sols.size(); s++) {
34  if (fabs(sols[s].getProbChi2() - maxProbChi2) < 0.0001)
35  indices.push_back(s);
36  }
37 
38  // TtHadSolutionMaker takes light jet combinations into account, but not b-jet ambiguity...
39  int bestSol = -999;
40  double prev_W1b = 999.;
41  double prev_W2b = 999.;
42  if (maxProbChi2 > 0.) {
43  if (indices.size() == 1)
44  bestSol = indices[0];
45  if (indices.size() > 1) { //for more than one solution...
46  for (unsigned int i = 0; i != indices.size(); i++) {
47  double DPhi_W1b0 = fabs(sols[indices[i]].getFitHadW_plus().phi() - sols[indices[i]].getFitHadb().phi());
48  double DPhi_W1b1 = fabs(sols[indices[i]].getFitHadW_plus().phi() - sols[indices[i]].getFitHadbbar().phi());
49  double DPhi_W2b0 = fabs(sols[indices[i]].getFitHadW_minus().phi() - sols[indices[i]].getFitHadb().phi());
50  double DPhi_W2b1 = fabs(sols[indices[i]].getFitHadW_minus().phi() - sols[indices[i]].getFitHadbbar().phi());
51 
52  if (DPhi_W1b0 > 3.1415)
53  DPhi_W1b0 = 2. * 3.1415 - DPhi_W1b0;
54  if (DPhi_W1b1 > 3.1415)
55  DPhi_W1b1 = 2. * 3.1415 - DPhi_W1b1;
56  if (DPhi_W2b0 > 3.1415)
57  DPhi_W2b0 = 2. * 3.1415 - DPhi_W2b0;
58  if (DPhi_W2b1 > 3.1415)
59  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 }
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
mps_fire.i
i
Definition: mps_fire.py:355
TtHadSimpleBestJetComb::operator()
int operator()(std::vector< TtHadEvtSolution > &)
Definition: TtHadSimpleBestJetComb.cc:23
TtHadSimpleBestJetComb.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
TtHadSimpleBestJetComb::TtHadSimpleBestJetComb
TtHadSimpleBestJetComb()
Definition: TtHadSimpleBestJetComb.cc:19
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
TtHadSimpleBestJetComb::~TtHadSimpleBestJetComb
~TtHadSimpleBestJetComb()
Definition: TtHadSimpleBestJetComb.cc:21
DDAxes::phi