Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:52

0001 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateClosestToPoint.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 
0004 // Private constructor
0005 
0006 TrajectoryStateClosestToPoint::TrajectoryStateClosestToPoint(const FTS& originalFTS, const GlobalPoint& referencePoint)
0007     : theFTS(originalFTS), theRefPoint(referencePoint), valid(true), theFTSavailable(true) {
0008   try {
0009     theParameters = PerigeeConversions::ftsToPerigeeParameters(originalFTS, referencePoint, thePt);
0010     if (theFTS.hasError()) {
0011       thePerigeeError = PerigeeConversions::ftsToPerigeeError(originalFTS);
0012       errorIsAvailable = true;
0013     } else {
0014       errorIsAvailable = false;
0015     }
0016     theField = &(originalFTS.parameters().magneticField());
0017   } catch (const cms::Exception& ex) {
0018     if (ex.category() != "PerigeeConversions")
0019       throw;
0020     edm::LogInfo("TrajectoryStateClosestToPoint_PerigeeConversions")
0021         << "Caught exception " << ex.explainSelf() << ".\n";
0022     valid = false;
0023   }
0024 }
0025 
0026 void TrajectoryStateClosestToPoint::calculateFTS() const {
0027   if (!isValid())
0028     throw TrajectoryStateException("TrajectoryStateClosestToPoint is invalid and cannot return any parameters");
0029   GlobalTrajectoryParameters gtp(PerigeeConversions::positionFromPerigee(theParameters, theRefPoint),
0030                                  PerigeeConversions::momentumFromPerigee(theParameters, thePt, theRefPoint),
0031                                  theParameters.charge(),
0032                                  theField);
0033   if (errorIsAvailable) {
0034     theFTS = FTS(gtp, PerigeeConversions::curvilinearError(thePerigeeError, gtp));
0035   } else {
0036     theFTS = FTS(gtp);
0037   }
0038   theFTSavailable = true;
0039 }