CMS 3D CMS Logo

Static Public Member Functions

SiStripUtility Class Reference

#include <SiStripUtility.h>

List of all members.

Static Public Member Functions

static bool checkME (std::string element, std::string name, std::string &full_path)
static void getBadModuleStatus (uint16_t flag, std::string &message)
static void getDetectorStatusColor (int status, int &rval, int &gval, int &bval)
static int getMEList (std::string name, std::vector< std::string > &values)
static int getMEList (std::string name, std::string &dir_path, std::vector< std::string > &me_names)
 (Documentation under construction).
static int getMEStatus (MonitorElement *me)
static int getMEStatus (MonitorElement *me, int &bad_channels)
static void getMEStatusColor (int status, int &rval, int &gval, int &bval)
static void getMEStatusColor (int status, int &icol, std::string &tag)
static void getMEValue (MonitorElement *me, std::string &val)
static void getModuleFolderList (DQMStore *dqm_store, std::vector< std::string > &m_ids)
static void getSubDetectorTag (uint32_t det_id, std::string &subdet_tag)
static void getTopFolderPath (DQMStore *dqm_store, std::string type, std::string &path)
static bool goToDir (DQMStore *dqm_store, std::string name)
static void setBadModuleFlag (std::string &hname, uint16_t &flg)
static void split (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")

Detailed Description

* Class that handles the SiStrip Quality Tests

Date:
2009/12/27 06:53:34
Revision:
1.15
Author:
Suchandra Dutta

Definition at line 21 of file SiStripUtility.h.


Member Function Documentation

bool SiStripUtility::checkME ( std::string  element,
std::string  name,
std::string &  full_path 
) [static]

Definition at line 34 of file SiPixelUtility.cc.

References split, and makeHLTPrescaleTable::values.

                                                                           {
  if (name.find(name) == string::npos) return false;
  string prefix_str = name.substr(0,(name.find(":")));
  prefix_str += "/"; 
  string temp_str = name.substr(name.find(":")+1);
  vector<string> values;
  split(temp_str, values, ",");
  for (vector<string>::iterator it = values.begin();
       it != values.end(); it++) {
    if ((*it).find(me_name) != string::npos) {
      full_path = prefix_str + (*it);
      return true;
    }
  }
  return false;
}
void SiStripUtility::getBadModuleStatus ( uint16_t  flag,
std::string &  message 
) [static]

Definition at line 289 of file SiStripUtility.cc.

Referenced by SiStripTrackerMapCreator::getDetectorFlagAndComment(), SiStripActionExecutor::printFaultyModuleList(), and SiStripInformationExtractor::readQTestSummary().

                                                                         {
  if (flag == 0) message += "No Error";
  else {
    message += " Error from :: "; 
    if (((flag >> 0) & 0x1) > 0) message += " Fed BadChannel : ";
    if (((flag >> 1) & 0x1) > 0) message += " # of Digi : ";  
    if (((flag >> 2) & 0x1) > 0) message += " # of Clusters :";
    if (((flag >> 3) & 0x1) > 0) message += " Excluded FED Channel ";
    if (((flag >> 4) & 0x1) > 0) message += " DCSError "; 
  }
}
void SiStripUtility::getDetectorStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
) [static]

Definition at line 114 of file SiStripUtility.cc.

Referenced by SiStripTrackerMapCreator::paintTkMapFromAlarm(), and SiStripTrackerMapCreator::paintTkMapFromHistogram().

                                                                                      {
  // No Error
  if (status == 0) {
    rval = 0; gval = 255;bval = 0;
    return;
  }
  // Error detected in FED Channel
  if (((status >> 0) & 0x1) > 0) { 
    rval = 150; gval = 0; bval = 0; 
    return;
  }
  // Excluded FED Channel 
  if (((status >> 3) & 0x1) > 0) {
    rval = 255; gval = 255; bval = 255; 
    return;
  }
  // DCS Error
  if (((status >> 4) & 0x1) > 0) {
    rval = 200; gval = 20; bval = 255; 
    return;
  } 
  // Digi and Cluster Problem   
  if (((status >> 1) & 0x1) > 0) {
    rval = 255; bval = 0;
    if (((status >> 2) & 0x1) > 0) gval = 0;
    else gval = 100;
  } else {
    rval = 251; gval = 0; bval = 100;   
  }
}
int SiStripUtility::getMEList ( std::string  name,
std::vector< std::string > &  values 
) [static]

Definition at line 13 of file SiStripUtility.cc.

References split().

                                                                          {
  values.clear();
  std::string prefix_str = name.substr(0,(name.find(":")));
  prefix_str += "/"; 
  std::string temp_str = name.substr(name.find(":")+1);
  split(temp_str, values, ",");
  for (std::vector<std::string>::iterator it = values.begin();
       it != values.end(); it++) (*it).insert(0,prefix_str);
  return values.size();
}
int SiStripUtility::getMEList ( std::string  name,
std::string &  dir_path,
std::vector< std::string > &  me_names 
) [static]

(Documentation under construction).

Definition at line 1243 of file SiPixelInformationExtractor.cc.

References ACBold, ACPlain, ACRed, DQMStore::cd(), cmsMakeMELists::contents, gather_cfg::cout, SiPixelInformationExtractor::getMEList(), DQMStore::getMEs(), DQMStore::getSubdirs(), DQMStore::goUp(), and DQMStore::pwd().

{
  string currDir = bei->pwd();
   
//   cout << ACRed << ACBold
//        << "[SiPixelInformationExtractor::getMEList()]"
//        << ACPlain
//        << " Requesting ME list in " 
//        << currDir
//        << endl ;
       
  string theME ;
   
  // Get ME from Collector/FU0/Tracker/PixelEndcap/HalfCylinder_pX/Disk_X/Blade_XX/Panel_XX/Module_XX
  if (currDir.find("Module_") != string::npos ||
      currDir.find("FED_") != string::npos)  
  {
    vector<string> contents = bei->getMEs(); 
       
    for (vector<string>::const_iterator it = contents.begin(); it != contents.end(); it++) 
    {
      theME = (*it) ;
//       cout << ACRed << ACReverse
//            << "[SiPixelInformationExtractor::getMEList()]"
//            << ACPlain
//            << " ME: " 
//            << (*it)
//            << endl ;
      if(theME.find("siPixel")==string::npos && theME.find("ctfWithMaterialTracks")==string::npos) 
      {
       cout << ACRed << ACBold
            << "[SiPixelInformationExtractor::getMEList()]"
            << ACPlain
            << " ----> Skipping " 
            << (*it)
            << endl ;
       continue ;
      } // If the ME is not a Pixel one, skip
      string full_path = currDir + "/" + (*it);
      string mEName = theME.substr(0,theME.find_first_of("_"));
      mEHash[mEName]++ ;
    }
    
    return;
  } else {  // If not yet reached the desired level in the directory tree, recursively go down one level more
    vector<string> subdirs = bei->getSubdirs();
    for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) 
    {
      bei->cd(*it);
      getMEList(bei, mEHash);
      bei->goUp();
    }
  }
}
int SiStripUtility::getMEStatus ( MonitorElement me) [static]
int SiStripUtility::getMEStatus ( MonitorElement me,
int &  bad_channels 
) [static]

Definition at line 184 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, MonitorElement::getQReports(), MonitorElement::hasError(), MonitorElement::hasOtherReport(), MonitorElement::hasWarning(), dqm::qstatus::OTHER, ntuplemaker::status, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

                                                                     {
  int status = 0; 
  if (me->getQReports().size() == 0) {
    status       = 0;
    bad_channels = -1;
  } else {
    std::vector<QReport *> qreports = me->getQReports();
    bad_channels =qreports[0]->getBadChannels().size();
    if (me->hasError()) {
      status = dqm::qstatus::ERROR;
    } else if (me->hasWarning()) {
      status = dqm::qstatus::WARNING;
    } else if (me->hasOtherReport()) {
      status = dqm::qstatus::OTHER;
    } else {  
      status = dqm::qstatus::STATUS_OK;
    }
  }
  return status;
}
void SiStripUtility::getMEStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
) [static]

Definition at line 77 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, dqm::qstatus::OTHER, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

Referenced by SiStripHistoPlotter::makePlot().

                                                                                {
  if (status == dqm::qstatus::STATUS_OK) { 
    rval = 0;   gval = 255;   bval = 0; 
  } else if (status == dqm::qstatus::WARNING) { 
    rval = 255; gval = 255; bval = 0;
  } else if (status == dqm::qstatus::ERROR) { 
    rval = 255; gval = 0;  bval = 0;
  } else if (status == dqm::qstatus::OTHER) { 
    rval = 255; gval = 150;  bval = 0;
  } else {
    rval = 0; gval = 0;  bval = 255;
  }        
}
void SiStripUtility::getMEStatusColor ( int  status,
int &  icol,
std::string &  tag 
) [static]

Definition at line 93 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, dqm::qstatus::OTHER, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

                                                                           {
  if (status == dqm::qstatus::STATUS_OK) { 
    tag = "Ok";
    icol = 3;
  } else if (status == dqm::qstatus::WARNING) { 
    tag = "Warning";
    icol = 5;     
  } else if (status == dqm::qstatus::ERROR) { 
    tag = "Error";
    icol = 2;
  } else if (status == dqm::qstatus::OTHER) { 
    tag = "Other";
    icol = 1;
  } else {
    tag = " ";
    icol = 1;
  }     
}
void SiStripUtility::getMEValue ( MonitorElement me,
std::string &  val 
) [static]

Definition at line 207 of file SiStripUtility.cc.

References MonitorElement::DQM_KIND_REAL, MonitorElement::kind(), and MonitorElement::valueString().

Referenced by SiStripActionExecutor::printReportSummary(), and SiStripQualityChecker::printStatusReport().

                                                                  {
  val = "";
  if (me &&  me->kind()==MonitorElement::DQM_KIND_REAL) {
    val = me->valueString();
    val = val.substr(val.find("=")+1);
  }
}
void SiStripUtility::getModuleFolderList ( DQMStore dqm_store,
std::vector< std::string > &  m_ids 
) [static]

Definition at line 166 of file SiStripUtility.cc.

References DQMStore::cd(), DQMStore::getSubdirs(), DQMStore::goUp(), and DQMStore::pwd().

Referenced by SiStripActionExecutor::printFaultyModuleList(), SiStripInformationExtractor::readModuleAndHistoList(), and SiStripInformationExtractor::readQTestSummary().

                                                                                            {
  std::string currDir = dqm_store->pwd();
  if (currDir.find("module_") != std::string::npos)  {
    //    std::string mId = currDir.substr(currDir.find("module_")+7, 9);
    mfolders.push_back(currDir);
  } else {  
    std::vector<std::string> subdirs = dqm_store->getSubdirs();
    for (std::vector<std::string>::const_iterator it = subdirs.begin();
         it != subdirs.end(); it++) {
      dqm_store->cd(*it);
      getModuleFolderList(dqm_store, mfolders);
      dqm_store->goUp();
    }
  }
}
void SiStripUtility::getSubDetectorTag ( uint32_t  det_id,
std::string &  subdet_tag 
) [static]

Definition at line 238 of file SiStripUtility.cc.

References TIDDetId::side(), TECDetId::side(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by SiStripDcsInfo::readCabling(), SiStripDaqInfo::readFedIds(), and SiStripDcsInfo::readStatus().

                                                                             {
  StripSubdetector subdet(det_id);
  subdet_tag = "";
  switch (subdet.subdetId()) 
    {
    case StripSubdetector::TIB:
      {
        subdet_tag = "TIB";
        break;
      }
    case StripSubdetector::TID:
      {
        TIDDetId tidId(det_id);
        if (tidId.side() == 2) {
          subdet_tag = "TIDF";
        }  else if (tidId.side() == 1) {
          subdet_tag = "TIDB";
        }
        break;       
      }
    case StripSubdetector::TOB:
      {
        subdet_tag = "TOB";
        break;
      }
    case StripSubdetector::TEC:
      {
        TECDetId tecId(det_id);
        if (tecId.side() == 2) {
          subdet_tag = "TECF";
        }  else if (tecId.side() == 1) {
          subdet_tag = "TECB";  
        }
        break;       
      }
    }
}
void SiStripUtility::getTopFolderPath ( DQMStore dqm_store,
std::string  type,
std::string &  path 
) [static]

Definition at line 303 of file SiStripUtility.cc.

References DQMStore::cd(), DQMStore::dirExists(), goToDir(), and DQMStore::pwd().

Referenced by SiStripCertificationInfo::bookSiStripCertificationMEs(), SiStripDcsInfo::bookStatus(), SiStripQualityChecker::bookStatus(), SiStripDaqInfo::bookStatus(), SiStripCertificationInfo::bookTrackingCertificationMEs(), SiStripCertificationInfo::fillSiStripCertificationMEsAtLumi(), and SiStripCertificationInfo::fillTrackingCertificationMEs().

                                                                                           {
  if (type != "SiStrip" && type != "Tracking") return;
  path = ""; 
  dqm_store->cd();
  if (type == "SiStrip") {
    if (dqm_store->dirExists(type)) {
      dqm_store->cd(type);
      path = dqm_store->pwd();
    } else {
      if (SiStripUtility::goToDir(dqm_store, type)) {
        std::string mdir = "MechanicalView";
        if (SiStripUtility::goToDir(dqm_store, mdir)) {
          path = dqm_store->pwd(); 
          path = path.substr(0, path.find(mdir)-1);
        }
      }
    }
  } else if (type == "Tracking") {
    std::string top_dir = "Tracking";
    if (dqm_store->dirExists(top_dir)) {
      dqm_store->cd(top_dir);
      path = dqm_store->pwd();
    } else {
      if (SiStripUtility::goToDir(dqm_store, top_dir)) {
        std::string tdir = "TrackParameters";
        if (SiStripUtility::goToDir(dqm_store, tdir)) {
          path = dqm_store->pwd(); 
          path = path.substr(0, path.find(tdir)-1);
        }
      } 
    }
  }
} 
bool SiStripUtility::goToDir ( DQMStore dqm_store,
std::string  name 
) [static]

Definition at line 217 of file SiStripUtility.cc.

References DQMStore::cd(), TrackerOfflineValidation_Dqm_cff::dirName, alignmentValidation::fname, DQMStore::getSubdirs(), DQMStore::goUp(), and DQMStore::pwd().

Referenced by SiStripDcsInfo::addBadModules(), SiStripActionExecutor::createSummaryOffline(), SiStripQualityChecker::fillDetectorStatus(), SiStripQualityChecker::fillDetectorStatusAtLumi(), SiStripQualityChecker::fillFaultyModuleStatus(), SiStripCertificationInfo::fillSiStripCertificationMEs(), SiStripQualityChecker::fillTrackingStatus(), SiStripQualityChecker::fillTrackingStatusAtLumi(), SiStripDaqInfo::findExcludedModule(), getTopFolderPath(), SiStripActionExecutor::printFaultyModuleList(), and SiStripTrackerMapCreator::setTkMapFromHistogram().

                                                                 {
  std::string currDir = dqm_store->pwd();
  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
  if (dirName.find(name) == 0) {
    return true;
  }
  std::vector<std::string> subDirVec = dqm_store->getSubdirs();
  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
       ic != subDirVec.end(); ic++) {
    std::string fname = (*ic);
    if ((fname.find("Reference") != std::string::npos) ||
         (fname.find("AlCaReco") != std::string::npos)) continue;
    dqm_store->cd(fname);
    if (!goToDir(dqm_store, name))  dqm_store->goUp();
    else return true;
  }
  return false;  
}
void SiStripUtility::setBadModuleFlag ( std::string &  hname,
uint16_t &  flg 
) [static]

Definition at line 278 of file SiStripUtility.cc.

Referenced by SiStripDcsInfo::addBadModules(), SiStripDaqInfo::findExcludedModule(), and SiStripQualityChecker::getModuleStatus().

                                                                     {
  
  if (hname.find("FractionOfBadChannels")   != std::string::npos) flg |= (1<<0);
  else if (hname.find("NumberOfDigi")       != std::string::npos) flg |= (1<<1);
  else if (hname.find("NumberOfCluster")    != std::string::npos) flg |= (1<<2);
  else if (hname.find("ExcludedFedChannel") != std::string::npos) flg |= (1<<3);
  else if (hname.find("DCSError")           != std::string::npos) flg |= (1<<4); 
}  
void SiStripUtility::split ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters = " " 
) [static]

Definition at line 56 of file SiStripUtility.cc.

References pos.

Referenced by getMEList().

                                                                                                          {
  // Skip delimiters at beginning.
  std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);

  // Find first "non-delimiter".
  std::string::size_type pos = str.find_first_of(delimiters, lastPos);

  while (std::string::npos != pos || std::string::npos != lastPos)  {
    // Found a token, add it to the std::vector.
    tokens.push_back(str.substr(lastPos, pos - lastPos));

    // Skip delimiters.  Note the "not_of"
    lastPos = str.find_first_not_of(delimiters, pos);

    // Find next "non-delimiter"
    pos = str.find_first_of(delimiters, lastPos);
  }
}