ROOT
v6-26
Reference Guide
Loading...
Searching...
No Matches
PreprocessFunction.cxx
Go to the documentation of this file.
1
// @(#)root/roostats:$Id$
2
// Author: Kyle Cranmer, George Lewis
3
/*************************************************************************
4
* Copyright (C) 1995-2008, 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
11
////////////////////////////////////////////////////////////////////////////////
12
/**
13
* \ingroup HistFactory
14
*/
15
16
#include <
RooStats/HistFactory/PreprocessFunction.h
>
17
18
#include <sstream>
19
20
namespace
{
21
22
/// Replaces the XML special characters with their escape codes.
23
std::string escapeXML(
const
std::string &src)
24
{
25
std::stringstream dst;
26
for
(
char
ch : src) {
27
switch
(ch) {
28
case
'&'
: dst <<
"&"
;
break
;
29
case
'\''
: dst <<
"'"
;
break
;
30
case
'"'
: dst <<
"""
;
break
;
31
case
'<'
: dst <<
"<"
;
break
;
32
case
'>'
: dst <<
">"
;
break
;
33
default
: dst << ch;
break
;
34
}
35
}
36
return
dst.str();
37
}
38
39
}
// namespace
40
41
RooStats::HistFactory::PreprocessFunction::PreprocessFunction
(std::string
const
&
name
, std::string
const
&expression,
42
std::string
const
&dependents)
43
: fName(
name
), fExpression(expression), fDependents(dependents)
44
{
45
}
46
47
std::string
RooStats::HistFactory::PreprocessFunction::GetCommand
()
const
48
{
49
return
"expr::"
+ fName +
"('"
+ fExpression +
"',{"
+ fDependents +
"})"
;
50
}
51
52
void
RooStats::HistFactory::PreprocessFunction::Print
(std::ostream &stream)
const
53
{
54
stream <<
"\t \t Name: "
<< fName <<
"\t \t Expression: "
<< fExpression <<
"\t \t Dependents: "
<< fDependents
55
<< std::endl;
56
}
57
58
void
RooStats::HistFactory::PreprocessFunction::PrintXML
(std::ostream &xml)
const
59
{
60
xml <<
"<Function Name=\""
<< fName <<
"\" "
61
<<
"Expression=\""
<< escapeXML(fExpression) <<
"\" "
62
<<
"Dependents=\""
<< fDependents <<
"\" "
63
<<
"/>\n"
;
64
}
PreprocessFunction.h
name
char name[80]
Definition
TGX11.cxx:110
RooStats::HistFactory::PreprocessFunction::Print
void Print(std::ostream &=std::cout) const
Definition
PreprocessFunction.cxx:52
RooStats::HistFactory::PreprocessFunction::GetCommand
std::string GetCommand() const
Definition
PreprocessFunction.cxx:47
RooStats::HistFactory::PreprocessFunction::PrintXML
void PrintXML(std::ostream &) const
Definition
PreprocessFunction.cxx:58
RooStats::HistFactory::PreprocessFunction::PreprocessFunction
PreprocessFunction()
Definition
PreprocessFunction.h:12
roofit
histfactory
src
PreprocessFunction.cxx
ROOT v6-26 - Reference Guide Generated on Mon Sep 11 2023 21:02:47 (GVA Time) using Doxygen 1.9.8