Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
macro.C
Go to the documentation of this file.
1 {
2 TFile f("g4humanphantom.root");
3 
4 TDirectory* dir = (TDirectory*)f.Get("ntuple");
5 TTree* ntuple = (TTree*)dir->Get("ntuple1");
6 ntuple -> Print();
7 
10 
11 ntuple->GetBranch("ID")->SetAddress(&organ_id);
12 ntuple->GetBranch("Edep")->SetAddress(&edep);
13 
14 // Print the content of the ntuple
15 Int_t nevent = ntuple->GetEntries();
16 
17  for ( Int_t i=0; i<nevent; i++ ) {
18  ntuple->GetEvent(i);
19  cout << "organ id, edep (MeV): "
20  << organ_id << ", " << edep << endl;
21  }
22 }