16#ifndef ROO_VECTOR_DATA_STORE
17#define ROO_VECTOR_DATA_STORE
29#define VECTOR_BUFFER_SIZE 1024
54 std::size_t nStart, std::size_t nStop,
Bool_t ,
const char* wgtVarName=0) ;
81 virtual std::vector<RooSpan<const double>>
getBatch(std::size_t
first, std::size_t last)
const override;
113 virtual void reset()
override;
131 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;
133 void dump()
override;
157 _vec.reserve(initialCapacity);
162 _vec.reserve(initialCapacity);
183 if (&other==
this)
return *
this;
189 std::vector<Double_t> tmp;
191 tmp.assign(other.
_vec.begin(), other.
_vec.end());
236 assert(
static_cast<std::size_t
>(i) <
_vec.size());
244 inline void load(std::size_t idx)
const {
245 assert(idx <
_vec.size());
251 auto end = std::min(
_vec.cbegin() + last,
_vec.cend());
265 std::vector<Double_t> tmp;
268 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + siz));
269 if (
Int_t(tmp.size()) != siz)
281 const std::vector<double>&
data()
const {
338 if (&other==
this)
return *
this;
348 for (
unsigned i = 0; i < 3; ++i) {
351 if (dst[i]->
size() <= src[i]->capacity() / 2 &&
353 std::vector<Double_t> tmp;
355 tmp.assign(src[i]->begin(), src[i]->end());
361 dst[i] =
new std::vector<Double_t>(*src[i]);
374 if (!
_vecE)
_vecE =
new std::vector<Double_t> ;
381 _vecEL =
new std::vector<Double_t> ;
382 _vecEH =
new std::vector<Double_t> ;
420 std::vector<Double_t> tmp;
424 std::vector<Double_t> tmp;
428 std::vector<Double_t> tmp;
443 for (
unsigned i = 0; i < 3; ++i) {
444 if (!vlist[i])
continue;
448 std::vector<Double_t> tmp;
450 if (!vlist[i]->empty())
451 tmp.assign(vlist[i]->begin(),
452 std::min(
_vec.end(),
_vec.begin() + siz));
453 if (
Int_t(tmp.size()) != siz)
457 vlist[i]->resize(siz);
488 _vec.reserve(initialCapacity);
494 _vec.reserve(initialCapacity);
507 if (&other==
this)
return *
this;
512 std::vector<RooAbsCategory::value_type> tmp;
514 tmp.assign(other.
_vec.begin(), other.
_vec.end());
542 std::vector<RooAbsCategory::value_type> tmp;
546 inline void load(std::size_t idx)
const {
559 std::vector<RooAbsCategory::value_type> tmp;
562 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + siz));
563 if (
Int_t(tmp.size()) != siz)
583 std::vector<RooAbsCategory::value_type>
_vec;
#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...
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
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.
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 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 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
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[.
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 ...
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
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()
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
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
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.