File indexing completed on 2025-02-22 10:53:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_RCUTFLOWREPORT
0012 #define ROOT_RCUTFLOWREPORT
0013
0014 #include <string_view>
0015 #include "RtypesCore.h"
0016
0017 #include <string>
0018 #include <vector>
0019
0020 namespace ROOT {
0021
0022 namespace Detail {
0023 namespace RDF {
0024 class RFilterBase;
0025 }
0026 }
0027
0028 namespace RDF {
0029
0030 class TCutInfo {
0031 friend class RCutFlowReport;
0032 friend class ROOT::Detail::RDF::RFilterBase;
0033
0034 private:
0035 std::string fName;
0036 ULong64_t fPass;
0037 ULong64_t fAll;
0038 TCutInfo(const std::string &name, ULong64_t pass, ULong64_t all) : fName(name), fPass(pass), fAll(all) {}
0039
0040 public:
0041
0042 TCutInfo() = default;
0043 const std::string &GetName() const { return fName; }
0044 ULong64_t GetAll() const { return fAll; }
0045 ULong64_t GetPass() const { return fPass; }
0046 float GetEff() const { return 100.f * (fPass / float(fAll)); }
0047 };
0048
0049 class RCutFlowReport {
0050 friend class ROOT::Detail::RDF::RFilterBase;
0051
0052 private:
0053 std::vector<TCutInfo> fCutInfos;
0054 void AddCut(TCutInfo &&ci) { fCutInfos.emplace_back(std::move(ci)); };
0055
0056 public:
0057 using const_iterator = typename std::vector<TCutInfo>::const_iterator;
0058 void Print();
0059 const TCutInfo &operator[](std::string_view cutName);
0060 const TCutInfo &At(std::string_view cutName) { return operator[](cutName); }
0061 const_iterator begin() const { return fCutInfos.begin(); }
0062 const_iterator end() const { return fCutInfos.end(); }
0063 };
0064
0065 }
0066 }
0067
0068 #endif