All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
larreco/larreco/RecoAlg/TCAlg/Utils.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 //
4 // TCAlg utilities
5 //
6 // Bruce Baller
7 //
8 ///////////////////////////////////////////////////////////////////////
9 #ifndef TRAJCLUSTERALGUTILS_H
10 #define TRAJCLUSTERALGUTILS_H
11 
12 // C++ standard libraries
13 #include <algorithm>
14 #include <array>
15 #include <string>
16 #include <utility>
17 #include <vector>
18 
19 // Framework libraries
20 #include "messagefacility/MessageLogger/MessageLogger.h"
21 
22 // LArSoft
24 namespace detinfo {
25  class DetectorClocksData;
26  class DetectorPropertiesData;
27 }
28 namespace geo {
29  struct TPCID;
30 }
31 namespace recob {
32  class Hit;
33 }
34 
35 namespace tca {
36 
37  namespace detail {
38  bool valsDecreasing(const SortEntry& c1, const SortEntry& c2);
39  bool valsIncreasing(const SortEntry& c1, const SortEntry& c2);
40  }
41 
42 
43  typedef enum {
47  } HitStatus_t;
48 
49  // ****************************** General purpose ******************************
50  // dressed muons
51  void MakeHaloTj(TCSlice& slc, Trajectory& muTj, bool prt);
52  void DefineTjParents(TCSlice& slc, bool prt);
53  float MaxChargeAsymmetry(TCSlice& slc, std::vector<int>& tjIDs);
54  int PDGCodeVote(const TCSlice& slc, const std::vector<int>& tjIDs);
55  int NeutrinoPrimaryTjID(const TCSlice& slc, const Trajectory& tj);
56  int PrimaryID(const TCSlice& slc, const Trajectory& tj);
57  int PrimaryUID(const TCSlice& slc, const PFPStruct& pfp);
58  bool MergeTjIntoPFP(TCSlice& slc, int mtjid, PFPStruct& pfp, bool prt);
59  float PointPull(TCSlice& slc, Point2_t pos, float chg, const Trajectory& tj);
60  bool CompatibleMerge(const TCSlice& slc, std::vector<int>& tjIDs, bool prt);
61  bool CompatibleMerge(const TCSlice& slc, const Trajectory& tj1, const Trajectory& tj2, bool prt);
62  float OverlapFraction(const TCSlice& slc, const Trajectory& tj1, const Trajectory& tj2);
63  unsigned short AngleRange(TrajPoint const& tp);
64  void SetAngleCode(TrajPoint& tp);
65  unsigned short AngleRange(float angle);
66  void FitTraj(TCSlice& slc, Trajectory& tj);
67  void FitTraj(TCSlice& slc,
68  Trajectory& tj,
69  unsigned short originPt,
70  unsigned short npts,
71  short fitDir,
72  TrajPoint& tpFit);
73  unsigned short GetPFPIndex(const TCSlice& slc, int tjID);
74  void ReleaseHits(TCSlice& slc, Trajectory& tj);
75  void UnsetUsedHits(TCSlice& slc, TrajPoint& tp);
76  bool StoreTraj(TCSlice& slc, Trajectory& tj);
77  void FitPar(const TCSlice& slc,
78  const Trajectory& tj,
79  unsigned short originPt,
80  unsigned short npts,
81  short fitDir,
82  ParFit& pFit,
83  unsigned short usePar);
84  bool InTrajOK(TCSlice& slc, std::string someText);
85  void CheckTrajBeginChg(TCSlice& slc, unsigned short itj);
86  bool BraggSplit(TCSlice& slc, unsigned short itj);
87  void ChkEndKink(TCSlice& slc, Trajectory& tj, bool prt);
88  void TrimHiChgEndPts(TCSlice& slc, Trajectory& tj, bool prt);
89  void TrimEndPts(std::string fcnLabel,
90  TCSlice& slc,
91  Trajectory& tj,
92  const std::vector<float>& fQualityCuts,
93  bool prt);
94  void ChkMissedKink(TCSlice& slc, Trajectory& tj, bool prt);
95  void ChkChgAsymmetry(TCSlice& slc, Trajectory& tj, bool prt);
96  bool SignalBetween(const TCSlice& slc,
97  const TrajPoint& tp1,
98  const TrajPoint& tp2,
99  const float& MinWireSignalFraction);
100  bool SignalBetween(const TCSlice& slc,
101  TrajPoint tp,
102  float toPos0,
103  const float& MinWireSignalFraction);
104  float ChgFracBetween(const TCSlice& slc, TrajPoint tp, float toPos0);
105  bool TrajHitsOK(TCSlice& slc,
106  const std::vector<unsigned int>& iHitsInMultiplet,
107  const std::vector<unsigned int>& jHitsInMultiplet);
108  bool TrajHitsOK(TCSlice& slc, const unsigned int iht, const unsigned int jht);
109  float ExpectedHitsRMS(TCSlice& slc, const TrajPoint& tp);
110  bool SignalAtTpInSlc(const TCSlice& slc, const TrajPoint& tp);
111  bool SignalAtTp(TrajPoint& tp);
112  bool NearbySrcHit(geo::PlaneID plnID, unsigned int wire, float loTick, float hiTick);
113  float TpSumHitChg(const TCSlice& slc, TrajPoint const& tp);
114  unsigned short NumPtsWithCharge(const TCSlice& slc, const Trajectory& tj, bool includeDeadWires);
115  unsigned short NumPtsWithCharge(const TCSlice& slc,
116  const Trajectory& tj,
117  bool includeDeadWires,
118  unsigned short firstPt,
119  unsigned short lastPt);
120  float DeadWireCount(const TCSlice& slc, const TrajPoint& tp1, const TrajPoint& tp2);
121  float DeadWireCount(const TCSlice& slc,
122  const float& inWirePos1,
123  const float& inWirePos2,
124  CTP_t tCTP);
125  unsigned short PDGCodeIndex(int PDGCode);
126  void MakeTrajectoryObsolete(TCSlice& slc, unsigned int itj);
127  void RestoreObsoleteTrajectory(TCSlice& slc, unsigned int itj);
128  void MergeGhostTjs(TCSlice& slc, CTP_t inCTP);
129  // Split the allTraj trajectory itj at position pos into two trajectories
130  // with an optional vertex assignment
131  bool SplitTraj(TCSlice& slc,
132  unsigned short itj,
133  unsigned short pos,
134  unsigned short ivx,
135  bool prt);
137  TCSlice& slc,
138  unsigned short itj,
139  float XPos,
140  bool makeVx2,
141  bool prt);
142  bool TrajClosestApproach(Trajectory const& tj,
143  float x,
144  float y,
145  unsigned short& closePt,
146  float& DOCA);
147  // returns the DOCA between a hit and a trajectory
148  float PointTrajDOCA(const TCSlice& slc, unsigned int iht, TrajPoint const& tp);
149  // returns the DOCA between a (W,T) point and a trajectory
150  float PointTrajDOCA(const TCSlice& slc, float wire, float time, TrajPoint const& tp);
151  // returns the DOCA^2 between a point and a trajectory
152  float PointTrajDOCA2(const TCSlice& slc, float wire, float time, TrajPoint const& tp);
153  // Fills tp.Hits sets tp.UseHit true for hits that are close to tp.Pos. Returns true if there are
154  // close hits OR if the wire at this position is dead
155  bool FindCloseHits(TCSlice& slc, TrajPoint& tp, float const& maxDelta, HitStatus_t hitRequest);
156  std::vector<unsigned int> FindCloseHits(const TCSlice& slc,
157  std::array<int, 2> const& wireWindow,
158  Point2_t const& timeWindow,
159  const unsigned short plane,
160  HitStatus_t hitRequest,
161  bool usePeakTime,
162  bool& hitsNear);
163  unsigned short NearbyCleanPt(const TCSlice& slc, const Trajectory& tj, unsigned short nearPt);
164  std::vector<int> FindCloseTjs(const TCSlice& slc,
165  const TrajPoint& fromTp,
166  const TrajPoint& toTp,
167  const float& maxDelta);
168  float ElectronLikelihood(const TCSlice& slc, const Trajectory& tj);
169  float KinkSignificance(TCSlice& slc,
170  Trajectory& tj1,
171  unsigned short end1,
172  Trajectory& tj2,
173  unsigned short end2,
174  unsigned short nPtsFit,
175  bool useChg,
176  bool prt);
177  float KinkSignificance(TCSlice& slc,
178  Trajectory& tj,
179  unsigned short kinkPt,
180  unsigned short nPtsFit,
181  bool useChg,
182  bool prt);
183  float ChgFracNearPos(const TCSlice& slc, const Point2_t& pos, const std::vector<int>& tjIDs);
184  float MaxHitDelta(TCSlice& slc, Trajectory& tj);
185  void ReverseTraj(TCSlice& slc, Trajectory& tj);
186  // returns the end of a trajectory that is closest to a point
187  unsigned short CloseEnd(const TCSlice& slc, const Trajectory& tj, const Point2_t& pos);
188  // returns the separation^2 between a point and a TP
189  float PointTrajSep2(float wire, float time, TrajPoint const& tp);
190  float PosSep(const Point2_t& pos1, const Point2_t& pos2);
191  float PosSep2(const Point2_t& pos1, const Point2_t& pos2);
192  // finds the point on trajectory tj that is closest to trajpoint tp
193  void TrajPointTrajDOCA(const TCSlice& slc,
194  TrajPoint const& tp,
195  Trajectory const& tj,
196  unsigned short& closePt,
197  float& minSep);
198  // returns the intersection position, intPos, of two trajectory points
199  void TrajIntersection(TrajPoint const& tp1, TrajPoint const& tp2, Point2_t& pos);
200  void TrajIntersection(TrajPoint const& tp1, TrajPoint const& tp2, float& x, float& y);
201  float MaxTjLen(const TCSlice& slc, std::vector<int>& tjIDs);
202  // Returns the separation distance between two trajectory points
203  float TrajPointSeparation(const TrajPoint& tp1, const TrajPoint& tp2);
204  float TrajLength(const Trajectory& tj);
205  // returns the separation^2 between two hits in WSE units
206  float HitSep2(const TCSlice& slc, unsigned int iht, unsigned int jht);
207  // Find the Distance Of Closest Approach between two trajectories, exceeding minSep
208  bool TrajTrajDOCA(const TCSlice& slc,
209  const Trajectory& tp1,
210  const Trajectory& tp2,
211  unsigned short& ipt1,
212  unsigned short& ipt2,
213  float& minSep);
214  bool TrajTrajDOCA(const TCSlice& slc,
215  const Trajectory& tp1,
216  const Trajectory& tp2,
217  unsigned short& ipt1,
218  unsigned short& ipt2,
219  float& minSep,
220  bool considerDeadWires);
221  // Calculates the angle between two TPs
222  float TwoTPAngle(const TrajPoint& tp1, const TrajPoint& tp2);
223  void TagJunkTj(TCSlice& slc, Trajectory& tj, bool prt);
224  std::vector<unsigned int> PutHitsInVector(const TCSlice& slc,
225  PFPStruct const& pfp,
226  HitStatus_t hitRequest);
227  // Put hits in each trajectory point into a flat vector.
228  std::vector<unsigned int> PutTrajHitsInVector(const Trajectory& tj, HitStatus_t hitRequest);
229  // returns true if a hit is associated with more than one point
230  bool HasDuplicateHits(const TCSlice& slc, Trajectory const& tj, bool prt);
231  // Project TP to a "wire position" Pos[0] and update Pos[1]
232  void MoveTPToWire(TrajPoint& tp, float wire);
233  bool PointInsideEnvelope(const Point2_t& Point, const std::vector<Point2_t>& Envelope);
234  bool SetMag(Vector2_t& v1, double mag);
235  void FindAlongTrans(Point2_t pos1, Vector2_t dir1, Point2_t pos2, Point2_t& alongTrans);
236  inline double
237  DotProd(const Vector2_t& v1, const Vector2_t& v2)
238  {
239  return v1[0] * v2[0] + v1[1] * v2[1];
240  }
241  double DeltaAngle(double Ang1, double Ang2);
242  double DeltaAngle2(double Ang1, double Ang2);
243  double DeltaAngle(const Point2_t& p1, const Point2_t& p2);
244  // Find the first (last) TPs, EndPt[0] (EndPt[1], that have charge
245  void SetEndPoints(Trajectory& tj);
246  // Returns the hit width using StartTick() and EndTick()
247  float TPHitsRMSTick(const TCSlice& slc, const TrajPoint& tp, HitStatus_t hitRequest);
248  float TPHitsRMSTime(const TCSlice& slc, const TrajPoint& tp, HitStatus_t hitRequest);
249  float HitsRMSTick(const TCSlice& slc,
250  const std::vector<unsigned int>& hitsInMultiplet,
251  HitStatus_t hitRequest);
252  float HitsRMSTime(const TCSlice& slc,
253  const std::vector<unsigned int>& hitsInMultiplet,
254  HitStatus_t hitRequest);
255  float HitsPosTick(const TCSlice& slc,
256  const std::vector<unsigned int>& hitsInMultiplet,
257  float& chg,
258  HitStatus_t hitRequest);
259  float HitsPosTime(const TCSlice& slc,
260  const std::vector<unsigned int>& hitsInMultiplet,
261  float& chg,
262  HitStatus_t hitRequest);
263  unsigned short NumHitsInTP(const TrajPoint& tp, HitStatus_t hitRequest);
264  unsigned short NumUsedHitsInTj(const TCSlice& slc, const Trajectory& tj);
265  unsigned short NearestPtWithChg(const TCSlice& slc, const Trajectory& tj, unsigned short thePt);
266  // Calculate MCS momentum
267  short MCSMom(const TCSlice& slc, const std::vector<int>& tjIDs);
268  short MCSMom(const TCSlice& slc, const Trajectory& tj);
269  short MCSMom(const TCSlice& slc,
270  const Trajectory& tj,
271  unsigned short FirstPt,
272  unsigned short lastPt);
273  // Calculate MCS theta RMS over the points specified. Returns MCS angle for the full length
274  double MCSThetaRMS(const TCSlice& slc,
275  const Trajectory& tj,
276  unsigned short firstPt,
277  unsigned short lastPt);
278  // Calculate MCS theta RMS over the entire length. Returns MCS angle for 1 WSE unit
279  float MCSThetaRMS(const TCSlice& slc, const Trajectory& tj);
280  void TjDeltaRMS(const TCSlice& slc,
281  const Trajectory& tj,
282  unsigned short firstPt,
283  unsigned short lastPt,
284  double& rms,
285  unsigned short& cnt);
286  void SetTPEnvironment(TCSlice& slc, CTP_t inCTP);
287  // Returns true if the trajectory has low hit multiplicity and is in a clean environment
288  bool TrajIsClean(TCSlice& slc, Trajectory& tj, bool prt);
289  void UpdateTjChgProperties(std::string inFcnLabel, TCSlice& slc, Trajectory& tj, bool prt);
290  void UpdateVxEnvironment(TCSlice& slc);
291  void UpdateVxEnvironment(TCSlice& slc, VtxStore& vx2, bool prt);
293  const TCSlice& slc,
294  const Point3_t& pos,
295  CTP_t inCTP);
296  // Make a bare trajectory point that only has position and direction defined
298  const TCSlice& slc,
299  const Point3_t& pos,
300  const Vector3_t& dir,
301  CTP_t inCTP);
302  bool MakeBareTrajPoint(const TCSlice& slc,
303  unsigned int fromHit,
304  unsigned int toHit,
305  TrajPoint& tp);
306  bool MakeBareTrajPoint(const TCSlice& slc,
307  float fromWire,
308  float fromTick,
309  float toWire,
310  float toTick,
311  CTP_t tCTP,
312  TrajPoint& tp);
313  bool MakeBareTrajPoint(const Point2_t& fromPos, const Point2_t& toPos, TrajPoint& tpOut);
314  bool MakeBareTrajPoint(const TCSlice& slc,
315  const TrajPoint& tpIn1,
316  const TrajPoint& tpIn2,
317  TrajPoint& tpOut);
318  unsigned short FarEnd(TCSlice& slc, const Trajectory& tj, const Point2_t& pos);
319  Vector2_t PointDirection(const Point2_t p1, const Point2_t p2);
320  void SetPDGCode(TCSlice& slc, Trajectory& tj);
321  void SetPDGCode(TCSlice& slc, unsigned short itj);
322  bool AnalyzeHits();
323  bool LongPulseHit(const recob::Hit& hit);
324  void FillWireHitRange(geo::TPCID inTPCID);
325  bool FillWireHitRange(detinfo::DetectorClocksData const& clockData,
327  TCSlice& slc);
328  // bool CheckWireHitRange(TCSlice& slc);
329  bool WireHitRangeOK(TCSlice& slc, const CTP_t& inCTP);
330  bool MergeAndStore(TCSlice& slc, unsigned int itj1, unsigned int itj2, bool doPrt);
331  std::vector<int> GetAssns(TCSlice& slc, std::string type1Name, int id, std::string type2Name);
332  // Start a trajectory going from fromHit to (toWire, toTick)
333  bool StartTraj(TCSlice& slc,
334  Trajectory& tj,
335  unsigned int fromhit,
336  unsigned int tohit,
337  unsigned short pass);
338  bool StartTraj(TCSlice& slc,
339  Trajectory& tj,
340  float fromWire,
341  float fromTick,
342  float toWire,
343  float toTick,
344  CTP_t& tCTP,
345  unsigned short pass);
346  bool Fit2D(short mode,
347  Point2_t inPt,
348  float& inPtErr,
349  Vector2_t& outVec,
350  Vector2_t& outVecErr,
351  float& chiDOF);
352  std::pair<unsigned short, unsigned short> GetSliceIndex(std::string typeName, int uID);
353  template <typename T>
354  std::vector<T> SetIntersection(const std::vector<T>& set1, const std::vector<T>& set2);
355  template <typename T>
356  std::vector<T> SetDifference(const std::vector<T>& set1, const std::vector<T>& set2);
357  bool DecodeDebugString(std::string ctpwt);
358  // ****************************** Printing ******************************
359  void DumpTj();
360  void PrintDebugMode();
361  void PrintAll(detinfo::DetectorPropertiesData const& detProp, std::string someText);
362  void PrintP(std::string someText, mf::LogVerbatim& myprt, PFPStruct& pfp, bool& printHeader);
364  std::string someText,
365  mf::LogVerbatim& myprt,
366  Vtx3Store& vx3,
367  bool& printHeader);
368  void Print2V(std::string someText, mf::LogVerbatim& myprt, VtxStore& vx2, bool& printHeader);
370  std::string someText,
371  mf::LogVerbatim& myprt,
372  ShowerStruct3D& ss3);
373  void PrintT(std::string someText, mf::LogVerbatim& myprt, Trajectory& tj, bool& printHeader);
374  void PrintTrajectory(std::string someText,
375  const TCSlice& slc,
376  const Trajectory& tj,
377  unsigned short tPoint);
379  std::string someText,
380  TCSlice& slc,
381  unsigned short itj,
382  unsigned short ipt,
383  bool printVtx = true);
384  void PrintTPHeader(std::string someText);
385  void PrintTP(std::string someText,
386  const TCSlice& slc,
387  unsigned short ipt,
388  short dir,
389  unsigned short pass,
390  const TrajPoint& tp);
391  std::string TPEnvString(const TrajPoint& tp);
392  void PrintPFP(std::string someText, TCSlice& slc, const PFPStruct& pfp, bool printHeader);
393  void PrintPFPs(std::string someText, TCSlice& slc);
394  // Print clusters after calling MakeAllTrajClusters
395  void PrintClusters();
396  // Print a single hit in the standard format
397  std::string PrintHit(const TCHit& hit);
398  std::string PrintHitShort(const TCHit& hit);
399  // Print Trajectory position in the standard format
400  std::string PrintPos(const TCSlice& slc, const TrajPoint& tp);
401  std::string PrintPos(const TCSlice& slc, const Point2_t& pos);
402  std::string PrintEndFlag(const Trajectory& tj, unsigned short end);
403  std::string PrintEndFlag(const PFPStruct& pfp, unsigned short end);
404 
405  ////////////////////////////////////////////////
406  template <typename T>
407  std::vector<T>
408  SetIntersection(const std::vector<T>& set1, const std::vector<T>& set2)
409  {
410  // returns a vector containing the elements of set1 and set2 that are common. This function
411  // is a replacement for std::set_intersection which fails in the following situation:
412  // set1 = {11 12 17 18} and set2 = {6 12 18}
413  // There is no requirement that the elements be sorted, unlike std::set_intersection
414  std::vector<T> shared;
415 
416  if (set1.empty()) return shared;
417  if (set2.empty()) return shared;
418  for (auto element1 : set1) {
419  // check for a common element
420  if (std::find(set2.begin(), set2.end(), element1) == set2.end()) continue;
421  // check for a duplicate
422  if (std::find(shared.begin(), shared.end(), element1) != shared.end()) continue;
423  shared.push_back(element1);
424  } // element1
425  return shared;
426  } // SetIntersection
427 
428  ////////////////////////////////////////////////
429  template <typename T>
430  std::vector<T>
431  SetDifference(const std::vector<T>& set1, const std::vector<T>& set2)
432  {
433  // returns the elements of set1 and set2 that are different
434  std::vector<T> different;
435  if (set1.empty() && set2.empty()) return different;
436  if (!set1.empty() && set2.empty()) return set1;
437  if (set1.empty() && !set2.empty()) return set2;
438  for (auto element1 : set1) {
439  // check for a common element
440  if (std::find(set2.begin(), set2.end(), element1) != set2.end()) continue;
441  // check for a duplicate
442  if (std::find(different.begin(), different.end(), element1) != different.end()) continue;
443  different.push_back(element1);
444  } // element1
445  for (auto element2 : set2) {
446  // check for a common element
447  if (std::find(set1.begin(), set1.end(), element2) != set1.end()) continue;
448  // check for a duplicate
449  if (std::find(different.begin(), different.end(), element2) != different.end()) continue;
450  different.push_back(element2);
451  } // element1
452  return different;
453  } // SetDifference
454 
455 } // namespace tca
456 
457 #endif // ifndef TRAJCLUSTERALGUTILS_H
void PrintAll(detinfo::DetectorPropertiesData const &detProp, std::string someText)
Definition: Utils.cxx:5521
float HitsPosTime(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
Definition: Utils.cxx:4279
void CheckTrajBeginChg(TCSlice &slc, unsigned short itj)
Definition: Utils.cxx:1337
void ReleaseHits(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:1062
short MCSMom(const TCSlice &slc, const std::vector< int > &tjIDs)
Definition: Utils.cxx:3468
unsigned short FarEnd(const TCSlice &slc, const PFPStruct &pfp, const Point3_t &pos)
Definition: PFPUtils.cxx:3339
void SetEndPoints(Trajectory &tj)
Definition: Utils.cxx:3413
void FitPar(const TCSlice &slc, const Trajectory &tj, unsigned short originPt, unsigned short npts, short fitDir, ParFit &pFit, unsigned short usePar)
Definition: Utils.cxx:1219
bool TrajHitsOK(TCSlice &slc, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
Definition: Utils.cxx:1873
bool InTrajOK(TCSlice &slc, std::string someText)
Definition: Utils.cxx:1276
unsigned short CloseEnd(const TCSlice &slc, const Trajectory &tj, const Point2_t &pos)
Definition: Utils.cxx:2551
std::vector< int > GetAssns(TCSlice &slc, std::string type1Name, int id, std::string type2Name)
Definition: Utils.cxx:4849
std::vector< unsigned int > PutTrajHitsInVector(const Trajectory &tj, HitStatus_t hitRequest)
Definition: Utils.cxx:2754
process_name opflash particleana ie x
std::array< double, 3 > Point3_t
Definition: DataStructs.h:41
bool SignalAtTp(TrajPoint &tp)
Definition: Utils.cxx:2004
void SetPDGCode(TCSlice &slc, unsigned short itj)
Definition: Utils.cxx:4350
void Print2V(std::string someText, mf::LogVerbatim &myprt, VtxStore &vx2, bool &printHeader)
Definition: Utils.cxx:5768
void Print3V(detinfo::DetectorPropertiesData const &detProp, std::string someText, mf::LogVerbatim &myprt, Vtx3Store &vx3, bool &printHeader)
Definition: Utils.cxx:5691
void PrintPFP(std::string someText, TCSlice &slc, const PFPStruct &pfp, bool printHeader)
Definition: Utils.cxx:6373
void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t &alongTrans)
Definition: PFPUtils.cxx:3097
void PrintTrajectory(std::string someText, const TCSlice &slc, const Trajectory &tj, unsigned short tPoint)
Definition: Utils.cxx:6195
void PrintClusters()
void PrintTP(std::string someText, const TCSlice &slc, unsigned short ipt, short dir, unsigned short pass, const TrajPoint &tp)
Definition: Utils.cxx:6296
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
bool WireHitRangeOK(TCSlice &slc, const CTP_t &inCTP)
Definition: Utils.cxx:4653
void UnsetUsedHits(TCSlice &slc, TrajPoint &tp)
Definition: Utils.cxx:1075
std::string PrintEndFlag(const PFPStruct &pfp, unsigned short end)
Definition: Utils.cxx:6463
void PrintT(std::string someText, mf::LogVerbatim &myprt, Trajectory &tj, bool &printHeader)
Definition: Utils.cxx:5860
bool StoreTraj(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:1089
float TpSumHitChg(const TCSlice &slc, TrajPoint const &tp)
Definition: Utils.cxx:2104
std::string PrintPos(const TCSlice &slc, const TrajPoint &tp)
Definition: Utils.cxx:6526
void ChkChgAsymmetry(TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:1741
float ExpectedHitsRMS(TCSlice &slc, const TrajPoint &tp)
Definition: Utils.cxx:1947
bool TrajClosestApproach(Trajectory const &tj, float x, float y, unsigned short &closePt, float &DOCA)
Definition: Utils.cxx:2690
void FillWireHitRange(geo::TPCID inTPCID)
Definition: Utils.cxx:4461
float TrajPointSeparation(const TrajPoint &tp1, const TrajPoint &tp2)
Definition: Utils.cxx:2680
void SetAngleCode(TrajPoint &tp)
Definition: Utils.cxx:773
void PrintP(std::string someText, mf::LogVerbatim &myprt, PFPStruct &pfp, bool &printHeader)
Definition: Utils.cxx:5605
float PointTrajDOCA(const TCSlice &slc, unsigned int iht, TrajPoint const &tp)
Definition: Utils.cxx:2572
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
Definition: PFPUtils.cxx:2540
bool StartTraj(TCSlice &slc, Trajectory &tj, unsigned int fromhit, unsigned int tohit, unsigned short pass)
Definition: Utils.cxx:5001
process_name hit
Definition: cheaterreco.fcl:51
bool MakeBareTrajPoint(const TCSlice &slc, unsigned int fromHit, unsigned int toHit, TrajPoint &tp)
Definition: Utils.cxx:4110
bool LongPulseHit(const recob::Hit &hit)
Definition: Utils.cxx:4452
float MCSThetaRMS(const TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:3541
float TPHitsRMSTime(const TCSlice &slc, const TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:4202
unsigned short NumUsedHitsInTj(const TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:4314
std::string TPEnvString(const TrajPoint &tp)
Definition: Utils.cxx:6353
void PrintPFPs(std::string someText, TCSlice &slc)
Definition: Utils.cxx:6444
float MaxTjLen(const TCSlice &slc, std::vector< int > &tjIDs)
Definition: Utils.cxx:2630
void Print3S(detinfo::DetectorPropertiesData const &detProp, std::string someText, mf::LogVerbatim &myprt, ShowerStruct3D &ss3)
Definition: Utils.cxx:5819
bool MergeTjIntoPFP(TCSlice &slc, int mtjid, PFPStruct &pfp, bool prt)
Definition: Utils.cxx:513
double DeltaAngle2(double Ang1, double Ang2)
Definition: Utils.cxx:3393
std::vector< T > SetIntersection(const std::vector< T > &set1, const std::vector< T > &set2)
std::string PrintHitShort(const TCHit &tch)
Definition: Utils.cxx:6506
TrajPoint MakeBareTP(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, const Point3_t &pos, CTP_t inCTP)
Definition: Utils.cxx:4027
float OverlapFraction(const TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2)
Definition: Utils.cxx:713
float HitsRMSTime(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
Definition: Utils.cxx:4237
bool CompatibleMerge(const TCSlice &slc, std::vector< int > &tjIDs, bool prt)
Definition: Utils.cxx:580
std::vector< unsigned int > PutHitsInVector(const TCSlice &slc, PFPStruct const &pfp, HitStatus_t hitRequest)
Definition: Utils.cxx:2731
float HitSep2(const TCSlice &slc, unsigned int iht, unsigned int jht)
Definition: Utils.cxx:2538
int NeutrinoPrimaryTjID(const TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:444
float HitsRMSTick(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
Definition: Utils.cxx:4246
void PrintAllTraj(detinfo::DetectorPropertiesData const &detProp, std::string someText, TCSlice &slc, unsigned short itj, unsigned short ipt, bool prtVtx)
Definition: Utils.cxx:5952
int PrimaryID(const TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:467
process_name opflash particleana ie ie y
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
bool TrajIsClean(TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:3442
float DeadWireCount(const TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2)
Definition: Utils.cxx:2141
bool BraggSplit(TCSlice &slc, unsigned short itj)
Definition: Utils.cxx:1444
unsigned short NearbyCleanPt(const TCSlice &slc, const Trajectory &tj, unsigned short end)
Definition: Utils.cxx:2956
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
Definition: PFPUtils.cxx:2548
void DumpTj()
Definition: Utils.cxx:5400
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:44
float ElectronLikelihood(const TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:3216
float TwoTPAngle(const TrajPoint &tp1, const TrajPoint &tp2)
Definition: Utils.cxx:2721
float KinkSignificance(TCSlice &slc, Trajectory &tj1, unsigned short end1, Trajectory &tj2, unsigned short end2, unsigned short nPtsFit, bool useChg, bool prt)
Definition: Utils.cxx:3056
const char mode
Definition: noise_ana.cxx:20
float ChgFracNearPos(const TCSlice &slc, const Point2_t &pos, const std::vector< int > &tjIDs)
Definition: Utils.cxx:3236
std::vector< unsigned int > FindCloseHits(const TCSlice &slc, std::array< int, 2 > const &wireWindow, Point2_t const &timeWindow, const unsigned short plane, HitStatus_t hitRequest, bool usePeakTime, bool &hitsNear)
Definition: Utils.cxx:2843
float ChgFracBetween(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, Point3_t pos1, Point3_t pos2)
Definition: PFPUtils.cxx:3197
void MakeHaloTj(TCSlice &slc, Trajectory &muTj, bool prt)
Definition: Utils.cxx:47
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
bool PointInsideEnvelope(const Point2_t &Point, const std::vector< Point2_t > &Envelope)
Definition: Utils.cxx:3323
void ChkEndKink(TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:1707
void TagJunkTj(TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:2782
void MakeTrajectoryObsolete(TCSlice &slc, unsigned int itj)
Definition: Utils.cxx:2184
float PointTrajDOCA2(const TCSlice &slc, float wire, float time, TrajPoint const &tp)
Definition: Utils.cxx:2590
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:2572
unsigned short GetPFPIndex(const TCSlice &slc, int tjID)
Definition: Utils.cxx:1050
void FitTraj(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:808
std::string PrintHit(const TCHit &tch)
Definition: Utils.cxx:6516
bool Fit2D(short mode, Point2_t inPt, float &inPtErr, Vector2_t &outVec, Vector2_t &outVecErr, float &chiDOF)
Definition: Utils.cxx:5129
bool SplitTraj(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, unsigned short itj, float XPos, bool makeVx2, bool prt)
Definition: Utils.cxx:2272
void TrajPointTrajDOCA(const TCSlice &slc, TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
Definition: Utils.cxx:2435
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
float MaxChargeAsymmetry(TCSlice &slc, std::vector< int > &tjIDs)
Definition: Utils.cxx:374
unsigned short NearestPtWithChg(const TCSlice &slc, const Trajectory &tj, unsigned short thePt)
Definition: Utils.cxx:3522
bool valsIncreasing(const SortEntry &c1, const SortEntry &c2)
Definition: Utils.cxx:39
bool SetMag(Vector3_t &v1, double mag)
Definition: PFPUtils.cxx:2583
std::array< double, 2 > Vector2_t
Definition: DataStructs.h:44
void ReverseTraj(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:3294
unsigned short NumHitsInTP(const TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:4328
void TrimEndPts(std::string fcnLabel, TCSlice &slc, Trajectory &tj, const std::vector< float > &fQualityCuts, bool prt)
Definition: Utils.cxx:1600
void DefineTjParents(TCSlice &slc, bool prt)
Definition: Utils.cxx:168
float HitsPosTick(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
Definition: Utils.cxx:4289
void UpdateTjChgProperties(std::string inFcnLabel, TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:3673
tuple dir
Definition: dropbox.py:28
bool MergeAndStore(TCSlice &slc, unsigned int itj1, unsigned int itj2, bool doPrt)
Definition: Utils.cxx:4664
float PointPull(const PFPStruct &pfp, const TP3D &tp3d)
Definition: PFPUtils.cxx:2815
void RestoreObsoleteTrajectory(TCSlice &slc, unsigned int itj)
Definition: Utils.cxx:2197
void TrajIntersection(TrajPoint const &tp1, TrajPoint const &tp2, Point2_t &pos)
Definition: Utils.cxx:2604
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
Definition: PFPUtils.h:128
unsigned int CTP_t
Definition: DataStructs.h:47
bool DecodeDebugString(std::string strng)
Definition: Utils.cxx:5216
bool AnalyzeHits()
Definition: Utils.cxx:4394
Contains all timing reference information for the detector.
float MaxHitDelta(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:3276
float TrajLength(const Trajectory &tj)
Definition: Utils.cxx:2646
void UpdateVxEnvironment(TCSlice &slc)
Definition: Utils.cxx:3862
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:2565
void TrimHiChgEndPts(TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:1557
unsigned short PDGCodeIndex(int PDGCode)
Definition: Utils.cxx:2171
bool valsDecreasing(const SortEntry &c1, const SortEntry &c2)
Definition: Utils.cxx:38
std::pair< unsigned short, unsigned short > GetSliceIndex(std::string typeName, int uID)
Definition: Utils.cxx:5088
float PointTrajSep2(float wire, float time, TrajPoint const &tp)
Definition: Utils.cxx:2563
std::array< double, 3 > Vector3_t
Definition: DataStructs.h:42
bool SignalAtTpInSlc(const TCSlice &slc, const TrajPoint &tp)
Definition: Utils.cxx:1962
void PrintDebugMode()
Definition: Utils.cxx:5450
std::vector< T > SetDifference(const std::vector< T > &set1, const std::vector< T > &set2)
finds tracks best matching by angle
bool NearbySrcHit(geo::PlaneID plnID, unsigned int wire, float loTick, float hiTick)
Definition: Utils.cxx:2071
void TjDeltaRMS(const TCSlice &slc, const Trajectory &tj, unsigned short firstPt, unsigned short lastPt, double &rms, unsigned short &cnt)
Definition: Utils.cxx:3584
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
std::vector< int > FindCloseTjs(const TCSlice &slc, const TrajPoint &fromTp, const TrajPoint &toTp, const float &maxDelta)
Definition: Utils.cxx:2977
bool SignalBetween(const TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2, const float &MinWireSignalFraction)
Definition: Utils.cxx:1807
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
void MoveTPToWire(TrajPoint &tp, float wire)
Definition: Utils.cxx:2831
unsigned short NumPtsWithCharge(const TCSlice &slc, const Trajectory &tj, bool includeDeadWires)
Definition: Utils.cxx:2116
void MergeGhostTjs(TCSlice &slc, CTP_t inCTP)
Definition: Utils.cxx:2220
int PrimaryUID(const TCSlice &slc, const PFPStruct &pfp)
Definition: Utils.cxx:487
bool TrajTrajDOCA(const TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep)
Definition: Utils.cxx:2460
float TPHitsRMSTick(const TCSlice &slc, const TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:4209
physics associatedGroupsWithLeft p1
void PrintTPHeader(std::string someText)
Definition: Utils.cxx:6287
auto const detProp
unsigned short AngleRange(TrajPoint const &tp)
Definition: Utils.cxx:766
void SetTPEnvironment(TCSlice &slc, CTP_t inCTP)
Definition: Utils.cxx:3626
bool HasDuplicateHits(const TCSlice &slc, Trajectory const &tj, bool prt)
Definition: Utils.cxx:2812
void ChkMissedKink(TCSlice &slc, Trajectory &tj, bool prt)