206 const G4VProcess *
process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
209 G4StepPoint *preStep=aStep->GetPreStepPoint();
210 G4StepPoint *postStep=aStep->GetPostStepPoint();
212 G4ThreeVector mom = preStep->GetMomentum();
213 const G4ThreeVector& pos = preStep->GetPosition();
216 G4Track * track = aStep->GetTrack();
218 int trackID=track->GetTrackID();
219 const bool trackIsAlive = (track->GetTrackStatus() == fAlive || track->GetTrackStatus() == fStopButAlive);
223 m_pdg = track->GetDefinition()->GetPDGEncoding();
224 const G4VProcess* creation = track->GetCreatorProcess();
225 m_scIn = creation? creation->GetProcessSubType() : -1;
229 HepMC::GenVertexPtr vtx = currentGenParticle ? currentGenParticle->production_vertex() :
nullptr;
230 m_gen = currentGenParticle? 0 : -1;
232 if (currentGenParticle) {
233 while (currentGenParticle && vtx ) {
234 int pdgID=currentGenParticle->pdg_id();
235 const HepMC::GenParticlePtr genmom = vtx->particles_in().size()>0 ? vtx->particles_in().front() :
nullptr;
236 if ( genmom && pdgID!=genmom->pdg_id() )
m_gen++;
237 else if (vtx->particles_out().size()>0 && currentGenParticle!=vtx->particles_out().front())
m_gen++;
238 vtx = genmom ? genmom->production_vertex() :
nullptr;
239 currentGenParticle = genmom;
243 int parentID=track->GetParentID();
244 std::map<int, int>::iterator genIt =
m_trackGenMap.find(parentID);
245 if ( genIt !=
m_trackGenMap.end())
m_gen = (genIt->second >= 0) ? genIt->second+1 : genIt->second-1;
264 double stepLength = aStep->GetStepLength();
265 double radLengthInX0 = preStep->GetMaterial()->GetRadlen();
266 double l0 = preStep->GetMaterial()->GetNuclearInterLength();
267 float stepInX0 = stepLength/radLengthInX0;
269 if (stepInX0>1.e-06) {
275 m_L0 += stepLength/l0;
278 double totNA = preStep->GetMaterial()->GetTotNbOfAtomsPerVolume();
279 const G4ElementVector* eVec = preStep->GetMaterial()->GetElementVector();
280 const G4double* atVector = preStep->GetMaterial() ->GetVecNbOfAtomsPerVolume();
281 float mFactor =stepInX0* preStep->GetMaterial()->GetDensity();
283 float zOverA = 0.;
float frSum = 0.;
284 for (
unsigned int i=0; i<eVec->size(); i++) {
285 float fEl = atVector ? atVector[i]/totNA : 0.;
286 m_wZ += stepInX0*fEl*((*eVec)[i]->GetZ());
289 zOverA += fEl*((*eVec)[i]->GetZ())/((*eVec)[i]->GetA());
292 if (fabs(frSum-1.)>0.01)
ATH_MSG_DEBUG(
"G4 material description inconsistent, sum of element fractions:"<< frSum);
302 float eloss = postStep->GetMomentum().mag()-preStep->GetMomentum().mag();
309 if (nSec>0 || !trackIsAlive ) {
312 m_pdg_mother = track->GetDefinition()->GetPDGEncoding();
314 G4ThreeVector mom = preStep->GetMomentum();
319 m_vtx_phi = postStep->GetPosition().phi();
321 int iPrimSurv = !trackIsAlive ? 0 : 1;
324 G4ThreeVector pbal(mom);
330 pbal -= postStep->GetMomentum();
334 for (
unsigned int isec=0; isec< nSec; isec++) {
335 G4ThreeVector secMom = truth.
childP(isec);
356 G4VPhysicalVolume *preVol=preStep->GetPhysicalVolume();
357 G4VPhysicalVolume *postVol=postStep->GetPhysicalVolume();
363 m_dt = track->GetLocalTime();
365 m_pth = track->GetVertexMomentumDirection().theta();
366 m_pph = track->GetVertexMomentumDirection().phi();
367 m_p = track->GetVertexKineticEnergy();
370 m_thIn= track->GetVertexPosition().theta();
371 m_phIn= track->GetVertexPosition().phi();
372 m_dIn= track->GetVertexPosition().mag();
374 m_thEnd=postStep->GetPosition().theta();
375 m_phEnd=postStep->GetPosition().phi();
376 m_dEnd=postStep->GetPosition().mag();
391 if ( !trackIsAlive ) {
394 m_dt = track->GetLocalTime();
396 m_pth = track->GetVertexMomentumDirection().theta();
397 m_pph = track->GetVertexMomentumDirection().phi();
398 m_p = track->GetVertexKineticEnergy();
401 m_thIn= track->GetVertexPosition().theta();
402 m_phIn= track->GetVertexPosition().phi();
403 m_dIn= track->GetVertexPosition().mag();
405 m_thEnd=postStep->GetPosition().theta();
406 m_phEnd=postStep->GetPosition().phi();
407 m_dEnd=postStep->GetPosition().mag();
419 if ( preVol==postVol )
return;
422 const G4ThreeVector &postPos = postStep->GetPosition();
423 const G4ThreeVector &postMom = postStep->GetMomentum();
432 if ( nextGeoID == geoID) {
435 ATH_MSG_DEBUG(
"track moves from "<<geoID<<
" to "<<nextGeoID);
439 if (aStep->GetStepLength() == 0.) {
448 const G4ThreeVector& g4pos = track->GetPosition();
450 const HepGeom::Point3D<double> position(g4pos.x(),g4pos.y(),g4pos.z());
452 G4ThreeVector g4mom = track->GetMomentum();
453 const HepGeom::Vector3D<double> momentum(g4mom.x(),g4mom.y(),g4mom.z());
456 if (track->GetTrackStatus()==fStopAndKill) {
465 m_dt = track->GetLocalTime();
467 m_pth = track->GetVertexMomentumDirection().theta();
468 m_pph = track->GetVertexMomentumDirection().phi();
469 m_p = track->GetVertexKineticEnergy();
472 m_thIn= track->GetVertexPosition().theta();
473 m_phIn= track->GetVertexPosition().phi();
474 m_dIn= track->GetVertexPosition().mag();
476 m_thEnd=postStep->GetPosition().theta();
477 m_phEnd=postStep->GetPosition().phi();
478 m_dEnd=postStep->GetPosition().mag();