15void vo003_LogicalOperations()
24 auto v1_gr_v2 =
v1 >
v2;
25 std::cout <<
v1 <<
" > " <<
v2 <<
" = " << v1_gr_v2 << std::endl;
28 auto v1_noteq_v2 =
v1 !=
v2;
29 std::cout <<
v1 <<
" != " <<
v2 <<
" = " << v1_noteq_v2 << std::endl;
33 auto all_true =
v1 > .5 *
v2;
34 std::cout << std::boolalpha;
35 std::cout <<
"All( " <<
v1 <<
" > .5 * " <<
v2 <<
" ) = " <<
All(all_true) << std::endl;
36 std::cout <<
"Any( " <<
v1 <<
" > " <<
v2 <<
" ) = " <<
Any(v1_noteq_v2) << std::endl;
42 auto v_filtered =
v[
v > 3.];
43 std::cout <<
"v = " <<
v <<
". v[ v > 3. ] = " << v_filtered << std::endl;
51 auto good_mu_pt = mu_pt[mu_pt > 10 && abs(mu_eta) < 2.1];
52 std::cout <<
"mu_pt = " << mu_pt <<
" mu_pt[ mu_pt > 10 && abs(mu_eta) < 2.1] = " << good_mu_pt << std::endl;
55 auto masked_mu_pt =
Where(abs(mu_eta) < 2., mu_pt, -999.);
56 std::cout <<
"mu_pt if abs(mu_eta) < 2 else -999 = " << masked_mu_pt << std::endl;
A "std::vector"-like collection of values implementing handy operation to analyse them.
auto All(const RVec< T > &v) -> decltype(v[0]==false)
Return true if all of the elements equate to true, return false otherwise.
RVec< T > Where(const RVec< int > &c, const RVec< T > &v1, const RVec< T > &v2)
Return the elements of v1 if the condition c is true and v2 if the condition c is false.
auto Any(const RVec< T > &v) -> decltype(v[0]==true)
Return true if any of the elements equates to true, return false otherwise.