1 #ifndef TRACKKALMANFITTER_H 2 #define TRACKKALMANFITTER_H 13 class DetectorPropertiesData;
19 class TrackTrajectory;
23 struct OptionalOutputs;
28 class TrackStatePropagator;
57 Comment(
"Flag to replace the default hit error " 58 "recob::Hit::SigmaPeakTime() with recob::Hit::RMS()."),
61 Name(
"sortHitsByPlane"),
62 Comment(
"Flag to sort hits along the forward fit. The hit order in each plane is preserved " 63 "(unless sortHitsByWire is true), the next hit to process in 3D is chosen as the " 64 "one with shorter 3D propagation distance among the next hit in all planes."),
67 Name(
"sortHitsByWire"),
68 Comment(
"Set to true if, instead of keeping the hit sorting in each plane from the pattern " 69 "recognition stage, the hits need to be sorted by wire number. Ignored if " 70 "sortHitsByPlane = false."),
73 Name(
"sortOutputHitsMinLength"),
74 Comment(
"Flag to decide whether the hits are sorted before creating the output track in " 75 "order to avoid tracks with huge length."),
80 "Flag to decide whether, during the forward fit, the hits corresponding to a negative " 81 "propagation distance should be dropped. Also, if sortOutputHitsMinLength is true, " 82 "during sorting hits at a negative distance with respect to the previous are rejected."),
86 Comment(
"Flag to decide whether hits with a zigzag pattern should be iteratively removed. " 87 "Zigzag identified as negative dot product of segments connecting a point to the " 88 "points before and after it."),
91 Name(
"rejectHighMultHits"),
92 Comment(
"Flag to rejects hits with recob::Hit::Multiplicity()>1."),
95 Name(
"rejectHitsNegativeGOF"),
96 Comment(
"Flag to rejects hits with recob::Hit::GoodnessOfFit<0."),
99 Comment(
"Scale the hit error squared by this factor."),
102 Name(
"tryNoSkipWhenFails"),
103 Comment(
"In case skipNegProp is true and the track fit fails, make a second attempt to fit " 104 "the track with skipNegProp=false in order to attempt to avoid losing efficiency."),
108 Comment(
"Try fit in both with default and reversed direction, choose the track with " 109 "highest score=CountValidPoints/(Length*Chi2PerNdof)."),
112 Name(
"pickBestHitOnWire"),
113 Comment(
"If there is >1 consecutive hit on the same wire, choose the one with best chi2 " 114 "and exclude the others."),
118 Comment(
"Reject hits with residue > maxResidue [cm]. If negative, it is set to " 119 "std::numeric_limits<float>::max()."),
122 Name(
"maxResidueFirstHit"),
123 Comment(
"Reject firt hit if has residue > maxResidueFirstHit [cm]. If negative, it is set " 124 "to std::numeric_limits<float>::max()."),
127 Comment(
"Reject hits with chi2 > maxChi2. If negative, it is set " 128 "to std::numeric_limits<float>::max()."),
132 Comment(
"Reject hits with propagation distance > maxDist [cm]. If negative, it is set to " 133 "std::numeric_limits<float>::max()."),
136 Name(
"negDistTolerance"),
137 Comment(
"Tolerance for negative propagation distance to avoid hit rejection (so this is " 138 "expected to be a small negative number)."),
142 Comment(
"0 for no debug printouts, 1 for moderate, 2 for maximum."),
150 bool sortHitsByPlane,
152 bool sortOutputHitsMinLength,
155 bool rejectHighMultHits,
156 bool rejectHitsNegativeGOF,
157 float hitErr2ScaleFact,
158 bool tryNoSkipWhenFails,
160 bool pickBestHitOnWire,
162 float maxResidueFirstHit,
165 float negDistTolerance,
170 sortHitsByPlane_ = sortHitsByPlane;
172 sortOutputHitsMinLength_ = sortOutputHitsMinLength;
173 skipNegProp_ = skipNegProp;
174 cleanZigzag_ = cleanZigzag;
175 rejectHighMultHits_ = rejectHighMultHits;
176 rejectHitsNegativeGOF_ = rejectHitsNegativeGOF;
177 hitErr2ScaleFact_ = hitErr2ScaleFact;
178 tryNoSkipWhenFails_ = tryNoSkipWhenFails;
179 tryBothDirs_ = tryBothDirs;
180 pickBestHitOnWire_ = pickBestHitOnWire;
182 maxResidueFirstHit_ =
186 negDistTolerance_ = negDistTolerance;
187 dumpLevel_ = dumpLevel;
194 p().sortHitsByPlane(),
196 p().sortOutputHitsMinLength(),
199 p().rejectHighMultHits(),
200 p().rejectHitsNegativeGOF(),
201 p().hitErr2ScaleFact(),
202 p().tryNoSkipWhenFails(),
204 p().pickBestHitOnWire(),
206 p().maxResidueFirstHit(),
209 p().negDistTolerance(),
222 const bool flipDirection,
233 const std::vector<recob::TrajectoryPointFlags>& flags,
244 std::vector<HitState>& hitstatev,
245 std::vector<recob::TrajectoryPointFlags::Mask_t>& hitflagsv,
246 std::vector<KFTrackState>& fwdPrdTkState,
247 std::vector<KFTrackState>& fwdUpdTkState,
248 std::vector<unsigned int>& hitstateidx,
249 std::vector<unsigned int>& rejectedhsidx,
250 std::vector<unsigned int>& sortedtksidx,
251 bool applySkipClean =
true)
const;
259 const int pdgid)
const;
264 const std::vector<recob::TrajectoryPointFlags>& flags,
266 std::vector<HitState>& hitstatev,
267 std::vector<recob::TrajectoryPointFlags::Mask_t>& hitflagsv)
const;
270 void sortOutput(std::vector<HitState>& hitstatev,
271 std::vector<KFTrackState>& fwdUpdTkState,
272 std::vector<unsigned int>& hitstateidx,
273 std::vector<unsigned int>& rejectedhsidx,
274 std::vector<unsigned int>& sortedtksidx,
275 std::vector<recob::TrajectoryPointFlags::Mask_t>& hitflagsv,
276 bool applySkipClean =
true)
const;
282 std::vector<HitState>& hitstatev,
283 std::vector<recob::TrajectoryPointFlags::Mask_t>& hitflagsv,
284 std::vector<KFTrackState>& fwdPrdTkState,
285 std::vector<KFTrackState>& fwdUpdTkState,
286 std::vector<unsigned int>& hitstateidx,
287 std::vector<unsigned int>& rejectedhsidx,
288 std::vector<unsigned int>& sortedtksidx,
Fit tracks using Kalman Filter fit+smooth.
Reconstruction base classes.
recob::tracking::Point_t Point_t
recob::tracking::Vector_t Vector_t
recob::tracking::SMatrixSym55 SMatrixSym55
TrackKalmanFitter(const TrackStatePropagator *prop, bool useRMS, bool sortHitsByPlane, bool sortHitsByWire, bool sortOutputHitsMinLength, bool skipNegProp, bool cleanZigzag, bool rejectHighMultHits, bool rejectHitsNegativeGOF, float hitErr2ScaleFact, bool tryNoSkipWhenFails, bool tryBothDirs, bool pickBestHitOnWire, float maxResidue, float maxResidueFirstHit, float maxChi2, float maxDist, float negDistTolerance, int dumpLevel)
Constructor from TrackStatePropagator and values of configuration parameters.
ChannelGroupService::Name Name
Class for propagation of a trkf::TrackState to a recob::tracking::Plane.
art::ServiceHandle< geo::Geometry const > geom
art framework interface to geometry description
bool sortHitsByWire(art::Ptr< recob::Hit > a, art::Ptr< recob::Hit > b)
Extension of a TrackState to perform KalmanFilter calculations.
bool rejectHitsNegativeGOF_
A trajectory in space reconstructed from hits.
const TrackStatePropagator * propagator
General LArSoft Utilities.
static int max(int a, int b)
Set of flags pertaining a point of the track.
float maxResidueFirstHit_
bool sortOutputHitsMinLength_
TrackKalmanFitter(const TrackStatePropagator *prop, Parameters const &p)
Constructor from TrackStatePropagator and Parameters table.
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Struct holding optional TrackMaker outputs.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: