G4RootAnalysisManager, Basket size

Hello,

I used G4RootAnalysisManager to store some NTuple in a root file. I use FillNtupleDColumn + AddNtupleRow to add some elements to the tuple. It works well, but it is not clear for me when exactly to call the “Write()” function. If I do it after every “AddNtupleRow”, the output file is composed of lot of branches (“Hits;1 Hits;2 etc”) every 4000 hits (which can be very cumbersome for large simulation). I suspect this is because of the BasketEntries value which is default to 4000. I tried to change the value, but it seems to have no effect. I tried also to play with SetBasketSize, but, while it does change things, I cannot understand what happened and some elements were missing in the resulting root file.

Alternatively, I try one single Write at the end of the simulation. It works, but it means that everything stay in memory the whole simulation, right ?

Finally, it is not fully clear what happens with the Close function. Is it needed ?

thanks for your help to help me understanding this stuff :wink: !
David
PS: I tried with last G4 v11.0 (and 10.7)