Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TLeafDraw6Provider.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#include "TLeafProvider.hxx"
10
11#include "TVirtualPad.h"
12
13/** Provider for drawing of ROOT6 classes */
14
16public:
17
18 bool AddHist(TVirtualPad *pad, TH1 *hist, const std::string &opt)
19 {
20 if (!hist)
21 return false;
22
23 pad->GetListOfPrimitives()->Clear();
24
25 pad->GetListOfPrimitives()->Add(hist, opt.c_str());
26
27 return true;
28 }
29
31 {
32 RegisterDraw6(TLeaf::Class(), [this](TVirtualPad *pad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
33 return AddHist(pad, DrawLeaf(obj), opt);
34 });
35
36 RegisterDraw6(TBranchElement::Class(), [this](TVirtualPad *pad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
37 return AddHist(pad, DrawBranchElement(obj), opt);
38 });
39
40 RegisterDraw6(TBranch::Class(), [this](TVirtualPad *pad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
41 return AddHist(pad, DrawBranch(obj), opt);
42 });
43
44 RegisterDraw6(TVirtualBranchBrowsable::Class(), [this](TVirtualPad *pad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
45 return AddHist(pad, DrawBranchBrowsable(obj), opt);
46 });
47 }
48
50
TLeafDraw6Provider newTLeafDraw6Provider
void RegisterDraw6(const TClass *cl, Draw6Func_t func)
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
Provider for drawing of ROOT6 classes.
bool AddHist(TVirtualPad *pad, TH1 *hist, const std::string &opt)
Provider for drawing of branches / leafs in the TTree.
TH1 * DrawBranch(std::unique_ptr< RHolder > &obj)
TH1 * DrawBranchBrowsable(std::unique_ptr< RHolder > &obj)
TH1 * DrawBranchElement(std::unique_ptr< RHolder > &obj)
TH1 * DrawLeaf(std::unique_ptr< RHolder > &obj)
virtual void Add(TObject *obj)
Definition TList.h:81
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition TList.cxx:402
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
virtual TList * GetListOfPrimitives() const =0