extend Steps ntuple and switch Docker to Geant4 submodule source
Add 15 new columns to the Steps ntuple: edep, step_length, parent_id, process name, layer_id, material, pre-step momentum direction, and B/E field components (in T and V/m) at the pre-step point. Replace wget Geant4 tarball download in all three Dockerfiles with ADD of the lib/geant4 submodule source; narrow submodule init to lib/pybind11 only so builds no longer require network access for Geant4. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+16
-1
@@ -95,7 +95,22 @@ RunAction::RunAction()
|
||||
analysisManager->CreateNtupleDColumn("post_x"); // col 8
|
||||
analysisManager->CreateNtupleDColumn("post_y"); // col 9
|
||||
analysisManager->CreateNtupleDColumn("post_z"); // col 10
|
||||
analysisManager->CreateNtupleDColumn("post_E"); // col 11
|
||||
analysisManager->CreateNtupleDColumn("post_E"); // col 11
|
||||
analysisManager->CreateNtupleDColumn("edep"); // col 12 [MeV]
|
||||
analysisManager->CreateNtupleDColumn("step_length"); // col 13 [mm]
|
||||
analysisManager->CreateNtupleIColumn("parent_id"); // col 14
|
||||
analysisManager->CreateNtupleSColumn("process"); // col 15
|
||||
analysisManager->CreateNtupleIColumn("layer_id"); // col 16 (-1 = outside all layers)
|
||||
analysisManager->CreateNtupleSColumn("material"); // col 17
|
||||
analysisManager->CreateNtupleDColumn("pre_dx"); // col 18
|
||||
analysisManager->CreateNtupleDColumn("pre_dy"); // col 19
|
||||
analysisManager->CreateNtupleDColumn("pre_dz"); // col 20
|
||||
analysisManager->CreateNtupleDColumn("Bx"); // col 21 [T]
|
||||
analysisManager->CreateNtupleDColumn("By"); // col 22 [T]
|
||||
analysisManager->CreateNtupleDColumn("Bz"); // col 23 [T]
|
||||
analysisManager->CreateNtupleDColumn("Ex"); // col 24 [V/m]
|
||||
analysisManager->CreateNtupleDColumn("Ey"); // col 25 [V/m]
|
||||
analysisManager->CreateNtupleDColumn("Ez"); // col 26 [V/m]
|
||||
analysisManager->FinishNtuple();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4Field.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
using namespace B4;
|
||||
|
||||
@@ -95,6 +99,63 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
analysisManager->FillNtupleDColumn(1, 9, post->GetPosition().y());
|
||||
analysisManager->FillNtupleDColumn(1, 10, post->GetPosition().z());
|
||||
analysisManager->FillNtupleDColumn(1, 11, post->GetKineticEnergy());
|
||||
|
||||
// A: energy deposited in medium at this step (≠ pre_E - post_E when secondaries are created)
|
||||
analysisManager->FillNtupleDColumn(1, 12, edep);
|
||||
|
||||
// B: geometric step length
|
||||
analysisManager->FillNtupleDColumn(1, 13, step->GetStepLength());
|
||||
|
||||
// C: parent track ID (0 for primary)
|
||||
analysisManager->FillNtupleIColumn(1, 14, track->GetParentID());
|
||||
|
||||
// D: process that ended this step
|
||||
G4String processName = "";
|
||||
const auto* postProc = post->GetProcessDefinedStep();
|
||||
if (postProc) processName = postProc->GetProcessName();
|
||||
analysisManager->FillNtupleSColumn(1, 15, processName);
|
||||
|
||||
// E: layer index (-1 if outside all layers) and material name at pre-step point
|
||||
int layerId = -1;
|
||||
const auto& layers = cw->getLayers();
|
||||
for (int i = 0; i < (int)layers.size(); i++) {
|
||||
if (layers[i].physicalVolume == volume) { layerId = i; break; }
|
||||
}
|
||||
G4String materialName = pre->GetMaterial() ? pre->GetMaterial()->GetName() : "";
|
||||
analysisManager->FillNtupleIColumn(1, 16, layerId);
|
||||
analysisManager->FillNtupleSColumn(1, 17, materialName);
|
||||
|
||||
// F: pre-step momentum direction (unit vector)
|
||||
const auto dir = pre->GetMomentumDirection();
|
||||
analysisManager->FillNtupleDColumn(1, 18, dir.x());
|
||||
analysisManager->FillNtupleDColumn(1, 19, dir.y());
|
||||
analysisManager->FillNtupleDColumn(1, 20, dir.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();
|
||||
if (fm && fm->DoesFieldExist()) {
|
||||
const G4Field* field = fm->GetDetectorField();
|
||||
if (field) {
|
||||
const G4double point[4] = {pre->GetPosition().x(), pre->GetPosition().y(),
|
||||
pre->GetPosition().z(), pre->GetGlobalTime()};
|
||||
G4double fieldVal[6] = {0,0,0,0,0,0};
|
||||
field->GetFieldValue(point, fieldVal);
|
||||
Bx = fieldVal[0] / tesla;
|
||||
By = fieldVal[1] / tesla;
|
||||
Bz = fieldVal[2] / tesla;
|
||||
Ex = fieldVal[3] / (volt/m);
|
||||
Ey = fieldVal[4] / (volt/m);
|
||||
Ez = fieldVal[5] / (volt/m);
|
||||
}
|
||||
}
|
||||
analysisManager->FillNtupleDColumn(1, 21, Bx);
|
||||
analysisManager->FillNtupleDColumn(1, 22, By);
|
||||
analysisManager->FillNtupleDColumn(1, 23, Bz);
|
||||
analysisManager->FillNtupleDColumn(1, 24, Ex);
|
||||
analysisManager->FillNtupleDColumn(1, 25, Ey);
|
||||
analysisManager->FillNtupleDColumn(1, 26, Ez);
|
||||
|
||||
analysisManager->AddNtupleRow(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user