43 category_ =
"Muon|RecoMuon|CosmicMuon|CosmicMuonSmoother";
62 std::vector<Trajectory> && fitted =
fit(t);
64 std::vector<Trajectory> && smoothed =
smooth(fitted);
65 return smoothed.empty() ?
Trajectory() : smoothed.front();
75 if ( hits.empty() ||!firstPredTsos.
isValid() )
return vector<Trajectory>();
84 vector<Trajectory> fitted =
fit(seed, hits, firstTsos);
86 vector<Trajectory> smoothed =
smooth(fitted);
98 if ( t.
empty() )
return vector<Trajectory>();
105 return vector<Trajectory>();
113 <<hits.back()->globalPosition();
117 LogTrace(
category_)<<
"after sorting hit front" <<hits.front()->globalPosition()<<
" hit back"
118 <<hits.back()->globalPosition();
120 return fit(t.
seed(), hits, firstTsos);
134 if ( hits.empty() ) {
136 return vector<Trajectory>();
146 return vector<Trajectory>();
150 if ( hits.front()->isValid() ) {
153 LogTrace(
category_)<<
"first hit is at det "<< hits.front()->det()->surface().position();
155 currTsos =
theUpdator->update(predTsos, *preciseHit);
158 <<
"an updated state is not valid. killing the trajectory.";
159 return vector<Trajectory>();
172 for ( ConstRecHitContainer::const_iterator ihit = hits.begin() + 1;
173 ihit != hits.end(); ++ihit ) {
175 if ( !(**ihit).isValid() ) {
195 predTsos =
theService->propagator(
"StraightLinePropagator")->propagate(currTsos, (**ihit).det()->
surface());
207 }
else if ( (**ihit).isValid() ) {
211 if ( !preciseHit->isValid() ) {
215 currTsos =
theUpdator->update(predTsos, *preciseHit);
218 <<
"an updated state is not valid. killing the trajectory.";
219 return vector<Trajectory>();
231 std::vector<TrajectoryMeasurement> mytms = myTraj.
measurements();
233 for (std::vector<TrajectoryMeasurement>::const_iterator itm = mytms.begin();
234 itm != mytms.end(); ++itm ) {
236 <<
"mom "<<itm->updatedState().globalMomentum();
240 return vector<Trajectory>(1, myTraj);
250 vector<Trajectory>
result;
252 for ( vector<Trajectory>::const_iterator it = tc.begin(); it != tc.end(); ++it ) {
253 vector<Trajectory> smoothed =
smooth(*it);
254 result.insert(result.end(), smoothed.begin(), smoothed.end());
269 return vector<Trajectory>();
276 if ( avtm.size() < 2 ) {
278 return vector<Trajectory>();
286 return vector<Trajectory>();
292 if ( avtm.back().recHit()->isValid() ) {
293 currTsos =
theUpdator->update(predTsos, (*avtm.back().recHit()));
296 <<
"an updated state is not valid. killing the trajectory.";
297 return vector<Trajectory>();
301 avtm.back().updatedState(),
302 avtm.back().recHit(),
303 avtm.back().estimate()
318 for ( vector<TrajectoryMeasurement>::reverse_iterator itm = avtm.rbegin() + 1;
319 itm != avtm.rend() - 1; ++itm ) {
343 return vector<Trajectory>();
345 }
else if ( (*itm).recHit()->isValid() ) {
347 currTsos =
theUpdator->update(predTsos, (*(*itm).recHit()));
350 <<
"an updated state is not valid. killing the trajectory.";
351 return vector<Trajectory>();
356 return vector<Trajectory>();
363 return vector<Trajectory>();
370 theEstimator->estimate(combTsos, (*(*itm).recHit())).second
379 return vector<Trajectory>();
397 avtm.front().recHit()));
399 if ( avtm.front().recHit()->isValid() ) {
401 currTsos =
theUpdator->update(predTsos, (*avtm.front().recHit()));
406 avtm.front().recHit(),
407 theEstimator->estimate(predTsos, (*avtm.front().recHit())).second
414 if (myTraj.foundHits() >= 3)
415 return vector<Trajectory>(1, myTraj);
418 return vector<Trajectory>();
432 if ( !beamhaloFlag ) {
464 if (hits.size() < 2)
return;
469 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
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()
const Propagator * propagatorOpposite() const
const Propagator * propagatorAlong() const
ConstRecHitContainer recHits(bool splitting=false) const
U second(std::pair< T, U > const &p)
DataContainer const & measurements() const
const SurfaceType & surface() const
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
CosmicMuonUtilities * theUtilities
virtual TrajectoryContainer trajectories(const Trajectory &traj) const
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
TrajectoryMeasurement const & firstMeasurement() const
TrajectoryStateOnSurface initialState(const Trajectory &) const
Chi2MeasurementEstimator * theEstimator
std::vector< Trajectory > fit(const Trajectory &) const
GlobalVector globalMomentum() const
CosmicMuonSmoother(const edm::ParameterSet &, const MuonServiceProxy *service)
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
TrajectoryStateOnSurface const & updatedState() const
void reverseDirection(TrajectoryStateOnSurface &, const MagneticField *) const
Trajectory trajectory(const Trajectory &) const
void push(const TrajectoryMeasurement &tm)
std::string thePropagatorOppositeName