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

Converter for Beamline-, Cavity-, Epics- and EVR Data. More...

#include <machine_converter.h>

+ Inheritance diagram for cass::MachineData::Converter:
+ Collaboration diagram for cass::MachineData::Converter:

Public Member Functions

void operator() (const Pds::Xtc *xtc, cass::CASSEvent *evt)
 called for appropriate xtc part. More...
 
void prepare (CASSEvent *evt)
 called before the conversion More...
 
void finalize (CASSEvent *evt)
 called at the end of the conversion More...
 
- Public Member Functions inherited from cass::ConversionBackend
virtual ~ConversionBackend ()
 virtual destructor to make clear this is a base class More...
 
const pdstypelist_tpdsTypeList () 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 Public Member Functions inherited from cass::ConversionBackend
static shared_pointer instance (const std::string &type)
 return the requested converter type More...
 

Private Types

typedef std::map< XTCDataKey, std::string > KeyMap_t
 define the conversion map from keys to strings More...
 
typedef std::tr1::function< void(const Pds::EpicsPvHeader &, Device::epicsDataMap_t::iterator, Device::epicsDataMap_t::iterator)> epicsType2val_t
 define the function to convert epics to cass More...
 
typedef std::map< int16_t, epicsType2val_tepicsType2convFunc_t
 define a map to map epics type to function for retrieval of the value More...
 

Private Member Functions

 Converter ()
 constructor More...
 
 Converter (const Converter &)
 prevent copy construction More...
 
Converteroperator= (const Converter &)
 prevent assignment More...
 

Private Attributes

KeyMap_t _index2name
 map Epics Keys to strings More...
 
epicsType2convFunc_t _epicsType2convFunc
 map containing fucntions that convert epics values to cass values More...
 
Device _store
 a container for the epics values 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

- Public Types inherited from cass::ConversionBackend
typedef std::tr1::shared_ptr< ConversionBackendshared_pointer
 typedef More...
 
typedef std::list< Pds::TypeId::Type > pdstypelist_t
 typedef More...
 
- Protected Attributes inherited from cass::ConversionBackend
pdstypelist_t _pdsTypeList
 the list of pds types that the converter is responsible for More...
 

Detailed Description

Converter for Beamline-, Cavity-, Epics- and EVR Data.

Will convert Beamline data, Cavity data, Epics Data and EVR Data

Note
maybe split this to several converters for the different data types will this work. ie is only the epics map copied or the whole event?
Author
Lutz Foucar

Definition at line 45 of file machine_converter.h.

Member Typedef Documentation

define a map to map epics type to function for retrieval of the value

Definition at line 103 of file machine_converter.h.

typedef std::tr1::function<void(const Pds::EpicsPvHeader&, Device::epicsDataMap_t::iterator, Device::epicsDataMap_t::iterator)> cass::MachineData::Converter::epicsType2val_t
private

define the function to convert epics to cass

Definition at line 100 of file machine_converter.h.

define the conversion map from keys to strings

Definition at line 92 of file machine_converter.h.

Constructor & Destructor Documentation

Converter::Converter ( )
private

constructor

sets up the pds types that it is responsible for

Definition at line 163 of file machine_converter.cpp.

References cass::MachineData::epicsValToNothing().

cass::MachineData::Converter::Converter ( const Converter )
private

prevent copy construction

Member Function Documentation

void Converter::finalize ( CASSEvent evt)
virtual

called at the end of the conversion

Parameters
evtpointer to the event that needs to be finalized

Reimplemented from cass::ConversionBackend.

Definition at line 719 of file machine_converter.cpp.

cass::ConversionBackend::shared_pointer Converter::instance ( )
static

create singleton if doesnt exist already

Definition at line 39 of file machine_converter.cpp.

void cass::MachineData::Converter::operator() ( const Pds::Xtc *  xtc,
cass::CASSEvent evt 
)
virtual

called for appropriate xtc part.

Parameters
xtcthe xtc that contains evr, epics, beamlinedata info
evtpointer to the event that we will write the data to.

BldDataEBeamV7 is the same as BldDataEBeamV6. A sign-error error was discovered in the calculation of the photon energy that goes into the ebeam bld. This is fixed on the accelerator side, but we will increment the ebeam bld version number to V7 so the data is clearly marked as changed.

need to lock this operation as it involves the store used by all

get the epics header and the epics id for this epics variable

cntrl is a configuration type and will only be send with a configure transition

create a key for the epics list and index. If this is an additional list, prepend the detInfo to the epics variable name

now we need to create the map which we will fill later with real values if this epics variable is an array we want an entry in the map for each entry in the array

go through all entries of the array create an entry in the map with the the index in brackets and initialize it with 0

otherwise we just add the name to the map and initialze it with 0

time is the actual data, that will be send down the xtc with 1 Hz

now we need to find the variable name in the map, therefore we look up the name in the indexmap

if it is an array go through all entries of the array create an entry in the map with the the index in brackets and initialize it with 0

try to find the the name in the map this returns an iterator to the first entry we found if it was an array we can then use the iterator to the next values

if the name is not in the map, ouput error message

otherwise extract the epicsData and write it into the map

set the variable that the epics store was filled

clear the status bytes of the event code

get the evr data

how many events have happened between the last event and now

go through all events and extract the eventcode from them

check if the array is big enough to hold the recorded eventcode

add variables to store, cassevent and to log

BPM X values (mm)

BPM Y values (mm)

BPM TMIT values (Nel)

Reimplemented from cass::ConversionBackend.

Definition at line 185 of file machine_converter.cpp.

References cass::Log::add(), cass::MachineData::Device::BeamlineData(), data, detector, cass::CASSEvent::devices(), cass::Log::ERROR, cass::MachineData::Device::EvrData(), cass::Log::INFO, info, cass::CASSEvent::MachineData, offset, cass::toString(), cass::Log::VERBOSEINFO, and cass::Log::WARNING.

Converter& cass::MachineData::Converter::operator= ( const Converter )
private

prevent assignment

void Converter::prepare ( cass::CASSEvent evt)
virtual

called before the conversion

Parameters
evtpointer to the event that needs to be finalized

clear the beamline data by setting every value to 0 and reset the filled flag

Note
clearing is needed to be done at this point, because the map will be updated multiple times during the conversion process and therefore clearing it during the conversion will erase variables that have already been set.

copy values in the store to the event

Note
we want to add the addional values that are in the store to the beamline data of the event therefore we should not use the assignment operator here

Reimplemented from cass::ConversionBackend.

Definition at line 686 of file machine_converter.cpp.

References cass::CASSEvent::devices(), cass::MachineData::Device::epicsFilled(), and cass::CASSEvent::MachineData.

Member Data Documentation

epicsType2convFunc_t cass::MachineData::Converter::_epicsType2convFunc
private

map containing fucntions that convert epics values to cass values

Definition at line 106 of file machine_converter.h.

KeyMap_t cass::MachineData::Converter::_index2name
private

map Epics Keys to strings

Definition at line 95 of file machine_converter.h.

cass::ConversionBackend::shared_pointer Converter::_instance
staticprivate

the singleton container

Definition at line 86 of file machine_converter.h.

QMutex Converter::_mutex
staticprivate

singleton locker for mutithreaded requests

Definition at line 89 of file machine_converter.h.

Device cass::MachineData::Converter::_store
private

a container for the epics values

Note
this is necessary, since not every shot there is info about the epics values and calibcycle

Definition at line 113 of file machine_converter.h.


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