StepUtils.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 //
4 // StepUtils - Core stepping algorithms
5 //
6 // Bruce Baller
7 //
8 ///////////////////////////////////////////////////////////////////////
9 #ifndef STEPUTILS_H
10 #define STEPUTILS_H
11 
12 // LArSoft libraries
15 
16 // C/C++ standard libraries
17 #include <vector>
18 
19 namespace tca {
20 
21  // Main stepping/crawling routine
22  void StepAway(TCSlice& slc, Trajectory& tj);
23  bool StopShort(TCSlice& slc, Trajectory& tj, bool prt);
24  void SetStrategy(TCSlice& slc, Trajectory& tj);
25  void Forecast(TCSlice& slc, const Trajectory& tj);
26  // Updates the last added trajectory point fit, average hit rms, etc.
27  void UpdateTraj(TCSlice& slc, Trajectory& tj);
28  // Version with a different strategy for tracking high energy electrons
29  void UpdateStiffEl(TCSlice& slc, Trajectory& tj);
30  // Check the quality of the trajectory and possibly trim it
31  void CheckTraj(TCSlice& slc, Trajectory& tj);
32  void CheckStiffEl(TCSlice& slc, Trajectory& tj);
33  // Add hits on the trajectory point ipt that are close to the trajectory point Pos
34  void AddHits(TCSlice& slc, Trajectory& tj, unsigned short ipt, bool& sigOK);
35  // Large Angle version
36  void AddLAHits(TCSlice& slc, Trajectory& tj, unsigned short ipt, bool& sigOK);
37  // Step through TPs starting at the end and moving to the beginning
38  void ReversePropagate(TCSlice& slc, Trajectory& tj);
39  void GetHitMultiplet(const TCSlice& slc, unsigned int theHit, std::vector<unsigned int>& hitsInMultiplet,
40  bool useLongPulseHits);
41  // Returns fHits[iht]->RMS() * fScaleF * fHitErrFac * fHits[iht]->Multiplicity();
42  float HitTimeErr(const TCSlice& slc, const unsigned int iht);
43  // Estimates the error^2 of the time using all hits in hitVec
44  float HitsTimeErr2(const TCSlice& slc, const std::vector<unsigned int>& hitVec);
45  // defines HitPos, HitPosErr2 and Chg for the used hits in the trajectory point
46  void ChkStopEndPts(TCSlice& slc, Trajectory& tj, bool prt);
47  void DefineHitPos(TCSlice& slc, TrajPoint& tp);
48  // Decide which hits to use to determine the trajectory point
49  // fit, charge, etc. This is done by setting UseHit true and
50  // setting inTraj < 0
51  void FindUseHits(TCSlice& slc, Trajectory& tj, unsigned short ipt, float maxDelta, bool useChg);
52  // Fill gaps in the trajectory
53  void FillGaps(TCSlice& slc, Trajectory& tj);
54  // Check for many unused hits and try to use them
55  void CheckHiMultUnusedHits(TCSlice& slc, Trajectory& tj);
56  void CheckHiMultEndHits(TCSlice& slc, Trajectory& tj);
57  // Estimate the Delta RMS of the TPs on the end of tj.
58  void UpdateDeltaRMS(TCSlice& slc, Trajectory& tj);
59  void MaskBadTPs(TCSlice& slc, Trajectory& tj, float const& maxChi);
60  // The hits in the TP at the end of the trajectory were masked off. Decide whether to continue stepping with the
61  // current configuration or whether to stop and possibly try with the next pass settings
62  bool MaskedHitsOK(TCSlice& slc, Trajectory& tj);
63  // Any re-sizing should have been done by the calling routine. This code updates the Pass and adjusts the number of
64  // fitted points to get FitCHi < 2
65  bool StopIfBadFits(TCSlice& slc, Trajectory& tj);
66  // Does a local fit of just-added TPs to identify a kink while stepping.
67  // Truncates the vector and returns true if one is found.
68  bool GottaKink(TCSlice& slc, Trajectory& tj, bool doTrim);
69  // Check the parameters at the start of the trajectory
70  void ChkBegin(TCSlice& slc, Trajectory& tj);
71  // Fix the parameters at the start of the trajectory
72  void FixBegin(TCSlice& slc, Trajectory& tj, unsigned short atPt);
73  bool IsGhost(TCSlice& slc, std::vector<unsigned int>& tHits);
74  bool IsGhost(TCSlice& slc, Trajectory& tj);
75  void LastEndMerge(TCSlice& slc, CTP_t inCTP);
76  void EndMerge(TCSlice& slc, CTP_t inCTP, bool lastPass);
77  TrajPoint CreateTPFromTj(TCSlice& slc, const Trajectory& tj);
78  void MaskTrajEndPoints(TCSlice& slc, Trajectory& tj, unsigned short nPts);
79  // Sets the StopsAtEnd bits for the trajectory
80  void ChkStop(TCSlice& slc, Trajectory& tj);
81  // Check the Michel electron topology, lastGoodPt is the last point of muon
82  bool ChkMichel(TCSlice& slc, Trajectory& tj, unsigned short& lastGoodPt);
83  // Make a junk trajectory using the list of hits in tHits
84  bool MakeJunkTraj(TCSlice& slc, std::vector<unsigned int> tHits);
85 } // namespace tca
86 
87 #endif // ifndef STEPUTILS_H
void Forecast(TCSlice &slc, const Trajectory &tj)
Definition: StepUtils.cxx:434
void StepAway(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:28
bool MaskedHitsOK(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2422
void UpdateTraj(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:667
bool IsGhost(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2863
void AddHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, bool &sigOK)
Definition: StepUtils.cxx:1037
bool StopShort(TCSlice &slc, Trajectory &tj, bool prt)
Definition: StepUtils.cxx:277
void SetStrategy(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:338
void FillGaps(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2031
float HitTimeErr(const TCSlice &slc, unsigned int iht)
Definition: StepUtils.cxx:1542
void ChkBegin(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2672
void FindUseHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, float maxDelta, bool useChg)
Definition: StepUtils.cxx:1755
bool MakeJunkTraj(TCSlice &slc, std::vector< unsigned int > tHits)
Definition: StepUtils.cxx:3866
TrajPoint CreateTPFromTj(TCSlice &slc, const Trajectory &tj)
Definition: StepUtils.cxx:3215
float HitsTimeErr2(const TCSlice &slc, const std::vector< unsigned int > &hitVec)
Definition: StepUtils.cxx:1550
void DefineHitPos(TCSlice &slc, TrajPoint &tp)
Definition: StepUtils.cxx:1670
void CheckStiffEl(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:914
void GetHitMultiplet(const TCSlice &slc, unsigned int theHit, std::vector< unsigned int > &hitsInMultiplet, bool useLongPulseHits)
Definition: StepUtils.cxx:1413
void FixBegin(TCSlice &slc, Trajectory &tj, unsigned short atPt)
Definition: StepUtils.cxx:2795
void UpdateStiffEl(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:646
void ChkStop(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:3703
bool StopIfBadFits(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2527
void MaskBadTPs(TCSlice &slc, Trajectory &tj, float const &maxChi)
Definition: StepUtils.cxx:2377
void CheckTraj(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:927
unsigned int CTP_t
Definition: DataStructs.h:49
void AddLAHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, bool &sigOK)
Definition: StepUtils.cxx:1214
void CheckHiMultUnusedHits(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2165
void LastEndMerge(TCSlice &slc, CTP_t inCTP)
Definition: StepUtils.cxx:3106
bool GottaKink(TCSlice &slc, Trajectory &tj, bool doTrim)
Definition: StepUtils.cxx:2554
void EndMerge(TCSlice &slc, CTP_t inCTP, bool lastPass)
Definition: StepUtils.cxx:3251
void MaskTrajEndPoints(TCSlice &slc, Trajectory &tj, unsigned short nPts)
Definition: StepUtils.cxx:3649
void UpdateDeltaRMS(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2347
void ChkStopEndPts(TCSlice &slc, Trajectory &tj, bool prt)
Definition: StepUtils.cxx:1560
void ReversePropagate(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:1314
void CheckHiMultEndHits(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2307
bool ChkMichel(TCSlice &slc, Trajectory &tj, unsigned short &lastGoodPt)
Definition: StepUtils.cxx:3809