CMS 3D CMS Logo

Static Public Member Functions

SiPixelUtility Class Reference

#include <SiPixelUtility.h>

List of all members.

Static Public Member Functions

static bool checkME (std::string element, std::string name, std::string &full_path)
static int computeErrorCode (DQMStore *bei, std::string &module_path)
static int computeErrorCode (int status)
static int computeHistoBin (std::string &module_path)
static void createStatusLegendMessages (std::map< std::string, std::pair< int, double > > &messages)
static void fillPaveText (TPaveText *pave, std::map< std::string, std::pair< int, double > > messages)
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)
static std::vector< std::string > getQTestNameList (MonitorElement *me)
static int getStatus (MonitorElement *me)
static void getStatusColor (double status, int &rval, int &gval, int &bval)
static void getStatusColor (int status, int &rval, int &gval, int &bval)
static void getStatusColor (int status, int &icol, std::string &tag)
static void setDrawingOption (TH1 *hist, float xlow=-1., float xhigh=-1.)
static std::map< std::string,
std::string > 
sourceCodeMap ()
static void split (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")

Detailed Description

* Class that handles the SiPixel Quality Tests

Date:
2008/03/01 20:19:46
Revision:
1.5
Author:
Petra Merkel

Definition at line 22 of file SiPixelUtility.h.


Member Function Documentation

static bool SiPixelUtility::checkME ( std::string  element,
std::string  name,
std::string &  full_path 
) [static]
static int SiPixelUtility::computeErrorCode ( DQMStore bei,
std::string &  module_path 
) [static]
int SiPixelUtility::computeErrorCode ( int  status) [static]

Definition at line 142 of file SiPixelUtility.cc.

References dqm::qstatus::ERROR, dqm::qstatus::INSUF_STAT, and dqm::qstatus::WARNING.

                                              {
  int code = 0;
  switch(status){
  case dqm::qstatus::INSUF_STAT:
    code = 1;
    break;
  case dqm::qstatus::WARNING:
    code = 2;
    break;
  case dqm::qstatus::ERROR:
    code = 3;
    break;
  } // end switch

  return code;

}
int SiPixelUtility::computeHistoBin ( std::string &  module_path) [static]

Definition at line 186 of file SiPixelUtility.cc.

References split.

                                                       { 

  int module_bin = 0;

  int module       = 0;
  int shell        = 0;   
  int layer        = 0;  
  int ladder       = 0;  
  int halfcylinder = 0;  
  int disk         = 0;  
  int blade        = 0;  
  int panel        = 0;  

  int nbinShell        = 192;
  int nbinLayer        = 0;  
  int nbinLadder       = 4;

  int nbinHalfcylinder = 168;  
  int nbinDisk         = 84;  
  int nbinBlade        = 7;  
  int nbinPanel        = 0;  

  vector<string> subDirVector;
  SiPixelUtility::split(module_path,subDirVector,"/");

  for (vector<string>::const_iterator it = subDirVector.begin();
       it != subDirVector.end(); it++) {
    if((*it).find("Collector") != string::npos ||
       //(*it).find("Collated") != string::npos ||
       (*it).find("FU") != string::npos ||
       (*it).find("Pixel") != string::npos ||
       (*it).find("Barrel") != string::npos ||
       (*it).find("Endcap") != string::npos) continue;
    
    if((*it).find("Module") != string::npos){
      module = atoi((*it).substr((*it).find("_")+1).c_str());
    }
    
    if((*it).find("Shell") != string::npos){
      if((*it).find("mI") != string::npos) shell = 1;
      if((*it).find("mO") != string::npos) shell = 2;
      if((*it).find("pI") != string::npos) shell = 3;
      if((*it).find("pO") != string::npos) shell = 4;
    }
    if((*it).find("Layer") != string::npos){
      layer = atoi((*it).substr((*it).find("_")+1).c_str());
      if(layer==1){
        nbinLayer = 0;
      }
      if(layer==2){
        nbinLayer = 40;
      }
      if(layer==3){
        nbinLayer = 40+64;
      }
    }
    if((*it).find("Ladder") != string::npos){
      ladder = atoi((*it).substr((*it).find("_")+1,2).c_str()); 
    }
    if((*it).find("HalfCylinder") != string::npos){
      if((*it).find("mI") != string::npos) halfcylinder = 1;
      if((*it).find("mO") != string::npos) halfcylinder = 2;
      if((*it).find("pI") != string::npos) halfcylinder = 3;
      if((*it).find("pO") != string::npos) halfcylinder = 4;
    }
    if((*it).find("Disk") != string::npos){
      disk = atoi((*it).substr((*it).find("_")+1).c_str());
    }
    if((*it).find("Blade") != string::npos){
      blade = atoi((*it).substr((*it).find("_")+1,2).c_str()); 
    }
    if((*it).find("Panel") != string::npos){
      panel = atoi((*it).substr((*it).find("_")+1).c_str()); 
      if(panel==1) nbinPanel = 0;
      if(panel==2) nbinPanel = 4;
    }
  }
  if(module_path.find("Barrel") != string::npos){
    module_bin =  module + 
      (ladder-1)*nbinLadder +
      nbinLayer +
      (shell -1)*nbinShell;
  }
  if(module_path.find("Endcap") != string::npos){
    module_bin =  module +
      (panel       -1)*nbinPanel +
      (blade       -1)*nbinBlade +
      (disk        -1)*nbinDisk +
      (halfcylinder-1)*nbinHalfcylinder;
  }
  
  return module_bin;

  //  cout << "leaving SiPixelInformationExtractor::computeHistoBin" << endl;
}
void SiPixelUtility::createStatusLegendMessages ( std::map< std::string, std::pair< int, double > > &  messages) [static]

Definition at line 325 of file SiPixelUtility.cc.

References findQualityFiles::size.

                                                                                       {
  for(int iStatus=1; iStatus<5;iStatus++){
    pair<int,double> color_size;
    int color = 1;
    double size  = 0.03;
    string code;
    string type;
    color_size.second = size;
    switch(iStatus){
    case 1: code = "1"; type = "INSUF_STAT"; color = kBlue;
      break;
    case 2: code = "2"; type = "WARNING(S)"; color = kYellow;
      break;
    case 3: code = "3"; type = "ERROR(S)  "; color = kRed;
      break;
    case 4: code = "4"; type = "ERRORS    "; color = kMagenta;
      break;
    } // end of switch
    string messageString = code + ": " + type;
    color_size.first = color;
    messages[messageString] = color_size;
  }
}
void SiPixelUtility::fillPaveText ( TPaveText *  pave,
std::map< std::string, std::pair< int, double > >  messages 
) [static]

Definition at line 283 of file SiPixelUtility.cc.

References first, argparse::message, edm::second(), and findQualityFiles::size.

                                                                          {

  TText* sourceCodeOnCanvas;
  for(map<string, pair<int,double> >::iterator it =  messages.begin();
                                            it != messages.end();
                                            it++){
    string message = it->first;
    int    color   = (it->second).first;
    double size    = (it->second).second;
    sourceCodeOnCanvas = pave->AddText(message.c_str());
    sourceCodeOnCanvas->SetTextColor(color);
    sourceCodeOnCanvas->SetTextSize(size);
    sourceCodeOnCanvas->SetTextFont(112);    

  }
}
static int SiPixelUtility::getMEList ( std::string  name,
std::vector< std::string > &  values 
) [static]
static int SiPixelUtility::getMEList ( std::string  name,
std::string &  dir_path,
std::vector< std::string > &  me_names 
) [static]
vector< string > SiPixelUtility::getQTestNameList ( MonitorElement me) [static]

Definition at line 137 of file SiPixelUtility.cc.

                                                                 {
  vector<string> qtestNameList;
  return qtestNameList;
}
int SiPixelUtility::getStatus ( MonitorElement me) [static]
void SiPixelUtility::getStatusColor ( double  status,
int &  rval,
int &  gval,
int &  bval 
) [static]
void SiPixelUtility::getStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
) [static]

Definition at line 75 of file SiPixelUtility.cc.

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

Referenced by SiPixelHistoPlotter::makePlot(), and SiPixelInformationExtractor::sendTkUpdatedStatus().

                                                                              {
  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;
  }        
}
static void SiPixelUtility::getStatusColor ( int  status,
int &  icol,
std::string &  tag 
) [static]
void SiPixelUtility::setDrawingOption ( TH1 *  hist,
float  xlow = -1.,
float  xhigh = -1. 
) [static]

Definition at line 353 of file SiPixelUtility.cc.

Referenced by SiPixelHistoPlotter::makePlot().

                                                     {
  if (!hist) return;

  TAxis* xa = hist->GetXaxis();
  TAxis* ya = hist->GetYaxis();

  xa->SetTitleOffset(0.7);
  xa->SetTitleSize(0.06);
  xa->SetLabelSize(0.04);
  //  xa->SetLabelColor(0);

  ya->SetTitleOffset(0.7);
  ya->SetTitleSize(0.06);


  if (xlow != -1 &&  xhigh != -1.0) {
    xa->SetRangeUser(xlow, xhigh);
  }
}
map< string, string > SiPixelUtility::sourceCodeMap ( ) [static]

Definition at line 301 of file SiPixelUtility.cc.

                                                {

  map<string,string> sourceCode;
  for(int iSource=0; iSource<5;iSource++){
    string type;
    string    code;
    switch(iSource){
    case 0: type = "RAW"; code = "1    ";
      break;
    case 1: type = "DIG"; code = "10   ";
      break;
    case 2: type = "CLU"; code = "100  ";
      break;
    case 3: type = "TRK"; code = "1000 ";
      break;
    case 4: type = "REC"; code = "10000";
      break;
    } // end of switch
    sourceCode[type]=code;
  }
  return sourceCode;
  
}
static void SiPixelUtility::split ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters = " " 
) [static]