52 thresholdL1_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
53 .getUntrackedParameter<double>(
"thresholdL1")),
54 thresholdL2_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
55 .getUntrackedParameter<double>(
"thresholdL2")),
56 thresholdL3_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
57 .getUntrackedParameter<double>(
"thresholdL3")),
58 thresholdL4_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
59 .getUntrackedParameter<double>(
"thresholdL4")),
60 thresholdRNG1_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
61 .getUntrackedParameter<double>(
"thresholdRNG1")),
62 thresholdRNG2_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
63 .getUntrackedParameter<double>(
"thresholdRNG2")),
64 outputBase_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
65 .getUntrackedParameter<
std::
string>(
"outputBase")),
67 iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters").getUntrackedParameter<
int>(
"aveDigiOcc")),
68 nLumi_(iConfig.getParameter<
edm::
ParameterSet>(
"SiPixelStatusManagerParameters")
69 .getUntrackedParameter<
int>(
"resetEveryNLumi")),
70 moduleName_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
71 .getUntrackedParameter<
std::
string>(
"moduleName")),
72 label_(iConfig.getParameter<
ParameterSet>(
"SiPixelStatusManagerParameters")
73 .getUntrackedParameter<
std::
string>(
"label")),
101 for (
auto& histoman :
histo) {
102 histoman.book(iBooker, iSetup);
127 int detid =
detId.rawId();
136 unsigned int nrocs = nROCrows * nROCcolumns;
139 std::map<int, std::pair<int, int>> rocToOfflinePixel;
142 typedef std::vector<sipixelobjects::CablingPathToDetUnit>::const_iterator
IT;
146 int idInDetUnit = (
int)
roc->idInDetUnit();
152 rocToOfflinePixel[idInDetUnit] = std::pair<int, int>(global.
row, global.
col);
163 std::map<edm::LuminosityBlockNumber_t, std::map<int, std::vector<int>>> FEDerror25Map =
165 std::map<edm::LuminosityBlockNumber_t, SiPixelDetectorStatus> siPixelStatusMap =
176 for (
unsigned int i = 0;
i < badComponentList.size();
i++) {
179 uint32_t
detId = badComponentList[
i].DetID;
183 for (
int iroc = 0; iroc <
int(nroc); iroc++) {
185 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
186 int row = rocToOfflinePixel[iroc].first;
187 int column = rocToOfflinePixel[iroc].second;
198 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> finalIOV;
199 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> fedError25IOV;
200 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> pclIOV;
203 std::map<int, SiPixelQuality> siPixelQualityStuckTBM_Tag;
214 if (nextIt != FEDerror25Map.end())
222 std::map<int, std::vector<int>> tmpFEDerror25 =
it->second;
223 for (
std::map<
int, std::vector<int>>::iterator ilist = tmpFEDerror25.begin(); ilist != tmpFEDerror25.end();
225 int detid = ilist->first;
226 uint32_t
detId = uint32_t(detid);
230 BadModule_stuckTBM.
DetID = uint32_t(detid);
231 BadModule_FEDerror25.
DetID = uint32_t(detid);
235 BadModule_stuckTBM.
BadRocs = 0;
236 BadModule_FEDerror25.
BadRocs = 0;
237 std::vector<uint32_t> BadRocList_stuckTBM, BadRocList_FEDerror25;
238 std::vector<int> list = ilist->second;
240 for (
unsigned int i = 0;
i < list.size();
i++) {
242 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
243 int row = rocToOfflinePixel[iroc].first;
244 int column = rocToOfflinePixel[iroc].second;
246 BadRocList_FEDerror25.push_back(uint32_t(iroc));
247 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
253 BadRocList_stuckTBM.push_back(uint32_t(iroc));
254 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
261 if (BadRocList_stuckTBM.size() ==
sensorSize_[detid])
264 short badrocs_stuckTBM = 0;
265 for (std::vector<uint32_t>::iterator iter = BadRocList_stuckTBM.begin(); iter != BadRocList_stuckTBM.end();
267 badrocs_stuckTBM += 1 << *iter;
270 if (badrocs_stuckTBM != 0) {
271 BadModule_stuckTBM.
BadRocs = badrocs_stuckTBM;
276 if (BadRocList_FEDerror25.size() ==
sensorSize_[detid])
279 short badrocs_FEDerror25 = 0;
280 for (std::vector<uint32_t>::iterator iter = BadRocList_FEDerror25.begin(); iter != BadRocList_FEDerror25.end();
282 badrocs_FEDerror25 += 1 << *iter;
285 if (badrocs_FEDerror25 != 0) {
286 BadModule_FEDerror25.
BadRocs = badrocs_FEDerror25;
292 siPixelQualityStuckTBM_Tag[
it->first] = siPixelQuality_stuckTBM;
294 finalIOV[
it->first] =
it->first;
295 fedError25IOV[
it->first] =
it->first;
304 finalIOV[
it->first] =
it->first;
305 pclIOV[
it->first] =
it->first;
309 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
312 std::map<int, SiPixelQuality> siPixelQualityPCL_Tag;
313 std::map<int, SiPixelQuality> siPixelQualityPrompt_Tag;
314 std::map<int, SiPixelQuality> siPixelQualityOther_Tag;
316 for (itIOV = finalIOV.begin(); itIOV != finalIOV.end(); itIOV++) {
318 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV =
std::next(itIOV);
319 if (nextItIOV != finalIOV.end())
320 interval =
int(nextItIOV->first - itIOV->first);
328 std::map<int, std::vector<int>> tmpFEDerror25 = FEDerror25Map[lumiFEDerror25];
338 <<
"Tag requested for prompt in low statistics IOV in the " <<
outputBase_ <<
" harvester" << std::endl;
339 siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPermBad;
340 siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPermBad;
343 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
344 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
345 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
346 int detid = itMod->first;
347 uint32_t
detId = uint32_t(detid);
350 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
352 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
353 int row = rocToOfflinePixel[iroc].first;
354 int column = rocToOfflinePixel[iroc].second;
355 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
368 <<
"Tag requested for other in low statistics IOV in the " <<
outputBase_ <<
" harvester" << std::endl;
382 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
383 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
384 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
388 int detid = itMod->first;
389 uint32_t
detId = uint32_t(detid);
392 double local_threshold = 0.0;
411 BadModulePCL.
DetID = uint32_t(detid);
412 BadModuleOther.
DetID = uint32_t(detid);
418 std::vector<uint32_t> BadRocListPCL, BadRocListOther;
422 std::vector<int> listFEDerror25 = tmpFEDerror25[detid];
424 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
425 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
426 unsigned int rocOccupancy = modStatus.
digiOccROC(iroc);
428 int row = rocToOfflinePixel[iroc].first;
429 int column = rocToOfflinePixel[iroc].second;
432 if (rocOccupancy < local_threshold * DetAverage_local) {
435 BadRocListPCL.push_back(uint32_t(iroc));
436 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
441 std::vector<int>::iterator
it =
std::find(listFEDerror25.begin(), listFEDerror25.end(), iroc);
446 BadRocListOther.push_back(uint32_t(iroc));
447 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
463 short badrocsPCL = 0;
464 for (std::vector<uint32_t>::iterator iterPCL = BadRocListPCL.begin(); iterPCL != BadRocListPCL.end();
466 badrocsPCL += 1 << *iterPCL;
468 if (badrocsPCL != 0) {
469 BadModulePCL.
BadRocs = badrocsPCL;
474 short badrocsOther = 0;
475 for (std::vector<uint32_t>::iterator iterOther = BadRocListOther.begin(); iterOther != BadRocListOther.end();
477 badrocsOther += 1 << *iterOther;
479 if (badrocsOther != 0) {
480 BadModuleOther.
BadRocs = badrocsOther;
486 BadModulePrompt.
DetID = uint32_t(detid);
490 std::vector<uint32_t> BadRocListPrompt;
491 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
494 BadRocListPrompt.push_back(uint32_t(iroc));
496 std::map<int, std::pair<int, int>> rocToOfflinePixel =
pixelO2O_[detid];
497 int row = rocToOfflinePixel[iroc].first;
498 int column = rocToOfflinePixel[iroc].second;
499 for (
int iLumi = 0; iLumi <
interval; iLumi++) {
509 short badrocsPrompt = 0;
510 for (std::vector<uint32_t>::iterator iterPrompt = BadRocListPrompt.begin();
511 iterPrompt != BadRocListPrompt.end();
513 badrocsPrompt += 1 << *iterPrompt;
515 if (badrocsPrompt != 0) {
516 BadModulePrompt.
BadRocs = badrocsPrompt;
523 siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPCL;
525 siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPrompt;
527 siPixelQualityOther_Tag[itIOV->first] = siPixelQualityOther;
546 itIOV = std::prev(finalIOV.end());
547 SiPixelQuality lastPrompt = siPixelQualityPrompt_Tag[itIOV->first];
580 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
581 for (itIOV = IOV.begin(); itIOV != IOV.end(); itIOV++) {
582 std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV;
586 if (nextItIOV != IOV.end()) {
587 if (pin >= itIOV->first && pin < nextItIOV->
first) {
591 if (pin >= itIOV->first) {
598 return (IOV.begin())->
first;
603 std::vector<SiPixelQuality::disabledModuleType> badRocListA;
604 std::vector<SiPixelQuality::disabledModuleType> badRocListB;
606 for (
unsigned int ia = 0; ia < (
a.getBadComponentList()).
size(); ia++) {
607 badRocListA.push_back((
a.getBadComponentList())[ia]);
609 for (
unsigned int ib = 0;
ib < (
b.getBadComponentList()).
size();
ib++) {
610 badRocListB.push_back((
b.getBadComponentList())[
ib]);
613 if (badRocListA.size() != badRocListB.size())
620 for (
unsigned int i = 0;
i < badRocListA.size();
i++) {
621 uint32_t detIdA = badRocListA[
i].DetID;
622 uint32_t detIdB = badRocListB[
i].DetID;
623 if (detIdA != detIdB)
626 unsigned short BadRocsA = badRocListA[
i].BadRocs;
627 unsigned short BadRocsB = badRocListB[
i].BadRocs;
628 if (BadRocsA != BadRocsB)
643 for (std::map<int, SiPixelQuality>::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end(); ++qIt) {
648 if (qIt == siPixelQualityTag.begin())
661 unsigned long int ave(0);
667 std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.
getDetectorStatus();
668 std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
669 for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
674 unsigned long int inc = itMod->second.digiOccMOD();
676 nrocs += itMod->second.nrocs();
680 return ave * 1.0 /
nrocs;
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) final
void addDisabledModule(disabledModuleType module)
SiPixelCoordinates coord_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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_
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
static std::string to_string(const XMLCh *ch)
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > siPixelFedCablingMapToken_
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)
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()
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
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
std::map< edm::LuminosityBlockNumber_t, SiPixelDetectorStatus >::iterator siPixelStatusMap_iterator