Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:43

0001 #ifndef RKCartesianDistance_H
0002 #define RKCartesianDistance_H
0003 
0004 #include "FWCore/Utilities/interface/Visibility.h"
0005 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
0006 #include "RKDistance.h"
0007 #include "RKSmallVector.h"
0008 #include "CartesianStateAdaptor.h"
0009 
0010 #include <cmath>
0011 
0012 /// Estimator of the distance between two state vectors, e.g. for convergence test
0013 
0014 class dso_internal RKCartesianDistance final : public RKDistance<double, 6> {
0015 public:
0016   typedef double Scalar;
0017   typedef RKSmallVector<double, 6> Vector;
0018 
0019   ~RKCartesianDistance() override {}
0020 
0021   Scalar operator()(const Vector& rka, const Vector& rkb, const Scalar& s) const override {
0022     CartesianStateAdaptor a(rka), b(rkb);
0023 
0024     return (a.position() - b.position()).mag() + (a.momentum() - b.momentum()).mag() / b.momentum().mag();
0025   }
0026 };
0027 
0028 #endif