CMS 3D CMS Logo

CustomUIsession.cc
Go to the documentation of this file.
2 
4 {
5 
6  G4UImanager *UI = G4UImanager::GetUIpointer();
7  UI->SetCoutDestination(this);
8 
9 }
10 
12 {
13 
14  G4UImanager *UI = G4UImanager::GetUIpointer();
15  UI->SetCoutDestination(nullptr);
16 
17 }
18 
19 G4int CustomUIsession::ReceiveG4cout(const G4String& coutString)
20 {
21  //std::cout << coutString << std::flush;
22  edm::LogVerbatim("G4cout") << trim(coutString);
23  return 0;
24 }
25 
26 G4int CustomUIsession::ReceiveG4cerr(const G4String& cerrString)
27 {
28  //std::cerr << cerrString << std::flush;
29  edm::LogWarning("G4cerr") << trim(cerrString);
30  return 0;
31 }
32 
34  if(!str.empty() && str.back() == '\n')
35  return str.substr(0, str.length()-1);
36  return str;
37 }
std::string trim(const std::string &str)
G4int ReceiveG4cerr(const G4String &cerrString) override
G4int ReceiveG4cout(const G4String &coutString) override
~CustomUIsession() override
#define str(s)