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();
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();
157 if (!currTsos.isValid()){
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() ) {
180 if (currTsos.isValid() && currTsos.globalMomentum().mag2() > 1
e-18
f) {
182 <<
"mom "<<currTsos.globalMomentum();
187 <<
"Input state is not valid. This loop over hits is doomed: breaking out";
195 LogTrace(
category_)<<
"step-propagating from "<<currTsos.globalPosition() <<
" to position: "<<(*ihit)->globalPosition();
199 LogTrace(
category_)<<
"straight-line propagating from "<<currTsos.globalPosition() <<
" to position: "<<(*ihit)->globalPosition();
200 predTsos =
theService->propagator(
"StraightLinePropagator")->propagate(currTsos, (**ihit).det()->surface());
212 }
else if ( (**ihit).isValid() ) {
216 auto preciseHit = *ihit;
218 if ( !preciseHit->isValid() ) {
223 if (!currTsos.isValid()){
225 <<
"an updated state is not valid. killing the trajectory.";
226 return vector<Trajectory>();
238 std::vector<TrajectoryMeasurement> mytms = myTraj.measurements();
240 for (std::vector<TrajectoryMeasurement>::const_iterator itm = mytms.begin();
241 itm != mytms.end(); ++itm ) {
243 <<
"mom "<<itm->updatedState().globalMomentum();
247 return vector<Trajectory>(1, myTraj);
257 vector<Trajectory>
result;
259 for ( vector<Trajectory>::const_iterator it = tc.begin(); it != tc.end(); ++it ) {
260 vector<Trajectory> smoothed =
smooth(*it);
261 result.insert(result.end(), smoothed.begin(), smoothed.end());
276 return vector<Trajectory>();
283 if ( avtm.size() < 2 ) {
285 return vector<Trajectory>();
291 if ( !predTsos.isValid() ) {
293 return vector<Trajectory>();
299 if ( avtm.back().recHit()->isValid() ) {
301 if (!currTsos.isValid()){
303 <<
"an updated state is not valid. killing the trajectory.";
304 return vector<Trajectory>();
308 avtm.back().updatedState(),
309 avtm.back().recHit(),
310 avtm.back().estimate()
325 for ( vector<TrajectoryMeasurement>::reverse_iterator itm = avtm.rbegin() + 1;
326 itm != avtm.rend() - 1; ++itm ) {
328 if (currTsos.isValid()) {
330 <<
"mom "<<currTsos.globalMomentum();
337 if ( !predTsos.isValid() ) {
338 LogTrace(
category_)<<
"step-propagating from "<<currTsos.globalPosition() <<
" to position: "<<(*itm).recHit()->globalPosition();
341 if (predTsos.isValid()) {
343 <<
"mom "<<predTsos.globalMomentum();
348 if ( !predTsos.isValid() ) {
350 return vector<Trajectory>();
352 }
else if ( (*itm).recHit()->isValid() ) {
355 if (!currTsos.isValid()){
357 <<
"an updated state is not valid. killing the trajectory.";
358 return vector<Trajectory>();
361 if ( !combTsos.isValid() ) {
363 return vector<Trajectory>();
368 if ( !smooTsos.isValid() ) {
370 return vector<Trajectory>();
377 theEstimator->estimate(combTsos, (*(*itm).recHit())).second
386 return vector<Trajectory>();
400 if ( !predTsos.isValid() ){
404 avtm.front().recHit()));
406 if ( avtm.front().recHit()->isValid() ) {
409 if (currTsos.isValid())
413 avtm.front().recHit(),
414 theEstimator->estimate(predTsos, (*avtm.front().recHit())).second
421 if (myTraj.foundHits() >= 3)
422 return vector<Trajectory>(1, myTraj);
425 return vector<Trajectory>();
439 if ( !beamhaloFlag ) {
471 if (hits.size() < 2)
return;
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
virtual ~CosmicMuonSmoother()
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
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
GlobalVector globalMomentum() const
CosmicMuonSmoother(const edm::ParameterSet &, const MuonServiceProxy *service)
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
virtual TrajectoryContainer trajectories(const Trajectory &traj) const override
TrajectoryStateOnSurface const & updatedState() const
void reverseDirection(TrajectoryStateOnSurface &, const MagneticField *) const
std::string thePropagatorOppositeName