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 
15 
16 namespace {
17 
18  template <class T>
19  inline
20  T sqr( T t) {return t*t;}
21 
22 }
23 
25 
27  const edm::EventSetup& es,
28  const SeedComparitor *ifilter) {
29  region = &iregion;
30  filter = ifilter;
31  // get tracker
33  // get propagator
35  // mag field
37  // edm::ESInputTag mfESInputTag(mfName_);
38  // es.get<IdealMagneticFieldRecord>().get(mfESInputTag, bfield);
39  nomField = bfield->nominalValue();
40  isBOFF = (0==nomField);
41 }
42 
44  const SeedingHitSet & hits) {
45  if ( hits.size() < 2) return;
46 
48  if (!initialKinematic(kine, hits)) return;
49 
50  float sin2Theta = kine.momentum().perp2()/kine.momentum().mag2();
51 
53  FreeTrajectoryState fts(kine, error);
54 
55  buildSeed(seedCollection,hits,fts);
56 }
57 
58 
59 
61  const SeedingHitSet & hits) const{
62 
65 
66  const GlobalPoint& vertexPos = region->origin();
67 
68  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield);
69  if (helix.isValid()) {
70  kine = helix.stateAtVertex();
71  } else {
72  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
73  initMomentum *= (100./initMomentum.perp());
74  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
75  }
76 
77  if unlikely(isBOFF && (theBOFFMomentum > 0)) {
79  kine.momentum().unit() * theBOFFMomentum,
80  kine.charge(),
81  &*bfield);
82  }
83  return (filter ? filter->compatible(hits, kine, helix, *region) : true);
84 }
85 
86 
87 
90 {
91  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
92  // information.
93  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
94 
95 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
96 // to avoid instabilities.
97 // N.B. This parameter needs optimising ...
98  // Probably OK based on quick study: KS 22/11/12.
99  float sin2th = sin2Theta;
100  float minC00 = sqr(theMinOneOverPtError);
101  C[0][0] = std::max(sin2th/sqr(region->ptMin()), minC00);
102  float zErr = sqr(region->originZBound());
103  float transverseErr = sqr(theOriginTransverseErrorMultiplier*region->originRBound());
104  C[3][3] = transverseErr;
105  C[4][4] = zErr*sin2th + transverseErr*(1.f-sin2th);
106 
107  return CurvilinearTrajectoryError(C);
108 }
109 
111  TrajectorySeedCollection & seedCollection,
112  const SeedingHitSet & hits,
113  const FreeTrajectoryState & fts) const
114 {
115  const Propagator* propagator = &(*propagatorHandle);
116 
117  // get updator
118  KFUpdator updator;
119 
120  // Now update initial state track using information from seed hits.
121 
122  TrajectoryStateOnSurface updatedState;
124 
125  const TrackingRecHit* hit = 0;
126  for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) {
127  hit = hits[iHit]->hit();
128  TrajectoryStateOnSurface state = (iHit==0) ?
129  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
130  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
131  if (!state.isValid()) return;
132 
133  TransientTrackingRecHit::ConstRecHitPointer const & tth = hits[iHit];
134 
135  TransientTrackingRecHit::RecHitPointer const & newtth = refitHit( tth, state);
136 
137  if (!checkHit(state,newtth)) return;
138 
139  updatedState = updator.update(state, *newtth);
140  if (!updatedState.isValid()) return;
141 
142  seedHits.push_back(newtth->hit()->clone());
143 
144  }
145 
146 
147  PTrajectoryStateOnDet const & PTraj =
149  TrajectorySeed seed(PTraj,std::move(seedHits),alongMomentum);
150  if ( !filter || filter->compatible(seed)) seedCollection.push_back(seed);
151 
152 }
153 
156  const TrajectoryStateOnSurface &state) const
157 {
158  return hit->clone(state);
159 }
160 
161 bool
163  const TrajectoryStateOnSurface &tsos,
165 {
166  return (filter ? filter->compatible(tsos,hit) : true);
167 }
168 
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