SimG4Core
Geometry
src
CustomUIsession.cc
Go to the documentation of this file.
1
#include "
SimG4Core/Geometry/interface/CustomUIsession.h
"
2
3
CustomUIsession::CustomUIsession
() :
fout
(nullptr) {
4
G4UImanager* UI = G4UImanager::GetUIpointer();
5
UI->SetCoutDestination(
this
);
6
}
7
8
CustomUIsession::~CustomUIsession
() {
9
G4UImanager* UI = G4UImanager::GetUIpointer();
10
UI->SetCoutDestination(
nullptr
);
11
}
12
13
G4int
CustomUIsession::ReceiveG4cout
(
const
G4String& coutString) {
14
//std::cout << coutString << std::flush;
15
if
(
fout
) {
16
(*fout) <<
trim
(coutString) <<
"\n"
;
17
}
else
{
18
edm::LogVerbatim
(
"G4cout"
) <<
trim
(coutString);
19
}
20
return
0;
21
}
22
23
G4int
CustomUIsession::ReceiveG4cerr
(
const
G4String& cerrString) {
24
//std::cerr << cerrString << std::flush;
25
edm::LogWarning
(
"G4cerr"
) <<
trim
(cerrString);
26
return
0;
27
}
28
29
std::string
CustomUIsession::trim
(
const
std::string
&
str
) {
30
if
(!
str
.empty() &&
str
.back() ==
'\n'
)
31
return
str
.substr(0,
str
.length() - 1);
32
return
str
;
33
}
34
35
void
CustomUIsession::sendToFile
(std::ofstream* ptr) {
36
if
(ptr && !ptr->fail()) {
37
fout
= ptr;
38
}
39
}
CustomUIsession::ReceiveG4cout
G4int ReceiveG4cout(const G4String &coutString) override
Definition:
CustomUIsession.cc:13
CustomUIsession::trim
std::string trim(const std::string &str)
Definition:
CustomUIsession.cc:29
CustomUIsession::CustomUIsession
CustomUIsession()
Definition:
CustomUIsession.cc:3
str
#define str(s)
Definition:
TestProcessor.cc:48
CustomUIsession.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition:
MessageLogger.h:141
CustomUIsession::~CustomUIsession
~CustomUIsession() override
Definition:
CustomUIsession.cc:8
groupFilesInBlocks.fout
fout
Definition:
groupFilesInBlocks.py:162
edm::LogVerbatim
Definition:
MessageLogger.h:297
CustomUIsession::sendToFile
void sendToFile(std::ofstream *)
Definition:
CustomUIsession.cc:35
CustomUIsession::ReceiveG4cerr
G4int ReceiveG4cerr(const G4String &cerrString) override
Definition:
CustomUIsession.cc:23
CustomUIsession::fout
std::ofstream * fout
Definition:
CustomUIsession.h:28
Generated for CMSSW Reference Manual by
1.8.16