Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/Example1/src/RunAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ void RunAction::EndOfRunAction(const G4Run *)
const std::lock_guard<std::mutex> lock(print_mutex);
// Print timer just for the master thread since this is called when all workers are done
if (tid < 0) {
G4cout << "Run time: " << time << "\n";
std::cout << "Run time: " << time << "\n";
}
}
3 changes: 2 additions & 1 deletion include/AdePT/integration/AdePTGeant4Integration.hh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ private:
void FillG4NavigationHistory(vecgeom::NavigationState aNavState, G4NavigationHistory &aG4NavigationHistory) const;

void FillG4Step(GPUHit const *aGPUHit, G4Step *aG4Step, G4TouchableHandle &aPreG4TouchableHandle,
G4TouchableHandle &aPostG4TouchableHandle) const;
G4TouchableHandle &aPostG4TouchableHandle, G4StepStatus aPreStepStatus,
G4StepStatus aPostStepStatus) const;

void ReturnTrack(adeptint::TrackData const &track, unsigned int trackIndex, int debugLevel) const;

Expand Down
1 change: 1 addition & 0 deletions include/AdePT/kernels/gammas.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ __global__ void TransportGammas(adept::TrackManager<Track> *gammas, Secondaries
survive();
}
}

// If there is some edep from cutting particles, record the step
if ((edep > 0 && auxData.fSensIndex >= 0) || returnAllSteps || returnLastStep) {
adept_scoring::RecordHit(userScoring,
Expand Down
21 changes: 17 additions & 4 deletions src/AdePTGeant4Integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <G4TouchableHandle.hh>
#include <G4PVReplica.hh>
#include <G4ReplicaNavigation.hh>
#include <G4StepStatus.hh>

#include <G4HepEmState.hh>
#include <G4HepEmData.hh>
Expand Down Expand Up @@ -351,6 +352,17 @@ void AdePTGeant4Integration::ProcessGPUStep(GPUHit const &hit, bool const callUs
&fScoringObjects->fPostG4NavigationHistory);
}

// Get step status
// NOTE: Currently, we only check for the geometrical boundary, other statuses are set as unknown for now
G4StepStatus preStepStatus{G4StepStatus::fUndefined};
G4StepStatus postStepStatus{G4StepStatus::fUndefined};
if (preNavState.IsOnBoundary()) {
preStepStatus = G4StepStatus::fGeomBoundary;
}
if (postNavState.IsOnBoundary()) {
postStepStatus = G4StepStatus::fGeomBoundary;
}

// Reconstruct G4Step
switch (hit.fParticleType) {
case 0:
Expand All @@ -364,7 +376,7 @@ void AdePTGeant4Integration::ProcessGPUStep(GPUHit const &hit, bool const callUs
break;
}
FillG4Step(&hit, fScoringObjects->fG4Step, *fScoringObjects->fPreG4TouchableHistoryHandle,
*fScoringObjects->fPostG4TouchableHistoryHandle);
*fScoringObjects->fPostG4TouchableHistoryHandle, preStepStatus, postStepStatus);

// Call SD code
G4VSensitiveDetector *aSensitiveDetector =
Expand Down Expand Up @@ -445,7 +457,8 @@ void AdePTGeant4Integration::FillG4NavigationHistory(vecgeom::NavigationState aN

void AdePTGeant4Integration::FillG4Step(GPUHit const *aGPUHit, G4Step *aG4Step,
G4TouchableHandle &aPreG4TouchableHandle,
G4TouchableHandle &aPostG4TouchableHandle) const
G4TouchableHandle &aPostG4TouchableHandle, G4StepStatus aPreStepStatus,
G4StepStatus aPostStepStatus) const
{
const G4ThreeVector aPostStepPointMomentumDirection(aGPUHit->fPostStepPoint.fMomentumDirection.x(),
aGPUHit->fPostStepPoint.fMomentumDirection.y(),
Expand Down Expand Up @@ -519,7 +532,7 @@ void AdePTGeant4Integration::FillG4Step(GPUHit const *aGPUHit, G4Step *aG4Step,
aPreStepPoint->SetPolarization(G4ThreeVector(aGPUHit->fPreStepPoint.fPolarization.x(),
aGPUHit->fPreStepPoint.fPolarization.y(),
aGPUHit->fPreStepPoint.fPolarization.z())); // Real data
// aPreStepPoint->SetStepStatus(G4StepStatus::fUndefined); // Missing data
aPreStepPoint->SetStepStatus(aPreStepStatus); // Missing data
// aPreStepPoint->SetProcessDefinedStep(nullptr); // Missing data
// aPreStepPoint->SetMass(0); // Missing data
aPreStepPoint->SetCharge(aGPUHit->fPreStepPoint.fCharge); // Real data
Expand All @@ -544,7 +557,7 @@ void AdePTGeant4Integration::FillG4Step(GPUHit const *aGPUHit, G4Step *aG4Step,
// aPostStepPoint->SetSensitiveDetector(nullptr); // Missing data
// aPostStepPoint->SetSafety(0); // Missing data
aPostStepPoint->SetPolarization(aPostStepPointPolarization); // Real data
// aPostStepPoint->SetStepStatus(G4StepStatus::fUndefined); // Missing data
aPostStepPoint->SetStepStatus(aPostStepStatus); // Missing data
// aPostStepPoint->SetProcessDefinedStep(nullptr); // Missing data
// aPostStepPoint->SetMass(0); // Missing data
aPostStepPoint->SetCharge(aGPUHit->fPostStepPoint.fCharge); // Real data
Expand Down