Belle II Software development
Filter.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <TTree.h>
12#include <string>
13#include <type_traits>
14
15#include <tracking/trackFindingVXD/filterMap/filterFramework/VoidObserver.h>
16
17namespace Belle2 {
33 template<typename ... typePack>
34 class Filter {
35 /* Empty: just specialized templates are interesting */
36 };
37
38
45 template<typename ... types>
46 struct all_same : std::false_type {};
47
53 template<typename T>
54 struct all_same<T> : std::true_type {};
55
61 template< >
62 struct all_same< > : std::true_type {};
63
70 template<typename T, typename ... types>
71 struct all_same<T, T, types ...> : all_same<T, types ...> {};
72
75 class BypassableFilter;
77 class ActivatableFilter;
78
79
81
108 template <
109 class Variable,
110 class RangeType,
111 class Observer
112 >
113 class Filter <Variable, RangeType, Observer> {
114 public:
116 typedef typename Variable::argumentType argumentType;
117
119 typedef typename Variable::functionType functionType;
120
128 explicit Filter(const RangeType& range):
129 m_range(range) { };
130
132 Filter() = default;
133
134
136 RangeType getRange(void) const { return m_range; }
137
138
145 template<typename ... argsType>
148 typename std::enable_if<all_same<argumentType, argsType ... >::value, bool>::type
149 accept(const argsType& ... args) const
150 {
151 typename Variable::variableType value = Variable::value(args ...);
152 Observer::notify(Variable(), value, m_range, args ...);
153 return m_range.contains(value);
154 }
155
156
161 void persist(TTree* t, const std::string& branchName)
162 {
163 m_range.persist(t, branchName, Variable().name());
164 }
165
166
171 void setBranchAddress(TTree* t, const std::string& branchName)
172 {
173 m_range.setBranchAddress(t, branchName, Variable().name());
174 }
175
176
208 bypass(const bool& bypassVariable = false)
209 {
211 }
212
213
219 // __attribute__((deprecated("Please use the bypass( const bool &) method instead")))
220 enable(const bool& enableVariable = true)
221 {
223 }
224
225
230 template< class otherObserver >
232 observeLeaf(const otherObserver&) const
233 {
235 }
236
237
242 template< class otherObserver >
245
246
252 std::string getNameAndReference(std::vector<std::pair<char, void*> >* pointers = nullptr)
253 {
254 return m_range.getNameAndReference(pointers, Variable::name());
255 }
256
257 protected:
259 RangeType m_range;
260 };
261
262
263
265
300 template <
301 class Variable,
302 class RangeType,
303 class Observer
304 >
305 class Filter <Variable, RangeType, Belle2::BypassableFilter, Observer>:
306 public Filter<Variable, RangeType, Observer> {
307 public:
309 typedef typename Variable::argumentType argumentType;
311 typedef typename Variable::functionType functionType;
312
313
324 Filter(const RangeType& range, const bool& bypass):
325 Filter<Variable, RangeType, Observer>(range)
326 { m_bypass = &bypass; };
327
328
330 Filter() = default;
331
332
339 template<typename ... argsType>
342 typename std::enable_if<all_same<argumentType, argsType ...>::value, bool>::type
343 accept(const argsType& ... args) const
344 {
345 typename Variable::variableType value = Variable::value(args ...);
347 return (*m_bypass) || Filter<Variable, RangeType, Observer>::m_range.contains(value);
348 }
349
350
356 std::string getNameAndReference(std::vector<std::pair<char, void*>>* pointers = nullptr)
357 {
358 return "(" + std::to_string(*m_bypass) + " OR " +
359 Filter<Variable, RangeType, Observer>::m_range.getNameAndReference(pointers, Variable::name()) + ")";
360 }
361
362 private:
364 const bool* m_bypass;
365 };
366
367
368
371
407 template <
408 class Variable,
409 class RangeType,
410 class Observer
411 >
412 class Filter <Variable, RangeType, Belle2::ActivatableFilter, Observer>:
413 public Filter<Variable, RangeType, Observer> {
414 public:
416 typedef typename Variable::argumentType argumentType;
418 typedef typename Variable::functionType functionType;
419
420
431 Filter(const RangeType& range, const bool& enable):
432 Filter<Variable, RangeType, Observer>(range)
433 {
434 m_enable = & enable ;
435 };
436
437
439 Filter() = default;
440
447 template<typename ... argsType>
448 typename std::enable_if<all_same<argumentType, argsType ...>::value, bool>::type
449 accept(const argsType& ... args) const
450 {
451 typename Variable::variableType value = Variable::value(args ...);
453 args ...);
454 return (!(*m_enable)) || Filter<Variable, RangeType, Observer>::m_range.contains(value);
455 }
456
457
463 std::string getNameAndReference(std::vector< std::pair<char, void*>>* pointers = nullptr)
464 {
465 return "(!(" + std::to_string(*m_enable) + ") OR "
466 + Filter<Variable, RangeType, Observer>::m_range.getNameAndReference(pointers, Variable::name()) + ")";
467 }
468
469 private:
471 const bool* m_enable;
472 };
473
474
475
478 class OperatorNot;
479
484 template <
485 class someFilter,
486 class templateObserverType
487 >
488 class Filter <Belle2::OperatorNot, someFilter, templateObserverType> {
490 const char* c_notSuffix = "_not";
491 public:
493 typedef typename someFilter::argumentType argumentType;
495 typedef typename someFilter::functionType functionType;
496
497
501 explicit Filter(const someFilter& filter):
502 m_filter(filter) { };
503
504
506 Filter() { };
507
508
515 template<typename ... argsType>
516 typename std::enable_if<all_same<argumentType, argsType ...>::value, bool>::type
517 accept(const argsType& ... args) const
518 {
519 return ! m_filter.accept(args ...);
520 }
521
522
528 std::string getNameAndReference(std::vector< std::pair<char, void*>>* pointers = nullptr)
529 {
530 return "!" + m_filter.getNameAndReference(pointers);
531 }
532
533
538 template<class otherObserver>
539 Filter<Belle2::OperatorNot, decltype(someFilter().observeLeaf(otherObserver())), otherObserver>
540 observeLeaf(const otherObserver&) const
541 {
542 return Filter<Belle2::OperatorNot, decltype(someFilter().observeLeaf(otherObserver())),
543 otherObserver>(m_filter.observeLeaf(otherObserver()));
544 }
545
546
551 void persist(TTree* t, const std::string& branchName)
552 {
553 std::string nameOfFilter(branchName);
554 nameOfFilter += c_notSuffix;
555 m_filter.persist(t, nameOfFilter);
556 }
557
558
563 void setBranchAddress(TTree* t, const std::string& branchName)
564 {
565 std::string nameOfFilter(branchName);
566 nameOfFilter += c_notSuffix;
567 m_filter.setBranchAddress(t, nameOfFilter);
568 }
569
570 private:
572 someFilter m_filter;
573 };
574
575
581 template<typename ... types>
582 Filter<OperatorNot, Filter<types...>, VoidObserver>
584 {
585 return Filter<OperatorNot, Filter<types...>, VoidObserver>(filter);
586 }
587
588
589
592 class OperatorAnd;
593
599 template <
600 class FilterA,
601 class FilterB,
602 class templateObserverType
603 >
604 class Filter <Belle2::OperatorAnd, FilterA, FilterB, templateObserverType> {
606 const char* c_andSuffixA = "_and_A";
608 const char* c_andSuffixB = "_and_B";
609 public:
611 typedef typename FilterA::argumentType argumentType;
613 typedef typename FilterB::argumentType argumentTypeB;
615 typedef typename FilterA::functionType functionTypeA;
617 typedef typename FilterB::functionType functionTypeB;
619 typedef typename std::enable_if<all_same<functionTypeA, functionTypeB>::value, functionTypeA>::type functionType;
620
621
626 Filter(const FilterA& filterA, const FilterB& filterB):
627 m_filterA(filterA), m_filterB(filterB) { };
628
629
631 Filter() { };
632
633
641 template<typename ... argsType>
642 typename std::enable_if<all_same<argumentType, argumentTypeB, argsType ...>::value, bool>::type
643 accept(const argsType& ... args) const
644 {
645 templateObserverType::prepare(args ...);
646 bool returnValue = m_filterA.accept(args ...) && m_filterB.accept(args ...);
647 templateObserverType::collect(args ...);
648 return returnValue;
649 }
650
651
658 template<class otherObserver>
659 Filter<Belle2::OperatorAnd, decltype(FilterA().observeLeaf(otherObserver())),
660 decltype(FilterB().observeLeaf(otherObserver())), otherObserver>
661 observe(const otherObserver&) const
662 {
663 // this will recursively loop over all AND Filters and set the SAME observer
664 return Filter<Belle2::OperatorAnd,
665 decltype(FilterA().observeLeaf(otherObserver())),
666 decltype(FilterB().observeLeaf(otherObserver())),
667 otherObserver>(m_filterA.observeLeaf(otherObserver()), m_filterB.observeLeaf(otherObserver()));
668 }
669
670
677 template<class otherObserver>
678 Filter<Belle2::OperatorAnd, decltype(FilterA().observeLeaf(otherObserver())),
679 decltype(FilterB().observeLeaf(otherObserver())), VoidObserver>
680 observeLeaf(const otherObserver&) const
681 {
682 // This will recursively loop over all lower level Filters of the AND combination and set the SAME observer.
683 // For the top level filter the void observer is used.
684 return Filter<Belle2::OperatorAnd,
685 decltype(FilterA().observeLeaf(otherObserver())),
686 decltype(FilterB().observeLeaf(otherObserver())),
687 VoidObserver>(m_filterA.observeLeaf(otherObserver()), m_filterB.observeLeaf(otherObserver()));
688 }
689
690
695 void persist(TTree* t, const std::string& branchName)
696 {
697 std::string nameOfFilterA(branchName);
698 nameOfFilterA += c_andSuffixA;
699 m_filterA.persist(t, nameOfFilterA);
700
701 std::string nameOfFilterB(branchName);
702 nameOfFilterB += c_andSuffixB;
703 m_filterB.persist(t, nameOfFilterB);
704 }
705
706
711 void setBranchAddress(TTree* t, const std::string& branchName)
712 {
713 std::string nameOfFilterA(branchName);
714 nameOfFilterA += c_andSuffixA;
715 m_filterA.setBranchAddress(t, nameOfFilterA);
716
717 std::string nameOfFilterB(branchName);
718 nameOfFilterB += c_andSuffixB;
719 m_filterB.setBranchAddress(t, nameOfFilterB);
720 }
721
722
728 std::string getNameAndReference(std::vector< std::pair<char, void*>>* pointers = nullptr)
729 {
730 return "(" + m_filterA.getNameAndReference(pointers) + " AND " + m_filterB.getNameAndReference(pointers) + ")";
731 }
732
733 private:
735 FilterA m_filterA;
737 FilterB m_filterB;
738 };
739
740
748 template <
749 typename ... types1,
750 typename ... types2
751 >
752 Filter<Belle2::OperatorAnd, Belle2::Filter<types1...>, Belle2::Filter<types2...>, Belle2::VoidObserver>
753 operator &&(const Filter<types1...>& filter1, const Filter<types2...>& filter2)
754 {
755 return Filter<OperatorAnd, Filter<types1...>, Filter<types2...>, VoidObserver> (filter1, filter2);
756 }
757
758
759
762 class OperatorOr;
763
769 template <
770 class FilterA,
771 class FilterB,
772 class templateObserverType
773 >
774 class Filter <Belle2::OperatorOr, FilterA, FilterB, templateObserverType > {
776 const char* c_orSuffixA = "_or_A";
778 const char* c_orSuffixB = "_or_B";
779
780 public:
782 typedef typename FilterA::argumentType argumentType;
784 typedef typename FilterB::argumentType argumentTypeB;
786 typedef typename FilterA::functionType functionTypeA;
788 typedef typename FilterB::functionType functionTypeB;
790 typedef typename std::enable_if<all_same<functionTypeA, functionTypeB>::value, functionTypeA>::type functionType;
791
792
797 Filter(const FilterA& filterA, const FilterB& filterB):
798 m_filterA(filterA), m_filterB(filterB) { };
799
800
802 Filter() { };
803
804
812 template<typename ... argsType>
813 typename std::enable_if <all_same<argumentType, argumentTypeB, argsType ...>::value, bool>::type
814 accept(const argsType& ... args) const
815 {
816 templateObserverType::prepare(args ...);
817 bool returnValue = m_filterA.accept(args ...) || m_filterB.accept(args ...);
818 templateObserverType::collect(args ...);
819 return returnValue;
820 }
821
822
828 template<class otherObserver>
829 Filter<Belle2::OperatorOr, decltype(FilterA().observeLeaf(otherObserver())),
830 decltype(FilterB().observeLeaf(otherObserver())), otherObserver>
831 observe(const otherObserver&) const
832 {
833 // this will recursively loop over all "and" Filters and set the SAME observer
834 return Filter<Belle2::OperatorOr,
835 decltype(FilterA().observeLeaf(otherObserver())),
836 decltype(FilterB().observeLeaf(otherObserver())),
837 otherObserver>(m_filterA.observeLeaf(otherObserver()), m_filterB.observeLeaf(otherObserver()));
838 }
839
840
848 template<class otherObserver>
849 Filter<Belle2::OperatorOr, decltype(FilterA().observeLeaf(otherObserver())),
850 decltype(FilterB().observeLeaf(otherObserver())), VoidObserver>
851 observeLeaf(const otherObserver&) const
852 {
853 // This will recursively loop over all lower level Filters of the AND combination and set the SAME observer.
854 // For the top level filter the void observer is used.
855 return Filter<Belle2::OperatorOr,
856 decltype(FilterA().observeLeaf(otherObserver())),
857 decltype(FilterB().observeLeaf(otherObserver())),
858 VoidObserver>(m_filterA.observeLeaf(otherObserver()), m_filterB.observeLeaf(otherObserver()));
859 }
860
861
866 void persist(TTree* t, const std::string& branchName)
867 {
868 std::string nameOfFilterA(branchName);
869 nameOfFilterA += c_orSuffixA;
870 m_filterA.persist(t, nameOfFilterA);
871
872 std::string nameOfFilterB(branchName);
873 nameOfFilterB += c_orSuffixB;
874 m_filterB.persist(t, nameOfFilterB);
875 }
876
877
882 void setBranchAddress(TTree* t, const std::string& branchName)
883 {
884 std::string nameOfFilterA(branchName);
885 nameOfFilterA += c_orSuffixA;
886 m_filterA.setBranchAddress(t, nameOfFilterA);
887
888 std::string nameOfFilterB(branchName);
889 nameOfFilterB += c_orSuffixB;
890 m_filterB.setBranchAddress(t, nameOfFilterB);
891 }
892
893
899 std::string getNameAndReference(std::vector< std::pair<char, void*>>* pointers = nullptr)
900 {
901 return "(" + m_filterA.getNameAndReference(pointers) + " OR " + m_filterB.getNameAndReference(pointers) + ")";
902 }
903
904 private:
906 FilterA m_filterA;
908 FilterB m_filterB;
909 };
910
911
919 template <
920 typename ... types1,
921 typename ... types2
922 >
923 Filter<Belle2::OperatorOr, Belle2::Filter<types1...>, Belle2::Filter<types2...>, Belle2::VoidObserver>
924 operator ||(const Filter<types1...>& filter1, const Filter<types2...>& filter2)
925 {
926 return Filter<OperatorOr, Filter<types1...>, Filter<types2...>, VoidObserver> (filter1, filter2);
927 }
928
929
930
932
941 template<class booleanBinaryOperator,
942 typename ... types1,
943 typename ... types2,
944 class observer,
945 typename ... argsTypes>
946 bool initializeObservers(const Filter<booleanBinaryOperator, Belle2::Filter<types1...>,
947 Belle2::Filter<types2...>, observer>&,
948 argsTypes ... args)
949 {
950 return observer::initialize(args ...)
953 }
954
955
964 template<class booleanUnaryOperator,
965 typename ... types1,
966 class observer,
967 typename ... argsTypes>
968 bool initializeObservers(const Filter<booleanUnaryOperator, Belle2::Filter<types1...>, observer>&, argsTypes ... args)
969 {
970 return observer::initialize(args ...) && initializeObservers(Belle2::Filter<types1...>(), args...);
971 }
972
973
983 template<class Variable, class RangeType, class observer, typename ... argsTypes>
985 {
986 return observer::initialize(Variable(), filter.getRange(), args ...);
987 }
988
989}
void setBranchAddress(TTree *t, const std::string &branchName)
Set the Branches addresses to this filter.
Definition Filter.h:711
FilterA::argumentType argumentType
Handy typedef for arguments type A.
Definition Filter.h:611
FilterB::argumentType argumentTypeB
Handy typedef for arguments type B.
Definition Filter.h:613
FilterB m_filterB
Member containing the filter B of the combination A AND B.
Definition Filter.h:737
Filter< Belle2::OperatorAnd, decltype(FilterA().observeLeaf(otherObserver())), decltype(FilterB().observeLeaf(otherObserver())), VoidObserver > observeLeaf(const otherObserver &) const
will set the observer for the Leaves of this filter, this AND filter will not be observed.
Definition Filter.h:680
std::enable_if< all_same< functionTypeA, functionTypeB >::value, functionTypeA >::type functionType
Handy typedef for combined function type.
Definition Filter.h:619
void persist(TTree *t, const std::string &branchName)
Persist the filter on a TTree.
Definition Filter.h:695
std::string getNameAndReference(std::vector< std::pair< char, void * > > *pointers=nullptr)
Getter for name of and reference to the range of the filters.
Definition Filter.h:728
const char * c_andSuffixA
Char suffix to be used in the filter name for ROOT to indicate the filter A of the combination A AND ...
Definition Filter.h:606
Filter< Belle2::OperatorAnd, decltype(FilterA().observeLeaf(otherObserver())), decltype(FilterB().observeLeaf(otherObserver())), otherObserver > observe(const otherObserver &) const
Will set the observer for this and both of the via the AND operation combined filters it contains.
Definition Filter.h:661
Filter(const FilterA &filterA, const FilterB &filterB)
Constructor creating a filter representing the boolean AND combination of two filters.
Definition Filter.h:626
FilterB::functionType functionTypeB
Handy typedef for function type B.
Definition Filter.h:617
FilterA m_filterA
Member containing the filter A of the combination A AND B.
Definition Filter.h:735
const char * c_andSuffixB
Char suffix to be used in the filter name for ROOT to indicate the filter B of the combination A AND ...
Definition Filter.h:608
std::enable_if< all_same< argumentType, argumentTypeB, argsType... >::value, bool >::type accept(const argsType &... args) const
The accept method for the combination of two filters with the AND Operator: This will return the comb...
Definition Filter.h:643
FilterA::functionType functionTypeA
Handy typedef for function type A.
Definition Filter.h:615
void setBranchAddress(TTree *t, const std::string &branchName)
Set the Branches addresses to this filter.
Definition Filter.h:563
someFilter m_filter
Member variable containing the filter.
Definition Filter.h:572
void persist(TTree *t, const std::string &branchName)
Persist the filter on a TTree.
Definition Filter.h:551
std::string getNameAndReference(std::vector< std::pair< char, void * > > *pointers=nullptr)
Getter for name of and reference to the range of the filters.
Definition Filter.h:528
const char * c_notSuffix
Char suffix to be used in the filter name for ROOT to indicate that NOT operator is attached.
Definition Filter.h:490
std::enable_if< all_same< argumentType, argsType... >::value, bool >::type accept(const argsType &... args) const
The accept method of the filter with NOT Operator: This will return the inverse of the result of the ...
Definition Filter.h:517
Filter< Belle2::OperatorNot, decltype(someFilter().observeLeaf(otherObserver())), otherObserver > observeLeaf(const otherObserver &) const
Will set the observer for the combination of NOT operator + filter.
Definition Filter.h:540
someFilter::argumentType argumentType
Handy typedef for arguments.
Definition Filter.h:493
Filter(const someFilter &filter)
Constructor creating a NOT filter from a filter.
Definition Filter.h:501
someFilter::functionType functionType
Handy typedef for function.
Definition Filter.h:495
void setBranchAddress(TTree *t, const std::string &branchName)
Set the Branches addresses to this filter.
Definition Filter.h:882
FilterA::argumentType argumentType
Handy typedef for arguments type A.
Definition Filter.h:782
FilterB::argumentType argumentTypeB
Handy typedef for arguments type B.
Definition Filter.h:784
const char * c_orSuffixB
Char suffix to be used in the filter name for ROOT to indicate the filter B of the combination A OR B...
Definition Filter.h:778
FilterB m_filterB
Member containing the filter B of the combination A OR B.
Definition Filter.h:908
std::enable_if< all_same< functionTypeA, functionTypeB >::value, functionTypeA >::type functionType
Handy typedef for the combined function type.
Definition Filter.h:790
void persist(TTree *t, const std::string &branchName)
Persist the filter on a TTree.
Definition Filter.h:866
Filter< Belle2::OperatorOr, decltype(FilterA().observeLeaf(otherObserver())), decltype(FilterB().observeLeaf(otherObserver())), otherObserver > observe(const otherObserver &) const
Will set the observer for this and both via the OR operator combined filters it contains,...
Definition Filter.h:831
Filter< Belle2::OperatorOr, decltype(FilterA().observeLeaf(otherObserver())), decltype(FilterB().observeLeaf(otherObserver())), VoidObserver > observeLeaf(const otherObserver &) const
Will set the observer for both via the OR operation combined filters it contains, this filter itself ...
Definition Filter.h:851
std::string getNameAndReference(std::vector< std::pair< char, void * > > *pointers=nullptr)
Getter for name of and reference to the range of the filters.
Definition Filter.h:899
Filter(const FilterA &filterA, const FilterB &filterB)
Constructor creating a filter representing the boolean OR combination of two filters.
Definition Filter.h:797
FilterB::functionType functionTypeB
Handy typedef for function type B.
Definition Filter.h:788
const char * c_orSuffixA
Char suffix to be used in the filter name for ROOT to indicate the filter A of the combination A OR B...
Definition Filter.h:776
FilterA m_filterA
Member containing the filter A of the combination A OR B.
Definition Filter.h:906
std::enable_if< all_same< argumentType, argumentTypeB, argsType... >::value, bool >::type accept(const argsType &... args) const
The accept method for the combination of two filters with the OR Operator: This will return the combi...
Definition Filter.h:814
FilterA::functionType functionTypeA
Handy typedef for function type A.
Definition Filter.h:786
Variable::argumentType argumentType
Handy typedef for arguments.
Definition Filter.h:416
Variable::functionType functionType
Handy typedef for function.
Definition Filter.h:418
std::string getNameAndReference(std::vector< std::pair< char, void * > > *pointers=nullptr)
Getter for name of and reference to the range of the filters.
Definition Filter.h:463
Filter(const RangeType &range, const bool &enable)
Constructor.
Definition Filter.h:431
std::enable_if< all_same< argumentType, argsType... >::value, bool >::type accept(const argsType &... args) const
The accept method of the activatable filter: All the real computations are occurring in this method.
Definition Filter.h:449
const bool * m_enable
Member pointer to boolean indicating if filters are active (true) or inactive (false).
Definition Filter.h:471
Variable::argumentType argumentType
Handy typedef for arguments.
Definition Filter.h:309
Variable::functionType functionType
Handy typedef for function.
Definition Filter.h:311
std::string getNameAndReference(std::vector< std::pair< char, void * > > *pointers=nullptr)
Getter for name of and reference to the range of the filters.
Definition Filter.h:356
const bool * m_bypass
Member pointer to boolean indicating if filters are bypassed (true) or their actual result is returne...
Definition Filter.h:364
std::enable_if< all_same< argumentType, argsType... >::value, bool >::type accept(const argsType &... args) const
The accept method of the bypassable filter: All the real computations are occurring in this method.
Definition Filter.h:343
Filter(const RangeType &range, const bool &bypass)
Constructor.
Definition Filter.h:324
void setBranchAddress(TTree *t, const std::string &branchName)
Set the Branches addresses to this filter.
Definition Filter.h:171
Filter< Variable, RangeType, BypassableFilter, Observer > bypass(const bool &bypassVariable=false)
This method creates a new bypassable Filter with the same range of *this E.g.:
Definition Filter.h:208
Variable::argumentType argumentType
Handy typedef for arguments.
Definition Filter.h:116
void persist(TTree *t, const std::string &branchName)
Persist the range on a TTree.
Definition Filter.h:161
Filter(const Filter< Variable, RangeType, otherObserver > &filter)
Copy constructor for filter.
Definition Filter.h:243
Variable::functionType functionType
Handy typedef for function.
Definition Filter.h:119
std::string getNameAndReference(std::vector< std::pair< char, void * > > *pointers=nullptr)
Getter for name of and reference to the range of the filters.
Definition Filter.h:252
Filter< Variable, RangeType, otherObserver > observeLeaf(const otherObserver &) const
Function to observer of a filter.
Definition Filter.h:232
std::enable_if< all_same< argumentType, argsType... >::value, bool >::type accept(const argsType &... args) const
The accept method of the filter: All the real computations are occurring in this method.
Definition Filter.h:149
RangeType m_range
Member range of the filter.
Definition Filter.h:259
RangeType getRange(void) const
Getter of the range.
Definition Filter.h:136
Filter(const RangeType &range)
Constructor.
Definition Filter.h:128
Filter< Variable, RangeType, ActivatableFilter, Observer > enable(const bool &enableVariable=true)
Create a new activatable filter.
Definition Filter.h:220
This class is used to select pairs, triplets... of objects.
Definition Filter.h:34
Observer base class which can be used to evaluate the VXDTF2's Filters.
Definition Observer.h:19
static void notify(T, double, someRangeType, const someHitType &, const someHitType &)
exemplary draft for a notify-function of an observer
Definition Observer.h:23
The most CPU efficient Observer for the VXDTF filter tools (even if useless).
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double > > &runs, double cut, std::map< ExpRun, std::pair< double, double > > &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition Splitter.cc:38
Filter< Belle2::OperatorOr, Belle2::Filter< types1... >, Belle2::Filter< types2... >, Belle2::VoidObserver > operator||(const Filter< types1... > &filter1, const Filter< types2... > &filter2)
Definition of the boolean OR operator || of the Filter class.
Definition Filter.h:924
Filter< Belle2::OperatorAnd, Belle2::Filter< types1... >, Belle2::Filter< types2... >, Belle2::VoidObserver > operator&&(const Filter< types1... > &filter1, const Filter< types2... > &filter2)
Definition of the boolean AND operator && of the Filter class.
Definition Filter.h:753
Filter< OperatorNot, Filter< types... >, VoidObserver > operator!(const Filter< types... > &filter)
Definition of the NOT operator !
Definition Filter.h:583
bool initializeObservers(const Filter< booleanBinaryOperator, Belle2::Filter< types1... >, Belle2::Filter< types2... >, observer > &, argsTypes ... args)
Observer Stuff ///.
Definition Filter.h:946
Abstract base class for different kinds of events.
The all_same struct is meant to check that all the types in a template pack are of the same type.
Definition Filter.h:46