CMS 3D CMS Logo

SiStripQuality.h

Go to the documentation of this file.
00001 #ifndef SiStripObjects_SiStripQuality_h
00002 #define SiStripObjects_SiStripQuality_h
00003 // -*- C++ -*-
00004 // -*- C++ -*-
00005 //
00006 // Package:     SiStripObjects
00007 // Class  :     SiStripQuality
00008 //
00017 //
00018 // Author:      Domenico Giordano
00019 // Created:     Wed Sep 26 17:42:12 CEST 2007
00020 // $Id: SiStripQuality.h,v 1.9 2008/08/21 11:10:16 giordano Exp $
00021 //
00022 
00023 
00024 #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h"
00025 #include "FWCore/ParameterSet/interface/FileInPath.h"
00026 #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
00027 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00028 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00029 #include <vector>
00030 
00031 class SiStripQuality: public SiStripBadStrip {
00032 
00033  public:
00034 
00035   struct BadComponent{
00036     uint32_t detid;
00037     unsigned short BadApvs : 6;
00038     unsigned short BadFibers :3;
00039     bool BadModule :1;
00040   };
00041 
00042   class BadComponentStrictWeakOrdering{
00043   public:
00044     bool operator() (const BadComponent& p,const uint32_t i) const {return p.detid < i;}
00045   };
00046   
00047   SiStripQuality(); //takes default file for SiStripDetInfoFileReader
00048   SiStripQuality(edm::FileInPath&);
00049   SiStripQuality(const SiStripQuality&); //copy constructor
00050 
00051   ~SiStripQuality(){ 
00052     LogTrace("SiStripQuality") << "SiStripQuality destructor" << std::endl; 
00053     delete reader;
00054   }
00055 
00056   void clear(){
00057     v_badstrips.clear();
00058     indexes.clear();
00059     BadComponentVect.clear();
00060     toCleanUp=false;
00061   }
00062 
00063   void add(const uint32_t&,const SiStripBadStrip::Range&);
00064   void add(const SiStripBadStrip*);
00065   void add(const SiStripDetCabling*);
00066   void addInvalidConnectionFromCabling();
00067   void addNotConnectedConnectionFromCabling();
00068 
00069   bool cleanUp(bool force=false);
00070 
00071   void fillBadComponents();
00072 
00073   void ReduceGranularity(double); 
00074 
00075   SiStripQuality& operator +=(const SiStripQuality&); 
00076   SiStripQuality& operator -=(const SiStripQuality&);
00077   const SiStripQuality operator -(const SiStripQuality&) const ;
00078   bool operator ==(const SiStripQuality&) const;
00079   bool operator !=(const SiStripQuality&) const;
00080   
00081   edm::FileInPath getFileInPath() const {return FileInPath_;}
00082 
00083   //------- Interface for the user ----------//
00084   bool IsModuleUsable(const uint32_t& detid) const;
00085 
00086   bool IsModuleBad(const uint32_t& detid) const;
00087   bool IsFiberBad(const uint32_t& detid, const short& fiberNb) const;
00088   bool IsApvBad(const uint32_t& detid, const short& apvNb) const;
00089   bool IsStripBad(const uint32_t& detid, const short& strip) const;
00090   bool IsStripBad(const Range& range, const short& strip) const;
00091   int  nBadStripsOnTheLeft(const Range& range, const short& strip) const; //provides number of consecutive bad strips on the left of strip (including strip)
00092   int  nBadStripsOnTheRight(const Range& range, const short& strip) const; //provides number of consecutive bad strips on the right of strip (including strip)
00093   
00094   short getBadApvs(const uint32_t& detid) const; 
00095   //each bad apv correspond to a bit to 1: num=
00096   //0 <-> all good apvs
00097   //1 <-> only apv 0 bad
00098   //2<-> only apv 1 bad
00099   //3<->  apv 0 and 1 bad
00100   // 4 <-> only apv 2 bad
00101   //...
00102   short getBadFibers(const uint32_t& detid) const; 
00103   //each bad fiber correspond to a bit to 1: num=
00104   //0 <-> all good fibers
00105   //1 <-> only fiber 0 bad
00106   //2<-> only fiber 1 bad
00107   //3<->  fiber 0 and 1 bad
00108   // 4 <-> only fiber 2 bad
00109   //...
00110   
00111   const std::vector<BadComponent>& getBadComponentList() const { return BadComponentVect; }   
00112 
00113   void compact(unsigned int&,std::vector<unsigned int>&);
00114 
00115  private:
00116 
00117   void compact(std::vector<unsigned int>&,std::vector<unsigned int>&,unsigned short&);
00118   void subtract(std::vector<unsigned int>&,const std::vector<unsigned int>&);
00119   void subtraction(std::vector<unsigned int>&,const unsigned int&);
00120   bool put_replace(const uint32_t& DetId, Range input);
00121 
00122   bool toCleanUp;
00123   edm::FileInPath FileInPath_;
00124   SiStripDetInfoFileReader* reader;
00125 
00126   std::vector<BadComponent> BadComponentVect;
00127 
00128   const SiStripDetCabling *SiStripDetCabling_;  
00129 };
00130 
00131 #endif

Generated on Tue Jun 9 17:25:26 2009 for CMSSW by  doxygen 1.5.4