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
23using namespace ROOT::Experimental;
24
25void fitpanel() {
26
27 RAxisConfig xaxis(10, 0., 10.);
28 // Create the histogram.
29 auto pHist = std::make_shared<RH1D>(xaxis);
30
31 // Fill a few points.
32 pHist->Fill(1);
33 pHist->Fill(2);
34 pHist->Fill(2);
35 pHist->Fill(3);
36
37 auto canvas = RCanvas::Create("RCanvas with histogram");
38 canvas->Draw(pHist); //->SetLineColor(RColor::kRed);
39
40 canvas->Show();
41 canvas->Update(); // need to ensure canvas is drawn
42
43 auto panel = std::make_shared<RFitPanel>("FitPanel Title");
44
45 // TODO: how combine there methods together
46 // here std::shread_ptr<> on both sides
47
48 panel->AssignCanvas(canvas);
49 panel->AssignHistogram(pHist);
50
51 canvas->AddPanel(panel);
52
53 // preserve panel alive until connection is closed
54 canvas->ClearOnClose(panel);
55}
Objects used to configure the different axis types.