CMS 3D CMS Logo

SiStripQuality.cc

Go to the documentation of this file.
00001 //
00002 // Author:      Domenico Giordano
00003 // Created:     Wed Sep 26 17:42:12 CEST 2007
00004 // $Id: SiStripQuality.cc,v 1.12 2008/08/21 11:10:17 giordano Exp $
00005 //
00006 #include "FWCore/Framework/interface/eventsetupdata_registration_macro.h"
00007 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00008  
00009 SiStripQuality::SiStripQuality():
00010   toCleanUp(false),
00011   FileInPath_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"),
00012   SiStripDetCabling_(NULL){
00013   reader=new SiStripDetInfoFileReader(FileInPath_.fullPath());
00014 }
00015 
00016 SiStripQuality::SiStripQuality(edm::FileInPath& file):toCleanUp(false),FileInPath_(file),SiStripDetCabling_(NULL){
00017   reader=new SiStripDetInfoFileReader(FileInPath_.fullPath());
00018 }
00019 
00020 SiStripQuality::SiStripQuality(const SiStripQuality& other){
00021   FileInPath_=other.FileInPath_;
00022   reader=new SiStripDetInfoFileReader(*(other.reader));
00023   toCleanUp=other.toCleanUp;
00024   indexes=other.indexes;
00025   v_badstrips=other.v_badstrips;
00026   BadComponentVect=other.BadComponentVect;
00027   SiStripDetCabling_=other.SiStripDetCabling_;
00028 }
00029 
00030 
00031 SiStripQuality& SiStripQuality::operator +=(const SiStripQuality& other){ 
00032   this->add(&other); 
00033   this->cleanUp(); 
00034   this->fillBadComponents(); 
00035   return *this; 
00036 }
00037 
00038 SiStripQuality& SiStripQuality::operator -=(const SiStripQuality& other){
00039     
00040   SiStripBadStrip::RegistryIterator rbegin = other.getRegistryVectorBegin();
00041   SiStripBadStrip::RegistryIterator rend   = other.getRegistryVectorEnd();
00042   std::vector<unsigned int> ovect,vect;
00043   uint32_t detid;
00044   unsigned short Nstrips;
00045     
00046   for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
00047     
00048     detid=rp->detid;
00049     Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128;
00050     
00051     SiStripBadStrip::Range orange = SiStripBadStrip::Range( other.getDataVectorBegin()+rp->ibegin , other.getDataVectorBegin()+rp->iend );
00052     
00053     //Is this detid already in the collections owned by this class?
00054     SiStripBadStrip::Range range = getRange(detid);   
00055     if (range.first!=range.second){ //yes, it is
00056 
00057       vect.clear();
00058       ovect.clear();
00059 
00060       //if other full det is bad, remove det from this
00061       SiStripBadStrip::data data_=decode(*(orange.first));
00062       if(orange.second-orange.first!=1
00063          || data_.firstStrip!=0
00064          || data_.range<Nstrips){
00065         
00066         ovect.insert(ovect.end(),orange.first,orange.second);
00067         vect.insert(vect.end(),range.first,range.second);
00068         subtract(vect,ovect);
00069       } 
00070       SiStripBadStrip::Range newrange(vect.begin(),vect.end());
00071       if ( ! put_replace(detid,newrange) )
00072         edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl;
00073     }
00074   }
00075   cleanUp(); 
00076   fillBadComponents(); 
00077   return *this; 
00078 }
00079 
00080 const SiStripQuality SiStripQuality::operator -(const SiStripQuality& other) const {
00081   return SiStripQuality(*this) -= other; 
00082 }
00083 
00084 bool SiStripQuality::operator ==(const SiStripQuality& other) const{
00085   SiStripQuality a = (*this) - other ;
00086   return a.getRegistryVectorBegin()==a.getRegistryVectorEnd();
00087 }
00088 bool SiStripQuality::operator !=(const SiStripQuality& other) const { return !(*this == other) ; }
00089 
00090 
00091 void SiStripQuality::add(const SiStripDetCabling *cab){
00092   SiStripDetCabling_=cab;
00093   addInvalidConnectionFromCabling();
00094   addNotConnectedConnectionFromCabling();
00095 }
00096 
00097 void SiStripQuality::addNotConnectedConnectionFromCabling(){
00098   
00099   std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > allData = reader->getAllData();
00100   std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator iter=allData.begin();
00101   std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator iterEnd=allData.end();
00102   std::vector<unsigned int> vect;
00103   short firstStrip=0;
00104   short range=0;
00105   for(;iter!=iterEnd;++iter)
00106     if (!SiStripDetCabling_->IsConnected(iter->first)){
00107       vect.clear();
00108       range=iter->second.nApvs*128;
00109       LogTrace("SiStripQuality") << "[addNotConnectedConnectionFromCabling] add detid " << iter->first << std::endl;
00110       vect.push_back(encode(firstStrip,range));
00111       SiStripBadStrip::Range Range(vect.begin(),vect.end());
00112       add(iter->first,Range);
00113     }
00114 }
00115 
00116 void SiStripQuality::addInvalidConnectionFromCabling(){
00117 
00118   std::vector<uint32_t> connected_detids;
00119   SiStripDetCabling_->addActiveDetectorsRawIds(connected_detids);
00120   std::vector<uint32_t>::const_iterator itdet = connected_detids.begin();
00121   std::vector<uint32_t>::const_iterator itdetEnd = connected_detids.end();
00122   for(;itdet!=itdetEnd;++itdet){
00123     //LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] looking at detid " <<*itdet << std::endl;
00124     const std::vector<FedChannelConnection>& fedconns=SiStripDetCabling_->getConnections(*itdet);
00125     std::vector<FedChannelConnection>::const_iterator itconns=fedconns.begin();
00126     std::vector<FedChannelConnection>::const_iterator itconnsEnd=fedconns.end();
00127     
00128     unsigned short nApvPairs=SiStripDetCabling_->nApvPairs(*itdet);
00129     short ngoodConn=0, goodConn=0;
00130     for(;itconns!=itconnsEnd;++itconns){
00131       //LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] apvpair " << itconns->apvPairNumber() << " napvpair " << itconns->nApvPairs()<< " detid " << itconns->detId() << std::endl;
00132       if(itconns->nApvPairs()==sistrip::invalid_)
00133         continue;
00134       ngoodConn++;
00135       goodConn = goodConn | ( 0x1 << itconns->apvPairNumber() );
00136     }
00137 
00138     if (ngoodConn!=nApvPairs){
00139       std::vector<unsigned int> vect;
00140       for (size_t idx=0;idx<nApvPairs;++idx){
00141         if( !(goodConn & ( 0x1 << idx)) ) {
00142           short firstStrip=idx*256;
00143           short range=256;
00144           LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] add detid " <<*itdet << "firstStrip " << firstStrip<< std::endl;
00145           vect.push_back(encode(firstStrip,range));
00146         }
00147       }
00148       if(!vect.empty()){
00149         SiStripBadStrip::Range Range(vect.begin(),vect.end());
00150         add(*itdet,Range);
00151       }
00152     }
00153   }
00154 }
00155 
00156 void SiStripQuality::add(const SiStripBadStrip* base){
00157   SiStripBadStrip::RegistryIterator basebegin = base->getRegistryVectorBegin();
00158   SiStripBadStrip::RegistryIterator baseend   = base->getRegistryVectorEnd();
00159   
00160   //the Registry already contains data
00161   //Loop on detids
00162   for (SiStripBadStrip::RegistryIterator basep=basebegin; basep != baseend; ++basep) {
00163     uint32_t detid=basep->detid;
00164     LogTrace("SiStripQuality") << "add detid " <<detid << std::endl;
00165     
00166     SiStripBadStrip::Range baserange = SiStripBadStrip::Range( base->getDataVectorBegin()+basep->ibegin , base->getDataVectorBegin()+basep->iend );
00167     
00168     add(detid,baserange);
00169   }
00170 }
00171 
00172 void SiStripQuality::add(const uint32_t& detid,const SiStripBadStrip::Range& baserange){
00173  std::vector<unsigned int> vect, tmp;
00174 
00175  unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128;
00176     
00177  //Is this detid already in the collections owned by this class?
00178  SiStripBadStrip::Range range = getRange(detid);
00179  
00180  //Append bad strips  
00181  tmp.clear();
00182  if (range.first==range.second){
00183    LogTrace("SiStripQuality") << "new detid" << std::endl;
00184    //It's a new detid
00185    tmp.insert(tmp.end(),baserange.first,baserange.second);
00186    std::stable_sort(tmp.begin(),tmp.end());
00187    LogTrace("SiStripQuality") << "ordered" << std::endl;
00188  } else {
00189    LogTrace("SiStripQuality") << "already exists" << std::endl;
00190    //alredy existing detid
00191    
00192    //if full det is bad go to next detid
00193    SiStripBadStrip::data data_=decode(*(range.first));
00194    if(range.second-range.first==1
00195       && data_.firstStrip==0
00196       && data_.range>=Nstrips){
00197      LogTrace("SiStripQuality") << "full det is bad.. " << range.second-range.first << " " << decode(*(range.first)).firstStrip << " " << decode(*(range.first)).range << " " << decode(*(range.first)).flag <<"\n"<< std::endl;
00198      return;
00199    }
00200                 
00201    tmp.insert(tmp.end(),baserange.first,baserange.second);
00202    tmp.insert(tmp.end(),range.first,range.second);
00203    std::stable_sort(tmp.begin(),tmp.end());
00204    LogTrace("SiStripQuality") << "ordered" << std::endl;
00205  }
00206  //Compact data
00207  compact(tmp,vect,Nstrips);
00208  SiStripBadStrip::Range newrange(vect.begin(),vect.end());
00209  if ( ! put_replace(detid,newrange) )
00210    edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl;
00211 }
00212 
00213 void SiStripQuality::compact(unsigned int& detid, std::vector<unsigned int>& vect){
00214   std::vector<unsigned int> tmp=vect;
00215   vect.clear();
00216   std::stable_sort(tmp.begin(),tmp.end());
00217   unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128;
00218   compact(tmp,vect,Nstrips);
00219 }
00220 
00221 bool SiStripQuality::put_replace(const uint32_t& DetId, Range input) {
00222   // put in SiStripQuality::v_badstrips of DetId
00223   Registry::iterator p = std::lower_bound(indexes.begin(),indexes.end(),DetId,SiStripBadStrip::StrictWeakOrdering());
00224 
00225   size_t sd= input.second-input.first;
00226   DetRegistry detregistry;
00227   detregistry.detid=DetId;
00228   detregistry.ibegin=v_badstrips.size();
00229   detregistry.iend=v_badstrips.size()+sd;
00230 
00231   v_badstrips.insert(v_badstrips.end(),input.first,input.second);
00232 
00233   if (p!=indexes.end() && p->detid==DetId){
00234     LogTrace("SiStripQuality") << "[SiStripQuality::put_replace]  Replacing SiStripQuality for already stored DetID " << DetId << std::endl;
00235     toCleanUp=true;
00236     *p=detregistry;
00237   } else {
00238     indexes.insert(p,detregistry);
00239   }
00240 
00241   return true;
00242 }
00243 
00244 /*
00245 Method to reduce the granularity of badcomponents:
00246 if in an apv there are more than ratio*128 bad strips,
00247 the full apv is declared as bad.
00248 Method needed to help the 
00249  */
00250 void SiStripQuality::ReduceGranularity(double threshold){
00251 
00252   SiStripBadStrip::RegistryIterator rp = getRegistryVectorBegin();
00253   SiStripBadStrip::RegistryIterator rend   = getRegistryVectorEnd();
00254   SiStripBadStrip::data data_;
00255   uint16_t BadStripPerApv[6], ipos;
00256   std::vector<unsigned int> vect;
00257 
00258   for (; rp != rend; ++rp) {
00259     uint32_t detid=rp->detid;
00260 
00261     BadStripPerApv[0]=0;    BadStripPerApv[1]=0;    BadStripPerApv[2]=0;    BadStripPerApv[3]=0;    BadStripPerApv[4]=0;    BadStripPerApv[5]=0;
00262     ipos=0;
00263 
00264     SiStripBadStrip::Range sqrange = SiStripBadStrip::Range( getDataVectorBegin()+rp->ibegin , getDataVectorBegin()+rp->iend );
00265     
00266     for(int it=0;it<sqrange.second-sqrange.first;it++){
00267 
00268       data_=decode( *(sqrange.first+it) );
00269       LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] detid " << detid << " first strip " << data_.firstStrip << " lastStrip " << data_.firstStrip+data_.range-1  << " range " << data_.range;
00270       ipos= data_.firstStrip/128;
00271       while (ipos<=(data_.firstStrip+data_.range-1)/128){
00272         BadStripPerApv[ipos]+=std::min(data_.firstStrip+data_.range,(ipos+1)*128)-std::max(data_.firstStrip*1,ipos*128);
00273         LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] ipos " << ipos << " Counter " << BadStripPerApv[ipos] << " min " << std::min(data_.firstStrip+data_.range,(ipos+1)*128) << " max " << std::max(data_.firstStrip*1,ipos*128) << " added " << std::min(data_.firstStrip+data_.range,(ipos+1)*128)-std::max(data_.firstStrip*1,ipos*128);
00274         ipos++;
00275       }
00276     }
00277 
00278     LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] Total for detid " << detid << " values " << BadStripPerApv[0] << " " << BadStripPerApv[1] << " " << BadStripPerApv[2] << " " <<BadStripPerApv[3] << " " <<BadStripPerApv[4] << " " << BadStripPerApv[5];
00279     
00280     
00281     vect.clear();
00282     for(size_t i=0;i<6;++i){
00283       if (BadStripPerApv[i]>=threshold*128){
00284         vect.push_back(encode(i*128,128));
00285       }
00286     }
00287     if(!vect.empty()){
00288       SiStripBadStrip::Range Range(vect.begin(),vect.end());
00289       add(detid,Range);
00290     }
00291   }
00292 }
00293 
00294 
00295 void SiStripQuality::compact(std::vector<unsigned int>& tmp,std::vector<unsigned int>& vect,unsigned short& Nstrips){
00296   SiStripBadStrip::data fs_0, fs_1;
00297   vect.clear();
00298 
00299   ContainerIterator it=tmp.begin();
00300   fs_0=decode(*it);
00301    
00302   //Check if at the module end
00303   if (fs_0.firstStrip+fs_0.range>=Nstrips){
00304     vect.push_back(encode(fs_0.firstStrip,Nstrips-fs_0.firstStrip));
00305     return;
00306   }
00307 
00308   ++it;
00309   for(;it!=tmp.end();++it){
00310     fs_1=decode(*it);
00311     
00312     if (fs_0.firstStrip+fs_0.range>=fs_1.firstStrip+fs_1.range){
00313       //fs_0 includes fs_1, go ahead
00314     } else if (fs_0.firstStrip+fs_0.range>=fs_1.firstStrip){
00315       // contiguous or superimposed intervals
00316       //Check if at the module end
00317       if (fs_1.firstStrip+fs_1.range>=Nstrips){
00318         vect.push_back(encode(fs_0.firstStrip,Nstrips-fs_0.firstStrip));
00319         return;
00320       }else{
00321         //create new fs_0
00322         fs_0.range=fs_1.firstStrip+fs_1.range-fs_0.firstStrip;
00323       }
00324     } else{
00325       //separated intervals
00326       vect.push_back(encode(fs_0.firstStrip,fs_0.range));
00327       fs_0=fs_1;
00328     }
00329   }
00330   vect.push_back(encode(fs_0.firstStrip,fs_0.range));
00331 }
00332 
00333 void SiStripQuality::subtract(std::vector<unsigned int>& A,const std::vector<unsigned int>& B){
00334   ContainerIterator it=B.begin();
00335   ContainerIterator itend=B.end();
00336   for(;it!=itend;++it){    
00337     subtraction(A,*it);
00338   }
00339 }
00340 
00341 void SiStripQuality::subtraction(std::vector<unsigned int>& A,const unsigned int& B){
00342   SiStripBadStrip::data fs_A, fs_B, fs_m, fs_M;
00343   std::vector<unsigned int> tmp;
00344 
00345   fs_B=decode(B);
00346   ContainerIterator jt=A.begin();
00347   ContainerIterator jtend=A.end();
00348   for(;jt!=jtend;++jt){
00349     fs_A=decode(*jt);
00350     if (B<*jt){
00351       fs_m=fs_B;
00352       fs_M=fs_A;
00353     }else{
00354       fs_m=fs_A;
00355       fs_M=fs_B;
00356     }
00357     //A) Verify the range to be subtracted crosses the new range
00358     if (fs_m.firstStrip+fs_m.range>fs_M.firstStrip){
00359       if (*jt<B){
00360         tmp.push_back(encode(fs_A.firstStrip,fs_B.firstStrip-fs_A.firstStrip));
00361       }
00362       if (fs_A.firstStrip+fs_A.range>fs_B.firstStrip+fs_B.range){
00363         tmp.push_back(encode(fs_B.firstStrip+fs_B.range,fs_A.firstStrip+fs_A.range-(fs_B.firstStrip+fs_B.range)));
00364       }
00365     }else{
00366       tmp.push_back(*jt);
00367     }
00368   } 
00369   A=tmp;
00370 }
00371 
00372 bool SiStripQuality::cleanUp(bool force){
00373 
00374   if (!toCleanUp && !force)
00375     return false;
00376 
00377   toCleanUp=false;
00378 
00379   std::vector<unsigned int> v_badstrips_tmp=v_badstrips;
00380   std::vector<DetRegistry> indexes_tmp=indexes;
00381 
00382   LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] before cleanUp v_badstrips.size()= " << v_badstrips.size() << " indexes.size()=" << indexes.size() << std::endl;
00383 
00384   v_badstrips.clear();
00385   indexes.clear();
00386 
00387   SiStripBadStrip::RegistryIterator basebegin = indexes_tmp.begin();
00388   SiStripBadStrip::RegistryIterator baseend   = indexes_tmp.end();
00389 
00390   for (SiStripBadStrip::RegistryIterator basep=basebegin; basep != baseend; ++basep) {
00391     if(basep->ibegin!=basep->iend){
00392       SiStripBadStrip::Range range( v_badstrips_tmp.begin()+basep->ibegin, v_badstrips_tmp.begin()+basep->iend );
00393       if ( ! put(basep->detid,range) )
00394         edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl;
00395     }
00396   }
00397   
00398   LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] after cleanUp v_badstrips.size()= " << v_badstrips.size() << " indexes.size()=" << indexes.size() << std::endl;
00399   return true;
00400 }
00401 
00402 void SiStripQuality::fillBadComponents(){
00403   
00404   BadComponentVect.clear();
00405   
00406   for (SiStripBadStrip::RegistryIterator basep=indexes.begin(); basep != indexes.end(); ++basep) {
00407     
00408     SiStripBadStrip::Range range( v_badstrips.begin()+basep->ibegin, v_badstrips.begin()+basep->iend );
00409     
00410     //Fill BadModules, BadFibers, BadApvs vectors
00411     unsigned short resultA=0, resultF=0;
00412     BadComponent result;
00413     
00414     SiStripBadStrip::data fs;
00415     unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(basep->detid).first*128;
00416     
00417     //BadModules
00418     fs=decode(*(range.first));
00419     if (basep->iend - basep->ibegin == 1 &&
00420         fs.firstStrip==0 && 
00421         fs.range==Nstrips ){
00422       result.detid=basep->detid;
00423       result.BadModule=true;
00424       result.BadFibers=(1<< (Nstrips/256))-1; 
00425       result.BadApvs=(1<< (Nstrips/128))-1; 
00426         
00427       BadComponentVect.push_back(result);
00428       
00429     } else {
00430 
00431       //Bad Fibers and  Apvs
00432       for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){
00433         fs=decode(*it);
00434       
00435         //BadApvs
00436         for(short apvNb=0;apvNb<6;++apvNb){
00437           if ( fs.firstStrip<=apvNb*128 && (apvNb+1)*128<=fs.firstStrip+fs.range ){
00438             resultA=resultA | (1<<apvNb);
00439           }     
00440         }
00441         //BadFibers
00442         for(short fiberNb=0;fiberNb<3;++fiberNb){
00443           if ( fs.firstStrip<=fiberNb*256 && (fiberNb+1)*256<=fs.firstStrip+fs.range ){
00444             resultF=resultF | (1<<fiberNb);
00445           }     
00446         }
00447       }
00448       if (resultA!=0){
00449         result.detid=basep->detid;
00450         result.BadModule=false;
00451         result.BadFibers=resultF;
00452         result.BadApvs=resultA;
00453         BadComponentVect.push_back(result);    
00454       }
00455     }
00456   }
00457 }
00458 
00459 //--------------------------------------------------------------//
00460 
00461 bool SiStripQuality::IsModuleUsable(const uint32_t& detid) const{  
00462 
00463   std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
00464   if (p!=BadComponentVect.end() && p->detid==detid)
00465     if(p->BadModule)
00466       return false;
00467 
00468   if (SiStripDetCabling_!=NULL)
00469     if(!SiStripDetCabling_->IsConnected(detid))
00470       return false;
00471 
00472   return true;
00473 }
00474 
00475 bool SiStripQuality::IsModuleBad(const uint32_t& detid) const{  
00476 
00477   std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
00478   if (p!=BadComponentVect.end() && p->detid==detid)
00479     return p->BadModule;
00480   return false;
00481 }
00482 
00483 bool SiStripQuality::IsFiberBad(const uint32_t& detid, const short& fiberNb) const{
00484   std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
00485   if (p!=BadComponentVect.end() && p->detid==detid)
00486     return ((p->BadFibers>>fiberNb)&0x1);
00487   return false;
00488 }
00489 
00490 bool SiStripQuality::IsApvBad(const uint32_t& detid, const short& apvNb) const{
00491   std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
00492   if (p!=BadComponentVect.end() && p->detid==detid)
00493     return ((p->BadApvs>>apvNb)&0x1);
00494   return false;
00495 }
00496 
00497 bool SiStripQuality::IsStripBad(const uint32_t& detid, const short& strip) const{
00498   SiStripBadStrip::Range range=getRange(detid);
00499   return IsStripBad(range,strip);
00500 }
00501 
00502 bool SiStripQuality::IsStripBad(const Range& range, const short& strip) const{
00503   bool result=false;
00504   SiStripBadStrip::data fs;
00505   for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){
00506     fs=decode(*it);
00507     if ( fs.firstStrip<=strip && strip<fs.firstStrip+fs.range ){
00508       result=true;
00509       break;
00510     }      
00511   }
00512   return result;
00513 }
00514 
00515 int SiStripQuality::nBadStripsOnTheLeft(const Range& range, const short& strip) const{
00516   int result=0;
00517   SiStripBadStrip::data fs;
00518   for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){
00519     fs=decode(*it);
00520     if ( fs.firstStrip<=strip && strip<fs.firstStrip+fs.range ){
00521       result=strip-fs.firstStrip+1;
00522       break;
00523     }      
00524   }
00525   return result;
00526 }
00527 
00528 int SiStripQuality::nBadStripsOnTheRight(const Range& range, const short& strip) const{
00529   int result=0;
00530   SiStripBadStrip::data fs;
00531   for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){
00532     fs=decode(*it);
00533     if ( fs.firstStrip<=strip && strip<fs.firstStrip+fs.range ){
00534       result=fs.firstStrip+fs.range-strip;
00535       break;
00536     }      
00537   }
00538   return result;
00539 }
00540 
00541 short SiStripQuality::getBadApvs(const uint32_t& detid) const{
00542   std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
00543   if (p!=BadComponentVect.end() && p->detid==detid)
00544     return p->BadApvs;
00545   return 0;
00546 }
00547 
00548 short SiStripQuality::getBadFibers(const uint32_t& detid) const{
00549   std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
00550   if (p!=BadComponentVect.end() && p->detid==detid)
00551     return p->BadFibers;
00552   return 0;
00553 } 

Generated on Tue Jun 9 17:25:27 2009 for CMSSW by  doxygen 1.5.4