34using std::string, std::cerr, std::cout, std::endl, std::vector;
38 void AddSubStrings( vector<std::string> & vs, std::string s){
39 const std::string delims(
"\\ ");
40 std::string::size_type begIdx;
41 std::string::size_type endIdx;
42 begIdx=s.find_first_not_of(delims);
43 while(begIdx!=string::npos){
44 endIdx=s.find_first_of(delims, begIdx);
45 if(endIdx==string::npos) endIdx=s.length();
46 vs.push_back(s.substr(begIdx,endIdx-begIdx));
47 begIdx=s.find_first_not_of(delims, endIdx);
53 std::vector<std::string> GetChildrenFromString( std::string str ) {
55 std::vector<std::string> child_vec;
57 const std::string delims(
"\\ ");
58 std::string::size_type begIdx;
59 std::string::size_type endIdx;
60 begIdx=str.find_first_not_of(delims);
61 while(begIdx!=string::npos){
62 endIdx=str.find_first_of(delims, begIdx);
63 if(endIdx==string::npos) endIdx=str.length();
64 std::string child_name = str.substr(begIdx,endIdx-begIdx);
65 child_vec.push_back(child_name);
66 begIdx=str.find_first_not_of(delims, endIdx);
78 std::vector<std::string> string_list = GetChildrenFromString( str );
83 std::map<std::string, double> param_map;
85 for(
unsigned int i=0; i < string_list.size(); ++i) {
87 std::string param = string_list.at(i);
89 size_t eql_location = param.find(
'=');
93 if( eql_location==string::npos ) {
98 std::string param_name = param.substr(0,eql_location);
99 double param_val = atof( param.substr(eql_location+1, param.size()).c_str() );
101 std::cout <<
"ASIMOV - Param Name: " << param_name
102 <<
" Param Val: " << param_val << std::endl;
125 std::vector< HistFactory::Measurement > measurement_list;
131 std::cerr <<
"Loading of xml document \"" <<
input
132 <<
"\" failed" << std::endl;
138 cxcoutIHF <<
"reading input : " <<
input << endl;
145 cxcoutEHF <<
"Error: Driver DOCTYPE not equal to 'Combination'" << std::endl;
150 std::string OutputFilePrefix;
154 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
158 std::string attrVal = curAttr->
GetValue();
160 if( attrName ==
TString(
"" ) ) {
161 cxcoutEHF <<
" Error: Attribute for 'Combination' with no name found" << std::endl;
165 else if( attrName ==
TString(
"OutputFilePrefix" ) ) {
166 OutputFilePrefix = string(curAttr->
GetValue());
167 cxcoutIHF <<
"output file prefix is : " << OutputFilePrefix << endl;
177 cxcoutEHF <<
" Error: Unknown attribute for 'Combination' encountered: "
178 << attrName << std::endl;
191 std::vector< std::string > xml_channel_files;
193 while( node !=
nullptr ) {
195 if( node->
GetText() ==
nullptr ) {
196 cxcoutEHF <<
"Error: node: " << node->
GetName()
197 <<
" has no text." << std::endl;
200 xml_channel_files.push_back(node->
GetText());
206 if(xml_channel_files.empty()){
207 cerr <<
"no input channels found" << endl;
212 std::ostringstream msg;
213 msg <<
"Found Channels: ";
214 for(
unsigned int i=0; i < xml_channel_files.size(); ++i ) msg <<
" " << xml_channel_files.at(i);
215 cxcoutIHF << msg.str();
227 std::vector< RooStats::HistFactory::PreprocessFunction > functionObjects;
230 while( node !=
nullptr ) {
237 functionObjects.push_back( Func );
242 std::cout << std::endl;
247 while( node !=
nullptr ) {
250 cxcoutEHF <<
"Error: Node found in Measurement Driver XML with no name" << std::endl;
258 measurement_list.push_back( measurement );
274 cxcoutEHF <<
"Error: Unknown node found in Measurement Driver XML: "
282 cxcoutIHF <<
"Done Processing Measurements" << std::endl;
284 if( measurement_list.empty() ) {
285 cxcoutEHF <<
"Error: No Measurements found in XML Driver File" << std::endl;
289 std::ostringstream msg;
290 msg <<
"Found Measurements: ";
291 for(
unsigned int i=0; i < measurement_list.size(); ++i ) msg <<
" " << measurement_list.at(i).GetName();
293 cxcoutIHF << msg.str();
301 for(
unsigned int i = 0; i < measurement_list.size(); ++i) {
302 measurement_list.at(i).SetFunctionObjects( functionObjects );
312 std::vector< HistFactory::Channel > channel_list;
315 for(
unsigned int i = 0; i < xml_channel_files.size(); ++i ) {
316 std::string channel_xml = xml_channel_files.at(i);
317 cxcoutIHF <<
"Parsing Channel: " << channel_xml << std::endl;
323 channel_list.push_back( channel );
327 for(
unsigned int i = 0; i < measurement_list.size(); ++i) {
331 for(
unsigned int j = 0; j < channel_list.size(); ++j ) {
332 measurement.GetChannels().push_back( channel_list.at(j) );
336 return measurement_list;
346 if (node ==
nullptr) {
347 cxcoutWHF <<
"Input driver node is undefined, ignoring\n";
357 cxcoutIHF <<
"Creating new measurement:\n";
362 while (( curAttr =
dynamic_cast<TXMLAttr *
>(attribIt()) ) !=
nullptr) {
364 const std::string curAttrName(curAttr->
GetName() ? curAttr->
GetName() :
"");
365 const std::string curAttrValue(curAttr->
GetValue() ? curAttr->
GetValue() :
"");
366 if (curAttrName.empty()) {
367 cxcoutEHF <<
"Found XML attribute in Measurement with no name.\n";
370 }
else if (curAttrName ==
"Name") {
371 measurement.
SetName(curAttrValue.c_str());
372 }
else if (curAttrName ==
"Lumi") {
373 measurement.
SetLumi(std::stof(curAttrValue));
374 }
else if (curAttrName ==
"LumiRelErr") {
376 }
else if (curAttrName ==
"BinLow") {
377 measurement.
SetBinLow(std::stoi(curAttrValue));
378 }
else if (curAttrName ==
"BinHigh") {
379 measurement.
SetBinHigh(std::stoi(curAttrValue));
380 }
else if (curAttrName ==
"Mode") {
381 cout <<
"\n INFO: Mode attribute is deprecated and no longer supported, will ignore\n";
382 }
else if (curAttrName ==
"ExportOnly") {
385 cxcoutEHF <<
"Found unknown XML attribute in Measurement: " << curAttrName <<
"\n";
392 while (
child !=
nullptr) {
393 const std::string childName(
child->GetName() ?
child->GetName() :
"");
394 const std::string childNodeName(
child->GetNodeName() ?
child->GetNodeName() :
"");
395 const std::string childText(
child->GetText() ?
child->GetText() :
"");
396 if (childNodeName.empty()) {
397 cxcoutEHF <<
"Found XML child node of Measurement with no name\n";
399 }
else if (childNodeName ==
"POI") {
400 if (childText.empty()) {
401 cxcoutEHF <<
"Error: node: " << childName <<
" has no text.\n";
405 AddSubStrings(measurement.
GetPOIList(), childText);
406 }
else if (childNodeName ==
"ParamSetting") {
409 while (( curParam =
dynamic_cast<TXMLAttr *
>(paramIt()) ) !=
nullptr) {
411 const std::string curParamName(curParam->
GetName() ? curParam->
GetName() :
"");
412 if (curParamName.empty()) {
413 cxcoutEHF <<
"Error: Found tag attribute with no name in ParamSetting\n";
415 }
else if (curParamName ==
"Const") {
418 if (childText.empty()) {
419 cxcoutEHF <<
"Error: node: " << childName <<
" has no text.\n";
424 }
else if (curParamName ==
"Val") {
425 double val = atof(curParam->
GetValue());
426 if (childText.empty()) {
427 cxcoutEHF <<
"Error: node: " << childName <<
" has no text.\n";
430 std::vector<std::string> child_nodes = GetChildrenFromString(childText);
431 for (
size_t i = 0; i < child_nodes.size(); ++i) {
435 cxcoutEHF <<
"Found tag attribute with unknown name in ParamSetting: " << curParamName <<
"\n";
439 }
else if (childNodeName ==
"Asimov") {
443 std::string ParamFixString;
446 attribIt =
child->GetAttributes();
448 while (( curAttr =
dynamic_cast<TXMLAttr *
>(attribIt()) ) !=
nullptr) {
449 const std::string curAttrName(curAttr->
GetName() ? curAttr->
GetName() :
"");
450 const std::string curAttrValue(curAttr->
GetValue() ? curAttr->
GetValue() :
"");
451 if (curAttrName.empty()) {
452 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
454 }
else if (curAttrName ==
"Name") {
456 }
else if (curAttrName ==
"FixParams") {
457 ParamFixString = curAttrValue;
459 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " << curAttrName <<
"\n";
466 if (ParamFixString.empty()) {
467 cxcoutWHF <<
"Warning: Asimov Dataset with name: " << asimov.
GetName()
468 <<
" added, but no parameters are set to be fixed\n";
470 AddParamsToAsimov(asimov, ParamFixString);
473 }
else if (childNodeName ==
"ConstraintTerm") {
474 std::vector<string> syst;
479 if (childText.empty()) {
480 cxcoutEHF <<
"Error: node: " << childName <<
" has no text\n";
483 AddSubStrings(syst, childText);
486 attribIt =
child->GetAttributes();
488 while (( curAttr =
dynamic_cast<TXMLAttr *
>(attribIt()) ) !=
nullptr) {
489 const std::string curAttrName(curAttr->
GetName() ? curAttr->
GetName() :
"");
490 const std::string curAttrValue(curAttr->
GetValue() ? curAttr->
GetValue() :
"");
491 if (curAttrName.empty()) {
492 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
494 }
else if (curAttrName ==
"Type") {
496 }
else if (curAttrName ==
"RelativeUncertainty") {
497 rel = std::stof(curAttrValue);
499 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " << curAttrName <<
"\n";
506 if (
type ==
"Gamma") {
507 for (
const auto &isyst : syst) {
509 measurement.GetGammaSyst()[isyst] = rel;
511 }
else if (
type ==
"Uniform") {
512 for (
const auto &isyst : syst) {
514 measurement.GetUniformSyst()[isyst] = rel;
516 }
else if (
type ==
"LogNormal") {
517 for (
const auto &isyst : syst) {
519 measurement.GetLogNormSyst()[isyst] = rel;
522 }
else if (
type ==
"NoConstraint") {
523 for (
const auto &isyst : syst) {
525 measurement.GetNoSyst()[isyst] = 1.0;
529 cxcoutEHF <<
"Error: Encountered unknown type for ConstraintTerm: " <<
type <<
"\n";
536 cxcoutEHF <<
"Found XML child of Measurement with unknown name: " << childNodeName <<
"\n";
542 measurement.PrintTree(
oocoutI(
nullptr, HistFactory));
555 cxcoutIHF <<
"Parsing file: " << filen << std::endl;
562 cxcoutEHF <<
"Loading of xml document \"" << filen
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;
595 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
599 std::string attrVal = curAttr->
GetValue();
601 if( attrName ==
TString(
"" ) ) {
602 cxcoutEHF <<
" Error: Attribute for 'Channel' with no name found" << std::endl;
606 else if( attrName ==
TString(
"Name" ) ) {
608 cxcoutIHF <<
" : creating a channel named " << channel.
GetName() << std::endl;
611 else if( attrName ==
TString(
"InputFile" ) ) {
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: "
633 << attrName << std::endl;
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;
725 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
729 std::string attrVal = curAttr->
GetValue();
731 if( attrName ==
TString(
"" ) ) {
732 cxcoutEHF <<
" Error: Attribute for 'Data' with no name found" << std::endl;
736 else if( attrName ==
TString(
"Name" ) ) {
737 data.SetName( attrVal );
740 else if( attrName ==
TString(
"InputFile" ) ) {
741 data.SetInputFile( attrVal );
744 else if( attrName ==
TString(
"HistoName" ) ) {
745 data.SetHistoName( attrVal );
748 else if( attrName ==
TString(
"HistoPath" ) ) {
749 data.SetHistoPath( attrVal );
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;
771 cxcoutIHF <<
"Created Data Node with"
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;
797 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
801 std::string attrVal = curAttr->
GetValue();
803 if( attrName ==
TString(
"RelErrorThreshold" ) ) {
807 if( attrName ==
TString(
"ConstraintType" ) ) {
810 if( attrVal.empty() ) {
811 cxcoutEHF <<
"Error: Bad Value for StatErrorConfig Constraint Type Found" << std::endl;
815 else if( attrVal==
"Gaussian" || attrVal==
"Gauss" ) {
819 else if( attrVal==
"Poisson" || attrVal==
"Pois" ) {
826 cout <<
"Invalid Stat Constraint Type: " << curAttr->
GetValue() << endl;
832 cxcoutIHF <<
"Created StatErrorConfig Element with"
844 cxcoutIHF <<
"Creating Sample Element" << std::endl;
859 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
863 std::string attrVal = curAttr->
GetValue();
865 if( attrName ==
TString(
"" ) ) {
866 cxcoutEHF <<
" Error: Attribute for 'Sample' with no name found" << std::endl;
870 else if( attrName ==
TString(
"Name" ) ) {
874 else if( attrName ==
TString(
"InputFile" ) ) {
879 else if( attrName ==
TString(
"HistoName" ) ) {
883 else if( attrName ==
TString(
"HistoPath" ) ) {
888 else if( attrName ==
TString(
"NormalizeByTheory" ) ) {
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;
917 cxcoutEHF <<
"Error: Sample Node has no InputFile" << std::endl;
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;
976 cxcoutIHF <<
"Created Sample Node with"
977 <<
" Name: " << sample.
GetName()
991 cxcoutIHF <<
"Making NormFactor:" << std::endl;
997 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1001 std::string attrVal = curAttr->
GetValue();
1003 if( attrName ==
TString(
"" ) ){
1004 cxcoutEHF <<
"Error: Encountered Element in NormFactor with no name" << std::endl;
1012 norm.
SetVal( atof(attrVal.c_str()) );
1015 norm.
SetLow( atof(attrVal.c_str()) );
1018 norm.
SetHigh( atof(attrVal.c_str()) );
1022 cxcoutEHF <<
"Error: Encountered Element in NormFactor with unknown name: "
1023 << attrName << std::endl;
1029 if( norm.
GetName().empty() ) {
1030 cxcoutEHF <<
"Error: NormFactor Node has no Name" << std::endl;
1035 cxcoutEHF <<
"Error: NormFactor: " << norm.
GetName()
1036 <<
" has lower limit >= its upper limit: "
1037 <<
" Lower: " << norm.
GetLow()
1038 <<
" Upper: " << norm.
GetHigh()
1039 <<
". Please Fix" << std::endl;
1043 cxcoutEHF <<
"Error: NormFactor: " << norm.
GetName()
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;
1100 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1104 std::string attrVal = curAttr->
GetValue();
1106 if( attrName ==
TString(
"" ) ){
1107 cxcoutEHF <<
"Error: Encountered Element in HistoSys with no name" << std::endl;
1136 cxcoutEHF <<
"Error: Encountered Element in HistoSys with unknown name: "
1137 << attrName << std::endl;
1144 if( histoSys.
GetName().empty() ) {
1145 cxcoutEHF <<
"Error: HistoSys Node has no Name" << std::endl;
1149 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileHigh" << std::endl;
1153 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileLow" << std::endl;
1157 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameHigh" << std::endl;
1161 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameLow" << std::endl;
1175 cxcoutIHF <<
"Making OverallSys:" << std::endl;
1181 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1185 std::string attrVal = curAttr->
GetValue();
1187 if( attrName ==
TString(
"" ) ){
1188 cxcoutEHF <<
"Error: Encountered Element in OverallSys with no name" << std::endl;
1192 else if( attrName ==
TString(
"Name" ) ) {
1193 overallSys.
SetName( attrVal );
1195 else if( attrName ==
TString(
"High" ) ) {
1196 overallSys.
SetHigh( atof(attrVal.c_str()) );
1198 else if( attrName ==
TString(
"Low" ) ) {
1199 overallSys.
SetLow( atof(attrVal.c_str()) );
1203 cxcoutEHF <<
"Error: Encountered Element in OverallSys with unknown name: "
1204 << attrName << std::endl;
1210 if( overallSys.
GetName().empty() ) {
1211 cxcoutEHF <<
"Error: Encountered OverallSys with no name" << std::endl;
1225 cxcoutIHF <<
"Making ShapeFactor" << std::endl;
1239 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1243 std::string attrVal = curAttr->
GetValue();
1245 if( attrName ==
TString(
"" ) ){
1246 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with no name" << std::endl;
1250 else if( attrName ==
TString(
"Name" ) ) {
1251 shapeFactor.
SetName( attrVal );
1253 else if( attrName ==
TString(
"Const" ) ) {
1257 else if( attrName ==
TString(
"HistoName" ) ) {
1261 else if( attrName ==
TString(
"InputFile" ) ) {
1262 ShapeInputFile = attrVal;
1265 else if( attrName ==
TString(
"HistoPath" ) ) {
1266 ShapeInputPath = attrVal;
1270 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with unknown name: "
1271 << attrName << std::endl;
1277 if( shapeFactor.
GetName().empty() ) {
1278 cxcoutEHF <<
"Error: Encountered ShapeFactor with no name" << std::endl;
1286 cxcoutEHF <<
"Error: ShapeFactor: " << shapeFactor.
GetName()
1287 <<
" is configured to have an initial shape, but "
1288 <<
"its histogram doesn't have a name"
1305 cxcoutIHF <<
"Making ShapeSys" << std::endl;
1319 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1324 std::string attrVal = curAttr->
GetValue();
1326 if( attrName ==
TString(
"" ) ){
1327 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with no name" << std::endl;
1331 else if( attrName ==
TString(
"Name" ) ) {
1335 else if( attrName ==
TString(
"HistoName" ) ) {
1339 else if( attrName ==
TString(
"HistoPath" ) ) {
1343 else if( attrName ==
TString(
"InputFile" ) ) {
1347 else if( attrName ==
TString(
"ConstraintType" ) ) {
1348 if( attrVal.empty() ) {
1349 cxcoutEHF <<
"Error: ShapeSys Constraint type is empty" << std::endl;
1352 else if( attrVal==
"Gaussian" || attrVal==
"Gauss" ) {
1355 else if( attrVal==
"Poisson" || attrVal==
"Pois" ) {
1359 cout <<
"Error: Encountered unknown ShapeSys Constraint type: " << attrVal << endl;
1365 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with unknown name: "
1366 << attrName << std::endl;
1373 if( shapeSys.
GetName().empty() ) {
1374 cxcoutEHF <<
"Error: Encountered ShapeSys with no Name" << std::endl;
1378 cxcoutEHF <<
"Error: Encountered ShapeSys with no InputFile" << std::endl;
1382 cxcoutEHF <<
"Error: Encountered ShapeSys with no HistoName" << std::endl;
1395 cxcoutIHF <<
"Activating StatError" << std::endl;
1406 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1410 std::string attrVal = curAttr->
GetValue();
1412 if( attrName ==
TString(
"" ) ){
1413 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with no name" << std::endl;
1417 else if( attrName ==
TString(
"Activate" ) ) {
1421 else if( attrName ==
TString(
"HistoName" ) ) {
1425 else if( attrName ==
TString(
"HistoPath" ) ) {
1429 else if( attrName ==
TString(
"InputFile" ) ) {
1434 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with unknown name: "
1435 << attrName << std::endl;
1483 cxcoutIHF <<
"Parsing FunctionConfig" << std::endl;
1490 std::string Expression;
1491 std::string Dependents;
1494 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
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;
1518 if( Dependents.empty() ){
1519 cxcoutEHF <<
"Error processing PreprocessFunction: Dependents attribute is empty" << std::endl;
1525 cxcoutIHF <<
"Created Preprocess Function: " << func.
GetCommand() << std::endl;
1552 if( attrVal.empty() ) {
1553 cxcoutEHF <<
"Error: In " << NodeTitle
1554 <<
" Expected either 'True' or 'False' but found empty" << std::endl;
1557 else if ( attrVal ==
"True" || attrVal ==
"true" )
return true;
1558 else if ( attrVal ==
"False" || attrVal ==
"false" )
return false;
1560 cxcoutEHF <<
"Error: In " << NodeTitle
1561 <<
" Expected either 'True' or 'False' but found: " << attrVal << std::endl;
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 SetName(const std::string &Name)
void SetHistoPathHigh(const std::string &HistoPathHigh)
const std::string & GetName() const
void SetInputFileLow(const std::string &InputFileLow)
const std::string & GetHistoNameHigh() const
const std::string & GetHistoNameLow() const
void SetHistoNameHigh(const std::string &HistoNameHigh)
void SetHistoNameLow(const std::string &HistoNameLow)
virtual void Print(std::ostream &=std::cout) const
const std::string & GetInputFileHigh() const
const std::string & GetInputFileLow() const
void SetHistoPathLow(const std::string &HistoPathLow)
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
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)
void SetExportOnly(bool ExportOnly) R__DEPRECATED(6
Do not produce any plots or tables, just save the model.
std::vector< std::string > & GetConstantParams()
get vector of all constant parameters
void SetOutputFilePrefix(const std::string &prefix)
set output prefix
void SetBinLow(int BinLow)
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.
std::string GetName() const
void Print(std::ostream &=std::cout) const
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)
const std::string & GetName() const
void SetHigh(double High)
void Print(std::ostream &=std::cout) const
std::string GetCommand() const
std::vector< RooStats::HistFactory::OverallSys > & GetOverallSysList()
std::string GetHistoName() const
get histogram name
void SetStatError(RooStats::HistFactory::StatError Error)
std::string GetName() const
get name of sample
void SetInputFile(const std::string &InputFile)
set input ROOT file
void SetChannelName(const std::string &ChannelName)
set name of associated channel
void SetHistoName(const std::string &HistoName)
set histogram name
std::string GetHistoPath() const
get histogram path
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::string GetInputFile() const
get input ROOT file
std::vector< RooStats::HistFactory::HistoSys > & GetHistoSysList()
std::vector< RooStats::HistFactory::ShapeSys > & GetShapeSysList()
*Un*constrained bin-by-bin variation of affected histogram.
void SetInputFile(const std::string &InputFile)
void SetHistoName(const std::string &HistoName)
void Print(std::ostream &=std::cout) const override
void SetConstant(bool constant)
bool HasInitialShape() const
void SetHistoPath(const std::string &HistoPath)
const std::string & GetHistoName() const
Constrained bin-by-bin variation of affected histogram.
std::string GetHistoName() const
void SetInputFile(const std::string &InputFile)
void Print(std::ostream &=std::cout) const override
void SetHistoName(const std::string &HistoName)
void SetConstraintType(Constraint::Type ConstrType)
std::string GetInputFile() const
void SetHistoPath(const std::string &HistoPath)
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.
const std::string & GetHistoPath() const
void Activate(bool IsActive=true)
void SetHistoPath(const std::string &HistoPath)
void SetInputFile(const std::string &InputFile)
const std::string & GetInputFile() const
void SetHistoName(const std::string &HistoName)
const std::string & GetHistoName() const
void SetUseHisto(bool UseHisto=true)
void Print(std::ostream &=std::cout) const override
virtual TXMLDocument * GetXMLDocument() const
Returns the TXMLDocument.
Int_t ParseFile(const char *filename) override
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 override
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.
Namespace for the RooStats classes.