Re: Crash:illegal pointer to class object (not happened before!)

From: Deepak Kar <dkar_at_phys.ufl.edu>
Date: Tue, 21 Apr 2009 11:07:37 +0200


Hi Nick,

Thanks for your input. When I do that, that initialiaztion error disappears (as expected), but the main error still remains,

Error: illegal pointer to class object hist2 0x0 1046 draw_ratio.C:22: !!!Dictionary position not recovered because G__unloadfile() is used in a macro!!!
*** Interpreter error recovered ***

Infact I did what Axel suggested, and I come up with this:

root [0] TFile *f= new TFile("gen.root"); root [1] f->cd("Ana/dyjet/Hist/dyjet_Pnchg5pairpt2"); Error in <TFile::cd>: Object Ana is not a directory (I am not sure if this was an error before or a warning)
root [2] f->ls()
OBJ: TProfile dyjet_Pnchg5pairpt2 dyjet: TRV - <No of Charged> vs Lepton Pair PT (Z Range) : 0 at: 0x8cf7270 (...and my other histograms with similar lines)

Thanks!
Deepak

On Tue, Apr 21, 2009 at 10:52 AM, Nick van Eijndhoven <nickve.nl_at_gmail.com> wrote:
> Hi Deepak,
> In your "for loop statement" you have to define "i" like e.g.
> for (Int_t i=1; i<=31; i++)
> Then the complaint about the automatic var. initialisation will also
> disappear.
> Cheers,
> Nick.
>
> On Tue, Apr 21, 2009 at 1:22 AM, Deepak Kar <dkar_at_phys.ufl.edu> wrote:
>>
>> Hello folks!
>>
>> I am sure I am missing something trivial here. I had a bunch of codes
>> before, and they ran fine. After a while I am trying to run them,
>> without changing anything to my knowledge. They are all crashing with
>> the same error, and this just a simple example.
>>
>> {
>> gROOT->Reset();
>>
>> TFile *f= new TFile("gen.root");
>> TProfile *hist2=(TProfile*)
>> gDirectory->Get("Ana/dyjet/Hist/dyjet_Pnchg5pairpt2");
>>
>> TFile *f=new TFile("ze_tlt.root");
>> TProfile *hist3=(TProfile*)
>> gDirectory->Get("Ana/dyjet/Hist/dyjet_Pnchg5pairpt2");
>>
>>
>> for(i=1;i<=31;i++){
>> xbin1= hist2->GetBinCenter(i);
>> gen = hist2->GetBinContent(i);
>> sim = hist3->GetBinContent(i);
>> printf("MC bin, Gen/SIM = %f, %f,\n",gen/sim);
>> }
>> }
>>
>> It crashes with:
>>
>> Warning: Automatic variable i is allocated draw_ratio.C:19:
>> Error: illegal pointer to class object hist2 0x0 1046 draw_ratio.C:20:
>> Warning: Automatic variable xbin1 is allocated draw_ratio.C:20:
>> Error: Undeclared variable xbin1 draw_ratio.C:20:
>> *** Interpreter error recovered ***
>>
>> The .root files are all there, so are the histograms in that path.
>>
>> Thanks a lot for any input.
>>
>> Deepak
>>
>>
>> --
>> Deepak Kar
>> Postdoctoral Fellow, Experimental Particle Physics (ATLAS/CDF)
>> Institut für Kern- und Teilchenphysik
>> TU Dresden
>> Homepage: http://iktp.tu-dresden.de/~dkar/
>>
>
>
>
> --
> Dr. Nick van Eijndhoven
> nickve.nl@gmail.com http://sites.google.com/site/nickveweb
> skype: nickve.nl gsm: +31-6-40181589
> Utrecht University, Dept. of Physics and Astronomy
> Princetonplein 5, 3584 CC Utrecht, The Netherlands
> tel: +31-30-2532331 fax: +31-30-2518689
>
> "In the beginning there was nothing, which exploded".
>

-- 
Deepak Kar
Postdoctoral Fellow, Experimental Particle Physics (ATLAS/CDF)
Institut für Kern- und Teilchenphysik
TU Dresden
Homepage: http://iktp.tu-dresden.de/~dkar/

Phone: (Local) 0351-2088158
           (Office) 0351-46342370
           (Mobile) 0176622661132
                       /0176622661131
Received on Tue Apr 21 2009 - 11:08:01 CEST

This archive was generated by hypermail 2.2.0 : Tue Apr 21 2009 - 17:50:01 CEST