Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:05

0001 #ifndef DTOccupancyCluster_H
0002 #define DTOccupancyCluster_H
0003 
0004 /** \class DTOccupancyCluster
0005  *  Cluster of DTOccupancyPoint used bt DTOccupancyTest to spot problematic layers.
0006  *  Layers are clusterized in the plane average cell occupancy - RMS of the cell occupancies.
0007  *  
0008  *  \author G. Cerminara - INFN Torino
0009  */
0010 
0011 #include "DTOccupancyPoint.h"
0012 
0013 #include <vector>
0014 #include <string>
0015 #include <cmath>
0016 #include <set>
0017 
0018 class TH2F;
0019 
0020 class DTOccupancyCluster {
0021 public:
0022   /// Constructor
0023   // Contruct the cluster from a couple of point
0024   DTOccupancyCluster(const DTOccupancyPoint& firstPoint, const DTOccupancyPoint& secondPoint);
0025 
0026   /// Constructor
0027   // Contruct the cluster from a single point: you can not add points to such a cluster
0028   DTOccupancyCluster(const DTOccupancyPoint& singlePoint);
0029 
0030   /// Destructor
0031   virtual ~DTOccupancyCluster();
0032 
0033   // Operations
0034 
0035   /// Check if the cluster candidate satisfies the quality requirements
0036   bool isValid() const;
0037 
0038   /// Add a point to the cluster: returns false if the point does not satisfy the
0039   /// quality requirement
0040   bool addPoint(const DTOccupancyPoint& anotherPoint);
0041 
0042   /// Compute the distance of a single point from the cluster
0043   /// (minimum distance with respect to the cluster points)
0044   double distance(const DTOccupancyPoint& point) const;
0045 
0046   /// average cell occupancy of the layers in the cluster
0047   double averageMean() const;
0048 
0049   /// average RMS of the cell occpuancy distributions of the layers in the cluster
0050   double averageRMS() const;
0051 
0052   /// max average cell occupancy of the layers in the cluster
0053   double maxMean() const;
0054 
0055   /// max RMS of the cell occpuancy distributions of the layers in the cluster
0056   double maxRMS() const;
0057 
0058   /// get a TH2F displaying the cluster
0059   TH2F* getHisto(std::string histoName,
0060                  int nBinsX,
0061                  double minX,
0062                  double maxX,
0063                  int nBinsY,
0064                  double minY,
0065                  double maxY,
0066                  int fillColor) const;
0067 
0068   /// # of layers belonging to the cluster
0069   int nPoints() const;
0070 
0071   std::set<DTLayerId> getLayerIDs() const;
0072 
0073 protected:
0074 private:
0075   bool qualityCriterion(const DTOccupancyPoint& firstPoint, const DTOccupancyPoint& secondPoint);
0076 
0077   bool qualityCriterion(const DTOccupancyPoint& anotherPoint);
0078 
0079   void computeRadius();
0080 
0081   bool theValidity;
0082   double radius;
0083   std::vector<DTOccupancyPoint> thePoints;
0084 
0085   double theMaxMean;
0086   double theMaxRMS;
0087   double theMeanSum;
0088   double theRMSSum;
0089 };
0090 
0091 /// for DTOccupancyCluster sorting
0092 bool clusterIsLessThan(const DTOccupancyCluster& clusterOne, const DTOccupancyCluster& clusterTwo);
0093 
0094 #endif