JHUGen MELA  JHUGen v7.5.6, MELA v2.4.2
Matrix element calculations as used in JHUGen.
TUtilHelpers.cc
Go to the documentation of this file.
1 #include <cstdlib>
2 #include <regex>
3 #include "TUtilHelpers.hh"
4 
5 
7  // Take care of special characters
8  size_t ipos;
9  std::string strTakeOut, strPutIn;
10 
11  strTakeOut = ".oODOLLAROo.";
12  strPutIn = "$";
13  ipos = str.find(strTakeOut);
14  while (ipos!=std::string::npos){ str.replace(ipos, strTakeOut.length(), strPutIn.c_str()); ipos = str.find(strTakeOut); }
15  strTakeOut = ".oOOPEN_BRACKETOo.";
16  strPutIn = "{";
17  ipos = str.find(strTakeOut);
18  while (ipos!=std::string::npos){ str.replace(ipos, strTakeOut.length(), strPutIn.c_str()); ipos = str.find(strTakeOut); }
19  strTakeOut = ".oOCLOSE_BRACKETOo.";
20  strPutIn = "}";
21  ipos = str.find(strTakeOut);
22  while (ipos!=std::string::npos){ str.replace(ipos, strTakeOut.length(), strPutIn.c_str()); ipos = str.find(strTakeOut); }
23 
24  static std::regex env("\\$\\{([^}]+)\\}");
25  std::smatch match;
26  while (std::regex_search(str, match, env)){
27  const char* s = getenv(match[1].str().c_str());
28  const std::string var(s == NULL ? "" : s);
29  str.replace(match[0].first, match[0].second, var);
30  }
31 }
modparameters::second
real(8), parameter, public second
Definition: mod_Parameters.F90:105
TUtilHelpers::ExpandEnvironmentVariables
void ExpandEnvironmentVariables(std::string &str)
Definition: TUtilHelpers.cc:6
TUtilHelpers.hh