/// \file /// \ingroup tutorial_vecops /// \notebook -nodraw /// In this tutorial we learn how combinations of RVecs can be built. /// /// \macro_code /// \macro_output /// /// \date August 2018 /// \author Stefan Wunsch void vo005_Combinations() { // The starting point are two collections and we want to calculate the result // of combinations of the elements. ROOT::RVecD v1{1., 2., 3.}; ROOT::RVecD v2{-4., -5.}; // To get the indices, which result in all combinations, you can call the // following helper. // Note that you can also pass the size of the vectors directly. auto idx = Combinations(v1, v2); // Next, the respective elements can be taken via the computed indices. auto c1 = Take(v1, idx[0]); auto c2 = Take(v2, idx[1]); // Finally, you can perform any set of operations conveniently. auto v3 = c1 * c2; std::cout << "Combinations of " << v1 << " and " << v2 << ":" << std::endl; for(size_t i=0; i