43 #include "TPaveText.h"
44 #include "TImageDump.h"
46 #include "TStopwatch.h"
48 #include "TPaveLabel.h"
69 " Creating SiPixelInformationExtractor " <<
"\n" ;
82 " Deleting SiPixelInformationExtractor " <<
"\n" ;
263 if( qtype.find(
"TH1") != string::npos )
266 }
else if ( qtype.find(
"TH2") != string::npos ) {
268 }
else if ( qtype.find(
"TH3") != string::npos ) {
319 vector<string> & modules,
320 map<string,string> &
histos) {
322 string currDir = bei->
pwd();
324 if(currDir.find(
"Module_") != string::npos){
325 if(histos.size() == 0){
327 for (vector<string>::const_iterator it = contents.begin(); it != contents.end(); it++) {
328 string hname = (*it).substr(0, (*it).find(
"_siPixel"));
329 if(hname==
" ") hname = (*it).substr(0, (*it).find(
"_generalTracks"));
330 string fullpathname = bei->
pwd() +
"/" + (*it);
333 string htype =
"undefined" ;
337 histos[hname] = htype ;
339 if(hname.find(
"ndigis") !=string::npos) mId = (*it).substr((*it).find(
"ndigis_siPixelDigis_")+20, 9);
340 if(mId==
" " && hname.find(
"nclusters") !=string::npos) mId = (*it).substr((*it).find(
"nclusters_siPixelClusters_")+26, 9);
341 if(mId==
" " && hname.find(
"residualX") !=string::npos) mId = (*it).substr((*it).find(
"residualX_ctfWithMaterialTracks_")+32, 9);
342 if(mId==
" " && hname.find(
"NErrors") !=string::npos) mId = (*it).substr((*it).find(
"NErrors_siPixelDigis_")+21, 9);
343 if(mId==
" " && hname.find(
"ClustX") !=string::npos) mId = (*it).substr((*it).find(
"ClustX_siPixelRecHit_")+21, 9);
344 if(mId==
" " && hname.find(
"pixelAlive") !=string::npos) mId = (*it).substr((*it).find(
"pixelAlive_siPixelCalibDigis_")+29, 9);
345 if(mId==
" " && hname.find(
"Gain1d") !=string::npos) mId = (*it).substr((*it).find(
"Gain1d_siPixelCalibDigis_")+25, 9);
346 if(mId!=
" ") modules.push_back(mId);
353 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
354 if((bei->
pwd()).
find(
"Barrel")==string::npos && (bei->
pwd()).
find(
"Endcap")==string::npos) bei->
goUp();
408 ostringstream& str_val){
410 string currDir = bei->
pwd();
411 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
413 <<
" <a href=\"#\" id=\"" << currDir <<
"\">\n "
418 vector<string> meVec = bei->
getMEs();
421 if ( meVec.size()== 0 && subDirVec.size() == 0 ) {
422 str_val <<
" </li>" << endl;
425 str_val <<
"\n <ul>" << endl;
426 for (vector<string>::const_iterator it = meVec.begin();
427 it != meVec.end(); it++) {
428 if ((*it).find(
"_siPixel")!=string::npos ||
429 (*it).find(
"_ctfWithMaterialTracks")!=string::npos) {
432 if(qit.find(
"siPixel")!=string::npos || qit.find(
"ctfWithMaterialTracks")!=string::npos) { temp_s = qit.substr(0,qit.find_first_of(
"_")); }
433 str_val <<
" <li class=\"dhtmlgoodies_sheet.gif\">\n"
434 <<
" <input id = \"selectedME\""
435 <<
" folder = \"" << currDir <<
"\""
436 <<
" type = \"checkbox\""
437 <<
" name = \"selected\""
438 <<
" class = \"smallCheckBox\""
439 <<
" value = \"" << (*it) <<
"\""
440 <<
" onclick = \"javascript:IMGC.selectedIMGCItems()\" />\n"
442 <<
" <a href=\"javascript:IMGC.plotFromPath('" << currDir <<
"')\">\n "
450 for (vector<string>::const_iterator ic = subDirVec.begin();
451 ic != subDirVec.end(); ic++) {
456 str_val <<
" </ul>" << endl;
457 str_val <<
" </li>" << endl;
503 ostringstream& str_val){
505 string currDir = bei->
pwd();
506 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
507 if (dname.find(
"Module_") ==0 || dname.find(
"FED_")==0)
return;
509 <<
" <a href=\"#\" id=\"" << currDir <<
"\">\n "
514 vector<string> meVec = bei->
getMEs();
517 if ( meVec.size()== 0 && subDirVec.size() == 0 ) {
518 str_val <<
" </li> "<< endl;
521 str_val <<
"\n <ul>" << endl;
522 for (vector<string>::const_iterator it = meVec.begin();
523 it != meVec.end(); it++) {
524 if ((*it).find(
"SUM") == 0) {
525 str_val <<
" <li class=\"dhtmlgoodies_sheet.gif\">\n"
526 <<
" <input id = \"selectedME\""
527 <<
" folder = \"" << currDir <<
"\""
528 <<
" type = \"checkbox\""
529 <<
" name = \"selected\""
530 <<
" class = \"smallCheckBox\""
531 <<
" value = \"" << (*it) <<
"\""
532 <<
" onclick = \"javascript:IMGC.selectedIMGCItems()\" />\n"
534 <<
" <a href=\"javascript:IMGC.plotFromPath('" << currDir <<
"')\">\n "
542 for (vector<string>::const_iterator ic = subDirVec.begin();
543 ic != subDirVec.end(); ic++) {
548 str_val <<
" </ul> "<< endl;
549 str_val <<
" </li> "<< endl;
602 ostringstream& str_val){
609 string currDir = bei->
pwd();
610 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
613 if(image_name!=
"images/LI_green.gif")
615 <<
" <a href=\"#\" id=\"" << currDir <<
"\">\n "
623 vector<string> meVec = bei->
getMEs();
625 if (subDirVec.size() == 0 && meVec.size() == 0) {
626 str_val <<
"</li> "<< endl;
629 str_val <<
"<ul>" << endl;
630 for (vector<string>::const_iterator it = meVec.begin();
631 it != meVec.end(); it++) {
632 string full_path = currDir +
"/" + (*it);
638 if (my_map.size() > 0) {
641 if(image_name1!=
"images/LI_green.gif") {
643 str_val <<
" <li class=\"dhtmlgoodies_sheet.gif\">\n"
644 <<
" <input id = \"selectedME\""
645 <<
" folder = \"" << currDir <<
"\""
646 <<
" type = \"checkbox\""
647 <<
" name = \"selected\""
648 <<
" class = \"smallCheckBox\""
649 <<
" value = \"" << (*it) <<
"\""
650 <<
" onclick = \"javascript:IMGC.selectedIMGCItems()\" />\n"
652 <<
" <a href=\"javascript:IMGC.plotFromPath('" << currDir <<
"')\">\n "
663 for (vector<string>::const_iterator ic = subDirVec.begin();
664 ic != subDirVec.end(); ic++) {
669 str_val <<
"</ul> "<< endl;
670 str_val <<
"</li> "<< endl;
687 vector<string>& items) {
690 for (multimap<string, string>::const_iterator it = req_map.begin();
691 it != req_map.end(); it++) {
692 if (it->first == item_name) {
693 items.push_back(it->second);
707 multimap<string,string>::iterator pos = req_map.find(item_name);
708 if (pos != req_map.end())
return true;
721 std::multimap<std::string,std::string>::const_iterator pos = req_map.find(item_name);
723 if (pos != req_map.end()) {
733 std::multimap<std::string,std::string>::iterator pos = req_map.find(item_name);
735 if (pos != req_map.end()) {
752 else col =
"#0000ff";
760 for (vector<QReport*>::const_iterator it = reports.begin(); it != reports.end();
762 status = (*it)->getStatus();
763 if (status > istat) istat =
status;
775 else name=
"images/LI_blue.gif";
783 for (vector<QReport*>::const_iterator it = reports.begin(); it != reports.end();
785 status = (*it)->getStatus();
786 if (status > istat) istat =
status;
837 if (dirName.find(sname) != string::npos)
return true;
914 pair<double,double> & norm)
916 double normalizationX = 1 ;
917 double normalizationY = 1 ;
923 pair<double,double> normX ;
924 pair<double,double> normY ;
935 if( theMEType.find(
"TH1") != string::npos)
937 meanX = (double)theME->
getMean();
939 normalizationX = fabs( normX.second - normX.first) ;
940 if( normalizationX == 0 ) {normalizationX=1.E-20;}
941 colorValue = meanX / normalizationX ;
942 norm.first = normX.first ;
943 norm.second = normX.second ;
946 if( theMEType.find(
"TH2") != string::npos)
948 meanX = (double)theME->
getMean(1);
949 meanY = (double)theME->
getMean(2);
951 normalizationX = fabs( normX.second - normX.first) ;
952 normalizationY = fabs( normY.second - normY.first) ;
953 if( normalizationX == 0 ) {normalizationX=1.E-20;}
954 if( normalizationY == 0 ) {normalizationY=1.E-20;}
955 double cVX = meanX / normalizationX ;
956 double cVY = meanY / normalizationY ;
957 colorValue =
sqrt(cVX*cVX + cVY*cVY) ;
958 if( normalizationX >= normalizationY )
960 norm.first = normX.first;
961 norm.second = normX.second ;
963 norm.first = normY.first;
964 norm.second = normY.second ;
985 pair<double,double>& norm,
989 double normHigh = 0 ;
991 if( theMEType.find(
"TH1") != string::npos)
994 norm.first = normLow ;
995 norm.second = normHigh ;
1004 pair<double,double>& normX,
1005 pair<double,double>& normY,
1008 double normLow = 0 ;
1009 double normHigh = 0 ;
1011 if( theMEType.find(
"TH2") != string::npos )
1014 normX.first = normLow ;
1015 normX.second = normHigh ;
1017 normY.first = normLow ;
1018 normY.second = normHigh ;
1038 vector<MonitorElement*> & mes)
1041 string currDir = bei->
pwd();
1046 if (currDir.find(
"Module_") != string::npos ||
1047 currDir.find(
"FED_") != string::npos)
1051 for (vector<string>::const_iterator it = contents.begin(); it != contents.end(); it++)
1054 if(theME.find(
"siPixel")==string::npos && theME.find(
"ctfWithMaterialTracks")==string::npos) {continue ;}
1055 string temp_s = theME.substr(0,theME.find_first_of(
"_"));
1057 if (temp_s == theMEName)
1059 string full_path = currDir +
"/" + (*it);
1063 if (me) {mes.push_back(me);}
1069 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
1227 string mEName = mE->
getName();
1231 if( mEName.find(
"_3") != string::npos )
1233 string detIdString = mEName.substr((mEName.find_last_of(
"_"))+1,9);
1235 std::istringstream isst;
1236 isst.str(detIdString);
1256 map<string, int> & mEHash)
1258 string currDir = bei->
pwd();
1270 if (currDir.find(
"Module_") != string::npos ||
1271 currDir.find(
"FED_") != string::npos)
1275 for (vector<string>::const_iterator it = contents.begin(); it != contents.end(); it++)
1284 if(theME.find(
"siPixel")==string::npos && theME.find(
"ctfWithMaterialTracks")==string::npos)
1287 <<
"[SiPixelInformationExtractor::getMEList()]"
1289 <<
" ----> Skipping "
1294 string full_path = currDir +
"/" + (*it);
1295 string mEName = theME.substr(0,theME.find_first_of(
"_"));
1302 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
1376 nevents_ = (bei->
get(
"Pixel/EventInfo/processedEvents"))->getIntValue();
1379 myfile_.open (
"NoisyPixelList.txt", ios::app);
1380 myfile_ <<
"Noise summary, ran over " <<
nevents_ <<
" events, threshold was set to " << noiseRate_ << std::endl;
1382 string currDir = bei->
pwd();
1383 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
1386 if(dname.find(
"Module_")!=string::npos){
1387 vector<string> meVec = bei->
getMEs();
1388 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1389 string full_path = currDir +
"/" + (*it);
1390 if(full_path.find(
"hitmap_siPixelDigis")!=string::npos){
1413 std::vector<std::pair<std::pair<int, int>,
float> > noisyPixelsInModule;
1414 TH2F * hothisto = me->
getTH2F();
1416 for(
int i=1;
i!=hothisto->GetNbinsX()+1;
i++){
1417 for(
int j=1;
j!=hothisto->GetNbinsY()+1;
j++){
1419 if(me->
getPathname().find(
"Barrel")!=string::npos){
1422 }
else if(me->
getPathname().find(
"Endcap")!=string::npos){
1426 if(value > noiseRate_){
1431 std::pair<int, int> address(pixcol, pixrow);
1432 std::pair<std::pair<int, int>,
float> PixelStats(address, value);
1433 noisyPixelsInModule.push_back(PixelStats);
1443 vector<string> subDirVec = bei->
getSubdirs();
1444 for (vector<string>::const_iterator ic = subDirVec.begin();
1445 ic != subDirVec.end(); ic++) {
1446 if((*ic).find(
"AdditionalPixelErrors")!=string::npos)
continue;
1457 if(currDir ==
"Pixel/EventInfo/reportSummaryContents"){
1459 std::vector<std::pair<sipixelobjects::DetectorIndex,double> > pixelvec;
1460 std::map<uint32_t,int> myfedmap;
1461 std::map<uint32_t,std::string> mynamemap;
1466 int n_noisyrocs_all = 0;
1467 int n_noisyrocs_barrel = 0;
1468 int n_noisyrocs_endcap = 0;
1469 int n_verynoisyrocs_all = 0;
1470 int n_verynoisyrocs_barrel = 0;
1471 int n_verynoisyrocs_endcap = 0;
1474 for(
std::map<uint32_t, std::vector< std::pair<std::pair<int, int>,
float> > >::const_iterator it =
noisyDetIds_.begin();
1476 uint32_t
detid = (*it).first;
1477 std::vector< std::pair<std::pair<int, int>,
float> > noisyPixels = (*it).second;
1480 for(
int fedid=0; fedid<=40; ++fedid){
1482 uint32_t newDetId =
detid;
1483 if(converter.hasDetUnit(newDetId)){
1488 if(
fid == realfedID){
1490 if(realfedID==-1)
continue;
1492 uint32_t detSubId = detId.
subdetId();
1494 bool HalfModule =
false;
1497 outputname = nameworker.
name();
1498 }
else if(detSubId == 1){
1500 outputname = nameworker.
name();
1506 std::map<int,int> myrocmap;
1507 myfedmap[
detid]=realfedID;
1508 mynamemap[
detid]=outputname;
1510 for(std::vector< std::pair< std::pair<int,int>,
float> >::const_iterator pxl = noisyPixels.begin();
1511 pxl != noisyPixels.end(); pxl++){
1512 std::pair<int,int> offlineaddress = (*pxl).first;
1513 float Noise_frac = (*pxl).second;
1514 int offlineColumn = offlineaddress.first;
1515 int offlineRow = offlineaddress.second;
1522 formatter.toCabling(cabling,detector);
1542 assert(realfedID >= 0);
1543 assert(cabling.
link >= 0);
1544 assert(cabling.
roc >= 0);
1546 static_cast<unsigned int>(cabling.
link),
1547 static_cast<unsigned int>(cabling.
roc)};
1551 int onlineColumn = locpixel.
rocCol();
1552 int onlineRow= locpixel.
rocRow();
1561 if((detSubId == 1) && (outputname.find(
"mO")!=string::npos || outputname.find(
"mI")!=string::npos) && (HalfModule)){
1569 myfile_ <<
"NAME: "<<outputname<<
" , DETID: "<<detid<<
" , OFFLINE: col,row: "<<offlineColumn<<
","<<offlineRow<<
" \t , ONLINE: roc,col,row: "<<rocnumber<<
","<<onlineColumn<<
","<<onlineRow<<
" \t , fed,dcol,pixid,link: "<<realfedID<<
","<<loc.
dcol<<
","<<loc.
pxid<<
","<<cabling.
link <<
", Noise fraction: " << Noise_frac << std::endl;
1571 for(std::map<int, int>::const_iterator nrc = myrocmap.begin(); nrc != myrocmap.end(); nrc++){
1572 if((*nrc).second > 0){
1575 n_noisyrocs_endcap++;
1576 }
else if(detSubId == 1){
1577 n_noisyrocs_barrel++;}
1579 if((*nrc).second > 40){
1580 n_verynoisyrocs_all++;
1582 n_verynoisyrocs_endcap++;
1583 }
else if(detSubId == 1){
1584 n_verynoisyrocs_barrel++;}
1591 myfile_ <<
"There are " << n_noisyrocs_all <<
" noisy ROCs (ROCs with at least 1 noisy pixel) in the entire detector. " << n_noisyrocs_endcap <<
" are in the FPIX and " << n_noisyrocs_barrel <<
" are in the BPIX. " << endl;
1592 myfile_ <<
"There are " << n_verynoisyrocs_all <<
" highly noisy ROCs (ROCs with at least 10% of all pixels passing the noise threshold) in the entire detector. " << n_verynoisyrocs_endcap <<
" are in the FPIX and " << n_verynoisyrocs_barrel <<
" are in the BPIX. " << endl;
const std::string & getName(void) const
get name of ME
int getStatus(const std::string &path="") const
std::vector< std::string > getSubdirs(void) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void cd(void)
go to top directory (ie. root)
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
identify pixel inside single ROC
int getNbinsY(void) const
get # of bins in Y-axis
const std::string & getPathname(void) const
get pathname of parent folder
bool isHalfModule() const
full or half module
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
double collumn and pixel ID in double collumn representation
void createPlots(DQMStore *bei)
TObject * getRootObject(void) const
virtual std::string name() const
from base class
std::vector< QReport * > getQReports(void) const
get map of QReports
T const * product() const
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
return(e1-e2)*(e1-e2)+dp *dp
virtual std::string name() const
from base class
static std::atomic< unsigned int > counter
int getNbinsX(void) const
get # of bins in X-axis
void goUp(void)
equivalent to "cd .."
static const int STATUS_OK
TH2F * getTH2F(void) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
const std::string & pwd(void) const