Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef TkDetLayers_BarrelUtil_h
0002 #define TkDetLayers_BarrelUtil_h
0003 
0004 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0005 
0006 #include "TrackingTools/DetLayers/interface/GeometricSearchDet.h"
0007 #include "TrackingTools/DetLayers/interface/MeasurementEstimator.h"
0008 #include "TrackingTools/DetLayers/interface/rangesIntersect.h"
0009 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0010 #include "DataFormats/GeometryVector/interface/VectorUtil.h"
0011 
0012 #pragma GCC visibility push(hidden)
0013 namespace barrelUtil {
0014 
0015   inline float calculatePhiWindow(float Xmax, const GeomDet& det, const TrajectoryStateOnSurface& state) {
0016     LocalPoint startPoint = state.localPosition();
0017     LocalVector shift(Xmax, 0., 0.);
0018     LocalPoint shift1 = startPoint + shift;
0019     LocalPoint shift2 = startPoint + (-shift);
0020     //LocalPoint shift2( startPoint); //original code;
0021     //shift2 -= shift;
0022 
0023     auto phi1 = det.surface().toGlobal(shift1).barePhi();
0024     auto phi2 = det.surface().toGlobal(shift2).barePhi();
0025     auto phiStart = state.globalPosition().barePhi();
0026     auto phiWin = std::min(std::abs(phiStart - phi1), std::abs(phiStart - phi2));
0027 
0028     return phiWin;
0029   }
0030 
0031   inline float computeWindowSize(const GeomDet* det,
0032                                  const TrajectoryStateOnSurface& tsos,
0033                                  const MeasurementEstimator& est) {
0034     auto xmax = est.maximalLocalDisplacement(tsos, det->surface()).x();
0035     return calculatePhiWindow(xmax, *det, tsos);
0036   }
0037 
0038   inline bool overlap(float phi, const GeometricSearchDet& gsdet, float phiWin) {
0039     // introduce offset (extrapolated point and true propagated point differ by 0.0003 - 0.00033,
0040     // due to thickness of Rod of 1 cm)
0041     constexpr float phiOffset = 0.00034;  //...TOBE CHECKED LATER...
0042     phiWin += phiOffset;
0043 
0044     // detector phi range
0045     std::pair<float, float> phiRange(phi - phiWin, phi + phiWin);
0046 
0047     return rangesIntersect(phiRange, gsdet.surface().phiSpan(), [](auto x, auto y) { return Geom::phiLess(x, y); });
0048   }
0049 
0050 }  // namespace barrelUtil
0051 
0052 #pragma GCC visibility pop
0053 #endif