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";
358 cxcoutIHF <<
"Creating new measurement:\n";
363 while (( curAttr =
dynamic_cast<TXMLAttr *
>(attribIt()) ) !=
nullptr) {
365 const std::string curAttrName(curAttr->
GetName() ? curAttr->
GetName() :
"");
366 const std::string curAttrValue(curAttr->
GetValue() ? curAttr->
GetValue() :
"");
367 if (curAttrName.empty()) {
368 cxcoutEHF <<
"Found XML attribute in Measurement with no name.\n";
371 }
else if (curAttrName ==
"Name") {
372 measurement.
SetName(curAttrValue.c_str());
373 }
else if (curAttrName ==
"Lumi") {
374 measurement.
SetLumi(std::stof(curAttrValue));
375 }
else if (curAttrName ==
"LumiRelErr") {
377 }
else if (curAttrName ==
"BinLow") {
378 measurement.
SetBinLow(std::stoi(curAttrValue));
379 }
else if (curAttrName ==
"BinHigh") {
380 measurement.
SetBinHigh(std::stoi(curAttrValue));
381 }
else if (curAttrName ==
"Mode") {
382 cout <<
"\n INFO: Mode attribute is deprecated and no longer supported, will ignore\n";
383 }
else if (curAttrName ==
"ExportOnly") {
386 cxcoutEHF <<
"Found unknown XML attribute in Measurement: " << curAttrName <<
"\n";
393 while (
child !=
nullptr) {
394 const std::string childName(
child->GetName() ?
child->GetName() :
"");
395 const std::string childNodeName(
child->GetNodeName() ?
child->GetNodeName() :
"");
396 const std::string childText(
child->GetText() ?
child->GetText() :
"");
397 if (childNodeName.empty()) {
398 cxcoutEHF <<
"Found XML child node of Measurement with no name\n";
400 }
else if (childNodeName ==
"POI") {
401 if (childText.empty()) {
402 cxcoutEHF <<
"Error: node: " << childName <<
" has no text.\n";
406 AddSubStrings(measurement.
GetPOIList(), childText);
407 }
else if (childNodeName ==
"ParamSetting") {
410 while (( curParam =
dynamic_cast<TXMLAttr *
>(paramIt()) ) !=
nullptr) {
412 const std::string curParamName(curParam->
GetName() ? curParam->
GetName() :
"");
413 if (curParamName.empty()) {
414 cxcoutEHF <<
"Error: Found tag attribute with no name in ParamSetting\n";
416 }
else if (curParamName ==
"Const") {
419 if (childText.empty()) {
420 cxcoutEHF <<
"Error: node: " << childName <<
" has no text.\n";
425 }
else if (curParamName ==
"Val") {
426 double val = atof(curParam->
GetValue());
427 if (childText.empty()) {
428 cxcoutEHF <<
"Error: node: " << childName <<
" has no text.\n";
431 std::vector<std::string> child_nodes = GetChildrenFromString(childText);
432 for (
size_t i = 0; i < child_nodes.size(); ++i) {
436 cxcoutEHF <<
"Found tag attribute with unknown name in ParamSetting: " << curParamName <<
"\n";
440 }
else if (childNodeName ==
"Asimov") {
444 std::string ParamFixString;
447 attribIt =
child->GetAttributes();
449 while (( curAttr =
dynamic_cast<TXMLAttr *
>(attribIt()) ) !=
nullptr) {
450 const std::string curAttrName(curAttr->
GetName() ? curAttr->
GetName() :
"");
451 const std::string curAttrValue(curAttr->
GetValue() ? curAttr->
GetValue() :
"");
452 if (curAttrName.empty()) {
453 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
455 }
else if (curAttrName ==
"Name") {
457 }
else if (curAttrName ==
"FixParams") {
458 ParamFixString = curAttrValue;
460 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " << curAttrName <<
"\n";
467 if (ParamFixString.empty()) {
468 cxcoutWHF <<
"Warning: Asimov Dataset with name: " << asimov.
GetName()
469 <<
" added, but no parameters are set to be fixed\n";
471 AddParamsToAsimov(asimov, ParamFixString);
474 }
else if (childNodeName ==
"ConstraintTerm") {
475 std::vector<string> syst;
480 if (childText.empty()) {
481 cxcoutEHF <<
"Error: node: " << childName <<
" has no text\n";
484 AddSubStrings(syst, childText);
487 attribIt =
child->GetAttributes();
489 while (( curAttr =
dynamic_cast<TXMLAttr *
>(attribIt()) ) !=
nullptr) {
490 const std::string curAttrName(curAttr->
GetName() ? curAttr->
GetName() :
"");
491 const std::string curAttrValue(curAttr->
GetValue() ? curAttr->
GetValue() :
"");
492 if (curAttrName.empty()) {
493 cxcoutEHF <<
"Error: Found tag attribute with no name in ConstraintTerm\n";
495 }
else if (curAttrName ==
"Type") {
497 }
else if (curAttrName ==
"RelativeUncertainty") {
498 rel = std::stof(curAttrValue);
500 cxcoutEHF <<
"Found tag attribute with unknown name in ConstraintTerm: " << curAttrName <<
"\n";
507 if (
type ==
"Gamma") {
508 for (
const auto &isyst : syst) {
512 }
else if (
type ==
"Uniform") {
513 for (
const auto &isyst : syst) {
517 }
else if (
type ==
"LogNormal") {
518 for (
const auto &isyst : syst) {
523 }
else if (
type ==
"NoConstraint") {
524 for (
const auto &isyst : syst) {
530 cxcoutEHF <<
"Error: Encountered unknown type for ConstraintTerm: " <<
type <<
"\n";
537 cxcoutEHF <<
"Found XML child of Measurement with unknown name: " << childNodeName <<
"\n";
556 cxcoutIHF <<
"Parsing file: " << filen << std::endl;
563 cxcoutEHF <<
"Loading of xml document \"" << filen
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;
596 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
600 std::string attrVal = curAttr->
GetValue();
602 if( attrName ==
TString(
"" ) ) {
603 cxcoutEHF <<
" Error: Attribute for 'Channel' with no name found" << std::endl;
607 else if( attrName ==
TString(
"Name" ) ) {
609 cxcoutIHF <<
" : creating a channel named " << channel.
GetName() << std::endl;
612 else if( attrName ==
TString(
"InputFile" ) ) {
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: "
634 << attrName << std::endl;
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;
726 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
730 std::string attrVal = curAttr->
GetValue();
732 if( attrName ==
TString(
"" ) ) {
733 cxcoutEHF <<
" Error: Attribute for 'Data' with no name found" << std::endl;
737 else if( attrName ==
TString(
"Name" ) ) {
738 data.SetName( attrVal );
741 else if( attrName ==
TString(
"InputFile" ) ) {
742 data.SetInputFile( attrVal );
745 else if( attrName ==
TString(
"HistoName" ) ) {
746 data.SetHistoName( attrVal );
749 else if( attrName ==
TString(
"HistoPath" ) ) {
750 data.SetHistoPath( attrVal );
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;
772 cxcoutIHF <<
"Created Data Node with"
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;
798 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
802 std::string attrVal = curAttr->
GetValue();
804 if( attrName ==
TString(
"RelErrorThreshold" ) ) {
808 if( attrName ==
TString(
"ConstraintType" ) ) {
811 if( attrVal.empty() ) {
812 cxcoutEHF <<
"Error: Bad Value for StatErrorConfig Constraint Type Found" << std::endl;
816 else if( attrVal==
"Gaussian" || attrVal==
"Gauss" ) {
820 else if( attrVal==
"Poisson" || attrVal==
"Pois" ) {
827 cout <<
"Invalid Stat Constraint Type: " << curAttr->
GetValue() << endl;
833 cxcoutIHF <<
"Created StatErrorConfig Element with"
845 cxcoutIHF <<
"Creating Sample Element" << std::endl;
860 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
864 std::string attrVal = curAttr->
GetValue();
866 if( attrName ==
TString(
"" ) ) {
867 cxcoutEHF <<
" Error: Attribute for 'Sample' with no name found" << std::endl;
871 else if( attrName ==
TString(
"Name" ) ) {
875 else if( attrName ==
TString(
"InputFile" ) ) {
880 else if( attrName ==
TString(
"HistoName" ) ) {
884 else if( attrName ==
TString(
"HistoPath" ) ) {
889 else if( attrName ==
TString(
"NormalizeByTheory" ) ) {
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;
918 cxcoutEHF <<
"Error: Sample Node has no InputFile" << std::endl;
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;
977 cxcoutIHF <<
"Created Sample Node with"
978 <<
" Name: " << sample.
GetName()
992 cxcoutIHF <<
"Making NormFactor:" << std::endl;
998 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1002 std::string attrVal = curAttr->
GetValue();
1004 if( attrName ==
TString(
"" ) ){
1005 cxcoutEHF <<
"Error: Encountered Element in NormFactor with no name" << std::endl;
1013 norm.
SetVal( atof(attrVal.c_str()) );
1016 norm.
SetLow( atof(attrVal.c_str()) );
1019 norm.
SetHigh( atof(attrVal.c_str()) );
1023 cxcoutEHF <<
"Error: Encountered Element in NormFactor with unknown name: "
1024 << attrName << std::endl;
1030 if( norm.
GetName().empty() ) {
1031 cxcoutEHF <<
"Error: NormFactor Node has no Name" << std::endl;
1036 cxcoutEHF <<
"Error: NormFactor: " << norm.
GetName()
1037 <<
" has lower limit >= its upper limit: "
1038 <<
" Lower: " << norm.
GetLow()
1039 <<
" Upper: " << norm.
GetHigh()
1040 <<
". Please Fix" << std::endl;
1044 cxcoutEHF <<
"Error: NormFactor: " << norm.
GetName()
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;
1101 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1105 std::string attrVal = curAttr->
GetValue();
1107 if( attrName ==
TString(
"" ) ){
1108 cxcoutEHF <<
"Error: Encountered Element in HistoSys with no name" << std::endl;
1137 cxcoutEHF <<
"Error: Encountered Element in HistoSys with unknown name: "
1138 << attrName << std::endl;
1145 if( histoSys.
GetName().empty() ) {
1146 cxcoutEHF <<
"Error: HistoSys Node has no Name" << std::endl;
1150 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileHigh" << std::endl;
1154 cxcoutEHF <<
"Error: HistoSysSample Node has no InputFileLow" << std::endl;
1158 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameHigh" << std::endl;
1162 cxcoutEHF <<
"Error: HistoSysSample Node has no HistoNameLow" << std::endl;
1176 cxcoutIHF <<
"Making OverallSys:" << std::endl;
1182 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1186 std::string attrVal = curAttr->
GetValue();
1188 if( attrName ==
TString(
"" ) ){
1189 cxcoutEHF <<
"Error: Encountered Element in OverallSys with no name" << std::endl;
1193 else if( attrName ==
TString(
"Name" ) ) {
1194 overallSys.
SetName( attrVal );
1196 else if( attrName ==
TString(
"High" ) ) {
1197 overallSys.
SetHigh( atof(attrVal.c_str()) );
1199 else if( attrName ==
TString(
"Low" ) ) {
1200 overallSys.
SetLow( atof(attrVal.c_str()) );
1204 cxcoutEHF <<
"Error: Encountered Element in OverallSys with unknown name: "
1205 << attrName << std::endl;
1211 if( overallSys.
GetName().empty() ) {
1212 cxcoutEHF <<
"Error: Encountered OverallSys with no name" << std::endl;
1226 cxcoutIHF <<
"Making ShapeFactor" << std::endl;
1240 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1244 std::string attrVal = curAttr->
GetValue();
1246 if( attrName ==
TString(
"" ) ){
1247 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with no name" << std::endl;
1251 else if( attrName ==
TString(
"Name" ) ) {
1252 shapeFactor.
SetName( attrVal );
1254 else if( attrName ==
TString(
"Const" ) ) {
1258 else if( attrName ==
TString(
"HistoName" ) ) {
1262 else if( attrName ==
TString(
"InputFile" ) ) {
1263 ShapeInputFile = attrVal;
1266 else if( attrName ==
TString(
"HistoPath" ) ) {
1267 ShapeInputPath = attrVal;
1271 cxcoutEHF <<
"Error: Encountered Element in ShapeFactor with unknown name: "
1272 << attrName << std::endl;
1278 if( shapeFactor.
GetName().empty() ) {
1279 cxcoutEHF <<
"Error: Encountered ShapeFactor with no name" << std::endl;
1287 cxcoutEHF <<
"Error: ShapeFactor: " << shapeFactor.
GetName()
1288 <<
" is configured to have an initial shape, but "
1289 <<
"its histogram doesn't have a name"
1306 cxcoutIHF <<
"Making ShapeSys" << std::endl;
1320 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1325 std::string attrVal = curAttr->
GetValue();
1327 if( attrName ==
TString(
"" ) ){
1328 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with no name" << std::endl;
1332 else if( attrName ==
TString(
"Name" ) ) {
1336 else if( attrName ==
TString(
"HistoName" ) ) {
1340 else if( attrName ==
TString(
"HistoPath" ) ) {
1344 else if( attrName ==
TString(
"InputFile" ) ) {
1348 else if( attrName ==
TString(
"ConstraintType" ) ) {
1349 if( attrVal.empty() ) {
1350 cxcoutEHF <<
"Error: ShapeSys Constraint type is empty" << std::endl;
1353 else if( attrVal==
"Gaussian" || attrVal==
"Gauss" ) {
1356 else if( attrVal==
"Poisson" || attrVal==
"Pois" ) {
1360 cout <<
"Error: Encountered unknown ShapeSys Constraint type: " << attrVal << endl;
1366 cxcoutEHF <<
"Error: Encountered Element in ShapeSys with unknown name: "
1367 << attrName << std::endl;
1374 if( shapeSys.
GetName().empty() ) {
1375 cxcoutEHF <<
"Error: Encountered ShapeSys with no Name" << std::endl;
1379 cxcoutEHF <<
"Error: Encountered ShapeSys with no InputFile" << std::endl;
1383 cxcoutEHF <<
"Error: Encountered ShapeSys with no HistoName" << std::endl;
1396 cxcoutIHF <<
"Activating StatError" << std::endl;
1407 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
1411 std::string attrVal = curAttr->
GetValue();
1413 if( attrName ==
TString(
"" ) ){
1414 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with no name" << std::endl;
1418 else if( attrName ==
TString(
"Activate" ) ) {
1422 else if( attrName ==
TString(
"HistoName" ) ) {
1426 else if( attrName ==
TString(
"HistoPath" ) ) {
1430 else if( attrName ==
TString(
"InputFile" ) ) {
1435 cxcoutEHF <<
"Error: Encountered Element in ActivateStatError with unknown name: "
1436 << attrName << std::endl;
1484 cxcoutIHF <<
"Parsing FunctionConfig" << std::endl;
1491 std::string Expression;
1492 std::string Dependents;
1495 while( ( curAttr =
dynamic_cast< TXMLAttr*
>( attribIt() ) ) !=
nullptr ) {
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;
1519 if( Dependents.empty() ){
1520 cxcoutEHF <<
"Error processing PreprocessFunction: Dependents attribute is empty" << std::endl;
1526 cxcoutIHF <<
"Created Preprocess Function: " << func.
GetCommand() << std::endl;
1553 if( attrVal.empty() ) {
1554 cxcoutEHF <<
"Error: In " << NodeTitle
1555 <<
" Expected either 'True' or 'False' but found empty" << std::endl;
1558 else if ( attrVal ==
"True" || attrVal ==
"true" )
return true;
1559 else if ( attrVal ==
"False" || attrVal ==
"false" )
return false;
1561 cxcoutEHF <<
"Error: In " << NodeTitle
1562 <<
" 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 input
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 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::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)
Print information about measurement object in tree-like structure to given stream.
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.
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.