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  * $Date: 2008/07/24 12:23:09 $
6  * $Revision: 1.3 $
7  * \author G. Cerminara - INFN Torino
8  */
9 
10 #include "DTOccupancyPoint.h"
11 
12 #include <math.h>
13 
14 
15 
17  theRMS(0.) {
18  debug = false; // FIXME: to be removed
19 
20 }
21 
22 
23 
24 DTOccupancyPoint::DTOccupancyPoint(double mean, double rms) : theMean(mean),
25  theRMS(rms) {
26  debug = false; // FIXME: to be removed
27 }
28 
29 
30 DTOccupancyPoint::DTOccupancyPoint(double mean, double rms, DTLayerId layerId) : theMean(mean),
31  theRMS(rms),
32  theLayerId(layerId) {
33  debug = false; // FIXME: to be removed
34 }
35 
36 
37 
39 
40 
41 
42 
43 double DTOccupancyPoint::mean() const {
44  return theMean;
45 }
46 
47 
48 
49 double DTOccupancyPoint::rms() const {
50  return theRMS;
51 }
52 
53 
54 
55 double DTOccupancyPoint::distance(const DTOccupancyPoint& anotherPoint) const {
56  return sqrt(deltaMean(anotherPoint)*deltaMean(anotherPoint) +
57  deltaRMS(anotherPoint)* deltaRMS(anotherPoint));
58 }
59 
60 
61 
62 double DTOccupancyPoint::deltaMean(const DTOccupancyPoint& anotherPoint) const {
63  return fabs(mean() - anotherPoint.mean());
64 }
65 
66 
67 
68 double DTOccupancyPoint::deltaRMS(const DTOccupancyPoint& anotherPoint) const {
69  return fabs(rms() - anotherPoint.rms());
70 }
71 
72 
73 
75  // FIXME: should add the layer ID? not clear
76  if(theMean == other.mean() &&
77  theRMS == other.rms() &&
78  theLayerId == other.layerId()) return true;
79  return false;
80 }
81 
82 
83 
85  if(theMean != other.mean() ||
86  theRMS != other.rms() ||
87  theLayerId != other.layerId()) return true;
88  return false;
89 }
90 
91 
92 
95  return false;
96  }
97 
98  if(fabs(distance(DTOccupancyPoint()) - other.distance(DTOccupancyPoint())) < 0.000001) {
99  if(layerId().rawId() < other.layerId().rawId()) {
100  return true;
101  } else {
102  return false;
103  }
104  }
105 
106  if(distance(DTOccupancyPoint()) < other.distance(DTOccupancyPoint())) return true;
107  return false;
108 }
109 
110 
111 
112 double computeAverageRMS(const DTOccupancyPoint& onePoint, const DTOccupancyPoint& anotherPoint) {
113  double ret = (onePoint.rms() + anotherPoint.rms())/2.;
114  return ret;
115 }
116 
117 
118 
119 double computeMinRMS(const DTOccupancyPoint& onePoint, const DTOccupancyPoint& anotherPoint) {
120  double ret = -1;
121  if(onePoint.rms() > anotherPoint.rms()) {
122  ret = anotherPoint.rms();
123  } else {
124  ret = onePoint.rms();
125  }
126  return ret;
127 }
128 
129 
130 
133 }
134 
135 
137  return theLayerId;
138 }
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:45
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:28
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