Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
fitpanel.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_v7
3///
4/// \macro_code
5///
6/// \date 2015-03-22
7/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
8/// \author Axel Naumann <axel@cern.ch>
9
10/*************************************************************************
11 * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
12 * All rights reserved. *
13 * *
14 * For the licensing terms see $ROOTSYS/LICENSE. *
15 * For the list of contributors see $ROOTSYS/README/CREDITS. *
16 *************************************************************************/
17
18#include "ROOT/RHist.hxx"
20#include "ROOT/RCanvas.hxx"
21#include "ROOT/RFitPanel.hxx"
22#include "ROOT/RDirectory.hxx"
23
24using namespace ROOT::Experimental;
25
26void fitpanel() {
27
28 RAxisConfig xaxis(10, 0., 10.);
29 // Create the histogram.
30 auto pHist = std::make_shared<RH1D>(xaxis);
31
32 // Fill a few points.
33 pHist->Fill(1);
34 pHist->Fill(2);
35 pHist->Fill(2);
36 pHist->Fill(3);
37
38 auto canvas = RCanvas::Create("Canvas Title");
39 canvas->Draw(pHist); //->SetLineColor(RColor::kRed);
40
41 canvas->Show();
42 canvas->Update(); // need to ensure canvas is drawn
43
44 auto panel = std::make_shared<RFitPanel>("FitPanel Title");
45
46 RDirectory::Heap().Add("fitpanel", panel);
47 RDirectory::Heap().Add("firsthisto", pHist);
48
49 // TODO: how combine there methods together
50 // here std::shread_ptr<> on both sides
51
52 panel->AssignCanvas(canvas);
53 panel->AssignHistogram(pHist);
54
55 canvas->AddPanel(panel);
56}
57
Objects used to configure the different axis types.