Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h"
00009 #include "CondFormats/SiPixelObjects/interface/SiPixelFrameReverter.h"
00010 #include "CondFormats/SiPixelObjects/interface/SiPixelFrameConverter.h"
00011 #include "DataFormats/Common/interface/Handle.h"
00012 #include "FWCore/Framework/interface/ESHandle.h"
00013 #include "FWCore/Framework/interface/ESWatcher.h"
00014 #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
00015 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
00016 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h"
00017 #include "CondFormats/SiPixelObjects/interface/PixelROC.h"
00018 #include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
00019 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00020 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00021 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00022
00023
00024 #include <algorithm>
00025 #include <iostream>
00026
00027
00028 using namespace sipixelobjects;
00029
00030
00032
00033
00034
00035
00037
00039
00040
00041
00042
00043
00044
00045
00047
00048
00049
00050 void SiPixelQuality::addDisabledModule(std::vector<SiPixelQuality::disabledModuleType> & idVector) {
00051 theDisabledModules.insert(theDisabledModules.end(),
00052 idVector.begin(),
00053 idVector.end());
00054
00055 }
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 bool SiPixelQuality::IsModuleUsable(const uint32_t& detid) const {
00069 if(IsFedBad(detid))
00070 return true;
00071 std::vector<SiPixelQuality::disabledModuleType>disabledModules = theDisabledModules;
00072 std::sort(disabledModules.begin(),disabledModules.end(),SiPixelQuality::BadComponentStrictWeakOrdering());
00073 std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(disabledModules.begin(),disabledModules.end(),detid,SiPixelQuality::BadComponentStrictWeakOrdering());
00074 if (iter != disabledModules.end() && iter->DetID==detid && iter->errorType ==0)
00075 return false;
00076 return true;
00077 }
00078
00079
00080 bool SiPixelQuality::IsModuleBad(const uint32_t & detid) const {
00081 if(IsFedBad(detid))
00082 return true;
00083 std::vector<SiPixelQuality::disabledModuleType>disabledModules = theDisabledModules;
00084 std::sort(disabledModules.begin(),disabledModules.end(),SiPixelQuality::BadComponentStrictWeakOrdering());
00085 std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(disabledModules.begin(),disabledModules.end(),detid,SiPixelQuality::BadComponentStrictWeakOrdering());
00086 if (iter != disabledModules.end() && iter->DetID==detid && iter->errorType == 0)
00087 return true;
00088 return false;
00089 }
00090
00091
00092 bool SiPixelQuality::IsRocBad(const uint32_t& detid, const short& rocNb) const {
00093 if(IsModuleBad(detid))
00094 return true;
00095 std::vector<SiPixelQuality::disabledModuleType>disabledModules = theDisabledModules;
00096 std::sort(disabledModules.begin(),disabledModules.end(),SiPixelQuality::BadComponentStrictWeakOrdering());
00097 std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(disabledModules.begin(),disabledModules.end(),detid,SiPixelQuality::BadComponentStrictWeakOrdering());
00098 if (iter != disabledModules.end() && iter->DetID == detid){
00099 return ((iter->BadRocs >> rocNb)&0x1);}
00100 return false;
00101 }
00102
00103 bool SiPixelQuality::IsAreaBad(uint32_t detid, sipixelobjects::GlobalPixel global, const edm::EventSetup& es, const SiPixelFedCabling* map ) const {
00104
00105 SiPixelFrameReverter reverter(es,map);
00106 int rocfromarea = -1;
00107 rocfromarea = reverter.findRocInDet(detid, global);
00108
00109 return SiPixelQuality::IsRocBad(detid, rocfromarea);
00110 return false;
00111 }
00112
00113
00114
00115
00116 short SiPixelQuality::getBadRocs(const uint32_t& detid) const{
00117 std::vector<SiPixelQuality::disabledModuleType>disabledModules = theDisabledModules;
00118 std::sort(disabledModules.begin(),disabledModules.end(),SiPixelQuality::BadComponentStrictWeakOrdering());
00119 std::vector<disabledModuleType>::const_iterator iter = std::lower_bound(disabledModules.begin(),disabledModules.end(),detid,SiPixelQuality::BadComponentStrictWeakOrdering());
00120 if (iter != disabledModules.end() && iter->DetID==detid)
00121 return iter->BadRocs;
00122 return 0;
00123 }
00124
00125 const std::vector<LocalPoint> SiPixelQuality::getBadRocPositions(const uint32_t & detid, const TrackerGeometry& theTracker, const SiPixelFedCabling* map) const{
00126 std::vector<LocalPoint> badrocpositions (0);
00127 std::pair<uint8_t, uint8_t> coord(1,1);
00128 for(unsigned int i = 0; i < 16; i++){
00129 if (IsRocBad(detid, i) == true){
00130 std::vector<CablingPathToDetUnit> path = map->pathToDetUnit(detid);
00131 typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
00132 for (IT it = path.begin(); it != path.end(); ++it) {
00133 const PixelROC * myroc = map->findItem(*it);
00134 if( myroc->idInDetUnit() == i) {
00135 LocalPixel::RocRowCol local = { 39, 25};
00136 GlobalPixel global = myroc->toGlobal( LocalPixel(local) );
00137
00138
00139
00140 const PixelGeomDetUnit * theGeomDet = dynamic_cast<const PixelGeomDetUnit*> (theTracker.idToDet(detid) );
00141
00142 PixelTopology const * topology = &(theGeomDet->specificTopology());
00143
00144 MeasurementPoint thepoint(global.row, global.col);
00145 LocalPoint localpoint = topology->localPosition(thepoint);
00146 badrocpositions.push_back(localpoint);
00147 break;
00148 }
00149 }
00150 }
00151 }
00152 return badrocpositions;
00153 }
00154
00155
00156 bool SiPixelQuality::IsFedBad(const uint32_t & detid) const{
00157 return false;
00158 }
00159
00160
00161