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
14/** Provider for drawing TLeaf/TBranch in ROOT7 canvas */
15
17public:
18 bool AddHist(std::shared_ptr<ROOT::Experimental::RPadBase> &subpad, TH1 *hist, const std::string &opt)
19 {
20 if (!hist)
21 return false;
22
23 std::shared_ptr<TH1> shared;
24 shared.reset(hist);
25
26 subpad->Draw<ROOT::Experimental::TObjectDrawable>(shared, opt);
27 subpad->GetCanvas()->Update(true);
28 return true;
29 }
30
32 {
33 RegisterDraw7(TLeaf::Class(), [this](std::shared_ptr<ROOT::Experimental::RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
34 return AddHist(subpad, DrawLeaf(obj), opt);
35 });
36
37 RegisterDraw7(TBranchElement::Class(), [this](std::shared_ptr<ROOT::Experimental::RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
38 return AddHist(subpad, DrawBranchElement(obj), opt);
39 });
40
41 RegisterDraw7(TBranch::Class(), [this](std::shared_ptr<ROOT::Experimental::RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
42 return AddHist(subpad, DrawBranch(obj), opt);
43 });
44
45 RegisterDraw7(TVirtualBranchBrowsable::Class(), [this](std::shared_ptr<ROOT::Experimental::RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
46 return AddHist(subpad, DrawBranchBrowsable(obj), opt);
47 });
48
49 }
50
52
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:59
Provider for drawing TLeaf/TBranch in ROOT7 canvas.
bool AddHist(std::shared_ptr< ROOT::Experimental::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()