CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 = 0;
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);
56 
58  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 
81  TrajectoryStateTransform transformer;
82  thePTraj = boost::shared_ptr<PTrajectoryStateOnDet>(
83  transformer.persistentState(outerState, lastHit.geographicalId().rawId()) );
84 
85 
86 }
87 
89 {
91 }
int i
Definition: DBlmapReader.cc:9
reference back()
Definition: OwnVector.h:340
void init(const reco::Track &proto, const edm::EventSetup &es)
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:149
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Point & referencePoint() const
Reference point on the track.
Definition: TrackBase.h:152
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:175
SeedFromProtoTrack(const reco::Track &proto, const edm::EventSetup &)
return((rh^lh)&mask)
TrajectorySeed trajectorySeed() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void push_back(D *&d)
Definition: OwnVector.h:288
RecHitContainer theHits
PTrajectoryStateOnDet * persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid) const
math::XYZPoint Point
point in the space
Definition: TrackBase.h:75
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
virtual TrackingRecHit * clone() const =0
const RecHitContainer & hits() const
boost::shared_ptr< PTrajectoryStateOnDet > thePTraj
const T & get() const
Definition: EventSetup.h:55
PropagationDirection direction() const
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
Definition: Track.h:67
unsigned int size() const
Definition: SeedingHitSet.h:14
int charge() const
track electric charge
Definition: TrackBase.h:112
DetId geographicalId() const
PTrajectoryStateOnDet trajectoryState() const
const PositionType & position() const
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:73
Global3DVector GlobalVector
Definition: GlobalVector.h:10