Kill the particle which comes into a certain volume

Hi everyone,
I want to caculate photon scatter rate to a certain volume. MCNP have a technial to setup a volume IMP=0 or 1,so i wander to konw whether geant4 have same method to set certain volume imp which could make particle to killed, when particle into it.
or is there another way could acheving the goal?

1 Like

Ciao @ZhenyuLim !

In Geant4 use StackingAction class to kill particle of your choice in any volume. There are many detailed examples on this topic and at instance you can have a look in /extended/electromagnetic/TestEm1

Contrary to killing you can score particle of your choice by using proper definition of particleID under processhits defined in steppingAction or in SensitiveDetctor Class.


attach a sensitive detector to the volume, and in ProcessHits(G4Step* aStep, G4TouchableHistory*) you can kill (everything or filtered by your choice) with aStep->GetTrack()->SetTrackStatus(fStopAndKill);

note that in this case you cannot use this volume as a primitive scorer, so you would need to do the scoring also in the sensitive detector

1 Like

Hello @weller,

Well explained. Thanks.


1 Like

Hi @drvijayraj ,Thank you for your answer, i will look it carefully.

I think it well be working, do there have some official examples in the Geant4’s examples folder?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.