1#ifndef LOGICAL_OPERATORS_RAL_H
2#define LOGICAL_OPERATORS_RAL_H
8#include "ROOT/RVec.hxx"
11#include "podio/CollectionBase.h"
15namespace LogicalOperators {
19template <
typename C,
typename = std::enable_if<
20 std::is_base_of<podio::CollectionBase, C>::value>>
21C
filter(
const ROOT::VecOps::RVec<bool> &mask,
const C &collection) {
22 if (mask.size() != collection.size()) {
23 auto msg =
"Different vector lengths: " + std::to_string(mask.size()) +
24 " vs. " + std::to_string(collection.size()) +
"!";
25 throw std::length_error(msg);
29 result.setSubsetCollection();
30 for (
int i = 0; i < collection.size(); i++) {
32 result.push_back(collection[i]);
40ROOT::VecOps::RVec<T>
filter(
const ROOT::VecOps::RVec<bool> &mask,
41 const ROOT::VecOps::RVec<T> &collection) {
42 if (mask.size() != collection.size()) {
43 auto msg =
"Different vector lengths: " + std::to_string(mask.size()) +
44 " vs. " + std::to_string(collection.size()) +
"!";
45 throw std::length_error(msg);
48 ROOT::VecOps::RVec<T> result;
49 for (
int i = 0; i < collection.size(); i++) {
51 result.emplace_back(collection[i]);
58ROOT::VecOps::RVec<bool>
operator&&(
const ROOT::VecOps::RVec<bool> &vec1,
59 const ROOT::VecOps::RVec<bool> &vec2);
61ROOT::VecOps::RVec<bool>
operator||(
const ROOT::VecOps::RVec<bool> &vec1,
62 const ROOT::VecOps::RVec<bool> &vec2);
64ROOT::VecOps::RVec<bool>
operator!(
const ROOT::VecOps::RVec<bool> &vec1);
ROOT::VecOps::RVec< bool > operator||(const ROOT::VecOps::RVec< bool > &vec1, const ROOT::VecOps::RVec< bool > &vec2)
Definition LogicalOperators.cc:25
ComparisonOperator
Definition LogicalOperators.h:17
ROOT::VecOps::RVec< bool > operator!(const ROOT::VecOps::RVec< bool > &vec1)
Definition LogicalOperators.cc:40
ROOT::VecOps::RVec< bool > operator&&(const ROOT::VecOps::RVec< bool > &vec1, const ROOT::VecOps::RVec< bool > &vec2)
Definition LogicalOperators.cc:10
C filter(const ROOT::VecOps::RVec< bool > &mask, const C &collection)
Definition LogicalOperators.h:21
Definition CalorimeterHit.cc:2