123#ifndef USEMEMPOOLFORDATASET
129RooDataSet::MemPool* RooDataSet::memPool() {
131 static auto * memPool =
new RooDataSet::MemPool();
136 auto pool = memPool();
152void* RooDataSet::operator
new (
size_t bytes)
157 return memPool()->allocate(
bytes);
165void RooDataSet::operator
delete (
void* ptr)
168 if (memPool()->deallocate(ptr))
171 std::cerr << __func__ <<
" " << ptr <<
" is not in any of the pools." << std::endl;
174 ::operator
delete(ptr);
190struct FinalizeVarsOutput {
192 std::unique_ptr<RooRealVar> weight;
193 std::string weightVarName;
197FinalizeVarsOutput finalizeVars(
RooArgSet const &vars,
199 const char* wgtVarName,
204 FinalizeVarsOutput out;
205 out.finalVars.add(vars);
209 std::vector<RooAbsData*> weightedImpDatas;
210 if(impData && impData->
isWeighted()) weightedImpDatas.push_back(impData);
212 if(
data->isWeighted()) {
213 weightedImpDatas.push_back(
data);
217 bool needsWeightErrors =
false;
222 needsWeightErrors =
true;
227 out.finalVars.add(*indexCat,
true);
230 out.weightVarName = wgtVarName ? wgtVarName :
"";
232 if(out.weightVarName.empty()) {
238 out.weightVarName = ds->weightVar()->GetName();
251 RooAbsArg * wgtVar = out.finalVars.find(out.weightVarName.c_str());
252 if (!out.weightVarName.empty() && !wgtVar) {
253 const char*
name = out.weightVarName.c_str();
254 out.weight = std::make_unique<RooRealVar>(
name,
name, 1.0);
255 wgtVar = out.weight.get();
256 out.finalVars.add(*out.weight);
259 if(needsWeightErrors) {
260 out.errorSet.add(*wgtVar);
264 if(errorSet) out.errorSet.add(*errorSet,
true);
270std::unique_ptr<RooDataSet> makeDataSetFromDataHist(
RooDataHist const &hist)
275 const char* wgtName = wgtVarCmdArg.
getString(0);
339 pc.defineInt(
"ownLinked",
"OwnLinked",0) ;
340 pc.defineObject(
"impTree",
"ImportTree",0) ;
341 pc.defineObject(
"impData",
"ImportData",0) ;
342 pc.defineObject(
"indexCat",
"IndexCat",0) ;
343 pc.defineObject(
"impSliceData",
"ImportDataSlice",0,0,
true) ;
344 pc.defineString(
"impSliceState",
"ImportDataSlice",0,
"",
true) ;
345 pc.defineObject(
"lnkSliceData",
"LinkDataSlice",0,0,
true) ;
346 pc.defineString(
"lnkSliceState",
"LinkDataSlice",0,
"",
true) ;
347 pc.defineString(
"cutSpec",
"CutSpec",0,
"") ;
348 pc.defineObject(
"cutVar",
"CutVar",0) ;
349 pc.defineString(
"cutRange",
"CutRange",0,
"") ;
350 pc.defineString(
"wgtVarName",
"WeightVarName",0,
"") ;
351 pc.defineInt(
"newWeight1",
"WeightVarName",0,0) ;
352 pc.defineString(
"fname",
"ImportFromFile",0,
"") ;
353 pc.defineString(
"tname",
"ImportFromFile",1,
"") ;
354 pc.defineObject(
"wgtVar",
"WeightVar",0) ;
355 pc.defineInt(
"newWeight2",
"WeightVar",0,0) ;
356 pc.defineObject(
"dummy1",
"ImportDataSliceMany",0) ;
357 pc.defineObject(
"dummy2",
"LinkDataSliceMany",0) ;
358 pc.defineSet(
"errorSet",
"StoreError",0) ;
359 pc.defineSet(
"asymErrSet",
"StoreAsymError",0) ;
360 pc.defineSet(
"glObs",
"GlobalObservables",0,0) ;
361 pc.defineMutex(
"ImportTree",
"ImportData",
"ImportDataSlice",
"LinkDataSlice",
"ImportFromFile") ;
362 pc.defineMutex(
"CutSpec",
"CutVar") ;
363 pc.defineMutex(
"WeightVarName",
"WeightVar") ;
364 pc.defineDependency(
"ImportDataSlice",
"IndexCat") ;
365 pc.defineDependency(
"LinkDataSlice",
"IndexCat") ;
366 pc.defineDependency(
"OwnLinked",
"LinkDataSlice") ;
378 const std::string errMsg =
"Error in RooDataSet constructor: command argument list could not be processed";
379 coutE(InputArguments) << errMsg << std::endl;
380 throw std::invalid_argument(errMsg);
383 if(pc.getSet(
"glObs")) setGlobalObservables(*pc.getSet(
"glObs"));
386 TTree* impTree =
static_cast<TTree*
>(pc.getObject(
"impTree")) ;
387 auto impData =
static_cast<RooAbsData*
>(pc.getObject(
"impData")) ;
389 const char* cutSpec = pc.getString(
"cutSpec",
"",
true) ;
390 const char* cutRange = pc.getString(
"cutRange",
"",
true) ;
391 const char* wgtVarName = pc.getString(
"wgtVarName",
"",
true) ;
393 const char* impSliceNames = pc.getString(
"impSliceState",
"",
true) ;
394 const RooLinkedList& impSliceData = pc.getObjectList(
"impSliceData") ;
395 const char* lnkSliceNames = pc.getString(
"lnkSliceState",
"",
true) ;
396 const RooLinkedList& lnkSliceData = pc.getObjectList(
"lnkSliceData") ;
398 RooArgSet* asymErrorSet = pc.getSet(
"asymErrSet") ;
399 const char* fname = pc.getString(
"fname") ;
400 const char* tname = pc.getString(
"tname") ;
401 Int_t ownLinked = pc.getInt(
"ownLinked") ;
402 Int_t newWeight = pc.getInt(
"newWeight1") + pc.getInt(
"newWeight2") ;
406 wgtVarName = wgtVar->
GetName();
409 auto finalVarsInfo = finalizeVars(vars,indexCat,wgtVarName,impData,impSliceData, pc.getSet(
"errorSet"));
410 initializeVars(finalVarsInfo.finalVars);
411 if(!finalVarsInfo.weightVarName.empty()) {
412 wgtVarName = finalVarsInfo.weightVarName.c_str();
415 RooArgSet* errorSet = finalVarsInfo.errorSet.
empty() ? nullptr : &finalVarsInfo.errorSet;
421 map<string,RooAbsData*> hmap ;
424 strlcpy(tmp, lnkSliceNames, 64000);
425 char *token = strtok(tmp,
",");
426 auto hiter = lnkSliceData.
begin();
428 hmap[token] =
static_cast<RooAbsData *
>(*hiter);
429 token = strtok(0,
",");
434 appendToDir(
this,
true) ;
439 map<string,RooAbsDataStore*> storeMap ;
442 throw std::string(
"RooDataSet::RooDataSet() ERROR in constructor, cannot find index category") ;
444 for (map<string,RooAbsData*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
446 if (indexCat && !indexCat->
hasLabel(hiter->first)) {
448 coutI(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->
GetName() << endl ;
450 if (icat && !icat->
hasLabel(hiter->first)) {
453 icat->
setLabel(hiter->first.c_str()) ;
458 addOwnedComponent(hiter->first.c_str(),*hiter->second) ;
463 _dstore = std::make_unique<RooCompositeDataStore>(
name,title,_vars,*icat,storeMap) ;
470 if (defaultStorageType==Tree) {
471 _dstore = std::make_unique<RooTreeDataStore>(
name,title,_vars,wgtVarName) ;
473 }
else if (defaultStorageType==Vector) {
474 if (wgtVarName && newWeight) {
475 RooAbsArg* wgttmp = _vars.find(wgtVarName) ;
480 _dstore = std::make_unique<RooVectorDataStore>(
name,title,_vars,wgtVarName) ;
485 std::map<string,RooAbsData*> hmap ;
487 auto hiter = impSliceData.
begin() ;
488 for (
const auto& token :
ROOT::
Split(impSliceNames,
",")) {
489 hmap[token] =
static_cast<RooDataSet*
>(*hiter);
496 std::unique_ptr<RooArgSet> intErrorSet{
static_cast<RooArgSet*
>(_vars.selectCommon(*errorSet))};
499 arg->attachToStore(*_dstore) ;
503 std::unique_ptr<RooArgSet> intAsymErrorSet{
static_cast<RooArgSet*
>(_vars.selectCommon(*asymErrorSet))};
506 arg->attachToStore(*_dstore) ;
510 appendToDir(
this,
true) ;
516 std::unique_ptr<RooFormulaVar> cutVarTmp;
520 loadValuesFromSlices(*indexCat, hmap, cutRange, cutVar, cutSpec);
521 }
else if (impData) {
523 std::unique_ptr<RooDataSet> impDataSet;
527 impDataSet = makeDataSetFromDataHist(
static_cast<RooDataHist const &
>(*impData));
528 impData = impDataSet.
get();
531 cutVarTmp = std::make_unique<RooFormulaVar>(cutSpec, cutSpec, *impData->
get());
532 cutVar = cutVarTmp.get();
534 _dstore->loadValues(impData->
store(), cutVar, cutRange);
536 }
else if (impTree || (fname && strlen(fname))) {
538 std::unique_ptr<TFile>
file;
540 if (impTree ==
nullptr) {
543 std::stringstream ss;
544 ss <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname
545 <<
"' cannot be opened or does not exist";
546 const std::string errMsg = ss.str();
547 coutE(InputArguments) << errMsg << std::endl;
548 throw std::invalid_argument(errMsg);
551 file->GetObject(tname, impTree);
553 std::stringstream ss;
554 ss <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname
555 <<
"' does not contain a TTree named '" << tname <<
"'";;
556 const std::string errMsg = ss.str();
557 coutE(InputArguments) << errMsg << std::endl;
558 throw std::invalid_argument(errMsg);
563 cutVarTmp = std::make_unique<RooFormulaVar>(cutSpec, cutSpec, _vars);
564 cutVar = cutVarTmp.get();
568 tstore->
loadValues(impTree, cutVar, cutRange);
571 tmpstore.loadValues(impTree, cutVar, cutRange);
572 _dstore->append(tmpstore);
607 const RooArgSet& vars,
const char *cuts,
const char* wgtVarName) :
614 std::unique_ptr<RooFormulaVar> cutVar;
615 if (cuts && strlen(cuts) != 0) {
617 cutVar = std::make_unique<RooFormulaVar>(cuts, cuts,
_vars,
false);
619 _dstore = std::make_unique<RooVectorDataStore>(
name,title,
663 :
RooDataSet{
name, title, dset, vars, cutVar.expression(), wgtVarName} {}
683 :
RooDataSet{
name, title, theTree, vars, cutVar.expression(), wgtVarName} {}
710 const RooArgSet& vars,
const char* cuts,
const char* wgtVarName) :
714 auto tstore = std::make_unique<RooTreeDataStore>(
name,title,
_vars,*theTree,cuts,wgtVarName);
720 _dstore = std::make_unique<RooVectorDataStore>(
name,title,
_vars,wgtVarName);
748 std::size_t nStart, std::size_t nStop) :
767 bool useOldWeight =
_wgtVar && (wgtVarName ==
nullptr || strcmp(wgtVarName,
_wgtVar->
GetName()) == 0);
769 if(newName ==
nullptr) newName =
GetName();
770 if(newTitle ==
nullptr) newTitle =
GetTitle();
774 if(vars ==
nullptr) {
782 vars2.
add(varInData ? *varInData : *var);
793 if(var->getAttribute(
"StoreError")) errorSet.
add(*var);;
794 if(var->getAttribute(
"StoreAsymError")) asymErrorSet.
add(*var);;
798 return new RooDataSet(newName, newTitle, vars2, WeightVar(wgtVarName), StoreError(errorSet), StoreAsymError(asymErrorSet));
815 coutE(DataHandling) <<
"RooDataSet::RooDataSet(" <<
GetName() <<
"): designated weight variable "
816 << wgtVarName <<
" not found in set of variables, no weighting will be assigned" << endl ;
817 throw std::invalid_argument(
"RooDataSet::initialize() weight variable could not be initialised.");
819 coutE(DataHandling) <<
"RooDataSet::RooDataSet(" <<
GetName() <<
"): designated weight variable "
820 << wgtVarName <<
" is not of type RooRealVar, no weighting will be assigned" << endl ;
821 throw std::invalid_argument(
"RooDataSet::initialize() weight variable could not be initialised.");
835 std::size_t nStart, std::size_t nStop)
843 if (!cutRange || strchr(cutRange,
',')==0) {
849 std::stringstream errMsg;
850 errMsg <<
"Error in RooAbsData::reduce! The ranges " << cutRange <<
" are overlapping!";
851 throw std::runtime_error(errMsg.str());
854 for (
const auto& token : tokens) {
859 out->
append(appendedData);
894 title = std::string(
GetTitle()) +
"_binned" ;
923 return e > 0.0 ?
e *
e :
w *
w;
933 if(first >= nEntries || (
first +
len) > nEntries) {
934 throw std::runtime_error(
"RooDataSet::getWeightBatch(): requested range not valid for dataset.");
938 if(allWeights.
empty())
return {};
940 if(!sumW2)
return {&*(std::cbegin(allWeights) +
first),
len};
950 for (std::size_t i = 0; i < nEntries; ++i) {
1003 std::unique_ptr<RooFormula> select = nullptr ;
1004 if (cutSpec && strlen(cutSpec) > 0) {
1005 select = std::make_unique<RooFormula>(
"select",cutSpec,*
get()) ;
1017 if (select && select->eval()==0.) continue ;
1094 }
else if ((wgt != 1. || wgtError != 0.) &&
_errorMsgCount < 5) {
1095 ccoutE(DataHandling) <<
"An event weight/error was passed but no weight variable was defined"
1096 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1102 && std::abs(wgt*wgt - wgtError)/wgtError > 1.E-15
1103 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1104 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
1106 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1144 ccoutE(DataHandling) <<
"An event weight was given but no weight variable was defined"
1145 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1150 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreAsymError")) {
1151 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
1153 <<
"' does not store errors. Check `StoreAsymError` in the RooDataSet constructor." << std::endl;
1196 ccoutE(DataHandling) <<
"An event weight was given but no weight variable was defined"
1197 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1204 && wgtError != 0. && wgtError != wgt*wgt
1205 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1206 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
1208 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1229 list<RooDataSet*> dsetList ;
1230 if (data1) dsetList.push_back(data1) ;
1231 if (data2) dsetList.push_back(data2) ;
1232 if (data3) dsetList.push_back(data3) ;
1233 if (data4) dsetList.push_back(data4) ;
1234 if (data5) dsetList.push_back(data5) ;
1235 if (data6) dsetList.push_back(data6) ;
1236 return merge(dsetList) ;
1252 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1254 coutE(InputArguments) <<
"RooDataSet::merge(" <<
GetName() <<
") ERROR: datasets have different size" << endl ;
1260 list<RooAbsDataStore*> dstoreList ;
1261 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1263 dstoreList.push_back((*iter)->store()) ;
1302 std::unique_ptr<RooAbsArg> ret{
_dstore->addColumn(var,adjustRange)};
1371 pc.
defineInt(
"lineColor",
"LineColor",0,-999) ;
1372 pc.
defineInt(
"lineStyle",
"LineStyle",0,-999) ;
1373 pc.
defineInt(
"lineWidth",
"LineWidth",0,-999) ;
1374 pc.
defineInt(
"markerColor",
"MarkerColor",0,-999) ;
1375 pc.
defineInt(
"markerStyle",
"MarkerStyle",0,8) ;
1377 pc.
defineInt(
"fillColor",
"FillColor",0,-999) ;
1378 pc.
defineInt(
"fillStyle",
"FillStyle",0,-999) ;
1379 pc.
defineInt(
"histInvisible",
"Invisible",0,0) ;
1392 const char* drawOptions = pc.
getString(
"drawOption") ;
1393 Int_t histInvisible = pc.
getInt(
"histInvisible") ;
1394 const char* histName = pc.
getString(
"histName",0,
true) ;
1395 double scaleFactor = pc.
getDouble(
"scaleFactor") ;
1404 coutE(InputArguments) <<
"RooDataSet::plotOnXY(" <<
GetName() <<
") ERROR: no YVar() argument specified and dataset is not weighted" << endl ;
1409 if (yvar && !dataY) {
1410 coutE(InputArguments) <<
"RooDataSet::plotOnXY(" <<
GetName() <<
") ERROR on YVar() argument, dataset does not contain a variable named " << yvar->
GetName() << endl ;
1418 graph->SetName(histName) ;
1428 double y,eylo,eyhi ;
1437 graph->addBinWithXYError(
x,
y,-1*exlo,exhi,-1*eylo,eyhi,scaleFactor) ;
1450 if (lineColor!=-999)
graph->SetLineColor(lineColor) ;
1451 if (lineStyle!=-999)
graph->SetLineStyle(lineStyle) ;
1452 if (lineWidth!=-999)
graph->SetLineWidth(lineWidth) ;
1453 if (markerColor!=-999)
graph->SetMarkerColor(markerColor) ;
1454 if (markerStyle!=-999)
graph->SetMarkerStyle(markerStyle) ;
1455 if (markerSize!=-999)
graph->SetMarkerSize(markerSize) ;
1456 if (fillColor!=-999)
graph->SetFillColor(fillColor) ;
1457 if (fillStyle!=-999)
graph->SetFillStyle(fillStyle) ;
1517 const char *verbOpt,
const char* commonPath,
1518 const char* indexCatName) {
1523 bool ownIsBlind(
true) ;
1524 RooAbsArg* blindState = variables.find(
"blindState") ;
1526 blindState =
new RooCategory(
"blindState",
"Blinding State") ;
1527 variables.add(*blindState) ;
1529 ownIsBlind = false ;
1531 oocoutE(
nullptr,DataHandling) <<
"RooDataSet::read: ERROR: variable list already contains"
1532 <<
"a non-RooCategory blindState member" << endl ;
1535 oocoutW(
nullptr,DataHandling) <<
"RooDataSet::read: WARNING: recycling existing "
1536 <<
"blindState category in variable list" << endl ;
1551 auto data = std::make_unique<RooDataSet>(
"dataset", fileList, variables);
1552 if (ownIsBlind) { variables.remove(*blindState) ;
delete blindState ; }
1554 oocoutE(
nullptr,DataHandling) <<
"RooDataSet::read: unable to create a new dataset"
1567 tmp =
data->_vars.find(indexCatName) ;
1569 oocoutE(
data.get(),DataHandling) <<
"RooDataSet::read: no index category named "
1570 << indexCatName <<
" in supplied variable list" << endl ;
1574 oocoutE(
data.get(),DataHandling) <<
"RooDataSet::read: variable " << indexCatName
1575 <<
" is not a RooCategory" << endl ;
1585 Int_t outOfRange(0) ;
1588 Int_t fileSeqNum(0);
1594 const char *catname = strchr(
filename.c_str(),
':');
1610 char newLabel[128] ;
1611 snprintf(newLabel,128,
"file%03d",fileSeqNum) ;
1612 if (indexCat->
defineType(newLabel,fileSeqNum)) {
1613 oocoutE(
data.get(), DataHandling) <<
"RooDataSet::read: Error, cannot register automatic type name " << newLabel
1614 <<
" in index category " << indexCat->
GetName() << endl ;
1622 oocoutI(
data.get(), DataHandling) <<
"RooDataSet::read: reading file " <<
filename << endl ;
1625 TString fullName(commonPath) ;
1627 ifstream
file(fullName) ;
1630 oocoutE(
data.get(), DataHandling) <<
"RooDataSet::read: unable to open '"
1631 <<
filename <<
"'. Returning nullptr now." << endl;
1637 bool haveBlindString(
false) ;
1639 while(
file.good() && !
file.eof()) {
1641 if(debug)
oocxcoutD(
data.get(),DataHandling) <<
"reading line " <<
line << endl;
1644 if (
file.peek() ==
'#') {
1645 if(debug)
oocxcoutD(
data.get(),DataHandling) <<
"skipping comment on line " <<
line << endl;
1648 bool readError = variables.readFromStream(
file,
true,verbose) ;
1649 data->_vars.assign(variables) ;
1653 oocoutE(
data.get(), DataHandling) <<
"RooDataSet::read(static): read error at line " <<
line << endl ;
1660 blindCat->
setIndex(haveBlindString) ;
1666 while (isspace(
file.peek())) {
1668 file >> std::noskipws >> dummy >> std::skipws;
1680 assert(
dynamic_cast<RooCategory*
>(variables.find(indexCatName)));
1681 const auto origIndexCat =
static_cast<RooCategory*
>(variables.find(indexCatName));
1682 for (
const auto& nameIdx : *indexCat) {
1683 origIndexCat->
defineType(nameIdx.first, nameIdx.second);
1686 oocoutI(
data.get(),DataHandling) <<
"RooDataSet::read: read " <<
data->numEntries()
1687 <<
" events (ignored " << outOfRange <<
" out of range events)" << endl;
1689 return data.release();
1706 coutE(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
") cannot create file " <<
filename << endl ;
1711 coutI(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
") writing ASCII file " <<
filename << endl ;
1729 coutW(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
"): WARNING error(s) have occured in writing" << endl ;
1747 os <<
indent <<
" Dataset variable \"" <<
_wgtVar->
GetName() <<
"\" is interpreted as the event weight" << endl ;
1778 os << arg->GetName() ;
1837 TTree* X_tree(0) ; R__b >> X_tree;
1844 _dstore = std::make_unique<RooTreeDataStore>(X_tree,
_vars) ;
1881 const char * cstr =
"cstr";
1892 const char *rangeName,
RooFormulaVar const *cutVar,
const char *cutSpec)
1895 if (cutVar && cutSpec) {
1896 throw std::invalid_argument(
"Only one of cutVar or cutSpec should be not a nullptr!");
1901 for (
auto const &item : slices) {
1902 std::unique_ptr<RooDataSet> sliceDataSet;
1907 sliceDataSet = makeDataSetFromDataHist(
static_cast<RooDataHist const &
>(*sliceData));
1908 sliceData = sliceDataSet.
get();
1912 if (!indexCat.
hasLabel(item.first)) {
1914 coutI(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") defining state \"" << item.first
1915 <<
"\" in index category " << indexCat.
GetName() << std::endl;
1917 if (!indexCatInData.hasLabel(item.first)) {
1918 indexCatInData.defineType(item.first);
1920 indexCatInData.setLabel(item.first.c_str());
1921 std::unique_ptr<RooFormulaVar> cutVarTmp;
1923 cutVarTmp = std::make_unique<RooFormulaVar>(cutSpec, cutSpec, *sliceData->
get());
1924 cutVar = cutVarTmp.get();
1926 _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
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 bytes
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
The Kahan summation is a compensated summation algorithm, which significantly reduces numerical error...
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
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 setAttribAll(const Text_t *name, bool value=true)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
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.
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
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
RooAbsData is the common 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.
RooArgSet _cachedVars
! External variables cached with 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.
RooCategory is an 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.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
const char * getString(Int_t idx) const
Return string stored in slot idx.
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
bool defineObject(const char *name, const char *argName, Int_t setNum, const TObject *obj=nullptr, bool isArray=false)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
double getDouble(const char *name, double defaultValue=0.0)
Return double property registered with name 'name'.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
bool defineInt(const char *name, const char *argName, Int_t intNum, Int_t defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
bool defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
bool ok(bool verbose) const
Return true of parsing was successful.
TObject * getObject(const char *name, TObject *obj=nullptr)
Return TObject property registered with name 'name'.
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false)
Return string property registered with name 'name'.
bool defineDouble(const char *name, const char *argName, Int_t doubleNum, double defValue=0.0)
Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argNam...
The RooDataHist is a 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.
RooDataSet is a container class to hold unbinned data.
RooSpan< const double > getWeightBatch(std::size_t first, std::size_t len, bool sumW2) const override
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)
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 add(const RooArgSet &row, double weight=1.0, double weightError=0.0) override
Add one ore more rows of data.
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.
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()) override
Implementation of RooAbsData virtual method that drives the RooAbsData::reduce() methods.
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.
virtual RooPlot * plotOnXY(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Special plot method for 'X-Y' datasets used in fitting.
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.
unsigned short _errorMsgCount
! Counter to silence error messages when filling dataset.
void convertToTreeStore() override
Convert vector-based storage to tree-based storage.
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.
RooDataHist * binnedClone(const char *newName=nullptr, const char *newTitle=nullptr) const
Return binned clone of this dataset.
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.
RooDirItem is a 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.
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
virtual void Add(TObject *arg)
RooLinkedListIterImpl begin() const
A RooPlot is a 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.
RooRealVar represents a 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
static void activate()
Install atexit handler that calls CleanupRooFitAtExit() on program termination.
A simple container to hold a batch of data values.
constexpr bool empty() const noexcept
The RooStringView is a wrapper around a C-syle string that can also be constructed from a std::string...
RooTreeDataStore is a 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...
RooVectorDataStore uses std::vectors to store data columns.
void append(RooAbsDataStore &other) override
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)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
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...
bool checkIfRangesOverlap(RooArgSet const &observables, std::vector< std::string > const &rangeNames)
Check if there is any overlap when a list of ranges is applied to a set of observables.
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)
#define Split(a, ahi, alo)