13void vo003_LogicalOperations()
22 auto v1_gr_v2 =
v1 >
v2;
23 std::cout <<
v1 <<
" > " <<
v2 <<
" = " << v1_gr_v2 << std::endl;
26 auto v1_noteq_v2 =
v1 !=
v2;
27 std::cout <<
v1 <<
" != " <<
v2 <<
" = " << v1_noteq_v2 << std::endl;
31 auto all_true =
v1 > .5 *
v2;
32 std::cout << std::boolalpha;
33 std::cout <<
"All( " <<
v1 <<
" > .5 * " <<
v2 <<
" ) = " <<
All(all_true) << std::endl;
34 std::cout <<
"Any( " <<
v1 <<
" > " <<
v2 <<
" ) = " <<
Any(v1_noteq_v2) << std::endl;
40 auto v_filtered =
v[
v > 3.];
41 std::cout <<
"v = " <<
v <<
". v[ v > 3. ] = " << v_filtered << std::endl;
49 auto good_mu_pt = mu_pt[mu_pt > 10 && abs(mu_eta) < 2.1];
50 std::cout <<
"mu_pt = " << mu_pt <<
" mu_pt[ mu_pt > 10 && abs(mu_eta) < 2.1] = " << good_mu_pt << std::endl;
53 auto masked_mu_pt =
Where(abs(mu_eta) < 2., mu_pt, -999.);
54 std::cout <<
"mu_pt if abs(mu_eta) < 2 else -999 = " << masked_mu_pt << std::endl;
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.