16#ifndef ROO_VECTOR_DATA_STORE
17#define ROO_VECTOR_DATA_STORE
39#define VECTOR_BUFFER_SIZE 1024
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;
163 void dump()
override;
194 if (
other._tracker) {
205 if (&
other==
this)
return *
this;
211 std::vector<double>
tmp;
258 assert(
static_cast<std::size_t
>(i) <
_vec.size());
266 inline void load(std::size_t idx)
const {
272 std::span<const double>
getRange(std::size_t first, std::size_t last)
const {
273 auto beg = std::min(
_vec.cbegin() + first,
_vec.cend());
274 auto end = std::min(
_vec.cbegin() + last,
_vec.cend());
276 return std::span<const double>(
_vec.data(), std::distance(
beg, end));
284 std::vector<double>
tmp;
300 const std::vector<double>&
data()
const {
434 if (&
other==
this)
return *
this;
439 std::vector<RooAbsCategory::value_type>
tmp;
469 std::vector<RooAbsCategory::value_type>
tmp;
473 inline void load(std::size_t idx)
const {
478 std::span<const RooAbsCategory::value_type>
getRange(std::size_t first, std::size_t last)
const {
479 auto beg = std::min(
_vec.cbegin() + first,
_vec.cend());
480 auto end = std::min(
_vec.cbegin() + last,
_vec.cend());
482 return std::span<const RooAbsCategory::value_type>(
_vec.data(), std::distance(
beg, end));
491 std::vector<RooAbsCategory::value_type>
tmp;
510 std::vector<RooAbsCategory::value_type>&
data() {
return _vec; }
517 std::vector<RooAbsCategory::value_type>
_vec;
#define VECTOR_BUFFER_SIZE
int Int_t
Signed integer 4 bytes (int)
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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.
const_iterator begin() const
const_iterator end() const
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.
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.
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.
RooAbsDataStore * clone(const RooArgSet &vars, const char *newname=nullptr) const override
std::vector< CatVector * > & catStoreList()
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 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.
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
void append(RooAbsDataStore &other) override
bool hasError(RooAbsReal *real)
std::vector< CatVector * > _catStoreList
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.
RealVector * addReal(RooAbsReal *real)
bool hasAsymError(RooAbsReal *real)
bool changeObservableName(const char *from, const char *to) 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...
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