53 fName(fDetector->GetMFDName())
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;
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));
163 " HitsMap is either not "
164 "created or the HitsMap was empty").c_str());
169 primScorerNames.at(i));
170 if(hitmap && hitmap->
GetMap()->size() != 0)
172 for(
auto itr = hitmap->
GetMap()->begin();
173 itr != hitmap->
GetMap()->end(); itr++)
175 IDs.insert(itr->first);
176 std::get<1>(
fTypeCompare[primScorerNames.at(i)][itr->first])
177 = *itr->second/units.at(i);
178 print(fileout, itr->first, *itr->second,
179 units.at(i), units.at(i+1), unitstr.at(i));
188 " HitsMap is either not "
189 "created or the HitsMap was empty").c_str());
195 G4cout <<
" closed file " << fname <<
" for output" <<
G4endl;
200 primScorerNames.at(i));
201 if(hitmap && hitmap->size() != 0)
203 for(
auto itr = hitmap->begin();
204 itr != hitmap->end(); itr++)
206 IDs.insert(itr->first);
207 std::get<2>(
fTypeCompare[primScorerNames.at(i)][itr->first])
208 = itr->second/units.at(i);
219 fname =
"mfd_diff.out";
223 G4cout <<
" opened file " << fname <<
" for difference output" <<
G4endl;
227 <<
" " << std::setw(10) <<
"ID"
229 << std::setw(30) << std::setprecision(12) << std::fixed
232 << std::setw(30) << std::setprecision(12) << std::fixed
233 <<
"Atomic Hits Map value"
235 << std::setw(30) << std::setprecision(8) << std::scientific
238 << std::setw(30) << std::setprecision(8) << std::scientific
239 <<
"Diff (MFD - MUTEXED)"
241 << std::setw(30) << std::setprecision(8) << std::scientific
242 <<
"Diff (ATOM_HIT_MAP - MUTEXED)"
248 fileout <<
"\n\nType = " << itr1->first <<
"\n" <<
G4endl;
249 for(
auto itr2 = itr1->second.begin();
250 itr2 != itr1->second.end(); ++itr2)
253 = std::fabs(std::get<0>(itr2->second) -
254 std::get<1>(itr2->second));
256 = std::fabs(std::get<0>(itr2->second) -
257 std::get<2>(itr2->second));
259 = std::fabs(std::get<1>(itr2->second) -
260 std::get<2>(itr2->second));
263 auto _print_diff = [&] (
const G4double& _dval)
266 fileout << std::setprecision(8) << std::scientific
267 << std::setw(30) << _dval <<
" ";
269 fileout << std::setprecision(1) << std::fixed
270 << std::setw(30) << _dval <<
" ";
274 <<
" " << std::setw(10) << itr2->first
276 << std::setw(30) << std::setprecision(12) << std::fixed
277 << std::get<0>(itr2->second)
279 << std::setw(30) << std::setprecision(12) << std::fixed
280 << std::get<1>(itr2->second)
293 G4cout <<
" closed file " << fname <<
" for difference output" <<
G4endl;
static G4RunManager * GetRunManager()
Definition of the TSRun class.
void print(G4double elem)
Definition of the TSRunAction class.
container_type * GetMap() const
Definition of the TSActionInitialization class.
static constexpr double second
MutexHitsMap_t * GetMutexHitsMap(const G4String &) const
virtual void EndOfRunAction(const G4Run *)
G4int GetNumberOfEvent() const
TypeCompare_t fTypeCompare
std::map< G4int, G4double > MutexHitsMap_t
virtual G4Run * GenerateRun()
static constexpr double eV
G4int GetNumberOfEventToBeProcessed() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4TAtomicHitsMap< G4double > * GetAtomicHitsMap(const G4String &) const
G4GLOB_DLL std::ostream G4cout
G4THitsMap< G4double > * GetHitsMap(const G4String &collname) const
static constexpr double keV
Definition of the TSDetectorConstruction class.
virtual void BeginOfRunAction(const G4Run *)
void SetPrintProgress(G4int i)