Go to the documentation of this file.00001 #include "RecoVertex/GaussianSumVertexFit/interface/PerigeeMultiLTS.h"
00002 #include "RecoVertex/VertexTools/interface/PerigeeRefittedTrackState.h"
00003 #include "TrackingTools/TrajectoryState/interface/PerigeeConversions.h"
00004 #include "RecoVertex/VertexPrimitives/interface/VertexException.h"
00005 #include "RecoVertex/VertexTools/interface/PerigeeLinearizedTrackState.h"
00006
00007
00008
00009 using namespace std;
00010
00011 PerigeeMultiLTS::PerigeeMultiLTS(const GlobalPoint & linP,
00012 const reco::TransientTrack & track, const TrajectoryStateOnSurface& tsos)
00013 : theLinPoint(linP), theTrack(track), theTSOS(tsos),
00014 theCharge(theTrack.charge()), collapsedStateAvailable(false)
00015 {
00016
00017
00018 vector<TrajectoryStateOnSurface> tsosComp = theTSOS.components();
00019
00020 ltComp.reserve(tsosComp.size());
00021 for (vector<TrajectoryStateOnSurface>::iterator it = tsosComp.begin();
00022 it != tsosComp.end(); it++) {
00023
00024 ltComp.push_back(theLTSfactory.linearizedTrackState(theLinPoint, theTrack, *it ));
00025 }
00026
00027 }
00028
00029
00030 void PerigeeMultiLTS::prepareCollapsedState() const
00031 {
00032 if (!collapsedStateAvailable) {
00033 collapsedStateLT = theLTSfactory.linearizedTrackState(theLinPoint, theTrack, theTSOS);
00034 }
00035 collapsedStateAvailable = true;
00036 }
00037
00038
00042 const AlgebraicVector5 & PerigeeMultiLTS::constantTerm() const
00043 {
00044 if (!collapsedStateAvailable) prepareCollapsedState();
00045 return collapsedStateLT->constantTerm();
00046 }
00047
00051 const AlgebraicMatrix53 & PerigeeMultiLTS::positionJacobian() const
00052 {
00053 if (!collapsedStateAvailable) prepareCollapsedState();
00054 return collapsedStateLT->positionJacobian();
00055 }
00056
00060 const AlgebraicMatrix53 & PerigeeMultiLTS::momentumJacobian() const
00061 {
00062 if (!collapsedStateAvailable) prepareCollapsedState();
00063 return collapsedStateLT->momentumJacobian();
00064 }
00065
00068 const AlgebraicVector5 & PerigeeMultiLTS::parametersFromExpansion() const
00069 {
00070 if (!collapsedStateAvailable) prepareCollapsedState();
00071 return collapsedStateLT->parametersFromExpansion();
00072 }
00073
00078 const TrajectoryStateClosestToPoint & PerigeeMultiLTS::predictedState() const
00079 {
00080 if (!collapsedStateAvailable) prepareCollapsedState();
00081 const PerigeeLinearizedTrackState* otherP =
00082 dynamic_cast<const PerigeeLinearizedTrackState*>(collapsedStateLT.get());
00083 return otherP->predictedState();
00084 }
00085
00086
00087 bool PerigeeMultiLTS::hasError() const
00088 {
00089 if (!collapsedStateAvailable) prepareCollapsedState();
00090 return collapsedStateLT->hasError();
00091 }
00092
00093 AlgebraicVector5 PerigeeMultiLTS::predictedStateParameters() const
00094 {
00095 if (!collapsedStateAvailable) prepareCollapsedState();
00096 return collapsedStateLT->predictedStateParameters();
00097 }
00098
00099 AlgebraicVector3 PerigeeMultiLTS::predictedStateMomentumParameters() const
00100 {
00101 if (!collapsedStateAvailable) prepareCollapsedState();
00102 return collapsedStateLT->predictedStateMomentumParameters();
00103 }
00104
00105 AlgebraicSymMatrix55 PerigeeMultiLTS::predictedStateWeight(int & error) const
00106 {
00107 if (!collapsedStateAvailable) prepareCollapsedState();
00108 return collapsedStateLT->predictedStateWeight(error) ;
00109 }
00110
00111 AlgebraicSymMatrix55 PerigeeMultiLTS::predictedStateError() const
00112 {
00113 if (!collapsedStateAvailable) prepareCollapsedState();
00114 return collapsedStateLT-> predictedStateError();
00115 }
00116
00117 AlgebraicSymMatrix33 PerigeeMultiLTS::predictedStateMomentumError() const
00118 {
00119 if (!collapsedStateAvailable) prepareCollapsedState();
00120 return collapsedStateLT->predictedStateMomentumError() ;
00121 }
00122
00123 bool PerigeeMultiLTS::operator ==(LinearizedTrackState<5>& other)const
00124 {
00125 const PerigeeMultiLTS* otherP =
00126 dynamic_cast<const PerigeeMultiLTS*>(&other);
00127 if (otherP == 0) {
00128 throw VertexException("PerigeeMultiLTS: don't know how to compare myself to non-perigee track state");
00129 }
00130 return (otherP->track() == theTrack);
00131 }
00132
00133
00134 PerigeeMultiLTS::RefCountedLinearizedTrackState
00135 PerigeeMultiLTS::stateWithNewLinearizationPoint
00136 (const GlobalPoint & newLP) const
00137 {
00138 return RefCountedLinearizedTrackState(
00139 new PerigeeMultiLTS(newLP, track(), theTSOS));
00140 }
00141
00142 PerigeeMultiLTS::RefCountedRefittedTrackState
00143 PerigeeMultiLTS::createRefittedTrackState(
00144 const GlobalPoint & vertexPosition,
00145 const AlgebraicVectorM & vectorParameters,
00146 const AlgebraicSymMatrixOO & covarianceMatrix) const
00147 {
00148 PerigeeConversions perigeeConversions;
00149 TrajectoryStateClosestToPoint refittedTSCP =
00150 perigeeConversions.trajectoryStateClosestToPoint(
00151 vectorParameters, vertexPosition, charge(), covarianceMatrix, theTrack.field());
00152 return RefCountedRefittedTrackState(new PerigeeRefittedTrackState(refittedTSCP, vectorParameters));
00153 }
00154
00155 AlgebraicVector5 PerigeeMultiLTS::refittedParamFromEquation(
00156 const RefCountedRefittedTrackState & theRefittedState) const
00157 {
00158 AlgebraicVector3 vertexPosition;
00159 vertexPosition(0) = theRefittedState->position().x();
00160 vertexPosition(1) = theRefittedState->position().y();
00161 vertexPosition(2) = theRefittedState->position().z();
00162 AlgebraicVectorN param = constantTerm() +
00163 positionJacobian() * vertexPosition +
00164 momentumJacobian() * theRefittedState->momentumVector();
00165 if (param(2) > M_PI) param(2)-= 2*M_PI;
00166 if (param(2) < -M_PI) param(2)+= 2*M_PI;
00167
00168 return param;
00169 }
00170
00171
00172 void PerigeeMultiLTS::checkParameters(AlgebraicVector5 & parameters) const
00173 {
00174 if (parameters(2) > M_PI) parameters(2)-= 2*M_PI;
00175 if (parameters(2) < -M_PI) parameters(2)+= 2*M_PI;
00176 }