|Message: Re: simulation efficiency||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
I am somewhat confused as to exactly what you need. Do you really want to know about all the neutrons produced in the whole geometry, or just in a particular volume or two?
Personally, I would suggest using an extension of G4VSensitiveDetector in the region of interest, with some extensions of G4VSDFilter. Counting would happen in ProcessHits(G4Step aStep, ...) and your count could be output in EndOfEventAction or whatever that method is called. Failing this, use G4UserStackingAction rather than G4UserSteppingAction. As it is, the method is called every time any particle takes a step. Granted, you immediately check if it is the first step and return if it isn't, but it's a waste to call the method at all. G4UserStackingAction isn't really designed for what you are doing, but it shouldn't be hard to adapt, and it lets you make your checks *only* when a particle is created. This is probably going to make the smallest footprint on your runtime.
Other than that, your check process looks functional. I would move the check for whether the particle is a primary inside the check for the PDG particle code for the neutron. I assume you have no Au198 primaries, so the check is unnecessary for it, and I would guess that the neutron check will eliminate more candidates than the secondary check, so you could save a bit of time by putting the neutron check on the outside. Alternatively, you could forgo the primary particle check entirely and just subtract the number of primaries at the end, though that is very poor programming practice.
Does this answer your question?
|Inline Depth:||Outline Depth:||Add message:|