CFEL - ASG Software Suite
2.5.0
CASS
|
Converter for pnCCD, CsPad and commercial CCD Data. More...
#include <lcls_converter.h>
Public Member Functions | |
void | operator() (const Pds::Xtc *xtc, cass::CASSEvent *evt) |
operator to convert the LCLS Data to CASSEvent More... | |
![]() | |
virtual | ~ConversionBackend () |
virtual destructor to make clear this is a base class More... | |
virtual void | prepare (cass::CASSEvent *) |
prepare the cassevent More... | |
virtual void | finalize (cass::CASSEvent *) |
finalize the event More... | |
const pdstypelist_t & | pdsTypeList () const |
return the list of pds type ids the converter is responsible for More... | |
Static Public Member Functions | |
static ConversionBackend::shared_pointer | instance () |
create singleton if doesnt exist already More... | |
![]() | |
static shared_pointer | instance (const std::string &type) |
return the requested converter type More... | |
Private Types | |
typedef std::map< lclsid::Key, int32_t > | idmap_t |
map that will map the LCLS key to the CASS key More... | |
typedef std::pair< uint32_t, std::vector< uint8_t > > | config_t |
pair the typeid of the config with a shared pointer of the config More... | |
typedef std::map< int32_t, config_t > | configStore_t |
map containing the detector id together with its configuration More... | |
Private Member Functions | |
Converter () | |
constructor More... | |
Converter (const Converter &) | |
prevent copy construction More... | |
Converter & | operator= (const Converter &) |
prevent assignment More... | |
Private Attributes | |
idmap_t | _LCLSToCASSId |
map lcls id to cass id More... | |
configStore_t | _configStore |
store for the configurations. More... | |
Static Private Attributes | |
static ConversionBackend::shared_pointer | _instance |
the singleton container More... | |
static QMutex | _mutex |
singleton locker for mutithreaded requests More... | |
Additional Inherited Members | |
![]() | |
typedef std::tr1::shared_ptr< ConversionBackend > | shared_pointer |
typedef More... | |
typedef std::list< Pds::TypeId::Type > | pdstypelist_t |
typedef More... | |
![]() | |
pdstypelist_t | _pdsTypeList |
the list of pds types that the converter is responsible for More... | |
Converter for pnCCD, CsPad and commercial CCD Data.
Converter/LCLSPixelDetectors/{size}
Number of user defined detectors to be pulled out of the xtc
Converter/LCLSPixelDetectors/%id%/{TypeName}
The type of the detector. Only the following types are supported:
Converter/LCLSPixelDetectors/%id%/{DetectorName}
Name of the detector. Default is invalid
Converter/LCLSPixelDetectors/%id%/{DetectorID}
the id of the detector. Default is 0.
Converter/LCLSPixelDetectors/%id%/{DeviceName}
Name of the detector device
Converter/LCLSPixelDetectors/%id%/{DeviceID}
Id of the detector device
Converter/LCLSPixelDetectors/%id%/{CASSID}
the Id the detector should get in the CASSEvent. One needs this number for further processing. Note that the config and the data part must have the same CASSID.
see Converter::operator() for details about the functionality
Definition at line 66 of file lcls_converter.h.
|
private |
pair the typeid of the config with a shared pointer of the config
Definition at line 196 of file lcls_converter.h.
|
private |
map containing the detector id together with its configuration
Definition at line 199 of file lcls_converter.h.
|
private |
map that will map the LCLS key to the CASS key
Definition at line 193 of file lcls_converter.h.
|
private |
constructor
set up the pds type ids that it is responsible for and creates the map that maps the lcls id to the cass key.
skip if the either name has not been set or not correctly set
Definition at line 299 of file lcls_converter.cpp.
References QSettings::beginGroup(), QSettings::beginReadArray(), Detector, QSettings::endArray(), QSettings::setArrayIndex(), size, and QSettings::value().
|
private |
prevent copy construction
|
static |
create singleton if doesnt exist already
Definition at line 287 of file lcls_converter.cpp.
|
virtual |
operator to convert the LCLS Data to CASSEvent
retrieve the corresponding CASS key from the lcls xtc that are contained in the TypeId and Src (DetInfo) parts of the Xtc. Use the_LCLSToCASSId to do this.
in case that xtc is a Id_pnCCDconfig:
extract the version and create a config object toghether with this. Then copy the information from the xtc config to the config object. Then store the config object in the _pnccdConfigStore map.
in case that xtc is a Id_pnCCDframe:
the conversion will only be performed if there is an config present for the data. The config of version 1 does not contain information about the frame size, therefore one needs to set it manually. In version 2 these values are present, but sometimes there is a problem and one gets wrong data. To prevent this, a check for consistency is implemented that will output the wrong values and set them to the default values.
The frame data of the pnccd is subdived into 4 segments in the lcls data format and one is provided with pointers to the beginning of the segments. The data of the segments is put into a linearised array. The frame looks as follows in the lab (when viwing into the beam)
----------- | | 2 | 3 | ^ | | D | B | | | -----O----- | | | 1 | 0 | | v | C | A | | -----------
Here the numbers indicate the segment number in the lcls data. The data alignmet of the array is indicated with the arrows. This means that the slow increasing axis for segments 0 and 3 is going to the left and for segments 1 and 2 to the right. In order to read the segments fast, it is decided that one should read the segments data of segment 0 and 3 first and then 1 and 2, with the fast increasing axis being upward. This effectively rotates the frame in the cass representation 90 degress clockwise with respect to the lab. The resulting segments in CASS are therefore given in letters.
To copy one now has to copy the first row of segment 0 (A in CASS coordinates) then copy the the first row of segment 3 (B in CASS coordinates). Then one copies 2nd row of segment 0 and 2nd row of segment 3. This keeps going until one has copied all rows of segment 0 and 3. Then one needs to copy the data from segment 1 reversely, meaning that one copies the last row in reverse direction. After that one does the same with segment 2. Then one reversly copies the 2nd to last row of segment 1 and the 2nd to last row of segment 2. This is done until all the data has been copied.
This gives to following assignment from lcls segments to CASS coordinates: LCLS segment -> CASS Tiles
0 -> A
3 -> B
1 (reverse) -> C
2 (reverse) -> D
If one wants to see the fram as it is oriented in the lab one has to rotate the data by 90 degrees counterclockwise. There is a processor that can do this.
While copying the data one has to ignore the upper two bits of the data.
in case that xtc is a Id_Frame:
the frame data of the lcls is just copied to the detectors frame. The alignment is already like it is within CASS as a linearised array of pixels with x being the fast increasing axis. One has to substract the offset from all pixels, which is done during the copying. The first 8 pixels of the frame contain status information and are therefore set to the same value that the ninth pixel has.
in case that xtc is a CsPad:
the data is layed out in the xtc in quadrants. Each quadrant contains 8 segments, which results in a total sum of 32 segments. The 8 segments of each quadrant are stored in a linearized array where the fast changing axis is along the x-axis. Each segment consits of 2*194 pixels along the x axis and 185 pixels along the y axis. The data is copied into a linearized array where the segments of each quadrant are aligned on top of each other like follows:
\ +-------------+ | | 31 | | +-------------+ | | 30 | } quadrant 3 +-------------+ | | 29 | | +-------------+ | . . . . . . +-------------+ | | 02 | | +-------------+ | ^ | 01 | } quadrant 0 | +-------------+ | y | 00 | | | +-------------+ | +---x---> /
in case that xtc is a CsPad2x2:\n the data from a CsPad2x2 is almost the same as from a regular CsPad, but much easier. The data consists of one block with a Header (same as CsPad) followed by a sequence of pairs. The first of the pair belongs to the first segement and the second to the second segment. In CASS they will be aligned like to segements of the cspad on top of each other:
+-------------+ ^ | second | | +-------------+ y | first | | +-------------+ +---x--->
@param xtc the part of the datagram that this converter is responsible for @param evt The CASSEvent that should store the information from the xtc.
skip if there is no corresponding cass key for that xtc
get the epix element from the xtc
get the corrsponding config for the epix element
get the configuration for this element and return when there is no config
Reimplemented from cass::ConversionBackend.
Definition at line 363 of file lcls_converter.cpp.
References cass::Log::add(), cass::pixeldetector::Detector::columns(), cass::pixeldetector::copyCsPadFrame(), cass::pixeldetector::copyEpixFrame(), cass::pixeldetector::copyPnCCDFrame(), data, cass::Log::DEBUG0, cass::Log::DEBUG4, cass::Log::ERROR, cass::pixeldetector::extractPayload(), cass::pixeldetector::Detector::frame(), cass::CASSEvent::id(), cass::pixeldetector::Detector::id(), cass::Log::INFO, cass::pixeldetector::retrieveDet(), cass::pixeldetector::Detector::rows(), and cass::toString().
prevent assignment
|
private |
store for the configurations.
Will store the version and the configuration itself in a pair and has the casskey as key.
Definition at line 228 of file lcls_converter.h.
|
staticprivate |
the singleton container
Definition at line 215 of file lcls_converter.h.
|
private |
map lcls id to cass id
Definition at line 221 of file lcls_converter.h.
|
staticprivate |
singleton locker for mutithreaded requests
Definition at line 218 of file lcls_converter.h.