Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4BaseFileManager Class Reference

#include <G4BaseFileManager.hh>

Inheritance diagram for G4BaseFileManager:
Collaboration diagram for G4BaseFileManager:

Public Member Functions

 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
 

Protected Member Functions

G4String TakeOffExtension (G4String &name) const
 

Protected Attributes

const G4AnalysisManagerStatefState
 
G4String fFileName
 

Detailed Description

Definition at line 38 of file G4BaseFileManager.hh.

Constructor & Destructor Documentation

G4BaseFileManager::G4BaseFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 35 of file G4BaseFileManager.cc.

36  : fState(state),
37  fFileName("")
38 {
39 }
const G4AnalysisManagerState & fState
G4BaseFileManager::~G4BaseFileManager ( )
virtual

Definition at line 42 of file G4BaseFileManager.cc.

43 {
44 }

Member Function Documentation

G4String G4BaseFileManager::GetFileName ( ) const
inline

Definition at line 95 of file G4BaseFileManager.hh.

95  {
96  return fFileName;
97 }
G4String G4BaseFileManager::GetFileType ( ) const

Definition at line 175 of file G4BaseFileManager.cc.

176 {
177  G4String fileType = fState.GetType();
178  fileType.toLower();
179  return fileType;
180 }
const G4AnalysisManagerState & fState
void toLower()

Here is the call graph for this function:

Here is the caller graph for this function:

G4String G4BaseFileManager::GetFullFileName ( const G4String baseFileName = "",
G4bool  isPerThread = true 
) const

Definition at line 70 of file G4BaseFileManager.cc.

72 {
73  G4String name(baseFileName);
74  if ( name == "" ) name = fFileName;
75 
76  // Take out file extension
77  G4String extension = TakeOffExtension(name);
78 
79  // Add thread Id to a file name if MT processing
80  if ( isPerThread && ! fState.GetIsMaster() ) {
81  std::ostringstream os;
83  name.append("_t");
84  name.append(os.str());
85  }
86 
87  // Add (back if it was present) file extension
88  name.append(extension);
89 
90  return name;
91 }
const XML_Char * name
Definition: expat.h:151
const G4AnalysisManagerState & fState
G4String TakeOffExtension(G4String &name) const
G4int G4GetThreadId()
Definition: G4Threading.cc:144

Here is the call graph for this function:

Here is the caller graph for this function:

G4String G4BaseFileManager::GetHnFileName ( const G4String hnType,
const G4String hnName 
) const

Definition at line 140 of file G4BaseFileManager.cc.

142 {
144 
145  // Take out file extension
146  auto extension = TakeOffExtension(name);
147 
148  // Add _hnType_hnName
149  name.append("_");
150  name.append(hnType);
151  name.append("_");
152  name.append(hnName);
153 
154  // Add (back if it was present) file extension
155  name.append(extension);
156 
157  return name;
158 }
const XML_Char * name
Definition: expat.h:151
G4String TakeOffExtension(G4String &name) const

Here is the call graph for this function:

G4String G4BaseFileManager::GetNtupleFileName ( const G4String ntupleName) const

Definition at line 94 of file G4BaseFileManager.cc.

95 {
97 
98  // Take out file extension
99  auto extension = TakeOffExtension(name);
100 
101  // Add ntupleName
102  name.append("_nt_");
103  name.append(ntupleName);
104 
105  // Add thread Id to a file name if MT processing
106  if ( ! fState.GetIsMaster() ) {
107  std::ostringstream os;
109  name.append("_t");
110  name.append(os.str());
111  }
112 
113  // Add (back if it was present) file extension
114  name.append(extension);
115 
116  return name;
117 }
const XML_Char * name
Definition: expat.h:151
const G4AnalysisManagerState & fState
G4String TakeOffExtension(G4String &name) const
G4int G4GetThreadId()
Definition: G4Threading.cc:144

Here is the call graph for this function:

Here is the caller graph for this function:

G4String G4BaseFileManager::GetNtupleFileName ( G4int  ntupleFileNumber) const

Definition at line 120 of file G4BaseFileManager.cc.

121 {
123 
124  // Take out file extension
125  auto extension = TakeOffExtension(name);
126 
127  // Add _M followed by ntupleFileNumber
128  std::ostringstream os;
129  os << ntupleFileNumber;
130  name.append("_m");
131  name.append(os.str());
132 
133  // Add (back if it was present) file extension
134  name.append(extension);
135 
136  return name;
137 }
const XML_Char * name
Definition: expat.h:151
G4String TakeOffExtension(G4String &name) const

Here is the call graph for this function:

G4String G4BaseFileManager::GetPlotFileName ( ) const

Definition at line 161 of file G4BaseFileManager.cc.

162 {
164 
165  // Take out file extension
166  auto extension = TakeOffExtension(name);
167 
168  // Add .ps extension
169  name.append(".ps");
170 
171  return name;
172 }
const XML_Char * name
Definition: expat.h:151
G4String TakeOffExtension(G4String &name) const

Here is the call graph for this function:

G4bool G4BaseFileManager::SetFileName ( const G4String fileName)
inlinevirtual

Reimplemented in G4VFileManager.

Definition at line 90 of file G4BaseFileManager.hh.

90  {
91  fFileName = fileName;
92  return true;
93 }

Here is the caller graph for this function:

G4String G4BaseFileManager::TakeOffExtension ( G4String name) const
protected

Definition at line 51 of file G4BaseFileManager.cc.

52 {
53  G4String extension;
54  if ( name.find(".") != std::string::npos ) {
55  extension = name.substr(name.find("."));
56  name = name.substr(0, name.find("."));
57  }
58  else {
59  extension = ".";
60  extension.append(GetFileType());
61  }
62  return extension;
63 }
G4String GetFileType() const
G4String & append(const G4String &)

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

G4String G4BaseFileManager::fFileName
protected

Definition at line 87 of file G4BaseFileManager.hh.

const G4AnalysisManagerState& G4BaseFileManager::fState
protected

Definition at line 86 of file G4BaseFileManager.hh.


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