test
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 
26  /*
27  template <class ResultingHit> TrackingRecHit::RecHitPointer project(const TrackingRecHit::ConstRecHitPointer hit,
28  const GeomDet& det,
29  const TrajectoryStateOnSurface ts) const{
30  //1) propagate the best possible track parameters to the surface of the hit you want to "move" using a AnalyticalPropagator ;
31  //2) create LocalTrajectoryParameters with the local x,y of the hit and direction + momentum from the propagated track parameters;
32  //3) create a LocalTrajectoryError matrix which is 0 except for the local x,y submatrix, which is filled with the hit errors;
33  //4) create a TSOS from the result of 2) and 3) and propagate it to the reference surface;
34  //5) create a new hit with the local x,y subspace of the result of 4)
35  if (!ts.isValid()) return InvalidTransientRecHit::build(hit->det());
36  // LogTrace("SiTrackerMultiRecHitUpdator") << "the tsos is valid";
37  //check if the ts lays or not on the destination surface and in case propagate it
38  TrajectoryStateOnSurface propagated =ts;
39  if (hit->surface() != &(ts.surface())) propagated = thePropagator->propagate(ts, *(hit->surface()));
40  if (!propagated.isValid()) return InvalidTransientRecHit::build(hit->det());
41  // LogTrace("SiTrackerMultiRecHitUpdator") << "the propagate tsos is valid";
42  // LogTrace("SiTrackerMultiRecHitUpdator") << "Original: position: "<<hit->parameters()<<" error: "<<hit->parametersError()<<std::endl;
43  //clone the original hit with this state
44  TrackingRecHit::RecHitPointer updatedOriginal = hit->clone(propagated);
45  // LogTrace("SiTrackerMultiRecHitUpdator") << "New: position: "<<updatedOriginal->parameters()<<" error: "<<updatedOriginal->parametersError()<<std::endl;
46 
47  // LogTrace("SiTrackerMultiRecHitUpdator") << "rechit cloned";
48  LocalTrajectoryParameters ltp(updatedOriginal->localPosition(), propagated.localMomentum(), propagated.charge());
49  AlgebraicSymMatrix55 ltem;
50  ltem(3,3) = (updatedOriginal->parametersError())(1,1);
51  ltem(4,4) = (updatedOriginal->parametersError())(2,2);
52  ltem(3,4) = (updatedOriginal->parametersError())(1,2);
53  // LogTrace("SiTrackerMultiRecHitUpdator") <<"The cov matrix: "<<ltem<<std::endl;
54  LocalTrajectoryError lte(ltem);
55  // LogTrace("SiTrackerMultiRecHitUpdator") <<"Original cov matrix: "<<lte.matrix()<<std::endl;
56  TrajectoryStateOnSurface hit_state(ltp, lte, propagated.surface(), propagated.magneticField());
57  TrajectoryStateOnSurface projected_hit_state = thePropagator->propagate(hit_state, det.surface());
58  if (!projected_hit_state.isValid()) return InvalidTransientRecHit::build(hit->det());
59  LocalPoint p = projected_hit_state.localPosition();
60  LocalError e = projected_hit_state.localError().positionError();
61  // LogTrace("SiTrackerMultiRecHitUpdator") << "position: "<<p<<" error: "<<e<<std::endl;
62  //AlgebraicSymMatrix55 projm=projected_hit_state.localError().matrix();
63  // for(int i=0;i<5;i++){
64  // LogTrace("SiTrackerMultiRecHitUpdator") <<"cov matrix: "<<projm<<std::endl;
65  // }
66  return ResultingHit::build(p, e, &det, updatedOriginal->det(), updatedOriginal, this);
67  }
68 
69  */
70  private:
72 };
73 
74 #endif
const AnalyticalPropagator * thePropagator
TrackingRecHitPropagator(const MagneticField *magf)