Logo ROOT   6.14/05
Reference Guide
RCutFlowReport.hxx
Go to the documentation of this file.
1 // Author: Enrico Guiraud, Danilo Piparo CERN 02/2018
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_RCUTFLOWREPORT
12 #define ROOT_RCUTFLOWREPORT
13 
14 #include "RtypesCore.h"
15 #include "TString.h"
16 
17 #include <string>
18 #include <vector>
19 
20 namespace ROOT {
21 
22 namespace Detail {
23 namespace RDF {
24 class RFilterBase;
25 } // End NS RDF
26 } // End NS Detail
27 
28 
29 namespace RDF {
30 
31 class TCutInfo {
32  friend class RCutFlowReport;
34 
35 private:
36  const std::string fName;
38  const ULong64_t fAll;
39  TCutInfo(const std::string &name, ULong64_t pass, ULong64_t all) : fName(name), fPass(pass), fAll(all) {}
40 
41 public:
42  const std::string &GetName() const { return fName; }
43  ULong64_t GetAll() const { return fAll; }
44  ULong64_t GetPass() const { return fPass; }
45  float GetEff() const { return 100.f * (fPass / float(fAll)); }
46 };
47 
50 
51 private:
52  std::vector<TCutInfo> fCutInfos;
53  void AddCut(TCutInfo &&ci) { fCutInfos.emplace_back(std::move(ci)); };
54 
55 public:
56  using const_iterator = typename std::vector<TCutInfo>::const_iterator;
57  void Print();
58  const TCutInfo &operator[](std::string_view cutName);
59  const TCutInfo &At(std::string_view cutName) { return operator[](cutName); }
60  const_iterator begin() const { return fCutInfos.begin(); }
61  const_iterator end() const { return fCutInfos.end(); }
62 };
63 
64 } // End NS RDF
65 } // End NS ROOT
66 
67 #endif
const_iterator begin() const
const std::string fName
void AddCut(TCutInfo &&ci)
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
const_iterator end() const
const TCutInfo & At(std::string_view cutName)
const ULong64_t fPass
float GetEff() const
ULong64_t GetAll() const
const std::string & GetName() const
TCutInfo(const std::string &name, ULong64_t pass, ULong64_t all)
void Print(std::ostream &os, const OptionType &opt)
unsigned long long ULong64_t
Definition: RtypesCore.h:70
basic_string_view< char > string_view
Definition: RStringView.hxx:35
std::vector< TCutInfo > fCutInfos
ULong64_t GetPass() const
typename std::vector< TCutInfo >::const_iterator const_iterator
const ULong64_t fAll
char name[80]
Definition: TGX11.cxx:109