Go to the documentation of this file.00001 #ifndef SiStripObjects_SiStripQuality_h
00002 #define SiStripObjects_SiStripQuality_h
00003
00004
00005
00006
00007
00008
00017
00018
00019
00020
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 "CondFormats/SiStripObjects/interface/SiStripDetVOff.h"
00030 #include "CondFormats/RunInfo/interface/RunInfo.h"
00031 #include <vector>
00032
00033 class SiStripQuality: public SiStripBadStrip {
00034
00035 public:
00036
00037 struct BadComponent{
00038 uint32_t detid;
00039 unsigned short BadApvs : 6;
00040 unsigned short BadFibers :3;
00041 bool BadModule :1;
00042 };
00043
00044 class BadComponentStrictWeakOrdering{
00045 public:
00046 bool operator() (const BadComponent& p,const uint32_t i) const {return p.detid < i;}
00047 };
00048
00049 SiStripQuality();
00050 SiStripQuality(edm::FileInPath&);
00051 SiStripQuality(const SiStripQuality&);
00052
00053 ~SiStripQuality(){
00054 LogTrace("SiStripQuality") << "SiStripQuality destructor" << std::endl;
00055 delete reader;
00056 }
00057
00058 void clear(){
00059 v_badstrips.clear();
00060 indexes.clear();
00061 BadComponentVect.clear();
00062 toCleanUp=false;
00063 }
00064
00065 void add(const uint32_t&,const SiStripBadStrip::Range&);
00066 void add(const SiStripBadStrip*);
00067 void add(const SiStripDetCabling*);
00068 void add(const SiStripDetVOff*);
00075 void add(const RunInfo *);
00076 void addInvalidConnectionFromCabling();
00077 void addNotConnectedConnectionFromCabling();
00078
00079 bool cleanUp(bool force=false);
00080
00081 void fillBadComponents();
00082
00083 void ReduceGranularity(double);
00084
00085 SiStripQuality& operator +=(const SiStripQuality&);
00086 SiStripQuality& operator -=(const SiStripQuality&);
00087 const SiStripQuality operator -(const SiStripQuality&) const ;
00088 bool operator ==(const SiStripQuality&) const;
00089 bool operator !=(const SiStripQuality&) const;
00090
00091 edm::FileInPath getFileInPath() const {return FileInPath_;}
00092
00093
00094 bool IsModuleUsable(const uint32_t& detid) const;
00095
00096 bool IsModuleBad(const uint32_t& detid) const;
00097 bool IsFiberBad(const uint32_t& detid, const short& fiberNb) const;
00098 bool IsApvBad(const uint32_t& detid, const short& apvNb) const;
00099 bool IsStripBad(const uint32_t& detid, const short& strip) const;
00100 bool IsStripBad(const Range& range, const short& strip) const;
00101 int nBadStripsOnTheLeft(const Range& range, const short& strip) const;
00102 int nBadStripsOnTheRight(const Range& range, const short& strip) const;
00103
00104 short getBadApvs(const uint32_t& detid) const;
00105
00106
00107
00108
00109
00110
00111
00112 short getBadFibers(const uint32_t& detid) const;
00113
00114
00115
00116
00117
00118
00119
00120
00121 const std::vector<BadComponent>& getBadComponentList() const { return BadComponentVect; }
00122
00123 void compact(unsigned int&,std::vector<unsigned int>&);
00124
00125 inline void setPrintDebugOutput(const bool printDebug) { printDebug_ = printDebug; }
00126 inline void setUseEmptyRunInfo(const bool useEmptyRunInfo) { useEmptyRunInfo_ = useEmptyRunInfo; }
00127
00128 private:
00129
00130 void compact(std::vector<unsigned int>&,std::vector<unsigned int>&,unsigned short&);
00131 void subtract(std::vector<unsigned int>&,const std::vector<unsigned int>&);
00132 void subtraction(std::vector<unsigned int>&,const unsigned int&);
00133 bool put_replace(const uint32_t& DetId, Range input);
00134
00139 void turnOffFeds(const std::vector<int> & fedsList, const bool turnOffStrips, const bool printDebug);
00140
00142 void printDetInfo(const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss);
00144 void printActiveFedsInfo( const std::vector<uint16_t> & activeFedsFromCabling,
00145 const std::vector<int> & activeFedsFromRunInfo,
00146 const std::vector<int> & differentFeds,
00147 const bool printDebug );
00148
00149 bool toCleanUp;
00150 edm::FileInPath FileInPath_;
00151 SiStripDetInfoFileReader* reader;
00152
00153 std::vector<BadComponent> BadComponentVect;
00154
00155 const SiStripDetCabling *SiStripDetCabling_;
00156 bool printDebug_;
00157 bool useEmptyRunInfo_;
00158 };
00159
00160 #endif