CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MultiRefittedTS Class Reference

#include <MultiRefittedTS.h>

Inheritance diagram for MultiRefittedTS:
RefittedTrackState< 5 > ReferenceCounted

Public Types

typedef ReferenceCountingPointer< LinearizedTrackState< 5 > > RefCountedLinearizedTrackState
 
typedef ReferenceCountingPointer< RefittedTrackState< 5 > > RefCountedRefittedTrackState
 
- Public Types inherited from RefittedTrackState< 5 >
typedef ROOT::Math::SMatrix< double, N, N, ROOT::Math::MatRepSym< double, N > > AlgebraicSymMatrixNN
 
typedef ROOT::Math::SVector< double, N - 2 > AlgebraicVectorM
 
typedef ROOT::Math::SVector< double, NAlgebraicVectorN
 

Public Member Functions

std::vector< ReferenceCountingPointer< RefittedTrackState< 5 > > > components () const override
 
AlgebraicSymMatrixNN covariance () const override
 
FreeTrajectoryState freeTrajectoryState () const override
 
AlgebraicVectorM momentumVector () const override
 
 MultiRefittedTS (const std::vector< RefCountedRefittedTrackState > &prtsComp, const Surface &referenceSurface)
 
 MultiRefittedTS (const std::vector< RefCountedRefittedTrackState > &prtsComp, const GlobalPoint &referencePosition)
 
AlgebraicVectorN parameters () const override
 
GlobalPoint position () const override
 
ReferenceCountingPointer< RefittedTrackState< 5 > > stateWithNewWeight (const double newWeight) const override
 
TrajectoryStateOnSurface trajectoryStateOnSurface (const Surface &surface) const override
 
TrajectoryStateOnSurface trajectoryStateOnSurface (const Surface &surface, const Propagator &propagator) const override
 
reco::TransientTrack transientTrack () const override
 
double weight () const override
 
 ~MultiRefittedTS () override
 
- Public Member Functions inherited from RefittedTrackState< 5 >
 ~RefittedTrackState () override
 

Private Types

typedef std::vector< RefCountedRefittedTrackStateRTSvector
 

Private Member Functions

void computeFreeTrajectoryState () const
 

Private Attributes

FreeTrajectoryState fts
 
bool ftsAvailable
 
const GlobalPoint refPosition
 
ConstReferenceCountingPointer< SurfacerefSurface
 
const bool surf
 
RTSvector theComponents
 
double totalWeight
 
bool totalWeightAvailable
 

Detailed Description

Definition at line 17 of file MultiRefittedTS.h.

Member Typedef Documentation

◆ RefCountedLinearizedTrackState

Definition at line 20 of file MultiRefittedTS.h.

◆ RefCountedRefittedTrackState

Definition at line 19 of file MultiRefittedTS.h.

◆ RTSvector

Definition at line 109 of file MultiRefittedTS.h.

Constructor & Destructor Documentation

◆ MultiRefittedTS() [1/2]

MultiRefittedTS::MultiRefittedTS ( const std::vector< RefCountedRefittedTrackState > &  prtsComp,
const Surface referenceSurface 
)

Constructor with a reference surface, to be used to assemble the TSOS components on one identical surface.

Definition at line 11 of file MultiRefittedTS.cc.

Referenced by stateWithNewWeight().

13  : theComponents(prtsComp), ftsAvailable(false), refSurface(&referenceSurface), surf(true) {}
RTSvector theComponents
ConstReferenceCountingPointer< Surface > refSurface

◆ MultiRefittedTS() [2/2]

MultiRefittedTS::MultiRefittedTS ( const std::vector< RefCountedRefittedTrackState > &  prtsComp,
const GlobalPoint referencePosition 
)

Constructor with a reference position. The surface which is going to be usedto assemble the TSOS components will be the surface perpendicular to the PCA of the state with the highest weight to the reference point.

Definition at line 15 of file MultiRefittedTS.cc.

17  : theComponents(prtsComp), ftsAvailable(false), refPosition(referencePosition), surf(false) {}
const GlobalPoint refPosition
RTSvector theComponents

◆ ~MultiRefittedTS()

MultiRefittedTS::~MultiRefittedTS ( )
inlineoverride

Definition at line 35 of file MultiRefittedTS.h.

35 {}

Member Function Documentation

◆ components()

std::vector<ReferenceCountingPointer<RefittedTrackState<5> > > MultiRefittedTS::components ( ) const
inlineoverridevirtual

Implements RefittedTrackState< 5 >.

Definition at line 94 of file MultiRefittedTS.h.

References theComponents.

94 { return theComponents; }
RTSvector theComponents

◆ computeFreeTrajectoryState()

void MultiRefittedTS::computeFreeTrajectoryState ( ) const
private

Definition at line 29 of file MultiRefittedTS.cc.

References TransverseImpactPointExtrapolator::extrapolate(), freeTrajectoryState(), TrajectoryStateOnSurface::freeTrajectoryState(), fts, ftsAvailable, refPosition, surf, TrajectoryStateOnSurface::surface(), theComponents, and trajectoryStateOnSurface().

Referenced by freeTrajectoryState().

29  {
30  if (surf) {
32  } else {
33  double maxWeight = -1.;
34  RTSvector::const_iterator maxIt;
35  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
36  if ((**it).weight() > maxWeight) {
37  maxWeight = (**it).weight();
38  maxIt = it;
39  }
40  }
41 
42  TransverseImpactPointExtrapolator tipe(&((**maxIt).freeTrajectoryState().parameters().magneticField()));
43  TrajectoryStateOnSurface initialTSOS = tipe.extrapolate((**maxIt).freeTrajectoryState(), refPosition);
44 
46  }
47  ftsAvailable = true;
48 }
const SurfaceType & surface() const
FreeTrajectoryState fts
const GlobalPoint refPosition
TrajectoryStateOnSurface trajectoryStateOnSurface(const Surface &surface) const override
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
FreeTrajectoryState freeTrajectoryState() const override
RTSvector theComponents

◆ covariance()

MultiRefittedTS::AlgebraicSymMatrixNN MultiRefittedTS::covariance ( void  ) const
overridevirtual

The covariance matrix. Not possible yet for a multi-state, throws an exception.

The covariance matrix

Implements RefittedTrackState< 5 >.

Definition at line 64 of file MultiRefittedTS.cc.

64  {
65  throw VertexException("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
66 }
Common base class.

◆ freeTrajectoryState()

FreeTrajectoryState MultiRefittedTS::freeTrajectoryState ( ) const
overridevirtual

Returns a FreeTrajectoryState. It will be the FTS of the single, collapsed state.

Transformation into a FreeTrajectoryState

Implements RefittedTrackState< 5 >.

Definition at line 23 of file MultiRefittedTS.cc.

References computeFreeTrajectoryState(), fts, and ftsAvailable.

Referenced by computeFreeTrajectoryState(), and transientTrack().

23  {
24  if (!ftsAvailable)
26  return fts;
27 }
FreeTrajectoryState fts
void computeFreeTrajectoryState() const

◆ momentumVector()

MultiRefittedTS::AlgebraicVectorM MultiRefittedTS::momentumVector ( ) const
overridevirtual

Vector containing the parameters describing the momentum as the vertex. These are (signed transverse curvature, theta, phi). Not possible yet for a multi-state, throws an exception.

Vector containing the parameters describing the momentum as the vertex. These are (signed transverse curvature, theta, phi)

Implements RefittedTrackState< 5 >.

Definition at line 81 of file MultiRefittedTS.cc.

81  {
82  throw VertexException("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
83 }
Common base class.

◆ parameters()

MultiRefittedTS::AlgebraicVectorN MultiRefittedTS::parameters ( void  ) const
overridevirtual

Vector containing the refitted track parameters. Not possible yet for a multi-state, throws an exception.

Vector containing the refitted track parameters.
These are (signed transverse curvature, theta, phi, (signed) transverse , longitudinal impact parameter)

Implements RefittedTrackState< 5 >.

Definition at line 56 of file MultiRefittedTS.cc.

56  {
57  throw VertexException("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
58 }
Common base class.

◆ position()

GlobalPoint MultiRefittedTS::position ( ) const
overridevirtual

Position at which the momentum is defined. Not possible yet for a multi-state, throws an exception.

Position at which the momentum is defined.

Implements RefittedTrackState< 5 >.

Definition at line 72 of file MultiRefittedTS.cc.

72  {
73  throw VertexException("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
74 }
Common base class.

◆ stateWithNewWeight()

ReferenceCountingPointer< RefittedTrackState< 5 > > MultiRefittedTS::stateWithNewWeight ( const double  newWeight) const
overridevirtual

This method is meant to returns a new refitted state of the same type, but with another weight. As we can have several components, each component of the new multi-state will be reweighted so that the sum of all weights is equal to the specified weight. The current state is unchanged.

Implements RefittedTrackState< 5 >.

Definition at line 98 of file MultiRefittedTS.cc.

References MultiRefittedTS(), refPosition, refSurface, surf, theComponents, and weight().

98  {
99  if (weight() < DBL_MIN) {
100  throw VertexException(
101  "MultiRefittedTS::stateWithNewWeight(): Can not reweight multi-state with total weight < DBL_MIN");
102  }
103  double factor = newWeight / weight();
104 
105  RTSvector reWeightedRTSC;
106  reWeightedRTSC.reserve(theComponents.size());
107 
108  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
109  reWeightedRTSC.push_back((**it).stateWithNewWeight((**it).weight() * factor));
110  }
111  if (surf) {
112  return RefCountedRefittedTrackState(new MultiRefittedTS(reWeightedRTSC, *refSurface));
113  } else {
114  return RefCountedRefittedTrackState(new MultiRefittedTS(reWeightedRTSC, refPosition));
115  }
116 }
MultiRefittedTS(const std::vector< RefCountedRefittedTrackState > &prtsComp, const Surface &referenceSurface)
Common base class.
ReferenceCountingPointer< RefittedTrackState< 5 > > RefCountedRefittedTrackState
std::vector< RefCountedRefittedTrackState > RTSvector
const GlobalPoint refPosition
RTSvector theComponents
ConstReferenceCountingPointer< Surface > refSurface
double weight() const override

◆ trajectoryStateOnSurface() [1/2]

TrajectoryStateOnSurface MultiRefittedTS::trajectoryStateOnSurface ( const Surface surface) const
overridevirtual

Returns a multi-state TSOS at a given surface

Transformation into a TSOS at a given surface

Implements RefittedTrackState< 5 >.

Definition at line 121 of file MultiRefittedTS.cc.

References theComponents.

Referenced by computeFreeTrajectoryState().

121  {
122  vector<TrajectoryStateOnSurface> tsosComponents;
123  tsosComponents.reserve(theComponents.size());
124  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
125  tsosComponents.push_back((**it).trajectoryStateOnSurface(surface));
126  }
128 }
RTSvector theComponents

◆ trajectoryStateOnSurface() [2/2]

TrajectoryStateOnSurface MultiRefittedTS::trajectoryStateOnSurface ( const Surface surface,
const Propagator propagator 
) const
overridevirtual

Returns a multi-state TSOS at a given surface, with a given propagator

Implements RefittedTrackState< 5 >.

Definition at line 130 of file MultiRefittedTS.cc.

References TrackCandidateProducer_cfi::propagator, and theComponents.

131  { //fixme... is the propagation done correctly? Is there a gsf propagator?
132  vector<TrajectoryStateOnSurface> tsosComponents;
133  tsosComponents.reserve(theComponents.size());
134  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
135  tsosComponents.push_back((**it).trajectoryStateOnSurface(surface, propagator));
136  }
138 }
RTSvector theComponents

◆ transientTrack()

reco::TransientTrack MultiRefittedTS::transientTrack ( ) const
overridevirtual

Returns a new reco::Track, which can then be made persistent. The parameters are taken from FTS described above.

Implements RefittedTrackState< 5 >.

Definition at line 140 of file MultiRefittedTS.cc.

References TransientTrackFromFTSFactory::build(), and freeTrajectoryState().

140  {
142  return factory.build(freeTrajectoryState());
143 }
reco::TransientTrack build(const FreeTrajectoryState &fts) const
FreeTrajectoryState freeTrajectoryState() const override

◆ weight()

double MultiRefittedTS::weight ( ) const
overridevirtual

The weight of this component in a mixture

Implements RefittedTrackState< 5 >.

Definition at line 85 of file MultiRefittedTS.cc.

References gather_cfg::cout, theComponents, totalWeight, and totalWeightAvailable.

Referenced by stateWithNewWeight().

85  {
86  if (!totalWeightAvailable) {
87  totalWeight = 0.;
88  if (theComponents.empty()) {
89  cout << "Asking for weight of empty MultiRefittedTS, returning zero!" << endl;
90  }
91  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
92  totalWeight += (**it).weight();
93  }
94  }
95  return totalWeight;
96 }
RTSvector theComponents

Member Data Documentation

◆ fts

FreeTrajectoryState MultiRefittedTS::fts
mutableprivate

Definition at line 114 of file MultiRefittedTS.h.

Referenced by computeFreeTrajectoryState(), and freeTrajectoryState().

◆ ftsAvailable

bool MultiRefittedTS::ftsAvailable
mutableprivate

Definition at line 112 of file MultiRefittedTS.h.

Referenced by computeFreeTrajectoryState(), and freeTrajectoryState().

◆ refPosition

const GlobalPoint MultiRefittedTS::refPosition
private

Definition at line 115 of file MultiRefittedTS.h.

Referenced by computeFreeTrajectoryState(), and stateWithNewWeight().

◆ refSurface

ConstReferenceCountingPointer<Surface> MultiRefittedTS::refSurface
private

Definition at line 116 of file MultiRefittedTS.h.

Referenced by stateWithNewWeight().

◆ surf

const bool MultiRefittedTS::surf
private

Definition at line 117 of file MultiRefittedTS.h.

Referenced by computeFreeTrajectoryState(), and stateWithNewWeight().

◆ theComponents

RTSvector MultiRefittedTS::theComponents
mutableprivate

◆ totalWeight

double MultiRefittedTS::totalWeight
mutableprivate

Definition at line 113 of file MultiRefittedTS.h.

Referenced by weight().

◆ totalWeightAvailable

bool MultiRefittedTS::totalWeightAvailable
mutableprivate

Definition at line 112 of file MultiRefittedTS.h.

Referenced by weight().