45 #include "TPaveText.h"
46 #include "TImageDump.h"
48 #include "TStopwatch.h"
50 #include "TPaveLabel.h"
71 " Creating SiPixelInformationExtractor " <<
"\n" ;
84 " Deleting SiPixelInformationExtractor " <<
"\n" ;
267 if( qtype.find(
"TH1") != string::npos )
270 }
else if ( qtype.find(
"TH2") != string::npos ) {
272 }
else if ( qtype.find(
"TH3") != string::npos ) {
324 map<string,string> &
histos) {
326 string currDir = bei->pwd();
328 if(currDir.find(
"Module_") != string::npos){
329 if(histos.size() == 0){
330 vector<string>
contents = bei->getMEs();
331 for (vector<string>::const_iterator it = contents.begin(); it != contents.end(); it++) {
332 string hname = (*it).substr(0, (*it).find(
"_siPixel"));
333 if(hname==
" ") hname = (*it).substr(0, (*it).find(
"_generalTracks"));
334 string fullpathname = bei->pwd() +
"/" + (*it);
337 string htype =
"undefined" ;
341 histos[hname] = htype ;
343 if(hname.find(
"ndigis") !=string::npos) mId = (*it).substr((*it).find(
"ndigis_siPixelDigis_")+20, 9);
344 if(mId==
" " && hname.find(
"nclusters") !=string::npos) mId = (*it).substr((*it).find(
"nclusters_siPixelClusters_")+26, 9);
345 if(mId==
" " && hname.find(
"residualX") !=string::npos) mId = (*it).substr((*it).find(
"residualX_ctfWithMaterialTracks_")+32, 9);
346 if(mId==
" " && hname.find(
"NErrors") !=string::npos) mId = (*it).substr((*it).find(
"NErrors_siPixelDigis_")+21, 9);
347 if(mId==
" " && hname.find(
"ClustX") !=string::npos) mId = (*it).substr((*it).find(
"ClustX_siPixelRecHit_")+21, 9);
348 if(mId==
" " && hname.find(
"pixelAlive") !=string::npos) mId = (*it).substr((*it).find(
"pixelAlive_siPixelCalibDigis_")+29, 9);
349 if(mId==
" " && hname.find(
"Gain1d") !=string::npos) mId = (*it).substr((*it).find(
"Gain1d_siPixelCalibDigis_")+25, 9);
350 if(mId!=
" ") modules.push_back(mId);
356 vector<string> subdirs = bei->getSubdirs();
357 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
358 if((bei->pwd()).
find(
"Barrel")==string::npos && (bei->pwd()).
find(
"Endcap")==string::npos) bei->goUp();
412 ostringstream& str_val){
414 string currDir = bei->pwd();
415 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
417 <<
" <a href=\"#\" id=\"" << currDir <<
"\">\n "
422 vector<string> meVec = bei->getMEs();
424 vector<string> subDirVec = bei->getSubdirs();
425 if ( meVec.size()== 0 && subDirVec.size() == 0 ) {
426 str_val <<
" </li>" << endl;
429 str_val <<
"\n <ul>" << endl;
430 for (vector<string>::const_iterator it = meVec.begin();
431 it != meVec.end(); it++) {
432 if ((*it).find(
"_siPixel")!=string::npos ||
433 (*it).find(
"_ctfWithMaterialTracks")!=string::npos) {
436 if(qit.find(
"siPixel")!=string::npos || qit.find(
"ctfWithMaterialTracks")!=string::npos) { temp_s = qit.substr(0,qit.find_first_of(
"_")); }
437 str_val <<
" <li class=\"dhtmlgoodies_sheet.gif\">\n"
438 <<
" <input id = \"selectedME\""
439 <<
" folder = \"" << currDir <<
"\""
440 <<
" type = \"checkbox\""
441 <<
" name = \"selected\""
442 <<
" class = \"smallCheckBox\""
443 <<
" value = \"" << (*it) <<
"\""
444 <<
" onclick = \"javascript:IMGC.selectedIMGCItems()\" />\n"
446 <<
" <a href=\"javascript:IMGC.plotFromPath('" << currDir <<
"')\">\n "
454 for (vector<string>::const_iterator ic = subDirVec.begin();
455 ic != subDirVec.end(); ic++) {
460 str_val <<
" </ul>" << endl;
461 str_val <<
" </li>" << endl;
507 ostringstream& str_val){
509 string currDir = bei->pwd();
510 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
511 if (dname.find(
"Module_") ==0 || dname.find(
"FED_")==0)
return;
513 <<
" <a href=\"#\" id=\"" << currDir <<
"\">\n "
518 vector<string> meVec = bei->getMEs();
520 vector<string> subDirVec = bei->getSubdirs();
521 if ( meVec.size()== 0 && subDirVec.size() == 0 ) {
522 str_val <<
" </li> "<< endl;
525 str_val <<
"\n <ul>" << endl;
526 for (vector<string>::const_iterator it = meVec.begin();
527 it != meVec.end(); it++) {
528 if ((*it).find(
"SUM") == 0) {
529 str_val <<
" <li class=\"dhtmlgoodies_sheet.gif\">\n"
530 <<
" <input id = \"selectedME\""
531 <<
" folder = \"" << currDir <<
"\""
532 <<
" type = \"checkbox\""
533 <<
" name = \"selected\""
534 <<
" class = \"smallCheckBox\""
535 <<
" value = \"" << (*it) <<
"\""
536 <<
" onclick = \"javascript:IMGC.selectedIMGCItems()\" />\n"
538 <<
" <a href=\"javascript:IMGC.plotFromPath('" << currDir <<
"')\">\n "
546 for (vector<string>::const_iterator ic = subDirVec.begin();
547 ic != subDirVec.end(); ic++) {
552 str_val <<
" </ul> "<< endl;
553 str_val <<
" </li> "<< endl;
606 ostringstream& str_val){
613 string currDir = bei->pwd();
614 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
617 if(image_name!=
"images/LI_green.gif")
619 <<
" <a href=\"#\" id=\"" << currDir <<
"\">\n "
625 vector<string> subDirVec = bei->getSubdirs();
627 vector<string> meVec = bei->getMEs();
629 if (subDirVec.size() == 0 && meVec.size() == 0) {
630 str_val <<
"</li> "<< endl;
633 str_val <<
"<ul>" << endl;
634 for (vector<string>::const_iterator it = meVec.begin();
635 it != meVec.end(); it++) {
636 string full_path = currDir +
"/" + (*it);
642 if (my_map.size() > 0) {
645 if(image_name1!=
"images/LI_green.gif") {
647 str_val <<
" <li class=\"dhtmlgoodies_sheet.gif\">\n"
648 <<
" <input id = \"selectedME\""
649 <<
" folder = \"" << currDir <<
"\""
650 <<
" type = \"checkbox\""
651 <<
" name = \"selected\""
652 <<
" class = \"smallCheckBox\""
653 <<
" value = \"" << (*it) <<
"\""
654 <<
" onclick = \"javascript:IMGC.selectedIMGCItems()\" />\n"
656 <<
" <a href=\"javascript:IMGC.plotFromPath('" << currDir <<
"')\">\n "
667 for (vector<string>::const_iterator ic = subDirVec.begin();
668 ic != subDirVec.end(); ic++) {
673 str_val <<
"</ul> "<< endl;
674 str_val <<
"</li> "<< endl;
691 vector<string>& items) {
694 for (multimap<string, string>::const_iterator it = req_map.begin();
695 it != req_map.end(); it++) {
696 if (it->first == item_name) {
697 items.push_back(it->second);
711 multimap<string,string>::iterator pos = req_map.find(item_name);
712 if (pos != req_map.end())
return true;
725 std::multimap<std::string,std::string>::const_iterator pos = req_map.find(item_name);
727 if (pos != req_map.end()) {
737 std::multimap<std::string,std::string>::iterator pos = req_map.find(item_name);
739 if (pos != req_map.end()) {
756 else col =
"#0000ff";
764 for (vector<QReport*>::const_iterator it = reports.begin(); it != reports.end();
766 status = (*it)->getStatus();
767 if (status > istat) istat =
status;
779 else name=
"images/LI_blue.gif";
787 for (vector<QReport*>::const_iterator it = reports.begin(); it != reports.end();
789 status = (*it)->getStatus();
790 if (status > istat) istat =
status;
841 if (dirName.find(sname) != string::npos)
return true;
918 pair<double,double> & norm)
920 double normalizationX = 1 ;
921 double normalizationY = 1 ;
927 pair<double,double> normX ;
928 pair<double,double> normY ;
939 if( theMEType.find(
"TH1") != string::npos)
941 meanX = (double)theME->
getMean();
943 normalizationX = fabs( normX.second - normX.first) ;
944 if( normalizationX == 0 ) {normalizationX=1.E-20;}
945 colorValue = meanX / normalizationX ;
946 norm.first = normX.first ;
947 norm.second = normX.second ;
950 if( theMEType.find(
"TH2") != string::npos)
952 meanX = (double)theME->
getMean(1);
953 meanY = (double)theME->
getMean(2);
955 normalizationX = fabs( normX.second - normX.first) ;
956 normalizationY = fabs( normY.second - normY.first) ;
957 if( normalizationX == 0 ) {normalizationX=1.E-20;}
958 if( normalizationY == 0 ) {normalizationY=1.E-20;}
959 double cVX = meanX / normalizationX ;
960 double cVY = meanY / normalizationY ;
961 colorValue =
sqrt(cVX*cVX + cVY*cVY) ;
962 if( normalizationX >= normalizationY )
964 norm.first = normX.first;
965 norm.second = normX.second ;
967 norm.first = normY.first;
968 norm.second = normY.second ;
989 pair<double,double>& norm,
993 double normHigh = 0 ;
995 if( theMEType.find(
"TH1") != string::npos)
998 norm.first = normLow ;
999 norm.second = normHigh ;
1008 pair<double,double>& normX,
1009 pair<double,double>& normY,
1012 double normLow = 0 ;
1013 double normHigh = 0 ;
1015 if( theMEType.find(
"TH2") != string::npos )
1018 normX.first = normLow ;
1019 normX.second = normHigh ;
1021 normY.first = normLow ;
1022 normY.second = normHigh ;
1042 vector<MonitorElement*> & mes)
1045 string currDir = bei->pwd();
1050 if (currDir.find(
"Module_") != string::npos ||
1051 currDir.find(
"FED_") != string::npos)
1053 vector<string>
contents = bei->getMEs();
1055 for (vector<string>::const_iterator it = contents.begin(); it != contents.end(); it++)
1058 if(theME.find(
"siPixel")==string::npos && theME.find(
"ctfWithMaterialTracks")==string::npos) {continue ;}
1059 string temp_s = theME.substr(0,theME.find_first_of(
"_"));
1061 if (temp_s == theMEName)
1063 string full_path = currDir +
"/" + (*it);
1067 if (me) {mes.push_back(me);}
1072 vector<string> subdirs = bei->getSubdirs();
1073 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
1231 string mEName = mE->
getName();
1235 if( mEName.find(
"_3") != string::npos )
1237 string detIdString = mEName.substr((mEName.find_last_of(
"_"))+1,9);
1239 std::istringstream isst;
1240 isst.str(detIdString);
1260 map<string, int> & mEHash)
1262 string currDir = bei->pwd();
1274 if (currDir.find(
"Module_") != string::npos ||
1275 currDir.find(
"FED_") != string::npos)
1277 vector<string>
contents = bei->getMEs();
1279 for (vector<string>::const_iterator it = contents.begin(); it != contents.end(); it++)
1288 if(theME.find(
"siPixel")==string::npos && theME.find(
"ctfWithMaterialTracks")==string::npos)
1291 <<
"[SiPixelInformationExtractor::getMEList()]"
1293 <<
" ----> Skipping "
1298 string full_path = currDir +
"/" + (*it);
1299 string mEName = theME.substr(0,theME.find_first_of(
"_"));
1305 vector<string> subdirs = bei->getSubdirs();
1306 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
1354 bei->setCurrentFolder(
"Pixel/Barrel");
1355 EventRateBarrelPixels = bei->book1D(
"barrelEventRate",
"Digi event rate for all Barrel pixels",1000,0.,0.01);
1359 bei->setCurrentFolder(
"Pixel/Endcap");
1360 EventRateEndcapPixels = bei->book1D(
"endcapEventRate",
"Digi event rate for all Endcap pixels",1000,0.,0.01);
1379 bei->setCurrentFolder(
"Pixel/EventInfo");
1380 nevents_ = (bei->get(
"Pixel/EventInfo/processedEvents"))->getIntValue();
1383 myfile_.open (
"NoisyPixelList.txt", ios::app);
1384 myfile_ <<
"Noise summary, ran over " <<
nevents_ <<
" events, threshold was set to " << noiseRate_ << std::endl;
1386 string currDir = bei->pwd();
1387 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
1390 if(dname.find(
"Module_")!=string::npos){
1391 vector<string> meVec = bei->getMEs();
1392 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1393 string full_path = currDir +
"/" + (*it);
1394 if(full_path.find(
"hitmap_siPixelDigis")!=string::npos){
1417 std::vector<std::pair<std::pair<int, int>,
float> > noisyPixelsInModule;
1418 TH2F * hothisto = me->
getTH2F();
1420 for(
int i=1;
i!=hothisto->GetNbinsX()+1;
i++){
1421 for(
int j=1;
j!=hothisto->GetNbinsY()+1;
j++){
1423 if(me->
getPathname().find(
"Barrel")!=string::npos){
1426 }
else if(me->
getPathname().find(
"Endcap")!=string::npos){
1430 if(value > noiseRate_){
1435 std::pair<int, int> address(pixcol, pixrow);
1436 std::pair<std::pair<int, int>,
float> PixelStats(address, value);
1437 noisyPixelsInModule.push_back(PixelStats);
1447 vector<string> subDirVec = bei->getSubdirs();
1448 for (vector<string>::const_iterator ic = subDirVec.begin();
1449 ic != subDirVec.end(); ic++) {
1450 if((*ic).find(
"AdditionalPixelErrors")!=string::npos)
continue;
1457 if(bei->pwd().find(
"EventInfo")!=string::npos)
endOfModules_ =
true;
1461 if(currDir ==
"Pixel/EventInfo/reportSummaryContents"){
1463 std::vector<std::pair<sipixelobjects::DetectorIndex,double> > pixelvec;
1464 std::map<uint32_t,int> myfedmap;
1465 std::map<uint32_t,std::string> mynamemap;
1470 int n_noisyrocs_all = 0;
1471 int n_noisyrocs_barrel = 0;
1472 int n_noisyrocs_endcap = 0;
1473 int n_verynoisyrocs_all = 0;
1474 int n_verynoisyrocs_barrel = 0;
1475 int n_verynoisyrocs_endcap = 0;
1478 for(
std::map<uint32_t, std::vector< std::pair<std::pair<int, int>,
float> > >::const_iterator it =
noisyDetIds_.begin();
1480 uint32_t
detid = (*it).first;
1481 std::vector< std::pair<std::pair<int, int>,
float> > noisyPixels = (*it).second;
1484 for(
int fedid=0; fedid<=40; ++fedid){
1486 uint32_t newDetId =
detid;
1487 if(converter.hasDetUnit(newDetId)){
1492 if(
fid == realfedID){
1494 if(realfedID==-1)
continue;
1496 uint32_t detSubId = detId.
subdetId();
1498 bool HalfModule =
false;
1501 outputname = nameworker.
name();
1502 }
else if(detSubId == 1){
1504 outputname = nameworker.
name();
1510 std::map<int,int> myrocmap;
1511 myfedmap[
detid]=realfedID;
1512 mynamemap[
detid]=outputname;
1514 for(std::vector< std::pair< std::pair<int,int>,
float> >::const_iterator pxl = noisyPixels.begin();
1515 pxl != noisyPixels.end(); pxl++){
1516 std::pair<int,int> offlineaddress = (*pxl).first;
1517 float Noise_frac = (*pxl).second;
1518 int offlineColumn = offlineaddress.first;
1519 int offlineRow = offlineaddress.second;
1546 assert(realfedID >= 0);
1547 assert(cabling.
link >= 0);
1548 assert(cabling.
roc >= 0);
1550 static_cast<unsigned int>(cabling.
link),
1551 static_cast<unsigned int>(cabling.
roc)};
1555 int onlineColumn = locpixel.
rocCol();
1556 int onlineRow= locpixel.
rocRow();
1565 if((detSubId == 1) && (outputname.find(
"mO")!=string::npos || outputname.find(
"mI")!=string::npos) && (HalfModule)){
1573 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;
1575 for(std::map<int, int>::const_iterator nrc = myrocmap.begin(); nrc != myrocmap.end(); nrc++){
1576 if((*nrc).second > 0){
1579 n_noisyrocs_endcap++;
1580 }
else if(detSubId == 1){
1581 n_noisyrocs_barrel++;}
1583 if((*nrc).second > 40){
1584 n_verynoisyrocs_all++;
1586 n_verynoisyrocs_endcap++;
1587 }
else if(detSubId == 1){
1588 n_verynoisyrocs_barrel++;}
1595 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;
1596 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
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
tuple path
else: Piece not in the list, fine.
bool isHalfModule() const
full or half module
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
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
virtual std::string name() const
from base class
static std::atomic< unsigned int > counter
int getNbinsX(void) const
get # of bins in X-axis
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)