Geant4-11
G4BaseFileManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26
27// Base class for analysis file managers.
28//
29// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
30
31#ifndef G4BaseFileManager_h
32#define G4BaseFileManager_h 1
33
35#include "globals.hh"
36
37#include <vector>
38
40{
41 public:
42 explicit G4BaseFileManager(const G4AnalysisManagerState& state);
44 virtual ~G4BaseFileManager() = default;
45
46 virtual G4bool SetFileName(const G4String& fileName);
47 // Set the base file name (without extension)
48 virtual G4String GetFileType() const;
49 // Return the manager type (starts with a lowercase letter)
50
51 void AddFileName(const G4String& fileName);
52 // For handling multiple files
53 // Save file name in a vector if not yet present
54
55 G4String GetFileName() const;
56 // Return the base file name (without extension)
57 G4String GetFullFileName(const G4String& baseFileName = "",
58 G4bool isPerThread = true) const;
59 // Compose and return the full file name:
60 // - add _tN suffix to the file base name if isPerThread
61 // - add file extension if not present and available in state
62 const std::vector<G4String>& GetFileNames() const;
63 // Return the file names vector
64
65 G4String GetHnFileName(const G4String& hnType,
66 const G4String& hnName) const;
67 // Compose and return the histogram or profile specific file name:
68 // - add _hn_hnName suffix to the file base name
69 // - add file extension if not present
70
71 G4String GetNtupleFileName(const G4String& ntupleName) const;
72 // Compose and return the ntuple specific file name:
73 // - add _nt_ntupleName suffix to the file base name
74 // - add _tN suffix if called on thread worker
75 // - add file extension if not present
76
77 G4String GetNtupleFileName(G4int ntupleFileNumber) const;
78 // Compose and return the ntuple specific file name:
79 // - add _mN suffix to the file base name
80 // - add file extension if not present
81
83 // Return the file name for batch plotting output
84
85 protected:
86 // Methods for verbose
87 void Message(G4int level,
88 const G4String& action,
89 const G4String& objectType,
90 const G4String& objectName = "",
91 G4bool success = true) const;
92
93 // Data members
95 G4String fFileName; // to be changed in fDefaultFileName
96 std::vector<G4String> fFileNames;
97};
98
100 // CHECK if still needed in this base class
101 fFileName = fileName;
102 return true;
103}
104
106 return fFileName;
107}
108
109inline const std::vector<G4String>& G4BaseFileManager::GetFileNames() const {
110 return fFileNames;
111}
112
114 G4int level, const G4String& action, const G4String& objectType,
115 const G4String& objectName, G4bool success) const
116{
117 fState.Message(level, action, objectType, objectName, success);
118}
119
120#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
virtual ~G4BaseFileManager()=default
std::vector< G4String > fFileNames
G4String GetFullFileName(const G4String &baseFileName="", G4bool isPerThread=true) const
G4String GetPlotFileName() const
virtual G4bool SetFileName(const G4String &fileName)
const std::vector< G4String > & GetFileNames() const
virtual G4String GetFileType() const
G4String GetHnFileName(const G4String &hnType, const G4String &hnName) const
G4String GetFileName() const
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
const G4AnalysisManagerState & fState
G4BaseFileManager()=delete
G4String GetNtupleFileName(const G4String &ntupleName) const
void AddFileName(const G4String &fileName)