41 : fScoringMesh(0), verboseLevel(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, G4double*> * score = msMapItr->second->GetMap();
93 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
101 ofile <<
"# i" << divisionAxisNames[0]
102 <<
", i" << divisionAxisNames[1]
103 <<
", i" << divisionAxisNames[2];
106 if(unit.size() > 0)
ofile <<
"[" << unit <<
"]";
110 if(opt.find(
"sequence") != std::string::npos) {
117 ofile << std::setprecision(16);
123 if(opt.find(
"csv") != std::string::npos)
124 ofile << x <<
"," << y <<
"," << z <<
",";
126 std::map<G4int, G4double*>::iterator value = score->find(idx);
127 if(value == score->end()) {
130 ofile << *(value->second)/unitValue;
133 if(opt.find(
"csv") != std::string::npos) {
135 }
else if(opt.find(
"sequence") != std::string::npos) {
143 ofile << std::setprecision(6);
155 std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(
int))(tolower));
158 if(opt.size() == 0) opt =
"csv";
159 if(opt.find(
"csv") == std::string::npos &&
160 opt.find(
"sequence") == std::string::npos) {
161 G4cerr <<
"ERROR : DumpToFile : Unknown option -> "
167 std::ofstream
ofile(fileName);
169 G4cerr <<
"ERROR : DumpToFile : File open error -> "
177 MeshScoreMap::const_iterator msMapItr = fSMap.begin();
178 std::map<G4int, G4double*> * score;
179 for(; msMapItr != fSMap.end(); msMapItr++) {
183 score = msMapItr->second->GetMap();
184 ofile <<
"# primitive scorer name: " << msMapItr->first << std::endl;
191 ofile <<
"# i" << divisionAxisNames[0]
192 <<
", i" << divisionAxisNames[1]
193 <<
", i" << divisionAxisNames[2];
196 if(unit.size() > 0)
ofile <<
"[" << unit <<
"]";
201 if(opt.find(
"sequence") != std::string::npos) {
208 ofile << std::setprecision(16);
214 if(opt.find(
"csv") != std::string::npos)
215 ofile << x <<
"," << y <<
"," << z <<
",";
217 std::map<G4int, G4double*>::iterator value = score->find(idx);
218 if(value == score->end()) {
221 ofile << *(value->second)/unitValue;
224 if(opt.find(
"csv") != std::string::npos) {
226 }
else if(opt.find(
"sequence") != std::string::npos) {
234 ofile << std::setprecision(6);
std::map< G4String, G4THitsMap< G4double > * > MeshScoreMap
G4DLLIMPORT 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)
MeshScoreMap GetScoreMap()
const G4String & GetWorldName() const
void GetDivisionAxisNames(G4String divisionAxisNames[3])