File indexing completed on 2024-04-06 12:30:28
0001 #include "SimG4Core/PhysicsLists/interface/CMSHepEmTrackingManager.h"
0002
0003 #include "G4EventManager.hh"
0004 #include "G4ProcessManager.hh"
0005 #include "G4StackManager.hh"
0006 #include "G4TrackingManager.hh"
0007
0008 CMSHepEmTrackingManager::CMSHepEmTrackingManager(G4double highEnergyLimit) : fHighEnergyLimit(highEnergyLimit) {}
0009
0010 CMSHepEmTrackingManager::~CMSHepEmTrackingManager() = default;
0011
0012 void CMSHepEmTrackingManager::BuildPhysicsTable(const G4ParticleDefinition& part) {
0013 G4HepEmTrackingManager::BuildPhysicsTable(part);
0014
0015 G4ProcessManager* pManager = part.GetProcessManager();
0016 G4ProcessManager* pManagerShadow = part.GetMasterProcessManager();
0017
0018 G4ProcessVector* pVector = pManager->GetProcessList();
0019 for (std::size_t j = 0; j < pVector->size(); ++j) {
0020 if (pManagerShadow == pManager) {
0021 (*pVector)[j]->BuildPhysicsTable(part);
0022 } else {
0023 (*pVector)[j]->BuildWorkerPhysicsTable(part);
0024 }
0025 }
0026 }
0027
0028 void CMSHepEmTrackingManager::PreparePhysicsTable(const G4ParticleDefinition& part) {
0029 G4HepEmTrackingManager::PreparePhysicsTable(part);
0030
0031 G4ProcessManager* pManager = part.GetProcessManager();
0032 G4ProcessManager* pManagerShadow = part.GetMasterProcessManager();
0033
0034 G4ProcessVector* pVector = pManager->GetProcessList();
0035 for (std::size_t j = 0; j < pVector->size(); ++j) {
0036 if (pManagerShadow == pManager) {
0037 (*pVector)[j]->PreparePhysicsTable(part);
0038 } else {
0039 (*pVector)[j]->PrepareWorkerPhysicsTable(part);
0040 }
0041 }
0042 }
0043
0044 void CMSHepEmTrackingManager::HandOverOneTrack(G4Track* aTrack) {
0045 if (aTrack->GetKineticEnergy() < fHighEnergyLimit) {
0046
0047 G4HepEmTrackingManager::HandOverOneTrack(aTrack);
0048 } else {
0049
0050 G4EventManager* eventManager = G4EventManager::GetEventManager();
0051 G4TrackingManager* trackManager = eventManager->GetTrackingManager();
0052
0053 trackManager->ProcessOneTrack(aTrack);
0054 if (aTrack->GetTrackStatus() != fStopAndKill) {
0055 G4Exception("CMSHepEmTrackingManager::HandOverOneTrack", "NotStopped", FatalException, "track was not stopped");
0056 }
0057
0058 G4TrackVector* secondaries = trackManager->GimmeSecondaries();
0059 eventManager->StackTracks(secondaries);
0060 delete aTrack;
0061 }
0062 }