40 : fScoringMesh(nullptr), verboseLevel(0), fact(1.0)
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 <<
"]";
108 ofile <<
", total(val^2), entry" <<
G4endl;
111 if(opt.find(
"sequence") != std::string::npos) {
118 ofile << std::setprecision(16);
120 for(
int y = 0;
y < fNMeshSegments[1];
y++) {
121 for(
int z = 0;
z < fNMeshSegments[2];
z++) {
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) {
140 if(count++%5 == 4) ofile <<
G4endl;
146 ofile << std::setprecision(6);
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 <<
"]";
203 ofile <<
", total(val^2), entry" <<
G4endl;
207 if(opt.find(
"sequence") != std::string::npos) {
214 ofile << std::setprecision(16);
216 for(
int y = 0;
y < fNMeshSegments[1];
y++) {
217 for(
int z = 0;
z < fNMeshSegments[2];
z++) {
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) {
236 if(count++%5 == 4) ofile <<
G4endl;
242 ofile << std::setprecision(6);