16#ifndef ROO_VECTOR_DATA_STORE
17#define ROO_VECTOR_DATA_STORE
35#define VECTOR_BUFFER_SIZE 1024
54 std::size_t nStart, std::size_t nStop,
Bool_t ,
const char* wgtVarName=0) ;
122 virtual void reset()
override;
140 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())
override;
142 void dump()
override;
192 if (&other==
this)
return *
this;
198 std::vector<Double_t> tmp;
200 tmp.assign(other.
_vec.begin(), other.
_vec.end());
245 assert(
static_cast<std::size_t
>(i) <
_vec.size());
253 inline void load(std::size_t idx)
const {
254 assert(idx <
_vec.size());
260 auto end = std::min(
_vec.cbegin() + last,
_vec.cend());
274 std::vector<Double_t> tmp;
277 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + siz));
278 if (
Int_t(tmp.size()) != siz)
290 const std::vector<double>&
data()
const {
347 if (&other==
this)
return *
this;
357 for (
unsigned i = 0; i < 3; ++i) {
360 if (dst[i]->
size() <= src[i]->capacity() / 2 &&
362 std::vector<Double_t> tmp;
364 tmp.assign(src[i]->begin(), src[i]->end());
370 dst[i] =
new std::vector<Double_t>(*src[i]);
383 if (!
_vecE)
_vecE =
new std::vector<Double_t> ;
390 _vecEL =
new std::vector<Double_t> ;
391 _vecEH =
new std::vector<Double_t> ;
429 std::vector<Double_t> tmp;
433 std::vector<Double_t> tmp;
437 std::vector<Double_t> tmp;
452 for (
unsigned i = 0; i < 3; ++i) {
453 if (!vlist[i])
continue;
457 std::vector<Double_t> tmp;
459 if (!vlist[i]->empty())
460 tmp.assign(vlist[i]->begin(),
461 std::min(
_vec.end(),
_vec.begin() + siz));
462 if (
Int_t(tmp.size()) != siz)
466 vlist[i]->resize(siz);
497 _vec.reserve(initialCapacity);
503 _vec.reserve(initialCapacity);
516 if (&other==
this)
return *
this;
521 std::vector<RooAbsCategory::value_type> tmp;
523 tmp.assign(other.
_vec.begin(), other.
_vec.end());
551 std::vector<RooAbsCategory::value_type> tmp;
555 inline void load(std::size_t idx)
const {
568 std::vector<RooAbsCategory::value_type> tmp;
571 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + siz));
572 if (
Int_t(tmp.size()) != siz)
592 std::vector<RooAbsCategory::value_type>
_vec;
#define VECTOR_BUFFER_SIZE
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
void reserve(Storage_t::size_type count)
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
const RooArgSet & cachedVars() const
virtual const RooArgSet * get() const
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.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooChangeTracker is a meta object that tracks value changes in a given set of RooAbsArgs by registeri...
Bool_t hasChanged(Bool_t clearState)
Returns true if state has changed since last call with clearState=kTRUE.
RooArgSet parameters() const
RooRealVar represents a variable that can be changed from the outside.
A simple container to hold a batch of data values.
RooTreeDataStore is a TTree-backed data storage.
void setBufArg(RooAbsCategory *arg)
void setBuffer(RooAbsCategory::value_type *newBuf)
void write(std::size_t i)
CatVector(UInt_t initialCapacity=VECTOR_BUFFER_SIZE)
RooAbsCategory::value_type * _buf
CatVector(RooAbsCategory *cat, UInt_t initialCapacity=VECTOR_BUFFER_SIZE)
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 loadToNative(std::size_t idx) const
const RooAbsCategory * bufArg() const
CatVector(const CatVector &other, RooAbsCategory *cat=nullptr)
void setAsymErrorBuffer(Double_t *newBufL, Double_t *newBufH)
RealFullVector(const RealFullVector &other, RooAbsReal *real=0)
std::vector< double > * _vecE
void get(Int_t idx) const
RealFullVector(RooAbsReal *arg, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
void loadToNative(Int_t idx) const
RealFullVector(const RealVector &other, RooAbsReal *real=0)
void setErrorBuffer(Double_t *newBuf)
RealFullVector & operator=(const RealFullVector &other)
RealFullVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
std::vector< double > * _vecEL
virtual ~RealFullVector()
std::vector< double > * _vecEH
RealVector(RooAbsReal *arg, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
RealVector & operator=(const RealVector &other)
void setBuffer(RooAbsReal *real, Double_t *newBuf)
const RooAbsReal * bufArg() const
RooChangeTracker * _tracker
void setBufArg(RooAbsReal *arg)
void setNset(RooArgSet *newNset)
void setNativeBuffer(Double_t *newBuf=0)
void loadToNative(std::size_t idx) const
RooSpan< const double > getRange(std::size_t first, std::size_t last) const
void setDependents(const RooArgSet &deps)
RealVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
void load(std::size_t idx) const
std::vector< double > _vec
RealVector(const RealVector &other, RooAbsReal *real=0)
const std::vector< double > & data() const
RooVectorDataStore uses std::vectors to store data columns.
const Double_t * _extWgtErrHiArray
External weight array - low error.
Bool_t hasAsymError(RooAbsReal *real)
virtual void resetCache() override
std::vector< CatVector * > & catStoreList()
virtual Int_t numEntries() const override
virtual 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
const RooVectorDataStore * cache() const
Bool_t isFullReal(RooAbsReal *real)
RooVectorDataStore * _cache
virtual void resetBuffers() override
RooRealVar * weightVar(const RooArgSet &allVars, const char *wgtName)
Utility function for constructors Return pointer to weight variable if it is defined.
std::vector< RealVector * > _realStoreList
std::vector< double > _weights
CatVector * addCategory(RooAbsCategory *cat)
virtual RooArgSet * addColumns(const RooArgList &varList) override
Utility function to add multiple columns in one call See addColumn() for details.
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()) override
virtual Bool_t hasFilledCache() const override
virtual RooAbsDataStore * clone(const RooArgSet &vars, const char *newname=0) const override
virtual Bool_t changeObservableName(const char *from, const char *to) override
RealFullVector * addRealFull(RooAbsReal *real)
const Double_t * _extWgtErrLoArray
External weight array.
virtual Bool_t valid() const override
Return true if currently loaded coordinate is considered valid within the current range definitions o...
virtual const RooArgSet * getNative(Int_t index) const
Load the n-th data point (n='index') into the variables of this dataset, and return a pointer to the ...
Double_t weight() const override
Return the weight of the last-retrieved data point.
virtual Int_t fill() override
Interface function to TTree::Fill.
std::vector< RealFullVector * > & realfStoreList()
virtual void append(RooAbsDataStore &other) override
void setExternalWeightArray(const Double_t *arrayWgt, const Double_t *arrayWgtErrLo, const Double_t *arrayWgtErrHi, const Double_t *arraySumW2) override
std::vector< CatVector * > _catStoreList
Bool_t _forcedUpdate
Cache owner.
void setAllBuffersNative()
const Double_t * _extSumW2Array
External weight array - high error.
virtual void reset() override
RooBatchCompute::RunContext getBatches(std::size_t first, std::size_t len) const override
Return batches of the data columns for the requested events.
virtual Bool_t isWeighted() const override
virtual void attachBuffers(const RooArgSet &extObs) override
virtual void setDirtyProp(Bool_t flag) override
RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore * > dstoreList) override
Merge columns of supplied data set(s) with this data set.
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=0, Bool_t skipZeroWeights=kTRUE) override
Cache given RooAbsArgs: The tree is given direct write access of the args internal cache the args val...
virtual RooAbsDataStore * clone(const char *newname=0) const override
RealVector * addReal(RooAbsReal *real)
virtual Double_t weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const override
Return the error of the current weight.
void forceCacheUpdate() override
std::vector< RealVector * > & realStoreList()
virtual void recalculateCache(const RooArgSet *, Int_t firstEvent, Int_t lastEvent, Int_t stepSize, Bool_t skipZeroWeights) override
std::size_t size() const
Get size of stored dataset.
Bool_t hasError(RooAbsReal *real)
virtual RooSpan< 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).
virtual const RooArgSet * get() const
virtual ~RooVectorDataStore()
Destructor.
virtual Double_t sumEntries() const override
RooArgSet varsNoWeight(const RooArgSet &allVars, const char *wgtName)
Utility function for constructors Return RooArgSet that is copy of allVars minus variable matching wg...
const Double_t * _extWgtArray
std::size_t _currentWeightIndex
External sum of weights array.
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE) override
Add a new column to the data set which holds the pre-calculated values of 'newVar'.
virtual const RooAbsArg * cacheOwner() override
virtual void setArgStatus(const RooArgSet &set, Bool_t active) override
Disabling of branches is (intentionally) not implemented in vector data stores (as the doesn't result...
RooAbsArg * _cacheOwner
Optimization cache.
virtual const char * GetName() const
Returns name of object.
A TTree represents a columnar dataset.
This struct enables passing computation data around between elements of a computation graph.