63 G4cout <<
"BrachyUserScorer-defined DumpQuantityToFile() method is invoked."
68 std::transform(opt.begin(), opt.end(), opt.begin(), (
int (*)(
int))(tolower));
71 if(opt.size() == 0) opt =
"csv";
74 std::ofstream
ofile(fileName);
76 G4cerr <<
"ERROR : DumpToFile : File open error -> "
85 MeshScoreMap::const_iterator msMapItr = fSMap.find(psName);
86 if(msMapItr == fSMap.end()) {
87 G4cerr <<
"ERROR : DumpToFile : Unknown quantity, \""
88 << psName <<
"\"." <<
G4endl;
91 std::map<G4int, G4double*> * score = msMapItr ->
second-> GetMap();
92 ofile <<
"# primitive scorer name: " << msMapItr -> first <<
G4endl;
101 analysisManager -> OpenFile(
"brachytherapy");
106 analysisManager -> CreateNtuple(
"EnergyDeposition",
"Edep(keV) in the phantom");
107 analysisManager -> CreateNtupleDColumn(
"xx");
108 analysisManager -> CreateNtupleDColumn(
"yy");
109 analysisManager -> CreateNtupleDColumn(
"zz");
110 analysisManager -> CreateNtupleDColumn(
"edep");
111 analysisManager -> FinishNtuple();
116 ofile << std::setprecision(16);
118 for(
int y = 0;
y < fNMeshSegments[1];
y++) {
119 for(
int z = 0;
z < fNMeshSegments[2];
z++) {
121 G4int numberOfVoxel = fNMeshSegments[0];
128 G4double xx = ( - numberOfVoxel + 1+ 2*
x )* voxelWidth/2;
129 G4double yy = ( - numberOfVoxel + 1+ 2*
y )* voxelWidth/2;
130 G4double zz = ( - numberOfVoxel + 1+ 2*
z )* voxelWidth/2;
134 std::map<G4int, G4double*>::iterator
value = score -> find(idx);
136 if (value != score -> end())
139 ofile << xx <<
" " << yy <<
" " << zz <<
" " <<*(value->second)/
keV << G4endl;
142 analysisManager = G4AnalysisManager::Instance();
143 analysisManager -> FillNtupleDColumn(0, xx);
144 analysisManager -> FillNtupleDColumn(1, yy);
145 analysisManager -> FillNtupleDColumn(2, zz);
146 analysisManager -> FillNtupleDColumn(3, *(value->second)/
keV);
147 analysisManager -> AddNtupleRow();
152 ofile << std::setprecision(6);
158 analysisManager -> Write();
159 analysisManager -> CloseFile();