diff --git a/README.md b/README.md index a887aad..8d2f147 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,7 @@ One row per Geant4 step. Every step of every track of every event is recorded. | `layer_id` | `int` | Layer index at the pre-step point (-1 = outside all layers) | | `material` | `string` | Material name at the pre-step point | | `pre_dx/dy/dz` | `double` | Pre-step momentum unit direction | +| `post_dx/dy/dz` | `double` | Post-step momentum unit direction | | `Bx/By/Bz` | `double` | Magnetic field at pre-step position [T] | | `Ex/Ey/Ez` | `double` | Electric field at pre-step position [V/m] | | `child_track_ids` | `int[]` | Track IDs of all secondaries spawned during this step (empty if none) | diff --git a/src/RunAction.cc b/src/RunAction.cc index 2d7507f..4e00ef5 100644 --- a/src/RunAction.cc +++ b/src/RunAction.cc @@ -111,6 +111,9 @@ RunAction::RunAction() analysisManager->CreateNtupleDColumn("Ey"); // col 24 [V/m] analysisManager->CreateNtupleDColumn("Ez"); // col 25 [V/m] analysisManager->CreateNtupleIColumn("child_track_ids", stepChildIds); // col 26 (variable-length array) + analysisManager->CreateNtupleDColumn("post_dx"); // col 27 + analysisManager->CreateNtupleDColumn("post_dy"); // col 28 + analysisManager->CreateNtupleDColumn("post_dz"); // col 29 analysisManager->FinishNtuple(); // Spawning ntuple (one row per secondary born, ntuple id=2) diff --git a/src/SteppingAction.cc b/src/SteppingAction.cc index cb4146f..a40b6c4 100644 --- a/src/SteppingAction.cc +++ b/src/SteppingAction.cc @@ -143,6 +143,12 @@ void SteppingAction::UserSteppingAction(const G4Step* step) analysisManager->FillNtupleDColumn(1, 18, dir.y()); analysisManager->FillNtupleDColumn(1, 19, dir.z()); + // G: post-step momentum direction (unit vector) + const auto postDir = post->GetMomentumDirection(); + analysisManager->FillNtupleDColumn(1, 27, postDir.x()); + analysisManager->FillNtupleDColumn(1, 28, postDir.y()); + analysisManager->FillNtupleDColumn(1, 29, postDir.z()); + // Field: B [T] and E [V/m] at pre-step position; zero if no field is registered G4double Bx=0, By=0, Bz=0, Ex=0, Ey=0, Ez=0; const auto* fm = G4TransportationManager::GetTransportationManager()->GetFieldManager();