File indexing completed on 2025-02-23 09:19:27
0001 void Read(TString source, TString physics_list){
0002
0003
0004
0005 gROOT -> Reset();
0006 TString fileName="brachytherapy_"+source+"_"+physics_list+".root";
0007 std::cout<< "Reading " << fileName << std::endl;
0008
0009 TFile f(fileName);
0010
0011 Double_t Seed_length = 0.35;
0012
0013 Double_t EnergyMap[401];
0014 Int_t Voxels[401];
0015 Double_t normDose[401];
0016 Double_t GeomFunction[401];
0017 Double_t GeometryFunctionZero;
0018 Double_t beta;
0019 Double_t R;
0020 Double_t K;
0021 Double_t Radial[401];
0022 Double_t radius;
0023 Int_t radInt;
0024 Int_t numberOfBins=801;
0025
0026 for (int i=0; i <401; i++)
0027 {
0028 EnergyMap[i]=0.;
0029 Voxels[i]=0.;
0030 }
0031
0032
0033 for (int k=0; k< numberOfBins; k++)
0034 {
0035 for (int m=0; m< numberOfBins; m++)
0036 {
0037 Double_t xx_histo = h20->GetXaxis()->GetBinCenter(k);
0038 Double_t yy_histo = h20->GetYaxis()->GetBinCenter(m);
0039 Double_t edep_histo=h20->GetBinContent(k, m);
0040 radius = sqrt(xx_histo*xx_histo+yy_histo*yy_histo);
0041
0042
0043
0044 if (radius != 0){
0045 radInt = TMath::Nint(4*radius);
0046 if ((radInt>0)&&(radInt<=400))
0047 {
0048 EnergyMap[radInt]+= edep_histo;
0049 Voxels[radInt]+= 1;
0050
0051
0052 }
0053 }
0054
0055 }}
0056
0057
0058 std::cout << "The energy deposition at the reference point is " << EnergyMap[40] << std::endl;
0059 Double_t tempNormValue = EnergyMap[40]/Voxels[40];
0060
0061 std::cout << "Dose rate ditribution (distances in cm)" << std::endl;
0062
0063 ofstream myfile;
0064 TString outputFileName ="geant4_dose_"+ source+"_"+physics_list+".txt";
0065
0066 myfile.open(outputFileName);
0067 std::cout << "file " << outputFileName << " is created "<<std::endl;
0068
0069 for (int i=0; i<=400; i++)
0070 {
0071 R = double(i)/40;
0072 if (Voxels[i]>0) normDose[i] = EnergyMap[i]/Voxels[i]/tempNormValue;
0073 else normDose[i] = 0;
0074
0075
0076
0077 if (R> 0.05)
0078 {
0079
0080 myfile << R << " " << normDose[i] << "\n";
0081 }
0082 }
0083
0084 myfile.close();
0085 }
0086