CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 //
21 
26 #include <vector>
27 
28 class SiStripDetCabling;
29 class SiStripDetInfo;
30 class TrackerTopology;
31 
32 class SiStripQuality final : public SiStripBadStrip {
33 public:
34  struct BadComponent {
35  uint32_t detid;
36  unsigned short BadApvs : 6;
37  unsigned short BadFibers : 3;
38  bool BadModule : 1;
39  };
40 
42  public:
43  bool operator()(const BadComponent &p, const uint32_t i) const { return p.detid < i; }
44  };
45 
46  SiStripQuality() = delete;
48  SiStripQuality(const SiStripQuality &) = default;
49  SiStripQuality(SiStripQuality &&) = default;
50 
51  ~SiStripQuality() override = default;
52 
53  void clear() {
54  v_badstrips.clear();
55  indexes.clear();
56  BadComponentVect.clear();
57  toCleanUp = false;
58  }
59 
60  void add(const uint32_t &, const SiStripBadStrip::Range &);
61  void add(const SiStripBadStrip *);
62  void add(const SiStripDetCabling *);
63  void add(const SiStripDetVOff *);
70  void add(const RunInfo *);
73 
74  bool cleanUp(bool force = false);
75 
76  void fillBadComponents();
77 
78  void ReduceGranularity(double);
79 
81 
82  //------- Interface for the user ----------//
83  bool IsModuleUsable(const uint32_t &detid) const;
84 
85  bool IsModuleBad(const uint32_t &detid) const;
86  bool IsFiberBad(const uint32_t &detid, const short &fiberNb) const;
87  bool IsApvBad(const uint32_t &detid, const short &apvNb) const;
88  bool IsStripBad(const uint32_t &detid, const short &strip) const;
89  bool IsStripBad(const Range &range, const short &strip) const;
90  int nBadStripsOnTheLeft(const Range &range,
91  const short &strip) const; // provides number of consecutive bad strips on the left of strip
92  // (including strip)
94  const Range &range, const short &strip) const; // provides number of consecutive bad strips on the right of strip
95  // (including strip)
96 
97  short getBadApvs(const uint32_t &detid) const;
98  // each bad apv correspond to a bit to 1: num=
99  // 0 <-> all good apvs
100  // 1 <-> only apv 0 bad
101  // 2<-> only apv 1 bad
102  // 3<-> apv 0 and 1 bad
103  // 4 <-> only apv 2 bad
104  //...
105  short getBadFibers(const uint32_t &detid) const;
106  // each bad fiber correspond to a bit to 1: num=
107  // 0 <-> all good fibers
108  // 1 <-> only fiber 0 bad
109  // 2<-> only fiber 1 bad
110  // 3<-> fiber 0 and 1 bad
111  // 4 <-> only fiber 2 bad
112  //...
113 
114  const std::vector<BadComponent> &getBadComponentList() const { return BadComponentVect; }
115 
116  void compact(unsigned int &, std::vector<unsigned int> &);
117 
118  inline void setPrintDebugOutput(const bool printDebug) { printDebug_ = printDebug; }
119  inline void setUseEmptyRunInfo(const bool useEmptyRunInfo) { useEmptyRunInfo_ = useEmptyRunInfo; }
120 
121  SiStripDetCabling const *cabling() const { return SiStripDetCabling_; }
122 
123 private:
124  void compact(std::vector<unsigned int> &, std::vector<unsigned int> &, unsigned short &);
125  void subtract(std::vector<unsigned int> &, const std::vector<unsigned int> &);
126  void subtraction(std::vector<unsigned int> &, const unsigned int &);
127  bool put_replace(const uint32_t &DetId, Range input);
128 
133  void turnOffFeds(const std::vector<int> &fedsList, const bool turnOffStrips, const bool printDebug);
134 
136  void printDetInfo(const TrackerTopology *const tTopo,
137  const uint32_t &detId,
138  const uint32_t &apvPairNumber,
139  std::stringstream &ss);
142  void printActiveFedsInfo(const std::vector<uint16_t> &activeFedsFromCabling,
143  const std::vector<int> &activeFedsFromRunInfo,
144  const std::vector<int> &differentFeds,
145  const bool printDebug);
146 
148  bool toCleanUp;
149  std::vector<BadComponent> BadComponentVect;
150 
154 };
155 
156 #endif
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
bool IsFiberBad(const uint32_t &detid, const short &fiberNb) const
bool cleanUp(bool force=false)
short getBadFibers(const uint32_t &detid) const
const std::vector< BadComponent > & getBadComponentList() const
~SiStripQuality() override=default
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
void printDetInfo(const TrackerTopology *const tTopo, const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
Prints debug output for a given detId.
SiStripQuality()=delete
SiStripQuality difference(const SiStripQuality &) const
std::vector< BadComponent > BadComponentVect
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
static std::string const input
Definition: EdmProvDump.cc:47
const uint16_t range(const Frame &aFrame)
void subtract(std::vector< unsigned int > &, const std::vector< unsigned int > &)
SiStripDetInfo info_
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)
SiStripDetCabling const * cabling() const
void subtraction(std::vector< unsigned int > &, const unsigned int &)
void fillBadComponents()
bool put_replace(const uint32_t &DetId, Range input)
Definition: DetId.h:17
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)
void printActiveFedsInfo(const std::vector< uint16_t > &activeFedsFromCabling, const std::vector< int > &activeFedsFromRunInfo, const std::vector< int > &differentFeds, const bool printDebug)
void addNotConnectedConnectionFromCabling()
int nBadStripsOnTheRight(const Range &range, const short &strip) const
void ReduceGranularity(double)