88 std::ofstream fileout;
90 std::stringstream separator;
93 <<
"============================================================";
95 typedef std::set<G4int> IDSet_t;
99 const TSRun* tsRun =
static_cast<const TSRun*
>(aRun);
105 std::vector<G4String> primScorerNames {
"EnergyDeposit",
107 std::vector<G4String> fnames {
"mfd_tl",
"mfd_tg" };
109 std::vector<G4String> unitstr {
"keV",
"steps" };
111 for(
unsigned i = 0; i < primScorerNames.size(); ++i)
113 for(
unsigned j = 0; j < fnames.size(); ++j)
116 auto print = [] (std::ostream& fout,
122 <<
" " << second/unit1
126 <<
" " << std::setw(10) << first
127 <<
" " << std::setw(15) << std::setprecision(6)
128 << std::fixed << second/unit2 <<
" " << unit2str
130 G4cout.unsetf(std::ios::fixed);
134 fname = fnames.at(j) +
"_" + primScorerNames.at(i) +
".out";
137 G4cout <<
" opened file " << fname <<
" for output" <<
G4endl;
144 = tsRun->
GetHitsMap(fName +
"/" + primScorerNames.at(i));
145 if(hitmap && hitmap->
GetMap()->size() != 0)
147 for(
auto itr = hitmap->
GetMap()->begin();
148 itr != hitmap->
GetMap()->end(); itr++)
150 IDs.insert(itr->first);
151 std::get<0>(fTypeCompare[primScorerNames.at(i)][itr->first])
152 = *itr->second/units.at(i);
153 print(fileout, itr->first, *itr->second,
154 units.at(i), units.at(i+1), unitstr.at(i));
162 primScorerNames.at(i));
163 if(hitmap && hitmap->
GetMap()->size() != 0)
165 for(
auto itr = hitmap->
GetMap()->begin();
166 itr != hitmap->
GetMap()->end(); itr++)
168 IDs.insert(itr->first);
169 std::get<1>(fTypeCompare[primScorerNames.at(i)][itr->first])
170 = *itr->second/units.at(i);
171 print(fileout, itr->first, *itr->second,
172 units.at(i), units.at(i+1), unitstr.at(i));
181 " HitsMap is either not "
182 "created or the HitsMap was empty").c_str());
188 G4cout <<
" closed file " << fname <<
" for output" <<
G4endl;
193 primScorerNames.at(i));
194 if(hitmap && hitmap->size() != 0)
196 for(
auto itr = hitmap->begin();
197 itr != hitmap->end(); itr++)
199 IDs.insert(itr->first);
200 std::get<2>(fTypeCompare[primScorerNames.at(i)][itr->first])
201 = itr->second/units.at(i);
212 fname =
"mfd_diff.out";
216 G4cout <<
" opened file " << fname <<
" for difference output" <<
G4endl;
220 <<
" " << std::setw(10) <<
"ID"
222 << std::setw(30) << std::setprecision(12) << std::fixed
225 << std::setw(30) << std::setprecision(12) << std::fixed
226 <<
"Atomic Hits Map value"
228 << std::setw(30) << std::setprecision(12) << std::fixed
231 << std::setw(30) << std::setprecision(12) << std::fixed
232 <<
"Diff (MFD - MUTEXED)"
234 << std::setw(30) << std::setprecision(12) << std::fixed
235 <<
"Diff (ATOM_HIT_MAP - MUTEXED)"
238 for(
auto itr1 = fTypeCompare.begin();
239 itr1 != fTypeCompare.end(); ++itr1)
241 fileout <<
"\n\nType = " << itr1->first <<
"\n" <<
G4endl;
242 for(
auto itr2 = itr1->second.begin();
243 itr2 != itr1->second.end(); ++itr2)
246 <<
" " << std::setw(10) << itr2->first
248 << std::setw(30) << std::setprecision(12) << std::fixed
249 << std::get<0>(itr2->second)
251 << std::setw(30) << std::setprecision(12) << std::fixed
252 << std::get<1>(itr2->second)
254 << std::setw(30) << std::setprecision(12) << std::fixed
255 << (std::fabs(std::get<0>(itr2->second) - std::get<1>(itr2->second)))
257 << std::setw(30) << std::setprecision(12) << std::fixed
258 << (std::fabs(std::get<0>(itr2->second) - std::get<2>(itr2->second)))
260 << std::setw(30) << std::setprecision(12) << std::fixed
261 << (std::fabs(std::get<1>(itr2->second) - std::get<2>(itr2->second)))
268 G4cout <<
" closed file " << fname <<
" for difference output" <<
G4endl;
static constexpr double keV
MutexHitsMap_t * GetMutexHitsMap(const G4String &) const
static constexpr double second
G4THitsMap< G4double > * GetHitsMap(const G4String &collname) const
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
std::map< G4int, G4double > MutexHitsMap_t
void print(G4double elem)
static constexpr double eV
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
container_type * GetMap() const
std::map< G4int, T * > * GetMap() const
G4TAtomicHitsMap< G4double > * GetAtomicHitsMap(const G4String &) const