CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingRecHitPropagator.h
Go to the documentation of this file.
1 #ifndef TrackingTools_TrackingRecHitPropagator_h
2 #define TrackingTools_TrackingRecHitPropagator_h
3 
11 
12 
13 /* propagates the RecHit position from the original reference frame
14  to the reference frame of another detector.
15  Useful for algorithms like the DAF or the MTF
16 */
17 
19  public:
22  };
23 
25 
27  const GeomDet& det,
28  const TrajectoryStateOnSurface ts) const{
29  //1) propagate the best possible track parameters to the surface of the hit you want to "move" using a AnalyticalPropagator ;
30  //2) create LocalTrajectoryParameters with the local x,y of the hit and direction + momentum from the propagated track parameters;
31  //3) create a LocalTrajectoryError matrix which is 0 except for the local x,y submatrix, which is filled with the hit errors;
32  //4) create a TSOS from the result of 2) and 3) and propagate it to the reference surface;
33  //5) create a new hit with the local x,y subspace of the result of 4)
34  if (!ts.isValid()) return InvalidTransientRecHit::build(hit->det());
35  // LogTrace("SiTrackerMultiRecHitUpdator") << "the tsos is valid";
36  //check if the ts lays or not on the destination surface and in case propagate it
37  TrajectoryStateOnSurface propagated =ts;
38  if (hit->surface() != &(ts.surface())) propagated = thePropagator->propagate(ts, *(hit->surface()));
39  if (!propagated.isValid()) return InvalidTransientRecHit::build(hit->det());
40  // LogTrace("SiTrackerMultiRecHitUpdator") << "the propagate tsos is valid";
41  // LogTrace("SiTrackerMultiRecHitUpdator") << "Original: position: "<<hit->parameters()<<" error: "<<hit->parametersError()<<std::endl;
42  //clone the original hit with this state
43  TransientTrackingRecHit::RecHitPointer updatedOriginal = hit->clone(propagated);
44  // LogTrace("SiTrackerMultiRecHitUpdator") << "New: position: "<<updatedOriginal->parameters()<<" error: "<<updatedOriginal->parametersError()<<std::endl;
45 
46  // LogTrace("SiTrackerMultiRecHitUpdator") << "rechit cloned";
47  LocalTrajectoryParameters ltp(updatedOriginal->localPosition(), propagated.localMomentum(), propagated.charge());
49  ltem(3,3) = (updatedOriginal->parametersError())(1,1);
50  ltem(4,4) = (updatedOriginal->parametersError())(2,2);
51  ltem(3,4) = (updatedOriginal->parametersError())(1,2);
52  // LogTrace("SiTrackerMultiRecHitUpdator") <<"The cov matrix: "<<ltem<<std::endl;
53  LocalTrajectoryError lte(ltem);
54  // LogTrace("SiTrackerMultiRecHitUpdator") <<"Original cov matrix: "<<lte.matrix()<<std::endl;
55  TrajectoryStateOnSurface hit_state(ltp, lte, propagated.surface(), propagated.magneticField());
56  TrajectoryStateOnSurface projected_hit_state = thePropagator->propagate(hit_state, det.surface());
57  if (!projected_hit_state.isValid()) return InvalidTransientRecHit::build(hit->det());
58  LocalPoint p = projected_hit_state.localPosition();
59  LocalError e = projected_hit_state.localError().positionError();
60  // LogTrace("SiTrackerMultiRecHitUpdator") << "position: "<<p<<" error: "<<e<<std::endl;
61  //AlgebraicSymMatrix55 projm=projected_hit_state.localError().matrix();
62  // for(int i=0;i<5;i++){
63  // LogTrace("SiTrackerMultiRecHitUpdator") <<"cov matrix: "<<projm<<std::endl;
64  // }
65  return ResultingHit::build(p, e, &det, updatedOriginal->det(), updatedOriginal, this);
66  }
67 
68  private:
70 };
71 
72 #endif
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const MagneticField * magneticField() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
LocalVector localMomentum() const
const SurfaceType & surface() const
const AnalyticalPropagator * thePropagator
TrackingRecHitPropagator(const MagneticField *magf)
TransientTrackingRecHit::RecHitPointer project(const TransientTrackingRecHit::ConstRecHitPointer hit, const GeomDet &det, const TrajectoryStateOnSurface ts) const