File indexing completed on 2025-02-22 10:53:07
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 RFilterBase &operator=(const RFilterBase &) = delete;
0057
0058 ~RFilterBase() override;
0059
0060 virtual void InitSlot(TTreeReader *r, unsigned int slot) = 0;
0061 bool HasName() const;
0062 std::string GetName() const;
0063 virtual void FillReport(ROOT::RDF::RCutFlowReport &) const;
0064 virtual void TriggerChildrenCount() = 0;
0065 virtual void ResetReportCount()
0066 {
0067 assert(!fName.empty());
0068
0069 std::fill(fAccepted.begin(), fAccepted.end(), 0);
0070 std::fill(fRejected.begin(), fRejected.end(), 0);
0071 }
0072
0073 virtual void FinalizeSlot(unsigned int slot) = 0;
0074 virtual void InitNode();
0075 };
0076
0077 }
0078 }
0079 }
0080
0081 #endif