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 //ask for bad ROCS
125 
126 short SiPixelQuality::getBadRocs(const uint32_t& detid) const {
127  std::vector<SiPixelQuality::disabledModuleType> disabledModules = theDisabledModules;
128  std::sort(disabledModules.begin(), disabledModules.end(), SiPixelQuality::BadComponentStrictWeakOrdering());
129  std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(
130  disabledModules.begin(), disabledModules.end(), detid, SiPixelQuality::BadComponentStrictWeakOrdering());
131  if (iter != disabledModules.end() && iter->DetID == detid)
132  return iter->BadRocs;
133  return 0;
134 }
135 
136 const std::vector<LocalPoint> SiPixelQuality::getBadRocPositions(const uint32_t& detid,
137  const TrackerGeometry& theTracker,
138  const SiPixelFedCabling* map) const {
139  std::vector<LocalPoint> badrocpositions(0);
140  for (unsigned int i = 0; i < 16; i++) {
141  if (IsRocBad(detid, i) == true) {
142  std::vector<CablingPathToDetUnit> path = map->pathToDetUnit(detid);
143  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
144  for (IT it = path.begin(); it != path.end(); ++it) {
145  const PixelROC* myroc = map->findItem(*it);
146  if (myroc->idInDetUnit() == i) {
147  LocalPixel::RocRowCol local = {39, 25}; //corresponding to center of ROC row, col
148  GlobalPixel global = myroc->toGlobal(LocalPixel(local));
149  // edm::ESHandle<TrackerGeometry> geom;
150  // es.get<TrackerDigiGeometryRecord>().get( geom );
151  // const TrackerGeometry& theTracker(*geom);
152  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(theTracker.idToDet(detid));
153 
154  PixelTopology const* topology = &(theGeomDet->specificTopology());
155 
156  MeasurementPoint thepoint(global.row, global.col);
157  LocalPoint localpoint = topology->localPosition(thepoint);
158  badrocpositions.push_back(localpoint);
159  break;
160  }
161  }
162  }
163  }
164  return badrocpositions;
165 }
166 
167 bool SiPixelQuality::IsFedBad(const uint32_t& detid) const { return false; }
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
Point2DBase
Definition: Point2DBase.h:9
SiPixelQuality::IsModuleBad
bool IsModuleBad(const uint32_t &detid) const
Definition: SiPixelQuality.cc:97
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
TrackerGeometry.h
SiPixelQuality::getBadRocs
short getBadRocs(const uint32_t &detid) const
Definition: SiPixelQuality.cc:126
ESHandle.h
SiPixelQuality::add
void add(const SiStripDetVOff *)
Definition: SiPixelQuality.cc:50
SiPixelQuality::BadComponentStrictWeakOrdering
Definition: SiPixelQuality.h:54
SiPixelQuality::disabledModuleType
Definition: SiPixelQuality.h:29
SiPixelFedCablingMap.h
sipixelobjects::GlobalPixel::row
int row
Definition: GlobalPixel.h:7
SiPixelQuality::disabledModuleType::errorType
int errorType
Definition: SiPixelQuality.h:31
SiPixelFedCablingTree.h
SiPixelFedCabling
Definition: SiPixelFedCabling.h:10
sipixelobjects::GlobalPixel::col
int col
Definition: GlobalPixel.h:8
sipixelobjects::LocalPixel
identify pixel inside single ROC
Definition: LocalPixel.h:7
SiPixelQuality::IsModuleUsable
bool IsModuleUsable(const uint32_t &detid) const
Definition: SiPixelQuality.cc:78
SiPixelQuality::BadModuleNumber
int BadModuleNumber()
Definition: SiPixelQuality.cc:90
sipixelobjects::GlobalPixel
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
ecaldqm::topology
const CaloTopology * topology(nullptr)
sipixelobjects
Definition: CablingPathToDetUnit.h:4
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
SiStripDetVOff::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiStripDetVOff.cc:64
Point3DBase< float, LocalTag >
PixelTopology
Definition: PixelTopology.h:10
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
TrackerDigiGeometryRecord.h
SiPixelFrameConverter.h
PixelROC.h
SiPixelFedCablingMapRcd.h
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
SiPixelQuality::disabledModuleType::DetID
uint32_t DetID
Definition: SiPixelQuality.h:30
SiPixelQuality::addDisabledModule
void addDisabledModule(disabledModuleType module)
Definition: SiPixelQuality.h:71
LocalPixel.h
SiStripDetVOff
Definition: SiStripDetVOff.h:31
sipixelobjects::PixelROC::toGlobal
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:55
IT
std::vector< LinkConnSpec >::const_iterator IT
Definition: TriggerBoardSpec.cc:5
SiPixelQuality::getBadRocPositions
const std::vector< LocalPoint > getBadRocPositions(const uint32_t &detid, const TrackerGeometry &theTracker, const SiPixelFedCabling *map) const
Definition: SiPixelQuality.cc:136
sipixelobjects::PixelROC
Definition: PixelROC.h:23
SiPixelQuality::disabledModuleType::BadRocs
unsigned short BadRocs
Definition: SiPixelQuality.h:32
sipixelobjects::LocalPixel::RocRowCol
row and collumn in ROC representation
Definition: LocalPixel.h:13
ESWatcher.h
PixelGeomDetUnit.h
SiPixelQuality.h
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
genParticles_cff.map
map
Definition: genParticles_cff.py:11
SiPixelQuality::IsRocBad
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
Definition: SiPixelQuality.cc:111
SiPixelQuality::IsFedBad
bool IsFedBad(const uint32_t &detid) const
Definition: SiPixelQuality.cc:167
sipixelobjects::PixelROC::idInDetUnit
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:37
TrackerGeometry
Definition: TrackerGeometry.h:14
SiPixelFrameReverter.h