Thank you for your response.
I am currently utilizing a scintillator detector connected to photomultiplier tubes (PMTs) at both ends. I record the total energy deposition (Edep) within the scintillator and the total number of optical photons detected by the PMTs. This information is stored at the end of each event within the event action. My current focus is to see the electron spectra.
However, I am encountering some difficulty in understanding how to store track information for each event, as it is represented as an array. Below is the event action part.
EventAction::EventAction(RunAction*)
:G4UserEventAction(),printModulo(100000),ListMode(0),fileOut(0)//, EdepInCrystal(0.), nAbsPhotons(0.), absTime(0.)
{
fileOut=new TFile(“Data207Bi_030724.root”,“recreate”);
ListMode=new TTree(“Tree”,“Parameters”);
ListMode->Branch(“EdepScintillator”,& EdepInScinti,“EdepScintillator/D”);
//ListMode->Branch(“PName”,&PName,“PName/I”);
ListMode->Branch(“PMT_A”,&nAbsPhotons1,“PMT_A/I”);
ListMode->Branch(“PMT_B”,&nAbsPhotons2,“PMT_B/I”);
ListMode->Branch(“t1”,&t1,“t1/D”);
ListMode->Branch(“t2”,&t2,“t2/D”);
}
EventAction::~EventAction()
{
ListMode->Write();
fileOut->Write();
G4cout<<“This file is written”<<G4endl;
fileOut->Close();
}
void EventAction::BeginOfEventAction(const G4Event* evt)
{
// initialisation per event
EdepInScinti = 0.;
nAbsPhotons1 = 0.;
nAbsPhotons2 = 0.;
PName = 0.;
G4int evtNb = evt->GetEventID();
//printing survey
if (evtNb%printModulo == 0)
G4cout << "\n—> Begin of Event: " << evtNb << G4endl;
}
void EventAction::EndOfEventAction(const G4Event* )
{
ListMode->Fill();
}