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
12
13#include <iostream>
14#include <unordered_set>
15
16namespace {
17static std::string GetStringRepr(
18 const std::unordered_multimap<std::string, std::shared_ptr<ROOT::Internal::RDF::RVariationBase>> &variationsMap)
19{
20 std::unordered_set<ROOT::Internal::RDF::RVariationBase*> uniqueVariations;
21 std::string s;
22
23 for (const auto &e : variationsMap) {
24 const auto it = uniqueVariations.insert(e.second.get());
25 if (!it.second) // we have already seen this variation
26 continue;
27
28 const auto &variation = *e.second;
29
30 s += "Variations {";
31 for (const auto &tag : variation.GetVariationNames())
32 s += tag + ", ";
33 s.erase(s.size() - 2);
34 s += "} affect column";
35 const auto &columns = variation.GetColumnNames();
36 if (columns.size() == 1)
37 s += " " + columns[0];
38 else {
39 s += "s {";
40 for (const auto &col : columns)
41 s += col + ", ";
42 s.erase(s.size() - 2);
43 s += "}";
44 }
45 s += '\n';
46 }
47 return s;
48}
49} // namespace
50
51namespace ROOT {
52namespace RDF {
53
54RVariationsDescription::RVariationsDescription(const Variations_t &variations) : fStringRepr(GetStringRepr(variations))
55{
56}
57
59{
60 std::cout << AsString();
61}
62
63} // namespace RDF
64} // namespace ROOT
#define e(i)
Definition RSha256.hxx:103
std::unordered_multimap< std::string, std::shared_ptr< ROOT::Internal::RDF::RVariationBase > > Variations_t
RVariationsDescription(const Variations_t &variations)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...