Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TLeafDraw7Provider.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 <ROOT/RCanvas.hxx>
13
14using namespace ROOT::Experimental;
15
16/** Provider for drawing of ROOT7 classes */
17
19public:
20 bool AddHist(std::shared_ptr<RPadBase> &subpad, TH1 *hist, const std::string &opt)
21 {
22 if (!hist)
23 return false;
24
25 std::shared_ptr<TH1> shared;
26 shared.reset(hist);
27
28 subpad->Draw<ROOT::Experimental::TObjectDrawable>(shared, opt);
29 subpad->GetCanvas()->Update(true);
30 return true;
31 }
32
34 {
35 RegisterDraw7(TLeaf::Class(), [this](std::shared_ptr<RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
36 return AddHist(subpad, DrawLeaf(obj), opt);
37 });
38
39 RegisterDraw7(TBranchElement::Class(), [this](std::shared_ptr<RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
40 return AddHist(subpad, DrawBranchElement(obj), opt);
41 });
42
43 RegisterDraw7(TBranch::Class(), [this](std::shared_ptr<RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
44 return AddHist(subpad, DrawBranch(obj), opt);
45 });
46
47 RegisterDraw7(TVirtualBranchBrowsable::Class(), [this](std::shared_ptr<RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
48 return AddHist(subpad, DrawBranchBrowsable(obj), opt);
49 });
50
51 }
52
54
TLeafDraw7Provider newTLeafDraw7Provider
void RegisterDraw7(const TClass *cl, Draw7Func_t func)
Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).
static TClass * Class()
static TClass * Class()
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
Provider for drawing of ROOT7 classes.
bool AddHist(std::shared_ptr< RPadBase > &subpad, TH1 *hist, const std::string &opt)
Provider for drawing of branches / leafs in the TTree.
TH1 * DrawBranch(const TBranch *tbranch)
TH1 * DrawBranchBrowsable(std::unique_ptr< RHolder > &obj)
TH1 * DrawBranchElement(std::unique_ptr< RHolder > &obj)
TH1 * DrawLeaf(std::unique_ptr< RHolder > &obj)
static TClass * Class()
static TClass * Class()