170 const G4Track * G4PrimaryTrack = fastTrack.GetPrimaryTrack();
172 const G4ParticleDefinition * G4Particle = G4PrimaryTrack -> GetDefinition();
174 signed int pdgID = G4Particle -> GetPDGEncoding();
177 if(G4PrimaryTrack -> GetKineticEnergy() < 10){
179 G4cout<<
"[FastCaloSim::DoIt] Skipping particle with Ekin: " << G4PrimaryTrack -> GetKineticEnergy() <<
" MeV. Below the 10 MeV threshold"<<G4endl;
181 fastStep.KillPrimaryTrack();
185 if(G4Particle == G4Electron::Definition() || G4Particle == G4Positron::Definition() || G4Particle == G4Gamma::Definition())
192 truthState.
set_pdgid(G4PionPlus::Definition() -> GetPDGEncoding());
196 truthState.SetPtEtaPhiM(G4PrimaryTrack -> GetMomentum().
perp(),
197 G4PrimaryTrack -> GetMomentum().
eta(),
198 G4PrimaryTrack -> GetMomentum().
phi(),
199 G4Particle -> GetPDGMass());
202 truthState.
set_vertex(G4PrimaryTrack -> GetPosition().
x(),
203 G4PrimaryTrack -> GetPosition().
y(),
204 G4PrimaryTrack -> GetPosition().
z());
210 if(pdgID == -2212 || pdgID == -2112) truthState.
set_Ekin_off(2 * G4Particle -> GetPDGMass());
223 G4cout<<
"[FastCaloSim::DoIt] Killing particle as extrapolation failed"<<G4endl;
225 fastStep.KillPrimaryTrack();
229 if(
m_FastCaloSimSvc->simulate(simState, &truthState, &extrapolState).isFailure()){
230 G4Exception(
"FastCaloSimSvc",
"FailedSimulationCall", FatalException,
"FastCaloSimSvc: Simulation call failed.");
235 G4cout<<
"[FastCaloSim::DoIt] pdgID of G4PrimaryTrack: " << pdgID << G4endl;
236 G4cout<<
"[FastCaloSim::DoIt] Energy returned: " << simState.E() << G4endl;
237 G4cout<<
"[FastCaloSim::DoIt] Energy fraction for layer: " << G4endl;
238 for (
int s = 0;
s < 24;
s++) G4cout<<
"[FastCaloSim::DoIt] Sampling " <<
s <<
" energy " << simState.E(
s) << G4endl;
249 G4ParticleTable *ptable = G4ParticleTable::GetParticleTable();
252 const double simE = simState.E();
255 std::vector<double> simEfrac;
256 for (
unsigned int i = 0;
i < 24;
i++){simEfrac.push_back(simState.Efrac(
i));}
259 m_PunchThroughSimWrapper->DoPunchThroughSim(*ptable, G4Random::getTheEngine(), simE, std::move(simEfrac), fastTrack, fastStep);
263 simState.DoAuxInfoCleanup();
266 fastStep.KillPrimaryTrack();
267 fastStep.ProposePrimaryTrackPathLength(0.0);