CFEL - ASG Software Suite  2.5.0
CASS
hll_frame_processor.cpp
Go to the documentation of this file.
1 // Copyright (C) 2011 Lutz Foucar
2 
3 /**
4  * @file hll_frame_processor.cpp contains hll correctionlike frame processor.
5  *
6  * @author Lutz Foucar
7  */
8 
9 #include "hll_frame_processor.h"
10 
11 #include "cass_settings.h"
12 #include "advanced_pixeldetector.h"
13 
14 using namespace cass;
15 using namespace pixeldetector;
16 using namespace commonmode;
17 using namespace std;
18 
20 {}
21 
23 {
24  const CalculatorBase &calcCommonMode(*_commonModeCalculator);
25  QReadLocker lock(&_commondata->lock);
26  Detector::frame_t::iterator pixel(frame.data.begin());
27  Detector::frame_t::const_iterator offset(_commondata->offsetMap.begin());
28  Detector::frame_t::const_iterator correction(_commondata->correctionMap.begin());
29  size_t idx(0);
30  float commonmodeLevel(0);
31  const size_t width(_commonModeCalculator->width());
32  const size_t parts(frame.data.size() / width);
33  for (size_t part(0); part < parts; ++part)
34  {
35  commonmodeLevel = calcCommonMode(pixel,idx);
36  for (size_t i(0); i < width; ++i, ++pixel, ++offset, ++correction, ++idx)
37  {
38  *pixel = (*pixel - *offset - commonmodeLevel) * *correction;
39  }
40  }
41  return frame;
42 }
43 
45 {
46  string detectorname(DetectorName::fromSettings(s));
47  _commondata = CommonData::instance(detectorname);
48  s.beginGroup("HLLProcessing");
49  string commonmodetype (s.value("CommonModeCalculationType","none").toString().toStdString());
50  _commonModeCalculator = CalculatorBase::instance(commonmodetype);
51  _commonModeCalculator->loadSettings(s);
52  s.endGroup();
53 }
contains hll correctionlike frame processor.
Settings for CASS.
Definition: cass_settings.h:30
STL namespace.
static std::string fromSettings(const CASSSettings &s)
retrieve it from the casssettings
Definition: common_data.h:47
set up the common mode correction
value(const QString &key, const QVariant &defaultValue=QVariant()
static shared_pointer instance(const std::string &type)
create an instance of the requested functor
Frame & operator()(Frame &frame)
process the frame
A Frame of an advance Pixel Detector.
Detector::frame_t data
the frame data
file contains specialized class that do the settings for cass
static shared_pointer instance(const instancesmap_t::key_type &detector)
static function creating instance of this.
offset
advanced pixeldetectors
int16_t pixel
define a pixel
Definition: hlltypes.hpp:27
void loadSettings(CASSSettings &s)
load the settings of this processor
base class for all common mode calculators
beginGroup(const QString &prefix)