CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/CondFormats/SiPixelObjects/interface/SiPixelQuality.h

Go to the documentation of this file.
00001 // SiPixelQuality.h
00002 //
00003 // class definition to hold a list of disabled pixel modules
00004 //
00005 // M. Eads
00006 // Apr 2008
00007 
00008 #ifndef SiPixelQuality_H
00009 #define SiPixelQuality_H
00010 
00011 #include <vector>
00012 #include <utility>
00013 
00014 #include "DataFormats/DetId/interface/DetId.h"
00015 #include "CondFormats/SiPixelObjects/interface/GlobalPixel.h"
00016 #include "FWCore/Framework/interface/ESHandle.h"
00017 #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
00018 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
00019 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h"
00020 #include "CondFormats/SiPixelObjects/interface/PixelROC.h"
00021 #include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
00022 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00023 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
00024 
00025 class SiPixelQuality {
00026 
00027  public:
00028   struct disabledModuleType { 
00029     uint32_t DetID;  
00030     int      errorType;
00031     unsigned short BadRocs;
00032   };
00033 
00035       //  errortype "whole" = int 0 in DB //
00036       //  errortype "tbmA" = int 1 in DB  //
00037       //  errortype "tbmB" = int 2 in DB  //
00038       //  errortype "none" = int 3 in DB  //
00040 
00042       //each bad roc correspond to a bit to 1: num=  //
00043       // 0 <-> all good rocs                         //
00044       // 1 <-> only roc 0 bad                        //
00045       // 2<-> only roc 1 bad                         //
00046       // 3<->  roc 0 and 1 bad                       //
00047       // 4 <-> only roc 2 bad                        //
00048       //  ...                                        //
00050 
00051 
00052 
00053 
00054 
00055   class BadComponentStrictWeakOrdering{
00056   public:
00057     bool operator() (const disabledModuleType& p,const uint32_t i) const {return p.DetID < i;}
00058     bool operator() (const disabledModuleType& p,const disabledModuleType& q) const {return p.DetID < q.DetID;}   
00059   };
00060 
00061 
00062 
00063   SiPixelQuality() : theDisabledModules(0) {;}
00064 
00065   // constructor from a list of disabled modules
00066   SiPixelQuality(std::vector<disabledModuleType> & disabledModules) : theDisabledModules(disabledModules) {;}
00067 
00068   virtual ~SiPixelQuality() {;}
00069 
00070   // set the list of disabled modules (current list is lost)
00071   void setDisabledModuleList(std::vector<disabledModuleType> & disabledModules) 
00072   { theDisabledModules = disabledModules; }
00073 
00074   // add a single module to the vector of disabled modules
00075   void addDisabledModule(disabledModuleType module)
00076   { theDisabledModules.push_back(module); }
00077 
00078   // add a vector of modules to the vector of disabled modules
00079   void addDisabledModule(std::vector<disabledModuleType> & idVector);
00080 
00081   // remove disabled module from the list
00082   // returns false if id not in disable list, true otherwise
00083   //  bool removeDisabledModule(const disabledModuleType & module);
00084   //   bool removeDisabledModule(const uint32_t & detid); 
00085 
00086 
00087 //--------------- Interface for the user -----------------//
00088 //------- designed to match SiStripQuality methods ----------//
00089 
00090 
00091 
00092   bool IsModuleBad(const uint32_t & detid) const;  //returns True if module disabled
00093   bool IsModuleUsable(const uint32_t& detid) const;  //returns True if module NOT disabled
00094   bool IsRocBad(const uint32_t& detid, const short& rocNb) const;  //returns True if ROC is disabled
00095   bool IsAreaBad(uint32_t detid, sipixelobjects::GlobalPixel global,  const edm::EventSetup& es, const SiPixelFedCabling* map ) const;
00096   short getBadRocs(const uint32_t& detid) const;  //returns bad Rocs for given DetId
00097   //each bad roc correspond to a bit to 1: num=
00098   //0 <-> all good rocs
00099   //1 <-> only roc 0 bad
00100   //2<-> only roc 1 bad
00101   //3<->  roc 0 and 1 bad
00102   // 4 <-> only roc 2 bad
00103   //...
00104   const std::vector<disabledModuleType> getBadComponentList() const  //returns list of disabled modules/ROCs
00105     { return theDisabledModules; }
00106   const std::vector< LocalPoint > getBadRocPositions(const uint32_t & detid, const TrackerGeometry& theTracker, const SiPixelFedCabling* map ) const; 
00107     //  const std::vector< std::pair <uint8_t, uint8_t> > getBadRocPositions(const uint32_t & detid,  const edm::EventSetup& es, const SiPixelFedCabling* map ) const; 
00108 
00109 
00110 
00111  private:
00112   std::vector<disabledModuleType> theDisabledModules;
00113   bool IsFedBad(const uint32_t & detid) const; 
00114 
00115 }; // class SiPixelQuality
00116 
00117 
00118 #endif