glogging
Loading...
Searching...
No Matches
gbatch_session.h
Go to the documentation of this file.
1#pragma once
2
3// geant4
4#include "G4UIsession.hh"
5
6// c++
7#include <fstream>
8
16class GBatch_Session : public G4UIsession {
17public:
19 logFile.open("gemc.log");
20 errFile.open("gemc.err");
21 }
22
23 G4int ReceiveG4cout(const G4String &coutString) override {
24 logFile << coutString << std::flush;
25 std::cout << coutString << std::flush;
26 return 0;
27 }
28
29 G4int ReceiveG4cerr(const G4String &cerrString) override {
30 errFile << cerrString << std::flush;
31 std::cerr << cerrString << std::flush;
32 return 0;
33 }
34
35private:
36 std::ofstream logFile;
37 std::ofstream errFile;
38};
39
The new G4UIsession passed to the G4UImanager.
G4int ReceiveG4cerr(const G4String &cerrString) override
G4int ReceiveG4cout(const G4String &coutString) override