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 
29 
30 class SiStripDetCabling;
32 class TrackerTopology;
33 
34 class SiStripQuality final : public SiStripBadStrip {
35 public:
36  struct BadComponent {
37  uint32_t detid;
38  unsigned short BadApvs : 6;
39  unsigned short BadFibers : 3;
40  bool BadModule : 1;
41  };
42 
44  public:
45  bool operator()(const BadComponent &p, const uint32_t i) const { return p.detid < i; }
46  };
47 
48  SiStripQuality(); // takes default file for SiStripDetInfoFileReader
50  SiStripQuality(const SiStripQuality &); // copy constructor
51 
52  ~SiStripQuality() override;
53 
54  void clear() {
55  v_badstrips.clear();
56  indexes.clear();
57  BadComponentVect.clear();
58  toCleanUp = false;
59  }
60 
61  void add(const uint32_t &, const SiStripBadStrip::Range &);
62  void add(const SiStripBadStrip *);
63  void add(const SiStripDetCabling *);
64  void add(const SiStripDetVOff *);
71  void add(const RunInfo *);
74 
75  bool cleanUp(bool force = false);
76 
77  void fillBadComponents();
78 
79  void ReduceGranularity(double);
80 
83  const SiStripQuality operator-(const SiStripQuality &) const;
84  bool operator==(const SiStripQuality &) const;
85  bool operator!=(const SiStripQuality &) const;
86 
88 
89  //------- Interface for the user ----------//
90  bool IsModuleUsable(const uint32_t &detid) const;
91 
92  bool IsModuleBad(const uint32_t &detid) const;
93  bool IsFiberBad(const uint32_t &detid, const short &fiberNb) const;
94  bool IsApvBad(const uint32_t &detid, const short &apvNb) const;
95  bool IsStripBad(const uint32_t &detid, const short &strip) const;
96  bool IsStripBad(const Range &range, const short &strip) const;
97  int nBadStripsOnTheLeft(const Range &range,
98  const short &strip) const; // provides number of consecutive bad strips on the left of strip
99  // (including strip)
101  const Range &range, const short &strip) const; // provides number of consecutive bad strips on the right of strip
102  // (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  SiStripDetCabling const *cabling() const { return SiStripDetCabling_; }
129 
130 private:
131  void compact(std::vector<unsigned int> &, std::vector<unsigned int> &, unsigned short &);
132  void subtract(std::vector<unsigned int> &, const std::vector<unsigned int> &);
133  void subtraction(std::vector<unsigned int> &, const unsigned int &);
134  bool put_replace(const uint32_t &DetId, Range input);
135 
140  void turnOffFeds(const std::vector<int> &fedsList, const bool turnOffStrips, const bool printDebug);
141 
143  void printDetInfo(const TrackerTopology *const tTopo,
144  const uint32_t &detId,
145  const uint32_t &apvPairNumber,
146  std::stringstream &ss);
149  void printActiveFedsInfo(const std::vector<uint16_t> &activeFedsFromCabling,
150  const std::vector<int> &activeFedsFromRunInfo,
151  const std::vector<int> &differentFeds,
152  const bool printDebug);
153 
154  bool toCleanUp;
157 
158  std::vector<BadComponent> BadComponentVect;
159 
163 };
164 
165 #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
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
void printDetInfo(const TrackerTopology *const tTopo, const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
Prints debug output for a given detId.
edm::FileInPath getFileInPath() const
std::vector< BadComponent > BadComponentVect
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
static std::string const input
Definition: EdmProvDump.cc:48
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)
SiStripDetCabling const * cabling() const
void subtraction(std::vector< unsigned int > &, const unsigned int &)
void fillBadComponents()
SiStripQuality & operator+=(const SiStripQuality &)
const SiStripQuality operator-(const SiStripQuality &) const
bool put_replace(const uint32_t &DetId, Range input)
Definition: DetId.h:18
Container v_badstrips
int nBadStripsOnTheLeft(const Range &range, const short &strip) const
~SiStripQuality() override
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)
SiStripQuality & operator-=(const SiStripQuality &)
void addNotConnectedConnectionFromCabling()
int nBadStripsOnTheRight(const Range &range, const short &strip) const
void ReduceGranularity(double)