Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-23 22:53:20

0001 #ifndef _ThirdHitPrediction_h_
0002 #define _ThirdHitPrediction_h_
0003 
0004 /** predicts a range in r-z for the position of third hit.
0005  *  the predicted reange is defined by stright line extrapolation/interpolation
0006  *  from hit pair and the margin defined by hit errors and multiple scattering
0007  */
0008 
0009 #include "RecoTracker/TkMSParametrization/interface/PixelRecoRange.h"
0010 #include "RecoTracker/TkMSParametrization/interface/PixelRecoLineRZ.h"
0011 #include "RecoTracker/TkTrackingRegions/interface/TkTrackingRegionsMargin.h"
0012 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
0013 
0014 #include "DataFormats/GeometryVector/interface/GlobalTag.h"
0015 #include "DataFormats/GeometryVector/interface/Vector2DBase.h"
0016 typedef Vector2DBase<float, GlobalTag> Global2DVector;
0017 
0018 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0019 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0020 
0021 class DetLayer;
0022 class OrderedHitPair;
0023 class TrackingRecHit;
0024 
0025 class MagneticField;
0026 class TransientTrackingRecHitBuilder;
0027 class MultipleScatteringParametrisationMaker;
0028 
0029 #include "FWCore/Framework/interface/EventSetup.h"
0030 #include "FWCore/Framework/interface/ESHandle.h"
0031 
0032 #include <vector>
0033 #include <utility>
0034 
0035 class ThirdHitPrediction {
0036 public:
0037   typedef PixelRecoRange<float> Range;
0038   typedef TkTrackingRegionsMargin<float> Margin;
0039 
0040   ThirdHitPrediction(const TrackingRegion& region,
0041                      GlobalPoint inner,
0042                      GlobalPoint outer,
0043                      const MagneticField& magfield,
0044                      const TransientTrackingRecHitBuilder& ttrhBuilder,
0045                      double nSigMultipleScattering,
0046                      double maxAngleRatio);
0047   ~ThirdHitPrediction();
0048 
0049   void getRanges(const DetLayer* layer, float phi[], float rz[]);
0050   void getRanges(float rORz, float phi[], float rz[]);
0051 
0052   bool isCompatibleWithMultipleScattering(GlobalPoint g3,
0053                                           const std::vector<const TrackingRecHit*>& h,
0054                                           std::vector<GlobalVector>& localDirs,
0055                                           const MultipleScatteringParametrisationMaker& msmaker);
0056 
0057 private:
0058   void initLayer(const DetLayer* layer);
0059 
0060   void printOut(char* text);
0061 
0062   void invertCircle(Global2DVector& c, float& r);
0063   void invertPoint(Global2DVector& p);
0064 
0065   std::pair<float, float> findMinimalCircles(float r);
0066   std::pair<float, float> findTouchingCircles(float r);
0067 
0068   std::pair<float, float> findArcIntersection(std::pair<float, float> a, std::pair<float, float> b, bool& keep);
0069 
0070   void fitParabola(const float x[3], const float y[3], float par[3]);
0071   void findRectangle(const float x[3], const float y[3], const float par[3], float phi[2], float z[2]);
0072 
0073   float areaParallelogram(const Global2DVector& a, const Global2DVector& b);
0074   float angleRatio(const Global2DVector& p3, const Global2DVector& c);
0075 
0076   void spinCloser(float phi[3]);
0077 
0078   void calculateRangesBarrel(float r3, float phi[2], float z[2], bool keep);
0079   void calculateRangesForward(float z3, float phi[2], float r[2], bool keep);
0080   void calculateRanges(float rz3, float phi[2], float rz[2]);
0081 
0082   bool theBarrel, theForward;
0083   Range theDetRange;
0084   Margin theTolerance;
0085   PixelRecoLineRZ theLine;
0086 
0087   const DetLayer* theLayer;
0088 
0089   const TransientTrackingRecHitBuilder* theTTRecHitBuilder;
0090 
0091   // Data
0092   float Bz, r0, rm;
0093   GlobalPoint g1, g2;
0094   Global2DVector c0, p1, p2, dif;
0095   std::pair<float, float> arc_0m;
0096 
0097   bool keep;
0098 
0099   double nSigma;
0100   double maxRatio;
0101 };
0102 #endif