69using std::sregex_iterator, std::ostream;
 
   80  for (
unsigned int i = 0; i < 
collection.size(); ++i) {
 
   91   for (std::size_t i = 0; i < formula.size(); ++i) {
 
   92      if (match && !
isdigit(formula[i])) {
 
   93         formula.insert(formula.begin() + i, 
']');
 
   96      } 
else if (!match && formula[i] == 
'@') {
 
   98         formula.insert(formula.begin() + i + 1, 
'[');
 
  110   for (std::string::size_type pos{}; 
inOut.npos != (pos = 
inOut.find(
what.data(), pos, 
what.length()));
 
  111        pos += 
with.length()) {
 
  121   static const std::regex 
r{
"\\b"};
 
  122   std::vector<bool> 
out(s.size() + 1);
 
  124   for (
auto i = std::sregex_iterator(s.begin(), s.end(), 
r); i != std::sregex_iterator(); ++i) {
 
  126      out[
m.position()] = 
true;
 
  130   out[s.size()] = 
true;
 
  139   for (
unsigned int i = 0; i < 
varList.size(); ++i) {
 
  146      for (std::string::size_type pos{}; formula.npos != (pos = formula.find(
varName.data(), pos, 
varName.length()));
 
  149         std::string::size_type next = pos + 
varName.length();
 
  158         if (next < formula.size() && (formula[next] == 
'[' || formula[next] == 
']')) {
 
  180         << 
"Preprocessing formula: replace named references: " << 
varName << 
" --> " << 
replacement << 
"\n\t" 
  181         << formula << std::endl;
 
  211  std::unique_ptr<TFormula> 
newTF;
 
  212  if (
other._tFormula) {
 
  213    newTF = std::make_unique<TFormula>(*
other._tFormula);
 
 
  233  cxcoutD(InputArguments) << 
"Preprocessing formula step 1: find category tags (catName::catState) in " 
  234      << formula << std::endl;
 
  237  static const std::regex 
categoryReg(
"(\\w+)::(\\w+)");
 
  239  for (sregex_iterator 
matchIt = sregex_iterator(formula.begin(), formula.end(), 
categoryReg);
 
  242    const std::string 
fullMatch = (*matchIt)[0];
 
  243    const std::string 
catName = (*matchIt)[1];
 
  244    const std::string 
catState = (*matchIt)[2];
 
  248      cxcoutD(InputArguments) << 
"Formula " << 
GetName() << 
" uses '::' to reference a category state as '" << 
fullMatch 
  249          << 
"' but a category '" << 
catName << 
"' cannot be found in the input variables." << std::endl;
 
  254      coutE(InputArguments) << 
"Formula " << 
GetName() << 
" uses '::' to reference a category state as '" << 
fullMatch 
  255          << 
"' but the category '" << 
catName << 
"' does not seem to have the state '" << 
catState << 
"'." << std::endl;
 
  256      throw std::invalid_argument(formula);
 
  263  cxcoutD(InputArguments) << 
"-- End of category tags --"<< std::endl;
 
  270  cxcoutD(InputArguments) << 
"Preprocessing formula step 2: replace category tags\n\t" << formula << std::endl;
 
  275  cxcoutD(InputArguments) << 
"Preprocessing formula step 3: replace '@'-references\n\t" << formula << std::endl;
 
  280  cxcoutD(InputArguments) << 
"Final formula:\n\t" << formula << std::endl;
 
 
  293  const std::string formula(
_tFormula->GetTitle());
 
 
  322    regexStr << 
"x\\[" << i << 
"\\]|@" << i;
 
  325    std::string 
replacement = std::string(
"[") + var.GetName() + 
"]";
 
 
  356      if (arg->getStringAttribute(
"origName")) {
 
  363      coutE(LinkStateMgmt) << 
__func__ << 
": cannot find replacement for " << arg->GetName() << std::endl;
 
 
  386    std::string 
what = 
"Formula ";
 
  388    what += 
" didn't compile.";
 
  389    throw std::runtime_error(
what);
 
  392  std::vector<double> pars;
 
  397      pars.push_back(cat.getCurrentIndex());
 
  400      pars.push_back(
real.getVal(nset));
 
 
  413   for (
int i = 0; i < 
nPars; i++) {
 
  418   std::vector<double> pars(
nPars);
 
  419   for (
size_t i = 0; i < 
output.size(); i++) {
 
 
  432  os << 
indent << 
"--- RooFormula ---" << std::endl;
 
 
  482  os << 
"[ actualVars=";
 
  484     os << 
" " << arg->GetName();
 
 
  496  cxcoutD(InputArguments) << 
"RooFormula '" << 
GetName() << 
"' will be compiled as " 
  500      << 
"\n  with the parameters " << 
_origList << std::endl;
 
  505    std::stringstream 
msg;
 
  506    msg << 
"RooFormula '" << 
GetName() << 
"' did not compile or is invalid." 
  507        << 
"\nInput:\n\t" << formula
 
  510    throw std::runtime_error(
msg.str());
 
  517    std::stringstream 
msg;
 
  518    msg << 
"TFormula interprets the formula " << formula << 
" as " << 
theFormula->GetNdim() << 
"-dimensional with the variable(s) {";
 
  519    for (
int i=1; i < 
theFormula->GetNdim(); ++i) {
 
  528      msg << 
"}, which could not be supplied by RooFit." 
  529          << 
"\nThe formula must be modified, or those variables must be supplied in the list of variables." << std::endl;
 
  531      throw std::invalid_argument(
msg.str());
 
 
static void indent(ostringstream &buf, int indent_level)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
const_iterator begin() const
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
A space to attach TBranches.
Abstract container object that can hold multiple RooAbsArg objects.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
virtual bool replace(const RooAbsArg &var1, const RooAbsArg &var2)
Replace var1 with var2 and return true for success.
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
std::span< double > output()
A 'mix-in' base class that define the standard RooFit plotting and printing methods.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
virtual const char * ClassName() const
Returns name of class to which the object belongs.