55 thresholdL1_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
56 .getUntrackedParameter<double>(
"thresholdL1")),
57 thresholdL2_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
58 .getUntrackedParameter<double>(
"thresholdL2")),
59 thresholdL3_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
60 .getUntrackedParameter<double>(
"thresholdL3")),
61 thresholdL4_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
62 .getUntrackedParameter<double>(
"thresholdL4")),
63 thresholdRNG1_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
64 .getUntrackedParameter<double>(
"thresholdRNG1")),
65 thresholdRNG2_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
66 .getUntrackedParameter<double>(
"thresholdRNG2")),
67 outputBase_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
68 .getUntrackedParameter<
std::
string>(
"outputBase")),
70 iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters").getUntrackedParameter<
int>(
"aveDigiOcc")),
71 nLumi_(iConfig.getParameter<
edm::
ParameterSet>(
"SiPixelStatusManagerParameters")
72 .getUntrackedParameter<
int>(
"resetEveryNLumi")),
73 moduleName_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
74 .getUntrackedParameter<
std::
string>(
"moduleName")),
75 label_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
76 .getUntrackedParameter<
std::
string>(
"label")),
104 for (
auto& histoman :
histo) {
105 histoman.book(iBooker, iSetup);
129 DetId detId = (*it)->geographicalId();
130 int detid = detId.
rawId();
139 unsigned int nrocs = nROCrows * nROCcolumns;
142 std::map<int, std::pair<int, int>> rocToOfflinePixel;
145 typedef std::vector<sipixelobjects::CablingPathToDetUnit>::const_iterator
IT;
146 for (
IT it =
path.begin(); it !=
path.end(); ++it) {
149 int idInDetUnit = (
int)
roc->idInDetUnit();
155 rocToOfflinePixel[idInDetUnit] = std::pair<int, int>(global.
row, global.
col);
166 std::map<edm::LuminosityBlockNumber_t, std::map<int, std::vector<int>>> FEDerror25Map =
168 std::map<edm::LuminosityBlockNumber_t, SiPixelDetectorStatus> siPixelStatusMap =
179 for (
unsigned int i = 0;
i < badComponentList.size();
i++) {
182 uint32_t detId = badComponentList[
i].DetID;
183 int detid =
int(detId);
186 for (
int iroc = 0; iroc <
int(nroc); iroc++) {
188 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
189 int row = rocToOfflinePixel[iroc].first;
190 int column = rocToOfflinePixel[iroc].second;
201 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> finalIOV;
202 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> fedError25IOV;
203 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> pclIOV;
206 std::map<int, SiPixelQuality> siPixelQualityStuckTBM_Tag;
217 if (nextIt != FEDerror25Map.end())
218 interval =
int(nextIt->first - it->first);
225 std::map<int, std::vector<int>> tmpFEDerror25 = it->second;
226 for (
std::map<
int, std::vector<int>>::iterator ilist = tmpFEDerror25.begin(); ilist != tmpFEDerror25.end();
228 int detid = ilist->first;
229 uint32_t detId = uint32_t(detid);
233 BadModule_stuckTBM.
DetID = uint32_t(detid);
234 BadModule_FEDerror25.
DetID = uint32_t(detid);
238 BadModule_stuckTBM.
BadRocs = 0;
239 BadModule_FEDerror25.
BadRocs = 0;
240 std::vector<uint32_t> BadRocList_stuckTBM, BadRocList_FEDerror25;
241 std::vector<int> list = ilist->second;
243 for (
unsigned int i = 0;
i < list.size();
i++) {
245 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
246 int row = rocToOfflinePixel[iroc].first;
247 int column = rocToOfflinePixel[iroc].second;
249 BadRocList_FEDerror25.push_back(uint32_t(iroc));
250 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
256 BadRocList_stuckTBM.push_back(uint32_t(iroc));
257 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
264 if (BadRocList_stuckTBM.size() ==
sensorSize_[detid])
267 short badrocs_stuckTBM = 0;
268 for (std::vector<uint32_t>::iterator iter = BadRocList_stuckTBM.begin(); iter != BadRocList_stuckTBM.end();
270 badrocs_stuckTBM += 1 << *iter;
273 if (badrocs_stuckTBM != 0) {
274 BadModule_stuckTBM.
BadRocs = badrocs_stuckTBM;
279 if (BadRocList_FEDerror25.size() ==
sensorSize_[detid])
282 short badrocs_FEDerror25 = 0;
283 for (std::vector<uint32_t>::iterator iter = BadRocList_FEDerror25.begin(); iter != BadRocList_FEDerror25.end();
285 badrocs_FEDerror25 += 1 << *iter;
288 if (badrocs_FEDerror25 != 0) {
289 BadModule_FEDerror25.
BadRocs = badrocs_FEDerror25;
295 siPixelQualityStuckTBM_Tag[it->first] = siPixelQuality_stuckTBM;
297 finalIOV[it->first] = it->first;
298 fedError25IOV[it->first] = it->first;
307 finalIOV[it->first] = it->first;
308 pclIOV[it->first] = it->first;
312 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
315 std::map<int, SiPixelQuality> siPixelQualityPCL_Tag;
316 std::map<int, SiPixelQuality> siPixelQualityPrompt_Tag;
317 std::map<int, SiPixelQuality> siPixelQualityOther_Tag;
319 for (itIOV = finalIOV.begin(); itIOV != finalIOV.end(); itIOV++) {
321 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV =
std::next(itIOV);
322 if (nextItIOV != finalIOV.end())
323 interval =
int(nextItIOV->first - itIOV->first);
331 std::map<int, std::vector<int>> tmpFEDerror25 = FEDerror25Map[lumiFEDerror25];
341 <<
"Tag requested for prompt in low statistics IOV in the " <<
outputBase_ <<
" harvester" << std::endl;
342 siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPermBad;
343 siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPermBad;
346 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
347 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
348 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
349 int detid = itMod->first;
350 uint32_t detId = uint32_t(detid);
353 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
355 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
356 int row = rocToOfflinePixel[iroc].first;
357 int column = rocToOfflinePixel[iroc].second;
358 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
371 <<
"Tag requested for other in low statistics IOV in the " <<
outputBase_ <<
" harvester" << std::endl;
385 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
386 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
387 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
391 int detid = itMod->first;
392 uint32_t detId = uint32_t(detid);
395 double local_threshold = 0.0;
414 BadModulePCL.
DetID = uint32_t(detid);
415 BadModuleOther.
DetID = uint32_t(detid);
421 std::vector<uint32_t> BadRocListPCL, BadRocListOther;
425 std::vector<int> listFEDerror25 = tmpFEDerror25[detid];
427 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
428 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
429 unsigned int rocOccupancy = modStatus.
digiOccROC(iroc);
431 int row = rocToOfflinePixel[iroc].first;
432 int column = rocToOfflinePixel[iroc].second;
435 if (rocOccupancy < local_threshold * DetAverage_local) {
438 BadRocListPCL.push_back(uint32_t(iroc));
439 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
444 std::vector<int>::iterator it =
std::find(listFEDerror25.begin(), listFEDerror25.end(), iroc);
449 BadRocListOther.push_back(uint32_t(iroc));
450 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
466 short badrocsPCL = 0;
467 for (std::vector<uint32_t>::iterator iterPCL = BadRocListPCL.begin(); iterPCL != BadRocListPCL.end();
469 badrocsPCL += 1 << *iterPCL;
471 if (badrocsPCL != 0) {
472 BadModulePCL.
BadRocs = badrocsPCL;
477 short badrocsOther = 0;
478 for (std::vector<uint32_t>::iterator iterOther = BadRocListOther.begin(); iterOther != BadRocListOther.end();
480 badrocsOther += 1 << *iterOther;
482 if (badrocsOther != 0) {
483 BadModuleOther.
BadRocs = badrocsOther;
489 BadModulePrompt.
DetID = uint32_t(detid);
493 std::vector<uint32_t> BadRocListPrompt;
494 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
497 BadRocListPrompt.push_back(uint32_t(iroc));
499 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
500 int row = rocToOfflinePixel[iroc].first;
501 int column = rocToOfflinePixel[iroc].second;
502 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
512 short badrocsPrompt = 0;
513 for (std::vector<uint32_t>::iterator iterPrompt = BadRocListPrompt.begin();
514 iterPrompt != BadRocListPrompt.end();
516 badrocsPrompt += 1 << *iterPrompt;
518 if (badrocsPrompt != 0) {
519 BadModulePrompt.
BadRocs = badrocsPrompt;
526 siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPCL;
528 siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPrompt;
530 siPixelQualityOther_Tag[itIOV->first] = siPixelQualityOther;
549 itIOV = std::prev(finalIOV.end());
550 SiPixelQuality lastPrompt = siPixelQualityPrompt_Tag[itIOV->first];
583 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
584 for (itIOV = IOV.begin(); itIOV != IOV.end(); itIOV++) {
585 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV;
589 if (nextItIOV != IOV.end()) {
590 if (pin >= itIOV->first && pin < nextItIOV->
first) {
594 if (pin >= itIOV->first) {
601 return (IOV.begin())->
first;
606 std::vector<SiPixelQuality::disabledModuleType> badRocListA;
607 std::vector<SiPixelQuality::disabledModuleType> badRocListB;
609 for (
unsigned int ia = 0; ia < (
a.getBadComponentList()).
size(); ia++) {
610 badRocListA.push_back((
a.getBadComponentList())[ia]);
612 for (
unsigned int ib = 0;
ib < (
b.getBadComponentList()).
size();
ib++) {
613 badRocListB.push_back((
b.getBadComponentList())[
ib]);
616 if (badRocListA.size() != badRocListB.size())
623 for (
unsigned int i = 0;
i < badRocListA.size();
i++) {
624 uint32_t detIdA = badRocListA[
i].DetID;
625 uint32_t detIdB = badRocListB[
i].DetID;
626 if (detIdA != detIdB)
629 unsigned short BadRocsA = badRocListA[
i].BadRocs;
630 unsigned short BadRocsB = badRocListB[
i].BadRocs;
631 if (BadRocsA != BadRocsB)
646 for (std::map<int, SiPixelQuality>::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end(); ++qIt) {
651 if (qIt == siPixelQualityTag.begin())
664 unsigned long int ave(0);
670 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
671 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
672 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
677 unsigned long int inc = itMod->second.digiOccMOD();
679 nrocs += itMod->second.nrocs();
683 return ave * 1.0 /
nrocs;
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) final
void addDisabledModule(disabledModuleType module)
SiPixelCoordinates coord_
std::map< int, unsigned int > sensorSize_
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
virtual int ncolumns() const =0
void constructTag(std::map< int, SiPixelQuality > siPixelQualityTag, edm::Service< cond::service::PoolDBOutputService > &poolDbService, std::string tagName, edm::Run const &iRun)
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
edm::LuminosityBlockNumber_t endLumiBlock_
virtual int rowsperroc() const =0
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &, const edm::EventSetup &) final
virtual int nrows() const =0
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
std::string to_string(const V &value)
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
void analyze(const edm::Event &iEvent, const edm::EventSetup &) final
edm::LuminosityBlockNumber_t stepIOV(edm::LuminosityBlockNumber_t pin, std::map< edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t > IOV)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned int LuminosityBlockNumber_t
~SiPixelStatusHarvester() override
SiPixelStatusManager siPixelStatusManager_
identify pixel inside single ROC
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > siPixelFedCablingMapToken_
constexpr std::array< uint8_t, layerIndexSize > layer
global coordinates (row and column in DetUnit, as in PixelDigi)
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
std::map< int, std::map< int, std::pair< int, int > > > pixelO2O_
virtual std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > det2PathMap() const =0
const std::vector< disabledModuleType > getBadComponentList() const
unsigned long long Time_t
std::string substructure(int detid)
const SiPixelQuality * badPixelInfo_
virtual int colsperroc() const =0
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const std::map< edm::LuminosityBlockNumber_t, SiPixelDetectorStatus > & getBadComponents()
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
const std::map< edm::LuminosityBlockNumber_t, std::map< int, std::vector< int > > > & getFEDerror25Rocs()
void init(const TrackerTopology *, const TrackerGeometry *, const SiPixelFedCablingMap *)
#define DEFINE_FWK_MODULE(type)
bool getData(T &iHolder) const
const SiPixelFedCabling * cablingMap_
std::vector< LinkConnSpec >::const_iterator IT
const TrackerGeometry * trackerGeometry_
bool equal(SiPixelQuality a, SiPixelQuality b)
void dqmEndRun(const edm::Run &, const edm::EventSetup &) final
Log< level::Info, false > LogInfo
std::map< int, SiPixelModuleStatus > getDetectorStatus()
constexpr uint32_t rawId() const
get the raw id
SiPixelStatusHarvester(const edm::ParameterSet &)
row and collumn in ROC representation
double perLayerRingAverage(int detid, SiPixelDetectorStatus tmpSiPixelStatus)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) final
std::vector< HistogramManager > histo
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
unsigned int digiOccROC(int iroc)
return ROC status (= hits on ROC iroc)
void readLumi(const edm::LuminosityBlock &)
LuminosityBlockNumber_t luminosityBlock() const
std::map< edm::LuminosityBlockNumber_t, std::map< int, std::vector< int > > >::iterator FEDerror25Map_iterator
std::map< edm::LuminosityBlockNumber_t, SiPixelDetectorStatus >::iterator siPixelStatusMap_iterator