34using std::string, std::cerr, std::cout, std::endl, 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 cerr <<
"no input channels found" << 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 cout <<
"\n INFO: Mode attribute is deprecated and no longer supported, will ignore\n";
392 while (
child !=
nullptr) {
397 cxcoutEHF <<
"Found XML child node of Measurement with no name\n";
413 cxcoutEHF <<
"Error: Found tag attribute with no name in ParamSetting\n";
425 double val = atof(
curParam->GetValue());
452 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
459 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " <<
curAttrName <<
"\n";
468 <<
" added, but no parameters are set to be fixed\n";
474 std::vector<string>
syst;
492 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
499 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " <<
curAttrName <<
"\n";
506 if (
type ==
"Gamma") {
511 }
else if (
type ==
"Uniform") {
516 }
else if (
type ==
"LogNormal") {
522 }
else if (
type ==
"NoConstraint") {
529 cxcoutEHF <<
"Error: Encountered unknown type for ConstraintTerm: " <<
type <<
"\n";
563 <<
"\" failed" << std::endl;
573 cxcoutEHF <<
"Error: In parsing a Channel XML, "
574 <<
"Encountered XML with DOCTYPE: " <<
rootNode->GetNodeName()
576 cxcoutEHF <<
" DOCTYPE for channels must be 'Channel' "
577 <<
" Check that your XML is properly written" << std::endl;
602 cxcoutEHF <<
" Error: Attribute for 'Channel' with no name found" << std::endl;
608 cxcoutIHF <<
" : creating a channel named " << channel.
GetName() << std::endl;
612 cxcoutIHF <<
"Setting InputFile for this channel: " <<
attrVal << std::endl;
619 cxcoutIHF <<
"Setting HistoPath for this channel: " <<
attrVal << std::endl;
627 cxcoutEHF <<
"Use of HistoName in Channel is deprecated" << std::endl;
628 cxcoutEHF <<
"This will be ignored" << std::endl;
632 cxcoutEHF <<
" Error: Unknown attribute for 'Channel' encountered: "
641 if( channel.
GetName().empty() ) {
642 cxcoutEHF <<
"Error: Channel created with no name" << std::endl;
655 while( node !=
nullptr ) {
662 cxcoutEHF <<
"Error: Encountered node in Channel with no name" << std::endl;
669 if( !
data.GetName().empty() ) {
670 cxcoutEHF <<
"Error: You can only rename the datasets of additional data sets. "
671 <<
" Remove the 'Name=" <<
data.GetName() <<
"' tag"
672 <<
" from channel: " << channel.
GetName() << std::endl;
694 cxcoutEHF <<
"Error: Encountered node in Channel with unknown name: " << node->
GetNodeName() << std::endl;
702 cxcoutIHF <<
"Created Channel: " << std::endl;
713 cxcoutIHF <<
"Creating Data Element" << std::endl;
732 cxcoutEHF <<
" Error: Attribute for 'Data' with no name found" << std::endl;
755 cxcoutEHF <<
" Error: Unknown attribute for 'Data' encountered: " <<
attrName << std::endl;
762 if(
data.GetInputFile().empty() ) {
763 cxcoutEHF <<
"Error: Data Node has no InputFile" << std::endl;
766 if(
data.GetHistoName().empty() ) {
767 cxcoutEHF <<
"Error: Data Node has no HistoName" << std::endl;
772 <<
" InputFile: " <<
data.GetInputFile()
773 <<
" HistoName: " <<
data.GetHistoName()
774 <<
" HistoPath: " <<
data.GetHistoPath()
775 << (!
data.GetName().empty() ?
" Name: " :
"") <<
data.GetName() << std::endl;
786 cxcoutIHF <<
"Creating StatErrorConfig Element" << std::endl;
811 cxcoutEHF <<
"Error: Bad Value for StatErrorConfig Constraint Type Found" << std::endl;
826 cout <<
"Invalid Stat Constraint Type: " <<
curAttr->GetValue() << endl;
832 cxcoutIHF <<
"Created StatErrorConfig Element with"
844 cxcoutIHF <<
"Creating Sample Element" << std::endl;
852 sample.SetNormalizeByTheory(
true );
866 cxcoutEHF <<
" Error: Attribute for 'Sample' with no name found" << std::endl;
906 cxcoutEHF <<
" Error: Unknown attribute for 'Sample' encountered: " <<
attrName << std::endl;
912 if(
sample.GetName().empty() ) {
913 cxcoutEHF <<
"Error: Sample Node has no Name" << std::endl;
916 if(
sample.GetInputFile().empty() ) {
917 cxcoutEHF <<
"Error: Sample Node has no InputFile" << std::endl;
920 if(
sample.GetHistoName().empty() ) {
921 cxcoutEHF <<
"Error: Sample Node has no HistoName" << std::endl;
930 while(
child !=
nullptr ) {
933 cxcoutEHF <<
"Error: Encountered node in Sample with no name" << std::endl;
937 else if(
child->GetNodeName() ==
TString(
"NormFactor" ) ) {
941 else if(
child->GetNodeName() ==
TString(
"OverallSys" ) ) {
945 else if(
child->GetNodeName() ==
TString(
"HistoSys" ) ) {
949 else if(
child->GetNodeName() ==
TString(
"HistoFactor" ) ) {
950 cxcoutEHF <<
"WARNING: HistoFactor not yet supported" << std::endl;
954 else if(
child->GetNodeName() ==
TString(
"ShapeSys" ) ) {
958 else if(
child->GetNodeName() ==
TString(
"ShapeFactor" ) ) {
962 else if(
child->GetNodeName() ==
TString(
"StatError" ) ) {
969 cxcoutEHF <<
"Error: Encountered node in Sample with unknown name: " <<
child->GetNodeName() << std::endl;
977 <<
" Name: " <<
sample.GetName()
978 <<
" InputFile: " <<
sample.GetInputFile()
979 <<
" HistoName: " <<
sample.GetHistoName()
980 <<
" HistoPath: " <<
sample.GetHistoPath()
991 cxcoutIHF <<
"Making NormFactor:" << std::endl;
1004 cxcoutEHF <<
"Error: Encountered Element in NormFactor with no name" << std::endl;
1022 cxcoutEHF <<
"Error: Encountered Element in NormFactor with unknown name: "
1029 if(
norm.GetName().empty() ) {
1030 cxcoutEHF <<
"Error: NormFactor Node has no Name" << std::endl;
1034 if(
norm.GetLow() >=
norm.GetHigh() ) {
1036 <<
" has lower limit >= its upper limit: "
1037 <<
" Lower: " <<
norm.GetLow()
1038 <<
" Upper: " <<
norm.GetHigh()
1039 <<
". Please Fix" << std::endl;
1044 <<
" has initial value not within its range: "
1045 <<
" Val: " <<
norm.GetVal()
1046 <<
" Lower: " <<
norm.GetLow()
1047 <<
" Upper: " <<
norm.GetHigh()
1048 <<
". Please Fix" << std::endl;
1060 cxcoutIHF <<
"Making HistoFactor" << std::endl;
1070 cxcoutIHF <<
"Made HistoFactor" << std::endl;
1079 cxcoutIHF <<
"Making HistoSys:" << std::endl;
1107 cxcoutEHF <<
"Error: Encountered Element in HistoSys with no name" << std::endl;
1136 cxcoutEHF <<
"Error: Encountered Element in HistoSys with unknown name: "
1145 cxcoutEHF <<
"Error: HistoSys Node has no Name" << std::endl;
1148 if(
histoSys.GetInputFileHigh().empty() ) {
1149 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileHigh" << std::endl;
1152 if(
histoSys.GetInputFileLow().empty() ) {
1153 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileLow" << std::endl;
1156 if(
histoSys.GetHistoNameHigh().empty() ) {
1157 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameHigh" << std::endl;
1160 if(
histoSys.GetHistoNameLow().empty() ) {
1161 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameLow" << std::endl;
1175 cxcoutIHF <<
"Making OverallSys:" << std::endl;
1188 cxcoutEHF <<
"Error: Encountered Element in OverallSys with no name" << std::endl;
1203 cxcoutEHF <<
"Error: Encountered Element in OverallSys with unknown name: "
1211 cxcoutEHF <<
"Error: Encountered OverallSys with no name" << std::endl;
1225 cxcoutIHF <<
"Making ShapeFactor" << std::endl;
1246 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with no name" << std::endl;
1270 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with unknown name: "
1278 cxcoutEHF <<
"Error: Encountered ShapeFactor with no name" << std::endl;
1287 <<
" is configured to have an initial shape, but "
1288 <<
"its histogram doesn't have a name"
1305 cxcoutIHF <<
"Making ShapeSys" << std::endl;
1327 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with no name" << std::endl;
1349 cxcoutEHF <<
"Error: ShapeSys Constraint type is empty" << std::endl;
1359 cout <<
"Error: Encountered unknown ShapeSys Constraint type: " <<
attrVal << endl;
1365 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with unknown name: "
1374 cxcoutEHF <<
"Error: Encountered ShapeSys with no Name" << std::endl;
1377 if(
shapeSys.GetInputFile().empty() ) {
1378 cxcoutEHF <<
"Error: Encountered ShapeSys with no InputFile" << std::endl;
1381 if(
shapeSys.GetHistoName().empty() ) {
1382 cxcoutEHF <<
"Error: Encountered ShapeSys with no HistoName" << std::endl;
1395 cxcoutIHF <<
"Activating StatError" << std::endl;
1413 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with no name" << std::endl;
1434 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with unknown name: "
1448 if( !
statError.GetHistoName().empty() ) {
1453 if(
statError.GetInputFile().empty() ) {
1456 if(
statError.GetHistoPath().empty() ) {
1483 cxcoutIHF <<
"Parsing FunctionConfig" << std::endl;
1490 std::string Expression;
1501 Expression =
curAttr->GetValue();
1511 cxcoutEHF <<
"Error processing PreprocessFunction: Name attribute is empty" << std::endl;
1514 if( Expression.empty() ){
1515 cxcoutEHF <<
"Error processing PreprocessFunction: Expression attribute is empty" << std::endl;
1519 cxcoutEHF <<
"Error processing PreprocessFunction: Dependents attribute is empty" << std::endl;
1554 <<
" Expected either 'True' or 'False' but found empty" << std::endl;
1558 else if (
attrVal ==
"False" ||
attrVal ==
"false" )
return false;
1561 <<
" 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.