CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SeedFromConsecutiveHitsCreator.cc
Go to the documentation of this file.
3 
14 
15 namespace {
16 
17  template <class T>
18  inline
19  T sqr( T t) {return t*t;}
20 
21 }
22 
24 
26  const edm::EventSetup& es,
27  const SeedComparitor *ifilter) {
28  region = &iregion;
29  filter = ifilter;
30  // get tracker
32  // get propagator
34  // mag field
36  nomField = bfield->nominalValue();
37  isBOFF = (0==nomField);
38 }
39 
41  const SeedingHitSet & hits) {
42  if ( hits.size() < 2) return;
43 
45  if (!initialKinematic(kine, hits)) return;
46 
47  float sin2Theta = kine.momentum().perp2()/kine.momentum().mag2();
48 
50  FreeTrajectoryState fts(kine, error);
51 
52  buildSeed(seedCollection,hits,fts);
53 }
54 
55 
56 
58  const SeedingHitSet & hits) const{
59 
62 
63  const GlobalPoint& vertexPos = region->origin();
64 
65  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield);
66  if (helix.isValid()) {
67  kine = helix.stateAtVertex();
68  } else {
69  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
70  initMomentum *= (100./initMomentum.perp());
71  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
72  }
73 
74  if unlikely(isBOFF && (theBOFFMomentum > 0)) {
76  kine.momentum().unit() * theBOFFMomentum,
77  kine.charge(),
78  &*bfield);
79  }
80  return (filter ? filter->compatible(hits, kine, helix, *region) : true);
81 }
82 
83 
84 
87 {
88  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
89  // information.
90  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
91 
92 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
93 // to avoid instabilities.
94 // N.B. This parameter needs optimising ...
95  // Probably OK based on quick study: KS 22/11/12.
96  float sin2th = sin2Theta;
97  float minC00 = sqr(theMinOneOverPtError);
98  C[0][0] = std::max(sin2th/sqr(region->ptMin()), minC00);
99  float zErr = sqr(region->originZBound());
100  float transverseErr = sqr(theOriginTransverseErrorMultiplier*region->originRBound());
101  C[3][3] = transverseErr;
102  C[4][4] = zErr*sin2th + transverseErr*(1.f-sin2th);
103 
104  return CurvilinearTrajectoryError(C);
105 }
106 
108  TrajectorySeedCollection & seedCollection,
109  const SeedingHitSet & hits,
110  const FreeTrajectoryState & fts) const
111 {
112  const Propagator* propagator = &(*propagatorHandle);
113 
114  // get updator
115  KFUpdator updator;
116 
117  // Now update initial state track using information from seed hits.
118 
119  TrajectoryStateOnSurface updatedState;
121 
122  const TrackingRecHit* hit = 0;
123  for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) {
124  hit = hits[iHit]->hit();
125  TrajectoryStateOnSurface state = (iHit==0) ?
126  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
127  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
128  if (!state.isValid()) return;
129 
130  TransientTrackingRecHit::ConstRecHitPointer const & tth = hits[iHit];
131 
132  TransientTrackingRecHit::RecHitPointer const & newtth = refitHit( tth, state);
133 
134  if (!checkHit(state,newtth)) return;
135 
136  updatedState = updator.update(state, *newtth);
137  if (!updatedState.isValid()) return;
138 
139  seedHits.push_back(newtth->hit()->clone());
140 
141  }
142 
143 
144  PTrajectoryStateOnDet const & PTraj =
146  TrajectorySeed seed(PTraj,std::move(seedHits),alongMomentum);
147  if ( !filter || filter->compatible(seed)) seedCollection.push_back(seed);
148 
149 }
150 
153  const TrajectoryStateOnSurface &state) const
154 {
155  return hit->clone(state);
156 }
157 
158 bool
160  const TrajectoryStateOnSurface &tsos,
162 {
163  return (filter ? filter->compatible(tsos,hit) : true);
164 }
165 
float originRBound() const
bounds the particle vertex in the transverse plane
T mag2() const
Definition: PV3DBase.h:66
GlobalPoint const & origin() const
edm::ESHandle< Propagator > propagatorHandle
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
bool checkHit(const TrajectoryStateOnSurface &tsos, const TransientTrackingRecHit::ConstRecHitPointer &hit) const dso_hidden
virtual bool initialKinematic(GlobalTrajectoryParameters &kine, const SeedingHitSet &hits) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
T perp2() const
Definition: PV3DBase.h:71
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const =0
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts) const dso_hidden
#define unlikely(x)
Definition: Likely.h:21
void push_back(D *&d)
Definition: OwnVector.h:273
std::vector< TrajectorySeed > TrajectorySeedCollection
const T & max(const T &a, const T &b)
virtual void init(const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter) GCC11_FINAL
float originZBound() const
bounds the particle vertex in the longitudinal plane
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
Vector3DBase unit() const
Definition: Vector3DBase.h:57
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< TrackerGeometry > tracker
float ptMin() const
minimal pt of interest
Square< F >::type sqr(const F &f)
Definition: Square.h:13
virtual void makeSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) GCC11_FINAL
CurvilinearTrajectoryError initialError(float sin2Theta) const dso_hidden
unsigned int size() const
Definition: SeedingHitSet.h:41
DetId geographicalId() const
TransientTrackingRecHit::RecHitPointer refitHit(const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrajectoryStateOnSurface &state) const dso_hidden
long double T
edm::ESHandle< MagneticField > bfield