88{
89 G4int nofEvents = aRun->GetNumberOfEvent();
90
91 static G4double local_total_dose = 0;
92 G4double total_dose = 0;
93
95
96 for ( G4int i = 0; i < (G4int)
fSDName.size(); i++ ){
97
98
99
100
101
102
105
106 if( DoseDeposit && DoseDeposit->GetMap()->size() != 0 ) {
107 std::map<G4int,G4double*>::iterator itr =
108 DoseDeposit->GetMap()->begin();
109 for(; itr != DoseDeposit->GetMap()->end(); itr++) {
110 if(!IsMaster()) { local_total_dose += *(itr->second); }
111 total_dose += *(itr->second);
112 }
113 }
114
115 }
116
117 if (IsMaster())
118 {
119 G4cout << "--------------------End of Global Run-----------------------"
120 << G4endl;
121 G4cout << " The run was " << nofEvents << " events " << G4endl;
122 G4cout << "LOCAL TOTAL DOSE : \t" << local_total_dose/gray
123 << " Gy" << G4endl;
124 G4cout << " TOTAL DOSE : \t" << total_dose/gray
125 << " Gy" << G4endl;
126
127 }
128 else
129 {
130 G4cout << "--------------------End of Local Run------------------------"
131 << G4endl;
132 G4cout << " The run was " << nofEvents << G4endl;
133 G4cout << "LOCAL TOTAL DOSE : \t" << local_total_dose/gray
134 << " Gy" << G4endl;
135 G4cout << " TOTAL DOSE : \t" << total_dose/gray
136 << " Gy" << G4endl;
137
138 }
139
140 if(IsMaster()) {
141 G4cout << " ###### EndOfRunAction ###### " << G4endl;
142
144
145
146 for ( G4int i = 0; i < (G4int)
fSDName.size(); i++ ){
147
148
149
150
151
152
155
156 G4cout << "============================================================="
157 <<G4endl;
158 G4cout << " Number of event processed : "
159 << aRun->GetNumberOfEvent() << G4endl;
160 G4cout << "============================================================="
161 <<G4endl;
162
163 std::ofstream fileout;
165 fileout.open(fname);
166 G4cout << " opened file " << fname << " for dose output" << G4endl;
167
168 if( DoseDeposit && DoseDeposit->GetMap()->size() != 0 ) {
169 std::ostream *myout = &G4cout;
171 std::map<G4int,G4double*>::iterator itr =DoseDeposit->GetMap()->begin();
172 for(; itr != DoseDeposit->GetMap()->end(); itr++) {
173 fileout << itr->first
174 << " " << *(itr->second)/CLHEP::gray
175 << G4endl;
176
177
178
179
180 }
181 G4cout << "============================================="<<G4endl;
182 } else {
183 G4Exception("DicomRunAction", "000", JustWarning,
184 "DoseDeposit HitsMap is either a null pointer of the HitsMap was empty");
185 }
186 fileout.close();
187 G4cout << " closed file " << fname << " for dose output" << G4endl;
188
189 }
190 }
191
192 G4cout << "Finished : End of Run Action " << aRun->GetRunID() << G4endl;
193
194}
void PrintHeader(std::ostream *out)
G4THitsMap< G4double > * GetHitsMap(G4int i) const