LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
StepUtils.h
Go to the documentation of this file.
1 //
3 //
4 // StepUtils - Core stepping algorithms
5 //
6 // Bruce Baller
7 //
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 const& 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,
40  unsigned int theHit,
41  std::vector<unsigned int>& hitsInMultiplet,
42  bool useLongPulseHits);
43  // Returns fHits[iht]->RMS() * fScaleF * fHitErrFac * fHits[iht]->Multiplicity();
44  float HitTimeErr(const TCSlice& slc, const unsigned int iht);
45  // Estimates the error^2 of the time using all hits in hitVec
46  float HitsTimeErr2(const TCSlice& slc, const std::vector<unsigned int>& hitVec);
47  // defines HitPos, HitPosErr2 and Chg for the used hits in the trajectory point
48  void ChkStopEndPts(TCSlice& slc, Trajectory& tj, bool prt);
49  void DefineHitPos(TCSlice& slc, TrajPoint& tp);
50  // Decide which hits to use to determine the trajectory point
51  // fit, charge, etc. This is done by setting UseHit true and
52  // setting inTraj < 0
53  void FindUseHits(TCSlice& slc, Trajectory& tj, unsigned short ipt, float maxDelta, bool useChg);
54  // Fill gaps in the trajectory
55  void FillGaps(TCSlice& slc, Trajectory& tj);
56  // Check for many unused hits and try to use them
57  void CheckHiMultUnusedHits(TCSlice& slc, Trajectory& tj);
58  void CheckHiMultEndHits(TCSlice& slc, Trajectory& tj);
59  // Estimate the Delta RMS of the TPs on the end of tj.
60  void UpdateDeltaRMS(Trajectory& tj);
61  void MaskBadTPs(TCSlice& slc, Trajectory& tj, float const& maxChi);
62  // The hits in the TP at the end of the trajectory were masked off. Decide whether to continue stepping with the
63  // current configuration or whether to stop and possibly try with the next pass settings
64  bool MaskedHitsOK(TCSlice& slc, Trajectory& tj);
65  // Any re-sizing should have been done by the calling routine. This code updates the Pass and adjusts the number of
66  // fitted points to get FitCHi < 2
67  bool StopIfBadFits(Trajectory& tj);
68  // Does a local fit of just-added TPs to identify a kink while stepping.
69  // Truncates the vector and returns true if one is found.
70  bool GottaKink(TCSlice& slc, Trajectory& tj, bool doTrim);
71  // Check the parameters at the start of the trajectory
72  void ChkBegin(TCSlice& slc, Trajectory& tj);
73  // Fix the parameters at the start of the trajectory
74  void FixBegin(TCSlice& slc, Trajectory& tj, unsigned short atPt);
75  bool IsGhost(TCSlice& slc, std::vector<unsigned int>& tHits);
76  bool IsGhost(TCSlice& slc, Trajectory& tj);
77  void LastEndMerge(TCSlice& slc, CTP_t inCTP);
78  void EndMerge(TCSlice& slc, CTP_t inCTP, bool lastPass);
79  TrajPoint CreateTPFromTj(const Trajectory& tj);
80  void MaskTrajEndPoints(TCSlice& slc, Trajectory& tj, unsigned short nPts);
81  // Sets the StopsAtEnd bits for the trajectory
82  void ChkStop(Trajectory& tj);
83  // Check the Michel electron topology, lastGoodPt is the last point of muon
84  bool ChkMichel(Trajectory& tj, unsigned short& lastGoodPt);
85  // Make a junk trajectory using the list of hits in tHits
86  bool MakeJunkTraj(TCSlice& slc, std::vector<unsigned int> tHits);
87 } // namespace tca
88 
89 #endif // ifndef STEPUTILS_H
void Forecast(TCSlice &slc, const Trajectory &tj)
Definition: StepUtils.cxx:460
void ChkStop(Trajectory &tj)
Definition: StepUtils.cxx:3972
void StepAway(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:30
bool MaskedHitsOK(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2619
void UpdateTraj(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:705
bool IsGhost(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:3084
void UpdateDeltaRMS(Trajectory &tj)
Definition: StepUtils.cxx:2542
void AddHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, bool &sigOK)
Definition: StepUtils.cxx:1113
bool StopShort(TCSlice &slc, Trajectory &tj, bool prt)
Definition: StepUtils.cxx:288
void SetStrategy(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:352
void FillGaps(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2204
float HitTimeErr(const TCSlice &slc, unsigned int iht)
Definition: StepUtils.cxx:1654
void ChkBegin(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2882
void FindUseHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, float maxDelta, bool useChg)
Definition: StepUtils.cxx:1882
bool MakeJunkTraj(TCSlice &slc, std::vector< unsigned int > tHits)
Definition: StepUtils.cxx:4146
bool ChkMichel(Trajectory &tj, unsigned short &lastGoodPt)
Definition: StepUtils.cxx:4087
void UpdateStiffEl(TCSlice const &slc, Trajectory &tj)
Definition: StepUtils.cxx:682
float HitsTimeErr2(const TCSlice &slc, const std::vector< unsigned int > &hitVec)
Definition: StepUtils.cxx:1662
void DefineHitPos(TCSlice &slc, TrajPoint &tp)
Definition: StepUtils.cxx:1791
void CheckStiffEl(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:983
void GetHitMultiplet(const TCSlice &slc, unsigned int theHit, std::vector< unsigned int > &hitsInMultiplet, bool useLongPulseHits)
Definition: StepUtils.cxx:1521
void FixBegin(TCSlice &slc, Trajectory &tj, unsigned short atPt)
Definition: StepUtils.cxx:3013
void MaskBadTPs(TCSlice &slc, Trajectory &tj, float const &maxChi)
Definition: StepUtils.cxx:2572
void CheckTraj(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:997
unsigned int CTP_t
Definition: DataStructs.h:47
void AddLAHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, bool &sigOK)
Definition: StepUtils.cxx:1309
void CheckHiMultUnusedHits(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2344
void LastEndMerge(TCSlice &slc, CTP_t inCTP)
Definition: StepUtils.cxx:3339
bool GottaKink(TCSlice &slc, Trajectory &tj, bool doTrim)
Definition: StepUtils.cxx:2756
void EndMerge(TCSlice &slc, CTP_t inCTP, bool lastPass)
Definition: StepUtils.cxx:3486
void MaskTrajEndPoints(TCSlice &slc, Trajectory &tj, unsigned short nPts)
Definition: StepUtils.cxx:3909
void ChkStopEndPts(TCSlice &slc, Trajectory &tj, bool prt)
Definition: StepUtils.cxx:1671
bool StopIfBadFits(Trajectory &tj)
Definition: StepUtils.cxx:2729
void ReversePropagate(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:1417
void CheckHiMultEndHits(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2500
TrajPoint CreateTPFromTj(const Trajectory &tj)
Definition: StepUtils.cxx:3450