9#include <framework/utilities/MakeROOTCompatible.h>
10#include <framework/logging/Logger.h>
12#include <boost/algorithm/string/replace.hpp>
20 return std::map<std::string, std::string> {
62 if (str.find(
"__") != std::string::npos) {
63 B2WARNING(
"String passed to makeROOTCompatible contains double-underscore __, which is used internally for escaping special characters. "
64 "It is recommended to avoid this. However escaping a string twice with makeROOTCompatible is safe, but will print this warning. "
65 "Passed string: " + str);
68 for (
auto& pair : replace) {
69 boost::replace_all(str, pair.first, pair.second);
71 const static std::regex blackList(
"[^a-zA-Z0-9_]");
72 return std::regex_replace(str, blackList,
"");
78 for (
auto& pair : replace) {
79 boost::replace_all(str, pair.second, pair.first);
static std::map< std::string, std::string > getSubstitutionMap()
Substituation map for makeROOTCompatible.
static std::string makeROOTCompatible(std::string str)
Remove special characters that ROOT dislikes in branch names, e.g.
static std::string invertMakeROOTCompatible(std::string str)
Invert makeROOTCompatible operation.
Abstract base class for different kinds of events.