CMS 3D CMS Logo

SiStripCablingDQM.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripMonitorSummary/interface/SiStripCablingDQM.h"
00002 #include "DQMServices/Core/interface/MonitorElement.h"
00003 using namespace std;
00004 // -----
00005 
00006 SiStripCablingDQM::SiStripCablingDQM(const edm::EventSetup & eSetup,
00007                                      edm::ParameterSet const& hPSet,
00008                                      edm::ParameterSet const& fPSet):SiStripBaseCondObjDQM(eSetup, hPSet, fPSet){}
00009 // -----
00010 
00011 // -----
00012 SiStripCablingDQM::~SiStripCablingDQM(){}
00013 // -----
00014 
00015 
00016 // -----
00017 void SiStripCablingDQM::getActiveDetIds(const edm::EventSetup & eSetup){
00018 
00019 
00020   int counterTIB[4];
00021   for(int i=0;i<4;i++)counterTIB[i]=0;
00022 
00023   int counterTID[2][3];
00024   for(int i=0;i<2;i++){
00025     for(int j=0;j<3;j++)counterTID[i][j]=0;
00026   }
00027 
00028   int counterTOB[6];
00029   for(int i=0;i<6;i++)counterTOB[i]=0;
00030 
00031   int counterTEC[2][9];
00032   for(int i=0;i<2;i++){
00033     for(int j=0;j<9;j++)counterTEC[i][j]=0;
00034   }
00035 
00036   cablingHandle_->addActiveDetectorsRawIds(activeDetIds);
00037   selectModules(activeDetIds);
00038 
00039   std::vector<uint32_t>::const_iterator idet=activeDetIds.begin();
00040 
00041   for(;idet!=activeDetIds.end();++idet){
00042 
00043     uint32_t detId = *idet;
00044 
00045     StripSubdetector subdet(detId);
00046 
00047     switch (subdet.subdetId()) 
00048       {
00049       case StripSubdetector::TIB:
00050         {
00051           TIBDetId tibId(detId);
00052           int i = tibId.layer() - 1;
00053           counterTIB[i]++;
00054           break;       
00055         }
00056       case StripSubdetector::TID:
00057         {
00058           TIDDetId tidId(detId);
00059           if (tidId.side() == 2) {
00060             int j = tidId.wheel() - 1;
00061             counterTID[0][j]++;
00062           }  else if (tidId.side() == 1) {
00063             int j = tidId.wheel() - 1;
00064             counterTID[1][j]++;
00065           }
00066           break;       
00067         }
00068       case StripSubdetector::TOB:
00069         {
00070           TOBDetId tobId(detId);
00071           int i = tobId.layer() - 1;
00072           counterTOB[i]++;
00073           break;       
00074         }
00075       case StripSubdetector::TEC:
00076         {
00077           TECDetId tecId(detId);
00078           if (tecId.side() == 2) {
00079             int j = tecId.wheel() - 1;
00080             counterTEC[0][j]++;
00081           }  else if (tecId.side() == 1) {
00082             int j = tecId.wheel() - 1;
00083             counterTEC[1][j]++;
00084           }
00085           break;       
00086         }
00087       }
00088 
00089     /*    std::string s;
00090     s=getLayerNameAndId(*idet).first; 
00091     LogDebug("SiStripCabling")<<"Sub Det and Layer "<<s;
00092     for(int i=0;i<4;i++){
00093       std::stringstream ss;
00094       ss<<"TIB__layer__"<<i+1;
00095       if(strstr(s.c_str(),ss.str().c_str())!=NULL)counterTIB[i]++;
00096     }
00097 
00098     for(int i=0;i<2;i++){
00099       for(int j=0;j<3;j++){
00100         std::stringstream ss;
00101         ss<<"TID__side__"<<i+1<<"__wheel__"<<j+1;
00102         if(strstr(s.c_str(),ss.str().c_str())!=NULL)counterTID[i][j]++;
00103       }
00104     }
00105 
00106     for(int i=0;i<6;i++){
00107       std::stringstream ss;
00108       ss<<"TOB__layer__"<<i+1;
00109       if(strstr(s.c_str(),ss.str().c_str())!=NULL)counterTOB[i]++;
00110     }
00111 
00112     for(int i=0;i<2;i++){
00113       for(int j=0;j<9;j++){
00114         std::stringstream ss;
00115         ss<<"TEC__side__"<<i+1<<"__wheel__"<<j+1;
00116         if(strstr(s.c_str(),ss.str().c_str())!=NULL)counterTEC[i][j]++;
00117       }
00118       }*/
00119   }
00120 
00121   //obtained from tracker.dat and hard-coded
00122   int TIBDetIds[4]={672,864,540,648};
00123   int TIDDetIds[2][3]={{136,136,136},{136,136,136}};
00124   int TOBDetIds[6]={1008,1152,648,720,792,888};
00125   int TECDetIds[2][9]={{408,408,408,360,360,360,312,312,272},{408,408,408,360,360,360,312,312,272}};
00126 
00127   DQMStore* dqmStore_=edm::Service<DQMStore>().operator->();
00128 
00129   std::string FolderName=fPSet_.getParameter<std::string>("FolderName_For_QualityAndCabling_SummaryHistos");
00130 
00131   dqmStore_->setCurrentFolder(FolderName);
00132 
00133   //  dqmStore_->cd("SiStrip/MechanicalView/");
00134   MonitorElement *ME;
00135   ME = dqmStore_->book2D("SummaryOfCabling","SummaryOfCabling",6,0.5,6.5,9,0.5,9.5);
00136   ME->setAxisTitle("Sub Det",1);
00137   ME->setAxisTitle("Layer",2);
00138 
00139 
00140   ME->getTH1()->GetXaxis()->SetBinLabel(1,"TIB");
00141   ME->getTH1()->GetXaxis()->SetBinLabel(2,"TID F");
00142   ME->getTH1()->GetXaxis()->SetBinLabel(3,"TID B");
00143   ME->getTH1()->GetXaxis()->SetBinLabel(4,"TOB");
00144   ME->getTH1()->GetXaxis()->SetBinLabel(5,"TEC F");
00145   ME->getTH1()->GetXaxis()->SetBinLabel(6,"TEC B");
00146 
00147   for(int i=0;i<4;i++){
00148     ME->Fill(1,i+1,float(counterTIB[i])/TIBDetIds[i]);
00149   }
00150   
00151   for(int i=0;i<2;i++){
00152     for(int j=0;j<3;j++){
00153       ME->Fill(i+2,j+1,float(counterTID[i][j])/TIDDetIds[i][j]);
00154     }
00155   }
00156 
00157   for(int i=0;i<6;i++){
00158     ME->Fill(4,i+1,float(counterTOB[i])/TOBDetIds[i]);
00159   }
00160   
00161   for(int i=0;i<2;i++){
00162     for(int j=0;j<9;j++){
00163       ME->Fill(i+5,j+1,float(counterTEC[i][j])/TECDetIds[i][j]);
00164     }
00165   }
00166 
00167 }

Generated on Tue Jun 9 17:33:40 2009 for CMSSW by  doxygen 1.5.4