Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-13 03:24:14

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   auto params = PerigeeConversions::ftsToPerigeeParameters(originalFTS, referencePoint, thePt);
0009   if (not params) {
0010     valid = false;
0011     edm::LogInfo("TrajectoryStateClosestToPoint_PerigeeConversions") << "Track had pt == 0.";
0012     return;
0013   }
0014   theParameters = *params;
0015   if (theFTS.hasError()) {
0016     thePerigeeError = PerigeeConversions::ftsToPerigeeError(originalFTS);
0017     errorIsAvailable = true;
0018   } else {
0019     errorIsAvailable = false;
0020   }
0021   theField = &(originalFTS.parameters().magneticField());
0022 }
0023 
0024 void TrajectoryStateClosestToPoint::calculateFTS() const {
0025   if (!isValid())
0026     throw TrajectoryStateException("TrajectoryStateClosestToPoint is invalid and cannot return any parameters");
0027   GlobalTrajectoryParameters gtp(PerigeeConversions::positionFromPerigee(theParameters, theRefPoint),
0028                                  PerigeeConversions::momentumFromPerigee(theParameters, thePt, theRefPoint),
0029                                  theParameters.charge(),
0030                                  theField);
0031   if (errorIsAvailable) {
0032     theFTS = FTS(gtp, PerigeeConversions::curvilinearError(thePerigeeError, gtp));
0033   } else {
0034     theFTS = FTS(gtp);
0035   }
0036   theFTSavailable = true;
0037 }