16#ifndef ROO_VECTOR_DATA_STORE
17#define ROO_VECTOR_DATA_STORE
30#define VECTOR_BUFFER_SIZE 1024
82 virtual std::vector<RooSpan<const double>>
getBatch(std::size_t
first, std::size_t last)
const override;
102 virtual void reset()
override;
122 void dump()
override;
146 _vec.reserve(initialCapacity);
151 _vec.reserve(initialCapacity);
172 if (&other==
this)
return *
this;
178 std::vector<Double_t> tmp;
180 tmp.assign(other.
_vec.begin(), other.
_vec.end());
230 std::vector<Double_t> tmp;
240 auto end = std::min(
_vec.cbegin() + last,
_vec.cend());
254 std::vector<Double_t> tmp;
257 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + siz));
258 if (
Int_t(tmp.size()) != siz)
270 const std::vector<double>&
data()
const {
327 if (&other==
this)
return *
this;
337 for (
unsigned i = 0; i < 3; ++i) {
340 if (dst[i]->
size() <= src[i]->capacity() / 2 &&
342 std::vector<Double_t> tmp;
344 tmp.assign(src[i]->begin(), src[i]->end());
350 dst[i] =
new std::vector<Double_t>(*src[i]);
363 if (!
_vecE)
_vecE =
new std::vector<Double_t> ;
370 _vecEL =
new std::vector<Double_t> ;
371 _vecEH =
new std::vector<Double_t> ;
409 std::vector<Double_t> tmp;
413 std::vector<Double_t> tmp;
417 std::vector<Double_t> tmp;
432 for (
unsigned i = 0; i < 3; ++i) {
433 if (!vlist[i])
continue;
437 std::vector<Double_t> tmp;
439 if (!vlist[i]->empty())
440 tmp.assign(vlist[i]->begin(),
441 std::min(
_vec.end(),
_vec.begin() + siz));
442 if (
Int_t(tmp.size()) != siz)
446 vlist[i]->resize(siz);
477 _vec.reserve(initialCapacity);
483 _vec.reserve(initialCapacity);
496 if (&other==
this)
return *
this;
501 std::vector<RooCatType> tmp;
503 tmp.assign(other.
_vec.begin(), other.
_vec.end());
530 std::vector<RooCatType> tmp;
545 std::vector<RooCatType> tmp;
548 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + siz));
549 if (
Int_t(tmp.size()) != siz)
590 if (std::string(catVec->bufArg()->GetName())==cat->
GetName()) {
609 if (realVec->bufArg()->namePtr()==real->
namePtr()) {
616 if (fullVec->bufArg()->namePtr()==real->
namePtr()) {
632 if (std::string(fullVec->bufArg()->GetName())==real->
GetName()) {
643 if (std::string(fullVec->bufArg()->GetName())==real->
GetName()) {
654 if (std::string(fullVec->bufArg()->GetName())==real->
GetName()) {
665 if (std::string(fullVec->bufArg()->GetName())==real->
GetName()) {
672 if (std::string(realVec->bufArg()->GetName())==real->
GetName()) {
#define VECTOR_BUFFER_SIZE
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
float type_of_call hi(const int &, const int &)
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
const TNamed * namePtr() const
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
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...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
void assignFast(const RooCatType &other)
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 getNative(Int_t idx) const
CatVector(const CatVector &other, RooAbsCategory *cat=0)
void setBuffer(RooCatType *newBuf)
CatVector & operator=(const CatVector &other)
void setNativeBuffer(RooCatType *newBuf=0)
CatVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(RooCatType)))
std::vector< RooCatType > _vec
CatVector(RooAbsCategory *cat, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(RooCatType)))
const RooAbsCategory * bufArg() const
void get(Int_t idx) const
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
void getNative(Int_t idx) const
RealFullVector(RooAbsReal *arg, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
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 getNative(Int_t idx) const
RooSpan< const double > getRange(std::size_t first, std::size_t last) const
void setDependents(const RooArgSet &deps)
void get(Int_t idx) const
RealVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
std::vector< double > _vec
RealVector(const RealVector &other, RooAbsReal *real=0)
const std::vector< double > & data() const
RooVectorDataStore is the abstract base class for data collection that use a TTree as internal storag...
const Double_t * _extWgtErrHiArray
External weight array - low error.
Bool_t hasAsymError(RooAbsReal *real)
virtual void resetCache() override
std::vector< CatVector * > & catStoreList()
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
virtual std::vector< RooSpan< const double > > getBatch(std::size_t first, std::size_t last) const override
Return a batch of the data columns for all events in [firstEvent, lastEvent[.
virtual Int_t numEntries() const override
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
RealVector * addReal(RooAbsReal *real)
virtual RooArgSet * addColumns(const RooArgList &varList) override
Utility function to add multiple columns in one call See addColumn() for details.
Double_t _sumWeight
do not persist
RealFullVector * addRealFull(RooAbsReal *real)
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
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') in memory and return a pointer to the internal RooArgSet holding...
virtual Double_t weight() const override
Return the weight of the n-th data point (n='index') in memory.
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
virtual Bool_t isWeighted() const override
virtual void attachBuffers(const RooArgSet &extObs) override
CatVector ** _firstCat
do not persist
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
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()
Double_t _curWgt
External sum of weights array.
virtual void recalculateCache(const RooArgSet *, Int_t firstEvent, Int_t lastEvent, Int_t stepSize, Bool_t skipZeroWeights) override
Bool_t hasError(RooAbsReal *real)
void loadValues(const RooAbsDataStore *tds, const RooFormulaVar *select=0, const char *rangeName=0, Int_t nStart=0, Int_t nStop=2000000000) override
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
CatVector * addCategory(RooAbsCategory *cat)
virtual RooSpan< const double > getWeightBatch(std::size_t first, std::size_t last) const override
Return the weights of all events in [first, last[.
RealFullVector ** _firstRealF
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.