ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtWeightedGaussian.cxx
Go to the documentation of this file.
1 #include "AtWeightedGaussian.h"
2 
3 #include "AtHit.h"
4 #include "AtSample.h" // for RandomSample
5 
6 #include <Math/PdfFuncMathCore.h>
7 #include <Math/Point3D.h> // for operator-
8 #include <Math/Vector3D.h> // for DisplacementVector3D
9 
10 #include <cmath> // for sqrt
11 #include <utility> // for move
12 
13 using namespace RandomSample;
14 void AtWeightedGaussian::SetHitsToSample(const std::vector<const AtHit *> &hits)
15 {
18 }
19 
20 std::vector<double> AtWeightedGaussian::PDF(const AtHit &hit)
21 {
22  auto dist = (fReferenceHit.GetPosition() - hit.GetPosition()).Mag2();
23  dist = std::sqrt(dist);
24  return {ROOT::Math::gaussian_pdf(dist, fSigma), hit.GetCharge()};
25 }
26 
28 {
29  AtChargeWeighted charge;
30  charge.SetHitsToSample(*fHits);
31  SetReferenceHit(std::move(charge.SampleHits(1)[0]));
32 }
RandomSample::AtSample::SampleHits
virtual std::vector< AtHit > SampleHits(int N)
Sample hits (AtHit) from fHits.
Definition: AtSample.cxx:20
AtWeightedGaussian.h
RandomSample
Definition: AtSampleConsensus.h:26
RandomSample::AtWeightedGaussian::SetHitsToSample
virtual void SetHitsToSample(const std::vector< const AtHit * > &hits) override
Definition: AtWeightedGaussian.cxx:14
RandomSample::AtSampleFromReference::SetReferenceHit
void SetReferenceHit(AtHit hit)
Definition: AtSampleFromReference.cxx:29
RandomSample::AtSample::fHits
const std::vector< const AtHit * > * fHits
Definition: AtSample.h:38
AtHit::GetPosition
const XYZPoint & GetPosition() const
Definition: AtHit.h:79
AtHit.h
RandomSample::AtWeightedGaussian::fSigma
double fSigma
Definition: AtWeightedGaussian.h:22
RandomSample::AtSampleFromReference::fReferenceHit
AtHit fReferenceHit
Definition: AtSampleFromReference.h:20
RandomSample::AtIndependentSample::SetHitsToSample
virtual void SetHitsToSample(const std::vector< const AtHit * > &hits) override
Definition: AtIndependentSample.cxx:5
RandomSample::AtChargeWeighted
Sample AtHits according to charge.
Definition: AtChargeWeighted.h:17
RandomSample::AtWeightedGaussian::SampleReferenceHit
virtual void SampleReferenceHit() override
Get reference hit from fHits.
Definition: AtWeightedGaussian.cxx:27
RandomSample::AtSampleFromReference::SetHitsToSample
virtual void SetHitsToSample(const std::vector< const AtHit * > &hits) override
Definition: AtSampleFromReference.h:25
AtSample.h
RandomSample::AtWeightedGaussian::fChargeSample
AtChargeWeighted fChargeSample
Definition: AtWeightedGaussian.h:23
RandomSample::AtWeightedGaussian::PDF
virtual std::vector< double > PDF(const AtHit &hit) override
Definition: AtWeightedGaussian.cxx:20
AtHit::GetCharge
Double_t GetCharge() const
Definition: AtHit.h:82
AtHit
Point in space with charge.
Definition: AtHit.h:27