40 category_ =
"Muon|RecoMuon|CosmicMuon|CosmicMuonSmoother";
59 std::vector<Trajectory>&& fitted =
fit(t);
62 std::vector<Trajectory>&& smoothed =
smooth(fitted);
63 return smoothed.empty() ?
Trajectory() : smoothed.front();
72 if (hits.empty() || !firstPredTsos.
isValid())
73 return vector<Trajectory>();
82 vector<Trajectory> fitted =
fit(seed, hits, firstTsos);
84 vector<Trajectory> smoothed =
smooth(fitted);
95 return vector<Trajectory>();
102 return vector<Trajectory>();
109 LogTrace(
category_) <<
"hit front" << hits.front()->globalPosition() <<
" hit back" << hits.back()->globalPosition();
113 LogTrace(
category_) <<
"after sorting hit front" << hits.front()->globalPosition() <<
" hit back"
114 << hits.back()->globalPosition();
116 return fit(t.
seed(), hits, firstTsos);
129 return vector<Trajectory>();
139 return vector<Trajectory>();
143 if (hits.front()->isValid()) {
146 auto preciseHit = hits.front();
148 LogTrace(
category_) <<
"first hit is at det " << hits.front()->det()->surface().position();
153 return vector<Trajectory>();
156 predTsos, currTsos, hits.front(),
theEstimator->estimate(predTsos, *hits.front()).
second));
166 for (ConstRecHitContainer::const_iterator ihit = hits.begin() + 1; ihit != hits.end(); ++ihit) {
167 if (!(**ihit).isValid()) {
176 LogTrace(
category_) <<
"Input state is not valid. This loop over hits is doomed: breaking out";
185 <<
" to position: " << (*ihit)->globalPosition();
189 (
theService->propagator(
"StraightLinePropagator").isValid())) {
191 <<
" to position: " << (*ihit)->globalPosition();
192 predTsos =
theService->propagator(
"StraightLinePropagator")->propagate(currTsos, (**ihit).det()->
surface());
200 LogTrace(
category_) <<
"Error: predTsos is still invalid or too far in forward fit.";
203 }
else if ((**ihit).isValid()) {
207 auto preciseHit = *ihit;
209 if (!preciseHit->isValid()) {
216 return vector<Trajectory>();
219 predTsos, currTsos, preciseHit,
theEstimator->estimate(predTsos, *preciseHit).second));
227 std::vector<TrajectoryMeasurement> mytms = myTraj.
measurements();
229 for (std::vector<TrajectoryMeasurement>::const_iterator itm = mytms.begin(); itm != mytms.end(); ++itm) {
230 LogTrace(
category_) <<
"updated pos " << itm->updatedState().globalPosition() <<
"mom "
231 << itm->updatedState().globalMomentum();
234 return vector<Trajectory>(1, myTraj);
241 vector<Trajectory>
result;
243 for (vector<Trajectory>::const_iterator it = tc.begin(); it != tc.end(); ++it) {
244 vector<Trajectory> smoothed =
smooth(*it);
245 result.insert(result.end(), smoothed.begin(), smoothed.end());
257 return vector<Trajectory>();
264 if (avtm.size() < 2) {
266 return vector<Trajectory>();
274 return vector<Trajectory>();
280 if (avtm.back().recHit()->isValid()) {
284 return vector<Trajectory>();
288 avtm.back().updatedState(),
289 avtm.back().recHit(),
290 avtm.back().estimate()
303 for (vector<TrajectoryMeasurement>::reverse_iterator itm = avtm.rbegin() + 1; itm != avtm.rend() - 1; ++itm) {
314 <<
" to position: " << (*itm).recHit()->globalPosition();
325 return vector<Trajectory>();
327 }
else if ((*itm).recHit()->isValid()) {
332 return vector<Trajectory>();
337 return vector<Trajectory>();
344 return vector<Trajectory>();
351 theEstimator->estimate(combTsos, (*(*itm).recHit())).second
360 return vector<Trajectory>();
379 if (avtm.front().recHit()->isValid()) {
386 avtm.front().recHit(),
387 theEstimator->estimate(predTsos, (*avtm.front().recHit())).second
394 if (myTraj.foundHits() >= 3)
395 return vector<Trajectory>(1, myTraj);
398 return vector<Trajectory>();
454 std::reverse(hits.begin(), hits.end());
bool empty() const
True if trajectory has no measurements.
void rescaleError(double factor)
void sortHitsAlongMom(ConstRecHitContainer &hits, const TrajectoryStateOnSurface &) const
const MuonServiceProxy * theService
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
ConstRecHitContainer recHits() const
Trajectory trajectory(const Trajectory &) const override
const Propagator * propagatorOpposite() const
const Propagator * propagatorAlong() const
const Chi2MeasurementEstimator * theEstimator
U second(std::pair< T, U > const &p)
DataContainer const & measurements() const
const SurfaceType & surface() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
const CosmicMuonUtilities * theUtilities
std::vector< Trajectory > smooth(const std::vector< Trajectory > &) const
TrajectoryMeasurement const & lastMeasurement() const
std::string thePropagatorAlongName
TrajectoryStateOnSurface stepPropagate(const TrajectoryStateOnSurface &, const ConstRecHitPointer &, const Propagator &) const
const KFUpdator * theUpdator
TrajectoryMeasurement const & firstMeasurement() const
TrajectoryStateOnSurface initialState(const Trajectory &) const
std::vector< Trajectory > fit(const Trajectory &) const
T getParameter(std::string const &) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
~CosmicMuonSmoother() override
GlobalVector globalMomentum() const
TrajectoryContainer trajectories(const Trajectory &traj) const override
CosmicMuonSmoother(const edm::ParameterSet &, const MuonServiceProxy *service)
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
TrajectoryStateOnSurface const & updatedState() const
Log< level::Warning, false > LogWarning
void reverseDirection(TrajectoryStateOnSurface &, const MagneticField *) const
void push(const TrajectoryMeasurement &tm)
std::string thePropagatorOppositeName
tuple Chi2MeasurementEstimator