CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DeDxDiscriminatorTools.cc
Go to the documentation of this file.
1 
3 
4 namespace DeDxDiscriminatorTools {
5 
6 using namespace std;
7 
8 bool IsSpanningOver2APV(unsigned int FirstStrip, unsigned int ClusterSize)
9 {
10  if(FirstStrip==0 ) return true;
11  if(FirstStrip==128 ) return true;
12  if(FirstStrip==256 ) return true;
13  if(FirstStrip==384 ) return true;
14  if(FirstStrip==512 ) return true;
15  if(FirstStrip==640 ) return true;
16 
17  if(FirstStrip<=127 && FirstStrip+ClusterSize>127) return true;
18  if(FirstStrip<=255 && FirstStrip+ClusterSize>255) return true;
19  if(FirstStrip<=383 && FirstStrip+ClusterSize>383) return true;
20  if(FirstStrip<=511 && FirstStrip+ClusterSize>511) return true;
21  if(FirstStrip<=639 && FirstStrip+ClusterSize>639) return true;
22 
23  if(FirstStrip+ClusterSize==127 ) return true;
24  if(FirstStrip+ClusterSize==255 ) return true;
25  if(FirstStrip+ClusterSize==383 ) return true;
26  if(FirstStrip+ClusterSize==511 ) return true;
27  if(FirstStrip+ClusterSize==639 ) return true;
28  if(FirstStrip+ClusterSize==767 ) return true;
29 
30  return false;
31 }
32 
33 
34 bool IsSaturatingStrip(const vector<uint8_t>& Ampls)
35 {
36  for(unsigned int i=0;i<Ampls.size();i++){
37  if(Ampls[i]>=254)return true;
38  }return false;
39 }
40 
41 
42 
43 double charge(const vector<uint8_t>& Ampls)
44 {
45  double charge = 0;
46  for(unsigned int a=0;a<Ampls.size();a++){charge+=Ampls[a];}
47  return charge;
48 }
49 
50 
51 double path(double cosine, double thickness)
52 {
53  return (10.0*thickness)/fabs(cosine);
54 }
55 
56 
58 {
59  if (dynamic_cast<const StripGeomDetUnit*>(it)==0 && dynamic_cast<const PixelGeomDetUnit*>(it)==0) {
60  std::cout << "this detID doesn't seem to belong to the Tracker" << std::endl;
61  return false;
62  }
63 
64  LocalPoint HitLocalPos = trajState.localPosition();
65  LocalError HitLocalError = trajState.localError().positionError() ;
66 
67  const BoundPlane plane = it->surface();
68  const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
69  const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
70 
71  double DistFromBorder = 1.0;
72  double HalfWidth = it->surface().bounds().width() /2.0;
73  double HalfLength = it->surface().bounds().length() /2.0;
74 
75  if(trapezoidalBounds)
76  {
77  std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
78  HalfLength = parameters[3];
79  double t = (HalfLength + HitLocalPos.y()) / (2*HalfLength) ;
80  HalfWidth = parameters[0] + (parameters[1]-parameters[0]) * t;
81  }else if(rectangularBounds){
82  HalfWidth = it->surface().bounds().width() /2.0;
83  HalfLength = it->surface().bounds().length() /2.0;
84  }else{return false;}
85 
86 // if (fabs(HitLocalPos.x())+HitLocalError.xx() >= (HalfWidth - DistFromBorder) ) return false;//Don't think is really necessary
87  if (fabs(HitLocalPos.y())+HitLocalError.yy() >= (HalfLength - DistFromBorder) ) return false;
88 
89  return true;
90 }
91 
92 }
double path(double cosine, double thickness)
int i
Definition: DBlmapReader.cc:9
virtual float length() const =0
T y() const
Definition: PV3DBase.h:57
double charge(const std::vector< uint8_t > &Ampls)
LocalError positionError() const
float yy() const
Definition: LocalError.h:21
bool IsFarFromBorder(TrajectoryStateOnSurface trajState, const GeomDetUnit *it)
bool IsSpanningOver2APV(unsigned int FirstStrip, unsigned int ClusterSize)
bool IsSaturatingStrip(const std::vector< uint8_t > &Ampls)
const LocalTrajectoryError & localError() const
const Bounds & bounds() const
Definition: BoundSurface.h:89
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:41
virtual float width() const =0
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37