Hello all
I am looking for a way to retrieve the position in global X,Y,Z coordinates of a sensitive volume (the position that would be indicated in the 3D visualization) that has just been hit by a particle (and not the position of the particle itself).
One way to go could be to access to all the physical volumes tree translation vectors and rotations :
std::vector<G4ThreeVector> translation_list; // to store list of translations
std::vector<G4RotationMatrix*> rotation_list; // to store list of rotations
// depth of the volume tree
G4int nb_depth = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistoryDepth();
for (G4int i = 0; i < nb_depth; ++i) {
translation_list.push_back (aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetTranslation(i));
rotation_list.push_back (aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetRotation(i));
}
And then combine them to reconstruct the position of the physical volume in world’s X,Y,Z space. But I don’t know how to do this combination correctly.
If there is an easier approach, I am of course very interested.
Thanks in advance for the help.
-David