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")),
107 for (
auto& histoman :
histo) {
108 histoman.book(iBooker, iSetup);
129 const PixelGeomDetUnit* pgdu = dynamic_cast<const PixelGeomDetUnit*>((*it));
132 DetId detId = (*it)->geographicalId();
133 int detid = detId.
rawId();
142 unsigned int nrocs = nROCrows * nROCcolumns;
145 std::map<int, std::pair<int, int>> rocToOfflinePixel;
148 typedef std::vector<sipixelobjects::CablingPathToDetUnit>::const_iterator
IT;
149 for (
IT it =
path.begin(); it !=
path.end(); ++it) {
152 int idInDetUnit = (
int)
roc->idInDetUnit();
158 rocToOfflinePixel[idInDetUnit] = std::pair<int, int>(global.
row, global.
col);
169 std::map<edm::LuminosityBlockNumber_t, std::map<int, std::vector<int>>> FEDerror25Map =
171 std::map<edm::LuminosityBlockNumber_t, SiPixelDetectorStatus> siPixelStatusMap =
182 for (
unsigned int i = 0;
i < badComponentList.size();
i++) {
185 uint32_t detId = badComponentList[
i].DetID;
186 int detid =
int(detId);
189 for (
int iroc = 0; iroc <
int(nroc); iroc++) {
191 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
192 int row = rocToOfflinePixel[iroc].first;
193 int column = rocToOfflinePixel[iroc].second;
204 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> finalIOV;
205 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> fedError25IOV;
206 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> pclIOV;
209 std::map<int, SiPixelQuality*> siPixelQualityStuckTBM_Tag;
220 if (nextIt != FEDerror25Map.end())
221 interval =
int(nextIt->first - it->first);
228 std::map<int, std::vector<int>> tmpFEDerror25 = it->second;
229 for (
std::map<
int, std::vector<int>>::iterator ilist = tmpFEDerror25.begin(); ilist != tmpFEDerror25.end();
231 int detid = ilist->first;
232 uint32_t detId = uint32_t(detid);
236 BadModule_stuckTBM.
DetID = uint32_t(detid);
237 BadModule_FEDerror25.
DetID = uint32_t(detid);
241 BadModule_stuckTBM.
BadRocs = 0;
242 BadModule_FEDerror25.
BadRocs = 0;
243 std::vector<uint32_t> BadRocList_stuckTBM, BadRocList_FEDerror25;
244 std::vector<int>
list = ilist->second;
246 for (
unsigned int i = 0;
i <
list.size();
i++) {
248 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
249 int row = rocToOfflinePixel[iroc].first;
250 int column = rocToOfflinePixel[iroc].second;
252 BadRocList_FEDerror25.push_back(uint32_t(iroc));
253 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
259 BadRocList_stuckTBM.push_back(uint32_t(iroc));
260 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
267 if (BadRocList_stuckTBM.size() ==
sensorSize_[detid])
270 short badrocs_stuckTBM = 0;
271 for (std::vector<uint32_t>::iterator iter = BadRocList_stuckTBM.begin(); iter != BadRocList_stuckTBM.end();
273 badrocs_stuckTBM += 1 << *iter;
276 if (badrocs_stuckTBM != 0) {
277 BadModule_stuckTBM.
BadRocs = badrocs_stuckTBM;
282 if (BadRocList_FEDerror25.size() ==
sensorSize_[detid])
285 short badrocs_FEDerror25 = 0;
286 for (std::vector<uint32_t>::iterator iter = BadRocList_FEDerror25.begin(); iter != BadRocList_FEDerror25.end();
288 badrocs_FEDerror25 += 1 << *iter;
291 if (badrocs_FEDerror25 != 0) {
292 BadModule_FEDerror25.
BadRocs = badrocs_FEDerror25;
298 siPixelQualityStuckTBM_Tag[it->first] = siPixelQuality_stuckTBM;
300 finalIOV[it->first] = it->first;
301 fedError25IOV[it->first] = it->first;
306 delete siPixelQuality_FEDerror25;
312 finalIOV[it->first] = it->first;
313 pclIOV[it->first] = it->first;
317 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
320 std::map<int, SiPixelQuality*> siPixelQualityPCL_Tag;
321 std::map<int, SiPixelQuality*> siPixelQualityPrompt_Tag;
322 std::map<int, SiPixelQuality*> siPixelQualityOther_Tag;
324 for (itIOV = finalIOV.begin(); itIOV != finalIOV.end(); itIOV++) {
326 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV =
std::next(itIOV);
327 if (nextItIOV != finalIOV.end())
328 interval =
int(nextItIOV->first - itIOV->first);
336 std::map<int, std::vector<int>> tmpFEDerror25 = FEDerror25Map[lumiFEDerror25];
346 <<
"Tag requested for prompt in low statistics IOV in the " <<
outputBase_ <<
" harvester" << std::endl;
347 siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPermBad;
348 siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPermBad;
351 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
352 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
353 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
354 int detid = itMod->first;
355 uint32_t detId = uint32_t(detid);
358 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
360 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
361 int row = rocToOfflinePixel[iroc].first;
362 int column = rocToOfflinePixel[iroc].second;
363 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
376 <<
"Tag requested for other in low statistics IOV in the " <<
outputBase_ <<
" harvester" << std::endl;
390 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
391 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
392 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
396 int detid = itMod->first;
397 uint32_t detId = uint32_t(detid);
400 double local_threshold = 0.0;
419 BadModulePCL.
DetID = uint32_t(detid);
420 BadModuleOther.
DetID = uint32_t(detid);
426 std::vector<uint32_t> BadRocListPCL, BadRocListOther;
430 std::vector<int> listFEDerror25 = tmpFEDerror25[detid];
432 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
433 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
434 unsigned int rocOccupancy = modStatus.
digiOccROC(iroc);
436 int row = rocToOfflinePixel[iroc].first;
437 int column = rocToOfflinePixel[iroc].second;
440 if (rocOccupancy < local_threshold * DetAverage_local) {
443 BadRocListPCL.push_back(uint32_t(iroc));
444 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
449 std::vector<int>::iterator it =
std::find(listFEDerror25.begin(), listFEDerror25.end(), iroc);
454 BadRocListOther.push_back(uint32_t(iroc));
455 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
471 short badrocsPCL = 0;
472 for (std::vector<uint32_t>::iterator iterPCL = BadRocListPCL.begin(); iterPCL != BadRocListPCL.end();
474 badrocsPCL += 1 << *iterPCL;
476 if (badrocsPCL != 0) {
477 BadModulePCL.
BadRocs = badrocsPCL;
482 short badrocsOther = 0;
483 for (std::vector<uint32_t>::iterator iterOther = BadRocListOther.begin(); iterOther != BadRocListOther.end();
485 badrocsOther += 1 << *iterOther;
487 if (badrocsOther != 0) {
488 BadModuleOther.
BadRocs = badrocsOther;
494 BadModulePrompt.
DetID = uint32_t(detid);
498 std::vector<uint32_t> BadRocListPrompt;
499 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
502 BadRocListPrompt.push_back(uint32_t(iroc));
504 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
505 int row = rocToOfflinePixel[iroc].first;
506 int column = rocToOfflinePixel[iroc].second;
507 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
517 short badrocsPrompt = 0;
518 for (std::vector<uint32_t>::iterator iterPrompt = BadRocListPrompt.begin();
519 iterPrompt != BadRocListPrompt.end();
521 badrocsPrompt += 1 << *iterPrompt;
523 if (badrocsPrompt != 0) {
524 BadModulePrompt.
BadRocs = badrocsPrompt;
531 siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPCL;
533 siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPrompt;
535 siPixelQualityOther_Tag[itIOV->first] = siPixelQualityOther;
554 itIOV = std::prev(finalIOV.end());
555 SiPixelQuality* lastPrompt = siPixelQualityPrompt_Tag[itIOV->first];
556 SiPixelQuality* lastOther = siPixelQualityOther_Tag[itIOV->first];
569 delete siPixelQualityDummy;
572 delete siPixelQualityPermBad;
593 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
594 for (itIOV = IOV.begin(); itIOV != IOV.end(); itIOV++) {
595 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV;
599 if (nextItIOV != IOV.end()) {
600 if (pin >= itIOV->first && pin < nextItIOV->
first) {
604 if (pin >= itIOV->first) {
611 return (IOV.begin())->
first;
616 std::vector<SiPixelQuality::disabledModuleType> badRocListA;
617 std::vector<SiPixelQuality::disabledModuleType> badRocListB;
619 for (
unsigned int ia = 0; ia < (
a->getBadComponentList()).
size(); ia++) {
620 badRocListA.push_back((
a->getBadComponentList())[ia]);
622 for (
unsigned int ib = 0;
ib < (
b->getBadComponentList()).
size();
ib++) {
623 badRocListB.push_back((
b->getBadComponentList())[
ib]);
626 if (badRocListA.size() != badRocListB.size())
633 for (
unsigned int i = 0;
i < badRocListA.size();
i++) {
634 uint32_t detIdA = badRocListA[
i].DetID;
635 uint32_t detIdB = badRocListB[
i].DetID;
636 if (detIdA != detIdB)
639 unsigned short BadRocsA = badRocListA[
i].BadRocs;
640 unsigned short BadRocsB = badRocListB[
i].BadRocs;
641 if (BadRocsA != BadRocsB)
656 for (std::map<int, SiPixelQuality*>::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end();
662 if (qIt == siPixelQualityTag.begin())
675 unsigned long int ave(0);
681 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
682 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
683 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
688 unsigned long int inc = itMod->second.digiOccMOD();
690 nrocs += itMod->second.nrocs();
694 return ave * 1.0 /
nrocs;