CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DQM/SiStripMonitorSummary/src/SiStripQualityDQM.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripMonitorSummary/interface/SiStripQualityDQM.h"
00002 #include "DQMServices/Core/interface/MonitorElement.h"
00003 #include "TCanvas.h"
00004 
00005 // -----
00006 SiStripQualityDQM::SiStripQualityDQM(const edm::EventSetup & eSetup,
00007                                          edm::ParameterSet const& hPSet,
00008                                          edm::ParameterSet const& fPSet):SiStripBaseCondObjDQM(eSetup, hPSet, fPSet){
00009   qualityLabel_ = fPSet.getParameter<std::string>("StripQualityLabel");
00010 
00011   // Build the Histo_TkMap:
00012   if(HistoMaps_On_ ) Tk_HM_ = new TkHistoMap("SiStrip/Histo_Map","Quality_TkMap",0.);
00013 
00014 }
00015 // -----
00016 
00017 
00018 
00019 // -----
00020 SiStripQualityDQM::~SiStripQualityDQM(){}
00021 // -----
00022 
00023 
00024 // -----
00025 void SiStripQualityDQM::getActiveDetIds(const edm::EventSetup & eSetup){
00026   getConditionObject(eSetup);
00027   qualityHandle_->getDetIds(activeDetIds);
00028 
00029 }
00030 // -----
00031 
00032 //================================================
00033 // -----
00034 void SiStripQualityDQM::fillModMEs(const std::vector<uint32_t> & selectedDetIds, const edm::EventSetup& es){
00035 
00036   //Retrieve tracker topology from geometry
00037   edm::ESHandle<TrackerTopology> tTopoHandle;
00038   es.get<IdealGeometryRecord>().get(tTopoHandle);
00039   const TrackerTopology* const tTopo = tTopoHandle.product();
00040    
00041   ModMEs CondObj_ME;
00042   
00043   for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
00044                                             detIter_!= selectedDetIds.end();detIter_++){
00045     fillMEsForDet(CondObj_ME,*detIter_,tTopo);
00046       
00047   }
00048 }    
00049 // -----
00050 
00051 
00052 
00053 //===================================================
00054 // -----
00055 void SiStripQualityDQM::fillMEsForDet(const ModMEs& _selModME_, uint32_t selDetId_, const TrackerTopology* tTopo){
00056   ModMEs selModME_ = _selModME_;  
00057   getModMEs(selModME_,selDetId_, tTopo);
00058   
00059   SiStripQuality::Range qualityRange = qualityHandle_->getRange(selDetId_);
00060   int nStrip =  reader->getNumberOfApvsAndStripLength(selDetId_).first*128;
00061   
00062   for( int istrip=0;istrip<nStrip;++istrip){
00063          selModME_.ProfileDistr->Fill(istrip+1,qualityHandle_->IsStripBad(qualityRange,istrip)?0.:1.);
00064 
00065   }// istrip
00066   
00067 }    
00068 // -----
00069 
00070 //====================================================
00071 // -----
00072 void SiStripQualityDQM::fillSummaryMEs(const std::vector<uint32_t> & selectedDetIds, const edm::EventSetup& es){
00073 
00074   //Retrieve tracker topology from geometry
00075   edm::ESHandle<TrackerTopology> tTopoHandle;
00076   es.get<IdealGeometryRecord>().get(tTopoHandle);
00077   const TrackerTopology* const tTopo = tTopoHandle.product();
00078 
00079   for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
00080                                             detIter_!= selectedDetIds.end();detIter_++){
00081     fillMEsForLayer(/*SummaryMEsMap_,*/ *detIter_,tTopo);
00082 
00083   }
00084 
00085   for (std::map<uint32_t, ModMEs>::iterator iter=SummaryMEsMap_.begin(); iter!=SummaryMEsMap_.end(); iter++){
00086 
00087     ModMEs selME;
00088     selME = iter->second;
00089 
00090     if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel") && fPSet_.getParameter<bool>("OutputSummaryAtLayerLevelAsImage")){
00091 
00092       TCanvas c1("c1");
00093       selME.SummaryDistr->getTH1()->Draw();
00094       std::string name (selME.SummaryDistr->getTH1()->GetTitle());
00095       name+=".png";
00096       c1.Print(name.c_str());
00097     }
00098   }
00099 
00100 }
00101 // -----
00102 
00103 
00104 //=================================================
00105 // -----
00106 void SiStripQualityDQM::fillMEsForLayer(/* std::map<uint32_t, ModMEs> selMEsMap_,*/ uint32_t selDetId_, const TrackerTopology* tTopo){
00107   
00108   float numberOfBadStrips=0;
00109   
00110   SiStripHistoId hidmanager;
00111 
00112   if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")){
00113       
00114     std::string hSummary_description;
00115     hSummary_description  = hPSet_.getParameter<std::string>("Summary_description");
00116       
00117     std::string hSummary_name; 
00118   
00119     // ----
00120     int subDetId_ = ((selDetId_>>25)&0x7);
00121   
00122     if( subDetId_<3 || subDetId_>6 ){ 
00123       edm::LogError("SiStripQualityDQM")
00124         << "[SiStripQualityDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
00125         << subDetId_ << " no folder set!" 
00126         << std::endl;
00127       return;
00128     }
00129     // ----
00130 
00131     hSummary_name = hidmanager.createHistoLayer(hSummary_description, 
00132                                                 "layer", 
00133                                                 getLayerNameAndId(selDetId_,tTopo).first, 
00134                                                 "") ;
00135         
00136     std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_,tTopo).second);
00137     
00138     ModMEs selME_;
00139     if ( selMEsMapIter_ != SummaryMEsMap_.end())
00140       selME_ =selMEsMapIter_->second;
00141 
00142     getSummaryMEs(selME_,selDetId_,tTopo);
00143   
00144   
00145     std::vector<uint32_t> sameLayerDetIds_;
00146     sameLayerDetIds_.clear();
00147     sameLayerDetIds_=GetSameLayerDetId(activeDetIds,selDetId_,tTopo);
00148     // -----
00149   //  unsigned int iBin=0;
00150 
00151     //%%%%%%%%%%%%%%%%%%%
00152     //%%% FIXME: patch to fix the bug causing double counting on each layer
00153     //%%%%%%%%%%%%%%%%%%%%%%%
00154     if(std::binary_search(alreadyFilledLayers.begin(),alreadyFilledLayers.end(),sameLayerDetIds_[0]))
00155       return;
00156     alreadyFilledLayers.push_back(sameLayerDetIds_[0]);
00157     sort(alreadyFilledLayers.begin(),alreadyFilledLayers.end());
00158     //%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%
00159 
00160     for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
00161     
00162       SiStripQuality::Range qualityRange = qualityHandle_->getRange(sameLayerDetIds_[i]);
00163       int nStrip =  reader->getNumberOfApvsAndStripLength(sameLayerDetIds_[i]).first*128;
00164     
00165       numberOfBadStrips=0;
00166     
00167       for( int istrip=0;istrip<nStrip;++istrip){
00168         if(qualityHandle_->IsStripBad(qualityRange,istrip)) { numberOfBadStrips++;}
00169       }
00170     
00171         float fr=100*float(numberOfBadStrips)/nStrip;
00172         selME_.SummaryDistr->Fill(i+1,fr);
00173         if(fr>20){
00174           char c[9];
00175           sprintf(c,"%d",sameLayerDetIds_[i]);
00176           selME_.SummaryDistr->getTH1()->GetXaxis()->SetBinLabel(i+1,c);
00177         }
00178 
00179         // Fill the TkHistoMap with Quality output :
00180         if(HistoMaps_On_ ) Tk_HM_->setBinContent(sameLayerDetIds_[i], fr);
00181 
00182         // Fill the TkMap
00183         if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
00184           fillTkMap(sameLayerDetIds_[i], fr);
00185         }
00186     } 
00187   }//if Fill ...  
00188 }  
00189 // -----
00190  
00191 
00192 //=============================
00193 void SiStripQualityDQM::fillGrandSummaryMEs(const edm::EventSetup& eSetup){
00194 
00195   //Retrieve tracker topology from geometry
00196   edm::ESHandle<TrackerTopology> tTopoHandle;
00197   eSetup.get<IdealGeometryRecord>().get(tTopoHandle);
00198   const TrackerTopology* const tTopo = tTopoHandle.product();
00199      
00200   std::string hSummary_BadObjects_xTitle        = hPSet_.getParameter<std::string>("Summary_BadObjects_histo_xTitle");
00201 
00202   std::string hSummary_BadModules_name          = hPSet_.getParameter<std::string>("Summary_BadModules_histo_name");
00203   std::string hSummary_BadModules_yTitle        = hPSet_.getParameter<std::string>("Summary_BadModules_histo_yTitle");
00204 
00205   std::string hSummary_BadFibers_name          = hPSet_.getParameter<std::string>("Summary_BadFibers_histo_name");
00206   std::string hSummary_BadFibers_yTitle        = hPSet_.getParameter<std::string>("Summary_BadFibers_histo_yTitle");
00207 
00208   std::string hSummary_BadApvs_name          = hPSet_.getParameter<std::string>("Summary_BadApvs_histo_name");
00209   std::string hSummary_BadApvs_yTitle        = hPSet_.getParameter<std::string>("Summary_BadApvs_histo_yTitle");
00210 
00211   std::string hSummary_BadStrips_name          = hPSet_.getParameter<std::string>("Summary_BadStrips_histo_name");
00212   std::string hSummary_BadStrips_yTitle        = hPSet_.getParameter<std::string>("Summary_BadStrips_histo_yTitle");
00213 
00214   int NchX           = 34; 
00215   double LowX        = 0.5;
00216   double HighX       = 34.5;
00217                     
00218 
00219 
00220    
00221   MonitorElement *ME[4];         
00222 
00223   DQMStore* dqmStore_=edm::Service<DQMStore>().operator->();
00224 
00225   std::string FolderName=fPSet_.getParameter<std::string>("FolderName_For_QualityAndCabling_SummaryHistos");
00226 
00227   dqmStore_->setCurrentFolder(FolderName);
00228 
00229   ME[0] = dqmStore_->book1D(hSummary_BadModules_name,hSummary_BadModules_name,NchX,LowX,HighX);
00230   ME[0]->setAxisTitle(hSummary_BadObjects_xTitle,1);
00231   ME[0]->setAxisTitle(hSummary_BadModules_yTitle,2);
00232 
00233   ME[1] = dqmStore_->book1D(hSummary_BadFibers_name,hSummary_BadFibers_name,NchX,LowX,HighX);
00234   ME[1]->setAxisTitle(hSummary_BadObjects_xTitle,1);
00235   ME[1]->setAxisTitle(hSummary_BadFibers_yTitle,2);
00236 
00237   ME[2] = dqmStore_->book1D(hSummary_BadApvs_name,hSummary_BadApvs_name,NchX,LowX,HighX);
00238   ME[2]->setAxisTitle(hSummary_BadObjects_xTitle,1);
00239   ME[2]->setAxisTitle(hSummary_BadApvs_yTitle,2);
00240 
00241   ME[3] = dqmStore_->book1D(hSummary_BadStrips_name,hSummary_BadStrips_name,NchX,LowX,HighX);
00242   ME[3]->setAxisTitle(hSummary_BadObjects_xTitle,1);
00243   ME[3]->setAxisTitle(hSummary_BadStrips_yTitle,2);
00244 
00245 
00246   //==============================
00247 
00248   for(int i=0;i<4;++i){
00249     NTkBadComponent[i]=0;
00250     for(int j=0;j<19;++j){
00251       ssV[i][j].str("");
00252       for(int k=0;k<4;++k)
00253         NBadComponent[i][j][k]=0;
00254     }
00255   }
00256 
00257   std::stringstream ss;
00258   ss.str(""); 
00259   std::vector<uint32_t> detids=reader->getAllDetIds();
00260   std::vector<uint32_t>::const_iterator idet=detids.begin();
00261   for(;idet!=detids.end();++idet){
00262     ss << "detid " << (*idet) << " IsModuleUsable " << qualityHandle_->IsModuleUsable((*idet)) << "\n";
00263   }
00264   LogDebug("SiStripQualityDQM") << ss.str() << std::endl;
00265 
00266 
00267   std::vector<SiStripQuality::BadComponent> BC = qualityHandle_->getBadComponentList();
00268   
00269   for (size_t i=0;i<BC.size();++i){
00270     
00271     //&&&&&&&&&&&&&
00272     //Full Tk
00273     //&&&&&&&&&&&&&
00274 
00275     if (BC[i].BadModule) 
00276       NTkBadComponent[0]++;
00277     if (BC[i].BadFibers) 
00278       NTkBadComponent[1]+= ( (BC[i].BadFibers>>2)&0x1 )+ ( (BC[i].BadFibers>>1)&0x1 ) + ( (BC[i].BadFibers)&0x1 );
00279     if (BC[i].BadApvs)
00280       NTkBadComponent[2]+= ( (BC[i].BadApvs>>5)&0x1 )+ ( (BC[i].BadApvs>>4)&0x1 ) + ( (BC[i].BadApvs>>3)&0x1 ) + 
00281         ( (BC[i].BadApvs>>2)&0x1 )+ ( (BC[i].BadApvs>>1)&0x1 ) + ( (BC[i].BadApvs)&0x1 );
00282 
00283     //&&&&&&&&&&&&&&&&&
00284     //Single SubSyste
00285     //&&&&&&&&&&&&&&&&&
00286 
00287     int component;
00288     SiStripDetId a(BC[i].detid);
00289     if ( a.subdetId() == SiStripDetId::TIB ){
00290       //&&&&&&&&&&&&&&&&&
00291       //TIB
00292       //&&&&&&&&&&&&&&&&&
00293       
00294       component=tTopo->tibLayer(BC[i].detid);
00295       SetBadComponents(0, component, BC[i]);         
00296 
00297     } else if ( a.subdetId() == SiStripDetId::TID ) {
00298       //&&&&&&&&&&&&&&&&&
00299       //TID
00300       //&&&&&&&&&&&&&&&&&
00301 
00302       component=tTopo->tidSide(BC[i].detid)==2?tTopo->tidWheel(BC[i].detid):tTopo->tidWheel(BC[i].detid)+3;
00303       SetBadComponents(1, component, BC[i]);         
00304 
00305     } else if ( a.subdetId() == SiStripDetId::TOB ) {
00306       //&&&&&&&&&&&&&&&&&
00307       //TOB
00308       //&&&&&&&&&&&&&&&&&
00309 
00310       component=tTopo->tobLayer(BC[i].detid);
00311       SetBadComponents(2, component, BC[i]);         
00312 
00313     } else if ( a.subdetId() == SiStripDetId::TEC ) {
00314       //&&&&&&&&&&&&&&&&&
00315       //TEC
00316       //&&&&&&&&&&&&&&&&&
00317 
00318       component=tTopo->tecSide(BC[i].detid)==2?tTopo->tecWheel(BC[i].detid):tTopo->tecWheel(BC[i].detid)+9;
00319       SetBadComponents(3, component, BC[i]);         
00320 
00321     }    
00322   }
00323 
00324   //&&&&&&&&&&&&&&&&&&
00325   // Single Strip Info
00326   //&&&&&&&&&&&&&&&&&&
00327 
00328   SiStripQuality::RegistryIterator rbegin = qualityHandle_->getRegistryVectorBegin();
00329   SiStripQuality::RegistryIterator rend   = qualityHandle_->getRegistryVectorEnd();
00330   
00331   for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
00332     uint32_t detid=rp->detid;
00333 
00334     int subdet=0;
00335     int component=0;
00336     SiStripDetId a(detid);
00337     if ( a.subdetId() == 3 ){
00338       subdet=0;
00339       component=tTopo->tibLayer(detid);
00340     } else if ( a.subdetId() == 4 ) {
00341       subdet=1;
00342       component=tTopo->tidSide(detid)==2?tTopo->tidWheel(detid):tTopo->tidWheel(detid)+3;
00343     } else if ( a.subdetId() == 5 ) {
00344       subdet=2;
00345       component=tTopo->tobLayer(detid);
00346     } else if ( a.subdetId() == 6 ) {
00347       subdet=3;
00348       component=tTopo->tecSide(detid)==2?tTopo->tecWheel(detid):tTopo->tecWheel(detid)+9;
00349     } 
00350 
00351     SiStripQuality::Range sqrange = SiStripQuality::Range( qualityHandle_->getDataVectorBegin()+rp->ibegin , qualityHandle_->getDataVectorBegin()+rp->iend );
00352         
00353     for(int it=0;it<sqrange.second-sqrange.first;it++){
00354       unsigned int range=qualityHandle_->decode( *(sqrange.first+it) ).range;
00355       NTkBadComponent[3]+=range;
00356       NBadComponent[subdet][0][3]+=range;
00357       NBadComponent[subdet][component][3]+=range;
00358     }
00359   }
00360   
00361  
00362   //&&&&&&&&&&&&&&&&&&
00363   // printout
00364   //&&&&&&&&&&&&&&&&&&
00365 
00366   ss.str("");
00367   ss << "\n-----------------\nGlobal Info\n-----------------";
00368   ss << "\nBadComponent \t   Modules \tFibers \tApvs\tStrips\n----------------------------------------------------------------";
00369   ss << "\nTracker:\t\t"<<NTkBadComponent[0]<<"\t"<<NTkBadComponent[1]<<"\t"<<NTkBadComponent[2]<<"\t"<<NTkBadComponent[3];
00370   ss<< "\n";
00371   ss << "\nTIB:\t\t\t"<<NBadComponent[0][0][0]<<"\t"<<NBadComponent[0][0][1]<<"\t"<<NBadComponent[0][0][2]<<"\t"<<NBadComponent[0][0][3];
00372   ss << "\nTID:\t\t\t"<<NBadComponent[1][0][0]<<"\t"<<NBadComponent[1][0][1]<<"\t"<<NBadComponent[1][0][2]<<"\t"<<NBadComponent[1][0][3];
00373   ss << "\nTOB:\t\t\t"<<NBadComponent[2][0][0]<<"\t"<<NBadComponent[2][0][1]<<"\t"<<NBadComponent[2][0][2]<<"\t"<<NBadComponent[2][0][3];
00374   ss << "\nTEC:\t\t\t"<<NBadComponent[3][0][0]<<"\t"<<NBadComponent[3][0][1]<<"\t"<<NBadComponent[3][0][2]<<"\t"<<NBadComponent[3][0][3];
00375   ss << "\n";
00376 
00377   for (int i=1;i<5;++i){
00378     ss << "\nTIB Layer " << i   << " :\t\t"<<NBadComponent[0][i][0]<<"\t"<<NBadComponent[0][i][1]<<"\t"<<NBadComponent[0][i][2]<<"\t"<<NBadComponent[0][i][3];
00379     std::stringstream binlabel;
00380       binlabel<<"TIB L "<<i;
00381 
00382     for(int j=0;j<4;j++){
00383       ME[j]->Fill(i,NBadComponent[0][i][j]);
00384       ME[j]->getTH1()->GetXaxis()->SetBinLabel(i,binlabel.str().c_str());
00385     }
00386   }
00387   ss << "\n";
00388   for (int i=1;i<4;++i){
00389     ss << "\nTID+ Disk " << i   << " :\t\t"<<NBadComponent[1][i][0]<<"\t"<<NBadComponent[1][i][1]<<"\t"<<NBadComponent[1][i][2]<<"\t"<<NBadComponent[1][i][3];
00390     std::stringstream binlabel;
00391       binlabel<<"TID+ D "<<i;
00392     
00393     for(int j=0;j<4;j++){
00394       ME[j]->Fill(i+4,NBadComponent[1][i][j]);
00395       ME[j]->getTH1()->GetXaxis()->SetBinLabel(i+4,binlabel.str().c_str());
00396     }
00397   }
00398   for (int i=4;i<7;++i){
00399     ss << "\nTID- Disk " << i-3 << " :\t\t"<<NBadComponent[1][i][0]<<"\t"<<NBadComponent[1][i][1]<<"\t"<<NBadComponent[1][i][2]<<"\t"<<NBadComponent[1][i][3];
00400     std::stringstream binlabel;
00401       binlabel<<"TID- D "<<i-3;
00402 
00403     for(int j=0;j<4;j++){
00404       ME[j]->Fill(i+4,NBadComponent[1][i][j]);
00405       ME[j]->getTH1()->GetXaxis()->SetBinLabel(i+4,binlabel.str().c_str());
00406     }
00407   }
00408   ss << "\n";
00409   for (int i=1;i<7;++i){
00410     ss << "\nTOB Layer " << i   << " :\t\t"<<NBadComponent[2][i][0]<<"\t"<<NBadComponent[2][i][1]<<"\t"<<NBadComponent[2][i][2]<<"\t"<<NBadComponent[2][i][3];
00411     std::stringstream binlabel;
00412       binlabel<<"TOB L "<<i;
00413 
00414     for(int j=0;j<4;j++){
00415       ME[j]->Fill(i+10,NBadComponent[2][i][j]);
00416       ME[j]->getTH1()->GetXaxis()->SetBinLabel(i+10,binlabel.str().c_str());
00417     }  
00418   }
00419   ss << "\n";
00420   for (int i=1;i<10;++i){
00421     ss << "\nTEC+ Disk " << i   << " :\t\t"<<NBadComponent[3][i][0]<<"\t"<<NBadComponent[3][i][1]<<"\t"<<NBadComponent[3][i][2]<<"\t"<<NBadComponent[3][i][3];
00422     std::stringstream binlabel;
00423       binlabel<<"TEC+ D "<<i;
00424 
00425     for(int j=0;j<4;j++){
00426       ME[j]->Fill(i+16,NBadComponent[3][i][j]);
00427       ME[j]->getTH1()->GetXaxis()->SetBinLabel(i+16,binlabel.str().c_str());
00428     }
00429   }
00430   for (int i=10;i<19;++i){
00431     ss << "\nTEC- Disk " << i-9 << " :\t\t"<<NBadComponent[3][i][0]<<"\t"<<NBadComponent[3][i][1]<<"\t"<<NBadComponent[3][i][2]<<"\t"<<NBadComponent[3][i][3];
00432     std::stringstream binlabel;
00433       binlabel<<"TEC- D "<<i-9;
00434 
00435     for(int j=0;j<4;j++){
00436       ME[j]->Fill(i+16,NBadComponent[3][i][j]);
00437       ME[j]->getTH1()->GetXaxis()->SetBinLabel(i+16,binlabel.str().c_str());
00438     }
00439   }
00440   ss<< "\n";
00441 
00442   ss << "\n----------------------------------------------------------------\n\t\t   Detid  \tModules Fibers Apvs\n----------------------------------------------------------------";
00443   for (int i=1;i<5;++i)
00444     ss << "\nTIB Layer " << i << " :" << ssV[0][i].str();
00445   ss << "\n";
00446   for (int i=1;i<4;++i)
00447     ss << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
00448   for (int i=4;i<7;++i)
00449     ss << "\nTID- Disk " << i-3 << " :" << ssV[1][i].str();
00450   ss << "\n";
00451   for (int i=1;i<7;++i)
00452     ss << "\nTOB Layer " << i << " :" << ssV[2][i].str();
00453   ss << "\n";
00454   for (int i=1;i<10;++i)
00455     ss << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
00456   for (int i=10;i<19;++i)
00457     ss << "\nTEC- Disk " << i-9 << " :" << ssV[3][i].str();
00458 
00459 
00460   edm::LogInfo("SiStripQualityDQM") << ss.str() << std::endl;
00461 
00462   for (int i=0; i<4; i++){
00463     TCanvas c1("c1");
00464     ME[i]->getTH1()->Draw();
00465     std::string name (ME[i]->getTH1()->GetTitle());
00466     name+=".png";
00467     c1.Print(name.c_str());
00468   }
00469 
00470 
00471 } 
00472 
00473 //=====================
00474 void SiStripQualityDQM::SetBadComponents(int i, int component,SiStripQuality::BadComponent& BC){
00475 
00476   int napv=reader->getNumberOfApvsAndStripLength(BC.detid).first;
00477 
00478   ssV[i][component] << "\n\t\t " 
00479                     << BC.detid 
00480                     << " \t " << BC.BadModule << " \t " 
00481                     << ( (BC.BadFibers)&0x1 ) << " ";
00482   if (napv==4)
00483     ssV[i][component] << "x " <<( (BC.BadFibers>>1)&0x1 );
00484   
00485   if (napv==6)
00486     ssV[i][component] << ( (BC.BadFibers>>1)&0x1 ) << " "
00487                       << ( (BC.BadFibers>>2)&0x1 );
00488   ssV[i][component] << " \t " 
00489                     << ( (BC.BadApvs)&0x1 ) << " " 
00490                     << ( (BC.BadApvs>>1)&0x1 ) << " ";
00491   if (napv==4) 
00492     ssV[i][component] << "x x " << ( (BC.BadApvs>>2)&0x1 ) << " " 
00493                       << ( (BC.BadApvs>>3)&0x1 );
00494   if (napv==6) 
00495     ssV[i][component] << ( (BC.BadApvs>>2)&0x1 ) << " " 
00496                       << ( (BC.BadApvs>>3)&0x1 ) << " " 
00497                       << ( (BC.BadApvs>>4)&0x1 ) << " " 
00498                       << ( (BC.BadApvs>>5)&0x1 ) << " "; 
00499 
00500   if (BC.BadApvs){
00501     NBadComponent[i][0][2]+= ( (BC.BadApvs>>5)&0x1 )+ ( (BC.BadApvs>>4)&0x1 ) + ( (BC.BadApvs>>3)&0x1 ) + 
00502       ( (BC.BadApvs>>2)&0x1 )+ ( (BC.BadApvs>>1)&0x1 ) + ( (BC.BadApvs)&0x1 );
00503     NBadComponent[i][component][2]+= ( (BC.BadApvs>>5)&0x1 )+ ( (BC.BadApvs>>4)&0x1 ) + ( (BC.BadApvs>>3)&0x1 ) + 
00504       ( (BC.BadApvs>>2)&0x1 )+ ( (BC.BadApvs>>1)&0x1 ) + ( (BC.BadApvs)&0x1 );
00505     //    tkMap->fillc(BC.detid,0xff0000);
00506   }
00507   if (BC.BadFibers){ 
00508     NBadComponent[i][0][1]+= ( (BC.BadFibers>>2)&0x1 )+ ( (BC.BadFibers>>1)&0x1 ) + ( (BC.BadFibers)&0x1 );
00509     NBadComponent[i][component][1]+= ( (BC.BadFibers>>2)&0x1 )+ ( (BC.BadFibers>>1)&0x1 ) + ( (BC.BadFibers)&0x1 );
00510     //    tkMap->fillc(BC.detid,0x0000ff);
00511   }   
00512   if (BC.BadModule){
00513     NBadComponent[i][0][0]++;
00514     NBadComponent[i][component][0]++;
00515     //    tkMap->fillc(BC.detid,0x0);
00516   }
00517 }
00518