36using std::string, std::vector;
41 const std::string
delims(
"\\ ");
42 std::string::size_type
begIdx;
43 std::string::size_type
endIdx;
45 while(
begIdx!=string::npos){
59 const std::string
delims(
"\\ ");
60 std::string::size_type
begIdx;
61 std::string::size_type
endIdx;
63 while(
begIdx!=string::npos){
87 for(
unsigned int i=0; i <
string_list.size(); ++i) {
103 std::cout <<
"ASIMOV - Param Name: " <<
param_name
104 <<
" Param Val: " <<
param_val << std::endl;
133 std::cerr <<
"Loading of xml document \"" <<
input
134 <<
"\" failed" << std::endl;
147 cxcoutEHF <<
"Error: Driver DOCTYPE not equal to 'Combination'" << std::endl;
163 cxcoutEHF <<
" Error: Attribute for 'Combination' with no name found" << std::endl;
179 cxcoutEHF <<
" Error: Unknown attribute for 'Combination' encountered: "
195 while( node !=
nullptr ) {
197 if( node->
GetText() ==
nullptr ) {
199 <<
" has no text." << std::endl;
209 std::cerr <<
"no input channels found" << std::endl;
214 std::ostringstream
msg;
215 msg <<
"Found Channels: ";
229 std::vector< RooStats::HistFactory::PreprocessFunction >
functionObjects;
232 while( node !=
nullptr ) {
244 std::cout << std::endl;
249 while( node !=
nullptr ) {
252 cxcoutEHF <<
"Error: Node found in Measurement Driver XML with no name" << std::endl;
276 cxcoutEHF <<
"Error: Unknown node found in Measurement Driver XML: "
284 cxcoutIHF <<
"Done Processing Measurements" << std::endl;
287 cxcoutEHF <<
"Error: No Measurements found in XML Driver File" << std::endl;
291 std::ostringstream
msg;
292 msg <<
"Found Measurements: ";
348 if (node ==
nullptr) {
349 cxcoutWHF <<
"Input driver node is undefined, ignoring\n";
359 cxcoutIHF <<
"Creating new measurement:\n";
369 cxcoutEHF <<
"Found XML attribute in Measurement with no name.\n";
383 std::cout <<
"\n INFO: Mode attribute is deprecated and no longer supported, will ignore\n";
386 cxcoutIHF <<
"The \"ExportOnly\" attribute is ignored it is always \"true\" for any Measurement." << std::endl;
395 while (
child !=
nullptr) {
400 cxcoutEHF <<
"Found XML child node of Measurement with no name\n";
416 cxcoutEHF <<
"Error: Found tag attribute with no name in ParamSetting\n";
455 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
462 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " <<
curAttrName <<
"\n";
471 <<
" added, but no parameters are set to be fixed\n";
477 std::vector<string>
syst;
495 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
502 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " <<
curAttrName <<
"\n";
509 if (
type ==
"Gamma") {
514 }
else if (
type ==
"Uniform") {
519 }
else if (
type ==
"LogNormal") {
525 }
else if (
type ==
"NoConstraint") {
532 cxcoutEHF <<
"Error: Encountered unknown type for ConstraintTerm: " <<
type <<
"\n";
566 <<
"\" failed" << std::endl;
576 cxcoutEHF <<
"Error: In parsing a Channel XML, "
577 <<
"Encountered XML with DOCTYPE: " <<
rootNode->GetNodeName()
579 cxcoutEHF <<
" DOCTYPE for channels must be 'Channel' "
580 <<
" Check that your XML is properly written" << std::endl;
605 cxcoutEHF <<
" Error: Attribute for 'Channel' with no name found" << std::endl;
611 cxcoutIHF <<
" : creating a channel named " << channel.
GetName() << std::endl;
615 cxcoutIHF <<
"Setting InputFile for this channel: " <<
attrVal << std::endl;
622 cxcoutIHF <<
"Setting HistoPath for this channel: " <<
attrVal << std::endl;
630 cxcoutEHF <<
"Use of HistoName in Channel is deprecated" << std::endl;
631 cxcoutEHF <<
"This will be ignored" << std::endl;
635 cxcoutEHF <<
" Error: Unknown attribute for 'Channel' encountered: "
644 if( channel.
GetName().empty() ) {
645 cxcoutEHF <<
"Error: Channel created with no name" << std::endl;
658 while( node !=
nullptr ) {
665 cxcoutEHF <<
"Error: Encountered node in Channel with no name" << std::endl;
672 if( !
data.GetName().empty() ) {
673 cxcoutEHF <<
"Error: You can only rename the datasets of additional data sets. "
674 <<
" Remove the 'Name=" <<
data.GetName() <<
"' tag"
675 <<
" from channel: " << channel.
GetName() << std::endl;
697 cxcoutEHF <<
"Error: Encountered node in Channel with unknown name: " << node->
GetNodeName() << std::endl;
705 cxcoutIHF <<
"Created Channel: " << std::endl;
716 cxcoutIHF <<
"Creating Data Element" << std::endl;
735 cxcoutEHF <<
" Error: Attribute for 'Data' with no name found" << std::endl;
758 cxcoutEHF <<
" Error: Unknown attribute for 'Data' encountered: " <<
attrName << std::endl;
765 if(
data.GetInputFile().empty() ) {
766 cxcoutEHF <<
"Error: Data Node has no InputFile" << std::endl;
769 if(
data.GetHistoName().empty() ) {
770 cxcoutEHF <<
"Error: Data Node has no HistoName" << std::endl;
775 <<
" InputFile: " <<
data.GetInputFile()
776 <<
" HistoName: " <<
data.GetHistoName()
777 <<
" HistoPath: " <<
data.GetHistoPath()
778 << (!
data.GetName().empty() ?
" Name: " :
"") <<
data.GetName() << std::endl;
789 cxcoutIHF <<
"Creating StatErrorConfig Element" << std::endl;
814 cxcoutEHF <<
"Error: Bad Value for StatErrorConfig Constraint Type Found" << std::endl;
829 std::cout <<
"Invalid Stat Constraint Type: " <<
curAttr->GetValue() << std::endl;
835 cxcoutIHF <<
"Created StatErrorConfig Element with"
847 cxcoutIHF <<
"Creating Sample Element" << std::endl;
855 sample.SetNormalizeByTheory(
true );
869 cxcoutEHF <<
" Error: Attribute for 'Sample' with no name found" << std::endl;
909 cxcoutEHF <<
" Error: Unknown attribute for 'Sample' encountered: " <<
attrName << std::endl;
915 if(
sample.GetName().empty() ) {
916 cxcoutEHF <<
"Error: Sample Node has no Name" << std::endl;
919 if(
sample.GetInputFile().empty() ) {
920 cxcoutEHF <<
"Error: Sample Node has no InputFile" << std::endl;
923 if(
sample.GetHistoName().empty() ) {
924 cxcoutEHF <<
"Error: Sample Node has no HistoName" << std::endl;
933 while(
child !=
nullptr ) {
936 cxcoutEHF <<
"Error: Encountered node in Sample with no name" << std::endl;
940 else if(
child->GetNodeName() ==
TString(
"NormFactor" ) ) {
944 else if(
child->GetNodeName() ==
TString(
"OverallSys" ) ) {
948 else if(
child->GetNodeName() ==
TString(
"HistoSys" ) ) {
952 else if(
child->GetNodeName() ==
TString(
"HistoFactor" ) ) {
953 cxcoutEHF <<
"WARNING: HistoFactor not yet supported" << std::endl;
957 else if(
child->GetNodeName() ==
TString(
"ShapeSys" ) ) {
961 else if(
child->GetNodeName() ==
TString(
"ShapeFactor" ) ) {
965 else if(
child->GetNodeName() ==
TString(
"StatError" ) ) {
972 cxcoutEHF <<
"Error: Encountered node in Sample with unknown name: " <<
child->GetNodeName() << std::endl;
980 <<
" Name: " <<
sample.GetName()
981 <<
" InputFile: " <<
sample.GetInputFile()
982 <<
" HistoName: " <<
sample.GetHistoName()
983 <<
" HistoPath: " <<
sample.GetHistoPath()
994 cxcoutIHF <<
"Making NormFactor:" << std::endl;
1007 cxcoutEHF <<
"Error: Encountered Element in NormFactor with no name" << std::endl;
1025 cxcoutEHF <<
"Error: Encountered Element in NormFactor with unknown name: "
1032 if(
norm.GetName().empty() ) {
1033 cxcoutEHF <<
"Error: NormFactor Node has no Name" << std::endl;
1037 if(
norm.GetLow() >=
norm.GetHigh() ) {
1039 <<
" has lower limit >= its upper limit: "
1040 <<
" Lower: " <<
norm.GetLow()
1041 <<
" Upper: " <<
norm.GetHigh()
1042 <<
". Please Fix" << std::endl;
1047 <<
" has initial value not within its range: "
1048 <<
" Val: " <<
norm.GetVal()
1049 <<
" Lower: " <<
norm.GetLow()
1050 <<
" Upper: " <<
norm.GetHigh()
1051 <<
". Please Fix" << std::endl;
1063 cxcoutIHF <<
"Making HistoFactor" << std::endl;
1073 cxcoutIHF <<
"Made HistoFactor" << std::endl;
1082 cxcoutIHF <<
"Making HistoSys:" << std::endl;
1110 cxcoutEHF <<
"Error: Encountered Element in HistoSys with no name" << std::endl;
1139 cxcoutEHF <<
"Error: Encountered Element in HistoSys with unknown name: "
1148 cxcoutEHF <<
"Error: HistoSys Node has no Name" << std::endl;
1151 if(
histoSys.GetInputFileHigh().empty() ) {
1152 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileHigh" << std::endl;
1155 if(
histoSys.GetInputFileLow().empty() ) {
1156 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileLow" << std::endl;
1159 if(
histoSys.GetHistoNameHigh().empty() ) {
1160 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameHigh" << std::endl;
1163 if(
histoSys.GetHistoNameLow().empty() ) {
1164 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameLow" << std::endl;
1178 cxcoutIHF <<
"Making OverallSys:" << std::endl;
1191 cxcoutEHF <<
"Error: Encountered Element in OverallSys with no name" << std::endl;
1206 cxcoutEHF <<
"Error: Encountered Element in OverallSys with unknown name: "
1214 cxcoutEHF <<
"Error: Encountered OverallSys with no name" << std::endl;
1228 cxcoutIHF <<
"Making ShapeFactor" << std::endl;
1249 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with no name" << std::endl;
1273 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with unknown name: "
1281 cxcoutEHF <<
"Error: Encountered ShapeFactor with no name" << std::endl;
1290 <<
" is configured to have an initial shape, but "
1291 <<
"its histogram doesn't have a name"
1308 cxcoutIHF <<
"Making ShapeSys" << std::endl;
1330 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with no name" << std::endl;
1352 cxcoutEHF <<
"Error: ShapeSys Constraint type is empty" << std::endl;
1362 std::cout <<
"Error: Encountered unknown ShapeSys Constraint type: " <<
attrVal << std::endl;
1368 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with unknown name: "
1377 cxcoutEHF <<
"Error: Encountered ShapeSys with no Name" << std::endl;
1380 if(
shapeSys.GetInputFile().empty() ) {
1381 cxcoutEHF <<
"Error: Encountered ShapeSys with no InputFile" << std::endl;
1384 if(
shapeSys.GetHistoName().empty() ) {
1385 cxcoutEHF <<
"Error: Encountered ShapeSys with no HistoName" << std::endl;
1398 cxcoutIHF <<
"Activating StatError" << std::endl;
1416 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with no name" << std::endl;
1437 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with unknown name: "
1451 if( !
statError.GetHistoName().empty() ) {
1456 if(
statError.GetInputFile().empty() ) {
1459 if(
statError.GetHistoPath().empty() ) {
1486 cxcoutIHF <<
"Parsing FunctionConfig" << std::endl;
1493 std::string Expression;
1504 Expression =
curAttr->GetValue();
1514 cxcoutEHF <<
"Error processing PreprocessFunction: Name attribute is empty" << std::endl;
1517 if( Expression.empty() ){
1518 cxcoutEHF <<
"Error processing PreprocessFunction: Expression attribute is empty" << std::endl;
1522 cxcoutEHF <<
"Error processing PreprocessFunction: Dependents attribute is empty" << std::endl;
1557 <<
" Expected either 'True' or 'False' but found empty" << std::endl;
1561 else if (
attrVal ==
"False" ||
attrVal ==
"false" )
return false;
1564 <<
" Expected either 'True' or 'False' but found: " <<
attrVal << std::endl;
double toDouble(const char *s)
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 data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
TODO Here, we are missing some documentation.
void SetName(const std::string &name)
void SetParamValue(const std::string ¶m, double value)
void SetFixedParam(const std::string ¶m, bool constant=true)
This class encapsulates all information for the statistical interpretation of one experiment.
void SetName(const std::string &Name)
set name of channel
void Print(std::ostream &=std::cout)
void AddAdditionalData(const RooStats::HistFactory::Data &data)
add additional data object
std::string GetInputFile() const
get name of input file
std::string GetHistoPath() const
get path to histograms in input file
void SetData(const RooStats::HistFactory::Data &data)
set data object
void SetInputFile(const std::string &file)
set name of input file containing histograms
void SetStatErrorConfig(double RelErrorThreshold, Constraint::Type ConstraintType)
std::vector< RooStats::HistFactory::Sample > & GetSamples()
get vector of samples for this channel
void SetHistoPath(const std::string &file)
set path for histograms in input file
std::string GetName() const
get name of channel
bool IsAcceptableNode(TXMLNode *functionNode)
std::vector< RooStats::HistFactory::Measurement > GetMeasurementsFromXML(std::string input)
The "main" method.
HistFactory::StatErrorConfig CreateStatErrorConfigElement(TXMLNode *node)
HistFactory::StatError ActivateStatError(TXMLNode *node)
HistFactory::OverallSys MakeOverallSys(TXMLNode *node)
HistFactory::Sample CreateSampleElement(TXMLNode *node)
HistFactory::HistoSys MakeHistoSys(TXMLNode *node)
std::string m_currentInputFile
To facilitate writing xml, when not specified, files and paths default to these cached values.
HistFactory::ShapeFactor MakeShapeFactor(TXMLNode *node)
std::string m_currentChannel
bool CheckTrueFalse(std::string val, std::string Name)
RooStats::HistFactory::Measurement CreateMeasurementFromDriverNode(TXMLNode *node)
HistFactory::PreprocessFunction ParseFunctionConfig(TXMLNode *functionNode)
HistFactory::Data CreateDataElement(TXMLNode *node)
Helpers used to process a channel.
HistFactory::HistoFactor MakeHistoFactor(TXMLNode *node)
std::string m_currentHistoPath
RooStats::HistFactory::Channel ParseChannelXMLFile(std::string filen)
HistFactory::ShapeSys MakeShapeSys(TXMLNode *node)
HistFactory::NormFactor MakeNormFactor(TXMLNode *node)
Helpers used when processing a Sample.
Configuration for an *un*constrained, coherent shape variation of affected samples.
Configuration for a constrained, coherent shape variation of affected samples.
void SetInputFileHigh(const std::string &InputFileHigh)
void SetHistoPathHigh(const std::string &HistoPathHigh)
void SetInputFileLow(const std::string &InputFileLow)
void SetHistoPathLow(const std::string &HistoPathLow)
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
Configuration for an un- constrained overall systematic to scale sample normalisations.
Configuration for a constrained overall systematic to scale sample normalisations.
std::string GetCommand() const
*Un*constrained bin-by-bin variation of affected histogram.
Constrained bin-by-bin variation of affected histogram.
Configuration to automatically assign nuisance parameters for the statistical error of the Monte Carl...
void SetConstraintType(Constraint::Type ConstrType)
double GetRelErrorThreshold() const
void SetRelErrorThreshold(double Threshold)
Constraint::Type GetConstraintType() const
Statistical error of Monte Carlo predictions.
virtual const char * GetName() const
Returns name of object.
TXMLAttribute is the attribute of an Element.
TXMLDocument contains a pointer to an xmlDoc structure, after the parser returns a tree built during ...
TXMLNode contains a pointer to xmlNode, which is a node under the DOM tree.
TList * GetAttributes()
Returns a list of node's attribute if any, returns 0 if no attribute.
const char * GetText() const
Returns the content of a Text node if node is a TextNode, 0 otherwise.
TXMLNode * GetNextNode()
Returns the next sibling XMLNode in the DOM tree, if any return 0 if no next node.
TXMLNode * GetChildren()
Returns the node's child if any, returns 0 if no child.
const char * GetNodeName() const
Returns the node's name.
Namespace for the RooStats classes.