Message: Problem Counting Optical Photons Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Problem Counting Optical Photons 

Forum: Processes Involving Optical Photons
Date: 28 Jul, 2011
From: Zach Miller <Zach Miller>

Hi,

I've attached some portions of code that I have been using. I'm trying to count how many photons pass between two specific volumes after I've thrown them through a certain geometry. In the User Step Function (SteppingAction.cc), I call a function (StepCheck) that checks if the photon is stepping from a certain volume (lightGuide) into another volume (catch). If this is true, I have it turn on the the "YesCount()" function in the EventAction class (EventAction.cc) [it only counts at the end of an event to avoid double counts during stepping; since I only want to know if the particle did make it to the other volume not if it made it and bounced in again]. In the EndOfEventAction() function, I have it call a function if YesCount() is activated called "increment()" which then takes the object that I'm using to count the number of photons that entered the second volume and adds one to it.

However, while attempting to debug it, I started having it print out the result of StepCheck() after each step... which meant that it should be either a 0 or a 1, since those are the only return values. If I make the result a G4int, it returns numbers like 10224735 and if I make it a G4float it sometimes returns things like .33303 and other non-zero, non-one values. Though it does always return a 1 when the correct conditions are satisfied, just not when it doesn't meet the correct conditions. I don't understand how this is possible since I'm returning either 0,1. Beyond that, it seems that my incrementing function never does anything. I use EndOfRunAction to call a function that returns my counting object... and it always returns a -1.

I don't understand how these return values are working, since they seem to be sometimes returning values that aren't any of the specified values. Do you see any obvious reasons this loop I'm using to count shouldn't work? Any ideas on why my return values are behaving oddly?

I've only attached the files that seem to be acting up, since compiling them seems to not be an issue... I really just need to find out why the counting and returning is behaving in a way that I can't understand.

Thanks for any time and help, Zach Miller

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2011/07/28/10.17-32275-LGEventAction.cc
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2011/07/28/10.17-80357-LGRunAction.cc
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2011/07/28/10.17-11671-LGSteppingAction.cc

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

1 Feedback: Re: Problem Counting Optical Photons   (Gumplinger Peter - 05 Aug, 2011)
(_ None: Re: Problem Counting Optical Photons   (Zach Miller - 09 Aug, 2011)
 Add Message Add Message
to: "Problem Counting Optical Photons"

 Subscribe Subscribe

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