26void rf102_dataimport()
40 TH1 *hh = makeTH1(trnd);
52 RooPlot *frame =
x.frame(
Title(
"Imported TH1 with Poisson error bars"));
68 RooPlot *frame2 =
x.frame(
Title(
"Imported TH1 with internal errors"));
86 TTree *tree = makeTTree(trnd);
105 std::ofstream outstream(
"rf102_testData.txt");
113 std::cout <<
"\n-----------------------\nReading data from ASCII\n";
119 dataReadBack->
Print(
"V");
121 std::cout <<
"\nOriginal data, line 20:\n";
122 ds.get(20)->Print(
"V");
124 std::cout <<
"\nRead-back data, line 20:\n";
134 RooPlot *frame3 =
y.frame(
Title(
"Unbinned data shown in default frame binning"));
138 RooPlot *frame4 =
y.frame(
Title(
"Unbinned data shown with custom binning"));
139 ds.plotOn(frame4,
Binning(20));
141 RooPlot *frame5 =
y.frame(
Title(
"Unbinned data read back from ASCII file"));
142 ds.plotOn(frame5,
Binning(20));
146 TCanvas *
c =
new TCanvas(
"rf102_dataimport",
"rf102_dataimport", 1000, 800);
149 gPad->SetLeftMargin(0.15);
153 gPad->SetLeftMargin(0.15);
158 gPad->SetLeftMargin(0.15);
162 gPad->SetLeftMargin(0.15);
166 gPad->SetLeftMargin(0.15);
174 TH1D *hh =
new TH1D(
"hh",
"hh", 25, -10, 10);
175 for (
int i = 0; i < 100; i++) {
187 tree->
Branch(
"x", px,
"x/D");
188 tree->
Branch(
"y", py,
"y/D");
189 for (
int i = 0; i < 100; i++) {
190 *px = trnd.
Gaus(0, 3);
191 *py = trnd.
Uniform() * 30 - 15;
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Container class to hold N-dimensional binned data.
Container class to hold unbinned data.
const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
static RooDataSet * read(const char *filename, const RooArgList &variables, const char *opts="", const char *commonPath="", const char *indexCatName=nullptr)
Read data from a text file and create a dataset from it.
Plot frame and a container for graphics objects within that frame.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
Variable that can be changed from the outside.
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Random number generator class based on M.
This is the base class for the ROOT Random number generators.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
RooCmdArg Title(const char *name)
RooCmdArg Import(const char *state, TH1 &histo)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg DataError(Int_t)
RooCmdArg Binning(const RooAbsBinning &binning)
RooCmdArg MarkerStyle(Style_t style)
RooCmdArg MarkerColor(TColorNumber color)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...