Fit graphs from a Tree crashing

Hello everybody

Here is what I am trying to do:

  • create a tree root file which contains only graphs - fileTreeGraphs.C create the root file.
    -open the tree file created, make a fit on each graph and save the results in a new tree -> fitfileTreeGraphs.C
    -i would like to export the fit parameters in a text file, but for the moment everything is crashing :frowning:
    When I execute the fitfileTreeGraphs, I get just a crash message.
    Thanks for your answers:

C:\Program Files (x86)\Microsoft Visual Studio 12.0>root

ROOT 5.34/34 (v5-34-34@v5-34-34, Oct 02 2015, 16:30:37 on win32)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .cd C:\rootFiles\newPlots\20052016
root [1] .x fitfileTreeGraphs.C
TFile: name=fileTreeGraphs.root, title=ROOT file with graphs, option=READ


fitfileTreeGraphs.C (1.7 KB)
fileTreeGraphs.C (1.03 KB)
fileTreeGraphs.root (67.6 KB)

I am 100% sure what you want to achieve. The file fileTreeGraphs.root contains 3 2-dimentional histograms (TH2F), which is the result of TTree::Draw(“x:z >> gr1”, cut, “*”). So, casting to TGraph with the other script and fitting it produces the crash.

So what should I do to put it right? How should I use TGraph to save it in root file?
Thanks and cheers
mp

Hi
Is working now, I changed everything to TH2F.
Thanks :smiley:
mp