# ****************************************************************
# PeakSensing Configuration File
# ****************************************************************

# NOTE:
# The setting modes can be [COMMON] (all boards-related), "[BOARD #]" (single board-related) or "[GROUP #]" (group-related)
# The setting mode is specified by a C,B and G in the setting description
# If a setting is GROUP-related, it can also be BOARD-related or COMMON (i.e. the setting refers to all the groups in all the boards of the system) 
# However not all options that are COMMON can also be BOARD- or GROUP-related.  The "[BOARD #]" or "[GROUP #]" directives have no effect on such settings
# The "[BOARD #]" and "[GROUP #]" modes are alternative to [COMMON] but do not exclude each other. This means that one can issue a command to a 
# specific group of a specific board, to all groups of a specific board or to a specific group of all boards. 
# When the [BOARD #] mode is set, the following settings apply to all groups (even if a specific channel was previously selected)  
# The board index follows the board initialization order using the OPEN command (see below).
# The lines between the commands @OFF and @ON will be skipped. This can be used to exclude parts of the config file.

# ----------------------------------------------------------------
# Settings common to the whole acquisition system.
# ----------------------------------------------------------------
[COMMON]

# OPEN: open the PeakSensing device
# NOTE: the BA must be set to 0 if the connection is direct or to the base address set through the rotary switches if the connection is via VME 
# The base address (if required) must be in the form "0xXXXXXXXX"
# options: 
# USB [LINKNUM] 0                   Desktop/NIM digitizer through USB
# USB [LINKNUM] [BA]                VME digitizer through USB V1718/V3718 (BA = BaseAddress of the VME board, 32 bit hex)
# PCI [LINKNUM] [CONET NODE] 0      Desktop/NIM/VME through CONET (optical link) with A2818/A3818/A5818
# PCI [LINKNUM] [CONET NODE] [BA]   VME digitizer through CONET (optical link) with A2818/A3818/A5818 and V2718/V3718/V4718 (BA = BaseAddress of the VME board, 32 bit hex)
# USB_A4818 [PID] [CONET NODE] 0    Desktop/NIM/VME through CONET (optical link) with A4818
# USB_A4818 [PID] [CONET NODE] [BA] VME digitizer through CONET (optical link) with A4818 and V2718/V3718/V4718 (BA = BaseAddress of the VME board, 32 bit hex)
# USB_V4718 [PID] [BA]              VME digitizer through USB V4718 (BA = BaseAddress of the VME board, 32 bit hex)
# ETH_V4718 [HOSTNAME] [BA]         VME digitizer through ETH V4718 (BA = BaseAddress of the VME board, 32 bit hex)

OPEN USB 0 0x32100000
#OPEN PCI 0 0 0
#OPEN USB 0 0
#OPEN PCI 0 0 0x32100000

# Statistics Refresh period (msec)(C), including event plotting if enabled.
STAT_REFRESH 1000

# PERIODIC_PLOT(YES/NO)(C): if set to YES a spectrum will be plotted periodically, the period being set by the STAT_REFRESH variable
# On slower PCs, disabling this feature might improve the demo sw's performances. Single events can be plotted by pressing the "p" key during acquisition 
PERIODIC_PLOT YES

# GNUPLOT_PATH (C): path to gnuplot executable file.
# If this parameter is commented, the included gnuplot exec will be used 
# Reminder: \ for windows, / for linux 
# GNUPLOT_PATH ".\gnuplot_exec\win\"

# Enable output file: RAW,LIST,HISTO (YES/NO)(C)
# The RAW mode allows to save the board dump (.bin)
# The LIST mode allows to save the information related to trigger, time stamp and the measured amplitude of each active channel (.txt)
# The HISTO mode allows to save the spectrum of each active channel (.txt)

OUTFILE_RAW NO
OUTFILE_LIST NO
OUTFILE_HISTO NO

# OUTPUT BINARY FILES PATH AND NAME
# The default output directory in windows is "UserDir"\Peaksensinsg_DAQ\PeakSensing_output\ (created by the program)
# The default output directory in linux is "UserDir"\PeakSensing_output\ (created by the program) 
# The default file name is run0
# b,c,seg identify the board, channel and output segment (segmented according to OUTFILE_MAXSIZE):
# "file_name"_raw_b#_seg#.bin for the raw
# "file name"_list_b#_seg#.txt for the list
# "file_name"_histo_b#_c#.txt for the histo
# the following lines must be uncommented to change the default output directory and filename
# if they are commented, "PeakSensing_output" and "run0" will be the default output directory and name
# OUTFILE_PATH PeakSensing_output\
# OUTFILE_NAME run0

# SIZE OF A SINGLE OUTPUT BINARY FILE(MBytes)(C). After this size has been reached by list or raw files, a new file with a _(#+1) segment value will be opened.
OUTFILE_MAXSIZE 100

# SLIDING SCALE(YES/NO)(B): if set to YES the sliding scale is enabled, with the purpose of correcting the ADC's DNL. 
# In this mode the ADC scale is limited to 15/16 of the full scale range (e.g. 3840 on a 4k spectrum).

SLSCALE_ENABLE YES

# POLARITY (POSITIVE/NEGATIVE)(B): allows to process positive/negative signals
POLARITY POSITIVE

# INPUT RANGE (8V/4V)(B): allows to modify the input range of the board
INPUT_RANGE 8V

# SPECTRUM_CHANNEL (1k,2k,4k,8k,16k)(B): sets the number of channels on which the peak measurement is performed
# The 16k mode is not allowed when the input range is 4V
SPECTRUM_CHANNEL 16k

# GATE_WIDTH (0/16 msec)(B): the gate width (same for all channels). 
# It is expressed in microseconds. The value is rounded down to the closest multiple of 16 ns.
# when GATE_WIDTH = 0 the internal programmable gate generator is disabled: the gate width corresponds to the external signal connected to the gate input
# when GATE_WIDTH > 0 the gate has the programmed width and starts with the leading edge of the external signal connected to the gate input
GATE_WIDTH 5.

# FPIO_LEVEL(NIM/TTL)(B): signal type of the front panel I/O LEMO connectors (GATE,REJECT,GPO)
FPIO_LEVEL TTL

# ENABLE_INPUT(0x0-0xffffffffffffffff for VME, 0x0-0xffffffff for DT/NIM)(B): set the enabled channels for acquisition
# This parameter cannot be modified online (i.e. during the acquisition)
ENABLE_INPUT 0xffffffffffffffff

# ENABLE_GRAPH(0x0-0xff)(B): set the enabled graphs for plotting within the plotted group
# The plotted channels for the plotted group can be enabled/disabled by pressing the 0-7 keys
ENABLE_GRAPH 0xff

# GROUP_GRAPH (0-7)(C): sets the plotted 8-channel group
# It can be incremented/decremented online by pressing the 8(-) and 9(+) keys
GROUP_GRAPH 0

# ZS_ENABLE(YES/NO)(B): if set to YES the zero suppression is enabled, with thresholds given by the ZS_THRESHOLD group parameter.
ZS_ENABLE NO

# ZS_THRESHOLD (0x0-0xffff)(G): sets the zero-suppression threshold (if enabled) for each group
# This parameter can be applied either on a common ([COMMON]) or on a group ([GROUP #]) basis

[GROUP 0]
ZS_THRESHOLD 1000
[GROUP 1]
ZS_THRESHOLD 1000
[GROUP 2]
ZS_THRESHOLD 1000
[GROUP 3]
ZS_THRESHOLD 1000
[GROUP 4]
ZS_THRESHOLD 1000
[GROUP 5]
ZS_THRESHOLD 1000
[GROUP 6]
ZS_THRESHOLD 1000
[GROUP 7]
ZS_THRESHOLD 1000