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);
233 RooAbsData(
name,title,
RooArgSet(vars,(
RooAbsArg*)
RooCmdConfig::decodeObjOnTheFly(
"RooDataSet::RooDataSet",
"IndexCat",0,0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)))
237 pc.defineInt(
"ownLinked",
"OwnLinked",0) ;
238 pc.defineObject(
"impTree",
"ImportTree",0) ;
239 pc.defineObject(
"impData",
"ImportData",0) ;
240 pc.defineObject(
"indexCat",
"IndexCat",0) ;
241 pc.defineObject(
"impSliceData",
"ImportDataSlice",0,0,
true) ;
242 pc.defineString(
"impSliceState",
"ImportDataSlice",0,
"",
true) ;
243 pc.defineObject(
"lnkSliceData",
"LinkDataSlice",0,0,
true) ;
244 pc.defineString(
"lnkSliceState",
"LinkDataSlice",0,
"",
true) ;
245 pc.defineString(
"cutSpec",
"CutSpec",0,
"") ;
246 pc.defineObject(
"cutVar",
"CutVar",0) ;
247 pc.defineString(
"cutRange",
"CutRange",0,
"") ;
248 pc.defineString(
"wgtVarName",
"WeightVarName",0,
"") ;
249 pc.defineInt(
"newWeight1",
"WeightVarName",0,0) ;
250 pc.defineString(
"fname",
"ImportFromFile",0,
"") ;
251 pc.defineString(
"tname",
"ImportFromFile",1,
"") ;
252 pc.defineObject(
"wgtVar",
"WeightVar",0) ;
253 pc.defineInt(
"newWeight2",
"WeightVar",0,0) ;
254 pc.defineObject(
"dummy1",
"ImportDataSliceMany",0) ;
255 pc.defineObject(
"dummy2",
"LinkDataSliceMany",0) ;
256 pc.defineSet(
"errorSet",
"StoreError",0) ;
257 pc.defineSet(
"asymErrSet",
"StoreAsymError",0) ;
258 pc.defineSet(
"glObs",
"GlobalObservables",0,0) ;
259 pc.defineMutex(
"ImportTree",
"ImportData",
"ImportDataSlice",
"LinkDataSlice",
"ImportFromFile") ;
260 pc.defineMutex(
"CutSpec",
"CutVar") ;
261 pc.defineMutex(
"WeightVarName",
"WeightVar") ;
262 pc.defineDependency(
"ImportDataSlice",
"IndexCat") ;
263 pc.defineDependency(
"LinkDataSlice",
"IndexCat") ;
264 pc.defineDependency(
"OwnLinked",
"LinkDataSlice") ;
283 TTree* impTree =
static_cast<TTree*
>(
pc.getObject(
"impTree")) ;
286 const char* cutSpec =
pc.getString(
"cutSpec",
"",
true) ;
287 const char* cutRange =
pc.getString(
"cutRange",
"",
true) ;
288 const char* wgtVarName =
pc.getString(
"wgtVarName",
"",
true) ;
290 const char* impSliceNames =
pc.getString(
"impSliceState",
"",
true) ;
292 const char* lnkSliceNames =
pc.getString(
"lnkSliceState",
"",
true) ;
296 RooArgSet* asymErrorSet =
pc.getSet(
"asymErrSet") ;
297 const char* fname =
pc.getString(
"fname") ;
298 const char* tname =
pc.getString(
"tname") ;
299 Int_t ownLinked =
pc.getInt(
"ownLinked") ;
300 Int_t newWeight =
pc.getInt(
"newWeight1") +
pc.getInt(
"newWeight2") ;
306 map<string,RooAbsData*> hmap ;
309 strlcpy(tmp, lnkSliceNames, 64000);
310 char *token = strtok(tmp,
",");
311 auto hiter = lnkSliceData.
begin();
313 hmap[token] =
static_cast<RooAbsData *
>(*hiter);
314 token = strtok(0,
",");
322 wgtVarName = wgtVar->
GetName() ;
330 map<string,RooAbsDataStore*> storeMap ;
333 throw std::string(
"RooDataSet::RooDataSet() ERROR in constructor, cannot find index category") ;
335 for (map<string,RooAbsData*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
337 if (indexCat && !indexCat->
hasLabel(hiter->first)) {
341 if (icat && !icat->
hasLabel(hiter->first)) {
344 icat->
setLabel(hiter->first.c_str()) ;
354 _dstore = std::make_unique<RooCompositeDataStore>(
name,title,
_vars,*icat,storeMap) ;
359 wgtVarName = wgtVar->
GetName() ;
363 if (!wgtVar && !wgtVarName && impData && impData->
_wgtVar) {
375 if (wgtVarName && newWeight) {
381 _dstore = std::make_unique<RooVectorDataStore>(
name,title,
_vars,wgtVarName) ;
386 map<string,RooDataSet*> hmap ;
388 auto hiter = impSliceData.
begin() ;
389 for (
const auto& token :
ROOT::Split(impSliceNames,
",")) {
390 hmap[token] =
static_cast<RooDataSet*
>(*hiter);
413 wgtVarName = wgtVar->
GetName() ;
420 if (wgtVarName && *wgtVarName) {
430 }
else if (indexCat) {
444 if (cutSpec && *cutSpec) {
451 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
453 if (!indexCat->
hasLabel(hiter->first)) {
457 if (!icat->
hasLabel(hiter->first)) {
460 icat->
setLabel(hiter->first.c_str()) ;
462 RooFormulaVar cutVarTmp(cutSpec,cutSpec,hiter->second->_vars) ;
463 _dstore->loadValues(hiter->second->store(),&cutVarTmp,cutRange) ;
466 }
else if (impData) {
470 _dstore->loadValues(impData->
store(),&cutVarTmp,cutRange);
471 }
else if (impTree) {
476 tstore->
loadValues(impTree,&cutVarTmp,cutRange);
479 tmpstore.
loadValues(impTree,&cutVarTmp,cutRange) ;
482 }
else if (fname && strlen(fname)) {
487 coutE(
InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
488 throw string(
Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",
GetName(),fname)) ;
492 coutE(
InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
493 throw string(
Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",
GetName(),fname,tname)) ;
515 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
517 if (!indexCat->
hasLabel(hiter->first)) {
521 if (!icat->
hasLabel(hiter->first)) {
524 icat->
setLabel(hiter->first.c_str()) ;
525 _dstore->loadValues(hiter->second->store(),cutVar,cutRange) ;
529 }
else if (impData) {
532 }
else if (impTree) {
538 tmpstore.
loadValues(impTree,cutVar,cutRange) ;
541 }
else if (fname && strlen(fname)) {
545 coutE(
InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
546 throw string(
Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",
GetName(),fname)) ;
550 coutE(
InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
551 throw string(
Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",
GetName(),fname,tname)) ;
570 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
572 if (!indexCat->
hasLabel(hiter->first)) {
576 if (!icat->
hasLabel(hiter->first)) {
579 icat->
setLabel(hiter->first.c_str()) ;
581 _dstore->loadValues(hiter->second->store(),0,cutRange) ;
584 }
else if (impData) {
588 }
else if (impTree || (fname && strlen(fname))) {
590 std::unique_ptr<TFile>
file;
592 if (impTree ==
nullptr) {
595 coutE(
InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
596 throw std::invalid_argument(
Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",
GetName(),fname)) ;
599 file->GetObject(tname, impTree);
601 coutE(
InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
602 throw std::invalid_argument(
Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",
GetName(),fname,tname)) ;
631 static_cast<std::unique_ptr<RooAbsDataStore>
>(std::make_unique<RooVectorDataStore>(
name,title,
_vars,wgtVarName)) ;
656 const RooArgSet& vars,
const char *cuts,
const char* wgtVarName) :
663 std::unique_ptr<RooFormulaVar> cutVar;
664 if (cuts && strlen(cuts) != 0) {
666 cutVar = std::make_unique<RooFormulaVar>(cuts, cuts,
_vars,
false);
668 _dstore = std::make_unique<RooVectorDataStore>(
name,title,
712 :
RooDataSet{
name, title, dset, vars, cutVar.expression(), wgtVarName} {}
732 :
RooDataSet{
name, title, theTree, vars, cutVar.expression(), wgtVarName} {}
759 const RooArgSet& vars,
const char* cuts,
const char* wgtVarName) :
763 auto tstore = std::make_unique<RooTreeDataStore>(
name,title,
_vars,*theTree,cuts,wgtVarName);
769 _dstore = std::make_unique<RooVectorDataStore>(
name,title,
_vars,wgtVarName);
797 std::size_t nStart, std::size_t nStop) :
817 if (wgtVar) tmp.
add(*wgtVar) ;
831 if (wgtVarName && vars && !
_wgtVar) {
864 << wgtVarName <<
" not found in set of variables, no weighting will be assigned" << endl ;
865 throw std::invalid_argument(
"RooDataSet::initialize() weight variable could not be initialised.");
868 << wgtVarName <<
" is not of type RooRealVar, no weighting will be assigned" << endl ;
869 throw std::invalid_argument(
"RooDataSet::initialize() weight variable could not be initialised.");
883 std::size_t nStart, std::size_t nStop)
891 if (!cutRange || strchr(cutRange,
',')==0) {
897 std::stringstream errMsg;
898 errMsg <<
"Error in RooAbsData::reduce! The ranges " << cutRange <<
" are overlapping!";
899 throw std::runtime_error(errMsg.str());
902 for (
const auto& token : tokens) {
907 out->
append(appendedData);
942 title = std::string(
GetTitle()) +
"_binned" ;
971 return e > 0.0 ?
e *
e :
w *
w;
981 if(first >= nEntries || (
first +
len) > nEntries) {
982 throw std::runtime_error(
"RooDataSet::getWeightBatch(): requested range not valid for dataset.");
986 if(allWeights.
empty())
return {};
988 if(!sumW2)
return {std::cbegin(allWeights) +
first, std::cbegin(allWeights) +
first +
len};
998 for (std::size_t i = 0; i < nEntries; ++i) {
1051 std::unique_ptr<RooFormula> select = nullptr ;
1052 if (cutSpec && strlen(cutSpec) > 0) {
1053 select = std::make_unique<RooFormula>(
"select",cutSpec,*
get()) ;
1065 if (select && select->eval()==0.) continue ;
1142 }
else if ((wgt != 1. || wgtError != 0.) &&
_errorMsgCount < 5) {
1143 ccoutE(
DataHandling) <<
"An event weight/error was passed but no weight variable was defined"
1144 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1150 &&
std::abs(wgt*wgt - wgtError)/wgtError > 1.E-15
1151 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1154 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1192 ccoutE(
DataHandling) <<
"An event weight was given but no weight variable was defined"
1193 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1198 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreAsymError")) {
1201 <<
"' does not store errors. Check `StoreAsymError` in the RooDataSet constructor." << std::endl;
1244 ccoutE(
DataHandling) <<
"An event weight was given but no weight variable was defined"
1245 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1252 && wgtError != 0. && wgtError != wgt*wgt
1253 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1256 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1277 list<RooDataSet*> dsetList ;
1278 if (data1) dsetList.push_back(data1) ;
1279 if (data2) dsetList.push_back(data2) ;
1280 if (data3) dsetList.push_back(data3) ;
1281 if (data4) dsetList.push_back(data4) ;
1282 if (data5) dsetList.push_back(data5) ;
1283 if (data6) dsetList.push_back(data6) ;
1284 return merge(dsetList) ;
1300 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1308 list<RooAbsDataStore*> dstoreList ;
1309 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1311 dstoreList.push_back((*iter)->store()) ;
1416 pc.defineString(
"drawOption",
"DrawOption",0,
"P") ;
1417 pc.defineString(
"histName",
"Name",0,
"") ;
1418 pc.defineInt(
"lineColor",
"LineColor",0,-999) ;
1419 pc.defineInt(
"lineStyle",
"LineStyle",0,-999) ;
1420 pc.defineInt(
"lineWidth",
"LineWidth",0,-999) ;
1421 pc.defineInt(
"markerColor",
"MarkerColor",0,-999) ;
1422 pc.defineInt(
"markerStyle",
"MarkerStyle",0,8) ;
1423 pc.defineDouble(
"markerSize",
"MarkerSize",0,-999) ;
1424 pc.defineInt(
"fillColor",
"FillColor",0,-999) ;
1425 pc.defineInt(
"fillStyle",
"FillStyle",0,-999) ;
1426 pc.defineInt(
"histInvisible",
"Invisible",0,0) ;
1427 pc.defineDouble(
"scaleFactor",
"Rescale",0,1.) ;
1428 pc.defineObject(
"xvar",
"XVar",0,0) ;
1429 pc.defineObject(
"yvar",
"YVar",0,0) ;
1433 pc.process(argList) ;
1439 const char* drawOptions =
pc.getString(
"drawOption") ;
1440 Int_t histInvisible =
pc.getInt(
"histInvisible") ;
1441 const char* histName =
pc.getString(
"histName",0,
true) ;
1442 double scaleFactor =
pc.getDouble(
"scaleFactor") ;
1451 coutE(
InputArguments) <<
"RooDataSet::plotOnXY(" <<
GetName() <<
") ERROR: no YVar() argument specified and dataset is not weighted" << endl ;
1456 if (yvar && !dataY) {
1457 coutE(
InputArguments) <<
"RooDataSet::plotOnXY(" <<
GetName() <<
") ERROR on YVar() argument, dataset does not contain a variable named " << yvar->
GetName() << endl ;
1465 graph->SetName(histName) ;
1475 double y,eylo,eyhi ;
1484 graph->addBinWithXYError(
x,
y,-1*exlo,exhi,-1*eylo,eyhi,scaleFactor) ;
1488 Int_t lineColor =
pc.getInt(
"lineColor") ;
1489 Int_t lineStyle =
pc.getInt(
"lineStyle") ;
1490 Int_t lineWidth =
pc.getInt(
"lineWidth") ;
1491 Int_t markerColor =
pc.getInt(
"markerColor") ;
1492 Int_t markerStyle =
pc.getInt(
"markerStyle") ;
1493 Size_t markerSize =
pc.getDouble(
"markerSize") ;
1494 Int_t fillColor =
pc.getInt(
"fillColor") ;
1495 Int_t fillStyle =
pc.getInt(
"fillStyle") ;
1497 if (lineColor!=-999)
graph->SetLineColor(lineColor) ;
1498 if (lineStyle!=-999)
graph->SetLineStyle(lineStyle) ;
1499 if (lineWidth!=-999)
graph->SetLineWidth(lineWidth) ;
1500 if (markerColor!=-999)
graph->SetMarkerColor(markerColor) ;
1501 if (markerStyle!=-999)
graph->SetMarkerStyle(markerStyle) ;
1502 if (markerSize!=-999)
graph->SetMarkerSize(markerSize) ;
1503 if (fillColor!=-999)
graph->SetFillColor(fillColor) ;
1504 if (fillStyle!=-999)
graph->SetFillStyle(fillStyle) ;
1564 const char *verbOpt,
const char* commonPath,
1565 const char* indexCatName) {
1570 bool ownIsBlind(
true) ;
1573 blindState =
new RooCategory(
"blindState",
"Blinding State") ;
1576 ownIsBlind = false ;
1578 oocoutE(
nullptr,
DataHandling) <<
"RooDataSet::read: ERROR: variable list already contains"
1579 <<
"a non-RooCategory blindState member" << endl ;
1583 <<
"blindState category in variable list" << endl ;
1598 auto data = std::make_unique<RooDataSet>(
"dataset", fileList,
variables);
1599 if (ownIsBlind) {
variables.remove(*blindState) ;
delete blindState ; }
1614 tmp =
data->_vars.find(indexCatName) ;
1617 << indexCatName <<
" in supplied variable list" << endl ;
1622 <<
" is not a RooCategory" << endl ;
1632 Int_t outOfRange(0) ;
1635 Int_t fileSeqNum(0);
1641 const char *catname = strchr(
filename.c_str(),
':');
1657 char newLabel[128] ;
1658 snprintf(newLabel,128,
"file%03d",fileSeqNum) ;
1659 if (indexCat->
defineType(newLabel,fileSeqNum)) {
1660 oocoutE(
data.get(),
DataHandling) <<
"RooDataSet::read: Error, cannot register automatic type name " << newLabel
1661 <<
" in index category " << indexCat->
GetName() << endl ;
1672 TString fullName(commonPath) ;
1674 ifstream
file(fullName) ;
1678 <<
filename <<
"'. Returning nullptr now." << endl;
1684 bool haveBlindString(
false) ;
1686 while(
file.good() && !
file.eof()) {
1691 if (
file.peek() ==
'#') {
1707 blindCat->
setIndex(haveBlindString) ;
1713 while (isspace(
file.peek())) {
1715 file >> std::noskipws >> dummy >> std::skipws;
1729 for (
const auto& nameIdx : *indexCat) {
1730 origIndexCat->
defineType(nameIdx.first, nameIdx.second);
1734 <<
" events (ignored " << outOfRange <<
" out of range events)" << endl;
1736 return data.release();
1776 coutW(
DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
"): WARNING error(s) have occured in writing" << endl ;
1794 os <<
indent <<
" Dataset variable \"" <<
_wgtVar->
GetName() <<
"\" is interpreted as the event weight" << endl ;
1825 os << arg->GetName() ;
1884 TTree* X_tree(0) ; R__b >> X_tree;
1891 _dstore = std::make_unique<RooTreeDataStore>(X_tree,
_vars) ;
1927 const char * cstr =
"cstr";
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.
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.
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
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 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.
void setGlobalObservables(RooArgSet const &globalObservables)
Sets the global observables stored in this data.
RooAbsDataStore * store()
static StorageType defaultStorageType
std::unique_ptr< RooAbsDataStore > _dstore
Data storage implementation.
void addOwnedComponent(const char *idxlabel, RooAbsData &data)
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.
void Streamer(TBuffer &) override
Stream an object of class RooAbsData.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAbsArg * createFundamental(const char *newname=nullptr) const override
Create a RooRealVar fundamental object with our properties.
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...
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
The RooDataHist is a container class to hold N-dimensional binned data.
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 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.
RooArgSet addWgtVar(const RooArgSet &origVars, const RooAbsArg *wgtVar)
Helper function for constructor that adds optional weight variable to construct total set of observab...
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.
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.
RVec< PromoteType< T > > abs(const RVec< T > &v)
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
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.
static constexpr double pc
void variables(TString dataset, TString fin="TMVA.root", TString dirName="InputVariables_Id", TString title="TMVA Input Variables", Bool_t isRegression=kFALSE, Bool_t useTMVAStyle=kTRUE)