42 #include "TImageDump.h" 44 #include "TPaveLabel.h" 45 #include "TPaveText.h" 49 #include "TStopwatch.h" 69 edm::LogInfo(
"SiPixelInformationExtractor") <<
" Creating SiPixelInformationExtractor " 80 edm::LogInfo(
"SiPixelInformationExtractor") <<
" Deleting SiPixelInformationExtractor " 95 if (qtype.find(
"TH1") != string::npos) {
97 }
else if (qtype.find(
"TH2") != string::npos) {
99 }
else if (qtype.find(
"TH3") != string::npos) {
112 vector<string> &
items) {
114 for (multimap<string, string>::const_iterator it = req_map.begin(); it != req_map.end(); it++) {
115 if (it->first == item_name) {
116 items.push_back(it->second);
127 multimap<string, string>::iterator
pos = req_map.find(item_name);
128 if (pos != req_map.end())
140 std::multimap<std::string, std::string>::const_iterator
pos = req_map.find(item_name);
142 if (pos != req_map.end()) {
149 std::multimap<std::string, std::string>::iterator
pos = req_map.find(item_name);
151 if (pos != req_map.end()) {
178 for (vector<QReport *>::const_iterator it = reports.begin(); it != reports.end(); it++) {
179 status = (*it)->getStatus();
190 name =
"images/LI_green.gif";
192 name =
"images/LI_yellow.gif";
194 name =
"images/LI_red.gif";
196 name =
"images/LI_orange.gif";
198 name =
"images/LI_blue.gif";
206 for (vector<QReport *>::const_iterator it = reports.begin(); it != reports.end(); it++) {
207 status = (*it)->getStatus();
219 double normalizationX = 1;
220 double normalizationY = 1;
226 pair<double, double> normX;
227 pair<double, double> normY;
231 if (theMEType.find(
"TH1") != string::npos) {
232 meanX = (double)theME->
getMean();
234 normalizationX = fabs(normX.second - normX.first);
235 if (normalizationX == 0) {
236 normalizationX = 1.E-20;
238 colorValue = meanX / normalizationX;
239 norm.first = normX.first;
240 norm.second = normX.second;
243 if (theMEType.find(
"TH2") != string::npos) {
244 meanX = (double)theME->
getMean(1);
245 meanY = (double)theME->
getMean(2);
247 normalizationX = fabs(normX.second - normX.first);
248 normalizationY = fabs(normY.second - normY.first);
249 if (normalizationX == 0) {
250 normalizationX = 1.E-20;
252 if (normalizationY == 0) {
253 normalizationY = 1.E-20;
255 double cVX = meanX / normalizationX;
256 double cVY = meanY / normalizationY;
257 colorValue =
sqrt(cVX * cVX + cVY * cVY);
258 if (normalizationX >= normalizationY) {
259 norm.first = normX.first;
260 norm.second = normX.second;
262 norm.first = normY.first;
263 norm.second = normY.second;
275 pair<double, double> &norm,
280 if (theMEType.find(
"TH1") != string::npos) {
282 norm.first = normLow;
283 norm.second = normHigh;
292 pair<double, double> &normX,
293 pair<double, double> &normY,
298 if (theMEType.find(
"TH2") != string::npos) {
300 normX.first = normLow;
301 normX.second = normHigh;
303 normY.first = normLow;
304 normY.second = normHigh;
314 const string &mEName = mE->
getName();
318 if (mEName.find(
"_3") != string::npos) {
319 string detIdString = mEName.substr((mEName.find_last_of(
"_")) + 1, 9);
320 std::istringstream isst;
321 isst.str(detIdString);
332 if (noiseRate_ >= 0.) {
351 int noiseRateDenominator_,
361 nevents_ = (iGetter.
get(
"Pixel/EventInfo/processedEvents"))->getIntValue();
365 myfile_.open(
"NoisyPixelList.txt", ios::app);
366 myfile_ <<
"Noise summary, ran over " <<
nevents_ <<
" events, threshold was set to " << noiseRate_ << std::endl;
368 string currDir = iBooker.
pwd();
369 string dname = currDir.substr(currDir.find_last_of(
"/") + 1);
371 if (dname.find(
"Module_") != string::npos) {
372 vector<string> meVec = iGetter.
getMEs();
373 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
374 string full_path = currDir +
"/" + (*it);
375 if (full_path.find(
"hitmap_siPixelDigis") != string::npos) {
382 std::vector<std::pair<std::pair<int, int>,
float>> noisyPixelsInModule;
383 TH2F *hothisto = me->
getTH2F();
385 for (
int i = 1;
i != hothisto->GetNbinsX() + 1;
i++) {
386 for (
int j = 1; j != hothisto->GetNbinsY() + 1; j++) {
388 if (me->
getPathname().find(
"Barrel") != string::npos) {
392 }
else if (me->
getPathname().find(
"Endcap") != string::npos) {
397 if (value > noiseRate_) {
401 std::pair<int, int> address(pixcol, pixrow);
402 std::pair<std::pair<int, int>,
float> PixelStats(address, value);
403 noisyPixelsInModule.push_back(PixelStats);
412 vector<string> subDirVec = iGetter.
getSubdirs();
413 for (vector<string>::const_iterator ic = subDirVec.begin(); ic != subDirVec.end(); ic++) {
414 if ((*ic).find(
"AdditionalPixelErrors") != string::npos)
419 findNoisyPixels(iBooker, iGetter, init, noiseRate_, noiseRateDenominator_, theCablingMap);
424 if (iBooker.
pwd().find(
"EventInfo") != string::npos)
429 if (currDir ==
"Pixel/EventInfo/reportSummaryContents") {
430 std::vector<std::pair<sipixelobjects::DetectorIndex, double>> pixelvec;
431 std::map<uint32_t, int> myfedmap;
432 std::map<uint32_t, std::string> mynamemap;
435 int n_noisyrocs_all = 0;
436 int n_noisyrocs_barrel = 0;
437 int n_noisyrocs_endcap = 0;
438 int n_verynoisyrocs_all = 0;
439 int n_verynoisyrocs_barrel = 0;
440 int n_verynoisyrocs_endcap = 0;
442 for (
int fid = 0; fid < 40; fid++) {
443 for (
std::map<uint32_t, std::vector<std::pair<std::pair<int, int>,
float>>>::const_iterator it =
447 uint32_t detid = (*it).first;
448 std::vector<std::pair<std::pair<int, int>,
float>> noisyPixels = (*it).second;
450 for (
int fedid = 0; fedid <= 40; ++fedid) {
452 uint32_t newDetId = detid;
458 if (fid == realfedID) {
462 uint32_t detSubId = detId.
subdetId();
464 bool HalfModule =
false;
467 outputname = nameworker.
name();
468 }
else if (detSubId == 1) {
470 outputname = nameworker.
name();
476 std::map<int, int> myrocmap;
477 myfedmap[detid] = realfedID;
480 for (std::vector<std::pair<std::pair<int, int>,
float>>::const_iterator pxl = noisyPixels.begin();
481 pxl != noisyPixels.end();
483 std::pair<int, int> offlineaddress = (*pxl).first;
484 float Noise_frac = (*pxl).second;
485 int offlineColumn = offlineaddress.first;
486 int offlineRow = offlineaddress.second;
492 formatter.toCabling(cabling, detector);
502 assert(realfedID >= 0);
503 assert(cabling.
link >= 0);
504 assert(cabling.
roc >= 0);
506 static_cast<unsigned int>(cabling.
link),
507 static_cast<unsigned int>(cabling.
roc)};
511 int onlineColumn = locpixel.
rocCol();
512 int onlineRow = locpixel.
rocRow();
522 if ((detSubId == 1) && (outputname.find(
"mO") != string::npos || outputname.find(
"mI") != string::npos) &&
529 myfile_ <<
"NAME: " << outputname <<
" , DETID: " << detid <<
" , OFFLINE: col,row: " << offlineColumn
530 <<
"," << offlineRow <<
" \t , ONLINE: roc,col,row: " << rocnumber <<
"," << onlineColumn <<
"," 531 << onlineRow <<
" \t , fed,dcol,pixid,link: " << realfedID <<
"," << loc.
dcol <<
"," << loc.
pxid 532 <<
"," << cabling.
link <<
", Noise fraction: " << Noise_frac << std::endl;
534 for (std::map<int, int>::const_iterator nrc = myrocmap.begin(); nrc != myrocmap.end(); nrc++) {
535 if ((*nrc).second > 0) {
538 n_noisyrocs_endcap++;
539 }
else if (detSubId == 1) {
540 n_noisyrocs_barrel++;
543 if ((*nrc).second > 40) {
544 n_verynoisyrocs_all++;
546 n_verynoisyrocs_endcap++;
547 }
else if (detSubId == 1) {
548 n_verynoisyrocs_barrel++;
555 myfile_ <<
"There are " << n_noisyrocs_all
556 <<
" noisy ROCs (ROCs with at least 1 noisy pixel) in the entire " 558 << n_noisyrocs_endcap <<
" are in the FPIX and " << n_noisyrocs_barrel <<
" are in the BPIX. " << endl;
559 myfile_ <<
"There are " << n_verynoisyrocs_all
560 <<
" highly noisy ROCs (ROCs with at least 10% of all pixels " 561 "passing the noise threshold) in the entire detector. " 562 << n_verynoisyrocs_endcap <<
" are in the FPIX and " << n_verynoisyrocs_barrel <<
" are in the BPIX. "
const std::string & getPathname() const
get pathname of parent folder
TObject * getRootObject() const
void setCurrentFolder(std::string const &fullpath)
const std::string & getName() const
get name of ME
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
identify pixel inside single ROC
std::string name() const override
from base class
void setCurrentFolder(std::string const &fullpath)
bool isHalfModule() const
full or half module
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) ...
MonitorElement * book1D(Args &&...args)
std::string name() const override
from base class
double collumn and pixel ID in double collumn representation
MonitorElement * get(std::string const &path)
std::string const & pwd()
const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &path) const final
int getNbinsY() const
get # of bins in Y-axis
std::vector< std::string > getSubdirs()
static const int STATUS_OK
int getNbinsX() const
get # of bins in X-axis
std::vector< std::string > getMEs()
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const