If one tries to write a Root file containing only ntuples, the analysis manager incorrectly deletes the file as empty. This is due to the following code: In G4RootAnalysisManager.cc lines 321-324: // Delete files if empty in MT mode if ( ( fState.GetIsMaster() && fH1Manager->IsEmpty() && fH2Manager->IsEmpty() ) || ( ( ! fState.GetIsMaster() ) && fNtupleManager->IsEmpty() ) ) { The code should instead look for both empty histogram managers AND an empty ntuple manager as follows: // Delete files if empty in MT mode if ( ( fState.GetIsMaster() && fH1Manager->IsEmpty() && fH2Manager->IsEmpty() ) && ( ( ! fState.GetIsMaster() ) && fNtupleManager->IsEmpty() ) ) {
Created attachment 273 [details] The code with fixed method G4RootAnalysisManager::CloseFileImpl()
The incorrect delete happens when an application is built against Geant4 MT libraries and runs in sequential mode. (If running in MT mode, the ntuples are written in files per thread and the base file remains empty.) The problem has been fixed in the development version and the fix will be also provided in patch02 to 10.0 release. (The code of the modified method in G4RootAnalysisManager.cc for the patch02 is also provided in the attachment.) Best regards