41 #include "TImageDump.h"
43 #include "TPaveLabel.h"
44 #include "TPaveText.h"
48 #include "TStopwatch.h"
68 edm::LogInfo(
"SiPixelInformationExtractor") <<
" Creating SiPixelInformationExtractor "
79 edm::LogInfo(
"SiPixelInformationExtractor") <<
" Deleting SiPixelInformationExtractor "
94 if (qtype.find(
"TH1") != string::npos) {
96 }
else if (qtype.find(
"TH2") != string::npos) {
98 }
else if (qtype.find(
"TH3") != string::npos) {
111 vector<string> &
items) {
113 for (multimap<string, string>::const_iterator it = req_map.begin(); it != req_map.end(); it++) {
114 if (it->first == item_name) {
115 items.push_back(it->second);
126 multimap<string, string>::iterator pos = req_map.find(item_name);
127 if (pos != req_map.end())
139 std::multimap<std::string, std::string>::const_iterator pos = req_map.find(item_name);
141 if (pos != req_map.end()) {
148 std::multimap<std::string, std::string>::iterator pos = req_map.find(item_name);
150 if (pos != req_map.end()) {
177 for (vector<QReport *>::const_iterator it = reports.begin(); it != reports.end(); it++) {
178 status = (*it)->getStatus();
189 name =
"images/LI_green.gif";
191 name =
"images/LI_yellow.gif";
193 name =
"images/LI_red.gif";
195 name =
"images/LI_orange.gif";
197 name =
"images/LI_blue.gif";
205 for (vector<QReport *>::const_iterator it = reports.begin(); it != reports.end(); it++) {
206 status = (*it)->getStatus();
218 double normalizationX = 1;
219 double normalizationY = 1;
225 pair<double, double> normX;
226 pair<double, double> normY;
230 if (theMEType.find(
"TH1") != string::npos) {
231 meanX = (double)theME->
getMean();
233 normalizationX = fabs(normX.second - normX.first);
234 if (normalizationX == 0) {
235 normalizationX = 1.E-20;
237 colorValue = meanX / normalizationX;
238 norm.first = normX.first;
239 norm.second = normX.second;
242 if (theMEType.find(
"TH2") != string::npos) {
243 meanX = (double)theME->
getMean(1);
244 meanY = (double)theME->
getMean(2);
246 normalizationX = fabs(normX.second - normX.first);
247 normalizationY = fabs(normY.second - normY.first);
248 if (normalizationX == 0) {
249 normalizationX = 1.E-20;
251 if (normalizationY == 0) {
252 normalizationY = 1.E-20;
254 double cVX = meanX / normalizationX;
255 double cVY = meanY / normalizationY;
256 colorValue =
sqrt(cVX * cVX + cVY * cVY);
257 if (normalizationX >= normalizationY) {
258 norm.first = normX.first;
259 norm.second = normX.second;
261 norm.first = normY.first;
262 norm.second = normY.second;
274 pair<double, double> &norm,
279 if (theMEType.find(
"TH1") != string::npos) {
281 norm.first = normLow;
282 norm.second = normHigh;
291 pair<double, double> &normX,
292 pair<double, double> &normY,
297 if (theMEType.find(
"TH2") != string::npos) {
299 normX.first = normLow;
300 normX.second = normHigh;
302 normY.first = normLow;
303 normY.second = normHigh;
313 const string &mEName = mE->
getName();
317 if (mEName.find(
"_3") != string::npos) {
318 string detIdString = mEName.substr((mEName.find_last_of(
'_')) + 1, 9);
319 std::istringstream isst;
320 isst.str(detIdString);
331 if (noiseRate_ >= 0.) {
350 int noiseRateDenominator_,
360 nevents_ = (iGetter.
get(
"Pixel/EventInfo/processedEvents"))->getIntValue();
364 myfile_.open(
"NoisyPixelList.txt", ios::app);
365 myfile_ <<
"Noise summary, ran over " <<
nevents_ <<
" events, threshold was set to " << noiseRate_ << std::endl;
367 string currDir = iBooker.
pwd();
368 string dname = currDir.substr(currDir.find_last_of(
'/') + 1);
370 if (dname.find(
"Module_") != string::npos) {
371 vector<string> meVec = iGetter.
getMEs();
372 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
373 string full_path = currDir +
"/" + (*it);
374 if (full_path.find(
"hitmap_siPixelDigis") != string::npos) {
381 std::vector<std::pair<std::pair<int, int>,
float>> noisyPixelsInModule;
382 TH2F *hothisto = me->
getTH2F();
384 for (
int i = 1;
i != hothisto->GetNbinsX() + 1;
i++) {
385 for (
int j = 1;
j != hothisto->GetNbinsY() + 1;
j++) {
387 if (me->
getPathname().find(
"Barrel") != string::npos) {
391 }
else if (me->
getPathname().find(
"Endcap") != string::npos) {
396 if (value > noiseRate_) {
400 std::pair<int, int> address(pixcol, pixrow);
401 std::pair<std::pair<int, int>,
float> PixelStats(address, value);
402 noisyPixelsInModule.push_back(PixelStats);
411 vector<string> subDirVec = iGetter.
getSubdirs();
412 for (vector<string>::const_iterator ic = subDirVec.begin(); ic != subDirVec.end(); ic++) {
413 if ((*ic).find(
"AdditionalPixelErrors") != string::npos)
418 findNoisyPixels(iBooker, iGetter, init, noiseRate_, noiseRateDenominator_, theCablingMap);
423 if (iBooker.
pwd().find(
"EventInfo") != string::npos)
428 if (currDir ==
"Pixel/EventInfo/reportSummaryContents") {
429 std::vector<std::pair<sipixelobjects::DetectorIndex, double>> pixelvec;
430 std::map<uint32_t, int> myfedmap;
431 std::map<uint32_t, std::string> mynamemap;
434 int n_noisyrocs_all = 0;
435 int n_noisyrocs_barrel = 0;
436 int n_noisyrocs_endcap = 0;
437 int n_verynoisyrocs_all = 0;
438 int n_verynoisyrocs_barrel = 0;
439 int n_verynoisyrocs_endcap = 0;
441 for (
int fid = 0; fid < 40; fid++) {
442 for (std::map<uint32_t,
std::vector<std::pair<std::pair<int, int>,
float>>>::const_iterator it =
446 uint32_t detid = (*it).first;
447 std::vector<std::pair<std::pair<int, int>,
float>> noisyPixels = (*it).second;
449 for (
int fedid = 0; fedid <= 40; ++fedid) {
451 uint32_t newDetId = detid;
457 if (fid == realfedID) {
461 uint32_t detSubId = detId.
subdetId();
463 bool HalfModule =
false;
466 outputname = nameworker.
name();
467 }
else if (detSubId == 1) {
469 outputname = nameworker.
name();
475 std::map<int, int> myrocmap;
476 myfedmap[detid] = realfedID;
479 for (
std::vector<std::pair<std::pair<int, int>,
float>>::const_iterator pxl = noisyPixels.begin();
480 pxl != noisyPixels.end();
482 std::pair<int, int> offlineaddress = (*pxl).first;
483 float Noise_frac = (*pxl).second;
484 int offlineColumn = offlineaddress.first;
485 int offlineRow = offlineaddress.second;
505 static_cast<unsigned int>(cabling.
link),
506 static_cast<unsigned int>(cabling.
roc)};
510 int onlineColumn = locpixel.
rocCol();
511 int onlineRow = locpixel.
rocRow();
521 if ((detSubId == 1) && (outputname.find(
"mO") != string::npos || outputname.find(
"mI") != string::npos) &&
528 myfile_ <<
"NAME: " << outputname <<
" , DETID: " << detid <<
" , OFFLINE: col,row: " << offlineColumn
529 <<
"," << offlineRow <<
" \t , ONLINE: roc,col,row: " << rocnumber <<
"," << onlineColumn <<
","
530 << onlineRow <<
" \t , fed,dcol,pixid,link: " << realfedID <<
"," << loc.
dcol <<
"," << loc.
pxid
531 <<
"," << cabling.
link <<
", Noise fraction: " << Noise_frac << std::endl;
533 for (std::map<int, int>::const_iterator nrc = myrocmap.begin(); nrc != myrocmap.end(); nrc++) {
534 if ((*nrc).second > 0) {
537 n_noisyrocs_endcap++;
538 }
else if (detSubId == 1) {
539 n_noisyrocs_barrel++;
542 if ((*nrc).second > 40) {
543 n_verynoisyrocs_all++;
545 n_verynoisyrocs_endcap++;
546 }
else if (detSubId == 1) {
547 n_verynoisyrocs_barrel++;
554 myfile_ <<
"There are " << n_noisyrocs_all
555 <<
" noisy ROCs (ROCs with at least 1 noisy pixel) in the entire "
557 << n_noisyrocs_endcap <<
" are in the FPIX and " << n_noisyrocs_barrel <<
" are in the BPIX. " << endl;
558 myfile_ <<
"There are " << n_verynoisyrocs_all
559 <<
" highly noisy ROCs (ROCs with at least 10% of all pixels "
560 "passing the noise threshold) in the entire detector. "
561 << n_verynoisyrocs_endcap <<
" are in the FPIX and " << n_verynoisyrocs_barrel <<
" are in the BPIX. "
virtual TH2F * getTH2F() const
virtual int getNbinsY() const
get # of bins in Y-axis
virtual void setCurrentFolder(std::string const &fullpath)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
const std::string & getPathname() const
get pathname of parent folder
virtual std::string pwd()
const std::string & getName() const
get name of ME
identify pixel inside single ROC
bool isHalfModule() const
full or half module
virtual int getNbinsX() const
get # of bins in X-axis
std::string name() const override
from base class
virtual MonitorElement * get(std::string const &fullpath) const
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &path) const final
double collumn and pixel ID in double collumn representation
Log< level::Info, false > LogInfo
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
std::string name() const override
from base class
int toCabling(sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
virtual std::vector< std::string > getMEs() const
static std::atomic< unsigned int > counter
bool hasDetUnit(uint32_t radId) const
static const int STATUS_OK
TObject * getRootObject() const override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)