LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PmaNode3D.h
Go to the documentation of this file.
1 
11 #ifndef PmaNode3D_h
12 #define PmaNode3D_h
13 
16 
18 
19 #include "TVectorT.h"
20 #include "TMatrixT.h"
21 
22 namespace pma
23 {
24  class Node3D;
25 }
26 
28 {
29 public:
30  Node3D(void);
31  Node3D(const TVector3& p3d, unsigned int tpc, unsigned int cryo, bool vtx = false, double xshift = 0);
32 
33  TVector3 const & Point3D(void) const { return fPoint3D; }
34 
37  bool SetPoint3D(const TVector3& p3d);
38 
39  TVector2 const & Projection2D(unsigned int view) const { return fProj2D[view]; }
40 
41  double GetDistToWall(void) const;
42 
44  bool SameTPC(const TVector3& p3d, float margin = 0.0F) const;
45  bool SameTPC(const pma::Vector3D& p3d, float margin = 0.0F) const;
46 
48  bool IsBranching(void) const;
49 
51  bool IsTPCEdge(void) const;
52 
54  bool IsVertex(void) const { return fIsVertex; }
55  void SetVertex(bool state) { fIsVertex = state; }
56  void SetVertexToBranching(bool setAllNodes)
57  {
58  if (setAllNodes || !fIsVertex) fIsVertex = IsBranching();
59  }
60 
61  std::vector< pma::Track3D* > GetBranches(void) const;
62 
64  double GetDistance2To(const TVector3& p3d) const override;
65 
67  double GetDistance2To(const TVector2& p2d, unsigned int view) const override;
68 
70  pma::Vector3D GetDirection3D(void) const override;
71 
73  TVector3 GetUnconstrainedProj3D(const TVector2& p2d, unsigned int view) const override { return fPoint3D; }
74 
76  void SetProjection(pma::Hit3D& h) const override;
77 
80  double Length2(void) const override;
81 
83  double SegmentCos(void) const;
86  double SegmentCosWirePlane(void) const;
89  double SegmentCosTransverse(void) const;
90 
92  double GetObjFunction(float penaltyValue, float endSegWeight) const;
93 
97  void Optimize(float penaltyValue, float endSegWeight);
98 
99  void ClearAssigned(pma::Track3D* trk = 0) override;
100 
101  void ApplyDriftShift(double dx) { fPoint3D[0] += dx; fDriftOffset += dx; }
102  double GetDriftShift(void) const { return fDriftOffset; }
103 
105  static void SetMargin(double m) { if (m >= 0.0) fMargin = m; }
106 
107 private:
109  bool LimitPoint3D(void);
110  void UpdateProj2D(void);
111 
112  double EndPtCos2Transverse(void) const;
113  double PiInWirePlane(void) const;
114  double PenaltyInWirePlane(void) const;
115 
116  double Pi(float endSegWeight, bool doAsymm) const;
117  double Penalty(float endSegWeight) const;
118  double Mse(void) const;
119 
120  double MakeGradient(float penaltyValue, float endSegWeight);
121  double StepWithGradient(float alfa, float tol, float penalty, float weight);
122 
123  double SumDist2Hits(void) const override;
124 
126 
127  double fMinX, fMaxX, fMinY, fMaxY, fMinZ, fMaxZ; // TPC boundaries to limit the node position (+margin)
128 
129  TVector3 fPoint3D; // node position in 3D space in [cm]
130  TVector2 fProj2D[3]; // node projections to 2D views, scaled to [cm], updated on each change of 3D position
131  double fDriftOffset; // the offset due to t0
132 
133  TVector3 fGradient;
134  bool fIsVertex; // no penalty on segments angle if branching or kink detected
135 
136  static bool fGradFixed[3];
137  static double fMargin;
138 };
139 
140 #endif
141 
void ApplyDriftShift(double dx)
Definition: PmaNode3D.h:101
void SetVertexToBranching(bool setAllNodes)
Definition: PmaNode3D.h:56
TVector2 const & Projection2D(unsigned int view) const
Definition: PmaNode3D.h:39
bool IsVertex(void) const
Check fIsVertex flag.
Definition: PmaNode3D.h:54
double Penalty(float endSegWeight) const
Definition: PmaNode3D.cxx:481
double fMinZ
Definition: PmaNode3D.h:127
TVector3 const & Point3D(void) const
Definition: PmaNode3D.h:33
void ClearAssigned(pma::Track3D *trk=0) override
Definition: PmaNode3D.cxx:766
double fDriftOffset
Definition: PmaNode3D.h:131
Geometry information for a single TPC.
Definition: TPCGeo.h:37
double GetDistance2To(const TVector3 &p3d) const override
Distance [cm] from the 3D point to the point 3D.
Definition: PmaNode3D.cxx:133
void Optimize(float penaltyValue, float endSegWeight)
Definition: PmaNode3D.cxx:756
double SegmentCosWirePlane(void) const
Definition: PmaNode3D.cxx:280
void SetVertex(bool state)
Definition: PmaNode3D.h:55
bool LimitPoint3D(void)
Returns true if node position was trimmed to its TPC volume + fMargin.
Definition: PmaNode3D.cxx:99
double GetDistToWall(void) const
Definition: PmaNode3D.cxx:64
static void SetMargin(double m)
Set allowed node position margin around TPC.
Definition: PmaNode3D.h:105
double PiInWirePlane(void) const
Definition: PmaNode3D.cxx:338
pma::Vector3D GetDirection3D(void) const override
Get 3D direction cosines of the next segment, or pevious segment if this is the last node...
Definition: PmaNode3D.cxx:160
recob::tracking::Vector_t Vector3D
Definition: Utilities.h:29
static bool fGradFixed[3]
Definition: PmaNode3D.h:136
double PenaltyInWirePlane(void) const
Definition: PmaNode3D.cxx:358
TVector2 fProj2D[3]
Definition: PmaNode3D.h:130
Implementation of the Projection Matching Algorithm.
double fMaxX
Definition: PmaNode3D.h:127
double EndPtCos2Transverse(void) const
Definition: PmaNode3D.cxx:321
bool SetPoint3D(const TVector3 &p3d)
Definition: PmaNode3D.cxx:123
double StepWithGradient(float alfa, float tol, float penalty, float weight)
Definition: PmaNode3D.cxx:609
bool SameTPC(const TVector3 &p3d, float margin=0.0F) const
Check if p3d is in the same TPC as the node.
Definition: PmaNode3D.cxx:83
double fMaxY
Definition: PmaNode3D.h:127
void UpdateProj2D(void)
Definition: PmaNode3D.cxx:115
double GetDriftShift(void) const
Definition: PmaNode3D.h:102
bool IsBranching(void) const
Belongs to more than one track?
Definition: PmaNode3D.cxx:379
double fMaxZ
Definition: PmaNode3D.h:127
std::vector< pma::Track3D * > GetBranches(void) const
Definition: PmaNode3D.cxx:406
double MakeGradient(float penaltyValue, float endSegWeight)
Definition: PmaNode3D.cxx:527
double SumDist2Hits(void) const override
Definition: PmaNode3D.cxx:143
double fMinY
Definition: PmaNode3D.h:127
double weight
Definition: plottest35.C:25
double SegmentCos(void) const
Cosine of 3D angle between connected segments.
Definition: PmaNode3D.cxx:260
double GetObjFunction(float penaltyValue, float endSegWeight) const
Objective function minimized during oprimization.
Definition: PmaNode3D.cxx:522
TVector3 GetUnconstrainedProj3D(const TVector2 &p2d, unsigned int view) const override
In case of a node it is simply 3D position of the node.
Definition: PmaNode3D.h:73
geo::TPCGeo const & fTpcGeo
Definition: PmaNode3D.h:125
TVector3 fPoint3D
Definition: PmaNode3D.h:129
double Length2(void) const override
Definition: PmaNode3D.cxx:250
double Mse(void) const
Definition: PmaNode3D.cxx:500
static double fMargin
Definition: PmaNode3D.h:137
bool IsTPCEdge(void) const
Is the first/last in this TPC?
Definition: PmaNode3D.cxx:394
void SetProjection(pma::Hit3D &h) const override
Set hit 3D position and its 2D projection to the vertex.
Definition: PmaNode3D.cxx:171
double Pi(float endSegWeight, bool doAsymm) const
Definition: PmaNode3D.cxx:421
bool fIsVertex
Definition: PmaNode3D.h:134
art framework interface to geometry description
Implementation of the Projection Matching Algorithm.
double fMinX
Definition: PmaNode3D.h:127
TVector3 fGradient
Definition: PmaNode3D.h:133
double SegmentCosTransverse(void) const
Definition: PmaNode3D.cxx:300
Node3D(void)
Definition: PmaNode3D.cxx:25