[ROOT] How does one intelligently manage input from multiple files?

From: Birger Koblitz (koblitz@mail.desy.de)
Date: Wed Apr 19 2000 - 12:08:30 MEST


Hi,

I have some root-files converted from hbook files containing ntuples. They
all have the same name, h133. Now I would like to plot some variables out
of these files on top of each other, the files contain different MC's.
What I am doing now is:
// A list of files
char *fname[]={"qcdins.root","qcdins_196.root","qcdins_234.root"};
char *hname[]={"h01","h02","h03"};
char strbuf[32];
// Read in the files:
  ....
for(i=0;i<3;i++){
  // CD into the dirs
  strcpy(strbuf,fname[i]);
  strcat(strbuf,":HZINS");
  ((TFile*)gROOT->GetListOfFiles()->FindObject(fname[i]))->cd(strbuf);
  histo=new TH1F(hname[i]," ",20,minx,maxx);
  strcpy(strbuf,"x"); // x is the variable name to be plotted
  strcat(strbuf,">>");
  strcat(strbuf,hname[i]);
  h133->Draw(strbuf,"wght*(ptje>1.)");
  
  if(i==0){
    histo[i]->DrawClone();
  }else{
    histo[i]->DrawClone("same");
  }
  c1->Update();
}

This does not work, probably because the histos are created in the
subdirs, they are drawn once but vanish when the next histo is plotted.
How does one get them into a common dir, can't one make then somewhat
global?
Why does it not help to use DrawClone or DrawCopy?
Can someone give me a hint how one should do this?

Thanks in advance,
  Birger

/------------------------------------------------------------\
| Birger Koblitz                    koblitz@mail.desy.de     |
| Max-Planck-Institut fuer Physik                            |
| (Werner Heisenberg-Institut)                               |
| DESY-FH1K                         Tel. (40) 8998-3971      |
| Notkestr. 85                                               |
| D-22603  HAMBURG                                           |
\------------------------------------------------------------/



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET