161{
162
164 std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(int))(tolower));
165
166
167 if(opt.empty())
168 opt = "csv";
169 if(opt.find("csv") == std::string::npos &&
170 opt.find("sequence") == std::string::npos)
171 {
172 G4cerr <<
"ERROR : DumpToFile : Unknown option -> " << option <<
G4endl;
173 return;
174 }
175
176
177 std::ofstream
ofile(fileName);
179 {
180 G4cerr <<
"ERROR : DumpToFile : File open error -> " << fileName <<
G4endl;
181 return;
182 }
185 {
186 ofile <<
"# multiplied factor : " <<
fact << std::endl;
187 }
188
189
192
193 MeshScoreMap::const_iterator msMapItr = fSMap.begin();
194 std::map<G4int, G4StatDouble*>* score;
195 for(; msMapItr != fSMap.end(); msMapItr++)
196 {
198
199 score = msMapItr->second->GetMap();
200 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
201
206
207 ofile <<
"# i" << divisionAxisNames[0] <<
", i" << divisionAxisNames[1]
208 << ", i" << divisionAxisNames[2];
209
210 ofile <<
", total(value) ";
211 if(!unit.empty())
212 ofile <<
"[" << unit <<
"]";
214
215
216 if(opt.find("sequence") != std::string::npos)
217 {
220 }
221
222
223 long count = 0;
224 ofile << std::setprecision(16);
226 {
228 {
230 {
232
233 if(opt.find("csv") != std::string::npos)
234 ofile << x <<
"," << y <<
"," << z <<
",";
235
236 auto value = score->find(idx);
237 if(value == score->end())
238 {
239 ofile << 0. <<
"," << 0. <<
"," << 0;
240 }
241 else
242 {
243 ofile << (value->second->sum_wx()) / unitValue *
fact <<
","
244 << (value->second->sum_wx2()) / unitValue / unitValue *
fact *
246 << "," << value->second->n();
247 }
248
249 if(opt.find("csv") != std::string::npos)
250 {
252 }
253 else if(opt.find("sequence") != std::string::npos)
254 {
256 if(count++ % 5 == 4)
258 }
259
260 }
261 }
262 }
263 ofile << std::setprecision(6);
264
265 }
266
267
269}
G4GLOB_DLL std::ostream G4cerr
G4VScoringMesh * fScoringMesh
G4int GetIndex(G4int x, G4int y, G4int z) const
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