This page describes the pixie_std.cpp file used for event creation and should not have to be altered on a regular basis. Pixie_std includes five important functions which control event creation:
- hissub_() - The interface between SCAN and the C++ analysis. Reassemble a complete pixie16 spill of data.
- Init_IDmap() - Analysis initialization
- hissub_sec() - extract channel information from the raw pixie16 data spill and sort the triggered channels based on time.
- Scan_List() - Group channels into events and send to detector_driver for processing
- Histo_Plot() - plot various permanent spectra such as the run time and time between events.
Pixie_std is the interface between the HRIBF scan program and the Pixie16 C++ analysis. The function hissub_()
is called from scan with two variables. The first, ibuf, is a pointer to the array where the raw data is stored. The second, nhw, describes the amount of raw data that is stored in the array.
In a typical experiment with the new pixie16 readout (default) all Pixie16 modules are read out when one module has reached its maximum number of events. The maximum number of events is programmed during experimental setup. This spill of data is divided into smaller chunks of data for transmission across the network. The hissub_() function collects the chunks of data to reassemble the complete spill.
Following the reconstruction of the first spill and before continuing the analysis is initialized with the function Init_IDmap()
When the first spill has been reconstructed and before analysis begins the function Init_IDmap()
is called to initialize all routines and variables used in the scanning process. First the detector_driver
class is queried to determine the valid detector types that can be used in the analysis. This is accomplished with the following two lines of code in Init_IDmap()
The detector types that are currently valid for analysis are dssd_front, dssd_back, ge, timeclass, si, position, idssd_front, sinct, and mcp. The detector types position and idssd_front have to date been exclusively used for fragmentation experiments at MSU.
Next the file map.txt is opened to determine a unique detector that is connected to each pixie16 strip. Please see map.txt for more information. For every line in the map.txt file the associated parameters are read into an identifier variable called id and pushed into the variable modchan (a vector containing a channel identifier for each line in the map.txt) will the following code:
If the entry should be ignore (by setting the detector type to "ignore") a dummy entry is inserted into the modchan vector. In the Scan_List()
function each channel has an identifier
retrieved from the modchan vector using the following code:
where the variable id is defined as
module number * 16 + channel number
Thus the identifier
corresponding to module #2 and channel #10 (id = 42) must be stored in modchan element 42 to allow the retrieval to work properly. This requires that entries in map.txt are in sequential order and all combinations of module number and channel number are present.
After reading in the map.txt file the detector types that are used in the current analysis along with an empty copy of the rawevent are sent to the detector driver for initialization.
For each pixie16 channel that has not been set to "ignore" the detector type is checked against the vector of known detectors. If the detector type is not listed among the known detectors the program will terminate to provide the user an opportunity to fix the problem.
Once the spill is reassembled the hissub_sec()
function scans the reconstructed buffer to extract individual triggered channels using the ReadBuffData()
function. The individual channels are inserted into the eventlist and once the spill has been completely scanned the list is sorted based on the event time of each individual channel.
After the list of channels that triggered in the current spill has been sorted by time the Scan_List()
function is invoked. This function scans the list of channels and groups channels with similar times togther into events. Starting from the begining of the list and continuing to the end an individual channel event time is compared with the previous channel event time to determine if they occur within the time period defined by the diff_t variable (in units of 10 ns) and
- if yes - the two channels are considered to belong to the same event and the current channel is added to the list of channels in the rawevent variable.
- if no - the previous rawevent is considered complete and is sent to the detector_driver for processing. Once processing is finished, the rawevent variable is zeroed and the current channel is placed inside it to begin a new event.
- All possible combinations of module number and channel number must be present in the map.txt file. There is currently no check on this requirement. Failure to do this may reset in the code issuing a "segmentation fault".
The entries in map.txt must be ordered sequentially. Failure to do so could possibly mix different detector types together.
If you add information into the rawevent class make sure to appropriately zero the variable in the Scan_List() function.