Q: | How can I access the track information through the step object and what information am I allowed to access ? |
A: |
A G4StepPoint* point1 = step->GetPreStepPoint(); G4StepPoint* point2 = step->GetPostStepPoint();
To get their positions in the global coordinate system: G4ThreeVector pos1 = point1->GetPosition(); G4ThreeVector pos2 = point2->GetPosition();
Hereafter we call current volume the volume where the step has just
gone through. Geometrical informations are available from
G4TouchableHandle touch1 = point1->GetTouchableHandle();
To get the current volume: G4VPhysicalVolume* volume = touch1->GetVolume();
To get its name: G4String name = volume->GetName();
To get the physical volume copy number: G4int copyNumber = touch1->GetCopyNumber();
To get logical volume: G4LogicalVolume* lVolume = volume->GetLogicalVolume();
To get the associated material: the following statements are equivalent: G4Material* material = point1 ->GetMaterial(); G4Material* material = lVolume ->GetMaterial();
To get the geometrical region: G4Region* region = lVolume->GetRegion();
To get its mother volume: G4VPhysicalVolume* mother = touch1->GetVolume(depth=1); grandMother: depth=2 ...etc...
To get the copy number of the mother volume: G4int copyNumber = touch1->GetCopyNumber(depth=1); grandMother: depth=2 ...etc...
To get the process which has limited the current step: G4VProcess* aProcess = point2->GetProcessDefinedStep();
To check that the particle has just entered in the current volume
(i.e. it is at the first step in the volume; the
if (point1->GetStepStatus() == fGeomBoundary)
To check that the particle is leaving the current volume
(i.e. it is at the last step in the volume; the
if (point2->GetStepStatus() == fGeomBoundary)
In the above situation, to get touchable of the next volume: G4TouchableHandle touch2 = point2->GetTouchableHandle();
From
Physics quantities are available from the step
(
To get the energy deposition, step length, displacement and time of flight spent by the current step: G4double eDeposit = step->GetTotalEnergyDeposit(); G4double sLength = step->GetStepLength(); G4ThreeVector displace = step->GetDeltaPosition(); G4double tof = step->GetDeltaTime();
To get momentum, kinetic energy and global time (time since the beginning of the event) of the track after the completion of the current step: G4Track* track = step->GetTrack(); G4ThreeVector momentum = track->GetMomentum(); G4double kinEnergy = track->GetKineticEnergy(); G4double globalTime = track->GetGlobalTime(); ...etc...
Remark
To transform a position from the global coordinate system to the
local system of the current volume, use the
|