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();
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>();
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();
153 return vector<Trajectory>();
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>();
262 vector<TrajectoryMeasurement> avtm =
t.measurements();
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>();
406 if (!
t.firstMeasurement().updatedState().isValid() || !
t.lastMeasurement().updatedState().isValid())
411 bool beamhaloFlag = (
t.firstMeasurement().updatedState().globalMomentum().eta() > 4.0 ||
412 t.lastMeasurement().updatedState().globalMomentum().eta() > 4.0);
415 if (
t.firstMeasurement().updatedState().globalPosition().y() >
416 t.lastMeasurement().updatedState().globalPosition().y()) {
417 result =
t.firstMeasurement().updatedState();
419 result =
t.lastMeasurement().updatedState();
421 if (
result.globalMomentum().y() > 1.0)
424 if (
t.firstMeasurement().updatedState().globalPosition().z() *
425 t.lastMeasurement().updatedState().globalPosition().z() >
427 if (fabs(
t.firstMeasurement().updatedState().globalPosition().z()) >
428 fabs(
t.lastMeasurement().updatedState().globalPosition().z())) {
429 result =
t.firstMeasurement().updatedState();
431 result =
t.lastMeasurement().updatedState();
435 if (fabs(
t.firstMeasurement().updatedState().globalPosition().eta()) >
436 fabs(
t.lastMeasurement().updatedState().globalPosition().eta())) {
437 result =
t.firstMeasurement().updatedState();
439 result =
t.lastMeasurement().updatedState();
void reverseDirection(TrajectoryStateOnSurface &, const MagneticField *) const
void rescaleError(double factor)
T getParameter(std::string const &) const
const MuonServiceProxy * theService
Global3DPoint GlobalPoint
Trajectory trajectory(const Trajectory &) const override
const SurfaceType & surface() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
DataContainer const & measurements() const
std::vector< Trajectory > smooth(const std::vector< Trajectory > &) const
const Chi2MeasurementEstimator * theEstimator
U second(std::pair< T, U > const &p)
const Propagator * propagatorOpposite() const
GlobalPoint globalPosition() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
const CosmicMuonUtilities * theUtilities
TrajectoryStateOnSurface stepPropagate(const TrajectoryStateOnSurface &, const ConstRecHitPointer &, const Propagator &) const
TrajectoryStateOnSurface initialState(const Trajectory &) const
std::string thePropagatorAlongName
std::vector< Trajectory > fit(const Trajectory &) const
const KFUpdator * theUpdator
void sortHitsAlongMom(ConstRecHitContainer &hits, const TrajectoryStateOnSurface &) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
GlobalVector globalMomentum() const
~CosmicMuonSmoother() override
const Propagator * propagatorAlong() const
TrajectoryContainer trajectories(const Trajectory &traj) const override
CosmicMuonSmoother(const edm::ParameterSet &, const MuonServiceProxy *service)
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Log< level::Warning, false > LogWarning
void push(const TrajectoryMeasurement &tm)
std::string thePropagatorOppositeName