115#ifndef USEMEMPOOLFORDATASET
144void* RooDataSet::operator
new (
size_t bytes)
149 return memPool()->allocate(bytes);
157void RooDataSet::operator
delete (
void* ptr)
160 if (memPool()->deallocate(ptr))
163 std::cerr << __func__ <<
" " << ptr <<
" is not in any of the pools." << std::endl;
166 ::operator
delete(ptr);
225 RooAbsData(
name,title,
RooArgSet(vars,(
RooAbsArg*)
RooCmdConfig::decodeObjOnTheFly(
"RooDataSet::RooDataSet",
"IndexCat",0,0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)))
229 pc.
defineInt(
"ownLinked",
"OwnLinked",0) ;
241 pc.
defineInt(
"newWeight1",
"WeightVarName",0,0) ;
245 pc.
defineInt(
"newWeight2",
"WeightVar",0,0) ;
248 pc.
defineSet(
"errorSet",
"StoreError",0) ;
249 pc.
defineSet(
"asymErrSet",
"StoreAsymError",0) ;
250 pc.
defineSet(
"glObs",
"GlobalObservables",0,0) ;
251 pc.
defineMutex(
"ImportTree",
"ImportData",
"ImportDataSlice",
"LinkDataSlice",
"ImportFromFile") ;
282 const char* impSliceNames = pc.
getString(
"impSliceState",
"",
kTRUE) ;
284 const char* lnkSliceNames = pc.
getString(
"lnkSliceState",
"",
kTRUE) ;
289 const char* fname = pc.
getString(
"fname") ;
290 const char* tname = pc.
getString(
"tname") ;
298 map<string,RooAbsData*> hmap ;
301 strlcpy(tmp, lnkSliceNames, 64000);
302 char *token = strtok(tmp,
",");
306 token = strtok(0,
",");
314 wgtVarName = wgtVar->
GetName() ;
322 map<string,RooAbsDataStore*> storeMap ;
325 throw std::string(
"RooDataSet::RooDataSet() ERROR in constructor, cannot find index category") ;
327 for (map<string,RooAbsData*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
329 if (indexCat && !indexCat->
hasLabel(hiter->first)) {
331 coutI(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->
GetName() << endl ;
333 if (icat && !icat->
hasLabel(hiter->first)) {
336 icat->
setLabel(hiter->first.c_str()) ;
351 wgtVarName = wgtVar->
GetName() ;
355 if (!wgtVar && !wgtVarName && impData && impData->
_wgtVar) {
369 if (wgtVarName && newWeight) {
383 map<string,RooDataSet*> hmap ;
386 for (
const auto& token :
ROOT::Split(impSliceNames,
",")) {
413 delete intAsymErrorSet ;
418 wgtVarName = wgtVar->
GetName() ;
425 if (wgtVarName && *wgtVarName) {
435 }
else if (indexCat) {
449 if (cutSpec && *cutSpec) {
456 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
458 if (!indexCat->
hasLabel(hiter->first)) {
460 coutI(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->
GetName() << endl ;
462 if (!icat->
hasLabel(hiter->first)) {
465 icat->
setLabel(hiter->first.c_str()) ;
467 RooFormulaVar cutVarTmp(cutSpec,cutSpec,hiter->second->_vars) ;
471 }
else if (impData) {
476 }
else if (impTree) {
481 tstore->
loadValues(impTree,&cutVarTmp,cutRange);
484 tmpstore.
loadValues(impTree,&cutVarTmp,cutRange) ;
487 }
else if (fname && strlen(fname)) {
492 coutE(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
493 throw string(
Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",
GetName(),fname)) ;
497 coutE(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
498 throw string(
Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",
GetName(),fname,tname)) ;
520 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
522 if (!indexCat->
hasLabel(hiter->first)) {
524 coutI(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->
GetName() << endl ;
526 if (!icat->
hasLabel(hiter->first)) {
529 icat->
setLabel(hiter->first.c_str()) ;
534 }
else if (impData) {
537 }
else if (impTree) {
543 tmpstore.
loadValues(impTree,cutVar,cutRange) ;
546 }
else if (fname && strlen(fname)) {
550 coutE(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
551 throw string(
Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",
GetName(),fname)) ;
555 coutE(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
556 throw string(
Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",
GetName(),fname,tname)) ;
575 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
577 if (!indexCat->
hasLabel(hiter->first)) {
579 coutI(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->
GetName() << endl ;
581 if (!icat->
hasLabel(hiter->first)) {
584 icat->
setLabel(hiter->first.c_str()) ;
589 }
else if (impData) {
593 }
else if (impTree || (fname && strlen(fname))) {
595 std::unique_ptr<TFile>
file;
597 if (impTree ==
nullptr) {
600 coutE(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
601 throw std::invalid_argument(
Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",
GetName(),fname)) ;
604 file->GetObject(tname, impTree);
606 coutE(InputArguments) <<
"RooDataSet::ctor(" <<
GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
607 throw std::invalid_argument(
Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",
GetName(),fname,tname)) ;
664 const RooArgSet& vars,
const char *cuts,
const char* wgtVarName) :
793 const RooArgSet& vars,
const char* cuts,
const char* wgtVarName) :
835 std::size_t nStart, std::size_t nStop,
Bool_t copyCache,
const char* wgtVarName) :
840 copyCache, wgtVarName);
843 nStop, copyCache, wgtVarName);
861 if (wgtVar) tmp.
add(*wgtVar) ;
877 delete selCacheVars ;
893 if (wgtVarName && vars && !
_wgtVar) {
925 coutE(DataHandling) <<
"RooDataSet::RooDataSet(" <<
GetName() <<
"): designated weight variable "
926 << wgtVarName <<
" not found in set of variables, no weighting will be assigned" << endl ;
927 throw std::invalid_argument(
"RooDataSet::initialize() weight variable could not be initialised.");
929 coutE(DataHandling) <<
"RooDataSet::RooDataSet(" <<
GetName() <<
"): designated weight variable "
930 << wgtVarName <<
" is not of type RooRealVar, no weighting will be assigned" << endl ;
931 throw std::invalid_argument(
"RooDataSet::initialize() weight variable could not be initialised.");
945 std::size_t nStart, std::size_t nStop,
Bool_t copyCache)
993 title = std::string(
GetTitle()) +
"_binned" ;
1026 if(first >= nEntries || (
first + len) > nEntries) {
1027 throw std::runtime_error(
"RooDataSet::getWeightBatch(): requested range not valid for dataset.");
1031 if(allWeights.
empty())
return {};
1033 if(!sumW2)
return {std::cbegin(allWeights) +
first, std::cbegin(allWeights) +
first + len};
1040 _sumW2Buffer = std::make_unique<std::vector<double>>();
1043 for (std::size_t i = 0; i < nEntries; ++i) {
1046 _sumW2Buffer->push_back(allWeights[i] * allWeights[i]);
1095 std::unique_ptr<RooFormula> select = nullptr ;
1096 if (cutSpec && strlen(cutSpec) > 0) {
1097 select = std::make_unique<RooFormula>(
"select",cutSpec,*
get()) ;
1109 if (select && select->eval()==0.) continue ;
1186 }
else if ((wgt != 1. || wgtError != 0.) &&
_errorMsgCount < 5) {
1187 ccoutE(DataHandling) <<
"An event weight/error was passed but no weight variable was defined"
1188 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1194 && fabs(wgt*wgt - wgtError)/wgtError > 1.E-15
1195 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1196 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
1198 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1236 ccoutE(DataHandling) <<
"An event weight was given but no weight variable was defined"
1237 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1242 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreAsymError")) {
1243 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
1245 <<
"' does not store errors. Check `StoreAsymError` in the RooDataSet constructor." << std::endl;
1288 ccoutE(DataHandling) <<
"An event weight was given but no weight variable was defined"
1289 <<
" in the dataset '" <<
GetName() <<
"'. The weight will be ignored." << std::endl;
1296 && wgtError != 0. && wgtError != wgt*wgt
1297 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1298 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" <<
GetName()
1300 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1321 list<RooDataSet*> dsetList ;
1322 if (data1) dsetList.push_back(data1) ;
1323 if (data2) dsetList.push_back(data2) ;
1324 if (data3) dsetList.push_back(data3) ;
1325 if (data4) dsetList.push_back(data4) ;
1326 if (data5) dsetList.push_back(data5) ;
1327 if (data6) dsetList.push_back(data6) ;
1328 return merge(dsetList) ;
1344 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1346 coutE(InputArguments) <<
"RooDataSet::merge(" <<
GetName() <<
") ERROR: datasets have different size" << endl ;
1352 list<RooAbsDataStore*> dstoreList ;
1353 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1355 dstoreList.push_back((*iter)->store()) ;
1448 static Int_t counter(0) ;
1457 <<
" is not in dataset and is also not dependent on data set" << endl ;
1463 ownPlotVarX =
kTRUE ;
1476 <<
" is not in dataset and is also not dependent on data set" << endl ;
1482 ownPlotVarY =
kTRUE ;
1490 if(0 != cuts && strlen(cuts)) {
1492 if (!select || !select->
ok()) {
1508 coutE(DataHandling) <<
fName <<
"::createHistogram: unable to create a new histogram" << endl;
1514 for(
Int_t i=0; i < nevent; ++i)
1518 if (select && select->
eval()==0) continue ;
1522 if (ownPlotVarX)
delete plotVarX ;
1523 if (ownPlotVarY)
delete plotVarY ;
1524 if (select)
delete select ;
1574 pc.
defineInt(
"lineColor",
"LineColor",0,-999) ;
1575 pc.
defineInt(
"lineStyle",
"LineStyle",0,-999) ;
1576 pc.
defineInt(
"lineWidth",
"LineWidth",0,-999) ;
1577 pc.
defineInt(
"markerColor",
"MarkerColor",0,-999) ;
1578 pc.
defineInt(
"markerStyle",
"MarkerStyle",0,8) ;
1580 pc.
defineInt(
"fillColor",
"FillColor",0,-999) ;
1581 pc.
defineInt(
"fillStyle",
"FillStyle",0,-999) ;
1582 pc.
defineInt(
"histInvisible",
"Invisible",0,0) ;
1595 const char* drawOptions = pc.
getString(
"drawOption") ;
1596 Int_t histInvisible = pc.
getInt(
"histInvisible") ;
1607 coutE(InputArguments) <<
"RooDataSet::plotOnXY(" <<
GetName() <<
") ERROR: no YVar() argument specified and dataset is not weighted" << endl ;
1612 if (yvar && !dataY) {
1613 coutE(InputArguments) <<
"RooDataSet::plotOnXY(" <<
GetName() <<
") ERROR on YVar() argument, dataset does not contain a variable named " << yvar->
GetName() << endl ;
1621 graph->SetName(histName) ;
1640 graph->addBinWithXYError(
x,
y,-1*exlo,exhi,-1*eylo,eyhi,scaleFactor) ;
1653 if (lineColor!=-999)
graph->SetLineColor(lineColor) ;
1654 if (lineStyle!=-999)
graph->SetLineStyle(lineStyle) ;
1655 if (lineWidth!=-999)
graph->SetLineWidth(lineWidth) ;
1656 if (markerColor!=-999)
graph->SetMarkerColor(markerColor) ;
1657 if (markerStyle!=-999)
graph->SetMarkerStyle(markerStyle) ;
1658 if (markerSize!=-999)
graph->SetMarkerSize(markerSize) ;
1659 if (fillColor!=-999)
graph->SetFillColor(fillColor) ;
1660 if (fillStyle!=-999)
graph->SetFillStyle(fillStyle) ;
1720 const char *verbOpt,
const char* commonPath,
1721 const char* indexCatName) {
1727 RooAbsArg* blindState = variables.find(
"blindState") ;
1729 blindState =
new RooCategory(
"blindState",
"Blinding State") ;
1730 variables.add(*blindState) ;
1733 if (blindState->IsA()!=RooCategory::Class()) {
1734 oocoutE((
TObject*)0,DataHandling) <<
"RooDataSet::read: ERROR: variable list already contains"
1735 <<
"a non-RooCategory blindState member" << endl ;
1738 oocoutW((
TObject*)0,DataHandling) <<
"RooDataSet::read: WARNING: recycling existing "
1739 <<
"blindState category in variable list" << endl ;
1754 auto data = std::make_unique<RooDataSet>(
"dataset", fileList, variables);
1755 if (ownIsBlind) { variables.remove(*blindState) ;
delete blindState ; }
1757 oocoutE((
TObject*)0,DataHandling) <<
"RooDataSet::read: unable to create a new dataset"
1763 blindCat = (
RooCategory*) data->_vars.find(
"blindState") ;
1770 tmp = data->_vars.find(indexCatName) ;
1772 oocoutE(data.get(),DataHandling) <<
"RooDataSet::read: no index category named "
1773 << indexCatName <<
" in supplied variable list" << endl ;
1776 if (tmp->IsA()!=RooCategory::Class()) {
1777 oocoutE(data.get(),DataHandling) <<
"RooDataSet::read: variable " << indexCatName
1778 <<
" is not a RooCategory" << endl ;
1788 Int_t outOfRange(0) ;
1791 Int_t fileSeqNum(0);
1792 for (
const auto& filename :
ROOT::Split(std::string(fileList),
", ")) {
1797 const char *catname = strchr(filename.c_str(),
':');
1813 char newLabel[128] ;
1814 snprintf(newLabel,128,
"file%03d",fileSeqNum) ;
1815 if (indexCat->
defineType(newLabel,fileSeqNum)) {
1816 oocoutE(data.get(), DataHandling) <<
"RooDataSet::read: Error, cannot register automatic type name " << newLabel
1817 <<
" in index category " << indexCat->
GetName() << endl ;
1825 oocoutI(data.get(), DataHandling) <<
"RooDataSet::read: reading file " << filename << endl ;
1828 TString fullName(commonPath) ;
1829 fullName.
Append(filename) ;
1830 ifstream
file(fullName) ;
1833 oocoutE(data.get(), DataHandling) <<
"RooDataSet::read: unable to open '"
1834 << filename <<
"'. Returning nullptr now." << endl;
1840 Bool_t haveBlindString(
false) ;
1842 while(
file.good() && !
file.eof()) {
1844 if(debug)
oocxcoutD(data.get(),DataHandling) <<
"reading line " <<
line << endl;
1847 if (
file.peek() ==
'#') {
1848 if(debug)
oocxcoutD(data.get(),DataHandling) <<
"skipping comment on line " <<
line << endl;
1852 data->_vars.assign(variables) ;
1856 oocoutE(data.get(), DataHandling) <<
"RooDataSet::read(static): read error at line " <<
line << endl ;
1863 blindCat->
setIndex(haveBlindString) ;
1869 while (isspace(
file.peek())) {
1871 file >> std::noskipws >> dummy >> std::skipws;
1883 assert(
dynamic_cast<RooCategory*
>(variables.find(indexCatName)));
1884 const auto origIndexCat =
static_cast<RooCategory*
>(variables.find(indexCatName));
1885 for (
const auto& nameIdx : *indexCat) {
1886 origIndexCat->
defineType(nameIdx.first, nameIdx.second);
1889 oocoutI(data.get(),DataHandling) <<
"RooDataSet::read: read " << data->numEntries()
1890 <<
" events (ignored " << outOfRange <<
" out of range events)" << endl;
1892 return data.release();
1907 ofstream ofs(filename) ;
1909 coutE(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
") cannot create file " << filename << endl ;
1914 coutI(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
") writing ASCII file " << filename << endl ;
1932 coutW(DataHandling) <<
"RooDataSet::write(" <<
GetName() <<
"): WARNING error(s) have occured in writing" << endl ;
1950 os <<
indent <<
" Dataset variable \"" <<
_wgtVar->
GetName() <<
"\" is interpreted as the event weight" << endl ;
2019void RooDataSet::Streamer(
TBuffer &R__b)
2042 RooAbsData::Streamer(R__b);
2043 TTree* X_tree(0) ; R__b >> X_tree;
2044 RooArgSet X_truth ; X_truth.Streamer(R__b);
2045 TString X_blindString ; X_blindString.Streamer(R__b);
2056 RooDirItem::Streamer(R__b);
2088 const char * cstr =
"cstr";
static void indent(ostringstream &buf, int indent_level)
char * Form(const char *fmt,...)
Memory pool for RooArgSet and RooDataSet.
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 attachToStore(RooAbsDataStore &store)
Attach this argument to the data store such that it reads data from there.
Bool_t redirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE)
Replace all direct servers of this object with the new servers in newServerList.
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
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.
void assignFast(const RooAbsCollection &other, bool setValDirty=true) const
Functional equivalent of assign() but assumes this and other collection have same layout.
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
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_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add an argument and transfer the ownership to the collection.
Bool_t allInRange(const char *rangeSpec) const
Return true if all contained object report to have their value inside the specified range.
void setAttribAll(const Text_t *name, Bool_t value=kTRUE)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
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...
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
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 RooSpan< const double > getWeightBatch(std::size_t first, std::size_t len) const =0
const RooArgSet & cachedVars() const
virtual void append(RooAbsDataStore &other)=0
virtual Double_t sumEntries() const
virtual void checkInit() const
virtual void loadValues(const RooAbsDataStore *tds, const RooFormulaVar *select=0, const char *rangeName=0, std::size_t nStart=0, std::size_t nStop=std::numeric_limits< std::size_t >::max())=0
virtual Double_t weight() const =0
virtual Double_t weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const =0
virtual RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore * > dstoreList)=0
virtual RooArgSet * addColumns(const RooArgList &varList)=0
virtual Bool_t isWeighted() const =0
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE)=0
RooAbsData is the common abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
void SetName(const char *name)
Set the name of the TNamed.
void setGlobalObservables(RooArgSet const &globalObservables)
Sets the global observables stored in this data.
RooAbsDataStore * store()
void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Interface for detailed printing of object.
static StorageType defaultStorageType
void addOwnedComponent(const char *idxlabel, RooAbsData &data)
virtual void attachCache(const RooAbsArg *newOwner, const RooArgSet &cachedVars)
Internal method – Attach dataset copied with cache contents to copied instances of functions.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
RooAbsDataStore * _dstore
External variables cached with this data set.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
virtual Int_t getBins(const char *name=0) const
Get number of bins of currently defined range.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAbsArg * createFundamental(const char *newname=0) const
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.
virtual void writeToStream(std::ostream &os, bool compact, const char *section=0) const
Write the contents of the argset in ASCII form to given stream.
RooCategory is an object to represent discrete states.
bool defineType(const std::string &label)
Define a state with given name.
virtual Bool_t setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
virtual Bool_t setIndex(Int_t index, bool printError=true) override
Set value by specifying the index code 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.
TObject * getObject(const char *name, TObject *obj=0)
Return TObject property registered with name 'name'.
Bool_t 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...
void defineMutex(const char *argName1, const char *argName2)
Define arguments named argName1 and argName2 mutually exclusive.
Bool_t defineObject(const char *name, const char *argName, Int_t setNum, const TObject *obj=0, Bool_t isArray=kFALSE)
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_t convEmptyToNull=kFALSE)
Return string property registered with name 'name'.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
const RooLinkedList & getObjectList(const char *name)
Return list of objects registered with name 'name'.
Bool_t defineDouble(const char *name, const char *argName, Int_t doubleNum, Double_t defValue=0.)
Define Double_t property name 'name' mapped to Double_t in slot 'doubleNum' in RooCmdArg with name ar...
void defineDependency(const char *refArgName, const char *neededArgName)
Define that processing argument name refArgName requires processing of argument named neededArgName t...
Double_t getDouble(const char *name, Double_t defaultValue=0)
Return Double_t property registered with name 'name'.
Bool_t defineSet(const char *name, const char *argName, Int_t setNum, const RooArgSet *set=0)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
Bool_t defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", Bool_t appendMode=kFALSE)
Define Double_t property name 'name' mapped to Double_t in slot 'stringNum' in RooCmdArg with name ar...
RooArgSet * getSet(const char *name, RooArgSet *set=0)
Return RooArgSet property registered with name 'name'.
Bool_t ok(Bool_t verbose) const
Return true of parsing was successful.
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
RooCompositeDataStore combines several disjunct datasets into one.
The RooDataHist is a container class to hold N-dimensional binned data.
RooDataSet is a container class to hold unbinned data.
virtual RooSpan< const double > getWeightBatch(std::size_t first, std::size_t len, bool sumW2) const override
virtual Bool_t isNonPoissonWeighted() const override
Returns true if histogram contains bins with entries with a non-integer weight.
virtual Bool_t isWeighted() const override
Return true if dataset contains weighted events.
bool _doWeightErrorCheck
Counter to silence error messages when filling dataset.
virtual RooAbsData * emptyClone(const char *newName=0, const char *newTitle=0, const RooArgSet *vars=0, const char *wgtVarName=0) const override
Return an empty clone of this dataset.
virtual void weightError(double &lo, double &hi, ErrorType etype=SumW2) const override
Return the asymmetric errors on the current weight.
virtual const RooArgSet * get() const override
Return a RooArgSet with the coordinates of the current event.
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE)
Add a column with the values of the given (function) argument to this dataset.
virtual Double_t sumEntries() const override
Return effective number of entries in dataset, i.e., sum all weights.
Bool_t write(const char *filename) const
Write the contents of this dataset to an ASCII file with the specified name.
RooAbsData * reduceEng(const RooArgSet &varSubset, const RooFormulaVar *cutVar, const char *cutRange=0, std::size_t nStart=0, std::size_t nStop=std::numeric_limits< std::size_t >::max(), Bool_t copyCache=kTRUE) override
Implementation of RooAbsData virtual method that drives the RooAbsData::reduce() methods.
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.
MemPoolForRooSets< RooDataSet, 5 *150 > MemPool
virtual 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 Double_t weightSquared() const override
Return squared event weight of current event.
static RooDataSet * read(const char *filename, const RooArgList &variables, const char *opts="", const char *commonPath="", const char *indexCatName=0)
Read given list of ascii files, and construct a data set, using the given ArgList as structure defini...
TH2F * createHistogram(const RooAbsRealLValue &var1, const RooAbsRealLValue &var2, const char *cuts="", const char *name="hist") const
Create a TH2F histogram of the distribution of the specified variable using this dataset.
virtual RooArgSet * addColumns(const RooArgList &varList)
Add a column with the values of the given list of (function) argument to this dataset.
void SetNameTitle(const char *name, const char *title) override
Change the title of this dataset into the given name.
virtual 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.
Bool_t merge(RooDataSet *data1, RooDataSet *data2=0, RooDataSet *data3=0, RooDataSet *data4=0, RooDataSet *data5=0, RooDataSet *data6=0)
void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const override
Print info about this dataset to the specified output stream.
virtual ~RooDataSet()
Destructor.
virtual void add(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0) override
Add a data point, with its coordinates specified in the 'data' argset, to the data set.
std::unique_ptr< std::vector< double > > _sumW2Buffer
When adding events with weights, check that weights can actually be stored.
unsigned short _errorMsgCount
RooDataHist * binnedClone(const char *newName=0, const char *newTitle=0) const
Return binned clone of this dataset.
virtual void addFast(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0)
Add a data point, with its coordinates specified in the 'data' argset, to the data set.
static MemPool * memPool()
void convertToTreeStore() override
Convert vector-based storage to tree-based storage.
virtual RooAbsData * cacheClone(const RooAbsArg *newCacheOwner, const RooArgSet *newCacheVars, const char *newName=0) override
Return a clone of this dataset containing only the cached variables.
virtual Double_t weight() const override
Return event weight of current event.
RooDirItem is a utility base class for RooFit objects that are to be attached to ROOT directories.
void appendToDir(TObject *obj, Bool_t forceMemoryResident=kFALSE)
Append object to directory.
void removeFromDir(TObject *obj)
Remove object from directory it was added to.
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 ...
TIterator * MakeIterator(Bool_t forward=kTRUE) const
Create a TIterator for this list.
virtual void Add(TObject *arg)
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_t invisible=kFALSE, Bool_t refreshNorm=kFALSE)
Add the specified plotable object to our plot.
RooRealVar represents a variable that can be changed from the outside.
Double_t getErrorHi() const
Double_t getErrorLo() const
void setError(Double_t value)
void setAsymError(Double_t lo, Double_t hi)
virtual void setVal(Double_t value)
Set value of variable to 'value'.
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
RooTreeDataStore is a TTree-backed data storage.
void loadValues(const TTree *t, const RooFormulaVar *select=0, const char *rangeName=0, 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.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=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
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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.
2-D histogram with a float per channel (see TH1 documentation)}
Int_t Fill(Double_t)
Invalid Fill method.
Iterator abstract base class.
virtual TObject * Next()=0
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
void ToLower()
Change string to lower-case.
const char * Data() const
TString & Prepend(const char *cs)
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A TTree represents a columnar dataset.
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.