48 extern "C" int setpawc();
49 extern "C" int setntuc();
51 ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::fgInstance = 0;
54 ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::Create(
G4bool )
56 if ( fgInstance == 0 ) {
57 fgInstance =
new ExG4HbookAnalysisManager();
64 ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::Instance()
66 if ( fgInstance == 0 ) {
67 fgInstance =
new ExG4HbookAnalysisManager();
74 ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()
88 <<
"G4HbookAnalysisManager is not supported in multi-threading mode.";
89 G4Exception(
"ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()",
96 <<
"G4HbookAnalysisManager already exists."
97 <<
"Cannot create another instance.";
98 G4Exception(
"ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()",
105 fH1Manager =
new ExG4HbookH1Manager(fState);
106 fH2Manager =
new ExG4HbookH2Manager(fState);
108 fP1Manager =
new ExG4HbookP1Manager(fState);
110 fNtupleManager =
new ExG4HbookNtupleManager(fState);
111 fFileManager = std::make_shared<ExG4HbookFileManager>(fState);
114 SetH1Manager(fH1Manager);
115 SetH2Manager(fH2Manager);
116 SetH3Manager(fH3Manager);
117 SetP1Manager(fP1Manager);
118 SetP2Manager(fP2Manager);
119 SetNtupleManager(fNtupleManager);
120 SetFileManager(fFileManager);
123 fH1Manager->SetFileManager(fFileManager.get());
124 fH2Manager->SetFileManager(fFileManager.get());
125 fP1Manager->SetFileManager(fFileManager.get());
126 fNtupleManager->SetFileManager(fFileManager.get());
129 tools::hbook::CHLIMIT(setpawc());
134 ExG4HbookAnalysisManager::~ExG4HbookAnalysisManager()
144 void ExG4HbookAnalysisManager::Reset()
151 fNtupleManager->Reset();
159 G4bool ExG4HbookAnalysisManager::OpenFileImpl(
const G4String& fileName)
161 G4bool finalResult =
true;
162 G4bool result = fFileManager->SetFileName(fileName);
163 finalResult = finalResult && result;
167 if ( fState.GetVerboseL4() )
168 fState.GetVerboseL4()->Message(
"open",
"analysis file", name);
172 result = fFileManager->OpenFile(fileName);
173 finalResult = finalResult && result;
176 fH1Manager->CreateH1sFromBooking();
179 fH2Manager->CreateH2sFromBooking();
182 fP1Manager->CreateP1sFromBooking();
185 fNtupleManager->CreateNtuplesFromBooking();
188 if ( fState.GetVerboseL1() )
189 fState.GetVerboseL1()->Message(
"open",
"analysis file", name);
196 G4bool ExG4HbookAnalysisManager::WriteImpl()
198 G4bool finalResult =
true;
200 G4bool result = fFileManager->WriteFile();
201 finalResult = finalResult && result;
205 result = WriteAscii(fFileManager->GetFileName());
206 finalResult = finalResult && result;
213 G4bool ExG4HbookAnalysisManager::CloseFileImpl()
215 G4bool finalResult =
true;
218 if ( fState.GetVerboseL4() )
219 fState.GetVerboseL4()->Message(
"close",
"file", fFileManager->GetFullFileName());
226 G4bool result = fFileManager->CloseFile();
227 finalResult = finalResult && result;
230 if ( fState.GetVerboseL1() )
231 fState.GetVerboseL1()->Message(
"close",
"file", fFileManager->GetFullFileName(), result);
238 G4bool ExG4HbookAnalysisManager::PlotImpl()
242 <<
"G4HbookAnalysisManager does not support batch plotting.";
243 G4Exception(
"ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()",
250 G4bool ExG4HbookAnalysisManager::MergeImpl(tools::histo::hmpi* )
254 <<
"G4HbookAnalysisManager does not support MPI.";
255 G4Exception(
"ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()",
std::ostringstream G4ExceptionDescription
Definition of the ExG4HbookH3DummyManager class.
Definition of the ExG4HbookAnalysisManager class.
Manager class for P2 with dummy implementation.
Definition of the ExG4HbookNtupleManager class.
Manager class for H3 with dummy implementation.
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 ExG4HbookP2DummyManager class.
Definition of the ExG4HbookFileManager class.
Definition of the ExG4HbookP1Manager class.