CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlphaT.cc
Go to the documentation of this file.
2 
3 double AlphaT::value_(std::vector<bool> * jet_sign) const {
4 
5  // Clear pseudo-jet container
6  if (jet_sign) {
7  jet_sign->clear();
8  jet_sign->resize(et_.size());
9  }
10 
11  // check the size of the input collection
12  if (et_.size() == 0)
13  // empty jet collection, return AlphaT = 0
14  return 0.;
15 
16  if (et_.size() > (unsigned int) std::numeric_limits<unsigned int>::digits)
17  // too many jets, return AlphaT = a very large number
19 
20  // Momentum sums in transverse plane
21  const double sum_et = std::accumulate( et_.begin(), et_.end(), 0. );
22  const double sum_px = std::accumulate( px_.begin(), px_.end(), 0. );
23  const double sum_py = std::accumulate( py_.begin(), py_.end(), 0. );
24 
25  // Minimum Delta Et for two pseudo-jets
26  double min_delta_sum_et = sum_et;
27 
28  for (unsigned int i = 0; i < (1U << (et_.size() - 1)); i++) { //@@ iterate through different combinations
29  double delta_sum_et = 0.;
30  for (unsigned int j = 0; j < et_.size(); ++j) { //@@ iterate through jets
31  if (i & (1U << j))
32  delta_sum_et -= et_[j];
33  else
34  delta_sum_et += et_[j];
35  }
36  delta_sum_et = std::abs(delta_sum_et);
37  if (delta_sum_et < min_delta_sum_et) {
38  min_delta_sum_et = delta_sum_et;
39  if (jet_sign) {
40  for (unsigned int j = 0; j < et_.size(); ++j)
41  (*jet_sign)[j] = ((i & (1U << j)) == 0);
42  }
43  }
44  }
45 
46  // Alpha_T
47  return (0.5 * (sum_et - min_delta_sum_et) / sqrt( sum_et*sum_et - (sum_px*sum_px+sum_py*sum_py) ));
48 }
std::vector< double > px_
Definition: AlphaT.h:19
int i
Definition: DBlmapReader.cc:9
std::vector< double > py_
Definition: AlphaT.h:20
#define abs(x)
Definition: mlp_lapack.h:159
double value_(std::vector< bool > *jet_sign) const
Definition: AlphaT.cc:3
std::vector< double > et_
Definition: AlphaT.h:18
const T & max(const T &a, const T &b)
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9