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