File indexing completed on 2025-02-23 09:21:19
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
0030
0031 #include "F04TrajectoryPoint.hh"
0032
0033 #include "G4AttDef.hh"
0034 #include "G4AttDefStore.hh"
0035 #include "G4AttValue.hh"
0036 #include "G4Step.hh"
0037 #include "G4StepStatus.hh"
0038 #include "G4Track.hh"
0039 #include "G4UIcommand.hh"
0040 #include "G4UnitsTable.hh"
0041 #include "G4VProcess.hh"
0042
0043
0044 #ifdef G4ATTDEBUG
0045 # include "G4AttCheck.hh"
0046 #endif
0047
0048 G4ThreadLocal G4Allocator<F04TrajectoryPoint>* F04TrajPointAllocator = nullptr;
0049
0050
0051
0052 F04TrajectoryPoint::F04TrajectoryPoint() {}
0053
0054
0055
0056 F04TrajectoryPoint::F04TrajectoryPoint(const G4Step* aStep)
0057 : G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition())
0058 {
0059 fTime = aStep->GetPostStepPoint()->GetGlobalTime();
0060 fMomentum = aStep->GetPostStepPoint()->GetMomentum();
0061 fStepStatus = aStep->GetPostStepPoint()->GetStepStatus();
0062 if (aStep->GetPostStepPoint()->GetPhysicalVolume()) {
0063 fVolumeName = aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName();
0064 }
0065 else {
0066 fVolumeName = G4String(" ");
0067 }
0068 }
0069
0070
0071
0072 F04TrajectoryPoint::F04TrajectoryPoint(const G4Track* aTrack)
0073 : G4TrajectoryPoint(aTrack->GetPosition())
0074 {
0075 fTime = aTrack->GetGlobalTime();
0076 fMomentum = aTrack->GetMomentum();
0077 fStepStatus = fUndefined;
0078 fVolumeName = aTrack->GetVolume()->GetName();
0079 }
0080
0081
0082
0083 F04TrajectoryPoint::F04TrajectoryPoint(const F04TrajectoryPoint& right) : G4TrajectoryPoint(right)
0084 {
0085 fTime = right.fTime;
0086 fMomentum = right.fMomentum;
0087 fStepStatus = right.fStepStatus;
0088 fVolumeName = right.fVolumeName;
0089 }
0090
0091
0092
0093 const std::map<G4String, G4AttDef>* F04TrajectoryPoint::GetAttDefs() const
0094 {
0095 G4bool isNew;
0096 std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("TrajectoryPoint", isNew);
0097 if (isNew) {
0098 G4String Pos("Pos");
0099 (*store)[Pos] = G4AttDef(Pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0100
0101 G4String Time("Time");
0102 (*store)[Time] = G4AttDef(Time, "Time", "Physics", "G4BestUnit", "G4double");
0103
0104 G4String Momentum("Momentum");
0105 (*store)[Momentum] = G4AttDef(Momentum, "Momentum", "Physics", "G4BestUnit", "G4ThreeVector");
0106
0107 G4String StepStatus("StepStatus");
0108 (*store)[StepStatus] = G4AttDef(StepStatus, "StepStatus", "Physics", "", "G4StepStatus");
0109
0110 G4String VolumeName("VolumeName");
0111 (*store)[VolumeName] = G4AttDef(VolumeName, "VolumeName", "Physics", "", "G4String");
0112 }
0113 return store;
0114 }
0115
0116
0117
0118 std::vector<G4AttValue>* F04TrajectoryPoint::CreateAttValues() const
0119 {
0120 auto values = new std::vector<G4AttValue>;
0121
0122 values->push_back(G4AttValue("Time", G4BestUnit(fTime, "Time"), ""));
0123
0124 values->push_back(G4AttValue("Momentum", G4BestUnit(fMomentum, "Momentum"), ""));
0125
0126 values->push_back(G4AttValue("StepStatus", G4UIcommand::ConvertToString(fStepStatus), ""));
0127
0128 values->push_back(G4AttValue("VolumeName", fVolumeName, ""));
0129
0130 #ifdef G4ATTDEBUG
0131 G4cout << G4AttCheck(values, GetAttDefs());
0132 #endif
0133
0134 return values;
0135 }