CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TSiStripMatchedRecHit.cc
Go to the documentation of this file.
6 //#include "FWCore/MessageLogger/interface/MessageLogger.h"
8 
9 #undef RecoTracker_TransientTrackingRecHit_TSiStripMatchedRecHit_RefitProj
10 #undef RecoTracker_TransientTrackingRecHit_TSiStripMatchedRecHit_RefitLGL
11 #ifdef RecoTracker_TransientTrackingRecHit_TSiStripMatchedRecHit_RefitLGL
12 // Local lo Global lo Local
14  const BoundPlane &stripPlane = gdet->stereoDet()->surface();
15  LocalPoint lp = stripPlane.toLocal(tsos.globalPosition());
16  LocalVector ld = stripPlane.toLocal(tsos.globalParameters().momentum());
17  return LocalTrajectoryParameters(lp,ld,tsos.charge());
18 }
19 #elif defined(RecoTracker_TransientTrackingRecHit_TSiStripMatchedRecHit_RefitProj)
20 // A la RecHitProjector
22  const BoundPlane &stripPlane = gdet->stereoDet()->surface();
23  double delta = stripPlane.localZ( tsos.globalPosition());
24  LocalVector ld = stripPlane.toLocal(tsos.globalParameters().momentum());
25  LocalPoint lp = stripPlane.toLocal(tsos.globalPosition()) - ld*delta/ld.z();
26  return LocalTrajectoryParameters(lp,ld,tsos.charge());
27 }
28 #else
29 // Dummy
31  return tsos.localParameters();
32 }
33 #endif
34 
37 {
38  if (theMatcher != 0) {
39  const SiStripMatchedRecHit2D *orig = static_cast<const SiStripMatchedRecHit2D *> (this->hit());
40  const GeomDet *det = this->det();
41  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (det);
42  //if ((orig == 0) || (gdet == 0)) return this->clone(); // or just die ?
43  LocalVector tkDir = (ts.isValid() ? ts.localDirection() :
44  det->surface().toLocal( det->position()-GlobalPoint(0,0,0)));
45 
46  if(theCPE != 0){
47  //approximation: the ts parameter on the glued surface are used on the mono
48  // and stereo surface to re-evaluate cluster parameter. A further propagation
49  //is slow// and useless (?) in this case.
50 
51  const SiStripMatchedRecHit2D* better;
52 
53  if(!orig->monoHit()->cluster().isNull()){
54  const SiStripCluster& monoclust = *orig->monoHit()->cluster();
55  const SiStripCluster& stereoclust = *orig->stereoHit()->cluster();
56 
58  theCPE->localParameters( monoclust, *gdet->monoDet(), ts);
60  theCPE->localParameters( stereoclust, *gdet->stereoDet(), gluedToStereo(ts, gdet));
61 
62  SiStripRecHit2D monoHit = SiStripRecHit2D( lvMono.first, lvMono.second,
63  gdet->monoDet()->geographicalId(),
64  orig->monoHit()->cluster());
65 
66  SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
67  gdet->stereoDet()->geographicalId(),
68  orig->stereoHit()->cluster());
69  better = theMatcher->match(&monoHit,&stereoHit,gdet,tkDir);
70  }else{
71  const SiStripCluster& monoclust = *orig->monoHit()->cluster_regional();
72  const SiStripCluster& stereoclust = *orig->stereoHit()->cluster_regional();
74  theCPE->localParameters( monoclust, *gdet->monoDet(), ts);
76  theCPE->localParameters( stereoclust, *gdet->stereoDet(), gluedToStereo(ts, gdet));
77 
78  SiStripRecHit2D monoHit = SiStripRecHit2D( lvMono.first, lvMono.second,
79  gdet->monoDet()->geographicalId(),
80  orig->monoHit()->cluster_regional());
81 
82  SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
83  gdet->stereoDet()->geographicalId(),
84  orig->stereoHit()->cluster_regional());
85  better = theMatcher->match(&monoHit,&stereoHit,gdet,tkDir);
86  }
87 
88  if (better == 0) {
89  //dm::LogWarning("TSiStripMatchedRecHit") << "Refitting of a matched rechit returns NULL";
90  return this->clone();
91  }
92 
94  delete better; //the ownership of the object is passed to the caller of the matcher
95  return result;
96 
97  }else{
98  const SiStripMatchedRecHit2D *better = theMatcher->match(orig,gdet,tkDir);
99  if (better == 0) {
100  //edm::LogWarning("TSiStripMatchedRecHit") << "Refitting of a matched rechit returns NULL";
101  return this->clone();
102  }
104  delete better; //the ownership of the object is passed to the caller of the matcher
105  return result;
106  }
107  }
108  return this->clone();
109 
110 }
111 
112 
113 
117 
118  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (this->det());
119  const SiStripMatchedRecHit2D *orig = static_cast<const SiStripMatchedRecHit2D *> (this->hit());
120 
121  result.push_back(TSiStripRecHit2DLocalPos::build( gdet->monoDet(),orig->monoHit(),theCPE));
122  result.push_back(TSiStripRecHit2DLocalPos::build( gdet->stereoDet(),orig->stereoHit(),theCPE));
123  return result;
124 }
ReferenceCountingPointer< TransientTrackingRecHit > RecHitPointer
dbl * delta
Definition: mlp_gen.cc:36
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
const LocalTrajectoryParameters & localParameters() const
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
const SiStripRecHit2D * stereoHit() const
LocalVector localDirection() const
virtual const TrackingRecHit * hit() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
float localZ(const GlobalPoint &gp) const
Fast access to distance from plane for a point.
Definition: Plane.h:52
const StripClusterParameterEstimator * theCPE
GlobalPoint globalPosition() const
ClusterRegionalRef const & cluster_regional() const
static RecHitPointer build(const GeomDet *geom, const SiStripRecHit2D *rh, const StripClusterParameterEstimator *cpe, float weight=1., float annealing=1., bool computeCoarseLocalPosition=false)
const LocalTrajectoryParameters & gluedToStereo(const TrajectoryStateOnSurface &tsos, const GluedGeomDet *gdet)
std::pair< LocalPoint, LocalError > LocalValues
virtual LocalValues localParameters(const T &, const GeomDetUnit &) const =0
bool isNull() const
Checks for null.
Definition: Ref.h:244
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:58
const SiStripRecHitMatcher * theMatcher
tuple result
Definition: query.py:137
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:74
std::vector< ConstRecHitPointer > ConstRecHitContainer
const GlobalTrajectoryParameters & globalParameters() const
ClusterRef const & cluster() const
static RecHitPointer build(const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe=0, float weight=1., float annealing=1., bool computeCoarseLocalPosition=false)
const GeomDet * det() const
The GomeDet* can be zero for InvalidTransientRecHits and for TConstraintRecHit2Ds.
const SiStripRecHit2D * monoHit() const
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
virtual ConstRecHitContainer transientHits() const
Composite interface: returns the component hits, if any.
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
virtual TSiStripMatchedRecHit * clone() const