Problem 1633 - RootAnalysisManager deletes files containing only ntuples as empty in MT mode
Summary: RootAnalysisManager deletes files containing only ntuples as empty in MT mode
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: analysis (show other problems)
Version: 10.0
Hardware: All All
: P5 normal
Assignee: Ivana.Hrivnacova
URL:
Depends on:
Blocks:
 
Reported: 2014-05-30 06:35 CEST by Jed Leggett
Modified: 2014-06-03 18:22 CEST (History)
0 users

See Also:


Attachments
The code with fixed method G4RootAnalysisManager::CloseFileImpl() (1.63 KB, text/x-c++src)
2014-06-03 18:20 CEST, Ivana.Hrivnacova
Details

Note You need to log in before you can comment on or make changes to this problem.
Description Jed Leggett 2014-05-30 06:35:05 CEST
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() ) ) {
Comment 1 Ivana.Hrivnacova 2014-06-03 18:20:07 CEST
Created attachment 273 [details]
The code with fixed method G4RootAnalysisManager::CloseFileImpl()
Comment 2 Ivana.Hrivnacova 2014-06-03 18:22:40 CEST
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