#include "StackingAction.hh" #include "G4RunManager.hh" #include "G4Event.hh" #include "G4Track.hh" #include "G4TrackStatus.hh" #include "G4ParticleDefinition.hh" #include "G4ParticleTypes.hh" #include "G4ios.hh" #include "G4VTouchable.hh" // Updated constructor to accept RunAction* parameter StackingAction::StackingAction(RunAction* theRunAction) : runAction(theRunAction) {} // Destructor StackingAction::~StackingAction() {} // ClassifyNewTrack method G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track * aTrack) { G4ClassificationOfNewTrack classification = fUrgent; G4String particleName1 = aTrack->GetDefinition()->GetParticleName(); if ( particleName1 == "proton" || particleName1 == "neutron" || particleName1 == "anti_proton" || particleName1 == "GenericIon " || particleName1 == "alpha" || particleName1 == "kaon+" || particleName1 == "kaon-" || particleName1 == "mu+" || particleName1 == "mu-" || particleName1 == "pi+" || particleName1 == "pi-" || particleName1 == "gamma" ) { classification = fKill; } if (aTrack->GetCreatorProcess() != NULL) { G4String particleName2 = aTrack->GetDefinition()->GetParticleName(); if ( particleName2 == "proton" || particleName2 == "neutron" || particleName2 == "anti_proton" || particleName2 == "GenericIon " || particleName2 == "alpha" || particleName2 == "kaon+" || particleName2 == "kaon-" || particleName2 == "mu+" || particleName2 == "mu-" || particleName2 == "pi+" || particleName2 == "pi-" || particleName2 == "gamma" ) { classification = fKill; } } return classification; }