16 const char* theName = filename.c_str();
19 std::ofstream* previous =
nullptr;
20 if(
theFile.compare_exchange_strong(previous,
f.get()) ) {
32 std::cout.setf(std::ios::right,std::ios::adjustfield);
33 std::cout.setf(std::ios::scientific,std::ios::floatfield);
37 std::lock_guard<std::mutex> guard{fileMutex};
39 (*theFile).setf(std::ios::right,std::ios::adjustfield);
40 (*theFile).setf(std::ios::scientific|std::ios::uppercase|std::ios::showpos,std::ios::floatfield);
41 (*theFile).precision(5);
42 (*theFile) <<
"SimHit in "<<
s;
46 std::lock_guard<std::mutex> guard{fileMutex};
47 (*theFile) <<
"Event "<<num<<std::endl;
52 std::lock_guard<std::mutex> guard{fileMutex};
55 (*theFile).setf(std::ios::right,std::ios::adjustfield);
61 std::lock_guard<std::mutex> guard{fileMutex};
62 (*theFile) <<
" trk ";
64 (*theFile).setf(std::ios::right,std::ios::adjustfield);
70 std::lock_guard<std::mutex> guard{fileMutex};
71 (*theFile) <<
" p "<<pabs;
75 std::cout <<
" Eloss: "<<eloss<<std::endl;
76 std::lock_guard<std::mutex> guard{fileMutex};
77 (*theFile) <<
" e "<<eloss;
81 std::cout <<
" Local(en/ex): "<<localen.
x()<<
" "<< localen.
y()<<
" "
82 <<localen.
z()<<
" / "<<localex.
x()<<
" "<< localex.
y()<<
" "
83 <<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()<<
" "
90 <<localen.
z()<<
" / "<<localex.
x()<<
" "<< localex.
y()<<
" "
95 std::cout <<
" Global(en): "<<global.
x()<<
" "<< global.
y()<<
" "
96 <<global.
z()<<std::endl;
97 std::lock_guard<std::mutex> guard{fileMutex};
99 (*theFile).setf(std::ios::right,std::ios::adjustfield);
100 (*theFile).setf(std::ios::floatfield);
101 (*theFile).precision(6);
102 (*theFile) <<
" gl "<<global.
x()<<
" "<< global.
y()<<
" "
103 <<global.
z()<<std::endl;
void printTrack(int) const
static boost::mutex mutex
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