15#ifdef XROOFIT_USE_PRAGMA_ONCE
18#if !defined(XROOFIT_XROONODE_H) || defined(XROOFIT_USE_PRAGMA_ONCE)
19#ifndef XROOFIT_USE_PRAGMA_ONCE
20#define XROOFIT_XROONODE_H
51class xRooNode :
public TNamed,
public std::vector<std::shared_ptr<xRooNode>> {
57 static std::map<std::string, std::tuple<std::function<
double(
double,
double,
double)>,
bool>>
auxFunctions;
58 static void SetAuxFunction(
const char *title,
const std::function<
double(
double,
double,
double)> &func,
59 bool symmetrize =
false);
62 static inline bool isNull(
const std::shared_ptr<xRooNode> &
x) {
return x ==
nullptr; }
72 if (
auto x = get<TNamed>();
x) {
76 xRooNode(
const char *
name =
"",
const std::shared_ptr<TObject> &comp =
nullptr,
77 const std::shared_ptr<xRooNode> &parent =
nullptr);
91 xRooNode(
const TObject &comp,
const std::shared_ptr<xRooNode> &parent =
nullptr);
93 xRooNode(
const std::shared_ptr<TObject> &comp,
const std::shared_ptr<xRooNode> &parent =
nullptr);
95 xRooNode(
const std::shared_ptr<T> &comp,
const std::shared_ptr<xRooNode> &parent =
nullptr)
104 template <
typename T>
105 xRooNode(
const std::shared_ptr<const T> &comp,
const std::shared_ptr<xRooNode> &parent =
nullptr)
106 :
xRooNode(std::dynamic_pointer_cast<
TObject>(std::const_pointer_cast<T>(comp)), parent)
109 template <
typename T>
111 :
xRooNode(std::dynamic_pointer_cast<
TObject>(std::const_pointer_cast<T>(comp)),
122 if (
auto o = (get<TNamed>()); o)
127 const char *GetNodeType()
const;
129 explicit operator bool()
const {
return strlen(GetName()) || get(); }
132 const std::shared_ptr<xRooNode> &
at(
size_t idx,
bool browseResult =
true)
const
135 auto &out = std::vector<std::shared_ptr<xRooNode>>::at(idx);
136 if (browseResult && out)
140 std::shared_ptr<xRooNode> at(
const std::string &
name,
bool browseResult =
true)
const;
144 std::shared_ptr<xRooNode> find(
const std::string &
name)
const;
145 bool contains(
const std::string &
name)
const;
148 std::shared_ptr<xRooNode>
operator[](
size_t idx) {
return at(idx); }
149 std::shared_ptr<xRooNode> operator[](
const std::string &
name);
152 auto begin() const -> decltype(std::vector<std::shared_ptr<
xRooNode>>::begin())
154 return std::vector<std::shared_ptr<xRooNode>>::begin();
156 auto end() const -> decltype(std::vector<std::shared_ptr<
xRooNode>>::end())
158 return std::vector<std::shared_ptr<xRooNode>>::end();
161 void Browse(
TBrowser *
b =
nullptr)
override;
162 bool IsFolder()
const override;
163 const char *GetIconName()
const override;
164 void Inspect()
const override;
168 std::string GetPath()
const;
169 void Print(
Option_t *opt =
"")
const override;
176 template <
typename T>
179 return dynamic_cast<T *
>(get());
185 std::shared_ptr<TObject>
186 acquire(
const std::shared_ptr<TObject> &arg,
bool checkFactory =
false,
bool mustBeNew =
false);
188 template <
typename T,
typename... Args>
191 return std::dynamic_pointer_cast<T>(acquire(std::make_shared<T>(std::forward<Args>(args)...)));
193 template <
typename T,
typename... Args>
196 return std::dynamic_pointer_cast<T>(acquire(std::make_shared<T>(std::forward<Args>(args)...),
false,
true));
198 std::shared_ptr<TObject> getObject(
const std::string &
name,
const std::string &
type =
"")
const;
199 template <
typename T>
202 return std::dynamic_pointer_cast<T>(getObject(
name, T::Class_Name()));
205 xRooNode shallowCopy(
const std::string &
name, std::shared_ptr<xRooNode> parent =
nullptr);
207 std::shared_ptr<TObject> convertForAcquisition(
xRooNode &acquirer,
const char *opt =
"")
const;
225 xRooNode coords(
bool setVals =
true)
const;
243 xRooNode reduced(
const std::string &range =
"")
247 void _Add_(
const char *
name,
const char *opt);
249 void _Vary_(
const char *
what);
253 bool _IsShowVars_()
const;
256 bool IsHidden()
const;
263 bool SetContents(
double value);
270 bool SetBinError(
int bin,
double value);
271 bool SetBinContent(
int bin,
double value,
const char *par =
nullptr,
double parVal = 1);
272 bool SetBinData(
int bin,
double value,
const char *dataName =
"obsData");
274 void _SetContents_(
double value);
275 void _SetBinContent_(
int bin,
double value,
const char *par =
"",
double parVal = 1);
278 bool SetXaxis(
const char *
name,
const char *title,
int nbins,
double low,
double high);
279 bool SetXaxis(
const char *
name,
const char *title,
int nbins,
double *bins);
280 bool SetXaxis(
const char *title,
int nbins,
double low,
double high)
282 return SetXaxis(
"xaxis", title, nbins, low, high);
284 bool SetXaxis(
const char *title,
int nbins,
double *bins) {
return SetXaxis(
"xaxis", title, nbins, bins); }
285 bool SetXaxis(
int nbins,
double low,
double high) {
return SetXaxis(
"xaxis",
"", nbins, low, high); }
288 std::shared_ptr<TStyle>
style(
TObject *initObject =
nullptr)
const;
290 TAxis *GetXaxis()
const;
292 double GetBinData(
int bin,
const char *dataName =
"obsData");
293 double GetBinContent(
int bin)
const {
return GetBinContents(bin, bin).at(0); }
294 std::vector<double> GetBinContents(
int binStart = 1,
int binEnd = 0)
const;
295 double GetBinError(
int bin,
const xRooNode &fr =
"")
const;
296 std::vector<double> GetBinErrors(
int binStart = 1,
int binEnd = 0,
const xRooNode &fr =
"")
const;
297 std::pair<double, double> IntegralAndError(
const xRooNode &fr =
"",
const char *rangeName =
nullptr)
const;
303 xRooNLLVar nll(
const xRooNode &_data, std::initializer_list<RooCmdArg> nllOpts)
const;
307 xRooNode fitResult(
const char *opt =
"")
const;
310 void SetFitResult(
const xRooNode &fr);
312 void _fitTo_(
const char *datasetName =
"",
const char *constParValues =
"");
313 void _generate_(
const char *
name =
"",
bool expected =
false);
330 void Checked(
TObject *obj,
bool val);
334 TH1 *BuildHistogram(
RooAbsLValue *
v =
nullptr,
bool empty =
false,
bool errors =
false,
int binStart = 1,
335 int binEnd = 0)
const;
344 static void Interactive_PLLPlot();
345 static void Interactive_Pull();
353 mutable std::shared_ptr<TObject>
fComp;
357 std::string fFolder =
"";
359 void SetRange(
const char *range,
double low = std::numeric_limits<double>::quiet_NaN(),
360 double high = std::numeric_limits<double>::quiet_NaN());
365 mutable std::shared_ptr<TAxis>
368 mutable bool fInterrupted =
false;
370 bool fAcquirer =
false;
373 std::shared_ptr<xRooNode> parentPdf()
const;
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
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 filename
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 np
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 child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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 type
Binding & operator=(OUT(*fun)(void))
static void GetRange(const char *comments, Double_t &xmin, Double_t &xmax, Double_t &factor)
Parse comments to search for a range specifier of the style: [xmin,xmax] or [xmin,...
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Abstract base class for objects that are lvalues, i.e.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
bool SetXaxis(int nbins, double low, double high)
void SetTitle(const char *title) override
Set the title of the TNamed.
bool SetXaxis(const char *title, int nbins, double low, double high)
xRooNode(const char *name, const TObject &comp, const std::shared_ptr< xRooNode > &parent)
auto end() const -> decltype(std::vector< std::shared_ptr< xRooNode > >::end())
bool SetXaxis(const char *title, int nbins, double *bins)
std::shared_ptr< TAxis > fXAxis
only here so can have char* GetRange return so can return nullptr for no range set (required for RooC...
xRooNode _Constrain_(const char *what)
std::shared_ptr< T > acquireNew(Args &&...args)
std::shared_ptr< T > acquire(Args &&...args)
xRooNode(const TObject &comp, const xRooNode &parent)
xRooNode(const std::shared_ptr< const T > &comp, const std::shared_ptr< xRooNode > &parent=nullptr)
xRooNLLVar nll(const xRooNode &_data, const RooLinkedList &nllOpts) const
bool SetContents(double value, const char *par, double parVal=1)
const std::shared_ptr< xRooNode > & at(size_t idx, bool browseResult=true) const
xRooNode(const char *name, const std::shared_ptr< TObject > &comp, const xRooNode &parent)
bool SetXaxis(int nbins, double *bins)
bool SetContents(const TObject &obj, const char *par, double parVal)
void SetFitResult(const std::shared_ptr< const RooFitResult > &fr)
auto begin() const -> decltype(std::vector< std::shared_ptr< xRooNode > >::begin())
xRooNode(const char *name, const TObject &comp, const xRooNode &parent)
std::shared_ptr< xRooNode > fProvider
std::shared_ptr< T > getObject(const std::string &name) const
static InteractiveObject * gIntObj
std::shared_ptr< TObject > fComp
double GetContent() const
static std::map< std::string, std::tuple< std::function< double(double, double, double)>, bool > > auxFunctions
xRooNode(const std::shared_ptr< T > &comp, const std::shared_ptr< xRooNode > &parent=nullptr)
bool SetContents(const TObject &obj)
xRooNode(const std::shared_ptr< T > &comp, const xRooNode &parent)
TObject * operator->() const
std::vector< std::shared_ptr< xRooNode > > fBrowsables
xRooNode(const char *name, const char *title)
std::shared_ptr< xRooNode > operator[](size_t idx)
xRooNode(const std::shared_ptr< const T > &comp, const xRooNode &parent)
xRooNode(const char *type, const char *name, const char *title="")
static bool isNull(const std::shared_ptr< xRooNode > &x)
std::function< xRooNode(xRooNode *)> fBrowseOperation
void SetChecked(bool val=true)
double GetBinContent(int bin) const
xRooNode _Multiply_(const char *what)
std::shared_ptr< xRooNode > fParent
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
The RooWorkspace is a persistable container for RooFit projects.
Class to manage histogram axis.
Using a TBrowser one can browse all ROOT objects.
A list tree is a widget that can contain a number of items arranged in a tree structure.
A TGraph is an object made of two arrays X and Y with npoints each.
TH1 is the base class of all histogram classes in ROOT.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Mother of all ROOT objects.
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
TStyle objects may be created to define special styles.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
RooCmdArg Constrain(const RooArgSet ¶ms)
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
#define BEGIN_XROOFIT_NAMESPACE
#define END_XROOFIT_NAMESPACE