Filling std::vector to ntuple in the eventaction class?

Hellow everyone,

I have a ntuple column to store the vectors containing energy deposited in different detectors for each event. (Quite similar to basic Example B5).

If I am not wrong, in Example B5, the vector filling (rather referencing) is done in the runactionclass,

analysisManager                                   // column Id = 6
      ->CreateNtupleDColumn("ECEnergyVector", fEventAction->GetEmCalEdep()); 

is it possible to achieve this in the eventaction class where the other nptuples are getting filled, like copying the above ln in EndofEvent()?
#include "runaction.hh"

runaction::runaction(eventaction *eventAction){}

void runaction::BeginOfRunAction(const G4Run* run){
    G4AnalysisManager*man = G4AnalysisManager::Instance();
    G4int RunID = run->GetRunID();
void runaction::EndOfRunAction(const G4Run*){
    G4AnalysisManager*man = G4AnalysisManager::Instance();

Thanks a lot !


The vector ntuple column is filled with the AddNtupleRow call, which happens in example B5 in EventAction.

The vector ntuple column is created with a reference to the vector, so when the vector is filled in the event action, its content is directly available to ntuple for storing the data.

The code


should stay in the RunAction constructor as it in B5.

1 Like

Thanks a lot for the clarification.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.