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