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

63 {}

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

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

Referenced by DTOccupancyClusterBuilder::buildNewCluster().

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

References theMeanSum, and thePoints.

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

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

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

Definition at line 124 of file DTOccupancyCluster.cc.

References thePoints, and theRMSSum.

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

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

Definition at line 214 of file DTOccupancyCluster.cc.

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

Referenced by addPoint(), and DTOccupancyCluster().

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

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

Referenced by DTOccupancyClusterBuilder::computeDistancesToCluster().

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

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

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

Definition at line 235 of file DTOccupancyCluster.cc.

References point, run_regression::ret, and thePoints.

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

References theValidity.

Referenced by DTOccupancyClusterBuilder::buildNewCluster().

68  {
69  return theValidity;
70 }
double DTOccupancyCluster::maxMean ( ) const

max average cell occupancy of the layers in the cluster

Definition at line 130 of file DTOccupancyCluster.cc.

References theMaxMean.

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

130  {
131  return theMaxMean;
132 }
double DTOccupancyCluster::maxRMS ( ) const

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

Definition at line 136 of file DTOccupancyCluster.cc.

References theMaxRMS.

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

136  {
137  return theMaxRMS;
138 }
int DTOccupancyCluster::nPoints ( ) const

of layers belonging to the cluster

Definition at line 230 of file DTOccupancyCluster.cc.

References thePoints.

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

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

Definition at line 156 of file DTOccupancyCluster.cc.

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

Referenced by addPoint(), and DTOccupancyCluster().

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

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

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