MCPcopy Create free account
hub / github.com/Geant4/geant4 / PostUserTrackingAction

Method PostUserTrackingAction

source/tracking/src/G4AdjointTrackingAction.cc:65–116  ·  view source on GitHub ↗

--------------------------------------------------------------------

Source from the content-addressed store, hash-verified

63// --------------------------------------------------------------------
64//
65void G4AdjointTrackingAction::PostUserTrackingAction(const G4Track* aTrack)
66{
67 // important to have it here !
68 //
69 last_weight = theAdjointSteppingAction->GetLastWeight();
70 last_ekin = theAdjointSteppingAction->GetLastEkin();
71
72 if (! is_adjoint_tracking_mode) {
73 if (theUserFwdTrackingAction != nullptr) {
74 theUserFwdTrackingAction->PostUserTrackingAction(aTrack);
75 }
76 }
77 else if (theAdjointSteppingAction->GetDidAdjParticleReachTheExtSource()) {
78 last_pos = theAdjointSteppingAction->GetLastPosition();
79 last_direction = theAdjointSteppingAction->GetLastMomentum();
80 last_direction /= last_direction.mag();
81 last_cos_th = last_direction.z();
82 G4ParticleDefinition* aPartDef = theAdjointSteppingAction->GetLastPartDef();
83 last_fwd_part_name = aPartDef->GetParticleName();
84 last_fwd_part_name.erase(0, 4);
85 last_fwd_part_PDGEncoding =
86 G4ParticleTable::GetParticleTable()->FindParticle(last_fwd_part_name)->GetPDGEncoding();
87 last_ekin = theAdjointSteppingAction->GetLastEkin();
88 last_ekin_nuc = last_ekin;
89 if (aPartDef->GetParticleType() == "adjoint_nucleus") {
90 auto nb_nuc = G4double(aPartDef->GetBaryonNumber());
91 last_ekin_nuc /= nb_nuc;
92 }
93
94 last_fwd_part_index = -1;
95 std::size_t i = 0;
96 while (i < pListOfPrimaryFwdParticles->size() && last_fwd_part_index < 0) {
97 if ((*pListOfPrimaryFwdParticles)[i]->GetParticleName() == last_fwd_part_name) {
98 last_fwd_part_index = (G4int)i;
99 }
100 ++i;
101 }
102
103 // Fill the vectors
104 //
105 last_pos_vec.push_back(last_pos);
106 last_direction_vec.push_back(last_direction);
107 last_ekin_vec.push_back(last_ekin);
108 last_ekin_nuc_vec.push_back(last_ekin_nuc);
109 last_cos_th_vec.push_back(last_cos_th);
110 last_weight_vec.push_back(last_weight);
111 last_fwd_part_PDGEncoding_vec.push_back(last_fwd_part_PDGEncoding);
112 last_fwd_part_index_vec.push_back(last_fwd_part_index);
113 }
114 else {
115 }
116}
117
118// --------------------------------------------------------------------
119//

Callers

nothing calls this directly

Calls 15

GetLastWeightMethod · 0.80
GetLastEkinMethod · 0.80
GetLastPositionMethod · 0.80
GetLastMomentumMethod · 0.80
zMethod · 0.80
GetLastPartDefMethod · 0.80
magMethod · 0.45
GetParticleNameMethod · 0.45
GetPDGEncodingMethod · 0.45
FindParticleMethod · 0.45
GetParticleTypeMethod · 0.45

Tested by

no test coverage detected