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.

Date:
2008/10/16 09:33:39
Revision:
1.3
Author
G. Cerminara - INFN Torino

Definition at line 22 of file DTOccupancyCluster.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 22 of file DTOccupancyCluster.cc.

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

23  : radius(0),
24  theMaxMean(-1.),
25  theMaxRMS(-1.),
26  theMeanSum(0.),
27  theRMSSum(0.) {
28  if(!qualityCriterion(firstPoint,secondPoint)) {
29  theValidity = false;
30  } else {
31  // compute the cluster quantities
32  thePoints.push_back(firstPoint);
33  thePoints.push_back(secondPoint);
34  if(firstPoint.mean() > secondPoint.mean()) theMaxMean = firstPoint.mean();
35  else theMaxMean = secondPoint.mean();
36 
37  if(firstPoint.rms() > secondPoint.rms()) theMaxRMS = firstPoint.rms();
38  else theMaxRMS = secondPoint.rms();
39  theMeanSum += firstPoint.mean();
40  theRMSSum += firstPoint.rms();
41 
42  theMeanSum += secondPoint.mean();
43  theRMSSum += secondPoint.rms();
44 
45 
46  computeRadius();
47  }
48 }
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 52 of file DTOccupancyCluster.cc.

References thePoints, and theValidity.

52  : radius(0),
53  theMaxMean(singlePoint.mean()),
54  theMaxRMS(singlePoint.rms()),
55  theMeanSum(singlePoint.mean()),
56  theRMSSum(singlePoint.rms()) {
57  theValidity = true;
58 
59  // compute the cluster quantities
60  thePoints.push_back(singlePoint);
61 }
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 65 of file DTOccupancyCluster.cc.

65 {}

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

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

Referenced by DTOccupancyClusterBuilder::buildNewCluster().

78  {
79  LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest|DTOccupancyCluster")
80  << " Add a point to the cluster: mean: " << anotherPoint.mean()
81  << " rms: " << anotherPoint.rms() << endl;
82  if(qualityCriterion(anotherPoint)) {
83  LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest|DTOccupancyCluster") << " point is valid" << endl;
84  thePoints.push_back(anotherPoint);
85  // Compute the new cluster size
86  computeRadius();
87  // compute the max mean and RMS
88  if(anotherPoint.mean() > theMaxMean) {
89  theMaxMean = anotherPoint.mean();
90  }
91  if(anotherPoint.rms() > theMaxRMS) {
92  theMaxRMS = anotherPoint.rms();
93  }
94  theMeanSum += anotherPoint.mean();
95  theRMSSum += anotherPoint.rms();
96  return true;
97  }
98  return false;
99 }
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 120 of file DTOccupancyCluster.cc.

References theMeanSum, and thePoints.

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

120  {
121  return theMeanSum/(double)thePoints.size();
122 }
std::vector< DTOccupancyPoint > thePoints
double DTOccupancyCluster::averageRMS ( ) const

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

Definition at line 126 of file DTOccupancyCluster.cc.

References thePoints, and theRMSSum.

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

126  {
127  return theRMSSum/(double)thePoints.size();
128 }
std::vector< DTOccupancyPoint > thePoints
void DTOccupancyCluster::computeRadius ( )
private

Definition at line 216 of file DTOccupancyCluster.cc.

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

Referenced by addPoint(), and DTOccupancyCluster().

216  {
217  double radius_squared = 0;
218  for(vector<DTOccupancyPoint>::const_iterator pt_i = thePoints.begin();
219  pt_i != thePoints.end(); ++pt_i) {
220  for(vector<DTOccupancyPoint>::const_iterator pt_j = thePoints.begin();
221  pt_j != thePoints.end(); ++pt_j) {
222  radius_squared += TMath::Power(pt_i->distance(*pt_j),2);
223  }
224  }
225  radius_squared = radius_squared/(2*TMath::Power(thePoints.size()+1,2));
226  radius = sqrt(radius_squared);
227  // cout << " the new cluster radius is: " << radius << endl;
228 }
std::vector< DTOccupancyPoint > thePoints
T sqrt(T t)
Definition: SSEVec.h:46
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 105 of file DTOccupancyCluster.cc.

References DTOccupancyPoint::distance(), and thePoints.

Referenced by DTOccupancyClusterBuilder::computeDistancesToCluster().

105  {
106  double dist = 99999999;
107  // compute the minimum distance from a point
108  for(vector<DTOccupancyPoint>::const_iterator pt = thePoints.begin();
109  pt != thePoints.end(); ++pt) {
110  double distance = point.distance(*pt);
111  if(distance < dist) {
112  dist = distance;
113  }
114  }
115  return dist;
116 }
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 144 of file DTOccupancyCluster.cc.

References interpolateCardsSimple::histo, cmsRun_displayProdMFGeom_cfg::maxX, cmsRun_displayProdMFGeom_cfg::maxY, cmsRun_displayProdMFGeom_cfg::minX, cmsRun_displayProdMFGeom_cfg::minY, and thePoints.

145  {
146  TH2F *histo = new TH2F(histoName.c_str(),histoName.c_str(),
147  nBinsX, minX, maxX, nBinsY, minY, maxY);
148  histo->SetFillColor(fillColor);
149  for(vector<DTOccupancyPoint>::const_iterator pt = thePoints.begin();
150  pt != thePoints.end(); ++pt) {
151  histo->Fill((*pt).mean(), (*pt).rms());
152  }
153  return histo;
154 }
std::vector< DTOccupancyPoint > thePoints
set< DTLayerId > DTOccupancyCluster::getLayerIDs ( ) const

Definition at line 237 of file DTOccupancyCluster.cc.

References point, run_regression::ret, and thePoints.

237  {
238  set<DTLayerId> ret;
239  for(vector<DTOccupancyPoint>::const_iterator point = thePoints.begin();
240  point != thePoints.end(); ++point) {
241  ret.insert((*point).layerId());
242  }
243  return ret;
244 }
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 70 of file DTOccupancyCluster.cc.

References theValidity.

Referenced by DTOccupancyClusterBuilder::buildNewCluster().

70  {
71  return theValidity;
72 }
double DTOccupancyCluster::maxMean ( ) const

max average cell occupancy of the layers in the cluster

Definition at line 132 of file DTOccupancyCluster.cc.

References theMaxMean.

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

132  {
133  return theMaxMean;
134 }
double DTOccupancyCluster::maxRMS ( ) const

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

Definition at line 138 of file DTOccupancyCluster.cc.

References theMaxRMS.

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

138  {
139  return theMaxRMS;
140 }
int DTOccupancyCluster::nPoints ( ) const

of layers belonging to the cluster

Definition at line 232 of file DTOccupancyCluster.cc.

References thePoints.

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

232  {
233  return thePoints.size();
234 }
std::vector< DTOccupancyPoint > thePoints
bool DTOccupancyCluster::qualityCriterion ( const DTOccupancyPoint firstPoint,
const DTOccupancyPoint secondPoint 
)
private

Definition at line 158 of file DTOccupancyCluster.cc.

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

Referenced by addPoint(), and DTOccupancyCluster().

159  {
160  // cout << " Seed qualityCriterion results: " << endl;
161  // cout << " delta mean: " << firstPoint.deltaMean(secondPoint) << endl;
162  // cout << " delta rms: " << firstPoint.deltaRMS(secondPoint) << endl;
163  // cout << " average rms: " << computeAverageRMS(firstPoint, secondPoint) << endl;
164  // cout << " min rms: " << computeMinRMS(firstPoint, secondPoint) << endl;
165  if(firstPoint.deltaMean(secondPoint) < computeAverageRMS(firstPoint, secondPoint) &&
166  firstPoint.deltaRMS(secondPoint) < computeMinRMS(firstPoint, secondPoint)) {
167  theValidity = true;
168  // cout << " seed is valid!" << endl;
169  return true;
170  }
171  // cout << " seed is not valid!" << endl;
172  theValidity = false;
173  return false;
174 }
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 179 of file DTOccupancyCluster.cc.

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

179  {
180  // double minDistance = distance(anotherPoint);
181 
182  double minrms = 0;
183  if(anotherPoint.rms() < averageRMS()) minrms = anotherPoint.rms();
184  else minrms = averageRMS();
185 
186  // cout << " delta mean: " << fabs(averageMean() - anotherPoint.mean()) << endl;
187  // cout << " average RMS: " << fabs(averageRMS() + anotherPoint.rms())/2. << endl;
188  // cout << " delta rms: " << fabs(averageRMS() - anotherPoint.rms()) << endl;
189  // cout << " min rms: " << minrms << endl;
190  // if(fabs(averageMean() - anotherPoint.mean()) < fabs(averageRMS() + anotherPoint.rms())/2. &&
191  // fabs(averageRMS() - anotherPoint.rms()) < minrms) {
192 
193  if(fabs(averageMean() - anotherPoint.mean()) < averageRMS() &&
194  fabs(averageRMS() - anotherPoint.rms()) < 2*minrms/3.) {
195  theValidity = true;
196  // cout << " point is valid!" << endl;
197  return true;
198  }
199  // cout << " point is not valid!" << endl;
200  theValidity = false;
201  return false;
202 
203  // if(thePoints.size() == 1) return false;
204  // // Get the minimum distance from the point
205  // double minDistance = distance(anotherPoint);
206  // cout << " min distance from cluster is: " << minDistance << endl;
207  // cout << " radius is: " << radius << endl;
208  // // compare the minimum distance with the radius;
209  // if(minDistance < 2*radius) return true;
210  // else return false;
211 }
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 80 of file DTOccupancyCluster.h.

Referenced by computeRadius().

double DTOccupancyCluster::theMaxMean
private

Definition at line 83 of file DTOccupancyCluster.h.

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

double DTOccupancyCluster::theMaxRMS
private

Definition at line 84 of file DTOccupancyCluster.h.

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

double DTOccupancyCluster::theMeanSum
private

Definition at line 85 of file DTOccupancyCluster.h.

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

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

Definition at line 86 of file DTOccupancyCluster.h.

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

bool DTOccupancyCluster::theValidity
private

Definition at line 79 of file DTOccupancyCluster.h.

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