|Event by event analysis. |
|void||Histo_Stats (unsigned long &, double &, double &, int)|
|void||hissub_sec (unsigned int *ibuf, unsigned int *nhw)|
|Extract channel information from the raw parameter array ibuf. |
|int||ReadBuffData (unsigned int *ibuf, unsigned short Begin, unsigned long *BufLen, vector< evt * > &, evt &)|
|extract channel information from raw data |
|void||pixie16_error (int errornum)|
|pixie16 scan error handling. |
|void||plot (const int &dammid, const double &val1, const double &val2=-1, const double val3=-1, char *name="h")|
|bool||cmp (const evt *a, const evt *b)|
|vector sort comparison function To use the sort function of a vector a method of comparing two elements in that vector must be defined. |
|void||hissub_ (unsigned short *ibuf, unsigned short *nhw)|
|interface between scan and C++ |
|vector< identifier >||modchan|
|vector< evt * >||eventlist|
|vector< evt * >::iterator||itereventlist|
|struct tms t||u|
pixie16_std provides the interface between the HRIBF scan and the C++ analysis and as such is not a class in its own right. In this file the data received from scan is first reassembled into a pixie16 spill and the then channel objects are made. The list of channels is then sorted based on each channels event time and grouped into events (the variable is rawevent) based on how close in time the channels are. The rawevent is then passed to the detector_driver and all further processing is based on the rawevent.
|#define TOTALREAD 2000000|
vector sort comparison function To use the sort function of a vector a method of comparing two elements in that vector must be defined.
"cmp" is the comparison function that will be used in the vector sorting routine. It will receive a pointer to two different objects of type evt. The "const" declaration is to ensure that the original objects are not inadvertently altered or damaged in this function. The function will return "true" if the time of the object a is less than the time of object b (otherwise return false). Currently time is taken from the pixie event time (two 32 bit words) with 10ns ticks.
|void hissub_||(||unsigned short *||ibuf,|
|unsigned short *||nhw|
interface between scan and C++
In a typical experiment Pixie16 reads data from all modules when one module has hit the maximum number of events which is programmed during experimental setup. This spill of data is then broken into smaller chuncks for transmitting across the network. The hissub_ function takes the chuncks and reconstructs the spill.
Summarizing the terminology:
The hissub_ function is passed a pointer to an array with data (ibuf) and the number of half words (nhw) contained in it. This function is used with the new Pixie16 readout (which is the default). If the old Pixie16 readout is used the code should be recompiled without the newredout flag in which case this particular function is not used.
|void hissub_sec||(||unsigned int *||ibuf,|
|unsigned int *||nhw|
Extract channel information from the raw parameter array ibuf.
If the new Pixie16 readout is used (default) this routine processes the reconstructed buffer. Specifically, it retrieves channel information and places the channel information into a list of channels that triggered in this spill. The list of channels is sorted according to the event time assigned to each channel by Pixie16 and the sorted list is passed to the Scan_List function for rawevent creation.
If the old pixie readout is used then this function is redefined as hissub_.
|void Histo_Stats||(||unsigned long &||id,|
At various points in the processing of data in Scan_List() the Histo_Stats function is called to increment some low level pixie16 informational and diagnostic spectra. The list of spectra filled includes runtime in seconds and milliseconds the deadtime, time between events and time with of an event.
Initialize the analysis
Read in the map.txt file to determine what detector types are going to be used in this analysis. For each detector type used created an entry into the det_sum map of the rawevent. After this is completed proceed to the detector_driver initialization function (detector_driver::init()) to complete the initialization.
Initialize firstime to zero, need to think about this when running multiple files
Currently not used
pixie16 scan error handling.
Print out an error message and terminate program depending on value of errornum. 1 - invalid module number in data stream (most likely due to not defining all modules in the map.txt file).
|void plot||(||const int &||dammid,|
|const double &||val1,|
|const double &|| val2 =
|const double|| val3 =
|char *|| name = |
Function for incrementing damm spectra. This function is defined in the detector_driver.cpp file. Using this interface function it will be possible to make a transparent switch between plotting functions in damm and ROOT.
generate the random numbers, results of this function are currently unused.
|int ReadBuffData||(||unsigned int *||ibuf,|
|unsigned long *||BufLen,|
|vector< evt * > &||eventlist,|
Remove list from memory when not needed
Event by event analysis.
The Scan_List operates on the time sorted list of all channels that triggered in a given spill. 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 a time period defined by the diff_t variable (time is in units of 10 ns). Depending on the answer different actions are performed:
a variable of type detector_driver named driver used to initialize the analysis and process rawevents
eventlist is a vector of pointers (the *) to different "evt" objects. The "evt" objects themselves are created in the function ReadBuffData (in file ReadBuffData.cpp) and a pointer to the object is stored in the vector eventlist.
The first time in a specific module (currently module 2) used for tracking run time.
An iterator for the eventlist. The iterator is used to loop over the eventlist vector.
a vector which contains the description of each channel in the analysis. The description is read in from the map.txt file and includes the module and channel number, the detector type and subtype, the damm spectrum number, the detectors physical location and an integer that is currently not used
The variable mode is passed to the process_events function and defines the current operating mode of the file. For a scan and damm analysis this is set to "scan". For offline analysis only with root files (still to be implemented) the mode is set to "standaloneroot".
The number of modules used in the map.txt file. If during event processing a module is encountered with a number above this varaible the program terminates and exits.
The number of times an unpacked buffer is sorted
variables r1,r2 used to retrieve run time information to check speed of algorithms. The use of these variables and associated function calls are system dependent so are commented out until someone needs them
Array of random numbers used in other routines
rawev will contain event information, the information is filled in the function Scan_List (in this file) and is passed to the function process_events (in the detector_driver file)
Troubleshooting variable to stop program execution after a certain number of events, to be removed in a final version
|struct tms t u|
Structures and variables used to print the current running time of the analysis