Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:29

0001 #include "PhysicsTools/Heppy/interface/AlphaT.h"
0002 
0003 #include <cmath>
0004 #include <numeric>
0005 #include <vector>
0006 
0007 namespace heppy {
0008 
0009   double AlphaT::getAlphaT(const std::vector<double>& et,
0010                            const std::vector<double>& px,
0011                            const std::vector<double>& py) {
0012     // Momentum sums in transverse plane
0013     const double sum_et = accumulate(et.begin(), et.end(), 0.);
0014     const double sum_px = accumulate(px.begin(), px.end(), 0.);
0015     const double sum_py = accumulate(py.begin(), py.end(), 0.);
0016 
0017     // Minimum Delta Et for two pseudo-jets
0018     double min_delta_sum_et = -1.;
0019     for (unsigned i = 0; i < unsigned(1 << (et.size() - 1)); i++) {  //@@ iterate through different combinations
0020       double delta_sum_et = 0.;
0021       std::vector<bool> jet;
0022       for (unsigned j = 0; j < et.size(); j++) {  //@@ iterate through jets
0023         delta_sum_et += et[j] * (1 - 2 * (int(i >> j) & 1));
0024       }
0025       if ((fabs(delta_sum_et) < min_delta_sum_et || min_delta_sum_et < 0.)) {
0026         min_delta_sum_et = fabs(delta_sum_et);
0027       }
0028     }
0029     if (min_delta_sum_et < 0.) {
0030       return 0.;
0031     }
0032 
0033     // Alpha_T
0034     return (0.5 * (sum_et - min_delta_sum_et) / sqrt(sum_et * sum_et - (sum_px * sum_px + sum_py * sum_py)));
0035   }
0036 }  // namespace heppy