120using std::endl, std::string, std::map, std::list, std::ifstream, std::ofstream, std::ostream;
136struct FinalizeVarsOutput {
138 std::unique_ptr<RooRealVar> weight;
139 std::string weightVarName;
143FinalizeVarsOutput finalizeVars(
RooArgSet const &vars,
145 const char* wgtVarName,
150 FinalizeVarsOutput
out;
151 out.finalVars.add(vars);
155 std::vector<RooAbsData*> weightedImpDatasets;
156 if(impData && impData->
isWeighted()) weightedImpDatasets.push_back(impData);
158 if(
data->isWeighted()) {
159 weightedImpDatasets.push_back(
data);
163 bool needsWeightErrors =
false;
168 needsWeightErrors =
true;
173 out.finalVars.add(*indexCat,
true);
176 out.weightVarName = wgtVarName ? wgtVarName :
"";
178 if(
out.weightVarName.empty()) {
184 out.weightVarName = ds->weightVar()->GetName();
198 if (!
out.weightVarName.empty() && !wgtVar) {
199 const char*
name =
out.weightVarName.c_str();
200 out.weight = std::make_unique<RooRealVar>(
name,
name, 1.0);
201 wgtVar =
out.weight.get();
202 out.finalVars.add(*
out.weight);
205 if(needsWeightErrors) {
206 out.errorSet.add(*wgtVar);
210 if(errorSet)
out.errorSet.add(*errorSet,
true);
216std::unique_ptr<RooDataSet> makeDataSetFromDataHist(
RooDataHist const &hist)
221 const char* wgtName = wgtVarCmdArg.
getString(0);
284 RooCmdConfig pc(
"RooDataSet::ctor(" + std::string(GetName()) +
")");
285 pc.defineInt(
"ownLinked",
"OwnLinked",0) ;
286 pc.defineObject(
"impTree",
"ImportTree",0) ;
287 pc.defineObject(
"impData",
"ImportData",0) ;
288 pc.defineObject(
"indexCat",
"IndexCat",0) ;
289 pc.defineObject(
"impSliceData",
"ImportDataSlice",0,
nullptr,
true) ;
290 pc.defineString(
"impSliceState",
"ImportDataSlice",0,
"",
true) ;
291 pc.defineObject(
"lnkSliceData",
"LinkDataSlice",0,
nullptr,
true) ;
292 pc.defineString(
"lnkSliceState",
"LinkDataSlice",0,
"",
true) ;
293 pc.defineString(
"cutSpec",
"CutSpec",0,
"") ;
294 pc.defineObject(
"cutVar",
"CutVar",0) ;
295 pc.defineString(
"cutRange",
"CutRange",0,
"") ;
296 pc.defineString(
"wgtVarName",
"WeightVarName",0,
"") ;
297 pc.defineInt(
"newWeight1",
"WeightVarName",0,0) ;
298 pc.defineString(
"fname",
"ImportFromFile",0,
"") ;
299 pc.defineString(
"tname",
"ImportFromFile",1,
"") ;
300 pc.defineObject(
"wgtVar",
"WeightVar",0) ;
301 pc.defineInt(
"newWeight2",
"WeightVar",0,0) ;
302 pc.defineObject(
"dummy1",
"ImportDataSliceMany",0) ;
303 pc.defineObject(
"dummy2",
"LinkDataSliceMany",0) ;
304 pc.defineSet(
"errorSet",
"StoreError",0) ;
305 pc.defineSet(
"asymErrSet",
"StoreAsymError",0) ;
306 pc.defineSet(
"glObs",
"GlobalObservables",0,
nullptr) ;
307 pc.defineMutex(
"ImportTree",
"ImportData",
"ImportDataSlice",
"LinkDataSlice",
"ImportFromFile") ;
308 pc.defineMutex(
"CutSpec",
"CutVar") ;
309 pc.defineMutex(
"WeightVarName",
"WeightVar") ;
310 pc.defineDependency(
"ImportDataSlice",
"IndexCat") ;
311 pc.defineDependency(
"LinkDataSlice",
"IndexCat") ;
312 pc.defineDependency(
"OwnLinked",
"LinkDataSlice") ;
324 const std::string errMsg =
"Error in RooDataSet constructor: command argument list could not be processed";
325 coutE(InputArguments) << errMsg << std::endl;
326 throw std::invalid_argument(errMsg);
329 if(pc.getSet(
"glObs")) setGlobalObservables(*pc.getSet(
"glObs"));
332 TTree* impTree =
static_cast<TTree*
>(pc.getObject(
"impTree")) ;
333 auto impData =
static_cast<RooAbsData*
>(pc.getObject(
"impData")) ;
335 const char* cutSpec = pc.getString(
"cutSpec",
"",
true) ;
336 const char* cutRange = pc.getString(
"cutRange",
"",
true) ;
337 const char* wgtVarName = pc.getString(
"wgtVarName",
"",
true) ;
339 const char* impSliceNames = pc.getString(
"impSliceState",
"",
true) ;
340 const RooLinkedList& impSliceData = pc.getObjectList(
"impSliceData") ;
341 const char* lnkSliceNames = pc.getString(
"lnkSliceState",
"",
true) ;
342 const RooLinkedList& lnkSliceData = pc.getObjectList(
"lnkSliceData") ;
344 RooArgSet* asymErrorSet = pc.getSet(
"asymErrSet") ;
345 const char* fname = pc.getString(
"fname") ;
346 const char* tname = pc.getString(
"tname") ;
347 Int_t ownLinked = pc.getInt(
"ownLinked") ;
348 Int_t newWeight = pc.getInt(
"newWeight1") + pc.getInt(
"newWeight2") ;
352 wgtVarName = wgtVar->
GetName();
355 auto finalVarsInfo = finalizeVars(vars,indexCat,wgtVarName,impData,impSliceData, pc.getSet(
"errorSet"));
356 initializeVars(finalVarsInfo.finalVars);
357 if(!finalVarsInfo.weightVarName.empty()) {
358 wgtVarName = finalVarsInfo.weightVarName.c_str();
361 RooArgSet* errorSet = finalVarsInfo.errorSet.
empty() ? nullptr : &finalVarsInfo.errorSet;
367 map<string,RooAbsData*> hmap ;
370 strlcpy(tmp, lnkSliceNames, 64000);
371 char *token = strtok(tmp,
",");
372 auto hiter = lnkSliceData.
begin();
374 hmap[token] =
static_cast<RooAbsData *
>(*hiter);
375 token = strtok(
nullptr,
",");
380 appendToDir(
this,
true) ;
385 map<string,RooAbsDataStore*> storeMap ;
388 throw std::string(
"RooDataSet::RooDataSet() ERROR in constructor, cannot find index category") ;
390 for (map<string,RooAbsData*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
392 if (indexCat && !indexCat->
hasLabel(hiter->first)) {
394 coutI(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->
GetName() << endl ;
396 if (icat && !icat->
hasLabel(hiter->first)) {
399 icat->
setLabel(hiter->first.c_str()) ;
404 addOwnedComponent(hiter->first.c_str(),*hiter->second) ;
409 _dstore = std::make_unique<RooCompositeDataStore>(
name,title,_vars,*icat,storeMap) ;
416 if (defaultStorageType==Tree) {
417 _dstore = std::make_unique<RooTreeDataStore>(
name,title,_vars,wgtVarName) ;
419 }
else if (defaultStorageType==Vector) {
420 if (wgtVarName && newWeight) {
421 RooAbsArg* wgttmp = _vars.find(wgtVarName) ;
426 _dstore = std::make_unique<RooVectorDataStore>(
name,title,_vars,wgtVarName) ;
431 std::map<string,RooAbsData*> hmap ;
433 auto hiter = impSliceData.
begin() ;
434 for (
const auto& token :
ROOT::
Split(impSliceNames,
",")) {
435 hmap[token] =
static_cast<RooDataSet*
>(*hiter);
442 std::unique_ptr<RooArgSet> intErrorSet{_vars.selectCommon(*errorSet)};
443 intErrorSet->setAttribAll(
"StoreError") ;
445 arg->attachToStore(*_dstore) ;
449 std::unique_ptr<RooArgSet> intAsymErrorSet{_vars.selectCommon(*asymErrorSet)};
450 intAsymErrorSet->setAttribAll(
"StoreAsymError") ;
452 arg->attachToStore(*_dstore) ;
456 appendToDir(
this,
true) ;
462 std::unique_ptr<RooFormulaVar> cutVarTmp;
466 loadValuesFromSlices(*indexCat, hmap, cutRange, cutVar, cutSpec);
467 }
else if (impData) {
469 std::unique_ptr<RooDataSet> impDataSet;
473 impDataSet = makeDataSetFromDataHist(
static_cast<RooDataHist const &
>(*impData));
474 impData = impDataSet.
get();
477 cutVarTmp = std::make_unique<RooFormulaVar>(cutSpec, cutSpec, *impData->
get(),
false);
478 cutVar = cutVarTmp.get();
480 _dstore->loadValues(impData->
store(), cutVar, cutRange);
482 }
else if (impTree || (fname && strlen(fname))) {
484 std::unique_ptr<TFile> file;
486 if (impTree ==
nullptr) {
489 std::stringstream ss;
490 ss <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname
491 <<
"' cannot be opened or does not exist";
492 const std::string errMsg = ss.str();
493 coutE(InputArguments) << errMsg << std::endl;
494 throw std::invalid_argument(errMsg);
497 file->GetObject(tname, impTree);
499 std::stringstream ss;
500 ss <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname
501 <<
"' does not contain a TTree named '" << tname <<
"'";
502 const std::string errMsg = ss.str();
503 coutE(InputArguments) << errMsg << std::endl;
504 throw std::invalid_argument(errMsg);
509 cutVarTmp = std::make_unique<RooFormulaVar>(cutSpec, cutSpec, _vars,
false);
510 cutVar = cutVarTmp.get();
514 tstore->
loadValues(impTree, cutVar, cutRange);
517 tmpstore.loadValues(impTree, cutVar, cutRange);
518 _dstore->append(tmpstore);
540 const RooArgSet& vars,
const char *cuts,
const char* wgtVarName) :
547 std::unique_ptr<RooFormulaVar> cutVar;
548 if (cuts && strlen(cuts) != 0) {
550 cutVar = std::make_unique<RooFormulaVar>(cuts, cuts,
_vars,
false);
552 _dstore = std::make_unique<RooVectorDataStore>(
name,title,
596 :
RooDataSet{
name, title, dset, vars, cutVar.expression(), wgtVarName} {}
616 bool useOldWeight =
_wgtVar && (wgtVarName ==
nullptr || strcmp(wgtVarName,
_wgtVar->
GetName()) == 0);
618 if(newName ==
nullptr) newName =
GetName();
619 if(newTitle ==
nullptr) newTitle =
GetTitle();
623 if(vars ==
nullptr) {
631 vars2.
add(varInData ? *varInData : *var);
642 if(var->getAttribute(
"StoreError")) errorSet.
add(*var);
643 if(var->getAttribute(
"StoreAsymError")) asymErrorSet.
add(*var);
647 return RooFit::makeOwningPtr<RooAbsData>(std::make_unique<RooDataSet>(
648 newName, newTitle, vars2, WeightVar(wgtVarName), StoreError(errorSet), StoreAsymError(asymErrorSet)));
665 coutE(DataHandling) <<
"RooDataSet::RooDataSet(" <<
GetName() <<
"): designated weight variable "
666 << wgtVarName <<
" not found in set of variables, no weighting will be assigned" << endl ;
667 throw std::invalid_argument(
"RooDataSet::initialize() weight variable could not be initialised.");
669 coutE(DataHandling) <<
"RooDataSet::RooDataSet(" <<
GetName() <<
"): designated weight variable "
670 << wgtVarName <<
" is not of type RooRealVar, no weighting will be assigned" << endl ;
671 throw std::invalid_argument(
"RooDataSet::initialize() weight variable could not be initialised.");
685 const char *cutRange, std::size_t nStart, std::size_t nStop)
const
695 std::unique_ptr<RooAbsData> out{createEmptyClone()};
697 if (!cutRange || strchr(cutRange,
',') ==
nullptr) {
699 ds.
_dstore =
_dstore->reduce(ds.GetName(), ds.GetTitle(), ds._vars, cutVar, cutRange, nStart, nStop);
700 ds._cachedVars.add(
_dstore->cachedVars());
705 std::stringstream errMsg;
706 errMsg <<
"Error in RooAbsData::reduce! The ranges " << cutRange <<
" are overlapping!";
707 throw std::runtime_error(errMsg.str());
709 for (
const auto &token : tokens) {
710 std::unique_ptr<RooAbsData> appendedData{createEmptyClone()};
711 auto &ds =
static_cast<RooDataSet &
>(*appendedData);
712 ds.
_dstore =
_dstore->reduce(ds.GetName(), ds.GetTitle(), ds._vars, cutVar, token.c_str(), nStart, nStop);
713 ds._cachedVars.add(
_dstore->cachedVars());
748 title = std::string(
GetTitle()) +
"_binned" ;
777 return e > 0.0 ?
e *
e :
w *
w;
787 if(first +
len > nEntries) {
788 throw std::runtime_error(
"RooDataSet::getWeightBatch(): requested range not valid for dataset.");
792 if(allWeights.empty())
return {};
794 if(!sumW2)
return {&*(std::cbegin(allWeights) + first),
len};
804 for (std::size_t i = 0; i < nEntries; ++i) {
810 return std::span<const double>(&*(
_sumW2Buffer->begin() + first),
len);
857 std::unique_ptr<RooFormula> select = nullptr ;
858 if (cutSpec && strlen(cutSpec) > 0) {
859 select = std::make_unique<RooFormula>(
"select",cutSpec,*
get()) ;
871 if (select && select->eval()==0.) continue ;
949 ccoutE(DataHandling) <<
"An event weight/error was passed but no weight variable was defined"
950 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
956 && std::abs(wgt*wgt - wgtError)/wgtError > 1.E-15
957 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
958 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
960 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
998 ccoutE(DataHandling) <<
"An event weight was given but no weight variable was defined"
999 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1004 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreAsymError")) {
1005 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
1007 <<
"' does not store errors. Check `StoreAsymError` in the RooDataSet constructor." << std::endl;
1050 ccoutE(DataHandling) <<
"An event weight was given but no weight variable was defined"
1051 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1058 && wgtError != 0. && wgtError != wgt*wgt
1059 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1060 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
1062 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1083 list<RooDataSet*> dsetList ;
1084 if (data1) dsetList.push_back(data1) ;
1085 if (data2) dsetList.push_back(data2) ;
1086 if (data3) dsetList.push_back(data3) ;
1087 if (data4) dsetList.push_back(data4) ;
1088 if (data5) dsetList.push_back(data5) ;
1089 if (data6) dsetList.push_back(data6) ;
1090 return merge(dsetList) ;
1106 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1108 coutE(InputArguments) <<
"RooDataSet::merge(" <<
GetName() <<
") ERROR: datasets have different size" << endl ;
1114 list<RooAbsDataStore*> dstoreList ;
1115 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1117 dstoreList.push_back((*iter)->store()) ;
1156 std::unique_ptr<RooAbsArg> ret{
_dstore->addColumn(var,adjustRange)};
1225 pc.
defineInt(
"lineColor",
"LineColor",0,-999) ;
1226 pc.
defineInt(
"lineStyle",
"LineStyle",0,-999) ;
1227 pc.
defineInt(
"lineWidth",
"LineWidth",0,-999) ;
1228 pc.
defineInt(
"markerColor",
"MarkerColor",0,-999) ;
1229 pc.
defineInt(
"markerStyle",
"MarkerStyle",0,8) ;
1231 pc.
defineInt(
"fillColor",
"FillColor",0,-999) ;
1232 pc.
defineInt(
"fillStyle",
"FillStyle",0,-999) ;
1233 pc.
defineInt(
"histInvisible",
"Invisible",0,0) ;
1246 const char* drawOptions = pc.
getString(
"drawOption") ;
1247 Int_t histInvisible = pc.
getInt(
"histInvisible") ;
1248 const char* histName = pc.
getString(
"histName",
nullptr,
true) ;
1249 double scaleFactor = pc.
getDouble(
"scaleFactor") ;
1258 coutE(InputArguments) <<
"RooDataSet::plotOnXY(" <<
GetName() <<
") ERROR: no YVar() argument specified and dataset is not weighted" << endl ;
1263 if (yvar && !dataY) {
1264 coutE(InputArguments) <<
"RooDataSet::plotOnXY(" <<
GetName() <<
") ERROR on YVar() argument, dataset does not contain a variable named " << yvar->
GetName() << endl ;
1272 graph->SetName(histName) ;
1274 graph->SetName((
"hxy_" + std::string(
GetName())).c_str());
1293 graph->addBinWithXYError(
x,
y,-1*exlo,exhi,-1*eylo,eyhi,scaleFactor) ;
1306 if (lineColor!=-999)
graph->SetLineColor(lineColor) ;
1307 if (lineStyle!=-999)
graph->SetLineStyle(lineStyle) ;
1308 if (lineWidth!=-999)
graph->SetLineWidth(lineWidth) ;
1309 if (markerColor!=-999)
graph->SetMarkerColor(markerColor) ;
1310 if (markerStyle!=-999)
graph->SetMarkerStyle(markerStyle) ;
1311 if (markerSize!=-999)
graph->SetMarkerSize(markerSize) ;
1312 if (fillColor!=-999)
graph->SetFillColor(fillColor) ;
1313 if (fillStyle!=-999)
graph->SetFillStyle(fillStyle) ;
1373 const char *verbOpt,
const char* commonPath,
1374 const char* indexCatName) {
1379 bool ownIsBlind(
true) ;
1380 RooAbsArg* blindState = variables.find(
"blindState") ;
1382 blindState =
new RooCategory(
"blindState",
"Blinding State") ;
1383 variables.add(*blindState) ;
1385 ownIsBlind = false ;
1387 oocoutE(
nullptr,DataHandling) <<
"RooDataSet::read: ERROR: variable list already contains"
1388 <<
"a non-RooCategory blindState member" << endl ;
1391 oocoutW(
nullptr,DataHandling) <<
"RooDataSet::read: WARNING: recycling existing "
1392 <<
"blindState category in variable list" << endl ;
1407 auto data = std::make_unique<RooDataSet>(
"dataset", fileList, variables);
1408 if (ownIsBlind) { variables.remove(*blindState) ;
delete blindState ; }
1410 oocoutE(
nullptr,DataHandling) <<
"RooDataSet::read: unable to create a new dataset"
1416 blindCat =
static_cast<RooCategory*
>(
data->_vars.find(
"blindState")) ;
1423 tmp =
data->_vars.find(indexCatName) ;
1425 oocoutE(
data.get(),DataHandling) <<
"RooDataSet::read: no index category named "
1426 << indexCatName <<
" in supplied variable list" << endl ;
1430 oocoutE(
data.get(),DataHandling) <<
"RooDataSet::read: variable " << indexCatName
1431 <<
" is not a RooCategory" << endl ;
1441 Int_t outOfRange(0) ;
1444 Int_t fileSeqNum(0);
1450 const char *catname = strchr(
filename.c_str(),
':');
1466 char newLabel[128] ;
1467 snprintf(newLabel,128,
"file%03d",fileSeqNum) ;
1468 if (indexCat->
defineType(newLabel,fileSeqNum)) {
1469 oocoutE(
data.get(), DataHandling) <<
"RooDataSet::read: Error, cannot register automatic type name " << newLabel
1470 <<
" in index category " << indexCat->
GetName() << endl ;
1478 oocoutI(
data.get(), DataHandling) <<
"RooDataSet::read: reading file " <<
filename << endl ;
1481 TString fullName(commonPath) ;
1483 ifstream file(fullName) ;
1486 oocoutE(
data.get(), DataHandling) <<
"RooDataSet::read: unable to open '"
1487 <<
filename <<
"'. Returning nullptr now." << endl;
1493 bool haveBlindString(
false) ;
1495 while(file.good() && !file.eof()) {
1497 if(debug)
oocxcoutD(
data.get(),DataHandling) <<
"reading line " <<
line << endl;
1500 if (file.peek() ==
'#') {
1501 if(debug)
oocxcoutD(
data.get(),DataHandling) <<
"skipping comment on line " <<
line << endl;
1504 bool readError = variables.readFromStream(file,
true,verbose) ;
1505 data->_vars.assign(variables) ;
1509 oocoutE(
data.get(), DataHandling) <<
"RooDataSet::read(static): read error at line " <<
line << endl ;
1516 blindCat->
setIndex(haveBlindString) ;
1522 while (isspace(file.peek())) {
1524 file >> std::noskipws >> dummy >> std::skipws;
1536 assert(
dynamic_cast<RooCategory*
>(variables.find(indexCatName)));
1537 const auto origIndexCat =
static_cast<RooCategory*
>(variables.find(indexCatName));
1538 for (
const auto& nameIdx : *indexCat) {
1539 origIndexCat->
defineType(nameIdx.first, nameIdx.second);
1542 oocoutI(
data.get(),DataHandling) <<
"RooDataSet::read: read " <<
data->numEntries()
1543 <<
" events (ignored " << outOfRange <<
" out of range events)" << endl;
1545 return data.release();
1562 coutE(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
") cannot create file " <<
filename << endl ;
1567 coutI(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
") writing ASCII file " <<
filename << endl ;
1585 coutW(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
"): WARNING error(s) have occurred in writing" << endl ;
1603 os <<
indent <<
" Dataset variable \"" <<
_wgtVar->
GetName() <<
"\" is interpreted as the event weight" << endl ;
1634 os << arg->GetName() ;
1697 TTree *X_tree(
nullptr);
1707 _dstore = std::make_unique<RooTreeDataStore>(X_tree,
_vars);
1742 const char * cstr =
"cstr";
1753 const char *rangeName,
RooFormulaVar const *cutVar,
const char *cutSpec)
1756 if (cutVar && cutSpec) {
1757 throw std::invalid_argument(
"Only one of cutVar or cutSpec should be not a nullptr!");
1762 for (
auto const &item : slices) {
1763 std::unique_ptr<RooDataSet> sliceDataSet;
1768 sliceDataSet = makeDataSetFromDataHist(
static_cast<RooDataHist const &
>(*sliceData));
1769 sliceData = sliceDataSet.
get();
1773 if (!indexCat.
hasLabel(item.first)) {
1775 coutI(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") defining state \"" << item.first
1776 <<
"\" in index category " << indexCat.
GetName() << std::endl;
1778 if (!indexCatInData.hasLabel(item.first)) {
1779 indexCatInData.defineType(item.first);
1781 indexCatInData.setLabel(item.first.c_str());
1782 std::unique_ptr<RooFormulaVar> cutVarTmp;
1784 cutVarTmp = std::make_unique<RooFormulaVar>(cutSpec, cutSpec, *sliceData->
get(),
false);
1785 cutVar = cutVarTmp.get();
1787 _dstore->loadValues(sliceData->
store(), cutVar, rangeName);
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
static void indent(ostringstream &buf, int indent_level)
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 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 filename
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 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 UChar_t len
The Kahan summation is a compensated summation algorithm, which significantly reduces numerical error...
Common abstract base class for objects that represent a value and a "shape" in RooFit.
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
bool hasLabel(const std::string &label) const
Check if a state with name label exists.
virtual const char * getCurrentLabel() const
Return label string of current state.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
Storage_t const & get() const
Const access to the underlying stl container.
bool allInRange(const char *rangeSpec) const
Return true if all contained object report to have their value inside the specified range.
void assignFast(const RooAbsCollection &other, bool setValDirty=true) const
Functional equivalent of assign() but assumes this and other collection have same layout.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for a data collection.
virtual bool isWeighted() const =0
virtual double sumEntries() const
virtual RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore * > dstoreList)=0
virtual double weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const =0
virtual double weight() const =0
Abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Interface for detailed printing of object.
void SetName(const char *name) override
Set the name of the TNamed.
RooAbsDataStore * store()
static StorageType defaultStorageType
std::unique_ptr< RooAbsDataStore > _dstore
Data storage implementation.
RooArgSet _vars
Dimensions of this data set.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
virtual bool isWeighted() const
void Streamer(TBuffer &) override
Stream an object of class RooAbsData.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
void Streamer(TBuffer &) override
Stream an object of class TObject.
virtual void writeToStream(std::ostream &os, bool compact, const char *section=nullptr) const
Write the contents of the argset in ASCII form to given stream.
Object to represent discrete states.
bool setIndex(Int_t index, bool printError=true) override
Set value by specifying the index code of the desired state.
bool defineType(const std::string &label)
Define a state with given name.
bool setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
Named container for two doubles, two integers two object points and three string pointers that can be...
const char * getString(Int_t idx) const
Return string stored in slot idx.
Configurable parser for RooCmdArg named arguments.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
double getDouble(const char *name, double defaultValue=0.0) const
Return double property registered with name 'name'.
bool defineDouble(const char *name, const char *argName, int doubleNum, double defValue=0.0)
Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argNam...
bool ok(bool verbose) const
Return true of parsing was successful.
bool defineObject(const char *name, const char *argName, int setNum, const TObject *obj=nullptr, bool isArray=false)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false) const
Return string property registered with name 'name'.
bool defineString(const char *name, const char *argName, int stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
bool defineInt(const char *name, const char *argName, int intNum, int defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
int getInt(const char *name, int defaultValue=0) const
Return integer property registered with name 'name'.
TObject * getObject(const char *name, TObject *obj=nullptr) const
Return TObject property registered with name 'name'.
Container class to hold N-dimensional binned data.
double weight(std::size_t i) const
Return weight of i-th bin.
double weightSquared(std::size_t i) const
Return squared weight sum of i-th bin.
const RooArgSet * get() const override
Get bin centre of current bin.
Container class to hold unbinned data.
RooFit::OwningPtr< RooAbsData > emptyClone(const char *newName=nullptr, const char *newTitle=nullptr, const RooArgSet *vars=nullptr, const char *wgtVarName=nullptr) const override
Return an empty clone of this dataset.
RooRealVar * _wgtVar
Pointer to weight variable (if set)
bool _doWeightErrorCheck
! When adding events with weights, check that weights can actually be stored.
RooArgSet _varsNoWgt
Vars without weight variable.
void loadValuesFromSlices(RooCategory &indexCat, std::map< std::string, RooAbsData * > const &slices, const char *rangeName, RooFormulaVar const *cutVar, const char *cutSpec)
RooFit::OwningPtr< RooDataHist > binnedClone(const char *newName=nullptr, const char *newTitle=nullptr) const
Return binned clone of this dataset.
void weightError(double &lo, double &hi, ErrorType etype=SumW2) const override
Return the asymmetric errors on the current weight.
const RooArgSet * get() const override
Return a RooArgSet with the coordinates of the current event.
void initialize(const char *wgtVarName)
Initialize the dataset.
void printArgs(std::ostream &os) const override
Print argument of dataset, i.e. the observable names.
void SetName(const char *name) override
Change the name of this dataset into the given name.
virtual void addFast(const RooArgSet &row, double weight=1.0, double weightError=0.0)
Add a data point, with its coordinates specified in the 'data' argset, to the data set.
bool merge(RooDataSet *data1, RooDataSet *data2=nullptr, RooDataSet *data3=nullptr, RooDataSet *data4=nullptr, RooDataSet *data5=nullptr, RooDataSet *data6=nullptr)
TClass * IsA() const override
virtual RooAbsArg * addColumn(RooAbsArg &var, bool adjustRange=true)
Add a column with the values of the given (function) argument to this dataset.
bool write(const char *filename) const
Write the contents of this dataset to an ASCII file with the specified name.
double sumEntries() const override
Return effective number of entries in dataset, i.e., sum all weights.
std::span< const double > getWeightBatch(std::size_t first, std::size_t len, bool sumW2) const override
virtual RooArgSet * addColumns(const RooArgList &varList)
Add a column with the values of the given list of (function) argument to this dataset.
~RooDataSet() override
Destructor.
bool isNonPoissonWeighted() const override
Returns true if histogram contains bins with entries with a non-integer weight.
void SetNameTitle(const char *name, const char *title) override
Change the title of this dataset into the given name.
void printValue(std::ostream &os) const override
Print value of the dataset, i.e. the sum of weights contained in the dataset.
void append(RooDataSet &data)
Add all data points of given data set to this data set.
RooDataSet()
Default constructor for persistence.
std::unique_ptr< std::vector< double > > _sumW2Buffer
! Buffer for sumW2 in case a batch of values is requested.
void Streamer(TBuffer &) override
Stream an object of class RooDataSet.
void add(const RooArgSet &row, double weight, double weightError)
Add one ore more rows of data.
unsigned short _errorMsgCount
! Counter to silence error messages when filling dataset.
std::unique_ptr< RooAbsData > reduceEng(const RooArgSet &varSubset, const RooFormulaVar *cutVar, const char *cutRange=nullptr, std::size_t nStart=0, std::size_t nStop=std::numeric_limits< std::size_t >::max()) const override
Implementation of RooAbsData virtual method that drives the RooAbsData::reduce() methods.
void convertToTreeStore() override
Convert vector-based storage to tree-based storage.
virtual RooPlot * plotOnXY(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Special plot method for 'X-Y' datasets used in fitting.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print info about this dataset to the specified output stream.
double weightSquared() const override
Return squared event weight of the current event.
double weight() const override
Return event weight of current event.
static RooDataSet * read(const char *filename, const RooArgList &variables, const char *opts="", const char *commonPath="", const char *indexCatName=nullptr)
Read data from a text file and create a dataset from it.
bool isWeighted() const override
Return true if dataset contains weighted events.
Utility base class for RooFit objects that are to be attached to ROOT directories.
virtual void Streamer(TBuffer &)
void removeFromDir(TObject *obj)
Remove object from directory it was added to.
TDirectory * _dir
! Associated directory
void appendToDir(TObject *obj, bool forceMemoryResident=false)
Append object to directory.
Graphical representation of binned data based on the TGraphAsymmErrors class.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
virtual void Add(TObject *arg)
RooLinkedListIterImpl begin() const
Plot frame and a container for graphics objects within that frame.
RooAbsRealLValue * getPlotVar() const
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", bool invisible=false, bool refreshNorm=false)
Add the specified plotable object to our plot.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
void setError(double value)
double getErrorLo() const
void setAsymError(double lo, double hi)
double getErrorHi() const
The RooStringView is a wrapper around a C-style string that can also be constructed from a std::strin...
TTree-backed data storage.
void loadValues(const TTree *t, const RooFormulaVar *select=nullptr, const char *rangeName=nullptr, Int_t nStart=0, Int_t nStop=2000000000)
Load values from tree 't' into this data collection, optionally selecting events using the RooFormula...
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
virtual TList * GetList() const
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.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
TClass * IsA() const override
Mother of all ROOT objects.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void ToLower()
Change string to lower-case.
virtual void Streamer(TBuffer &)
Stream a string object.
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A TTree represents a columnar dataset.
RooCmdArg StoreError(const RooArgSet &aset)
RooCmdArg WeightVar(const char *name="weight", bool reinterpretAsWeight=false)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
OwningPtr< T > makeOwningPtr(std::unique_ptr< T > &&ptr)
Internal helper to turn a std::unique_ptr<T> into an OwningPtr.
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
bool checkIfRangesOverlap(RooArgSet const &observables, std::vector< std::string > const &rangeNames)
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)