File indexing completed on 2024-04-06 12:31:42
0001 #ifndef TValidTrackingRecHit_H
0002 #define TValidTrackingRecHit_H
0003
0004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0005 #include "DataFormats/TrackingRecHit/interface/TrackingRecHitGlobalState.h"
0006 #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
0007
0008
0009
0010
0011
0012 class TValidTrackingRecHit : public TransientTrackingRecHit {
0013 public:
0014 TValidTrackingRecHit(const GeomDet& geom) : TrackingRecHit(geom) {}
0015
0016 template <typename... Args>
0017 TValidTrackingRecHit(Args&&... args) : TrackingRecHit(std::forward<Args>(args)...) {}
0018
0019
0020 TrackingRecHit* cloneHit() const override { return hit()->clone(); }
0021
0022
0023 const Surface* surface() const final { return &(det()->surface()); }
0024
0025 GlobalPoint globalPosition() const final { return surface()->toGlobal(localPosition()); }
0026
0027 GlobalError globalPositionError() const final {
0028 return ErrorFrameTransformer().transform(localPositionError(), *surface());
0029 }
0030 float errorGlobalR() const final { return std::sqrt(globalPositionError().rerr(globalPosition())); }
0031 float errorGlobalZ() const final { return std::sqrt(globalPositionError().czz()); }
0032 float errorGlobalRPhi() const final {
0033 return globalPosition().perp() * sqrt(globalPositionError().phierr(globalPosition()));
0034 }
0035
0036
0037 TrackingRecHitGlobalState globalState() const {
0038 GlobalError globalError = ErrorFrameTransformer::transform(localPositionError(), *surface());
0039 auto gp = globalPosition();
0040 float r = gp.perp();
0041 float errorRPhi = r * std::sqrt(float(globalError.phierr(gp)));
0042 float errorR = std::sqrt(float(globalError.rerr(gp)));
0043 float errorZ = std::sqrt(float(globalError.czz()));
0044 return (TrackingRecHitGlobalState){gp.basicVector(), r, gp.barePhi(), errorR, errorZ, errorRPhi};
0045 }
0046
0047
0048
0049
0050
0051 bool canImproveWithTrack() const override { return false; }
0052
0053
0054 virtual float clusterProbability() const { return 1.f; }
0055
0056 private:
0057
0058
0059 TValidTrackingRecHit* clone() const override = 0;
0060 };
0061
0062 #endif