Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
xRooNode.h
Go to the documentation of this file.
1/*
2 * Project: xRooFit
3 * Author:
4 * Will Buttinger, RAL 2022
5 *
6 * Copyright (c) 2022, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13#include "Config.h"
14
15#ifdef XROOFIT_USE_PRAGMA_ONCE
16#pragma once
17#endif
18#if !defined(XROOFIT_XROONODE_H) || defined(XROOFIT_USE_PRAGMA_ONCE)
19#ifndef XROOFIT_USE_PRAGMA_ONCE
20#define XROOFIT_XROONODE_H
21#endif
22
23#include "TNamed.h"
24#include <vector>
25#include <functional>
26
27class RooWorkspace;
28class RooAbsReal;
29class TH1;
30class RooAbsLValue;
31class RooArgList;
32class RooAbsBinning;
33class RooFitResult;
34class TGraph;
35class TAxis;
36class TGListTreeItem;
37class TGListTree;
38class TVirtualPad;
39class TStyle;
40
41#include "xRooFit.h"
42#include "RooLinkedList.h"
43#include "RooCmdArg.h"
44#include "TQObject.h"
45#include "TMatrixDSym.h"
46
48
49class xRooNode;
50class xRooNLLVar;
51
52class xRooNode : public TNamed, public std::vector<std::shared_ptr<xRooNode>> {
53
54public:
55 // functions of form value = f(orig,nom,nom_err)
56 // e.g. f = ratio would be simply orig/nom
57 // bool indicates if should be symmetrized
58 static std::map<std::string, std::tuple<std::function<double(double, double, double)>, bool>> auxFunctions;
59 /** @private */
60 static void SetAuxFunction(const char *title, const std::function<double(double, double, double)> &func,
61 bool symmetrize = false);
62
63 // this function is here because couldn't figure out how to check a null shared_ptr in pyroot
64 /** @private */
65 static inline bool isNull(const std::shared_ptr<xRooNode> &x) { return x == nullptr; }
66
67 // name of the node needn't match the name of the component that it points to
68 // the name of the node is how it is identified inside its parent
69 // In c++17 for constructors with a Node2& parent, could look at using shared_from_this and if it throws except then
70 // construct make_shared<Node2>(parent)
71 xRooNode(const char *type, const char *name, const char *title = "");
72
73 /** @private */
74 template <typename T>
75 xRooNode(const char *name, const char *title) : TNamed(name, title), fComp(std::make_shared<T>())
76 {
77 if (auto x = get<TNamed>(); x) {
78 x->SetNameTitle(name, title);
79 }
80 }
81 xRooNode(const char *name = "", const std::shared_ptr<TObject> &comp = nullptr,
82 const std::shared_ptr<xRooNode> &parent = nullptr);
83
84 /** @private */
85 xRooNode(const char *name, const std::shared_ptr<TObject> &comp, const xRooNode &parent)
86 : xRooNode(name, comp, std::make_shared<xRooNode>(parent))
87 {
88 }
89
90 /** @private */
91 xRooNode(const char *name, const TObject &comp, const std::shared_ptr<xRooNode> &parent)
92 : xRooNode(name, std::shared_ptr<TObject>(const_cast<TObject *>(&comp), [](TObject *) {}), parent)
93 {
94 } // needed to ensure passing a shared_ptr<Node2> for the parent doesnt become Node2(shared_ptr<Node2>) as parent
95 // because of Node2(shared_ptr<TObject>) constructor
96 /** @private */
97 xRooNode(const char *name, const TObject &comp, const xRooNode &parent)
98 : xRooNode(name, std::shared_ptr<TObject>(const_cast<TObject *>(&comp), [](TObject *) {}), parent)
99 {
100 }
101 /** @private */
102 xRooNode(const TObject &comp, const std::shared_ptr<xRooNode> &parent = nullptr);
103 /** @private */
104 xRooNode(const TObject &comp, const xRooNode &parent) : xRooNode(comp, std::make_shared<xRooNode>(parent)) {}
105 /** @private */
106 xRooNode(const std::shared_ptr<TObject> &comp, const std::shared_ptr<xRooNode> &parent = nullptr);
107 template <typename T>
108 /** @private */
109 xRooNode(const std::shared_ptr<T> &comp, const std::shared_ptr<xRooNode> &parent = nullptr)
110 : xRooNode(std::dynamic_pointer_cast<TObject>(comp), parent)
111 {
112 }
113 /** @private */
114 template <typename T>
115 xRooNode(const std::shared_ptr<T> &comp, const xRooNode &parent)
117 {
118 }
119 /** @private */
120 template <typename T>
121 xRooNode(const std::shared_ptr<const T> &comp, const std::shared_ptr<xRooNode> &parent = nullptr)
123 {
124 }
125 /** @private */
126 template <typename T>
127 xRooNode(const std::shared_ptr<const T> &comp, const xRooNode &parent)
129 std::make_shared<xRooNode>(parent))
130 {
131 }
132 /** @private */
133 xRooNode(double value);
134
135 ~xRooNode() override;
136
137 void SetName(const char *name) override; // *MENU*
138 void SetTitle(const char *title) override; // *MENU*
139
140 /** @private */
141 const char *GetNodeType() const;
142
143 /** @private */
144 explicit operator bool() const { return strlen(GetName()) || get(); } // the 'null' Component is the empty string
145
146 // at doesn't do an initial browse of the object, unlike [] operator
147 const std::shared_ptr<xRooNode> &at(size_t idx, bool browseResult = true) const
148 {
149 IsFolder();
150 auto &out = std::vector<std::shared_ptr<xRooNode>>::at(idx);
151 if (browseResult && out)
152 out->browse();
153 return out;
154 }
155 std::shared_ptr<xRooNode> at(const std::string &name, bool browseResult = true) const;
156
157 RooArgList argList() const;
158
159 std::shared_ptr<xRooNode>
160 find(const std::string &name, bool browseResult = true) const; // same as at but return nullptr if not found
161 bool contains(const std::string &name) const; // doesn't trigger a browse of the found object, unlike find
162
163 // most users should use these methods: will do an initial browse and will browse the returned object too
164 std::shared_ptr<xRooNode> operator[](size_t idx) { return at(idx); }
165 std::shared_ptr<xRooNode> operator[](const std::string &name); // will create a new node if not existing, unlike 'at'
166
167 // custom iterator to ensure children are auto-browsed as we iterate through
168 class xRooNodeIterator : public std::vector<std::shared_ptr<xRooNode>>::const_iterator {
169 public:
170 xRooNodeIterator(std::vector<std::shared_ptr<xRooNode>>::const_iterator itr)
171 : std::vector<std::shared_ptr<xRooNode>>::const_iterator(itr)
172 {
173 }
174 std::iterator_traits<const std::shared_ptr<xRooNode> *>::reference operator*() const
175 {
176 const std::shared_ptr<xRooNode> &out = std::vector<std::shared_ptr<xRooNode>>::const_iterator::operator*();
177 if (out->get() && out->empty()) {
178 out->browse();
179 }
180 return std::vector<std::shared_ptr<xRooNode>>::const_iterator::operator*();
181 }
182 bool operator!=(xRooNodeIterator const &b) const
183 {
184 const std::vector<std::shared_ptr<xRooNode>>::const_iterator &aa = (*this);
185 const std::vector<std::shared_ptr<xRooNode>>::const_iterator &bb = b;
186 return aa != bb;
187 };
189 {
190 std::vector<std::shared_ptr<xRooNode>>::const_iterator::operator++();
191 return *this;
192 }
193 bool operator==(xRooNodeIterator const &b) const
194 {
195 const std::vector<std::shared_ptr<xRooNode>>::const_iterator &aa = (*this);
196 const std::vector<std::shared_ptr<xRooNode>>::const_iterator &bb = b;
197 return aa == bb;
198 };
199 };
201 {
202 // this update is to resolve need for calling browse() before iterating, e.g.
203 // for(auto a : xRooNode(b).browse()) ...
204 // can now become the more natural:
205 // for(auto a : xRooNode(b)) ...
206 // but would still need e.g. xRooNode(s).browse().size() rather than xRooNode(s).size() which would give 0 for
207 // unpopulated case
208 static bool browseLock =
209 false; // need for blocking recursive calls to browse (since browse method uses the iterators)
210 if (!browseLock && get() && empty()) {
211 browseLock = true;
212 const_cast<xRooNode &>(*this).browse();
213 browseLock = false;
214 }
215 return xRooNodeIterator(std::vector<std::shared_ptr<xRooNode>>::begin());
216 }
217 auto end() const -> xRooNodeIterator { return xRooNodeIterator(std::vector<std::shared_ptr<xRooNode>>::end()); }
218
219 // needed in pyROOT to avoid it creating iterators that follow the 'get' to death
220 // auto begin() const -> decltype(std::vector<std::shared_ptr<xRooNode>>::begin())
221 // {
222 // return std::vector<std::shared_ptr<xRooNode>>::begin();
223 // }
224 // auto end() const -> decltype(std::vector<std::shared_ptr<xRooNode>>::end())
225 // {
226 // return std::vector<std::shared_ptr<xRooNode>>::end();
227 // }
228
229 void Browse(TBrowser *b = nullptr) override; // will browse the children that aren't "null" nodes
230 /** @private */
231 bool IsFolder() const override;
232 /** @private */
233 const char *GetIconName() const override;
234 void Inspect() const override; // *MENU*
235
236 /** @private */
237 xRooNode &browse(); // refreshes child nodes
238
239 /** @private */
240 std::string GetPath() const;
241 void Print(Option_t *opt = "") const override; // *MENU*
242 // void Reverse() {
243 // std::reverse(std::vector<std::shared_ptr<Node2>>::begin(),std::vector<std::shared_ptr<Node2>>::end()); } // *MENU*
244
245 xRooNode &operator=(const TObject &o);
246
247 TObject *get() const { return fComp.get(); }
248 template <typename T>
249 T *get() const
250 {
251 return dynamic_cast<T *>(get());
252 }
253 /** @private */
254 TObject *xget() const { return xget<TObject>(); }
255 template <typename T>
256 T *xget() const
257 {
258 for (auto &c : fBrowsables) {
259 if (strcmp(c->GetName(), ".memory") == 0) {
260 return c->get<T>();
261 }
262 }
263 return nullptr;
264 }
265
266 TObject *operator->() const { return get(); }
267
268 RooWorkspace *ws() const;
269
270 /** @private */
271 std::shared_ptr<TObject>
272 acquire(const std::shared_ptr<TObject> &arg, bool checkFactory = false, bool mustBeNew = false);
273 // common pattern for 'creating' an acquired object
274 /** @private */
275 template <typename T, typename... Args>
276 std::shared_ptr<T> acquire(Args &&...args)
277 {
278 return std::dynamic_pointer_cast<T>(acquire(std::make_shared<T>(std::forward<Args>(args)...)));
279 }
280 /** @private */
281 template <typename T, typename T2, typename... Args>
282 // looser version of above ... first template type says what type to return
283 // allows returning different type to the one requested in T2 (e.g. ok to get RooConstVar when acquire a RooRealVar)
284 std::shared_ptr<T> acquire2(Args &&...args)
285 {
286 return std::dynamic_pointer_cast<T>(acquire(std::make_shared<T2>(std::forward<Args>(args)...)));
287 }
288 /** @private */
289 template <typename T, typename... Args>
290 std::shared_ptr<T> acquireNew(Args &&...args)
291 {
292 return std::dynamic_pointer_cast<T>(acquire(std::make_shared<T>(std::forward<Args>(args)...), false, true));
293 }
294 /** @private */
295 std::shared_ptr<TObject> getObject(const std::string &name, const std::string &type = "") const;
296 /** @private */
297 template <typename T>
298 std::shared_ptr<T> getObject(const std::string &name) const
299 {
300 return std::dynamic_pointer_cast<T>(getObject(name, T::Class_Name()));
301 }
302
303 /** @private */
304 xRooNode shallowCopy(const std::string &name, std::shared_ptr<xRooNode> parent = nullptr);
305 /** @private */
306 std::shared_ptr<TObject> convertForAcquisition(xRooNode &acquirer, const char *opt = "") const;
307
308 xRooNode vars() const; // obs,pars
309 xRooNode obs() const; // robs and globs
310 xRooNode robs() const; // just the regular obs
311 xRooNode globs() const; // just the global obs
312 xRooNode pars() const; // poi, np, and pp (prespecified pars)
313 xRooNode floats() const; // float poi or np
314 xRooNode consts() const; // just const poi or np
315
316 xRooNode poi() const; // parameters of interest
317 xRooNode np() const; // nuisance parameters (non-poi floatables)
318 xRooNode pp() const; // preset/prespecified parameters
319
320 xRooNode components() const; // additive children
321 xRooNode factors() const; // multiplicative children
322 xRooNode variations() const; // interpolated children (are bins a form of variation?)
323 xRooNode coefs(bool recurse = false) const;
324 xRooNode coords(bool setVals = true) const; // will move to the coords in the process if setVals=true
325 xRooNode bins() const;
326
327 xRooNode constraints() const; // pdfs other than the node's parent pdf where the deps of this node appear
328 xRooNode datasets()
329 const; // datasets corresponding to this pdf (parent nodes that do observable selections automatically applied)
330
331 xRooNode parents() const; // the clients of this node
332 xRooNode args() const; // all the nodes underneath this node
333
334 xRooNode Replace(const xRooNode &node); // use to replace a node in the tree at the location of this node
335 xRooNode Remove(const xRooNode &child);
337 Add(const xRooNode &child,
338 Option_t *opt =
339 ""); // = components()[child.GetName()]=child; although need to handle case of adding same term multiple times
340 xRooNode Multiply(const xRooNode &child, Option_t *opt = ""); // = factors()[child.GetName()]=child;
341 xRooNode Vary(const xRooNode &child);
342 xRooNode Constrain(const xRooNode &child);
343
344 xRooNode Combine(const xRooNode &rhs, bool silent = false); // combine rhs with this node
345
346 xRooNode reduced(const std::string &range = "", bool invert = false)
347 const; // return a node representing reduced version of this node, will use the SetRange to reduce if blank
348 xRooNode reduced(const std::function<bool(const xRooNode &)> selector) const;
349
350 // following versions are for the menu in the GUI
351 /** @private */
352 void _Add_(const char *name, const char *opt); // *MENU*
353 /** @private */
354 xRooNode _Multiply_(const char *what) { return Multiply(what); } // *MENU*
355 /** @private */
356 void _Vary_(const char *what); // *MENU*
357 /** @private */
358 xRooNode _Constrain_(const char *what) { return Constrain(what); } // *MENU*
359 /** @private */
360 void _ShowVars_(bool set = true); // *TOGGLE* *GETTER=_IsShowVars_
361 /** @private */
362 bool _IsShowVars_() const;
363 /** @private */
364 void _SetAttribute_(const char *name, const char *value = nullptr); // *MENU*
365
366 void SetHidden(bool set = true); // *TOGGLE* *GETTER=IsHidden
367 bool IsHidden() const;
368
369 bool SetContents(const TObject &obj)
370 {
371 operator=(obj);
372 return true;
373 } // populates the node's comp (creating if necessary) from given object
374 bool SetData(const TObject &obj, const xRooNode &data = "obsData");
375
376 bool SetContent(double value); // uses a RooConst
377 bool SetContent(double value, const char *par, double parVal = 1); // shortcut to setting a variation content
378 bool SetContents(const TObject &obj, const char *par, double parVal)
379 {
380 variations()[TString::Format("%s=%g", par, parVal).Data()]->operator=(obj);
381 return true;
382 }
383 bool SetBinError(int bin, double value);
384 bool SetBinContent(int bin, double value, const char *par = nullptr, double parVal = 1);
385 bool SetBinData(int bin, double value, const xRooNode &data = "obsData"); // only valid for pdf nodes
386
387 /** @private */
388 void _SetContent_(double value); // *MENU*
389 /** @private */
390 void _SetBinContent_(int bin, double value, const char *par = "", double parVal = 1); // *MENU*
391
392 bool SetXaxis(const RooAbsBinning &binning);
393 bool SetXaxis(TAxis *ax);
394 bool SetXaxis(const char *name, const char *title, int nbins, double low, double high);
395 bool SetXaxis(const char *name, const char *title, int nbins, const double *bins);
396 bool SetXaxis(const char *title, int nbins, double low, double high)
397 {
398 return SetXaxis("xaxis", title, nbins, low, high);
399 }
400 bool SetXaxis(const char *title, int nbins, const double *bins) { return SetXaxis("xaxis", title, nbins, bins); }
401 bool SetXaxis(int nbins, double low, double high) { return SetXaxis("xaxis", "", nbins, low, high); }
402 bool SetXaxis(int nbins, const double *bins) { return SetXaxis("xaxis", "", nbins, bins); }
403
404 std::shared_ptr<TStyle>
405 style(TObject *initObject = nullptr, bool autoCreate = true) const; // DEPRECATED: TO BE REMOVED
406 xRooNode styles(TObject *initObject = nullptr, bool autoCreate = true) const;
407
408 TAxis *GetXaxis() const;
409
410 double GetBinData(int bin, const xRooNode &data = "obsData");
411 double GetBinContent(int bin) const { return GetBinContents(bin, bin).at(0); }
412 std::vector<double> GetBinContents(int binStart = 1, int binEnd = 0) const; // default will get all bins
413 double
414 GetBinError(int bin, const xRooNode &fr = "", int nToys = 0, bool errorsHi = false, bool errorsLo = false) const;
415 std::vector<double> GetBinErrors(int binStart = 1, int binEnd = 0, const xRooNode &fr = "", int nToys = 0,
416 bool errorsHi = false, bool errorsLo = false) const;
417 std::pair<double, double> IntegralAndError(const xRooNode &fr = "", const char *rangeName = nullptr, int nToys = 0,
418 bool errorsHi = false, bool errorsLo = false) const;
419
420 std::vector<double> GetBinErrorsHi(int binStart = 1, int binEnd = 0, const xRooNode &fr = "", int nToys = 0) const
421 {
422 return GetBinErrors(binStart, binEnd, fr, nToys, true, false);
423 }
424 std::vector<double> GetBinErrorsLo(int binStart = 1, int binEnd = 0, const xRooNode &fr = "", int nToys = 0) const
425 {
426 return GetBinErrors(binStart, binEnd, fr, nToys, false, true);
427 }
428 double GetBinErrorHi(int bin, const xRooNode &fr = "", int nToys = 0) const
429 {
430 return GetBinError(bin, fr, nToys, true, false);
431 }
432 double GetBinErrorLo(int bin, const xRooNode &fr = "", int nToys = 0) const
433 {
434 return GetBinError(bin, fr, nToys, false, true);
435 }
436
437 // methods to access default content and error
438 double GetContent() const { return GetBinContent(fBinNumber); }
439 double GetError(const xRooNode &fr = "", int nToys = 0, bool errorsHi = false, bool errorsLo = false) const
440 {
441 return (fBinNumber == -1) ? IntegralAndError(fr, "", nToys, errorsHi, errorsLo).second
442 : GetBinError(fBinNumber, fr, nToys, errorsHi, errorsLo);
443 }
444 double GetErrorHi(const xRooNode &fr = "", int nToys = 0) const { return GetError(fr, nToys, true, false); }
445 double GetErrorLo(const xRooNode &fr = "", int nToys = 0) const { return GetError(fr, nToys, false, true); }
446 double GetData(const xRooNode &data = "obsData") { return GetBinData(fBinNumber, data); }
447
448 // methods to access content and covariances of the CHILDREN of a node
449 std::vector<double> contents() const;
450 TMatrixDSym covariances(const xRooNode &fr = "") const;
451 xRooNLLVar nll(const xRooNode &_data, std::initializer_list<RooCmdArg> nllOpts) const;
452 xRooNLLVar nll(const xRooNode &_data, const RooLinkedList &nllOpts) const;
453 xRooNLLVar nll(const xRooNode &_data = "") const; // uses xRooFit::createNLLOption for nllOpts
454
456 nll(const char *_data,
457 std::initializer_list<RooCmdArg> nllOpts = {}) const; // exists to have sensible exception reporting in python
458 // (rather than conversion errors, which are incorrect)
459
460 xRooNode fitResult(const char *opt = "") const; // todo: make this 'fitResults'
461 void SetFitResult(const RooFitResult *fr = nullptr); // null means will load prefit
462 void SetFitResult(const std::shared_ptr<const RooFitResult> &fr) { SetFitResult(fr.get()); }
463 void SetFitResult(const xRooNode &fr);
464
466 generate(const xRooNode &fr = "", bool expected = false,
467 int seed = 0); // generate a dataset from a pdf node using given fr - if none given will use current fit
468
469 /** @private */
470 void _fit_(const char *constParValues = "", const char *options = "GoF"); // *MENU*
471 /** @private */
472 void _generate_(const char *name = "", bool expected = false); // *MENU*
473 /** @private */
474 void _scan_(const char *what = "plr", double nToys = 0, const char *xvar = "", int nPointsX = 0, double lowX = 0,
475 double highX = 0 /*, const char* yvar="", int nBinsY=0, double lowY=0, double highY=0*/,
476 const char *constParValues = "", const char *options = ""); // *MENU*
477 // xRooNode fitTo(const char* datasetName) const;
478 // xRooNode fitTo(const xRooNode& _data) const;
479 // xRooNode generate(bool expected=false) const;
480 // void minosScan(const char* parName); // *MENU*
481 // void pllScan(const char* parName, int npoints=100); // *MENU*
482 // void breakdown(const char* parNames, const char* groupNames); // *MENU*
483
484 /*
485 double pll(Node2& data, const char* parName, double value, const Asymptotics::PLLType& pllType =
486 Asymptotics::TwoSided) const;
487 // pair is obs p_sb and p_b, vector is expected -2->+2 sigma p_sb (p_b are known by construction)
488 std::pair<std::pair<double,double>,std::vector<double>> pValue(Node2& data, const char* parName, double value,
489 double alt_value, const Asymptotics::PLLType& pllType); double sigma_mu(Node2& data, const char* parName, double
490 value, double alt_value) const;
491*/
492
493 void Checked(TObject *obj, bool val);
494 void SetChecked(bool val = true) { Checked(this, val); }
495
496 /** @private */
497 xRooNode histo(const xRooNode &vars = "x", const xRooNode &fr = "", bool content = true, bool errors = true,
498 bool stack = true, bool errorsHi = false, bool errorsLo = false, int nErrorToys = 0) const;
499 /** @private */
500 xRooNode filter(const xRooNode &range) const;
501
502 TGraph *BuildGraph(RooAbsLValue *v = nullptr, bool includeZeros = false, TVirtualPad *fromPad = nullptr) const;
503 TH1 *BuildHistogram(RooAbsLValue *v = nullptr, bool empty = false, bool errors = false, int binStart = 1,
504 int binEnd = 0, const xRooNode &fr = "", bool errorsHi = false, bool errorsLo = false,
505 int nErrorToys = 0, TH1 *templateHist = nullptr, bool nostack = true,
506 bool setInterp = false) const;
507 xRooNode mainChild() const;
508 void Draw(Option_t *opt = "") override; // *MENU*
509
510 void SaveAs(const char *filename = "", Option_t *option = "") const override; // *MENU*
511
512 /** @private */
513 TGListTreeItem *GetTreeItem(TBrowser *b) const;
514 /** @private */
515 TGListTree *GetListTree(TBrowser *b) const;
516
517 static void Interactive_PLLPlot();
518 static void Interactive_Pull();
520 public:
521 void Interactive_PLLPlot(TVirtualPad *pad, TObject *obj, Int_t x, Int_t y);
523 };
525
526 mutable std::shared_ptr<TObject> fComp; ///<!
527 int fTimes = 1; // when the same comp appears multiple times in a parent node, this is increased to reflect that
528 int fBinNumber = -1; // used by 'bin' nodes (a node that refers to a specific bin of a parent)
529 std::shared_ptr<xRooNode> fParent; ///<!
530 std::string fFolder; // folder to put this node in when 'organising' the parent
531
532 void SetRange(const char *range, double low = std::numeric_limits<double>::quiet_NaN(),
533 double high = std::numeric_limits<double>::quiet_NaN()); // *MENU*
534 const char *GetRange() const;
535 mutable std::string fRange; ///<! only here so can have char* GetRange return so can return nullptr for no range set
536 ///<! (required for RooCategory)
537
538 mutable std::shared_ptr<TAxis>
539 fXAxis; ///<! appears that if was fXaxis then dialog box for SetXaxis will take as current value
540
541 mutable bool fInterrupted = false;
542
543 bool fAcquirer = false; // if true, when acquiring will go into objects memory rather than pass onto parent
544 std::shared_ptr<xRooNode> fProvider; ///<! like a parent but only for use by getObject
545
546 std::shared_ptr<xRooNode> parentPdf() const; // find first parent that is a pdf
547
548 /** @private */
549 void sterilize() const;
550
551 std::vector<std::shared_ptr<xRooNode>> fBrowsables; // will appear in the browser tree but are not actual children
552 std::function<xRooNode(xRooNode *)> fBrowseOperation; // a way to specify a custom browsing operation
553
554 /** @private */
555 std::shared_ptr<xRooNode> getBrowsable(const char *name) const;
556
558};
559
561
562#ifndef XROOFIT_NAMESPACE_NAME
563#ifdef XROOFIT_NAMESPACE
564#define XROOFIT_NAMESPACE_NAME XROOFIT_NAMESPACE
565#else
566#define XROOFIT_NAMESPACE_NAME
567#endif
568#endif
569namespace cling {
570std::string printValue(const XROOFIT_NAMESPACE_NAME::xRooNode *val);
571}
572
573#endif // include guard
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
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
Option_t Option_t style
char name[80]
Definition TGX11.cxx:145
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.
Definition xRooNLLVar.h:59
std::iterator_traits< conststd::shared_ptr< xRooNode > * >::reference operator*() const
Definition xRooNode.h:174
xRooNodeIterator(std::vector< std::shared_ptr< xRooNode > >::const_iterator itr)
Definition xRooNode.h:170
bool operator==(xRooNodeIterator const &b) const
Definition xRooNode.h:193
bool operator!=(xRooNodeIterator const &b) const
Definition xRooNode.h:182
The xRooNode class is designed to wrap over a TObject and provide functionality to aid with interacti...
Definition xRooNode.h:52
xRooNode(const std::shared_ptr< T > &comp, const xRooNode &parent)
Definition xRooNode.h:115
xRooNode _Multiply_(const char *what)
Definition xRooNode.h:354
std::vector< std::shared_ptr< xRooNode > > fBrowsables
Definition xRooNode.h:551
std::shared_ptr< T > acquire(Args &&...args)
Definition xRooNode.h:276
bool SetXaxis(int nbins, double low, double high)
Definition xRooNode.h:401
xRooNode(const std::shared_ptr< const T > &comp, const std::shared_ptr< xRooNode > &parent=nullptr)
Definition xRooNode.h:121
double GetBinErrorHi(int bin, const xRooNode &fr="", int nToys=0) const
Definition xRooNode.h:428
xRooNode(const std::shared_ptr< T > &comp, const std::shared_ptr< xRooNode > &parent=nullptr)
Definition xRooNode.h:109
xRooNode(const TObject &comp, const xRooNode &parent)
Definition xRooNode.h:104
xRooNode(const char *type, const char *name, const char *title="")
const std::shared_ptr< xRooNode > & at(size_t idx, bool browseResult=true) const
Definition xRooNode.h:147
std::string fRange
! only here so can have char* GetRange return so can return nullptr for no range set !...
Definition xRooNode.h:535
xRooNode reduced(const std::string &range="", bool invert=false) const
xRooNLLVar nll(const xRooNode &_data, const RooLinkedList &nllOpts) const
double GetBinErrorLo(int bin, const xRooNode &fr="", int nToys=0) const
Definition xRooNode.h:432
bool SetXaxis(int nbins, const double *bins)
Definition xRooNode.h:402
std::shared_ptr< xRooNode > operator[](size_t idx)
Definition xRooNode.h:164
std::shared_ptr< T > acquireNew(Args &&...args)
Definition xRooNode.h:290
std::shared_ptr< T > acquire2(Args &&...args)
Definition xRooNode.h:284
std::shared_ptr< T > getObject(const std::string &name) const
Definition xRooNode.h:298
bool SetXaxis(const char *title, int nbins, double low, double high)
Definition xRooNode.h:396
xRooNode(const std::shared_ptr< const T > &comp, const xRooNode &parent)
Definition xRooNode.h:127
static InteractiveObject * gIntObj
Definition xRooNode.h:524
double GetError(const xRooNode &fr="", int nToys=0, bool errorsHi=false, bool errorsLo=false) const
Definition xRooNode.h:439
std::shared_ptr< xRooNode > fProvider
! like a parent but only for use by getObject
Definition xRooNode.h:544
std::shared_ptr< TAxis > fXAxis
! appears that if was fXaxis then dialog box for SetXaxis will take as current value
Definition xRooNode.h:539
double GetErrorLo(const xRooNode &fr="", int nToys=0) const
Definition xRooNode.h:445
static std::map< std::string, std::tuple< std::function< double(double, double, double)>, bool > > auxFunctions
Definition xRooNode.h:58
double GetErrorHi(const xRooNode &fr="", int nToys=0) const
Definition xRooNode.h:444
xRooNode(const char *name, const std::shared_ptr< TObject > &comp, const xRooNode &parent)
Definition xRooNode.h:85
xRooNode(const char *name, const TObject &comp, const xRooNode &parent)
Definition xRooNode.h:97
std::vector< double > GetBinErrorsHi(int binStart=1, int binEnd=0, const xRooNode &fr="", int nToys=0) const
Definition xRooNode.h:420
bool SetContents(const TObject &obj)
Definition xRooNode.h:369
std::shared_ptr< TObject > fComp
!
Definition xRooNode.h:526
void SetFitResult(const std::shared_ptr< const RooFitResult > &fr)
Definition xRooNode.h:462
double GetData(const xRooNode &data="obsData")
Definition xRooNode.h:446
static bool isNull(const std::shared_ptr< xRooNode > &x)
Definition xRooNode.h:65
xRooNode(const char *name, const TObject &comp, const std::shared_ptr< xRooNode > &parent)
Definition xRooNode.h:91
bool SetContent(double value, const char *par, double parVal=1)
xRooNode(const char *name, const char *title)
Definition xRooNode.h:75
double GetBinContent(int bin) const
Definition xRooNode.h:411
auto begin() const -> xRooNodeIterator
Definition xRooNode.h:200
std::shared_ptr< xRooNode > fParent
!
Definition xRooNode.h:529
auto end() const -> xRooNodeIterator
Definition xRooNode.h:217
std::function< xRooNode(xRooNode *) fBrowseOperation)
Definition xRooNode.h:552
std::vector< double > GetBinErrorsLo(int binStart=1, int binEnd=0, const xRooNode &fr="", int nToys=0) const
Definition xRooNode.h:424
xRooNode _Constrain_(const char *what)
Definition xRooNode.h:358
bool SetXaxis(const char *title, int nbins, const double *bins)
Definition xRooNode.h:400
bool SetContents(const TObject &obj, const char *par, double parVal)
Definition xRooNode.h:378
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...
Definition RooAbsReal.h:63
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
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.
Definition TAxis.h:32
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:197
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition TNamed.cxx:163
Mother of all ROOT objects.
Definition TObject.h:42
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition TQObject.h:48
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2385
TStyle objects may be created to define special styles.
Definition TStyle.h:29
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
gr SetName("gr")
#define T2
Definition md5.inl:147
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
#define BEGIN_XROOFIT_NAMESPACE
Definition Config.h:24
#define END_XROOFIT_NAMESPACE
Definition Config.h:25
static const char * what
Definition stlLoader.cc:5
th1 Draw()