85 fNtupleManager(nullptr),
86 fSlaveNtupleManager(nullptr),
93 <<
"G4RootAnalysisManager already exists."
94 <<
"Cannot create another instance.";
95 G4Exception(
"G4RootAnalysisManager::G4RootAnalysisManager()",
109 auto mergeNtuples =
false;
129 G4int nofNtupleFiles)
135 ->
Message(
"set",
"ntuple merging mode",
"");
138 auto canMerge =
true;
142 if ( nofNtupleFiles > 0 ) {
145 <<
" " <<
"Merging ntuples is not applicable in sequential application."
147 <<
" " <<
"Setting was ignored.";
148 G4Exception(
"G4RootAnalysisManager::SetNtupleMergingMode()",
159 <<
" " <<
"Merging ntuples requires G4AnalysisManager instance on master."
161 <<
" " <<
"Setting was ignored.";
162 G4Exception(
"G4RootAnalysisManager::SetNtupleMergingMode()",
168 if ( ( ! mergeNtuples ) || ( ! canMerge ) ) {
170 mergingMode =
"G4NtupleMergeMode::kNone";
182 <<
" " <<
"Number of reduced files must be [0, nofThreads]."
184 <<
" " <<
"Cannot set " << nofNtupleFiles
187 <<
" " <<
"Ntuples will be merged in a single file.";
188 G4Exception(
"G4RootAnalysisManager::SetNtupleMergingMode()",
214 mergingMode =
"G4NtupleMergeMode::kMain";
217 mergingMode =
"G4NtupleMergeMode::kSlave";
224 ->
Message(
"set",
"ntuple merging mode", mergingMode);
270 if ( ! nofMainManagers ) nofMainManagers = 1;
281 auto mainNtupleManager
300 if ( ! nofMainManagers ) nofMainManagers = 1;
303 G4cout <<
"In GetNtupleFileNumber: "
316 if ( ! h1Vector.size() )
return true;
341 if ( ! h2Vector.size() )
return true;
366 if ( ! h3Vector.size() )
return true;
391 if ( ! p1Vector.size() )
return true;
416 if ( ! p2Vector.size() )
return true;
440 auto finalResult =
true;
453 finalResult =
result && finalResult;
458 finalResult =
result && finalResult;
474 auto finalResult =
true;
477 finalResult = finalResult &&
result;
482 finalResult = result && finalResult;
485 finalResult = finalResult &&
result;
497 auto finalResult =
true;
499 finalResult = finalResult &&
result;
510 finalResult = finalResult &&
result;
532 finalResult = finalResult &&
result;
543 G4cout <<
"Going to create slave ntuples from main" <<
G4endl;
555 auto finalResult =
true;
563 <<
" " <<
"No master G4RootAnalysisManager instance exists."
565 <<
" " <<
"Histogram/profile data will not be merged.";
572 finalResult = finalResult &&
result;
576 finalResult = finalResult &&
result;
580 finalResult = finalResult &&
result;
584 finalResult = finalResult &&
result;
588 finalResult = finalResult &&
result;
592 finalResult = finalResult &&
result;
597 finalResult = finalResult &&
result;
603 finalResult = finalResult &&
result;
612 auto finalResult =
true;
622 description <<
" " <<
"Resetting data failed";
626 finalResult = finalResult &&
result;
642 result = ! std::remove(
fFileManager->GetFullFileName());
646 description <<
" " <<
"Removing file "
651 finalResult = finalResult &&
result;
668 G4int nofNtupleFiles,
670 unsigned int basketSize)
const G4AnalysisVerbose * GetVerboseL2() const
G4RootPNtupleManager * fSlaveNtupleManager
virtual ~G4RootAnalysisManager()
G4RootMainNtupleManager * GetMainNtupleManager(G4int index) const
std::ostringstream G4ExceptionDescription
static constexpr unsigned int fgkDefaultBasketSize
virtual G4bool Merge() final
void CreateNtuplesFromBooking()
std::shared_ptr< G4RootFileManager > fFileManager
virtual G4bool OpenFileImpl(const G4String &fileName) final
G4bool WriteT(const std::vector< T * > &htVector, const std::vector< G4HnInformation * > &hnVector, tools::wroot::directory *directory, const G4String &hnType)
void ClearNtupleManagers()
virtual G4bool WriteImpl() final
void SetNtupleDirectory(tools::wroot::directory *directory)
G4int GetNumberOfRunningWorkerThreads()
#define G4MUTEX_INITIALIZER
G4AnalysisManagerState fState
void SetNtupleMergingMode(G4bool mergeNtuples, G4int nofNtupleFiles)
const G4AnalysisVerbose * GetVerboseL4() const
G4int GetNtupleFileNumber()
virtual G4bool CloseFileImpl() final
virtual G4bool Reset(G4bool deleteNtuple)
const G4AnalysisVerbose * GetVerboseL3() const
G4NtupleMergeMode fNtupleMergeMode
void SetFileManager(std::shared_ptr< G4VFileManager > fileManager)
static G4bool IsInstance()
G4double G4ParticleHPJENDLHEData::G4double result
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4bool IsMultithreadedApplication()
void SetNtupleManager(G4VNtupleManager *ntupleManager)
G4RootAnalysisManager(G4bool isMaster=true)
static G4RootAnalysisManager * Instance()
G4RootNtupleManager * fNtupleManager
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4GLOB_DLL std::ostream G4cout
G4bool GetIsMaster() const
void CreateNtupleManagers()
static G4ThreadLocal G4RootAnalysisManager * fgInstance
void SetFileManager(std::shared_ptr< G4RootFileManager > fileManager)
void SetNtupleMerging(G4bool mergeNtuples, G4int nofReducedNtupleFiles=0, G4bool rowWise=0, unsigned int basketSize=fgkDefaultBasketSize)
const G4AnalysisVerbose * GetVerboseL1() const
void CreateNtuplesFromMain()
static G4RootAnalysisManager * fgMasterInstance
G4bool WriteAscii(const G4String &fileName)