ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtPattern.h
Go to the documentation of this file.
1 #ifndef ATPATTERN_H
2 #define ATPATTERN_H
3 
4 #include <Math/Point3D.h>
5 #include <Math/Point3Dfwd.h> // for XYZPoint
6 #include <Rtypes.h> // for Double_t, Int_t, THashConsistencyHolder, ClassDef
7 #include <TObject.h>
8 
9 #include <algorithm> // for max
10 #include <cmath> // for NAN
11 #include <memory>
12 #include <utility> // for move
13 #include <vector> // for vector
14 
15 class TBuffer;
16 class TClass;
17 class TMemberInspector;
18 class TEveLine;
19 class TEveElement;
20 class AtHit;
21 
30 namespace AtPatterns {
31 
40 class AtPattern : public TObject {
41 public:
43 
44 protected:
45  std::vector<Double_t> fPatternPar; //< Description of pattern
46  Double_t fChi2{NAN}; //< How good the pattern is at describing the data
47  Int_t fNFree{0}; //< Degrees of freedom in the fit to the pattern
48  const Int_t fNumPoints; //< Number of 3D points that define the pattern (i.e. size of fIndices)
49  Double_t fTotCharge{0}; //< Total charge of the pattern
50 
51  using TEveLineVec = std::vector<std::unique_ptr<TEveLine>>;
52 
53 public:
54  AtPattern(Int_t numPoints = 0);
55  AtPattern(const AtPattern &) = default;
56  AtPattern(AtPattern &&) = default;
57  virtual ~AtPattern() = default;
58 
59  Double_t FitPattern(const std::vector<AtHit> &pointsToFit, Double_t qThreshold = -1);
60  Double_t FitPattern(const std::vector<const AtHit *> &pointsToFit, Double_t qThreshold = -1);
61  Double_t FitPattern(const std::vector<XYZPoint> &pointsToFit);
62 
71  virtual void DefinePattern(const std::vector<XYZPoint> &points) = 0;
72 
79  virtual void DefinePattern(std::vector<double> par) { fPatternPar = std::move(par); }
80 
87  virtual Double_t DistanceToPattern(const XYZPoint &point) const = 0;
94  virtual XYZPoint ClosestPointOnPattern(const XYZPoint &point) const = 0;
101  virtual XYZPoint GetPointAt(double t) const = 0;
102 
114  TEveLine *GetEveLine(double tMin, double tMax, int n) const;
115 
121  virtual TEveElement *GetEveElement() const = 0;
122 
123  virtual std::unique_ptr<AtPattern> Clone() const = 0;
124 
130  Int_t GetNumPoints() const { return fNumPoints; }
131  Double_t GetChi2() const { return fChi2; }
132  Int_t GetNFree() const { return fNFree; }
133 
139  virtual std::vector<double> GetPatternPar() const { return fPatternPar; }
140 
141  Double_t GetTotCharge() const { return fTotCharge; }
142  void SetPatternPar(std::vector<double> par) { fPatternPar = std::move(par); }
143  void SetChi2(double chi2) { fChi2 = chi2; }
144 
145 protected:
150  virtual void FitPattern(const std::vector<XYZPoint> &pointsToFit, const std::vector<double> &pointCharge) = 0;
151 
152  ClassDef(AtPattern, 1)
153 };
154 } // namespace AtPatterns
155 #endif //#ifndef ATTRACKPATTERN_H
AtPatterns::AtPattern::ClosestPointOnPattern
virtual XYZPoint ClosestPointOnPattern(const XYZPoint &point) const =0
Closest point on pattern.
AtPatterns::AtPattern::~AtPattern
virtual ~AtPattern()=default
AtPatterns::AtPattern::SetPatternPar
void SetPatternPar(std::vector< double > par)
Definition: AtPattern.h:142
AtPatterns::AtPattern::GetNFree
Int_t GetNFree() const
Definition: AtPattern.h:132
AtPatterns::AtPattern::Clone
virtual std::unique_ptr< AtPattern > Clone() const =0
AtPatterns::AtPattern::fNFree
Int_t fNFree
Definition: AtPattern.h:47
AtPatterns::AtPattern::AtPattern
AtPattern(AtPattern &&)=default
AtPatterns::AtPattern::DefinePattern
virtual void DefinePattern(std::vector< double > par)
Define based on parameters.
Definition: AtPattern.h:79
AtPatterns::AtPattern::GetPointAt
virtual XYZPoint GetPointAt(double t) const =0
Point on pattern at t.
AtPatterns::AtPattern::AtPattern
AtPattern(const AtPattern &)=default
XYZPoint
ROOT::Math::XYZPoint XYZPoint
Definition: AtPatternCircle2D.h:18
AtPatterns::AtPattern
Describes a shape in 3D space.
Definition: AtPattern.h:40
AtPatterns::AtPattern::AtPattern
AtPattern(Int_t numPoints=0)
Definition: AtPattern.cxx:12
AtPatterns::AtPattern::DefinePattern
virtual void DefinePattern(const std::vector< XYZPoint > &points)=0
Define based on points.
AtPatterns::AtPattern::TEveLineVec
std::vector< std::unique_ptr< TEveLine > > TEveLineVec
Definition: AtPattern.h:51
AtPatterns::AtPattern::GetTotCharge
Double_t GetTotCharge() const
Definition: AtPattern.h:141
AtPatterns::AtPattern::GetEveLine
TEveLine * GetEveLine(double tMin, double tMax, int n) const
Get visual representation of pattern.
Definition: AtPattern.cxx:63
AtPatterns::AtPattern::fChi2
Double_t fChi2
Definition: AtPattern.h:46
AtPatterns::AtPattern::GetChi2
Double_t GetChi2() const
Definition: AtPattern.h:131
AtPatterns
Definition: AtFissionEvent.h:21
AtPatterns::AtPattern::FitPattern
virtual void FitPattern(const std::vector< XYZPoint > &pointsToFit, const std::vector< double > &pointCharge)=0
AtPatterns::AtPattern::GetPatternPar
virtual std::vector< double > GetPatternPar() const
Get list or parameters that describe the pattern.
Definition: AtPattern.h:139
AtPatterns::AtPattern::DistanceToPattern
virtual Double_t DistanceToPattern(const XYZPoint &point) const =0
Closest distance to pattern.
AtPatterns::AtPattern::GetNumPoints
Int_t GetNumPoints() const
Number of points to define the pattern.
Definition: AtPattern.h:130
AtPatterns::AtPattern::GetEveElement
virtual TEveElement * GetEveElement() const =0
Get visual representation of pattern.
AtPatterns::AtPattern::fPatternPar
std::vector< Double_t > fPatternPar
Definition: AtPattern.h:45
AtPatterns::AtPattern::fTotCharge
Double_t fTotCharge
Definition: AtPattern.h:49
AtPatterns::AtPattern::SetChi2
void SetChi2(double chi2)
Definition: AtPattern.h:143
AtPatterns::AtPattern::fNumPoints
const Int_t fNumPoints
Definition: AtPattern.h:48
AtPatterns::AtPattern::FitPattern
Double_t FitPattern(const std::vector< AtHit > &pointsToFit, Double_t qThreshold=-1)
Fit the pattern.
Definition: AtPattern.cxx:24
AtHit
Point in space with charge.
Definition: AtHit.h:27
AtPatterns::AtPattern::XYZPoint
ROOT::Math::XYZPoint XYZPoint
Definition: AtPattern.h:42