[ROOT] C++ Problem

From: Guy Ron (ronguy@tauphy.tau.ac.il)
Date: Mon Mar 10 2003 - 16:19:49 MET


Dear Rooters,
I'm running root on a linux machine (root version 3.05) and am trying to
produce a simple histogram, the source code runs fine under CINT but once
I compile it in C++ I can only access the entries in the tree but not draw
them (neither the histogram nor directly through tree->Draw()).
The source code I'm using is:

   TFile *hfile;
   TTree *tree;
   Double_t *event = 0;
   TH1F *hpx   = new TH1F("hpx","distribution",100,0,100);

   int nb;

    Event ev;
      hfile = new TFile("bbtreefile.root");
      tree = (TTree*)hfile->Get("bbtree");
      hfile->Print();

      tree->Show(20);
      //      tree->Draw("inipp");
      cout << tree->GetEntries() << "\n";
      tree->SetBranchAddress("mainE plane energy loss",&ev.zekind);
      for (nb=1;nb<10;nb++) {
      cout << tree->GetEntry(nb) << "\n";
      cout << ev.zekind << "\n";
      hpx->Fill(ev.zekind);
      }

      hpx->Draw();
     cin >> nb;
   hfile->Close();


Please HELP, I've been trying this for a few days now and am really
falling behind on my work.

Thanks,
	Guy



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET