Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
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 *****************************************************************************/
19#include "RooAbsDataStore.h"
21#include <map>
22#include <string>
23#include <vector>
24#include <list>
26class RooAbsArg ;
27class RooArgList ;
28class RooFormulaVar ;
29class RooArgSet ;
30class RooCategory ;
38 // Ctors from DataStore
39 RooCompositeDataStore(RooStringView name, RooStringView title, const RooArgSet& vars, RooCategory& indexCat, std::map<std::string,RooAbsDataStore*> const& inputData) ;
41 // Empty ctor
42 RooAbsDataStore* clone(const char* newname=nullptr) const override { return new RooCompositeDataStore(*this,newname) ; }
43 RooAbsDataStore* clone(const RooArgSet& vars, const char* newname=nullptr) const override { return new RooCompositeDataStore(*this,vars,newname) ; }
45 std::unique_ptr<RooAbsDataStore> reduce(RooStringView name, RooStringView title,
46 const RooArgSet& vars, const RooFormulaVar* cutVar, const char* cutRange,
47 std::size_t nStart, std::size_t nStop) override;
49 RooCompositeDataStore(const RooCompositeDataStore& other, const char* newname=nullptr) ;
50 RooCompositeDataStore(const RooCompositeDataStore& other, const RooArgSet& vars, const char* newname=nullptr) ;
52 ~RooCompositeDataStore() override ;
54 void dump() override ;
56 // Write current row
57 Int_t fill() override ;
59 double sumEntries() const override ;
61 // Retrieve a row
63 const RooArgSet* get(Int_t index) const override ;
65 double weight() const override ;
66 double weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const override ;
67 void weightError(double& lo, double& hi, RooAbsData::ErrorType etype=RooAbsData::Poisson) const override ;
68 bool isWeighted() const override ;
70 // Change observable name
71 bool changeObservableName(const char* from, const char* to) override ;
73 // Add one column
74 RooAbsArg* addColumn(RooAbsArg& var, bool adjustRange=true) override ;
76 // Merge column-wise
77 RooAbsDataStore* merge(const RooArgSet& allvars, std::list<RooAbsDataStore*> dstoreList) override ;
79 RooCategory* index() { return _indexCat ; }
81 // Add rows
82 void append(RooAbsDataStore& other) override ;
84 // General & bookkeeping methods
85 Int_t numEntries() const override ;
86 void reset() override ;
88 // Buffer redirection routines used in inside RooAbsOptTestStatistics
89 void attachBuffers(const RooArgSet& extObs) override ;
90 void resetBuffers() override ;
92 // Constant term optimizer interface
93 void cacheArgs(const RooAbsArg* owner, RooArgSet& varSet, const RooArgSet* nset=nullptr, bool skipZeroWeights=false) override ;
94 const RooAbsArg* cacheOwner() override { return nullptr ; }
95 void setArgStatus(const RooArgSet& set, bool active) override ;
96 void resetCache() override ;
98 void recalculateCache(const RooArgSet* /*proj*/, Int_t /*firstEvent*/, Int_t /*lastEvent*/, Int_t /*stepSize*/, bool /*skipZeroWeights*/) override ;
99 bool hasFilledCache() const override ;
101 void loadValues(const RooAbsDataStore *tds, const RooFormulaVar* select=nullptr, const char* rangeName=nullptr,
102 std::size_t nStart=0, std::size_t nStop = std::numeric_limits<std::size_t>::max()) override;
104 void forceCacheUpdate() override ;
106 RooAbsData::RealSpans getBatches(std::size_t first, std::size_t len) const override {
107 //TODO
108 std::cerr << "This functionality is not yet implemented for composite data stores." << std::endl;
109 throw std::logic_error("getBatches() not implemented for RooCompositeDataStore.");
110 (void)first; (void)len;
111 return {};
112 }
113 RooSpan<const double> getWeightBatch(std::size_t first, std::size_t len) const override;
116 protected:
118 void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) override ;
120 std::map<Int_t,RooAbsDataStore*> _dataMap ;
122 mutable RooAbsDataStore* _curStore = nullptr; ///<! Datastore associated with current event
123 mutable Int_t _curIndex = 0; ///<! Index associated with current event
124 mutable std::unique_ptr<std::vector<double>> _weightBuffer; ///<! Buffer for weights in case a batch of values is requested.
125 bool _ownComps = false; ///<!
127 ClassDefOverride(RooCompositeDataStore,1) // Composite Data Storage class
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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 name[80]
Definition TGX11.cxx:110
#define hi
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:79
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
const RooArgSet & cachedVars() const
virtual double weight() const =0
virtual const RooArgSet * get() const
std::map< RooFit::Detail::DataKey, RooSpan< const double > > RealSpans
Definition RooAbsData.h:132
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
RooCategory is an object to represent discrete states.
Definition RooCategory.h:28
RooCompositeDataStore combines several disjunct datasets into one.
void attachCache(const RooAbsArg *newOwner, const RooArgSet &cachedVars) override
Initialize cache of dataset: attach variables of cache ArgSet to the corresponding TTree branches.
RooAbsDataStore * clone(const RooArgSet &vars, const char *newname=nullptr) const override
RooAbsArg * addColumn(RooAbsArg &var, bool adjustRange=true) override
WVE ownership issue here!! Caller (a RooAbsData) should take ownership of all arguments,...
std::unique_ptr< std::vector< double > > _weightBuffer
! Buffer for weights in case a batch of values is requested.
Int_t _curIndex
! Index associated with current event
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
Int_t numEntries() const override
std::map< Int_t, RooAbsDataStore * > _dataMap
RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore * > dstoreList) override
bool changeObservableName(const char *from, const char *to) override
Change name of internal observable named 'from' into 'to'.
~RooCompositeDataStore() override
RooSpan< const double > getWeightBatch(std::size_t first, std::size_t len) const override
Get the weights of the events in the range [first, first+len).
RooAbsDataStore * clone(const char *newname=nullptr) const override
void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=nullptr, bool skipZeroWeights=false) override
void recalculateCache(const RooArgSet *, Int_t, Int_t, Int_t, bool) override
Forward recalculate request to all subsets.
RooAbsData::RealSpans getBatches(std::size_t first, std::size_t len) const override
Retrieve batches for all observables in this data store.
bool isWeighted() const override
void setArgStatus(const RooArgSet &set, bool active) override
bool hasFilledCache() const override
RooAbsDataStore * _curStore
! Datastore associated with current event
double weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const override
double sumEntries() const override
Forward fill request to appropriate subset.
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
Int_t fill() override
Forward fill request to appropriate subset.
void attachBuffers(const RooArgSet &extObs) override
double weight() const override
const RooAbsArg * cacheOwner() override
void append(RooAbsDataStore &other) override
virtual const RooArgSet * get() const
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
A simple container to hold a batch of data values.
Definition RooSpan.h:34
The RooStringView is a wrapper around a C-syle string that can also be constructed from a std::string...
Definition first.py:1