test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTOccupancyPoint.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * \author G. Cerminara - INFN Torino
6  */
7 
8 #include "DTOccupancyPoint.h"
9 
10 #include <math.h>
11 
12 
13 
15  theRMS(0.) {
16  debug = false; // FIXME: to be removed
17 
18 }
19 
20 
21 
22 DTOccupancyPoint::DTOccupancyPoint(double mean, double rms) : theMean(mean),
23  theRMS(rms) {
24  debug = false; // FIXME: to be removed
25 }
26 
27 
28 DTOccupancyPoint::DTOccupancyPoint(double mean, double rms, DTLayerId layerId) : theMean(mean),
29  theRMS(rms),
30  theLayerId(layerId) {
31  debug = false; // FIXME: to be removed
32 }
33 
34 
35 
37 
38 
39 
40 
41 double DTOccupancyPoint::mean() const {
42  return theMean;
43 }
44 
45 
46 
47 double DTOccupancyPoint::rms() const {
48  return theRMS;
49 }
50 
51 
52 
53 double DTOccupancyPoint::distance(const DTOccupancyPoint& anotherPoint) const {
54  return sqrt(deltaMean(anotherPoint)*deltaMean(anotherPoint) +
55  deltaRMS(anotherPoint)* deltaRMS(anotherPoint));
56 }
57 
58 
59 
60 double DTOccupancyPoint::deltaMean(const DTOccupancyPoint& anotherPoint) const {
61  return fabs(mean() - anotherPoint.mean());
62 }
63 
64 
65 
66 double DTOccupancyPoint::deltaRMS(const DTOccupancyPoint& anotherPoint) const {
67  return fabs(rms() - anotherPoint.rms());
68 }
69 
70 
71 
73  // FIXME: should add the layer ID? not clear
74  if(theMean == other.mean() &&
75  theRMS == other.rms() &&
76  theLayerId == other.layerId()) return true;
77  return false;
78 }
79 
80 
81 
83  if(theMean != other.mean() ||
84  theRMS != other.rms() ||
85  theLayerId != other.layerId()) return true;
86  return false;
87 }
88 
89 
90 
93  return false;
94  }
95 
96  if(fabs(distance(DTOccupancyPoint()) - other.distance(DTOccupancyPoint())) < 0.000001) {
97  if(layerId().rawId() < other.layerId().rawId()) {
98  return true;
99  } else {
100  return false;
101  }
102  }
103 
104  if(distance(DTOccupancyPoint()) < other.distance(DTOccupancyPoint())) return true;
105  return false;
106 }
107 
108 
109 
110 double computeAverageRMS(const DTOccupancyPoint& onePoint, const DTOccupancyPoint& anotherPoint) {
111  double ret = (onePoint.rms() + anotherPoint.rms())/2.;
112  return ret;
113 }
114 
115 
116 
117 double computeMinRMS(const DTOccupancyPoint& onePoint, const DTOccupancyPoint& anotherPoint) {
118  double ret = -1;
119  if(onePoint.rms() > anotherPoint.rms()) {
120  ret = anotherPoint.rms();
121  } else {
122  ret = onePoint.rms();
123  }
124  return ret;
125 }
126 
127 
128 
131 }
132 
133 
135  return theLayerId;
136 }
double mean() const
average cell occupancy in the layer
double deltaMean(const DTOccupancyPoint &anotherPoint) const
double computeAverageRMS(const DTOccupancyPoint &onePoint, const DTOccupancyPoint &anotherPoint)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
double deltaRMS(const DTOccupancyPoint &anotherPoint) const
double rms() const
RMS of the distribution of the cell occupancies in the layer.
double computeMinRMS(const DTOccupancyPoint &onePoint, const DTOccupancyPoint &anotherPoint)
T sqrt(T t)
Definition: SSEVec.h:48
DTOccupancyPoint()
Constructor.
bool operator==(const DTOccupancyPoint &other) const
bool operator!=(const DTOccupancyPoint &other) const
bool operator<(const DTOccupancyPoint &other) const
virtual ~DTOccupancyPoint()
Destructor.
double distance(const DTOccupancyPoint &anotherPoint) const
distance from another point in the 2D plane
void setLayerId(DTLayerId layerId)
DTLayerId layerId() const