Hi Razzak,
Your histogram are TH1D (or not F), see the result of setA->ls(); __In addition__, looking at the result of setA->ls() you will notice that some of your histograms' name (in particular the one you are looking for) is prepended with a space.
So use:
TH1D *Spher3D_sig = (TH1D*)setA->Get(" h_Sphericity3D");
or better yet:
TH1D *Spher3D_sig; setA->GetObject(" h_Sphericity3D",Spher3D_sig);
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On
Behalf Of Meera Lebbai, Mohamed R.
Sent: Tuesday, October 30, 2007 9:24 AM
To: Rene Brun
Cc: ROOT Talk
Subject: RE: [ROOT] Error: illegal pointer to class object Spher3D_sig 0x0
396 plot1.C:7: *** Interpreter error recovered ***
I can see the histogram from my Histogram file (hist_stop_sig.root) . But when I tried to get through TFile I am getting this error. You can check my hist_stop_sig.root in my public area at lxplus. ~razzak/public/hist_stop_sig.root
Thanks
Razzak
So this means that your object with name " h_Sphericity3D" does not
exist in the file.
As a result the pointer Spher3D_sig is null
Rene Brun
Meera Lebbai, Mohamed R. wrote:
> Hi Rene,
>
> When I do
>
> TH1F *Spher3D_sig = (TH1F*)setA->Get("h_Sphericity3D");
> if(Spher3D_sig) Spher3D_sig->Draw();
>
> I don't get any error messages but I can't save this histogram ( I can't
see the histogram).
>
> Is there any way to do it.
>
> Note: I also wanted to metion one thing this kind of illegal pointer error
only occuring for particular variables such as Spehricity, Aplanarity and
Planarity.
>
> Thanks
>
> Razzak
> ________________________________________
> From: Rene Brun [Rene.Brun_at_cern.ch]
> Sent: Friday, October 26, 2007 9:39 AM
> To: Meera Lebbai, Mohamed R.
> Cc: ROOT Talk
> Subject: Re: [ROOT] Error: illegal pointer to class object Spher3D_sig 0x0
396 plot1.C:7: *** Interpreter error recovered ***
>
> Instead of:
>
> TH1F *Spher3D_sig = setA->Get("h_Sphericity3D");
> Spher3D_sig->Draw();
>
> do:
>
> TH1F *Spher3D_sig = (TH1F*)setA->Get("h_Sphericity3D");
> if(Spher3D_sig) Spher3D_sig->Draw();
>
> Rene Brun
>
> Meera Lebbai, Mohamed R. wrote:
>
>> Hi all,
>>
>> I am getting illegal pointer error when I try Draw() a histogram ( but I
never used to get this before).
>>
>> I have just included a simple file
>>
>>
>> // test.C
>>
>>
>> { gStyle->SetOptFit(111111);
>>
>> // signal
>> TFile* setA = TFile::Open("hist_stop_sig.root");
>>
>> TH1F *Spher3D_sig = setA->Get("h_Sphericity3D");
>> Spher3D_sig->Draw();
>> }
>>
>> Any help will be appreciated.
>>
>> Razzak
>>
>>
>>
>
>
Received on Tue Oct 30 2007 - 15:39:53 CET
This archive was generated by hypermail 2.2.0 : Tue Oct 30 2007 - 17:50:02 CET