Dear all,
I have problems in running a macro; it crashes because I’m trying to use a poiter which turns out to be NULL:
[quote]Processing runNoisePlot.C…
FCN=-2549.15 FROM MINOS STATUS=SUCCESSFUL 41 CALLS 191 TOTAL
EDM=9.34993e-09 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 Constant 8.61350e+01 3.64584e+00 -5.64429e-02 -9.15920e-06
2 Mean 1.90859e+00 1.10232e-02 -6.16598e-06 -1.71261e-02
3 Sigma 3.19066e-01 8.18510e-03 8.18510e-03 -4.86487e-02
ERR DEF= 0.5
Error: illegal pointer to class object ps 0x0 2902 runNoisePlot.C:12:
*** Interpreter error recovered ***
[/quote]
The relevant part of code is this:
TFile f("calibration-100225-140429-dispersion.root","READ");
f.cd();
TH1F *hh = new TH1F("hh","noise dispersion for M24 chip17, p-Side tpcb=343C; PH (mV);Entries",25,1.,3.0);
TTree *tSave = f.Get("tSave");
tSave->Project("hh","sigma","probChi2>0.01&&sigma>-9.");
// tSave->Project("hh","sigma","sigma>0.");
TCanvas *c1 = new TCanvas("c1","",1024,768);
c1->cd();
hh->Fit("gaus","LLME","e");
TPaveStats* ps = (TPaveStats*)hh->GetListOfFunctions()->FindObject("stats");
ps->SetFillStyle(0); // trasparent
What is really weird is this: if I just copy on root prompt all the lines of the macro, it just works!
I really like to run the macro and not copy each line at the prompt…
In attachment you have root file and macro.
Root version = 5.26; OS = SL 4.8;
Any ideas?
Many thanks and regards,
Marco
calibration-100225-140429-dispersion.root (204 KB)
runNoisePlot.C (954 Bytes)