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,
29  detinfo::DetectorPropertiesData const& detProp,
30  TCSlice& slc);
31  void MakePFParticles(detinfo::DetectorClocksData const& clockData,
32  detinfo::DetectorPropertiesData const& detProp,
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,
50  detinfo::DetectorPropertiesData const& detProp,
51  const TCSlice& slc,
52  PFPStruct& pfp,
53  bool prt);
54  bool ReSection(detinfo::DetectorClocksData const& clockData,
55  detinfo::DetectorPropertiesData const& detProp,
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,
76  detinfo::DetectorPropertiesData const& detProp,
77  const TCSlice& slc,
78  PFPStruct& pfp,
79  unsigned short sfIndex);
80  SectionFit FitTP3Ds(detinfo::DetectorPropertiesData const& detProp,
81  const TCSlice& slc,
82  const std::vector<TP3D>& tp3ds,
83  unsigned short fromPt,
84  short fitDir,
85  unsigned short nPtsFit);
86  bool FitTP3Ds(detinfo::DetectorPropertiesData const& detProp,
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,
95  detinfo::DetectorPropertiesData const& detProp,
96  TCSlice& slc,
97  PFPStruct& pfp,
98  bool prt);
100  const TCSlice& slc,
101  const PFPStruct& pfp);
102  void AddPointsInRange(detinfo::DetectorClocksData const& clockData,
103  detinfo::DetectorPropertiesData const& detProp,
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,
116  detinfo::DetectorPropertiesData const& detProp,
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);
124  TP3D MakeTP3D(detinfo::DetectorPropertiesData const& detProp,
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,
137  detinfo::DetectorPropertiesData const& detProp,
138  const TCSlice& slc,
139  PFPStruct& pfp);
140  float dEdx(detinfo::DetectorClocksData const& clockData,
141  detinfo::DetectorPropertiesData const& detProp,
142  const TCSlice& slc,
143  TP3D& tp3d);
144  void Average_dEdX(detinfo::DetectorClocksData const& clockData,
145  detinfo::DetectorPropertiesData const& detProp,
146  const TCSlice& slc,
147  PFPStruct& pfp,
148  float& dEdXAve,
149  float& dEdXRms);
151  const TCSlice& slc,
152  int tjID,
153  unsigned short tjPt);
154  bool SetSection(detinfo::DetectorPropertiesData const& detProp,
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);
166  bool PointDirIntersect(Point3_t p1,
167  Vector3_t p1Dir,
168  Point3_t p2,
169  Vector3_t p2Dir,
170  Point3_t& intersect,
171  float& doca);
172  bool LineLineIntersect(Point3_t p1,
173  Point3_t p2,
174  Point3_t p3,
175  Point3_t p4,
176  Point3_t& intersect,
177  float& doca);
178  float ChgFracBetween(detinfo::DetectorPropertiesData const& detProp,
179  const TCSlice& slc,
180  Point3_t pos1,
181  Point3_t pos2);
182  float ChgFracNearEnd(detinfo::DetectorPropertiesData const& detProp,
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,
195  detinfo::DetectorPropertiesData const& detProp,
196  const TCSlice& slc,
197  PFPStruct& pfp);
198  void PrintTP3Ds(detinfo::DetectorClocksData const& clockData,
199  detinfo::DetectorPropertiesData const& detProp,
200  std::string someText,
201  const TCSlice& slc,
202  const PFPStruct& pfp,
203  short printPts);
204 } // namespace tca
205 
206 #endif // ifndef TRAJCLUSTERALGSPTUTILS_H
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
void Recover(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:2088
unsigned short FarEnd(const TCSlice &slc, const PFPStruct &pfp, const Point3_t &pos)
Definition: PFPUtils.cxx:3338
float Length(const PFPStruct &pfp)
Definition: PFPUtils.cxx:3303
void Average_dEdX(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, float &dEdXAve, float &dEdXRms)
Definition: PFPUtils.cxx:2649
void MakePFParticles(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, std::vector< MatchStruct > matVec, unsigned short matVec_Iter)
Definition: PFPUtils.cxx:267
bool ReconcileTPs(TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:426
bool InsideFV(const TCSlice &slc, const PFPStruct &pfp, unsigned short end)
Definition: PFPUtils.cxx:3044
bool SetSection(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, TP3D &tp3d)
Definition: PFPUtils.cxx:2769
bool InsideTPC(const Point3_t &pos, geo::TPCID &inTPCID)
Definition: PFPUtils.cxx:3071
std::array< double, 3 > Point3_t
Definition: DataStructs.h:43
std::string string
Definition: nybbler.cc:12
bool SortSection(PFPStruct &pfp, unsigned short sfIndex)
Definition: PFPUtils.cxx:2027
void Reverse(TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:2359
void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t &alongTrans)
Definition: PFPUtils.cxx:3096
bool LineLineIntersect(Point3_t p1, Point3_t p2, Point3_t p3, Point3_t p4, Point3_t &intersect, float &doca)
Definition: PFPUtils.cxx:3132
PFPStruct CreatePFP(const TCSlice &slc)
Definition: PFPUtils.cxx:2823
Point3_t PosAtEnd(const PFPStruct &pfp, unsigned short end)
Definition: PFPUtils.cxx:3292
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
Definition: PFPUtils.cxx:2539
string dir
void Match2Planes(TCSlice &slc, std::vector< MatchStruct > &matVec)
Definition: PFPUtils.cxx:944
bool CanSection(const TCSlice &slc, const PFPStruct &pfp)
Definition: PFPUtils.cxx:1342
void FilldEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:2596
void ReconcileVertices(TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1649
void MakePFPTjs(TCSlice &slc)
Definition: PFPUtils.cxx:512
unsigned short Find3DRecoRange(const TCSlice &slc, const PFPStruct &pfp, unsigned short fromPt, unsigned short min2DPts, short dir)
Definition: PFPUtils.cxx:1358
bool MakeSmallAnglePFP(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:2205
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:1837
bool ReSection(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1111
double dEdx(float dqdx, float Efield)
Definition: doAna.cpp:21
void PFPVertexCheck(TCSlice &slc)
Definition: PFPUtils.cxx:2844
void FillGaps3D(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1744
std::array< float, 2 > Point2_t
Definition: DataStructs.h:45
int PDGCodeVote(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:3351
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
Definition: PFPUtils.cxx:2547
void FillWireIntersections(TCSlice &slc)
Definition: PFPUtils.cxx:611
bool MakeTP3Ds(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:2124
void Match3Planes(TCSlice &slc, std::vector< MatchStruct > &matVec)
Definition: PFPUtils.cxx:813
bool TCIntersectionPoint(unsigned int wir1, unsigned int wir2, unsigned int pln1, unsigned int pln2, float &y, float &z)
Definition: PFPUtils.cxx:668
float ChgFracBetween(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, Point3_t pos1, Point3_t pos2)
Definition: PFPUtils.cxx:3196
bool FitSection(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, unsigned short sfIndex)
Definition: PFPUtils.cxx:1413
void CountBadPoints(const TCSlice &slc, const PFPStruct &pfp, unsigned short fromPt, unsigned short toPt, unsigned short &nBadPts, unsigned short &firstBadPt)
Definition: PFPUtils.cxx:1308
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:2571
General LArSoft Utilities.
bool SectionStartEnd(const PFPStruct &pfp, unsigned short sfIndex, unsigned short &startPt, unsigned short &endPt)
Definition: PFPUtils.cxx:3311
bool PointDirIntersect(Point3_t p1, Vector3_t p1Dir, Point3_t p2, Vector3_t p2Dir, Point3_t &intersect, float &doca)
Definition: PFPUtils.cxx:3114
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
bool SetMag(Vector3_t &v1, double mag)
Definition: PFPUtils.cxx:2582
void GetRange(const PFPStruct &pfp, unsigned short sfIndex, unsigned short &fromPt, unsigned short &npts)
Definition: PFPUtils.cxx:1391
unsigned short InsertTP3D(PFPStruct &pfp, TP3D &tp3d)
Definition: PFPUtils.cxx:1988
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:1446
float PointPull(const PFPStruct &pfp, const TP3D &tp3d)
Definition: PFPUtils.cxx:2814
TP3D CreateTP3D(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, int tjID, unsigned short tpIndex)
Definition: PFPUtils.cxx:2722
bool ValidTwoPlaneMatch(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, const PFPStruct &pfp)
Definition: PFPUtils.cxx:1796
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
Definition: PFPUtils.h:128
unsigned int CTP_t
Definition: DataStructs.h:49
void FillmAllTraj(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc)
Definition: PFPUtils.cxx:2381
Contains all timing reference information for the detector.
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:2564
std::array< double, 3 > Vector3_t
Definition: DataStructs.h:44
void DefinePFPParents(TCSlice &slc, bool prt)
Definition: PFPUtils.cxx:2883
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:190
bool StorePFP(TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:3003
float ChgFracNearEnd(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, const PFPStruct &pfp, unsigned short end)
Definition: PFPUtils.cxx:3231
void PrintTP3Ds(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::string someText, const TCSlice &slc, const PFPStruct &pfp, short printPts)
Definition: PFPUtils.cxx:3396
Vector3_t DirAtEnd(const PFPStruct &pfp, unsigned short end)
Definition: PFPUtils.cxx:3283
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void StitchPFPs()
Definition: PFPUtils.cxx:41
TP3D MakeTP3D(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, const TrajPoint &itp, const TrajPoint &jtp)
Definition: PFPUtils.cxx:2447
bool Update(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1056
bool SptInTPC(const std::array< unsigned int, 3 > &sptHits, unsigned int tpc)
Definition: PFPUtils.cxx:792