File indexing completed on 2024-04-06 12:30:22
0001 #ifndef SimG4Core_CustomUIsession_H
0002 #define SimG4Core_CustomUIsession_H
0003
0004 #include "G4UIsession.hh"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006
0007 #include <fstream>
0008
0009 class CustomUIsession : public G4UIsession {
0010 public:
0011 CustomUIsession();
0012 ~CustomUIsession() override;
0013
0014 G4int ReceiveG4cout(const G4String& coutString) override;
0015 G4int ReceiveG4cerr(const G4String& cerrString) override;
0016
0017 void sendToFile(std::ofstream*);
0018 inline void stopSendToFile() { fout = nullptr; }
0019
0020 protected:
0021 std::string trim(const std::string& str);
0022
0023 private:
0024 std::ofstream* fout;
0025 };
0026
0027 #endif