00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020 #include "RecoEgamma/EgammaElectronAlgos/interface/BarrelMeasurementEstimator.h"
00021 #include "RecoTracker/TkTrackingRegions/interface/GlobalDetRangeZPhi.h"
00022 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00023 #include "TrackingTools/DetLayers/interface/rangesIntersect.h"
00024 #include "TrackingTools/DetLayers/interface/PhiLess.h"
00025 #include "CLHEP/Units/PhysicalConstants.h"
00026
00027
00028
00029 std::pair<bool,double> BarrelMeasurementEstimator::estimate( const TrajectoryStateOnSurface& ts,
00030 const TransientTrackingRecHit& hit) const {
00031 LocalPoint lp = hit.localPosition();
00032 GlobalPoint gp = hit.det()->surface().toGlobal( lp);
00033 return this->estimate(ts,gp);
00034 }
00035
00036
00037 std::pair<bool,double> BarrelMeasurementEstimator::estimate( const TrajectoryStateOnSurface& ts,
00038 GlobalPoint &gp) const {
00039 float tsPhi = ts.globalParameters().position().phi();
00040 float myR = gp.perp();
00041 float myZ = gp.z();
00042
00043 float myZmax = theZMax;
00044 float myZmin = theZMin;
00045
00046 if(fabs(myZ)<30. && myR>8.)
00047 {
00048 myZmax = 0.09;
00049 myZmin = -0.09;
00050 }
00051
00052 float rhPhi = gp.phi();
00053
00054 float zDiff = ts.globalParameters().position().z() - gp.z();
00055 float phiDiff = tsPhi - rhPhi;
00056 if (phiDiff > pi) phiDiff -= twopi;
00057 if (phiDiff < -pi) phiDiff += twopi;
00058
00059 if ( phiDiff < thePhiMax && phiDiff > thePhiMin &&
00060 zDiff < myZmax && zDiff > myZmin) {
00061
00062 return std::pair<bool,double>(true,1.);
00063 } else {
00064
00065 return std::pair<bool,double>(false,0.);
00066 }
00067 }
00068
00069 bool BarrelMeasurementEstimator::estimate( const TrajectoryStateOnSurface& ts,
00070 const BoundPlane& plane) const {
00071
00072 typedef std::pair<float,float> Range;
00073
00074
00075 GlobalPoint trajPos(ts.globalParameters().position());
00076 GlobalDetRangeZPhi detRange(plane);
00077
00078 Range trajZRange(trajPos.z() - fabs(theZMin), trajPos.z() + fabs(theZMax));
00079 Range trajPhiRange(trajPos.phi() - fabs(thePhiMin), trajPos.phi() + fabs(thePhiMax));
00080
00081 if(rangesIntersect(trajZRange, detRange.zRange()) &&
00082 rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess())) {
00083 return true;
00084 }
00085 else {
00086
00087
00088
00089
00090
00091
00092
00093
00094 return false;
00095 }
00096
00097 }
00098
00099 MeasurementEstimator::Local2DVector
00100 BarrelMeasurementEstimator::maximalLocalDisplacement( const TrajectoryStateOnSurface& ts,
00101 const BoundPlane& plane) const
00102 {
00103 float nSigmaCut = 3.;
00104 if ( ts.hasError()) {
00105 LocalError le = ts.localError().positionError();
00106 return Local2DVector( sqrt(le.xx())*nSigmaCut, sqrt(le.yy())*nSigmaCut);
00107 }
00108 else return Local2DVector(99999,99999);
00109 }
00110
00111
00112