ROOT
v6-32
Reference Guide
Loading...
Searching...
No Matches
RCutFlowReport.cxx
Go to the documentation of this file.
1
// Author: Enrico Guiraud, Danilo Piparo CERN 02/2018
2
3
/*************************************************************************
4
* Copyright (C) 1995-2018, 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
#include "
ROOT/RDF/RCutFlowReport.hxx
"
12
#include "
TString.h
"
// Printf
13
14
#include <algorithm>
15
#include <stdexcept>
16
17
namespace
ROOT
{
18
19
namespace
RDF
{
20
21
void
RCutFlowReport::Print
()
22
{
23
const
auto
allEntries =
fCutInfos
.empty() ? 0ULL :
fCutInfos
.begin()->GetAll();
24
for
(
auto
&&ci :
fCutInfos
) {
25
const
auto
&
name
= ci.GetName();
26
const
auto
pass = ci.GetPass();
27
const
auto
all = ci.GetAll();
28
const
auto
eff = ci.GetEff();
29
const
auto
cumulativeEff = 100.f * float(pass) / float(allEntries);
30
Printf
(
"%-10s: pass=%-10lld all=%-10lld -- eff=%3.2f %% cumulative eff=%3.2f %%"
,
name
.c_str(), pass, all, eff, cumulativeEff);
31
}
32
}
33
const
TCutInfo
&
RCutFlowReport::operator[]
(std::string_view cutName)
34
{
35
if
(cutName.empty()) {
36
throw
std::runtime_error(
"Cannot look for an unnamed cut."
);
37
}
38
auto
pred = [&cutName](
const
TCutInfo
&ci) {
return
ci.GetName() == cutName; };
39
const
auto
ciItEnd =
fCutInfos
.end();
40
const
auto
it = std::find_if(
fCutInfos
.begin(), ciItEnd, pred);
41
if
(ciItEnd == it) {
42
std::string err =
"Cannot find a cut called \""
;
43
err += cutName;
44
err +=
"\". Available named cuts are: \n"
;
45
for
(
auto
&&ci :
fCutInfos
) {
46
err +=
" - "
+ ci.GetName() +
"\n"
;
47
}
48
throw
std::runtime_error(err);
49
}
50
return
*it;
51
}
52
53
}
// End NS RDF
54
55
}
// End NS ROOT
RCutFlowReport.hxx
name
char name[80]
Definition
TGX11.cxx:110
TString.h
Printf
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Definition
TString.cxx:2503
ROOT::RDF::RCutFlowReport::fCutInfos
std::vector< TCutInfo > fCutInfos
Definition
RCutFlowReport.hxx:53
ROOT::RDF::RCutFlowReport::Print
void Print()
Definition
RCutFlowReport.cxx:21
ROOT::RDF::RCutFlowReport::operator[]
const TCutInfo & operator[](std::string_view cutName)
Definition
RCutFlowReport.cxx:33
ROOT::RDF::TCutInfo
Definition
RCutFlowReport.hxx:30
ROOT::RDF
Definition
RArrowDS.hxx:28
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition
EExecutionPolicy.hxx:4
tree
dataframe
src
RCutFlowReport.cxx
ROOT v6-32 - Reference Guide Generated on Tue May 19 2026 02:47:06 (GVA Time) using Doxygen 1.13.2