@@ -81,10 +81,7 @@ void Deleter::operator()(ScoringObjects *ptr)
81
81
82
82
} // namespace AdePTGeant4Integration_detail
83
83
84
- AdePTGeant4Integration::~AdePTGeant4Integration ()
85
- {
86
-
87
- }
84
+ AdePTGeant4Integration::~AdePTGeant4Integration () {}
88
85
89
86
void AdePTGeant4Integration::CreateVecGeomWorld (std::string filename)
90
87
{
@@ -268,7 +265,6 @@ void AdePTGeant4Integration::InitScoringData(adeptint::VolAuxData *volAuxData)
268
265
// Though we only record and reconstruct hits for sensitive volumes, this map needs to store every
269
266
// volume in the geometry, as a step may begin in a sensitive volume and end in a non-sensitive one
270
267
fglobal_vecgeom_to_g4_map.insert (std::pair<int , const G4VPhysicalVolume *>(vg_pvol->id (), g4_pvol));
271
-
272
268
// Now do the daughters
273
269
for (int id = 0 ; id < g4_lvol->GetNoDaughters (); ++id) {
274
270
auto g4pvol_d = g4_lvol->GetDaughter (id);
@@ -292,18 +288,20 @@ void AdePTGeant4Integration::ProcessGPUHit(GPUHit const &hit)
292
288
}
293
289
294
290
// Reconstruct G4NavigationHistory and G4Step, and call the SD code for each hit
295
- vecgeom::NavigationState const & preNavState = hit.fPreStepPoint .fNavigationState ;
291
+ vecgeom::NavigationState const &preNavState = hit.fPreStepPoint .fNavigationState ;
296
292
// Reconstruct Pre-Step point G4NavigationHistory
297
293
FillG4NavigationHistory (preNavState, &fScoringObjects ->fPreG4NavigationHistory );
298
294
(*fScoringObjects ->fPreG4TouchableHistoryHandle )
299
295
->UpdateYourself (fScoringObjects ->fPreG4NavigationHistory .GetTopVolume (),
300
296
&fScoringObjects ->fPreG4NavigationHistory );
301
297
// Reconstruct Post-Step point G4NavigationHistory
302
- vecgeom::NavigationState const & postNavState = hit.fPostStepPoint .fNavigationState ;
303
- FillG4NavigationHistory (postNavState, &fScoringObjects ->fPostG4NavigationHistory );
304
- (*fScoringObjects ->fPostG4TouchableHistoryHandle )
305
- ->UpdateYourself (fScoringObjects ->fPostG4NavigationHistory .GetTopVolume (),
306
- &fScoringObjects ->fPostG4NavigationHistory );
298
+ vecgeom::NavigationState const &postNavState = hit.fPostStepPoint .fNavigationState ;
299
+ if (!postNavState.IsOutside ()) {
300
+ FillG4NavigationHistory (postNavState, &fScoringObjects ->fPostG4NavigationHistory );
301
+ (*fScoringObjects ->fPostG4TouchableHistoryHandle )
302
+ ->UpdateYourself (fScoringObjects ->fPostG4NavigationHistory .GetTopVolume (),
303
+ &fScoringObjects ->fPostG4NavigationHistory );
304
+ }
307
305
308
306
// Reconstruct G4Step
309
307
switch (hit.fParticleType ) {
@@ -385,12 +383,15 @@ void AdePTGeant4Integration::FillG4Step(GPUHit const *aGPUHit, G4Step *aG4Step,
385
383
G4TouchableHandle &aPreG4TouchableHandle,
386
384
G4TouchableHandle &aPostG4TouchableHandle) const
387
385
{
388
- const G4ThreeVector aPostStepPointMomentumDirection (aGPUHit->fPostStepPoint .fMomentumDirection .x (), aGPUHit->fPostStepPoint .fMomentumDirection .y (),
389
- aGPUHit->fPostStepPoint .fMomentumDirection .z ());
390
- const G4ThreeVector aPostStepPointPolarization (aGPUHit->fPostStepPoint .fPolarization .x (), aGPUHit->fPostStepPoint .fPolarization .y (),
391
- aGPUHit->fPostStepPoint .fPolarization .z ());
392
- const G4ThreeVector aPostStepPointPosition (aGPUHit->fPostStepPoint .fPosition .x (), aGPUHit->fPostStepPoint .fPosition .y (),
393
- aGPUHit->fPostStepPoint .fPosition .z ());
386
+ const G4ThreeVector aPostStepPointMomentumDirection (aGPUHit->fPostStepPoint .fMomentumDirection .x (),
387
+ aGPUHit->fPostStepPoint .fMomentumDirection .y (),
388
+ aGPUHit->fPostStepPoint .fMomentumDirection .z ());
389
+ const G4ThreeVector aPostStepPointPolarization (aGPUHit->fPostStepPoint .fPolarization .x (),
390
+ aGPUHit->fPostStepPoint .fPolarization .y (),
391
+ aGPUHit->fPostStepPoint .fPolarization .z ());
392
+ const G4ThreeVector aPostStepPointPosition (aGPUHit->fPostStepPoint .fPosition .x (),
393
+ aGPUHit->fPostStepPoint .fPosition .y (),
394
+ aGPUHit->fPostStepPoint .fPosition .z ());
394
395
395
396
// G4Step
396
397
aG4Step->SetStepLength (aGPUHit->fStepLength ); // Real data
@@ -404,8 +405,8 @@ void AdePTGeant4Integration::FillG4Step(GPUHit const *aGPUHit, G4Step *aG4Step,
404
405
405
406
// G4Track
406
407
G4Track *aTrack = aG4Step->GetTrack ();
407
- aTrack->SetTrackID (aGPUHit->fParentID ); // Missing data
408
- aTrack->SetParentID (aGPUHit->fParentID ); // ID of the initial particle that entered AdePT
408
+ aTrack->SetTrackID (aGPUHit->fParentID ); // Missing data
409
+ aTrack->SetParentID (aGPUHit->fParentID ); // ID of the initial particle that entered AdePT
409
410
aTrack->SetPosition (aPostStepPointPosition); // Real data
410
411
// aTrack->SetGlobalTime(0); // Missing data
411
412
// aTrack->SetLocalTime(0); // Missing data
@@ -468,7 +469,7 @@ void AdePTGeant4Integration::FillG4Step(GPUHit const *aGPUHit, G4Step *aG4Step,
468
469
// aPostStepPoint->SetGlobalTime(0); // Missing data
469
470
// aPostStepPoint->SetProperTime(0); // Missing data
470
471
aPostStepPoint->SetMomentumDirection (aPostStepPointMomentumDirection); // Real data
471
- aPostStepPoint->SetKineticEnergy (aGPUHit->fPostStepPoint .fEKin ); // Real data
472
+ aPostStepPoint->SetKineticEnergy (aGPUHit->fPostStepPoint .fEKin ); // Real data
472
473
// aPostStepPoint->SetVelocity(0); // Missing data
473
474
if (const auto postVolume = (*fScoringObjects ->fPostG4TouchableHistoryHandle )->GetVolume ();
474
475
postVolume != nullptr ) { // protect against nullptr if postNavState is outside
0 commit comments