Message: Re: Killing Photons Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Disagree Re: Killing Photons 

Forum: Event and Track Management
Re: None Killing Photons (Greg Damhorst)
Date: 24 Jul, 2009
From: Gumplinger Peter <Gumplinger Peter>

Hi Greg,

> I've tried G4UserLimits and G4UserSpecialCuts in DetectorConstruction

> and PhysicsList, respectively, as an example I found seemed to describe.

> However, this compiles successfully and then can't run (I get errors

> telling me I need to construct electrons!), so if you suggest these

> methods please be very specific about what I need.

I can't find a reason why you'd need to define an electron simply because you are using G4UserLimits and G4UserSpecialCuts. You'll need an electron if you have this code in your PhysicsList:

  // Use Birks Correction in the Scintillation process

  G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();


One way to get an electron would be to add:


at the top of your PhysicsList.

> I'd like to kill a photon like this (say, after a certain number of

> steps) so my program can move on and calculate the next photon

> trajectory. Any ideas on the simplest way to do this?

Well, the simplest way is G4UserLimits/G4UserSpecialCuts. Else, you can program in your SteppingAction class a private member bounceLimit which you initialize in the constructor. You also add counterBounce as a private member which you have to set to zero at each first step of a photon track. In UserSteppingAction:

case FresnelReflection:

case TotalInternalReflection:


if (bounceLimit > 0 && counterBounce >= bounceLimit) theTrack->SetTrackStatus(fStopAndKill);

(please see the examples/extended/optical/LXe/ for how you obtain the G4OpBoundaryProcess status)

You can also even more simply code:

if(theTrack->GetTrackLength() > 10*m)theTrack->SetTrackStatus(fStopAndKill);

>I've also tried to set an absorption length in the fiber material, but

>when I do this the application ignores the boundary process/refractive

>indexes I've set and just shoots photons straight through my material.

I have no explanation for this!!! There is something very fishy with your code.

Best regards, Peter

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Killing Photons   (Greg Damhorst - 25 Jul, 2009)
 Add Message Add Message
to: "Re: Killing Photons"

 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 ]