CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SeedFromNuclearInteraction Class Reference

#include <SeedFromNuclearInteraction.h>

Public Member Functions

PropagationDirection direction () const
 
recHitContainer hits () const
 
const TSOSinitialTSOS () const
 
bool isValid () const
 
ConstRecHitPointer outerHit () const
 
DetId outerHitDetId () const
 
GlobalPoint outerHitPosition () const
 
AlgebraicMatrix33 rotationMatrix (const GlobalVector &perp) const
 
 SeedFromNuclearInteraction (const Propagator *prop, const TrackerGeometry *geom, double ptMin)
 
void setMeasurements (const TSOS &tsosAtInteractionPoint, ConstRecHitPointer ihit, ConstRecHitPointer ohit)
 Fill all data members from 2 TM's where the first one is supposed to be at the interaction point. More...
 
void setMeasurements (TangentHelix &primHelix, const TSOS &inner_TSOS, ConstRecHitPointer ihit, ConstRecHitPointer ohit)
 Fill all data members from 1 TSOS and 2 rec Hits and using the circle associated to the primary track as constraint. More...
 
FreeTrajectoryStatestateWithError () const
 
FreeTrajectoryStatestateWithError (TangentHelix &helix) const
 
PTrajectoryStateOnDet const & trajectoryState () const
 
TrajectorySeed TrajSeed () const
 
const TSOSupdatedTSOS () const
 
virtual ~SeedFromNuclearInteraction ()
 

Private Types

typedef std::vector
< ConstRecHitPointer
ConstRecHitContainer
 
typedef
TransientTrackingRecHit::ConstRecHitPointer 
ConstRecHitPointer
 
typedef edm::OwnVector
< TrackingRecHit
recHitContainer
 
typedef TrajectoryMeasurement TM
 
typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

bool construct ()
 

Private Attributes

std::shared_ptr
< FreeTrajectoryState
freeTS_
 
std::shared_ptr< TSOSinitialTSOS_
 
ConstRecHitPointer innerHit_
 
bool isValid_
 
ConstRecHitPointer outerHit_
 
double ptMin
 
PTrajectoryStateOnDet pTraj
 
ConstRecHitContainer theHits
 
const PropagatorthePropagator
 
const TrackerGeometrytheTrackerGeom
 
std::shared_ptr< TSOSupdatedTSOS_
 

Detailed Description

Definition at line 17 of file SeedFromNuclearInteraction.h.

Member Typedef Documentation

Definition at line 23 of file SeedFromNuclearInteraction.h.

Definition at line 22 of file SeedFromNuclearInteraction.h.

Definition at line 21 of file SeedFromNuclearInteraction.h.

Definition at line 19 of file SeedFromNuclearInteraction.h.

Definition at line 20 of file SeedFromNuclearInteraction.h.

Constructor & Destructor Documentation

SeedFromNuclearInteraction::SeedFromNuclearInteraction ( const Propagator prop,
const TrackerGeometry geom,
double  ptMin 
)

Definition at line 14 of file SeedFromNuclearInteraction.cc.

References freeTS_, initialTSOS_, isValid_, and updatedTSOS_.

17  : ptMin(iPtMin), thePropagator(prop), theTrackerGeom(geom) {
18  isValid_ = true;
19  initialTSOS_ = std::make_shared<TrajectoryStateOnSurface>();
20  updatedTSOS_ = std::make_shared<TrajectoryStateOnSurface>();
21  freeTS_ = std::make_shared<FreeTrajectoryState>();
22 }
const TrackerGeometry * theTrackerGeom
std::shared_ptr< TSOS > initialTSOS_
std::shared_ptr< TSOS > updatedTSOS_
std::shared_ptr< FreeTrajectoryState > freeTS_
virtual SeedFromNuclearInteraction::~SeedFromNuclearInteraction ( )
inlinevirtual

Definition at line 28 of file SeedFromNuclearInteraction.h.

28 {}

Member Function Documentation

bool SeedFromNuclearInteraction::construct ( )
private

Definition at line 133 of file SeedFromNuclearInteraction.cc.

References freeTS_, TrackingRecHit::geographicalId(), TrackerGeometry::idToDet(), TrajectoryStateOnSurface::isValid(), LogDebug, outerHitDetId(), trajectoryStateTransform::persistentState(), Propagator::propagate(), pTraj, theHits, thePropagator, theTrackerGeom, KFUpdator::update(), and updatedTSOS_.

Referenced by setMeasurements().

133  {
134  // loop on all hits in theHits
135  KFUpdator theUpdator;
136 
137  const TrackingRecHit* hit = nullptr;
138 
139  LogDebug("NuclearSeedGenerator") << "Seed ** initial state " << freeTS_->cartesianError().matrix();
140 
141  for (unsigned int iHit = 0; iHit < theHits.size(); iHit++) {
142  hit = theHits[iHit]->hit();
144  (iHit == 0)
147 
148  if (!state.isValid())
149  return false;
150 
152  updatedTSOS_.reset(new TrajectoryStateOnSurface(theUpdator.update(state, *tth)));
153  }
154 
155  LogDebug("NuclearSeedGenerator") << "Seed ** updated state " << updatedTSOS_->cartesianError().matrix();
156 
158  return true;
159 }
const TrackerGeometry * theTrackerGeom
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
const TrackerGeomDet * idToDet(DetId) const override
std::shared_ptr< TSOS > updatedTSOS_
std::shared_ptr< FreeTrajectoryState > freeTS_
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
DetId geographicalId() const
#define LogDebug(id)
PropagationDirection SeedFromNuclearInteraction::direction ( ) const
inline

Definition at line 45 of file SeedFromNuclearInteraction.h.

References alongMomentum.

Referenced by stateWithError(), and TrajSeed().

edm::OwnVector< TrackingRecHit > SeedFromNuclearInteraction::hits ( void  ) const

Definition at line 162 of file SeedFromNuclearInteraction.cc.

References edm::OwnVector< T, P >::push_back(), and theHits.

Referenced by TrajSeed().

162  {
163  recHitContainer _hits;
164  for (ConstRecHitContainer::const_iterator it = theHits.begin(); it != theHits.end(); it++) {
165  _hits.push_back(it->get()->hit()->clone());
166  }
167  return _hits;
168 }
void push_back(D *&d)
Definition: OwnVector.h:326
edm::OwnVector< TrackingRecHit > recHitContainer
const TSOS& SeedFromNuclearInteraction::initialTSOS ( ) const
inline

Definition at line 55 of file SeedFromNuclearInteraction.h.

References initialTSOS_.

55 { return *initialTSOS_; }
std::shared_ptr< TSOS > initialTSOS_
bool SeedFromNuclearInteraction::isValid ( void  ) const
inline
ConstRecHitPointer SeedFromNuclearInteraction::outerHit ( ) const
inline

Definition at line 63 of file SeedFromNuclearInteraction.h.

References outerHit_.

63 { return outerHit_; }
DetId SeedFromNuclearInteraction::outerHitDetId ( ) const
inline

Definition at line 61 of file SeedFromNuclearInteraction.h.

References outerHit_.

Referenced by construct(), and outerHitPosition().

61 { return outerHit_->geographicalId(); }
GlobalPoint SeedFromNuclearInteraction::outerHitPosition ( ) const
inline

Definition at line 57 of file SeedFromNuclearInteraction.h.

References TrackerGeometry::idToDet(), outerHit_, outerHitDetId(), GeomDet::surface(), theTrackerGeom, and Surface::toGlobal().

Referenced by stateWithError().

57  {
58  return theTrackerGeom->idToDet(outerHitDetId())->surface().toGlobal(outerHit_->localPosition());
59  }
const TrackerGeometry * theTrackerGeom
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const TrackerGeomDet * idToDet(DetId) const override
AlgebraicMatrix33 SeedFromNuclearInteraction::rotationMatrix ( const GlobalVector perp) const

Return the rotation matrix to be applied to get parameters in a framework where the z direction is along perp

Definition at line 170 of file SeedFromNuclearInteraction.cc.

References Vector3DBase< T, FrameTag >::cross(), mps_fire::result, Vector3DBase< T, FrameTag >::unit(), unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and MetAnalyzer::zAxis.

Referenced by stateWithError().

170  {
172 
173  // z axis coincides with perp
174  GlobalVector zAxis = perp.unit();
175 
176  // x axis has no global Z component
177  GlobalVector xAxis;
178  if (zAxis.x() != 0 || zAxis.y() != 0) {
179  // precision is not an issue here, just protect against divizion by zero
180  xAxis = GlobalVector(-zAxis.y(), zAxis.x(), 0).unit();
181  } else { // perp coincides with global Z
182  xAxis = GlobalVector(1, 0, 0);
183  }
184 
185  // y axis obtained by cross product
186  GlobalVector yAxis(zAxis.cross(xAxis));
187 
188  result(0, 0) = xAxis.x();
189  result(0, 1) = xAxis.y();
190  result(0, 2) = xAxis.z();
191  result(1, 0) = yAxis.x();
192  result(1, 1) = yAxis.y();
193  result(1, 2) = yAxis.z();
194  result(2, 0) = zAxis.x();
195  result(2, 1) = zAxis.y();
196  result(2, 2) = zAxis.z();
197  return result;
198 }
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
T y() const
Definition: PV3DBase.h:60
tuple result
Definition: mps_fire.py:311
T z() const
Definition: PV3DBase.h:61
Vector3DBase unit() const
Definition: Vector3DBase.h:54
tuple zAxis
Definition: MetAnalyzer.py:57
T x() const
Definition: PV3DBase.h:59
Global3DVector GlobalVector
Definition: GlobalVector.h:10
Basic3DVector unit() const
void SeedFromNuclearInteraction::setMeasurements ( const TSOS tsosAtInteractionPoint,
ConstRecHitPointer  ihit,
ConstRecHitPointer  ohit 
)

Fill all data members from 2 TM's where the first one is supposed to be at the interaction point.

Definition at line 25 of file SeedFromNuclearInteraction.cc.

References construct(), freeTS_, initialTSOS_, innerHit_, isValid_, outerHit_, ptMin, stateWithError(), and theHits.

27  {
28  // delete pointer to TrackingRecHits
29  theHits.clear();
30 
31  // get the inner and outer transient TrackingRecHits
32  innerHit_ = ihit;
33  outerHit_ = ohit;
34 
35  //theHits.push_back( inner_TM.recHit() ); // put temporarily - TODO: remove this line
36  theHits.push_back(outerHit_);
37 
38  initialTSOS_.reset(new TrajectoryStateOnSurface(inner_TSOS));
39 
40  // calculate the initial FreeTrajectoryState.
41  freeTS_.reset(stateWithError());
42 
43  // check transverse momentum
44  if (freeTS_->momentum().perp() < ptMin) {
45  isValid_ = false;
46  } else {
47  // convert freeTS_ into a persistent TSOS on the outer surface
48  isValid_ = construct();
49  }
50 }
std::shared_ptr< TSOS > initialTSOS_
std::shared_ptr< FreeTrajectoryState > freeTS_
FreeTrajectoryState * stateWithError() const
void SeedFromNuclearInteraction::setMeasurements ( TangentHelix primHelix,
const TSOS inner_TSOS,
ConstRecHitPointer  ihit,
ConstRecHitPointer  ohit 
)

Fill all data members from 1 TSOS and 2 rec Hits and using the circle associated to the primary track as constraint.

Definition at line 52 of file SeedFromNuclearInteraction.cc.

References construct(), freeTS_, TrackerGeometry::idToDet(), initialTSOS_, innerHit_, isValid_, outerHit_, ptMin, stateWithError(), theHits, theTrackerGeom, and GeomDet::toGlobal().

55  {
56  // delete pointer to TrackingRecHits
57  theHits.clear();
58 
59  // get the inner and outer transient TrackingRecHits
60  innerHit_ = ihit;
61  outerHit_ = ohit;
62 
63  GlobalPoint innerPos =
64  theTrackerGeom->idToDet(innerHit_->geographicalId())->surface().toGlobal(innerHit_->localPosition());
65  GlobalPoint outerPos =
66  theTrackerGeom->idToDet(outerHit_->geographicalId())->surface().toGlobal(outerHit_->localPosition());
67 
68  TangentHelix helix(thePrimaryHelix, outerPos, innerPos);
69 
70  theHits.push_back(innerHit_);
71  theHits.push_back(outerHit_);
72 
73  initialTSOS_.reset(new TrajectoryStateOnSurface(inner_TSOS));
74 
75  // calculate the initial FreeTrajectoryState from the inner and outer TM assuming that the helix equation is already known.
76  freeTS_.reset(stateWithError(helix));
77 
78  if (freeTS_->momentum().perp() < ptMin) {
79  isValid_ = false;
80  } else {
81  // convert freeTS_ into a persistent TSOS on the outer surface
82  isValid_ = construct();
83  }
84 }
const TrackerGeometry * theTrackerGeom
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
std::shared_ptr< TSOS > initialTSOS_
const TrackerGeomDet * idToDet(DetId) const override
std::shared_ptr< FreeTrajectoryState > freeTS_
FreeTrajectoryState * stateWithError() const
FreeTrajectoryState * SeedFromNuclearInteraction::stateWithError ( ) const

Definition at line 86 of file SeedFromNuclearInteraction.cc.

References direction(), initialTSOS_, SurfaceOrientation::inner, and outerHitPosition().

Referenced by setMeasurements().

86  {
87  // Calculation of the helix assuming that the secondary track has the same direction
88  // than the primary track and pass through the inner and outer hits.
89  GlobalVector direction = initialTSOS_->globalDirection();
90  GlobalPoint inner = initialTSOS_->globalPosition();
91  TangentHelix helix(direction, inner, outerHitPosition());
92 
93  return stateWithError(helix);
94 }
PropagationDirection direction() const
std::shared_ptr< TSOS > initialTSOS_
FreeTrajectoryState * stateWithError() const
FreeTrajectoryState * SeedFromNuclearInteraction::stateWithError ( TangentHelix helix) const

Definition at line 96 of file SeedFromNuclearInteraction.cc.

References TangentHelix::charge(), TangentHelix::directionAtVertex(), initialTSOS_, MagneticField::inTesla(), mag(), TangentHelix::rho(), makeMuonMisalignmentScenario::rot, rotationMatrix(), TangentHelix::vertexError(), TangentHelix::vertexPoint(), and z.

96  {
97  // typedef TkRotation<float> Rotation;
98 
99  GlobalVector dirAtVtx = helix.directionAtVertex();
100  const MagneticField& mag = initialTSOS_->globalParameters().magneticField();
101 
102  // Get the global parameters of the trajectory
103  // we assume that the magnetic field at the vertex is equal to the magnetic field at the inner TM.
105  helix.vertexPoint(), dirAtVtx, helix.charge(mag.inTesla(helix.vertexPoint()).z()) / helix.rho(), 0, &mag);
106 
107  // Error matrix in a frame where z is in the direction of the track at the vertex
108  AlgebraicSymMatrix66 primaryError(initialTSOS_->cartesianError().matrix());
109  double p_max = initialTSOS_->globalParameters().momentum().mag();
110  AlgebraicMatrix33 rot = this->rotationMatrix(dirAtVtx);
111 
112  AlgebraicMatrix66 globalRotation;
113  globalRotation.Place_at(rot, 0, 0);
114  globalRotation.Place_at(rot, 3, 3);
115  AlgebraicSymMatrix66 primaryErrorInNewFrame = ROOT::Math::Similarity(globalRotation, primaryError);
116 
117  AlgebraicSymMatrix66 secondaryErrorInNewFrame = AlgebraicMatrixID();
118  double p_perp_max = 2; // energy max of a secondary track emited perpendicularly to the
119  // primary track is +/- 2 GeV
120  secondaryErrorInNewFrame(0, 0) = primaryErrorInNewFrame(0, 0) + helix.vertexError() * p_perp_max / p_max;
121  secondaryErrorInNewFrame(1, 1) = primaryErrorInNewFrame(1, 1) + helix.vertexError() * p_perp_max / p_max;
122  secondaryErrorInNewFrame(2, 2) = helix.vertexError() * helix.vertexError();
123  secondaryErrorInNewFrame(3, 3) = p_perp_max * p_perp_max;
124  secondaryErrorInNewFrame(4, 4) = p_perp_max * p_perp_max;
125  secondaryErrorInNewFrame(5, 5) = p_max * p_max;
126 
127  AlgebraicSymMatrix66 secondaryError = ROOT::Math::SimilarityT(globalRotation, secondaryErrorInNewFrame);
128 
129  return new FreeTrajectoryState(gtp, CartesianTrajectoryError(secondaryError));
130 }
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
GlobalVector directionAtVertex()
Definition: TangentHelix.cc:17
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
std::shared_ptr< TSOS > initialTSOS_
double vertexError()
Definition: TangentHelix.h:47
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
AlgebraicMatrix33 rotationMatrix(const GlobalVector &perp) const
int charge(float magz)
Definition: TangentHelix.h:41
GlobalPoint vertexPoint() const
Definition: TangentHelix.h:35
double rho() const
Definition: TangentHelix.h:43
PTrajectoryStateOnDet const& SeedFromNuclearInteraction::trajectoryState ( ) const
inline

Definition at line 39 of file SeedFromNuclearInteraction.h.

References pTraj.

Referenced by TrajSeed().

39 { return pTraj; }
TrajectorySeed SeedFromNuclearInteraction::TrajSeed ( ) const
inline

Definition at line 49 of file SeedFromNuclearInteraction.h.

References direction(), hits(), and trajectoryState().

49 { return TrajectorySeed(trajectoryState(), hits(), direction()); }
PropagationDirection direction() const
PTrajectoryStateOnDet const & trajectoryState() const
const TSOS& SeedFromNuclearInteraction::updatedTSOS ( ) const
inline

Definition at line 53 of file SeedFromNuclearInteraction.h.

References updatedTSOS_.

53 { return *updatedTSOS_; }
std::shared_ptr< TSOS > updatedTSOS_

Member Data Documentation

std::shared_ptr<FreeTrajectoryState> SeedFromNuclearInteraction::freeTS_
private
std::shared_ptr<TSOS> SeedFromNuclearInteraction::initialTSOS_
private

Initial TSOS used as input

Definition at line 80 of file SeedFromNuclearInteraction.h.

Referenced by initialTSOS(), SeedFromNuclearInteraction(), setMeasurements(), and stateWithError().

ConstRecHitPointer SeedFromNuclearInteraction::innerHit_
private

Pointer to the hit of the inner TM

Definition at line 75 of file SeedFromNuclearInteraction.h.

Referenced by setMeasurements().

bool SeedFromNuclearInteraction::isValid_
private

check if the seed is valid

Definition at line 70 of file SeedFromNuclearInteraction.h.

Referenced by isValid(), SeedFromNuclearInteraction(), and setMeasurements().

ConstRecHitPointer SeedFromNuclearInteraction::outerHit_
private

Pointer to the outer hit

Definition at line 76 of file SeedFromNuclearInteraction.h.

Referenced by outerHit(), outerHitDetId(), outerHitPosition(), and setMeasurements().

double SeedFromNuclearInteraction::ptMin
private

Minimum transverse momentum of the seed

Definition at line 88 of file SeedFromNuclearInteraction.h.

Referenced by setMeasurements().

PTrajectoryStateOnDet SeedFromNuclearInteraction::pTraj
private

the final persistent TSOS

Definition at line 84 of file SeedFromNuclearInteraction.h.

Referenced by construct(), and trajectoryState().

ConstRecHitContainer SeedFromNuclearInteraction::theHits
private

all the hits to be used to update the

Definition at line 72 of file SeedFromNuclearInteraction.h.

Referenced by construct(), hits(), and setMeasurements().

const Propagator* SeedFromNuclearInteraction::thePropagator
private

Definition at line 90 of file SeedFromNuclearInteraction.h.

Referenced by construct().

const TrackerGeometry* SeedFromNuclearInteraction::theTrackerGeom
private

Definition at line 91 of file SeedFromNuclearInteraction.h.

Referenced by construct(), outerHitPosition(), and setMeasurements().

std::shared_ptr<TSOS> SeedFromNuclearInteraction::updatedTSOS_
private

Final TSOS

Definition at line 78 of file SeedFromNuclearInteraction.h.

Referenced by construct(), SeedFromNuclearInteraction(), and updatedTSOS().