00001 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateClosestToPoint.h"
00002
00003
00004
00005 TrajectoryStateClosestToPoint::
00006 TrajectoryStateClosestToPoint(const FTS& originalFTS, const GlobalPoint& referencePoint) :
00007 theFTS(originalFTS), theFTSavailable(true), theRefPoint(referencePoint)
00008 {
00009 theParameters = perigeeConversions.ftsToPerigeeParameters(originalFTS, referencePoint, thePt);
00010 if (theFTS.hasError()) {
00011 thePerigeeError = perigeeConversions.ftsToPerigeeError(originalFTS);
00012 errorIsAvailable = true;
00013 }
00014 else {
00015 errorIsAvailable = false;
00016 }
00017 theField = &(originalFTS.parameters().magneticField());
00018 }
00019
00020
00027 TrajectoryStateClosestToPoint::
00028 TrajectoryStateClosestToPoint(const PerigeeTrajectoryParameters& perigeeParameters, double pt,
00029 const GlobalPoint& referencePoint, const MagneticField* field) :
00030 theField(field), theFTSavailable(false), theRefPoint(referencePoint),
00031 theParameters(perigeeParameters), thePt( pt ), errorIsAvailable(false)
00032 {}
00033
00040 TrajectoryStateClosestToPoint::
00041 TrajectoryStateClosestToPoint(const PerigeeTrajectoryParameters& perigeeParameters, double pt,
00042 const PerigeeTrajectoryError& perigeeError, const GlobalPoint& referencePoint,
00043 const MagneticField* field):
00044 theField(field), theFTSavailable(false), theRefPoint(referencePoint), theParameters(perigeeParameters),
00045 thePt( pt ), thePerigeeError(perigeeError), errorIsAvailable(true)
00046
00047 {}
00048
00049
00050 void TrajectoryStateClosestToPoint::calculateFTS() const
00051 {
00052 GlobalTrajectoryParameters gtp(
00053 perigeeConversions.positionFromPerigee(theParameters, theRefPoint),
00054 perigeeConversions.momentumFromPerigee(theParameters, thePt, theRefPoint),
00055 theParameters.charge(), theField);
00056 if (errorIsAvailable) {
00057 theFTS = FTS(gtp, perigeeConversions.curvilinearError(thePerigeeError, gtp));
00058 } else {
00059 theFTS = FTS(gtp);
00060 }
00061 theFTSavailable = true;
00062 }