Counters Ferdi Franceschini 2006-08-16 16:24 Beam monitors have not been documented completely in either the PSI source code or on the Bragg Institute Plone CMS. Therefore, this document is a standalone document, not edited from another source. Beam monitors When you are doing an experiment with the main detector, you don't address beam monitors directly. You would normally select and configure the beam monitor to control your experiment using the histmem command. However, you may want to use a scan command with a beam monitor and without the main detector. This can be done with bmonscan which is a SICS scan object. For more detail on bmonscan, see the chapter "Simple Scans". Instruments often have more than one beam monitor. SICS has a multicounter interface named bm, which is a list of all the beam monitors on the instrument, usually 2 or 3 beam monitors with names bm1, bm2 and bm3. You must select which beam monitor will control your experiment. When you run the experiment using bm, all the beam monitors on the instrument will count, and with most instrument configurations, the values will be saved to the data file - you should check this is the case if you need these values. Selecting a beam monitor for bm bmonscan setchannel n Sets the active beam monitor. n = 0 is bm1, n =1 is bm2 etc. This is the preferred command when doing a bmonscan bm setchannel n Sets the active beam monitor. n = 0 is bm1, n =1 is bm2 etc. This is the alternate command when using bmonscan histmem mode MONITOR_n Sets the active beam monitor. n = 1 is bm1, n =2 is bm2 etc. Use this command when using histmem runscan also has an argument to select the beam monitor. Do not use these interchangably e.g. do not use bm setchannel n to set histmem mode MONITOR_n. It will not work. Since there are four commands for selecting beam monitor, you have to be careful to use the right one. Be explicit with your selection of beam monitor when using these commands. Don't assume. If you are using histmem to control the detector, set the beam monitor using histmem mode. If you are using bmonscan set the beam monitor using bm setchannel or bmonscan setchannel If you are using runscan set the beam monitor with the mode setting in the runscan arguments. Setting modes for the beam monitors The mode for a beam monitor, either or can be set using bm mode, where bm can be bm, bm1, bm2 etc. The mode of the mulitcounter bm may be different from the mode of the selected beam monitor e.g. bm1 mode. Even if you select bm1 using bm setchannel 0 or bmonscan setchannel 0, changing the mode of bm1 e.g. bm1 mode monitor will not change bm mode. bm mode is set by the most recent bmonscan run. Active beam monitor commands (bm) The active beam monitor bm has the following commands. These commands are get only bm_preset scalar value at which an acquisition will be stopped. Used in conjunction with mode get only tree interface /monitor/preset bm_mode mode to stop acquisitions, either or get only Return values: will stop acquisition preset seconds after the acquisition is started will stop acquisition preset counts after the acquisition is started tree interface /monitor/mode tree interface only gets the scalar value for the instantaneous time of the beam monitor selected to control the experiment. get only Units: seconds tree interface /monitor/time tree interface only gets the scalar value for the instantaneous counts of the beam monitor selected to control the experiment. get only Units: counts tree interface /monitor/data bm is available in the tree interface under the /monitor node, and attributes can be set and get using the hget and hset commands. Specific beam monitor commands (bm1) Each beam monitors are accessible as SICS objects, and in the tree interface under the /monitor node. They can be addressed by name, or using the hget commands when using the tree interface. There are generally either 1, 2 or 3 monitor per instrument, and the commands are of the form bm1_... where 1 can be 1, 2 or 3 For simplicity, all the command descriptions below will use bm1 bm1_counts returns the instanteous value of the number of counts Units: counts tree interface /monitor/bm1_counts bm1_event_rate returns the instanteous value of the count rate Units: counts per second tree interface /monitor/bm1_event_rate bm1_time return the instantaneous time on this beam monitor. Each beam monitor can have a unique time value. Units: seconds tree interface /monitor/bm1_time bm1_status Return values: Beam monitor is enabled Beam monitor is disabled tree interface /monitor/bm1_status Commands used on both active (bm) and specific (bm1) beam monitors Use the commands on either bm or bm1 Please replace bm1 with the beam monitor you want to control. A setting on bm will not change the setting on the selected beam monitor e.g. bm1 bm1 preset value get or set a preset value for bm1. This is the value at which the acquisition will be stopped. Used in conjunction with mode bm1 mode value get or set the mode to stop acquisitions, either or value must be one of these options will stop acquisition preset seconds after the acquisition is started will stop acquisition preset counts after the acquisition is started bm1 status returns the monitor status. e.g. bm1.CountStatus = 10000 0 Beam: 0 E6 = preset, current control value, current counts. The current counts may be high by 10 times. To be tested and fixed. bm1 count value Sets the preset to value and runs the counter to the preset. Use hget with the tree interface e.g. hget /monitor/bm1_counts. hget /monitor/bm1_counts will return the same value as bm1_counts These attributes are get only e.g. hget /monitor/bm1_counts The next section refers to histmem which is most commonly used. The second section will refer to bm, and how it interacts with histmem Configuring counters Counters must be configured into the SICS server with the MakeCounter command, they cannot be added dynamically to a running server. The MakeCounter command has the following syntax MakeCounter name type [parameters] The list of parameters depends on the type of counter that is being created.