CMS 3D CMS Logo

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