17 const char* theName = filename.c_str();
20 std::ofstream* previous =
nullptr;
21 if (
theFile.compare_exchange_strong(previous,
f.get())) {
33 std::cout.setf(std::ios::right, std::ios::adjustfield);
34 std::cout.setf(std::ios::scientific, std::ios::floatfield);
36 std::cout <<
"SimHit in " << s << std::endl;
38 std::lock_guard<std::mutex> guard{fileMutex};
40 (*theFile).setf(std::ios::right, std::ios::adjustfield);
41 (*theFile).setf(std::ios::scientific | std::ios::uppercase | std::ios::showpos, std::ios::floatfield);
42 (*theFile).precision(5);
43 (*theFile) <<
"SimHit in " <<
s;
47 std::lock_guard<std::mutex> guard{fileMutex};
48 (*theFile) <<
"Event " << num << std::endl;
53 std::lock_guard<std::mutex> guard{fileMutex};
56 (*theFile).setf(std::ios::right, std::ios::adjustfield);
61 std::cout <<
" Track: " <<
id << std::endl;
62 std::lock_guard<std::mutex> guard{fileMutex};
63 (*theFile) <<
" trk ";
65 (*theFile).setf(std::ios::right, std::ios::adjustfield);
70 std::cout <<
" Pabs: " << pabs << std::endl;
71 std::lock_guard<std::mutex> guard{fileMutex};
72 (*theFile) <<
" p " << pabs;
76 std::cout <<
" Eloss: " << eloss << std::endl;
77 std::lock_guard<std::mutex> guard{fileMutex};
78 (*theFile) <<
" e " << eloss;
82 std::cout <<
" Local(en/ex): " << localen.
x() <<
" " << localen.
y() <<
" " << localen.
z() <<
" / " << localex.
x()
83 <<
" " << localex.
y() <<
" " << localex.
z() << std::endl;
84 std::lock_guard<std::mutex> guard{fileMutex};
86 (*theFile).setf(std::ios::right, std::ios::adjustfield);
87 (*theFile).setf(std::ios::floatfield);
88 (*theFile).precision(6);
89 (*theFile) <<
" en/ex " << localen.
x() <<
" " << localen.
y() <<
" " << localen.
z() <<
" / " << localex.
x() <<
" " 90 << localex.
y() <<
" " << localex.
z();
94 std::cout <<
" Global(en): " << global.
x() <<
" " << global.
y() <<
" " << global.
z() << std::endl;
95 std::lock_guard<std::mutex> guard{fileMutex};
97 (*theFile).setf(std::ios::right, std::ios::adjustfield);
98 (*theFile).setf(std::ios::floatfield);
99 (*theFile).precision(6);
100 (*theFile) <<
" gl " << global.
x() <<
" " << global.
y() <<
" " << global.
z() << std::endl;
static boost::mutex mutex
void printTrack(int) const
void printLocal(LocalPoint, LocalPoint) const
void printPabs(float) const
static std::atomic< std::ofstream * > theFile
SimHitPrinter(std::string)
void printGlobal(GlobalPoint) const
void startNewSimHit(std::string)
void printEloss(float) const