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  const GlobalPoint& vertexPos = region->origin();
63 
64  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield);
65  if (helix.isValid()) {
66  kine = helix.stateAtVertex();
67  } else {
68  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
69  initMomentum *= (100./initMomentum.perp());
70  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
71  }
72 
73  if unlikely(isBOFF && (theBOFFMomentum > 0)) {
75  kine.momentum().unit() * theBOFFMomentum,
76  kine.charge(),
77  &*bfield);
78  }
79  return (filter ? filter->compatible(hits, kine, helix, *region) : true);
80 }
81 
82 
83 
86 {
87  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
88  // information.
89  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
90 
91 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
92 // to avoid instabilities.
93 // N.B. This parameter needs optimising ...
94  // Probably OK based on quick study: KS 22/11/12.
95  float sin2th = sin2Theta;
96  float minC00 = sqr(theMinOneOverPtError);
97  C[0][0] = std::max(sin2th/sqr(region->ptMin()), minC00);
98  float zErr = sqr(region->originZBound());
100  C[3][3] = transverseErr;
101  C[4][4] = zErr*sin2th + transverseErr*(1.f-sin2th);
102 
103  return CurvilinearTrajectoryError(C);
104 }
105 
107  TrajectorySeedCollection & seedCollection,
108  const SeedingHitSet & hits,
109  const FreeTrajectoryState & fts) const
110 {
111  const Propagator* propagator = &(*propagatorHandle);
112 
113  // get updator
114  KFUpdator updator;
115 
116  // Now update initial state track using information from seed hits.
117 
118  TrajectoryStateOnSurface updatedState;
120 
121  const TrackingRecHit* hit = 0;
122  for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) {
123  hit = hits[iHit]->hit();
124  TrajectoryStateOnSurface state = (iHit==0) ?
125  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
126  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
127  if (!state.isValid()) return;
128 
129  TransientTrackingRecHit::ConstRecHitPointer const & tth = hits[iHit];
130 
131  TransientTrackingRecHit::RecHitPointer const & newtth = refitHit( tth, state);
132 
133  if (!checkHit(state,newtth)) return;
134 
135  updatedState = updator.update(state, *newtth);
136  if (!updatedState.isValid()) return;
137 
138  seedHits.push_back(newtth->hit()->clone());
139 
140  }
141 
142 
143  PTrajectoryStateOnDet const & PTraj =
145  TrajectorySeed seed(PTraj,std::move(seedHits),alongMomentum);
146  if ( !filter || filter->compatible(seed)) seedCollection.push_back(seed);
147 
148 }
149 
152  const TrajectoryStateOnSurface &state) const
153 {
154  return hit->clone(state);
155 }
156 
157 bool
159  const TrajectoryStateOnSurface &tsos,
161 {
162  return (filter ? filter->compatible(tsos,hit) : true);
163 }
164 
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:45
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
char state
Definition: procUtils.cc:75
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:40
DetId geographicalId() const
TransientTrackingRecHit::RecHitPointer refitHit(const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrajectoryStateOnSurface &state) const dso_hidden
long double T
edm::ESHandle< MagneticField > bfield