Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooVectorDataStore.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_VECTOR_DATA_STORE
17#define ROO_VECTOR_DATA_STORE
18
19#include "RooAbsDataStore.h"
20#include "RooAbsCategory.h"
21#include "RooAbsReal.h"
22#include "RooChangeTracker.h"
23#include "RooRealVar.h"
24
25#include <list>
26#include <vector>
27#include <algorithm>
28
29class RooAbsArg ;
30class RooArgList ;
31class TTree ;
32class RooFormulaVar ;
33class RooArgSet ;
34
35#define VECTOR_BUFFER_SIZE 1024
36
38public:
39
41
42 // Empty ctor
43 RooVectorDataStore(const char* name, const char* title, const RooArgSet& vars, const char* wgtVarName=0) ;
44 virtual RooAbsDataStore* clone(const char* newname=0) const override { return new RooVectorDataStore(*this,newname) ; }
45 virtual RooAbsDataStore* clone(const RooArgSet& vars, const char* newname=0) const override { return new RooVectorDataStore(*this,vars,newname) ; }
46
47 RooVectorDataStore(const RooVectorDataStore& other, const char* newname=0) ;
48 RooVectorDataStore(const RooTreeDataStore& other, const RooArgSet& vars, const char* newname=0) ;
49 RooVectorDataStore(const RooVectorDataStore& other, const RooArgSet& vars, const char* newname=0) ;
50
51
52 RooVectorDataStore(const char *name, const char *title, RooAbsDataStore& tds,
53 const RooArgSet& vars, const RooFormulaVar* cutVar, const char* cutRange,
54 std::size_t nStart, std::size_t nStop, Bool_t /*copyCache*/, const char* wgtVarName=0) ;
55
56 virtual ~RooVectorDataStore() ;
57
58private:
59 RooArgSet varsNoWeight(const RooArgSet& allVars, const char* wgtName);
60 RooRealVar* weightVar(const RooArgSet& allVars, const char* wgtName);
61
62 // reserve storage for nEvt entries
63 void reserve(Int_t nEvt);
64
65public:
66 // Write current row
67 virtual Int_t fill() override;
68
69 // Retrieve a row
71 virtual const RooArgSet* get(Int_t index) const override;
72
73 virtual const RooArgSet* getNative(Int_t index) const;
74
75 /// Return the weight of the last-retrieved data point.
76 Double_t weight() const override
77 {
78 if (_extWgtArray)
80 if (_wgtVar)
81 return _wgtVar->getVal();
82
83 return 1.0;
84 }
86 virtual void weightError(Double_t& lo, Double_t& hi, RooAbsData::ErrorType etype=RooAbsData::Poisson) const override;
87 virtual Double_t weight(Int_t index) const override;
88 virtual Bool_t isWeighted() const override { return _wgtVar || _extWgtArray; }
89
90 RooBatchCompute::RunContext getBatches(std::size_t first, std::size_t len) const override;
91 virtual RooSpan<const double> getWeightBatch(std::size_t first, std::size_t len) const override;
92
93 // Change observable name
94 virtual Bool_t changeObservableName(const char* from, const char* to) override;
95
96 // Add one or more columns
97 virtual RooAbsArg* addColumn(RooAbsArg& var, Bool_t adjustRange=kTRUE) override;
98 virtual RooArgSet* addColumns(const RooArgList& varList) override;
99
100 // Merge column-wise
101 RooAbsDataStore* merge(const RooArgSet& allvars, std::list<RooAbsDataStore*> dstoreList) override;
102
103 // Add rows
104 virtual void append(RooAbsDataStore& other) override;
105
106 // General & bookkeeping methods
107 virtual Bool_t valid() const override;
108 virtual Int_t numEntries() const override { return static_cast<int>(size()); }
109 virtual Double_t sumEntries() const override { return _sumWeight ; }
110 /// Get size of stored dataset.
111 std::size_t size() const {
112 if (!_realStoreList.empty()) {
113 return _realStoreList.front()->size();
114 } else if (!_realfStoreList.empty()) {
115 return _realfStoreList.front()->size();
116 } else if (!_catStoreList.empty()) {
117 return _catStoreList.front()->size();
118 }
119
120 return 0;
121 }
122 virtual void reset() override;
123
124 // Buffer redirection routines used in inside RooAbsOptTestStatistics
125 virtual void attachBuffers(const RooArgSet& extObs) override;
126 virtual void resetBuffers() override;
127
128
129 // Constant term optimizer interface
130 virtual const RooAbsArg* cacheOwner() override { return _cacheOwner ; }
131 virtual void cacheArgs(const RooAbsArg* owner, RooArgSet& varSet, const RooArgSet* nset=0, Bool_t skipZeroWeights=kTRUE) override;
132 virtual void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) override;
133 virtual void resetCache() override;
134 virtual void recalculateCache(const RooArgSet* /*proj*/, Int_t firstEvent, Int_t lastEvent, Int_t stepSize, Bool_t skipZeroWeights) override;
135
136 virtual void setArgStatus(const RooArgSet& set, Bool_t active) override;
137
138 const RooVectorDataStore* cache() const { return _cache ; }
139
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;
141
142 void dump() override;
143
144 void setExternalWeightArray(const Double_t* arrayWgt, const Double_t* arrayWgtErrLo,
145 const Double_t* arrayWgtErrHi, const Double_t* arraySumW2) override {
146 _extWgtArray = arrayWgt ;
147 _extWgtErrLoArray = arrayWgtErrLo ;
148 _extWgtErrHiArray = arrayWgtErrHi ;
149 _extSumW2Array = arraySumW2 ;
150 }
151
152 virtual void setDirtyProp(Bool_t flag) override {
153 _doDirtyProp = flag ;
154 if (_cache) {
155 _cache->setDirtyProp(flag) ;
156 }
157 }
158
159 const RooArgSet& row() { return _varsww ; }
160
162 public:
163
164 RealVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE / sizeof(Double_t))) :
165 _nativeReal(0), _real(0), _buf(0), _nativeBuf(0), _tracker(0), _nset(0) {
166 _vec.reserve(initialCapacity);
167 }
168
169 RealVector(RooAbsReal* arg, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE / sizeof(Double_t))) :
170 _nativeReal(arg), _real(0), _buf(0), _nativeBuf(0), _tracker(0), _nset(0) {
171 _vec.reserve(initialCapacity);
172 }
173
174 virtual ~RealVector() {
175 delete _tracker;
176 if (_nset) delete _nset ;
177 }
178
179 RealVector(const RealVector& other, RooAbsReal* real=0) :
180 _vec(other._vec), _nativeReal(real?real:other._nativeReal), _real(real?real:other._real), _buf(other._buf), _nativeBuf(other._nativeBuf), _nset(0) {
181 if (other._tracker) {
182 _tracker = new RooChangeTracker(Form("track_%s",_nativeReal->GetName()),"tracker",other._tracker->parameters()) ;
183 } else {
184 _tracker = 0 ;
185 }
186 if (other._nset) {
187 _nset = new RooArgSet(*other._nset) ;
188 }
189 }
190
192 if (&other==this) return *this;
193 _nativeReal = other._nativeReal;
194 _real = other._real;
195 _buf = other._buf;
196 _nativeBuf = other._nativeBuf;
197 if (other._vec.size() <= _vec.capacity() / 2 && _vec.capacity() > (VECTOR_BUFFER_SIZE / sizeof(Double_t))) {
198 std::vector<Double_t> tmp;
199 tmp.reserve(std::max(other._vec.size(), VECTOR_BUFFER_SIZE / sizeof(Double_t)));
200 tmp.assign(other._vec.begin(), other._vec.end());
201 _vec.swap(tmp);
202 } else {
203 _vec = other._vec;
204 }
205
206 return *this;
207 }
208
209 void setNset(RooArgSet* newNset) { _nset = newNset ? new RooArgSet(*newNset) : 0 ; }
210
211 RooArgSet* nset() const { return _nset ; }
212
213 void setBufArg(RooAbsReal* arg) { _nativeReal = arg ; }
214 const RooAbsReal* bufArg() const { return _nativeReal ; }
215
216 void setBuffer(RooAbsReal* real, Double_t* newBuf) {
217 _real = real ;
218 _buf = newBuf ;
219 if (_nativeBuf==0) {
220 _nativeBuf=newBuf ;
221 }
222 }
223
224 void setNativeBuffer(Double_t* newBuf=0) {
225 _nativeBuf = newBuf ? newBuf : _buf ;
226 }
227
228 void setDependents(const RooArgSet& deps) {
229 if (_tracker) {
230 delete _tracker ;
231 }
232 _tracker = new RooChangeTracker(Form("track_%s",_nativeReal->GetName()),"tracker",deps) ;
233 }
234
236 if (!_tracker) return kFALSE ;
237 return _tracker->hasChanged(kTRUE) ;
238 }
239
240 void fill() {
241 _vec.push_back(*_buf);
242 }
243
244 void write(Int_t i) {
245 assert(static_cast<std::size_t>(i) < _vec.size());
246 _vec[i] = *_buf ;
247 }
248
249 void reset() {
250 _vec.clear();
251 }
252
253 inline void load(std::size_t idx) const {
254 assert(idx < _vec.size());
255 *_buf = *(_vec.begin() + idx) ;
256 }
257
258 RooSpan<const double> getRange(std::size_t first, std::size_t last) const {
259 auto beg = std::min(_vec.cbegin() + first, _vec.cend());
260 auto end = std::min(_vec.cbegin() + last, _vec.cend());
261
262 return RooSpan<const double>(beg, end);
263 }
264
265 inline void loadToNative(std::size_t idx) const {
266 *_nativeBuf = *(_vec.begin() + idx) ;
267 }
268
269 std::size_t size() const { return _vec.size() ; }
270
271 void resize(Int_t siz) {
272 if (siz < Int_t(_vec.capacity()) / 2 && _vec.capacity() > (VECTOR_BUFFER_SIZE / sizeof(Double_t))) {
273 // do an expensive copy, if we save at least a factor 2 in size
274 std::vector<Double_t> tmp;
275 tmp.reserve(std::max(siz, Int_t(VECTOR_BUFFER_SIZE / sizeof(Double_t))));
276 if (!_vec.empty())
277 tmp.assign(_vec.begin(), std::min(_vec.end(), _vec.begin() + siz));
278 if (Int_t(tmp.size()) != siz)
279 tmp.resize(siz);
280 _vec.swap(tmp);
281 } else {
282 _vec.resize(siz);
283 }
284 }
285
286 void reserve(Int_t siz) {
287 _vec.reserve(siz);
288 }
289
290 const std::vector<double>& data() const {
291 return _vec;
292 }
293
294 protected:
295 std::vector<double> _vec;
296
297 private:
298 friend class RooVectorDataStore ;
299 RooAbsReal* _nativeReal ; // Instance which our data belongs to. This is the variable in the dataset.
300 RooAbsReal* _real ; // Instance where we should write data into when load() is called.
305 ClassDef(RealVector,1) // STL-vector-based Data Storage class
306 } ;
307
308
309 class RealFullVector : public RealVector {
310 public:
311 RealFullVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE / sizeof(Double_t))) : RealVector(initialCapacity),
312 _bufE(0), _bufEL(0), _bufEH(0),
314 _vecE(0), _vecEL(0), _vecEH(0) {
315 }
316
317 RealFullVector(RooAbsReal* arg, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE / sizeof(Double_t))) :
318 RealVector(arg,initialCapacity),
319 _bufE(0), _bufEL(0), _bufEH(0),
321 _vecE(0), _vecEL(0), _vecEH(0) {
322 }
323
324 virtual ~RealFullVector() {
325 if (_vecE) delete _vecE ;
326 if (_vecEL) delete _vecEL ;
327 if (_vecEH) delete _vecEH ;
328 }
329
330 RealFullVector(const RealFullVector& other, RooAbsReal* real=0) : RealVector(other,real),
331 _bufE(other._bufE), _bufEL(other._bufEL), _bufEH(other._bufEH),
333 _vecE = (other._vecE) ? new std::vector<Double_t>(*other._vecE) : 0 ;
334 _vecEL = (other._vecEL) ? new std::vector<Double_t>(*other._vecEL) : 0 ;
335 _vecEH = (other._vecEH) ? new std::vector<Double_t>(*other._vecEH) : 0 ;
336 }
337
338 RealFullVector(const RealVector& other, RooAbsReal* real=0) : RealVector(other,real),
339 _bufE(0), _bufEL(0), _bufEH(0),
341 _vecE = 0 ;
342 _vecEL = 0 ;
343 _vecEH = 0 ;
344 }
345
347 if (&other==this) return *this;
349 _bufE = other._bufE;
350 _bufEL = other._bufEL;
351 _bufEH = other._bufEH;
352 _nativeBufE = other._nativeBufE;
355 std::vector<Double_t>* src[3] = { other._vecE, other._vecEL, other._vecEH };
356 std::vector<Double_t>* dst[3] = { _vecE, _vecEL, _vecEH };
357 for (unsigned i = 0; i < 3; ++i) {
358 if (src[i]) {
359 if (dst[i]) {
360 if (dst[i]->size() <= src[i]->capacity() / 2 &&
361 src[i]->capacity() > (VECTOR_BUFFER_SIZE / sizeof(Double_t))) {
362 std::vector<Double_t> tmp;
363 tmp.reserve(std::max(src[i]->size(), VECTOR_BUFFER_SIZE / sizeof(Double_t)));
364 tmp.assign(src[i]->begin(), src[i]->end());
365 dst[i]->swap(tmp);
366 } else {
367 *dst[i] = *src[i];
368 }
369 } else {
370 dst[i] = new std::vector<Double_t>(*src[i]);
371 }
372 } else {
373 delete dst[i];
374 dst[i] = 0;
375 }
376 }
377 return *this;
378 }
379
380 void setErrorBuffer(Double_t* newBuf) {
381 /* std::cout << "setErrorBuffer(" << _nativeReal->GetName() << ") newBuf = " << newBuf << std::endl ; */
382 _bufE = newBuf ;
383 if (!_vecE) _vecE = new std::vector<Double_t> ;
384 _vecE->reserve(_vec.capacity()) ;
386 }
387 void setAsymErrorBuffer(Double_t* newBufL, Double_t* newBufH) {
388 _bufEL = newBufL ; _bufEH = newBufH ;
389 if (!_vecEL) {
390 _vecEL = new std::vector<Double_t> ;
391 _vecEH = new std::vector<Double_t> ;
392 _vecEL->reserve(_vec.capacity()) ;
393 _vecEH->reserve(_vec.capacity()) ;
394 }
395 if (!_nativeBufEL) {
398 }
399 }
400
401 inline void loadToNative(Int_t idx) const {
403 if (_vecE) {
404 *_nativeBufE = (*_vecE)[idx] ;
405 }
406 if (_vecEL) {
407 *_nativeBufEL = (*_vecEL)[idx] ;
408 *_nativeBufEH = (*_vecEH)[idx] ;
409 }
410 }
411
412 void fill() {
414 if (_vecE) _vecE->push_back(*_bufE) ;
415 if (_vecEL) _vecEL->push_back(*_bufEL) ;
416 if (_vecEH) _vecEH->push_back(*_bufEH) ;
417 } ;
418
419 void write(Int_t i) {
421 if (_vecE) (*_vecE)[i] = *_bufE ;
422 if (_vecEL) (*_vecEL)[i] = *_bufEL ;
423 if (_vecEH) (*_vecEH)[i] = *_bufEH ;
424 }
425
426 void reset() {
428 if (_vecE) {
429 std::vector<Double_t> tmp;
430 _vecE->swap(tmp);
431 }
432 if (_vecEL) {
433 std::vector<Double_t> tmp;
434 _vecEL->swap(tmp);
435 }
436 if (_vecEH) {
437 std::vector<Double_t> tmp;
438 _vecEH->swap(tmp);
439 }
440 }
441
442 inline void get(Int_t idx) const {
443 RealVector::load(idx) ;
444 if (_vecE) *_bufE = (*_vecE)[idx];
445 if (_vecEL) *_bufEL = (*_vecEL)[idx] ;
446 if (_vecEH) *_bufEH = (*_vecEH)[idx] ;
447 }
448
449 void resize(Int_t siz) {
451 std::vector<Double_t>* vlist[3] = { _vecE, _vecEL, _vecEH };
452 for (unsigned i = 0; i < 3; ++i) {
453 if (!vlist[i]) continue;
454 if (vlist[i]) {
455 if (siz < Int_t(vlist[i]->capacity()) / 2 && vlist[i]->capacity() > (VECTOR_BUFFER_SIZE / sizeof(Double_t))) {
456 // if we gain a factor of 2 in memory, we copy and swap
457 std::vector<Double_t> tmp;
458 tmp.reserve(std::max(siz, Int_t(VECTOR_BUFFER_SIZE / sizeof(Double_t))));
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)
463 tmp.resize(siz);
464 vlist[i]->swap(tmp);
465 } else {
466 vlist[i]->resize(siz);
467 }
468 }
469 }
470 }
471
472 void reserve(Int_t siz) {
474 if (_vecE) _vecE->reserve(siz);
475 if (_vecEL) _vecEL->reserve(siz);
476 if (_vecEH) _vecEH->reserve(siz);
477 }
478
479 private:
480 friend class RooVectorDataStore ;
487 std::vector<double> *_vecE, *_vecEL, *_vecEH ;
488 ClassDef(RealFullVector,1) // STL-vector-based Data Storage class
489 } ;
490
491
492 class CatVector {
493 public:
495 _cat(nullptr), _buf(nullptr), _nativeBuf(nullptr)
496 {
497 _vec.reserve(initialCapacity);
498 }
499
501 _cat(cat), _buf(nullptr), _nativeBuf(nullptr)
502 {
503 _vec.reserve(initialCapacity);
504 }
505
506 virtual ~CatVector() {
507 }
508
509 CatVector(const CatVector& other, RooAbsCategory* cat = nullptr) :
510 _cat(cat?cat:other._cat), _buf(other._buf), _nativeBuf(other._nativeBuf), _vec(other._vec)
511 {
512
513 }
514
516 if (&other==this) return *this;
517 _cat = other._cat;
518 _buf = other._buf;
519 _nativeBuf = other._nativeBuf;
520 if (other._vec.size() <= _vec.capacity() / 2 && _vec.capacity() > VECTOR_BUFFER_SIZE) {
521 std::vector<RooAbsCategory::value_type> tmp;
522 tmp.reserve(std::max(other._vec.size(), std::size_t(VECTOR_BUFFER_SIZE)));
523 tmp.assign(other._vec.begin(), other._vec.end());
524 _vec.swap(tmp);
525 } else {
526 _vec = other._vec;
527 }
528
529 return *this;
530 }
531
533 _buf = newBuf ;
534 if (!_nativeBuf) _nativeBuf = newBuf;
535 }
536
538 _nativeBuf = newBuf ? newBuf : _buf;
539 }
540
541 void fill() {
542 _vec.push_back(*_buf) ;
543 }
544
545 void write(std::size_t i) {
546 _vec[i] = *_buf;
547 }
548
549 void reset() {
550 // make sure the vector releases the underlying memory
551 std::vector<RooAbsCategory::value_type> tmp;
552 _vec.swap(tmp);
553 }
554
555 inline void load(std::size_t idx) const {
556 *_buf = _vec[idx];
557 }
558
559 inline void loadToNative(std::size_t idx) const {
560 *_nativeBuf = _vec[idx];
561 }
562
563 std::size_t size() const { return _vec.size() ; }
564
565 void resize(Int_t siz) {
566 if (siz < Int_t(_vec.capacity()) / 2 && _vec.capacity() > VECTOR_BUFFER_SIZE) {
567 // do an expensive copy, if we save at least a factor 2 in size
568 std::vector<RooAbsCategory::value_type> tmp;
569 tmp.reserve(std::max(siz, VECTOR_BUFFER_SIZE));
570 if (!_vec.empty())
571 tmp.assign(_vec.begin(), std::min(_vec.end(), _vec.begin() + siz));
572 if (Int_t(tmp.size()) != siz)
573 tmp.resize(siz);
574 _vec.swap(tmp);
575 } else {
576 _vec.resize(siz);
577 }
578 }
579
580 void reserve(Int_t siz) {
581 _vec.reserve(siz);
582 }
583
584 void setBufArg(RooAbsCategory* arg) { _cat = arg; }
585 const RooAbsCategory* bufArg() const { return _cat; }
586
587 private:
588 friend class RooVectorDataStore ;
592 std::vector<RooAbsCategory::value_type> _vec;
593 ClassDef(CatVector,2) // STL-vector-based Data Storage class
594 } ;
595
596
597 protected:
598
599 friend class RooAbsReal ;
600 friend class RooAbsCategory ;
601 friend class RooRealVar ;
602 std::vector<RealVector*>& realStoreList() { return _realStoreList ; }
603 std::vector<RealFullVector*>& realfStoreList() { return _realfStoreList ; }
604 std::vector<CatVector*>& catStoreList() { return _catStoreList ; }
605
606 CatVector* addCategory(RooAbsCategory* cat);
607
608 RealVector* addReal(RooAbsReal* real);
609
611
613
615
616 RealFullVector* addRealFull(RooAbsReal* real);
617
618 virtual Bool_t hasFilledCache() const override { return _cache ? kTRUE : kFALSE ; }
619
620 void forceCacheUpdate() override;
621
622 private:
624 RooRealVar* _wgtVar ; // Pointer to weight variable (if set)
625
626 std::vector<RealVector*> _realStoreList ;
627 std::vector<RealFullVector*> _realfStoreList ;
628 std::vector<CatVector*> _catStoreList ;
629 std::vector<double> _weights;
630
631 void setAllBuffersNative() ;
632
635
636 const Double_t* _extWgtArray ; //! External weight array
637 const Double_t* _extWgtErrLoArray ; //! External weight array - low error
638 const Double_t* _extWgtErrHiArray ; //! External weight array - high error
639 const Double_t* _extSumW2Array ; //! External sum of weights array
640
641 mutable std::size_t _currentWeightIndex{0}; //
642
643 RooVectorDataStore* _cache ; //! Optimization cache
644 RooAbsArg* _cacheOwner ; //! Cache owner
645
646 Bool_t _forcedUpdate ; //! Request for forced cache update
647
648 ClassDefOverride(RooVectorDataStore, 5) // STL-vector-based Data Storage class
649};
650
651
652#endif
#define VECTOR_BUFFER_SIZE
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassDef(name, id)
Definition Rtypes.h:325
#define ClassDefOverride(name, id)
Definition Rtypes.h:329
char name[80]
Definition TGX11.cxx:110
#define hi
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:72
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...
Definition RooAbsReal.h:61
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:91
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:21
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
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
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:39
A simple container to hold a batch of data values.
Definition RooSpan.h:34
RooTreeDataStore is a TTree-backed data storage.
void setBufArg(RooAbsCategory *arg)
void setBuffer(RooAbsCategory::value_type *newBuf)
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)
RealFullVector(RooAbsReal *arg, UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
RealFullVector(const RealVector &other, RooAbsReal *real=0)
RealFullVector & operator=(const RealFullVector &other)
RealFullVector(UInt_t initialCapacity=(VECTOR_BUFFER_SIZE/sizeof(Double_t)))
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
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
RealVector(const RealVector &other, RooAbsReal *real=0)
const std::vector< double > & data() const
RooVectorDataStore uses std::vectors to store data columns.
const RooArgSet & row()
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.
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.
Definition TNamed.h:47
A TTree represents a columnar dataset.
Definition TTree.h:79
Definition first.py:1
This struct enables passing computation data around between elements of a computation graph.
Definition RunContext.h:31