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