40 : fScoringMesh(nullptr)
61 std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(
int))(tolower));
66 if(opt.find(
"csv") == std::string::npos &&
67 opt.find(
"sequence") == std::string::npos)
69 G4cerr <<
"ERROR : DumpToFile : Unknown option -> " << option <<
G4endl;
74 std::ofstream
ofile(fileName);
77 G4cerr <<
"ERROR : DumpToFile : File open error -> " << fileName <<
G4endl;
86 MeshScoreMap::const_iterator msMapItr = fSMap.find(psName);
87 if(msMapItr == fSMap.end())
89 G4cerr <<
"ERROR : DumpToFile : Unknown quantity, \"" << psName <<
"\"."
94 std::map<G4int, G4StatDouble*>* score = msMapItr->second->GetMap();
95 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
98 ofile <<
"# multiplied factor : " <<
fact << std::endl;
106 ofile <<
"# i" << divisionAxisNames[0] <<
", i" << divisionAxisNames[1]
107 <<
", i" << divisionAxisNames[2];
109 ofile <<
", total(value) ";
111 ofile <<
"[" << unit <<
"]";
115 if(opt.find(
"sequence") != std::string::npos)
123 ofile << std::setprecision(16);
132 if(opt.find(
"csv") != std::string::npos)
133 ofile << x <<
"," << y <<
"," << z <<
",";
135 std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
136 if(value == score->end())
138 ofile << 0. <<
"," << 0. <<
"," << 0;
142 ofile << (value->second->sum_wx()) / unitValue *
fact <<
","
143 << (value->second->sum_wx2()) / unitValue / unitValue *
fact *
145 <<
"," << value->second->n();
148 if(opt.find(
"csv") != std::string::npos)
152 else if(opt.find(
"sequence") != std::string::npos)
162 ofile << std::setprecision(6);
173 std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(
int))(tolower));
178 if(opt.find(
"csv") == std::string::npos &&
179 opt.find(
"sequence") == std::string::npos)
181 G4cerr <<
"ERROR : DumpToFile : Unknown option -> " << option <<
G4endl;
186 std::ofstream
ofile(fileName);
189 G4cerr <<
"ERROR : DumpToFile : File open error -> " << fileName <<
G4endl;
195 ofile <<
"# multiplied factor : " <<
fact << std::endl;
201 MeshScoreMap::const_iterator msMapItr = fSMap.begin();
202 std::map<G4int, G4StatDouble*>* score;
203 for(; msMapItr != fSMap.end(); msMapItr++)
207 score = msMapItr->second->GetMap();
208 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
215 ofile <<
"# i" << divisionAxisNames[0] <<
", i" << divisionAxisNames[1]
216 <<
", i" << divisionAxisNames[2];
218 ofile <<
", total(value) ";
220 ofile <<
"[" << unit <<
"]";
224 if(opt.find(
"sequence") != std::string::npos)
232 ofile << std::setprecision(16);
241 if(opt.find(
"csv") != std::string::npos)
242 ofile << x <<
"," << y <<
"," << z <<
",";
244 std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
245 if(value == score->end())
247 ofile << 0. <<
"," << 0. <<
"," << 0;
251 ofile << (value->second->sum_wx()) / unitValue *
fact <<
","
252 << (value->second->sum_wx2()) / unitValue / unitValue *
fact *
254 <<
"," << value->second->n();
257 if(opt.find(
"csv") != std::string::npos)
261 else if(opt.find(
"sequence") != std::string::npos)
271 ofile << std::setprecision(6);
G4GLOB_DLL std::ostream G4cerr
virtual ~G4VScoreWriter()
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