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)
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;
451 uint32_t newDetId = detid;
457 if (fid == realfedID) {
461 uint32_t detSubId = detId.
subdetId();
463 bool HalfModule =
false;
467 }
else if (detSubId == 1) {
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;
491 formatter.toCabling(cabling,
detector);
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. "