CFEL - ASG Software Suite
2.5.0
CASS
|
Data used commonly for one AdvancedDetector. More...
#include <common_data.h>
Public Types | |
typedef std::tr1::shared_ptr< CommonData > | 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::vector< char > | mask_t |
a mask is a vector of bools More... | |
Public Member Functions | |
void | loadSettings (CASSSettings &s) |
load the settings of this common object More... | |
void | generateMaps (const Frame &frame) |
generate the maps from the frame data with help of the functors More... | |
void | createCorMap () |
create the correction map More... | |
void | saveOffsetNoiseMaps () |
save offset and noise maps More... | |
void | saveGainMap () |
save gain map More... | |
void | saveHotPixMask () |
save hot pixel mask More... | |
Static Public Member Functions | |
static shared_pointer | instance (const instancesmap_t::key_type &detector) |
static function creating instance of this. More... | |
static void | controlCalibration (const std::string &command) |
issue a command to the map creators of all instances More... | |
Public Attributes | |
QReadWriteLock | lock |
lock to synchronize read and write acces to the common data More... | |
size_t | columns |
the width of the maps More... | |
size_t | rows |
the height of the maps More... | |
Detector::frame_t | offsetMap |
the offset map More... | |
Detector::frame_t | noiseMap |
the noise map More... | |
mask_t | mask |
the detector mask More... | |
mask_t | hotpixels |
the hotpixel mask More... | |
Detector::frame_t | gain_cteMap |
the gain + cte map More... | |
Detector::frame_t | correctionMap |
the correction map More... | |
int32_t | detectorId |
the id of the detector that contains the frames whos maps we have here More... | |
std::string | detectorname |
the name of the detector whos maps are contained in this class instance More... | |
Private Member Functions | |
CommonData () | |
prevent people from constructing other than using instance(). More... | |
CommonData (const instancesmap_t::key_type &detname) | |
private constructor. More... | |
CommonData (const CommonData &) | |
prevent copy-construction More... | |
CommonData & | operator= (const CommonData &) |
prevent assingment More... | |
Private Attributes | |
std::tr1::shared_ptr< MapCreatorBase > | _offsetnoiseMapcreator |
functor to create the Maps More... | |
std::tr1::function< void(const std::string &, CommonData &)> | _saveNoiseOffsetTo |
function to write the offset maps More... | |
std::string | _outputOffsetFilename |
output filename for the offset and noise maps More... | |
std::string | _inputOffsetFilename |
input filename of the offset and noise map More... | |
bool | _settingsLoaded |
switch to tell that load settins for this common data was already running More... | |
std::tr1::shared_ptr< MapCreatorBase > | _gainCreator |
functor to create the Maps More... | |
std::tr1::function< void(const std::string &, CommonData &)> | _saveGainTo |
function to write the gain map More... | |
std::string | _inputGainFilename |
the gain correction input filename More... | |
std::string | _outputGainFilename |
the gain correction output filename More... | |
std::tr1::function< void(const std::string &, CommonData &)> | _saveHotPixTo |
function to write the hot pixel mask More... | |
std::string | _inputHotPixFilename |
the hot pixel mask input filename More... | |
std::string | _outputHotPixFilename |
the hot pixel mask output filename More... | |
std::pair< Detector::pixel_t, Detector::pixel_t > | _noiseRange |
the range in adu for masking noisy pixels More... | |
bool | _autoNoiseThreshold |
flag whether the noise threshold should be automatically determined More... | |
Detector::pixel_t | _autoMultiplier |
the multiplier about which the automatically determined threshold will be defined More... | |
Static Private Attributes | |
static instancesmap_t | _instances |
the helperclass instances. More... | |
static QMutex | _mutex |
mutex to lock the creation of an instance More... | |
Data used commonly for one AdvancedDetector.
This class hold the data for one AdvancedDetector. There can be multiple instances of the AdvancedDetector which should use only one common data for e.g. offsetmaps. This data is contained in this class. To ensure that one AdvancedDetector will get only one instance the static function CommonData::instance will return only a new instance when the name does not exist yet.
PixelDetectors/%name%/CorrectionMaps/{MapCreatorType}
The type of functor that will create the maps used for correcting the frames from individual frames. See Map-Creators List for a list of all possible values. Default is "none".
PixelDetectors/%name%/CorrectionMaps/{InputOffsetNoiseFilename}
The filename containing the saved noise and offset maps. Default is "darkcal_%detectorId%.lnk". Which is a link to the most recent darkcalibration file. If no file is found, the offset will be set to 0 and the noise will be set to 4000. When the user has chosen a "NoisyPixelThreshold" lower than 4000 this will result in a completly masked frame.
PixelDetectors/%name%/CorrectionMaps/{InputOffsetNoiseFiletype}
The filetype that the values are stored in. Default is "hll". Options are:
PixelDetectors/%name%/CorrectionMaps/{OutputOffsetNoiseFilename}
The filename where the offset and noise values will be written to. If the name is "darkcal", the name will be build by the detector id and the current date and time when it was written. Also when writing a link to the written file will be created like this: "darkcal_%detectorID%.lnk". When the name differs from "darkcal", the values will be written only to the given filename. See cass::pixeldetector::CommonData::saveOffsetNoiseMaps for more details. Default is "darkcal".
PixelDetectors/%name%/CorrectionMaps/{OutputOffsetNoiseFiletype}
The filetype that the noise and offset values are stored to. Default is "hll". Options are:
PixelDetectors/%name%/CorrectionMaps/{GainMapCreatorType}
The type of functor that will create the gain used for correcting the frames from individual frames. See Gainmap-Creators List for a list of all possible values. Default is "none".
PixelDetectors/%name%/CorrectionMaps/{InputGainFilename}
The filename containing the gain (/cte) values. Default is "gain_\%detectorId\%.lnk".
PixelDetectors/%name%/CorrectionMaps/{InputGainFiletype}
The filetype that the gain (/cte) values are stored in. Default is "hll". Options are:
PixelDetectors/%name%/CorrectionMaps/{OutputGainFilename}
The filename where the gain (/cte) values will be written to. If the name is "gain", the name will be build by the detector id and the current date and time when it was written. Also when writing a link to the written file will be created like this: "gain_\%detectorID\%.lnk". When the name differs from "gain", the values will be written only to the given filename. See cass::pixeldetector::CommonData::saveGainMap for more details. Default is "gain".
PixelDetectors/%name%/CorrectionMaps/{OutputGainFiletype}
The filetype that the gain (/cte) values are stored in. Default is "cass". Options are:
PixelDetectors/%name%/CorrectionMaps/{NoisyPixelThreshold | LowerNoisyPixelThreshold}
The boundaries to identify noisy pixels. Will be used when creating the correction map. When the noise of the pixel is outside these exclusive bounds the pixel will be masked. If NoisyPixelThreshold is -1, good values for the bound will be determined from the noise map. Default is 40000 | 0
PixelDetectors/%name%/CorrectionMaps/{AutoMultiplier}
When automatically determining the noise threshold, this is the multiplier by which the autovalue is determined. .
. Default is 4.
PixelDetectors/%name%/CorrectionMaps/{nColumns}
PixelDetectors/%name%/CorrectionMaps/{nRows}
Definition at line 136 of file common_data.h.
typedef std::map<std::string,shared_pointer> cass::pixeldetector::CommonData::instancesmap_t |
typedef describing the instances of the helper
Definition at line 143 of file common_data.h.
typedef std::vector<char> cass::pixeldetector::CommonData::mask_t |
a mask is a vector of bools
Definition at line 146 of file common_data.h.
typedef std::tr1::shared_ptr<CommonData> cass::pixeldetector::CommonData::shared_pointer |
typedef a shared pointer of this
Definition at line 140 of file common_data.h.
|
inlineprivate |
prevent people from constructing other than using instance().
Definition at line 313 of file common_data.h.
|
private |
private constructor.
unused
detname | the name of the detector |
Definition at line 553 of file common_data.cpp.
|
inlineprivate |
prevent copy-construction
Definition at line 324 of file common_data.h.
|
static |
issue a command to the map creators of all instances
command | the command to issue |
Definition at line 534 of file common_data.cpp.
References cass::Log::add(), and cass::Log::DEBUG1.
void CommonData::createCorMap | ( | ) |
create the correction map
will create the correction map from the mask, noise and cte/gain values with the help of the cass::pixeldetector::createCorrectionMap function
the correction value for a pixel is calculated using the following formular:
reset the correction map before generating the correction values
Definition at line 807 of file common_data.cpp.
References _autoMultiplier, _autoNoiseThreshold, _noiseRange, cass::Log::add(), correctionMap, detectorId, gain_cteMap, hotpixels, cass::Log::INFO, mask, noise, noiseMap, and cass::toString().
Referenced by cass::pixeldetector::isSameSize(), and loadSettings().
void CommonData::generateMaps | ( | const Frame & | frame | ) |
generate the maps from the frame data with help of the functors
There are several ways of creating the maps available. For a detailed list see this classes help.
frame | The frame data to create the maps from |
Definition at line 722 of file common_data.cpp.
References _gainCreator, _offsetnoiseMapcreator, _settingsLoaded, cass::pixeldetector::Frame::columns, correctionMap, cass::pixeldetector::Frame::data, detectorname, gain_cteMap, hotpixels, mask, noiseMap, offsetMap, cass::pixeldetector::Frame::rows, and cass::toString().
|
static |
static function creating instance of this.
return the instance of the common data used with the advanced detector with the name detector. If the instance is not yet inside the _instances map the helper instance will be created one and put into the _instances map. So that later calls to this will return the same shared pointer.
detector | key (name) of the detector to find it in the _instances map |
Definition at line 522 of file common_data.cpp.
References cass::Log::add(), cass::Log::DEBUG0, and detector.
Referenced by cass::pixeldetector::commonmode::CalculatorBase::load(), cass::pixeldetector::AboveNoiseFinder::loadSettings(), cass::pixeldetector::HLLProcessor::loadSettings(), cass::pixeldetector::OnlineFixedCreator::loadSettings(), cass::pixeldetector::FixedMaps::loadSettings(), cass::pixeldetector::GainCalibration::loadSettings(), cass::pixeldetector::MovingMaps::loadSettings(), cass::pixeldetector::OnlineFixedCreatorCommonMode::loadSettings(), cass::pixeldetector::AdvancedDetector::loadSettings(), and cass::pixeldetector::HotPixelsFinder::loadSettings().
void CommonData::loadSettings | ( | CASSSettings & | s | ) |
load the settings of this common object
See the description of this class for the list of possible variables that will be loaded via this function. Once all parameters are loaded it will load the Mask for this detector. See pixeldetector::createCASSMask for options creating the mask. Also the correction map for this dector is created once all information has been loaded. See createCorrectionMap for details.
s | the object to load the settings for the common data from. |
try do deduce the frame size from the detectorname, if it can't be deduced read it from the settings file and resize the maps accordingly.
load info for getting the right cor value from the noise maps
setup how the offset/noise maps will be created
setup how and where the offset/noise maps will be read from. If offset filename is a link, try to deduce the real filename
setup how and where the offset/noise maps will be written to
setup how the offset/noise maps will be created
setup how and from where the gain file will be read and read it
setup how and where the gain map will be written to
setup how and from where the hot pixels mask file will be read and read it
setup how and where the gain map will be written to
create the user mask and generate the correction map
Definition at line 561 of file common_data.cpp.
References _autoMultiplier, _autoNoiseThreshold, _gainCreator, _inputGainFilename, _inputHotPixFilename, _inputOffsetFilename, _noiseRange, _offsetnoiseMapcreator, _outputGainFilename, _outputHotPixFilename, _outputOffsetFilename, _saveGainTo, _saveHotPixTo, _saveNoiseOffsetTo, _settingsLoaded, cass::Log::add(), QSettings::beginGroup(), columns, correctionMap, cass::pixeldetector::createCASSMask(), createCorMap(), detectorId, detectorname, QSettings::endGroup(), cass::pixeldetector::DetectorName::fromSettings(), QString::fromStdString(), gain_cteMap, hotpixels, cass::pixeldetector::MapCreatorBase::instance(), mask, noiseMap, offsetMap, cass::pixeldetector::readCASSGainFile(), cass::pixeldetector::readCASSHotPixFile(), cass::pixeldetector::readCASSOffsetFile(), cass::pixeldetector::readHLLGainFile(), cass::pixeldetector::readHLLOffsetFile(), rows, cass::pixeldetector::saveCASSGainFile(), cass::pixeldetector::saveCASSHotPixFile(), cass::pixeldetector::saveCASSOffsetFile(), cass::pixeldetector::saveHLLOffsetFile(), cass::pixeldetector::Frame::shapeFromName(), cass::toString(), QSettings::value(), cass::Log::VERBOSEINFO, and cass::Log::WARNING.
|
inlineprivate |
prevent assingment
Definition at line 327 of file common_data.h.
void CommonData::saveGainMap | ( | ) |
save gain map
save the gain calibration to file in the user chosen fileformat. See cass::pixeldetector::saveCASSGaiFile for details.
If the filename is "gain" for the gain calibration file, the detector id and the current time will be appended to the filename. A link to the created files will be generated. The name of the link will be called "gain_\%detectorID\%.lnk". In case the links exist, try to remove it first.
Definition at line 761 of file common_data.cpp.
References _outputGainFilename, _saveGainTo, QDateTime::currentDateTime(), detectorId, QFile::exists(), QString::fromStdString(), QFile::link(), QFile::remove(), and cass::toString().
void CommonData::saveHotPixMask | ( | ) |
save hot pixel mask
save the hot pixel mask to file in the user chosen fileformat.
If the filename is "hotpix" for the gain calibration file, the detector id and the current time will be appended to the filename. A link to the created files will be generated. The name of the link will be called "hotpix_\%detectorID\%.lnk". In case the link exist, try to remove it first.
Definition at line 784 of file common_data.cpp.
References _outputHotPixFilename, _saveHotPixTo, QDateTime::currentDateTime(), detectorId, QFile::exists(), QString::fromStdString(), QFile::link(), QFile::remove(), and cass::toString().
void CommonData::saveOffsetNoiseMaps | ( | ) |
save offset and noise maps
save the offset and noise calibratioin to file in the user chosen fileformat. See cass::pixeldetector::saveCASSOffsetFile or cass::pixeldetector::saveHLLOffsetFile for details.
If the filename is "darkcal" for the darkcalibration file, the detector id and the current time will be appended the filename. A link to the created files will be generated. The name of the link will be called "darkcal_\%detectorID\%.lnk". In case the link exists, try to remove it first.
Definition at line 738 of file common_data.cpp.
References _outputOffsetFilename, _saveNoiseOffsetTo, QDateTime::currentDateTime(), detectorId, QFile::exists(), QString::fromStdString(), QFile::link(), QFile::remove(), and cass::toString().
|
private |
the multiplier about which the automatically determined threshold will be defined
Definition at line 383 of file common_data.h.
Referenced by createCorMap(), and loadSettings().
|
private |
flag whether the noise threshold should be automatically determined
Definition at line 380 of file common_data.h.
Referenced by createCorMap(), and loadSettings().
|
private |
functor to create the Maps
Definition at line 356 of file common_data.h.
Referenced by generateMaps(), and loadSettings().
|
private |
the gain correction input filename
Definition at line 362 of file common_data.h.
Referenced by loadSettings().
|
private |
the hot pixel mask input filename
Definition at line 371 of file common_data.h.
Referenced by loadSettings().
|
private |
input filename of the offset and noise map
Definition at line 350 of file common_data.h.
Referenced by loadSettings().
|
staticprivate |
the helperclass instances.
the instances of this class put into map one instance for each available detector
Definition at line 334 of file common_data.h.
|
staticprivate |
mutex to lock the creation of an instance
Definition at line 337 of file common_data.h.
|
private |
the range in adu for masking noisy pixels
Definition at line 377 of file common_data.h.
Referenced by createCorMap(), and loadSettings().
|
private |
functor to create the Maps
Definition at line 341 of file common_data.h.
Referenced by generateMaps(), and loadSettings().
|
private |
the gain correction output filename
Definition at line 365 of file common_data.h.
Referenced by loadSettings(), and saveGainMap().
|
private |
the hot pixel mask output filename
Definition at line 374 of file common_data.h.
Referenced by loadSettings(), and saveHotPixMask().
|
private |
output filename for the offset and noise maps
Definition at line 347 of file common_data.h.
Referenced by loadSettings(), and saveOffsetNoiseMaps().
|
private |
function to write the gain map
Definition at line 359 of file common_data.h.
Referenced by loadSettings(), and saveGainMap().
|
private |
function to write the hot pixel mask
Definition at line 368 of file common_data.h.
Referenced by loadSettings(), and saveHotPixMask().
|
private |
function to write the offset maps
Definition at line 344 of file common_data.h.
Referenced by loadSettings(), and saveOffsetNoiseMaps().
|
private |
switch to tell that load settins for this common data was already running
Definition at line 353 of file common_data.h.
Referenced by generateMaps(), and loadSettings().
size_t cass::pixeldetector::CommonData::columns |
the width of the maps
Definition at line 256 of file common_data.h.
Referenced by cass::pixeldetector::addCircle(), cass::pixeldetector::addEllipse(), cass::pixeldetector::addRing(), cass::pixeldetector::addSquare(), cass::pixeldetector::addTriangle(), cass::pixeldetector::isSameSize(), loadSettings(), and cass::pixeldetector::saveHLLOffsetFile().
Detector::frame_t cass::pixeldetector::CommonData::correctionMap |
the correction map
this map contains the correction values calculated from the mask, the gain and cte map. With this values the indivdual pixels will be mulitplied in the HLL like processing of the frame
Definition at line 303 of file common_data.h.
Referenced by createCorMap(), generateMaps(), cass::pixeldetector::isSameSize(), and loadSettings().
int32_t cass::pixeldetector::CommonData::detectorId |
the id of the detector that contains the frames whos maps we have here
Definition at line 306 of file common_data.h.
Referenced by createCorMap(), loadSettings(), saveGainMap(), saveHotPixMask(), and saveOffsetNoiseMaps().
std::string cass::pixeldetector::CommonData::detectorname |
the name of the detector whos maps are contained in this class instance
Definition at line 309 of file common_data.h.
Referenced by generateMaps(), cass::pixeldetector::isSameSize(), and loadSettings().
Detector::frame_t cass::pixeldetector::CommonData::gain_cteMap |
the gain + cte map
this is a matrix of values containing correction factors for each individual pixel of the frame
Definition at line 295 of file common_data.h.
Referenced by createCorMap(), generateMaps(), cass::pixeldetector::isSameSize(), loadSettings(), cass::pixeldetector::readCASSGainFile(), cass::pixeldetector::readHLLGainFile(), and cass::pixeldetector::saveCASSGainFile().
mask_t cass::pixeldetector::CommonData::hotpixels |
the hotpixel mask
a negative value masks pixels permanently. Positive values indicate how many frames this pixel was high. If its not high anymore the mask value will be reset to 0.
Definition at line 288 of file common_data.h.
Referenced by createCorMap(), generateMaps(), cass::pixeldetector::isSameSize(), loadSettings(), cass::pixeldetector::readCASSHotPixFile(), and cass::pixeldetector::saveCASSHotPixFile().
QReadWriteLock cass::pixeldetector::CommonData::lock |
lock to synchronize read and write acces to the common data
Definition at line 253 of file common_data.h.
Referenced by cass::pixeldetector::addCircle(), cass::pixeldetector::addEllipse(), cass::pixeldetector::addRing(), cass::pixeldetector::addSquare(), cass::pixeldetector::isSameSize(), cass::pixeldetector::readCASSGainFile(), cass::pixeldetector::readCASSHotPixFile(), cass::pixeldetector::readCASSOffsetFile(), cass::pixeldetector::readHLLGainFile(), and cass::pixeldetector::readHLLOffsetFile().
mask_t cass::pixeldetector::CommonData::mask |
the detector mask
the mask is a matrix with either 0 or 1 which indicate which pixels shoud be omitted (1 stands for :take pixel, 0 is for don't take pixel
Definition at line 280 of file common_data.h.
Referenced by cass::pixeldetector::addCircle(), cass::pixeldetector::addEllipse(), cass::pixeldetector::addRing(), cass::pixeldetector::addSquare(), cass::pixeldetector::addTriangle(), cass::pixeldetector::createCASSMask(), createCorMap(), generateMaps(), cass::pixeldetector::isSameSize(), loadSettings(), cass::pixeldetector::readHLLOffsetFile(), and cass::pixeldetector::saveHLLOffsetFile().
Detector::frame_t cass::pixeldetector::CommonData::noiseMap |
the noise map
the noise map is the standart deviation of the mean value of indidual pixels for a given number of frames
Definition at line 273 of file common_data.h.
Referenced by createCorMap(), generateMaps(), cass::pixeldetector::isSameSize(), loadSettings(), cass::pixeldetector::readCASSOffsetFile(), cass::pixeldetector::readHLLOffsetFile(), cass::pixeldetector::saveCASSOffsetFile(), and cass::pixeldetector::saveHLLOffsetFile().
Detector::frame_t cass::pixeldetector::CommonData::offsetMap |
the offset map
the offset map is the mean value of the individual pixels for given number of frames
Definition at line 266 of file common_data.h.
Referenced by generateMaps(), cass::pixeldetector::isSameSize(), loadSettings(), cass::pixeldetector::readCASSOffsetFile(), cass::pixeldetector::readHLLOffsetFile(), cass::pixeldetector::saveCASSOffsetFile(), and cass::pixeldetector::saveHLLOffsetFile().
size_t cass::pixeldetector::CommonData::rows |
the height of the maps
Definition at line 259 of file common_data.h.
Referenced by cass::pixeldetector::addCircle(), cass::pixeldetector::addEllipse(), cass::pixeldetector::addRing(), cass::pixeldetector::addSquare(), cass::pixeldetector::addTriangle(), cass::pixeldetector::isSameSize(), loadSettings(), and cass::pixeldetector::saveHLLOffsetFile().