Add next_volume/next_material columns and sampling batch script
Records the volume and material a track is about to enter when a step ends at a geometric boundary, since post-step's physical volume still refers to the volume the step occurred in. Also adds run-sampling-batch.sh to run all run_sampling configs in parallel from isolated directories, avoiding output filename collisions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,8 @@ RunAction::RunAction()
|
||||
analysisManager->CreateNtupleDColumn("post_dx"); // col 27
|
||||
analysisManager->CreateNtupleDColumn("post_dy"); // col 28
|
||||
analysisManager->CreateNtupleDColumn("post_dz"); // col 29
|
||||
analysisManager->CreateNtupleSColumn("next_volume"); // col 30 (volume entered if step ended at a boundary, else "")
|
||||
analysisManager->CreateNtupleSColumn("next_material"); // col 31 (material entered if step ended at a boundary, else "")
|
||||
analysisManager->FinishNtuple();
|
||||
|
||||
// Spawning ntuple (one row per secondary born, ntuple id=2)
|
||||
|
||||
@@ -149,6 +149,22 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
analysisManager->FillNtupleDColumn(1, 28, postDir.y());
|
||||
analysisManager->FillNtupleDColumn(1, 29, postDir.z());
|
||||
|
||||
// H: volume/material the track is about to enter, if this step ended at a
|
||||
// geometric boundary. post->GetPhysicalVolume() still refers to the volume
|
||||
// the step occurred in, not the one being entered, so use track->GetNextVolume().
|
||||
G4String nextVolumeName = "";
|
||||
G4String nextMaterialName = "";
|
||||
if (post->GetStepStatus() == fGeomBoundary) {
|
||||
auto nextVolume = track->GetNextVolume();
|
||||
if (nextVolume) {
|
||||
nextVolumeName = nextVolume->GetName();
|
||||
auto nextMaterial = nextVolume->GetLogicalVolume()->GetMaterial();
|
||||
if (nextMaterial) nextMaterialName = nextMaterial->GetName();
|
||||
}
|
||||
}
|
||||
analysisManager->FillNtupleSColumn(1, 30, nextVolumeName);
|
||||
analysisManager->FillNtupleSColumn(1, 31, nextMaterialName);
|
||||
|
||||
// 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();
|
||||
|
||||
Reference in New Issue
Block a user