40 : fScoringMesh(nullptr), verboseLevel(0), fact(1.0)
59 std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(
int))(tolower));
62 if(opt.size() == 0) opt =
"csv";
63 if(opt.find(
"csv") == std::string::npos &&
64 opt.find(
"sequence") == std::string::npos) {
65 G4cerr <<
"ERROR : DumpToFile : Unknown option -> "
71 std::ofstream
ofile(fileName);
73 G4cerr <<
"ERROR : DumpToFile : File open error -> "
84 MeshScoreMap::const_iterator msMapItr = fSMap.find(psName);
85 if(msMapItr == fSMap.end()) {
86 G4cerr <<
"ERROR : DumpToFile : Unknown quantity, \""
87 << psName <<
"\"." <<
G4endl;
92 std::map<G4int, G4StatDouble*> * score = msMapItr->second->GetMap();
93 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
95 {
ofile <<
"# multiplied factor : " <<
fact << std::endl; }
102 ofile <<
"# i" << divisionAxisNames[0]
103 <<
", i" << divisionAxisNames[1]
104 <<
", i" << divisionAxisNames[2];
106 ofile <<
", total(value) ";
107 if(unit.size() > 0)
ofile <<
"[" << unit <<
"]";
111 if(opt.find(
"sequence") != std::string::npos) {
118 ofile << std::setprecision(16);
124 if(opt.find(
"csv") != std::string::npos)
125 ofile << x <<
"," << y <<
"," << z <<
",";
127 std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
128 if(value == score->end()) {
129 ofile << 0. <<
"," << 0. <<
"," << 0;
131 ofile << (value->second->sum_wx())/unitValue*
fact <<
","
132 << (value->second->sum_wx2())/unitValue/unitValue*
fact*
fact <<
","
133 << value->second->n();
136 if(opt.find(
"csv") != std::string::npos) {
138 }
else if(opt.find(
"sequence") != std::string::npos) {
146 ofile << std::setprecision(6);
158 std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(
int))(tolower));
161 if(opt.size() == 0) opt =
"csv";
162 if(opt.find(
"csv") == std::string::npos &&
163 opt.find(
"sequence") == std::string::npos) {
164 G4cerr <<
"ERROR : DumpToFile : Unknown option -> "
170 std::ofstream
ofile(fileName);
172 G4cerr <<
"ERROR : DumpToFile : File open error -> "
178 {
ofile <<
"# multiplied factor : " <<
fact << std::endl; }
183 MeshScoreMap::const_iterator msMapItr = fSMap.begin();
184 std::map<G4int, G4StatDouble*> * score;
185 for(; msMapItr != fSMap.end(); msMapItr++) {
189 score = msMapItr->second->GetMap();
190 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
197 ofile <<
"# i" << divisionAxisNames[0]
198 <<
", i" << divisionAxisNames[1]
199 <<
", i" << divisionAxisNames[2];
201 ofile <<
", total(value) ";
202 if(unit.size() > 0)
ofile <<
"[" << unit <<
"]";
207 if(opt.find(
"sequence") != std::string::npos) {
214 ofile << std::setprecision(16);
220 if(opt.find(
"csv") != std::string::npos)
221 ofile << x <<
"," << y <<
"," << z <<
",";
223 std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
224 if(value == score->end()) {
225 ofile << 0. <<
"," << 0. <<
"," << 0;
227 ofile << (value->second->sum_wx())/unitValue*
fact <<
","
228 << (value->second->sum_wx2())/unitValue/unitValue*
fact*
fact <<
","
229 << value->second->n();
232 if(opt.find(
"csv") != std::string::npos) {
234 }
else if(opt.find(
"sequence") != std::string::npos) {
242 ofile << std::setprecision(6);
G4GLOB_DLL std::ostream G4cerr
std::size_t first(char) const
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