Go to the documentation of this file.00001 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateClosestToPoint.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003
00004
00005
00006 TrajectoryStateClosestToPoint::
00007 TrajectoryStateClosestToPoint(const FTS& originalFTS, const GlobalPoint& referencePoint) :
00008 valid(true), theFTS(originalFTS), theFTSavailable(true), theRefPoint(referencePoint)
00009 {
00010 try {
00011 theParameters = perigeeConversions.ftsToPerigeeParameters(originalFTS, referencePoint, thePt);
00012 if (theFTS.hasError()) {
00013 thePerigeeError = perigeeConversions.ftsToPerigeeError(originalFTS);
00014 errorIsAvailable = true;
00015 }
00016 else {
00017 errorIsAvailable = false;
00018 }
00019 theField = &(originalFTS.parameters().magneticField());
00020 } catch (const cms::Exception &ex) {
00021 if (ex.category() != "PerigeeConversions") throw;
00022 edm::LogWarning("TrajectoryStateClosestToPoint_PerigeeConversions") << "Caught exception " << ex.explainSelf() << ".\n";
00023 valid = false;
00024 }
00025 }
00026
00027
00034 TrajectoryStateClosestToPoint::
00035 TrajectoryStateClosestToPoint(const PerigeeTrajectoryParameters& perigeeParameters, double pt,
00036 const GlobalPoint& referencePoint, const MagneticField* field) :
00037 valid(true), theField(field), theFTSavailable(false), theRefPoint(referencePoint),
00038 theParameters(perigeeParameters), thePt( pt ), errorIsAvailable(false)
00039 {}
00040
00047 TrajectoryStateClosestToPoint::
00048 TrajectoryStateClosestToPoint(const PerigeeTrajectoryParameters& perigeeParameters, double pt,
00049 const PerigeeTrajectoryError& perigeeError, const GlobalPoint& referencePoint,
00050 const MagneticField* field):
00051 valid(true), theField(field), theFTSavailable(false), theRefPoint(referencePoint),
00052 theParameters(perigeeParameters), thePt( pt ), thePerigeeError(perigeeError),
00053 errorIsAvailable(true)
00054
00055 {}
00056
00057
00058 void TrajectoryStateClosestToPoint::calculateFTS() const
00059 {
00060 if(!isValid()) throw TrajectoryStateException(
00061 "TrajectoryStateClosestToPoint is invalid and cannot return any parameters");
00062 GlobalTrajectoryParameters gtp(
00063 perigeeConversions.positionFromPerigee(theParameters, theRefPoint),
00064 perigeeConversions.momentumFromPerigee(theParameters, thePt, theRefPoint),
00065 theParameters.charge(), theField);
00066 if (errorIsAvailable) {
00067 theFTS = FTS(gtp, perigeeConversions.curvilinearError(thePerigeeError, gtp));
00068 } else {
00069 theFTS = FTS(gtp);
00070 }
00071 theFTSavailable = true;
00072 }