#include <DQM/DTMonitorClient/src/DTOccupancyCluster.h>
Public Member Functions | |
bool | addPoint (const DTOccupancyPoint &anotherPoint) |
Add a point to the cluster: returns false if the point does not satisfy the quality requirement. | |
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 |
Compute the distance of a single point from the cluster (minimum distance with respect to the cluster points). | |
DTOccupancyCluster (const DTOccupancyPoint &singlePoint) | |
Constructor. | |
DTOccupancyCluster (const DTOccupancyPoint &firstPoint, const DTOccupancyPoint &secondPoint) | |
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< DTLayerId > | getLayerIDs () 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 &anotherPoint) |
bool | qualityCriterion (const DTOccupancyPoint &firstPoint, const DTOccupancyPoint &secondPoint) |
Private Attributes | |
double | radius |
double | theMaxMean |
double | theMaxRMS |
double | theMeanSum |
std::vector< DTOccupancyPoint > | thePoints |
double | theRMSSum |
bool | theValidity |
Layers are clusterized in the plane average cell occupancy - RMS of the cell occupancies.
Definition at line 22 of file DTOccupancyCluster.h.
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.
00023 : radius(0), 00024 theMaxMean(-1.), 00025 theMaxRMS(-1.), 00026 theMeanSum(0.), 00027 theRMSSum(0.) { 00028 if(!qualityCriterion(firstPoint,secondPoint)) { 00029 theValidity = false; 00030 } else { 00031 // compute the cluster quantities 00032 thePoints.push_back(firstPoint); 00033 thePoints.push_back(secondPoint); 00034 if(firstPoint.mean() > secondPoint.mean()) theMaxMean = firstPoint.mean(); 00035 else theMaxMean = secondPoint.mean(); 00036 00037 if(firstPoint.rms() > secondPoint.rms()) theMaxRMS = firstPoint.rms(); 00038 else theMaxRMS = secondPoint.rms(); 00039 theMeanSum += firstPoint.mean(); 00040 theRMSSum += firstPoint.rms(); 00041 00042 theMeanSum += secondPoint.mean(); 00043 theRMSSum += secondPoint.rms(); 00044 00045 00046 computeRadius(); 00047 } 00048 }
DTOccupancyCluster::DTOccupancyCluster | ( | const DTOccupancyPoint & | singlePoint | ) |
Constructor.
Definition at line 52 of file DTOccupancyCluster.cc.
References thePoints, and theValidity.
00052 : radius(0), 00053 theMaxMean(singlePoint.mean()), 00054 theMaxRMS(singlePoint.rms()), 00055 theMeanSum(singlePoint.mean()), 00056 theRMSSum(singlePoint.rms()) { 00057 theValidity = true; 00058 00059 // compute the cluster quantities 00060 thePoints.push_back(singlePoint); 00061 }
DTOccupancyCluster::~DTOccupancyCluster | ( | ) | [virtual] |
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(), lat::endl(), LogTrace, DTOccupancyPoint::mean(), qualityCriterion(), DTOccupancyPoint::rms(), theMaxMean, theMaxRMS, theMeanSum, thePoints, and theRMSSum.
Referenced by DTOccupancyClusterBuilder::buildNewCluster().
00078 { 00079 LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest|DTOccupancyCluster") 00080 << " Add a point to the cluster: mean: " << anotherPoint.mean() 00081 << " rms: " << anotherPoint.rms() << endl; 00082 if(qualityCriterion(anotherPoint)) { 00083 LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest|DTOccupancyCluster") << " point is valid" << endl; 00084 thePoints.push_back(anotherPoint); 00085 // Compute the new cluster size 00086 computeRadius(); 00087 // compute the max mean and RMS 00088 if(anotherPoint.mean() > theMaxMean) { 00089 theMaxMean = anotherPoint.mean(); 00090 } 00091 if(anotherPoint.rms() > theMaxRMS) { 00092 theMaxRMS = anotherPoint.rms(); 00093 } 00094 theMeanSum += anotherPoint.mean(); 00095 theRMSSum += anotherPoint.rms(); 00096 return true; 00097 } 00098 return false; 00099 }
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().
00120 { 00121 return theMeanSum/(double)thePoints.size(); 00122 }
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().
void DTOccupancyCluster::computeRadius | ( | ) | [private] |
Definition at line 216 of file DTOccupancyCluster.cc.
References radius, funct::sqrt(), and thePoints.
Referenced by addPoint(), and DTOccupancyCluster().
00216 { 00217 double radius_squared = 0; 00218 for(vector<DTOccupancyPoint>::const_iterator pt_i = thePoints.begin(); 00219 pt_i != thePoints.end(); ++pt_i) { 00220 for(vector<DTOccupancyPoint>::const_iterator pt_j = thePoints.begin(); 00221 pt_j != thePoints.end(); ++pt_j) { 00222 radius_squared += TMath::Power(pt_i->distance(*pt_j),2); 00223 } 00224 } 00225 radius_squared = radius_squared/(2*TMath::Power(thePoints.size()+1,2)); 00226 radius = sqrt(radius_squared); 00227 // cout << " the new cluster radius is: " << radius << endl; 00228 }
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 dist(), DTOccupancyPoint::distance(), and thePoints.
Referenced by DTOccupancyClusterBuilder::computeDistancesToCluster().
00105 { 00106 double dist = 99999999; 00107 // compute the minimum distance from a point 00108 for(vector<DTOccupancyPoint>::const_iterator pt = thePoints.begin(); 00109 pt != thePoints.end(); ++pt) { 00110 double distance = point.distance(*pt); 00111 if(distance < dist) { 00112 dist = distance; 00113 } 00114 } 00115 return dist; 00116 }
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 histo, and thePoints.
00145 { 00146 TH2F *histo = new TH2F(histoName.c_str(),histoName.c_str(), 00147 nBinsX, minX, maxX, nBinsY, minY, maxY); 00148 histo->SetFillColor(fillColor); 00149 for(vector<DTOccupancyPoint>::const_iterator pt = thePoints.begin(); 00150 pt != thePoints.end(); ++pt) { 00151 histo->Fill((*pt).mean(), (*pt).rms()); 00152 } 00153 return histo; 00154 }
set< DTLayerId > DTOccupancyCluster::getLayerIDs | ( | ) | const |
Definition at line 237 of file DTOccupancyCluster.cc.
References thePoints.
00237 { 00238 set<DTLayerId> ret; 00239 for(vector<DTOccupancyPoint>::const_iterator point = thePoints.begin(); 00240 point != thePoints.end(); ++point) { 00241 ret.insert((*point).layerId()); 00242 } 00243 return ret; 00244 }
Check if the cluster candidate satisfies the quality requirements.
Definition at line 70 of file DTOccupancyCluster.cc.
References theValidity.
Referenced by DTOccupancyClusterBuilder::buildNewCluster().
00070 { 00071 return theValidity; 00072 }
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().
00132 { 00133 return theMaxMean; 00134 }
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().
00138 { 00139 return theMaxRMS; 00140 }
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().
00232 { 00233 return thePoints.size(); 00234 }
bool DTOccupancyCluster::qualityCriterion | ( | const DTOccupancyPoint & | anotherPoint | ) | [private] |
Definition at line 179 of file DTOccupancyCluster.cc.
References averageMean(), averageRMS(), DTOccupancyPoint::mean(), DTOccupancyPoint::rms(), and theValidity.
00179 { 00180 // double minDistance = distance(anotherPoint); 00181 00182 double minrms = 0; 00183 if(anotherPoint.rms() < averageRMS()) minrms = anotherPoint.rms(); 00184 else minrms = averageRMS(); 00185 00186 // cout << " delta mean: " << fabs(averageMean() - anotherPoint.mean()) << endl; 00187 // cout << " average RMS: " << fabs(averageRMS() + anotherPoint.rms())/2. << endl; 00188 // cout << " delta rms: " << fabs(averageRMS() - anotherPoint.rms()) << endl; 00189 // cout << " min rms: " << minrms << endl; 00190 // if(fabs(averageMean() - anotherPoint.mean()) < fabs(averageRMS() + anotherPoint.rms())/2. && 00191 // fabs(averageRMS() - anotherPoint.rms()) < minrms) { 00192 00193 if(fabs(averageMean() - anotherPoint.mean()) < averageRMS() && 00194 fabs(averageRMS() - anotherPoint.rms()) < 2*minrms/3.) { 00195 theValidity = true; 00196 // cout << " point is valid!" << endl; 00197 return true; 00198 } 00199 // cout << " point is not valid!" << endl; 00200 theValidity = false; 00201 return false; 00202 00203 // if(thePoints.size() == 1) return false; 00204 // // Get the minimum distance from the point 00205 // double minDistance = distance(anotherPoint); 00206 // cout << " min distance from cluster is: " << minDistance << endl; 00207 // cout << " radius is: " << radius << endl; 00208 // // compare the minimum distance with the radius; 00209 // if(minDistance < 2*radius) return true; 00210 // else return false; 00211 }
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().
00159 { 00160 // cout << " Seed qualityCriterion results: " << endl; 00161 // cout << " delta mean: " << firstPoint.deltaMean(secondPoint) << endl; 00162 // cout << " delta rms: " << firstPoint.deltaRMS(secondPoint) << endl; 00163 // cout << " average rms: " << computeAverageRMS(firstPoint, secondPoint) << endl; 00164 // cout << " min rms: " << computeMinRMS(firstPoint, secondPoint) << endl; 00165 if(firstPoint.deltaMean(secondPoint) < computeAverageRMS(firstPoint, secondPoint) && 00166 firstPoint.deltaRMS(secondPoint) < computeMinRMS(firstPoint, secondPoint)) { 00167 theValidity = true; 00168 // cout << " seed is valid!" << endl; 00169 return true; 00170 } 00171 // cout << " seed is not valid!" << endl; 00172 theValidity = false; 00173 return false; 00174 }
double DTOccupancyCluster::radius [private] |
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] |
Definition at line 81 of file DTOccupancyCluster.h.
Referenced by addPoint(), averageMean(), averageRMS(), computeRadius(), distance(), DTOccupancyCluster(), getHisto(), getLayerIDs(), and nPoints().
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().