Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Counter

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",

counter1

To count against monitor, the "counter.countAgainst" node must be set to the word "MONITOR". In the following example,

counter2

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,

counters_roi_1b

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:

traj_counter_TMR

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:

  • TIME
  • MONITOR
  • ROI
  • TIME_MONITOR
  • TIME_ROI
  • MONITOR_ROI
  • TIME_MONITOR_ROI

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.

Created December 7, 2018, Updated July 18, 2019