Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RootRFileManager Class Reference

#include <G4RootRFileManager.hh>

Inheritance diagram for G4RootRFileManager:
Collaboration diagram for G4RootRFileManager:

Public Member Functions

 G4RootRFileManager (const G4AnalysisManagerState &state)
 
virtual ~G4RootRFileManager ()
 
virtual G4bool OpenRFile (const G4String &fileName, G4bool isPerThread)
 
tools::rroot::file * GetRFile (const G4String &fileName, G4bool isPerThread) const
 
- Public Member Functions inherited from G4BaseFileManager
 G4BaseFileManager (const G4AnalysisManagerState &state)
 
virtual ~G4BaseFileManager ()
 
virtual G4bool SetFileName (const G4String &fileName)
 
G4String GetFileName () const
 
G4String GetFullFileName (const G4String &baseFileName="", G4bool isPerThread=true) const
 
G4String GetHnFileName (const G4String &hnType, const G4String &hnName) const
 
G4String GetNtupleFileName (const G4String &ntupleName) const
 
G4String GetNtupleFileName (G4int ntupleFileNumber) const
 
G4String GetPlotFileName () const
 
G4String GetFileType () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4BaseFileManager
G4String TakeOffExtension (G4String &name) const
 
- Protected Attributes inherited from G4BaseFileManager
const G4AnalysisManagerStatefState
 
G4String fFileName
 

Detailed Description

Definition at line 47 of file G4RootRFileManager.hh.

Constructor & Destructor Documentation

G4RootRFileManager::G4RootRFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 40 of file G4RootRFileManager.cc.

41  : G4BaseFileManager(state),
42  fRFiles()
43 {
44 }
G4BaseFileManager(const G4AnalysisManagerState &state)
G4RootRFileManager::~G4RootRFileManager ( )
virtual

Definition at line 47 of file G4RootRFileManager.cc.

48 {
49  for (G4int i=0; i<G4int(fRFiles.size()); ++i) {
50  delete fRFiles[i];
51  }
52 }
int G4int
Definition: G4Types.hh:78

Member Function Documentation

tools::rroot::file * G4RootRFileManager::GetRFile ( const G4String fileName,
G4bool  isPerThread 
) const

Definition at line 104 of file G4RootRFileManager.cc.

106 {
107  // Get full file name
108  G4String name = GetFullFileName(fileName, isPerThread);
109 
110  std::map<G4String, tools::rroot::file*>::const_iterator it
111  = fRFiles.find(name);
112  if ( it != fRFiles.end() )
113  return it->second;
114  else {
115  return nullptr;
116  }
117 }
const XML_Char * name
Definition: expat.h:151
G4String GetFullFileName(const G4String &baseFileName="", G4bool isPerThread=true) const

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4RootRFileManager::OpenRFile ( const G4String fileName,
G4bool  isPerThread 
)
virtual

Definition at line 59 of file G4RootRFileManager.cc.

61 {
62  // Get full file name
63  G4String name = GetFullFileName(fileName, isPerThread);
64 
65 #ifdef G4VERBOSE
66  if ( fState.GetVerboseL4() )
67  fState.GetVerboseL4()->Message("open", "read analysis file", name);
68 #endif
69 
70  // create new file
71  tools::rroot::file* newFile = new tools::rroot::file(G4cout, name);
72  newFile->add_unziper('Z',tools::decompress_buffer);
73 
74  if ( ! newFile->is_open() ) {
75  G4ExceptionDescription description;
76  description << " " << "Cannot open file " << name;
77  G4Exception("G4RootRFileManager::OpenFile()",
78  "Analysis_WR001", JustWarning, description);
79  delete newFile;
80  return false;
81  }
82 
83  // add file in a map and delete the previous file if it exists
84  std::map<G4String, tools::rroot::file*>::iterator it
85  = fRFiles.find(name);
86  if ( it != fRFiles.end() ) {
87  delete it->second;
88  it->second = newFile;
89  }
90  else {
91  fRFiles[name] = newFile;
92  }
93 
94 #ifdef G4VERBOSE
95  if ( fState.GetVerboseL1() )
97  ->Message("open", "read analysis file", name);
98 #endif
99 
100  return true;
101 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
const XML_Char * name
Definition: expat.h:151
const G4AnalysisManagerState & fState
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4GLOB_DLL std::ostream G4cout
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4String GetFullFileName(const G4String &baseFileName="", G4bool isPerThread=true) const
const G4AnalysisVerbose * GetVerboseL1() const

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: