Message: Printing /gps/position in output file Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Printing /gps/position in output file 

Forum: Particles
Date: 07 Aug, 2017
From: Alan Horst <Alan Horst>

So to preface I'm quite new to Geant and apologize if my explanation is horrible.

Basically I'm simulating firing photons at a scintillator tile, and I'm outputting data for each run while altering the particle source coordinates using /gps/position x y z cm which is relevant information that I need from each run.

So my problem is figuring out how to include the x and y coordinates of the particle source with the output data from each run.

I tried using this in Analysis.cc and printing pos.x() and pos.y()

     G4ThreeVector pos =G4EventManager::GetEventManager()->GetConstCurrentEvent()
     ->GetPrimaryVertex(0)->GetPosition();

But I think that this data is getting deleted during each run, and adding this line makes the simulation output nothing at all. (If i remove it, it works normally)

Is there a way to define a global variable based on what I input in my macro (maybe in Analysismessenger) that I can call in analysis.cc after each run?

 Add Message Add Message
to: "Printing /gps/position in output file"

 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 ]