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);
126 const PixelGeomDetUnit* pgdu = dynamic_cast<const PixelGeomDetUnit*>((*it));
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;
303 delete siPixelQuality_FEDerror25;
309 finalIOV[it->first] = it->first;
310 pclIOV[it->first] = it->first;
314 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
317 std::map<int, SiPixelQuality*> siPixelQualityPCL_Tag;
318 std::map<int, SiPixelQuality*> siPixelQualityPrompt_Tag;
319 std::map<int, SiPixelQuality*> siPixelQualityOther_Tag;
321 for (itIOV = finalIOV.begin(); itIOV != finalIOV.end(); itIOV++) {
323 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV =
std::next(itIOV);
324 if (nextItIOV != finalIOV.end())
325 interval =
int(nextItIOV->first - itIOV->first);
333 std::map<int, std::vector<int>> tmpFEDerror25 = FEDerror25Map[lumiFEDerror25];
343 <<
"Tag requested for prompt in low statistics IOV in the " <<
outputBase_ <<
" harvester" << std::endl;
344 siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPermBad;
345 siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPermBad;
348 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
349 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
350 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
351 int detid = itMod->first;
352 uint32_t detId = uint32_t(detid);
355 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
357 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
358 int row = rocToOfflinePixel[iroc].first;
359 int column = rocToOfflinePixel[iroc].second;
360 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
373 <<
"Tag requested for other in low statistics IOV in the " <<
outputBase_ <<
" harvester" << std::endl;
387 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
388 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
389 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
393 int detid = itMod->first;
394 uint32_t detId = uint32_t(detid);
397 double local_threshold = 0.0;
416 BadModulePCL.
DetID = uint32_t(detid);
417 BadModuleOther.
DetID = uint32_t(detid);
423 std::vector<uint32_t> BadRocListPCL, BadRocListOther;
427 std::vector<int> listFEDerror25 = tmpFEDerror25[detid];
429 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
430 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
431 unsigned int rocOccupancy = modStatus.
digiOccROC(iroc);
433 int row = rocToOfflinePixel[iroc].first;
434 int column = rocToOfflinePixel[iroc].second;
437 if (rocOccupancy < local_threshold * DetAverage_local) {
440 BadRocListPCL.push_back(uint32_t(iroc));
441 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
446 std::vector<int>::iterator it =
std::find(listFEDerror25.begin(), listFEDerror25.end(), iroc);
451 BadRocListOther.push_back(uint32_t(iroc));
452 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
468 short badrocsPCL = 0;
469 for (std::vector<uint32_t>::iterator iterPCL = BadRocListPCL.begin(); iterPCL != BadRocListPCL.end();
471 badrocsPCL += 1 << *iterPCL;
473 if (badrocsPCL != 0) {
474 BadModulePCL.
BadRocs = badrocsPCL;
479 short badrocsOther = 0;
480 for (std::vector<uint32_t>::iterator iterOther = BadRocListOther.begin(); iterOther != BadRocListOther.end();
482 badrocsOther += 1 << *iterOther;
484 if (badrocsOther != 0) {
485 BadModuleOther.
BadRocs = badrocsOther;
491 BadModulePrompt.
DetID = uint32_t(detid);
495 std::vector<uint32_t> BadRocListPrompt;
496 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
499 BadRocListPrompt.push_back(uint32_t(iroc));
501 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
502 int row = rocToOfflinePixel[iroc].first;
503 int column = rocToOfflinePixel[iroc].second;
504 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
514 short badrocsPrompt = 0;
515 for (std::vector<uint32_t>::iterator iterPrompt = BadRocListPrompt.begin();
516 iterPrompt != BadRocListPrompt.end();
518 badrocsPrompt += 1 << *iterPrompt;
520 if (badrocsPrompt != 0) {
521 BadModulePrompt.
BadRocs = badrocsPrompt;
528 siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPCL;
530 siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPrompt;
532 siPixelQualityOther_Tag[itIOV->first] = siPixelQualityOther;
551 itIOV = std::prev(finalIOV.end());
552 SiPixelQuality* lastPrompt = siPixelQualityPrompt_Tag[itIOV->first];
553 SiPixelQuality* lastOther = siPixelQualityOther_Tag[itIOV->first];
566 delete siPixelQualityDummy;
569 delete siPixelQualityPermBad;
590 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
591 for (itIOV = IOV.begin(); itIOV != IOV.end(); itIOV++) {
592 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV;
596 if (nextItIOV != IOV.end()) {
597 if (pin >= itIOV->first && pin < nextItIOV->
first) {
601 if (pin >= itIOV->first) {
608 return (IOV.begin())->
first;
613 std::vector<SiPixelQuality::disabledModuleType> badRocListA;
614 std::vector<SiPixelQuality::disabledModuleType> badRocListB;
616 for (
unsigned int ia = 0; ia < (
a->getBadComponentList()).
size(); ia++) {
617 badRocListA.push_back((
a->getBadComponentList())[ia]);
619 for (
unsigned int ib = 0;
ib < (
b->getBadComponentList()).
size();
ib++) {
620 badRocListB.push_back((
b->getBadComponentList())[
ib]);
623 if (badRocListA.size() != badRocListB.size())
630 for (
unsigned int i = 0;
i < badRocListA.size();
i++) {
631 uint32_t detIdA = badRocListA[
i].DetID;
632 uint32_t detIdB = badRocListB[
i].DetID;
633 if (detIdA != detIdB)
636 unsigned short BadRocsA = badRocListA[
i].BadRocs;
637 unsigned short BadRocsB = badRocListB[
i].BadRocs;
638 if (BadRocsA != BadRocsB)
653 for (std::map<int, SiPixelQuality*>::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end();
659 if (qIt == siPixelQualityTag.begin())
672 unsigned long int ave(0);
678 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
679 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
680 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
685 unsigned long int inc = itMod->second.digiOccMOD();
687 nrocs += itMod->second.nrocs();
691 return ave * 1.0 /
nrocs;