Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:36

0001 #ifndef SIPIXELDETECTORSTATUS_h
0002 #define SIPIXELDETECTORSTATUS_h
0003 
0004 #include <ctime>
0005 #include <map>
0006 #include <string>
0007 
0008 #include "CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h"
0009 
0010 // ----------------------------------------------------------------------
0011 class SiPixelDetectorStatus {
0012 public:
0013   SiPixelDetectorStatus();
0014   ~SiPixelDetectorStatus();
0015 
0016   // reset
0017   void resetDetectorStatus();
0018   // combine detector status
0019   void updateDetectorStatus(SiPixelDetectorStatus newData);
0020 
0021   // file I/O
0022   void readFromFile(std::string filename);
0023   void dumpToFile(std::ofstream& outFile);
0024 
0025   /*|||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
0026 
0027   // add SiPixelModuleStatus for detID, specifying nrocs
0028   void addModule(int detid, int nrocs);
0029   // add a SiPixelModuleStatus obj for detID
0030   void addModule(int detid, SiPixelModuleStatus a);
0031   // get a Module
0032   bool findModule(int detid);
0033   SiPixelModuleStatus* getModule(int detid);
0034 
0035   // fill hit in double idc in ROC roc into module detid
0036   void fillDIGI(int detid, int roc);
0037   // fill FEDerror25 info
0038   void fillFEDerror25(int detid, PixelFEDChannel ch);
0039 
0040   // detector status : std:map - collection of module status
0041   std::map<int, SiPixelModuleStatus> getDetectorStatus() { return fModules_; }
0042   // list of ROCs with FEDerror25
0043   std::map<int, std::vector<int>> getFEDerror25Rocs();
0044   // total number of DIGIs
0045   unsigned long int digiOccDET() { return fDetHits_; }
0046   // total processed events
0047   void setNevents(unsigned long int N) { ftotalevents_ = N; }
0048   unsigned long int getNevents() { return ftotalevents_; }
0049 
0050   // number of modules in detector
0051   int nmodules();
0052   // determine detector average nhits and RMS
0053   double perRocDigiOcc();
0054   double perRocDigiOccVar();
0055 
0056   // set the time stamps
0057   void setRunRange(int run0, int run1) {
0058     fRun0_ = run0;
0059     fRun1_ = run1;
0060   }
0061   std::pair<int, int> getRunRange() { return std::make_pair(fRun0_, fRun1_); }
0062   //////////////////////////////////////////////////////////////////////////////////
0063   void setLSRange(int ls0, int ls1) {
0064     fLS0_ = ls0;
0065     fLS1_ = ls1;
0066   }
0067   std::pair<int, int> getLSRange() { return std::make_pair(fLS0_, fLS1_); }
0068 
0069   // provide for iterating over the entire detector
0070   std::map<int, SiPixelModuleStatus>::iterator begin();
0071   std::map<int, SiPixelModuleStatus>::iterator next();
0072   std::map<int, SiPixelModuleStatus>::iterator end();
0073 
0074 private:
0075   std::map<int, SiPixelModuleStatus> fModules_;
0076 
0077   // first and last lumisection seen in this instance
0078   int fLS0_, fLS1_;
0079   // first and last run (should be the same number! as currently only perform Single Run Harvestor)
0080   int fRun0_, fRun1_;
0081 
0082   // number of events processed
0083   unsigned long int ftotalevents_;
0084 
0085   // total hits in detector
0086   unsigned long int fDetHits_;
0087 };
0088 
0089 #endif