Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:58

0001 #ifndef RecoTracker_TkTrackingRegions_OuterHitCompatibility_H
0002 #define RecoTracker_TkTrackingRegions_OuterHitCompatibility_H
0003 
0004 /** test compatibility of RecHit. 
0005     The phi and r-z are checked in independent way.
0006     The phi of a RecHit hit is tested if it is in the range 
0007     defined by OuterHitPhiPrediction.
0008     The r-z checking is done with a help of HitRZCompatibility checker */
0009 #include "FWCore/Framework/interface/EventSetup.h"
0010 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0011 #include "OuterHitPhiPrediction.h"
0012 #include "RecoTracker/TkTrackingRegions/interface/HitRZCompatibility.h"
0013 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0014 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0015 #include "DataFormats/GeometryVector/interface/VectorUtil.h"
0016 #include "DataFormats/Math/interface/approx_atan2.h"
0017 
0018 #include "FWCore/Utilities/interface/Visibility.h"
0019 
0020 template <typename Algo>
0021 class dso_internal OuterHitCompatibility {
0022 public:
0023   OuterHitCompatibility(const OuterHitPhiPrediction& phiPrediction, const Algo& rzCompatibility)
0024       : thePhiPrediction(phiPrediction), theRZCompatibility(rzCompatibility) {}
0025 
0026   bool operator()(const TrackingRecHit& hit) const {
0027     auto hitPos = hit.globalPosition();
0028     auto hitR = hitPos.perp();
0029 
0030     auto hitZ = hitPos.z();
0031     if (!theRZCompatibility(hitR, hitZ))
0032       return false;
0033 
0034     auto hitPhi = unsafe_atan2f<9>(hitPos.y(), hitPos.x());
0035 
0036     return checkPhi(hitPhi, hitR);
0037   }
0038 
0039   bool checkPhi(float phi, float r) const {
0040     auto hitPhiRange = thePhiPrediction(r);
0041     bool phiOK = Geom::phiLess(hitPhiRange.min(), phi) && Geom::phiLess(phi, hitPhiRange.max());
0042     return phiOK;
0043   }
0044 
0045 private:
0046   OuterHitPhiPrediction thePhiPrediction;
0047   Algo theRZCompatibility;
0048 };
0049 #endif