| Message: Re: Killing Photons | Not Logged In (login) |
|
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();
theScintProcess->AddSaturation(emSaturation); One way to get an electron would be to add: G4LossTableManager::Instance(); 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: counterBounce++; if (bounceLimit > 0 && counterBounce >= bounceLimit) theTrack->SetTrackStatus(fStopAndKill); (please see the examples/extended/optical/LXe/LXeSteppingAction.cc 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: | Outline Depth: | Add message: |
|
to: |