34using std::string, std::vector;
39 const std::string
delims(
"\\ ");
40 std::string::size_type
begIdx;
41 std::string::size_type
endIdx;
43 while(
begIdx!=string::npos){
57 const std::string
delims(
"\\ ");
58 std::string::size_type
begIdx;
59 std::string::size_type
endIdx;
61 while(
begIdx!=string::npos){
85 for(
unsigned int i=0; i <
string_list.size(); ++i) {
101 std::cout <<
"ASIMOV - Param Name: " <<
param_name
102 <<
" Param Val: " <<
param_val << std::endl;
131 std::cerr <<
"Loading of xml document \"" <<
input
132 <<
"\" failed" << std::endl;
145 cxcoutEHF <<
"Error: Driver DOCTYPE not equal to 'Combination'" << std::endl;
161 cxcoutEHF <<
" Error: Attribute for 'Combination' with no name found" << std::endl;
177 cxcoutEHF <<
" Error: Unknown attribute for 'Combination' encountered: "
193 while( node !=
nullptr ) {
195 if( node->
GetText() ==
nullptr ) {
197 <<
" has no text." << std::endl;
207 std::cerr <<
"no input channels found" << std::endl;
212 std::ostringstream
msg;
213 msg <<
"Found Channels: ";
227 std::vector< RooStats::HistFactory::PreprocessFunction >
functionObjects;
230 while( node !=
nullptr ) {
242 std::cout << std::endl;
247 while( node !=
nullptr ) {
250 cxcoutEHF <<
"Error: Node found in Measurement Driver XML with no name" << std::endl;
274 cxcoutEHF <<
"Error: Unknown node found in Measurement Driver XML: "
282 cxcoutIHF <<
"Done Processing Measurements" << std::endl;
285 cxcoutEHF <<
"Error: No Measurements found in XML Driver File" << std::endl;
289 std::ostringstream
msg;
290 msg <<
"Found Measurements: ";
346 if (node ==
nullptr) {
347 cxcoutWHF <<
"Input driver node is undefined, ignoring\n";
357 cxcoutIHF <<
"Creating new measurement:\n";
367 cxcoutEHF <<
"Found XML attribute in Measurement with no name.\n";
381 std::cout <<
"\n INFO: Mode attribute is deprecated and no longer supported, will ignore\n";
384 cxcoutIHF <<
"The \"ExportOnly\" attribute is ignored it is always \"true\" for any Measurement." << std::endl;
393 while (
child !=
nullptr) {
398 cxcoutEHF <<
"Found XML child node of Measurement with no name\n";
414 cxcoutEHF <<
"Error: Found tag attribute with no name in ParamSetting\n";
426 double val = atof(
curParam->GetValue());
453 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
460 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " <<
curAttrName <<
"\n";
469 <<
" added, but no parameters are set to be fixed\n";
475 std::vector<string>
syst;
493 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
500 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " <<
curAttrName <<
"\n";
507 if (
type ==
"Gamma") {
512 }
else if (
type ==
"Uniform") {
517 }
else if (
type ==
"LogNormal") {
523 }
else if (
type ==
"NoConstraint") {
530 cxcoutEHF <<
"Error: Encountered unknown type for ConstraintTerm: " <<
type <<
"\n";
564 <<
"\" failed" << std::endl;
574 cxcoutEHF <<
"Error: In parsing a Channel XML, "
575 <<
"Encountered XML with DOCTYPE: " <<
rootNode->GetNodeName()
577 cxcoutEHF <<
" DOCTYPE for channels must be 'Channel' "
578 <<
" Check that your XML is properly written" << std::endl;
603 cxcoutEHF <<
" Error: Attribute for 'Channel' with no name found" << std::endl;
609 cxcoutIHF <<
" : creating a channel named " << channel.
GetName() << std::endl;
613 cxcoutIHF <<
"Setting InputFile for this channel: " <<
attrVal << std::endl;
620 cxcoutIHF <<
"Setting HistoPath for this channel: " <<
attrVal << std::endl;
628 cxcoutEHF <<
"Use of HistoName in Channel is deprecated" << std::endl;
629 cxcoutEHF <<
"This will be ignored" << std::endl;
633 cxcoutEHF <<
" Error: Unknown attribute for 'Channel' encountered: "
642 if( channel.
GetName().empty() ) {
643 cxcoutEHF <<
"Error: Channel created with no name" << std::endl;
656 while( node !=
nullptr ) {
663 cxcoutEHF <<
"Error: Encountered node in Channel with no name" << std::endl;
670 if( !
data.GetName().empty() ) {
671 cxcoutEHF <<
"Error: You can only rename the datasets of additional data sets. "
672 <<
" Remove the 'Name=" <<
data.GetName() <<
"' tag"
673 <<
" from channel: " << channel.
GetName() << std::endl;
695 cxcoutEHF <<
"Error: Encountered node in Channel with unknown name: " << node->
GetNodeName() << std::endl;
703 cxcoutIHF <<
"Created Channel: " << std::endl;
714 cxcoutIHF <<
"Creating Data Element" << std::endl;
733 cxcoutEHF <<
" Error: Attribute for 'Data' with no name found" << std::endl;
756 cxcoutEHF <<
" Error: Unknown attribute for 'Data' encountered: " <<
attrName << std::endl;
763 if(
data.GetInputFile().empty() ) {
764 cxcoutEHF <<
"Error: Data Node has no InputFile" << std::endl;
767 if(
data.GetHistoName().empty() ) {
768 cxcoutEHF <<
"Error: Data Node has no HistoName" << std::endl;
773 <<
" InputFile: " <<
data.GetInputFile()
774 <<
" HistoName: " <<
data.GetHistoName()
775 <<
" HistoPath: " <<
data.GetHistoPath()
776 << (!
data.GetName().empty() ?
" Name: " :
"") <<
data.GetName() << std::endl;
787 cxcoutIHF <<
"Creating StatErrorConfig Element" << std::endl;
812 cxcoutEHF <<
"Error: Bad Value for StatErrorConfig Constraint Type Found" << std::endl;
827 std::cout <<
"Invalid Stat Constraint Type: " <<
curAttr->GetValue() << std::endl;
833 cxcoutIHF <<
"Created StatErrorConfig Element with"
845 cxcoutIHF <<
"Creating Sample Element" << std::endl;
853 sample.SetNormalizeByTheory(
true );
867 cxcoutEHF <<
" Error: Attribute for 'Sample' with no name found" << std::endl;
907 cxcoutEHF <<
" Error: Unknown attribute for 'Sample' encountered: " <<
attrName << std::endl;
913 if(
sample.GetName().empty() ) {
914 cxcoutEHF <<
"Error: Sample Node has no Name" << std::endl;
917 if(
sample.GetInputFile().empty() ) {
918 cxcoutEHF <<
"Error: Sample Node has no InputFile" << std::endl;
921 if(
sample.GetHistoName().empty() ) {
922 cxcoutEHF <<
"Error: Sample Node has no HistoName" << std::endl;
931 while(
child !=
nullptr ) {
934 cxcoutEHF <<
"Error: Encountered node in Sample with no name" << std::endl;
938 else if(
child->GetNodeName() ==
TString(
"NormFactor" ) ) {
942 else if(
child->GetNodeName() ==
TString(
"OverallSys" ) ) {
946 else if(
child->GetNodeName() ==
TString(
"HistoSys" ) ) {
950 else if(
child->GetNodeName() ==
TString(
"HistoFactor" ) ) {
951 cxcoutEHF <<
"WARNING: HistoFactor not yet supported" << std::endl;
955 else if(
child->GetNodeName() ==
TString(
"ShapeSys" ) ) {
959 else if(
child->GetNodeName() ==
TString(
"ShapeFactor" ) ) {
963 else if(
child->GetNodeName() ==
TString(
"StatError" ) ) {
970 cxcoutEHF <<
"Error: Encountered node in Sample with unknown name: " <<
child->GetNodeName() << std::endl;
978 <<
" Name: " <<
sample.GetName()
979 <<
" InputFile: " <<
sample.GetInputFile()
980 <<
" HistoName: " <<
sample.GetHistoName()
981 <<
" HistoPath: " <<
sample.GetHistoPath()
992 cxcoutIHF <<
"Making NormFactor:" << std::endl;
1005 cxcoutEHF <<
"Error: Encountered Element in NormFactor with no name" << std::endl;
1023 cxcoutEHF <<
"Error: Encountered Element in NormFactor with unknown name: "
1030 if(
norm.GetName().empty() ) {
1031 cxcoutEHF <<
"Error: NormFactor Node has no Name" << std::endl;
1035 if(
norm.GetLow() >=
norm.GetHigh() ) {
1037 <<
" has lower limit >= its upper limit: "
1038 <<
" Lower: " <<
norm.GetLow()
1039 <<
" Upper: " <<
norm.GetHigh()
1040 <<
". Please Fix" << std::endl;
1045 <<
" has initial value not within its range: "
1046 <<
" Val: " <<
norm.GetVal()
1047 <<
" Lower: " <<
norm.GetLow()
1048 <<
" Upper: " <<
norm.GetHigh()
1049 <<
". Please Fix" << std::endl;
1061 cxcoutIHF <<
"Making HistoFactor" << std::endl;
1071 cxcoutIHF <<
"Made HistoFactor" << std::endl;
1080 cxcoutIHF <<
"Making HistoSys:" << std::endl;
1108 cxcoutEHF <<
"Error: Encountered Element in HistoSys with no name" << std::endl;
1137 cxcoutEHF <<
"Error: Encountered Element in HistoSys with unknown name: "
1146 cxcoutEHF <<
"Error: HistoSys Node has no Name" << std::endl;
1149 if(
histoSys.GetInputFileHigh().empty() ) {
1150 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileHigh" << std::endl;
1153 if(
histoSys.GetInputFileLow().empty() ) {
1154 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileLow" << std::endl;
1157 if(
histoSys.GetHistoNameHigh().empty() ) {
1158 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameHigh" << std::endl;
1161 if(
histoSys.GetHistoNameLow().empty() ) {
1162 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameLow" << std::endl;
1176 cxcoutIHF <<
"Making OverallSys:" << std::endl;
1189 cxcoutEHF <<
"Error: Encountered Element in OverallSys with no name" << std::endl;
1204 cxcoutEHF <<
"Error: Encountered Element in OverallSys with unknown name: "
1212 cxcoutEHF <<
"Error: Encountered OverallSys with no name" << std::endl;
1226 cxcoutIHF <<
"Making ShapeFactor" << std::endl;
1247 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with no name" << std::endl;
1271 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with unknown name: "
1279 cxcoutEHF <<
"Error: Encountered ShapeFactor with no name" << std::endl;
1288 <<
" is configured to have an initial shape, but "
1289 <<
"its histogram doesn't have a name"
1306 cxcoutIHF <<
"Making ShapeSys" << std::endl;
1328 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with no name" << std::endl;
1350 cxcoutEHF <<
"Error: ShapeSys Constraint type is empty" << std::endl;
1360 std::cout <<
"Error: Encountered unknown ShapeSys Constraint type: " <<
attrVal << std::endl;
1366 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with unknown name: "
1375 cxcoutEHF <<
"Error: Encountered ShapeSys with no Name" << std::endl;
1378 if(
shapeSys.GetInputFile().empty() ) {
1379 cxcoutEHF <<
"Error: Encountered ShapeSys with no InputFile" << std::endl;
1382 if(
shapeSys.GetHistoName().empty() ) {
1383 cxcoutEHF <<
"Error: Encountered ShapeSys with no HistoName" << std::endl;
1396 cxcoutIHF <<
"Activating StatError" << std::endl;
1414 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with no name" << std::endl;
1435 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with unknown name: "
1449 if( !
statError.GetHistoName().empty() ) {
1454 if(
statError.GetInputFile().empty() ) {
1457 if(
statError.GetHistoPath().empty() ) {
1484 cxcoutIHF <<
"Parsing FunctionConfig" << std::endl;
1491 std::string Expression;
1502 Expression =
curAttr->GetValue();
1512 cxcoutEHF <<
"Error processing PreprocessFunction: Name attribute is empty" << std::endl;
1515 if( Expression.empty() ){
1516 cxcoutEHF <<
"Error processing PreprocessFunction: Expression attribute is empty" << std::endl;
1520 cxcoutEHF <<
"Error processing PreprocessFunction: Dependents attribute is empty" << std::endl;
1555 <<
" Expected either 'True' or 'False' but found empty" << std::endl;
1559 else if (
attrVal ==
"False" ||
attrVal ==
"false" )
return false;
1562 <<
" Expected either 'True' or 'False' but found: " <<
attrVal << std::endl;
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.