45 extern "C" int setpawc();
46 extern "C" int setntuc();
48 ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::fgInstance = 0;
51 ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::Create(
G4bool )
53 if ( fgInstance == 0 ) {
54 fgInstance =
new ExG4HbookAnalysisManager();
61 ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::Instance()
63 if ( fgInstance == 0 ) {
64 fgInstance =
new ExG4HbookAnalysisManager();
71 ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()
82 <<
"G4HbookAnalysisManager is not supported in multi-threading mode.";
83 G4Exception(
"ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()",
90 <<
"G4HbookAnalysisManager already exists."
91 <<
"Cannot create another instance.";
92 G4Exception(
"ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()",
99 fH1Manager =
new ExG4HbookH1Manager(fState);
100 fH2Manager =
new ExG4HbookH2Manager(fState);
101 fNtupleManager =
new ExG4HbookNtupleManager(fState);
102 fFileManager =
new ExG4HbookFileManager(fState);
105 SetH1Manager(fH1Manager);
106 SetH2Manager(fH2Manager);
107 SetNtupleManager(fNtupleManager);
108 SetFileManager(fFileManager);
111 fH1Manager->SetFileManager(fFileManager);
112 fH2Manager->SetFileManager(fFileManager);
113 fNtupleManager->SetFileManager(fFileManager);
116 tools::hbook::CHLIMIT(setpawc());
121 ExG4HbookAnalysisManager::~ExG4HbookAnalysisManager()
131 void ExG4HbookAnalysisManager::Reset()
137 fNtupleManager->Reset();
145 G4bool ExG4HbookAnalysisManager::OpenFileImpl(
const G4String& fileName)
147 G4bool finalResult =
true;
148 G4bool result = fFileManager->SetFileName(fileName);
149 finalResult = finalResult && result;
153 if ( fState.GetVerboseL4() )
154 fState.GetVerboseL4()->Message(
"open",
"analysis file", name);
158 result = fFileManager->OpenFile(fileName);
159 finalResult = finalResult && result;
162 fH1Manager->CreateH1sFromBooking();
165 fH2Manager->CreateH2sFromBooking();
168 fNtupleManager->CreateNtuplesFromBooking();
171 if ( fState.GetVerboseL1() )
172 fState.GetVerboseL1()->Message(
"open",
"analysis file", name);
179 G4bool ExG4HbookAnalysisManager::WriteImpl()
181 G4bool finalResult =
true;
183 G4bool result = fFileManager->WriteFile();
184 finalResult = finalResult && result;
188 result = WriteAscii(fFileManager->GetFileName());
189 finalResult = finalResult && result;
196 G4bool ExG4HbookAnalysisManager::CloseFileImpl()
198 G4bool finalResult =
true;
201 if ( fState.GetVerboseL4() )
202 fState.GetVerboseL4()->Message(
"close",
"file", fFileManager->GetFullFileName());
209 G4bool result = fFileManager->CloseFile();
210 finalResult = finalResult && result;
213 if ( fState.GetVerboseL1() )
214 fState.GetVerboseL1()->Message(
"close",
"file", fFileManager->GetFullFileName(), result);
std::ostringstream G4ExceptionDescription
Definition of the ExG4HbookAnalysisManager class.
Definition of the ExG4HbookNtupleManager class.
Definition of the ExG4HbookH1Manager class.
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition of the ExG4HbookH2Manager class.
Definition of the ExG4HbookFileManager class.