51 std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(
int))(tolower));
56 if(opt.find(
"csv") == std::string::npos &&
57 opt.find(
"sequence") == std::string::npos)
59 G4cerr <<
"ERROR : DumpToFile : Unknown option -> " << option <<
G4endl;
64 std::ofstream
ofile(fileName);
67 G4cerr <<
"ERROR : DumpToFile : File open error -> " << fileName <<
G4endl;
77 MeshScoreMap::const_iterator msMapItr = fSMap.find(psName);
78 if(msMapItr == fSMap.end())
80 G4cerr <<
"ERROR : DumpToFile : Unknown quantity, \"" << psName <<
"\"."
85 std::map<G4int, G4StatDouble*>* score = msMapItr->second->GetMap();
86 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
89 ofile <<
"# multiplied factor : " <<
fact << std::endl;
97 ofile <<
"# i" << divisionAxisNames[0] <<
", i" << divisionAxisNames[1]
98 <<
", i" << divisionAxisNames[2];
100 ofile <<
", total(value) ";
102 ofile <<
"[" << unit <<
"]";
106 if(opt.find(
"sequence") != std::string::npos)
114 ofile << std::setprecision(16);
123 if(opt.find(
"csv") != std::string::npos)
124 ofile << x <<
"," << y <<
"," << z <<
",";
126 auto value = score->find(idx);
127 if(value == score->end())
129 ofile << 0. <<
"," << 0. <<
"," << 0;
133 ofile << (value->second->sum_wx()) / unitValue *
fact <<
","
134 << (value->second->sum_wx2()) / unitValue / unitValue *
fact *
136 <<
"," << value->second->n();
139 if(opt.find(
"csv") != std::string::npos)
143 else if(opt.find(
"sequence") != std::string::npos)
153 ofile << std::setprecision(6);
164 std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(
int))(tolower));
169 if(opt.find(
"csv") == std::string::npos &&
170 opt.find(
"sequence") == std::string::npos)
172 G4cerr <<
"ERROR : DumpToFile : Unknown option -> " << option <<
G4endl;
177 std::ofstream
ofile(fileName);
180 G4cerr <<
"ERROR : DumpToFile : File open error -> " << fileName <<
G4endl;
186 ofile <<
"# multiplied factor : " <<
fact << std::endl;
193 MeshScoreMap::const_iterator msMapItr = fSMap.begin();
194 std::map<G4int, G4StatDouble*>* score;
195 for(; msMapItr != fSMap.end(); msMapItr++)
199 score = msMapItr->second->GetMap();
200 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
207 ofile <<
"# i" << divisionAxisNames[0] <<
", i" << divisionAxisNames[1]
208 <<
", i" << divisionAxisNames[2];
210 ofile <<
", total(value) ";
212 ofile <<
"[" << unit <<
"]";
216 if(opt.find(
"sequence") != std::string::npos)
224 ofile << std::setprecision(16);
233 if(opt.find(
"csv") != std::string::npos)
234 ofile << x <<
"," << y <<
"," << z <<
",";
236 auto value = score->find(idx);
237 if(value == score->end())
239 ofile << 0. <<
"," << 0. <<
"," << 0;
243 ofile << (value->second->sum_wx()) / unitValue *
fact <<
","
244 << (value->second->sum_wx2()) / unitValue / unitValue *
fact *
246 <<
"," << value->second->n();
249 if(opt.find(
"csv") != std::string::npos)
253 else if(opt.find(
"sequence") != std::string::npos)
263 ofile << std::setprecision(6);
G4GLOB_DLL std::ostream G4cerr
G4VScoringMesh * fScoringMesh
virtual void DumpQuantityToFile(const G4String &psName, const G4String &fileName, const G4String &option)
virtual void DumpAllQuantitiesToFile(const G4String &fileName, const G4String &option)
G4int GetIndex(G4int x, G4int y, G4int z) const
void SetScoringMesh(G4VScoringMesh *sm)
void GetNumberOfSegments(G4int nSegment[3])
G4double GetPSUnitValue(const G4String &psname)
G4String GetPSUnit(const G4String &psname)
const G4String & GetWorldName() const
std::map< G4String, RunScore * > MeshScoreMap
void GetDivisionAxisNames(G4String divisionAxisNames[3])
MeshScoreMap GetScoreMap() const