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 GlobalPoint &referencePosition)
 
 MultiRefittedTS (const std::vector< RefCountedRefittedTrackState > &prtsComp, const Surface &referenceSurface)
 
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.

13  : theComponents(prtsComp), ftsAvailable(false), refSurface(&referenceSurface), surf(true) {}

Referenced by stateWithNewWeight().

◆ 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) {}

◆ ~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.

94 { return theComponents; }

References theComponents.

◆ computeFreeTrajectoryState()

void MultiRefittedTS::computeFreeTrajectoryState ( ) const
private

Definition at line 29 of file MultiRefittedTS.cc.

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 }

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

Referenced by freeTrajectoryState().

◆ 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 }

◆ 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.

23  {
24  if (!ftsAvailable)
26  return fts;
27 }

References computeFreeTrajectoryState(), fts, and ftsAvailable.

Referenced by computeFreeTrajectoryState(), and transientTrack().

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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.

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 }

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

◆ 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.

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 }

References theComponents.

Referenced by computeFreeTrajectoryState().

◆ 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.

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 }

References TrackCandidateProducer_cfi::propagator, and 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.

140  {
142  return factory.build(freeTrajectoryState());
143 }

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

◆ 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.

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 }

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

Referenced by stateWithNewWeight().

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().

TrajectoryStateOnSurface::freeTrajectoryState
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:60
MultiRefittedTS::RTSvector
std::vector< RefCountedRefittedTrackState > RTSvector
Definition: MultiRefittedTS.h:109
VertexException
Common base class.
Definition: VertexException.h:12
BasicMultiTrajectoryState
Definition: BasicMultiTrajectoryState.h:17
MultiRefittedTS::weight
double weight() const override
Definition: MultiRefittedTS.cc:85
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MultiRefittedTS::fts
FreeTrajectoryState fts
Definition: MultiRefittedTS.h:114
MultiRefittedTS::theComponents
RTSvector theComponents
Definition: MultiRefittedTS.h:111
TransverseImpactPointExtrapolator
Definition: TransverseImpactPointExtrapolator.h:26
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
MultiRefittedTS::freeTrajectoryState
FreeTrajectoryState freeTrajectoryState() const override
Definition: MultiRefittedTS.cc:23
MultiRefittedTS::surf
const bool surf
Definition: MultiRefittedTS.h:117
TransientTrackFromFTSFactory::build
reco::TransientTrack build(const FreeTrajectoryState &fts) const
Definition: TransientTrackFromFTSFactory.cc:7
MultiRefittedTS::totalWeight
double totalWeight
Definition: MultiRefittedTS.h:113
BasicTrajectoryState
Definition: BasicTrajectoryState.h:66
MultiRefittedTS::refPosition
const GlobalPoint refPosition
Definition: MultiRefittedTS.h:115
MultiRefittedTS::computeFreeTrajectoryState
void computeFreeTrajectoryState() const
Definition: MultiRefittedTS.cc:29
MultiRefittedTS::refSurface
ConstReferenceCountingPointer< Surface > refSurface
Definition: MultiRefittedTS.h:116
TransientTrackFromFTSFactory
Definition: TransientTrackFromFTSFactory.h:10
TrajectoryStateOnSurface::surface
const SurfaceType & surface() const
Definition: TrajectoryStateOnSurface.h:78
MultiRefittedTS::RefCountedRefittedTrackState
ReferenceCountingPointer< RefittedTrackState< 5 > > RefCountedRefittedTrackState
Definition: MultiRefittedTS.h:19
MultiRefittedTS::trajectoryStateOnSurface
TrajectoryStateOnSurface trajectoryStateOnSurface(const Surface &surface) const override
Definition: MultiRefittedTS.cc:121
MultiRefittedTS::totalWeightAvailable
bool totalWeightAvailable
Definition: MultiRefittedTS.h:112
MultiRefittedTS::MultiRefittedTS
MultiRefittedTS(const std::vector< RefCountedRefittedTrackState > &prtsComp, const Surface &referenceSurface)
Definition: MultiRefittedTS.cc:11
MultiRefittedTS::ftsAvailable
bool ftsAvailable
Definition: MultiRefittedTS.h:112