Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
pre-unpacker [2017/06/11 15:46] pereira [Using the Sweeper Pre-unpacker] |
pre-unpacker [2017/06/26 13:24] (current) pereira [Substructure fpic] |
| |
| |
* The function ''unpack'', establishes the communication between the parsing and unpacking stages described above. This function receives two pointers, //pBegin// and //pEnd//. As illustrated in the [[Sweeper USB DAQ data format|data diagram]], the former points to the fragment body of the first fragment, whereas the later points to the end of the data stream (ring item) from the Sweeper EVB. | * The function ''unpack'', establishes the communication between the parsing and unpacking stages described above. This function receives two pointers, //pBegin// and //pEnd//. As illustrated in the [[Sweeper USB DAQ data format|data diagram]], the former points to the fragment body of the first fragment, whereas the later points to the end of fragment. |
| |
* The function ''unpack'' passes the pointers //pBegin// and //pEnd// to the CSweeperParser function ''parse''. This function uses the NSCLDAQ class **FragmentIndex** to iterate through the two fragments from the Sweeper EVB. For each fragment, a pointer //pBody// pointing to the body of the ring item encoded in the fragment is created and sent to the CSweeperParser function ''parseData''. | * The function ''unpack'' passes the pointers //pBegin// and //pEnd// to the **CSweeperParser** function ''parse''. This function uses the NSCLDAQ class **FragmentIndex** to iterate through the two fragments from the Sweeper EVB. For each fragment, a pointer //pBody// pointing to the body of the ring item encoded in the fragment is created and sent to the CSweeperParser function ''parseData''. |
| |
* The function ''parseData'' goes through the body data and searches for tags identifying the data from each module (see [[Sweeper USB DAQ data format|data diagram]]). Whenever a tag is found, ''parseData'' sends the pointer //pBody// to a specific function designed to decode data from a given module. As an example, when ''parseData'' finds the tag **0x0DDC**, it will call the function ''DecodeMTDC'' to parse the data from the Mesytec MTDC module containing time information. Once parsed, the time values from different detectors will be contained in a substructure (mtdc) of the structure **ParsedEVB**. | * The function ''parseData'' goes through the body data and searches for tags identifying the data from each module (see [[Sweeper USB DAQ data format|data diagram]]). Whenever a tag is found, ''parseData'' sends the pointer //pBody// to a specific function designed to decode data from a given module. As an example, when ''parseData'' finds the tag **0x0DDC**, it will call the function ''DecodeMTDC'' to parse the data from the Mesytec MTDC module containing time information. Once parsed, the time values from different detectors will be contained in a substructure (mtdc) of the structure **ParsedEVB**. |
| |
===== Using the Sweeper Pre-unpacker ===== | ===== Using the Sweeper Pre-unpacker ===== |
In order to include the Sweeper Pre-unpacker, the user needs to follow a series of steps: | In order to include the Sweeper Pre-unpacker, the user needs to follow a series of steps (for more details, please contact the Sweeper Device Physicist Jorge Pereira ([[pereira@nscl.msu.edu]]) or DAQ expert Ron Fox ([[fox@nscl.msu.edu]]): |
| |
* The analysis-software compiler must include the library **libSweeperUnpacker.so** along with some header files. Their current location (June 2017) is ''/user/sweeper/develop/unpacker/library/src'', for **libSweeperUnpacker.so**, and ''/user/sweeper/develop/unpacker/library/inc'' and ''/user/sweeper/develop/unpacker/library/inc/Sweeper'', for the header files. | * The analysis-software compiler must include the library **libSweeperUnpacker.so** along with some header files. Their current location (June 2017) is ''/user/sweeper/develop/unpacker/library/src'', for **libSweeperUnpacker.so**, and ''/user/sweeper/develop/unpacker/library/inc'' and ''/user/sweeper/develop/unpacker/library/inc/Sweeper'', for the header files. |
* In order to use the Sweeper ''unpack'' function and the structure **SweeperEvent**, the analysis code must include the header files **Sweeper.h** and **SweeperEvent.h**. | * In order to use the Sweeper ''unpack'' function and the structure **SweeperEvent**, the analysis code must include the header files **Sweeper.h** and **SweeperEvent.h**. |
| |
* As described above, the user needs to provide two pointers (//pBegin// and //pEnd//) to the function ''unpack''. //pBegin// points to the fragment body of the first fragment, and //pEnd// points to the end of the data stream (ring item) from the Sweeper EVB. The function ''unpack'' will return a **SweeperEvent** structure containing all the unpacked information needed for the analysis. | * As described above, the user needs to provide two pointers (//pBegin// and //pEnd//) to the function ''unpack''. //pBegin// points to the fragment body of the first fragment, and //pEnd// points to the end of the fragment. The function ''unpack'' will return a **SweeperEvent** structure containing all the unpacked information needed for the analysis. The example below shows how to use the Sweeper Pre-unpacker in SpecTcl. The processor **CSweeperMapper** was created to call the Pre-unpacker function ''Sweeper::unpack''. This function returns the SweeperEvent-type structure **event** which contains all the detector-related substructures needed by the user. |
| |
| |
| |
<code cpp> | <code cpp> |
| #include <Sweeper.h> |
| #include <SweeperEvent.h> |
| |
Bool_tCSweeperMapper::operator()(const Address_t pEvent, | #include <Event.h> |
| #include <EventProcessor.h> |
| #include <TCLAnalyzer.h> |
| #include <Globals.h> |
| |
| Bool_t |
| CSweeperMapper::operator()(const Address_t pEvent, |
CEvent& rEvent, | CEvent& rEvent, |
CAnalyzer& rAnalyzer, | CAnalyzer& rAnalyzer, |
UShort_t *pBegin = (UShort_t*)pEvent; //pBegin points to the fragment payload (fragment body) of the first fragment | UShort_t *pBegin = (UShort_t*)pEvent; //pBegin points to the fragment payload (fragment body) of the first fragment |
UShort_t tWords = *p++; // Here I take the (self-inclusive) payload size | UShort_t tWords = *p++; // Here I take the (self-inclusive) payload size |
UShort_t *pEnd = pBegin + tWords; // pEnd points to the end of the complete ring item | UShort_t *pEnd = pBegin + tWords; // pEnd points to the end of the fragment |
| |
// At least one member of the pipeline must tell the analyzer how | // At least one member of the pipeline must tell the analyzer how |
| |
| |
* | In the above example, all the unpacked data are encoded in the structure **event** (type **SweeperEvent**). Thus, all that the user needs to do is to handle the variables (organized in sub-structures) provided in the **event** structure. The list of **SweeperEvent** sub-structures and corresponding variables are described below: |
* and //pEnd//) poi | |
| |
//pBegin// and //pEnd//. As illustrated in the [[Sweeper USB DAQ data format|data diagram]], the former points to the fragment body of the first fragment, whereas the later points to the end of the data stream (ring item) from the Sweeper EVB. | |
| |
| |
| |
* the beginning of every analysis software code, there is a part where a pointer pointing to the beginning of the data stream is received. The user | |
| |
| |
| |
For more details about how to include the Sweeper Pre-unpacker and use the C++ structure **SweeperEvent**, please contact Jorge Pereira ([[pereira@nscl.msu.edu]], ext. 428). Once, the Pre-unpacker is included in the analysis software, the user needs to handle the variables provided in the **SweeperEvent** structure. | |
| |
| |
The **SweeperEvent** structure, includes a list of variables organized in sub-structures. These substructures and variables are described below: | |
| |
==== Substructure fpic ==== | ==== Substructure fpic ==== |
This substructure contains information about the focal-plane ion chamber | This substructure contains information about the focal-plane ion chamber |
* **fpic.hasdata** (bool): logic variable which is TRUE when the structure contains valid data | * **fpic.hasdata** (bool): logic variable which is TRUE when the structure contains valid data |
* **fpsci.raw[0-15]** (uint16_t): energy array (Phillips 7164 ADC module) from each of the 16 detector pads | * **fpic.raw[0-15]** (uint16_t): energy array (Phillips 7164 ADC module) from each of the 16 detector pads |
| |
| |
| |
* **mtdc.hasdata** (bool): logic variable which is TRUE when the structure contains valid data | * **mtdc.hasdata** (bool): logic variable which is TRUE when the structure contains valid data |
* **hits.data[0-31]** (uint16_t): array with number of "hits" for each channel | * **hits[0-31]** (uint16_t): array with number of "hits" for each channel |
* **hits.raw[0-31]** (uint16_t): array with time of first hit of each channel | * **raw[0-31]** (uint16_t): array with time of first hit of each channel |
* **hits.data[0-31][maximum number-of-hits=31]** (uint16_t): array with times for each hit and channel | * **data[0-31][maximum number-of-hits=31]** (uint16_t): array with times for each hit and channel |
| |
| |