Dear Experts
Geant4 Version: 11.0.0
_Operating System:_Ubuntu 22.0
I need to create multiple ROOT output files using this run.cc
#include “run.hh”
MyRunAction::MyRunAction()
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
man->CreateNtuple(“Hits”, “Hits”);
man->CreateNtupleIColumn(“fEvent”);
man->CreateNtupleDColumn(“fX”);
man->CreateNtupleDColumn(“fY”);
man->CreateNtupleDColumn(“fZ”);
man->FinishNtuple(0);
}
MyRunAction::~MyRunAction()
{}
void MyRunAction::BeginOfRunAction(const G4Run* run)
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
G4int runID = run->GetRunID();
std::stringstream strRunID;
strRunID << runID;
man->OpenFile(“output”+strRunID.str()+“.root”);
}
void MyRunAction::EndOfRunAction(const G4Run*)
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
man->Write();
man->CloseFile();
}
But I see only one Output file.
It seems it doesnot execute run.mac
/gun/momentumAmp 0.5 GeV
/run/beamOn 100
/gun/momentumAmp 1 GeV
/run/beamOn 100
/gun/momentumAmp 5 GeV
/run/beamOn 100
Please suggest possible solution