Logo ROOT   6.18/05
Reference Guide
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
12
13#include <algorithm>
14#include <stdexcept>
15
16namespace ROOT {
17
18namespace RDF {
19
21{
22 const auto allEntries = fCutInfos.empty() ? 0ULL : fCutInfos.begin()->GetAll();
23 for (auto &&ci : fCutInfos) {
24 const auto &name = ci.GetName();
25 const auto pass = ci.GetPass();
26 const auto all = ci.GetAll();
27 const auto eff = ci.GetEff();
28 const auto cumulativeEff = 100.f * float(pass) / float(allEntries);
29 Printf("%-10s: pass=%-10lld all=%-10lld -- eff=%3.2f %% cumulative eff=%3.2f %%", name.c_str(), pass, all, eff, cumulativeEff);
30 }
31}
33{
34 if (cutName.empty()) {
35 throw std::runtime_error("Cannot look for an unnamed cut.");
36 }
37 auto pred = [&cutName](const TCutInfo &ci) { return ci.GetName() == cutName; };
38 const auto ciItEnd = fCutInfos.end();
39 const auto it = std::find_if(fCutInfos.begin(), ciItEnd, pred);
40 if (ciItEnd == it) {
41 std::string err = "Cannot find a cut called \"";
42 err += cutName;
43 err += "\". Available named cuts are: \n";
44 for (auto &&ci : fCutInfos) {
45 err += " - " + ci.GetName() + "\n";
46 }
47 throw std::runtime_error(err);
48 }
49 return *it;
50}
51
52} // End NS RDF
53
54} // End NS ROOT
char name[80]
Definition: TGX11.cxx:109
void Printf(const char *fmt,...)
std::vector< TCutInfo > fCutInfos
const TCutInfo & operator[](std::string_view cutName)
basic_string_view< char > string_view
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21