27using namespace HistFactory;
31std::vector< RooStats::HistFactory::Measurement > ConfigParser::GetMeasurementsFromXML(
string input ) {
41 std::vector< HistFactory::Measurement > measurement_list;
49 std::cerr <<
"Loading of xml document \"" << input
50 <<
"\" failed" << std::endl;
56 cout <<
"reading input : " << input << endl;
62 if( rootNode->
GetNodeName() != TString(
"Combination" ) ){
63 std::cout <<
"Error: Driver DOCTYPE not equal to 'Combination'" << std::endl;
68 std::string OutputFilePrefix;
72 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
75 TString attrName = curAttr->
GetName();
76 std::string attrVal = curAttr->
GetValue();
78 if( attrName == TString(
"" ) ) {
79 std::cout <<
" Error: Attribute for 'Combination' with no name found" << std::endl;
83 else if( attrName == TString(
"OutputFilePrefix" ) ) {
84 OutputFilePrefix = string(curAttr->
GetValue());
85 std::cout <<
"output file prefix is : " << OutputFilePrefix << endl;
95 std::cout <<
" Error: Unknown attribute for 'Combination' encountered: "
96 << attrName << std::endl;
109 std::vector< std::string > xml_channel_files;
113 if( node->
GetText() == NULL ) {
114 std::cout <<
"Error: node: " << node->
GetName()
115 <<
" has no text." << std::endl;
118 xml_channel_files.push_back(node->
GetText());
124 if(xml_channel_files.empty()){
125 cerr <<
"no input channels found" << endl;
130 std::cout <<
"Found Channels: ";
131 for(
unsigned int i=0; i < xml_channel_files.size(); ++i ) std::cout <<
" " << xml_channel_files.at(i);
132 std::cout << std::endl;
144 std::vector< RooStats::HistFactory::PreprocessFunction > functionObjects;
148 if( node->
GetNodeName() == TString(
"Function" ) ) {
154 functionObjects.push_back( Func );
159 std::cout << std::endl;
167 std::cout <<
"Error: Node found in Measurement Driver XML with no name" << std::endl;
171 else if( node->
GetNodeName() == TString(
"Measurement" ) ) {
175 measurement_list.push_back( measurement );
178 else if( node->
GetNodeName() == TString(
"Function" ) ) {
183 else if( node->
GetNodeName() == TString(
"Input" ) ) {
191 std::cout <<
"Error: Unknown node found in Measurement Driver XML: "
199 std::cout <<
"Done Processing Measurements" << std::endl;
201 if( measurement_list.size() == 0 ) {
202 std::cout <<
"Error: No Measurements found in XML Driver File" << std::endl;
206 std::cout <<
"Found Measurements: ";
207 for(
unsigned int i=0; i < measurement_list.size(); ++i ) std::cout <<
" " << measurement_list.at(i).GetName();
208 std::cout << std::endl;
216 for(
unsigned int i = 0; i < measurement_list.size(); ++i) {
217 measurement_list.at(i).SetFunctionObjects( functionObjects );
227 std::vector< HistFactory::Channel > channel_list;
230 for(
unsigned int i = 0; i < xml_channel_files.size(); ++i ) {
231 std::string channel_xml = xml_channel_files.at(i);
232 std::cout <<
"Parsing Channel: " << channel_xml << std::endl;
238 channel_list.push_back( channel );
242 for(
unsigned int i = 0; i < measurement_list.size(); ++i) {
246 for(
unsigned int j = 0; j < channel_list.size(); ++j ) {
247 measurement.
GetChannels().push_back( channel_list.at(j) );
251 catch(std::exception&
e)
253 std::cout <<
e.what() << std::endl;
257 return measurement_list;
274 std::cout <<
"Creating new measurement: " << std::endl;
279 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
281 if( curAttr->
GetName() == TString(
"" ) ) {
282 std::cout <<
"Found XML attribute in Measurement with no name" << std::endl;
286 else if( curAttr->
GetName() == TString(
"Name" ) ) {
291 else if( curAttr->
GetName() == TString(
"Lumi" ) ) {
294 else if( curAttr->
GetName() == TString(
"LumiRelErr" ) ) {
297 else if( curAttr->
GetName() == TString(
"BinLow" ) ) {
300 else if( curAttr->
GetName() == TString(
"BinHigh" ) ) {
303 else if( curAttr->
GetName() == TString(
"Mode" ) ) {
304 cout <<
"\n INFO: Mode attribute is deprecated, will ignore\n"<<endl;
306 else if( curAttr->
GetName() == TString(
"ExportOnly" ) ) {
311 std::cout <<
"Found unknown XML attribute in Measurement: " << curAttr->
GetName()
321 while( child != 0 ) {
324 std::cout <<
"Found XML child node of Measurement with no name" << std::endl;
328 else if( child->
GetNodeName() == TString(
"POI" ) ) {
329 if( child->
GetText() == NULL ) {
330 std::cout <<
"Error: node: " << child->
GetName()
331 <<
" has no text." << std::endl;
338 else if( child->
GetNodeName() == TString(
"ParamSetting" ) ) {
341 while( ( curParam =
dynamic_cast< TXMLAttr*
>( paramIt() ) ) != 0 ) {
343 if( curParam->
GetName() == TString(
"" ) ) {
344 std::cout <<
"Error: Found tag attribute with no name in ParamSetting" << std::endl;
347 else if( curParam->
GetName() == TString(
"Const" ) ) {
348 if(curParam->
GetValue()==TString(
"True")){
350 if( child->
GetText() == NULL ) {
351 std::cout <<
"Error: node: " << child->
GetName()
352 <<
" has no text." << std::endl;
358 else if( curParam->
GetName() == TString(
"Val" ) ) {
359 double val = atof(curParam->
GetValue());
360 if( child->
GetText() == NULL ) {
361 std::cout <<
"Error: node: " << child->
GetName()
362 <<
" has no text." << std::endl;
366 for(
unsigned int i = 0; i < child_nodes.size(); ++i) {
372 std::cout <<
"Found tag attribute with unknown name in ParamSetting: "
373 << curAttr->
GetName() << std::endl;
379 else if( child->
GetNodeName() == TString(
"Asimov" ) ) {
387 std::string ParamFixString;
392 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
394 if( curAttr->
GetName() == TString(
"" ) ) {
395 std::cout <<
"Error: Found tag attribute with no name in ConstraintTerm" << std::endl;
399 else if( curAttr->
GetName() == TString(
"Name" ) ) {
404 else if( curAttr->
GetName() == TString(
"FixParams" ) ) {
405 ParamFixString = curAttr->
GetValue();
411 std::cout <<
"Found tag attribute with unknown name in ConstraintTerm: "
412 << curAttr->
GetName() << std::endl;
420 if( ParamFixString==
"" ) {
421 std::cout <<
"Warning: Asimov Dataset with name: " << asimov.
GetName()
422 <<
" added, but no parameters are set to be fixed" << std::endl;
432 else if( child->
GetNodeName() == TString(
"ConstraintTerm" ) ) {
437 map<string,double> gammaSyst;
438 map<string,double> uniformSyst;
439 map<string,double> logNormSyst;
442 if( child->
GetText() == NULL ) {
443 std::cout <<
"Error: node: " << child->
GetName()
444 <<
" has no text." << std::endl;
452 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
454 if( curAttr->
GetName() == TString(
"" ) ) {
455 std::cout <<
"Error: Found tag attribute with no name in ConstraintTerm" << std::endl;
459 else if( curAttr->
GetName() == TString(
"Type" ) ) {
463 else if( curAttr->
GetName() == TString(
"RelativeUncertainty" ) ) {
468 std::cout <<
"Found tag attribute with unknown name in ConstraintTerm: "
469 << curAttr->
GetName() << std::endl;
479 if( ! (
type==
"Gamma" ||
type==
"Uniform" ||
480 type==
"LogNormal" ||
type==
"NoConstraint") ) {
481 std::cout <<
"Error: Encountered unknown type for ConstraintTerm: " <<
type << std::endl;
485 if (
type==
"Gamma" && rel!=0) {
486 for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); ++it) {
492 if (
type==
"Uniform" && rel!=0) {
493 for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); ++it) {
499 if (
type==
"LogNormal" && rel!=0) {
500 for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); ++it) {
506 if (
type==
"NoConstraint") {
507 for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); ++it) {
509 measurement.
GetNoSyst()[(*it).c_str()] = 1.0;
518 std::cout <<
"Found XML child of Measurement with unknown name: " << child->
GetNodeName()
527 std::cout << std::endl;
543 std::cout <<
"Parsing file: " << filen ;
550 std::cout <<
"Loading of xml document \"" << filen
551 <<
"\" failed" << std::endl;
560 if( rootNode->
GetNodeName() != TString(
"Channel" ) ){
561 std::cout <<
"Error: In parsing a Channel XML, "
562 <<
"Encounterd XML with DOCTYPE: " << rootNode->
GetNodeName()
564 std::cout <<
" DOCTYPE for channels must be 'Channel' "
565 <<
" Check that your XML is properly written" << std::endl;
583 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
586 TString attrName = curAttr->
GetName();
587 std::string attrVal = curAttr->
GetValue();
589 if( attrName == TString(
"" ) ) {
590 std::cout <<
" Error: Attribute for 'Channel' with no name found" << std::endl;
594 else if( attrName == TString(
"Name" ) ) {
596 std::cout <<
" : creating a channel named " << channel.
GetName() << std::endl;
599 else if( attrName == TString(
"InputFile" ) ) {
600 std::cout <<
"Setting InputFile for this channel: " << attrVal << std::endl;
606 else if( curAttr->
GetName() == TString(
"HistoPath" ) ) {
607 std::cout <<
"Setting HistoPath for this channel: " << attrVal << std::endl;
613 else if( curAttr->
GetName() == TString(
"HistoName" ) ) {
615 std::cout <<
"Use of HistoName in Channel is deprecated" << std::endl;
616 std::cout <<
"This will be ignored" << std::endl;
620 std::cout <<
" Error: Unknown attribute for 'Channel' encountered: "
621 << attrName << std::endl;
629 if( channel.
GetName() ==
"" ) {
630 std::cout <<
"Error: Channel created with no name" << std::endl;
650 std::cout <<
"Error: Encountered node in Channel with no name" << std::endl;
654 else if( node->
GetNodeName() == TString(
"Data" ) ) {
657 if(
data.GetName() !=
"" ) {
658 std::cout <<
"Error: You can only rename the datasets of additional data sets. "
659 <<
" Remove the 'Name=" <<
data.GetName() <<
"' tag"
660 <<
" from channel: " << channel.
GetName() << std::endl;
671 else if( node->
GetNodeName() == TString(
"StatErrorConfig" ) ) {
675 else if( node->
GetNodeName() == TString(
"Sample" ) ) {
682 std::cout <<
"Error: Encountered node in Channel with unknown name: " << node->
GetNodeName() << std::endl;
690 std::cout <<
"Created Channel: " << std::endl;
701 std::cout <<
"Creating Data Element" << std::endl;
713 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
716 TString attrName = curAttr->
GetName();
717 std::string attrVal = curAttr->
GetValue();
719 if( attrName == TString(
"" ) ) {
720 std::cout <<
" Error: Attribute for 'Data' with no name found" << std::endl;
724 else if( attrName == TString(
"Name" ) ) {
725 data.SetName( attrVal );
728 else if( attrName == TString(
"InputFile" ) ) {
729 data.SetInputFile( attrVal );
732 else if( attrName == TString(
"HistoName" ) ) {
733 data.SetHistoName( attrVal );
736 else if( attrName == TString(
"HistoPath" ) ) {
737 data.SetHistoPath( attrVal );
743 std::cout <<
" Error: Unknown attribute for 'Data' encountered: " << attrName << std::endl;
750 if(
data.GetInputFile() ==
"" ) {
751 std::cout <<
"Error: Data Node has no InputFile" << std::endl;
754 if(
data.GetHistoName() ==
"" ) {
755 std::cout <<
"Error: Data Node has no HistoName" << std::endl;
759 std::cout <<
"Created Data Node with"
760 <<
" InputFile: " <<
data.GetInputFile()
761 <<
" HistoName: " <<
data.GetHistoName()
762 <<
" HistoPath: " <<
data.GetHistoPath();
763 if(
data.GetName() !=
"") std::cout <<
" Name: " <<
data.GetName();
764 std::cout << std::endl;
775 std::cout <<
"Creating StatErrorConfig Element" << std::endl;
786 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
789 TString attrName = curAttr->
GetName();
790 std::string attrVal = curAttr->
GetValue();
792 if( attrName == TString(
"RelErrorThreshold" ) ) {
796 if( attrName == TString(
"ConstraintType" ) ) {
799 if( attrVal ==
"" ) {
800 std::cout <<
"Error: Bad Value for StatErrorConfig Constraint Type Found" << std::endl;
804 else if( attrVal==
"Gaussian" || attrVal==
"Gauss" ) {
808 else if( attrVal==
"Poisson" || attrVal==
"Pois" ) {
815 cout <<
"Invalid Stat Constraint Type: " << curAttr->
GetValue() << endl;
821 std::cout <<
"Created StatErrorConfig Element with"
833 std::cout <<
"Creating Sample Element" << std::endl;
848 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
851 TString attrName = curAttr->
GetName();
852 std::string attrVal = curAttr->
GetValue();
854 if( attrName == TString(
"" ) ) {
855 std::cout <<
" Error: Attribute for 'Sample' with no name found" << std::endl;
859 else if( attrName == TString(
"Name" ) ) {
863 else if( attrName == TString(
"InputFile" ) ) {
868 else if( attrName == TString(
"HistoName" ) ) {
872 else if( attrName == TString(
"HistoPath" ) ) {
877 else if( attrName == TString(
"NormalizeByTheory" ) ) {
895 std::cout <<
" Error: Unknown attribute for 'Sample' encountered: " << attrName << std::endl;
902 std::cout <<
"Error: Sample Node has no Name" << std::endl;
906 std::cout <<
"Error: Sample Node has no InputFile" << std::endl;
910 std::cout <<
"Error: Sample Node has no HistoName" << std::endl;
919 while( child != 0 ) {
922 std::cout <<
"Error: Encountered node in Sample with no name" << std::endl;
926 else if( child->
GetNodeName() == TString(
"NormFactor" ) ) {
930 else if( child->
GetNodeName() == TString(
"OverallSys" ) ) {
934 else if( child->
GetNodeName() == TString(
"HistoSys" ) ) {
938 else if( child->
GetNodeName() == TString(
"HistoFactor" ) ) {
939 std::cout <<
"WARNING: HistoFactor not yet supported" << std::endl;
943 else if( child->
GetNodeName() == TString(
"ShapeSys" ) ) {
947 else if( child->
GetNodeName() == TString(
"ShapeFactor" ) ) {
951 else if( child->
GetNodeName() == TString(
"StatError" ) ) {
958 std::cout <<
"Error: Encountered node in Sample with unknown name: " << child->
GetNodeName() << std::endl;
965 std::cout <<
"Created Sample Node with"
966 <<
" Name: " << sample.
GetName()
980 std::cout <<
"Making NormFactor:" << std::endl;
986 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
989 TString attrName = curAttr->
GetName();
990 std::string attrVal = curAttr->
GetValue();
992 if( attrName == TString(
"" ) ){
993 std::cout <<
"Error: Encountered Element in NormFactor with no name" << std::endl;
997 else if( curAttr->
GetName() == TString(
"Name" ) ) {
1000 else if( curAttr->
GetName() == TString(
"Val" ) ) {
1001 norm.
SetVal( atof(attrVal.c_str()) );
1003 else if( curAttr->
GetName() == TString(
"Low" ) ) {
1004 norm.
SetLow( atof(attrVal.c_str()) );
1006 else if( curAttr->
GetName() == TString(
"High" ) ) {
1007 norm.
SetHigh( atof(attrVal.c_str()) );
1009 else if( curAttr->
GetName() == TString(
"Const" ) ) {
1014 std::cout <<
"Error: Encountered Element in NormFactor with unknown name: "
1015 << attrName << std::endl;
1022 std::cout <<
"Error: NormFactor Node has no Name" << std::endl;
1027 std::cout <<
"Error: NormFactor: " << norm.
GetName()
1028 <<
" has lower limit >= its upper limit: "
1029 <<
" Lower: " << norm.
GetLow()
1030 <<
" Upper: " << norm.
GetHigh()
1031 <<
". Please Fix" << std::endl;
1035 std::cout <<
"Error: NormFactor: " << norm.
GetName()
1036 <<
" has initial value not within its range: "
1037 <<
" Val: " << norm.
GetVal()
1038 <<
" Lower: " << norm.
GetLow()
1039 <<
" Upper: " << norm.
GetHigh()
1040 <<
". Please Fix" << std::endl;
1052 std::cout <<
"Making HistoFactor" << std::endl;
1062 std::cout <<
"Made HistoFactor" << std::endl;
1071 std::cout <<
"Making HistoSys:" << std::endl;
1092 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
1095 TString attrName = curAttr->
GetName();
1096 std::string attrVal = curAttr->
GetValue();
1098 if( attrName == TString(
"" ) ){
1099 std::cout <<
"Error: Encountered Element in HistoSys with no name" << std::endl;
1103 else if( curAttr->
GetName() == TString(
"Name" ) ) {
1107 else if( curAttr->
GetName() == TString(
"HistoFileHigh" ) ) {
1110 else if( curAttr->
GetName() == TString(
"HistoPathHigh" ) ) {
1113 else if( curAttr->
GetName() == TString(
"HistoNameHigh" ) ) {
1117 else if( curAttr->
GetName() == TString(
"HistoFileLow" ) ) {
1120 else if( curAttr->
GetName() == TString(
"HistoPathLow" ) ) {
1123 else if( curAttr->
GetName() == TString(
"HistoNameLow" ) ) {
1128 std::cout <<
"Error: Encountered Element in HistoSys with unknown name: "
1129 << attrName << std::endl;
1136 if( histoSys.
GetName() ==
"" ) {
1137 std::cout <<
"Error: HistoSys Node has no Name" << std::endl;
1141 std::cout <<
"Error: HistoSysSample Node has no InputFileHigh" << std::endl;
1145 std::cout <<
"Error: HistoSysSample Node has no InputFileLow" << std::endl;
1149 std::cout <<
"Error: HistoSysSample Node has no HistoNameHigh" << std::endl;
1153 std::cout <<
"Error: HistoSysSample Node has no HistoNameLow" << std::endl;
1167 std::cout <<
"Making OverallSys:" << std::endl;
1173 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
1176 TString attrName = curAttr->
GetName();
1177 std::string attrVal = curAttr->
GetValue();
1179 if( attrName == TString(
"" ) ){
1180 std::cout <<
"Error: Encountered Element in OverallSys with no name" << std::endl;
1184 else if( attrName == TString(
"Name" ) ) {
1185 overallSys.
SetName( attrVal );
1187 else if( attrName == TString(
"High" ) ) {
1188 overallSys.
SetHigh( atof(attrVal.c_str()) );
1190 else if( attrName == TString(
"Low" ) ) {
1191 overallSys.
SetLow( atof(attrVal.c_str()) );
1195 std::cout <<
"Error: Encountered Element in OverallSys with unknown name: "
1196 << attrName << std::endl;
1202 if( overallSys.
GetName() ==
"" ) {
1203 std::cout <<
"Error: Encountered OverallSys with no name" << std::endl;
1217 std::cout <<
"Making ShapeFactor" << std::endl;
1231 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
1234 TString attrName = curAttr->
GetName();
1235 std::string attrVal = curAttr->
GetValue();
1237 if( attrName == TString(
"" ) ){
1238 std::cout <<
"Error: Encountered Element in ShapeFactor with no name" << std::endl;
1242 else if( attrName == TString(
"Name" ) ) {
1243 shapeFactor.
SetName( attrVal );
1245 else if( attrName == TString(
"Const" ) ) {
1249 else if( attrName == TString(
"HistoName" ) ) {
1253 else if( attrName == TString(
"InputFile" ) ) {
1254 ShapeInputFile = attrVal;
1257 else if( attrName == TString(
"HistoPath" ) ) {
1258 ShapeInputPath = attrVal;
1262 std::cout <<
"Error: Encountered Element in ShapeFactor with unknown name: "
1263 << attrName << std::endl;
1269 if( shapeFactor.
GetName() ==
"" ) {
1270 std::cout <<
"Error: Encountered ShapeFactor with no name" << std::endl;
1278 std::cout <<
"Error: ShapeFactor: " << shapeFactor.
GetName()
1279 <<
" is configured to have an initial shape, but "
1280 <<
"its histogram doesn't have a name"
1288 shapeFactor.
Print();
1297 std::cout <<
"Making ShapeSys" << std::endl;
1311 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
1315 TString attrName = curAttr->
GetName();
1316 std::string attrVal = curAttr->
GetValue();
1318 if( attrName == TString(
"" ) ){
1319 std::cout <<
"Error: Encountered Element in ShapeSys with no name" << std::endl;
1323 else if( attrName == TString(
"Name" ) ) {
1327 else if( attrName == TString(
"HistoName" ) ) {
1331 else if( attrName == TString(
"HistoPath" ) ) {
1335 else if( attrName == TString(
"InputFile" ) ) {
1339 else if( attrName == TString(
"ConstraintType" ) ) {
1341 std::cout <<
"Error: ShapeSys Constraint type is empty" << std::endl;
1344 else if( attrVal==
"Gaussian" || attrVal==
"Gauss" ) {
1347 else if( attrVal==
"Poisson" || attrVal==
"Pois" ) {
1351 cout <<
"Error: Encountered unknown ShapeSys Constraint type: " << attrVal << endl;
1357 std::cout <<
"Error: Encountered Element in ShapeSys with unknown name: "
1358 << attrName << std::endl;
1365 if( shapeSys.
GetName() ==
"" ) {
1366 std::cout <<
"Error: Encountered ShapeSys with no Name" << std::endl;
1370 std::cout <<
"Error: Encountered ShapeSys with no InputFile" << std::endl;
1374 std::cout <<
"Error: Encountered ShapeSys with no HistoName" << std::endl;
1387 std::cout <<
"Activating StatError" << std::endl;
1398 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
1401 TString attrName = curAttr->
GetName();
1402 std::string attrVal = curAttr->
GetValue();
1404 if( attrName == TString(
"" ) ){
1405 std::cout <<
"Error: Encountered Element in ActivateStatError with no name" << std::endl;
1409 else if( attrName == TString(
"Activate" ) ) {
1413 else if( attrName == TString(
"HistoName" ) ) {
1417 else if( attrName == TString(
"HistoPath" ) ) {
1421 else if( attrName == TString(
"InputFile" ) ) {
1426 std::cout <<
"Error: Encountered Element in ActivateStatError with unknown name: "
1427 << attrName << std::endl;
1475 std::cout <<
"Parsing FunctionConfig" << std::endl;
1481 std::string
Name =
"";
1482 std::string Expression =
"";
1483 std::string Dependents =
"";
1486 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) != 0 ) {
1487 if( curAttr->
GetName() == TString(
"Name" ) ) {
1492 if( curAttr->
GetName() == TString(
"Expression" ) ) {
1496 if( curAttr->
GetName() == TString(
"Dependents" ) ) {
1503 std::cout <<
"Error processing PreprocessFunction: Name attribute is empty" << std::endl;
1506 if( Expression==
"" ){
1507 std::cout <<
"Error processing PreprocessFunction: Expression attribute is empty" << std::endl;
1510 if( Dependents==
"" ){
1511 std::cout <<
"Error processing PreprocessFunction: Dependents attribute is empty" << std::endl;
1517 std::cout <<
"Created Preprocess Function: " << func.
GetCommand() << std::endl;
1533 if( node->
GetNodeName() == TString(
"comment" ) ) {
1544 if( attrVal ==
"" ) {
1545 std::cout <<
"Error: In " << NodeTitle
1546 <<
" Expected either 'True' or 'False' but found empty" << std::endl;
1549 else if ( attrVal ==
"True" || attrVal ==
"true" )
return true;
1550 else if ( attrVal ==
"False" || attrVal ==
"false" )
return false;
1552 std::cout <<
"Error: In " << NodeTitle
1553 <<
" Expected either 'True' or 'False' but found: " << attrVal << std::endl;
static RooMathCoreReg dummy
TODO Here, we are missing some documentation.
void SetName(const std::string &name)
This class encapsulates all information for the statistical interpretation of one experiment.
std::string GetInputFile()
get name of input file
void SetName(const std::string &Name)
set name of channel
std::string GetHistoPath()
get path to histograms in input file
void Print(std::ostream &=std::cout)
void AddAdditionalData(const RooStats::HistFactory::Data &data)
add additional data object
void SetData(const RooStats::HistFactory::Data &data)
set data object
void SetInputFile(const std::string &file)
set name of input file containing histograms
std::string GetName()
get name of channel
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
bool IsAcceptableNode(TXMLNode *functionNode)
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 unconstrained, coherent shape variation of affected samples.
Configuration for a constrained, coherent shape variation of affected samples.
std::string GetHistoNameHigh()
std::string GetInputFileHigh()
void SetHistoNameLow(const std::string &HistoNameLow)
void SetHistoPathHigh(const std::string &HistoPathHigh)
void Print(std::ostream &=std::cout)
std::string GetInputFileLow()
void SetName(const std::string &Name)
std::string GetHistoNameLow()
void SetInputFileLow(const std::string &InputFileLow)
void SetHistoPathLow(const std::string &HistoPathLow)
void SetInputFileHigh(const std::string &InputFileHigh)
void SetHistoNameHigh(const std::string &HistoNameHigh)
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
std::map< std::string, double > & GetGammaSyst()
std::map< std::string, double > & GetLogNormSyst()
std::map< std::string, double > & GetNoSyst()
void SetExportOnly(bool ExportOnly)
do not produce any plots or tables, just save the model
std::vector< std::string > & GetPOIList()
get vector of PoI names
void SetLumi(double Lumi)
set integrated luminosity used to normalise histograms (if NormalizeByTheory is true for this sample)
void SetParamValue(const std::string ¶m, double value)
Set a parameter to a specific value (And optionally fix it)
std::map< std::string, double > & GetUniformSyst()
std::vector< std::string > & GetConstantParams()
get vector of all constant parameters
void SetOutputFilePrefix(const std::string &prefix)
set output prefix
void PrintTree(std::ostream &=std::cout)
void SetBinLow(int BinLow)
std::vector< RooStats::HistFactory::Channel > & GetChannels()
void SetBinHigh(int BinHigh)
void SetLumiRelErr(double RelErr)
set relative uncertainty on luminosity
void AddAsimovDataset(RooStats::HistFactory::Asimov dataset)
add an Asimov Dataset
Configuration for an un- constrained overall systematic to scale sample normalisations.
void Print(std::ostream &=std::cout)
void SetConst(bool Const=true)
void SetHigh(double High)
void SetName(const std::string &Name)
Configuration for a constrained overall systematic to scale sample normalisations.
void SetName(const std::string &Name)
void Print(std::ostream &=std::cout)
void SetHigh(double High)
std::string GetCommand(std::string Name, std::string Expression, std::string Dependents)
std::string GetInputFile()
get input ROOT file
std::vector< RooStats::HistFactory::OverallSys > & GetOverallSysList()
void SetStatError(RooStats::HistFactory::StatError Error)
std::string GetName()
get name of sample
void SetInputFile(const std::string &InputFile)
set input ROOT file
std::string GetHistoPath()
get histogram path
void SetChannelName(const std::string &ChannelName)
set name of associated channel
void SetHistoName(const std::string &HistoName)
set histogram name
void SetNormalizeByTheory(bool norm)
defines whether the normalization scale with luminosity
std::vector< RooStats::HistFactory::ShapeFactor > & GetShapeFactorList()
void SetName(const std::string &Name)
set name of sample
void SetHistoPath(const std::string &HistoPath)
set histogram path
std::vector< RooStats::HistFactory::NormFactor > & GetNormFactorList()
std::vector< RooStats::HistFactory::HistoSys > & GetHistoSysList()
std::vector< RooStats::HistFactory::ShapeSys > & GetShapeSysList()
std::string GetHistoName()
get histogram name
Unconstrained bin-by-bin variation of affected histogram.
std::string GetHistoName()
void SetName(const std::string &Name)
void Print(std::ostream &=std::cout)
void SetInputFile(const std::string &InputFile)
void SetHistoName(const std::string &HistoName)
void SetConstant(bool constant)
void SetHistoPath(const std::string &HistoPath)
Constrained bin-by-bin variation of affected histogram.
void SetName(const std::string &Name)
void Print(std::ostream &=std::cout)
void SetInputFile(const std::string &InputFile)
std::string GetHistoName()
void SetHistoName(const std::string &HistoName)
void SetConstraintType(Constraint::Type ConstrType)
void SetHistoPath(const std::string &HistoPath)
std::string GetInputFile()
Configuration to automatically assign nuisance parameters for the statistical error of the Monte Carl...
void SetConstraintType(Constraint::Type ConstrType)
double GetRelErrorThreshold()
void SetRelErrorThreshold(double Threshold)
Constraint::Type GetConstraintType()
Statistical error of Monte Carlo predictions.
void Activate(bool IsActive=true)
void SetHistoPath(const std::string &HistoPath)
void SetInputFile(const std::string &InputFile)
std::string GetHistoPath()
void SetHistoName(const std::string &HistoName)
std::string GetInputFile()
void SetUseHisto(bool UseHisto=true)
std::string GetHistoName()
void Print(std::ostream &=std::cout)
virtual TXMLDocument * GetXMLDocument() const
Returns the TXMLDocument.
virtual Int_t ParseFile(const char *filename)
Parse the XML file where filename is the XML file name.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetName() const
Returns name of object.
TXMLAttribute is the attribute of an Element.
const char * GetValue() const
const char * GetName() const
Returns name of object.
TXMLDocument contains a pointer to an xmlDoc structure, after the parser returns a tree built during ...
TXMLNode * GetRootNode() const
Returns the root element node.
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.
void AddSubStrings(vector< std::string > &vs, std::string s)
std::vector< std::string > GetChildrenFromString(std::string str)
void AddParamsToAsimov(RooStats::HistFactory::Asimov &asimov, std::string str)
@(#)root/roostats:$Id$ Author: George Lewis, Kyle Cranmer