CMS 3D CMS Logo

SeedFromProtoTrack.cc
Go to the documentation of this file.
2 
5 
9 
12 
15 
18 
20 
22  const SeedingHitSet & hits, const edm::EventSetup& es)
23  : theValid(true)
24 {
25  for (unsigned int i= 0, n = hits.size(); i< n; ++i) {
26  const TrackingRecHit * trh = hits[i]->hit();
27  theHits.push_back( trh->clone() );
28  }
29  init(proto, es);
30 }
31 
33  : theValid(true)
34 {
35  const TrackingRecHit* hit = nullptr;
36  for (unsigned int iHit = 0, nHits = proto.recHitsSize(); iHit < nHits; ++iHit) {
37  TrackingRecHitRef refHit = proto.recHit(iHit);
38  hit = &(*refHit);
39  theHits.push_back( hit->clone() );
40  }
41  init(proto,es);
42 }
43 
44 
46 {
48  es.get<TrackerDigiGeometryRecord>().get(tracker);
49 
50  edm::ESHandle<Propagator> propagatorHandle;
51  es.get<TrackingComponentsRecord>().get("PropagatorWithMaterial",propagatorHandle);
52  const Propagator* propagator = &(*propagatorHandle);
53 
55  es.get<IdealMagneticFieldRecord>().get(field);//fixme
56 
57  const reco::TrackBase::Point& vtx = proto.referencePoint();
58  const reco::TrackBase::Vector& mom = proto.momentum();
60  GlobalPoint(vtx.x(),vtx.y(),vtx.z()),
61  GlobalVector(mom.x(),mom.y(),mom.z()),
62  proto.charge(), &(*field) );
63 
65 
66  FreeTrajectoryState fts( gtp, err);
67 
68  const TrackingRecHit & lastHit = theHits.back();
69 
70  TrajectoryStateOnSurface outerState =
71  propagator->propagate(fts, tracker->idToDet(lastHit.geographicalId())->surface());
72 
73  if (!outerState.isValid()){
74  const Surface & surface = tracker->idToDet(lastHit.geographicalId())->surface();
75  edm::LogError("SeedFromProtoTrack")<<" was trying to create a seed from:\n"<<fts<<"\n propagating to: "<<lastHit.geographicalId()<<surface.position();
76  theValid = false;
77  return ;
78  }
79  theValid = true;
80 
82 
83 
84 }
85 
87 {
89 }
const Point & referencePoint() const
Reference point on the track.
Definition: TrackBase.h:681
reference back()
Definition: OwnVector.h:395
void init(const reco::Track &proto, const edm::EventSetup &es)
PTrajectoryStateOnDet thePTraj
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:119
PTrajectoryStateOnDet const & trajectoryState() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:675
SeedFromProtoTrack(const reco::Track &proto, const edm::EventSetup &)
TrajectorySeed trajectorySeed() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void push_back(D *&d)
Definition: OwnVector.h:290
RecHitContainer theHits
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:731
virtual TrackingRecHit * clone() const =0
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
const RecHitContainer & hits() const
const T & get() const
Definition: EventSetup.h:55
PropagationDirection direction() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
return(e1-e2)*(e1-e2)+dp *dp
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
Definition: Track.h:114
unsigned int size() const
Definition: SeedingHitSet.h:46
const TrackerGeomDet * idToDet(DetId) const override
int charge() const
track electric charge
Definition: TrackBase.h:567
DetId geographicalId() const
const PositionType & position() const
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:80
Global3DVector GlobalVector
Definition: GlobalVector.h:10