File indexing completed on 2024-04-06 12:31:41
0001 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0002 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCurvilinearToCartesian.h"
0003 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCartesianToCurvilinear.h"
0004
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006
0007 #include "MagneticField/Engine/interface/MagneticField.h"
0008
0009 #include "FWCore/Utilities/interface/Likely.h"
0010
0011 #include <cmath>
0012 #include <sstream>
0013
0014
0015
0016 void FreeTrajectoryState::missingError() const {
0017 std::stringstream form;
0018 form << "FreeTrajectoryState: attempt to access errors when none available"
0019 << "\nCurvilinear error valid/values :" << theCurvilinearError.valid() << "\n"
0020 << theCurvilinearError.matrix();
0021 edm::LogWarning("FreeTrajectoryState") << "(was exception) " << form.str();
0022
0023
0024 }
0025
0026
0027
0028
0029
0030
0031 void FreeTrajectoryState::createCartesianError(CartesianTrajectoryError& aCartesianError) const {
0032 JacobianCurvilinearToCartesian curv2Cart(theGlobalParameters);
0033 const AlgebraicMatrix65& jac = curv2Cart.jacobian();
0034
0035 aCartesianError = ROOT::Math::Similarity(jac, theCurvilinearError.matrix());
0036 }
0037
0038
0039 void FreeTrajectoryState::createCurvilinearError(CartesianTrajectoryError const& aCartesianError) const {
0040 JacobianCartesianToCurvilinear cart2Curv(theGlobalParameters);
0041 const AlgebraicMatrix56& jac = cart2Curv.jacobian();
0042
0043 theCurvilinearError = ROOT::Math::Similarity(jac, aCartesianError.matrix());
0044 }
0045
0046 void FreeTrajectoryState::rescaleError(double factor) {
0047 if UNLIKELY (!hasError())
0048 return;
0049 bool zeroField = (parameters().magneticField().nominalValue() == 0);
0050 if UNLIKELY (zeroField)
0051 theCurvilinearError.zeroFieldScaling(factor * factor);
0052 else
0053 theCurvilinearError *= (factor * factor);
0054 }