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