CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripQuality.h
Go to the documentation of this file.
1 #ifndef SiStripObjects_SiStripQuality_h
2 #define SiStripObjects_SiStripQuality_h
3 // -*- C++ -*-
4 // -*- C++ -*-
5 //
6 // Package: SiStripObjects
7 // Class : SiStripQuality
8 //
17 //
18 // Author: Domenico Giordano
19 // Created: Wed Sep 26 17:42:12 CEST 2007
20 // $Id: SiStripQuality.h,v 1.14 2009/07/28 08:39:55 demattia Exp $
21 //
22 
23 
31 #include <vector>
32 
34 
35  public:
36 
37  struct BadComponent{
38  uint32_t detid;
39  unsigned short BadApvs : 6;
40  unsigned short BadFibers :3;
41  bool BadModule :1;
42  };
43 
45  public:
46  bool operator() (const BadComponent& p,const uint32_t i) const {return p.detid < i;}
47  };
48 
49  SiStripQuality(); //takes default file for SiStripDetInfoFileReader
51  SiStripQuality(const SiStripQuality&); //copy constructor
52 
54  LogTrace("SiStripQuality") << "SiStripQuality destructor" << std::endl;
55  delete reader;
56  }
57 
58  void clear(){
59  v_badstrips.clear();
60  indexes.clear();
61  BadComponentVect.clear();
62  toCleanUp=false;
63  }
64 
65  void add(const uint32_t&,const SiStripBadStrip::Range&);
66  void add(const SiStripBadStrip*);
67  void add(const SiStripDetCabling*);
68  void add(const SiStripDetVOff*);
75  void add(const RunInfo *);
78 
79  bool cleanUp(bool force=false);
80 
81  void fillBadComponents();
82 
83  void ReduceGranularity(double);
84 
87  const SiStripQuality operator -(const SiStripQuality&) const ;
88  bool operator ==(const SiStripQuality&) const;
89  bool operator !=(const SiStripQuality&) const;
90 
92 
93  //------- Interface for the user ----------//
94  bool IsModuleUsable(const uint32_t& detid) const;
95 
96  bool IsModuleBad(const uint32_t& detid) const;
97  bool IsFiberBad(const uint32_t& detid, const short& fiberNb) const;
98  bool IsApvBad(const uint32_t& detid, const short& apvNb) const;
99  bool IsStripBad(const uint32_t& detid, const short& strip) const;
100  bool IsStripBad(const Range& range, const short& strip) const;
101  int nBadStripsOnTheLeft(const Range& range, const short& strip) const; //provides number of consecutive bad strips on the left of strip (including strip)
102  int nBadStripsOnTheRight(const Range& range, const short& strip) const; //provides number of consecutive bad strips on the right of strip (including strip)
103 
104  short getBadApvs(const uint32_t& detid) const;
105  //each bad apv correspond to a bit to 1: num=
106  //0 <-> all good apvs
107  //1 <-> only apv 0 bad
108  //2<-> only apv 1 bad
109  //3<-> apv 0 and 1 bad
110  // 4 <-> only apv 2 bad
111  //...
112  short getBadFibers(const uint32_t& detid) const;
113  //each bad fiber correspond to a bit to 1: num=
114  //0 <-> all good fibers
115  //1 <-> only fiber 0 bad
116  //2<-> only fiber 1 bad
117  //3<-> fiber 0 and 1 bad
118  // 4 <-> only fiber 2 bad
119  //...
120 
121  const std::vector<BadComponent>& getBadComponentList() const { return BadComponentVect; }
122 
123  void compact(unsigned int&,std::vector<unsigned int>&);
124 
125  inline void setPrintDebugOutput(const bool printDebug) { printDebug_ = printDebug; }
126  inline void setUseEmptyRunInfo(const bool useEmptyRunInfo) { useEmptyRunInfo_ = useEmptyRunInfo; }
127 
128  private:
129 
130  void compact(std::vector<unsigned int>&,std::vector<unsigned int>&,unsigned short&);
131  void subtract(std::vector<unsigned int>&,const std::vector<unsigned int>&);
132  void subtraction(std::vector<unsigned int>&,const unsigned int&);
133  bool put_replace(const uint32_t& DetId, Range input);
134 
139  void turnOffFeds(const std::vector<int> & fedsList, const bool turnOffStrips, const bool printDebug);
140 
142  void printDetInfo(const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss);
144  void printActiveFedsInfo( const std::vector<uint16_t> & activeFedsFromCabling,
145  const std::vector<int> & activeFedsFromRunInfo,
146  const std::vector<int> & differentFeds,
147  const bool printDebug );
148 
149  bool toCleanUp;
152 
153  std::vector<BadComponent> BadComponentVect;
154 
158 };
159 
160 #endif
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
bool IsFiberBad(const uint32_t &detid, const short &fiberNb) const
int i
Definition: DBlmapReader.cc:9
void printDetInfo(const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
Prints debug output for a given detId.
bool cleanUp(bool force=false)
short getBadFibers(const uint32_t &detid) const
const std::vector< BadComponent > & getBadComponentList() const
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
void addInvalidConnectionFromCabling()
void add(const uint32_t &, const SiStripBadStrip::Range &)
bool IsStripBad(const uint32_t &detid, const short &strip) const
bool operator()(const BadComponent &p, const uint32_t i) const
bool operator!=(const SiStripQuality &) const
edm::FileInPath getFileInPath() const
std::vector< BadComponent > BadComponentVect
void subtract(std::vector< unsigned int > &, const std::vector< unsigned int > &)
bool operator==(const SiStripQuality &) const
short getBadApvs(const uint32_t &detid) const
bool IsModuleUsable(const uint32_t &detid) const
void setUseEmptyRunInfo(const bool useEmptyRunInfo)
void compact(unsigned int &, std::vector< unsigned int > &)
const SiStripDetCabling * SiStripDetCabling_
bool IsModuleBad(const uint32_t &detid) const
void setPrintDebugOutput(const bool printDebug)
void subtraction(std::vector< unsigned int > &, const unsigned int &)
void fillBadComponents()
SiStripQuality & operator+=(const SiStripQuality &)
void printDebug(std::stringstream &ss) const
#define LogTrace(id)
const SiStripQuality operator-(const SiStripQuality &) const
bool put_replace(const uint32_t &DetId, Range input)
Definition: DetId.h:20
Container v_badstrips
int nBadStripsOnTheLeft(const Range &range, const short &strip) const
std::pair< ContainerIterator, ContainerIterator > Range
void turnOffFeds(const std::vector< int > &fedsList, const bool turnOffStrips, const bool printDebug)
SiStripDetInfoFileReader * reader
edm::FileInPath FileInPath_
void printActiveFedsInfo(const std::vector< uint16_t > &activeFedsFromCabling, const std::vector< int > &activeFedsFromRunInfo, const std::vector< int > &differentFeds, const bool printDebug)
Prints debug output for the active feds comparing the list in RunInfo and FedCabling.
SiStripQuality & operator-=(const SiStripQuality &)
void addNotConnectedConnectionFromCabling()
int nBadStripsOnTheRight(const Range &range, const short &strip) const
void ReduceGranularity(double)