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
52class xRooNode :
public TNamed,
public std::vector<std::shared_ptr<xRooNode>> {
58 static std::map<std::string, std::tuple<std::function<
double(
double,
double,
double)>,
bool>>
auxFunctions;
60 static void SetAuxFunction(
const char *title,
const std::function<
double(
double,
double,
double)> &func,
61 bool symmetrize =
false);
65 static inline bool isNull(
const std::shared_ptr<xRooNode> &
x) {
return x ==
nullptr; }
77 if (
auto x = get<TNamed>();
x) {
81 xRooNode(
const char *
name =
"",
const std::shared_ptr<TObject> &comp =
nullptr,
82 const std::shared_ptr<xRooNode> &parent =
nullptr);
102 xRooNode(
const TObject &comp,
const std::shared_ptr<xRooNode> &parent =
nullptr);
106 xRooNode(
const std::shared_ptr<TObject> &comp,
const std::shared_ptr<xRooNode> &parent =
nullptr);
107 template <
typename T>
109 xRooNode(
const std::shared_ptr<T> &comp,
const std::shared_ptr<xRooNode> &parent =
nullptr)
114 template <
typename T>
120 template <
typename T>
121 xRooNode(
const std::shared_ptr<const T> &comp,
const std::shared_ptr<xRooNode> &parent =
nullptr)
122 :
xRooNode(std::dynamic_pointer_cast<
TObject>(std::const_pointer_cast<T>(comp)), parent)
126 template <
typename T>
128 :
xRooNode(std::dynamic_pointer_cast<
TObject>(std::const_pointer_cast<T>(comp)),
138 void SetTitle(
const char *title)
override;
141 const char *GetNodeType()
const;
144 explicit operator bool()
const {
return strlen(GetName()) || get(); }
147 const std::shared_ptr<xRooNode> &
at(
size_t idx,
bool browseResult =
true)
const
150 auto &out = std::vector<std::shared_ptr<xRooNode>>::at(idx);
151 if (browseResult && out)
155 std::shared_ptr<xRooNode> at(
const std::string &
name,
bool browseResult =
true)
const;
159 std::shared_ptr<xRooNode>
160 find(
const std::string &
name,
bool browseResult =
true)
const;
161 bool contains(
const std::string &
name)
const;
164 std::shared_ptr<xRooNode>
operator[](
size_t idx) {
return at(idx); }
165 std::shared_ptr<xRooNode> operator[](
const std::string &
name);
171 : std::vector<std::shared_ptr<
xRooNode>>::const_iterator(itr)
174 std::iterator_traits<const std::shared_ptr<xRooNode> *>::reference
operator*()
const
176 const std::shared_ptr<xRooNode> &out = std::vector<std::shared_ptr<xRooNode>>::const_iterator::operator*();
177 if (out->get() && out->empty()) {
180 return std::vector<std::shared_ptr<xRooNode>>::const_iterator::operator*();
184 const std::vector<std::shared_ptr<xRooNode>>::const_iterator &aa = (*this);
185 const std::vector<std::shared_ptr<xRooNode>>::const_iterator &bb =
b;
190 std::vector<std::shared_ptr<xRooNode>>::const_iterator::operator++();
195 const std::vector<std::shared_ptr<xRooNode>>::const_iterator &aa = (*this);
196 const std::vector<std::shared_ptr<xRooNode>>::const_iterator &bb =
b;
213 void Browse(
TBrowser *
b =
nullptr)
override;
215 bool IsFolder()
const override;
217 const char *GetIconName()
const override;
218 void Inspect()
const override;
224 std::string GetPath()
const;
232 template <
typename T>
235 return dynamic_cast<T *
>(get());
239 template <
typename T>
242 for (
auto &
c : fBrowsables) {
243 if (strcmp(
c->GetName(),
".memory") == 0) {
255 std::shared_ptr<TObject>
256 acquire(
const std::shared_ptr<TObject> &arg,
bool checkFactory =
false,
bool mustBeNew =
false);
259 template <
typename T,
typename... Args>
262 return std::dynamic_pointer_cast<T>(acquire(std::make_shared<T>(std::forward<Args>(args)...)));
265 template <
typename T,
typename T2,
typename... Args>
270 return std::dynamic_pointer_cast<T>(acquire(std::make_shared<T2>(std::forward<Args>(args)...)));
273 template <
typename T,
typename... Args>
276 return std::dynamic_pointer_cast<T>(acquire(std::make_shared<T>(std::forward<Args>(args)...),
false,
true));
279 std::shared_ptr<TObject> getObject(
const std::string &
name,
const std::string &
type =
"")
const;
281 template <
typename T>
284 return std::dynamic_pointer_cast<T>(getObject(
name, T::Class_Name()));
288 xRooNode shallowCopy(
const std::string &
name, std::shared_ptr<xRooNode> parent =
nullptr);
290 std::shared_ptr<TObject> convertForAcquisition(
xRooNode &acquirer,
const char *opt =
"")
const;
308 xRooNode coords(
bool setVals =
true)
const;
327 xRooNode reduced(
const std::string &range =
"",
bool invert =
false)
332 void _Add_(
const char *
name,
const char *opt);
336 void _Vary_(
const char *
what);
340 void _ShowVars_(
bool set =
true);
342 bool _IsShowVars_()
const;
344 void SetHidden(
bool set =
true);
345 bool IsHidden()
const;
354 bool SetContent(
double value);
361 bool SetBinError(
int bin,
double value);
362 bool SetBinContent(
int bin,
double value,
const char *par =
nullptr,
double parVal = 1);
366 void _SetContent_(
double value);
368 void _SetBinContent_(
int bin,
double value,
const char *par =
"",
double parVal = 1);
371 bool SetXaxis(
TAxis *ax);
372 bool SetXaxis(
const char *
name,
const char *title,
int nbins,
double low,
double high);
373 bool SetXaxis(
const char *
name,
const char *title,
int nbins,
const double *bins);
374 bool SetXaxis(
const char *title,
int nbins,
double low,
double high)
376 return SetXaxis(
"xaxis", title, nbins, low, high);
378 bool SetXaxis(
const char *title,
int nbins,
const double *bins) {
return SetXaxis(
"xaxis", title, nbins, bins); }
379 bool SetXaxis(
int nbins,
double low,
double high) {
return SetXaxis(
"xaxis",
"", nbins, low, high); }
380 bool SetXaxis(
int nbins,
const double *bins) {
return SetXaxis(
"xaxis",
"", nbins, bins); }
382 std::shared_ptr<TStyle>
style(
TObject *initObject =
nullptr,
bool autoCreate =
true)
const;
384 TAxis *GetXaxis()
const;
386 double GetBinData(
int bin,
const xRooNode &
data =
"obsData");
387 double GetBinContent(
int bin)
const {
return GetBinContents(bin, bin).at(0); }
388 std::vector<double> GetBinContents(
int binStart = 1,
int binEnd = 0)
const;
389 double GetBinError(
int bin,
const xRooNode &fr =
"")
const;
390 std::vector<double> GetBinErrors(
int binStart = 1,
int binEnd = 0,
const xRooNode &fr =
"")
const;
391 std::pair<double, double> IntegralAndError(
const xRooNode &fr =
"",
const char *rangeName =
nullptr)
const;
394 double GetContent()
const {
return GetBinContent(fBinNumber); }
397 return (fBinNumber == -1) ? IntegralAndError(fr).second : GetBinError(fBinNumber, fr);
402 std::vector<double> contents()
const;
405 xRooNLLVar nll(
const xRooNode &_data, std::initializer_list<RooCmdArg> nllOpts)
const;
409 xRooNode fitResult(
const char *opt =
"")
const;
412 void SetFitResult(
const xRooNode &fr);
415 generate(
const xRooNode &fr =
"",
bool expected =
false,
419 void _fit_(
const char *constParValues =
"");
421 void _generate_(
const char *
name =
"",
bool expected =
false);
423 void _scan_(
const char *
what =
"plr",
double nToys = 0,
const char *xvar =
"",
int nPointsX = 0,
double lowX = 0,
425 const char *constParValues =
"");
442 void Checked(
TObject *obj,
bool val);
451 TH1 *BuildHistogram(
RooAbsLValue *
v =
nullptr,
bool empty =
false,
bool errors =
false,
int binStart = 1,
452 int binEnd = 0,
const xRooNode &fr =
"")
const;
463 static void Interactive_PLLPlot();
464 static void Interactive_Pull();
472 mutable std::shared_ptr<TObject>
fComp;
478 void SetRange(
const char *range,
double low = std::numeric_limits<double>::quiet_NaN(),
479 double high = std::numeric_limits<double>::quiet_NaN());
484 mutable std::shared_ptr<TAxis>
487 mutable bool fInterrupted =
false;
489 bool fAcquirer =
false;
492 std::shared_ptr<xRooNode> parentPdf()
const;
495 void sterilize()
const;
501 std::shared_ptr<xRooNode> getBrowsable(
const char *
name)
const;
507std::string printValue(
const xRooNode *val);
#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 data
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
void Print(GNN_Data &d, std::string txt="")
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,...
This xRooNLLVar object has several special methods, e.g.
std::iterator_traits< conststd::shared_ptr< xRooNode > * >::reference operator*() const
xRooNodeIterator(std::vector< std::shared_ptr< xRooNode > >::const_iterator itr)
bool operator==(xRooNodeIterator const &b) const
bool operator!=(xRooNodeIterator const &b) const
xRooNodeIterator const & operator++()
The xRooNode class is designed to wrap over a TObject and provide functionality to aid with interacti...
xRooNode(const std::shared_ptr< T > &comp, const xRooNode &parent)
xRooNode _Multiply_(const char *what)
std::vector< std::shared_ptr< xRooNode > > fBrowsables
std::shared_ptr< T > acquire(Args &&...args)
bool SetXaxis(int nbins, double low, double high)
xRooNode(const std::shared_ptr< const T > &comp, const std::shared_ptr< xRooNode > &parent=nullptr)
xRooNode(const std::shared_ptr< T > &comp, const std::shared_ptr< xRooNode > &parent=nullptr)
xRooNode(const TObject &comp, const xRooNode &parent)
xRooNode(const char *type, const char *name, const char *title="")
const std::shared_ptr< xRooNode > & at(size_t idx, bool browseResult=true) const
xRooNLLVar nll(const xRooNode &_data, const RooLinkedList &nllOpts) const
bool SetXaxis(int nbins, const double *bins)
std::shared_ptr< xRooNode > operator[](size_t idx)
double GetContent() const
std::shared_ptr< T > acquireNew(Args &&...args)
std::shared_ptr< T > acquire2(Args &&...args)
std::shared_ptr< T > getObject(const std::string &name) const
bool SetXaxis(const char *title, int nbins, double low, double high)
xRooNode(const std::shared_ptr< const T > &comp, const xRooNode &parent)
std::function< xRooNode(xRooNode *)> fBrowseOperation
static InteractiveObject * gIntObj
std::shared_ptr< xRooNode > fProvider
TObject * operator->() const
std::shared_ptr< TAxis > fXAxis
only here so can have char* GetRange return so can return nullptr for no range set (required for RooC...
static std::map< std::string, std::tuple< std::function< double(double, double, double)>, bool > > auxFunctions
xRooNode(const char *name, const std::shared_ptr< TObject > &comp, const xRooNode &parent)
xRooNode(const char *name, const TObject &comp, const xRooNode &parent)
bool SetContents(const TObject &obj)
std::shared_ptr< TObject > fComp
void SetFitResult(const std::shared_ptr< const RooFitResult > &fr)
double GetData(const xRooNode &data="obsData")
static bool isNull(const std::shared_ptr< xRooNode > &x)
xRooNode(const char *name, const TObject &comp, const std::shared_ptr< xRooNode > &parent)
bool SetContent(double value, const char *par, double parVal=1)
xRooNode(const char *name, const char *title)
double GetBinContent(int bin) const
auto begin() const -> xRooNodeIterator
void SetChecked(bool val=true)
std::shared_ptr< xRooNode > fParent
auto end() const -> xRooNodeIterator
xRooNode _Constrain_(const char *what)
double GetError(const xRooNode &fr="") const
bool SetXaxis(const char *title, int nbins, const double *bins)
bool SetContents(const TObject &obj, const char *par, double parVal)
Abstract base class for RooRealVar binning definitions.
Abstract base class for objects that are lvalues, i.e.
Abstract base class for objects that represent a real value and implements functionality common to al...
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.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
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 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.
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