LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PmaNode3D.h
Go to the documentation of this file.
1 
11 #ifndef PmaNode3D_h
12 #define PmaNode3D_h
13 
17 namespace detinfo {
18  class DetectorPropertiesData;
19 }
20 
21 #include "TVector2.h"
22 #include "TVector3.h"
23 
24 #include <vector>
25 
26 namespace geo {
27  class TPCGeo;
28 }
29 
30 namespace pma {
31  class Node3D;
32 }
33 
34 class pma::Node3D final : public pma::Element3D, public pma::SortedBranchBase {
35 public:
36  Node3D();
38  const TVector3& p3d,
39  unsigned int tpc,
40  unsigned int cryo,
41  bool vtx = false,
42  double xshift = 0);
43 
44  TVector3 const& Point3D() const { return fPoint3D; }
45 
48  bool SetPoint3D(const TVector3& p3d);
49 
50  TVector2 const& Projection2D(unsigned int view) const { return fProj2D[view]; }
51 
52  double GetDistToWall() const;
53 
55  bool SameTPC(const TVector3& p3d, float margin = 0.0F) const;
56  bool SameTPC(const pma::Vector3D& p3d, float margin = 0.0F) const;
57 
59  bool IsBranching() const;
60 
62  bool IsTPCEdge() const;
63 
65  bool IsVertex() const { return fIsVertex; }
66  void SetVertex(bool state) { fIsVertex = state; }
67  void SetVertexToBranching(bool setAllNodes)
68  {
69  if (setAllNodes || !fIsVertex) fIsVertex = IsBranching();
70  }
71 
72  std::vector<pma::Track3D*> GetBranches() const;
73 
75  double GetDistance2To(const TVector3& p3d) const override;
76 
79  double GetDistance2To(const TVector2& p2d, unsigned int view) const override;
80 
83  pma::Vector3D GetDirection3D() const override;
84 
86  TVector3 GetUnconstrainedProj3D(const TVector2&, unsigned int) const override { return fPoint3D; }
87 
89  void SetProjection(pma::Hit3D& h) const override;
90 
93  double Length2() const override;
94 
96  double SegmentCos() const;
100  double SegmentCosWirePlane() const;
104  double SegmentCosTransverse() const;
105 
107  double GetObjFunction(float penaltyValue, float endSegWeight) const;
108 
112  void Optimize(float penaltyValue, float endSegWeight);
113 
114  void ClearAssigned(pma::Track3D* trk = 0) override;
115 
116  void ApplyDriftShift(double dx)
117  {
118  fPoint3D[0] += dx;
119  fDriftOffset += dx;
120  }
121  double GetDriftShift() const { return fDriftOffset; }
122 
124  static void SetMargin(double m)
125  {
126  if (m >= 0.0) fMargin = m;
127  }
128 
129 private:
131  bool LimitPoint3D();
132  void UpdateProj2D();
133 
134  double EndPtCos2Transverse() const;
135  double PiInWirePlane() const;
136  double PenaltyInWirePlane() const;
137 
138  double Pi(float endSegWeight, bool doAsymm) const;
139  double Penalty(float endSegWeight) const;
140  double Mse() const;
141 
142  double MakeGradient(float penaltyValue, float endSegWeight);
143  double StepWithGradient(float alfa, float tol, float penalty, float weight);
144 
145  double SumDist2Hits() const override;
146 
148 
149  double fMinX, fMaxX, fMinY, fMaxY, fMinZ,
150  fMaxZ; // TPC boundaries to limit the node position (+margin)
151 
152  TVector3 fPoint3D; // node position in 3D space in [cm]
153  TVector2 fProj2D[3]; // node projections to 2D views, scaled to [cm], updated
154  // on each change of 3D position
155  double fDriftOffset; // the offset due to t0
156 
157  TVector3 fGradient;
158  bool fIsVertex; // no penalty on segments angle if branching or kink detected
159 
160  static bool fGradFixed[3];
161  static double fMargin;
162 };
163 
164 #endif
void ApplyDriftShift(double dx)
Definition: PmaNode3D.h:116
TVector3 const & Point3D() const
Definition: PmaNode3D.h:44
void SetVertexToBranching(bool setAllNodes)
Definition: PmaNode3D.h:67
TVector2 const & Projection2D(unsigned int view) const
Definition: PmaNode3D.h:50
double fMinZ
Definition: PmaNode3D.h:149
double fDriftOffset
Definition: PmaNode3D.h:155
Geometry information for a single TPC.
Definition: TPCGeo.h:36
void SetVertex(bool state)
Definition: PmaNode3D.h:66
static void SetMargin(double m)
Set allowed node position margin around TPC.
Definition: PmaNode3D.h:124
recob::tracking::Vector_t Vector3D
Definition: Utilities.h:34
Implementation of the Projection Matching Algorithm.
double GetDriftShift() const
Definition: PmaNode3D.h:121
bool IsVertex() const
Check fIsVertex flag.
Definition: PmaNode3D.h:65
General LArSoft Utilities.
double weight
Definition: plottest35.C:25
Implementation of the Projection Matching Algorithm.
TVector3 GetUnconstrainedProj3D(const TVector2 &, unsigned int) const override
In case of a node it is simply 3D position of the node.
Definition: PmaNode3D.h:86
geo::TPCGeo const & fTpcGeo
Definition: PmaNode3D.h:147
TVector3 fPoint3D
Definition: PmaNode3D.h:152
static double fMargin
Definition: PmaNode3D.h:161
Namespace collecting geometry-related classes utilities.
bool fIsVertex
Definition: PmaNode3D.h:158
Implementation of the Projection Matching Algorithm.
TVector3 fGradient
Definition: PmaNode3D.h:157