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