All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PFPUtils.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 //
4 // PFParticle utilities
5 //
6 // Bruce Baller
7 //
8 ///////////////////////////////////////////////////////////////////////
9 #ifndef TRAJCLUSTERALGSPTUTILS_H
10 #define TRAJCLUSTERALGSPTUTILS_H
11 
12 // C/C++ standard libraries
13 #include <string>
14 
15 // LArSoft libraries
17 namespace detinfo {
18  class DetectorClocksData;
19  class DetectorPropertiesData;
20 }
21 namespace geo {
22  struct TPCID;
23 }
24 
25 namespace tca {
26 
27  void StitchPFPs();
28  void FindPFParticles(detinfo::DetectorClocksData const& clockData,
30  TCSlice& slc);
31  void MakePFParticles(detinfo::DetectorClocksData const& clockData,
33  TCSlice& slc,
34  std::vector<MatchStruct> matVec,
35  unsigned short matVec_Iter);
36  bool ReconcileTPs(TCSlice& slc, PFPStruct& pfp, bool prt);
37  void ReconcileTPs(TCSlice& slc);
38  void MakePFPTjs(TCSlice& slc);
39  void FillWireIntersections(TCSlice& slc);
40  bool TCIntersectionPoint(unsigned int wir1,
41  unsigned int wir2,
42  unsigned int pln1,
43  unsigned int pln2,
44  float& y,
45  float& z);
46  void Match3Planes(TCSlice& slc, std::vector<MatchStruct>& matVec);
47  bool SptInTPC(const std::array<unsigned int, 3>& sptHits, unsigned int tpc);
48  void Match2Planes(TCSlice& slc, std::vector<MatchStruct>& matVec);
49  bool Update(detinfo::DetectorClocksData const& clockData,
51  const TCSlice& slc,
52  PFPStruct& pfp,
53  bool prt);
54  bool ReSection(detinfo::DetectorClocksData const& clockData,
56  const TCSlice& slc,
57  PFPStruct& pfp,
58  bool prt);
59  void CountBadPoints(const TCSlice& slc,
60  const PFPStruct& pfp,
61  unsigned short fromPt,
62  unsigned short toPt,
63  unsigned short& nBadPts,
64  unsigned short& firstBadPt);
65  bool CanSection(const TCSlice& slc, const PFPStruct& pfp);
66  unsigned short Find3DRecoRange(const TCSlice& slc,
67  const PFPStruct& pfp,
68  unsigned short fromPt,
69  unsigned short min2DPts,
70  short dir);
71  void GetRange(const PFPStruct& pfp,
72  unsigned short sfIndex,
73  unsigned short& fromPt,
74  unsigned short& npts);
75  bool FitSection(detinfo::DetectorClocksData const& clockData,
77  const TCSlice& slc,
78  PFPStruct& pfp,
79  unsigned short sfIndex);
81  const TCSlice& slc,
82  const std::vector<TP3D>& tp3ds,
83  unsigned short fromPt,
84  short fitDir,
85  unsigned short nPtsFit);
87  const TCSlice& slc,
88  PFPStruct& pfp,
89  unsigned short fromPt,
90  unsigned short npts,
91  unsigned short sfIndex,
92  float& chiDOF);
93  void ReconcileVertices(TCSlice& slc, PFPStruct& pfp, bool prt);
94  void FillGaps3D(detinfo::DetectorClocksData const& clockData,
96  TCSlice& slc,
97  PFPStruct& pfp,
98  bool prt);
100  const TCSlice& slc,
101  const PFPStruct& pfp);
102  void AddPointsInRange(detinfo::DetectorClocksData const& clockData,
104  TCSlice& slc,
105  PFPStruct& pfp,
106  unsigned short fromPt,
107  unsigned short toPt,
108  CTP_t inCTP,
109  float maxPull,
110  unsigned short& nWires,
111  unsigned short& nAdd,
112  bool prt);
113  unsigned short InsertTP3D(PFPStruct& pfp, TP3D& tp3d);
114  bool SortSection(PFPStruct& pfp, unsigned short sectionFitIndex);
115  void Recover(detinfo::DetectorClocksData const& clockData,
117  TCSlice& slc, PFPStruct& pfp, bool prt);
118  bool MakeTP3Ds(detinfo::DetectorPropertiesData const& detProp, TCSlice& slc,
119  PFPStruct& pfp, bool prt);
121  TCSlice& slc, PFPStruct& pfp, bool prt);
122  void Reverse(TCSlice& slc, PFPStruct& pfp);
123  void FillmAllTraj(detinfo::DetectorPropertiesData const& detProp, TCSlice& slc);
125  TCSlice& slc, const TrajPoint& itp, const TrajPoint& jtp);
126  double DeltaAngle(const Vector3_t v1, const Vector3_t v2);
127  inline double
128  DotProd(const Vector3_t& v1, const Vector3_t& v2)
129  {
130  return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
131  }
132  Vector3_t PointDirection(const Point3_t p1, const Point3_t p2);
133  double PosSep(const Point3_t& pos1, const Point3_t& pos2);
134  double PosSep2(const Point3_t& pos1, const Point3_t& pos2);
135  bool SetMag(Vector3_t& v1, double mag);
136  void FilldEdx(detinfo::DetectorClocksData const& clockData,
138  const TCSlice& slc,
139  PFPStruct& pfp);
140  float dEdx(detinfo::DetectorClocksData const& clockData,
142  const TCSlice& slc,
143  TP3D& tp3d);
144  void Average_dEdX(detinfo::DetectorClocksData const& clockData,
146  const TCSlice& slc,
147  PFPStruct& pfp,
148  float& dEdXAve,
149  float& dEdXRms);
151  const TCSlice& slc,
152  int tjID,
153  unsigned short tjPt);
155  const TCSlice& slc,
156  PFPStruct& pfp,
157  TP3D& tp3d);
158  float PointPull(const PFPStruct& pfp, const TP3D& tp3d);
159  PFPStruct CreatePFP(const TCSlice& slc);
160  void PFPVertexCheck(TCSlice& tcs);
161  void DefinePFPParents(TCSlice& slc, bool prt);
162  bool StorePFP(TCSlice& slc, PFPStruct& pfp);
163  bool InsideFV(const TCSlice& slc, const PFPStruct& pfp, unsigned short end);
164  bool InsideTPC(const Point3_t& pos, geo::TPCID& inTPCID);
165  void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t& alongTrans);
167  Vector3_t p1Dir,
168  Point3_t p2,
169  Vector3_t p2Dir,
170  Point3_t& intersect,
171  float& doca);
173  Point3_t p2,
174  Point3_t p3,
175  Point3_t p4,
176  Point3_t& intersect,
177  float& doca);
179  const TCSlice& slc,
180  Point3_t pos1,
181  Point3_t pos2);
183  const TCSlice& slc,
184  const PFPStruct& pfp,
185  unsigned short end);
186  Point3_t PosAtEnd(const PFPStruct& pfp, unsigned short end);
187  Vector3_t DirAtEnd(const PFPStruct& pfp, unsigned short end);
188  float Length(const PFPStruct& pfp);
189  bool SectionStartEnd(const PFPStruct& pfp,
190  unsigned short sfIndex,
191  unsigned short& startPt,
192  unsigned short& endPt);
193  unsigned short FarEnd(const TCSlice& slc, const PFPStruct& pfp, const Point3_t& pos);
194  int PDGCodeVote(detinfo::DetectorClocksData const& clockData,
196  const TCSlice& slc,
197  PFPStruct& pfp);
198  void PrintTP3Ds(detinfo::DetectorClocksData const& clockData,
200  std::string someText,
201  const TCSlice& slc,
202  const PFPStruct& pfp,
203  short printPts);
204 } // namespace tca
205 
206 #endif // ifndef TRAJCLUSTERALGSPTUTILS_H
process_name opflash particleana ie ie ie z
void Recover(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:2089
unsigned short FarEnd(const TCSlice &slc, const PFPStruct &pfp, const Point3_t &pos)
Definition: PFPUtils.cxx:3339
float Length(const PFPStruct &pfp)
Definition: PFPUtils.cxx:3304
void Average_dEdX(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, float &dEdXAve, float &dEdXRms)
Definition: PFPUtils.cxx:2650
void MakePFParticles(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, std::vector< MatchStruct > matVec, unsigned short matVec_Iter)
Definition: PFPUtils.cxx:268
bool ReconcileTPs(TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:427
bool InsideFV(const TCSlice &slc, const PFPStruct &pfp, unsigned short end)
Definition: PFPUtils.cxx:3045
bool SetSection(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, TP3D &tp3d)
Definition: PFPUtils.cxx:2770
bool InsideTPC(const Point3_t &pos, geo::TPCID &inTPCID)
Definition: PFPUtils.cxx:3072
std::array< double, 3 > Point3_t
Definition: DataStructs.h:41
bool SortSection(PFPStruct &pfp, unsigned short sfIndex)
Definition: PFPUtils.cxx:2028
void Reverse(TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:2360
void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t &alongTrans)
Definition: PFPUtils.cxx:3097
bool LineLineIntersect(Point3_t p1, Point3_t p2, Point3_t p3, Point3_t p4, Point3_t &intersect, float &doca)
Definition: PFPUtils.cxx:3133
PFPStruct CreatePFP(const TCSlice &slc)
Definition: PFPUtils.cxx:2824
Point3_t PosAtEnd(const PFPStruct &pfp, unsigned short end)
Definition: PFPUtils.cxx:3293
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
Definition: PFPUtils.cxx:2540
void Match2Planes(TCSlice &slc, std::vector< MatchStruct > &matVec)
Definition: PFPUtils.cxx:945
bool CanSection(const TCSlice &slc, const PFPStruct &pfp)
Definition: PFPUtils.cxx:1343
void FilldEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:2597
void ReconcileVertices(TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1650
void MakePFPTjs(TCSlice &slc)
Definition: PFPUtils.cxx:513
unsigned short Find3DRecoRange(const TCSlice &slc, const PFPStruct &pfp, unsigned short fromPt, unsigned short min2DPts, short dir)
Definition: PFPUtils.cxx:1359
bool MakeSmallAnglePFP(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:2206
void AddPointsInRange(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, unsigned short fromPt, unsigned short toPt, CTP_t inCTP, float maxPull, unsigned short &nWires, unsigned short &nAdd, bool prt)
Definition: PFPUtils.cxx:1838
bool ReSection(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1112
void PFPVertexCheck(TCSlice &slc)
Definition: PFPUtils.cxx:2845
process_name opflash particleana ie ie y
void FillGaps3D(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1745
std::array< float, 2 > Point2_t
Definition: DataStructs.h:43
int PDGCodeVote(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:3352
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
Definition: PFPUtils.cxx:2548
void FillWireIntersections(TCSlice &slc)
Definition: PFPUtils.cxx:612
bool MakeTP3Ds(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:2125
void Match3Planes(TCSlice &slc, std::vector< MatchStruct > &matVec)
Definition: PFPUtils.cxx:814
bool TCIntersectionPoint(unsigned int wir1, unsigned int wir2, unsigned int pln1, unsigned int pln2, float &y, float &z)
Definition: PFPUtils.cxx:669
float ChgFracBetween(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, Point3_t pos1, Point3_t pos2)
Definition: PFPUtils.cxx:3197
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
bool FitSection(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, unsigned short sfIndex)
Definition: PFPUtils.cxx:1414
void CountBadPoints(const TCSlice &slc, const PFPStruct &pfp, unsigned short fromPt, unsigned short toPt, unsigned short &nBadPts, unsigned short &firstBadPt)
Definition: PFPUtils.cxx:1309
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:2572
bool SectionStartEnd(const PFPStruct &pfp, unsigned short sfIndex, unsigned short &startPt, unsigned short &endPt)
Definition: PFPUtils.cxx:3312
bool PointDirIntersect(Point3_t p1, Vector3_t p1Dir, Point3_t p2, Vector3_t p2Dir, Point3_t &intersect, float &doca)
Definition: PFPUtils.cxx:3115
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
bool SetMag(Vector3_t &v1, double mag)
Definition: PFPUtils.cxx:2583
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2687
void GetRange(const PFPStruct &pfp, unsigned short sfIndex, unsigned short &fromPt, unsigned short &npts)
Definition: PFPUtils.cxx:1392
unsigned short InsertTP3D(PFPStruct &pfp, TP3D &tp3d)
Definition: PFPUtils.cxx:1989
tuple dir
Definition: dropbox.py:28
SectionFit FitTP3Ds(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, const std::vector< TP3D > &tp3ds, unsigned short fromPt, short fitDir, unsigned short nPtsFit)
Definition: PFPUtils.cxx:1447
float PointPull(const PFPStruct &pfp, const TP3D &tp3d)
Definition: PFPUtils.cxx:2815
TP3D CreateTP3D(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, int tjID, unsigned short tpIndex)
Definition: PFPUtils.cxx:2723
bool ValidTwoPlaneMatch(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, const PFPStruct &pfp)
Definition: PFPUtils.cxx:1797
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
Definition: PFPUtils.h:128
unsigned int CTP_t
Definition: DataStructs.h:47
void FillmAllTraj(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc)
Definition: PFPUtils.cxx:2382
Contains all timing reference information for the detector.
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:2565
std::array< double, 3 > Vector3_t
Definition: DataStructs.h:42
void DefinePFPParents(TCSlice &slc, bool prt)
Definition: PFPUtils.cxx:2884
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
void FindPFParticles(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc)
Definition: PFPUtils.cxx:191
bool StorePFP(TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:3004
float ChgFracNearEnd(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, const PFPStruct &pfp, unsigned short end)
Definition: PFPUtils.cxx:3232
void PrintTP3Ds(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::string someText, const TCSlice &slc, const PFPStruct &pfp, short printPts)
Definition: PFPUtils.cxx:3397
Vector3_t DirAtEnd(const PFPStruct &pfp, unsigned short end)
Definition: PFPUtils.cxx:3284
void StitchPFPs()
Definition: PFPUtils.cxx:42
TP3D MakeTP3D(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, const TrajPoint &itp, const TrajPoint &jtp)
Definition: PFPUtils.cxx:2448
physics associatedGroupsWithLeft p1
auto const detProp
bool Update(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1057
bool SptInTPC(const std::array< unsigned int, 3 > &sptHits, unsigned int tpc)
Definition: PFPUtils.cxx:793