[ Counter ] section ================================================== In PHITS, each particle maintains an individual value called a *Counter* in addition to other information such as energy and position. The counter value can be updated whenever specific events occur, such as entering or exiting a certain region ( **in**, **out** ), scattering or nuclear reactions within that region ( **coll** ), or reflection at a boundary ( **ref** ). This allows users to investigate in detail the history and origin of how tallied particles reached their locations. Therefore, the counter serves as an *event logger* in PHITS simulations. To enable restrictions based on counters, the **ctmin** or **ctmax** parameters must be set in each tally section or the [Parameters] section. This allows you to either selectively tally only particles with specific counter values (gate function) or terminate the actual tracking of particles that satisfy certain conditions (cutoff function). Three counters can be used in tally sections. The counter basically counts when 1. a particle enters a specified region, **in** [#]_ 2. a particle goes out of a specified region, **out** 3. a particle undergoes scattering or a nuclear reaction in a specified region, **coll** 4. a particle reflects back on a certain boundary of the region, **ref** 5. a yield value is tallied in **[t-yield]** or **[t-dchain]** with **ndata=2,3**, **ndata** You can set one progress value of the counter from **-9999** to **9999**, or zero set, **10000**. Counter values are attached to particles. Secondary particles produced in collisions inherit the counter value of their parent. The capacity of the counter is from **-9999** to **9999**. The counter changes only within this range. You can set the counter for each particle by using **part=** definition, and you can exclude some particles from counter actions by **\*part=** definition. .. code-block:: text :caption: **[ Counter ]** section example (1) [ Counter ] counter = 1 part = neutron proton reg in out coll ref 1 1 10000 0 0 11 1 10000 0 0 counter = 2 *part = proton deuteron triton 3he alpha nucleus reg in out coll ( { 2 - 5 } 8 9 ) -1 0 1 counter = 3 part = 208Pb reg coll ( 11 12 15 ) 5 ( 6<10[1 0 0]