CMS 3D CMS Logo

alpha_T.h
Go to the documentation of this file.
1 #ifndef ALPHA_T_H
2 #define ALPHA_T_H
3 
4 #include <cmath>
5 #include <vector>
6 #include <numeric>
7 #include <functional>
8 #include <algorithm>
9 
10 struct alpha_T {
11  template <class LVs>
12  double operator()(const LVs& p4s) const {
13  typedef typename LVs::value_type LorentzV;
14  if (p4s.size() < 2)
15  return 0;
16 
17  std::vector<double> pTs;
18  transform(p4s.begin(), p4s.end(), back_inserter(pTs), std::mem_fn(&LorentzV::Pt));
19 
20  const double DsumPT = minimum_deltaSumPT(pTs);
21  const double sumPT = accumulate(pTs.begin(), pTs.end(), double(0));
22  const LorentzV sumP4 = accumulate(p4s.begin(), p4s.end(), LorentzV());
23 
24  return 0.5 * (sumPT - DsumPT) / sqrt(sumPT * sumPT - sumP4.Perp2());
25  }
26 
27  static double minimum_deltaSumPT(const std::vector<double>& pTs) {
28  std::vector<double> diff(1 << (pTs.size() - 1), 0.);
29  for (unsigned i = 0; i < diff.size(); i++)
30  for (unsigned j = 0; j < pTs.size(); j++)
31  diff[i] += pTs[j] * (1 - 2 * (int(i >> j) & 1));
32 
33  return fabs(*min_element(diff.begin(), diff.end(), [](auto x, auto y) { return fabs(x) < fabs(y); }));
34  }
35 };
36 
37 #endif
change_name.diff
diff
Definition: change_name.py:13
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
DDAxes::x
LorentzV
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > LorentzV
Definition: HLTAlphaTFilter.cc:28
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
alpha_T::minimum_deltaSumPT
static double minimum_deltaSumPT(const std::vector< double > &pTs)
Definition: alpha_T.h:27
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
alpha_T
Definition: alpha_T.h:10
alpha_T::operator()
double operator()(const LVs &p4s) const
Definition: alpha_T.h:12
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66