6 #include <Math/Point3D.h>
23 std::vector<AtHit> ret;
25 ret.push_back(*
fHits->at(ind));
36 std::vector<ROOT::Math::XYZPoint> ret;
38 ret.push_back(hit.GetPosition());
56 double probRemoved = 0;
57 for (
int i = 0; i <
fCDF.size(); ++i) {
64 if ((
fCDF[i] - probRemoved) / (1.0 - rmCFD) >= r)
67 return fCDF.size() - 1;
80 auto probSum = [
this](
double accum,
int ind) {
return accum +
getPDFfromCDF(ind); };
81 double rmProb = std::accumulate(vetoed.begin(), vetoed.end(), 0.0, probSum);
83 std::vector<int> sampledInd;
84 while (sampledInd.size() < N) {
85 auto r = gRandom->Uniform();
92 vetoed.push_back(hitInd);
97 sampledInd.push_back(hitInd);
106 return index == 0 ?
fCDF[0] :
fCDF[index] -
fCDF[index - 1];
117 std::vector<double> normalization;
119 for (
const auto &hit : *
fHits) {
122 auto pdfMarginal =
PDF(*hit);
123 auto pdfJoint = std::accumulate(pdfMarginal.begin(), pdfMarginal.end(), 1.0,
124 std::multiplies<>());
127 if (normalization.size() == 0)
128 normalization.assign(pdfMarginal.size(), 0);
130 for (
int i = 0; i < pdfMarginal.size(); ++i)
131 normalization[i] += pdfMarginal[i];
133 if (
fCDF.size() == 0)
134 fCDF.push_back(pdfJoint);
136 fCDF.push_back(pdfJoint +
fCDF.back());
140 auto norm = std::accumulate(normalization.begin(), normalization.end(), 1.0, std::multiplies<>());
141 for (
auto &elem :
fCDF) {