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