1 #ifndef TRACKKALMANFITTER_H 2 #define TRACKKALMANFITTER_H 17 class DetectorPropertiesData;
22 class TrackTrajectory;
26 struct OptionalOutputs;
34 class TrackStatePropagator;
63 Comment(
"Flag to replace the default hit error " 64 "recob::Hit::SigmaPeakTime() with recob::Hit::RMS()."),
67 Name(
"sortHitsByPlane"),
68 Comment(
"Flag to sort hits along the forward fit. The hit order in each plane is preserved " 69 "(unless sortHitsByWire is true), the next hit to process in 3D is chosen as the " 70 "one with shorter 3D propagation distance among the next hit in all planes."),
73 Name(
"sortHitsByWire"),
74 Comment(
"Set to true if, instead of keeping the hit sorting in each plane from the pattern " 75 "recognition stage, the hits need to be sorted by wire number. Ignored if " 76 "sortHitsByPlane = false."),
79 Name(
"sortOutputHitsMinLength"),
80 Comment(
"Flag to decide whether the hits are sorted before creating the output track in " 81 "order to avoid tracks with huge length."),
86 "Flag to decide whether, during the forward fit, the hits corresponding to a negative " 87 "propagation distance should be dropped. Also, if sortOutputHitsMinLength is true, " 88 "during sorting hits at a negative distance with respect to the previous are rejected."),
92 Comment(
"Flag to decide whether hits with a zigzag pattern should be iteratively removed. " 93 "Zigzag identified as negative dot product of segments connecting a point to the " 94 "points before and after it."),
97 Name(
"rejectHighMultHits"),
98 Comment(
"Flag to rejects hits with recob::Hit::Multiplicity()>1."),
101 Name(
"rejectHitsNegativeGOF"),
102 Comment(
"Flag to rejects hits with recob::Hit::GoodnessOfFit<0."),
105 Comment(
"Scale the hit error squared by this factor."),
108 Name(
"tryNoSkipWhenFails"),
109 Comment(
"In case skipNegProp is true and the track fit fails, make a second attempt to fit " 110 "the track with skipNegProp=false in order to attempt to avoid losing efficiency."),
114 Comment(
"Try fit in both with default and reversed direction, choose the track with " 115 "highest score=CountValidPoints/(Length*Chi2PerNdof)."),
118 Name(
"pickBestHitOnWire"),
119 Comment(
"If there is >1 consecutive hit on the same wire, choose the one with best chi2 " 120 "and exclude the others."),
124 Comment(
"Reject hits with residue > maxResidue [cm]. If negative, it is set to " 125 "std::numeric_limits<float>::max()."),
128 Name(
"maxResidueFirstHit"),
129 Comment(
"Reject firt hit if has residue > maxResidueFirstHit [cm]. If negative, it is set " 130 "to std::numeric_limits<float>::max()."),
133 Comment(
"Reject hits with chi2 > maxChi2. If negative, it is set " 134 "to std::numeric_limits<float>::max()."),
138 Comment(
"Reject hits with propagation distance > maxDist [cm]. If negative, it is set to " 139 "std::numeric_limits<float>::max()."),
142 Name(
"negDistTolerance"),
143 Comment(
"Tolerance for negative propagation distance to avoid hit rejection (so this is " 144 "expected to be a small negative number)."),
148 Comment(
"0 for no debug printouts, 1 for moderate, 2 for maximum."),
156 bool sortHitsByPlane,
158 bool sortOutputHitsMinLength,
161 bool rejectHighMultHits,
162 bool rejectHitsNegativeGOF,
163 float hitErr2ScaleFact,
164 bool tryNoSkipWhenFails,
166 bool pickBestHitOnWire,
168 float maxResidueFirstHit,
171 float negDistTolerance,
176 sortHitsByPlane_ = sortHitsByPlane;
178 sortOutputHitsMinLength_ = sortOutputHitsMinLength;
179 skipNegProp_ = skipNegProp;
180 cleanZigzag_ = cleanZigzag;
181 rejectHighMultHits_ = rejectHighMultHits;
182 rejectHitsNegativeGOF_ = rejectHitsNegativeGOF;
183 hitErr2ScaleFact_ = hitErr2ScaleFact;
184 tryNoSkipWhenFails_ = tryNoSkipWhenFails;
185 tryBothDirs_ = tryBothDirs;
186 pickBestHitOnWire_ = pickBestHitOnWire;
187 maxResidue_ = (maxResidue > 0 ? maxResidue : std::numeric_limits<float>::max());
188 maxResidueFirstHit_ =
189 (maxResidueFirstHit > 0 ? maxResidueFirstHit : std::numeric_limits<float>::max());
190 maxChi2_ = (maxChi2 > 0 ? maxChi2 : std::numeric_limits<float>::max());
191 maxDist_ = (maxDist > 0 ? maxDist : std::numeric_limits<float>::max());
192 negDistTolerance_ = negDistTolerance;
193 dumpLevel_ = dumpLevel;
200 p().sortHitsByPlane(),
202 p().sortOutputHitsMinLength(),
205 p().rejectHighMultHits(),
206 p().rejectHitsNegativeGOF(),
207 p().hitErr2ScaleFact(),
208 p().tryNoSkipWhenFails(),
210 p().pickBestHitOnWire(),
212 p().maxResidueFirstHit(),
215 p().negDistTolerance(),
228 const bool flipDirection,
239 const std::vector<recob::TrajectoryPointFlags>& flags,
250 std::vector<HitState>& hitstatev,
251 std::vector<recob::TrajectoryPointFlags::Mask_t>& hitflagsv,
252 std::vector<KFTrackState>& fwdPrdTkState,
253 std::vector<KFTrackState>& fwdUpdTkState,
254 std::vector<unsigned int>& hitstateidx,
255 std::vector<unsigned int>& rejectedhsidx,
256 std::vector<unsigned int>& sortedtksidx,
257 bool applySkipClean =
true)
const;
265 const int pdgid)
const;
270 const std::vector<recob::TrajectoryPointFlags>& flags,
271 std::vector<HitState>& hitstatev,
272 std::vector<recob::TrajectoryPointFlags::Mask_t>& hitflagsv)
const;
275 void sortOutput(std::vector<HitState>& hitstatev,
276 std::vector<KFTrackState>& fwdUpdTkState,
277 std::vector<unsigned int>& hitstateidx,
278 std::vector<unsigned int>& rejectedhsidx,
279 std::vector<unsigned int>& sortedtksidx,
280 std::vector<recob::TrajectoryPointFlags::Mask_t>& hitflagsv,
281 bool applySkipClean =
true)
const;
287 std::vector<HitState>& hitstatev,
288 std::vector<recob::TrajectoryPointFlags::Mask_t>& hitflagsv,
289 std::vector<KFTrackState>& fwdPrdTkState,
290 std::vector<KFTrackState>& fwdUpdTkState,
291 std::vector<unsigned int>& hitstateidx,
292 std::vector<unsigned int>& rejectedhsidx,
293 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
Declaration of signal hit object.
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.
Class for propagation of a trkf::TrackState to a recob::tracking::Plane.
art::ServiceHandle< geo::Geometry const > geom
bool sortHitsByWire(art::Ptr< recob::Hit > a, art::Ptr< recob::Hit > b)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Extension of a TrackState to perform KalmanFilter calculations.
bool rejectHitsNegativeGOF_
A trajectory in space reconstructed from hits.
const TrackStatePropagator * propagator
General LArSoft Utilities.
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.
Struct holding optional TrackMaker outputs.
art framework interface to geometry description
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: