ATTPCROOT
0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtTools
AtHitSampling
AtUniform.cxx
Go to the documentation of this file.
1
#include "
AtUniform.h
"
2
3
#include "
AtHit.h
"
4
#include "
AtSample.h
"
// for RandomSample
5
6
#include <TRandom.h>
7
8
#include <algorithm>
9
using namespace
RandomSample
;
10
11
std::vector<AtHit>
AtUniform::SampleHits
(
int
N)
12
{
13
std::vector<int> ind;
14
std::vector<AtHit> retVec;
15
while
(ind.size() < N) {
16
int
i = gRandom->Uniform() *
fHits
->size();
17
if
(
fWithReplacement
|| !
isInVector
(i, ind)) {
18
ind.push_back(i);
19
retVec.push_back(*
fHits
->at(i));
20
}
21
}
22
return
retVec;
23
}
24
std::vector<double>
AtUniform::PDF
(
const
AtHit
&hit)
25
{
26
return
{};
27
}
RandomSample::AtUniform::PDF
virtual std::vector< double > PDF(const AtHit &hit) override
Definition:
AtUniform.cxx:24
RandomSample
Definition:
AtSampleConsensus.h:26
RandomSample::AtSample::fWithReplacement
bool fWithReplacement
Definition:
AtSample.h:40
RandomSample::AtUniform::SampleHits
virtual std::vector< AtHit > SampleHits(int N) override
Sample hits (AtHit) from fHits.
Definition:
AtUniform.cxx:11
RandomSample::AtSample::fHits
const std::vector< const AtHit * > * fHits
Definition:
AtSample.h:38
AtHit.h
AtUniform.h
RandomSample::AtSample::isInVector
static bool isInVector(T val, std::vector< T > vec)
Definition:
AtSample.h:72
AtSample.h
AtHit
Point in space with charge.
Definition:
AtHit.h:27
Generated on Sat Nov 11 2023 15:30:38 for ATTPCROOT by
1.8.18