#include "LGTrackingAction.hh" #include "LGTrackingMessenger.hh" #include "G4TrackingManager.hh" #include "G4Track.hh" LGTrackingAction::LGTrackingAction() : mode_Num(7) { tracking_Messenger = new LGTrackingMessenger(this); } LGTrackingAction::~LGTrackingAction() { delete tracking_Messenger; } void LGTrackingAction::PreUserTrackingAction(const G4Track* aTrack) { switch(mode_Num) { case 1: // draw trajectory only for primaries if (aTrack->GetParentID() == 0) fpTrackingManager->SetStoreTrajectory(true); else fpTrackingManager->SetStoreTrajectory(false); break; case 2: // draw trajectory only for secondaries if (aTrack->GetParentID() > 0) fpTrackingManager->SetStoreTrajectory(true); else fpTrackingManager->SetStoreTrajectory(false); break; case 3: // draw trajectory only for e-'s if (aTrack->GetParentID()>0 && aTrack->GetDefinition()->GetParticleName()=="e-") fpTrackingManager->SetStoreTrajectory(true); else fpTrackingManager->SetStoreTrajectory(false); break; case 4: // draw trajectory only for e+'s if (aTrack->GetParentID()>0 && aTrack->GetDefinition()->GetParticleName()=="e+") fpTrackingManager->SetStoreTrajectory(true); else fpTrackingManager->SetStoreTrajectory(false); break; case 5: // draw trajectory only for gammas if (aTrack->GetParentID()>0 && aTrack->GetDefinition()->GetParticleName()=="gamma") fpTrackingManager->SetStoreTrajectory(true); else fpTrackingManager->SetStoreTrajectory(false); break; case 6: // draw trajectory only for optical photons if (aTrack->GetParentID()>0 && aTrack->GetDefinition()->GetParticleName()=="opticalphoton") fpTrackingManager->SetStoreTrajectory(true); else fpTrackingManager->SetStoreTrajectory(false); break; default: // draw trajectory only for primaries and secondaries excluding optical photons if (aTrack->GetParentID() >=0) { fpTrackingManager->SetStoreTrajectory(true); if (aTrack->GetDefinition()->GetParticleName() == "opticalphoton") fpTrackingManager->SetStoreTrajectory(false); } } }