CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::DTOccupancyCluster ( const DTOccupancyPoint firstPoint,
const DTOccupancyPoint secondPoint 
)

Constructor.

Definition at line 20 of file DTOccupancyCluster.cc.

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

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

Constructor.

Definition at line 50 of file DTOccupancyCluster.cc.

References thePoints, and theValidity.

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

Destructor.

Definition at line 61 of file DTOccupancyCluster.cc.

61 {}

Member Function Documentation

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 70 of file DTOccupancyCluster.cc.

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

Referenced by DTOccupancyClusterBuilder::buildNewCluster().

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

average cell occupancy of the layers in the cluster

Definition at line 112 of file DTOccupancyCluster.cc.

References theMeanSum, and thePoints.

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

112  {
113  return theMeanSum/(double)thePoints.size();
114 }
std::vector< DTOccupancyPoint > thePoints
double DTOccupancyCluster::averageRMS ( ) const

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

Definition at line 118 of file DTOccupancyCluster.cc.

References thePoints, and theRMSSum.

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

118  {
119  return theRMSSum/(double)thePoints.size();
120 }
std::vector< DTOccupancyPoint > thePoints
void DTOccupancyCluster::computeRadius ( )
private

Definition at line 179 of file DTOccupancyCluster.cc.

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

Referenced by addPoint(), and DTOccupancyCluster().

179  {
180  double radius_squared = 0;
181  for(vector<DTOccupancyPoint>::const_iterator pt_i = thePoints.begin();
182  pt_i != thePoints.end(); ++pt_i) {
183  for(vector<DTOccupancyPoint>::const_iterator pt_j = thePoints.begin();
184  pt_j != thePoints.end(); ++pt_j) {
185  radius_squared += TMath::Power(pt_i->distance(*pt_j),2);
186  }
187  }
188  radius_squared = radius_squared/(2*TMath::Power(thePoints.size()+1,2));
189  radius = sqrt(radius_squared);
190 }
std::vector< DTOccupancyPoint > thePoints
T sqrt(T t)
Definition: SSEVec.h:18
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 97 of file DTOccupancyCluster.cc.

References DTOccupancyPoint::distance(), EnergyCorrector::pt, and thePoints.

Referenced by DTOccupancyClusterBuilder::computeDistancesToCluster().

97  {
98  double dist = 99999999;
99  // compute the minimum distance from a point
100  for(vector<DTOccupancyPoint>::const_iterator pt = thePoints.begin();
101  pt != thePoints.end(); ++pt) {
102  double distance = point.distance(*pt);
103  if(distance < dist) {
104  dist = distance;
105  }
106  }
107  return dist;
108 }
std::vector< DTOccupancyPoint > thePoints
double distance(const DTOccupancyPoint &anotherPoint) const
distance from another point in the 2D plane
double distance(const DTOccupancyPoint &point) const
TH2F * DTOccupancyCluster::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

Definition at line 136 of file DTOccupancyCluster.cc.

References timingPdfMaker::histo, EnergyCorrector::pt, and thePoints.

137  {
138  TH2F *histo = new TH2F(histoName.c_str(),histoName.c_str(),
139  nBinsX, minX, maxX, nBinsY, minY, maxY);
140  histo->SetFillColor(fillColor);
141  for(vector<DTOccupancyPoint>::const_iterator pt = thePoints.begin();
142  pt != thePoints.end(); ++pt) {
143  histo->Fill((*pt).mean(), (*pt).rms());
144  }
145  return histo;
146 }
std::vector< DTOccupancyPoint > thePoints
set< DTLayerId > DTOccupancyCluster::getLayerIDs ( ) const

Definition at line 199 of file DTOccupancyCluster.cc.

References point, runTheMatrix::ret, and thePoints.

199  {
200  set<DTLayerId> ret;
201  for(vector<DTOccupancyPoint>::const_iterator point = thePoints.begin();
202  point != thePoints.end(); ++point) {
203  ret.insert((*point).layerId());
204  }
205  return ret;
206 }
tuple 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
bool DTOccupancyCluster::isValid ( void  ) const

Check if the cluster candidate satisfies the quality requirements.

Definition at line 64 of file DTOccupancyCluster.cc.

References theValidity.

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

64  {
65  return theValidity;
66 }
double DTOccupancyCluster::maxMean ( ) const

max average cell occupancy of the layers in the cluster

Definition at line 124 of file DTOccupancyCluster.cc.

References theMaxMean.

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

124  {
125  return theMaxMean;
126 }
double DTOccupancyCluster::maxRMS ( ) const

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

Definition at line 130 of file DTOccupancyCluster.cc.

References theMaxRMS.

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

130  {
131  return theMaxRMS;
132 }
int DTOccupancyCluster::nPoints ( ) const

of layers belonging to the cluster

Definition at line 194 of file DTOccupancyCluster.cc.

References thePoints.

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

194  {
195  return thePoints.size();
196 }
std::vector< DTOccupancyPoint > thePoints
bool DTOccupancyCluster::qualityCriterion ( const DTOccupancyPoint firstPoint,
const DTOccupancyPoint secondPoint 
)
private

Definition at line 150 of file DTOccupancyCluster.cc.

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

Referenced by addPoint(), and DTOccupancyCluster().

151  {
152 
153  if(firstPoint.deltaMean(secondPoint) < computeAverageRMS(firstPoint, secondPoint) &&
154  firstPoint.deltaRMS(secondPoint) < computeMinRMS(firstPoint, secondPoint)) {
155  theValidity = true;
156 
157  return true;
158  }
159 
160  theValidity = false;
161  return false;
162 }
double deltaMean(const DTOccupancyPoint &anotherPoint) const
double computeAverageRMS(const DTOccupancyPoint &onePoint, const DTOccupancyPoint &anotherPoint)
double deltaRMS(const DTOccupancyPoint &anotherPoint) const
double computeMinRMS(const DTOccupancyPoint &onePoint, const DTOccupancyPoint &anotherPoint)
bool DTOccupancyCluster::qualityCriterion ( const DTOccupancyPoint anotherPoint)
private

Definition at line 164 of file DTOccupancyCluster.cc.

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

164  {
165 
166  double minrms = 0;
167  if(anotherPoint.rms() < averageRMS()) minrms = anotherPoint.rms();
168  else minrms = averageRMS();
169 
170  if(fabs(averageMean() - anotherPoint.mean()) < averageRMS() &&
171  fabs(averageRMS() - anotherPoint.rms()) < 2*minrms/3.) {
172  theValidity = true;
173  return true;
174  }
175  theValidity = false;
176  return false;
177 }
double mean() const
average cell occupancy in the layer
double averageRMS() const
average RMS of the cell occpuancy distributions of the layers in the cluster
double rms() const
RMS of the distribution of the cell occupancies in the layer.
double averageMean() const
average cell occupancy of the layers in the cluster

Member Data Documentation

double DTOccupancyCluster::radius
private

Definition at line 78 of file DTOccupancyCluster.h.

Referenced by computeRadius().

double DTOccupancyCluster::theMaxMean
private

Definition at line 81 of file DTOccupancyCluster.h.

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

double DTOccupancyCluster::theMaxRMS
private

Definition at line 82 of file DTOccupancyCluster.h.

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

double DTOccupancyCluster::theMeanSum
private

Definition at line 83 of file DTOccupancyCluster.h.

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

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

Definition at line 84 of file DTOccupancyCluster.h.

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

bool DTOccupancyCluster::theValidity
private

Definition at line 77 of file DTOccupancyCluster.h.

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