Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTupleDraw7Provider.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2021, 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 "TClass.h"
10
11#include <ROOT/RCanvas.hxx>
13
14#include "RFieldProvider.hxx"
15
16using namespace ROOT::Experimental;
17
18// ==============================================================================================
19
20/** \class RNTupleDraw7Provider
21\ingroup rbrowser
22\brief Provider for RNTuple drawing on RCanvas
23\author Sergey Linev <S.Linev@gsi.de>
24\date 2021-03-09
25\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
26*/
27
29
30public:
31
33 {
34 RegisterDraw7(TClass::GetClass<ROOT::Experimental::RNTuple>(), [this](std::shared_ptr<RPadBase> &subpad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
35
36 auto h1 = DrawField(dynamic_cast<RFieldHolder*> (obj.get()));
37 if (!h1) return false;
38
39 if (subpad->NumPrimitives() > 0) {
40 subpad->Wipe();
41 subpad->GetCanvas()->Modified();
42 subpad->GetCanvas()->Update(true);
43 }
44
45 std::shared_ptr<TH1> shared;
46 shared.reset(h1);
47
48 subpad->Draw<ROOT::Experimental::TObjectDrawable>(shared, opt);
49 subpad->GetCanvas()->Update(true);
50 return true;
51 });
52 }
53
55
RNTupleDraw7Provider newRNTupleDraw7Provider
Base class for provider of RNTuple drawing.
TH1 * DrawField(RFieldHolder *holder)
Provider for RNTuple drawing on RCanvas.
void RegisterDraw7(const TClass *cl, Draw7Func_t func)
Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).
TH1F * h1
Definition legend1.C:5