88 _wgtVar(weightVar(vars,wgtVarName)),
109 arg->attachToVStore(*
this) ;
123 realVec->setNativeBuffer();
127 fullVec->setNativeBuffer();
131 catVec->setNativeBuffer();
177 _varsww(other._varsww),
178 _wgtVar(other._wgtVar),
181 _nEntries(other._nEntries),
182 _sumWeight(other._sumWeight),
183 _sumWeightCarry(other._sumWeightCarry),
184 _extWgtArray(other._extWgtArray),
185 _extWgtErrLoArray(other._extWgtErrLoArray),
186 _extWgtErrHiArray(other._extWgtErrHiArray),
187 _extSumW2Array(other._extSumW2Array),
188 _curWgt(other._curWgt),
189 _curWgtErrLo(other._curWgtErrLo),
190 _curWgtErrHi(other._curWgtErrHi),
191 _curWgtErr(other._curWgtErr),
223 _wgtVar(weightVar(vars,other._wgtVar?other._wgtVar->
GetName():0)),
232 _extWgtErrLoArray(0),
233 _extWgtErrHiArray(0),
270 _wgtVar(other._wgtVar?weightVar(vars,other._wgtVar->
GetName()):0),
273 _nEntries(other._nEntries),
274 _sumWeight(other._sumWeight),
275 _sumWeightCarry(other._sumWeightCarry),
276 _extWgtArray(other._extWgtArray),
277 _extWgtErrLoArray(other._extWgtErrLoArray),
278 _extWgtErrHiArray(other._extWgtErrHiArray),
279 _extSumW2Array(other._extSumW2Array),
280 _curWgt(other._curWgt),
281 _curWgtErrLo(other._curWgtErrLo),
282 _curWgtErrHi(other._curWgtErrHi),
283 _curWgtErr(other._curWgtErr),
288 auto real =
static_cast<RooAbsReal*
>(vars.
find(realVec->bufArg()->GetName()));
293 real->attachToVStore(*
this) ;
297 vector<RealFullVector*>::const_iterator fiter = other.
_realfStoreList.begin() ;
309 vector<CatVector*>::const_iterator citer = other.
_catStoreList.begin() ;
341 _wgtVar(weightVar(vars,wgtVarName)),
350 _extWgtErrLoArray(0),
351 _extWgtErrHiArray(0),
381 loadValues(&tds,cloneVar,cutRange,nStart,nStop);
483 for (
auto var :
_vars) {
484 var->setValueDirty();
533 realV->getNative(index) ;
550 for (
auto var :
_vars) {
551 var->setValueDirty() ;
658 throw string(
Form(
"RooDataHist::weightError(%s) error type Auto not allowed here",
GetName())) ;
662 throw string(
Form(
"RooDataHist::weightError(%s) error type Expected not allowed here",
GetName())) ;
754 std::vector<std::string> ranges;
760 for(
Int_t i=nStart; i < nevent ; ++i) {
764 if (selectClone && selectClone->
getVal()==0) {
784 bool allValid =
true;
785 for (
const auto arg :
_varsww) {
786 allValid = arg->isValid() && (ranges.empty() || std::any_of(ranges.begin(), ranges.end(),
787 [arg](
const std::string& range){return arg->inRange(range.c_str());}) );
845 << valHolder->
GetName() <<
"\"" << endl;
875 if (rv) rv->
write(i) ;
876 if (cv) cv->
write(i) ;
904 holderSet->
add(*valHolder) ;
909 << valHolder->
GetName() <<
"\"" << endl;
915 if (!newVarCloneList) {
917 <<
") Couldn't deep-clone variable " << var->
GetName() <<
", abort." << endl ;
924 cloneSetList.
Add(newVarCloneList) ;
925 cloneSet.
add(*newVarClone) ;
988 Int_t nevt = dstoreList.front()->numEntries() ;
990 for (
int i=0 ; i<nevt ; i++) {
996 for (list<RooAbsDataStore*>::iterator iter = dstoreList.begin() ; iter!=dstoreList.end() ; ++iter) {
997 const RooArgSet* partSet = (*iter)->get(i) ;
998 mergedStore->
_vars = *partSet ;
1001 mergedStore->
fill() ;
1003 return mergedStore ;
1011 elm->reserve(nEvts);
1015 elm->reserve(nEvts);
1019 elm->reserve(nEvts);
1029 for (
int i=0 ; i<nevt ; i++) {
1090 vector<RooAbsArg*> trackArgs;
1091 for (
const auto arg : newVarSetCopy) {
1092 if (arg->getAttribute(
"ConstantExpression") && !arg->getAttribute(
"NOCacheAndTrack")) {
1093 orderedArgs.
add(*arg) ;
1100 if (arg->dependsOn(
_vars) && !arg->getAttribute(
"NOCacheAndTrack")) {
1101 trackArgs.push_back(arg) ;
1110 return right->dependsOn(*left);
1114 for (
const auto trackedArg : trackArgs) {
1115 orderedArgs.
add(*trackedArg);
1125 std::vector<RooArgSet*> vlist;
1128 for (
const auto var : orderedArgs) {
1132 RooAbsArg* newVarClone = newVarCloneList->
find(var->GetName()) ;
1135 vlist.push_back(newVarCloneList) ;
1136 cloneSet.
add(*newVarClone) ;
1145 std::vector<RooArgSet*> nsetList ;
1146 std::vector<RooArgSet*> argObsList ;
1150 for (
const auto arg : cloneSet) {
1151 arg->attachToVStore(*newCache) ;
1153 RooArgSet* argObs = nset ? arg->getObservables(*nset) : arg->getVariables() ;
1154 argObsList.push_back(argObs) ;
1157 const char* catNset = arg->getStringAttribute(
"CATNormSet") ;
1166 const char* catCset = arg->getStringAttribute(
"CATCondSet") ;
1181 nsetList.push_back(normSet) ;
1189 if (
weight()!=0 || !skipZeroWeights) {
1190 for (std::size_t j = 0; j < cloneSet.
size(); ++j) {
1191 auto& cloneArg = cloneSet[j];
1192 auto argNSet = nsetList[j];
1194 cloneArg.syncCache(argNSet ? argNSet : nset) ;
1204 for (
const auto arg : orderedArgs) {
1205 arg->attachToVStore(*newCache) ;
1208 if (!arg->getAttribute(
"ConstantExpression") &&
dynamic_cast<RooAbsReal*
>(arg)) {
1217 coutI(
Optimization) <<
"RooVectorDataStore::cacheArg() element " << arg->
GetName() <<
" has change tracking enabled on parameters " << *deps << endl ;
1225 for (
auto set : vlist) {
1228 for (
auto set : argObsList) {
1250 std::vector<RooVectorDataStore::RealVector *> tv;
1256 tv.push_back(realVec);
1272 if (projectedArgs && projectedArgs->
getSize()>0) {
1275 usedNset = ownedNset ;
1281 for (
int i=firstEvent ; i<lastEvent ; i+=stepSize) {
1284 if (!zeroWeight || !skipZeroWeights) {
1285 for (
auto realVector : tv) {
1286 realVector->_nativeReal->_valueDirty =
kTRUE;
1287 realVector->_nativeReal->getValV(realVector->_nset ? realVector->_nset : usedNset);
1288 realVector->write(i);
1293 for (
auto realVector : tv) {
1315 for (
const auto elm : cacheElements) {
1316 auto real =
static_cast<RooAbsReal*
>(cachedVarsIn.
find(elm->bufArg()->GetName()));
1324 auto cat =
static_cast<RooAbsCategory*
>(cachedVarsIn.
find(catVec->bufArg()->GetName()));
1382 arg->attachToVStore(*
this);
1392 cout <<
"RooVectorDataStor::dump()" << endl ;
1395 cout <<
"realVector list is" << endl ;
1398 cout <<
"RealVector " << elm <<
" _nativeReal = " << elm->_nativeReal <<
" = " << elm->_nativeReal->GetName() <<
" bufptr = " << elm->_buf << endl ;
1399 cout <<
" values : " ;
1400 Int_t imax = elm->_vec.size()>10 ? 10 : elm->_vec.size() ;
1401 for (
Int_t i=0 ; i<imax ; i++) {
1402 cout << elm->_vec[i] <<
" " ;
1408 cout <<
"RealFullVector " << elm <<
" _nativeReal = " << elm->_nativeReal <<
" = " << elm->_nativeReal->GetName()
1409 <<
" bufptr = " << elm->_buf <<
" errbufptr = " << elm->_bufE << endl ;
1411 cout <<
" values : " ;
1412 Int_t imax = elm->_vec.size()>10 ? 10 : elm->_vec.size() ;
1413 for (
Int_t i=0 ; i<imax ; i++) {
1414 cout << elm->_vec[i] <<
" " ;
1418 cout <<
" errors : " ;
1419 for (
Int_t i=0 ; i<imax ; i++) {
1420 cout << (*elm->_vecE)[i] <<
" " ;
1432void RooVectorDataStore::Streamer(
TBuffer &R__b)
1465void RooVectorDataStore::RealVector::Streamer(
TBuffer &R__b)
1477void RooVectorDataStore::RealFullVector::Streamer(
TBuffer &R__b)
1485 if (_vecE && _vecE->empty()) {
delete _vecE ; _vecE = 0 ; }
1486 if (_vecEL && _vecEL->empty()) {
delete _vecEL ; _vecEL = 0 ; }
1487 if (_vecEH && _vecEH->empty()) {
delete _vecEH ; _vecEH = 0 ; }
1496void RooVectorDataStore::CatVector::Streamer(
TBuffer &R__b)
1500 _vec0 = _vec.size()>0 ? &_vec.front() : 0 ;
1511 std::vector<RooSpan<const double>> ret;
1516 ret.emplace_back(realVec->getRange(firstEvent, lastEvent));
1523 ret.emplace_back(realVec->getRange(firstEvent, lastEvent));
1546 static double dummyWeight = 1.;
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...
virtual RooAbsArg * cloneTree(const char *newname=0) const
Clone tree expression of objects.
void attachDataStore(const RooAbsDataStore &set)
Replace server nodes with names matching the dataset variable names with those data set variables,...
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)=0
static void setDirtyInhibit(Bool_t flag)
Control global dirty inhibit mode.
virtual Bool_t isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
void setOperMode(OperMode mode, Bool_t recurseADirty=kTRUE)
Change cache operation mode to given mode.
virtual void syncCache(const RooArgSet *nset=0)=0
virtual void attachToVStore(RooVectorDataStore &vstore)=0
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
virtual RooAbsArg * createFundamental(const char *newname=0) const =0
Create a fundamental-type object that stores our type of value.
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
virtual void attachToVStore(RooVectorDataStore &vstore)
Attach the category index and label to as branches to the given vector store.
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
RooAbsCollection & assignValueOnly(const RooAbsCollection &other, Bool_t oneSafe=kFALSE)
The assignment operator sets the value of any argument in our set that also appears in the other set.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Storage_t::size_type size() const
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
TIterator-style iteration over contained elements.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
virtual const RooArgSet * get(Int_t index) const =0
virtual void checkInit() const
virtual Double_t weight() const =0
virtual Int_t numEntries() const =0
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual void attachToVStore(RooVectorDataStore &vstore)
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.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
Bool_t getPoissonInterval(Int_t n, Double_t &mu1, Double_t &mu2, Double_t nSigma=1) const
Return a confidence interval for the expected number of events given n observed (unweighted) events.
static const RooHistError & instance()
Return a reference to a singleton object that is created the first time this method is called.
RooNameSet is a utility class that stores the names the objects in a RooArget.
RooArgSet * select(const RooArgSet &list) const
Construct a RooArgSet of objects in input 'list' whose names match to those in the internal name list...
void setNameList(const char *givenList)
RooRealVar represents a variable that can be changed from the outside.
Double_t getAsymErrorLo() const
Bool_t hasAsymError(Bool_t allowZero=kTRUE) const
RooSpan< const double > getValBatch(std::size_t begin, std::size_t batchSize, const RooArgSet *=nullptr) const
Return batch of data between begin and end.
Double_t getAsymErrorHi() const
Bool_t hasError(Bool_t allowZero=kTRUE) const
Double_t getError() const
virtual void setVal(Double_t value)
Set value of variable to 'value'.
A simple container to hold a batch of data values.
RooTreeDataStore is a TTree-backed data storage.
virtual const RooArgSet * get(Int_t index) const
Load the n-th data point (n='index') in memory and return a pointer to the internal RooArgSet holding...
RooArgSet _varsww
Was object constructed with default ctor?
virtual Int_t numEntries() const
void setNset(RooArgSet *newNset)
void setDependents(const RooArgSet &deps)
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.
virtual void resetCache() 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[.
virtual Int_t numEntries() const override
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
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
virtual const RooArgSet * get(Int_t index) const override
Load the n-th data point (n='index') in memory and return a pointer to the internal RooArgSet holding...
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.
virtual void append(RooAbsDataStore &other) 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 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 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
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.
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 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.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Iterator abstract base class.
virtual TObject * Next()=0
virtual void Add(TObject *obj)
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
std::string GetName(const std::string &scope_name)
std::vector< std::string > tokenise(const std::string &str, const std::string &delims)
Tokenise the string by splitting at the characters in delims.