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();
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();
151 if (!currTsos.isValid()) {
153 return vector<Trajectory>();
156 predTsos, currTsos, hits.front(),
theEstimator->estimate(predTsos, *hits.front()).
second));
157 if (currTsos.isValid())
166 for (ConstRecHitContainer::const_iterator ihit = hits.begin() + 1; ihit != hits.end(); ++ihit) {
167 if (!(**ihit).isValid()) {
171 if (currTsos.isValid() && currTsos.globalMomentum().mag2() > 1
e-18
f) {
172 LogTrace(
category_) <<
"current pos " << currTsos.globalPosition() <<
"mom " << currTsos.globalMomentum();
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())) {
190 LogTrace(
category_) <<
"straight-line propagating from " << currTsos.globalPosition()
191 <<
" to position: " << (*ihit)->globalPosition();
192 predTsos =
theService->propagator(
"StraightLinePropagator")->propagate(currTsos, (**ihit).det()->surface());
203 }
else if ((**ihit).isValid()) {
207 auto preciseHit = *ihit;
209 if (!preciseHit->isValid()) {
214 if (!currTsos.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>();
272 if (!predTsos.isValid()) {
274 return vector<Trajectory>();
280 if (avtm.back().recHit()->isValid()) {
282 if (!currTsos.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) {
304 if (currTsos.isValid()) {
305 LogTrace(
category_) <<
"current pos " << currTsos.globalPosition() <<
"mom " << currTsos.globalMomentum();
312 if (!predTsos.isValid()) {
314 <<
" to position: " << (*itm).recHit()->globalPosition();
317 if (predTsos.isValid()) {
318 LogTrace(
category_) <<
"predicted pos " << predTsos.globalPosition() <<
"mom " << predTsos.globalMomentum();
323 if (!predTsos.isValid()) {
325 return vector<Trajectory>();
327 }
else if ((*itm).recHit()->isValid()) {
330 if (!currTsos.isValid()) {
332 return vector<Trajectory>();
335 if (!combTsos.isValid()) {
337 return vector<Trajectory>();
342 if (!smooTsos.isValid()) {
344 return vector<Trajectory>();
351 theEstimator->estimate(combTsos, (*(*itm).recHit())).second
360 return vector<Trajectory>();
374 if (!predTsos.isValid()) {
379 if (avtm.front().recHit()->isValid()) {
382 if (currTsos.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>();
bool empty() const
True if trajectory has no measurements.
void rescaleError(double factor)
T getParameter(std::string const &) const
void sortHitsAlongMom(ConstRecHitContainer &hits, const TrajectoryStateOnSurface &) const
Trajectory trajectory(const Trajectory &) const override
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
const Propagator * propagatorOpposite() const
const Propagator * propagatorAlong() const
const Chi2MeasurementEstimator * theEstimator
U second(std::pair< T, U > const &p)
DataContainer const & measurements() 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
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
~CosmicMuonSmoother() override
GlobalVector globalMomentum() const
CosmicMuonSmoother(const edm::ParameterSet &, const MuonServiceProxy *service)
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
TrajectoryStateOnSurface const & updatedState() const
void reverseDirection(TrajectoryStateOnSurface &, const MagneticField *) const
TrajectoryContainer trajectories(const Trajectory &traj) const override
std::string thePropagatorOppositeName