In this tutorial we learn how combinations of RVecs can be build.
import ROOT
v1[0], v1[1], v1[2] = 1, 2, 3
v2[0], v2[1] = -4, -5
v3 = c1 * c2
print("Combinations of {} and {}:".format(v1, v2))
for i in range(len(v3)):
print("{} * {} = {}".format(c1[i], c2[i], v3[i]))
print
v4[0], v4[1], v4[2], v4[3] = 1, 2, 3, 4
v5 = c3 * c4 * c5
print("Unique triples of {}:".format(v4))
for i in range(len(v5)):
print("{} * {} * {} = {}".format(c3[i], c4[i], c5[i], v5[i]))
ROOT::VecOps::RVec< T > RVec
RVec< T > Take(const RVec< T > &v, const RVec< typename RVec< T >::size_type > &i)
Return elements of a vector at given indices.
RVec< RVec< std::size_t > > Combinations(const std::size_t size1, const std::size_t size2)
Return the indices that represent all combinations of the elements of two RVecs.
Combinations of { 1.0000000, 2.0000000, 3.0000000 } and { -4.0000000, -5.0000000 }:
1.0 * -4.0 = -4.0
1.0 * -5.0 = -5.0
2.0 * -4.0 = -8.0
2.0 * -5.0 = -10.0
3.0 * -4.0 = -12.0
3.0 * -5.0 = -15.0
Unique triples of { 1.0000000, 2.0000000, 3.0000000, 4.0000000 }:
1.0 * 2.0 * 3.0 = 6.0
1.0 * 2.0 * 4.0 = 8.0
1.0 * 3.0 * 4.0 = 12.0
2.0 * 3.0 * 4.0 = 24.0
- Date
- August 2018
- Author
- Stefan Wunsch
Definition in file vo005_Combinations.py.