63using std::endl, std::list, std::string;
159 std::unique_ptr<RooFormulaVar> cloneVar;
162 cloneVar->attachDataStore(
tds) ;
194 ret.remove(*
wgt,
true,
true) ;
220 _varsww(
other._varsww),
221 _wgtVar(
other._wgtVar),
222 _extWgtArray(
other._extWgtArray),
223 _extWgtErrLoArray(
other._extWgtErrLoArray),
224 _extWgtErrHiArray(
other._extWgtErrHiArray),
225 _extSumW2Array(
other._extSumW2Array),
226 _curWgt(
other._curWgt),
227 _curWgtErrLo(
other._curWgtErrLo),
228 _curWgtErrHi(
other._curWgtErrHi),
229 _curWgtErr(
other._curWgtErr)
241 _wgtVar(
other._wgtVar?weightVar(vars,
other._wgtVar->GetName()):nullptr),
242 _extWgtArray(
other._extWgtArray),
243 _extWgtErrLoArray(
other._extWgtErrLoArray),
244 _extWgtErrHiArray(
other._extWgtErrHiArray),
245 _extSumW2Array(
other._extSumW2Array),
246 _curWgt(
other._curWgt),
247 _curWgtErrLo(
other._curWgtErrLo),
248 _curWgtErrHi(
other._curWgtErrHi),
249 _curWgtErr(
other._curWgtErr)
344 if (!
tClone->GetBranch(var->GetName())) {
346 coutE(InputArguments) <<
"Didn't find a branch in Tree '" <<
tClone->GetName() <<
"' to read variable '"
347 << var->GetName() <<
"' from."
348 <<
"\n\tNote: Name the RooFit variable the same as the branch." << std::endl;
352 coutE(InputArguments) <<
"Cannot import data from TTree '" <<
tClone->GetName()
353 <<
"' because some branches are missing !" << std::endl;
373 for(
Long64_t i=0; i < nevent; ++i) {
390 auto& log =
coutI(DataHandling);
391 log <<
"RooTreeDataStore::loadValues(" <<
GetName() <<
") Skipping event #" << i <<
" because " <<
destArg->GetName()
392 <<
" cannot accommodate the value ";
400 coutI(DataHandling) <<
"RooTreeDataStore::loadValues(" <<
GetName() <<
") Skipping ..." << std::endl;
415 coutW(DataHandling) <<
"RooTreeDataStore::loadValues(" <<
GetName() <<
") Ignored " <<
numInvalid <<
" out-of-range events" << std::endl ;
446 const auto numEntr =
static_cast<std::size_t
>(
ads->numEntries());
454 std::vector<std::string> ranges;
459 for (
auto i=
nStart; i < nevent ; ++i) {
476 for (
const auto arg :
_varsww) {
477 allValid = arg->isValid() && (ranges.empty() || std::any_of(ranges.begin(), ranges.end(),
478 [arg](
const std::string&
range){return arg->inRange(range.c_str());}) );
519 if(!
ret)
return nullptr;
523 for (
auto var :
_vars) {
524 var->setValueDirty();
609 throw string(
Form(
"RooDataHist::weightError(%s) error type Auto not allowed here",
GetName())) ;
613 throw string(
Form(
"RooDataHist::weightError(%s) error type Expected not allowed here",
GetName())) ;
674 coutE(InputArguments) <<
"RooTreeDataStore::changeObservableName(" <<
GetName() <<
" no observable " << from <<
" in this dataset" << std::endl ;
742 auto valHolder = std::unique_ptr<RooAbsArg>{
newVar.createFundamental()}.release();
745 coutE(InputArguments) <<
GetName() <<
"::addColumn: holder argument is not fundamental: \""
746 <<
valHolder->GetName() <<
"\"" << std::endl;
800 for (
int i=0 ; i<nevt ; i++) {
825 for (
int i=0 ; i<nevt ; i++) {
845 for (
int i=0 ; i<nevt ; i++) {
850 carry = (t -
sum) -
y;
860 for (
int i=0 ; i<nevt ; i++) {
864 carry = (t -
sum) -
y;
902 for (
const auto arg :
_varsww) {
905 if (arg->getAttribute(
"StoreError")) {
906 extArg->setAttribute(
"StoreError") ;
908 if (arg->getAttribute(
"StoreAsymError")) {
909 extArg->setAttribute(
"StoreAsymError") ;
924 arg->attachToTree(*
_tree) ;
935 arg->attachToTree(*
_tree) ;
956 if (
R__b.IsReading()) {
977 if (
_tree && parent) {
1000 std::replace(title.begin(), title.end(),
' ',
'_');
1001 std::replace(title.begin(), title.end(),
'-',
'_');
1002 return std::string(
"RooTreeDataStore_") +
GetName() +
"_" + title;
int Int_t
Signed integer 4 bytes (int)
short Version_t
Class version identifier (short)
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 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.
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
void SetName(const char *name) override
Set the name of the TNamed.
TString cleanBranchName() const
Construct a mangled name from the actual name that is free of any math symbols that might be interpre...
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
RooAbsCollection & assignValueOnly(const RooAbsCollection &other, bool forceIfSizeOne=false)
Sets the value of any argument in our set that also appears in the other set.
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.
Abstract base class for a data collection.
bool _doDirtyProp
Switch do (de)activate dirty state propagation when loading a data point.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
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 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...
const char * c_str() const
TTree-backed data storage.
void initialize()
One-time initialization common to all constructor forms.
double _curWgtErr
Weight of current event.
double weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const override
void resetBuffers() override
double _curWgt
Weight of current event.
double _curWgtErrHi
Weight of current event.
Int_t numEntries() const override
std::string makeTreeName() const
Generate a name for the storage tree from the name and title of this instance.
RooArgSet varsNoWeight(const RooArgSet &allVars, const char *wgtName=nullptr)
Utility function for constructors Return RooArgSet that is copy of allVars minus variable matching wg...
~RooTreeDataStore() override
Destructor.
void createTree(RooStringView name, RooStringView title)
Create TTree object that lives in memory, independent of current location of gDirectory.
const double * _extWgtErrHiArray
! External weight array - high error
void attachBuffers(const RooArgSet &extObs) override
RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore * > dstoreList) override
Merge columns of supplied data set(s) with this data set.
static Int_t _defTreeBufSize
RooArgSet _attachedBuffers
! Currently attached buffers (if different from _varsww)
Int_t fill() override
Interface function to TTree::Fill.
double sumEntries() const override
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
bool _defCtor
! Was object constructed with default ctor?
RooAbsArg * addColumn(RooAbsArg &var, bool adjustRange=true) override
Add a new column to the data set which holds the pre-calculated values of 'newVar'.
double weight() const override
Return the weight of the n-th data point (n='index') in memory.
void restoreAlternateBuffers()
void loadValues(const TTree *t, const RooFormulaVar *select=nullptr, const char *rangeName=nullptr, Int_t nStart=0, Int_t nStop=2000000000)
Load values from tree 't' into this data collection, optionally selecting events using the RooFormula...
void append(RooAbsDataStore &other) override
std::span< 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).
const double * _extWgtErrLoArray
! External weight array - low error
void checkInit() const override
std::unique_ptr< std::vector< double > > _weightBuffer
! Buffer for weights in case a batch of values is requested.
const double * _extSumW2Array
! External sum of weights array
void Streamer(TBuffer &) override
Stream an object of class RooTreeDataStore.
RooRealVar * weightVar(const RooArgSet &allVars, const char *wgtName=nullptr)
Utility function for constructors Return pointer to weight variable if it is defined.
const double * _extWgtArray
! External weight array
double _curWgtErrLo
Weight of current event.
bool changeObservableName(const char *from, const char *to) override
Change name of internal observable named 'from' into 'to'.
virtual const RooArgSet * get() const
Buffer base class used for serializing objects.
Describe directory structure in memory.
void GetObject(const char *namecycle, T *&ptr)
Get an object with proper type checking.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
@ kCanDelete
if object in a list can be deleted
@ kMustCleanup
if object destructor must call RecursiveRemove()
const char * Data() const
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
virtual Int_t FlushBaskets(bool create_cluster=true) const
Write to disk all the basket that have not yet been individually written and create an event cluster ...
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
TDirectory * GetDirectory() const
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
virtual Long64_t GetEntries() const
virtual void Reset(Option_t *option="")
Reset baskets, buffers and entries count in all branches and leaves.
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
static uint64_t sum(uint64_t i)