ROOT
Version v6.32
master
v6.34
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
Reference Guide
▼
ROOT
ROOT Reference Documentation
Tutorials
▼
Functional Parts
►
Core ROOT classes
►
std Extension classes
►
Parallelized classes
►
The Geometry Package
►
Graphics
►
Event display with ROOT7
►
GUI
►
Web Widgets
►
Web Display
►
Histogram Library
►
Input/Output Library
►
Math
►
N-D parametric functions
►
VecOps
►
Monte Carlo
►
HTTP server
►
PROOF
►
TMVA
►
RooFit
►
Dataframe
►
ROOT7 classes
►
NTuple-related classes
►
Tree Library
►
TreePlayer Library
▼
Tutorials
►
Histograms tutorials
►
Tree tutorials
►
Dataframe tutorials
▼
ROOT 7 tutorials
►
RCanvas examples
►
ROOT 7 ntuple tutorials
browser.cxx
concurrentfill.cxx
filedialog.cxx
fitpanel.cxx
fitpanel6.cxx
histops.cxx
perf.cxx
perfcomp.cxx
simple.cxx
►
FOAM tutorials
►
Containers tutorials
►
Event display tutorials
►
Event display ROOT7 tutorials
►
Geometry tutorials
►
Fast Fourier Transforms tutorials
►
Fit Tutorials
►
RooFit Tutorials
►
Graphs tutorials
►
Graphics tutorials
►
OpenGL tutorials
►
Tutorials specific to Mac/Cocoa
►
GUI tutorials
►
HistFactory Tutorials
►
HTTP tutorials
►
Image tutorials
►
IO tutorials
►
Math tutorials
►
Matrix tutorials
►
Monte Carlo tutorials
►
Multicore tutorials
►
Net tutorials
►
Physics tutorials
►
PyRoot tutorials
►
Pythia tutorials
►
Quadratic programming package.
►
R tutorials
►
RooStats Tutorials
►
Spectrum tutorials
►
TSPlot tutorials
►
SQL tutorials
►
TMVA tutorials
►
TUnfold tutorials
►
Unuran tutorials
►
VecOps tutorials
►
FITS files interface tutorials
►
XML tutorials
►
Proof tutorials
►
Webgui tutorials
►
Legacy tutorials
demos.C
demoshelp.C
hsimple.C
rootlogoff.C
rootlogon.C
►
R Interface for Statistical Computing
►
Namespaces
►
All Classes
►
Files
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
simple.cxx File Reference
Tutorials
»
ROOT 7 tutorials
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/RFit.hxx
"
#include "
ROOT/RFile.hxx
"
void
simple
()
{
using namespace
ROOT::Experimental
;
// Create a 2D histogram with an X axis with equidistant bins, and a y axis
// with irregular binning.
RAxisConfig
xAxis
(100, 0., 1.);
RAxisConfig
yAxis
({0., 1., 2., 3., 10.});
RH2D
histFromVars
(
xAxis
,
yAxis
);
// Or the short in-place version:
// Create a 2D histogram with an X axis with equidistant bins, and a y axis
// with irregular binning.
RH2D
hist({100, 0., 1.}, {{0., 1., 2., 3., 10.}});
// Fill weight 1. at the coordinate 0.01, 1.02.
hist.Fill({0.01, 1.02});
// Fit the histogram.
RFunction<2>
func([](
const
std::array<double, 2> &
x
,
const
std::span<const double> par) {
return
par[0] *
x
[0] *
x
[0] + (par[1] -
x
[1]) *
x
[1];
});
auto
fitResult =
FitTo
(hist, func, {{0., 1.}});
auto
file = RFile::Recreate(
"hist.root"
);
file->Write(
"TheHist"
, hist);
}
RFile.hxx
RFit.hxx
RHist.hxx
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
ROOT::Experimental::RAxisConfig
Objects used to configure the different axis types.
Definition
RAxisConfig.hxx:35
x
Double_t x[n]
Definition
legend1.C:17
ROOT::Experimental
Definition
RDirectory.hxx:30
ROOT::Experimental::FitTo
RFitResult FitTo(const RHist< DIMENSIONS, PRECISION, STAT... > &hist, const RFunction< DIMENSIONS > &func, std::span< const double > paramInit)
Definition
RFit.hxx:39
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
simple.cxx
.
tutorials
v7
simple.cxx
ROOT v6-32 - Reference Guide Generated on Mon Apr 14 2025 06:07:01 (GVA Time) using Doxygen 1.10.0