Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:34

0001 #ifndef SiPixelPerformanceSummary_h
0002 #define SiPixelPerformanceSummary_h
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include <vector>
0007 #include <map>
0008 #include <iostream>
0009 #include <cstdint>
0010 
0011 #define kDetSummarySize 60  // float numbers kept in DetSummary.performanceValues
0012 #define kDefaultValue -99.9
0013 
0014 class SiPixelPerformanceSummary {
0015 public:
0016   struct DetSummary {
0017     uint32_t detId_;
0018     std::vector<float> performanceValues_;
0019 
0020     COND_SERIALIZABLE;
0021   };
0022 
0023   class StrictWeakOrdering {  // sort detSummaries by detId
0024   public:
0025     bool operator()(const DetSummary& detSumm, const uint32_t& otherDetId) const {
0026       return (detSumm.detId_ < otherDetId);
0027     };
0028   };
0029 
0030 public:
0031   SiPixelPerformanceSummary(const SiPixelPerformanceSummary&);
0032   SiPixelPerformanceSummary();
0033   ~SiPixelPerformanceSummary();
0034 
0035   void clear();
0036 
0037   unsigned int size() { return allDetSummaries_.size(); }
0038 
0039   void setTimeStamp(unsigned long long timeStamp) { timeStamp_ = timeStamp; }
0040   unsigned long long getTimeStamp() const { return timeStamp_; }
0041 
0042   void setRunNumber(unsigned int runNumber) { runNumber_ = runNumber; }
0043   unsigned int getRunNumber() const { return runNumber_; }
0044 
0045   void setNumberOfEvents(unsigned int numberOfEvents) { numberOfEvents_ = numberOfEvents; }
0046   unsigned int getNumberOfEvents() const { return numberOfEvents_; }
0047 
0048   void setLuminosityBlock(unsigned int lumBlock) { luminosityBlock_ = lumBlock; }
0049   unsigned int getLuminosityBlock() const { return luminosityBlock_; };
0050 
0051   void print() const;
0052   void print(const uint32_t detId) const;
0053   void printAll() const;
0054 
0055   std::vector<uint32_t> getAllDetIds() const;
0056   std::vector<DetSummary> getAllDetSummaries() const { return allDetSummaries_; }
0057   std::vector<float> getDetSummary(uint32_t detId) const;
0058 
0059   // RawData
0060   bool setRawDataErrorType(uint32_t detId, int bin, float nErrors);
0061   // Digi
0062   bool setNumberOfDigis(uint32_t detId, float mean, float rms, float emPtn);
0063   bool setADC(uint32_t detId, float mean, float rms, float emPtn);
0064   // Cluster
0065   bool setNumberOfClusters(uint32_t detId, float mean, float rms, float emPtn);
0066   bool setClusterCharge(uint32_t detId, float mean, float rms, float emPtn);
0067   bool setClusterSize(uint32_t detId, float mean, float rms, float emPtn);
0068   bool setClusterSizeX(uint32_t detId, float mean, float rms, float emPtn);
0069   bool setClusterSizeY(uint32_t detId, float mean, float rms, float emPtn);
0070   // RecHit
0071   bool setNumberOfRecHits(uint32_t detId, float mean, float rms, float emPtn);
0072   // TrackResidual
0073   bool setResidualX(uint32_t detId, float mean, float rms, float emPtn);
0074   bool setResidualY(uint32_t detId, float mean, float rms, float emPtn);
0075   //
0076   bool setNumberOfNoisCells(uint32_t detId, float nNpixCells);  // N=4,1..
0077   bool setNumberOfDeadCells(uint32_t detId, float nNpixCells);  // N=4,1..
0078   bool setNumberOfPixelHitsInTrackFit(uint32_t detId, float nPixelHits);
0079   // Track
0080   bool setFractionOfTracks(uint32_t detId, float mean, float rms);
0081   bool setNumberOfOnTrackClusters(uint32_t detId, float nClusters);
0082   bool setNumberOfOffTrackClusters(uint32_t detId, float nClusters);
0083   bool setClusterChargeOnTrack(uint32_t detId, float mean, float rms);
0084   bool setClusterChargeOffTrack(uint32_t detId, float mean, float rms);
0085   bool setClusterSizeOnTrack(uint32_t detId, float mean, float rms);
0086   bool setClusterSizeOffTrack(uint32_t detId, float mean, float rms);
0087 
0088 private:
0089   std::pair<bool, std::vector<DetSummary>::iterator> initDet(const uint32_t detId);
0090   std::pair<bool, std::vector<DetSummary>::iterator> setDet(const uint32_t detId,
0091                                                             const std::vector<float>& performanceValues);
0092   bool setValue(uint32_t detId, int index, float performanceValue);
0093   float getValue(uint32_t detId, int index);
0094 
0095 private:
0096   unsigned long long timeStamp_;
0097   unsigned int runNumber_;
0098   unsigned int luminosityBlock_;
0099   unsigned int numberOfEvents_;
0100 
0101   std::vector<DetSummary> allDetSummaries_;
0102 
0103   COND_SERIALIZABLE;
0104 };
0105 
0106 #endif