LArSoft  v07_13_02
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"
33 
34 namespace tca {
35 
36  typedef enum {
40  } HitStatus_t ;
41 
42  // ****************************** General purpose ******************************
43 
44  // dressed muons
45  void MakeHaloTj(TCSlice& slc, Trajectory& muTj, bool prt);
46  void DefineTjParents(TCSlice& slc, bool prt);
47  float MaxChargeAsymmetry(TCSlice& slc, std::vector<int>& tjIDs);
48  int PDGCodeVote(TCSlice& slc, std::vector<int>& tjIDs, bool prt);
49  unsigned short NumDeltaRays(TCSlice& slc, const Trajectory& tj);
50  unsigned short NumDeltaRays(TCSlice& slc, std::vector<int>& tjIDs);
51  int NeutrinoPrimaryTjID(TCSlice& slc, const Trajectory& tj);
52  int PrimaryID(TCSlice& slc, const Trajectory& tj);
53  int PrimaryUID(TCSlice& slc, const PFPStruct& pfp);
54  bool MergeTjIntoPFP(TCSlice& slc, int mtjid, PFPStruct& pfp, bool prt);
55  bool CompatibleMerge(TCSlice& slc, std::vector<int>& tjIDs, bool prt);
56  bool CompatibleMerge(TCSlice& slc, const Trajectory& tj1, const Trajectory& tj2, bool prt);
57  float OverlapFraction(TCSlice& slc, const Trajectory& tj1, const Trajectory& tj2);
58  unsigned short AngleRange(TrajPoint const& tp);
59  void SetAngleCode(TrajPoint& tp);
60  unsigned short AngleRange(float angle);
61  void FitTraj(TCSlice& slc, Trajectory& tj);
62  void FitTraj(TCSlice& slc, Trajectory& tj, unsigned short originPt, unsigned short npts, short fitDir, TrajPoint& tpFit);
63  float TjDirFOM(TCSlice& slc, const Trajectory& tj, bool prt);
64 // void WatchHit(std::string someText, TCSlice& slc);
65  unsigned short GetPFPIndex(TCSlice& slc, int tjID);
66  unsigned short MatchVecIndex(TCSlice& slc, int tjID);
67  void ReleaseHits(TCSlice& slc, Trajectory& tj);
68  void UnsetUsedHits(TCSlice& slc, TrajPoint& tp);
69  bool StoreTraj(TCSlice& slc, Trajectory& tj);
70  void ChgSlope(TCSlice& slc, Trajectory& tj, float& slope, float& slopeErr, float& chiDOF);
71  void ChgSlope(TCSlice& slc, Trajectory& tj, unsigned short fromPt, unsigned short toPt, float& slope, float& slopeErr, float& chiDOF);
72  bool InTrajOK(TCSlice& slc, std::string someText);
73  void CheckTrajBeginChg(TCSlice& slc, unsigned short itj);
74  void TrimEndPts(std::string fcnLabel, TCSlice& slc, Trajectory& tj, const std::vector<float>& fQualityCuts, bool prt);
75  void ChkChgAsymmetry(TCSlice& slc, Trajectory& tj, bool prt);
76  bool SignalBetween(TCSlice& slc, const TrajPoint& tp1, const TrajPoint& tp2, const float& MinWireSignalFraction);
77  bool SignalBetween(TCSlice& slc, TrajPoint tp, float toPos0, const float& MinWireSignalFraction);
78  float ChgFracBetween(TCSlice& slc, TrajPoint tp, float toPos0);
79  bool TrajHitsOK(TCSlice& slc, const std::vector<unsigned int>& iHitsInMultiplet, const std::vector<unsigned int>& jHitsInMultiplet);
80  bool TrajHitsOK(TCSlice& slc, const unsigned int iht, const unsigned int jht);
81  float ExpectedHitsRMS(TCSlice& slc, const TrajPoint& tp);
82  bool SignalAtTp(TCSlice& slc, TrajPoint const& tp);
83  float TpSumHitChg(TCSlice& slc, TrajPoint const& tp);
84  unsigned short NumPtsWithCharge(TCSlice& slc, const Trajectory& tj, bool includeDeadWires);
85  unsigned short NumPtsWithCharge(TCSlice& slc, const Trajectory& tj, bool includeDeadWires, unsigned short firstPt, unsigned short lastPt);
86  float DeadWireCount(TCSlice& slc, const TrajPoint& tp1, const TrajPoint& tp2);
87  float DeadWireCount(TCSlice& slc, const float& inWirePos1, const float& inWirePos2, CTP_t tCTP);
88  unsigned short PDGCodeIndex(int PDGCode);
89  void MakeTrajectoryObsolete(TCSlice& slc, unsigned int itj);
90  void RestoreObsoleteTrajectory(TCSlice& slc, unsigned int itj);
91  void MergeGhostTjs(TCSlice& slc, CTP_t inCTP);
92  // Split the allTraj trajectory itj at position pos into two trajectories
93  // with an optional vertex assignment
94  bool SplitTraj(TCSlice& slc, unsigned short itj, unsigned short pos, unsigned short ivx, bool prt);
95  bool SplitTraj(TCSlice& slc, unsigned short itj, float XPos, bool makeVx2, bool prt);
96  bool TrajClosestApproach(Trajectory const& tj, float x, float y, unsigned short& closePt, float& DOCA);
97  // returns the DOCA between a hit and a trajectory
98  float PointTrajDOCA(TCSlice& slc, unsigned int iht, TrajPoint const& tp);
99  // returns the DOCA between a (W,T) point and a trajectory
100  float PointTrajDOCA(TCSlice& slc, float wire, float time, TrajPoint const& tp);
101  // returns the DOCA^2 between a point and a trajectory
102  float PointTrajDOCA2(TCSlice& slc, float wire, float time, TrajPoint const& tp);
103  // Fills tp.Hits sets tp.UseHit true for hits that are close to tp.Pos. Returns true if there are
104  // close hits OR if the wire at this position is dead
105  bool FindCloseHits(TCSlice& slc, TrajPoint& tp, float const& maxDelta, HitStatus_t hitRequest);
106  std::vector<unsigned int> FindCloseHits(TCSlice& slc, std::array<int, 2> const& wireWindow, Point2_t const& timeWindow, const unsigned short plane, HitStatus_t hitRequest, bool usePeakTime, bool& hitsNear);
107  std::vector<int> FindCloseTjs(TCSlice& slc, const TrajPoint& fromTp, const TrajPoint& toTp, const float& maxDelta);
108  float ElectronLikelihood(TCSlice& slc, Trajectory& tj, float& asym);
109  float ChgFracNearPos(TCSlice& slc, const Point2_t& pos, const std::vector<int>& tjIDs);
110  float MaxHitDelta(TCSlice& slc, Trajectory& tj);
111  void ReverseTraj(TCSlice& slc, Trajectory& tj);
112  // returns the end of a trajectory that is closest to a point
113  unsigned short CloseEnd(TCSlice& slc, const Trajectory& tj, const Point2_t& pos);
114  // returns the separation^2 between a point and a TP
115  float PointTrajSep2(float wire, float time, TrajPoint const& tp);
116  float PosSep(const Point2_t& pos1, const Point2_t& pos2);
117  float PosSep2(const Point2_t& pos1, const Point2_t& pos2);
118  // finds the point on trajectory tj that is closest to trajpoint tp
119  void TrajPointTrajDOCA(TCSlice& slc, TrajPoint const& tp, Trajectory const& tj, unsigned short& closePt, float& minSep);
120  // returns the intersection position, intPos, of two trajectory points
121  void TrajIntersection(TrajPoint const& tp1, TrajPoint const& tp2, Point2_t& pos);
122  void TrajIntersection(TrajPoint const& tp1, TrajPoint const& tp2, float& x, float& y);
123  float MaxTjLen(TCSlice& slc, std::vector<int>& tjIDs);
124  // Returns the separation distance between two trajectory points
125  float TrajPointSeparation(TrajPoint& tp1, TrajPoint& tp2);
126  float TrajLength(Trajectory& tj);
127  // returns the separation^2 between two hits in WSE units
128  float HitSep2(TCSlice& slc, unsigned int iht, unsigned int jht);
129  // Find the Distance Of Closest Approach between two trajectories, exceeding minSep
130  bool TrajTrajDOCA(TCSlice& slc, const Trajectory& tp1, const Trajectory& tp2, unsigned short& ipt1, unsigned short& ipt2, float& minSep);
131  bool TrajTrajDOCA(TCSlice& slc, const Trajectory& tp1, const Trajectory& tp2, unsigned short& ipt1, unsigned short& ipt2, float& minSep, bool considerDeadWires);
132  // Calculates the angle between two TPs
133  float TwoTPAngle(TrajPoint& tp1, TrajPoint& tp2);
134  void TagJunkTj(TCSlice& slc, Trajectory& tj, bool prt);
135  // Put hits in each trajectory point into a flat vector.
136  std::vector<unsigned int> PutTrajHitsInVector(Trajectory const& tj, HitStatus_t hitRequest);
137  // returns true if a hit is associated with more than one point
138  bool HasDuplicateHits(TCSlice& slc, Trajectory const& tj, bool prt);
139  // Project TP to a "wire position" Pos[0] and update Pos[1]
140  void MoveTPToWire(TrajPoint& tp, float wire);
141  bool PointInsideEnvelope(const Point2_t& Point, const std::vector<Point2_t>& Envelope);
142  bool SetMag(Vector2_t& v1, double mag);
143  void FindAlongTrans(Point2_t pos1, Vector2_t dir1, Point2_t pos2, Point2_t& alongTrans);
144  inline double DotProd(const Vector2_t& v1, const Vector2_t& v2) {return v1[0]*v2[0] + v1[1]*v2[1]; }
145  double DeltaAngle(double Ang1, double Ang2);
146  double DeltaAngle2(double Ang1, double Ang2);
147  double DeltaAngle(const Point2_t& p1, const Point2_t& p2);
148  // Find the first (last) TPs, EndPt[0] (EndPt[1], that have charge
149  void SetEndPoints(Trajectory& tj);
150  // Returns the hit width using StartTick() and EndTick()
151  float TPHitsRMSTick(TCSlice& slc, TrajPoint& tp, HitStatus_t hitRequest);
152  float TPHitsRMSTime(TCSlice& slc, TrajPoint& tp, HitStatus_t hitRequest);
153  float HitsRMSTick(TCSlice& slc, const std::vector<unsigned int>& hitsInMultiplet, HitStatus_t hitRequest);
154  float HitsRMSTime(TCSlice& slc, const std::vector<unsigned int>& hitsInMultiplet, HitStatus_t hitRequest);
155  float HitsPosTick(TCSlice& slc, const std::vector<unsigned int>& hitsInMultiplet, float& chg, HitStatus_t hitRequest);
156  float HitsPosTime(TCSlice& slc, const std::vector<unsigned int>& hitsInMultiplet, float& chg, HitStatus_t hitRequest);
157  unsigned short NumHitsInTP(const TrajPoint& tp, HitStatus_t hitRequest);
158  unsigned short NumUsedHitsInTj(TCSlice& slc, const Trajectory& tj);
159  unsigned short NearestPtWithChg(TCSlice& slc, Trajectory& tj, unsigned short thePt);
160  // Calculate MCS momentum
161  short MCSMom(TCSlice& slc, const std::vector<int>& tjIDs);
162  short MCSMom(TCSlice& slc, Trajectory& tj);
163  short MCSMom(TCSlice& slc, Trajectory& tj, unsigned short FirstPt, unsigned short lastPt);
164  // Calculate MCS theta RMS over the points specified. Returns MCS angle for the full length
165  double MCSThetaRMS(TCSlice& slc, Trajectory& tj, unsigned short firstPt, unsigned short lastPt);
166  // Calculate MCS theta RMS over the entire length. Returns MCS angle for 1 WSE unit
167  float MCSThetaRMS(TCSlice& slc, Trajectory& tj);
168  void TjDeltaRMS(TCSlice& slc, Trajectory& tj, unsigned short firstPt, unsigned short lastPt, double& rms, unsigned short& cnt);
169  // Returns true if the trajectory has low hit multiplicity and is in a clean environment
170  bool TrajIsClean(TCSlice& slc, Trajectory& tj, bool prt);
171  // Flag delta ray trajectories in allTraj
172  void TagDeltaRays(TCSlice& slc, const CTP_t& inCTP);
173  // Tag muon directions using delta proximity
174 // void TagMuonDirections(TCSlice& slc, short debugWorkID);
175  void UpdateTjChgProperties(std::string inFcnLabel, TCSlice& slc, Trajectory& tj, bool prt);
176  void UpdateVxEnvironment(std::string inFcnLabel, TCSlice& slc, VtxStore& vx2, bool prt);
177  // Make a bare trajectory point that only has position and direction defined
178  TrajPoint MakeBareTP(TCSlice& slc, Point3_t& pos, Vector3_t& dir, CTP_t inCTP);
179  bool MakeBareTrajPoint(TCSlice& slc, unsigned int fromHit, unsigned int toHit, TrajPoint& tp);
180  bool MakeBareTrajPoint(TCSlice& slc, float fromWire, float fromTick, float toWire, float toTick, CTP_t tCTP, TrajPoint& tp);
181  bool MakeBareTrajPoint(const Point2_t& fromPos, const Point2_t& toPos, TrajPoint& tpOut);
182  bool MakeBareTrajPoint(TCSlice& slc, const TrajPoint& tpIn1, const TrajPoint& tpIn2, TrajPoint& tpOut);
183  unsigned short FarEnd(TCSlice& slc, const Trajectory& tj, const Point2_t& pos);
184  Vector2_t PointDirection(const Point2_t p1, const Point2_t p2);
185  void SetPDGCode(TCSlice& slc, Trajectory& tj, bool tjDone);
186  void SetPDGCode(TCSlice& slc, unsigned short itj, bool tjDone);
187 // void AnalyzeHits(TCSlice& slc);
188  bool AnalyzeHits();
189  bool LongPulseHit(const recob::Hit& hit);
190  bool FillWireHitRange(TCSlice& slc);
191 // bool CheckWireHitRange(TCSlice& slc);
192  bool WireHitRangeOK(TCSlice& slc, const CTP_t& inCTP);
193  bool MergeAndStore(TCSlice& slc, unsigned int itj1, unsigned int itj2, bool doPrt);
194  std::vector<int> GetAssns(TCSlice& slc, std::string type1Name, int id, std::string type2Name);
195  // Start a trajectory going from fromHit to (toWire, toTick)
196  bool StartTraj(TCSlice& slc, Trajectory& tj, unsigned int fromhit, unsigned int tohit, unsigned short pass);
197  bool StartTraj(TCSlice& slc, Trajectory& tj, float fromWire, float fromTick, float toWire, float toTick, CTP_t& tCTP, unsigned short pass);
198  bool Fit2D(short mode, Point2_t inPt, float& inPtErr, Vector2_t& outVec, Vector2_t& outVecErr, float& chiDOF);
199  std::pair<unsigned short, unsigned short> GetSliceIndex(std::string typeName, int uID);
200  template <typename T>
201  std::vector<T> SetIntersection(const std::vector<T>& set1, const std::vector<T>& set2);
202  template <typename T>
203  std::vector<T> SetDifference(const std::vector<T>& set1, const std::vector<T>& set2);
204  bool DecodeDebugString(std::string ctpwt);
205  // ****************************** Printing ******************************
206  void DumpTj();
207  void PrintAll(std::string someText, const std::vector<simb::MCParticle*>& mcpList);
208  void PrintP(std::string someText, mf::LogVerbatim& myprt, PFPStruct& pfp, bool& printHeader);
209  void Print3V(std::string someText, mf::LogVerbatim& myprt, Vtx3Store& vx3);
210  void Print2V(std::string someText, mf::LogVerbatim& myprt, VtxStore& vx2);
211  void Print3S(std::string someText, mf::LogVerbatim& myprt, ShowerStruct3D& ss3);
212  void PrintT(std::string someText, mf::LogVerbatim& myprt, Trajectory& tj, bool& printHeader);
213  void PrintTrajectory(std::string someText, TCSlice& slc, const Trajectory& tj ,unsigned short tPoint);
214  void PrintAllTraj(std::string someText, TCSlice& slc, unsigned short itj, unsigned short ipt, bool printVtx = true);
215  void PrintHeader(std::string someText);
216  void PrintTrajPoint(std::string someText, TCSlice& slc, unsigned short ipt, short dir, unsigned short pass, TrajPoint const& tp);
217  void PrintPFP(std::string someText, TCSlice& slc, const PFPStruct& pfp, bool printHeader);
218  void PrintPFPs(std::string someText, TCSlice& slc);
219  // Print clusters after calling MakeAllTrajClusters
220  void PrintClusters();
221  // Print a single hit in the standard format
222  std::string PrintHit(const TCHit& hit);
223  std::string PrintHitShort(const TCHit& hit);
224  // Print Trajectory position in the standard format
225  std::string PrintPos(TCSlice& slc, const TrajPoint& tp);
226  std::string PrintPos(TCSlice& slc, const Point2_t& pos);
227  std::string PrintStopFlag(const Trajectory& tj, unsigned short end);
228 
230  template <typename T>
231  std::vector<T> SetIntersection(const std::vector<T>& set1, const std::vector<T>& set2)
232  {
233  // returns a vector containing the elements of set1 and set2 that are common. This function
234  // is a replacement for std::set_intersection which fails in the following situation:
235  // set1 = {11 12 17 18} and set2 = {6 12 18}
236  // There is no requirement that the elements be sorted, unlike std::set_intersection
237  std::vector<T> shared;
238 
239  if(set1.empty()) return shared;
240  if(set2.empty()) return shared;
241  for(auto element1 : set1) {
242  // check for a common element
243  if(std::find(set2.begin(), set2.end(), element1) == set2.end()) continue;
244  // check for a duplicate
245  if(std::find(shared.begin(), shared.end(), element1) != shared.end()) continue;
246  shared.push_back(element1);
247  } // element1
248  return shared;
249  } // SetIntersection
250 
252  template <typename T>
253  std::vector<T> SetDifference(const std::vector<T>& set1, const std::vector<T>& set2)
254  {
255  // returns the elements of set1 and set2 that are different
256  std::vector<T> different;
257  if(set1.empty() && set2.empty()) return different;
258  if(!set1.empty() && set2.empty()) return set1;
259  if(set1.empty() && !set2.empty()) return set2;
260  for(auto element1 : set1) {
261  // check for a common element
262  if(std::find(set2.begin(), set2.end(), element1) != set2.end()) continue;
263  // check for a duplicate
264  if(std::find(different.begin(), different.end(), element1) != different.end()) continue;
265  different.push_back(element1);
266  } // element1
267  for(auto element2 : set2) {
268  // check for a common element
269  if(std::find(set1.begin(), set1.end(), element2) != set1.end()) continue;
270  // check for a duplicate
271  if(std::find(different.begin(), different.end(), element2) != different.end()) continue;
272  different.push_back(element2);
273  } // element1
274  return different;
275  } // SetDifference
276 
277 } // namespace tca
278 
279 #endif // ifndef TRAJCLUSTERALGUTILS_H
Float_t x
Definition: compare.C:6
void PrintTrajectory(std::string someText, TCSlice &slc, const Trajectory &tj, unsigned short tPoint)
Definition: Utils.cxx:5455
float HitsRMSTime(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
Definition: Utils.cxx:3700
void CheckTrajBeginChg(TCSlice &slc, unsigned short itj)
Definition: Utils.cxx:1406
void ReleaseHits(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:1150
float HitsRMSTick(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
Definition: Utils.cxx:3706
int PDGCodeVote(TCSlice &slc, std::vector< int > &tjIDs, bool prt)
Definition: Utils.cxx:372
void SetEndPoints(Trajectory &tj)
Definition: Utils.cxx:2864
bool MakeBareTrajPoint(TCSlice &slc, unsigned int fromHit, unsigned int toHit, TrajPoint &tp)
Definition: Utils.cxx:3581
bool TrajHitsOK(TCSlice &slc, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
Definition: Utils.cxx:1736
bool InTrajOK(TCSlice &slc, std::string someText)
Definition: Utils.cxx:1333
float TjDirFOM(TCSlice &slc, const Trajectory &tj, bool prt)
Definition: Utils.cxx:986
struct of temporary 2D vertices (end points)
Definition: DataStructs.h:54
std::vector< int > GetAssns(TCSlice &slc, std::string type1Name, int id, std::string type2Name)
Definition: Utils.cxx:4279
void TrajPointTrajDOCA(TCSlice &slc, TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
Definition: Utils.cxx:2155
std::array< double, 3 > Point3_t
Definition: DataStructs.h:35
short MCSMom(TCSlice &slc, const std::vector< int > &tjIDs)
Definition: Utils.cxx:2914
void PrintPFP(std::string someText, TCSlice &slc, const PFPStruct &pfp, bool printHeader)
Definition: Utils.cxx:5587
std::vector< unsigned int > PutTrajHitsInVector(Trajectory const &tj, HitStatus_t hitRequest)
Definition: Utils.cxx:2416
int NeutrinoPrimaryTjID(TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:441
Declaration of signal hit object.
void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t &alongTrans)
Definition: PFPUtils.cxx:2849
Float_t y
Definition: compare.C:6
void PrintClusters()
bool WireHitRangeOK(TCSlice &slc, const CTP_t &inCTP)
Definition: Utils.cxx:4085
void UnsetUsedHits(TCSlice &slc, TrajPoint &tp)
Definition: Utils.cxx:1162
void TjDeltaRMS(TCSlice &slc, Trajectory &tj, unsigned short firstPt, unsigned short lastPt, double &rms, unsigned short &cnt)
Definition: Utils.cxx:3029
void PrintT(std::string someText, mf::LogVerbatim &myprt, Trajectory &tj, bool &printHeader)
Definition: Utils.cxx:5109
bool StoreTraj(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:1175
void ChkChgAsymmetry(TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:1611
float ExpectedHitsRMS(TCSlice &slc, const TrajPoint &tp)
Definition: Utils.cxx:1802
void PrintAllTraj(std::string someText, TCSlice &slc, unsigned short itj, unsigned short ipt, bool prtVtx)
Definition: Utils.cxx:5197
bool TrajClosestApproach(Trajectory const &tj, float x, float y, unsigned short &closePt, float &DOCA)
Definition: Utils.cxx:2377
unsigned short MatchVecIndex(TCSlice &slc, int tjID)
Definition: Utils.cxx:1138
float TrajPointSeparation(TrajPoint &tp1, TrajPoint &tp2)
Definition: Utils.cxx:2368
void SetAngleCode(TrajPoint &tp)
Definition: Utils.cxx:722
void PrintP(std::string someText, mf::LogVerbatim &myprt, PFPStruct &pfp, bool &printHeader)
Definition: Utils.cxx:4876
void Print3V(std::string someText, mf::LogVerbatim &myprt, Vtx3Store &vx3)
Definition: Utils.cxx:4959
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
Definition: PFPUtils.cxx:1636
void TagDeltaRays(TCSlice &slc, const CTP_t &inCTP)
Definition: Utils.cxx:3065
bool StartTraj(TCSlice &slc, Trajectory &tj, unsigned int fromhit, unsigned int tohit, unsigned short pass)
Definition: Utils.cxx:4431
HitStatus_t
Definition: Utils.h:36
bool LongPulseHit(const recob::Hit &hit)
Definition: Utils.cxx:3936
float DeadWireCount(TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2)
Definition: Utils.cxx:1881
void PrintPFPs(std::string someText, TCSlice &slc)
Definition: Utils.cxx:5661
bool MergeTjIntoPFP(TCSlice &slc, int mtjid, PFPStruct &pfp, bool prt)
Definition: Utils.cxx:507
int PrimaryID(TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:463
double DeltaAngle2(double Ang1, double Ang2)
Definition: Utils.cxx:2848
std::vector< T > SetIntersection(const std::vector< T > &set1, const std::vector< T > &set2)
Definition: Utils.h:231
bool TrajTrajDOCA(TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep)
Definition: Utils.cxx:2175
void UpdateVxEnvironment(std::string inFcnLabel, TCSlice &slc, VtxStore &vx2, bool prt)
Definition: Utils.cxx:3385
float HitsPosTick(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
Definition: Utils.cxx:3742
TrajPoint MakeBareTP(TCSlice &slc, Point3_t &pos, Vector3_t &dir, CTP_t inCTP)
Definition: Utils.cxx:3523
std::string PrintHitShort(const TCHit &tch)
Definition: Utils.cxx:5696
float MaxTjLen(TCSlice &slc, std::vector< int > &tjIDs)
Definition: Utils.cxx:2322
std::vector< unsigned int > FindCloseHits(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:2496
struct of temporary 3D vertices
Definition: DataStructs.h:84
std::array< float, 2 > Point2_t
Definition: DataStructs.h:37
unsigned short NearestPtWithChg(TCSlice &slc, Trajectory &tj, unsigned short thePt)
Definition: Utils.cxx:2966
bool TrajIsClean(TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:2891
void Print2V(std::string someText, mf::LogVerbatim &myprt, VtxStore &vx2)
Definition: Utils.cxx:5026
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
Definition: PFPUtils.cxx:1643
unsigned short NumDeltaRays(TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:413
void DumpTj()
Definition: Utils.cxx:4728
bool SignalBetween(TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2, const float &MinWireSignalFraction)
Definition: Utils.cxx:1671
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
unsigned short GetPFPIndex(TCSlice &slc, int tjID)
Definition: Utils.cxx:1127
std::vector< int > FindCloseTjs(TCSlice &slc, const TrajPoint &fromTp, const TrajPoint &toTp, const float &maxDelta)
Definition: Utils.cxx:2604
float TrajLength(Trajectory &tj)
Definition: Utils.cxx:2337
void MakeHaloTj(TCSlice &slc, Trajectory &muTj, bool prt)
Definition: Utils.cxx:20
float PointTrajDOCA2(TCSlice &slc, float wire, float time, TrajPoint const &tp)
Definition: Utils.cxx:2286
bool SignalAtTp(TCSlice &slc, const TrajPoint &tp)
Definition: Utils.cxx:1814
bool PointInsideEnvelope(const Point2_t &Point, const std::vector< Point2_t > &Envelope)
Definition: Utils.cxx:2781
void TagJunkTj(TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:2442
void MakeTrajectoryObsolete(TCSlice &slc, unsigned int itj)
Definition: Utils.cxx:1922
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:1660
void FitTraj(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:753
unsigned short CloseEnd(TCSlice &slc, const Trajectory &tj, const Point2_t &pos)
Definition: Utils.cxx:2251
std::string PrintHit(const TCHit &tch)
Definition: Utils.cxx:5704
void SetPDGCode(TCSlice &slc, unsigned short itj, bool tjDone)
Definition: Utils.cxx:3795
bool Fit2D(short mode, Point2_t inPt, float &inPtErr, Vector2_t &outVec, Vector2_t &outVecErr, float &chiDOF)
Definition: Utils.cxx:4536
float TpSumHitChg(TCSlice &slc, TrajPoint const &tp)
Definition: Utils.cxx:1853
float MaxChargeAsymmetry(TCSlice &slc, std::vector< int > &tjIDs)
Definition: Utils.cxx:340
unsigned short FarEnd(TCSlice &slc, const PFPStruct &pfp, const Point3_t &pos)
Definition: PFPUtils.cxx:3032
bool SetMag(Vector3_t &v1, double mag)
Definition: PFPUtils.cxx:1670
std::array< double, 2 > Vector2_t
Definition: DataStructs.h:38
Definition of data types for geometry description.
void ReverseTraj(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:2751
unsigned short NumHitsInTP(const TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:3775
void TrimEndPts(std::string fcnLabel, TCSlice &slc, Trajectory &tj, const std::vector< float > &fQualityCuts, bool prt)
Definition: Utils.cxx:1511
void DefineTjParents(TCSlice &slc, bool prt)
Definition: Utils.cxx:129
float TPHitsRMSTime(TCSlice &slc, TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:3668
Detector simulation of raw signals on wires.
void PrintAll(std::string someText, const std::vector< simb::MCParticle * > &mcpList)
Definition: Utils.cxx:4774
void UpdateTjChgProperties(std::string inFcnLabel, TCSlice &slc, Trajectory &tj, bool prt)
Definition: Utils.cxx:3196
unsigned short NumPtsWithCharge(TCSlice &slc, const Trajectory &tj, bool includeDeadWires)
Definition: Utils.cxx:1863
float TwoTPAngle(TrajPoint &tp1, TrajPoint &tp2)
Definition: Utils.cxx:2407
bool MergeAndStore(TCSlice &slc, unsigned int itj1, unsigned int itj2, bool doPrt)
Definition: Utils.cxx:4095
void RestoreObsoleteTrajectory(TCSlice &slc, unsigned int itj)
Definition: Utils.cxx:1933
float ChgFracNearPos(TCSlice &slc, const Point2_t &pos, const std::vector< int > &tjIDs)
Definition: Utils.cxx:2698
void TrajIntersection(TrajPoint const &tp1, TrajPoint const &tp2, Point2_t &pos)
Definition: Utils.cxx:2299
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
Definition: PFPUtils.h:59
unsigned int CTP_t
Definition: DataStructs.h:41
float ElectronLikelihood(TCSlice &slc, Trajectory &tj, float &asym)
Definition: Utils.cxx:2679
bool DecodeDebugString(std::string strng)
Definition: Utils.cxx:4611
float MCSThetaRMS(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:2984
bool AnalyzeHits()
Definition: Utils.cxx:3877
TDirectory * dir
Definition: macro.C:5
bool HasDuplicateHits(TCSlice &slc, Trajectory const &tj, bool prt)
Definition: Utils.cxx:2469
void ChgSlope(TCSlice &slc, Trajectory &tj, float &slope, float &slopeErr, float &chiDOF)
Definition: Utils.cxx:1288
float MaxHitDelta(TCSlice &slc, Trajectory &tj)
Definition: Utils.cxx:2734
unsigned short NumUsedHitsInTj(TCSlice &slc, const Trajectory &tj)
Definition: Utils.cxx:3763
void Print3S(std::string someText, mf::LogVerbatim &myprt, ShowerStruct3D &ss3)
Definition: Utils.cxx:5069
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
Definition: PFPUtils.cxx:1654
unsigned short PDGCodeIndex(int PDGCode)
Definition: Utils.cxx:1908
std::string PrintPos(TCSlice &slc, const TrajPoint &tp)
Definition: Utils.cxx:5712
std::pair< unsigned short, unsigned short > GetSliceIndex(std::string typeName, int uID)
Definition: Utils.cxx:4496
float HitSep2(TCSlice &slc, unsigned int iht, unsigned int jht)
Definition: Utils.cxx:2239
float OverlapFraction(TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2)
Definition: Utils.cxx:664
float TPHitsRMSTick(TCSlice &slc, TrajPoint &tp, HitStatus_t hitRequest)
Definition: Utils.cxx:3674
float PointTrajDOCA(TCSlice &slc, unsigned int iht, TrajPoint const &tp)
Definition: Utils.cxx:2270
float HitsPosTime(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
Definition: Utils.cxx:3736
float PointTrajSep2(float wire, float time, TrajPoint const &tp)
Definition: Utils.cxx:2262
std::array< double, 3 > Vector3_t
Definition: DataStructs.h:36
bool FillWireHitRange(TCSlice &slc)
Definition: Utils.cxx:3944
std::string PrintStopFlag(const Trajectory &tj, unsigned short end)
Definition: Utils.cxx:5677
std::vector< T > SetDifference(const std::vector< T > &set1, const std::vector< T > &set2)
Definition: Utils.h:253
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
void MoveTPToWire(TrajPoint &tp, float wire)
Definition: Utils.cxx:2485
void MergeGhostTjs(TCSlice &slc, CTP_t inCTP)
Definition: Utils.cxx:1955
float ChgFracBetween(TCSlice &slc, Point3_t pos1, Point3_t pos2)
Definition: PFPUtils.cxx:2957
bool SplitTraj(TCSlice &slc, unsigned short itj, float XPos, bool makeVx2, bool prt)
Definition: Utils.cxx:2004
void PrintHeader(std::string someText)
Definition: Utils.cxx:5535
void PrintTrajPoint(std::string someText, TCSlice &slc, unsigned short ipt, short dir, unsigned short pass, TrajPoint const &tp)
Definition: Utils.cxx:5541
int PrimaryUID(TCSlice &slc, const PFPStruct &pfp)
Definition: Utils.cxx:482
unsigned short AngleRange(TrajPoint const &tp)
Definition: Utils.cxx:716
bool CompatibleMerge(TCSlice &slc, std::vector< int > &tjIDs, bool prt)
Definition: Utils.cxx:534