1 #ifndef NPSTAT_HISTOND_HH_ 2 #define NPSTAT_HISTOND_HH_ 42 template <
typename Numeric,
class Axis=HistoAxis>
45 template <
typename Num2,
class Axis2>
friend class HistoND;
75 const Axis&
zAxis,
const Axis& tAxis,
80 const Axis&
zAxis,
const Axis& tAxis,
const Axis& vAxis,
97 template <
typename Num2,
class Functor>
108 template <
typename Num2>
110 unsigned nIndices,
const char*
title=0);
121 template <
typename Num2>
123 unsigned newAxisNumber,
const char*
title=0);
142 template <
typename Num2>
144 const unsigned *newBinCounts,
unsigned lenNewBinCounts,
145 const double* shifts=0,
const char*
title=0);
173 inline const std::vector<Axis>&
axes()
const {
return axes_;}
176 inline const Axis&
axis(
const unsigned i)
const 177 {
return axes_.at(i);}
222 double* coords,
unsigned lenCoords)
const;
231 template <
class Po
int>
277 template <
typename Num2>
278 void fill(
const double* coords,
unsigned coordLength,
286 template <
typename Num2>
287 void fill(
const Num2& weight);
289 template <
typename Num2>
290 void fill(
double x0,
const Num2& weight);
292 template <
typename Num2>
293 void fill(
double x0,
double x1,
const Num2& weight);
295 template <
typename Num2>
296 void fill(
double x0,
double x1,
double x2,
const Num2& weight);
298 template <
typename Num2>
299 void fill(
double x0,
double x1,
double x2,
double x3,
302 template <
typename Num2>
303 void fill(
double x0,
double x1,
double x2,
double x3,
double x4,
306 template <
typename Num2>
307 void fill(
double x0,
double x1,
double x2,
double x3,
double x4,
308 double x5,
const Num2& weight);
310 template <
typename Num2>
311 void fill(
double x0,
double x1,
double x2,
double x3,
double x4,
312 double x5,
double x6,
const Num2& weight);
314 template <
typename Num2>
315 void fill(
double x0,
double x1,
double x2,
double x3,
double x4,
316 double x5,
double x6,
double x7,
const Num2& weight);
318 template <
typename Num2>
319 void fill(
double x0,
double x1,
double x2,
double x3,
double x4,
320 double x5,
double x6,
double x7,
double x8,
323 template <
typename Num2>
324 void fill(
double x0,
double x1,
double x2,
double x3,
double x4,
325 double x5,
double x6,
double x7,
double x8,
double x9,
342 template <
typename Num2,
class Functor>
343 void dispatch(
const double* coords,
unsigned coordLength,
344 Num2& weight, Functor&
f);
351 template <
typename Num2,
class Functor>
352 void dispatch(Num2& weight, Functor& f);
354 template <
typename Num2,
class Functor>
355 void dispatch(
double x0, Num2& weight, Functor& f);
357 template <
typename Num2,
class Functor>
358 void dispatch(
double x0,
double x1, Num2& weight, Functor& f);
360 template <
typename Num2,
class Functor>
361 void dispatch(
double x0,
double x1,
double x2, Num2& weight,
364 template <
typename Num2,
class Functor>
365 void dispatch(
double x0,
double x1,
double x2,
double x3,
366 Num2& weight, Functor& f);
368 template <
typename Num2,
class Functor>
369 void dispatch(
double x0,
double x1,
double x2,
double x3,
double x4,
370 Num2& weight, Functor& f);
372 template <
typename Num2,
class Functor>
373 void dispatch(
double x0,
double x1,
double x2,
double x3,
double x4,
374 double x5, Num2& weight, Functor& f);
376 template <
typename Num2,
class Functor>
377 void dispatch(
double x0,
double x1,
double x2,
double x3,
double x4,
378 double x5,
double x6, Num2& weight, Functor& f);
380 template <
typename Num2,
class Functor>
381 void dispatch(
double x0,
double x1,
double x2,
double x3,
double x4,
382 double x5,
double x6,
double x7, Num2& weight,
385 template <
typename Num2,
class Functor>
386 void dispatch(
double x0,
double x1,
double x2,
double x3,
double x4,
387 double x5,
double x6,
double x7,
double x8,
388 Num2& weight, Functor& f);
390 template <
typename Num2,
class Functor>
391 void dispatch(
double x0,
double x1,
double x2,
double x3,
double x4,
392 double x5,
double x6,
double x7,
double x8,
double x9,
393 Num2& weight, Functor& f);
402 const Numeric&
examine(
const double* coords,
403 unsigned coordLength)
const;
410 const Numeric&
examine()
const;
412 const Numeric&
examine(
double x0)
const;
414 const Numeric&
examine(
double x0,
double x1)
const;
416 const Numeric&
examine(
double x0,
double x1,
double x2)
const;
418 const Numeric&
examine(
double x0,
double x1,
double x2,
421 const Numeric&
examine(
double x0,
double x1,
double x2,
double x3,
424 const Numeric&
examine(
double x0,
double x1,
double x2,
double x3,
425 double x4,
double x5)
const;
427 const Numeric&
examine(
double x0,
double x1,
double x2,
double x3,
428 double x4,
double x5,
double x6)
const;
430 const Numeric&
examine(
double x0,
double x1,
double x2,
double x3,
431 double x4,
double x5,
double x6,
434 const Numeric&
examine(
double x0,
double x1,
double x2,
double x3,
435 double x4,
double x5,
double x6,
double x7,
438 const Numeric&
examine(
double x0,
double x1,
double x2,
double x3,
439 double x4,
double x5,
double x6,
double x7,
440 double x8,
double x9)
const;
449 const Numeric&
closestBin(
const double* coords,
450 unsigned coordLength)
const;
461 const Numeric&
closestBin(
double x0,
double x1)
const;
463 const Numeric&
closestBin(
double x0,
double x1,
double x2)
const;
465 const Numeric&
closestBin(
double x0,
double x1,
double x2,
468 const Numeric&
closestBin(
double x0,
double x1,
double x2,
double x3,
471 const Numeric&
closestBin(
double x0,
double x1,
double x2,
double x3,
472 double x4,
double x5)
const;
474 const Numeric&
closestBin(
double x0,
double x1,
double x2,
double x3,
475 double x4,
double x5,
double x6)
const;
477 const Numeric&
closestBin(
double x0,
double x1,
double x2,
double x3,
478 double x4,
double x5,
double x6,
481 const Numeric&
closestBin(
double x0,
double x1,
double x2,
double x3,
482 double x4,
double x5,
double x6,
double x7,
485 const Numeric&
closestBin(
double x0,
double x1,
double x2,
double x3,
486 double x4,
double x5,
double x6,
double x7,
487 double x8,
double x9)
const;
512 template <
typename Num2>
513 void fillC(
const double* coords,
unsigned coordLength,
521 template <
typename Num2>
522 void fillC(
const Num2& weight);
524 template <
typename Num2>
525 void fillC(
double x0,
const Num2& weight);
527 template <
typename Num2>
528 void fillC(
double x0,
double x1,
const Num2& weight);
530 template <
typename Num2>
531 void fillC(
double x0,
double x1,
double x2,
const Num2& weight);
533 template <
typename Num2>
534 void fillC(
double x0,
double x1,
double x2,
double x3,
537 template <
typename Num2>
538 void fillC(
double x0,
double x1,
double x2,
double x3,
double x4,
541 template <
typename Num2>
542 void fillC(
double x0,
double x1,
double x2,
double x3,
double x4,
543 double x5,
const Num2& weight);
545 template <
typename Num2>
546 void fillC(
double x0,
double x1,
double x2,
double x3,
double x4,
547 double x5,
double x6,
const Num2& weight);
549 template <
typename Num2>
550 void fillC(
double x0,
double x1,
double x2,
double x3,
double x4,
551 double x5,
double x6,
double x7,
const Num2& weight);
553 template <
typename Num2>
554 void fillC(
double x0,
double x1,
double x2,
double x3,
double x4,
555 double x5,
double x6,
double x7,
double x8,
558 template <
typename Num2>
559 void fillC(
double x0,
double x1,
double x2,
double x3,
double x4,
560 double x5,
double x6,
double x7,
double x8,
double x9,
568 template <
typename Num2>
580 template <
typename Num2>
585 template <
typename Num2>
586 void setBin(
const unsigned *
index,
unsigned indexLen,
const Num2&
v);
588 template <
typename Num2>
589 void setBin(
const Num2& v);
591 template <
typename Num2>
592 void setBin(
unsigned i0,
const Num2& v);
594 template <
typename Num2>
595 void setBin(
unsigned i0,
unsigned i1,
const Num2& v);
597 template <
typename Num2>
598 void setBin(
unsigned i0,
unsigned i1,
unsigned i2,
const Num2& v);
600 template <
typename Num2>
601 void setBin(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
604 template <
typename Num2>
605 void setBin(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
606 unsigned i4,
const Num2& v);
608 template <
typename Num2>
609 void setBin(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
610 unsigned i4,
unsigned i5,
const Num2& v);
612 template <
typename Num2>
613 void setBin(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
614 unsigned i4,
unsigned i5,
unsigned i6,
const Num2& v);
616 template <
typename Num2>
617 void setBin(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
618 unsigned i4,
unsigned i5,
unsigned i6,
unsigned i7,
621 template <
typename Num2>
622 void setBin(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
623 unsigned i4,
unsigned i5,
unsigned i6,
unsigned i7,
624 unsigned i8,
const Num2& v);
626 template <
typename Num2>
627 void setBin(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
628 unsigned i4,
unsigned i5,
unsigned i6,
unsigned i7,
629 unsigned i8,
unsigned i9,
const Num2& v);
631 template <
typename Num2>
638 template <
typename Num2>
639 void setBinAt(
const unsigned *index,
unsigned indexLen,
const Num2& v);
641 template <
typename Num2>
644 template <
typename Num2>
645 void setBinAt(
unsigned i0,
const Num2& v);
647 template <
typename Num2>
648 void setBinAt(
unsigned i0,
unsigned i1,
const Num2& v);
650 template <
typename Num2>
651 void setBinAt(
unsigned i0,
unsigned i1,
unsigned i2,
const Num2& v);
653 template <
typename Num2>
654 void setBinAt(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
657 template <
typename Num2>
658 void setBinAt(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
659 unsigned i4,
const Num2& v);
661 template <
typename Num2>
662 void setBinAt(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
663 unsigned i4,
unsigned i5,
const Num2& v);
665 template <
typename Num2>
666 void setBinAt(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
667 unsigned i4,
unsigned i5,
unsigned i6,
const Num2& v);
669 template <
typename Num2>
670 void setBinAt(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
671 unsigned i4,
unsigned i5,
unsigned i6,
unsigned i7,
674 template <
typename Num2>
675 void setBinAt(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
676 unsigned i4,
unsigned i5,
unsigned i6,
unsigned i7,
677 unsigned i8,
const Num2& v);
679 template <
typename Num2>
680 void setBinAt(
unsigned i0,
unsigned i1,
unsigned i2,
unsigned i3,
681 unsigned i4,
unsigned i5,
unsigned i6,
unsigned i7,
682 unsigned i8,
unsigned i9,
const Num2& v);
684 template <
typename Num2>
690 template <
typename Num2>
692 bool clearOverflows=
true);
695 template <
typename Num2>
696 void setOverflows(
const Num2* data,
unsigned long dataLength);
702 template <
typename Num2>
710 template <
typename Num2>
734 template <
typename Num2>
738 template <
typename Num2>
743 template <
typename Num2>
746 template <
typename Num2>
755 template <
typename Num2>
758 template <
typename Num2>
768 template <
typename Num2>
771 template <
typename Num2>
783 template <
typename Acc>
785 bool calculateAverage =
false)
const;
798 template <
typename Num2,
typename Num3>
801 const unsigned *projectedIndices,
802 unsigned nProjectedIndices)
const;
804 template <
typename Num2,
typename Num3>
807 const unsigned *projectedIndices,
808 unsigned nProjectedIndices)
const;
837 inline gs::ClassId
classId()
const {
return gs::ClassId(*
this);}
838 bool write(std::ostream& of)
const;
843 static HistoND*
read(
const gs::ClassId&
id, std::istream&
in);
852 template <
typename Num2>
855 template <
typename Acc>
857 unsigned*
idx, Acc* accumulator,
858 double overlapFraction,
long double* wsum)
const;
887 template <
typename Histo>
895 template <
typename Histo>
908 template <
typename Histo>
910 bool doubleDataRange);
919 #include "Alignment/Geners/interface/CPP11_auto_ptr.hh" 920 #include "Alignment/Geners/interface/binaryIO.hh" 924 template <
class Axis>
927 const unsigned n = axes.size();
930 for (
unsigned i=0;
i<
n; ++
i)
931 result.push_back(axes[
i].nBins());
935 template <
class Axis>
940 result.push_back(xAxis.nBins());
944 template <
class Axis>
949 result.push_back(xAxis.nBins());
950 result.push_back(yAxis.nBins());
954 template <
class Axis>
961 result.push_back(xAxis.nBins());
962 result.push_back(yAxis.nBins());
963 result.push_back(zAxis.nBins());
967 template <
class Axis>
969 const Axis&
zAxis,
const Axis& tAxis)
973 result.push_back(xAxis.nBins());
974 result.push_back(yAxis.nBins());
975 result.push_back(zAxis.nBins());
976 result.push_back(tAxis.nBins());
980 template <
class Axis>
982 const Axis&
zAxis,
const Axis& tAxis,
987 result.push_back(xAxis.nBins());
988 result.push_back(yAxis.nBins());
989 result.push_back(zAxis.nBins());
990 result.push_back(tAxis.nBins());
991 result.push_back(vAxis.nBins());
995 template <
class Axis>
997 const unsigned *newBins,
998 const unsigned lenNewBins)
1000 const unsigned dim = axes.size();
1002 "In npstat::Private::rebinAxes: invalid length " 1003 "of the new bins array");
1005 std::vector<Axis> newAxes;
1006 newAxes.reserve(dim);
1007 for (
unsigned i=0;
i<
dim; ++
i)
1008 newAxes.push_back(axes[
i].rebin(newBins[
i]));
1012 template <
class Axis>
1014 const unsigned *fixedIndices,
1015 const unsigned nFixedIndices)
1017 const unsigned dim = axes.size();
1018 std::vector<Axis> newAxes;
1020 "In npstat::Private::axesOfASlice: " 1021 "at least one fixed index must be specified");
1023 "In npstat::Private::axesOfASlice: too many fixed indices");
1024 assert(fixedIndices);
1025 for (
unsigned i=0;
i<nFixedIndices; ++
i)
1027 "In npstat::Private::axesOfASlice: fixed index out of range");
1028 newAxes.reserve(dim - nFixedIndices);
1029 for (
unsigned i=0;
i<
dim; ++
i)
1032 for (
unsigned j=0; j<nFixedIndices; ++j)
1033 if (fixedIndices[j] ==
i)
1039 newAxes.push_back(axes[
i]);
1041 if (newAxes.size() != dim - nFixedIndices)
1043 "In npstat::Private::axesOfASlice: duplicate fixed index");
1047 template <
class Axis>
1049 const unsigned *fixedIndices,
1050 const unsigned nFixedIndices)
1052 const unsigned dim = axes.size();
1054 "In npstat::Private::shapeOfASlice: " 1055 "at least one fixed index must be specified");
1057 "In npstat::Private::shapeOfASlice: too many fixed indices");
1058 assert(fixedIndices);
1061 for (
unsigned j=0; j<nFixedIndices; ++j)
1063 "In npstat::Private::shapeOfASlice: fixed index out of range");
1067 if (nFixedIndices < dim)
1068 sh.reserve(dim - nFixedIndices);
1069 for (
unsigned i=0;
i<
dim; ++
i)
1072 for (
unsigned j=0; j<nFixedIndices; ++j)
1073 if (fixedIndices[j] ==
i)
1079 sh.push_back(axes[
i].
nBins());
1081 if (sh.size() != dim - nFixedIndices)
1083 "In npstat::Private::shapeOfASlice: duplicate fixed index");
1087 template <
class Axis>
1089 const Axis& newAxis,
1090 const unsigned newAxisNumber)
1092 const unsigned dim = axes.size();
1093 std::vector<Axis> newAxes;
1094 newAxes.reserve(dim + 1
U);
1096 for (
unsigned i=0;
i<
dim; ++
i)
1098 if (newAxisNumber ==
i)
1099 newAxes.push_back(newAxis);
1101 newAxes.push_back(axes[iadd++]);
1104 newAxes.push_back(newAxis);
1106 newAxes.push_back(axes[iadd]);
1110 template <
class Axis>
1112 const Axis& newAxis,
1113 const unsigned newAxisNumber)
1115 const unsigned dim = axes.size();
1117 result.reserve(dim + 1
U);
1119 for (
unsigned i=0;
i<
dim; ++
i)
1121 if (newAxisNumber ==
i)
1122 result.push_back(newAxis.nBins());
1124 result.push_back(axes[iadd++].
nBins());
1127 result.push_back(newAxis.nBins());
1129 result.push_back(axes[iadd].
nBins());
1135 std::ostringstream os;
1136 os <<
"In npstat::HistoND::" << method <<
": number of arguments" 1137 <<
" is incompatible with histogram dimensionality";
1142 template <
typename Numeric,
class Axis>
1143 template <
typename Acc>
1146 unsigned*
idx, Acc* accumulator,
const double overlapFraction,
1147 long double* wsum)
const 1151 const unsigned nbins = axis.nBins();
1152 const bool lastLevel = level ==
dim_ - 1
U;
1155 const double over = overlapFraction*
1156 axis.binInterval(
i).overlapFraction(boxSide);
1172 template <
typename Numeric,
class Axis>
1173 template <
typename Acc>
1176 const bool calculateAverage)
const 1179 "In npstat::HistoND::accumulateBinsInBox: " 1180 "incompatible box dimensionality");
1181 assert(accumulator);
1184 long double wsum = 0.0L;
1185 for (
unsigned i=0;
i<
dim_; ++
i)
1188 if (calculateAverage && wsum > 0.0
L)
1189 *accumulator *=
static_cast<double>(1.0L/wsum);
1192 *accumulator += 1.0*
data_();
1195 template <
typename Numeric,
class Axis>
1203 template <
typename Numeric,
class Axis>
1211 template <
typename Numeric,
class Axis>
1219 template <
typename Numeric,
class Axis>
1222 :
title_(title ? title :
""),
1232 if (
dim_ >= CHAR_BIT*
sizeof(
unsigned long))
1234 "In npstat::HistoND constructor: requested histogram " 1235 "dimensionality is not supported (too large)");
1239 template <
typename Numeric,
class Axis>
1242 :
title_(title ? title :
""),
1252 axes_.push_back(xAxis);
1256 template <
typename Numeric,
class Axis>
1259 :
title_(title ? title :
""),
1269 axes_.push_back(xAxis);
1270 axes_.push_back(yAxis);
1274 template <
typename Numeric,
class Axis>
1278 :
title_(title ? title :
""),
1288 axes_.push_back(xAxis);
1289 axes_.push_back(yAxis);
1290 axes_.push_back(zAxis);
1294 template <
typename Numeric,
class Axis>
1296 const Axis&
zAxis,
const Axis& tAxis,
1298 :
title_(title ? title :
""),
1308 axes_.push_back(xAxis);
1309 axes_.push_back(yAxis);
1310 axes_.push_back(zAxis);
1311 axes_.push_back(tAxis);
1315 template <
typename Numeric,
class Axis>
1317 const Axis&
zAxis,
const Axis& tAxis,
1320 :
title_(title ? title :
""),
1330 axes_.push_back(xAxis);
1331 axes_.push_back(yAxis);
1332 axes_.push_back(zAxis);
1333 axes_.push_back(tAxis);
1334 axes_.push_back(vAxis);
1338 template <
typename Numeric,
class Axis>
1342 :
title_(title ? title :
""),
1352 "In npstat::HistoND constructor: " 1353 "incompatible bounding box dimensionality");
1354 if (
dim_ >= CHAR_BIT*
sizeof(
unsigned long))
1356 "In npstat::HistoND constructor: requested histogram " 1357 "dimensionality is not supported (too large)");
1359 for (
unsigned i=0;
i<
dim_; ++
i)
1360 axes_.push_back(Axis(shape[
i],
1361 boundingBox[i].
min(),
1362 boundingBox[i].
max()));
1366 template <
typename Numeric,
class Axis>
1367 template <
typename Num2,
class Functor>
1371 :
title_(title ? title :
""),
1385 template <
typename Numeric,
class Axis>
1386 template <
typename Num2>
1389 const unsigned nIndices,
const char*
title)
1390 :
title_(title ? title :
""),
1403 template <
typename Numeric,
class Axis>
1404 template <
typename Num2>
1407 const unsigned newAxisNumber,
const char*
title)
1408 :
title_(title ? title :
""),
1418 if (
dim_ >= CHAR_BIT*
sizeof(
unsigned long))
1420 "In npstat::HistoND constructor: requested histogram " 1421 "dimensionality is not supported (too large)");
1425 template <
typename Numeric,
class Axis>
1426 template <
typename Num2>
1429 const unsigned *newBinCounts,
const unsigned lenNewBinCounts,
1430 const double* shifts,
const char*
title)
1433 data_(newBinCounts, lenNewBinCounts),
1451 for (
unsigned long ibin=0; ibin<newBins; ++ibin)
1455 for (
unsigned i=0;
i<
dim_; ++
i)
1458 for (
unsigned i=0; i<
dim_; ++
i)
1465 const Numeric zero = Numeric();
1467 for (
unsigned long ibin=0; ibin<newBins; ++ibin)
1470 for (
unsigned i=0;
i<
dim_; ++
i)
1471 binLimits[
i] = ax[
i].binInterval(ubuf[
i]);
1474 h.accumulateBinsInBox(binLimits, &thisBin, rType ==
AVERAGE);
1479 template <
typename Numeric,
class Axis>
1482 for (
unsigned i=0;
i<
dim_; ++
i)
1483 if (!
axes_[
i].isUniform())
1488 template <
typename Numeric,
class Axis>
1497 Precise sum =
data_.template sum<Precise>();
1498 return static_cast<double>(sum)*
binVolume();
1502 Precise sum = Precise();
1505 for (
unsigned long i=0;
i<len; ++
i)
1507 return static_cast<double>(sum);
1511 template <
typename Numeric,
class Axis>
1519 for (
unsigned i=0;
i<
dim_; ++
i)
1520 box.push_back(ax[
i].interval());
1525 template <
typename Numeric,
class Axis>
1528 double* coords,
const unsigned lenCoords)
const 1531 "In npstat::HistoND::binCenter: " 1532 "incompatible input point dimensionality");
1538 for (
unsigned i=0;
i<
dim_; ++
i)
1543 template <
typename Numeric,
class Axis>
1544 template <
class Po
int>
1546 std::vector<Point>* centers)
const 1551 centers->reserve(len);
1556 "In npstat::HistoND::allBinCenters: " 1557 "incompatible point dimensionality (too small)");
1560 for (
unsigned long i=0;
i<len; ++
i)
1563 for (
unsigned idim=0; idim<
dim_; ++idim)
1564 cdat[idim] = ax[idim].
binCenter(ibuf[idim]);
1565 centers->push_back(center);
1569 template <
typename Numeric,
class Axis>
1580 for (
unsigned i=0;
i<
dim_; ++
i)
1585 template <
typename Numeric,
class Axis>
1588 return dim_ == r.dim_ &&
1593 template <
typename Numeric,
class Axis>
1596 return dim_ == r.dim_ &&
1606 template <
typename Numeric,
class Axis>
1609 return !(*
this ==
r);
1612 template <
typename Numeric,
class Axis>
1621 for (
unsigned i=0;
i<
dim_; ++
i)
1627 template <
typename Numeric,
class Axis>
1634 for (
unsigned i=0;
i<
dim_; ++
i)
1640 template <
typename Numeric,
class Axis>
1641 template <
typename Num2>
1643 const double* coords,
const unsigned coordLength,
const Num2&
w)
1646 "In npstat::HistoND::fill: " 1647 "incompatible input point dimensionality");
1652 unsigned* over = idx +
dim_;
1654 unsigned overflown = 0
U;
1655 for (
unsigned i=0;
i<
dim_; ++
i)
1657 over[
i] = ax[
i].overflowIndex(coords[
i], idx + i);
1658 overflown |= (over[
i] - 1
U);
1673 template <
typename Numeric,
class Axis>
1674 template <
typename Num2,
class Functor>
1676 const double* coords,
const unsigned coordLength, Num2&
w, Functor&
f)
1679 "In npstat::HistoND::dispatch: " 1680 "incompatible input point dimensionality");
1685 unsigned* over = idx +
dim_;
1687 unsigned overflown = 0
U;
1688 for (
unsigned i=0;
i<
dim_; ++
i)
1690 over[
i] = ax[
i].overflowIndex(coords[
i], idx + i);
1691 overflown |= (over[
i] - 1
U);
1703 template <
typename Numeric,
class Axis>
1705 const double* coords,
const unsigned coordLength)
const 1708 "In npstat::HistoND::examine: " 1709 "incompatible input point dimensionality");
1714 unsigned* over = idx +
dim_;
1716 unsigned overflown = 0
U;
1717 for (
unsigned i=0;
i<
dim_; ++
i)
1719 over[
i] = ax[
i].overflowIndex(coords[
i], idx + i);
1720 overflown |= (over[
i] - 1
U);
1731 template <
typename Numeric,
class Axis>
1733 const double* coords,
const unsigned coordLength)
const 1736 "In npstat::HistoND::closestBin: " 1737 "incompatible input point dimensionality");
1743 for (
unsigned i=0;
i<
dim_; ++
i)
1744 idx[
i] = ax[
i].closestValidBin(coords[
i]);
1751 template <
typename Numeric,
class Axis>
1752 template <
typename Num2>
1758 const unsigned long maxcycle = 1UL <<
dim_;
1759 for (
unsigned long icycle=0; icycle<maxcycle; ++icycle)
1762 unsigned long icell = 0UL;
1763 for (
unsigned i=0;
i<
dim_; ++
i)
1765 if (icycle & (1UL <<
i))
1767 w *= (1.0 - weights[
i]);
1768 icell += strides[
i]*(cell[
i] + 1
U);
1773 icell += strides[
i]*cell[
i];
1780 template <
typename Numeric,
class Axis>
1781 template <
typename Num2>
1783 const double* coords,
const unsigned coordLength,
const Num2&
w)
1786 "In npstat::HistoND::fillC: " 1787 "incompatible input point dimensionality");
1793 unsigned* over = idx +
dim_;
1795 unsigned overflown = 0
U;
1796 for (
unsigned i=0;
i<
dim_; ++
i)
1798 over[
i] = ax[
i].overflowIndexWeighted(coords[
i], idx+i, wg+i);
1799 overflown |= (over[
i] - 1
U);
1814 template <
typename Numeric,
class Axis>
1815 template <
typename Num2>
1823 template <
typename Numeric,
class Axis>
1824 template <
typename Num2,
class Functor>
1832 template <
typename Numeric,
class Axis>
1833 template <
typename Num2>
1841 template <
typename Numeric,
class Axis>
1848 template <
typename Numeric,
class Axis>
1855 template <
typename Numeric,
class Axis>
1856 template <
typename Num2>
1861 const unsigned ov0 =
axes_[0].overflowIndex(x0, &i0);
1872 template <
typename Numeric,
class Axis>
1873 template <
typename Num2,
class Functor>
1878 const unsigned ov0 =
axes_[0].overflowIndex(x0, &i0);
1886 template <
typename Numeric,
class Axis>
1887 template <
typename Num2>
1893 const unsigned ov0 =
axes_[0].overflowIndexWeighted(x0, idx, wg);
1904 template <
typename Numeric,
class Axis>
1909 const unsigned ov0 =
axes_[0].overflowIndex(x0, &i0);
1916 template <
typename Numeric,
class Axis>
1920 const unsigned i0 =
axes_[0].closestValidBin(x0);
1924 template <
typename Numeric,
class Axis>
1925 template <
typename Num2>
1930 unsigned i0 = 0, i1 = 0;
1932 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
1933 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
1934 if (o0 == 1
U && o1 == 1
U)
1944 template <
typename Numeric,
class Axis>
1945 template <
typename Num2,
class Functor>
1947 Num2&
w, Functor&
f)
1950 unsigned i0 = 0, i1 = 0;
1952 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
1953 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
1954 if (o0 == 1
U && o1 == 1
U)
1961 template <
typename Numeric,
class Axis>
1962 template <
typename Num2>
1970 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
1971 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
1972 if (o0 == 1
U && o1 == 1
U)
1982 template <
typename Numeric,
class Axis>
1984 const double x1)
const 1987 unsigned i0 = 0, i1 = 0;
1989 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
1990 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
1991 if (o0 == 1
U && o1 == 1
U)
1992 return data_(i0, i1);
1997 template <
typename Numeric,
class Axis>
1999 const double x1)
const 2003 const unsigned i0 = ax[0].closestValidBin(x0);
2004 const unsigned i1 = ax[1].closestValidBin(x1);
2005 return data_(i0, i1);
2008 template <
typename Numeric,
class Axis>
2009 template <
typename Num2>
2011 const double x2,
const Num2&
w)
2014 unsigned i0 = 0, i1 = 0, i2 = 0;
2016 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2017 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2018 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2019 if (o0 == 1
U && o1 == 1
U && o2 == 1
U)
2029 template <
typename Numeric,
class Axis>
2030 template <
typename Num2,
class Functor>
2032 const double x2, Num2&
w, Functor&
f)
2035 unsigned i0 = 0, i1 = 0, i2 = 0;
2037 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2038 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2039 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2040 if (o0 == 1
U && o1 == 1
U && o2 == 1
U)
2047 template <
typename Numeric,
class Axis>
2048 template <
typename Num2>
2050 const double x2,
const Num2&
w)
2056 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
2057 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
2058 const unsigned o2 = ax[2].overflowIndexWeighted(x2, idx+2, wg+2);
2059 if (o0 == 1
U && o1 == 1
U && o2 == 1
U)
2069 template <
typename Numeric,
class Axis>
2072 const double x2)
const 2075 unsigned i0 = 0, i1 = 0, i2 = 0;
2077 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2078 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2079 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2080 if (o0 == 1
U && o1 == 1
U && o2 == 1
U)
2081 return data_(i0, i1, i2);
2086 template <
typename Numeric,
class Axis>
2089 const double x2)
const 2093 const unsigned i0 = ax[0].closestValidBin(x0);
2094 const unsigned i1 = ax[1].closestValidBin(x1);
2095 const unsigned i2 = ax[2].closestValidBin(x2);
2096 return data_(i0, i1, i2);
2099 template <
typename Numeric,
class Axis>
2100 template <
typename Num2>
2102 const double x2,
const double x3,
2106 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0;
2108 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2109 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2110 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2111 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2112 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U)
2113 data_(i0, i1, i2, i3) +=
w;
2122 template <
typename Numeric,
class Axis>
2123 template <
typename Num2,
class Functor>
2125 const double x2,
const double x3,
2126 Num2&
w, Functor&
f)
2129 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0;
2131 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2132 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2133 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2134 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2135 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U)
2136 f(
data_(i0, i1, i2, i3), w);
2142 template <
typename Numeric,
class Axis>
2143 template <
typename Num2>
2145 const double x2,
const double x3,
2152 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
2153 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
2154 const unsigned o2 = ax[2].overflowIndexWeighted(x2, idx+2, wg+2);
2155 const unsigned o3 = ax[3].overflowIndexWeighted(x3, idx+3, wg+3);
2156 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U)
2166 template <
typename Numeric,
class Axis>
2170 const double x3)
const 2173 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0;
2175 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2176 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2177 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2178 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2179 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U)
2180 return data_(i0, i1, i2, i3);
2185 template <
typename Numeric,
class Axis>
2189 const double x3)
const 2193 const unsigned i0 = ax[0].closestValidBin(x0);
2194 const unsigned i1 = ax[1].closestValidBin(x1);
2195 const unsigned i2 = ax[2].closestValidBin(x2);
2196 const unsigned i3 = ax[3].closestValidBin(x3);
2197 return data_(i0, i1, i2, i3);
2200 template <
typename Numeric,
class Axis>
2201 template <
typename Num2>
2203 const double x2,
const double x3,
2204 const double x4,
const Num2&
w)
2207 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0;
2209 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2210 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2211 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2212 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2213 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2214 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U)
2215 data_(i0, i1, i2, i3, i4) +=
w;
2224 template <
typename Numeric,
class Axis>
2225 template <
typename Num2,
class Functor>
2227 const double x2,
const double x3,
2228 const double x4, Num2&
w, Functor&
f)
2231 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0;
2233 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2234 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2235 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2236 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2237 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2238 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U)
2239 f(
data_(i0, i1, i2, i3, i4), w);
2245 template <
typename Numeric,
class Axis>
2246 template <
typename Num2>
2248 const double x2,
const double x3,
2249 const double x4,
const Num2&
w)
2255 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
2256 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
2257 const unsigned o2 = ax[2].overflowIndexWeighted(x2, idx+2, wg+2);
2258 const unsigned o3 = ax[3].overflowIndexWeighted(x3, idx+3, wg+3);
2259 const unsigned o4 = ax[4].overflowIndexWeighted(x4, idx+4, wg+4);
2260 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U)
2270 template <
typename Numeric,
class Axis>
2272 const double x0,
const double x1,
2273 const double x2,
const double x3,
2274 const double x4)
const 2277 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0;
2279 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2280 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2281 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2282 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2283 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2284 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U)
2285 return data_(i0, i1, i2, i3, i4);
2290 template <
typename Numeric,
class Axis>
2295 const double x4)
const 2299 const unsigned i0 = ax[0].closestValidBin(x0);
2300 const unsigned i1 = ax[1].closestValidBin(x1);
2301 const unsigned i2 = ax[2].closestValidBin(x2);
2302 const unsigned i3 = ax[3].closestValidBin(x3);
2303 const unsigned i4 = ax[4].closestValidBin(x4);
2304 return data_(i0, i1, i2, i3, i4);
2307 template <
typename Numeric,
class Axis>
2308 template <
typename Num2>
2310 const double x2,
const double x3,
2311 const double x4,
const double x5,
2315 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0;
2317 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2318 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2319 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2320 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2321 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2322 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2323 if (o0 == 1
U && o1 == 1
U && o2 == 1
U &&
2324 o3 == 1
U && o4 == 1
U && o5 == 1
U)
2325 data_(i0, i1, i2, i3, i4, i5) +=
w;
2334 template <
typename Numeric,
class Axis>
2335 template <
typename Num2,
class Functor>
2337 const double x2,
const double x3,
2338 const double x4,
const double x5,
2339 Num2&
w, Functor&
f)
2342 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0;
2344 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2345 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2346 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2347 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2348 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2349 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2350 if (o0 == 1
U && o1 == 1
U && o2 == 1
U &&
2351 o3 == 1
U && o4 == 1
U && o5 == 1
U)
2352 f(
data_(i0, i1, i2, i3, i4, i5), w);
2358 template <
typename Numeric,
class Axis>
2359 template <
typename Num2>
2361 const double x2,
const double x3,
2362 const double x4,
const double x5,
2369 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
2370 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
2371 const unsigned o2 = ax[2].overflowIndexWeighted(x2, idx+2, wg+2);
2372 const unsigned o3 = ax[3].overflowIndexWeighted(x3, idx+3, wg+3);
2373 const unsigned o4 = ax[4].overflowIndexWeighted(x4, idx+4, wg+4);
2374 const unsigned o5 = ax[5].overflowIndexWeighted(x5, idx+5, wg+5);
2375 if (o0 == 1
U && o1 == 1
U && o2 == 1
U &&
2376 o3 == 1
U && o4 == 1
U && o5 == 1
U)
2386 template <
typename Numeric,
class Axis>
2392 const double x5)
const 2395 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0;
2397 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2398 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2399 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2400 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2401 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2402 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2403 if (o0 == 1
U && o1 == 1
U && o2 == 1
U &&
2404 o3 == 1
U && o4 == 1
U && o5 == 1
U)
2405 return data_(i0, i1, i2, i3, i4, i5);
2407 return overflow_(o0, o1, o2, o3, o4, o5);
2410 template <
typename Numeric,
class Axis>
2416 const double x5)
const 2420 const unsigned i0 = ax[0].closestValidBin(x0);
2421 const unsigned i1 = ax[1].closestValidBin(x1);
2422 const unsigned i2 = ax[2].closestValidBin(x2);
2423 const unsigned i3 = ax[3].closestValidBin(x3);
2424 const unsigned i4 = ax[4].closestValidBin(x4);
2425 const unsigned i5 = ax[5].closestValidBin(x5);
2426 return data_(i0, i1, i2, i3, i4, i5);
2429 template <
typename Numeric,
class Axis>
2430 template <
typename Num2>
2432 const double x2,
const double x3,
2433 const double x4,
const double x5,
2434 const double x6,
const Num2&
w)
2437 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0, i6 = 0;
2439 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2440 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2441 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2442 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2443 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2444 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2445 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2446 if (o0 == 1
U && o1 == 1
U && o2 == 1
U &&
2447 o3 == 1
U && o4 == 1
U && o5 == 1
U && o6 == 1
U)
2448 data_(i0, i1, i2, i3, i4, i5, i6) +=
w;
2457 template <
typename Numeric,
class Axis>
2458 template <
typename Num2,
class Functor>
2460 const double x2,
const double x3,
2461 const double x4,
const double x5,
2462 const double x6, Num2&
w, Functor&
f)
2465 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0, i6 = 0;
2467 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2468 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2469 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2470 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2471 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2472 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2473 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2474 if (o0 == 1
U && o1 == 1
U && o2 == 1
U &&
2475 o3 == 1
U && o4 == 1
U && o5 == 1
U && o6 == 1
U)
2476 f(
data_(i0, i1, i2, i3, i4, i5, i6), w);
2482 template <
typename Numeric,
class Axis>
2483 template <
typename Num2>
2485 const double x2,
const double x3,
2486 const double x4,
const double x5,
2487 const double x6,
const Num2&
w)
2493 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
2494 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
2495 const unsigned o2 = ax[2].overflowIndexWeighted(x2, idx+2, wg+2);
2496 const unsigned o3 = ax[3].overflowIndexWeighted(x3, idx+3, wg+3);
2497 const unsigned o4 = ax[4].overflowIndexWeighted(x4, idx+4, wg+4);
2498 const unsigned o5 = ax[5].overflowIndexWeighted(x5, idx+5, wg+5);
2499 const unsigned o6 = ax[6].overflowIndexWeighted(x6, idx+6, wg+6);
2500 if (o0 == 1
U && o1 == 1
U && o2 == 1
U &&
2501 o3 == 1
U && o4 == 1
U && o5 == 1
U && o6 == 1
U)
2511 template <
typename Numeric,
class Axis>
2513 const double x0,
const double x1,
2514 const double x2,
const double x3,
2515 const double x4,
const double x5,
2516 const double x6)
const 2519 unsigned i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0, i6 = 0;
2521 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2522 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2523 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2524 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2525 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2526 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2527 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2528 if (o0 == 1
U && o1 == 1
U && o2 == 1
U &&
2529 o3 == 1
U && o4 == 1
U && o5 == 1
U && o6 == 1
U)
2530 return data_(i0, i1, i2, i3, i4, i5, i6);
2532 return overflow_(o0, o1, o2, o3, o4, o5, o6);
2535 template <
typename Numeric,
class Axis>
2542 const double x6)
const 2546 const unsigned i0 = ax[0].closestValidBin(x0);
2547 const unsigned i1 = ax[1].closestValidBin(x1);
2548 const unsigned i2 = ax[2].closestValidBin(x2);
2549 const unsigned i3 = ax[3].closestValidBin(x3);
2550 const unsigned i4 = ax[4].closestValidBin(x4);
2551 const unsigned i5 = ax[5].closestValidBin(x5);
2552 const unsigned i6 = ax[6].closestValidBin(x6);
2553 return data_(i0, i1, i2, i3, i4, i5, i6);
2556 template <
typename Numeric,
class Axis>
2557 template <
typename Num2>
2559 const double x2,
const double x3,
2560 const double x4,
const double x5,
2561 const double x6,
const double x7,
2565 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
2567 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2568 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2569 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2570 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2571 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2572 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2573 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2574 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2575 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U &&
2576 o4 == 1
U && o5 == 1
U && o6 == 1
U && o7 == 1
U)
2577 data_(i0, i1, i2, i3, i4, i5, i6, i7) +=
w;
2580 overflow_(o0, o1, o2, o3, o4, o5, o6, o7) +=
w;
2586 template <
typename Numeric,
class Axis>
2587 template <
typename Num2,
class Functor>
2589 const double x2,
const double x3,
2590 const double x4,
const double x5,
2591 const double x6,
const double x7,
2592 Num2&
w, Functor&
f)
2595 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
2597 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2598 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2599 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2600 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2601 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2602 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2603 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2604 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2605 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U &&
2606 o4 == 1
U && o5 == 1
U && o6 == 1
U && o7 == 1
U)
2607 f(
data_(i0, i1, i2, i3, i4, i5, i6, i7), w);
2609 f(
overflow_(o0, o1, o2, o3, o4, o5, o6, o7), w);
2613 template <
typename Numeric,
class Axis>
2614 template <
typename Num2>
2616 const double x2,
const double x3,
2617 const double x4,
const double x5,
2618 const double x6,
const double x7,
2625 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
2626 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
2627 const unsigned o2 = ax[2].overflowIndexWeighted(x2, idx+2, wg+2);
2628 const unsigned o3 = ax[3].overflowIndexWeighted(x3, idx+3, wg+3);
2629 const unsigned o4 = ax[4].overflowIndexWeighted(x4, idx+4, wg+4);
2630 const unsigned o5 = ax[5].overflowIndexWeighted(x5, idx+5, wg+5);
2631 const unsigned o6 = ax[6].overflowIndexWeighted(x6, idx+6, wg+6);
2632 const unsigned o7 = ax[7].overflowIndexWeighted(x7, idx+7, wg+7);
2633 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U &&
2634 o4 == 1
U && o5 == 1
U && o6 == 1
U && o7 == 1
U)
2638 overflow_(o0, o1, o2, o3, o4, o5, o6, o7) +=
w;
2644 template <
typename Numeric,
class Axis>
2646 const double x0,
const double x1,
2647 const double x2,
const double x3,
2648 const double x4,
const double x5,
2650 const double x7)
const 2653 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
2655 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2656 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2657 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2658 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2659 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2660 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2661 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2662 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2663 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U &&
2664 o4 == 1
U && o5 == 1
U && o6 == 1
U && o7 == 1
U)
2665 return data_(i0, i1, i2, i3, i4, i5, i6, i7);
2667 return overflow_(o0, o1, o2, o3, o4, o5, o6, o7);
2670 template <
typename Numeric,
class Axis>
2678 const double x7)
const 2682 const unsigned i0 = ax[0].closestValidBin(x0);
2683 const unsigned i1 = ax[1].closestValidBin(x1);
2684 const unsigned i2 = ax[2].closestValidBin(x2);
2685 const unsigned i3 = ax[3].closestValidBin(x3);
2686 const unsigned i4 = ax[4].closestValidBin(x4);
2687 const unsigned i5 = ax[5].closestValidBin(x5);
2688 const unsigned i6 = ax[6].closestValidBin(x6);
2689 const unsigned i7 = ax[7].closestValidBin(x7);
2690 return data_(i0, i1, i2, i3, i4, i5, i6, i7);
2693 template <
typename Numeric,
class Axis>
2694 template <
typename Num2>
2696 const double x2,
const double x3,
2697 const double x4,
const double x5,
2698 const double x6,
const double x7,
2699 const double x8,
const Num2&
w)
2702 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0;
2704 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2705 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2706 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2707 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2708 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2709 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2710 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2711 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2712 const unsigned o8 = ax[8].overflowIndex(x8, &i8);
2713 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U &&
2714 o5 == 1
U && o6 == 1
U && o7 == 1
U && o8 == 1
U)
2715 data_(i0, i1, i2, i3, i4, i5, i6, i7, i8) +=
w;
2718 overflow_(o0, o1, o2, o3, o4, o5, o6, o7, o8) +=
w;
2724 template <
typename Numeric,
class Axis>
2725 template <
typename Num2,
class Functor>
2727 const double x2,
const double x3,
2728 const double x4,
const double x5,
2729 const double x6,
const double x7,
2730 const double x8, Num2&
w, Functor&
f)
2733 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0;
2735 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2736 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2737 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2738 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2739 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2740 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2741 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2742 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2743 const unsigned o8 = ax[8].overflowIndex(x8, &i8);
2744 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U &&
2745 o5 == 1
U && o6 == 1
U && o7 == 1
U && o8 == 1
U)
2746 f(
data_(i0, i1, i2, i3, i4, i5, i6, i7, i8), w);
2748 f(
overflow_(o0, o1, o2, o3, o4, o5, o6, o7, o8), w);
2752 template <
typename Numeric,
class Axis>
2753 template <
typename Num2>
2755 const double x2,
const double x3,
2756 const double x4,
const double x5,
2757 const double x6,
const double x7,
2758 const double x8,
const Num2&
w)
2764 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
2765 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
2766 const unsigned o2 = ax[2].overflowIndexWeighted(x2, idx+2, wg+2);
2767 const unsigned o3 = ax[3].overflowIndexWeighted(x3, idx+3, wg+3);
2768 const unsigned o4 = ax[4].overflowIndexWeighted(x4, idx+4, wg+4);
2769 const unsigned o5 = ax[5].overflowIndexWeighted(x5, idx+5, wg+5);
2770 const unsigned o6 = ax[6].overflowIndexWeighted(x6, idx+6, wg+6);
2771 const unsigned o7 = ax[7].overflowIndexWeighted(x7, idx+7, wg+7);
2772 const unsigned o8 = ax[8].overflowIndexWeighted(x8, idx+8, wg+8);
2773 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U &&
2774 o5 == 1
U && o6 == 1
U && o7 == 1
U && o8 == 1
U)
2778 overflow_(o0, o1, o2, o3, o4, o5, o6, o7, o8) +=
w;
2784 template <
typename Numeric,
class Axis>
2786 const double x0,
const double x1,
2787 const double x2,
const double x3,
2788 const double x4,
const double x5,
2789 const double x6,
const double x7,
2790 const double x8)
const 2793 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0;
2795 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2796 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2797 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2798 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2799 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2800 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2801 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2802 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2803 const unsigned o8 = ax[8].overflowIndex(x8, &i8);
2804 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U &&
2805 o5 == 1
U && o6 == 1
U && o7 == 1
U && o8 == 1
U)
2806 return data_(i0, i1, i2, i3, i4, i5, i6, i7, i8);
2808 return overflow_(o0, o1, o2, o3, o4, o5, o6, o7, o8);
2811 template <
typename Numeric,
class Axis>
2820 const double x8)
const 2824 const unsigned i0 = ax[0].closestValidBin(x0);
2825 const unsigned i1 = ax[1].closestValidBin(x1);
2826 const unsigned i2 = ax[2].closestValidBin(x2);
2827 const unsigned i3 = ax[3].closestValidBin(x3);
2828 const unsigned i4 = ax[4].closestValidBin(x4);
2829 const unsigned i5 = ax[5].closestValidBin(x5);
2830 const unsigned i6 = ax[6].closestValidBin(x6);
2831 const unsigned i7 = ax[7].closestValidBin(x7);
2832 const unsigned i8 = ax[8].closestValidBin(x8);
2833 return data_(i0, i1, i2, i3, i4, i5, i6, i7, i8);
2836 template <
typename Numeric,
class Axis>
2837 template <
typename Num2>
2839 const double x2,
const double x3,
2840 const double x4,
const double x5,
2841 const double x6,
const double x7,
2842 const double x8,
const double x9,
2846 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0;
2848 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2849 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2850 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2851 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2852 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2853 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2854 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2855 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2856 const unsigned o8 = ax[8].overflowIndex(x8, &i8);
2857 const unsigned o9 = ax[9].overflowIndex(x9, &i9);
2858 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U &&
2859 o5 == 1
U && o6 == 1
U && o7 == 1
U && o8 == 1
U && o9 == 1
U)
2860 data_(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) +=
w;
2863 overflow_(o0, o1, o2, o3, o4, o5, o6, o7, o8, o9) +=
w;
2869 template <
typename Numeric,
class Axis>
2870 template <
typename Num2,
class Functor>
2872 const double x2,
const double x3,
2873 const double x4,
const double x5,
2874 const double x6,
const double x7,
2875 const double x8,
const double x9,
2876 Num2&
w, Functor&
f)
2879 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0;
2881 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2882 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2883 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2884 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2885 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2886 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2887 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2888 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2889 const unsigned o8 = ax[8].overflowIndex(x8, &i8);
2890 const unsigned o9 = ax[9].overflowIndex(x9, &i9);
2891 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U &&
2892 o5 == 1
U && o6 == 1
U && o7 == 1
U && o8 == 1
U && o9 == 1
U)
2893 f(
data_(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9), w);
2895 f(
overflow_(o0, o1, o2, o3, o4, o5, o6, o7, o8, o9), w);
2899 template <
typename Numeric,
class Axis>
2900 template <
typename Num2>
2902 const double x2,
const double x3,
2903 const double x4,
const double x5,
2904 const double x6,
const double x7,
2905 const double x8,
const double x9,
2912 const unsigned o0 = ax[0].overflowIndexWeighted(x0, idx+0, wg+0);
2913 const unsigned o1 = ax[1].overflowIndexWeighted(x1, idx+1, wg+1);
2914 const unsigned o2 = ax[2].overflowIndexWeighted(x2, idx+2, wg+2);
2915 const unsigned o3 = ax[3].overflowIndexWeighted(x3, idx+3, wg+3);
2916 const unsigned o4 = ax[4].overflowIndexWeighted(x4, idx+4, wg+4);
2917 const unsigned o5 = ax[5].overflowIndexWeighted(x5, idx+5, wg+5);
2918 const unsigned o6 = ax[6].overflowIndexWeighted(x6, idx+6, wg+6);
2919 const unsigned o7 = ax[7].overflowIndexWeighted(x7, idx+7, wg+7);
2920 const unsigned o8 = ax[8].overflowIndexWeighted(x8, idx+8, wg+8);
2921 const unsigned o9 = ax[9].overflowIndexWeighted(x9, idx+9, wg+9);
2922 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U &&
2923 o5 == 1
U && o6 == 1
U && o7 == 1
U && o8 == 1
U && o9 == 1
U)
2927 overflow_(o0, o1, o2, o3, o4, o5, o6, o7, o8, o9) +=
w;
2933 template <
typename Numeric,
class Axis>
2935 const double x0,
const double x1,
2936 const double x2,
const double x3,
2937 const double x4,
const double x5,
2938 const double x6,
const double x7,
2940 const double x9)
const 2943 unsigned i0=0, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0;
2945 const unsigned o0 = ax[0].overflowIndex(x0, &i0);
2946 const unsigned o1 = ax[1].overflowIndex(x1, &i1);
2947 const unsigned o2 = ax[2].overflowIndex(x2, &i2);
2948 const unsigned o3 = ax[3].overflowIndex(x3, &i3);
2949 const unsigned o4 = ax[4].overflowIndex(x4, &i4);
2950 const unsigned o5 = ax[5].overflowIndex(x5, &i5);
2951 const unsigned o6 = ax[6].overflowIndex(x6, &i6);
2952 const unsigned o7 = ax[7].overflowIndex(x7, &i7);
2953 const unsigned o8 = ax[8].overflowIndex(x8, &i8);
2954 const unsigned o9 = ax[9].overflowIndex(x9, &i9);
2955 if (o0 == 1
U && o1 == 1
U && o2 == 1
U && o3 == 1
U && o4 == 1
U &&
2956 o5 == 1
U && o6 == 1
U && o7 == 1
U && o8 == 1
U && o9 == 1
U)
2957 return data_(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9);
2959 return overflow_(o0, o1, o2, o3, o4, o5, o6, o7, o8, o9);
2962 template <
typename Numeric,
class Axis>
2972 const double x9)
const 2976 const unsigned i0 = ax[0].closestValidBin(x0);
2977 const unsigned i1 = ax[1].closestValidBin(x1);
2978 const unsigned i2 = ax[2].closestValidBin(x2);
2979 const unsigned i3 = ax[3].closestValidBin(x3);
2980 const unsigned i4 = ax[4].closestValidBin(x4);
2981 const unsigned i5 = ax[5].closestValidBin(x5);
2982 const unsigned i6 = ax[6].closestValidBin(x6);
2983 const unsigned i7 = ax[7].closestValidBin(x7);
2984 const unsigned i8 = ax[8].closestValidBin(x8);
2985 const unsigned i9 = ax[9].closestValidBin(x9);
2986 return data_(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9);
2989 template <
typename Numeric,
class Axis>
2990 template <
typename Num2>
2992 const unsigned indexLen,
2999 template <
typename Numeric,
class Axis>
3000 template <
typename Num2>
3002 const unsigned indexLen,
3009 template <
typename Numeric,
class Axis>
3010 template <
typename Num2>
3017 template <
typename Numeric,
class Axis>
3018 template <
typename Num2>
3025 template <
typename Numeric,
class Axis>
3026 template <
typename Num2>
3028 const unsigned i0,
const Num2&
v)
3034 template <
typename Numeric,
class Axis>
3035 template <
typename Num2>
3037 const unsigned i0,
const Num2&
v)
3043 template <
typename Numeric,
class Axis>
3044 template <
typename Num2>
3053 template <
typename Numeric,
class Axis>
3054 template <
typename Num2>
3063 template <
typename Numeric,
class Axis>
3064 template <
typename Num2>
3074 template <
typename Numeric,
class Axis>
3075 template <
typename Num2>
3082 data_(i0, i1, i2, i3) =
v;
3086 template <
typename Numeric,
class Axis>
3087 template <
typename Num2>
3095 data_(i0, i1, i2, i3, i4) =
v;
3099 template <
typename Numeric,
class Axis>
3100 template <
typename Num2>
3109 data_(i0, i1, i2, i3, i4, i5) =
v;
3113 template <
typename Numeric,
class Axis>
3114 template <
typename Num2>
3124 data_(i0, i1, i2, i3, i4, i5, i6) =
v;
3128 template <
typename Numeric,
class Axis>
3129 template <
typename Num2>
3140 data_(i0, i1, i2, i3, i4, i5, i6, i7) =
v;
3144 template <
typename Numeric,
class Axis>
3145 template <
typename Num2>
3157 data_(i0, i1, i2, i3, i4, i5, i6, i7, i8) =
v;
3161 template <
typename Numeric,
class Axis>
3162 template <
typename Num2>
3175 data_(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) =
v;
3179 template <
typename Numeric,
class Axis>
3180 template <
typename Num2>
3190 template <
typename Numeric,
class Axis>
3191 template <
typename Num2>
3202 template <
typename Numeric,
class Axis>
3203 template <
typename Num2>
3215 template <
typename Numeric,
class Axis>
3216 template <
typename Num2>
3225 data_.
at(i0, i1, i2, i3, i4, i5) =
v;
3229 template <
typename Numeric,
class Axis>
3230 template <
typename Num2>
3240 data_.
at(i0, i1, i2, i3, i4, i5, i6) =
v;
3244 template <
typename Numeric,
class Axis>
3245 template <
typename Num2>
3256 data_.
at(i0, i1, i2, i3, i4, i5, i6, i7) =
v;
3260 template <
typename Numeric,
class Axis>
3261 template <
typename Num2>
3273 data_.
at(i0, i1, i2, i3, i4, i5, i6, i7, i8) =
v;
3277 template <
typename Numeric,
class Axis>
3278 template <
typename Num2>
3291 data_.
at(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) =
v;
3295 template <
typename Numeric,
class Axis>
3296 template <
typename Num2>
3308 template <
typename Numeric,
class Axis>
3309 template <
typename Num2>
3328 template <
typename Numeric,
class Axis>
3329 template <
typename Num2>
3339 template <
typename Numeric,
class Axis>
3340 template <
typename Num2>
3350 template <
typename Numeric,
class Axis>
3369 template <
typename Numeric,
class Axis>
3385 template <
typename Numeric,
class Axis>
3407 template <
typename Numeric,
class Axis>
3409 const unsigned axisNum1,
const unsigned axisNum2)
const 3411 if (axisNum1 >=
dim_ || axisNum2 >=
dim_)
3413 "axis number is out of range");
3414 if (axisNum1 == axisNum2)
3418 return HistoND(*
this, axisNum1, axisNum2);
3421 template <
typename Numeric,
class Axis>
3422 template <
typename Num2>
3427 for (
unsigned long i=0;
i<nDat; ++
i)
3433 template <
typename Numeric,
class Axis>
3434 template <
typename Num2>
3439 for (
unsigned long i=0;
i<nOver; ++
i)
3446 template <
typename Numeric,
class Axis>
3447 template <
typename Num2>
3449 const Num2*
data,
const unsigned long dataLength)
3452 "In npstat::HistoND::addToBinContents: incompatible data length");
3454 Numeric* dat =
const_cast<Numeric*
>(
data_.
data());
3455 for (
unsigned long i=0;
i<dataLength; ++
i)
3461 template <
typename Numeric,
class Axis>
3462 template <
typename Num2>
3464 const Num2*
data,
const unsigned long dataLength)
3467 "In npstat::HistoND::addToOverflows: incompatible data length");
3470 for (
unsigned long i=0;
i<dataLength; ++
i)
3477 template <
typename Numeric,
class Axis>
3478 template <
typename Num2>
3480 const Num2*
data,
const unsigned long dataLength)
3483 "In npstat::HistoND::scaleBinContents: incompatible data length");
3485 Numeric* dat =
const_cast<Numeric*
>(
data_.
data());
3486 for (
unsigned long i=0;
i<dataLength; ++
i)
3491 template <
typename Numeric,
class Axis>
3492 template <
typename Num2>
3494 const Num2*
data,
const unsigned long dataLength)
3497 "In npstat::HistoND::scaleOverflows: incompatible data length");
3500 for (
unsigned long i=0;
i<dataLength; ++
i)
3505 template <
typename Numeric,
class Axis>
3506 template <
typename Num2>
3508 const Num2*
data,
const unsigned long dataLength,
3509 const bool clearOverflowsNow)
3512 if (clearOverflowsNow)
3517 template <
typename Numeric,
class Axis>
3518 template <
typename Num2>
3520 const Num2*
data,
const unsigned long dataLength)
3526 template <
typename Numeric,
class Axis>
3529 const long double nOver =
overflow_.template sum<long double>();
3530 const long double nData =
data_.template sum<long double>();
3531 overCount_ =
static_cast<unsigned long>(nOver);
3532 fillCount_ =
static_cast<unsigned long>(nData + nOver);
3536 template <
typename Numeric,
class Axis>
3537 template <
typename Num2,
typename Num3>
3541 const unsigned *projectedIndices,
3542 const unsigned nProjectedIndices)
const 3546 projectedIndices, nProjectedIndices);
3547 projection->fillCount_ += projection->nBins();
3548 projection->modCount_++;
3551 template <
typename Numeric,
class Axis>
3552 template <
typename Num2,
typename Num3>
3556 const unsigned *projectedIndices,
3557 const unsigned nProjectedIndices)
const 3561 projectedIndices, nProjectedIndices);
3562 projection->fillCount_ += projection->nBins();
3563 projection->modCount_++;
3566 template <
typename Numeric,
class Axis>
3569 static const std::string myClass(gs::template_class_name<Numeric,Axis>(
3570 "npstat::HistoND"));
3571 return myClass.c_str();
3574 template<
typename Numeric,
class Axis>
3577 gs::write_pod(of,
title_);
3582 return !of.fail() &&
3583 gs::write_obj_vector(of,
axes_) &&
3589 template<
typename Numeric,
class Axis>
3593 static const gs::ClassId current(
3595 current.ensureSameId(
id);
3598 gs::read_pod(in, &title);
3601 gs::read_pod(in, &accumulatedDataLabel);
3603 unsigned long fillCount = 0, overCount = 0;
3604 gs::read_pod(in, &fillCount);
3605 gs::read_pod(in, &overCount);
3606 if (in.fail())
throw gs::IOReadFailure(
3607 "In npstat::HistoND::read: input stream failure");
3609 std::vector<Axis>
axes;
3610 gs::read_heap_obj_vector_as_placed(in, &axes);
3611 gs::ClassId ida(in, 1);
3615 CPP11_auto_ptr<HistoND<Numeric,Axis> >
result(
3617 accumulatedDataLabel.c_str()));
3618 result->data_ =
data;
3619 result->overflow_ = over;
3620 result->fillCount_ = fillCount;
3621 result->overCount_ = overCount;
3622 return result.release();
3625 template <
typename Histo>
3629 if (!knownNonNegative)
3632 const double integ = h->integral();
3636 template <
typename Histo>
3639 std::vector<LinearMapper1d>
result;
3640 const unsigned d = histo.dim();
3642 for (
unsigned i=0;
i<
d; ++
i)
3645 result.push_back(m.
inverse());
3650 template <
typename Histo>
3652 const Histo&
histo,
const bool doubleRange)
3654 std::vector<CircularMapper1d>
result;
3655 const unsigned d = histo.dim();
3657 for (
unsigned i=0;
i<
d; ++
i)
3658 result.push_back(histo.axis(
i).kernelScanMapper(doubleRange));
3664 #endif // NPSTAT_HISTOND_HH_
void setBinAt(const unsigned *index, unsigned indexLen, const Num2 &v)
ArrayND & setData(const Num2 *data, unsigned long dataLength)
void accumulateBinsLoop(unsigned level, const BoxND< double > &box, unsigned *idx, Acc *accumulator, double overlapFraction, long double *wsum) const
static unsigned version()
void convertLinearIndex(unsigned long l, unsigned *index, unsigned indexLen) const
bool operator==(const HistoND &) const
unsigned long getModCount() const
bool write(std::ostream &of) const
HistoND & operator+=(const HistoND< Num2, Axis > &r)
std::vector< CircularMapper1d > convolutionHistoMap(const Histo &histo, bool doubleDataRange)
bool write(std::ostream &of) const
void addToProjection(HistoND< Num2, Axis > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
const std::string & accumulatedDataLabel() const
def binNumber(station, sector)
const Numeric & examine() const
bool isSameData(const HistoND &) const
unsigned long nFillsTotal() const
void binCenter(unsigned long binNumber, double *coords, unsigned lenCoords) const
const Axis & axis(const unsigned i) const
HistoND & operator=(const HistoND &)
void dispatch(const double *coords, unsigned coordLength, Num2 &weight, Functor &f)
std::vector< unsigned > ArrayShape
HistoND & operator*=(const Num2 &r)
Numeric & linearValue(unsigned long index)
unsigned long length() const
void setLinearBin(const unsigned long index, const Num2 &v)
void fill(const double *coords, unsigned coordLength, const Num2 &weight)
Numeric & value(const unsigned *index, unsigned indexLen)
const std::string & title() const
void addToProjection(ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Numeric & linearValueAt(unsigned long index)
void recalculateNFillsFromData()
void scaleBinContents(const Num2 *data, unsigned long dataLength)
LinearMapper1d inverse() const
std::string accumulatedDataLabel_
void convertHistoToDensity(Histo *histogram, bool knownNonNegative=false)
ArrayND & constFill(Numeric c)
void setNFillsOver(const unsigned long i)
double binVolume(unsigned long binNumber=0) const
gs::ClassId classId() const
const ArrayND< Numeric > & binContents() const
Exceptions for the npstat namespace.
Container::value_type value_type
void h_badargs(const char *method)
void setAccumulatedDataLabel(const char *newlabel)
void setOverflowsToConst(const Num2 &value)
ArrayShape makeHistoShape(const Axis &xAxis, const Axis &yAxis, const Axis &zAxis, const Axis &tAxis, const Axis &vAxis)
void addToBinContents(const Num2 &weight)
gs::ClassId classId() const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void setBin(const unsigned *index, unsigned indexLen, const Num2 &v)
static const char * classname()
Numeric & valueAt(const unsigned *index, unsigned indexLen)
void accumulateBinsInBox(const BoxND< double > &box, Acc *acc, bool calculateAverage=false) const
void addToOverflows(const Num2 &weight)
void setNFillsTotal(const unsigned long i)
void fillC(const double *coords, unsigned coordLength, const Num2 &weight)
const Numeric * data() const
PreciseTypeHelper< T, gs::IOIsNumber< T >::value >::type type
bool isUniformlyBinned() const
unsigned long nFillsOver() const
std::vector< double > weightBuf_
const std::vector< Axis > & axes() const
void allBinCenters(std::vector< Point > *centers) const
static void restore(const gs::ClassId &id, std::istream &in, ArrayND *array)
std::vector< unsigned > indexBuf_
std::vector< Axis > rebinAxes(const std::vector< Axis > &axes, const unsigned *newBins, const unsigned lenNewBins)
unsigned long nBins() const
std::vector< Axis > addAxis(const std::vector< Axis > &axes, const Axis &newAxis, const unsigned newAxisNumber)
const Numeric & closestBin() const
BoxND< double > boundingBox() const
HistoND & operator-=(const HistoND< Num2, Axis > &r)
void setTitle(const char *newtitle)
HistoND & operator/=(const Num2 &r)
void setOverflows(const Num2 *data, unsigned long dataLength)
void binBox(unsigned long binNumber, BoxND< double > *box) const
void fillPreservingCentroid(const Num2 &weight)
char data[epos_bytes_allocation]
unsigned long nFillsInRange() const
std::vector< Axis > axesOfASlice(const std::vector< Axis > &axes, const unsigned *fixedIndices, const unsigned nFixedIndices)
void setBinContents(const Num2 *data, unsigned long dataLength, bool clearOverflows=true)
void setAxisLabel(const unsigned axisNum, const char *newlabel)
void setBinsToConst(const Num2 &value)
const unsigned long * strides() const
static HistoND * read(const gs::ClassId &id, std::istream &in)
bool operator!=(const HistoND &) const
void setLinearBinAt(const unsigned long index, const Num2 &v)
std::vector< Axis > axes_
ArrayShape shapeOfASlice(const std::vector< Axis > &axes, const unsigned *fixedIndices, const unsigned nFixedIndices)
ArrayND< Numeric > overflow_
const ArrayND< Numeric > & overflows() const
std::vector< LinearMapper1d > densityScanHistoMap(const Histo &histo)
HistoND transpose(unsigned axisNum1, unsigned axisNum2) const
Histogram axis with equidistant bins.
void scaleOverflows(const Num2 *data, unsigned long dataLength)
Arbitrary-dimensional array template.
ArrayShape shapeWithExtraAxis(const std::vector< Axis > &axes, const Axis &newAxis, const unsigned newAxisNumber)