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

Helper for Advanced Pixel Detector related Postprocessors. More...

#include <pixel_detector_helper.h>

+ Collaboration diagram for cass::pixeldetector::DetectorHelper:

Public Types

typedef std::tr1::shared_ptr< DetectorHelpershared_pointer
 typedef a shared pointer of this More...
 
typedef std::map< std::string, shared_pointerinstancesmap_t
 typedef describing the instances of the helper More...
 
typedef std::tr1::shared_ptr< AdvancedDetectorAdvDet_sptr
 define a shared pointer of the item to manage More...
 
typedef CASSEvent::id_t id_type
 define the type of the id used More...
 
typedef std::pair< id_type, AdvDet_sptrKeyDetPair_t
 defining a key - value pair for the list More...
 
typedef std::vector< KeyDetPair_tdetectorList_t
 typedef defining the list of detectors for more readable code More...
 
typedef detectorList_t::iterator iter_type
 define an iterator for the list More...
 

Public Member Functions

AdvDet_sptr detector (const CASSEvent &evt)
 retrieve detector for event More...
 
void loadSettings (size_t i=0)
 load the settings of the detectors in the detector list More...
 

Static Public Member Functions

static shared_pointer instance (const instancesmap_t::key_type &detector)
 static function creating instance of this. More...
 
static void releaseDetector (const id_type &id)
 release the detector of all helpers that is blocked for the event More...
 

Protected Attributes

detectorList_t _detectorList
 list of pairs of id-detectors. More...
 

Private Member Functions

 DetectorHelper ()
 prevent people from constructin other than using instance(). More...
 
 DetectorHelper (const instancesmap_t::key_type &detname)
 private constructor. More...
 
 DetectorHelper (const DetectorHelper &)
 prevent copy-construction More...
 
DetectorHelperoperator= (const DetectorHelper &)
 prevent assingment More...
 
iter_type findId (const id_type &id)
 find an element with a given id in the list More...
 
void release (const id_type &id)
 release the detector element in the list by settings its key (eventid) back to 0 More...
 

Private Attributes

QMutex _helperMutex
 Mutex for each helper. More...
 
iter_type _lastEntry
 the iterator to the last element returned More...
 

Static Private Attributes

static instancesmap_t _instances
 the helperclass instances. More...
 
static QMutex _mutex
 Singleton Mutex to lock write operations. More...
 

Detailed Description

Helper for Advanced Pixel Detector related Postprocessors.

This class will look whether a AdvancedDetector with the name does already exist. If not it will create it and put it in list so that one event is always associated with one AdvancedDetector.

User definable Parameters:
PixelDetectors/{Name}
Name of the Pixeldetector. See cass::pixeldetector::AdvancedDetector for more information.
Author
Lutz Foucar

Definition at line 45 of file pixel_detector_helper.h.

Member Typedef Documentation

define a shared pointer of the item to manage

Definition at line 55 of file pixel_detector_helper.h.

typedef defining the list of detectors for more readable code

Definition at line 64 of file pixel_detector_helper.h.

define the type of the id used

Definition at line 58 of file pixel_detector_helper.h.

typedef describing the instances of the helper

Definition at line 52 of file pixel_detector_helper.h.

typedef detectorList_t::iterator cass::pixeldetector::DetectorHelper::iter_type

define an iterator for the list

Definition at line 67 of file pixel_detector_helper.h.

defining a key - value pair for the list

Definition at line 61 of file pixel_detector_helper.h.

typedef a shared pointer of this

Definition at line 49 of file pixel_detector_helper.h.

Constructor & Destructor Documentation

cass::pixeldetector::DetectorHelper::DetectorHelper ( )
inlineprivate

prevent people from constructin other than using instance().

Definition at line 127 of file pixel_detector_helper.h.

DetectorHelper::DetectorHelper ( const instancesmap_t::key_type &  detname)
private

private constructor.

Creates the list of detectors. The detectors are of the user chosen type. The type can be chosen by the user via the .cass ini setting dettype. The instance of the detectors are created by DetectorBackend::instance()
The name of the detector is also the key in the instances map.

Parameters
detnamethe name of the detector

Definition at line 48 of file pixel_detector_helper.cpp.

References cass::Log::add(), cass::NbrOfWorkers, and cass::Log::VERBOSEINFO.

cass::pixeldetector::DetectorHelper::DetectorHelper ( const DetectorHelper )
private

prevent copy-construction

Member Function Documentation

DetectorHelper::AdvDet_sptr DetectorHelper::detector ( const CASSEvent evt)

retrieve detector for event

This function will lock, so that it can be consecutivly called by different threads.
Check if the event is already associated with one of the detectors in the detector list. If so just return the pointer to the detector that is associated with this event.
If not then take the detector of the last element in the _detectorList and call its associate() member with this event. Then create a new element to be put into the _detectorList, where the key of the element is the id of the event and the value is the pointer to the detector, that we associated with this event. Put the newly created element in the beginning of the _detectorList and erase the last element.

Returns
pointer to the detector that contains the data related to the requested event
Parameters
evtthe event whos data we need to relate to the detector.

Definition at line 72 of file pixel_detector_helper.cpp.

References cass::CASSEvent::id().

DetectorHelper::iter_type DetectorHelper::findId ( const id_type id)
private

find an element with a given id in the list

Returns
iterator to the found element
Parameters
idthe id of the element

Definition at line 57 of file pixel_detector_helper.cpp.

DetectorHelper::shared_pointer DetectorHelper::instance ( const instancesmap_t::key_type &  detector)
static

static function creating instance of this.

return the instance of the helper that is managing the detector. If the helper is not yet inside the _instances map the helper instance will be created and put into the _instances map.

Returns
instance of the helper manaing the detector
Parameters
detectorkey (name) of the detector to find it in the _instances map

Definition at line 29 of file pixel_detector_helper.cpp.

References cass::Log::add(), detector, and cass::Log::VERBOSEINFO.

void DetectorHelper::loadSettings ( size_t  i = 0)

load the settings of the detectors in the detector list

go through the list of detectors and tell each of the detector to load its settings.

Parameters
iunused parameter

Definition at line 91 of file pixel_detector_helper.cpp.

References QSettings::beginGroup(), and QSettings::endGroup().

DetectorHelper& cass::pixeldetector::DetectorHelper::operator= ( const DetectorHelper )
private

prevent assingment

void DetectorHelper::release ( const id_type id)
private

release the detector element in the list by settings its key (eventid) back to 0

Parameters
idthe detector event id that should be released

Definition at line 64 of file pixel_detector_helper.cpp.

void DetectorHelper::releaseDetector ( const id_type id)
static

release the detector of all helpers that is blocked for the event

Parameters
idthe eventid that is assinged for the detector

Definition at line 41 of file pixel_detector_helper.cpp.

Referenced by cass::ProcessorManager::operator()().

Member Data Documentation

detectorList_t cass::pixeldetector::DetectorHelper::_detectorList
protected

list of pairs of id-detectors.

Note
Needs to be at least the size of workers that can possibly call this helper simultaniously, but should be shrinked if it gets much bigger than the number of workers.

Definition at line 123 of file pixel_detector_helper.h.

QMutex cass::pixeldetector::DetectorHelper::_helperMutex
private

Mutex for each helper.

Definition at line 172 of file pixel_detector_helper.h.

DetectorHelper::instancesmap_t DetectorHelper::_instances
staticprivate

the helperclass instances.

the instances of this class put into map one instance for each available detector

Definition at line 166 of file pixel_detector_helper.h.

iter_type cass::pixeldetector::DetectorHelper::_lastEntry
private

the iterator to the last element returned

Definition at line 175 of file pixel_detector_helper.h.

QMutex DetectorHelper::_mutex
staticprivate

Singleton Mutex to lock write operations.

Definition at line 169 of file pixel_detector_helper.h.


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