|
|
Users's Guide
|
|
|
============
|
|
|
|
|
|
Introduction
|
|
|
------------
|
|
|
|
|
|
The User's Guide provides essential information on how to use the library.
|
|
|
To access the library API you should include:
|
|
|
|
|
|
#include <lstdpp128/lstdpp.h>
|
|
|
|
|
|
Open a File
|
|
|
-----------
|
|
|
|
|
|
First of all, you have to open a file.
|
|
|
|
|
|
// The classes are defined in the namespace lstdpp128.
|
|
|
using namespace lstdpp128;
|
|
|
|
|
|
// Initialize a reader with a buffer of size 1024.
|
|
|
Reader reader(1024);
|
|
|
|
|
|
// Open the file.
|
|
|
bool success = reader.open(fileName);
|
|
|
|
|
|
// Exit in case of error.
|
|
|
if (!success) {
|
|
|
return EXIT_FAILURE;
|
|
|
}
|
|
|
|
|
|
// Print the list mode context.
|
|
|
cout << listModeContext << endl;
|
|
|
|
|
|
The *listModeContext* object contains the context of the loaded file. It represents the configuration of the electronic cards.
|
|
|
The model is the following:
|
|
|
* The context contains a Crateboard
|
|
|
* A Crateboard contains some Boards
|
|
|
* A Board contains some Channels
|
|
|
|
|
|
The _Board_ structure is:
|
|
|
|
|
|
**Members** | **Type**
|
|
|
------------|---------
|
|
|
eventType | uint16_t
|
|
|
crate | uint8_t
|
|
|
nbChannels | uint16_t
|
|
|
boardType | BoardType
|
|
|
|
|
|
The _BoardType_ type has the following values:
|
|
|
|
|
|
**Constant** | **Value**
|
|
|
-------------|---------
|
|
|
CFD_BOARD_TYPE | 0
|
|
|
V1751_BOARD_TYPE | 1
|
|
|
V1724_BOARD_TYPE | 2
|
|
|
V1730_BOARD_TYPE | 3
|
|
|
|
|
|
The _Crate_ structure is:
|
|
|
|
|
|
**Members** | **Type**
|
|
|
------------|---------
|
|
|
nbBoards | uint16_t
|
|
|
boards | Board*
|
|
|
|
|
|
The _boards_ pointer is the address of the array containing _nbBoards_ _Board_ objects.
|
|
|
|
|
|
The _CrateBoard_ structure is:
|
|
|
|
|
|
**Members** | **Type**
|
|
|
------------|---------
|
|
|
nbCrates | uint16_t
|
|
|
crates | Crate*
|
|
|
|
|
|
The _crates_ pointer is the address of the array containing _nbCrates_ _Crate_ objects.
|
|
|
|
|
|
The global *listModeContext* object of type _ListModeContext_ has the structure:
|
|
|
|
|
|
**Members** | **Type**
|
|
|
------------|---------
|
|
|
version | uint32_t
|
|
|
timeBase | uint32_t
|
|
|
nbEvents | uint32_t
|
|
|
crateBoard | CrateBoard
|
|
|
|
|
|
The _version_ member represents the version of the format of the file. The _timeBase_ is the unit of time of the events. The value 9 means that the time base is 10^-9.
|
|
|
|
|
|
Read and Process the File
|
|
|
-------------------------
|
|
|
|
|
|
There are two methods to read and process a file:
|
|
|
* Use a simple reader event by event
|
|
|
* Use a more advanced processor configured with an algorithm
|
|
|
|
|
|
An example of a simple reader application is provided by [SimpleReader.cpp](../../src/lstdpp128/apps/common/SimpleReader.cpp).
|
|
|
|
|
|
A more advanced strategy is to use a concept of algorithms used through arrays of events.
|
|
|
The advantage is that it is possible to read a block of events, sort them in time and process them.
|
|
|
It can be very interesting for very large files for which the entire sequence of events cannot reside in RAM.
|
|
|
|
|
|
The programmer defines a processor class and can use it by two read strategies (EventArray or EventBlockArray).
|
|
|
An example of such processor and algorithm is provided by:
|
|
|
* Processor [Insert.h](../../src/lstdpp128/Insert.h) [Insert.cpp](../../src/lstdpp128/Insert.cpp)
|
|
|
* Main [IterativeVectorInsert.cpp](../../src/lstdpp128/apps/common/IterativeVectorInsert.cpp)
|
|
|
|
|
|
Fortran Code as Callback to the Reading of an Event
|
|
|
----------------------------------------
|
|
|
|
|
|
It is possible to write Fortran code and access to the library lst-data-process-128 as it is shown in this example:
|
|
|
[lst128fortran.tar](/uploads/324230b5e624d4bbc618999972cd3580/lst128fortran.tar) |