CFEL - ASG Software Suite
2.5.0
CASS
|
Helper for Advanced Pixel Detector related Postprocessors. More...
#include <pixel_detector_helper.h>
Public Types | |
typedef std::tr1::shared_ptr< DetectorHelper > | shared_pointer |
typedef a shared pointer of this More... | |
typedef std::map< std::string, shared_pointer > | instancesmap_t |
typedef describing the instances of the helper More... | |
typedef std::tr1::shared_ptr< AdvancedDetector > | AdvDet_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_sptr > | KeyDetPair_t |
defining a key - value pair for the list More... | |
typedef std::vector< KeyDetPair_t > | detectorList_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... | |
DetectorHelper & | operator= (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... | |
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.
Definition at line 45 of file pixel_detector_helper.h.
typedef std::tr1::shared_ptr<AdvancedDetector> cass::pixeldetector::DetectorHelper::AdvDet_sptr |
define a shared pointer of the item to manage
Definition at line 55 of file pixel_detector_helper.h.
typedef std::vector<KeyDetPair_t> cass::pixeldetector::DetectorHelper::detectorList_t |
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 std::map<std::string,shared_pointer> cass::pixeldetector::DetectorHelper::instancesmap_t |
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.
typedef std::pair<id_type,AdvDet_sptr> cass::pixeldetector::DetectorHelper::KeyDetPair_t |
defining a key - value pair for the list
Definition at line 61 of file pixel_detector_helper.h.
typedef std::tr1::shared_ptr<DetectorHelper> cass::pixeldetector::DetectorHelper::shared_pointer |
typedef a shared pointer of this
Definition at line 49 of file pixel_detector_helper.h.
|
inlineprivate |
prevent people from constructin other than using instance().
Definition at line 127 of file pixel_detector_helper.h.
|
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.
detname | the name of the detector |
Definition at line 48 of file pixel_detector_helper.cpp.
References cass::Log::add(), cass::NbrOfWorkers, and cass::Log::VERBOSEINFO.
|
private |
prevent copy-construction
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.
evt | the event whos data we need to relate to the detector. |
Definition at line 72 of file pixel_detector_helper.cpp.
References cass::CASSEvent::id().
|
private |
find an element with a given id in the list
id | the id of the element |
Definition at line 57 of file pixel_detector_helper.cpp.
|
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.
detector | key (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.
i | unused parameter |
Definition at line 91 of file pixel_detector_helper.cpp.
References QSettings::beginGroup(), and QSettings::endGroup().
|
private |
prevent assingment
|
private |
release the detector element in the list by settings its key (eventid) back to 0
id | the detector event id that should be released |
Definition at line 64 of file pixel_detector_helper.cpp.
|
static |
release the detector of all helpers that is blocked for the event
id | the eventid that is assinged for the detector |
Definition at line 41 of file pixel_detector_helper.cpp.
Referenced by cass::ProcessorManager::operator()().
|
protected |
list of pairs of id-detectors.
Definition at line 123 of file pixel_detector_helper.h.
|
private |
Mutex for each helper.
Definition at line 172 of file pixel_detector_helper.h.
|
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.
|
private |
the iterator to the last element returned
Definition at line 175 of file pixel_detector_helper.h.
|
staticprivate |
Singleton Mutex to lock write operations.
Definition at line 169 of file pixel_detector_helper.h.