Filling multiple histograms

From: lijowski@cosray2.wustl.edu
Date: Fri Jul 31 1998 - 18:50:38 MEST


  Hello Rooters,

  Thanks for all previous responses. I still have one more
  question regarding using filling multiple histograms like those 
  in dirs.C macro in tutorials directory. I need to fill one of 
  them based on selections depending on other entries in the 
  ntuple. 

  Below is a fragment of the macro reading ntuple and filling histograms.

 //     This is the loop skeleton
//       To read only selected branches, Insert statements like:
   t9000->SetBranchStatus("*",0);  // disable all branches
   t9000->SetBranchStatus("Dx2",1);  // activate branchname
   t9000->SetBranchStatus("Dy2",1);  // activate branchname
   t9000->SetBranchStatus("Dx2",1);  // activate branchname
   t9000->SetBranchStatus("Dy2",1);  // activate branchname

// create histograms for dx2
   
   char hname[20];
   char htitle[80];

   const Int_t xsize = 27, ysize = 27;
   Float_t xmin = -1.2, xmax = 1.2;
   Int_t  nbins = 120;

   for (Int_t yk = 0; yk < ysize; yk++) {
       for (Int_t  xk = 0; xk < xsize; xk++) {
           sprintf(hname,"X_Band%2d_Hist%2d", yk, xk);
           sprintf(htitle,"    H2 X plane  X Band %2d  Hist %2d      ", yk, xk);
           Int_t  hidx = yk * xsize + xk;
           TH1F *h2x = new TH1F(hname, htitle, nbins, xmin, xmax);           
           }
       }

   for  (Int_t ii = 0; ii < Noevents; ii++) {
       t9000 -> GetEvent(ii);
       Int_t xk = (int) (Xx2 / 10.0);
       Int_t yk = (int) (Yy2 / 10.0);
       Int_t hidx = yk * xsize + xk;
 // Here I want to fill a histogram number hidx. How do I do it?
 //      h2x -> Fill(Dx2);
       }

     Thanks in advance.

     Michal Lijowski

------------------------------------------------------------------------
Michal Lijowski                  Washington University
Research Associate               St. Louis, MO 63130-4899, USA 
Department of Physics            phone:   314-935-6285
Campus Box 1105                  email:   lijowski@cosray2.wustl.edu
------------------------------------------------------------------------



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