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);
119 for(
int y = 0;
y < fNMeshSegments[1];
y++) {
120 for(
int z = 0;
z < fNMeshSegments[2];
z++) {
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) {
137 if(count++%5 == 4) ofile <<
G4endl;
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);
210 for(
int y = 0;
y < fNMeshSegments[1];
y++) {
211 for(
int z = 0;
z < fNMeshSegments[2];
z++) {
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) {
228 if(count++%5 == 4) ofile <<
G4endl;
234 ofile << std::setprecision(6);
void GetNumberOfSegments(G4int nSegment[3])
const G4String & GetWorldName() const
std::map< G4String, G4THitsMap< G4double > * > MeshScoreMap
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4double GetPSUnitValue(const G4String &psname)
G4String GetPSUnit(const G4String &psname)
G4VScoringMesh * fScoringMesh
virtual void DumpAllQuantitiesToFile(const G4String &fileName, const G4String &option)
G4int GetIndex(G4int x, G4int y, G4int z) const
void SetScoringMesh(G4VScoringMesh *sm)
void GetDivisionAxisNames(G4String divisionAxisNames[3])
MeshScoreMap GetScoreMap() const
const XML_Char int const XML_Char * value
virtual ~G4VScoreWriter()
G4GLOB_DLL std::ostream G4cerr
virtual void DumpQuantityToFile(const G4String &psName, const G4String &fileName, const G4String &option)