58 G4cout <<
"User-defined DumpQuantityToFile() method is invoked."
60 G4cout <<
" -- to obtain a projection of the quantity <"
62 <<
"> onto the x-y plane --" <<
G4endl;
67 std::transform(opt.begin(), opt.end(), opt.begin(), (
int (*)(
int))(tolower));
70 if(opt.size() == 0) opt =
"csv";
73 std::ofstream
ofile(fileName);
75 G4cerr <<
"ERROR : DumpToFile : File open error -> "
85 MeshScoreMap::const_iterator msMapItr = scMap.find(psName);
86 if(msMapItr == scMap.end()) {
87 G4cerr <<
"ERROR : DumpToFile : Unknown quantity, \""
88 << psName <<
"\"." <<
G4endl;
91 std::map<G4int, G4StatDouble*> * score = msMapItr->second->GetMap();
92 ofile <<
"# primitive scorer name: " << msMapItr->first <<
G4endl;
95 ofile <<
"# xy projection" <<
G4endl;
99 std::vector<double> projy;
101 std::vector<std::vector<double> > projxy;
102 for(
int x = 0;
x < fNMeshSegments[0];
x++) projxy.push_back(projy);
104 ofile << std::setprecision(16);
105 for(
int x = 0;
x < fNMeshSegments[0];
x++) {
106 for(
int y = 0;
y < fNMeshSegments[1];
y++) {
107 for(
int z = 0;
z < fNMeshSegments[2];
z++) {
111 std::map<G4int, G4StatDouble*>::iterator
value = score->find(idx);
112 if(value != score->end()) projxy[
x][
y] += value->second->sum_wx();
119 ofile << std::setprecision(16);
120 for(
int x = 0;
x < fNMeshSegments[0];
x++) {
121 for(
int y = 0;
y < fNMeshSegments[1];
y++) {
123 ofile <<
x <<
"," <<
y <<
",";
128 ofile << std::setprecision(6);
MeshScoreMap GetScoreMap() const
virtual ~RE03UserScoreWriter()
G4int GetIndex(G4int x, G4int y, G4int z) const
G4VScoringMesh * fScoringMesh
const G4String & GetWorldName() const
virtual void DumpQuantityToFile(const G4String &psName, const G4String &fileName, const G4String &option)
const XML_Char int const XML_Char * value
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
Definition of the RE03UserScoreWriter class.
std::map< G4String, RunScore * > MeshScoreMap