All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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:436
void StepAway(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:30
bool MaskedHitsOK(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2424
void UpdateTraj(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:669
bool IsGhost(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2865
void AddHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, bool &sigOK)
Definition: StepUtils.cxx:1039
bool StopShort(TCSlice &slc, Trajectory &tj, bool prt)
Definition: StepUtils.cxx:279
void SetStrategy(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:340
void FillGaps(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2033
float HitTimeErr(const TCSlice &slc, unsigned int iht)
Definition: StepUtils.cxx:1544
void ChkBegin(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2674
void FindUseHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, float maxDelta, bool useChg)
Definition: StepUtils.cxx:1757
bool MakeJunkTraj(TCSlice &slc, std::vector< unsigned int > tHits)
Definition: StepUtils.cxx:3868
TrajPoint CreateTPFromTj(TCSlice &slc, const Trajectory &tj)
Definition: StepUtils.cxx:3217
float HitsTimeErr2(const TCSlice &slc, const std::vector< unsigned int > &hitVec)
Definition: StepUtils.cxx:1552
void DefineHitPos(TCSlice &slc, TrajPoint &tp)
Definition: StepUtils.cxx:1672
void CheckStiffEl(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:916
void GetHitMultiplet(const TCSlice &slc, unsigned int theHit, std::vector< unsigned int > &hitsInMultiplet, bool useLongPulseHits)
Definition: StepUtils.cxx:1415
void FixBegin(TCSlice &slc, Trajectory &tj, unsigned short atPt)
Definition: StepUtils.cxx:2797
void UpdateStiffEl(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:648
void ChkStop(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:3705
bool StopIfBadFits(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2529
void MaskBadTPs(TCSlice &slc, Trajectory &tj, float const &maxChi)
Definition: StepUtils.cxx:2379
void CheckTraj(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:929
unsigned int CTP_t
Definition: DataStructs.h:47
void AddLAHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, bool &sigOK)
Definition: StepUtils.cxx:1216
void CheckHiMultUnusedHits(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2167
void LastEndMerge(TCSlice &slc, CTP_t inCTP)
Definition: StepUtils.cxx:3108
bool GottaKink(TCSlice &slc, Trajectory &tj, bool doTrim)
Definition: StepUtils.cxx:2556
void EndMerge(TCSlice &slc, CTP_t inCTP, bool lastPass)
Definition: StepUtils.cxx:3253
void MaskTrajEndPoints(TCSlice &slc, Trajectory &tj, unsigned short nPts)
Definition: StepUtils.cxx:3651
void UpdateDeltaRMS(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2349
void ChkStopEndPts(TCSlice &slc, Trajectory &tj, bool prt)
Definition: StepUtils.cxx:1562
void ReversePropagate(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:1316
void CheckHiMultEndHits(TCSlice &slc, Trajectory &tj)
Definition: StepUtils.cxx:2309
bool ChkMichel(TCSlice &slc, Trajectory &tj, unsigned short &lastGoodPt)
Definition: StepUtils.cxx:3811