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

From: Deepak Kar <dkar_at_phys.ufl.edu>
Date: Tue, 21 Apr 2009 01:22:22 +0200


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/
Received on Tue Apr 21 2009 - 01:22:40 CEST

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