Go to the documentation of this file.00001 #ifndef TrackingTools_TrackingRecHitPropagator_h
00002 #define TrackingTools_TrackingRecHitPropagator_h
00003
00004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00005 #include "TrackingTools/KalmanUpdators/interface/TrackingRecHitPropagator.h"
00006 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
00007 #include "MagneticField/Engine/interface/MagneticField.h"
00008 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00009 #include "TrackingTools/TransientTrackingRecHit/interface/InvalidTransientRecHit.h"
00010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00011
00012
00013
00014
00015
00016
00017
00018 class TrackingRecHitPropagator {
00019 public:
00020 TrackingRecHitPropagator(const MagneticField* magf){
00021 thePropagator = new AnalyticalPropagator(magf, anyDirection, 1.6);
00022 };
00023
00024 ~TrackingRecHitPropagator() {delete thePropagator;}
00025
00026 template <class ResultingHit> TransientTrackingRecHit::RecHitPointer project(const TransientTrackingRecHit::ConstRecHitPointer hit,
00027 const GeomDet& det,
00028 const TrajectoryStateOnSurface ts) const{
00029
00030
00031
00032
00033
00034 if (!ts.isValid()) return InvalidTransientRecHit::build(hit->det());
00035
00036
00037 TrajectoryStateOnSurface propagated =ts;
00038 if (hit->surface() != &(ts.surface())) propagated = thePropagator->propagate(ts, *(hit->surface()));
00039 if (!propagated.isValid()) return InvalidTransientRecHit::build(hit->det());
00040
00041
00042
00043 TransientTrackingRecHit::RecHitPointer updatedOriginal = hit->clone(propagated);
00044
00045
00046
00047 LocalTrajectoryParameters ltp(updatedOriginal->localPosition(), propagated.localMomentum(), propagated.charge());
00048 AlgebraicSymMatrix55 ltem;
00049 ltem(3,3) = (updatedOriginal->parametersError())(1,1);
00050 ltem(4,4) = (updatedOriginal->parametersError())(2,2);
00051 ltem(3,4) = (updatedOriginal->parametersError())(1,2);
00052
00053 LocalTrajectoryError lte(ltem);
00054
00055 TrajectoryStateOnSurface hit_state(ltp, lte, propagated.surface(), propagated.magneticField());
00056 TrajectoryStateOnSurface projected_hit_state = thePropagator->propagate(hit_state, det.surface());
00057 if (!projected_hit_state.isValid()) return InvalidTransientRecHit::build(hit->det());
00058 LocalPoint p = projected_hit_state.localPosition();
00059 LocalError e = projected_hit_state.localError().positionError();
00060
00061 AlgebraicSymMatrix55 projm=projected_hit_state.localError().matrix();
00062
00063
00064
00065 return ResultingHit::build(p, e, &det, updatedOriginal->det(), updatedOriginal, this);
00066 }
00067
00068 private:
00069 const AnalyticalPropagator* thePropagator;
00070 };
00071
00072 #endif