CMS 3D CMS Logo

SiPixelQuality.cc
Go to the documentation of this file.
1 // SiPixelQuality.cc
2 //
3 // class implementation to hold a list of disabled pixel modules
4 //
5 // M. Eads
6 // Apr 2008
7 
18 
19 #include <algorithm>
20 #include <iostream>
21 
22 using namespace sipixelobjects;
23 
25 // errortype "whole" = int 0 in DB //
26 // errortype "tbmA" = int 1 in DB //
27 // errortype "tbmB" = int 2 in DB //
28 // errortype "none" = int 3 in DB //
30 
32 //each bad roc correspond to a bit to 1: num= //
33 // 0 <-> all good rocs //
34 // 1 <-> only roc 0 bad //
35 // 2<-> only roc 1 bad //
36 // 3<-> roc 0 and 1 bad //
37 // 4 <-> only roc 2 bad //
38 // ... //
40 
41 // add a list of modules to the vector of disabled modules
42 void SiPixelQuality::addDisabledModule(std::vector<SiPixelQuality::disabledModuleType>& idVector) {
43  theDisabledModules.insert(theDisabledModules.end(), idVector.begin(), idVector.end());
44 }
45 
47  //Get vector of Voff dets
48  std::vector<uint32_t> vdets;
49  Voff->getDetIds(vdets);
50 
51  std::vector<uint32_t>::const_iterator iter = vdets.begin();
52  std::vector<uint32_t>::const_iterator iterEnd = vdets.end();
53 
54  for (; iter != iterEnd; ++iter) {
56  BadModule.DetID = *iter;
57  BadModule.errorType = 0;
58  BadModule.BadRocs = 65535; //NOTE: here all module is bad - no difference for half modules
59  if (IsModuleUsable(BadModule.DetID))
60  addDisabledModule(BadModule);
61  }
62 }
63 
64 // bool SiPixelQuality::removeDisabledModule(const uint32_t & detid){
65 // std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(theDisabledModules.begin(),theDisabledModules.end(),detid,SiPixelQuality::BadComponentStrictWeakOrdering());
66 // if (iter != theDisabledModules.end() && iter->DetID==detid){
67 // theDisabledModules.erase(iter);
68 // return true;
69 // }
70 // return false;
71 // }
72 
73 // ask if module is OK
74 bool SiPixelQuality::IsModuleUsable(const uint32_t& detid) const {
75  if (IsFedBad(detid))
76  return true;
77  std::vector<SiPixelQuality::disabledModuleType> disabledModules = theDisabledModules;
78  std::sort(disabledModules.begin(), disabledModules.end(), SiPixelQuality::BadComponentStrictWeakOrdering());
79  std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(
80  disabledModules.begin(), disabledModules.end(), detid, SiPixelQuality::BadComponentStrictWeakOrdering());
81  if (iter != disabledModules.end() && iter->DetID == detid && iter->errorType == 0)
82  return false;
83  return true;
84 }
85 
87  std::vector<SiPixelQuality::disabledModuleType> disabledModules = theDisabledModules;
88  //does not distinguish between partially dead or not
89  return disabledModules.size();
90 }
91 
92 //ask if module is bad
93 bool SiPixelQuality::IsModuleBad(const uint32_t& detid) const {
94  if (IsFedBad(detid))
95  return true;
96  std::vector<SiPixelQuality::disabledModuleType> disabledModules = theDisabledModules;
97  std::sort(disabledModules.begin(), disabledModules.end(), SiPixelQuality::BadComponentStrictWeakOrdering());
98  std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(
99  disabledModules.begin(), disabledModules.end(), detid, SiPixelQuality::BadComponentStrictWeakOrdering());
100  //errorType 0 corresponds to "whole" dead module
101  if (iter != disabledModules.end() && iter->DetID == detid && iter->errorType == 0)
102  return true;
103  return false;
104 }
105 
106 //ask if roc is bad
107 bool SiPixelQuality::IsRocBad(const uint32_t& detid, const short& rocNb) const {
108  if (IsModuleBad(detid))
109  return true;
110  std::vector<SiPixelQuality::disabledModuleType> disabledModules = theDisabledModules;
111  std::sort(disabledModules.begin(), disabledModules.end(), SiPixelQuality::BadComponentStrictWeakOrdering());
112  std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(
113  disabledModules.begin(), disabledModules.end(), detid, SiPixelQuality::BadComponentStrictWeakOrdering());
114  if (iter != disabledModules.end() && iter->DetID == detid) {
115  return ((iter->BadRocs >> rocNb) & 0x1);
116  }
117  return false;
118 }
119 
120 //ask for bad ROCS
121 
122 short SiPixelQuality::getBadRocs(const uint32_t& detid) const {
123  std::vector<SiPixelQuality::disabledModuleType> disabledModules = theDisabledModules;
124  std::sort(disabledModules.begin(), disabledModules.end(), SiPixelQuality::BadComponentStrictWeakOrdering());
125  std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(
126  disabledModules.begin(), disabledModules.end(), detid, SiPixelQuality::BadComponentStrictWeakOrdering());
127  if (iter != disabledModules.end() && iter->DetID == detid)
128  return iter->BadRocs;
129  return 0;
130 }
131 
132 const std::vector<LocalPoint> SiPixelQuality::getBadRocPositions(const uint32_t& detid,
133  const TrackerGeometry& theTracker,
134  const SiPixelFedCabling* map) const {
135  std::vector<LocalPoint> badrocpositions(0);
136  for (unsigned int i = 0; i < 16; i++) {
137  if (IsRocBad(detid, i) == true) {
138  std::vector<CablingPathToDetUnit> path = map->pathToDetUnit(detid);
139  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
140  for (IT it = path.begin(); it != path.end(); ++it) {
141  const PixelROC* myroc = map->findItem(*it);
142  if (myroc->idInDetUnit() == i) {
143  LocalPixel::RocRowCol local = {39, 25}; //corresponding to center of ROC row, col
144  GlobalPixel global = myroc->toGlobal(LocalPixel(local));
145  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(theTracker.idToDet(detid));
146 
147  PixelTopology const* topology = &(theGeomDet->specificTopology());
148 
149  MeasurementPoint thepoint(global.row, global.col);
150  LocalPoint localpoint = topology->localPosition(thepoint);
151  badrocpositions.push_back(localpoint);
152  break;
153  }
154  }
155  }
156  }
157  return badrocpositions;
158 }
159 
160 bool SiPixelQuality::IsFedBad(const uint32_t& detid) const { return false; }
void addDisabledModule(disabledModuleType module)
void getDetIds(std::vector< uint32_t > &DetIds_) const
void add(const SiStripDetVOff *)
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
bool IsModuleBad(const uint32_t &detid) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:55
std::vector< LinkConnSpec >::const_iterator IT
const TrackerGeomDet * idToDet(DetId) const override
bool IsFedBad(const uint32_t &detid) const
row and collumn in ROC representation
Definition: LocalPixel.h:13
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
short getBadRocs(const uint32_t &detid) const
const std::vector< LocalPoint > getBadRocPositions(const uint32_t &detid, const TrackerGeometry &theTracker, const SiPixelFedCabling *map) const
bool IsModuleUsable(const uint32_t &detid) const
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:37