24 using namespace PhysicsTools;
33 ~ProcNormalize()
override {}
35 void configure(ConfIterator iter,
unsigned int n)
override;
36 void eval(ValueIterator iter,
unsigned int n)
const override;
37 std::vector<double> deriv(ValueIterator iter,
unsigned int n)
const override;
50 void findMap(ValueIterator iter,
52 std::vector<Map>::const_iterator &
begin,
53 std::vector<Map>::const_iterator &
end)
const;
55 std::vector<Map> maps;
57 unsigned int nCategories;
64 maps(calib->distr.
begin(), calib->distr.
end()),
65 categoryIdx(calib->categoryIdx),
68 void ProcNormalize::configure(ConfIterator iter,
unsigned int n) {
69 if (categoryIdx >= 0) {
70 if ((
int)n < categoryIdx + 1)
72 nCategories = maps.size() / (n - 1);
73 if (nCategories * (n - 1) != maps.size())
75 }
else if (n != maps.size())
80 if (categoryIdx == i++)
81 iter++(Variable::FLAG_NONE);
83 iter << iter++(Variable::FLAG_ALL);
87 void ProcNormalize::findMap(ValueIterator iter,
89 std::vector<Map>::const_iterator &
begin,
90 std::vector<Map>::const_iterator &
end)
const {
91 if (categoryIdx >= 0) {
92 ValueIterator iter2 = iter;
93 for (
int i = 0; i < categoryIdx; i++)
96 int cat = (int)*iter2;
97 if (cat < 0 || (
unsigned int)cat >= nCategories) {
103 begin = maps.begin() + cat * (n - 1);
104 end = begin + (n - 1);
106 begin = maps.begin();
111 void ProcNormalize::eval(ValueIterator iter,
unsigned int n)
const {
112 std::vector<Map>::const_iterator map,
last;
113 findMap(iter, n, map, last);
115 for (
int i = 0; map !=
last; ++iter, i++) {
116 if (i == categoryIdx)
120 val = (val - map->min) / map->width;
121 val = map->spline.integral(val);
129 std::vector<double> ProcNormalize::deriv(ValueIterator iter,
unsigned int n)
const {
130 std::vector<Map>::const_iterator map,
last;
131 findMap(iter, n, map, last);
133 unsigned int size = 0;
134 for (ValueIterator iter2 = iter; iter2; ++iter2)
135 size += iter2.size();
137 std::vector<double>
result(size * size);
140 for (
int i = 0; map !=
last; ++iter, i++) {
141 if (i == categoryIdx) {
148 val = (val - map->min) / map->width;
149 val = map->spline.eval(val) * (map->spline.numberOfEntries() - 1) / (map->width * map->spline.getArea());
const uint16_t range(const Frame &aFrame)
tuple size
Write out results.