26 "KFTrajectoryFitter::fit(TrajectorySeed, <TransientTrackingRecHit>) not implemented");
33 const TSOS& firstPredTsos,
39 throw cms::Exception(
"KFTrajectoryFitter",
"TrajectorySeed::direction() requested but not set");
45 <<
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" 46 <<
" KFTrajectoryFitter::fit starting with " <<
hits.size() <<
" HITS";
48 for (
unsigned int j = 0;
j <
hits.size();
j++) {
50 LogTrace(
"TrackFitters") <<
"hit #:" <<
j + 1 <<
" rawId=" <<
hits[
j]->det()->geographicalId().rawId()
51 <<
" validity=" <<
hits[
j]->isValid();
53 LogTrace(
"TrackFitters") <<
"hit #:" <<
j + 1 <<
" Hit with no Det information";
55 LogTrace(
"TrackFitters") <<
" INITIAL STATE " << firstPredTsos;
60 myTraj.reserve(
hits.size());
62 TSOS predTsos(firstPredTsos);
66 for (
const auto& ihit :
hits) {
74 LogDebug(
"TrackFitters") <<
" Error: invalid hit with no GeomDet attached .... skipping";
81 predTsos = p_cloned->propagate(currTsos, *(
hit.surface()));
84 LogDebug(
"TrackFitters") <<
"SOMETHING WRONG !" 86 <<
"KFTrajectoryFitter: predicted tsos not valid!\n" 87 <<
"current TSOS: " << currTsos <<
"\n";
90 LogTrace(
"TrackFitters") <<
"next Surface: " <<
hit.surface()->position() <<
"\n";
92 if (myTraj.foundHits() >=
minHits_) {
93 LogDebug(
"TrackFitters") <<
" breaking trajectory" 97 LogDebug(
"TrackFitters") <<
" killing trajectory" 104 assert((
hit.geographicalId() != 0
U) | !
hit.canImproveWithTrack());
107 LogTrace(
"TrackFitters") <<
"THE HIT IS VALID: updating hit with predTsos";
109 assert((!
hit.canImproveWithTrack()) | (
nullptr != dynamic_cast<BaseTrackerRecHit const*>((ihit).
get())));
111 dump(*preciseHit, hitcounter,
"TrackFitters");
112 assert(preciseHit->isValid());
113 assert((preciseHit->geographicalId() != 0
U) | (!preciseHit->canImproveWithTrack()));
114 assert(preciseHit->surface() !=
nullptr);
116 if UNLIKELY (!preciseHit->isValid()) {
117 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS NOT VALID: using currTsos = predTsos" 122 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS VALID: updating currTsos" 126 bool badState = (!currTsos.
isValid()) ||
134 edm::LogError(
"FailedUpdate") <<
"updating with the hit failed. Not updating the trajectory with the hit";
140 edm::LogError(
"TrajectoryNotPosDef") <<
"Trajectory covariance is not positive-definite";
143 LogTrace(
"FailedUpdate") <<
"updated state is valid but pretty bad, skipping. currTsos " << currTsos
144 <<
"\n predTsos " << predTsos;
149 if (myTraj.foundHits() >=
minHits_) {
150 LogDebug(
"TrackFitters") <<
" breaking trajectory" 154 LogDebug(
"TrackFitters") <<
" killing trajectory" 159 if (preciseHit->det()) {
160 myTraj.push(
TM(predTsos,
166 myTraj.push(
TM(predTsos, currTsos, preciseHit,
estimator()->estimate(predTsos, *preciseHit).
second));
171 dump(
hit, hitcounter,
"TrackFitters");
173 LogDebug(
"TrackFitters") <<
"THE HIT IS NOT VALID: using currTsos" 176 assert(((ihit)->det() ==
nullptr) || (ihit)->geographicalId() != 0
U);
180 myTraj.push(
TM(predTsos, ihit, 0));
182 LogTrace(
"TrackFitters") <<
"predTsos !" 184 << predTsos <<
" with local position " << predTsos.
localPosition() <<
"currTsos !" 186 << currTsos <<
" with local position " << currTsos.
localPosition();
189 LogDebug(
"TrackFitters") <<
"Found 1 trajectory with " << myTraj.foundHits() <<
" valid hits\n";
virtual const DetLayer * idToLayer(const DetId &detId) const
const LocalTrajectoryError & localError() const
LocalPoint localPosition() const
constexpr bool isNotFinite(T x)
ret
prodAgent to be discontinued
const LocalTrajectoryParameters & localParameters() const
Log< level::Error, false > LogError
PropagationDirection direction() const
U second(std::pair< T, U > const &p)
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
static const DetLayerGeometry dummyGeometry
const MeasurementEstimator * estimator() const
ConstRecHitContainer recHits() const
Abs< T >::type abs(const T &t)
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
const DetLayerGeometry * theGeometry
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
bool empty() const
True if trajectory has no measurements.
TrajectoryStateOnSurface const & updatedState() const
TrajectoryMeasurement const & firstMeasurement() const
const Propagator * thePropagator
const TrajectoryStateUpdator * updator() const
LocalPoint position() const
Local x and y position coordinates.
Trajectory::RecHitContainer RecHitContainer
Trajectory fitOne(const Trajectory &aTraj, fitType) const override
TkCloner const * theHitCloner