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 //
21 
22 
27 #include <vector>
28 
30 
31 class SiStripDetCabling;
33 class TrackerTopology;
34 
36 
37  public:
38 
39  struct BadComponent{
40  uint32_t detid;
41  unsigned short BadApvs : 6;
42  unsigned short BadFibers :3;
43  bool BadModule :1;
44  };
45 
47  public:
48  bool operator() (const BadComponent& p,const uint32_t i) const {return p.detid < i;}
49  };
50 
51  SiStripQuality(); //takes default file for SiStripDetInfoFileReader
53  SiStripQuality(const SiStripQuality&); //copy constructor
54 
56 
57  void clear(){
58  v_badstrips.clear();
59  indexes.clear();
60  BadComponentVect.clear();
61  toCleanUp=false;
62  }
63 
64  void add(const uint32_t&,const SiStripBadStrip::Range&);
65  void add(const SiStripBadStrip*);
66  void add(const SiStripDetCabling*);
67  void add(const SiStripDetVOff*);
74  void add(const RunInfo *);
77 
78  bool cleanUp(bool force=false);
79 
80  void fillBadComponents();
81 
82  void ReduceGranularity(double);
83 
86  const SiStripQuality operator -(const SiStripQuality&) const ;
87  bool operator ==(const SiStripQuality&) const;
88  bool operator !=(const SiStripQuality&) const;
89 
91 
92  //------- Interface for the user ----------//
93  bool IsModuleUsable(const uint32_t& detid) const;
94 
95  bool IsModuleBad(const uint32_t& detid) const;
96  bool IsFiberBad(const uint32_t& detid, const short& fiberNb) const;
97  bool IsApvBad(const uint32_t& detid, const short& apvNb) const;
98  bool IsStripBad(const uint32_t& detid, const short& strip) const;
99  bool IsStripBad(const Range& range, const short& strip) const;
100  int nBadStripsOnTheLeft(const Range& range, const short& strip) const; //provides number of consecutive bad strips on the left of strip (including strip)
101  int nBadStripsOnTheRight(const Range& range, const short& strip) const; //provides number of consecutive bad strips on the right of strip (including strip)
102 
103  short getBadApvs(const uint32_t& detid) const;
104  //each bad apv correspond to a bit to 1: num=
105  //0 <-> all good apvs
106  //1 <-> only apv 0 bad
107  //2<-> only apv 1 bad
108  //3<-> apv 0 and 1 bad
109  // 4 <-> only apv 2 bad
110  //...
111  short getBadFibers(const uint32_t& detid) const;
112  //each bad fiber correspond to a bit to 1: num=
113  //0 <-> all good fibers
114  //1 <-> only fiber 0 bad
115  //2<-> only fiber 1 bad
116  //3<-> fiber 0 and 1 bad
117  // 4 <-> only fiber 2 bad
118  //...
119 
120  const std::vector<BadComponent>& getBadComponentList() const { return BadComponentVect; }
121 
122  void compact(unsigned int&,std::vector<unsigned int>&);
123 
124  inline void setPrintDebugOutput(const bool printDebug) { printDebug_ = printDebug; }
125  inline void setUseEmptyRunInfo(const bool useEmptyRunInfo) { useEmptyRunInfo_ = useEmptyRunInfo; }
126 
127 
128  SiStripDetCabling const * cabling() const { return SiStripDetCabling_;}
129 
130 
131  private:
132 
133  void compact(std::vector<unsigned int>&,std::vector<unsigned int>&,unsigned short&);
134  void subtract(std::vector<unsigned int>&,const std::vector<unsigned int>&);
135  void subtraction(std::vector<unsigned int>&,const unsigned int&);
136  bool put_replace(const uint32_t& DetId, Range input);
137 
142  void turnOffFeds(const std::vector<int> & fedsList, const bool turnOffStrips, const bool printDebug);
143 
145  void printDetInfo(const TrackerTopology* const tTopo, const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss);
147  void printActiveFedsInfo( const std::vector<uint16_t> & activeFedsFromCabling,
148  const std::vector<int> & activeFedsFromRunInfo,
149  const std::vector<int> & differentFeds,
150  const bool printDebug );
151 
152  bool toCleanUp;
155 
156  std::vector<BadComponent> BadComponentVect;
157 
161 };
162 
163 #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
bool cleanUp(bool force=false)
short getBadFibers(const uint32_t &detid) const
#define GCC11_FINAL
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
static std::string const input
Definition: EdmProvDump.cc:43
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 &)
void printDebug(std::stringstream &ss) const
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
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)