Hello, Instead using Draw to plot histograms of the individual entries in the root ntuple I would like to create histograms and fill them with selected entries in the ntuple. I am not quite sure how to do it after reading the existing documentation. In the next version of the included macro I would create 2 x 27 x 27 histograms of the same quantities and save them into a file. Thanks in advance for help. 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 ------------------------------------------------------------------------ // read HBOOK generated ntuple and produce histograms of dx2 and dy2 void make_dxdy_hists() { gROOT->Reset(); // Connect CRIS ROOT ntuple file generated by h2root // from the HBOOK make_cris_ntuple.rz file TFile *f1 = new TFile("/data3/users/lijowski/make_cris_ntuple.root.1"); f1 -> ls(); // connect a tree to an ntuple in the input file TTree *t9000 = (TTree*)f1 -> Get("h9000;1"); t9000 -> Print(); // create a new Root file TFile *top = new TFile("dxdy_hists.root", "recreate"); // create a new subdirectory in this file TDirectory *cdTOP = top -> mkdir("TOP"); cdTOP -> cd(); // create two histograms one for dx2 and another for dy2 char hname[20]; char htitle[80]; Float_t xmin = -1.2, xmax = 1.2; Int_t nbins = 120; sprintf(hname, "H2X-plane-dx2"); sprintf(htitle,"H2 X plane dx2"); TH1F *h2x = new TH1F(hname, htitle, nbins, xmin, xmax); // h2x -> Fill(dx2); sprintf(hname, "H2Y-plane-dy2"); sprintf(htitle,"H2 Y plane dy2"); TH1F *h2y = new TH1F(hname, htitle, nbins, xmin, xmax); // h2y -> Fill(dy2); // save histogram hierarchy in the file top -> Write(); }
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:35 MET