Warning, file /include/root/RooAbsDataStore.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_ABS_DATA_STORE
0017 #define ROO_ABS_DATA_STORE
0018
0019 #include "Rtypes.h"
0020 #include "RooArgSet.h"
0021 #include "RooAbsData.h"
0022
0023 #include <string_view>
0024 #include "TNamed.h"
0025
0026 #include <list>
0027 #include <vector>
0028
0029 class RooAbsArg ;
0030 class RooArgList ;
0031 class TTree ;
0032
0033
0034 class RooAbsDataStore : public TNamed, public RooPrintable {
0035 public:
0036
0037 RooAbsDataStore() {}
0038 RooAbsDataStore(RooStringView name, RooStringView title, const RooArgSet& vars)
0039 : TNamed(name,title), _vars{vars} {}
0040 RooAbsDataStore(const RooAbsDataStore& other, const char* newname=nullptr)
0041 : RooAbsDataStore(other, other._vars, newname) {}
0042 RooAbsDataStore(const RooAbsDataStore& other, const RooArgSet& vars, const char* newname=nullptr)
0043 : TNamed(other), RooPrintable(other), _vars{vars}, _doDirtyProp{other._doDirtyProp}
0044 {
0045 if(newname) SetName(newname);
0046 }
0047
0048 virtual RooAbsDataStore* clone(const char* newname=nullptr) const = 0 ;
0049 virtual RooAbsDataStore* clone(const RooArgSet& vars, const char* newname=nullptr) const = 0 ;
0050
0051 virtual std::unique_ptr<RooAbsDataStore> reduce(RooStringView name, RooStringView title,
0052 const RooArgSet& vars, const RooFormulaVar* cutVar, const char* cutRange,
0053 std::size_t nStart, std::size_t nStop) = 0 ;
0054
0055
0056 virtual Int_t fill() = 0 ;
0057
0058
0059 virtual const RooArgSet* get(Int_t index) const = 0 ;
0060 virtual const RooArgSet* get() const { return &_vars ; }
0061 virtual double weight() const = 0 ;
0062
0063 virtual double weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const = 0 ;
0064 virtual void weightError(double& lo, double& hi, RooAbsData::ErrorType etype=RooAbsData::Poisson) const = 0 ;
0065
0066 double weight(Int_t index) const {
0067 get(index) ;
0068 return weight() ;
0069 }
0070 virtual bool isWeighted() const = 0 ;
0071
0072
0073 virtual RooAbsData::RealSpans getBatches(std::size_t first, std::size_t len) const = 0;
0074 virtual RooAbsData::CategorySpans getCategoryBatches(std::size_t , std::size_t ) const {
0075 std::cerr << "This functionality is not yet implemented for this data store." << std::endl;
0076 throw std::logic_error("getCategoryBatches() not implemented in RooAbsDataStore.");
0077 return {};
0078 }
0079 virtual std::span<const double> getWeightBatch(std::size_t first, std::size_t len) const = 0;
0080
0081
0082 virtual bool changeObservableName(const char* from, const char* to) =0 ;
0083
0084
0085 virtual RooAbsArg* addColumn(RooAbsArg& var, bool adjustRange=true) = 0 ;
0086 RooArgSet* addColumns(const RooArgList& varList);
0087
0088
0089 virtual RooAbsDataStore* merge(const RooArgSet& allvars, std::list<RooAbsDataStore*> dstoreList) = 0 ;
0090
0091
0092 virtual void append(RooAbsDataStore& other)= 0 ;
0093
0094
0095 virtual Int_t numEntries() const = 0 ;
0096 virtual double sumEntries() const { return 0 ; } ;
0097 virtual void reset() = 0 ;
0098
0099
0100 virtual void attachBuffers(const RooArgSet& extObs) = 0 ;
0101 virtual void resetBuffers() = 0 ;
0102
0103 virtual void setExternalWeightArray(const double* , const double* , const double* , const double* ) {} ;
0104
0105
0106 inline void Print(Option_t *options= nullptr) const override {
0107
0108 printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
0109 }
0110
0111
0112 void printName(std::ostream& os) const override { os << GetName(); }
0113
0114 void printTitle(std::ostream& os) const override { os << GetTitle(); }
0115 void printClassName(std::ostream& os) const override ;
0116 void printArgs(std::ostream& os) const override;
0117
0118 void printValue(std::ostream& os) const override { os << numEntries() << " entries" ; }
0119 void printMultiline(std::ostream& os, Int_t content, bool verbose, TString indent) const override;
0120
0121
0122 int defaultPrintContents(Option_t* ) const override { return kName|kClassName|kArgs|kValue ; }
0123
0124
0125
0126 virtual void cacheArgs(const RooAbsArg* cacheOwner, RooArgSet& varSet, const RooArgSet* nset=nullptr, bool skipZeroWeights=false) = 0 ;
0127 virtual const RooAbsArg* cacheOwner() = 0 ;
0128 virtual void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) = 0 ;
0129 virtual void setArgStatus(const RooArgSet& set, bool active) = 0 ;
0130 const RooArgSet& cachedVars() const { return _cachedVars ; }
0131 virtual void resetCache() = 0 ;
0132 virtual void recalculateCache(const RooArgSet* , Int_t , Int_t , Int_t , bool ) {} ;
0133
0134 virtual void setDirtyProp(bool flag) { _doDirtyProp = flag ; }
0135 bool dirtyProp() const { return _doDirtyProp ; }
0136
0137 virtual void checkInit() const {} ;
0138
0139 virtual bool hasFilledCache() const { return false ; }
0140
0141 virtual const TTree* tree() const { return nullptr ; }
0142 virtual void dump() {}
0143
0144 virtual void loadValues(const RooAbsDataStore *tds, const RooFormulaVar* select=nullptr, const char* rangeName=nullptr,
0145 std::size_t nStart=0, std::size_t nStop = std::numeric_limits<std::size_t>::max()) = 0 ;
0146
0147 virtual void forceCacheUpdate() {} ;
0148
0149 protected:
0150
0151 RooArgSet _vars;
0152 RooArgSet _cachedVars;
0153
0154 bool _doDirtyProp = true;
0155
0156 ClassDefOverride(RooAbsDataStore,1)
0157 };
0158
0159
0160 #endif