Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // SiPixelQuality.h
0002 //
0003 // class definition to hold a list of disabled pixel modules
0004 //
0005 // M. Eads
0006 // Apr 2008
0007 
0008 #ifndef SiPixelQuality_H
0009 #define SiPixelQuality_H
0010 
0011 #include "CondFormats/Serialization/interface/Serializable.h"
0012 
0013 #include <vector>
0014 #include <utility>
0015 
0016 #include "DataFormats/DetId/interface/DetId.h"
0017 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0018 #include "CondFormats/SiPixelObjects/interface/GlobalPixel.h"
0019 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
0020 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h"
0021 #include "CondFormats/SiPixelObjects/interface/PixelROC.h"
0022 #include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
0023 #include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h"
0024 
0025 class TrackerGeometry;
0026 
0027 class SiPixelQuality {
0028 public:
0029   struct disabledModuleType {
0030     uint32_t DetID;
0031     int errorType;
0032     unsigned short BadRocs;
0033 
0034     COND_SERIALIZABLE;
0035   };
0036 
0037   //////////////////////////////////////
0038   //  errortype "whole" = int 0 in DB //
0039   //  errortype "tbmA" = int 1 in DB  //
0040   //  errortype "tbmB" = int 2 in DB  //
0041   //  errortype "none" = int 3 in DB  //
0042   //////////////////////////////////////
0043 
0044   /////////////////////////////////////////////////
0045   //each bad roc correspond to a bit to 1: num=  //
0046   // 0 <-> all good rocs                         //
0047   // 1 <-> only roc 0 bad                        //
0048   // 2<-> only roc 1 bad                         //
0049   // 3<->  roc 0 and 1 bad                       //
0050   // 4 <-> only roc 2 bad                        //
0051   //  ...                                        //
0052   /////////////////////////////////////////////////
0053 
0054   class BadComponentStrictWeakOrdering {
0055   public:
0056     bool operator()(const disabledModuleType& p, const uint32_t i) const { return p.DetID < i; }
0057     bool operator()(const disabledModuleType& p, const disabledModuleType& q) const { return p.DetID < q.DetID; }
0058   };
0059 
0060   SiPixelQuality() : theDisabledModules(0) { ; }
0061 
0062   // constructor from a list of disabled modules
0063   SiPixelQuality(std::vector<disabledModuleType>& disabledModules) : theDisabledModules(disabledModules) { ; }
0064 
0065   virtual ~SiPixelQuality() { ; }
0066 
0067   // set the list of disabled modules (current list is lost)
0068   void setDisabledModuleList(std::vector<disabledModuleType>& disabledModules) { theDisabledModules = disabledModules; }
0069 
0070   // add a single module to the vector of disabled modules
0071   void addDisabledModule(disabledModuleType module) { theDisabledModules.push_back(module); }
0072 
0073   // add a vector of modules to the vector of disabled modules
0074   void addDisabledModule(std::vector<disabledModuleType>& idVector);
0075 
0076   // remove disabled module from the list
0077   // returns false if id not in disable list, true otherwise
0078   //  bool removeDisabledModule(const disabledModuleType & module);
0079   //   bool removeDisabledModule(const uint32_t & detid);
0080 
0081   //--------------- Interface for the user -----------------//
0082   //------- designed to match SiStripQuality methods ----------//
0083   //method copied from the SiStripQuality
0084   void add(const SiStripDetVOff*);
0085   //----------------------------------------
0086   //number of Bad modules
0087   int BadModuleNumber();
0088 
0089   bool IsModuleBad(const uint32_t& detid) const;                   //returns True if module disabled
0090   bool IsModuleUsable(const uint32_t& detid) const;                //returns True if module NOT disabled
0091   bool IsRocBad(const uint32_t& detid, const short& rocNb) const;  //returns True if ROC is disabled
0092   short getBadRocs(const uint32_t& detid) const;                   //returns bad Rocs for given DetId
0093   //each bad roc correspond to a bit to 1: num=
0094   //0 <-> all good rocs
0095   //1 <-> only roc 0 bad
0096   //2<-> only roc 1 bad
0097   //3<->  roc 0 and 1 bad
0098   // 4 <-> only roc 2 bad
0099   //...
0100   const std::vector<disabledModuleType> getBadComponentList() const  //returns list of disabled modules/ROCs
0101   {
0102     return theDisabledModules;
0103   }
0104   const std::vector<LocalPoint> getBadRocPositions(const uint32_t& detid,
0105                                                    const TrackerGeometry& theTracker,
0106                                                    const SiPixelFedCabling* map) const;
0107   //  const std::vector< std::pair <uint8_t, uint8_t> > getBadRocPositions(const uint32_t & detid,  const edm::EventSetup& es, const SiPixelFedCabling* map ) const;
0108 
0109 private:
0110   std::vector<disabledModuleType> theDisabledModules;
0111   bool IsFedBad(const uint32_t& detid) const;
0112 
0113   COND_SERIALIZABLE;
0114 };  // class SiPixelQuality
0115 
0116 #endif