Performing counts as part of a trajectory can be done by setting the Init block with standard counter conditions or by setting up specific counter conditions per loop. To learn more about using the Init block, see Initialization.
The counter can be set to count against time, monitor, or a region of interest (ROI) on a detector OR any combination of these criteria. In the following examples, the counter will be set within the Init block - not only because this is the most common way to set a counter for a trajectory but also because it is identical to how the counter gets set for individual loops.
To count against time for 10 seconds, you must set the "counter.countAgainst" node to the word "TIME" and the "counter.timePreset" node to "10.0",
To count against monitor, the "counter.countAgainst" node must be set to the word "MONITOR". In the following example,
the count will continue until the monitor has detected 10,000 neutrons.
Counting against ROI requires you to use the "counter.countAgainst" node with the keyword "ROI". "counter.roiPrest" specifies the number of neutrons at which counting should terminate, while "counter.roiAgainst" specifies the name of the logical detector whose region of interest should be used.
In the below example,
The system will count until accumulated region of interest sum across the area detector exceeds 20,000 neutrons. In other words, once the counts in all the pre-selected detector pixels (and counter array indices) collectively sums to 20,000 neutrons, then the count will end.
NOTE: The detector name for "counter.roiAgainst" must be set as a raw string.
NOTE: To use the ROI option you must set an appropriate ROI mask on the detector you are interested in. The ROI mask represents a per pixel weight across an entire logical detector. This can be set by moving the mask directly through a script to an arbitrary configuration or by using a convenience command at the console to set it to a common shape.
Here is an example of counting against time, monitor, and ROI:
The above count will continue until 5 seconds have passed, the monitor reaches 10,000 counts, or the accumulated ROI sum across the area detector exceeds 20,000 counts.
The available "counter.countAgainst" codes are as listed below:
Again, these codes must be set as raw strings.
IMPORTANT: When counting against time or monitor, the system will never undercount or overcount. This is guaranteed because the counter hardware uses electronic gating in its data collection.
When counting against multiple criteria, the count will end when ANY of the criteria is met, NOT when all criteria are met. When counting against multiple criteria and/or ROI, the system may overcount. For example, you ask the system to collect counts for 20 seconds or until you reach 10,000 monitor counts; however, the count ends at 18.2 seconds having recorded 10,027 monitor counts. These additional 27 counts get recorded because of a time lag in the software communicating to the hardware that it should stop counting.