Hi all!
I'm using ROOT 5.18 on my laptop.
I'd like to create multiple plots with multiple stat boxes in one canvas
and found http://home.fnal.gov/~asmoron/roottips.html#stat_box
But actually it works just if I give commands from command line. By using a routine, it does not work even if I try to modify just the text color of one stat box... The input file is really simple, since it is just a trial.
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <cmath>
#include "TColor.h"
#include "TStyle.h"
#include <TFile.h>
#include <TCanvas.h>
#include <TH2F.h>
#include <TSystem.h>
#include <TPave.h>
#include <TPaveStats.h>
using namespace std;
void trial() {
TFile *f_s=new TFile("file1.root","read"); TH1D*h_s=(TH1D*)f_s->Get("proj"); h_s->Draw(); TPaveStats *p = (TPaveStats*)h_s->GetListOfFunctions()->FindObject("stats"); p->SetColor(2); p->Draw(); f_s->Close();
}
By activating the gdb debugging, I obtain the following error message.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff32454cd in trial () at
/home/irfulx157/mnt/fbelloni/workspace/XYMG/Exp_Res/14_06_2010/beam_profile/./trial.C:30
30 p->SetTextColor(2);
#0 0x00007ffff32454cd in trial () at
/home/irfulx157/mnt/fbelloni/workspace/XYMG/Exp_Res/14_06_2010/beam_profile/./trial.C:30
#1 0x00007ffff324556f in G__file5viCoV__0_2063 (result7=0x7fffffff69d0,
funcname=0x9c8430 "\001", libp=0x7fffffff01b0, hash=0)
at
/home/irfulx157/mnt/fbelloni/workspace/XYMG/Exp_Res/14_06_2010/beam_profile/./file5viCoV.cxx:68
#2 0x00007ffff6c067fd in G__call_cppfunc () from
/usr/lib/root/libCint.so.5.18
#3 0x00007ffff6be671f in G__interpret_func () from
/usr/lib/root/libCint.so.5.18
#4 0x00007ffff6bd8de1 in G__getfunction () from
/usr/lib/root/libCint.so.5.18
#5 0x00007ffff6bb9d72 in G__getitem () from /usr/lib/root/libCint.so.5.18
#6 0x00007ffff6bc0479 in G__getexpr () from /usr/lib/root/libCint.so.5.18
#7 0x00007ffff6bc6a88 in G__calc_internal () from
/usr/lib/root/libCint.so.5.18
#8 0x00007ffff6c39376 in G__process_cmd () from
/usr/lib/root/libCint.so.5.18
#9 0x00007ffff76678c0 in TCint::ProcessLine(char const*,
TInterpreter::EErrorCode*) () from /usr/lib/root/libCore.so.5.18
#10 0x00007ffff75d5fa2 in TApplication::ExecuteFile(char const*, int*) ()
from /usr/lib/root/libCore.so.5.18
#11 0x00007ffff75d4973 in TApplication::ProcessLine(char const*, bool,
int*) () from /usr/lib/root/libCore.so.5.18
#12 0x00007ffff68dbe6e in TRint::Run(bool) () from
/usr/lib/root/libRint.so.5.18
#13 0x00000000004011bc in main ()
(gdb) info locals
f_s = 0x964c50
h_s = 0xb6f070
p = 0x0
Could anyone help me, please?
Thank you,
regards,
Francesca
Received on Sun Feb 27 2011 - 15:29:51 CET
This archive was generated by hypermail 2.2.0 : Sun Feb 27 2011 - 17:50:01 CET