CMS 3D CMS Logo

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, 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(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(uint32_t detid) const;
84 
85  bool IsModuleBad(uint32_t detid) const;
86  bool IsFiberBad(uint32_t detid, short fiberNb) const;
87  bool IsApvBad(uint32_t detid, short apvNb) const;
88  bool IsStripBad(uint32_t detid, short strip) const;
89  bool IsStripBad(const Range &range, short strip) const;
90  int nBadStripsOnTheLeft(const Range &range,
91  short strip) const; // provides number of consecutive bad strips on the left of strip
92  // (including strip)
93  int nBadStripsOnTheRight(const Range &range,
94  short strip) const; // provides number of consecutive bad strips on the right of strip
95  // (including strip)
96 
97  short getBadApvs(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(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(uint32_t detid, 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(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, uint32_t detId, uint32_t apvPairNumber, std::stringstream &ss);
139  void printActiveFedsInfo(const std::vector<uint16_t> &activeFedsFromCabling,
140  const std::vector<int> &activeFedsFromRunInfo,
141  const std::vector<int> &differentFeds,
142  const bool printDebug);
143 
145  bool toCleanUp;
146  std::vector<BadComponent> BadComponentVect;
147 
151 };
152 
153 #endif
bool cleanUp(bool force=false)
bool IsApvBad(uint32_t detid, short apvNb) const
~SiStripQuality() override=default
void addInvalidConnectionFromCabling()
short getBadFibers(uint32_t detid) const
bool IsModuleBad(uint32_t detid) const
SiStripQuality()=delete
void add(uint32_t, const SiStripBadStrip::Range &)
std::vector< BadComponent > BadComponentVect
const std::vector< BadComponent > & getBadComponentList() const
static std::string const input
Definition: EdmProvDump.cc:50
void subtract(std::vector< unsigned int > &, const std::vector< unsigned int > &)
SiStripDetInfo info_
void setUseEmptyRunInfo(const bool useEmptyRunInfo)
const SiStripDetCabling * SiStripDetCabling_
void compact(uint32_t detid, std::vector< unsigned int > &)
void setPrintDebugOutput(const bool printDebug)
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
int nBadStripsOnTheLeft(const Range &range, short strip) const
void subtraction(std::vector< unsigned int > &, const unsigned int &)
void fillBadComponents()
Container v_badstrips
int nBadStripsOnTheRight(const Range &range, short strip) const
bool IsStripBad(uint32_t detid, short strip) const
void printDetInfo(const TrackerTopology *const tTopo, uint32_t detId, uint32_t apvPairNumber, std::stringstream &ss)
Prints debug output for a given detId.
SiStripQuality difference(const SiStripQuality &) const
bool put_replace(uint32_t detId, Range input)
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)
SiStripDetCabling const * cabling() const
bool IsModuleUsable(uint32_t detid) const
bool IsFiberBad(uint32_t detid, short fiberNb) const
void addNotConnectedConnectionFromCabling()
void ReduceGranularity(double)
bool operator()(const BadComponent &p, uint32_t i) const
short getBadApvs(uint32_t detid) const