69 G4cout <<
"ForwardTransportModel::DoIt" << G4endl;
72 const int pdgcode = fastTrack.GetPrimaryTrack()->GetDefinition()->GetPDGEncoding();
73 const G4ThreeVector& initialMomentum = fastTrack.GetPrimaryTrack()->GetMomentum();
74 if (!
m_fwdSvc->selectedParticle(initialMomentum, pdgcode)) {
79 const double charge = fastTrack.GetPrimaryTrack()->GetDefinition()->GetPDGCharge();
80 const G4ThreeVector& initialPosition = fastTrack.GetPrimaryTrack()->GetPosition();
81 const double time = fastTrack.GetPrimaryTrack()->GetGlobalTime();
82 const double energy = fastTrack.GetPrimaryTrack()->GetTotalEnergy();
85 G4cout <<
" pdgCode: " << pdgcode <<
" energy[GeV]: " <<
energy/
CLHEP::GeV <<
" charge: " <<
charge << G4endl;
95 G4cout << fParticle << G4endl;
116 HepMC::GenEvent* gEvent = (
part) ?
const_cast<HepMC::GenEvent*
>(
part->parent_event()) :
nullptr;
119 description <<
"ForwardTransportModel::DoIt Cannot get HepMC::GenEvent pointer";
120 G4Exception(
"ForwardTransportModel",
"ForwardTransportModel03", FatalException,
description);
126 postTransportPosition.x(),
127 postTransportPosition.y(),
128 postTransportPosition.z(),
130 gEvent->add_vertex(gVertex);
131 gVertex->add_particle_in(
part);
134 postTransportMomentum.x(),
135 postTransportMomentum.y(),
136 postTransportMomentum.z(),
140 gVertex->add_particle_out(gParticle);
144 fastStep.SetNumberOfSecondaryTracks(1);
146 const G4ParticleDefinition *aParticleDefinition{};
148 if (pdgcode == MC::GEANTINOPLUS) {
149 aParticleDefinition = G4ChargedGeantino::Definition();
151 if (pdgcode == MC::GEANTINO0) {
152 aParticleDefinition = G4Geantino::GeantinoDefinition();
154 if (!aParticleDefinition) {
156 G4ParticleTable *ptable = G4ParticleTable::GetParticleTable();
158 aParticleDefinition = ptable->FindParticle(pdgcode);
161 G4DynamicParticle dp2(aParticleDefinition,
energy, postTransportMomentum);
165 std::unique_ptr<ISF::ISFParticle> postTransportISP{};
170 const int status = gParticle->status();
171 auto tBinding = std::make_unique<ISF::TruthBinding>(gParticle);
173 const Amg::Vector3D pos(postTransportPosition.x(), postTransportPosition.y(), postTransportPosition.z());
174 const Amg::Vector3D mom(postTransportMomentum.x(), postTransportMomentum.y(), postTransportMomentum.z());
175 postTransportISP = std::make_unique<ISF::ISFParticle>(
pos,
188 std::unique_ptr<PrimaryParticleInformation> ppi2 = std::make_unique<PrimaryParticleInformation>(gParticle,postTransportISP.release());
189 std::unique_ptr<G4PrimaryParticle> pp2 = std::make_unique<G4PrimaryParticle>(
191 postTransportMomentum.x(),
192 postTransportMomentum.y(),
193 postTransportMomentum.z());
194 pp2->SetUserInformation(ppi2.release());
195 dp2.SetPrimaryParticle(pp2.release());
197 G4Track* postTransportTrack =
198 fastStep.CreateSecondaryTrack(
200 postTransportPosition,
203 if (!postTransportTrack) {
205 description <<
"ForwardTransportModel::DoIt Failed to create secondary G4Track.";
206 G4Exception(
"ForwardTransportModel",
"ForwardTransportModel04", FatalException,
description);
209 fastStep.ProposePrimaryTrackFinalPosition(postTransportPosition,
false);
210 fastStep.SetPrimaryTrackFinalMomentum(postTransportMomentum,
false);
211 fastStep.KillPrimaryTrack();