11 #include "Math/Vector2D.h" 
   12 #include "Math/Vector4D.h" 
   13 #include "Math/VectorUtil.h" 
   49     std::array<std::array<float, 6>, 6> 
m_inv;
 
   91     explicit operator bool()
 const {
 
   92         return jets.size() > 1;
 
   96         return accumulate(
jets.begin(), 
jets.end(), 1.0, 
 
   97         [] (
float w, 
const Jet& j) {
 
   98             return w * j.weights.front(); 
 
  104         return accumulate(
jets.begin(), 
jets.end(), 0.0,
 
  105             [](
float sum, 
const auto& jet) {
 
  106                 return sum + jet.CorrPt();
 
  121         for (
size_t i = 0; i < 6; ++i) {
 
  122             for (
size_t j = 0; j < 6; ++j) {
 
  128                 m_inv[i][j] = dijet.CorrP4().M();
 
  137             for (
auto& pr : triple) {
 
  140                 S_pt_perm[i]  += pow(dijet.CorrPt() / (
jets[pr.first].CorrPt() + 
jets[pr.second].CorrPt()), 2);
 
  154         std::array<std::array<int,4>, 3> group4 = {{
 
  159         for (
size_t j = 0; j < group4.size(); ++j) {
 
  161             for (
size_t i = 0; i < partitions.size(); ++i) {
 
  162                 auto [p1, p2] = partitions[i];
 
  165                 float a = dijet1.CorrPt() / (
jets[p1.first].CorrPt() + 
jets[p1.second].CorrPt());
 
  166                 float b = dijet2.CorrPt() / (
jets[p2.first].CorrPt() + 
jets[p2.second].CorrPt());
 
  167                 S_pt_4_perm[j][i]  = std::sqrt(0.5 * (pow(a, 2) + pow(b, 2)));
 
  168                 S_phi_4_perm[j][i] = std::sqrt(0.5 * (pow(dijet1.DeltaPhi(), 2) + pow(dijet2.DeltaPhi(), 2)));
 
  179     std::array<std::pair<std::pair<int, int>, std::pair<int, int>>, 3>
 
  182             {{index[0], index[1]}, {index[2], index[3]}},
 
  183             {{index[0], index[2]}, {index[1], index[3]}},
 
  184             {{index[0], index[3]}, {index[1], index[2]}}
 
  191         static const auto jetPairs = []() {
 
  192             std::vector<int> elements{0, 1, 2, 3, 4, 5};
 
  193             std::vector<std::pair<int, int>> current;
 
  194             std::vector<std::vector<std::pair<int, int>>> results;
 
  199             auto pairJetsIndices = [](
const std::vector<int>& elements,
 
  200                                       std::vector<std::pair<int, int>>& current,
 
  201                                       std::vector<std::vector<std::pair<int, int>>>& results,
 
  202                                       auto&& 
self) -> 
void {
 
  204                 if (elements.empty()) {
 
  205                     results.push_back(current);
 
  209                 int first = elements.front();
 
  211                 std::vector<int> rest(elements.begin() + 1, elements.end());
 
  214                 for (
size_t i = 0; i < rest.size(); ++i) {
 
  215                     int partner = rest[i];
 
  217                     current.emplace_back(first, partner);
 
  220                     std::vector<int> next;
 
  221                     next.reserve(rest.size() - 1);
 
  222                     for (
size_t j = 0; j < rest.size(); ++j) {
 
  224                             next.push_back(rest[j]);
 
  228                     self(next, current, results, 
self);
 
  233             pairJetsIndices(elements, current, results, pairJetsIndices);