Geant4_10
macro.C
Go to the documentation of this file.
1 {
2 gROOT -> Reset();
3 TFile f("brachytherapy.root");
4 
5 TDirectory* dir = (TDirectory*)f.Get("brachy_ntuple");
6 TTree* ntuple = (TTree*)dir->Get("1");
7 ntuple -> Print();
8 
14 ntuple->GetBranch("xx")->SetAddress(&xx);
15 ntuple->GetBranch("yy")->SetAddress(&yy);
16 ntuple->GetBranch("zz")->SetAddress(&zz);
17 ntuple->GetBranch("edep")->SetAddress(&edep);
18 
19 // Print the content of the ntuple
20 /*Int_t nevent = Int_t(ntuple->GetEntries());
21 
22 for ( Int_t i=0; i<nevent; i++ ) {
23  ntuple->GetEvent(i);
24  cout << "xx, yy, zz, edep: "
25  << xx << ", " << yy << ", " << zz << ", " << edep << endl;
26  }
27 */
28 
29 // The phantom is 30 cm wide along x, y, z
30 // the voxel size is 1 mm. The number of voxels is 300 along x, y, z
31 
32 // Plot the energy deposition in the phantom in 3D
33 TCanvas* c1 = new TCanvas("c1", " ");
34 
35 TH3F* edepDDistribution3D = new TH3F("h30", "3Dedepxyz",
36  300, -150, 150, // binning, xmin, xmax, along x direction
37  300, -150, 150, // binning, xmin, xmax, along y direction
38  300, -150, 150);// binning, xmin, xmax, along z direction
39 
40 gStyle->SetPalette(1);
41 
42 ntuple.Draw("xx:yy:zz:edep>>h30", "", "colz");
43 }
Double_t yy
Definition: macro.C:11
Int_t index
Definition: macro.C:9
Double_t xx
Definition: macro.C:10
TCanvas * c1
Definition: plotHisto.C:7
TTree * ntuple
Definition: macro.C:6
Double_t edep
Definition: macro.C:13
TH3F * edepDDistribution3D
Definition: macro.C:35
TFile f
Definition: plotHisto.C:6
G4int Int_t
ntupleExperimental Reset()
Double_t zz
Definition: macro.C:12
G4double Double_t
TDirectory * dir
Definition: macro.C:5
void Print(G4Element &ele)
Definition: pyG4Element.cc:56