CMS 3D CMS Logo

SeedFromNuclearInteraction.cc
Go to the documentation of this file.
2 
5 
9 
11 
12 
14  ptMin(iConfig.getParameter<double>("ptMin")),
15  thePropagator(prop), theTrackerGeom(geom)
16  {
17  isValid_=true;
18  initialTSOS_ = boost::shared_ptr<TrajectoryStateOnSurface>(new TrajectoryStateOnSurface());
19  updatedTSOS_ = boost::shared_ptr<TrajectoryStateOnSurface>(new TrajectoryStateOnSurface());
20  freeTS_ = boost::shared_ptr<FreeTrajectoryState>(new FreeTrajectoryState());
21  }
22 
23 //----------------------------------------------------------------------
25 
26  // delete pointer to TrackingRecHits
27  theHits.clear();
28 
29  // get the inner and outer transient TrackingRecHits
30  innerHit_ = ihit;
31  outerHit_ = ohit;
32 
33  //theHits.push_back( inner_TM.recHit() ); // put temporarily - TODO: remove this line
34  theHits.push_back( outerHit_ );
35 
36  initialTSOS_.reset( new TrajectoryStateOnSurface(inner_TSOS) );
37 
38  // calculate the initial FreeTrajectoryState.
39  freeTS_.reset(stateWithError());
40 
41  // check transverse momentum
42  if(freeTS_->momentum().perp() < ptMin) { isValid_ = false; }
43  else {
44  // convert freeTS_ into a persistent TSOS on the outer surface
45  isValid_ = construct(); }
46 }
47 //----------------------------------------------------------------------
49 
50  // delete pointer to TrackingRecHits
51  theHits.clear();
52 
53  // get the inner and outer transient TrackingRecHits
54  innerHit_ = ihit;
55  outerHit_ = ohit;
56 
57  GlobalPoint innerPos = theTrackerGeom->idToDet(innerHit_->geographicalId())->surface().toGlobal(innerHit_->localPosition());
58  GlobalPoint outerPos = theTrackerGeom->idToDet(outerHit_->geographicalId())->surface().toGlobal(outerHit_->localPosition());
59 
60  TangentHelix helix(thePrimaryHelix, outerPos, innerPos);
61 
62  theHits.push_back( innerHit_ );
63  theHits.push_back( outerHit_ );
64 
65  initialTSOS_.reset( new TrajectoryStateOnSurface(inner_TSOS) );
66 
67  // calculate the initial FreeTrajectoryState from the inner and outer TM assuming that the helix equation is already known.
68  freeTS_.reset(stateWithError(helix));
69 
70  if(freeTS_->momentum().perp() < ptMin) { isValid_ = false; }
71  else {
72  // convert freeTS_ into a persistent TSOS on the outer surface
73  isValid_ = construct(); }
74 }
75 //----------------------------------------------------------------------
77 
78  // Calculation of the helix assuming that the secondary track has the same direction
79  // than the primary track and pass through the inner and outer hits.
80  GlobalVector direction = initialTSOS_->globalDirection();
81  GlobalPoint inner = initialTSOS_->globalPosition();
82  TangentHelix helix(direction, inner, outerHitPosition());
83 
84  return stateWithError(helix);
85 }
86 //----------------------------------------------------------------------
88 
89 // typedef TkRotation<float> Rotation;
90 
91  GlobalVector dirAtVtx = helix.directionAtVertex();
92  const MagneticField& mag = initialTSOS_->globalParameters().magneticField();
93 
94  // Get the global parameters of the trajectory
95  // we assume that the magnetic field at the vertex is equal to the magnetic field at the inner TM.
96  GlobalTrajectoryParameters gtp(helix.vertexPoint(), dirAtVtx , helix.charge(mag.inTesla(helix.vertexPoint()).z())/helix.rho(), 0, &mag);
97 
98  // Error matrix in a frame where z is in the direction of the track at the vertex
99  AlgebraicSymMatrix66 primaryError( initialTSOS_->cartesianError().matrix() );
100  double p_max = initialTSOS_->globalParameters().momentum().mag();
101  AlgebraicMatrix33 rot = this->rotationMatrix( dirAtVtx );
102 
103  AlgebraicMatrix66 globalRotation;
104  globalRotation.Place_at(rot,0,0);
105  globalRotation.Place_at(rot,3,3);
106  AlgebraicSymMatrix66 primaryErrorInNewFrame = ROOT::Math::Similarity(globalRotation, primaryError);
107 
108  AlgebraicSymMatrix66 secondaryErrorInNewFrame = AlgebraicMatrixID();
109  double p_perp_max = 2; // energy max of a secondary track emited perpendicularly to the
110  // primary track is +/- 2 GeV
111  secondaryErrorInNewFrame(0,0) = primaryErrorInNewFrame(0,0)+helix.vertexError()*p_perp_max/p_max;
112  secondaryErrorInNewFrame(1,1) = primaryErrorInNewFrame(1,1)+helix.vertexError()*p_perp_max/p_max;
113  secondaryErrorInNewFrame(2,2) = helix.vertexError() * helix.vertexError();
114  secondaryErrorInNewFrame(3,3) = p_perp_max*p_perp_max;
115  secondaryErrorInNewFrame(4,4) = p_perp_max*p_perp_max;
116  secondaryErrorInNewFrame(5,5) = p_max*p_max;
117 
118  AlgebraicSymMatrix66 secondaryError = ROOT::Math::SimilarityT(globalRotation, secondaryErrorInNewFrame);
119 
120  return new FreeTrajectoryState( gtp, CartesianTrajectoryError(secondaryError) );
121 }
122 
123 //----------------------------------------------------------------------
125 
126  // loop on all hits in theHits
127  KFUpdator theUpdator;
128 
129  const TrackingRecHit* hit = 0;
130 
131  LogDebug("NuclearSeedGenerator") << "Seed ** initial state " << freeTS_->cartesianError().matrix();
132 
133  for ( unsigned int iHit = 0; iHit < theHits.size(); iHit++) {
134  hit = theHits[iHit]->hit();
135  TrajectoryStateOnSurface state = (iHit==0) ?
138 
139  if (!state.isValid()) return false;
140 
142  updatedTSOS_.reset( new TrajectoryStateOnSurface(theUpdator.update(state, *tth)) );
143 
144  }
145 
146 
147 
148  LogDebug("NuclearSeedGenerator") << "Seed ** updated state " << updatedTSOS_->cartesianError().matrix();
149 
151  return true;
152 }
153 
154 //----------------------------------------------------------------------
156  recHitContainer _hits;
157  for( ConstRecHitContainer::const_iterator it = theHits.begin(); it!=theHits.end(); it++ ){
158  _hits.push_back( it->get()->hit()->clone() );
159  }
160  return _hits;
161 }
162 //----------------------------------------------------------------------
164 
166 
167  // z axis coincides with perp
168  GlobalVector zAxis = perp.unit();
169 
170  // x axis has no global Z component
172  if ( zAxis.x() != 0 || zAxis.y() != 0) {
173  // precision is not an issue here, just protect against divizion by zero
174  xAxis = GlobalVector( -zAxis.y(), zAxis.x(), 0).unit();
175  }
176  else { // perp coincides with global Z
177  xAxis = GlobalVector( 1, 0, 0);
178  }
179 
180  // y axis obtained by cross product
181  GlobalVector yAxis( zAxis.cross( xAxis));
182 
183  result(0,0) = xAxis.x();
184  result(0,1) = xAxis.y();
185  result(0,2) = xAxis.z();
186  result(1,0) = yAxis.x();
187  result(1,1) = yAxis.y();
188  result(1,2) = yAxis.z();
189  result(2,0) = zAxis.x();
190  result(2,1) = zAxis.y();
191  result(2,2) = zAxis.z();
192  return result;
193 }
194 
#define LogDebug(id)
const TrackerGeometry * theTrackerGeom
PropagationDirection direction() const
boost::shared_ptr< TSOS > updatedTSOS_
GlobalVector directionAtVertex()
Definition: TangentHelix.cc:18
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
boost::shared_ptr< FreeTrajectoryState > freeTS_
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
T y() const
Definition: PV3DBase.h:63
void setMeasurements(const TSOS &tsosAtInteractionPoint, ConstRecHitPointer ihit, ConstRecHitPointer ohit)
Fill all data members from 2 TM&#39;s where the first one is supposed to be at the interaction point...
void push_back(D *&d)
Definition: OwnVector.h:290
SeedFromNuclearInteraction(const Propagator *prop, const TrackerGeometry *geom, const edm::ParameterSet &iConfig)
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
Definition: KFUpdator.cc:75
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
T z() const
Definition: PV3DBase.h:64
double vertexError()
Definition: TangentHelix.h:42
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
AlgebraicMatrix33 rotationMatrix(const GlobalVector &perp) const
Vector3DBase unit() const
Definition: Vector3DBase.h:57
int charge(float magz)
Definition: TangentHelix.h:36
boost::shared_ptr< TSOS > initialTSOS_
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
T perp() const
Magnitude of transverse component.
GlobalPoint vertexPoint() const
Definition: TangentHelix.h:30
DetId geographicalId() const
double rho() const
Definition: TangentHelix.h:38
T x() const
Definition: PV3DBase.h:62
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
Global3DVector GlobalVector
Definition: GlobalVector.h:10
const TrackerGeomDet * idToDet(DetId) const
FreeTrajectoryState * stateWithError() const