Geant4 Cross Reference |
1 { 1 { 2 gROOT -> Reset(); 2 gROOT -> Reset(); 3 TFile f("brachytherapy.root"); 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 >> 9 Int_t index; >> 10 Double_t xx; >> 11 Double_t yy; >> 12 Double_t zz; >> 13 Double_t edep; >> 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 4 TCanvas* c1 = new TCanvas("c1", " "); 33 TCanvas* c1 = new TCanvas("c1", " "); 5 h20->Draw(""); << 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"); 6 } 43 } 7 44