Message: EventAction never kicks in? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None EventAction never kicks in? 

Forum: Event and Track Management
Date: 27 Mar, 2017
From: Erik Almhagen <Erik Almhagen>

Hello all Geant4-meisters!

So for whatever reason, I cannot seem to be able to get my user EventAction class to do anything. I am using Geant4.10.2.p02. What I want to do is to create a NTuple for every event:

void EventAction::beginOfEventAction(const G4Event* event)
{
          ...
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
          ...
analysisManager->OpenFile(FileName);
analysisManager->CreateNtuple("E", "P");
analysisManager->CreateNtupleDColumn("Particle");
analysisManager->CreateNtupleDColumn("Total Energy Deposit");
analysisManager->CreateNtupleDColumn("TrackID");
analysisManager->FinishNtuple();
          ...
}

and then score the interesting stuff in my user SteppingAction class:

void SteppingAction::UserSteppingAction(const G4Step* step)
{
          ...
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
          ...
analysisManager->FillNtupleDColumn(0, Particle);
analysisManager->FillNtupleDColumn(1, E/eV);
analysisManager->FillNtupleDColumn(2, step->GetTrack()->GetTrackID());
          ...
}

and then finally close things up and write everything in my Eventaction class again:

void EventAction::endOfEventAction(const G4Event*)
{
          ...
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
analysisManager->CloseFile();
          ...
}

But it seems like my NTuple is never actually created, because every time I run my code I get error messages saying:

*** G4Exception : Analysis_W011
      issued by : G4TNtupleManager::FillNtupleTColumn
      ntuple 0 does not exist.
*** This is just a warning message. ***
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : Analysis_W011
      issued by : G4TNtupleManager::AddNtupleRow
      ntuple 0 does not exist.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

and no output file is ever created. I tried inserting some G4couts in my beginOfEventAction method but it is never printed in the output. I have initialized my EventAction and SteppingAction in the ActionInitialization class:

void ActionInitialization::Build() const { SetUserAction(PrimaryGeneratorAction); EventAction* eventAction = new EventAction; SetUserAction(eventAction); SteppingAction* steppingAction = new SteppingAction(eventAction,GetLimit()); SetUserAction(steppingAction); }

and everything compiles nicely. It seems as if my EventAction class is completely sidestepped and ignored, and it just dives into my SteppingAction class which finds no NTuple into which to fill the data. Does anything have any idea what is happening here?

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: EventAction never kicks in?   (Erik Almhagen - 28 Mar, 2017)
 Add Message Add Message
to: "EventAction never kicks in?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]