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

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Tue, 21 Apr 2009 08:54:54 +0200


Hi Deepak,

CINT claims hist2 is NULL, which means that gen.root does not contain Ana/dyjet/Hist/dyjet_Pnchg5pairpt2. Could you send the output of

TFile *f= new TFile("gen.root");
f->cd("Ana/dyjet/Hist/dyjet_Pnchg5pairpt2"); f->ls()

Cheers, Axel.

Deepak Kar wrote on 04/21/2009 01:22 AM:
> 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
>
>
Received on Tue Apr 21 2009 - 08:51:08 CEST

This archive was generated by hypermail 2.2.0 : Tue Apr 21 2009 - 11:50:02 CEST