ROOT Output File (output.root) Not Created

Hello everyone,

I’m using #include “g4root.hh” and calling man->OpenFile(“output.root”);, but I’m unable to visualize the data in ROOT because the output.root file is not being created. Could someone help? Are there any recent changes in Geant4 affecting g4root?

Geant4 Version: 11.2.1

Operating System: Ubuntu 22.04 LTS (64-bit)

Compiler/Version: GCC 11.4.0

CMake Version: 3.22.1

Thank you

Hasan Ghotme.

@HasanGhotme, I assume you do so inside your BeginOfRunAction. After that you should write and close the ROOT file in your EndOfRunAction. Something like this:

void MyRunAction::EndOfRunAction(const G4Run*)
{
    // Inicializes an instance of the AnalysisManager
    G4AnalysisManager *man = G4AnalysisManager::Instance();

    // Writes data in the Tuples at the end of the run
    // and closes the output file 
    man->Write();
    man->CloseFile();
}
2 Likes