00001 #ifndef _ThirdHitPrediction_h_
00002 #define _ThirdHitPrediction_h_
00003
00009 #include "RecoTracker/TkMSParametrization/interface/PixelRecoRange.h"
00010 #include "RecoTracker/TkMSParametrization/interface/PixelRecoLineRZ.h"
00011 #include "RecoTracker/TkTrackingRegions/interface/TkTrackingRegionsMargin.h"
00012 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
00013
00014 #include "DataFormats/GeometryVector/interface/GlobalTag.h"
00015 #include "DataFormats/GeometryVector/interface/Vector2DBase.h"
00016 typedef Vector2DBase<float,GlobalTag> Global2DVector;
00017
00018 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00019 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00020
00021 class DetLayer;
00022 class OrderedHitPair;
00023 class TrackingRecHit;
00024
00025 class TransientTrackingRecHitBuilder;
00026
00027 #include "FWCore/Framework/interface/EventSetup.h"
00028 #include "FWCore/Framework/interface/ESHandle.h"
00029
00030 #include <vector>
00031 #include <utility>
00032
00033 class ThirdHitPrediction {
00034 public:
00035 typedef PixelRecoRange<float> Range;
00036 typedef TkTrackingRegionsMargin<float> Margin;
00037
00038 ThirdHitPrediction
00039 (const TrackingRegion & region, GlobalPoint inner, GlobalPoint outer,
00040 const edm::EventSetup& es, double nSigMultipleScattering, double
00041 maxAngleRatio, std::string builderName);
00042 ~ThirdHitPrediction();
00043
00044 void getRanges(const DetLayer *layer, float phi[],float rz[]);
00045 void getRanges(float rORz , float phi[],float rz[]);
00046
00047 bool isCompatibleWithMultipleScattering
00048 (GlobalPoint g3, std::vector<const TrackingRecHit*> h,
00049 std::vector<GlobalVector>& localDirs, const edm::EventSetup& es);
00050
00051 private:
00052 void initLayer(const DetLayer *layer);
00053
00054 void printOut(char *text);
00055
00056 void invertCircle(Global2DVector& c,float& r);
00057 void invertPoint (Global2DVector& p);
00058
00059 std::pair<float,float> findMinimalCircles (float r);
00060 std::pair<float,float> findTouchingCircles(float r);
00061
00062 std::pair<float,float> findArcIntersection
00063 (std::pair<float,float> a, std::pair<float,float> b, bool& keep);
00064
00065 void fitParabola
00066 (const float x[3], const float y[3], float par[3]);
00067 void findRectangle
00068 (const float x[3], const float y[3], const float par[3],
00069 float phi[2],float z[2]);
00070
00071 float areaParallelogram(const Global2DVector& a , const Global2DVector& b);
00072 float angleRatio (const Global2DVector& p3, const Global2DVector& c);
00073
00074 void spinCloser(float phi[3]);
00075
00076 void calculateRangesBarrel (float r3, float phi[2],float z[2], bool keep);
00077 void calculateRangesForward(float z3, float phi[2],float r[2], bool keep);
00078 void calculateRanges (float rz3, float phi[2],float rz[2]);
00079
00080 bool theBarrel, theForward;
00081 Range theDetRange;
00082 Margin theTolerance;
00083 PixelRecoLineRZ theLine;
00084
00085 const DetLayer * theLayer;
00086
00087 const TransientTrackingRecHitBuilder * theTTRecHitBuilder;
00088
00089
00090 float Bz, r0,rm;
00091 GlobalPoint g1,g2;
00092 Global2DVector c0, p1,p2,dif;
00093 std::pair<float,float> arc_0m;
00094
00095 bool keep;
00096
00097 double nSigma;
00098 double maxRatio;
00099 };
00100 #endif