53 pair<float,float>_userCenter(make_pair(settings.
value(
"ImageXCenter", 500).toFloat(),
54 settings.
value(
"ImageYCenter", 500).toFloat()));
56 _symAngle = settings.
value(
"SymmetryAngle", 0).toFloat() * M_PI / 180.;
58 pair<float,float>_radiusRangeUser(make_pair(min(settings.
value(
"MaxIncludedRadius",10).toFloat(),
59 settings.
value(
"MinIncludedRadius",0).toFloat()),
60 max(settings.
value(
"MaxIncludedRadius",10).toFloat(),
61 settings.
value(
"MinIncludedRadius",0).toFloat())));
63 throw invalid_argument(
"pp200::loadSettings()'" +
name() +
64 "': Error the histogram we depend on '" +
_image->name() +
65 "' is not a 2D Histogram.");
68 _center = make_pair(xaxis.bin(_userCenter.first),
69 yaxis.bin(_userCenter.second));
70 const size_t imagewidth (xaxis.nBins);
71 const size_t imageheight (yaxis.nBins);
72 const size_t dist_center_x_right (imagewidth - _center.first);
73 const size_t dist_center_y_top (imageheight - _center.second);
74 const size_t min_dist_x (min(dist_center_x_right, _center.first));
75 const size_t min_dist_y (min(dist_center_y_top, _center.second));
76 const size_t max_allowed_radius (min(min_dist_x, min_dist_y));
77 const size_t user_maxradius_hist_coord (xaxis.bin(_radiusRangeUser.second)- xaxis.bin(0));
78 const size_t maxRadius (min(max_allowed_radius, user_maxradius_hist_coord));
79 const size_t user_minradius_hist_coord (xaxis.bin(_radiusRangeUser.first)- xaxis.bin(0));
80 const size_t minRadius (max(
size_t(1) , user_minradius_hist_coord));
83 _imageWidth = imagewidth;
89 "' calculates cos2theta of image from Processor '" +
_image->name() +
90 "' Center is x'"+
toString(_center.first) +
"' y'" +
toString(_center.second) +
92 "' Min radius the user requested is '" +
toString(_radiusRangeUser.first) +
93 "' Max radius the user requested is '" +
toString(_radiusRangeUser.second) +
94 "' Image width is '" +
toString(_imageWidth) +
96 "'. Condition is '" +
_condition->name() +
"'");
104 float nom(0), denom(0), maxval(0);
110 const float angle(2.*M_PI *
float(jth) /
float(_nbrAngularPoints));
114 denom += val *
square(radius);
116 maxval = max(val,maxval);
119 result.
setValue((abs(denom) < 1e-15)?0.5:nom/denom);
142 pair<float,float> _userCenter(make_pair(settings.
value(
"ImageXCenter", 500).toFloat(),
143 settings.
value(
"ImageYCenter", 500).toFloat()));
144 pair<float,float> _radiusRangeUser(make_pair(settings.
value(
"MinIncludedRadius",10).toFloat(),
145 settings.
value(
"MaxIncludedRadius",0).toFloat()));
152 if (
_image->result().dim() != 2)
153 throw invalid_argument(
"pp201::loadSettings()'" +
name() +
154 "': Error the histogram we depend on '" +
_image->name() +
155 "' is not a 2D Histogram.");
159 size_t imagewidth (xaxis.nBins);
160 _center = make_pair(xaxis.bin(_userCenter.first),
161 yaxis.bin(_userCenter.second));
163 _radiusRange.second = min(min(_radiusRange.second,
_center.first + 0.5f), imagewidth -
_center.first - 0.5f);
164 _radiusRange.second = min(min(_radiusRange.second,
_center.second + 0.5f), imagewidth -
_center.second - 0.5f);
165 _radiusRange.first = max(0.1f, min(_radiusRange.second - 1.0f , _radiusRangeUser.first));
171 "' will calculate the angular distribution of '" +
_image->name() +
172 "' from radia '" +
toString(_radiusRange.first) +
"' to '" +
174 " y:" +
toString(
_center.second) +
". Number of Points on the axis '" +
190 const float angle_deg(jth*360/_nbrAngularPoints);
191 const float angle(angle_deg * M_PI/ 180.f);
192 const float x(
_center.first + radius*sin(angle));
193 const float y(
_center.second + radius*cos(angle));
194 const size_t x1(static_cast<size_t>(x));
195 const size_t x2(x1 + 1);
196 const size_t y1(static_cast<size_t>(y));
197 const size_t y2(y1 + 1);
198 const float f11 (image[y1 *
width + x1]);
199 const float f21 (image[y1 *
width + x2]);
200 const float f12 (image[y2 *
width + x1]);
201 const float f22 (image[y2 *
width + x2]);
202 const float interpolateValue = f11*(x2 -
x )*(y2 - y )+
203 f21*(x -x1)*(y2 - y )+
204 f12*(x2 -
x )*(y - y1)+
205 f22*(x - x1)*(y - y1);
206 result[jth] += interpolateValue;
230 settings.
value(
"ImageYCenter", 500).toFloat());
238 if (
_image->result().dim() != 2)
239 throw invalid_argument(
"pp202::loadSettings()'" +
name() +
240 "': Error the histogram we depend on '" +
_image->name() +
241 "' is not a 2D Histogram.");
247 const size_t imagewidth (xaxis.nBins);
248 const size_t imageheight (yaxis.nBins);
249 const size_t dist_center_x_right(imagewidth - _center.first);
250 const size_t dist_center_y_top(imageheight - _center.second);
251 const size_t min_dist_x (min(dist_center_x_right, _center.first));
252 const size_t min_dist_y (min(dist_center_y_top, _center.second));
262 "' to polar coordinates. Center x'"+
toString(_center.first) +
"' y'" +
264 "'. Number of Points on the phi '" +
toString(_nbrAngularPoints) +
266 "'. Condition is '" +
_condition->name() +
"'");
279 const float radius(jr*
_maxRadius/_nbrRadialPoints);
280 const float angle_deg(jth*360/_nbrAngularPoints);
281 const float angle(angle_deg * M_PI/ 180.f);
282 const float x(
_center.first + radius*sin(angle));
283 const float y(
_center.second + radius*cos(angle));
284 const size_t x1(static_cast<size_t>(x));
285 const size_t x2(x1 + 1);
286 const size_t y1(static_cast<size_t>(y));
287 const size_t y2(y1 + 1);
288 const float f11 (image[y1 *
width + x1]);
289 const float f21 (image[y1 *
width + x2]);
290 const float f12 (image[y2 *
width + x1]);
291 const float f22 (image[y2 *
width + x2]);
292 const float interpolateValue = f11*(x2 -
x )*(y2 - y )+
293 f21*(x -x1)*(y2 - y )+
294 f12*(x2 -
x )*(y - y1)+
295 f22*(x - x1)*(y - y1);
296 result[jr*_nbrAngularPoints + jth] += interpolateValue;
CachedList::item_type result_t
define the results
Event to store all LCLS Data.
virtual void createHistList(result_t::shared_pointer result)
create result list.
std::pair< size_t, size_t > _center
center of the image in histogram coordinates
size_t _nbrRadialPoints
the number of radial, determinded by the _radiusRange
virtual void process(const CASSEvent &, result_t &)
calculate of averaged image
const name_t name() const
retrieve the name of this processor
file contains declaration of the CASSEvent
shared_pointer _image
pp containing image that we will the angular distribution from
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
virtual void loadSettings(size_t)
load the histogram settings from CASS.ini
an axis of a more than 0 dimensional container
float _symAngle
symmetry angle for calculation
size_t _nbrAngularPoints
the number of angular points that we include in the distribution
processors that calculate laser alignment parameters
pp201(const name_t &)
Construct processor for Gaussian height of image.
float _maxRadius
the maximal radius possible
T square(const T &val)
multiply number by itself
static void add(Level level, const std::string &line)
add a string to the log
void setValue(const_reference value)
assign the result container to a value
fromStdString(const std::string &str)
size_t _nbrAngularPoints
the number of angular points that we include in the distribution
std::pair< size_t, size_t > _center
center of the image in histogram coordinates
virtual void process(const CASSEvent &, result_t &)
calculate of averaged image
base class for processors.
shared_pointer setupDependency(const std::string &depVarName, const name_t &name="")
setup the dependecy.
virtual void loadSettings(size_t)
load the histogram settings from CASS.ini
std::pair< float, float > _userCenter
center of the image in user coordinates
const axis_t & axis() const
read access to the axis
file contains declaration of classes and functions that help other processors to do their job...
size_t _imageWidth
the width of the image
size_t _nbrRadialPoints
the number of radial, determinded by the _radiusRange
QReadWriteLock lock
lock for locking operations on the data of the container
shared_pointer _image
pp containing image that we will calculate the from
size_t _nbrAngularPoints
the number of angular points that we include in the distribution
std::string toString(const Type &t)
convert any type to a string
value(const QString &key, const QVariant &defaultValue=QVariant()
pp202(const name_t &)
Construct processor for Gaussian height of image.
virtual void process(const CASSEvent &, result_t &)
calculate of averaged image
void setupGeneral()
general setup of the processor
file contains specialized class that do the settings for cass
shared_pointer _condition
pointer to the processor that will contain the condition
size_t _nbrRadialPoints
the number of radial, determinded by the _radiusRange
std::pair< float, float > _radiusRange
the rane of radia used
virtual void loadSettings(size_t)
load the histogram settings from CASS.ini
bool setupCondition(bool defaultConditionType=true)
setup the condition.
std::string name_t
define the name type
contains a logger for cass
std::pair< size_t, size_t > _center
center of the image in histogram coordinates
pp200(const name_t &)
Construct processor for Gaussian height of image.
shared_pointer _image
pp containing image that we will the angular distribution from
beginGroup(const QString &prefix)
std::pair< float, float > _radiusRange
the range of radia used
virtual const result_t & result(const CASSEvent::id_t eventid=0)
retrieve a result for a given id.