Go to the documentation of this file.00001
00002 #include "RecoTracker/DeDx/interface/DeDxDiscriminatorTools.h"
00003
00004 namespace DeDxDiscriminatorTools {
00005
00006 using namespace std;
00007
00008 bool IsSpanningOver2APV(unsigned int FirstStrip, unsigned int ClusterSize)
00009 {
00010 if(FirstStrip==0 ) return true;
00011 if(FirstStrip==128 ) return true;
00012 if(FirstStrip==256 ) return true;
00013 if(FirstStrip==384 ) return true;
00014 if(FirstStrip==512 ) return true;
00015 if(FirstStrip==640 ) return true;
00016
00017 if(FirstStrip<=127 && FirstStrip+ClusterSize>127) return true;
00018 if(FirstStrip<=255 && FirstStrip+ClusterSize>255) return true;
00019 if(FirstStrip<=383 && FirstStrip+ClusterSize>383) return true;
00020 if(FirstStrip<=511 && FirstStrip+ClusterSize>511) return true;
00021 if(FirstStrip<=639 && FirstStrip+ClusterSize>639) return true;
00022
00023 if(FirstStrip+ClusterSize==127 ) return true;
00024 if(FirstStrip+ClusterSize==255 ) return true;
00025 if(FirstStrip+ClusterSize==383 ) return true;
00026 if(FirstStrip+ClusterSize==511 ) return true;
00027 if(FirstStrip+ClusterSize==639 ) return true;
00028 if(FirstStrip+ClusterSize==767 ) return true;
00029
00030 return false;
00031 }
00032
00033
00034 bool IsSaturatingStrip(const vector<uint8_t>& Ampls)
00035 {
00036 for(unsigned int i=0;i<Ampls.size();i++){
00037 if(Ampls[i]>=254)return true;
00038 }return false;
00039 }
00040
00041
00042
00043 double charge(const vector<uint8_t>& Ampls)
00044 {
00045 double charge = 0;
00046 for(unsigned int a=0;a<Ampls.size();a++){charge+=Ampls[a];}
00047 return charge;
00048 }
00049
00050
00051 double path(double cosine, double thickness)
00052 {
00053 return (10.0*thickness)/fabs(cosine);
00054 }
00055
00056
00057 bool IsFarFromBorder(TrajectoryStateOnSurface trajState, const GeomDetUnit* it)
00058 {
00059 if (dynamic_cast<const StripGeomDetUnit*>(it)==0 && dynamic_cast<const PixelGeomDetUnit*>(it)==0) {
00060 std::cout << "this detID doesn't seem to belong to the Tracker" << std::endl;
00061 return false;
00062 }
00063
00064 LocalPoint HitLocalPos = trajState.localPosition();
00065 LocalError HitLocalError = trajState.localError().positionError() ;
00066
00067 const BoundPlane plane = it->surface();
00068 const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
00069 const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
00070
00071 double DistFromBorder = 1.0;
00072
00073 double HalfLength = it->surface().bounds().length() /2.0;
00074
00075 if(trapezoidalBounds)
00076 {
00077 std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
00078 HalfLength = parameters[3];
00079
00080
00081 }else if(rectangularBounds){
00082
00083 HalfLength = it->surface().bounds().length() /2.0;
00084 }else{return false;}
00085
00086
00087 if (fabs(HitLocalPos.y())+HitLocalError.yy() >= (HalfLength - DistFromBorder) ) return false;
00088
00089 return true;
00090 }
00091
00092 }