Filling histos in directory + if(==) problem

From: Tadeusz Pytlos (pytlos@fizwe5.fic.uni.lodz.pl)
Date: Sun May 24 1998 - 15:25:31 MEST


Dear Rooters,
I'm working on RedHat5 with ROOT 2.00/07.
Last time I decided to start using directories of histograms according
to Rene Brun's example dirs.C. Unfortunetly, I found very strange
behaviour which I cannot solve and it is difficult to explain. 
Simply speaking without directories such condition works properly
 if((xne[2]>4.4) && (xne[2]<4.5) && (m==12)) h2->Fill(k);
but with directories doesn't. It produces error
root [0] 
Processing dep0.C...
Error: Can't call TGX11::Fill() in current scope
FILE:/home/pytlos/usr/kret/test/./dep0.C LINE:264
*** Interpreter error recovered ***

I tried to investigate the problem a lot in my macro, but
it seems to be a very soft kind of interpreter error.

{
.....

  Int_t m,k,count,hist[58];
  const Int_t nplanes=1;
  const Int_t ncounters=10;
  char dirname[50];
  char hname[20];
  char htitle[80];

........// Preparing directories structure
  TFile *hfile = gROOT->FindObject("dep.root");
  if(hfile) hfile->Close();
  hfile = new TFile("dep.root","RECREATE","ROOT file");
  TDirectory *top=hfile->mkdir("top");
  top->cd();

  for(Int_t i=0;i<nplanes;i++)
   {
     sprintf(dirname,"plane%d",i);
     TDirectory *plane=top->mkdir(dirname);
     plane->cd();
     for(Int_t j=0;j<ncounters;j++)
     {
       sprintf(hname,"h%d",j);
       sprintf(htitle,"Histogram dla m=%d",j);
       TH1S *h = new TH1S(hname,htitle,40,0,40);
     }
     top->cd();
   }


..........
.................//Filling directories

      top->cd();
      plane0->cd();
      if((xne[2]>4.4) && (xne[2]<4.5)) h0->Fill(m);
      if((xne[2]>4.4) && (xne[2]<4.5) && (m!=12)) h1->Fill(k);
//bad      if((xne[2]>4.4) && (xne[2]<4.5) && (m==12)) h2->Fill(k);
      if((xne[2]>4.4) && (xne[2]<4.5) && (m==12)) hist[count++]=k;
   }
  for(Int_t i=0;i<58;i++) h3->Fill(hist[i]);
........


I cannot fulfill only h2 histogram with (m==2). h2 is good if I don't
include (m==something) or I don't insert h2->Fill(k).
Nevertheless, it was easy to check that condition 
if((xne[2]>4.4) && (xne[2]<4.5) && (m==12)) h2->Fill(k);
has 58 events and I histogram them in h3.
My program is rather complicated and data file is big, but
I can send them if you need to investigate.
Best wishes,
          Tadeusz


--
Tadeusz Pytlos        
mailto:pytlos@fizwe5.fic.uni.lodz.pl 
Lodz, Poland                                                 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET