CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTOccupancyCluster Class Reference

#include <DTOccupancyCluster.h>

Public Member Functions

bool addPoint (const DTOccupancyPoint &anotherPoint)
 
double averageMean () const
 average cell occupancy of the layers in the cluster More...
 
double averageRMS () const
 average RMS of the cell occpuancy distributions of the layers in the cluster More...
 
double distance (const DTOccupancyPoint &point) const
 
 DTOccupancyCluster (const DTOccupancyPoint &firstPoint, const DTOccupancyPoint &secondPoint)
 Constructor. More...
 
 DTOccupancyCluster (const DTOccupancyPoint &singlePoint)
 Constructor. More...
 
TH2F * getHisto (std::string histoName, int nBinsX, double minX, double maxX, int nBinsY, double minY, double maxY, int fillColor) const
 get a TH2F displaying the cluster More...
 
std::set< DTLayerIdgetLayerIDs () const
 
bool isValid () const
 Check if the cluster candidate satisfies the quality requirements. More...
 
double maxMean () const
 max average cell occupancy of the layers in the cluster More...
 
double maxRMS () const
 max RMS of the cell occpuancy distributions of the layers in the cluster More...
 
int nPoints () const
 

of layers belonging to the cluster

More...
 
virtual ~DTOccupancyCluster ()
 Destructor. More...
 

Private Member Functions

void computeRadius ()
 
bool qualityCriterion (const DTOccupancyPoint &firstPoint, const DTOccupancyPoint &secondPoint)
 
bool qualityCriterion (const DTOccupancyPoint &anotherPoint)
 

Private Attributes

double radius
 
double theMaxMean
 
double theMaxRMS
 
double theMeanSum
 
std::vector< DTOccupancyPointthePoints
 
double theRMSSum
 
bool theValidity
 

Detailed Description

Cluster of DTOccupancyPoint used bt DTOccupancyTest to spot problematic layers. Layers are clusterized in the plane average cell occupancy - RMS of the cell occupancies.

Author
G. Cerminara - INFN Torino

Definition at line 20 of file DTOccupancyCluster.h.

Constructor & Destructor Documentation

◆ DTOccupancyCluster() [1/2]

DTOccupancyCluster::DTOccupancyCluster ( const DTOccupancyPoint firstPoint,
const DTOccupancyPoint secondPoint 
)

Constructor.

Definition at line 19 of file DTOccupancyCluster.cc.

References computeRadius(), DTOccupancyPoint::mean(), qualityCriterion(), DTOccupancyPoint::rms(), theMaxMean, theMaxRMS, theMeanSum, thePoints, theRMSSum, and theValidity.

20  : radius(0), theMaxMean(-1.), theMaxRMS(-1.), theMeanSum(0.), theRMSSum(0.) {
21  if (!qualityCriterion(firstPoint, secondPoint)) {
22  theValidity = false;
23  } else {
24  // compute the cluster quantities
25  thePoints.push_back(firstPoint);
26  thePoints.push_back(secondPoint);
27  if (firstPoint.mean() > secondPoint.mean())
28  theMaxMean = firstPoint.mean();
29  else
30  theMaxMean = secondPoint.mean();
31 
32  if (firstPoint.rms() > secondPoint.rms())
33  theMaxRMS = firstPoint.rms();
34  else
35  theMaxRMS = secondPoint.rms();
36  theMeanSum += firstPoint.mean();
37  theRMSSum += firstPoint.rms();
38 
39  theMeanSum += secondPoint.mean();
40  theRMSSum += secondPoint.rms();
41 
42  computeRadius();
43  }
44 }
double mean() const
average cell occupancy in the layer
std::vector< DTOccupancyPoint > thePoints
double rms() const
RMS of the distribution of the cell occupancies in the layer.
bool qualityCriterion(const DTOccupancyPoint &firstPoint, const DTOccupancyPoint &secondPoint)

◆ DTOccupancyCluster() [2/2]

DTOccupancyCluster::DTOccupancyCluster ( const DTOccupancyPoint singlePoint)

Constructor.

Definition at line 46 of file DTOccupancyCluster.cc.

References thePoints, and theValidity.

47  : radius(0),
48  theMaxMean(singlePoint.mean()),
49  theMaxRMS(singlePoint.rms()),
50  theMeanSum(singlePoint.mean()),
51  theRMSSum(singlePoint.rms()) {
52  theValidity = true;
53 
54  // compute the cluster quantities
55  thePoints.push_back(singlePoint);
56 }
double mean() const
average cell occupancy in the layer
std::vector< DTOccupancyPoint > thePoints
double rms() const
RMS of the distribution of the cell occupancies in the layer.

◆ ~DTOccupancyCluster()

DTOccupancyCluster::~DTOccupancyCluster ( )
virtual

Destructor.

Definition at line 58 of file DTOccupancyCluster.cc.

58 {}

Member Function Documentation

◆ addPoint()

bool DTOccupancyCluster::addPoint ( const DTOccupancyPoint anotherPoint)

Add a point to the cluster: returns false if the point does not satisfy the quality requirement

Definition at line 65 of file DTOccupancyCluster.cc.

References computeRadius(), LogTrace, DTOccupancyPoint::mean(), qualityCriterion(), DTOccupancyPoint::rms(), theMaxMean, theMaxRMS, theMeanSum, thePoints, and theRMSSum.

Referenced by DTOccupancyClusterBuilder::buildNewCluster().

65  {
66  LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest|DTOccupancyCluster")
67  << " Add a point to the cluster: mean: " << anotherPoint.mean() << " rms: " << anotherPoint.rms() << endl;
68  if (qualityCriterion(anotherPoint)) {
69  LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest|DTOccupancyCluster") << " point is valid" << endl;
70  thePoints.push_back(anotherPoint);
71  // Compute the new cluster size
72  computeRadius();
73  // compute the max mean and RMS
74  if (anotherPoint.mean() > theMaxMean) {
75  theMaxMean = anotherPoint.mean();
76  }
77  if (anotherPoint.rms() > theMaxRMS) {
78  theMaxRMS = anotherPoint.rms();
79  }
80  theMeanSum += anotherPoint.mean();
81  theRMSSum += anotherPoint.rms();
82  return true;
83  }
84  return false;
85 }
double mean() const
average cell occupancy in the layer
#define LogTrace(id)
std::vector< DTOccupancyPoint > thePoints
double rms() const
RMS of the distribution of the cell occupancies in the layer.
bool qualityCriterion(const DTOccupancyPoint &firstPoint, const DTOccupancyPoint &secondPoint)

◆ averageMean()

double DTOccupancyCluster::averageMean ( ) const

average cell occupancy of the layers in the cluster

Definition at line 101 of file DTOccupancyCluster.cc.

References theMeanSum, and thePoints.

Referenced by DTOccupancyClusterBuilder::buildNewCluster(), clusterIsLessThan(), and qualityCriterion().

101 { return theMeanSum / (double)thePoints.size(); }
std::vector< DTOccupancyPoint > thePoints

◆ averageRMS()

double DTOccupancyCluster::averageRMS ( ) const

average RMS of the cell occpuancy distributions of the layers in the cluster

Definition at line 103 of file DTOccupancyCluster.cc.

References thePoints, and theRMSSum.

Referenced by DTOccupancyClusterBuilder::buildNewCluster(), clusterIsLessThan(), and qualityCriterion().

103 { return theRMSSum / (double)thePoints.size(); }
std::vector< DTOccupancyPoint > thePoints

◆ computeRadius()

void DTOccupancyCluster::computeRadius ( )
private

Definition at line 153 of file DTOccupancyCluster.cc.

References radius, mathSSE::sqrt(), and thePoints.

Referenced by addPoint(), and DTOccupancyCluster().

153  {
154  double radius_squared = 0;
155  for (vector<DTOccupancyPoint>::const_iterator pt_i = thePoints.begin(); pt_i != thePoints.end(); ++pt_i) {
156  for (vector<DTOccupancyPoint>::const_iterator pt_j = thePoints.begin(); pt_j != thePoints.end(); ++pt_j) {
157  radius_squared += TMath::Power(pt_i->distance(*pt_j), 2);
158  }
159  }
160  radius_squared = radius_squared / (2 * TMath::Power(thePoints.size() + 1, 2));
161  radius = sqrt(radius_squared);
162 }
std::vector< DTOccupancyPoint > thePoints
T sqrt(T t)
Definition: SSEVec.h:19

◆ distance()

double DTOccupancyCluster::distance ( const DTOccupancyPoint point) const

Compute the distance of a single point from the cluster (minimum distance with respect to the cluster points)

Definition at line 89 of file DTOccupancyCluster.cc.

References point, DiDispStaMuonMonitor_cfi::pt, and thePoints.

Referenced by DTOccupancyClusterBuilder::computeDistancesToCluster().

89  {
90  double dist = 99999999;
91  // compute the minimum distance from a point
92  for (vector<DTOccupancyPoint>::const_iterator pt = thePoints.begin(); pt != thePoints.end(); ++pt) {
93  double distance = point.distance(*pt);
94  if (distance < dist) {
95  dist = distance;
96  }
97  }
98  return dist;
99 }
std::vector< DTOccupancyPoint > thePoints
double distance(const DTOccupancyPoint &point) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

◆ getHisto()

TH2F * DTOccupancyCluster::getHisto ( std::string  histoName,
int  nBinsX,
double  minX,
double  maxX,
int  nBinsY,
double  minY,
double  maxY,
int  fillColor 
) const

◆ getLayerIDs()

set< DTLayerId > DTOccupancyCluster::getLayerIDs ( ) const

Definition at line 166 of file DTOccupancyCluster.cc.

References point, runTheMatrix::ret, and thePoints.

166  {
167  set<DTLayerId> ret;
168  for (vector<DTOccupancyPoint>::const_iterator point = thePoints.begin(); point != thePoints.end(); ++point) {
169  ret.insert((*point).layerId());
170  }
171  return ret;
172 }
ret
prodAgent to be discontinued
std::vector< DTOccupancyPoint > thePoints
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

◆ isValid()

bool DTOccupancyCluster::isValid ( void  ) const

Check if the cluster candidate satisfies the quality requirements.

Definition at line 61 of file DTOccupancyCluster.cc.

References theValidity.

Referenced by ntupleDataFormat._Object::_checkIsValid(), DTOccupancyClusterBuilder::buildNewCluster(), and core.AutoHandle.AutoHandle::ReallyLoad().

61 { return theValidity; }

◆ maxMean()

double DTOccupancyCluster::maxMean ( ) const

max average cell occupancy of the layers in the cluster

Definition at line 105 of file DTOccupancyCluster.cc.

References theMaxMean.

Referenced by DTOccupancyClusterBuilder::buildClusters(), and DTOccupancyClusterBuilder::buildNewCluster().

105 { return theMaxMean; }

◆ maxRMS()

double DTOccupancyCluster::maxRMS ( ) const

max RMS of the cell occpuancy distributions of the layers in the cluster

Definition at line 107 of file DTOccupancyCluster.cc.

References theMaxRMS.

Referenced by DTOccupancyClusterBuilder::buildClusters(), and DTOccupancyClusterBuilder::buildNewCluster().

107 { return theMaxRMS; }

◆ nPoints()

int DTOccupancyCluster::nPoints ( ) const

of layers belonging to the cluster

Definition at line 164 of file DTOccupancyCluster.cc.

References thePoints.

Referenced by DTOccupancyClusterBuilder::buildNewCluster(), and clusterIsLessThan().

164 { return thePoints.size(); }
std::vector< DTOccupancyPoint > thePoints

◆ qualityCriterion() [1/2]

bool DTOccupancyCluster::qualityCriterion ( const DTOccupancyPoint firstPoint,
const DTOccupancyPoint secondPoint 
)
private

Definition at line 125 of file DTOccupancyCluster.cc.

References computeAverageRMS(), computeMinRMS(), DTOccupancyPoint::deltaMean(), DTOccupancyPoint::deltaRMS(), and theValidity.

Referenced by addPoint(), and DTOccupancyCluster().

125  {
126  if (firstPoint.deltaMean(secondPoint) < computeAverageRMS(firstPoint, secondPoint) &&
127  firstPoint.deltaRMS(secondPoint) < computeMinRMS(firstPoint, secondPoint)) {
128  theValidity = true;
129 
130  return true;
131  }
132 
133  theValidity = false;
134  return false;
135 }
double deltaRMS(const DTOccupancyPoint &anotherPoint) const
double computeAverageRMS(const DTOccupancyPoint &onePoint, const DTOccupancyPoint &anotherPoint)
double computeMinRMS(const DTOccupancyPoint &onePoint, const DTOccupancyPoint &anotherPoint)
double deltaMean(const DTOccupancyPoint &anotherPoint) const

◆ qualityCriterion() [2/2]

bool DTOccupancyCluster::qualityCriterion ( const DTOccupancyPoint anotherPoint)
private

Definition at line 137 of file DTOccupancyCluster.cc.

References averageMean(), averageRMS(), DTOccupancyPoint::mean(), DTOccupancyPoint::rms(), and theValidity.

137  {
138  double minrms = 0;
139  if (anotherPoint.rms() < averageRMS())
140  minrms = anotherPoint.rms();
141  else
142  minrms = averageRMS();
143 
144  if (fabs(averageMean() - anotherPoint.mean()) < averageRMS() &&
145  fabs(averageRMS() - anotherPoint.rms()) < 2 * minrms / 3.) {
146  theValidity = true;
147  return true;
148  }
149  theValidity = false;
150  return false;
151 }
double averageRMS() const
average RMS of the cell occpuancy distributions of the layers in the cluster
double averageMean() const
average cell occupancy of the layers in the cluster
double mean() const
average cell occupancy in the layer
double rms() const
RMS of the distribution of the cell occupancies in the layer.

Member Data Documentation

◆ radius

double DTOccupancyCluster::radius
private

Definition at line 82 of file DTOccupancyCluster.h.

Referenced by computeRadius().

◆ theMaxMean

double DTOccupancyCluster::theMaxMean
private

Definition at line 85 of file DTOccupancyCluster.h.

Referenced by addPoint(), DTOccupancyCluster(), and maxMean().

◆ theMaxRMS

double DTOccupancyCluster::theMaxRMS
private

Definition at line 86 of file DTOccupancyCluster.h.

Referenced by addPoint(), DTOccupancyCluster(), and maxRMS().

◆ theMeanSum

double DTOccupancyCluster::theMeanSum
private

Definition at line 87 of file DTOccupancyCluster.h.

Referenced by addPoint(), averageMean(), and DTOccupancyCluster().

◆ thePoints

std::vector<DTOccupancyPoint> DTOccupancyCluster::thePoints
private

◆ theRMSSum

double DTOccupancyCluster::theRMSSum
private

Definition at line 88 of file DTOccupancyCluster.h.

Referenced by addPoint(), averageRMS(), and DTOccupancyCluster().

◆ theValidity

bool DTOccupancyCluster::theValidity
private

Definition at line 81 of file DTOccupancyCluster.h.

Referenced by DTOccupancyCluster(), isValid(), and qualityCriterion().