157 std::transform(opt.begin(), opt.end(), opt.begin(), (
int (*)(
int))(tolower));
160 if(opt.size() == 0) opt =
"csv";
161 if(opt.find(
"csv") == std::string::npos &&
162 opt.find(
"sequence") == std::string::npos) {
163 G4cerr <<
"ERROR : DumpToFile : Unknown option -> "
169 std::ofstream
ofile(fileName);
171 G4cerr <<
"ERROR : DumpToFile : File open error -> "
179 MeshScoreMap::const_iterator msMapItr = fSMap.begin();
180 std::map<G4int, G4StatDouble*> * score;
181 for(; msMapItr != fSMap.end(); msMapItr++) {
185 score = msMapItr->second->GetMap();
186 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
193 ofile <<
"# i" << divisionAxisNames[0]
194 <<
", i" << divisionAxisNames[1]
195 <<
", i" << divisionAxisNames[2];
197 ofile <<
", total(value) ";
198 if(unit.size() > 0)
ofile <<
"[" << unit <<
"]";
203 if(opt.find(
"sequence") != std::string::npos) {
210 ofile << std::setprecision(16);
212 for(
int y = 0; y < fNMeshSegments[1]; y++) {
213 for(
int z = 0;
z < fNMeshSegments[2];
z++) {
216 if(opt.find(
"csv") != std::string::npos)
217 ofile <<
x <<
"," << y <<
"," <<
z <<
",";
219 std::map<G4int, G4StatDouble*>::iterator
value = score->find(idx);
220 if(value == score->end()) {
221 ofile << 0. <<
"," << 0. <<
"," << 0;
223 ofile << (value->second->sum_wx())/unitValue <<
","
224 << (value->second->sum_wx2())/unitValue/unitValue <<
","
225 << value->second->n();
228 if(opt.find(
"csv") != std::string::npos) {
230 }
else if(opt.find(
"sequence") != std::string::npos) {
238 ofile << std::setprecision(6);
const G4String & GetWorldName() const
G4double GetPSUnitValue(const G4String &psname)
G4String GetPSUnit(const G4String &psname)
G4VScoringMesh * fScoringMesh
const XML_Char int const XML_Char * value
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4int GetIndex(G4int x, G4int y, G4int z) const
void GetDivisionAxisNames(G4String divisionAxisNames[3])
MeshScoreMap GetScoreMap() const
std::map< G4String, RunScore * > MeshScoreMap
G4GLOB_DLL std::ostream G4cerr