CFEL - ASG Software Suite  2.5.0
CASS
Classes | Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
cass::SACLAConverter Class Reference

Class for reading SACLA data. More...

#include <sacla_converter.h>

+ Collaboration diagram for cass::SACLAConverter:

Classes

struct  detParams
 detector consists of tiles More...
 
struct  detTileParams
 non changeing parameters of a pixel detector tile More...
 
struct  MachineValue
 container for the cached machine value More...
 

Public Types

typedef std::vector< detParamspixDets_t
 define the pixel detectors container type More...
 

Public Member Functions

 SACLAConverter ()
 constructor More...
 
uint64_t operator() (const int highTagNbr, const int tagNbr, CASSEvent &event)
 read data from SaclaDataAccessUserAPI More...
 
void loadSettings ()
 load the settings of the reader More...
 
void cacheParameters (std::vector< int >::const_iterator first, std::vector< int >::const_iterator last, int blNbr, int runNbr, int highTagNbr)
 retrieve requested beamline parameters in one go More...
 

Private Types

typedef std::vector< MachineValuemachineVals_t
 define the machine values More...
 

Private Attributes

machineVals_t _machineVals
 the list of requested machine values More...
 
pixDets_t _pixelDetectors
 the list of requested machine values More...
 
pixDets_t _octalDetectors
 the list of requested octal detectors More...
 

Detailed Description

Class for reading SACLA data.

This class will interface the API provided by SACLA to retrieve the available data. One can use it to retrieve data from the Database, Octal Detector and other detectors.

The additional data of the MPCCD, such as the position, angle, gain, width and height will be written in to the BeamlineData and can be retrieved for each tile using the tilename:

User definable Parameters:

SACLAConverter/{RetrieveAcceleratorData}
Flag that tells whether the accelerator data should be retrieved. Default is true. When set to true the following data is available in the Machine Data:

  • "Acc_electronEnergy_eV"
  • "Acc_KParams"
  • "Acc_PhotonEnergy"

SACLAConverter/OctalPixelDetectors/{size}
The number of octal MPCCD detectors one wants to retrieve. Be sure that for each detector there is a unique id in the list below.

SACLAConverter/OctalPixelDetectors/%index%/{DetectorName}
The base name of the octal MPCCD. Unlike the API this name will be used to determine the names of the individual tiles of the MPCCD. Default is "Invalid" which will caus to skip this index.

SACLAConverter/OctalPixelDetectors/%index%/{CASSID}
The id of the detector that CASS will use internally. Default is "0".

SACLAConverter/OctalPixelDetectors/%index%/{NormalizeToAbsGain}
Using this option one can control whether the pixel values of the individual tiles will be normalized to the gain value of the first tile. When true, the pixel values of tiles 2 to 8 will modified using: $ pixval_{tile} = \frac{gain_{tile}}{gain_{tile1}}*pixval_{tile}$ Default is true.

SACLAConverter/DatabaseValues/{size}
The number of values one wants to retrieve from the database. Be sure that for each detector there is a unique id in the list below.

SACLAConverter/DatabaseValues/%index%/{ValueName}
The name of the database value to retrieve. Default is "Invalid" which will cause to skip that index.

SACLAConverter/DatabaseValues/%index%/{CASSName}
The name of the value that the database value should have within the cassevent. Default is the same name as ValueName

Author
Lutz Foucar

Definition at line 74 of file sacla_converter.h.

Member Typedef Documentation

typedef std::vector<MachineValue> cass::SACLAConverter::machineVals_t
private

define the machine values

Definition at line 129 of file sacla_converter.h.

define the pixel detectors container type

Definition at line 307 of file sacla_converter.h.

Constructor & Destructor Documentation

SACLAConverter::SACLAConverter ( )

constructor

Definition at line 30 of file sacla_converter.cpp.

References cass::Log::add(), cass::Log::INFO, and cass::toString().

Member Function Documentation

void SACLAConverter::cacheParameters ( std::vector< int >::const_iterator  first,
std::vector< int >::const_iterator  last,
int  blNbr,
int  runNbr,
int  highTagNbr 
)

retrieve requested beamline parameters in one go

this is a hack to improve speed, as requesting parameters for each tag individually seems to be a bottleneck

Parameters
firstiterator to the first tag in the list
lastiterator to one beyond the last tag in the list
blNbrthe beamline number for the experiment
runNbrthe run number for the experiment
highTagNbrthe high tagnumber for the tag list

create the tag list from the iterators

for all requested beamline parameters retrieve the values for all tags in one go

create the sacla string buffer to retrieve the data

retrive the data

check if as many parameters as tags given have been returned. In case this number is different, something bad happened

convert the retrieved database values into double numbers and put them into the cache

check if retrieved value can be converted to double, and if so add it to the machine data, otherwise issue an error and add a 0 into the cache for that given tag.

Note
the retrieved values might contain the unit of the value in the string, therefore one has to remove all characters from the string

destroy the sacla string list

output which database value has been cached

for all pixel dets, which consist of only 1 tile, retrieve the non-changing parameters from the first image

for all octal dets retrieve the non changing parameters from the first image

get reference to the current tile

initialize the tiles streamer and buffer

read data from the first tag into the buffer

cache the non-chaneging data

retrieve the additonal information of the tiles of an octal detector

the position in x in the lab space in um

the position in y in the lab space in um

the position in z in the lab space in um

the angle in degrees in the lab space

the gain of the detector tile

if the tiles of the octal detector should be normalized, calculate the relative gain of the individual tiles with respect to the first tile and store the relative gains within the tile

get the total size of the detector

Definition at line 218 of file sacla_converter.cpp.

References cass::Log::add(), cass::SACLAConverter::detTileParams::angle_deg, cass::SACLAConverter::detTileParams::cache(), cass::SACLAConverter::MachineValue::cassName, cass::SACLAConverter::MachineValue::databaseName, cass::Log::ERROR, cass::SACLAConverter::detTileParams::gain, cass::Log::INFO, cass::SACLAConverter::detTileParams::init(), cass::SACLAConverter::detTileParams::name, cass::SACLAConverter::detTileParams::normalize, cass::SACLAConverter::detTileParams::posx_um, cass::SACLAConverter::detTileParams::posy_um, cass::SACLAConverter::detTileParams::posz_um, cass::SACLAConverter::detTileParams::readBuf, cass::SACLAConverter::detTileParams::readFromStreamer(), cass::SACLAConverter::detTileParams::relativeGain, QString::remove(), QString::toDouble(), cass::toString(), cass::SACLAConverter::MachineValue::values, cass::SACLAConverter::detTileParams::xsize, and cass::SACLAConverter::detTileParams::ysize.

Referenced by cass::TagListProcessor::runthis().

void SACLAConverter::loadSettings ( )

load the settings of the reader

set the requested octal detectors

skip if the detector name has not been set

set the requested pixel detectors

skip if the detector name has not been set

set the requested database values

skip if the value name has not been set

retrieve the name that the value should have in the CASSEvent (in case non is given, default it to the machine value name

Definition at line 148 of file sacla_converter.cpp.

References cass::Log::add(), QSettings::beginGroup(), QSettings::beginReadArray(), QSettings::endArray(), QSettings::endGroup(), QString::fromStdString(), cass::Log::INFO, QSettings::setArrayIndex(), size, cass::toString(), and QSettings::value().

Referenced by cass::TagListProcessor::runthis().

uint64_t SACLAConverter::operator() ( const int  highTagNbr,
const int  tagNbr,
CASSEvent event 
)

read data from SaclaDataAccessUserAPI

Returns
size of the filled data in bytes
Parameters
highTagNbrfirst part of the tag
tagNbrthe acutal Tag
eventthe CASSEvent where the data will be put into

set the event id from the highTag and Tag number

get reference to the devices of the cassevent

check if the event contains the machine data container, if so get a reference to it. Otherwise throw an error.

go through all requested machine data events and retrieve the corresponding values for the tag

rerference to the machine value

check if the cache contains the machine value for the requested tag

retrieve the container for pixel detectors

read the requested pixel detector data

skip if the detector data isn't loaded

retrieve the right detector from the cassevent and prepare the frame

get information about the tile and the position with the frame

retrieve the data with the right type

notice how much data has been retrieved

read the requested octal detectors

skip if the data of the detector isn't loaded

retrieve the right detector from the cassevent and reset it

copty the parameters of the tiles to the beamline data

retrive the data of the tiles Using openmp to parallelize the retrieval of the detector data. The 'pragma omp parallel for' statement says that the for loop should be parallelized. Within the loop all the declared variables are local to the thread and not shared. The 'num_threads' parameter allows to define how many threads should be used. Since the octal detector has 8 tiles, we only need 8 threads and not all that are available (which will be used if nothing is declared).

retrieve the data with the right type

gather the size retrieved of all the tiles

Definition at line 448 of file sacla_converter.cpp.

References cass::Log::add(), cass::SACLAConverter::detTileParams::angle_deg, cass::MachineData::Device::BeamlineData(), cass::SACLAConverter::detTileParams::bytes_retrieved, cass::SACLAConverter::MachineValue::cassName, cass::SACLAConverter::detTileParams::copyTo(), cass::SACLAConverter::MachineValue::databaseName, cass::pixeldetector::Device::dets(), cass::CASSEvent::devices(), cass::Log::ERROR, cass::pixeldetector::Detector::frame(), cass::SACLAConverter::detTileParams::gain, cass::CASSEvent::MachineData, cass::SACLAConverter::detTileParams::name, cass::SACLAConverter::detTileParams::nPixels, cass::CASSEvent::PixelDetectors, cass::SACLAConverter::detTileParams::pixsizex_um, cass::SACLAConverter::detTileParams::pixsizey_um, cass::SACLAConverter::detTileParams::posx_um, cass::SACLAConverter::detTileParams::posy_um, cass::SACLAConverter::detTileParams::posz_um, cass::SACLAConverter::detTileParams::readFromStreamer(), cass::SACLAConverter::detTileParams::relativeGain, cass::toString(), cass::SACLAConverter::MachineValue::values, cass::SACLAConverter::detTileParams::xsize, and cass::SACLAConverter::detTileParams::ysize.

Member Data Documentation

machineVals_t cass::SACLAConverter::_machineVals
private

the list of requested machine values

Definition at line 132 of file sacla_converter.h.

pixDets_t cass::SACLAConverter::_octalDetectors
private

the list of requested octal detectors

Definition at line 314 of file sacla_converter.h.

pixDets_t cass::SACLAConverter::_pixelDetectors
private

the list of requested machine values

Definition at line 311 of file sacla_converter.h.


The documentation for this class was generated from the following files: