CMS 3D CMS Logo

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 <cmath>
11 
12 DTOccupancyPoint::DTOccupancyPoint() : theMean(0.), theRMS(0.) {
13  debug = false; // FIXME: to be removed
14 }
15 
16 DTOccupancyPoint::DTOccupancyPoint(double mean, double rms) : theMean(mean), theRMS(rms) {
17  debug = false; // FIXME: to be removed
18 }
19 
21  : theMean(mean), theRMS(rms), theLayerId(layerId) {
22  debug = false; // FIXME: to be removed
23 }
24 
26 
27 double DTOccupancyPoint::mean() const { return theMean; }
28 
29 double DTOccupancyPoint::rms() const { return theRMS; }
30 
31 double DTOccupancyPoint::distance(const DTOccupancyPoint& anotherPoint) const {
32  return sqrt(deltaMean(anotherPoint) * deltaMean(anotherPoint) + deltaRMS(anotherPoint) * deltaRMS(anotherPoint));
33 }
34 
35 double DTOccupancyPoint::deltaMean(const DTOccupancyPoint& anotherPoint) const {
36  return fabs(mean() - anotherPoint.mean());
37 }
38 
39 double DTOccupancyPoint::deltaRMS(const DTOccupancyPoint& anotherPoint) const {
40  return fabs(rms() - anotherPoint.rms());
41 }
42 
44  // FIXME: should add the layer ID? not clear
45  if (theMean == other.mean() && theRMS == other.rms() && theLayerId == other.layerId())
46  return true;
47  return false;
48 }
49 
51  if (theMean != other.mean() || theRMS != other.rms() || theLayerId != other.layerId())
52  return true;
53  return false;
54 }
55 
58  return false;
59  }
60 
61  if (fabs(distance(DTOccupancyPoint()) - other.distance(DTOccupancyPoint())) < 0.000001) {
62  if (layerId().rawId() < other.layerId().rawId()) {
63  return true;
64  } else {
65  return false;
66  }
67  }
68 
70  return true;
71  return false;
72 }
73 
74 double computeAverageRMS(const DTOccupancyPoint& onePoint, const DTOccupancyPoint& anotherPoint) {
75  double ret = (onePoint.rms() + anotherPoint.rms()) / 2.;
76  return ret;
77 }
78 
79 double computeMinRMS(const DTOccupancyPoint& onePoint, const DTOccupancyPoint& anotherPoint) {
80  double ret = -1;
81  if (onePoint.rms() > anotherPoint.rms()) {
82  ret = anotherPoint.rms();
83  } else {
84  ret = onePoint.rms();
85  }
86  return ret;
87 }
88 
90 
ret
prodAgent to be discontinued
double mean() const
average cell occupancy in the layer
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
double deltaMean(const DTOccupancyPoint &anotherPoint) const
double computeAverageRMS(const DTOccupancyPoint &onePoint, const DTOccupancyPoint &anotherPoint)
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:19
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