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
11 changes: 11 additions & 0 deletions G4HepEm/G4HepEm/include/G4HepEmTrackingManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ public:
// Needed if the random engine was swapped after construction of the HepEm TM
void RebindG4RandomEngine();

// Returns whether the region for the given region index is using woodcock tracking
G4bool IsWDTRegion(G4int regionId) const;

// returns the Woodcock tracking kinetic energy limit
G4double GetWDTKineticEnergyLimit() const;

// For a given region index with Woodcock tracking and root logical volume index,
// this function returns the G4HepEm material cut couple index of that volume if it is indeed
// a root logical volume of a Woodcock tracking region, -1 otherwise
G4int GetWDTCoupleHepEmIndex(G4int regionId, G4int logicalVolumeId) const;

// Returns the vector of e-/e+ G4HepEmNoProcess pointers used only to set a
// creator and step limiter G4VProcess of the G4Step with an appropriate
// name and EM process type.
Expand Down
9 changes: 8 additions & 1 deletion G4HepEm/G4HepEm/include/G4HepEmWoodcockHelper.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public:


void SetKineticEnergyLimit(G4double val) { fWDTKineticEnergyLimit = val; }
G4double GetKineticEnergyLimit() { return fWDTKineticEnergyLimit; }
G4double GetKineticEnergyLimit() const { return fWDTKineticEnergyLimit; }


// Checks if this step will be done in a WDT region with high enough kinetic energy.
Expand All @@ -55,6 +55,13 @@ public:
// post step points and interaction can only happen at the post step point if any).
G4bool KeepTracking(const struct G4HepEmData* theHepEmData, G4HepEmGammaTrack* theGammaTrack, G4Track& aTrack);

// Returns whether the region for the given region index is using woodcock tracking
G4bool IsWDTRegion(G4int regionId) const;

// For a given region index with Woodcock tracking and root logical volume index,
// this function returns the G4HepEm material cut couple index of that volume if it is indeed
// a root logical volume of a Woodcock tracking region, -1 otherwise
G4int GetWDTCoupleHepEmIndex(G4int regionId, G4int logicalVolumeId) const;

private:

Expand Down
14 changes: 14 additions & 0 deletions G4HepEm/G4HepEm/src/G4HepEmTrackingManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ void G4HepEmTrackingManager::RebindG4RandomEngine() {

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

G4bool G4HepEmTrackingManager::IsWDTRegion(G4int regionId) const {
return (fWDTHelper) ? fWDTHelper->IsWDTRegion(regionId) : false;
}

G4double G4HepEmTrackingManager::GetWDTKineticEnergyLimit() const {
return (fWDTHelper) ? fWDTHelper->GetKineticEnergyLimit() : 0.0;
}

G4int G4HepEmTrackingManager::GetWDTCoupleHepEmIndex(G4int regionId, G4int logicalVolumeId) const {
return (fWDTHelper) ? fWDTHelper->GetWDTCoupleHepEmIndex(regionId, logicalVolumeId) : -1;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void G4HepEmTrackingManager::BuildPhysicsTable(const G4ParticleDefinition &part) {
if (&part == G4Electron::Definition()) {
int particleID = 0;
Expand Down
20 changes: 20 additions & 0 deletions G4HepEm/G4HepEm/src/G4HepEmWoodcockHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,26 @@ G4bool G4HepEmWoodcockHelper::KeepTracking(const struct G4HepEmData* theHepEmDat
return isWDTReachedBoundary;
}

G4bool G4HepEmWoodcockHelper::IsWDTRegion(G4int regionId) const {
auto itrRegion = fWDTData.find(regionId);
return itrRegion != fWDTData.end() && itrRegion->second;
}

G4int G4HepEmWoodcockHelper::GetWDTCoupleHepEmIndex(G4int regionId, G4int logicalVolumeId) const {
// check whether the provided region is a Woodcock tracking region
auto itrRegion = fWDTData.find(regionId);
if (itrRegion == fWDTData.end() || !itrRegion->second) {
return -1;
}
// check whether the provided logicalVolumeId corresponds to an entry in the root logical volumes map
const auto& WDTmap = itrRegion->second->fWDTDataRegion;
auto itrRootVol = WDTmap.find(logicalVolumeId);
if (itrRootVol == WDTmap.end() || !itrRootVol->second) {
return -1;
}
return itrRootVol->second->fG4CoupleHepEmIndex;
}


void G4HepEmWoodcockHelper::ClearData() {
// iterate over the `fWDTData` map
Expand Down