CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
CustomUIsessionToFile Class Reference

#include <CustomUIsessionToFile.h>

Inheritance diagram for CustomUIsessionToFile:
CustomUIsession

Public Member Functions

 CustomUIsessionToFile (const std::string &filePrefix, int threadId)
 
G4int ReceiveG4cerr (const G4String &cerrString) override
 
G4int ReceiveG4cout (const G4String &coutString) override
 
 ~CustomUIsessionToFile () override
 
- Public Member Functions inherited from CustomUIsession
 CustomUIsession ()
 
G4int ReceiveG4cerr (const G4String &cerrString) override
 
G4int ReceiveG4cout (const G4String &coutString) override
 
void sendToFile (std::ofstream *)
 
void stopSendToFile ()
 
 ~CustomUIsession () override
 

Private Attributes

std::ofstream m_output
 

Additional Inherited Members

- Protected Member Functions inherited from CustomUIsession
std::string trim (const std::string &str)
 

Detailed Description

This class is intended for debugging of multithreaded simulation when the amount of output is moderate to large. Output of Geant4 in each thread is forwarded to a thread-specific file. Compared to using MessageLogger, this way the synchronization is avoided. Thread safety is ensured by

Definition at line 19 of file CustomUIsessionToFile.h.

Constructor & Destructor Documentation

◆ CustomUIsessionToFile()

CustomUIsessionToFile::CustomUIsessionToFile ( const std::string &  filePrefix,
int  threadId 
)

Definition at line 3 of file CustomUIsessionToFile.cc.

4  : CustomUIsession(), m_output(filePrefix + "_" + std::to_string(threadId) + ".txt") {}

◆ ~CustomUIsessionToFile()

CustomUIsessionToFile::~CustomUIsessionToFile ( )
override

Definition at line 6 of file CustomUIsessionToFile.cc.

6 {}

Member Function Documentation

◆ ReceiveG4cerr()

G4int CustomUIsessionToFile::ReceiveG4cerr ( const G4String &  cerrString)
override

Definition at line 13 of file CustomUIsessionToFile.cc.

13  {
14  m_output << cerrString;
15  return 0;
16 }

References m_output.

◆ ReceiveG4cout()

G4int CustomUIsessionToFile::ReceiveG4cout ( const G4String &  coutString)
override

Definition at line 8 of file CustomUIsessionToFile.cc.

8  {
9  m_output << coutString;
10  return 0;
11 }

References m_output.

Member Data Documentation

◆ m_output

std::ofstream CustomUIsessionToFile::m_output
private

Definition at line 28 of file CustomUIsessionToFile.h.

Referenced by ReceiveG4cerr(), and ReceiveG4cout().

CustomUIsession::CustomUIsession
CustomUIsession()
Definition: CustomUIsession.cc:3
CustomUIsessionToFile::m_output
std::ofstream m_output
Definition: CustomUIsessionToFile.h:28