/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/util/include/RAT/MuteGeant4.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/util/include/RAT/MuteGeant4.hh Source File
Ratpac-two
MuteGeant4.hh
1 #ifndef __RAT_MuteGeant4__
2 #define __RAT_MuteGeant4__
3 
4 #include <G4ios.hh>
5 
6 namespace RAT {
7 
8 class discard_streambuf : public std::streambuf {
9  public:
11 
12  virtual int_type overflow(int_type c) { return c; };
13 };
14 
15 discard_streambuf discard;
16 std::streambuf *g4cout_orig = G4cout.rdbuf();
17 std::streambuf *g4cerr_orig = G4cerr.rdbuf();
18 
19 void mute_g4mute() {
20  G4cout.rdbuf(&discard);
21  G4cerr.rdbuf(&discard);
22 }
23 
24 void mute_g4unmute() {
25  G4cout.rdbuf(g4cout_orig);
26  G4cerr.rdbuf(g4cerr_orig);
27 }
28 
29 } // namespace RAT
30 
31 #endif
Definition: MuteGeant4.hh:8
Definition: CCCrossSecMessenger.hh:29