LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
Utils.h
Go to the documentation of this file.
1 //
3 //
4 // TCAlg utilities
5 //
6 // Bruce Baller
7 //
9 #ifndef TRAJCLUSTERALGUTILS_H
10 #define TRAJCLUSTERALGUTILS_H
11 
12 // C/C++ standard libraries
13 #include <array>
14 #include <vector>
15 #include <bitset>
16 #include <utility> // std::pair<>
17 #include <cmath>
18 #include <iostream>
19 #include <iomanip>
20 #include <algorithm>
21 
23 
24 // LArSoft libraries
26 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h"
27 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h"
34 
35 namespace tca {
36 
37  typedef enum {
41  } HitStatus_t ;
42 
43  // ****************************** General purpose ******************************
44 
45  void DefineTjParents(TjStuff& tjs, const geo::TPCID& tpcid, bool prt);
46  float MaxChargeAsymmetry(TjStuff& tjs, std::vector<int>& tjIDs);
47  int PDGCodeVote(TjStuff& tjs, std::vector<int>& tjIDs, bool prt);
48  unsigned short NumDeltaRays(const TjStuff& tjs, const Trajectory& tj);
49  unsigned short NumDeltaRays(const TjStuff& tjs, std::vector<int>& tjIDs);
50  int NeutrinoPrimaryTjID(const TjStuff& tjs, const Trajectory& tj);
51  int PrimaryID(const TjStuff& tjs, const Trajectory& tj);
52  int PrimaryID(const TjStuff& tjs, const PFPStruct& pfp);
53  bool MergeTjIntoPFP(TjStuff& tjs, int mtjid, PFPStruct& pfp, bool prt);
54  bool CompatibleMerge(TjStuff& tjs, std::vector<int>& tjIDs, bool prt);
55  bool CompatibleMerge(TjStuff& tjs, const Trajectory& tj1, const Trajectory& tj2, bool prt);
56  float OverlapFraction(TjStuff& tjs, const Trajectory& tj1, const Trajectory& tj2);
57  unsigned short AngleRange(TjStuff& tjs, TrajPoint const& tp);
58  void SetAngleCode(TjStuff& tjs, TrajPoint& tp);
59  unsigned short AngleRange(TjStuff& tjs, float angle);
60  void FitTraj(TjStuff& tjs, Trajectory& tj);
61  void FitTraj(TjStuff& tjs, Trajectory& tj, unsigned short originPt, unsigned short npts, short fitDir, TrajPoint& tpFit);
62  float TjDirFOM(const TjStuff& tjs, const Trajectory& tj, bool prt);
63  void WatchHit(std::string someText, TjStuff& tjs, const unsigned int& watchHit, short& watchInTraj, const unsigned short& tjID);
64  unsigned short GetPFPIndex(const TjStuff& tjs, int tjID);
65  unsigned short MatchVecIndex(const TjStuff& tjs, int tjID);
66  void ReleaseHits(TjStuff& tjs, Trajectory& tj);
67  void UnsetUsedHits(TjStuff& tjs, TrajPoint& tp);
68  bool StoreTraj(TjStuff& tjs, Trajectory& tj);
69  bool InTrajOK(TjStuff& tjs, std::string someText);
70  void CheckTrajBeginChg(TjStuff& tjs, unsigned short itj, bool prt);
71  void TrimEndPts(std::string fcnLabel, TjStuff& tjs, Trajectory& tj, const std::vector<float>& fQualityCuts, bool prt);
72  void ChkChgAsymmetry(TjStuff& tjs, Trajectory& tj, bool prt);
73  bool SignalBetween(TjStuff& tjs, const TrajPoint& tp1, const TrajPoint& tp2, const float& MinWireSignalFraction, bool prt);
74  bool SignalBetween(TjStuff& tjs, TrajPoint tp, float toPos0, const float& MinWireSignalFraction, bool prt);
75  float ChgFracBetween(TjStuff& tjs, TrajPoint tp, float toPos0, bool prt);
76  bool TrajHitsOK(TjStuff& tjs, const std::vector<unsigned int>& iHitsInMultiplet, const std::vector<unsigned int>& jHitsInMultiplet);
77  bool TrajHitsOK(TjStuff& tjs, const unsigned int iht, const unsigned int jht);
78  float ExpectedHitsRMS(TjStuff& tjs, const TrajPoint& tp);
79  bool SignalAtTp(TjStuff& tjs, TrajPoint const& tp);
80  float TpSumHitChg(TjStuff& tjs, TrajPoint const& tp);
81 // bool CheckHitClusterAssociations(TjStuff& tjs);
82  unsigned short NumPtsWithCharge(const TjStuff& tjs, const Trajectory& tj, bool includeDeadWires);
83  unsigned short NumPtsWithCharge(const TjStuff& tjs, const Trajectory& tj, bool includeDeadWires, unsigned short firstPt, unsigned short lastPt);
84  float DeadWireCount(const TjStuff& tjs, const TrajPoint& tp1, const TrajPoint& tp2);
85  float DeadWireCount(const TjStuff& tjs, const float& inWirePos1, const float& inWirePos2, CTP_t tCTP);
86  unsigned short PDGCodeIndex(TjStuff& tjs, int PDGCode);
87  void MakeTrajectoryObsolete(TjStuff& tjs, unsigned int itj);
88  void RestoreObsoleteTrajectory(TjStuff& tjs, unsigned int itj);
89  void MergeGhostTjs(TjStuff& tjs, CTP_t inCTP);
90  // Split the allTraj trajectory itj at position pos into two trajectories
91  // with an optional vertex assignment
92  bool SplitTraj(TjStuff& tjs, unsigned short itj, unsigned short pos, unsigned short ivx, bool prt);
93  bool SplitTraj(TjStuff& tjs, unsigned short itj, float XPos, bool makeVx2, bool prt);
94  bool TrajClosestApproach(Trajectory const& tj, float x, float y, unsigned short& closePt, float& DOCA);
95  // returns the DOCA between a hit and a trajectory
96  float PointTrajDOCA(TjStuff const& tjs, unsigned int iht, TrajPoint const& tp);
97  // returns the DOCA between a (W,T) point and a trajectory
98  float PointTrajDOCA(TjStuff const& tjs, float wire, float time, TrajPoint const& tp);
99  // returns the DOCA^2 between a point and a trajectory
100  float PointTrajDOCA2(TjStuff const& tjs, float wire, float time, TrajPoint const& tp);
101  // Fills tp.Hits sets tp.UseHit true for hits that are close to tp.Pos. Returns true if there are
102  // close hits OR if the wire at this position is dead
103  bool FindCloseHits(TjStuff const& tjs, TrajPoint& tp, float const& maxDelta, HitStatus_t hitRequest);
104  std::vector<unsigned int> FindCloseHits(TjStuff const& tjs, std::array<int, 2> const& wireWindow, Point2_t const& timeWindow, const unsigned short plane, HitStatus_t hitRequest, bool usePeakTime, bool& hitsNear);
105  std::vector<int> FindCloseTjs(const TjStuff& tjs, const TrajPoint& fromTp, const TrajPoint& toTp, const float& maxDelta);
106 // void PrimaryElectronLikelihood(TjStuff& tjs, Trajectory& tj, float& likelihood, bool& flipDirection, bool prt);
107  float ChgFracNearPos(TjStuff& tjs, const Point2_t& pos, const std::vector<int>& tjIDs);
108  float MaxHitDelta(TjStuff& tjs, Trajectory& tj);
109  void ReverseTraj(TjStuff& tjs, Trajectory& tj);
110  // returns the end of a trajectory that is closest to a point
111  unsigned short CloseEnd(TjStuff& tjs, const Trajectory& tj, const Point2_t& pos);
112  // returns the separation^2 between a point and a TP
113  float PointTrajSep2(float wire, float time, TrajPoint const& tp);
114  float PosSep(const Point2_t& pos1, const Point2_t& pos2);
115  float PosSep2(const Point2_t& pos1, const Point2_t& pos2);
116  // finds the point on trajectory tj that is closest to trajpoint tp
117  void TrajPointTrajDOCA(TjStuff& tjs, TrajPoint const& tp, Trajectory const& tj, unsigned short& closePt, float& minSep);
118  // returns the intersection position, intPos, of two trajectory points
119  void TrajIntersection(TrajPoint const& tp1, TrajPoint const& tp2, Point2_t& pos);
120  void TrajIntersection(TrajPoint const& tp1, TrajPoint const& tp2, float& x, float& y);
121  float MaxTjLen(TjStuff const& tjs, std::vector<int>& tjIDs);
122  // Returns the separation distance between two trajectory points
123  float TrajPointSeparation(TrajPoint& tp1, TrajPoint& tp2);
124  float TrajLength(Trajectory& tj);
125  // returns the separation^2 between two hits in WSE units
126  float HitSep2(TjStuff& tjs, unsigned int iht, unsigned int jht);
127  // Find the Distance Of Closest Approach between two trajectories, exceeding minSep
128  bool TrajTrajDOCA(const TjStuff& tjs, const Trajectory& tp1, const Trajectory& tp2, unsigned short& ipt1, unsigned short& ipt2, float& minSep);
129  bool TrajTrajDOCA(const TjStuff& tjs, const Trajectory& tp1, const Trajectory& tp2, unsigned short& ipt1, unsigned short& ipt2, float& minSep, bool considerDeadWires);
130  // Calculates the angle between two TPs
131  float TwoTPAngle(TrajPoint& tp1, TrajPoint& tp2);
132  void TagJunkTj(TjStuff const& tjs, Trajectory& tj, bool prt);
133  // Put hits in each trajectory point into a flat vector.
134  std::vector<unsigned int> PutTrajHitsInVector(Trajectory const& tj, HitStatus_t hitRequest);
135  // returns true if a hit is associated with more than one point
136  bool HasDuplicateHits(TjStuff const& tjs, Trajectory const& tj, bool prt);
137  // Project TP to a "wire position" Pos[0] and update Pos[1]
138  void MoveTPToWire(TrajPoint& tp, float wire);
139  bool PointInsideEnvelope(const Point2_t& Point, const std::vector<Point2_t>& Envelope);
140  bool SetMag(Vector2_t& v1, double mag);
141  void FindAlongTrans(Point2_t pos1, Vector2_t dir1, Point2_t pos2, Point2_t& alongTrans);
142  inline double DotProd(const Vector2_t& v1, const Vector2_t& v2) {return v1[0]*v2[0] + v1[1]*v2[1]; }
143  double DeltaAngle(double Ang1, double Ang2);
144  double DeltaAngle2(double Ang1, double Ang2);
145  double DeltaAngle(const Point2_t& p1, const Point2_t& p2);
146  // Find the first (last) TPs, EndPt[0] (EndPt[1], that have charge
147  void SetEndPoints(TjStuff& tjs, Trajectory& tj);
148  // Returns the hit width using StartTick() and EndTick()
149  float TPHitsRMSTick(TjStuff& tjs, TrajPoint& tp, HitStatus_t hitRequest);
150  float TPHitsRMSTime(TjStuff& tjs, TrajPoint& tp, HitStatus_t hitRequest);
151  float HitsRMSTick(TjStuff& tjs, const std::vector<unsigned int>& hitsInMultiplet, HitStatus_t hitRequest);
152  float HitsRMSTime(TjStuff& tjs, const std::vector<unsigned int>& hitsInMultiplet, HitStatus_t hitRequest);
153  float HitsPosTick(TjStuff& tjs, const std::vector<unsigned int>& hitsInMultiplet, float& chg, HitStatus_t hitRequest);
154  float HitsPosTime(TjStuff& tjs, const std::vector<unsigned int>& hitsInMultiplet, float& chg, HitStatus_t hitRequest);
155  unsigned short NumHitsInTP(const TrajPoint& tp, HitStatus_t hitRequest);
156  unsigned short NumUsedHitsInTj(const TjStuff& tjs, const Trajectory& tj);
157  unsigned short NearestPtWithChg(TjStuff& tjs, Trajectory& tj, unsigned short thePt);
158  // Calculate MCS momentum
159  short MCSMom(const TjStuff& tjs, const std::vector<int>& tjIDs);
160  short MCSMom(TjStuff& tjs, Trajectory& tj);
161  short MCSMom(TjStuff& tjs, Trajectory& tj, unsigned short FirstPt, unsigned short lastPt);
162  // Calculate MCS theta RMS over the points specified. Returns MCS angle for the full length
163  double MCSThetaRMS(TjStuff& tjs, Trajectory& tj, unsigned short firstPt, unsigned short lastPt);
164  // Calculate MCS theta RMS over the entire length. Returns MCS angle for 1 WSE unit
165  float MCSThetaRMS(TjStuff& tjs, Trajectory& tj);
166  void TjDeltaRMS(TjStuff& tjs, Trajectory& tj, unsigned short firstPt, unsigned short lastPt, double& rms, unsigned short& cnt);
167  // Returns true if the trajectory has low hit multiplicity and is in a clean environment
168  bool TrajIsClean(TjStuff& tjs, Trajectory& tj, bool prt);
169  // Flag delta ray trajectories in allTraj
170  void TagDeltaRays(TjStuff& tjs, const CTP_t& inCTP);
171  // Tag muon directions using delta proximity
172  void TagMuonDirections(TjStuff& tjs, short debugWorkID);
173  void UpdateTjChgProperties(std::string inFcnLabel, TjStuff& tjs, Trajectory& tj, bool prt);
174  void UpdateVxEnvironment(std::string inFcnLabel, TjStuff& tjs, VtxStore& vx2, bool prt);
175  // Make a bare trajectory point that only has position and direction defined
176  TrajPoint MakeBareTP(TjStuff& tjs, Point3_t& pos, Vector3_t& dir, CTP_t inCTP);
177  bool MakeBareTrajPoint(const TjStuff& tjs, unsigned int fromHit, unsigned int toHit, TrajPoint& tp);
178  bool MakeBareTrajPoint(const TjStuff& tjs, float fromWire, float fromTick, float toWire, float toTick, CTP_t tCTP, TrajPoint& tp);
179  bool MakeBareTrajPoint(const Point2_t& fromPos, const Point2_t& toPos, TrajPoint& tpOut);
180  bool MakeBareTrajPoint(const TjStuff& tjs, const TrajPoint& tpIn1, const TrajPoint& tpIn2, TrajPoint& tpOut);
181  unsigned short FarEnd(const TjStuff& tjs, const Trajectory& tj, const Point2_t& pos);
182  Vector2_t PointDirection(const Point2_t p1, const Point2_t p2);
183  void SetPDGCode(TjStuff& tjs, Trajectory& tj);
184  void SetPDGCode(TjStuff& tjs, unsigned short itj);
185  bool FillWireHitRange(TjStuff& tjs, const geo::TPCID& tpcid);
186  bool CheckWireHitRange(const TjStuff& tjs);
187  bool WireHitRangeOK(const TjStuff& tjs, const CTP_t& inCTP);
188  bool MergeAndStore(TjStuff& tjs, unsigned int itj1, unsigned int itj2, bool doPrt);
189  std::vector<int> GetAssns(const TjStuff& tjs, std::string type1Name, int id, std::string type2Name);
190  template <typename T>
191  std::vector<T> SetIntersection(const std::vector<T>& set1, const std::vector<T>& set2);
192  template <typename T>
193  std::vector<T> SetDifference(const std::vector<T>& set1, const std::vector<T>& set2);
194  // ****************************** Printing ******************************
195  // Print trajectories, TPs, etc to mf::LogVerbatim
196  void PrintTrajectory(std::string someText, const TjStuff& tjs, const Trajectory& tj ,unsigned short tPoint);
197  void PrintAllTraj(std::string someText, const TjStuff& tjs, const DebugStuff& Debug, unsigned short itj, unsigned short ipt, bool printVtx = true);
198  void PrintHeader(std::string someText);
199  void PrintTrajPoint(std::string someText, const TjStuff& tjs, unsigned short ipt, short dir, unsigned short pass, TrajPoint const& tp);
200  void PrintPFP(std::string someText, const TjStuff& tjs, const PFPStruct& pfp, bool printHeader);
201  void PrintPFPs(std::string someText, const TjStuff& tjs);
202  // Print clusters after calling MakeAllTrajClusters
203  void PrintClusters();
204  // Print a single hit in the standard format
205  std::string PrintHit(const TCHit& hit);
206  std::string PrintHitShort(const TCHit& hit);
207  // Print Trajectory position in the standard format
208  std::string PrintPos(const TjStuff& tjs, const TrajPoint& tp);
209  std::string PrintPos(const TjStuff& tjs, const Point2_t& pos);
210  std::string PrintStopFlag(const Trajectory& tj, unsigned short end);
211 
213  template <typename T>
214  std::vector<T> SetIntersection(const std::vector<T>& set1, const std::vector<T>& set2)
215  {
216  // returns a vector containing the elements of set1 and set2 that are common. This function
217  // is a replacement for std::set_intersection which fails in the following situation:
218  // set1 = {11 12 17 18} and set2 = {6 12 18}
219  // There is no requirement that the elements be sorted, unlike std::set_intersection
220  std::vector<T> shared;
221 
222  if(set1.empty()) return shared;
223  if(set2.empty()) return shared;
224  for(auto element1 : set1) {
225  // check for a common element
226  if(std::find(set2.begin(), set2.end(), element1) == set2.end()) continue;
227  // check for a duplicate
228  if(std::find(shared.begin(), shared.end(), element1) != shared.end()) continue;
229  shared.push_back(element1);
230  } // element1
231  return shared;
232  } // SetIntersection
233 
235  template <typename T>
236  std::vector<T> SetDifference(const std::vector<T>& set1, const std::vector<T>& set2)
237  {
238  // returns the elements of set1 and set2 that are different
239  std::vector<T> different;
240  if(set1.empty() && set2.empty()) return different;
241  if(!set1.empty() && set2.empty()) return set1;
242  if(set1.empty() && !set2.empty()) return set2;
243  for(auto element1 : set1) {
244  // check for a common element
245  if(std::find(set2.begin(), set2.end(), element1) != set2.end()) continue;
246  // check for a duplicate
247  if(std::find(different.begin(), different.end(), element1) != different.end()) continue;
248  different.push_back(element1);
249  } // element1
250  for(auto element2 : set2) {
251  // check for a common element
252  if(std::find(set1.begin(), set1.end(), element2) != set1.end()) continue;
253  // check for a duplicate
254  if(std::find(different.begin(), different.end(), element2) != different.end()) continue;
255  different.push_back(element2);
256  } // element1
257  return different;
258  } // SetDifference
259 
260 } // namespace tca
261 
262 #endif // ifndef TRAJCLUSTERALGUTILS_H
Float_t x
Definition: compare.C:6
int PrimaryID(const TjStuff &tjs, const Trajectory &tj)
Definition: Utils.cxx:385
unsigned short MatchVecIndex(const TjStuff &tjs, int tjID)
Definition: Utils.cxx:1058
std::string PrintPos(const TjStuff &tjs, const TrajPoint &tp)
Definition: Utils.cxx:4738
std::vector< unsigned int > FindCloseHits(TjStuff const &tjs, std::array< int, 2 > const &wireWindow, Point2_t const &timeWindow, const unsigned short plane, HitStatus_t hitRequest, bool usePeakTime, bool &hitsNear)
Definition: Utils.cxx:2362
void ChkChgAsymmetry(TjStuff &tjs, Trajectory &tj, bool prt)
Definition: Utils.cxx:1436
float TPHitsRMSTime(TjStuff &tjs, TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:3576
struct of temporary 2D vertices (end points)
Definition: DataStructs.h:83
void PrintTrajectory(std::string someText, const TjStuff &tjs, const Trajectory &tj, unsigned short tPoint)
Definition: Utils.cxx:4488
float OverlapFraction(TjStuff &tjs, const Trajectory &tj1, const Trajectory &tj2)
Definition: Utils.cxx:584
float HitSep2(TjStuff &tjs, unsigned int iht, unsigned int jht)
Definition: Utils.cxx:2110
std::array< double, 3 > Point3_t
Definition: DataStructs.h:35
void UpdateVxEnvironment(std::string inFcnLabel, TjStuff &tjs, VtxStore &vx2, bool prt)
Definition: Utils.cxx:3297
void RestoreObsoleteTrajectory(TjStuff &tjs, unsigned int itj)
Definition: Utils.cxx:1808
unsigned short AngleRange(TjStuff &tjs, TrajPoint const &tp)
Definition: Utils.cxx:636
void PrintAllTraj(std::string someText, const TjStuff &tjs, const DebugStuff &debug, unsigned short itj, unsigned short ipt, bool prtVtx)
Definition: Utils.cxx:4232
bool HasDuplicateHits(TjStuff const &tjs, Trajectory const &tj, bool prt)
Definition: Utils.cxx:2335
std::vector< unsigned int > PutTrajHitsInVector(Trajectory const &tj, HitStatus_t hitRequest)
Definition: Utils.cxx:2283
void TagJunkTj(TjStuff const &tjs, Trajectory &tj, bool prt)
Definition: Utils.cxx:2309
unsigned short NearestPtWithChg(TjStuff &tjs, Trajectory &tj, unsigned short thePt)
Definition: Utils.cxx:2889
float ChgFracBetween(TjStuff &tjs, Point3_t pos1, Point3_t pos2, geo::TPCID tpcid)
Definition: PFPUtils.cxx:2860
unsigned short PDGCodeIndex(TjStuff &tjs, int PDGCode)
Definition: Utils.cxx:1783
Declaration of signal hit object.
void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t &alongTrans)
Definition: PFPUtils.cxx:2751
Float_t y
Definition: compare.C:6
void PrintClusters()
float TpSumHitChg(TjStuff &tjs, TrajPoint const &tp)
Definition: Utils.cxx:1678
bool TrajHitsOK(TjStuff &tjs, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
Definition: Utils.cxx:1563
float HitsRMSTime(TjStuff &tjs, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
Definition: Utils.cxx:3607
float HitsRMSTick(TjStuff &tjs, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
Definition: Utils.cxx:3613
void TrimEndPts(std::string fcnLabel, TjStuff &tjs, Trajectory &tj, const std::vector< float > &fQualityCuts, bool prt)
Definition: Utils.cxx:1342
bool TrajClosestApproach(Trajectory const &tj, float x, float y, unsigned short &closePt, float &DOCA)
Definition: Utils.cxx:2244
float TrajPointSeparation(TrajPoint &tp1, TrajPoint &tp2)
Definition: Utils.cxx:2235
void SetAngleCode(TjStuff &tjs, TrajPoint &tp)
Definition: Utils.cxx:642
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
Definition: PFPUtils.cxx:1607
bool MergeTjIntoPFP(TjStuff &tjs, int mtjid, PFPStruct &pfp, bool prt)
Definition: Utils.cxx:428
HitStatus_t
Definition: Utils.h:37
float DeadWireCount(const TjStuff &tjs, const TrajPoint &tp1, const TrajPoint &tp2)
Definition: Utils.cxx:1756
bool CompatibleMerge(TjStuff &tjs, std::vector< int > &tjIDs, bool prt)
Definition: Utils.cxx:455
void MergeGhostTjs(TjStuff &tjs, CTP_t inCTP)
Definition: Utils.cxx:1830
double DeltaAngle2(double Ang1, double Ang2)
Definition: Utils.cxx:2772
std::vector< T > SetIntersection(const std::vector< T > &set1, const std::vector< T > &set2)
Definition: Utils.h:214
unsigned short FarEnd(const TjStuff &tjs, const PFPStruct &pfp, const Point3_t &pos)
Definition: PFPUtils.cxx:2936
bool SignalAtTp(TjStuff &tjs, const TrajPoint &tp)
Definition: Utils.cxx:1639
void TagDeltaRays(TjStuff &tjs, const CTP_t &inCTP)
Definition: Utils.cxx:2985
void CheckTrajBeginChg(TjStuff &tjs, unsigned short itj, bool prt)
Definition: Utils.cxx:1272
bool TrajIsClean(TjStuff &tjs, Trajectory &tj, bool prt)
Definition: Utils.cxx:2814
void ReleaseHits(TjStuff &tjs, Trajectory &tj)
Definition: Utils.cxx:1070
void ReverseTraj(TjStuff &tjs, Trajectory &tj)
Definition: Utils.cxx:2666
bool SplitTraj(TjStuff &tjs, unsigned short itj, float XPos, bool makeVx2, bool prt)
Definition: Utils.cxx:1879
bool CheckWireHitRange(const TjStuff &tjs)
Definition: Utils.cxx:3855
std::array< float, 2 > Point2_t
Definition: DataStructs.h:37
int PDGCodeVote(TjStuff &tjs, std::vector< int > &tjIDs, bool prt)
Definition: Utils.cxx:267
float PointTrajDOCA2(TjStuff const &tjs, float wire, float time, TrajPoint const &tp)
Definition: Utils.cxx:2153
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
Definition: PFPUtils.cxx:1614
float HitsPosTime(TjStuff &tjs, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
Definition: Utils.cxx:3639
void UpdateTjChgProperties(std::string inFcnLabel, TjStuff &tjs, Trajectory &tj, bool prt)
Definition: Utils.cxx:3118
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
unsigned short NumDeltaRays(const TjStuff &tjs, const Trajectory &tj)
Definition: Utils.cxx:335
bool SignalBetween(TjStuff &tjs, const TrajPoint &tp1, const TrajPoint &tp2, const float &MinWireSignalFraction, bool prt)
Definition: Utils.cxx:1495
TrajPoint MakeBareTP(TjStuff &tjs, Point3_t &pos, Vector3_t &dir, CTP_t inCTP)
Definition: Utils.cxx:3435
float MaxTjLen(TjStuff const &tjs, std::vector< int > &tjIDs)
Definition: Utils.cxx:2189
unsigned short CloseEnd(TjStuff &tjs, const Trajectory &tj, const Point2_t &pos)
Definition: Utils.cxx:2120
std::vector< int > FindCloseTjs(const TjStuff &tjs, const TrajPoint &fromTp, const TrajPoint &toTp, const float &maxDelta)
Definition: Utils.cxx:2466
float TrajLength(Trajectory &tj)
Definition: Utils.cxx:2204
bool PointInsideEnvelope(const Point2_t &Point, const std::vector< Point2_t > &Envelope)
Definition: Utils.cxx:2705
void DefineTjParents(TjStuff &tjs, const geo::TPCID &tpcid, bool prt)
Definition: Utils.cxx:17
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:1631
bool MakeBareTrajPoint(const TjStuff &tjs, unsigned int fromHit, unsigned int toHit, TrajPoint &tp)
Definition: Utils.cxx:3493
std::string PrintHit(const TCHit &hit)
Definition: Utils.cxx:4732
The data type to uniquely identify a TPC.
Definition: geo_types.h:195
bool SetMag(Vector3_t &v1, double mag)
Definition: PFPUtils.cxx:1641
std::array< double, 2 > Vector2_t
Definition: DataStructs.h:38
Definition of data types for geometry description.
unsigned short NumHitsInTP(const TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:3677
void TagMuonDirections(TjStuff &tjs, short debugWorkID)
Definition: Utils.cxx:3078
float PointTrajDOCA(TjStuff const &tjs, unsigned int iht, TrajPoint const &tp)
Definition: Utils.cxx:2139
Detector simulation of raw signals on wires.
void TjDeltaRMS(TjStuff &tjs, Trajectory &tj, unsigned short firstPt, unsigned short lastPt, double &rms, unsigned short &cnt)
Definition: Utils.cxx:2951
void WatchHit(std::string someText, TjStuff &tjs, const unsigned int &wHit, short &wInTraj, const unsigned short &tjID)
Definition: Utils.cxx:984
short MCSMom(const TjStuff &tjs, const std::vector< int > &tjIDs)
Definition: Utils.cxx:2837
float ChgFracNearPos(TjStuff &tjs, const Point2_t &pos, const std::vector< int > &tjIDs)
Definition: Utils.cxx:2614
float TwoTPAngle(TrajPoint &tp1, TrajPoint &tp2)
Definition: Utils.cxx:2274
void TrajIntersection(TrajPoint const &tp1, TrajPoint const &tp2, Point2_t &pos)
Definition: Utils.cxx:2166
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
Definition: PFPUtils.h:60
unsigned int CTP_t
Definition: DataStructs.h:41
bool InTrajOK(TjStuff &tjs, std::string someText)
Definition: Utils.cxx:1199
int NeutrinoPrimaryTjID(const TjStuff &tjs, const Trajectory &tj)
Definition: Utils.cxx:363
bool FillWireHitRange(TjStuff &tjs, const geo::TPCID &tpcid)
Definition: Utils.cxx:3722
std::string PrintHitShort(const TCHit &hit)
Definition: Utils.cxx:4726
TDirectory * dir
Definition: macro.C:5
float ExpectedHitsRMS(TjStuff &tjs, const TrajPoint &tp)
Definition: Utils.cxx:1627
float MaxChargeAsymmetry(TjStuff &tjs, std::vector< int > &tjIDs)
Definition: Utils.cxx:235
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:1625
void SetEndPoints(TjStuff &tjs, Trajectory &tj)
Definition: Utils.cxx:2788
unsigned short NumPtsWithCharge(const TjStuff &tjs, const Trajectory &tj, bool includeDeadWires)
Definition: Utils.cxx:1738
bool MergeAndStore(TjStuff &tjs, unsigned int itj1, unsigned int itj2, bool doPrt)
Definition: Utils.cxx:3896
float PointTrajSep2(float wire, float time, TrajPoint const &tp)
Definition: Utils.cxx:2131
std::array< double, 3 > Vector3_t
Definition: DataStructs.h:36
float MaxHitDelta(TjStuff &tjs, Trajectory &tj)
Definition: Utils.cxx:2649
bool WireHitRangeOK(const TjStuff &tjs, const CTP_t &inCTP)
Definition: Utils.cxx:3886
unsigned short GetPFPIndex(const TjStuff &tjs, int tjID)
Definition: Utils.cxx:1045
std::string PrintStopFlag(const Trajectory &tj, unsigned short end)
Definition: Utils.cxx:4707
std::vector< T > SetDifference(const std::vector< T > &set1, const std::vector< T > &set2)
Definition: Utils.h:236
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
void MakeTrajectoryObsolete(TjStuff &tjs, unsigned int itj)
Definition: Utils.cxx:1797
float TjDirFOM(const TjStuff &tjs, const Trajectory &tj, bool prt)
Definition: Utils.cxx:906
void PrintPFP(std::string someText, const TjStuff &tjs, const PFPStruct &pfp, bool printHeader)
Definition: Utils.cxx:4619
void PrintPFPs(std::string someText, const TjStuff &tjs)
Definition: Utils.cxx:4690
void UnsetUsedHits(TjStuff &tjs, TrajPoint &tp)
Definition: Utils.cxx:1082
void SetPDGCode(TjStuff &tjs, unsigned short itj)
Definition: Utils.cxx:3697
float HitsPosTick(TjStuff &tjs, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
Definition: Utils.cxx:3645
void MoveTPToWire(TrajPoint &tp, float wire)
Definition: Utils.cxx:2351
float MCSThetaRMS(TjStuff &tjs, Trajectory &tj)
Definition: Utils.cxx:2907
bool TrajTrajDOCA(const TjStuff &tjs, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep)
Definition: Utils.cxx:2046
bool StoreTraj(TjStuff &tjs, Trajectory &tj)
Definition: Utils.cxx:1095
float TPHitsRMSTick(TjStuff &tjs, TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:3582
void PrintTrajPoint(std::string someText, const TjStuff &tjs, unsigned short ipt, short dir, unsigned short pass, TrajPoint const &tp)
Definition: Utils.cxx:4574
void PrintHeader(std::string someText)
Definition: Utils.cxx:4568
void TrajPointTrajDOCA(TjStuff &tjs, TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
Definition: Utils.cxx:2026
std::vector< int > GetAssns(const TjStuff &tjs, std::string type1Name, int id, std::string type2Name)
Definition: Utils.cxx:4079
unsigned short NumUsedHitsInTj(const TjStuff &tjs, const Trajectory &tj)
Definition: Utils.cxx:3665
void FitTraj(TjStuff &tjs, Trajectory &tj)
Definition: Utils.cxx:673