50using std::string, std::vector, std::list;
74 arg->attachToVStore(*
this) ;
113 ret.remove(*
wgt,
true,
true) ;
142 _varsww(
other._varsww),
143 _wgtVar(
other._wgtVar),
144 _sumWeight(
other._sumWeight),
145 _sumWeightCarry(
other._sumWeightCarry),
146 _extWgtArray(
other._extWgtArray),
147 _extWgtErrLoArray(
other._extWgtErrLoArray),
148 _extWgtErrHiArray(
other._extWgtErrHiArray),
149 _extSumW2Array(
other._extSumW2Array),
150 _currentWeightIndex(
other._currentWeightIndex)
175 _wgtVar(weightVar(vars,
other._wgtVar?
other._wgtVar->GetName():nullptr))
177 for (
const auto arg :
_varsww) {
178 arg->attachToVStore(*
this) ;
185 for (
Int_t i=0 ; i<
other.numEntries() ; i++) {
201 _wgtVar(
other._wgtVar?weightVar(vars,
other._wgtVar->GetName()):nullptr),
202 _sumWeight(
other._sumWeight),
203 _sumWeightCarry(
other._sumWeightCarry),
204 _extWgtArray(
other._extWgtArray),
205 _extWgtErrLoArray(
other._extWgtErrLoArray),
206 _extWgtErrHiArray(
other._extWgtErrHiArray),
207 _extSumW2Array(
other._extSumW2Array),
208 _currentWeightIndex(
other._currentWeightIndex)
216 real->attachToVStore(*
this) ;
227 real->attachToVStore(*
this) ;
231 vector<CatVector*>::const_iterator
citer =
other._catStoreList.
begin() ;
272 for (
const auto arg :
_varsww) {
273 arg->attachToVStore(*
this) ;
279 std::unique_ptr<RooFormulaVar> cloneVar;
282 cloneVar->attachDataStore(
tds) ;
354 if (
index < 0 ||
static_cast<std::size_t
>(
index) >=
size())
return nullptr;
370 for (
auto var :
_vars) {
371 var->setValueDirty();
434 throw string(
Form(
"RooDataHist::weightError(%s) error type Auto not allowed here",
GetName())) ;
438 throw string(
Form(
"RooDataHist::weightError(%s) error type Expected not allowed here",
GetName())) ;
512 const auto numEntr =
static_cast<std::size_t
>(
ads->numEntries());
533 std::vector<std::string> ranges;
539 for(
auto i=
nStart; i < nevent ; ++i) {
570 allValid &= std::any_of(ranges.begin(), ranges.end(), [arg](
const std::string&
range){
571 return arg->inRange(range.c_str());});
626 auto valHolder = std::unique_ptr<RooAbsArg>{
newVar.createFundamental()}.release();
629 coutE(InputArguments) <<
GetName() <<
"::addColumn: holder argument is not fundamental: \""
630 <<
valHolder->GetName() <<
"\"" << std::endl;
658 for (std::size_t i=0; i <
numEvt; i++) {
664 if (
rv)
rv->write(i) ;
665 if (
cv)
cv->write(i) ;
683 const auto nevt =
dstoreList.front()->numEntries();
685 for (
int i=0 ; i<nevt ; i++) {
724 for (
int i=0 ; i<nevt ; i++) {
777 if (arg->getAttribute(
"ConstantExpression") && !arg->getAttribute(
"NOCacheAndTrack")) {
785 if (arg->dependsOn(
_vars) && !arg->getAttribute(
"NOCacheAndTrack")) {
796 if (left == right) return false;
797 return right->dependsOn(*left);
812 std::vector<std::unique_ptr<RooArgSet>>
vlist;
834 std::vector<std::unique_ptr<RooArgSet>>
argObsList ;
840 if(nset)
argObsList.emplace_back(arg->getObservables(*nset));
841 else argObsList.emplace_back(arg->getVariables());
845 const char*
catNset = arg->getStringAttribute(
"CATNormSet") ;
853 const char*
catCset = arg->getStringAttribute(
"CATCondSet") ;
873 for (std::size_t i=0; i <
numEvt; i++) {
876 for (
unsigned int j = 0;
j <
cloneSet.size(); ++
j) {
894 if (!arg->getAttribute(
"ConstantExpression") &&
dynamic_cast<RooAbsReal*
>(arg)) {
897 arg->getParameters(&
_vars, deps);
898 rv->setDependents(deps) ;
904 coutI(Optimization) <<
"RooVectorDataStore::cacheArg() element " << arg->GetName() <<
" has change tracking enabled on parameters " << deps << std::endl ;
928 std::vector<RooVectorDataStore::RealVector *>
tv;
951 ownedNset = std::make_unique<RooArgSet>();
1046 extArg->attachToVStore(*
this) ;
1058 arg->attachToVStore(*
this);
1068 std::cout <<
"RooVectorDataStor::dump()" << std::endl ;
1070 std::cout <<
"_varsww = " << std::endl ;
_varsww.
Print(
"v") ;
1071 std::cout <<
"realVector list is" << std::endl ;
1074 std::cout <<
"RealVector " <<
elm <<
" _nativeReal = " <<
elm->_nativeReal <<
" = " <<
elm->_nativeReal->GetName() <<
" bufptr = " <<
elm->_buf << std::endl ;
1075 std::cout <<
" values : " ;
1078 std::cout <<
elm->_vec[i] <<
" " ;
1080 std::cout << std::endl ;
1084 std::cout <<
"RealFullVector " <<
elm <<
" _nativeReal = " <<
elm->_nativeReal <<
" = " <<
elm->_nativeReal->GetName()
1085 <<
" bufptr = " <<
elm->_buf <<
" errbufptr = " <<
elm->bufE() << std::endl ;
1087 std::cout <<
" values : " ;
1090 std::cout <<
elm->_vec[i] <<
" " ;
1092 std::cout << std::endl ;
1094 std::cout <<
" errors : " ;
1096 std::cout <<
elm->dataE()[i] <<
" " ;
1098 std::cout << std::endl ;
1110 if (
R__b.IsReading()) {
1141 auto span =
realVec->getRange(first, first +
len);
1145 coutE(DataHandling) <<
"A batch of data for '" <<
realVec->_nativeReal->GetName()
1146 <<
"' was requested from " << first <<
" to " << first+
len
1147 <<
", but only the events [" << first <<
", " << first +
size <<
") are available." << std::endl;
1180 auto span =
catVec->getRange(first, first +
len);
1184 coutE(DataHandling) <<
"A batch of data for '" <<
catVec->_cat->GetName()
1185 <<
"' was requested from " << first <<
" to " << first+
len
1186 <<
", but only the events [" << first <<
", " << first +
size <<
") are available." << std::endl;
1216 return (*storageIter)->getRange(first, first +
len);
1220 return (*fstorageIter)->getRange(first, first +
len);
1222 throw std::logic_error(
"RooVectorDataStore::getWeightBatch(): Could not retrieve data for _wgtVar.");
1232 if (std::string(
catVec->bufArg()->GetName())==cat->
GetName()) {
1248 if (
realVec->bufArg()->namePtr()==
real->namePtr()) {
1255 if (
fullVec->bufArg()->namePtr()==
real->namePtr()) {
1272 if (std::string(
fullVec->bufArg()->GetName())==
real->GetName()) {
1284 if (std::string(
fullVec->bufArg()->GetName())==
real->GetName()) {
1296 if (std::string(
fullVec->bufArg()->GetName())==
real->GetName()) {
1308 if (std::string(
fullVec->bufArg()->GetName())==
real->GetName()) {
1315 if (std::string(
realVec->bufArg()->GetName())==
real->GetName()) {
1339 double const*
arr =
nullptr;
1354 if(
arr ==
nullptr) {
1371 out.reals.emplace_back(
real->_nativeReal->GetName(),
real->_vec.data());
1374 std::string
name =
realf->_nativeReal->GetName();
1375 out.reals.emplace_back(
name,
realf->_vec.data());
1376 if(
realf->bufE()) out.reals.emplace_back(
name +
"Err",
realf->dataE().data());
1377 if(
realf->bufEL()) out.reals.emplace_back(
name +
"ErrLo",
realf->dataEL().data());
1378 if(
realf->bufEH()) out.reals.emplace_back(
name +
"ErrHi",
realf->dataEH().data());
1381 out.cats.emplace_back(cat->_cat->GetName(), cat->_vec.data());
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
static KahanSum< T, N > Accumulate(Iterator begin, Iterator end, T initialValue=T{})
Iterate over a range and return an instance of a KahanSum.
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
static void setDirtyInhibit(bool flag)
Control global dirty inhibit mode.
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
virtual void attachToVStore(RooVectorDataStore &vstore)=0
A space to attach TBranches.
void attachToVStore(RooVectorDataStore &vstore) override
Attach the category index and label to as branches to the given vector store.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
RooAbsArg * find(const char *name) const
Find object with given name in list.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
Abstract base class for a data collection.
virtual void checkInit() const
bool _doDirtyProp
Switch do (de)activate dirty state propagation when loading a data point.
std::map< RooFit::Detail::DataKey, std::span< const double > > RealSpans
std::map< RooFit::Detail::DataKey, std::span< const RooAbsCategory::value_type > > CategorySpans
Abstract base class for objects that represent a real value and implements functionality common to al...
double 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.
static const RooHistError & instance()
Return a reference to a singleton object that is created the first time this method is called.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
bool hasError(bool allowZero=true) const
bool hasAsymError(bool allowZero=true) const
double getAsymErrorHi() const
double getAsymErrorLo() const
The RooStringView is a wrapper around a C-style string that can also be constructed from a std::strin...
TTree-backed data storage.
Uses std::vector to store data columns.
void resetCache() override
void recalculateCache(const RooArgSet *, Int_t firstEvent, Int_t lastEvent, Int_t stepSize, bool skipZeroWeights) override
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
Int_t numEntries() const override
RooAbsArg * addColumn(RooAbsArg &var, bool adjustRange=true) override
Add a new column to the data set which holds the pre-calculated values of 'newVar'.
RooVectorDataStore * _cache
! Optimization cache
const double * _extWgtErrHiArray
! External weight array - high error
std::span< 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).
~RooVectorDataStore() override
Destructor.
void resetBuffers() override
RooRealVar * weightVar(const RooArgSet &allVars, const char *wgtName)
Utility function for constructors Return pointer to weight variable if it is defined.
void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=nullptr, bool skipZeroWeights=true) override
Cache given RooAbsArgs: The tree is given direct write access of the args internal cache the args val...
RooRealVar * _wgtVar
Pointer to weight variable (if set)
std::vector< RealVector * > _realStoreList
CatVector * addCategory(RooAbsCategory *cat)
void loadValues(const RooAbsDataStore *tds, const RooFormulaVar *select=nullptr, const char *rangeName=nullptr, std::size_t nStart=0, std::size_t nStop=std::numeric_limits< std::size_t >::max()) override
const RooArgSet * get(Int_t index) const override
Load the n-th data point (n='index') into the variables of this dataset, and return a pointer to the ...
RealFullVector * addRealFull(RooAbsReal *real)
double weight() const override
Return the weight of the last-retrieved data point.
RooAbsData::RealSpans getBatches(std::size_t first, std::size_t len) const override
Return batches of the data columns for the requested events.
ULong64_t _currentWeightIndex
bool isFullReal(RooAbsReal *real)
Int_t fill() override
Interface function to TTree::Fill.
const double * _extWgtErrLoArray
! External weight array - low error
bool _forcedUpdate
! Request for forced cache update
void append(RooAbsDataStore &other) override
bool hasError(RooAbsReal *real)
std::vector< CatVector * > _catStoreList
void setArgStatus(const RooArgSet &set, bool active) override
Disabling of branches is (intentionally) not implemented in vector data stores (as the doesn't result...
void setAllBuffersNative()
double weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const override
Return the error of the current weight.
void attachBuffers(const RooArgSet &extObs) override
ArraysStruct getArrays() const
Exports all arrays in this RooVectorDataStore into a simple datastructure to be used by RooFit intern...
RooAbsData::CategorySpans getCategoryBatches(std::size_t, std::size_t len) const override
RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore * > dstoreList) override
Merge columns of supplied data set(s) with this data set.
void setDirtyProp(bool flag) override
RealVector * addReal(RooAbsReal *real)
bool hasAsymError(RooAbsReal *real)
bool changeObservableName(const char *from, const char *to) override
void forceCacheUpdate() override
const double * _extSumW2Array
! External sum of weights array
void recomputeSumWeight()
Trigger a recomputation of the cached weight sums.
std::vector< RealVector * > & realStoreList()
std::size_t size() const
Get size of stored dataset.
std::unique_ptr< RooAbsDataStore > reduce(RooStringView name, RooStringView title, const RooArgSet &vars, const RooFormulaVar *cutVar, const char *cutRange, std::size_t nStart, std::size_t nStop) override
virtual const RooArgSet * get() const
const double * _extWgtArray
! External weight array
void Streamer(TBuffer &) override
Stream an object of class RooVectorDataStore.
RooArgSet varsNoWeight(const RooArgSet &allVars, const char *wgtName)
Utility function for constructors Return RooArgSet that is copy of allVars minus variable matching wg...
RooAbsArg * _cacheOwner
! Cache owner
Buffer base class used for serializing objects.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
RooArgSet selectFromArgSet(RooArgSet const &, std::string const &names)
Output struct for the RooVectorDataStore::getArrays() helper function.