Hello everyone, I have a muon as a primary particle which travels inside a water Cherenkov detector and emits optical photons.
I want to take the momentum and the time of the secondary particle(photon) at the vertex of creation.
However, I want to keep this info(momentum and time), only for those photons that arrive at the end of the detector(2 meters).
Set up your SD or SteppingAction to catch the photon at its end point. Then, in that code, access G4Track::GetVertexPosition() (as you do above), to get the photonâs initial position. Use G4Track::GetVertexKineticEnergy() and G4Track::GetDynamicParticle()->GetMass() to calculate the momentum magnitude, and multiply that by G4Track::GetVertexMomentumDirection() to get the momentum vector. Finally, use G4Track::GetGlobalTime() and G4Track::GetLocalTime() to compute the timestamp at the photonâs initial position.
Assuming you know that you only have exactly one primary particle per event, then G4Event::GetPrimaryVertex()->GetPrimaryParticle()->GetMomentum() will give you the initial momentum vector of the muon. Youâll need all the intermediate .hh files for those pointer dereferences to work properly.
Thank you, However if I do G4Event::GetPrimaryVertex()->GetPrimaryParticle()->GetMomentum() then it prints only the first vertex and not all of them.
I need a âforâ for all vertices of this event, right?
I do
G4int n_vertex = evt->GetNumberOfPrimaryVertex();
But it says that I have only one vertex, when at SteppingAction.cc I have many vertices(I know that because I get the coordinates of the vertex)
You are confusing the âverticesâ that are associated with the individually created secondary tracks (and which are stored withinG4Track), with the primary vertex, which contains the particle or particles you create with G4ParticleGun or G4GeneralParticleSource.
I did it*, but just to have it clear in my mind I want to ask you something.
A primary muon travels and emits photons. I thought we had a vertex at the point of emission . In that vertex I wanted the momentum of the muon(every time we have an emission, I need the momentum of the muon).
So, does the vertex only refer to the secondary track?
When we say primary vertex, we mean only the first point of ââcreationââ of primary particle?
How can we have access to information of the primary particle at different points of its track?
*(I did it in stepping, checking if we have cherenkov process and then I got the momentum with G4Track)
Yes, you can call the point where the photon is emitted a vertex, but there is no object by that name in Geant4 that you can reference. In Geant4, G4PrimaryVertex and G4PrimaryParticle refer to the generated initial particles in the event.
If you want to know the momentum of the muon when the secondary photon is emitted, then you will need a block of code in your SteppingAction:
Look for a track with ParentID == 0. Thatâs one of the primary particles.
Check if the process which limited the step is a process where photons are emitted
Check whether a secondary track was created in the step
If all those are true, get the track momentum and do what you want with it.
Yes. More specifically, the G4PrimaryVertex object specifies the location, and carries a list of the primary particles at that location. The G4PrimaryParticle object specifies the kinematics (mass, momentum, energy, charge, etc.) of one of the primary particles.
Each primary particle is converted into a G4Track, for which the parent ID is zero (i.e., the primaries donât have a parent). So you can test for that condition in your SteppingAction or SD.