CMS 3D CMS Logo

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