library: libRooFit #include "RooTreeData.h" |
RooTreeData
class description - source file - inheritance tree (.pdf)
This is an abstract class, constructors will not be documented.
Look at the header to check for available constructors.
private:
void initialize()
protected:
virtual void cacheArgs(RooArgSet& varSet, const RooArgSet* nset = 0)
const TTree& cacheTree() const
void checkInit() const
void createTree(const char* name, const char* title)
Int_t Fill()
Int_t getBranchBufferSize() const
Stat_t GetEntries() const
Int_t GetEntry(Int_t entry = 0, Int_t getall = 0)
void initCache(const RooArgSet& cachedVars)
void loadValues(const RooTreeData* t, RooFormulaVar* select = 0, const char* rangeName = "0", Int_t nStart = 0, Int_t nStop = 2000000000)
void loadValues(const TTree* t, RooFormulaVar* cutVar = 0, const char* rangeName = "0", Int_t nStart = 0, Int_t nStop = 2000000000)
void loadValues(const char* filename, const char* treename, RooFormulaVar* cutVar = 0)
void Reset(Option_t* option = "0")
virtual void resetCache()
Int_t ScanCache(const char* varexp = "", const char* selection = "", Option_t* option = "", Int_t nentries = 1000000000, Int_t firstentry = 0)
virtual void setArgStatus(const RooArgSet& set, Bool_t active)
void setBranchBufferSize(Int_t size)
void treePrint()
public:
virtual ~RooTreeData()
virtual RooAbsArg* addColumn(RooAbsArg& var)
virtual RooArgSet* addColumns(const RooArgList& varList)
static TClass* Class()
void dump()
virtual void fill()
virtual TH1* fillHistogram(TH1* hist, const RooArgList& plotVars, const char* cuts = "", const char* cutRange = "0") const
virtual const RooArgSet* get(Int_t index) const
virtual const RooArgSet* get() const
Bool_t getRange(RooRealVar& var, Double_t& lowest, Double_t& highest) const
virtual TClass* IsA() const
RooRealVar* meanVar(RooRealVar& var, const char* cutSpec = "0", const char* cutRange = "0") const
Double_t moment(RooRealVar& var, Double_t order, Double_t offset = 0, const char* cutSpec = "0", const char* cutRange = "0") const
virtual Int_t numEntries(Bool_t useWeights = kFALSE) const
RooTreeData& operator=(const RooTreeData&)
virtual RooPlot* plotAsymOn(RooPlot* frame, const RooAbsCategoryLValue& asymCat, RooTreeData::PlotOpt o) const
virtual RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const
virtual RooPlot* plotOn(RooPlot* frame, RooTreeData::PlotOpt o) const
virtual void printToStream(ostream& os, RooPrintable::PrintOption opt, TString indent) const
virtual void reset()
RooRealVar* rmsVar(RooRealVar& var, const char* cutSpec = "0", const char* cutRange = "0") const
Int_t Scan(const char* varexp = "", const char* selection = "", Option_t* option = "", Int_t nentries = 1000000000, Int_t firstentry = 0)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual TList* split(const RooAbsCategory& splitCat) const
virtual RooPlot* statOn(RooPlot* frame, const RooCmdArg& arg1 = RooCmdArg::none, const RooCmdArg& arg2 = RooCmdArg::none, const RooCmdArg& arg3 = RooCmdArg::none, const RooCmdArg& arg4 = RooCmdArg::none, const RooCmdArg& arg5 = RooCmdArg::none, const RooCmdArg& arg6 = RooCmdArg::none, const RooCmdArg& arg7 = RooCmdArg::none, const RooCmdArg& arg8 = RooCmdArg::none)
virtual RooPlot* statOn(RooPlot* frame, const char* what, const char* label = "", Int_t sigDigits = 2, Option_t* options = "NELU", Double_t xmin = 0.15, Double_t xmax = 0.65, Double_t ymax = 0.85, const char* cutSpec = "0", const char* cutRange = "0", const RooCmdArg* formatCmd = 0)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
virtual Roo1DTable* table(const RooAbsCategory& cat, const char* cuts = "", const char* opts = "") const
const TTree& tree() const
protected:
TTree* _tree TTree holding the data points
TTree* _cacheTree ! TTree holding the cached function values
Bool_t _defCtor ! Was object constructed with default ctor?
RooArgSet _truth Truth variables
TString _blindString Blinding string (optionally read from ASCII files)
static Int_t _defTreeBufSize
void createTree(const char* name, const char* title)
Create TTree object that lives in memory, independent of current
location of gDirectory
~RooTreeData()
Destructor
void initialize()
Attach variables of internal ArgSet
to the corresponding TTree branches
void initCache(const RooArgSet& cachedVars)
Initialize cache of dataset: attach variables of cache ArgSet
to the corresponding TTree branches
void loadValues(const char *filename, const char *treename,
RooFormulaVar* cutVar)
Load TTree name 'treename' from file 'filename' and pass call
to loadValue(TTree*,...)
void loadValues(const RooTreeData *t, RooFormulaVar* select,
const char* rangeName, Int_t nStart, Int_t nStop)
Load values from dataset 't' into this data collection, optionally
selecting events using 'select' RooFormulaVar
void loadValues(const TTree *t, RooFormulaVar* select, const char* /*rangeName*/, Int_t /*nStart*/, Int_t /*nStop*/)
Load values from tree 't' into this data collection, optionally
selecting events using 'select' RooFormulaVar
The source tree 't' is first clone as not disturb its branch
structure when retrieving information from it.
void dump()
DEBUG: Dump contents
void resetCache()
Reset the cache
void setArgStatus(const RooArgSet& set, Bool_t active)
void cacheArgs(RooArgSet& newVarSet, const RooArgSet* nset)
Cache given RooAbsArgs with this tree: The tree is
given direct write access of the args internal cache
the args values is pre-calculated for all data points
in this data collection. Upon a get() call, the
internal cache of 'newVar' will be loaded with the
precalculated value and it's dirty flag will be cleared.
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 its coordinates.
RooAbsArg* addColumn(RooAbsArg& newVar)
Add a new column to the data set which holds the pre-calculated values
of 'newVar'. This operation is only meaningful if 'newVar' is a derived
value.
The return value points to the added element holding 'newVar's value
in the data collection. The element is always the corresponding fundamental
type of 'newVar' (e.g. a RooRealVar if 'newVar' is a RooFormulaVar)
Note: This function is explicitly NOT intended as a speed optimization
opportunity for the user. Components of complex PDFs that can be
precalculated with the dataset are automatically identified as such
and will be precalculated when fitting to a dataset
By forcibly precalculating functions with non-trivial Jacobians,
or functions of multiple variables occurring in the data set,
using addColumn(), you may alter the outcome of the fit.
Only in cases where such a modification of fit behaviour is intentional,
this function should be used. (E.g collapsing a continuous B0 flavour
probability into a 2-state B0/B0bar category)
RooArgSet* addColumns(const RooArgList& varList)
TList* split(const RooAbsCategory& splitCat) const
Sanity check
RooPlot* plotOn(RooPlot* frame, const RooLinkedList& argList) const
Plot dataset on specified frame. By default an unbinned dataset will use the default binning of
the target frame. A binned dataset will by default retain its intrinsic binning.
The following optional named arguments can be used to modify the default behavior
Data representation options
---------------------------
Asymmetry(const RooCategory& c) -- Show the asymmetry of the daya in given two-state category [F(+)-F(-)] / [F(+)+F(-)].
Category must have two states with indices -1 and +1 or three states with indeces -1,0 and +1.
ErrorType(RooAbsData::EType) -- Select the type of error drawn: Poisson (default) draws asymmetric Poisson
confidence intervals. SumW2 draws symmetric sum-of-weights error
Binning(double xlo, double xhi, -- Use specified binning to draw dataset
int nbins)
Binning(const RooAbsBinning&) -- Use specified binning to draw dataset
Binning(const char* name) -- Use binning with specified name to draw dataset
RefreshNorm(Bool_t flag) -- Force refreshing for PDF normalization information in frame.
If set, any subsequent PDF will normalize to this dataset, even if it is
not the first one added to the frame. By default only the 1st dataset
added to a frame will update the normalization information
Histogram drawing options
-------------------------
DrawOption(const char* opt) -- Select ROOT draw option for resulting TGraph object
LineStyle(Int_t style) -- Select line style by ROOT line style code, default is solid
LineColor(Int_t color) -- Select line color by ROOT color code, default is black
LineWidth(Int_t width) -- Select line with in pixels, default is 3
MarkerStyle(Int_t style) -- Select the ROOT marker style, default is 21
MarkerColor(Int_t color) -- Select the ROOT marker color, default is black
MarkerSize(Double_t size) -- Select the ROOT marker size
XErrorSize(Double_t frac) -- Select size of X error bar as fraction of the bin width, default is 1
Misc. other options
-------------------
Name(const chat* name) -- Give curve specified name in frame. Useful if curve is to be referenced later
Invisble(Bool_t flag) -- Add curve to frame, but do not display. Useful in combination AddTo()
AddTo(const char* name, -- Add constructed histogram to already existing histogram with given name and relative weight factors
double_t wgtSelf, double_t wgtOther)
RooPlot* plotOn(RooPlot *frame, PlotOpt o) const
Create and fill a histogram of the frame's variable and append it to the frame.
The frame variable must be one of the data sets dimensions.
The plot range and the number of plot bins is determined by the parameters
of the plot variable of the frame (RooAbsReal::setPlotRange(), RooAbsReal::setPlotBins())
The optional cut string expression can be used to select the events to be plotted.
The cut specification may refer to any variable contained in the data set
The drawOptions are passed to the TH1::Draw() method
RooPlot* plotAsymOn(RooPlot* frame, const RooAbsCategoryLValue& asymCat, PlotOpt o) const
Create and fill a histogram with the asymmetry N[+] - N[-] / ( N[+] + N[-] ),
where N(+/-) is the number of data points with asymCat=+1 and asymCat=-1
as function of the frames variable. The asymmetry category 'asymCat' must
have exactly 2 (or 3) states defined with index values +1,-1 (and 0)
The plot range and the number of plot bins is determined by the parameters
of the plot variable of the frame (RooAbsReal::setPlotRange(), RooAbsReal::setPlotBins())
The optional cut string expression can be used to select the events to be plotted.
The cut specification may refer to any variable contained in the data set
The drawOptions are passed to the TH1::Draw() method
TH1* fillHistogram(TH1 *hist, const RooArgList &plotVars, const char *cuts, const char* cutRange) const
Loop over columns of our tree data and fill the input histogram. Returns a pointer to the
input histogram, or zero in case of an error. The input histogram can be any TH1 subclass, and
therefore of arbitrary dimension. Variables are matched with the (x,y,...) dimensions of the input
histogram according to the order in which they appear in the input plotVars list.
Roo1DTable* table(const RooAbsCategory& cat, const char* cuts, const char* /*opts*/) const
Create and fill a 1-dimensional table for given category column
This functions is the equivalent of plotOn() for category dimensions.
The optional cut string expression can be used to select the events to be tabulated
The cut specification may refer to any variable contained in the data set
The option string is currently not used
Double_t moment(RooRealVar &var, Double_t order, Double_t offset, const char* cutSpec, const char* cutRange) const
Lookup variable in dataset
RooRealVar* meanVar(RooRealVar &var, const char* cutSpec, const char* cutRange) const
Create a new variable with appropriate strings. The error is calculated as
RMS/Sqrt(N) which is generally valid.
RooRealVar* rmsVar(RooRealVar &var, const char* cutSpec, const char* cutRange) const
Create a new variable with appropriate strings. The error is calculated as
RMS/(2*Sqrt(N)) which is only valid if the variable has a Gaussian distribution.
Bool_t getRange(RooRealVar& var, Double_t& lowest, Double_t& highest) const
Lookup variable in dataset
RooPlot* statOn(RooPlot* frame, const RooCmdArg& arg1, const RooCmdArg& arg2,
const RooCmdArg& arg3, const RooCmdArg& arg4, const RooCmdArg& arg5,
const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)
Add a box with statistics information to the specified frame. By default a box with the
event count, mean and rms of the plotted variable is added.
The following optional named arguments are accepted
What(const char* whatstr) -- Controls what is printed: "N" = count, "M" is mean, "R" is RMS.
Format(const char* optStr) -- Classing [arameter formatting options, provided for backward compatibility
Format(const char* what,...) -- Parameter formatting options, details given below
Label(const chat* label) -- Add header label to parameter box
Layout(Double_t xmin, -- Specify relative position of left,right side of box and top of box. Position of
Double_t xmax, Double_t ymax) bottom of box is calculated automatically from number lines in box
Cut(const char* expression) -- Apply given cut expression to data when calculating statistics
CutRange(const char* rangeName) -- Only consider events within given range when calculating statistics. Multiple
CutRange() argument may be specified to combine ranges
The Format(const char* what,...) has the following structure
const char* what -- Controls what is shown. "N" adds name, "E" adds error,
"A" shows asymmetric error, "U" shows unit, "H" hides the value
FixedPrecision(int n) -- Controls precision, set fixed number of digits
AutoPrecision(int n) -- Controls precision. Number of shown digits is calculated from error
+ n specified additional digits (1 is sensible default)
VerbatimName(Bool_t flag) -- Put variable name in a \verb+ + clause.
RooPlot* statOn(RooPlot* frame, const char* what, const char *label, Int_t sigDigits,
Option_t *options, Double_t xmin, Double_t xmax, Double_t ymax,
const char* cutSpec, const char* cutRange, const RooCmdArg* formatCmd)
Int_t numEntries(Bool_t) const
void printToStream(ostream& os, PrintOption opt, TString indent) const
Print info about this dataset to the specified output stream.
Standard: number of entries
Shape: list of variables we define & were generated with
Inline Functions
void fill()
const RooArgSet* get() const
void reset()
Int_t Scan(const char* varexp = "", const char* selection = "", Option_t* option = "", Int_t nentries = 1000000000, Int_t firstentry = 0)
const TTree& tree() const
Int_t ScanCache(const char* varexp = "", const char* selection = "", Option_t* option = "", Int_t nentries = 1000000000, Int_t firstentry = 0)
const TTree& cacheTree() const
Stat_t GetEntries() const
void Reset(Option_t* option = "0")
Int_t Fill()
Int_t GetEntry(Int_t entry = 0, Int_t getall = 0)
void treePrint()
void setBranchBufferSize(Int_t size)
Int_t getBranchBufferSize() const
void checkInit() const
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
RooTreeData& operator=(const RooTreeData&)
Last update: Tue Jun 28 18:15:40 2005
Copyright (c) 2000-2005, Regents of the University of California *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.