41 category_ =
"Muon|RecoMuon|CosmicMuon|CosmicMuonSmoother";
60 std::vector<Trajectory> && fitted =
fit(t);
62 std::vector<Trajectory> && smoothed =
smooth(fitted);
63 return smoothed.empty() ?
Trajectory() : smoothed.front();
73 if ( hits.empty() ||!firstPredTsos.
isValid() )
return vector<Trajectory>();
82 vector<Trajectory> fitted =
fit(seed, hits, firstTsos);
84 vector<Trajectory> smoothed =
smooth(fitted);
96 if ( t.
empty() )
return vector<Trajectory>();
103 return vector<Trajectory>();
111 <<hits.back()->globalPosition();
115 LogTrace(
category_)<<
"after sorting hit front" <<hits.front()->globalPosition()<<
" hit back"
116 <<hits.back()->globalPosition();
118 return fit(t.
seed(), hits, firstTsos);
132 if ( hits.empty() ) {
134 return vector<Trajectory>();
144 return vector<Trajectory>();
148 if ( hits.front()->isValid() ) {
152 auto preciseHit = hits.front();
154 LogTrace(
category_)<<
"first hit is at det "<< hits.front()->det()->surface().position();
156 currTsos =
theUpdator->update(predTsos, *preciseHit);
159 <<
"an updated state is not valid. killing the trajectory.";
160 return vector<Trajectory>();
173 for ( ConstRecHitContainer::const_iterator ihit = hits.begin() + 1;
174 ihit != hits.end(); ++ihit ) {
176 if ( !(**ihit).isValid() ) {
196 predTsos =
theService->propagator(
"StraightLinePropagator")->propagate(currTsos, (**ihit).det()->
surface());
208 }
else if ( (**ihit).isValid() ) {
212 auto preciseHit = *ihit;
214 if ( !preciseHit->isValid() ) {
218 currTsos =
theUpdator->update(predTsos, *preciseHit);
221 <<
"an updated state is not valid. killing the trajectory.";
222 return vector<Trajectory>();
234 std::vector<TrajectoryMeasurement> mytms = myTraj.
measurements();
236 for (std::vector<TrajectoryMeasurement>::const_iterator itm = mytms.begin();
237 itm != mytms.end(); ++itm ) {
239 <<
"mom "<<itm->updatedState().globalMomentum();
243 return vector<Trajectory>(1, myTraj);
253 vector<Trajectory>
result;
255 for ( vector<Trajectory>::const_iterator it = tc.begin(); it != tc.end(); ++it ) {
256 vector<Trajectory> smoothed =
smooth(*it);
257 result.insert(result.end(), smoothed.begin(), smoothed.end());
272 return vector<Trajectory>();
279 if ( avtm.size() < 2 ) {
281 return vector<Trajectory>();
289 return vector<Trajectory>();
295 if ( avtm.back().recHit()->isValid() ) {
296 currTsos =
theUpdator->update(predTsos, (*avtm.back().recHit()));
299 <<
"an updated state is not valid. killing the trajectory.";
300 return vector<Trajectory>();
304 avtm.back().updatedState(),
305 avtm.back().recHit(),
306 avtm.back().estimate()
321 for ( vector<TrajectoryMeasurement>::reverse_iterator itm = avtm.rbegin() + 1;
322 itm != avtm.rend() - 1; ++itm ) {
346 return vector<Trajectory>();
348 }
else if ( (*itm).recHit()->isValid() ) {
350 currTsos =
theUpdator->update(predTsos, (*(*itm).recHit()));
353 <<
"an updated state is not valid. killing the trajectory.";
354 return vector<Trajectory>();
359 return vector<Trajectory>();
366 return vector<Trajectory>();
382 return vector<Trajectory>();
400 avtm.front().recHit()));
402 if ( avtm.front().recHit()->isValid() ) {
404 currTsos =
theUpdator->update(predTsos, (*avtm.front().recHit()));
409 avtm.front().recHit(),
417 if (myTraj.foundHits() >= 3)
418 return vector<Trajectory>(1, myTraj);
421 return vector<Trajectory>();
435 if ( !beamhaloFlag ) {
467 if (hits.size() < 2)
return;
472 std::reverse(hits.begin(),hits.end());
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
virtual TrajectoryContainer trajectories(const Trajectory &traj) 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
virtual ~CosmicMuonSmoother()
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
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
tuple Chi2MeasurementEstimator
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
GlobalVector globalMomentum() const
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
CosmicMuonSmoother(const edm::ParameterSet &, const MuonServiceProxy *service)
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
TrajectoryStateOnSurface const & updatedState() const
void reverseDirection(TrajectoryStateOnSurface &, const MagneticField *) const
void push(const TrajectoryMeasurement &tm)
std::string thePropagatorOppositeName