CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/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 "CondFormats/SiStripObjects/interface/SiStripDetVOff.h"
00023 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00024 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
00025 
00026 class SiPixelQuality {
00027 
00028  public:
00029   struct disabledModuleType { 
00030     uint32_t DetID;  
00031     int      errorType;
00032     unsigned short BadRocs;
00033   };
00034 
00036       //  errortype "whole" = int 0 in DB //
00037       //  errortype "tbmA" = int 1 in DB  //
00038       //  errortype "tbmB" = int 2 in DB  //
00039       //  errortype "none" = int 3 in DB  //
00041 
00043       //each bad roc correspond to a bit to 1: num=  //
00044       // 0 <-> all good rocs                         //
00045       // 1 <-> only roc 0 bad                        //
00046       // 2<-> only roc 1 bad                         //
00047       // 3<->  roc 0 and 1 bad                       //
00048       // 4 <-> only roc 2 bad                        //
00049       //  ...                                        //
00051 
00052 
00053 
00054 
00055 
00056   class BadComponentStrictWeakOrdering{
00057   public:
00058     bool operator() (const disabledModuleType& p,const uint32_t i) const {return p.DetID < i;}
00059     bool operator() (const disabledModuleType& p,const disabledModuleType& q) const {return p.DetID < q.DetID;}   
00060   };
00061 
00062 
00063 
00064   SiPixelQuality() : theDisabledModules(0) {;}
00065 
00066   // constructor from a list of disabled modules
00067   SiPixelQuality(std::vector<disabledModuleType> & disabledModules) : theDisabledModules(disabledModules) {;}
00068 
00069   virtual ~SiPixelQuality() {;}
00070 
00071   // set the list of disabled modules (current list is lost)
00072   void setDisabledModuleList(std::vector<disabledModuleType> & disabledModules) 
00073   { theDisabledModules = disabledModules; }
00074 
00075   // add a single module to the vector of disabled modules
00076   void addDisabledModule(disabledModuleType module)
00077   { theDisabledModules.push_back(module); }
00078 
00079   // add a vector of modules to the vector of disabled modules
00080   void addDisabledModule(std::vector<disabledModuleType> & idVector);
00081 
00082   // remove disabled module from the list
00083   // returns false if id not in disable list, true otherwise
00084   //  bool removeDisabledModule(const disabledModuleType & module);
00085   //   bool removeDisabledModule(const uint32_t & detid); 
00086 
00087 
00088 //--------------- Interface for the user -----------------//
00089 //------- designed to match SiStripQuality methods ----------//
00090   //method copied from the SiStripQuality
00091   void add(const SiStripDetVOff*);
00092   //----------------------------------------
00093   //number of Bad modules
00094   int BadModuleNumber();   
00095   
00096   bool IsModuleBad(const uint32_t & detid) const;  //returns True if module disabled
00097   bool IsModuleUsable(const uint32_t& detid) const;  //returns True if module NOT disabled
00098   bool IsRocBad(const uint32_t& detid, const short& rocNb) const;  //returns True if ROC is disabled
00099   bool IsAreaBad(uint32_t detid, sipixelobjects::GlobalPixel global,  const edm::EventSetup& es, const SiPixelFedCabling* map ) const;
00100   short getBadRocs(const uint32_t& detid) const;  //returns bad Rocs for given DetId
00101   //each bad roc correspond to a bit to 1: num=
00102   //0 <-> all good rocs
00103   //1 <-> only roc 0 bad
00104   //2<-> only roc 1 bad
00105   //3<->  roc 0 and 1 bad
00106   // 4 <-> only roc 2 bad
00107   //...
00108   const std::vector<disabledModuleType> getBadComponentList() const  //returns list of disabled modules/ROCs
00109     { return theDisabledModules; }
00110   const std::vector< LocalPoint > getBadRocPositions(const uint32_t & detid, const TrackerGeometry& theTracker, const SiPixelFedCabling* map ) const; 
00111     //  const std::vector< std::pair <uint8_t, uint8_t> > getBadRocPositions(const uint32_t & detid,  const edm::EventSetup& es, const SiPixelFedCabling* map ) const; 
00112 
00113 
00114 
00115  private:
00116   std::vector<disabledModuleType> theDisabledModules;
00117   bool IsFedBad(const uint32_t & detid) const; 
00118 
00119 }; // class SiPixelQuality
00120 
00121 
00122 #endif