53 fName(fDetector->GetMFDName())
90 std::ofstream fileout;
95 <<
"============================================================";
97 typedef std::set<G4int> IDSet_t;
101 const TSRun* tsRun =
static_cast<const TSRun*
>(aRun);
107 std::vector<G4String> primScorerNames {
"EnergyDeposit",
109 std::vector<G4String> fnames {
"mfd_tl",
"mfd_tg" };
111 std::vector<G4String> unitstr {
"keV",
"steps" };
115 auto print = [] (std::ostream& fout,
121 <<
" " << second/unit1
125 <<
" " << std::setw(10) << first
126 <<
" " << std::setw(15) << std::setprecision(6)
127 << std::fixed << second/unit2 <<
" " << unit2str
129 G4cout.unsetf(std::ios::fixed);
133 auto stat_print = [] (std::ostream& fout,
139 auto fsecond = (*stat);
140 auto psecond = (*stat);
145 fout << first <<
" " << fsecond <<
G4endl;
146 conv->ShowResult(fout);
148 std::stringstream ss;
149 ss <<
" " << std::setw(10) << first
150 <<
" " << std::setw(15) << std::setprecision(6)
151 << std::fixed << psecond <<
" " << unit2str;
157 for(
unsigned i = 0; i < primScorerNames.size(); ++i)
159 for(
unsigned j = 0; j < fnames.size(); ++j)
161 fname = fnames.at(j) +
"_" + primScorerNames.at(i) +
".out";
164 G4cout <<
" opened file " << fname <<
" for output" <<
G4endl;
177 if(hitmap && hitmap->
size() != 0)
179 for(
auto itr = hitmap->
begin(); itr != hitmap->
end(); itr++)
183 IDs.insert(itr->first);
184 std::get<0>(
fTypeCompare[primScorerNames.at(i)][itr->first])
185 = *itr->second/units.at(i);
186 print(fileout, itr->first, *itr->second,
187 units.at(i), units.at(i+1), unitstr.at(i));
195 if(statmap && statmap->
size() != 0 &&
196 convmap && convmap->
size() != 0)
198 auto stat_fname =
"stat_" +
fname;
199 std::ofstream statout;
200 statout.open(stat_fname);
201 for(
auto itr = statmap->
begin(); itr != statmap->
end(); itr++)
206 stat_print(statout, _f, _s, _c,
207 units.at(i), units.at(i+1), unitstr.at(i));
213 std::stringstream ss;
214 ss <<
" StatMap/ConvMap is either not "
215 <<
"created or the StatMap/ConvMap was empty";
217 ss <<
" (StatMap size == " << statmap->
size() <<
")";
219 ss <<
" (ConvMap size == " << convmap->
size() <<
")";
230 " HitsMap is either not "
231 "created or the HitsMap was empty").c_str());
238 primScorerNames.at(i));
239 if(hitmap && hitmap->
size() != 0)
241 for(
auto itr = hitmap->
begin(); itr != hitmap->
end(); itr++)
243 IDs.insert(itr->first);
244 std::get<1>(
fTypeCompare[primScorerNames.at(i)][itr->first])
245 = *itr->second/units.at(i);
246 print(fileout, itr->first, *itr->second,
247 units.at(i), units.at(i+1), unitstr.at(i));
259 " HitsMap is either not "
260 "created or the HitsMap was empty").c_str());
266 G4cout <<
" closed file " << fname <<
" for output" <<
G4endl;
271 primScorerNames.at(i));
272 if(hitmap && hitmap->size() != 0)
274 for(
auto itr = hitmap->begin();
275 itr != hitmap->end(); itr++)
277 IDs.insert(itr->first);
278 std::get<2>(
fTypeCompare[primScorerNames.at(i)][itr->first])
279 = itr->second/units.at(i);
290 fname =
"mfd_diff.out";
294 G4cout <<
" opened file " << fname <<
" for difference output" <<
G4endl;
297 fileout <<
" " << std::setw(10) <<
"ID"
299 << std::setw(30) << std::setprecision(12) << std::fixed
302 << std::setw(30) << std::setprecision(12) << std::fixed
303 <<
"Atomic Hits Map value"
305 << std::setw(30) << std::setprecision(8) << std::scientific
308 << std::setw(30) << std::setprecision(8) << std::scientific
309 <<
"Diff (MFD - MUTEXED)"
311 << std::setw(30) << std::setprecision(8) << std::scientific
312 <<
"Diff (ATOM_HIT_MAP - MUTEXED)"
318 fileout <<
"\n\nType = " << itr1->first <<
"\n" <<
G4endl;
319 for(
auto itr2 = itr1->second.begin();
320 itr2 != itr1->second.end(); ++itr2)
323 = std::fabs(std::get<0>(itr2->second) -
324 std::get<1>(itr2->second));
326 = std::fabs(std::get<0>(itr2->second) -
327 std::get<2>(itr2->second));
329 = std::fabs(std::get<1>(itr2->second) -
330 std::get<2>(itr2->second));
333 auto _print_diff = [&] (
const G4double& _dval)
336 fileout << std::setprecision(8) << std::scientific
337 << std::setw(30) << _dval <<
" ";
339 fileout << std::setprecision(1) << std::fixed
340 << std::setw(30) << _dval <<
" ";
344 <<
" " << std::setw(10) << itr2->first
346 << std::setw(30) << std::setprecision(12) << std::fixed
347 << std::get<0>(itr2->second)
349 << std::setw(30) << std::setprecision(12) << std::fixed
350 << std::get<1>(itr2->second)
363 G4cout <<
" closed file " << fname <<
" for difference output" <<
G4endl;