10 #include <QtCore/QString>
26 using tr1::placeholders::_1;
27 using tr1::placeholders::_2;
28 using tr1::placeholders::_3;
29 using tr1::placeholders::_4;
30 using tr1::placeholders::_5;
40 template <
class ForwardIterator>
41 ForwardIterator
max_element ( ForwardIterator first, ForwardIterator last )
43 if (first==last)
return last;
44 ForwardIterator largest = first;
45 while (!std::isfinite(*largest))
53 if (std::isfinite(*first))
65 template <
class ForwardIterator>
66 ForwardIterator
min_element ( ForwardIterator first, ForwardIterator last )
68 if (first==last)
return last;
69 ForwardIterator smallest = first;
70 while (!std::isfinite(*smallest))
78 if (std::isfinite(*first))
108 if (one.shape() != two.shape())
109 throw invalid_argument(
"pp1::loadSettings() '"+
name()+
110 "': InputOne '" + one.name() +
111 "' with dimension '" +
toString(one.dim()) +
112 "', memory size '" +
toString(one.size()) +
113 "' and shape '" +
toString(one.shape().first) +
114 "x" +
toString(one.shape().second) +
115 "' differs from InputTwo '" + two.name() +
116 "' with has dimension '" +
toString(two.dim()) +
117 "', memory size '" +
toString(two.size()) +
118 "' and shape '" +
toString(two.shape().first) +
119 "x" +
toString(two.shape().second));
121 string operation(s.
value(
"Operation",
"+").toString().toStdString());
122 if (operation ==
"+")
124 else if (operation ==
"-")
125 _op = minus<float>();
126 else if (operation ==
"/")
127 _op = divides<float>();
128 else if (operation ==
"*")
129 _op = multiplies<float>();
130 else if (operation ==
"AND")
131 _op = logical_and<bool>();
132 else if (operation ==
"OR")
133 _op = logical_or<bool>();
134 else if (operation ==
">")
135 _op = greater<float>();
136 else if (operation ==
">=")
137 _op = greater_equal<float>();
138 else if (operation ==
"<")
140 else if (operation ==
"<=")
141 _op = less_equal<float>();
142 else if (operation ==
"==")
143 _op = equal_to<float>();
144 else if (operation ==
"!=")
145 _op = not_equal_to<float>();
147 throw invalid_argument(
"pp1::loadSettings() '" +
name() +
148 "': operation '" + operation +
"' is unkown.");
153 "' will do operation '"+ operation +
"'with '" +
_one->name() +
154 "' as first and '" +
_two->name() +
"' as second argument" +
155 "'. Condition is '" +
_condition->name() +
"'");
194 bool IsFloatValue(
false);
210 if (!IsFloatValue &&
_valuePP->result().dim() != 0)
211 throw invalid_argument(
"pp2::loadSettings() '"+
name()+
" value '" +
212 _valuePP->name() +
"' is not a 0d result");
214 string operation(s.
value(
"Operation",
"+").toString().toStdString());
215 if (operation ==
"+")
217 else if (operation ==
"-")
218 _op = minus<float>();
219 else if (operation ==
"/")
220 _op = divides<float>();
221 else if (operation ==
"*")
222 _op = multiplies<float>();
223 else if (operation ==
"AND")
224 _op = logical_and<bool>();
225 else if (operation ==
"OR")
226 _op = logical_or<bool>();
227 else if (operation ==
">")
228 _op = greater<float>();
229 else if (operation ==
">=")
230 _op = greater_equal<float>();
231 else if (operation ==
"<")
233 else if (operation ==
"<=")
234 _op = less_equal<float>();
235 else if (operation ==
"==")
236 _op = equal_to<float>();
237 else if (operation ==
"!=")
238 _op = not_equal_to<float>();
240 throw invalid_argument(
"pp2::loadSettings() '" +
name() +
241 "': operation '" + operation +
"' is unkown.");
243 string valuePos(s.
value(
"ValuePos",
"first").toString().toStdString());
244 if (valuePos ==
"first")
246 else if (valuePos ==
"second")
249 throw invalid_argument(
"pp2::loadSettings() '" +
name() +
250 "': value position '" + valuePos +
"' is unkown.");
254 "' on '" +
_hist->name() +
"' with " +
255 (!IsFloatValue ?
"value in '"+
_valuePP->name() :
"constant '"+
257 "'. Condition is "+
_condition->name() +
"'");
262 return std::tr1::bind(
_op,val,_1);
267 return std::tr1::bind(
_op,_1,val);
279 return value.getValue();
318 if (
_one->result().dim() != 0)
319 throw invalid_argument(
"pp4::loadSettings() '"+
name()+
" value '" +
320 _one->name() +
"' is not a 0d result, but needs to be");
357 _range = make_pair(s.
value(
"LowerLimit",0).toFloat(),
358 s.
value(
"UpperLimit",0).toFloat());
367 +
"' will check whether hist in Processor '" +
_one->name() +
370 " Condition is '" +
_condition->name() +
"'");
402 string type(s.
value(
"ValueType",
"0D").toString().toStdString());
407 else if (type ==
"1D")
412 s.
value(
"XLow",0).toFloat(),
413 s.
value(
"XUp",1).toFloat(),
414 s.
value(
"XTitle",
"x-axis").toString().toStdString()
417 else if (type ==
"2D")
422 s.
value(
"XLow",0).toFloat(),
423 s.
value(
"XUp",1).toFloat(),
424 s.
value(
"XTitle",
"x-axis").toString().toStdString()),
426 s.
value(
"YLow",0).toFloat(),
427 s.
value(
"YUp",1).toFloat(),
428 s.
value(
"YTitle",
"y-axis").toString().toStdString())));
432 throw invalid_argument(
"pp12::loadSettings(): '" +
name() +
433 "' unknown valuetype '" + type +
"' provided");
437 if (
name() ==
"DefaultTrueHist")
439 if (
name() ==
"DefaultFalseHist")
475 "' will return a copy of Processor '" +
_one->name() +
476 "'. Condition is '" +
_condition->name() +
"'");
519 if (one.dim() != two.dim())
520 throw invalid_argument(
"pp14::loadSettings() "+
name()+
": First '" +
521 _one->name() +
"' with dimension '" +
522 toString(one.dim()) +
"' and Second '" +
523 _two->name() +
"' with dimension '" +
525 "' don't have the same dimension");
530 _one->name() +
"' when condition input is true and '" +
576 if (
_hist->result().dim() != 0 )
577 throw runtime_error(
"pp15::loadSettings() " +
name() +
": Result '" +
578 _hist->name() +
"' is not 0D, but needs to be");
580 if (fabs(
_difference) < std::numeric_limits<result_t::value_t>::epsilon() )
581 _difference = std::numeric_limits<result_t::value_t>::epsilon();
585 "' will check whether the difference between the current and the" +
586 " previous value of '" +
_hist->name() +
588 "'. It will use condition '" +
_condition->name() +
"'");
630 bool IsFloatValue(
false);
647 "' will threshold Result in Processor '" +
_one->name() +
649 (
"' indexwise with threshold values defined in '" +
_threshPP->name())) +
650 "'. In case the value is below the threshold it will be set to '" +
657 return ((thresh < value) ? value :
_userVal);
720 throw invalid_argument(
"pp41:loadSettings() '" +
name() +
721 "' Shape of hist to threshold '" +
_one->name() +
"'(" +
724 ") and the threshold '" +
_threshold->name() +
"' (" +
729 "' will set bins in Processor '" +
_one->name() +
733 "' where the boarders are exclusive. Condition is '"
783 if (
_pHist->result().dim() != 2)
784 throw invalid_argument(
"pp50::loadSettings()'" +
name() +
785 "': Result '" +
_pHist->name() +
786 "' is not a 2D Result.");
793 pair<float,float> userRange(make_pair(s.
value(
"Low",-1e6).toFloat(),
794 s.
value(
"Up", 1e6).toFloat()));
795 if (userRange.first >= userRange.second)
796 throw invalid_argument(
"pp50::loadSettings: '"+
name()+
"' Low'" +
798 "' is bigger or equal to Up'" +
800 string axis(s.
value(
"Axis",
"xAxis").toString().toStdString());
803 _xRange = make_pair(0,xAxis.nBins);
804 _yRange.first = yAxis.bin(userRange.first);
805 _yRange.second = yAxis.bin(userRange.second);
807 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
808 "': Low'" +
toString(userRange.first) +
809 "' is giving the the same row as Up'" +
812 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
813 "': Low'" +
toString(userRange.first) +
814 "' is smaller than the lowest possible value '" +
816 if (static_cast<int>(yAxis.nBins) <
_yRange.first)
817 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
818 "': Low '" +
toString(userRange.first) +
819 "' is higher than the highest possible value '" +
822 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
823 "': Up '" +
toString(userRange.second) +
824 "' is smaller than the lowest possible value '" +
826 if (static_cast<int>(yAxis.nBins) <
_yRange.second)
827 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
828 "': Up '" +
toString(userRange.second) +
829 "' is higher than the highest possible value '" +
834 else if (axis ==
"yAxis")
836 _xRange.first = xAxis.bin(userRange.first);
837 _xRange.second = xAxis.bin(userRange.second);
838 _yRange = make_pair(0,yAxis.nBins);
840 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
841 "': Low '" +
toString(userRange.first) +
842 "' is giving the the same column as Up '" +
845 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
846 "': Low '" +
toString(userRange.first) +
847 "' is smaller than the lowest possible value '" +
849 if (static_cast<int>(xAxis.nBins) <
_xRange.first)
850 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
851 "': Low '" +
toString(userRange.first) +
852 "' is higher than the highest possible value '" +
855 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
856 "': Up '" +
toString(userRange.second) +
857 "' is smaller than the lowest possible value '" +
859 if (static_cast<int>(xAxis.nBins) <
_xRange.second)
860 throw invalid_argument(
"pp50::loadSettings: '" +
name() +
861 "': Up '" +
toString(userRange.second) +
862 "' is higher than the highest possible value '" +
869 throw invalid_argument(
"pp50::loadSettings() '" +
name() +
870 "': requested axis '" + axis +
"' is not recognized");
874 "' will project result of Processor '" +
_pHist->name() +
875 "' from '" +
toString(userRange.first) +
"' to '" +
876 toString(userRange.second) +
"' to the " + axis +
877 ". The area in result coordinates lower left '" +
888 dest[
x] += src[
y*
_nX +
x];
895 dest[
y] += src[
y*
_nX +
x];
937 if (
input.dim() != 1)
938 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
939 "': result '" +
input.name() +
"' is not a 1d result.");
941 pair<float,float> userrange(make_pair(s.
value(
"XLow",-1e6).toFloat(),
942 s.
value(
"XUp", 1e6).toFloat()));
943 if (userrange.first >= userrange.second)
944 throw invalid_argument(
"pp51::loadSettings: '"+
name()+
"' XLow '" +
946 "' is bigger or equal to XUp '" +
948 _range.first = xaxis.bin(userrange.first);
949 _range.second = xaxis.bin(userrange.second);
951 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
952 "': XLow '" +
toString(userrange.first) +
953 "' is giving the the same column as XUp '" +
956 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
957 "': XLow '" +
toString(userrange.first) +
958 "' is smaller than the lowest possible value '" +
960 if (static_cast<int>(xaxis.nBins) <
_range.first)
961 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
962 "': XLow '" +
toString(userrange.first) +
963 "' is higher than the highest possible value '" +
966 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
967 "': Xup '" +
toString(userrange.second) +
968 "' is smaller than the lowest possible value '" +
970 if (static_cast<int>(xaxis.nBins) <
_range.second)
971 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
972 "': Xup '" +
toString(userrange.second) +
973 "' is higher than the highest possible value '" +
976 string output(
"Processor '" +
name() +
977 "' will create integral of 1D results in Processor '" +
input.name() +
982 if (s.
value(
"BaselineXLow",
"None").toString() !=
"None")
984 pair<float,float> baselineuserrange(make_pair(s.
value(
"BaselineXLow",-1e6).toFloat(),
985 s.
value(
"BaselineXUp", 1e6).toFloat()));
986 if (baselineuserrange.first >= baselineuserrange.second)
987 throw invalid_argument(
"pp51::loadSettings: '"+
name()+
"' BaselineXLow '" +
989 "' is bigger or equal to BaselineXUp '" +
990 toString(baselineuserrange.second) +
"'");
994 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
995 "': BaselineXLow '" +
toString(baselineuserrange.first) +
996 "' is giving the the same column as BaselineXUp '" +
997 toString(baselineuserrange.second) +
"'");
999 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
1000 "': BaselineXLow '" +
toString(baselineuserrange.first) +
1001 "' is smaller than the lowest possible value '" +
1004 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
1005 "': BaselineXLow '" +
toString(baselineuserrange.first) +
1006 "' is higher than the highest possible value '" +
1009 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
1010 "': BaselineXup '" +
toString(baselineuserrange.second) +
1011 "' is smaller than the lowest possible value '" +
1014 throw invalid_argument(
"pp51::loadSettings: '" +
name() +
1015 "': BaselineXup '" +
toString(baselineuserrange.second) +
1016 "' is higher than the highest possible value '" +
1019 output += (
". It will use range from '" +
toString(baselineuserrange.first) +
1021 toString(baselineuserrange.second) +
"(" +
1026 output += (
". It will use a constant baseline of 0");
1032 output += (
" Condition is '" +
_condition->name() +
"'");
1040 const float sum(accumulate(begin,end, 0.f));
1041 const float nPoints(distance(begin,end));
1042 return (sum/nPoints);
1052 const float nPoints(distance(begin,end));
1083 "' stores the previous result from Processor '" +
_pHist->name() +
1084 "'. Condition on processor '" +
_condition->name() +
"'");
1139 if (
input.dim() != 2)
1140 throw invalid_argument(
"pp57::setupParameters()'" +
name() +
1141 "': Error the processor we depend on '" +
input.name() +
1142 "' is not a 2D result.");
1145 pair<float,float> userRange(make_pair(s.
value(
"Low",-1e6).toFloat(),
1146 s.
value(
"Up", 1e6).toFloat()));
1147 if (userRange.first >= userRange.second)
1148 throw invalid_argument(
"pp57::loadSettings: '"+
name()+
"' Low'" +
1150 "' is bigger or equal to Up'" +
1157 string axis(s.
value(
"Axis",
"xAxis").toString().toStdString());
1158 if (axis ==
"xAxis")
1160 _Xrange = make_pair(0,xAxis.nBins);
1161 _Yrange.first = yAxis.bin(userRange.first);
1162 _Yrange.second = yAxis.bin(userRange.second);
1164 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1165 "': Low '" +
toString(userRange.first) +
1166 "' is giving the the same row as Up '" +
1169 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1170 "': Low '" +
toString(userRange.first) +
1171 "' is smaller than the lowest possible value '" +
1173 if (static_cast<int>(yAxis.nBins) <
_Yrange.first)
1174 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1175 "': Low '" +
toString(userRange.first) +
1176 "' is higher than the highest possible value '" +
1179 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1180 "': Up '" +
toString(userRange.second) +
1181 "' is smaller than the lowest possible value '" +
1183 if (static_cast<int>(yAxis.nBins) <
_Yrange.second)
1184 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1185 "': Up '" +
toString(userRange.second) +
1186 "' is higher than the highest possible value '" +
1191 else if (axis ==
"yAxis")
1193 _Xrange.first = xAxis.bin(userRange.first);
1194 _Xrange.second = xAxis.bin(userRange.second);
1196 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1197 "': Low '" +
toString(userRange.first) +
1198 "' is giving the the same column as Up '" +
1201 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1202 "': Low '" +
toString(userRange.first) +
1203 "' is smaller than the lowest possible value '" +
1205 if (static_cast<int>(xAxis.nBins) <
_Xrange.first)
1206 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1207 "': Low '" +
toString(userRange.first) +
1208 "' is higher than the highest possible value '" +
1211 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1212 "': Up '" +
toString(userRange.second) +
1213 "' is smaller than the lowest possible value '" +
1215 if (static_cast<int>(xAxis.nBins) <
_Xrange.second)
1216 throw invalid_argument(
"pp57::loadSettings: '" +
name() +
1217 "': Up '" +
toString(userRange.second) +
1218 "' is higher than the highest possible value '" +
1220 _Yrange = make_pair(0,yAxis.nBins);
1226 throw invalid_argument(
"pp57::loadSettings() '" +
name() +
1227 "': requested _axis '" + axis +
"' is not recognized");
1230 "' will project result of Processor '" +
input.name() +
1231 "' from '" +
toString(userRange.first) +
"' to '" +
1232 toString(userRange.second) +
"' onto the " + axis +
1233 ". The area in result coordinates lower left '" +
1246 const float pixval(src[
y*
_nX +
x]);
1249 result[
x] += pixval;
1261 const float pixval(src[
y*
_nX +
x]);
1264 result[
y] += pixval;
1281 norm.begin(),result.
begin(), divides<result_t::value_t>());
1311 bool isFloat(
false);
1317 output += (
" Using a constant weight of '" +
toString(
_weight) +
"'");
1324 output += (
" Using the weights taken from '" +
_weightProc->name() +
"'");
1329 bool CountsPerBin(s.
value(
"RememberCounts",
false).toBool());
1332 if (isFloat && CountsPerBin)
1334 if (isFloat && !CountsPerBin)
1336 if (!isFloat && CountsPerBin && !ConstantFromProc)
1338 if (!isFloat && !CountsPerBin && !ConstantFromProc)
1340 if (!isFloat && CountsPerBin && ConstantFromProc)
1342 if (!isFloat && !CountsPerBin && ConstantFromProc)
1351 s.
value(
"XLow",0).toFloat(),
1352 s.
value(
"XUp",0).toFloat(),
1353 s.
value(
"XTitle",
"x-axis").toString().toStdString()),
1356 output += (
"' and remember the counts per bin");
1364 throw invalid_argument(
"pp60:loadSettings() " +
name() +
1365 ": The processor containing the weights '" +
1366 _weightProc->name() +
"' differs in its shape '" +
1369 "' from the input '" +
_input->name() +
"' shape '" +
1374 "' histograms values from Processor '" +
_input->name() +
"'. " +
1375 output +
". Condition on Processor '" +
_condition->name() +
"'");
1387 for (; in != last; ++in, ++weight)
1400 for (; in != last; ++in)
1409 for (; in != last; ++in)
1422 for (; in != last; ++in, ++weight)
1424 result.
histogram(make_pair(*in,0.1),*weight);
1438 for (; in != last; ++in)
1450 for (; in != last; ++in)
1489 unsigned average = s.
value(
"NbrOfAverages", 1).toUInt();
1492 _alpha = 2./
static_cast<float>(average+1.);
1500 _alpha = average ? 2./
static_cast<float>(average+1.) : 0.;
1516 QString averageType(s.
value(
"AveragingType",
"Normal").toString());
1517 if (averageType ==
"Normal")
1519 else if (averageType ==
"Square")
1522 throw invalid_argument(
"pp61::loadSettings() " +
name() +
1523 ": requested Averaging type '" +
1524 averageType.toStdString() +
"' unknown.");
1531 "' averages result from Processor '" +
_pHist->name() +
1533 "'. Condition on processor '" +
_condition->name() +
"'");
1540 return aveOld + scale*(val - aveOld);
1547 return aveOld + scale*(val*val - aveOld);
1606 "' sums up results from Processor '" +
_pHist->name() +
1607 "'. Condition on processor '" +
_condition->name() +
"'");
1643 const size_t min_time_user (s.
value(
"MinTime",0).toUInt());
1644 const size_t max_time_user (s.
value(
"MaxTime",300).toUInt());
1645 _timerange = make_pair(min_time_user,max_time_user);
1654 "' will calculate the time average of result of Processor '" +
_pHist->name() +
1655 "' from now '" +
toString(s.
value(
"MinTime",0).toUInt()) +
"' to '" +
1657 "' ; '" +
toString(_timerange.second) +
"' each bin is equivalent to up to '" +
1659 " Condition on Processor '" +
_condition->name() +
"'");
1666 char timeandday[40];
1667 struct tm * timeinfo;
1670 time_t now_of_event;
1680 strftime(timeandday,40,
"%Y%m%d %H%M%S",timeinfo);
1686 now_of_event=
static_cast<time_t
>(evt.
id()>>32);
1688 timeinfo = localtime ( &now_of_event );
1689 strftime(timeandday,40,
"%Y%m%d %H%M%S",timeinfo);
1691 fiducials=
static_cast<uint32_t
>(evt.
id() & 0x000000001FFFFF00);
1693 timeinfo = localtime ( &now_of_event );
1694 strftime(timeandday,40,
"%Y%m%d %H%M%S",timeinfo);
1702 cout <<
"time to forget"<<endl;
1714 cout <<
"extra time to forget"<<endl;
1726 if(_num_seen_evt>
_nbrSamples+1) cout<<
"pp64::process(): How... it smells like fish! "
1763 if ( !(
_hist && ret) )
return;
1771 "' will make a history of values of result in processor '" +
1773 "' Condition on processor '" +
_condition->name() +
"'");
1818 bool isFloat(
false);
1824 output += (
" Using a constant weight of '" +
toString(
_weight) +
"'");
1831 output += (
" Using the weights taken from '" +
_weightInput->name() +
"'");
1838 throw runtime_error(
"pp65::loadSettings() " +
name() +
" XName '" +
1839 _xInput->name() +
"' with shape '" +
1842 "' and YName '" +
_yInput->name() +
"' with shape '" +
1847 throw runtime_error(
"pp65::loadSettings() " +
name() +
": The input '" +
1858 bool CountsPerBin(s.
value(
"RememberCounts",
false).toBool());
1861 if (isFloat && CountsPerBin)
1863 if (isFloat && !CountsPerBin)
1865 if (!isFloat && CountsPerBin && !ConstantFromProc)
1867 if (!isFloat && !CountsPerBin && !ConstantFromProc)
1869 if (!isFloat && CountsPerBin && ConstantFromProc)
1871 if (!isFloat && !CountsPerBin && ConstantFromProc)
1884 s.
value(
"XLow",0).toFloat(),
1885 s.
value(
"XUp",0).toFloat(),
1886 s.
value(
"XTitle",
"x-axis").toString().toStdString()),
1889 output += (
"' and remember the counts per bin");
1895 "': histograms values from Processor '" +
_xInput->name() +
1896 "' as x-input and '" +
_yInput->name() +
"' as y-input. " + output +
1897 " Condition on Processor '" +
_condition->name() +
"'");
1910 for (; xin != xlast; ++xin, ++weight, ++yin)
1911 result.
histogram(make_pair(*xin,*yin),*weight);
1924 for (; xin != xlast; ++xin, ++yin)
1925 result.
histogram(make_pair(*xin,*yin),w);
1934 for (; xin != xlast; ++xin, ++yin)
1950 for (; xin != xlast; ++xin, ++weight, ++yin)
1953 result[idx] += *weight;
1954 result[idx+distToCounts] += 1;
1970 for (; xin != xlast; ++xin, ++yin)
1974 result[idx+distToCounts] += 1;
1986 for (; xin != xlast; ++xin, ++yin)
1990 result[idx+distToCounts] += 1;
2034 if (one.dim() != 1 || two.dim() != 1)
2035 throw invalid_argument(
"pp66::loadSettings() "+
name()+
": First '" +
2036 _one->name() +
"' with dimension '" +
2037 toString(one.dim()) +
"' or Second '" +
2038 _two->name() +
"' has dimension '" +
2039 toString(two.dim()) +
"' does not have dimension 1");
2045 "' creates a 2D result from Processor '" +
_one->name() +
2046 "' and '" +
_two->name() +
"'. condition on Processor '" +
2057 const size_t oneNBins(one.
shape().first);
2058 const size_t twoNBins(two.
shape().first);
2059 for (
size_t j(0); j < twoNBins; ++j)
2060 for (
size_t i(0); i < oneNBins; ++i)
2061 result[j*oneNBins+i] = one[i]*two[j];
2097 if (
_one->result().dim() != 1 ||
_two->result().dim() != 0)
2098 throw runtime_error(
"pp68::loadSettings() '" +
name() +
"': Either '" +
2099 _one->name() +
"' is not 1D or '" +
_two->name() +
2100 "' is not a 0D Hist");
2107 s.
value(
"YLow",0).toFloat(),
2108 s.
value(
"YUp",0).toFloat(),
2109 s.
value(
"YTitle",
"y-axis").toString().toStdString()))));
2111 "' makes a 2D Histogram where '" +
_one->name() +
2112 "' defines the x axis to fill and '" +
_two->name() +
2113 "' defines the y axis bin. Condition on Processor '" +
2124 const result_t::shape_t::first_type nxbins(result.
shape().first);
2126 const int ybin(yaxis.bin(two.
getValue()));
2127 if (!yaxis.isOverflow(ybin) && !yaxis.isUnderflow(ybin))
2155 if (
_one->result().dim() != 0 ||
_two->result().dim() != 0)
2156 throw runtime_error(
"pp69::loadSettings() '" +
name() +
"': Either '" +
2157 _one->name() +
"' or '" +
_two->name() +
"' is not a 0D Hist");
2160 "' makes a 1D Histogram where '"+
_one->name() +
2161 "' defines the x bin to set and '" +
_two->name() +
2162 "' defines the y value of the x bin"
2163 ". Condition on Processor '" +
_condition->name() +
"'");
2198 _offset(make_pair(0,0))
2215 if (
input.dim() == 0)
2216 throw invalid_argument(
"pp70::loadSettings(): Can't subset 0D result '" +
2217 input.name() +
"'");
2220 pair<float,float> userXRange;
2221 userXRange.first = s.
value(
"XLow",0).toFloat();
2222 userXRange.second = s.
value(
"XUp",1).toFloat();
2223 if (userXRange.first >= userXRange.second)
2224 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
"' XLow '" +
2226 "' is bigger or equal to XUp '" +
2227 toString(userXRange.second) +
"'");
2229 _offset.first = xaxis.bin(userXRange.first);
2230 const int binXUp(xaxis.bin(userXRange.second));
2232 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2233 "': XLow '" +
toString(userXRange.first) +
2234 "' is giving the the same column as XUp '" +
2235 toString(userXRange.second) +
"'");
2237 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2238 "': XLow '" +
toString(userXRange.first) +
2239 "' is smaller than the lowest possible value '" +
2241 if (static_cast<int>(xaxis.nBins) <
_offset.first)
2242 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2243 "': XLow '" +
toString(userXRange.first) +
2244 "' is bigger than the highest possible value '" +
2247 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2248 "': XUp '" +
toString(userXRange.second) +
2249 "' is smaller than the lowest possible value '" +
2251 if (static_cast<int>(xaxis.nBins) < binXUp)
2252 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2253 "': XUp '" +
toString(userXRange.second) +
2254 "' is bigger than the highest possible value '" +
2256 const size_t nXBins(binXUp-
_offset.first);
2257 const float xLow(userXRange.first);
2258 const float xUp(userXRange.second);
2259 string output(
"pp70::loadSettings '" +
name() +
2260 "': returns a subset of result in processor '" +
input.name() +
2262 "'. Subset is xLow:" +
toString(userXRange.first) +
"(" +
2265 if (1 ==
input.dim())
2270 else if (2 ==
input.dim())
2273 pair<float,float> userYRange;
2274 userYRange.first = s.
value(
"YLow",0).toFloat();
2275 userYRange.second = s.
value(
"YUp",1).toFloat();
2276 if (userYRange.first >= userYRange.second)
2277 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
"' YLow '" +
2279 "' is bigger or equal to YUp '" +
2280 toString(userYRange.second) +
"'");
2281 _offset.second = yaxis.bin(userYRange.first);
2282 const int binYUp(yaxis.bin(userYRange.second));
2284 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2285 "': YLow '" +
toString(userYRange.first) +
2286 "' is giving the the same row as YUp '" +
2287 toString(userYRange.second) +
"'");
2289 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2290 "': YLow '" +
toString(userYRange.first) +
2291 "' is smaller than the lowest possible value '" +
2293 if (static_cast<int>(yaxis.nBins) <
_offset.second)
2294 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2295 "': YLow '" +
toString(userYRange.first) +
2296 "' is bigger than the highest possible value '" +
2299 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2300 "': YUp '" +
toString(userYRange.second) +
2301 "' is smaller than the lowest possible value '" +
2303 if (static_cast<int>(yaxis.nBins) < binYUp)
2304 throw invalid_argument(
"pp70::loadSettings: '" +
name() +
2305 "': YUp '" +
toString(userYRange.second) +
2306 "' is bigger than the highest possible value '" +
2308 const size_t nYBins(binYUp -
_offset.second);
2309 const float yLow (userYRange.first);
2310 const float yUp (userYRange.second);
2320 output +=
". Condition on processor '" +
_condition->name() +
"'";
2329 const size_t resNX(result.
shape().first);
2330 const size_t resNY(result.
shape().second);
2331 const size_t inNX(input.
shape().first);
2332 for (
size_t y(0);
y < resNY; ++
y)
2335 const size_t inEnd(inStart + resNX);
2336 const size_t resStart(
y*resNX);
2337 copy(input.
begin()+inStart, input.
begin()+inEnd, result.
begin()+resStart);
2365 string functype(s.
value(
"RetrieveType",
"max").toString().toStdString());
2366 if (functype ==
"max")
2367 _func = &cass::max_element<result_t::const_iterator>;
2368 else if (functype ==
"min")
2369 _func = &cass::min_element<result_t::const_iterator>;
2371 throw invalid_argument(
"pp71::loadSettings(): RetrieveType '" + functype +
2376 "' returns the value in '" +
_pHist->name() +
2377 "' that is retrieved by using function type '" + functype +
2378 "' .Condition on processor '" +
_condition->name() +
"'");
2412 if (!(ret &&
_hist))
2415 "' clears the result in processor '" +
_hist->name() +
2421 throw logic_error(
"pp75::result: '"+
name()+
"' should never be called");
2427 const_cast<result_t&>(
_hist->result(evt.
id())).clear();
2449 "' will quit CASS.. Condition is "+
_condition->name());
2454 throw logic_error(
"pp75::result: '"+
name()+
"' should never be called");
2490 string filename(s.
value(
"List",
"").toString().toStdString());
2491 ifstream file(filename.c_str(),ios::in);
2492 if (!file.is_open())
2493 throw invalid_argument(
"pp77::loadSettings(): list file '" + filename +
2494 "' could not be opened.");
2499 _list.push_back(
id);
2504 "' will check whether eventid in file '" + filename +
2536 "' counts how many times its process is called. '" +
2537 "'. Condition is '"+
_condition->name() +
"'");
2575 if (
_pHist->result().dim() != 1)
2576 throw invalid_argument(
"pp81::loadSettings() '" +
name() +
"': '" +
2577 _pHist->name() +
"' is not a 1D hist");
2578 string functype(s.
value(
"RetrieveType",
"max").toString().toStdString());
2579 if (functype ==
"max")
2580 _func = &cass::max_element<result_t::const_iterator>;
2581 else if (functype ==
"min")
2582 _func = &cass::min_element<result_t::const_iterator>;
2584 throw invalid_argument(
"pp81::loadSettings(): RetrieveType '" + functype +
2589 "' returns the maximum bin in '" +
_pHist->name() +
2590 "' .Condition on processor '" +
_condition->name() +
"'");
2599 const size_t bin(distance(one.
begin(),it));
2637 string functype(s.
value(
"Statistics",
"sum").toString().toStdString());
2638 if (functype ==
"sum")
2643 else if (functype ==
"mean")
2648 else if (functype ==
"stdv")
2653 else if (functype ==
"variance")
2658 else if (functype ==
"median")
2663 throw invalid_argument(
"pp82::loadSettings(): Statistics type '" + functype +
2669 "' returns the '" + functype +
"' of all bins in '" +
_pHist->name() +
2670 "' .Condition on processor '" +
_condition->name() +
"'");
2731 if (hist.dim() != 1)
2732 throw invalid_argument(
"pp85::loadSettings()'" +
name() +
2733 "': Error the result we depend on '" +
_pHist->name() +
2734 "' is not a 1D Histogram.");
2735 pair<float,float> userXRange(make_pair(s.
value(
"XLow",0).toFloat(),
2736 s.
value(
"XUp",1).toFloat()));
2737 if (userXRange.first >= userXRange.second)
2738 throw invalid_argument(
"pp85::loadSettings: '"+
name()+
"' XLow '" +
2740 "' is bigger or equal to XUp '" +
2741 toString(userXRange.second) +
"'");
2743 _xRange.first = xaxis.bin(userXRange.first);
2744 _xRange.second = xaxis.bin(userXRange.second);
2746 throw invalid_argument(
"pp85::loadSettings: '" +
name() +
2747 "': XLow '" +
toString(userXRange.first) +
2748 "' is giving the the same column as XUp '" +
2749 toString(userXRange.second) +
"'");
2751 throw invalid_argument(
"pp85::loadSettings: '" +
name() +
2752 "': XLow '" +
toString(userXRange.first) +
2753 "' is smaller than the lowest possible value '" +
2755 if (static_cast<int>(xaxis.nBins) <
_xRange.first)
2756 throw invalid_argument(
"pp85::loadSettings: '" +
name() +
2757 "': XLow '" +
toString(userXRange.first) +
2758 "' is higher than the highest possible value '" +
2761 throw invalid_argument(
"pp85::loadSettings: '" +
name() +
2762 "': XUp '" +
toString(userXRange.second) +
2763 "' is smaller than the lowest possible value '" +
2765 if (static_cast<int>(xaxis.nBins) <
_xRange.second)
2766 throw invalid_argument(
"pp85::loadSettings: '" +
name() +
2767 "': XUp '" +
toString(userXRange.second) +
2768 "' is higher than the highest possible value '" +
2774 "' returns the full width at half maximum in '" +
_pHist->name() +
2775 "' of the range from xlow '" +
toString(userXRange.first) +
2776 "' to xup '" +
toString(userXRange.second) +
2779 "' .Condition on processor '" +
_condition->name() +
"'");
2791 const float fracMax((*maxElementIt-*minElementIt) *
_fraction + *minElementIt);
2796 (iVal != xRangeBegin) && (*iVal > fracMax);
2802 (iVal != xRangeEnd) && (*iVal > fracMax);
2808 const float lowerLeftPos (xaxis.pos(distance(one.
begin(),leftSide)));
2809 const float lowerRightPos(xaxis.pos(distance(one.
begin(),rightSide)));
2810 const float upperLeftPos (xaxis.pos(distance(one.
begin(),leftSide-1)));
2811 const float upperRightPos(xaxis.pos(distance(one.
begin(),rightSide+1)));
2812 const float lowerdist(lowerRightPos - lowerLeftPos);
2813 const float upperdist(upperRightPos - upperLeftPos);
2814 const float fwfm((upperdist+lowerdist)*0.5);
2859 if (hist.dim() != 1)
2860 throw invalid_argument(
"pp86::loadSettings()'" +
name() +
2861 "': Error the processor we depend on '" +
_pHist->name() +
2862 "' does not contain a 1D result.");
2865 pair<float,float> userXRangeStep(make_pair(s.
value(
"XLow",0).toFloat(),
2866 s.
value(
"XUp",1).toFloat()));
2867 if (userXRangeStep.first >= userXRangeStep.second)
2868 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
"' XLow '" +
2870 "' is bigger or equal to XUp '" +
2871 toString(userXRangeStep.second) +
"'");
2872 _xRangeStep.first = xaxis.bin(userXRangeStep.first);
2873 _xRangeStep.second = xaxis.bin(userXRangeStep.second);
2875 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2876 "': XLow '" +
toString(userXRangeStep.first) +
2877 "' is giving the the same column as XUp '" +
2878 toString(userXRangeStep.second) +
"'");
2880 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2881 "': XLow '" +
toString(userXRangeStep.first) +
2882 "' is smaller than the lowest possible value '" +
2884 if (static_cast<int>(xaxis.nBins) <
_xRangeStep.first)
2885 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2886 "': XLow '" +
toString(userXRangeStep.first) +
2887 "' is higher than the highest possible value '" +
2890 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2891 "': XUp '" +
toString(userXRangeStep.second) +
2892 "' is smaller than the lowest possible value '" +
2894 if (static_cast<int>(xaxis.nBins) <
_xRangeStep.second)
2895 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2896 "': XUp '" +
toString(userXRangeStep.second) +
2897 "' is higher than the highest possible value '" +
2900 pair<float,float> userXRangeBaseline(make_pair(s.
value(
"BaselineLow",0).toFloat(),
2901 s.
value(
"BaselineUp",1).toFloat()));
2902 if (userXRangeBaseline.first >= userXRangeBaseline.second)
2903 throw invalid_argument(
"pp86::loadSettings: '"+
name()+
"' BaselineLow '" +
2904 toString(userXRangeBaseline.first) +
2905 "' is bigger or equal to BaselineUp '" +
2906 toString(userXRangeBaseline.second) +
"'");
2910 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2911 "': BaselineLow '" +
toString(userXRangeBaseline.first) +
2912 "' is giving the the same column as BaselineUp '" +
2913 toString(userXRangeBaseline.second) +
"'");
2915 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2916 "': BaselineLow '" +
toString(userXRangeBaseline.first) +
2917 "' is smaller than the lowest possible value '" +
2920 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2921 "': BaselineLow '" +
toString(userXRangeBaseline.first) +
2922 "' is higher than the highest possible value '" +
2925 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2926 "': BaselineUp '" +
toString(userXRangeBaseline.second) +
2927 "' is smaller than the lowest possible value '" +
2930 throw invalid_argument(
"pp86::loadSettings: '" +
name() +
2931 "': BaselineUp '" +
toString(userXRangeBaseline.second) +
2932 "' is higher than the highest possible value '" +
2939 "' returns the position of the step in '" +
_pHist->name() +
2940 "' in the range from xlow '" +
toString(userXRangeStep.first) +
2941 "' to xup '" +
toString(userXRangeStep.second) +
2944 "'. Where the baseline is defined in range '" +
2945 toString(userXRangeBaseline.first) +
"' to '" +
2946 toString(userXRangeBaseline.second) +
"' which in bins is from '" +
2960 const float baseline(accumulate(baselineBegin,baselineEnd,0.f) /
2961 static_cast<float>(distance(baselineBegin,baselineEnd)));
2968 const float halfMax((*maxElementIt+baseline) *
_userFraction);
2971 for ( ; stepIt != maxElementIt ; stepIt++ )
2972 if ( *(stepIt-1) <= halfMax && halfMax < *stepIt )
2974 const size_t steppos(distance(one.
begin(),stepIt));
3013 if (hist.dim() != 1)
3014 throw invalid_argument(
"pp87::loadSettings()'" +
name() +
3015 "': Error the processor we depend on '" +
_pHist->name() +
3016 "' does not contain a 1D result.");
3018 pair<float,float> userXRange(make_pair(s.
value(
"XLow",0).toFloat(),
3019 s.
value(
"XUp",1).toFloat()));
3020 if (userXRange.first >= userXRange.second)
3021 throw invalid_argument(
"pp87::loadSettings: '"+
name()+
"' XLow '" +
3023 "' is bigger or equal to XUp '" +
3024 toString(userXRange.second) +
"'");
3025 _xRange.first = xaxis.bin(userXRange.first);
3026 _xRange.second = xaxis.bin(userXRange.second);
3028 throw invalid_argument(
"pp87::loadSettings: '" +
name() +
3029 "': XLow '" +
toString(userXRange.first) +
3030 "' is giving the the same column as XUp '" +
3031 toString(userXRange.second) +
"'");
3033 throw invalid_argument(
"pp87::loadSettings: '" +
name() +
3034 "': XLow '" +
toString(userXRange.first) +
3035 "' is smaller than the lowest possible value '" +
3037 if (static_cast<int>(xaxis.nBins) <
_xRange.first)
3038 throw invalid_argument(
"pp87::loadSettings: '" +
name() +
3039 "': XLow '" +
toString(userXRange.first) +
3040 "' is higher than the highest possible value '" +
3043 throw invalid_argument(
"pp87::loadSettings: '" +
name() +
3044 "': XUp '" +
toString(userXRange.second) +
3045 "' is smaller than the lowest possible value '" +
3047 if (static_cast<int>(xaxis.nBins) <
_xRange.second)
3048 throw invalid_argument(
"pp87::loadSettings: '" +
name() +
3049 "': XUp '" +
toString(userXRange.second) +
3050 "' is higher than the highest possible value '" +
3055 "' returns the center of mass in '" +
_pHist->name() +
3056 "' in the range from xlow '" +
toString(userXRange.first) +
3057 "' to xup '" +
toString(userXRange.second) +
3060 "' .Condition on processor '"+
_condition->name()+
"'");
3074 integral += (data[i]);
3075 const float pos(xAxis.pos(i));
3076 weight += (data[i]*pos);
3078 const float com(weight/integral);
3109 QString axisparam(s.
value(
"AxisParameter",
"XNbrBins").toString());
3110 if (axisparam ==
"XNbrBins")
3115 else if (axisparam ==
"XLow")
3120 else if (axisparam ==
"XUp")
3125 else if (axisparam ==
"YNbrBins")
3130 else if (axisparam ==
"YLow")
3135 else if (axisparam ==
"YUp")
3141 throw invalid_argument(
"pp88 '" +
name() +
"' AxisParameter '" +
3142 axisparam.toStdString() +
"' is unknown.");
3144 if (
_pHist->result().dim() == 0)
3145 throw invalid_argument(
"pp88 '" +
name() +
"' result '" +
_pHist->name() +
3146 "' has dimension 0, which has no axis properties.");
3148 if ((axisparam ==
"YNbrBins" || axisparam ==
"YLow" || axisparam ==
"YUp")
3149 &&
_pHist->result().dim() == 1)
3150 throw invalid_argument(
"pp88 '" +
name() +
"' result '" +
_pHist->name() +
3151 "' has dimension 1 thus doesn't contain '" +
3152 axisparam.toStdString() +
"'");
3156 "' returns axis parameter'"+ axisparam.toStdString() +
3157 "' of result in processor '" +
_pHist->name() +
3158 "'. Condition on Processor '" +
_condition->name() +
"'");
3196 const float RC(1.f/(s.
value(
"Cutoff",100.f).toFloat() * 2 * 3.1415));
3197 const float dt(1.f/s.
value(
"SampleRate",100.f).toFloat());
3199 QString filtertype(s.
value(
"FilterType",
"LowPass").toString());
3200 if (filtertype ==
"LowPass")
3208 else if (filtertype ==
"HighPass")
3217 throw invalid_argument(
"pp89 '" +
name() +
"' FilterType '" +
3218 filtertype.toStdString() +
"' is unknown.");
3220 if (
_pHist->result().dim() != 1)
3221 throw invalid_argument(
"pp89 '" +
name() +
"' result '" +
_pHist->name() +
3222 "' is not a 1D result");
3226 "' does "+ filtertype.toStdString() +
3227 "' operation on result in processor '" +
_pHist->name() +
3228 "'. Condition on Processor '" +
_condition->name() +
"'");
3244 *filtered =
_alpha * (*(filtered-1) + *orig - *(orig-1));
3261 *filtered = *(filtered-1) + (
_alpha * (*orig - *(filtered-1)));
3274 while (inIt != inEnd)
3307 if (
input.dim() != 1)
3308 throw invalid_argument(
"pp91::loadSettings()'" +
name() +
3309 "': Error the processor we depend on '" +
input.name() +
3310 "' does not contain a 1D result.");
3313 string extremePointTypes(s.
value(
"ExtremePointType",
"minima").toString().toStdString());
3314 if (extremePointTypes ==
"minima")
3315 _op = greater<result_t::value_t>();
3316 else if (extremePointTypes ==
"maxima")
3317 _op = less<result_t::value_t>();
3319 throw invalid_argument(
"pp91::loadSettings()'" +
name() +
3320 "': extreme point type '" + extremePointTypes +
3321 "' is unrecognized");
3325 "' returns a list of local " + extremePointTypes +
" in '" +
3326 _input->name() +
"'. The local " + extremePointTypes +
" are the " +
3328 "' .Condition on processor '"+
_condition->name() +
"'");
3343 if (!std::isfinite(data[i]))
3346 float curval(data[i]);
3347 bool isExtreme(
true);
3350 if(isnan(data[j]) ||
_op(curval,data[j]))
3358 candidate[
Index] = i;
3359 candidate[
Position] = xAxis.pos(i);
3360 candidate[
Value] = data[i];
std::tr1::function< result_t::value_t()> _scale
function that will return the scale that should be used for the average
virtual void process(const CASSEvent &, result_t &)
process event
CachedList::item_type result_t
define the results
result_t::value_t cumulativeScale()
retrieve the cumulative scale for the current datum
shared_pointer _two
processor containing 0D result
result_t::value_t _weight
the constant weight
storage_t::const_iterator const_iterator
a const iterator on the storage
virtual void process(const CASSEvent &, result_t &)
process event
func_t _histogram
function used for histogramming
result_t::value_t movingScale()
retrieve the moving average scale after the initialization of the "first" point
std::pair< int, int > _baselineRange
range we want to have the baseline for the integral over in result bins
void appendRows(const storage_t &rows)
add row(s) to the result
value_t getValue() const
return the value
shared_pointer _pHist
processor containing the 2d result we want to project
Event to store all LCLS Data.
result_t::value_t _alpha
alpha for the running average
std::tr1::function< result_t::value_t(const result_t::axe_t &)> _func
function to retrieve the parameter from the axis
virtual void createHistList(result_t::shared_pointer result)
create result list.
void applyConstantThreshold(const result_t &in, result_t &out, const CASSEvent::id_t &id)
apply a constant threshold
shared_pointer _pHist
processor containing result to store
virtual void process(const CASSEvent &, result_t &)
process event
bool fuzzycompare(const T &first, const T &second)
fuzzy compare two floating point variables
const_iterator end() const
retrieve iterator to the end of storage
virtual void process(const CASSEvent &, result_t &)
process event
virtual void loadSettings(size_t)
load the settings of the pp
pp57(const name_t &name)
constructor
pp64(const name_t &)
constructor
float baselineFromInput(const result_t &input)
get the baseline for the integration
shared_pointer _weightInput
processor containing the weights
std::vector< value_t > storage_t
the storage of this container
binaryoperation_t _op
the operand
std::pair< int, int > _xRangeStep
the requested x-axis limits for find the step in bins
pp65(const name_t &name)
constructor
virtual void loadSettings(size_t)
load the settings
const item_type & latest() const
retrieve the latest item
virtual void process(const CASSEvent &evt, result_t &)
process event
const name_t name() const
retrieve the name of this processor
virtual void process(const CASSEvent &, result_t &)
process event
pp86(const name_t &name)
constructor
void histogramAndBinCountWithWeights(CASSEvent::id_t id, result_t::const_iterator in, result_t::const_iterator last, result_t &result)
histogam with weights from another processor
pp40(const name_t &name)
constructor
result_t::value_t _userVal
the value that will be set
float value_t
the values of this container
std::tr1::function< void(result_t::const_iterator, result_t::iterator)> _func
function to retrieve the parameter from the axis
void highPass(result_t::const_iterator orig, result_t::iterator filtered)
high pass filtering function
virtual void loadSettings(size_t)
load the settings
result_t::value_t cummulativeStatistics(const result_t &res)
retrieve the statistics value from the cummulative statistics calculator
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
std::tr1::function< cumstat_t::value_type(const cumstat_t &)> _val
the type of function used to retrive the wanted element
result_t::axe_t _origYAxis
y-axis object of the original size (without the nbr fills part)
std::vector< uint64_t > _list
the list of ids
float constantBaseline(const result_t &)
get constant baseline
result_t _previous
the previous result
shared_pointer _input
processor containing input result
std::tr1::function< result_t::value_t(const result_t &)> _value
function to retrieve the statistics type
pp69(const name_t &name)
constructor
shared_pointer _hist
processor containing input result
virtual void loadSettings(size_t)
load the settings of the pp
void histogramWithWeightFrom0D(CASSEvent::id_t id, result_t::const_iterator in, result_t::const_iterator last, result_t &result)
histogam with weight from 0D processor
virtual void loadSettings(size_t)
load the settings of the pp
Processor::result_t::shared_pointer set2DHist(const Processor::name_t &name)
function to set the 2d histogram properties from the ini file.
pp78(const name_t &name)
constructor
void assign(const self_type &in)
copy the contents of a different result to this result
void lowPass(result_t::const_iterator orig, result_t::iterator filtered)
low pass filtering function
shared_pointer _one
pp containing input result
result_t::value_t _difference
the maximum difference to previous val that is accepted
size_type size() const
return the raw size of the storage
void histogramAndBinCountWithConstant(CASSEvent::id_t unused, result_t::const_iterator in, result_t::const_iterator last, result_t &result)
histogam with user provided constant weight
result_t::value_t _threshold
the threshold
pp66(const name_t &name)
constructor
shared_pointer _one
processor containing result
uint64_t id_t
define the id type
virtual void loadSettings(size_t)
load the settings of the pp
shared_pointer _yInput
processor containing Y-axis value
shared_pointer _pHist
processor containing input result
virtual void loadSettings(size_t)
load the settings of the pp
bool _hide
flag to tell whether this pp should be hidden in the dropdown list
statistics calculator for a cummulative statistic
virtual void loadSettings(size_t)
load the settings
file contains processors that will operate on results of other processors
an axis of a more than 0 dimensional container
virtual void process(const CASSEvent &, result_t &)
process event
virtual void process(const CASSEvent &, result_t &)
process event
result_t::value_t _previousVal
the value of the previous event
virtual void process(const CASSEvent &, result_t &)
process event
float _excludeVal
the value that should be excluded in the summation
std::string title
the title of the axis
virtual void process(const CASSEvent &, result_t &)
process event
void histogramAndBinCountWithConstant(CASSEvent::id_t unused, result_t::const_iterator xin, result_t::const_iterator xlast, result_t::const_iterator yin, result_t &result)
histogam with constant weight
void resetTable()
reset the table like result
ForwardIterator min_element(ForwardIterator first, ForwardIterator last)
provide own implementation of min_element to be able to compile
unaryoperation_t ValAtFirst(result_t::value_t val)
bind the value to the first parameter of the binaryoperation
size_t bin(const Axis< AxisPrecessionType > &xaxis, const ResultValueType &value)
calculate the index of the lineared array
void histogramAndBinCountWithWeightFrom0D(CASSEvent::id_t id, result_t::const_iterator in, result_t::const_iterator last, result_t &result)
histogam with weights from 0D processor
shared_pointer _two
processor containing input when false result
size_t _nX
the size of the original image in X
shared_pointer _one
processor containing x-axis 0D result
virtual void process(const CASSEvent &, result_t &)
process event
shared_pointer _two
processor containing y-axis 0D result
size_t _nbrEventsAccumulated
the number of events the processor has accumulated
shared_pointer _hist
processor containing input result
shared_pointer _input
pp containing input histogram
void projectToY(result_t::const_iterator src, result_t::iterator result, result_t::iterator norm)
integrate the columns
void histogramAndBinCountWithWeights(CASSEvent::id_t id, result_t::const_iterator xin, result_t::const_iterator xlast, result_t::const_iterator yin, result_t &result)
histogam with weights from another processor
virtual void loadSettings(size_t)
load the settings of this pp
result_t::value_t _weight
the weight in case it is a constant
pp50(const name_t &name)
constructor
virtual void process(const CASSEvent &, result_t &)
process event
pp1(const name_t &name)
constructor
std::tr1::function< bool(const result_t::value_t &, const result_t::value_t &)> _op
operation to find the extreme point
size_t nBins
the number of bins in this axis
virtual void loadSettings(size_t)
load the settings of the pp
virtual void process(const CASSEvent &, result_t &)
process event
pp68(const name_t &name)
constructor
virtual void process(const CASSEvent &, result_t &)
process event
std::pair< int, int > _range
range we want to have the integral over in result bins
uint64_t id() const
retrieve the id of the result
result_t::value_t checkrange(result_t::value_t val, result_t::value_t checkval)
check if value is in range and return another value
std::tr1::function< result_t::const_iterator(result_t::const_iterator, result_t::const_iterator)> _func
the type of function used to retrive the wanted bin
pp89(const name_t &name)
constructor
void histogramWithConstant(CASSEvent::id_t unused, result_t::const_iterator in, result_t::const_iterator last, result_t &result)
histogam with user provided constant weight
shared_pointer _threshold
pp containing threshold result
value_type mean() const
retrieve the mean of the distribution
pp63(const name_t &)
constructor
virtual void loadSettings(size_t)
load the settings of the pp
shared_pointer _hist
pp containing the value to check
uint32_t _first_fiducials
time when the first samples was used in the point in time
virtual void process(const CASSEvent &, result_t &)
process event
virtual void loadSettings(size_t)
load the settings of the pp
void applyIdxwiseThreshold(const result_t &in, result_t &out, const CASSEvent::id_t &id)
apply a indexwise threshold
shared_pointer _one
pp containing X-axis 1D result to combine
result_t::value_t _value
the value for the unary operation
static void add(Level level, const std::string &line)
add a string to the log
pp75(const name_t &name)
constructor
void setValue(const_reference value)
assign the result container to a value
const_iterator begin() const
retrieve a iterator for read access to beginning
iter_type newItem(const id_type &id)
get an item for processing
virtual void loadSettings(size_t)
load the settings
std::pair< int, int > _xRange
the requested x-axis limits in bins
fromStdString(const std::string &str)
result_t::value_t medianCalc(const result_t &res)
retrieve the statistics value from the median statistics calculator
size_t _range
the requested x-axis limits in histogram coordinates
pp76(const name_t &name)
constructor
bool isTrue() const
evaluate whether value is zero
std::tr1::function< void(result_t::const_iterator, result_t::iterator, result_t::iterator)> _project
the function used to project the image
ForwardIterator max_element(ForwardIterator first, ForwardIterator last)
provide own implementation of min_element to be able to compile
void histogramWithConstant(CASSEvent::id_t unused, result_t::const_iterator xin, result_t::const_iterator xlast, result_t::const_iterator yin, result_t &result)
histogam with constant weight
std::pair< int, int > _offset
offset in x and y to the first bin of the input
shared_pointer _pHist
processor containing input result
result_t::storage_t table_t
definition of the table
shared_pointer _pHist
processor containing input result
void projectToY(result_t::const_iterator src, result_t::iterator dest)
project 2d result to y axis
shared_pointer _pHist
processor containing input result
virtual void process(const CASSEvent &, result_t &)
process event
base class for processors.
shared_pointer setupDependency(const std::string &depVarName, const name_t &name="")
setup the dependecy.
size_t _num_seen_evt
the number of samples seen up to now and used in the point
std::tr1::function< void(result_t::const_iterator, result_t::iterator)> _project
function that will do the projection
const axis_t & axis() const
read access to the axis
pp85(const name_t &name)
constructor
time_t _when_first_evt
time when the first samples was used in the point in time
virtual void loadSettings(size_t)
load the settings of the pp
pp82(const name_t &name)
constructor
shared_pointer _hist
processor containing input result
std::tr1::function< result_t::value_t(result_t::value_t)> unaryoperation_t
define the unary operation
void histogramWithWeights(CASSEvent::id_t id, result_t::const_iterator in, result_t::const_iterator last, result_t &result)
histogam with weights from another processor
CachedList _resultList
the list of results
virtual void loadSettings(size_t)
load the settings of the pp
result_t::axis_name _axisId
the id of the axis
std::pair< int, int > _xRange
the requested x-axis limits in bins
shared_pointer _pHist
processor containing input result
virtual void loadSettings(size_t)
load the settings of this pp
pp41(const name_t &name)
constructor
virtual void process(const CASSEvent &, result_t &)
process event
virtual void process(const CASSEvent &, result_t &)
process event
file contains declaration of classes and functions that help other processors to do their job...
shared_pointer _one
pp containing input result
virtual void loadSettings(size_t)
load the settings of this pp
std::tr1::function< result_t::value_t(result_t::value_t, result_t::value_t)> _op
the operand
virtual void process(const CASSEvent &, result_t &)
process event
float _userFraction
user fraction of the height between low and up
setParamPos_t _setParamPos
function to set the value to the requested parameter position
virtual void loadSettings(size_t)
load the settings of this pp
pp77(const name_t &name)
constructor
virtual void loadSettings(size_t)
load the settings of the pp
virtual const result_t & result(const CASSEvent::id_t eventid=0)
overwrite the retrieval of an result
QReadWriteLock lock
lock for locking operations on the data of the container
result_t::value_t _userVal
the user value that will be set when the threshold is applied
shared_pointer _pHist
processor containing input result
value_type sum() const
retrieve the sum of all dati that have been added
virtual void loadSettings(size_t)
load the settings of this pp
virtual void loadSettings(size_t)
load the settings of this pp
virtual void loadSettings(size_t)
load the settings of the pp
pp61(const name_t &name)
constructor
virtual void loadSettings(size_t)
load the settings
shared_pointer _pHist
processor containing the 2d result we want to project
pp71(const name_t &name)
constructor
file contains global definitions for project cass
pp91(const name_t &name)
constructor
shared_pointer _one
processor containing first result
result_t::value_t valueFromPP(const CASSEvent::id_t &id)
retrieve value from Processor
shared_pointer _pHist
processor containing result to sum
virtual void process(const CASSEvent &, result_t &)
process event
size_t _size
the number of bins in the result, range is fixed
pp70(const name_t &name)
constructor
virtual void process(const CASSEvent &, result_t &)
process event
std::string toString(const Type &t)
convert any type to a string
shared_pointer _pHist
processor containing input result
result_t::value_t squareAverage(result_t::value_t val, result_t::value_t aveOld, result_t::value_t scale)
function that will calculate the square average
auxiliary data[Processor]
shared_pointer _valuePP
processor containing 0D value for the unary operation
shared_pointer _two
processor containing the second result
shared_pointer _pHist
processor containing result to average
pp87(const name_t &name)
constructor
valueRetrieval_t _retrieveValue
function to retrieve the value for the unary operation
std::pair< result_t::value_t, result_t::value_t > _range
the requested range that the value should be in
binary function for averaging.
shared_pointer _xInput
processor containing X axis value
result_t::value_t threshold(const result_t::value_t &value, const result_t::value_t &thres)
the thresholding function
result_t::shared_pointer _res
the constant result
pp51(const name_t &name)
constructor
value(const QString &key, const QVariant &defaultValue=QVariant()
std::pair< int, int > _xRange
range we want to project
shared_pointer _one
processor containing result
pp2(const name_t &name)
constructor
virtual void createHistList(result_t::shared_pointer result)
create the list of results
shared_pointer _one
processor containing the first result
virtual void processEvent(const CASSEvent &)
process event
shared_pointer _weightProc
processor containing the weight
storage_t::iterator iterator
a iterator on the storage
value_t low
lower end of the axis
virtual void process(const CASSEvent &evt, result_t &)
process event
std::pair< size_t, size_t > _timerange
range of time that we use for the angular distribution
virtual void loadSettings(size_t)
load the settings of this pp
std::pair< int, int > _xRangeBaseline
the requested x-axis limits for find the baseline in bins
virtual void process(const CASSEvent &, result_t &)
process event
shared_pointer _pHist
processor containing result to work on
void setupGeneral()
general setup of the processor
void histogramWithWeightFrom0DInput(CASSEvent::id_t id, result_t::const_iterator xin, result_t::const_iterator xlast, result_t::const_iterator yin, result_t &result)
histogam with constant weight from input
value_t up
upper end of the axis
std::tr1::function< result_t::const_iterator(result_t::const_iterator, result_t::const_iterator)> _func
the type of function used to retrive the wanted element
virtual void loadSettings(size_t)
load the settings of this pp
result_t::value_t _upperBound
the upper boundary of the range
float _fraction
the fraction of the range
pp13(const name_t &name)
constructor
std::tr1::function< void(const result_t &, result_t &, const CASSEvent::id_t &)> _applyThresh
the funtion that applies the threshold to the input
virtual void loadSettings(size_t)
load the settings
file contains specialized class that do the settings for cass
virtual const result_t & result(const CASSEvent::id_t eventid=0)
overwrite the retrieval of an result
pp4(const name_t &name)
constructor
result_t::value_t movingInitializationScale()
retrieve the moving average scale during the initialization
result_t::value_t valueFromConst(const CASSEvent::id_t &evt)
retrieve value constant
shared_pointer _input
processor containing the 1d result we want to integrate
iterator histogram(const value_t &pos, const value_t &weight=1)
add the weight at the right bin for the value in the 1d array
Example of how to use the sacla online input
virtual void loadSettings(size_t)
load the settings of the pp
pp12(const name_t &)
constructor
void projectToX(result_t::const_iterator src, result_t::iterator result, result_t::iterator norm)
integrate the rows
pp81(const name_t &name)
constructor
std::tr1::function< result_t::value_t(result_t::value_t, result_t::value_t, result_t::value_t)> _func
function that will do the averagin
virtual void process(const CASSEvent &, result_t &)
process event
virtual void processEvent(const CASSEvent &)
overwrite process event
an accumulating processor
pp14(const name_t &name)
constructor
void projectToX(result_t::const_iterator src, result_t::iterator dest)
project 2d result to x axis
list_type::iterator iter_type
define an iterator for the list
virtual void process(const CASSEvent &, result_t &)
process event
result_t::shared_pointer _result
the result that accumulates the events
virtual void loadSettings(size_t)
load the settings
void histogramWithWeights(CASSEvent::id_t id, result_t::const_iterator xin, result_t::const_iterator xlast, result_t::const_iterator yin, result_t &result)
histogam with weights from another processor
std::pair< int, int > _Xrange
range in X we want to project
shared_pointer _condition
pointer to the processor that will contain the condition
pp56(const name_t &name)
constructor
shared_pointer _two
pp containing Y-axis 1D result to combine
Processor::result_t::shared_pointer set1DHist(const Processor::name_t &name)
function to set the 1d histogram properties from the ini file.
virtual void process(const CASSEvent &, result_t &)
process event
shared_pointer _input
processor containing result to histogram
void addDistribution(InputIterator first, InputIterator last)
add a number of dati to the distribution
size_t _nX
the nbr of bins in the original image
unaryoperation_t ValAtSecond(result_t::value_t val)
bind the value to the second parameter of the binaryoperation
shape_t shape() const
return the shape of the result
virtual void loadSettings(size_t)
load the settings of the pp
bool setupCondition(bool defaultConditionType=true)
setup the condition.
virtual void processEvent(const CASSEvent &)
overwrite process event
std::string name_t
define the name type
virtual void process(const CASSEvent &, result_t &)
process event
float _alpha
factor used for filtering
std::tr1::function< float(const result_t &)> _baseline
the function that will return the baseline
pp88(const name_t &name)
constructor
contains a logger for cass
pp60(const name_t &name)
constructor
pp9(const name_t &name)
constructor
virtual void process(const CASSEvent &, result_t &)
process event
std::pair< int, int > _yRange
range we want to project
virtual void loadSettings(size_t)
load the settings of the pp
pp62(const name_t &)
constructor
virtual void process(const CASSEvent &, result_t &)
process event
result_t::value_t average(result_t::value_t val, result_t::value_t aveOld, result_t::value_t scale)
function for normal averaging.
virtual void process(const CASSEvent &, result_t &)
process event
check if there is some light in the chamber based upon the GMD value
size_t _nbrSamples
the number of bins in the result, range is fixed
virtual void process(const CASSEvent &, result_t &)
process event
size_type datasize() const
return the size of the data as determined by the axis
virtual void process(const CASSEvent &, result_t &)
process event
shared_pointer _threshPP
pp containing the indexwise threshold
virtual void loadSettings(size_t)
load the settings of the pp
std::pair< int, int > _Yrange
range in Y we want to project
void histogramAndBinCountWithWeightFrom0DInput(CASSEvent::id_t id, result_t::const_iterator xin, result_t::const_iterator xlast, result_t::const_iterator yin, result_t &result)
histogam with constant weight from input
value_type stdv() const
retrieve the standart deviation of the distribution
shared_pointer _one
processor containing the 1D result
beginGroup(const QString &prefix)
virtual void loadSettings(size_t)
load the settings
value_type variance() const
retrieve the variance of the distribution
virtual void loadSettings(size_t)
load the settings of this pp
shared_pointer _one
processor containing input when true result
pp15(const name_t &name)
constructor
func_t _histogram
the function to histogram the values
result_t::value_t _lowerBound
the lower boundary of the range
virtual void process(const CASSEvent &, result_t &)
process event
virtual void loadSettings(size_t)
load the settings of the pp
virtual void loadSettings(size_t)
load the settings of the pp
virtual const result_t & result(const CASSEvent::id_t eventid=0)
retrieve a result for a given id.
virtual void loadSettings(size_t)
load the settings of the pp
shared_pointer _pHist
processor containing the input result
virtual void loadSettings(size_t)
load the settings of the pp