File indexing completed on 2026-09-09 08:29:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "Par04DefineMeshModel.hh"
0030
0031 #include "Par04EventInformation.hh" // for Par04EventInformation
0032
0033 #include "G4Event.hh" // for G4Event
0034 #include "G4EventManager.hh" // for G4EventManager
0035
0036 #include <G4FastTrack.hh> // for G4FastTrack
0037 #include <G4Track.hh> // for G4Track
0038 #include <G4VFastSimulationModel.hh> // for G4VFastSimulationModel
0039 #include <G4VUserEventInformation.hh> // for G4VUserEventInformation
0040 class G4FastStep;
0041 class G4ParticleDefinition;
0042 class G4Region;
0043
0044
0045
0046 Par04DefineMeshModel::Par04DefineMeshModel(G4String aModelName, G4Region* aEnvelope)
0047 : G4VFastSimulationModel(aModelName, aEnvelope)
0048 {}
0049
0050
0051
0052 Par04DefineMeshModel::Par04DefineMeshModel(G4String aModelName) : G4VFastSimulationModel(aModelName)
0053 {}
0054
0055
0056
0057 Par04DefineMeshModel::~Par04DefineMeshModel() = default;
0058
0059
0060
0061 G4bool Par04DefineMeshModel::IsApplicable(const G4ParticleDefinition&)
0062 {
0063 return true;
0064 }
0065
0066
0067
0068 G4bool Par04DefineMeshModel::ModelTrigger(const G4FastTrack&)
0069 {
0070 auto info = dynamic_cast<Par04EventInformation*>(
0071 G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetUserInformation());
0072
0073 if (info != nullptr)
0074 return !info->GetFlag();
0075 else
0076 return true;
0077 }
0078
0079
0080
0081 void Par04DefineMeshModel::DoIt(const G4FastTrack& aFastTrack, G4FastStep&)
0082 {
0083 auto info = dynamic_cast<Par04EventInformation*>(
0084 G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetUserInformation());
0085 if (info == nullptr) {
0086 info = new Par04EventInformation();
0087 G4EventManager::GetEventManager()->GetNonconstCurrentEvent()->SetUserInformation(info);
0088 }
0089 info->SetPosition(aFastTrack.GetPrimaryTrack()->GetPosition());
0090 info->SetDirection(aFastTrack.GetPrimaryTrack()->GetMomentumDirection());
0091 info->SetFlag(true);
0092 }