56 cxcoutWHF <<
"Warning: Setting parameter: " << param <<
" to constant, but it is already listed as constant. "
57 <<
"You may ignore this warning." << std::endl;
73 <<
" to: " <<
value << std::endl;
77 cxcoutIHF <<
"Setting parameter: " << param <<
" value to " <<
value << std::endl;
95 std::vector<std::string> PreprocessFunctionExpressions;
98 PreprocessFunctionExpressions.push_back(expression);
100 return PreprocessFunctionExpressions;
131 for (
unsigned int i = 0; i <
fChannels.size(); ++i) {
134 if (chan.
GetName() == ChanName) {
146 for (
unsigned int i = 0; i <
fChannels.size(); ++i) {
149 if (chan.
GetName() == ChanName) {
156 cxcoutEHF <<
"Error: Did not find channel: " << ChanName <<
" in measurement: " <<
GetName() << std::endl;
168 for (
unsigned int i = 0; i <
fPOI.size(); ++i) {
169 stream <<
fPOI.at(i);
175 stream <<
"Constant Params: ";
183 stream <<
"Preprocess Functions: ";
191 stream <<
"Channels:" << std::endl;
192 for (
unsigned int i = 0; i <
fChannels.size(); ++i) {
208 auto testExists = [](
const std::string &theDirectory) {
210 bool exists = dir !=
nullptr;
217 if (!directory.empty() && !testExists(directory)) {
220 cxcoutEHF <<
"Error: Failed to make directory: " << directory << std::endl;
227 cxcoutPHF <<
"Printing XML Files for measurement: " <<
GetName() << std::endl;
229 std::string XMLName = std::string(
GetName()) +
".xml";
230 if (!directory.empty())
231 XMLName = directory +
"/" + XMLName;
233 std::ofstream xml(XMLName.c_str());
235 if (!xml.is_open()) {
236 cxcoutEHF <<
"Error opening xml file: " << XMLName << std::endl;
241 xml <<
"<!--" << std::endl;
242 xml <<
"This xml file created automatically on: " << std::endl;
249 t.
GetDate(
true, 0, &year, &month, &day);
250 xml << year <<
'-' << month <<
'-' << day << std::endl;
252 xml <<
"-->" << std::endl;
255 xml <<
"<!DOCTYPE Combination SYSTEM 'HistFactorySchema.dtd'>" << std::endl << std::endl;
258 if (newOutputPrefix.empty())
260 xml <<
"<Combination OutputFilePrefix=\"" << newOutputPrefix <<
"\" >" << std::endl
272 for (
unsigned int i = 0; i <
fChannels.size(); ++i) {
273 xml <<
" <Input>" <<
"./";
274 if (!directory.empty())
275 xml << directory <<
"/";
276 xml <<
GetName() <<
"_" <<
fChannels.at(i).GetName() <<
".xml" <<
"</Input>" << std::endl;
282 xml <<
" <Measurement Name=\"" <<
GetName() <<
"\" "
283 <<
"Lumi=\"" <<
fLumi <<
"\" "
288 <<
"ExportOnly=\"" << (
fExportOnly ? std::string(
"True") : std::string(
"False")) <<
"\" "
289 <<
" >" << std::endl;
293 for (
unsigned int i = 0; i <
fPOI.size(); ++i) {
297 xml <<
" " <<
fPOI.at(i);
300 xml <<
"</POI> " << std::endl;
304 xml <<
" <ParamSetting Const=\"True\">";
312 xml <<
"</ParamSetting>" << std::endl;
316 std::map<std::string, double>::iterator ConstrItr;
320 xml <<
"<ConstraintTerm Type=\"Gamma\" RelativeUncertainty=\"" << ConstrItr->second <<
"\">" << ConstrItr->first
321 <<
"</ConstraintTerm>" << std::endl;
325 xml <<
"<ConstraintTerm Type=\"Uniform\" RelativeUncertainty=\"" << ConstrItr->second <<
"\">" << ConstrItr->first
326 <<
"</ConstraintTerm>" << std::endl;
330 xml <<
"<ConstraintTerm Type=\"LogNormal\" RelativeUncertainty=\"" << ConstrItr->second <<
"\">"
331 << ConstrItr->first <<
"</ConstraintTerm>" << std::endl;
334 for (ConstrItr =
fNoSyst.begin(); ConstrItr !=
fNoSyst.end(); ++ConstrItr) {
335 xml <<
"<ConstraintTerm Type=\"NoSyst\" RelativeUncertainty=\"" << ConstrItr->second <<
"\">" << ConstrItr->first
336 <<
"</ConstraintTerm>" << std::endl;
340 xml <<
" </Measurement> " << std::endl << std::endl;
343 xml <<
"</Combination>" << std::endl;
350 std::string prefix = std::string(
GetName()) +
"_";
352 for (
unsigned int i = 0; i <
fChannels.size(); ++i) {
353 fChannels.at(i).PrintXML(directory, prefix);
356 cxcoutPHF <<
"Finished printing XML files" << std::endl;
375 std::string OutputFileName = file->
GetName();
387 std::string chanName = channel.GetName();
389 if (!channel.CheckHistograms()) {
390 cxcoutEHF <<
"Measurement.writeToFile(): Channel: " << chanName <<
" has uninitialized histogram pointers"
405 if (chanDir ==
nullptr) {
406 cxcoutEHF <<
"Error: Cannot create channel " << (chanName +
"_hists") << std::endl;
413 if (dataDir ==
nullptr) {
414 cxcoutEHF <<
"Error: Cannot make directory " << chanDir << std::endl;
419 channel.fData.writeToFile(OutputFileName,
GetDirPath(dataDir));
422 for (
Sample &sample : channel.GetSamples()) {
423 cxcoutPHF <<
"Writing sample: " << sample.GetName() << std::endl;
428 if (sampleDir ==
nullptr) {
429 cxcoutEHF <<
"Error: Directory " << sample.
GetName() <<
" not created properly" << std::endl;
432 std::string sampleDirPath =
GetDirPath(sampleDir);
435 cxcoutEHF <<
"Error making directory: " << sample.GetName() <<
" in directory: " << chanName << std::endl;
442 sample.writeToFile(OutputFileName, sampleDirPath);
448 cxcoutPHF <<
"Saved all histograms" << std::endl;
453 cxcoutPHF <<
"Saved Measurement" << std::endl;
460 std::string path = dir->
GetPath();
462 if (path.find(
':') != std::string::npos) {
463 size_t index = path.find(
':');
464 path.replace(0,
index + 1,
"");
481 chan.CollectHistograms();
496 : fName(other.fName),
497 fInputFile(other.fInputFile),
498 fHistoName(other.fHistoName),
499 fHistoPath(other.fHistoPath),
500 fChannelName(other.fChannelName),
502 fOverallSysList(other.fOverallSysList),
503 fNormFactorList(other.fNormFactorList),
504 fHistoSysList(other.fHistoSysList),
505 fHistoFactorList(other.fHistoFactorList),
506 fShapeSysList(other.fShapeSysList),
507 fShapeFactorList(other.fShapeFactorList),
509 fStatError(other.fStatError),
510 fNormalizeByTheory(other.fNormalizeByTheory),
511 fStatErrorActivate(other.fStatErrorActivate),
512 fhNominal(other.fhNominal)
552Sample::Sample(std::string SampName, std::string SampHistoName, std::string SampInputFile, std::string SampHistoPath)
554 fInputFile(SampInputFile),
555 fHistoName(SampHistoName),
556 fHistoPath(SampHistoPath),
557 fNormalizeByTheory(true),
558 fStatErrorActivate(false)
562Sample::Sample(std::string SampName) : fName(SampName), fNormalizeByTheory(true), fStatErrorActivate(false) {}
574 histNominal->
Write();
610 std::string SampleHistName =
fName +
"_hist";
615 fhCountingHist = std::make_unique<TH1F>(SampleHistName.c_str(), SampleHistName.c_str(), 1, 0, 1);
630 stream <<
"\t \t \t \t "
632 <<
"\t HistoAddress: "
658 xml <<
" <Sample Name=\"" <<
fName <<
"\" "
662 <<
" NormalizeByTheory=\"" << (
fNormalizeByTheory ? std::string(
"True") : std::string(
"False")) <<
"\" "
755 xml <<
" </Sample>" << std::endl;
786 sys.SetHigh(SysHigh);
815 std::string SysHistoPathLow, std::string SysHistoNameHigh, std::string SysHistoFileHigh,
816 std::string SysHistoPathHigh)
822 sys.SetHistoNameLow(SysHistoNameLow);
823 sys.SetHistoPathLow(SysHistoPathLow);
824 sys.SetInputFileLow(SysHistoFileLow);
826 sys.SetHistoNameHigh(SysHistoNameHigh);
827 sys.SetHistoPathHigh(SysHistoPathHigh);
828 sys.SetInputFileHigh(SysHistoFileHigh);
839 std::string SysHistoPathLow, std::string SysHistoNameHigh, std::string SysHistoFileHigh,
840 std::string SysHistoPathHigh)
885 std::string SysHistoFile, std::string SysHistoPath)
890 sys.SetConstraintType(SysConstraintType);
892 sys.SetHistoName(SysHistoName);
893 sys.SetHistoPath(SysHistoPath);
894 sys.SetInputFile(SysHistoFile);
914Channel::Channel(std::string ChanName, std::string ChanInputFile) : fName(ChanName), fInputFile(ChanInputFile)
935 stream <<
"\t Channel Name: " <<
fName <<
"\t InputFile: " <<
fInputFile << std::endl;
937 stream <<
"\t Data:" << std::endl;
940 stream <<
"\t statErrorConfig:" << std::endl;
945 stream <<
"\t Samples: " << std::endl;
946 for (
unsigned int i = 0; i <
fSamples.size(); ++i) {
951 stream <<
"\t End of Channel " <<
fName << std::endl;
960 std::string XMLName = prefix +
fName +
".xml";
961 if (!directory.empty())
962 XMLName = directory +
"/" + XMLName;
964 std::ofstream xml(XMLName.c_str());
967 xml <<
"<!--" << std::endl;
968 xml <<
"This xml file created automatically on: " << std::endl;
974 t.
GetDate(
true, 0, &year, &month, &day);
975 xml << year <<
'-' << month <<
'-' << day << std::endl;
976 xml <<
"-->" << std::endl;
979 xml <<
"<!DOCTYPE Channel SYSTEM 'HistFactorySchema.dtd'> " << std::endl << std::endl;
982 xml <<
" <Channel Name=\"" <<
fName <<
"\" InputFile=\"" <<
fInputFile <<
"\" >" << std::endl << std::endl;
996 for (
auto const &sample :
fSamples) {
997 sample.PrintXML(xml);
998 xml << std::endl << std::endl;
1002 xml <<
" </Channel> " << std::endl;
1005 cxcoutPHF <<
"Finished printing XML files" << std::endl;
1008void Channel::SetData(std::string DataHistoName, std::string DataInputFile, std::string DataHistoPath)
1032 std::string DataHistName =
fName +
"_data";
1035 TH1F *hData =
new TH1F(DataHistName.c_str(), DataHistName.c_str(), 1, 0, 1);
1064 std::map<std::string, std::unique_ptr<TFile>> fileHandles;
1074 if (!
data.GetInputFile().empty()) {
1082 cxcoutDHF <<
"Collecting Nominal Histogram" << std::endl;
1083 TH1 *Nominal =
GetHistogram(sample.GetInputFile(), sample.GetHistoPath(), sample.GetHistoName(), fileHandles);
1085 sample.SetHisto(Nominal);
1088 if (sample.GetStatError().GetUseHisto()) {
1089 sample.GetStatError().SetErrorHist(
GetHistogram(sample.GetStatError().GetInputFile(),
1090 sample.GetStatError().GetHistoPath(),
1091 sample.GetStatError().GetHistoName(), fileHandles));
1095 for (
HistoSys &histoSys : sample.GetHistoSysList()) {
1096 histoSys.SetHistoLow(
GetHistogram(histoSys.GetInputFileLow(), histoSys.GetHistoPathLow(),
1097 histoSys.GetHistoNameLow(), fileHandles));
1099 histoSys.SetHistoHigh(
GetHistogram(histoSys.GetInputFileHigh(), histoSys.GetHistoPathHigh(),
1100 histoSys.GetHistoNameHigh(), fileHandles));
1104 for (
HistoFactor &histoFactor : sample.GetHistoFactorList()) {
1105 histoFactor.SetHistoLow(
GetHistogram(histoFactor.GetInputFileLow(), histoFactor.GetHistoPathLow(),
1106 histoFactor.GetHistoNameLow(), fileHandles));
1108 histoFactor.SetHistoHigh(
GetHistogram(histoFactor.GetInputFileHigh(), histoFactor.GetHistoPathHigh(),
1109 histoFactor.GetHistoNameHigh(), fileHandles));
1113 for (
ShapeSys &shapeSys : sample.GetShapeSysList()) {
1114 shapeSys.SetErrorHist(
1115 GetHistogram(shapeSys.GetInputFile(), shapeSys.GetHistoPath(), shapeSys.GetHistoName(), fileHandles));
1119 for (
ShapeFactor &shapeFactor : sample.GetShapeFactorList()) {
1121 if (shapeFactor.HasInitialShape()) {
1122 TH1 *hist =
GetHistogram(shapeFactor.GetInputFile(), shapeFactor.GetHistoPath(), shapeFactor.GetHistoName(),
1124 shapeFactor.SetInitialShape(hist);
1139 cxcoutEHF <<
"Error: Data Histogram for channel " <<
GetName() <<
" is nullptr." << std::endl;
1146 if (sample.GetHisto() ==
nullptr) {
1147 cxcoutEHF <<
"Error: Nominal Histogram for sample " << sample.GetName() <<
" is nullptr." << std::endl;
1152 std::vector<int> NegativeBinNumber;
1153 std::vector<double> NegativeBinContent;
1154 const TH1 *histNominal = sample.GetHisto();
1155 for (
int ibin = 1; ibin <= histNominal->
GetNbinsX(); ++ibin) {
1157 NegativeBinNumber.push_back(ibin);
1158 NegativeBinContent.push_back(histNominal->
GetBinContent(ibin));
1161 if (!NegativeBinNumber.empty()) {
1162 cxcoutWHF <<
"WARNING: Nominal Histogram " << histNominal->
GetName() <<
" for Sample = " << sample.GetName()
1163 <<
" in Channel = " <<
GetName() <<
" has negative entries in bin numbers = ";
1165 for (
unsigned int ibin = 0; ibin < NegativeBinNumber.size(); ++ibin) {
1168 std::cout << NegativeBinNumber[ibin] <<
" : " << NegativeBinContent[ibin];
1170 std::cout << std::endl;
1175 if (sample.GetStatError().GetUseHisto()) {
1176 if (sample.GetStatError().GetErrorHist() ==
nullptr) {
1177 cxcoutEHF <<
"Error: Statistical Error Histogram for sample " << sample.GetName() <<
" is nullptr."
1184 for (
const HistoSys &histoSys : sample.GetHistoSysList()) {
1186 if (histoSys.GetHistoLow() ==
nullptr) {
1187 cxcoutEHF <<
"Error: HistoSyst Low for Systematic " << histoSys.GetName() <<
" in sample "
1188 << sample.GetName() <<
" is nullptr." << std::endl;
1191 if (histoSys.GetHistoHigh() ==
nullptr) {
1192 cxcoutEHF <<
"Error: HistoSyst High for Systematic " << histoSys.GetName() <<
" in sample "
1193 << sample.GetName() <<
" is nullptr." << std::endl;
1200 for (
const HistoFactor &histoFactor : sample.GetHistoFactorList()) {
1202 if (histoFactor.GetHistoLow() ==
nullptr) {
1203 cxcoutEHF <<
"Error: HistoSyst Low for Systematic " << histoFactor.GetName() <<
" in sample "
1204 << sample.GetName() <<
" is nullptr." << std::endl;
1207 if (histoFactor.GetHistoHigh() ==
nullptr) {
1208 cxcoutEHF <<
"Error: HistoSyst High for Systematic " << histoFactor.GetName() <<
" in sample "
1209 << sample.GetName() <<
" is nullptr." << std::endl;
1216 for (
const ShapeSys &shapeSys : sample.GetShapeSysList()) {
1217 if (shapeSys.GetErrorHist() ==
nullptr) {
1218 cxcoutEHF <<
"Error: HistoSyst High for Systematic " << shapeSys.GetName() <<
" in sample "
1219 << sample.GetName() <<
" is nullptr." << std::endl;
1235 std::map<std::string, std::unique_ptr<TFile>> &lsof)
1238 cxcoutPHF <<
"Getting histogram " << InputFile <<
":" << HistoPath <<
"/" << HistoName << std::endl;
1240 auto &inFile = lsof[InputFile];
1241 if (!inFile || !inFile->IsOpen()) {
1243 if (!inFile || !inFile->IsOpen()) {
1244 cxcoutEHF <<
"Error: Unable to open input file: " << InputFile << std::endl;
1247 cxcoutIHF <<
"Opened input file: " << InputFile <<
": " << std::endl;
1251 if (dir ==
nullptr) {
1252 cxcoutEHF <<
"Histogram path '" << HistoPath <<
"' wasn't found in file '" << InputFile <<
"'." << std::endl;
1258 auto key = dir->
GetKey(HistoName.c_str());
1259 if (key ==
nullptr) {
1260 cxcoutEHF <<
"Histogram '" << HistoName <<
"' wasn't found in file '" << InputFile <<
"' in directory '"
1261 << HistoPath <<
"'." << std::endl;
1265 std::unique_ptr<TH1> hist(key->ReadObject<
TH1>());
1267 cxcoutEHF <<
"Histogram '" << HistoName <<
"' wasn't found in file '" << InputFile <<
"' in directory '"
1268 << HistoPath <<
"'." << std::endl;
1273 TH1 *ptr =
static_cast<TH1 *
>(hist->Clone());
1276 std::cerr <<
"Not all necessary info are set to access the input file. Check your config" << std::endl;
1277 std::cerr <<
"filename: " << InputFile <<
"path: " << HistoPath <<
"obj: " << HistoName << std::endl;
1282 std::cout <<
"Found Histogram: " << HistoName
" at address: " << ptr <<
" with integral " << ptr->
Integral()
1283 <<
" and mean " << ptr->
GetMean() << std::endl;
1295Data::Data(std::string HistoName, std::string InputFile, std::string HistoPath)
1296 : fInputFile(InputFile), fHistoName(HistoName), fHistoPath(HistoPath)
1314 <<
"\t HistoAddress: " <<
GetHisto() << std::endl;
1322 if (histData !=
nullptr) {
1338 xml <<
" <Data HistoName=\"" <<
GetHistoName() <<
"\" "
1342 xml <<
"Name=\"" <<
GetName() <<
"\" ";
1344 xml <<
" /> " << std::endl << std::endl;
1355std::string escapeXML(
const std::string &
src)
1357 std::stringstream
dst;
1358 for (
char ch :
src) {
1360 case '&':
dst <<
"&";
break;
1361 case '\'':
dst <<
"'";
break;
1362 case '"':
dst <<
""";
break;
1363 case '<':
dst <<
"<";
break;
1364 case '>':
dst <<
">";
break;
1365 default:
dst << ch;
break;
1374 std::string
const &dependents)
1375 : fName(
name), fExpression(expression), fDependents(dependents)
1392 xml <<
"<Function Name=\"" <<
fName <<
"\" "
1393 <<
"Expression=\"" << escapeXML(
fExpression) <<
"\" "
1438 std::string param = itr->first;
1439 double val = itr->second;
1444 std::cout <<
"Error: Trying to set variable: " << var
1445 <<
" to a specific value in creation of asimov dataset: " <<
fName
1446 <<
" but this variable doesn't appear to exist in the workspace" << std::endl;
1451 double inRange = var->
inRange(val,
nullptr);
1453 std::cout <<
"Error: Attempting to set variable: " << var <<
" to value: " << val <<
", however it appears"
1454 <<
" that this is not withn the variable's range: "
1455 <<
"[" << var->
getMin() <<
", " << var->
getMax() <<
"]" << std::endl;
1460 std::cout <<
"Configuring Asimov Dataset: Setting " << param <<
" = " << val << std::endl;
1473 std::cout <<
"Error: Trying to set variable: " << var <<
" constant in creation of asimov dataset: " <<
fName
1474 <<
" but this variable doesn't appear to exist in the workspace" << std::endl;
1478 std::cout <<
"Configuring Asimov Dataset: Setting " << param <<
" to constant " << std::endl;
1515 fHist = std::move(other.fHist);
1527 return static_cast<TH1 *
>(
h->Clone());
1550 return fHist.release();
1568 std::cout <<
"Error: Given empty name for ConstraintType" << std::endl;
1572 else if (Name ==
"Gaussian" || Name ==
"Gauss") {
1576 else if (Name ==
"Poisson" || Name ==
"Pois") {
1581 std::cout <<
"Error: Unknown name given for Constraint Type: " << Name << std::endl;
1588 stream <<
"\t \t Name: " <<
fName <<
"\t Val: " <<
fVal <<
"\t Low: " <<
fLow <<
"\t High: " <<
fHigh << std::endl;
1593 xml <<
" <NormFactor Name=\"" <<
GetName() <<
"\" "
1594 <<
" Val=\"" <<
GetVal() <<
"\" "
1595 <<
" High=\"" <<
GetHigh() <<
"\" "
1596 <<
" Low=\"" <<
GetLow() <<
"\" "
1597 <<
" /> " << std::endl;
1602 stream <<
"\t \t Name: " <<
fName <<
"\t Low: " <<
fLow <<
"\t High: " <<
fHigh << std::endl;
1607 xml <<
" <OverallSys Name=\"" <<
GetName() <<
"\" "
1608 <<
" High=\"" <<
GetHigh() <<
"\" "
1609 <<
" Low=\"" <<
GetLow() <<
"\" "
1610 <<
" /> " << std::endl;
1616 : fName(Name), fhLow(nullptr), fhHigh(nullptr)
1640 if (histLow ==
nullptr) {
1641 std::cout <<
"Error: Cannot write " <<
GetName() <<
" to file: " << FileName <<
" HistoLow is nullptr"
1651 if (histHigh ==
nullptr) {
1652 std::cout <<
"Error: Cannot write " <<
GetName() <<
" to file: " << FileName <<
" HistoHigh is nullptr"
1664 xml <<
" <HistoSys Name=\"" <<
GetName() <<
"\" "
1672 <<
" /> " << std::endl;
1688 xml <<
" <ShapeSys Name=\"" <<
GetName() <<
"\" "
1693 <<
" /> " << std::endl;
1699 if (histError ==
nullptr) {
1700 std::cout <<
"Error: Cannot write " <<
GetName() <<
" to file: " << FileName <<
" ErrorHist is nullptr"
1712 xml <<
" <HistoFactor Name=\"" <<
GetName() <<
"\" "
1721 <<
" /> " << std::endl;
1732 stream <<
"\t \t Name: " <<
fName << std::endl;
1740 stream <<
"\t \t Value: " <<
GetVal() <<
" L(" <<
GetLow() <<
" - " <<
GetHigh() <<
")\n";
1743 stream <<
"\t \t ( Constant ): " << std::endl;
1752 if (histInitialShape ==
nullptr) {
1753 std::cout <<
"Error: Cannot write " <<
GetName() <<
" to file: " << FileName <<
" InitialShape is nullptr"
1757 histInitialShape->Write();
1766 xml <<
" <ShapeFactor Name=\"" <<
GetName() <<
"\" ";
1772 xml <<
" Val=\"" <<
GetVal() <<
"\" "
1773 <<
" High=\"" <<
GetHigh() <<
"\" "
1774 <<
" Low=\"" <<
GetLow() <<
"\" "
1775 <<
" Const=\"" << (
IsConstant() ? std::string(
"True") : std::string(
"False")) <<
"\" ";
1776 xml <<
" /> " << std::endl;
1794 <<
"/> " << std::endl
1808 xml <<
" <StatError Activate=\"" << (
GetActivate() ? std::string(
"True") : std::string(
"False")) <<
"\" "
1812 <<
" /> " << std::endl;
1821 std::string statErrorHistName =
"statisticalErrors";
1824 if (hStatError ==
nullptr) {
1825 std::cout <<
"Error: Stat Error error hist is nullptr" << std::endl;
1828 hStatError->Write(statErrorHistName.c_str());
1838 fInputFileLow{oth.fInputFileLow},
1839 fHistoNameLow{oth.fHistoNameLow},
1840 fHistoPathLow{oth.fHistoPathLow},
1841 fInputFileHigh{oth.fInputFileHigh},
1842 fHistoNameHigh{oth.fHistoNameHigh},
1843 fHistoPathHigh{oth.fHistoPathHigh},
1844 fhLow{oth.fhLow ? static_cast<
TH1 *>(oth.fhLow->Clone()) : nullptr},
1845 fhHigh{oth.fhHigh ? static_cast<
TH1 *>(oth.fhHigh->Clone()) : nullptr}
1848 fhLow->SetDirectory(
nullptr);
1850 fhHigh->SetDirectory(
nullptr);
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
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 index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
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
R__EXTERN TSystem * gSystem
void setConstant(bool value=true)
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
bool inRange(const char *name) const override
Check if current value is inside range with given name.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
std::map< std::string, double > fParamValsToSet
void ConfigureWorkspace(RooWorkspace *)
std::map< std::string, bool > fParamsToFix
This class encapsulates all information for the statistical interpretation of one experiment.
std::vector< RooStats::HistFactory::Sample > fSamples
std::vector< RooStats::HistFactory::Data > fAdditionalData
One can add additional datasets These are simply added to the xml under a different name.
void Print(std::ostream &=std::cout)
HistFactory::StatErrorConfig fStatErrorConfig
void SetData(const RooStats::HistFactory::Data &data)
set data object
void AddSample(RooStats::HistFactory::Sample sample)
bool CheckHistograms() const
TH1 * GetHistogram(std::string InputFile, std::string HistoPath, std::string HistoName, std::map< std::string, std::unique_ptr< TFile > > &lsof)
Open a file and copy a histogram.
void SetStatErrorConfig(double RelErrorThreshold, Constraint::Type ConstraintType)
void PrintXML(std::string const &directory, std::string const &prefix="") const
std::string GetName() const
get name of channel
void Print(std::ostream &=std::cout)
std::string const & GetInputFile() const
void PrintXML(std::ostream &) const
void SetInputFile(const std::string &InputFile)
void SetHistoPath(const std::string &HistoPath)
void writeToFile(std::string FileName, std::string DirName)
std::string const & GetHistoName() const
void SetHistoName(const std::string &HistoName)
std::string const & GetHistoPath() const
std::string const & GetName() const
Internal class wrapping an histogram and managing its content.
HistRef(TH1 *h=nullptr)
constructor - use gives away ownerhip of the given pointer
HistRef & operator=(const HistRef &other)
assignment operator (delete previous contained histogram)
void SetObject(TH1 *h)
set the object - user gives away the ownerhisp
std::unique_ptr< TH1 > fHist
pointer to contained histogram
static TH1 * CopyObject(const TH1 *h)
TH1 * ReleaseObject()
Release ownership of object.
Configuration for an *un*constrained, coherent shape variation of affected samples.
void PrintXML(std::ostream &) const override
Configuration for a constrained, coherent shape variation of affected samples.
void PrintXML(std::ostream &) const override
////////////////////////////////////////////////////////////////////////////////////////////Base clas...
void SetInputFileHigh(const std::string &InputFileHigh)
std::unique_ptr< TH1 > fhHigh
void SetHistoHigh(TH1 *High)
void SetName(const std::string &Name)
std::string fHistoPathHigh
virtual void writeToFile(const std::string &FileName, const std::string &DirName)
std::string fInputFileLow
void SetHistoPathHigh(const std::string &HistoPathHigh)
HistogramUncertaintyBase()
std::string fHistoPathLow
const std::string & GetName() const
void SetInputFileLow(const std::string &InputFileLow)
const TH1 * GetHistoHigh() const
const std::string & GetHistoNameHigh() const
std::string fHistoNameLow
std::string fHistoNameHigh
const std::string & GetHistoNameLow() const
std::string fInputFileHigh
void SetHistoNameHigh(const std::string &HistoNameHigh)
void SetHistoNameLow(const std::string &HistoNameLow)
virtual void Print(std::ostream &=std::cout) const
HistogramUncertaintyBase & operator=(const HistogramUncertaintyBase &oth)
const std::string & GetHistoPathLow() const
const std::string & GetInputFileHigh() const
const std::string & GetInputFileLow() const
void SetHistoPathLow(const std::string &HistoPathLow)
void SetHistoLow(TH1 *Low)
std::unique_ptr< TH1 > fhLow
const std::string & GetHistoPathHigh() const
const TH1 * GetHistoLow() const
virtual ~HistogramUncertaintyBase()
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
void writeToFile(TFile *file)
A measurement, once fully configured, can be saved into a ROOT file.
std::map< std::string, double > fUniformSyst
std::string fOutputFilePrefix
Configurables of this measurement.
void AddGammaSyst(std::string syst, double uncert)
Set constraint term for given systematic to Gamma distribution.
std::string GetDirPath(TDirectory *dir)
Return the directory's path, stripped of unnecessary prefixes.
std::map< std::string, double > fNoSyst
std::vector< RooStats::HistFactory::Channel > fChannels
Channels that make up this measurement.
void AddLogNormSyst(std::string syst, double uncert)
Set constraint term for given systematic to LogNormal distribution.
void PrintXML(std::string Directory="", std::string NewOutputPrefix="")
Print to a stream.
void SetParamValue(const std::string ¶m, double value)
Set a parameter to a specific value (And optionally fix it)
std::map< std::string, double > fGammaSyst
List of Alternate constraint terms.
std::map< std::string, double > fParamValues
Map of parameter names to initial values to be set.
void CollectHistograms()
The most common way to add histograms to channels is to have them stored in ROOT files and to give Hi...
std::vector< RooStats::HistFactory::PreprocessFunction > fFunctionObjects
List of Preprocess Function objects.
RooStats::HistFactory::Channel & GetChannel(std::string)
Get channel with given name from this measurement throws an exception in case the channel is not foun...
bool HasChannel(std::string)
Check if the given channel is part of this measurement.
void AddUniformSyst(std::string syst)
Set constraint term for given systematic to uniform distribution.
void PrintTree(std::ostream &=std::cout)
Print information about measurement object in tree-like structure to given stream.
void AddNoSyst(std::string syst)
Define given systematics to have no external constraint.
void AddConstantParam(const std::string ¶m)
Add a parameter to be set as constant (Similar to ParamSetting method below)
void AddFunctionObject(const RooStats::HistFactory::PreprocessFunction function)
add a preprocess function object
void AddPreprocessFunction(std::string name, std::string expression, std::string dependencies)
Add a preprocessed function by giving the function a name, a functional expression,...
std::vector< std::string > GetPreprocessFunctions() const
Returns a list of defined preprocess function expressions.
std::map< std::string, double > fLogNormSyst
std::vector< std::string > fPOI
std::vector< std::string > fConstantParams
List of Parameters to be set constant.
Configuration for an un- constrained overall systematic to scale sample normalisations.
std::string GetName() const
void Print(std::ostream &=std::cout) const
void PrintXML(std::ostream &) 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 PrintXML(std::ostream &) const
void Print(std::ostream &=std::cout) const
void Print(std::ostream &=std::cout) const
std::string GetCommand() const
void PrintXML(std::ostream &) const
std::vector< RooStats::HistFactory::ShapeFactor > fShapeFactorList
std::unique_ptr< TH1 > fhCountingHist
void AddShapeSys(std::string Name, Constraint::Type ConstraintType, std::string HistoName, std::string HistoFile, std::string HistoPath="")
void AddOverallSys(std::string Name, double Low, double High)
void writeToFile(std::string FileName, std::string DirName)
const TH1 * GetHisto() const
void SetValue(double Val)
RooStats::HistFactory::StatError fStatError
Properties.
void SetChannelName(const std::string &ChannelName)
set name of associated channel
std::vector< RooStats::HistFactory::NormFactor > fNormFactorList
void AddNormFactor(std::string const &Name, double Val, double Low, double High)
Sample & operator=(const Sample &other)
std::string fChannelName
The Name of the parent channel.
std::vector< RooStats::HistFactory::OverallSys > fOverallSysList
void SetHisto(TH1 *histo)
void Print(std::ostream &=std::cout) const
std::vector< RooStats::HistFactory::HistoSys > fHistoSysList
RooStats::HistFactory::StatError & GetStatError()
void AddHistoFactor(std::string Name, std::string HistoNameLow, std::string HistoFileLow, std::string HistoPathLow, std::string HistoNameHigh, std::string HistoFileHigh, std::string HistoPathHigh)
std::vector< RooStats::HistFactory::ShapeFactor > & GetShapeFactorList()
std::vector< RooStats::HistFactory::HistoFactor > & GetHistoFactorList()
std::vector< RooStats::HistFactory::HistoSys > & GetHistoSysList()
std::vector< RooStats::HistFactory::HistoFactor > fHistoFactorList
std::vector< RooStats::HistFactory::ShapeSys > fShapeSysList
HistRef fhNominal
The Nominal Shape.
void AddShapeFactor(std::string Name)
std::vector< RooStats::HistFactory::ShapeSys > & GetShapeSysList()
void AddHistoSys(std::string Name, std::string HistoNameLow, std::string HistoFileLow, std::string HistoPathLow, std::string HistoNameHigh, std::string HistoFileHigh, std::string HistoPathHigh)
void PrintXML(std::ofstream &xml) const
*Un*constrained bin-by-bin variation of affected histogram.
void PrintXML(std::ostream &) const override
const std::string & GetHistoPath() const
const TH1 * GetInitialShape() const
void SetInitialShape(TH1 *shape)
void writeToFile(const std::string &FileName, const std::string &DirName) override
void Print(std::ostream &=std::cout) const override
const std::string & GetInputFile() const
bool HasInitialShape() const
const std::string & GetHistoName() const
Constrained bin-by-bin variation of affected histogram.
std::string GetHistoPath() const
void PrintXML(std::ostream &) const override
Constraint::Type GetConstraintType() const
const TH1 * GetErrorHist() const
std::string GetHistoName() const
void writeToFile(const std::string &FileName, const std::string &DirName) override
void Print(std::ostream &=std::cout) const override
std::string GetInputFile() const
void SetErrorHist(TH1 *hError)
double fRelErrorThreshold
void PrintXML(std::ostream &) const
void SetConstraintType(Constraint::Type ConstrType)
Constraint::Type fConstraintType
double GetRelErrorThreshold() const
void SetRelErrorThreshold(double Threshold)
Constraint::Type GetConstraintType() const
void Print(std::ostream &=std::cout) const
const std::string & GetHistoPath() const
void Activate(bool IsActive=true)
void SetHistoPath(const std::string &HistoPath)
void SetInputFile(const std::string &InputFile)
const TH1 * GetErrorHist() const
void SetErrorHist(TH1 *Error)
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
void PrintXML(std::ostream &) const override
void writeToFile(const std::string &FileName, const std::string &DirName) override
Persistable container for RooFit projects.
RooRealVar * var(RooStringView name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
Bool_t cd() override
Change current directory to "this" directory.
TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE) override
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
TDirectory::TContext keeps track and restore the current directory.
Describe directory structure in memory.
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
virtual const char * GetPath() const
Returns the full path of the directory.
virtual Bool_t cd()
Change current directory to "this" directory.
virtual TKey * GetKey(const char *, Short_t=9999) const
virtual TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE)
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
virtual void Flush()
Synchronize a file's in-memory and on-disk states.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
virtual Int_t GetNbinsX() const
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
const char * GetName() const override
Returns name of object.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory.
virtual int MakeDirectory(const char *name)
Make a directory.
The TTimeStamp encapsulates seconds and ns since EPOCH.
UInt_t GetDate(Bool_t inUTC=kTRUE, Int_t secOffset=0, UInt_t *year=nullptr, UInt_t *month=nullptr, UInt_t *day=nullptr) const
Return date in form of 19971224 (i.e.
Type GetType(const std::string &Name)
std::string Name(Type type)