File indexing completed on 2025-09-17 09:14:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_RFILTERBASE
0012 #define ROOT_RFILTERBASE
0013
0014 #include "ROOT/RDF/RColumnRegister.hxx"
0015 #include "ROOT/RDF/RNodeBase.hxx"
0016 #include "ROOT/RDF/Utils.hxx" // ColumnNames_t
0017 #include "ROOT/RVec.hxx"
0018 #include "RtypesCore.h"
0019
0020 #include <cassert>
0021 #include <string>
0022 #include <vector>
0023
0024 class TTreeReader;
0025
0026 namespace ROOT {
0027
0028 namespace RDF {
0029 class RCutFlowReport;
0030 }
0031
0032 namespace Detail {
0033 namespace RDF {
0034 namespace RDFInternal = ROOT::Internal::RDF;
0035
0036 class RLoopManager;
0037
0038 class RFilterBase : public RNodeBase {
0039 protected:
0040 std::vector<Long64_t> fLastCheckedEntry;
0041 std::vector<int> fLastResult = {true};
0042 std::vector<ULong64_t> fAccepted = {0};
0043 std::vector<ULong64_t> fRejected = {0};
0044 const std::string fName;
0045 const ROOT::RDF::ColumnNames_t fColumnNames;
0046 RDFInternal::RColumnRegister fColRegister;
0047
0048 ROOT::RVecB fIsDefine;
0049 std::string fVariation;
0050 std::unordered_map<std::string, std::shared_ptr<RFilterBase>> fVariedFilters;
0051
0052 public:
0053 RFilterBase(RLoopManager *df, std::string_view name, const unsigned int nSlots,
0054 const RDFInternal::RColumnRegister &colRegister, const ColumnNames_t &columns,
0055 const std::vector<std::string> &prevVariations, const std::string &variation = "nominal");
0056
0057
0058
0059 RFilterBase(const RFilterBase &) = delete;
0060 RFilterBase &operator=(const RFilterBase &) = delete;
0061 RFilterBase(RFilterBase &&) = delete;
0062 RFilterBase &operator=(RFilterBase &&) = delete;
0063 ~RFilterBase() override;
0064
0065 virtual void InitSlot(TTreeReader *r, unsigned int slot) = 0;
0066 bool HasName() const;
0067 std::string GetName() const;
0068 virtual void FillReport(ROOT::RDF::RCutFlowReport &) const;
0069 virtual void TriggerChildrenCount() = 0;
0070 virtual void ResetReportCount()
0071 {
0072 assert(!fName.empty());
0073
0074 std::fill(fAccepted.begin(), fAccepted.end(), 0);
0075 std::fill(fRejected.begin(), fRejected.end(), 0);
0076 }
0077
0078 virtual void FinalizeSlot(unsigned int slot) = 0;
0079 virtual void InitNode();
0080 };
0081
0082 }
0083 }
0084 }
0085
0086 #endif