Message: Re: G4UserLimit for gammas Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: G4UserLimit for gammas 

Forum: Physics List
Re: Question G4UserLimit for gammas (Thomas Melzig)
Date: 18 Feb, 2011
From: Randolph Moellenberg <Randolph Moellenberg>

You can kill the gammas below a certain threshold, before they are tracked. Just add the following code to your PostUserTrackingAction method:

G4TrackVector* secondaries = fpTrackingManager->GimmeSecondaries();
if(secondaries)
{
    size_t nSeco = secondaries->size();
    if(nSeco>0)
    {
      for(size_t i=0;i<nSeco;i++)
      {
        //check if secondary particle is a gamma
        if((*secondaries)[i]->GetDefinition()->GetParticleName()=='gamma')
        {
          //check if secondary particle is below threshold
	  if((*secondaries)[i]->GetVertexKineticEnergy()<threshold)
	     (*secondaries)[i]->SetTrackStatus(fStopAndKill); //kill secondary
        }
      }
     }

}

I hope that will solve your problem.

 Add Message Add Message
to: "Re: G4UserLimit for gammas"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]