Logo ROOT   6.16/01
Reference Guide
fitpanel.cxx File Reference

Detailed Description

/*************************************************************************
* Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#include "ROOT/RHist.hxx"
#include "ROOT/RCanvas.hxx"
#include "ROOT/RFitPanel.hxx"
void fitpanel0() {
using namespace ROOT::Experimental;
// Create the histogram.
RAxisConfig xaxis(10, 0., 10.);
auto pHist = std::make_shared<RH1D>(xaxis);
// Fill a few points.
pHist->Fill(1);
pHist->Fill(2);
pHist->Fill(2);
pHist->Fill(3);
auto panel = std::make_shared<RFitPanel>("FitPanel Title");
panel->Show();
// Register the histogram with ROOT: now it lives even after draw() ends.
// Create a canvas to be displayed.
// auto canvas = Experimental::RCanvas::Create("Canvas Title");
// canvas->Draw(pHist)->SetLineColor(Experimental::TColor::kRed);
// canvas->Draw(pHist2)->SetLineColor(Experimental::TColor::kBlue);
// canvas->Show();
}
void fitpanel() {
using namespace ROOT::Experimental;
// TODO - also keep axis correctly in the help
auto xaxis = std::make_shared<RAxisConfig>(10, 0., 10.);
// Create the histogram.
auto pHist = std::make_shared<RH1D>(*xaxis.get());
// Fill a few points.
pHist->Fill(1);
pHist->Fill(2);
pHist->Fill(2);
pHist->Fill(3);
auto canvas = RCanvas::Create("Canvas Title");
canvas->Draw(pHist)->SetLineColor(RColor::kRed);
canvas->Show();
canvas->Update(); // need to ensure canvas is drawn
auto panel = std::make_shared<RFitPanel>("FitPanel Title");
ROOT::Experimental::TDirectory::Heap().Add("firsthisto", pHist);
// TODO: how combine there methods together
// here std::shread_ptr<> on both sides
panel->UseCanvas(canvas);
canvas->AddPanel(panel);
}
@ kRed
Definition: Rtypes.h:63
static TDirectory & Heap()
Dedicated, process-wide TDirectory.
Definition: TFile.cxx:23
void Add(std::string_view name, const std::shared_ptr< T > &ptr)
Add an existing object (rather a shared_ptr to it) to the TDirectory.
Definition: TDirectory.hxx:172
Date
2015-03-22
Warning
This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
Author
Axel Naumann axel@.nosp@m.cern.nosp@m..ch

Definition in file fitpanel.cxx.