Problem 1523

Summary: ROOT I/O in G4AnalysisManager does not set the list of free blocks correctly in the ROOT file
Product: Geant4 Reporter: Christian Haeberli <christian.haeberli>
Component: analysisAssignee: Ivana.Hrivnacova
Status: RESOLVED FIXED    
Severity: normal CC: christian.haeberli
Priority: P5    
Version: 9.6   
Hardware: PC   
OS: Linux   

Description Christian Haeberli 2013-08-15 10:18:17 CEST
Dear colleagues,

It seems that there is an issue with writing ROOT files in G4AnalysisManager.

When updating the TTree in ROOT files generated by GEANT4, I faced the following situation:
- ROOT reported memory allocation problems and crashed.
- The ROOT File was corrupted and not readable anymore.

I traced the issue down with the ROOT developers.

The ROOT developers think that in G4AnalysisManager the list of free blocks is not set correctly. The evidence found by the ROOT developers is that by opening and closing the ROOT files the number of free blocks is modified (see below). 

After opening and closing the ROOT file without modifying it, my problems with memory and ROOT file corruption updating the TTree disappear.

TFile *file = new TFile("Cu_Bremsstrahlung.root","UPDATE")
gFile->GetListOfFree()->ls()
OBJ: TList      TList   Doubly linked list : 0
Free Segment: 4616147   4616212
Free Segment: 64        2000000000
file->Close()

TFile *file = new TFile("Cu_Bremsstrahlung.root","UPDATE")
gFile->GetListOfFree()->ls()
OBJ: TList      TList   Doubly linked list : 0
Free Segment: 4616347   2000000000

I should mention that I close the file properly with the G4AnalysisManager:

G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetVerboseLevel(4);
analysisManager->Write();
analysisManager->CloseFile();

Best regards,
Christian
Comment 1 Ivana.Hrivnacova 2013-08-28 16:45:57 CEST
The problem was identified in g4tools and is under investigation now by the author. The fix should be available in a short time.
Comment 2 Ivana.Hrivnacova 2013-09-02 17:16:07 CEST
The fix is now available in tools 1.7.0 and 1.4.4, see:
http://softinex.lal.in2p3.fr/download/g4tools/

and it is included in the Geant4 development version and proposed for testing. It will be then included in the next Geant4 release (10.00) and the next patch for 9.6 version.

Best regards,