Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RVariationsDescription.cxx
Go to the documentation of this file.
1// Author: Enrico Guiraud CERN 02/2022
2
3/*************************************************************************
4 * Copyright (C) 1995-2022, 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
13
14#include <iostream>
15
16namespace {
17static std::string GetStringRepr(const std::vector<const ROOT::Internal::RDF::RVariationBase *> &variations)
18{
19 std::string s;
20
21 for (const auto *varPtr : variations) {
22 const auto &variation = *varPtr;
23
24 s += "Variations {";
25 for (const auto &tag : variation.GetVariationNames())
26 s += tag + ", ";
27 s.erase(s.size() - 2);
28 s += "} affect column";
29 const auto &columns = variation.GetColumnNames();
30 if (columns.size() == 1)
31 s += " " + columns[0];
32 else {
33 s += "s {";
34 for (const auto &col : columns)
35 s += col + ", ";
36 s.erase(s.size() - 2);
37 s += "}";
38 }
39 s += '\n';
40 }
41 return s;
42}
43} // anonymous namespace
44
45namespace ROOT {
46namespace RDF {
47
48// Pre-condition: elements in variations are expected to be unique.
49RVariationsDescription::RVariationsDescription(const Variations_t &variations) : fStringRepr(GetStringRepr(variations))
50{
51}
52
54{
55 std::cout << AsString();
56}
57
58} // namespace RDF
59} // namespace ROOT
std::vector< const ROOT::Internal::RDF::RVariationBase * > Variations_t
RVariationsDescription(const Variations_t &variations)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.