CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTOccupancyCluster Class Reference

#include <DTOccupancyCluster.h>

List of all members.

Public Member Functions

bool addPoint (const DTOccupancyPoint &anotherPoint)
double averageMean () const
 average cell occupancy of the layers in the cluster
double averageRMS () const
 average RMS of the cell occpuancy distributions of the layers in the cluster
double distance (const DTOccupancyPoint &point) const
 DTOccupancyCluster (const DTOccupancyPoint &firstPoint, const DTOccupancyPoint &secondPoint)
 Constructor.
 DTOccupancyCluster (const DTOccupancyPoint &singlePoint)
 Constructor.
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
std::set< DTLayerIdgetLayerIDs () const
bool isValid () const
 Check if the cluster candidate satisfies the quality requirements.
double maxMean () const
 max average cell occupancy of the layers in the cluster
double maxRMS () const
 max RMS of the cell occpuancy distributions of the layers in the cluster
int nPoints () const
 # of layers belonging to the cluster
virtual ~DTOccupancyCluster ()
 Destructor.

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.

                                                                            : radius(0),
                                                                              theMaxMean(-1.),
                                                                              theMaxRMS(-1.),
                                                                              theMeanSum(0.),
                                                                              theRMSSum(0.) {
  if(!qualityCriterion(firstPoint,secondPoint)) {
    theValidity = false;
  } else {
    // compute the cluster quantities
    thePoints.push_back(firstPoint);
    thePoints.push_back(secondPoint);
    if(firstPoint.mean() > secondPoint.mean()) theMaxMean = firstPoint.mean();
    else theMaxMean = secondPoint.mean();

    if(firstPoint.rms() > secondPoint.rms()) theMaxRMS = firstPoint.rms();
    else theMaxRMS = secondPoint.rms();
    theMeanSum += firstPoint.mean();
    theRMSSum += firstPoint.rms();

    theMeanSum += secondPoint.mean();
    theRMSSum += secondPoint.rms();


    computeRadius();
  }
}
DTOccupancyCluster::DTOccupancyCluster ( const DTOccupancyPoint singlePoint)

Constructor.

Definition at line 52 of file DTOccupancyCluster.cc.

References thePoints, and theValidity.

                                                                          : radius(0),
                                                                              theMaxMean(singlePoint.mean()),
                                                                              theMaxRMS(singlePoint.rms()),
                                                                              theMeanSum(singlePoint.mean()),
                                                                              theRMSSum(singlePoint.rms()) {
  theValidity = true;

  // compute the cluster quantities
  thePoints.push_back(singlePoint);
}
DTOccupancyCluster::~DTOccupancyCluster ( ) [virtual]

Destructor.

Definition at line 65 of file DTOccupancyCluster.cc.

{}

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().

                                                                      {
  LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest|DTOccupancyCluster")
    << "   Add a point to the cluster: mean: " << anotherPoint.mean()
    << " rms: " << anotherPoint.rms() << endl;
  if(qualityCriterion(anotherPoint)) {
    LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest|DTOccupancyCluster") << "   point is valid" << endl;
    thePoints.push_back(anotherPoint);
    // Compute the new cluster size
    computeRadius();
    // compute the max mean and RMS
    if(anotherPoint.mean() > theMaxMean) {
      theMaxMean = anotherPoint.mean();
    }
    if(anotherPoint.rms() > theMaxRMS) {
      theMaxRMS = anotherPoint.rms();
    }
    theMeanSum += anotherPoint.mean();
    theRMSSum += anotherPoint.rms();
    return true;
  } 
  return false;
}
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().

                                              {
  return theMeanSum/(double)thePoints.size();
}
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().

                                             {
  return theRMSSum/(double)thePoints.size();
}
void DTOccupancyCluster::computeRadius ( ) [private]

Definition at line 216 of file DTOccupancyCluster.cc.

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

Referenced by addPoint(), and DTOccupancyCluster().

                                       {
  double radius_squared = 0;
  for(vector<DTOccupancyPoint>::const_iterator pt_i = thePoints.begin();
      pt_i != thePoints.end(); ++pt_i) {
    for(vector<DTOccupancyPoint>::const_iterator pt_j = thePoints.begin();
        pt_j != thePoints.end(); ++pt_j) {
      radius_squared += TMath::Power(pt_i->distance(*pt_j),2);
    }
  }
  radius_squared = radius_squared/(2*TMath::Power(thePoints.size()+1,2));
  radius = sqrt(radius_squared);
  //   cout << "    the new cluster radius is: " << radius << endl;
}
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().

                                                                       {
  double dist = 99999999;
  // compute the minimum distance from a point
  for(vector<DTOccupancyPoint>::const_iterator pt = thePoints.begin();
      pt != thePoints.end(); ++pt) {
    double distance = point.distance(*pt);
    if(distance < dist) {
      dist = distance;
    }
  }
  return dist;
}
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 timingPdfMaker::histo, displayMF_cfg::maxX, displayMF_cfg::maxY, displayMF_cfg::minX, displayMF_cfg::minY, and thePoints.

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

Definition at line 237 of file DTOccupancyCluster.cc.

References point, runTheMatrix::ret, and thePoints.

                                                     {
  set<DTLayerId> ret;
  for(vector<DTOccupancyPoint>::const_iterator point = thePoints.begin();
      point != thePoints.end(); ++point) {
    ret.insert((*point).layerId());
  }
  return ret;
}
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().

                                       {
  return theValidity;
}
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().

                                          {
  return theMaxMean;
}
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().

                                         {
  return theMaxRMS;
}
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().

                                      {
  return thePoints.size();
}
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().

                                                                               {
  //   cout << "   Seed qualityCriterion results: " << endl;
  //   cout << "      delta mean: " << firstPoint.deltaMean(secondPoint) << endl;
  //   cout << "      delta rms: " << firstPoint.deltaRMS(secondPoint) << endl;
  //   cout << "      average rms: " << computeAverageRMS(firstPoint, secondPoint) << endl;
  //   cout << "      min rms: " << computeMinRMS(firstPoint, secondPoint) << endl;
  if(firstPoint.deltaMean(secondPoint) <  computeAverageRMS(firstPoint, secondPoint) &&
     firstPoint.deltaRMS(secondPoint) < computeMinRMS(firstPoint, secondPoint)) {
    theValidity = true;
    //     cout << "    seed is valid!" << endl;
    return true;
  }  
  //   cout << "    seed is not valid!" << endl;
  theValidity = false;
  return false;
}
bool DTOccupancyCluster::qualityCriterion ( const DTOccupancyPoint anotherPoint) [private]

Definition at line 179 of file DTOccupancyCluster.cc.

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

                                                                               {
  //   double minDistance = distance(anotherPoint);

  double minrms = 0;
  if(anotherPoint.rms() < averageRMS()) minrms = anotherPoint.rms();
  else minrms = averageRMS();

  //   cout << "  delta mean: " <<   fabs(averageMean() - anotherPoint.mean()) << endl;
  //   cout << "  average RMS: " << fabs(averageRMS() + anotherPoint.rms())/2. << endl;
  //   cout << "  delta rms: " <<  fabs(averageRMS() - anotherPoint.rms()) << endl;
  //   cout << " min rms: " << minrms << endl;
  //   if(fabs(averageMean() - anotherPoint.mean()) < fabs(averageRMS() + anotherPoint.rms())/2. &&
  //      fabs(averageRMS() - anotherPoint.rms()) < minrms) {

  if(fabs(averageMean() - anotherPoint.mean()) < averageRMS() &&
     fabs(averageRMS() - anotherPoint.rms()) < 2*minrms/3.) {
    theValidity = true;
    //     cout << "    point is valid!" << endl;
    return true;
  }  
  //   cout << "    point is not valid!" << endl;
  theValidity = false;
  return false;

  //   if(thePoints.size() == 1) return false;
  //   // Get the minimum distance from the point
  //   double minDistance = distance(anotherPoint);
  //   cout << "     min distance from cluster is: " << minDistance << endl;
  //   cout << "     radius is: " << radius << endl;
  //   // compare the minimum distance with the radius;
  //   if(minDistance < 2*radius) return true;
  //   else return false;
}

Member Data Documentation

double DTOccupancyCluster::radius [private]

Definition at line 80 of file DTOccupancyCluster.h.

Referenced by computeRadius().

Definition at line 83 of file DTOccupancyCluster.h.

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

Definition at line 84 of file DTOccupancyCluster.h.

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

Definition at line 85 of file DTOccupancyCluster.h.

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

Definition at line 86 of file DTOccupancyCluster.h.

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

Definition at line 79 of file DTOccupancyCluster.h.

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