16 #ifndef ROO_VECTOR_DATA_STORE 17 #define ROO_VECTOR_DATA_STORE 30 #define VECTOR_BUFFER_SIZE 1024 95 virtual void reset() ;
139 _vec.reserve(initialCapacity);
144 _vec.reserve(initialCapacity);
166 if (&other==
this)
return *
this;
172 std::vector<Double_t> tmp;
174 tmp.assign(other.
_vec.begin(), other.
_vec.end());
226 std::vector<Double_t> tmp;
244 std::vector<Double_t> tmp;
247 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + siz));
248 if (
Int_t(tmp.size()) != siz)
281 _bufE(0), _bufEL(0), _bufEH(0),
282 _nativeBufE(0), _nativeBufEL(0), _nativeBufEH(0),
283 _vecE(0), _vecEL(0), _vecEH(0) {
288 _bufE(0), _bufEL(0), _bufEH(0),
289 _nativeBufE(0), _nativeBufEL(0), _nativeBufEH(0),
290 _vecE(0), _vecEL(0), _vecEH(0) {
294 if (_vecE)
delete _vecE ;
295 if (_vecEL)
delete _vecEL ;
296 if (_vecEH)
delete _vecEH ;
300 _bufE(other._bufE), _bufEL(other._bufEL), _bufEH(other._bufEH),
301 _nativeBufE(other._nativeBufE), _nativeBufEL(other._nativeBufEL), _nativeBufEH(other._nativeBufEH) {
302 _vecE = (other.
_vecE) ?
new std::vector<Double_t>(*other.
_vecE) : 0 ;
303 _vecEL = (other.
_vecEL) ?
new std::vector<Double_t>(*other.
_vecEL) : 0 ;
304 _vecEH = (other.
_vecEH) ?
new std::vector<Double_t>(*other.
_vecEH) : 0 ;
308 _bufE(0), _bufEL(0), _bufEH(0),
309 _nativeBufE(0), _nativeBufEL(0), _nativeBufEH(0) {
316 if (&other==
this)
return *
this;
325 std::vector<Double_t>* dst[3] = { _vecE, _vecEL, _vecEH };
326 for (
unsigned i = 0; i < 3; ++i) {
329 if (dst[i]->
size() <= src[i]->capacity() / 2 &&
331 std::vector<Double_t> tmp;
333 tmp.assign(src[i]->begin(), src[i]->end());
339 dst[i] =
new std::vector<Double_t>(*src[i]);
352 if (!_vecE) _vecE =
new std::vector<Double_t> ;
353 _vecE->reserve(
_vec.capacity()) ;
354 if (!_nativeBufE) _nativeBufE = _bufE ;
357 _bufEL = newBufL ; _bufEH = newBufH ;
359 _vecEL =
new std::vector<Double_t> ;
360 _vecEH =
new std::vector<Double_t> ;
361 _vecEL->reserve(
_vec.capacity()) ;
362 _vecEH->reserve(
_vec.capacity()) ;
365 _nativeBufEL = _bufEL ;
366 _nativeBufEH = _bufEH ;
373 *_nativeBufE = (*_vecE)[idx] ;
376 *_nativeBufEL = (*_vecEL)[idx] ;
377 *_nativeBufEH = (*_vecEH)[idx] ;
383 if (_vecE) _vecE->push_back(*_bufE) ;
384 if (_vecEL) _vecEL->push_back(*_bufEL) ;
385 if (_vecEH) _vecEH->push_back(*_bufEH) ;
390 if (_vecE) (*_vecE)[i] = *_bufE ;
391 if (_vecEL) (*_vecEL)[i] = *_bufEL ;
392 if (_vecEH) (*_vecEH)[i] = *_bufEH ;
398 std::vector<Double_t> tmp;
402 std::vector<Double_t> tmp;
406 std::vector<Double_t> tmp;
413 if (_vecE) *_bufE = (*_vecE)[idx];
414 if (_vecEL) *_bufEL = (*_vecEL)[idx] ;
415 if (_vecEH) *_bufEH = (*_vecEH)[idx] ;
420 std::vector<Double_t>* vlist[3] = { _vecE, _vecEL, _vecEH };
421 for (
unsigned i = 0; i < 3; ++i) {
422 if (!vlist[i])
continue;
426 std::vector<Double_t> tmp;
428 if (!vlist[i]->empty())
429 tmp.assign(vlist[i]->begin(),
430 std::min(
_vec.end(),
_vec.begin() + siz));
431 if (
Int_t(tmp.size()) != siz)
435 vlist[i]->resize(siz);
443 if (_vecE) _vecE->reserve(siz);
444 if (_vecEL) _vecEL->reserve(siz);
445 if (_vecEH) _vecEH->reserve(siz);
456 std::vector<Double_t> *_vecE, *
_vecEL, *_vecEH ;
466 _vec.reserve(initialCapacity);
472 _vec.reserve(initialCapacity);
485 if (&other==
this)
return *
this;
490 std::vector<RooCatType> tmp;
492 tmp.assign(other.
_vec.begin(), other.
_vec.end());
519 std::vector<RooCatType> tmp;
534 std::vector<RooCatType> tmp;
537 tmp.assign(
_vec.begin(), std::min(
_vec.end(),
_vec.begin() + siz));
538 if (
Int_t(tmp.size()) != siz)
580 std::vector<CatVector*>::iterator iter =
_catStoreList.begin() ;
582 if (std::string((*iter)->bufArg()->GetName())==cat->
GetName()) {
603 std::vector<RealVector*>::iterator iter =
_realStoreList.begin() ;
606 if ((*iter)->bufArg()->namePtr()==real->
namePtr()) {
613 std::vector<RealFullVector*>::iterator iter2 =
_realfStoreList.begin() ;
616 if ((*iter2)->bufArg()->namePtr()==real->
namePtr()) {
637 std::vector<RealFullVector*>::iterator iter =
_realfStoreList.begin() ;
639 if (std::string((*iter)->bufArg()->GetName())==real->
GetName()) {
649 std::vector<RealFullVector*>::iterator iter =
_realfStoreList.begin() ;
651 if (std::string((*iter)->bufArg()->GetName())==real->
GetName()) {
661 std::vector<RealFullVector*>::iterator iter =
_realfStoreList.begin() ;
663 if (std::string((*iter)->bufArg()->GetName())==real->
GetName()) {
675 std::vector<RealFullVector*>::iterator iter =
_realfStoreList.begin() ;
677 if (std::string((*iter)->bufArg()->GetName())==real->
GetName()) {
684 std::vector<RealVector*>::iterator iter2 =
_realStoreList.begin() ;
686 if (std::string((*iter2)->bufArg()->GetName())==real->
GetName()) {
CatVector * addCategory(RooAbsCategory *cat)
virtual const char * GetName() const
Returns name of object.
virtual const RooArgSet * get() const
virtual Bool_t valid() const
Return true if currently loaded coordinate is considered valid within the current range definitions o...
RealFullVector & operator=(const RealFullVector &other)
void setAllBuffersNative()
std::vector< Double_t > * _vecE
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
CatVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(RooCatType)))
RealFullVector(RooAbsReal *arg, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
Double_t * _extSumW2Array
External weight array - high error.
RooRealVar * weightVar(const RooArgSet &allVars, const char *wgtName)
Utility function for constructors Return pointer to weight variable if it is defined.
const RooAbsCategory * bufArg() const
void setBufArg(RooAbsReal *arg)
virtual Int_t fill()
Interface function to TTree::Fill.
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=0, Bool_t skipZeroWeights=kTRUE)
Cache given RooAbsArgs with this tree: The tree is given direct write access of the args internal cac...
void getNative(Int_t idx) const
void setBuffer(RooCatType *newBuf)
void setNativeBuffer(Double_t *newBuf=0)
virtual RooAbsDataStore * clone(const char *newname=0) const
virtual void reserve(Int_t nEvt)
RealVector & operator=(const RealVector &other)
virtual void setDirtyProp(Bool_t flag)
void setDependents(const RooArgSet &deps)
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE)
Add a new column to the data set which holds the pre-calculated values of 'newVar'.
void setBuffer(RooAbsReal *real, Double_t *newBuf)
virtual void recalculateCache(const RooArgSet *, Int_t firstEvent, Int_t lastEvent, Int_t stepSize, Bool_t skipZeroWeights)
virtual void attachCache(const RooAbsArg *newOwner, const RooArgSet &cachedVars)
Initialize cache of dataset: attach variables of cache ArgSet to the corresponding TTree branches...
Bool_t hasChanged(Bool_t clearState)
Returns true if state has changes since last call with clearState=kTRUE If clearState is true...
virtual void append(RooAbsDataStore &other)
std::vector< RealVector * > & realStoreList()
Double_t _sumWeight
do not persist
Double_t * _extWgtErrLoArray
External weight array.
const RooVectorDataStore * cache() const
std::vector< RealFullVector * > & realfStoreList()
void get(Int_t idx) const
void setAsymErrorBuffer(Double_t *newBufL, Double_t *newBufH)
RooAbsArg * _cacheOwner
Optimization cache.
RooTreeDataStore is the abstract base class for data collection that use a TTree as internal storage ...
RealVector(const RealVector &other, RooAbsReal *real=0)
Double_t _curWgt
External sum of weights array.
std::vector< Double_t > _vec
Bool_t _doDirtyProp
Iterator over cached variables.
std::vector< RooCatType > _vec
virtual RooAbsDataStore * clone(const RooArgSet &vars, const char *newname=0) const
virtual RooArgSet * addColumns(const RooArgList &varList)
Utility function to add multiple columns in one call See addColumn() for details. ...
std::vector< RealFullVector * > _realfStoreList
RooArgSet varsNoWeight(const RooArgSet &allVars, const char *wgtName)
Utility function for constructors Return RooArgSet that is copy of allVars minus variable matching wg...
const RooArgSet & cachedVars() const
Bool_t _forcedUpdate
Cache owner.
#define ClassDef(name, id)
void loadValues(const RooAbsDataStore *tds, const RooFormulaVar *select=0, const char *rangeName=0, Int_t nStart=0, Int_t nStop=2000000000)
throw(std::string("RooVectorDataSore::loadValues() NOT IMPLEMENTED")) ;
std::vector< CatVector * > & catStoreList()
virtual Double_t sumEntries() const
void setNset(RooArgSet *newNset)
std::vector< RealVector * > _realStoreList
virtual Bool_t hasFilledCache() const
virtual void resetBuffers()
RooVectorDataStore is the abstract base class for data collection that use a TTree as internal storag...
void setNativeBuffer(RooCatType *newBuf=0)
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state...
virtual void setArgStatus(const RooArgSet &set, Bool_t active)
Disabling of branches is (intentionally) not implemented in vector data stores (as the doesn't result...
std::vector< Double_t > * _vecEH
virtual Int_t numEntries() const
Bool_t hasError(RooAbsReal *real)
RooRealVar represents a fundamental (non-derived) real valued object.
CatVector ** _firstCat
do not persist
RealFullVector(const RealFullVector &other, RooAbsReal *real=0)
Bool_t hasAsymError(RooAbsReal *real)
RooArgSet parameters() const
RealFullVector(const RealVector &other, RooAbsReal *real=0)
virtual Bool_t isWeighted() const
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...
char * Form(const char *fmt,...)
virtual Double_t weight() const
Return the weight of the n-th data point (n='index') in memory.
RealVector(RooAbsReal *arg, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
RealFullVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
CatVector & operator=(const CatVector &other)
Double_t * _extWgtErrHiArray
External weight array - low error.
void setErrorBuffer(Double_t *newBuf)
std::vector< CatVector * > _catStoreList
RooVectorDataStore * _cache
virtual const RooAbsArg * cacheOwner()
RooChangeTracker * _tracker
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Bool_t isFullReal(RooAbsReal *real)
RealVector * addReal(RooAbsReal *real)
virtual ~RealFullVector()
CatVector(const CatVector &other, RooAbsCategory *cat=0)
RooChangeTracker is a meta object that tracks value changes in a given set of RooAbsArgs by registeri...
RealVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
virtual ~RooVectorDataStore()
Destructor.
RealFullVector * addRealFull(RooAbsReal *real)
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
const RooAbsReal * bufArg() const
std::vector< Double_t > * _vecEL
CatVector(RooAbsCategory *cat, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(RooCatType)))
virtual Double_t weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const
A TTree object has a header with a name and a title.
float type_of_call hi(const int &, const int &)
RealFullVector ** _firstRealF
do not persist
virtual void attachBuffers(const RooArgSet &extObs)
virtual Bool_t changeObservableName(const char *from, const char *to)
#define VECTOR_BUFFER_SIZE
RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore *> dstoreList)
Merge columns of supplied data set(s) with this data set.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
void setExternalWeightArray(Double_t *arrayWgt, Double_t *arrayWgtErrLo, Double_t *arrayWgtErrHi, Double_t *arraySumW2)
void getNative(Int_t idx) const
void setBufArg(RooAbsCategory *arg)
const TNamed * namePtr() const
virtual void resetCache()
void getNative(Int_t idx) const