16#ifndef ROO_VECTOR_DATA_STORE
17#define ROO_VECTOR_DATA_STORE
39#define VECTOR_BUFFER_SIZE 1024
54 std::size_t nStart, std::size_t nStop)
override;
63 std::size_t nStart, std::size_t nStop,
const char* wgtVarName=
nullptr) ;
79 std::vector<ArrayInfo<double>>
reals;
80 std::vector<ArrayInfo<RooAbsCategory::value_type>>
cats;
126 std::span<const double>
getWeightBatch(std::size_t first, std::size_t
len)
const override;
155 void reset()
override;
173 void loadValues(
const RooAbsDataStore *tds,
const RooFormulaVar* select=
nullptr,
const char* rangeName=
nullptr, std::size_t nStart=0, std::size_t nStop = std::numeric_limits<std::size_t>::max())
override;
175 void dump()
override;
178 const double* arrayWgtErrHi,
const double* arraySumW2)
override {
198 _vec.reserve(initialCapacity);
203 _vec.reserve(initialCapacity);
224 if (&other==
this)
return *
this;
230 std::vector<double> tmp;
232 tmp.assign(other.
_vec.begin(), other.
_vec.end());
277 assert(
static_cast<std::size_t
>(i) <
_vec.size());
285 inline void load(std::size_t idx)
const {
286 assert(idx <
_vec.size());
291 std::span<const double>
getRange(std::size_t first, std::size_t last)
const {
292 auto beg = std::min(
_vec.cbegin() + first,
_vec.cend());
293 auto end = std::min(
_vec.cbegin() + last,
_vec.cend());
295 return std::span<const double>(
_vec.data(), std::distance(beg, end));
303 std::vector<double> tmp;
306 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + newSize));
307 if (
Int_t(tmp.size()) != newSize)
311 _vec.resize(newSize);
316 _vec.reserve(newSize);
319 const std::vector<double>&
data()
const {
434 _vec.reserve(initialCapacity);
440 _vec.reserve(initialCapacity);
453 if (&other==
this)
return *
this;
458 std::vector<RooAbsCategory::value_type> tmp;
460 tmp.assign(other.
_vec.begin(), other.
_vec.end());
488 std::vector<RooAbsCategory::value_type> tmp;
492 inline void load(std::size_t idx)
const {
497 std::span<const RooAbsCategory::value_type>
getRange(std::size_t first, std::size_t last)
const {
498 auto beg = std::min(
_vec.cbegin() + first,
_vec.cend());
499 auto end = std::min(
_vec.cbegin() + last,
_vec.cend());
501 return std::span<const RooAbsCategory::value_type>(
_vec.data(), std::distance(beg, end));
510 std::vector<RooAbsCategory::value_type> tmp;
513 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + newSize));
514 if (
Int_t(tmp.size()) != newSize)
518 _vec.resize(newSize);
523 _vec.reserve(newSize);
529 std::vector<RooAbsCategory::value_type>&
data() {
return _vec; }
536 std::vector<RooAbsCategory::value_type>
_vec;
#define VECTOR_BUFFER_SIZE
unsigned long long ULong64_t
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
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
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
A space to attach TBranches.
Abstract base class for a data collection.
const RooArgSet & cachedVars() const
bool _doDirtyProp
Switch do (de)activate dirty state propagation when loading a data point.
virtual double weight() const =0
virtual const RooArgSet * get() const
std::map< RooFit::Detail::DataKey, std::span< const double > > RealSpans
std::map< RooFit::Detail::DataKey, std::span< const RooAbsCategory::value_type > > CategorySpans
Abstract base class for objects that represent a real value and implements functionality common to al...
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.
Meta object that tracks value changes in a given set of RooAbsArgs by registering itself as value cli...
bool hasChanged(bool clearState)
Returns true if state has changed since last call with clearState=true.
RooArgSet parameters() const
Variable that can be changed from the outside.
The RooStringView is a wrapper around a C-style string that can also be constructed from a std::strin...
TTree-backed data storage.
void setBufArg(RooAbsCategory *arg)
void setBuffer(RooAbsCategory::value_type *newBuf)
void write(std::size_t i)
CatVector(UInt_t initialCapacity=1024)
RooAbsCategory::value_type * _buf
!
std::span< const RooAbsCategory::value_type > getRange(std::size_t first, std::size_t last) const
RooAbsCategory::value_type * _nativeBuf
!
CatVector & operator=(const CatVector &other)
void load(std::size_t idx) const
std::vector< RooAbsCategory::value_type > _vec
void setNativeBuffer(RooAbsCategory::value_type *newBuf=nullptr)
void reserve(Int_t newSize)
CatVector(RooAbsCategory *cat, UInt_t initialCapacity=1024)
const RooAbsCategory * bufArg() const
std::vector< RooAbsCategory::value_type > & data()
void resize(Int_t newSize)
CatVector(const CatVector &other, RooAbsCategory *cat=nullptr)
RealFullVector(RooAbsReal *arg, UInt_t initialCapacity=(1024/sizeof(double)))
void setErrorBuffer(double *newBuf)
RealFullVector(const RealFullVector &other, RooAbsReal *real=nullptr)
std::vector< double > const & dataE() const
void reserve(Int_t newSize)
RealFullVector & operator=(RealFullVector const &other)=delete
std::vector< double > _vecE
std::vector< double > _vecEL
std::vector< double > const & dataEL() const
void resize(Int_t newSize)
RealFullVector(UInt_t initialCapacity=(1024/sizeof(double)))
RealFullVector(const RealVector &other, RooAbsReal *real=nullptr)
void load(Int_t idx) const
std::vector< double > const & dataEH() const
void setAsymErrorBuffer(double *newBufL, double *newBufH)
std::vector< double > _vecEH
std::span< const double > getRange(std::size_t first, std::size_t last) const
RealVector & operator=(const RealVector &other)
RealVector(const RealVector &other, RooAbsReal *real=nullptr)
const RooAbsReal * bufArg() const
RooChangeTracker * _tracker
void setBufArg(RooAbsReal *arg)
void setNset(RooArgSet *newNset)
std::vector< double > & data()
void reserve(Int_t newSize)
RooAbsReal * _nativeReal
Instance which our data belongs to. This is the variable in the dataset.
void setDependents(const RooArgSet &deps)
RealVector(UInt_t initialCapacity=(1024/sizeof(double)))
RooAbsReal * _real
Instance where we should write data into when load() is called.
void resize(Int_t newSize)
void setBuffer(RooAbsReal *real, double *newBuf)
RealVector(RooAbsReal *arg, UInt_t initialCapacity=(1024/sizeof(double)))
void load(std::size_t idx) const
std::vector< double > _vec
void setNativeBuffer(double *newBuf=nullptr)
const std::vector< double > & data() const
Uses std::vector to store data columns.
void resetCache() override
void recalculateCache(const RooArgSet *, Int_t firstEvent, Int_t lastEvent, Int_t stepSize, bool skipZeroWeights) override
RooAbsDataStore * clone(const RooArgSet &vars, const char *newname=nullptr) const override
std::vector< CatVector * > & catStoreList()
void attachCache(const RooAbsArg *newOwner, const RooArgSet &cachedVars) override
Initialize cache of dataset: attach variables of cache ArgSet to the corresponding TTree branches.
std::vector< RealFullVector * > _realfStoreList
void setExternalWeightArray(const double *arrayWgt, const double *arrayWgtErrLo, const double *arrayWgtErrHi, const double *arraySumW2) override
Int_t numEntries() const override
RooAbsDataStore * clone(const char *newname=nullptr) const override
RooAbsArg * addColumn(RooAbsArg &var, bool adjustRange=true) override
Add a new column to the data set which holds the pre-calculated values of 'newVar'.
const RooVectorDataStore * cache() const
RooVectorDataStore * _cache
! Optimization cache
const double * _extWgtErrHiArray
! External weight array - high error
std::span< const double > getWeightBatch(std::size_t first, std::size_t len) const override
Return the weights of all events in the range [first, first+len).
~RooVectorDataStore() override
Destructor.
void resetBuffers() override
RooRealVar * weightVar(const RooArgSet &allVars, const char *wgtName)
Utility function for constructors Return pointer to weight variable if it is defined.
void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=nullptr, bool skipZeroWeights=true) override
Cache given RooAbsArgs: The tree is given direct write access of the args internal cache the args val...
RooRealVar * _wgtVar
Pointer to weight variable (if set)
std::vector< RealVector * > _realStoreList
CatVector * addCategory(RooAbsCategory *cat)
void loadValues(const RooAbsDataStore *tds, const RooFormulaVar *select=nullptr, const char *rangeName=nullptr, std::size_t nStart=0, std::size_t nStop=std::numeric_limits< std::size_t >::max()) override
RealFullVector * addRealFull(RooAbsReal *real)
double weight() const override
Return the weight of the last-retrieved data point.
RooAbsData::RealSpans getBatches(std::size_t first, std::size_t len) const override
Return batches of the data columns for the requested events.
ULong64_t _currentWeightIndex
bool isFullReal(RooAbsReal *real)
bool isWeighted() const override
double sumEntries() const override
Int_t fill() override
Interface function to TTree::Fill.
std::vector< RealFullVector * > & realfStoreList()
const double * _extWgtErrLoArray
! External weight array - low error
bool _forcedUpdate
! Request for forced cache update
void append(RooAbsDataStore &other) override
bool hasError(RooAbsReal *real)
std::vector< CatVector * > _catStoreList
void setArgStatus(const RooArgSet &set, bool active) override
Disabling of branches is (intentionally) not implemented in vector data stores (as the doesn't result...
void setAllBuffersNative()
double weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const override
Return the error of the current weight.
void attachBuffers(const RooArgSet &extObs) override
ArraysStruct getArrays() const
Exports all arrays in this RooVectorDataStore into a simple datastructure to be used by RooFit intern...
RooAbsData::CategorySpans getCategoryBatches(std::size_t, std::size_t len) const override
RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore * > dstoreList) override
Merge columns of supplied data set(s) with this data set.
void setDirtyProp(bool flag) override
RealVector * addReal(RooAbsReal *real)
bool hasAsymError(RooAbsReal *real)
bool changeObservableName(const char *from, const char *to) override
void forceCacheUpdate() override
const RooAbsArg * cacheOwner() override
const double * _extSumW2Array
! External sum of weights array
void recomputeSumWeight()
Trigger a recomputation of the cached weight sums.
std::vector< RealVector * > & realStoreList()
std::size_t size() const
Get size of stored dataset.
std::unique_ptr< RooAbsDataStore > reduce(RooStringView name, RooStringView title, const RooArgSet &vars, const RooFormulaVar *cutVar, const char *cutRange, std::size_t nStart, std::size_t nStop) override
virtual const RooArgSet * get() const
const double * _extWgtArray
! External weight array
RooArgSet varsNoWeight(const RooArgSet &allVars, const char *wgtName)
Utility function for constructors Return RooArgSet that is copy of allVars minus variable matching wg...
RooAbsArg * _cacheOwner
! Cache owner
bool hasFilledCache() const override
const char * GetName() const override
Returns name of object.
A TTree represents a columnar dataset.
ArrayInfo(RooStringView n, T const *d)
Output struct for the RooVectorDataStore::getArrays() helper function.
std::vector< ArrayInfo< double > > reals
std::vector< ArrayInfo< RooAbsCategory::value_type > > cats