#include <SiStripQuality.cc>
Classes | |
struct | BadComponent |
class | BadComponentStrictWeakOrdering |
Public Member Functions | |
void | add (const uint32_t &, const SiStripBadStrip::Range &) |
void | add (const SiStripDetCabling *) |
void | add (const SiStripDetVOff *) |
void | add (const RunInfo *) |
void | add (const SiStripBadStrip *) |
void | addInvalidConnectionFromCabling () |
void | addNotConnectedConnectionFromCabling () |
bool | cleanUp (bool force=false) |
void | clear () |
void | compact (unsigned int &, std::vector< unsigned int > &) |
void | fillBadComponents () |
short | getBadApvs (const uint32_t &detid) const |
const std::vector< BadComponent > & | getBadComponentList () const |
short | getBadFibers (const uint32_t &detid) const |
edm::FileInPath | getFileInPath () const |
bool | IsApvBad (const uint32_t &detid, const short &apvNb) const |
bool | IsFiberBad (const uint32_t &detid, const short &fiberNb) const |
bool | IsModuleBad (const uint32_t &detid) const |
bool | IsModuleUsable (const uint32_t &detid) const |
bool | IsStripBad (const Range &range, const short &strip) const |
bool | IsStripBad (const uint32_t &detid, const short &strip) const |
int | nBadStripsOnTheLeft (const Range &range, const short &strip) const |
int | nBadStripsOnTheRight (const Range &range, const short &strip) const |
bool | operator!= (const SiStripQuality &) const |
SiStripQuality & | operator+= (const SiStripQuality &) |
const SiStripQuality | operator- (const SiStripQuality &) const |
SiStripQuality & | operator-= (const SiStripQuality &) |
bool | operator== (const SiStripQuality &) const |
void | ReduceGranularity (double) |
void | setPrintDebugOutput (const bool printDebug) |
void | setUseEmptyRunInfo (const bool useEmptyRunInfo) |
SiStripQuality () | |
SiStripQuality (edm::FileInPath &) | |
SiStripQuality (const SiStripQuality &) | |
~SiStripQuality () | |
Private Member Functions | |
void | compact (std::vector< unsigned int > &, std::vector< unsigned int > &, unsigned short &) |
void | printActiveFedsInfo (const std::vector< uint16_t > &activeFedsFromCabling, const std::vector< int > &activeFedsFromRunInfo, const std::vector< int > &differentFeds, const bool printDebug) |
Prints debug output for the active feds comparing the list in RunInfo and FedCabling. | |
void | printDetInfo (const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss) |
Prints debug output for a given detId. | |
bool | put_replace (const uint32_t &DetId, Range input) |
void | subtract (std::vector< unsigned int > &, const std::vector< unsigned int > &) |
void | subtraction (std::vector< unsigned int > &, const unsigned int &) |
void | turnOffFeds (const std::vector< int > &fedsList, const bool turnOffStrips, const bool printDebug) |
Private Attributes | |
std::vector< BadComponent > | BadComponentVect |
edm::FileInPath | FileInPath_ |
bool | printDebug_ |
SiStripDetInfoFileReader * | reader |
const SiStripDetCabling * | SiStripDetCabling_ |
bool | toCleanUp |
bool | useEmptyRunInfo_ |
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 33 of file SiStripQuality.h.
SiStripQuality::SiStripQuality | ( | ) |
Definition at line 20 of file SiStripQuality.cc.
References FileInPath_, edm::FileInPath::fullPath(), reader, and OfflineSiStripConfigDb_cff::SiStripDetInfoFileReader.
Referenced by operator-().
: toCleanUp(false), FileInPath_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"), SiStripDetCabling_(NULL), printDebug_(false), useEmptyRunInfo_(false) { reader=new SiStripDetInfoFileReader(FileInPath_.fullPath()); }
SiStripQuality::SiStripQuality | ( | edm::FileInPath & | file | ) |
Definition at line 30 of file SiStripQuality.cc.
References FileInPath_, edm::FileInPath::fullPath(), reader, and OfflineSiStripConfigDb_cff::SiStripDetInfoFileReader.
:toCleanUp(false),FileInPath_(file),SiStripDetCabling_(NULL), printDebug_(false), useEmptyRunInfo_(false) { reader=new SiStripDetInfoFileReader(FileInPath_.fullPath()); }
SiStripQuality::SiStripQuality | ( | const SiStripQuality & | other | ) |
Definition at line 35 of file SiStripQuality.cc.
References BadComponentVect, FileInPath_, SiStripBadStrip::indexes, printDebug_, reader, SiStripDetCabling_, OfflineSiStripConfigDb_cff::SiStripDetInfoFileReader, toCleanUp, useEmptyRunInfo_, and SiStripBadStrip::v_badstrips.
{ FileInPath_=other.FileInPath_; reader=new SiStripDetInfoFileReader(*(other.reader)); toCleanUp=other.toCleanUp; indexes=other.indexes; v_badstrips=other.v_badstrips; BadComponentVect=other.BadComponentVect; SiStripDetCabling_=other.SiStripDetCabling_; printDebug_=other.printDebug_; useEmptyRunInfo_=other.useEmptyRunInfo_; }
SiStripQuality::~SiStripQuality | ( | ) | [inline] |
void SiStripQuality::add | ( | const uint32_t & | detid, |
const SiStripBadStrip::Range & | baserange | ||
) |
Definition at line 284 of file SiStripQuality.cc.
References compact(), SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::flag, SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRange(), LogTrace, put_replace(), SiStripBadStrip::data::range, reader, and tmp.
Referenced by add(), addInvalidConnectionFromCabling(), addNotConnectedConnectionFromCabling(), operator+=(), ReduceGranularity(), and turnOffFeds().
{ std::vector<unsigned int> vect, tmp; unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128; //Is this detid already in the collections owned by this class? SiStripBadStrip::Range range = getRange(detid); //Append bad strips tmp.clear(); if (range.first==range.second){ LogTrace("SiStripQuality") << "new detid" << std::endl; //It's a new detid tmp.insert(tmp.end(),baserange.first,baserange.second); std::stable_sort(tmp.begin(),tmp.end()); LogTrace("SiStripQuality") << "ordered" << std::endl; } else { LogTrace("SiStripQuality") << "already exists" << std::endl; //alredy existing detid //if full det is bad go to next detid SiStripBadStrip::data data_=decode(*(range.first)); if(range.second-range.first==1 && data_.firstStrip==0 && data_.range>=Nstrips){ 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; return; } tmp.insert(tmp.end(),baserange.first,baserange.second); tmp.insert(tmp.end(),range.first,range.second); std::stable_sort(tmp.begin(),tmp.end()); LogTrace("SiStripQuality") << "ordered" << std::endl; } //Compact data compact(tmp,vect,Nstrips); SiStripBadStrip::Range newrange(vect.begin(),vect.end()); if ( ! put_replace(detid,newrange) ) edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl; }
void SiStripQuality::add | ( | const SiStripDetCabling * | cab | ) |
Definition at line 201 of file SiStripQuality.cc.
References addInvalidConnectionFromCabling(), addNotConnectedConnectionFromCabling(), and SiStripDetCabling_.
void SiStripQuality::add | ( | const SiStripDetVOff * | Voff | ) |
Definition at line 112 of file SiStripQuality.cc.
References add(), SiStripBadStrip::encode(), SiStripDetVOff::getDetIds(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), LogTrace, and reader.
{ std::vector<unsigned int> vect; short firstStrip=0; short range=0; //Get vector of Voff dets std::vector<uint32_t> vdets; Voff->getDetIds(vdets); std::vector<uint32_t>::const_iterator iter=vdets.begin(); std::vector<uint32_t>::const_iterator iterEnd=vdets.end(); for(;iter!=iterEnd;++iter){ vect.clear(); range = (short) (reader->getNumberOfApvsAndStripLength(*iter).first*128.); LogTrace("SiStripQuality") << "[add Voff] add detid " << *iter << " first strip " << firstStrip << " range " << range << std::endl; vect.push_back(encode(firstStrip,range)); SiStripBadStrip::Range Range(vect.begin(),vect.end()); add(*iter,Range); } }
void SiStripQuality::add | ( | const SiStripBadStrip * | base | ) |
Definition at line 267 of file SiStripQuality.cc.
References add(), cond::rpcobgas::detid, SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), and LogTrace.
{ SiStripBadStrip::RegistryIterator basebegin = base->getRegistryVectorBegin(); SiStripBadStrip::RegistryIterator baseend = base->getRegistryVectorEnd(); //the Registry already contains data //Loop on detids for (SiStripBadStrip::RegistryIterator basep=basebegin; basep != baseend; ++basep) { uint32_t detid=basep->detid; LogTrace("SiStripQuality") << "add detid " <<detid << std::endl; SiStripBadStrip::Range baserange = SiStripBadStrip::Range( base->getDataVectorBegin()+basep->ibegin , base->getDataVectorBegin()+basep->iend ); add(detid,baserange); } }
void SiStripQuality::add | ( | const RunInfo * | runInfo | ) |
Used to get the cabling from RunInfo.
It compares the feds from cabling with those from runInfo and it turns off all the strips associated to feds that are off for the RunInfo but not for FedCabling.
Definition at line 134 of file SiStripQuality.cc.
References CastorDataFrameFilter_impl::check(), SiStripDetCabling::fedCabling(), SiStripFedCabling::feds(), RunInfo::m_fed_in, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, printActiveFedsInfo(), printDebug_, SiStripDetCabling_, python::multivaluedict::sort(), turnOffFeds(), and useEmptyRunInfo_.
{ bool allFedsEmpty = runInfo->m_fed_in.empty(); if( allFedsEmpty ) { std::stringstream ss; ss << "WARNING: the full list of feds in RunInfo is empty. "; if( useEmptyRunInfo_ ) { ss << " SiStripQuality will still use it and all tracker will be off." << std::endl; } else { ss << " SiStripQuality will not use it." << std::endl; } edm::LogInfo("SiStripQuality") << ss.str(); } if( !allFedsEmpty || useEmptyRunInfo_ ) { // Take the list of active feds from fedCabling std::vector<uint16_t> activeFedsFromCabling = SiStripDetCabling_->fedCabling()->feds(); // Take the list of active feds from RunInfo std::vector<int> activeFedsFromRunInfo; // Take only Tracker feds (remove all non Tracker) std::remove_copy_if( runInfo->m_fed_in.begin(), runInfo->m_fed_in.end(), std::back_inserter(activeFedsFromRunInfo), !boost::bind(std::logical_and<bool>(), boost::bind(std::greater_equal<int>(), _1, int(FEDNumbering::MINSiStripFEDID)), boost::bind(std::less_equal<int>(), _1, int(FEDNumbering::MAXSiStripFEDID))) ); // Compare the two. If a fedId from RunInfo is not present in the fedCabling we need to // get all the corresponding fedChannels and then the single apv pairs and use them to // turn off the corresponding strips (apvNumber*256). // set_difference returns the set of elements that are in the first and not in the second std::sort(activeFedsFromCabling.begin(), activeFedsFromCabling.end()); std::sort(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end()); std::vector<int> differentFeds; // Take the feds active for cabling but not for runInfo std::set_difference(activeFedsFromCabling.begin(), activeFedsFromCabling.end(), activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(), std::back_inserter(differentFeds)); printActiveFedsInfo(activeFedsFromCabling, activeFedsFromRunInfo, differentFeds, printDebug_); // Feds in the differentFeds vector are now to be turned off as they are off according to RunInfo // but were not off in cabling and thus are still active for the SiStripQuality. // The "true" means that the strips are to be set as bad. turnOffFeds(differentFeds, true, printDebug_); // Consistency check // ----------------- std::vector<int> check; std::set_difference(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(), activeFedsFromCabling.begin(), activeFedsFromCabling.end(), std::back_inserter(check)); // This must not happen if( !check.empty() ) { // throw cms::Exception("LogicError") edm::LogWarning("SiStripQuality") << "The cabling should always include the active feds in runInfo and possibly have some more" << "there are instead " << check.size() << " feds only active in runInfo"; // The "false" means that we are only printing the output, but not setting the strips as bad. // The second bool means that we always want the debug output in this case. turnOffFeds(check, false, true); } } }
void SiStripQuality::addInvalidConnectionFromCabling | ( | ) |
Definition at line 227 of file SiStripQuality.cc.
References add(), SiStripDetCabling::addActiveDetectorsRawIds(), SiStripBadStrip::encode(), SiStripDetCabling::getConnections(), sistrip::invalid_, LogTrace, SiStripDetCabling::nApvPairs(), and SiStripDetCabling_.
Referenced by add().
{ std::vector<uint32_t> connected_detids; SiStripDetCabling_->addActiveDetectorsRawIds(connected_detids); std::vector<uint32_t>::const_iterator itdet = connected_detids.begin(); std::vector<uint32_t>::const_iterator itdetEnd = connected_detids.end(); for(;itdet!=itdetEnd;++itdet){ //LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] looking at detid " <<*itdet << std::endl; const std::vector<const FedChannelConnection *>& fedconns=SiStripDetCabling_->getConnections(*itdet); std::vector<const FedChannelConnection *>::const_iterator itconns=fedconns.begin(); std::vector<const FedChannelConnection *>::const_iterator itconnsEnd=fedconns.end(); unsigned short nApvPairs=SiStripDetCabling_->nApvPairs(*itdet); short ngoodConn=0, goodConn=0; for(;itconns!=itconnsEnd;++itconns){ //LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] apvpair " << (*itconns)->apvPairNumber() << " napvpair " << (*itconns)->nApvPairs()<< " detid " << (*itconns)->detId() << std::endl; if( (*itconns == 0) || ((*itconns)->nApvPairs()==sistrip::invalid_) ) continue; ngoodConn++; goodConn = goodConn | ( 0x1 << (*itconns)->apvPairNumber() ); } if (ngoodConn!=nApvPairs){ std::vector<unsigned int> vect; for (size_t idx=0;idx<nApvPairs;++idx){ if( !(goodConn & ( 0x1 << idx)) ) { short firstStrip=idx*256; short range=256; LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] add detid " <<*itdet << "firstStrip " << firstStrip<< std::endl; vect.push_back(encode(firstStrip,range)); } } if(!vect.empty()){ SiStripBadStrip::Range Range(vect.begin(),vect.end()); add(*itdet,Range); } } } }
void SiStripQuality::addNotConnectedConnectionFromCabling | ( | ) |
Definition at line 208 of file SiStripQuality.cc.
References add(), SiStripBadStrip::encode(), SiStripDetInfoFileReader::getAllData(), SiStripDetCabling::IsConnected(), LogTrace, reader, and SiStripDetCabling_.
Referenced by add().
{ std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > allData = reader->getAllData(); std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator iter=allData.begin(); std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator iterEnd=allData.end(); std::vector<unsigned int> vect; short firstStrip=0; short range=0; for(;iter!=iterEnd;++iter) if (!SiStripDetCabling_->IsConnected(iter->first)){ vect.clear(); range=iter->second.nApvs*128; LogTrace("SiStripQuality") << "[addNotConnectedConnectionFromCabling] add detid " << iter->first << std::endl; vect.push_back(encode(firstStrip,range)); SiStripBadStrip::Range Range(vect.begin(),vect.end()); add(iter->first,Range); } }
bool SiStripQuality::cleanUp | ( | bool | force = false | ) |
Definition at line 490 of file SiStripQuality.cc.
References SiStripBadStrip::indexes, LogTrace, SiStripBadStrip::put(), toCleanUp, and SiStripBadStrip::v_badstrips.
Referenced by SiStripBadModuleGenerator::createObject(), operator+=(), and operator-=().
{ if (!toCleanUp && !force) return false; toCleanUp=false; std::vector<unsigned int> v_badstrips_tmp=v_badstrips; std::vector<DetRegistry> indexes_tmp=indexes; LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] before cleanUp v_badstrips.size()= " << v_badstrips.size() << " indexes.size()=" << indexes.size() << std::endl; v_badstrips.clear(); indexes.clear(); SiStripBadStrip::RegistryIterator basebegin = indexes_tmp.begin(); SiStripBadStrip::RegistryIterator baseend = indexes_tmp.end(); for (SiStripBadStrip::RegistryIterator basep=basebegin; basep != baseend; ++basep) { if(basep->ibegin!=basep->iend){ SiStripBadStrip::Range range( v_badstrips_tmp.begin()+basep->ibegin, v_badstrips_tmp.begin()+basep->iend ); if ( ! put(basep->detid,range) ) edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl; } } LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] after cleanUp v_badstrips.size()= " << v_badstrips.size() << " indexes.size()=" << indexes.size() << std::endl; return true; }
void SiStripQuality::clear | ( | void | ) | [inline] |
Definition at line 58 of file SiStripQuality.h.
References BadComponentVect, SiStripBadStrip::indexes, toCleanUp, and SiStripBadStrip::v_badstrips.
Referenced by SiStripBadAPVAlgorithmFromClusterOccupancy::extractBadAPVs(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVSandStrips(), and SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips().
{ v_badstrips.clear(); indexes.clear(); BadComponentVect.clear(); toCleanUp=false; }
void SiStripQuality::compact | ( | std::vector< unsigned int > & | tmp, |
std::vector< unsigned int > & | vect, | ||
unsigned short & | Nstrips | ||
) | [private] |
Definition at line 410 of file SiStripQuality.cc.
References SiStripBadStrip::decode(), SiStripBadStrip::encode(), SiStripBadStrip::data::firstStrip, and SiStripBadStrip::data::range.
{ SiStripBadStrip::data fs_0, fs_1; vect.clear(); ContainerIterator it=tmp.begin(); fs_0=decode(*it); //Check if at the module end if (fs_0.firstStrip+fs_0.range>=Nstrips){ vect.push_back(encode(fs_0.firstStrip,Nstrips-fs_0.firstStrip)); return; } ++it; for(;it!=tmp.end();++it){ fs_1=decode(*it); if (fs_0.firstStrip+fs_0.range>=fs_1.firstStrip+fs_1.range){ //fs_0 includes fs_1, go ahead } else if (fs_0.firstStrip+fs_0.range>=fs_1.firstStrip){ // contiguous or superimposed intervals //Check if at the module end if (fs_1.firstStrip+fs_1.range>=Nstrips){ vect.push_back(encode(fs_0.firstStrip,Nstrips-fs_0.firstStrip)); return; }else{ //create new fs_0 fs_0.range=fs_1.firstStrip+fs_1.range-fs_0.firstStrip; } } else{ //separated intervals vect.push_back(encode(fs_0.firstStrip,fs_0.range)); fs_0=fs_1; } } vect.push_back(encode(fs_0.firstStrip,fs_0.range)); }
void SiStripQuality::compact | ( | unsigned int & | detid, |
std::vector< unsigned int > & | vect | ||
) |
Definition at line 326 of file SiStripQuality.cc.
References SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), reader, and tmp.
Referenced by add(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::AnalyzeOccupancy(), SiStripBadAPVAlgorithmFromClusterOccupancy::AnalyzeOccupancy(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), SiStripHitEffFromCalibTree::makeSQLite(), and SiStripCondObjBuilderFromDb::storeQuality().
{ std::vector<unsigned int> tmp=vect; vect.clear(); std::stable_sort(tmp.begin(),tmp.end()); unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128; compact(tmp,vect,Nstrips); }
void SiStripQuality::fillBadComponents | ( | ) |
Definition at line 520 of file SiStripQuality.cc.
References SiStripQuality::BadComponent::BadApvs, BadComponentVect, SiStripQuality::BadComponent::BadFibers, SiStripQuality::BadComponent::BadModule, SiStripBadStrip::decode(), SiStripQuality::BadComponent::detid, SiStripBadStrip::data::firstStrip, SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), SiStripBadStrip::indexes, SiStripBadStrip::data::range, reader, query::result, and SiStripBadStrip::v_badstrips.
Referenced by SiStripBadAPVAlgorithmFromClusterOccupancy::extractBadAPVs(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVSandStrips(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), SiStripHitEffFromCalibTree::makeSQLite(), operator+=(), and operator-=().
{ BadComponentVect.clear(); for (SiStripBadStrip::RegistryIterator basep=indexes.begin(); basep != indexes.end(); ++basep) { SiStripBadStrip::Range range( v_badstrips.begin()+basep->ibegin, v_badstrips.begin()+basep->iend ); //Fill BadModules, BadFibers, BadApvs vectors unsigned short resultA=0, resultF=0; BadComponent result; SiStripBadStrip::data fs; unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(basep->detid).first*128; //BadModules fs=decode(*(range.first)); if (basep->iend - basep->ibegin == 1 && fs.firstStrip==0 && fs.range==Nstrips ){ result.detid=basep->detid; result.BadModule=true; result.BadFibers=(1<< (Nstrips/256))-1; result.BadApvs=(1<< (Nstrips/128))-1; BadComponentVect.push_back(result); } else { //Bad Fibers and Apvs for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){ fs=decode(*it); //BadApvs for(short apvNb=0;apvNb<6;++apvNb){ if ( fs.firstStrip<=apvNb*128 && (apvNb+1)*128<=fs.firstStrip+fs.range ){ resultA=resultA | (1<<apvNb); } } //BadFibers for(short fiberNb=0;fiberNb<3;++fiberNb){ if ( fs.firstStrip<=fiberNb*256 && (fiberNb+1)*256<=fs.firstStrip+fs.range ){ resultF=resultF | (1<<fiberNb); } } } if (resultA!=0){ result.detid=basep->detid; result.BadModule=false; result.BadFibers=resultF; result.BadApvs=resultA; BadComponentVect.push_back(result); } } } }
short SiStripQuality::getBadApvs | ( | const uint32_t & | detid | ) | const |
Definition at line 665 of file SiStripQuality.cc.
References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.
Referenced by StMeasurementDetSet::initializeStripStatus().
{ std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering()); if (p!=BadComponentVect.end() && p->detid==detid) return p->BadApvs; return 0; }
const std::vector<BadComponent>& SiStripQuality::getBadComponentList | ( | ) | const [inline] |
Definition at line 121 of file SiStripQuality.h.
References BadComponentVect.
Referenced by SiStripHitEffFromCalibTree::algoAnalyze(), and SiStripBadModuleGenerator::createObject().
{ return BadComponentVect; }
short SiStripQuality::getBadFibers | ( | const uint32_t & | detid | ) | const |
Definition at line 673 of file SiStripQuality.cc.
References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.
Referenced by StMeasurementDetSet::initializeStripStatus().
{ std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering()); if (p!=BadComponentVect.end() && p->detid==detid) return p->BadFibers; return 0; }
edm::FileInPath SiStripQuality::getFileInPath | ( | ) | const [inline] |
bool SiStripQuality::IsApvBad | ( | const uint32_t & | detid, |
const short & | apvNb | ||
) | const |
Definition at line 609 of file SiStripQuality.cc.
References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.
{ std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering()); if (p!=BadComponentVect.end() && p->detid==detid) return ((p->BadApvs>>apvNb)&0x1); return false; }
bool SiStripQuality::IsFiberBad | ( | const uint32_t & | detid, |
const short & | fiberNb | ||
) | const |
Definition at line 601 of file SiStripQuality.cc.
References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.
{ std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering()); if (p!=BadComponentVect.end() && p->detid==detid) return ((p->BadFibers>>fiberNb)&0x1); return false; }
bool SiStripQuality::IsModuleBad | ( | const uint32_t & | detid | ) | const |
Definition at line 593 of file SiStripQuality.cc.
References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.
{ std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering()); if (p!=BadComponentVect.end() && p->detid==detid) return p->BadModule; return false; }
bool SiStripQuality::IsModuleUsable | ( | const uint32_t & | detid | ) | const |
Definition at line 579 of file SiStripQuality.cc.
References BadComponentVect, cond::rpcobgas::detid, SiStripDetCabling::IsConnected(), NULL, AlCaHLTBitMon_ParallelJobs::p, and SiStripDetCabling_.
Referenced by StMeasurementDetSet::initializeStripStatus().
{ std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering()); if (p!=BadComponentVect.end() && p->detid==detid) if(p->BadModule) return false; if (SiStripDetCabling_!=NULL) if(!SiStripDetCabling_->IsConnected(detid)) return false; return true; }
bool SiStripQuality::IsStripBad | ( | const Range & | range, |
const short & | strip | ||
) | const |
Definition at line 623 of file SiStripQuality.cc.
References SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, and query::result.
{ bool result=false; SiStripBadStrip::data fs; for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){ fs=decode(*it); if ( fs.firstStrip<=strip && strip<fs.firstStrip+fs.range ){ result=true; break; } } return result; }
bool SiStripQuality::IsStripBad | ( | const uint32_t & | detid, |
const short & | strip | ||
) | const |
Definition at line 617 of file SiStripQuality.cc.
References SiStripBadStrip::getRange().
Referenced by jptJetAnalysis::StripSignalOverNoiseCalculator::signalOverNoise().
{ SiStripBadStrip::Range range=getRange(detid); return IsStripBad(range,strip); }
int SiStripQuality::nBadStripsOnTheLeft | ( | const Range & | range, |
const short & | strip | ||
) | const |
Definition at line 637 of file SiStripQuality.cc.
References SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, and query::result.
{ int result=0; SiStripBadStrip::data fs; for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){ fs=decode(*it); if ( fs.firstStrip<=strip && strip<fs.firstStrip+fs.range ){ result=strip-fs.firstStrip+1; break; } } return result; }
int SiStripQuality::nBadStripsOnTheRight | ( | const Range & | range, |
const short & | strip | ||
) | const |
Definition at line 651 of file SiStripQuality.cc.
References SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, query::result, and strip().
{ int result=0; SiStripBadStrip::data fs; for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){ fs=decode(*it); if ( fs.firstStrip<=strip && strip<fs.firstStrip+fs.range ){ result=fs.firstStrip+fs.range-strip; break; } } return result; }
bool SiStripQuality::operator!= | ( | const SiStripQuality & | other | ) | const |
Definition at line 110 of file SiStripQuality.cc.
{ return !(*this == other) ; }
SiStripQuality & SiStripQuality::operator+= | ( | const SiStripQuality & | other | ) |
Definition at line 49 of file SiStripQuality.cc.
References add(), cleanUp(), and fillBadComponents().
{ this->add(&other); this->cleanUp(); this->fillBadComponents(); return *this; }
const SiStripQuality SiStripQuality::operator- | ( | const SiStripQuality & | other | ) | const |
Definition at line 99 of file SiStripQuality.cc.
References SiStripQuality().
{ return SiStripQuality(*this) -= other; }
SiStripQuality & SiStripQuality::operator-= | ( | const SiStripQuality & | other | ) |
Definition at line 57 of file SiStripQuality.cc.
References cleanUp(), SiStripBadStrip::decode(), cond::rpcobgas::detid, fillBadComponents(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::getDataVectorBegin(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRange(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), put_replace(), SiStripBadStrip::data::range, reader, and subtract().
{ SiStripBadStrip::RegistryIterator rbegin = other.getRegistryVectorBegin(); SiStripBadStrip::RegistryIterator rend = other.getRegistryVectorEnd(); std::vector<unsigned int> ovect,vect; uint32_t detid; unsigned short Nstrips; for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) { detid=rp->detid; Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128; SiStripBadStrip::Range orange = SiStripBadStrip::Range( other.getDataVectorBegin()+rp->ibegin , other.getDataVectorBegin()+rp->iend ); //Is this detid already in the collections owned by this class? SiStripBadStrip::Range range = getRange(detid); if (range.first!=range.second){ //yes, it is vect.clear(); ovect.clear(); //if other full det is bad, remove det from this SiStripBadStrip::data data_=decode(*(orange.first)); if(orange.second-orange.first!=1 || data_.firstStrip!=0 || data_.range<Nstrips){ ovect.insert(ovect.end(),orange.first,orange.second); vect.insert(vect.end(),range.first,range.second); subtract(vect,ovect); } SiStripBadStrip::Range newrange(vect.begin(),vect.end()); if ( ! put_replace(detid,newrange) ) edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl; } } cleanUp(); fillBadComponents(); return *this; }
bool SiStripQuality::operator== | ( | const SiStripQuality & | other | ) | const |
Definition at line 104 of file SiStripQuality.cc.
References a, SiStripBadStrip::getRegistryVectorBegin(), and SiStripBadStrip::getRegistryVectorEnd().
{ SiStripQuality a = (*this) - other ; return a.getRegistryVectorBegin()==a.getRegistryVectorEnd(); }
void SiStripQuality::printActiveFedsInfo | ( | const std::vector< uint16_t > & | activeFedsFromCabling, |
const std::vector< int > & | activeFedsFromRunInfo, | ||
const std::vector< int > & | differentFeds, | ||
const bool | printDebug | ||
) | [private] |
Prints debug output for the active feds comparing the list in RunInfo and FedCabling.
Definition at line 726 of file SiStripQuality.cc.
References filterCSVwithJSON::copy.
Referenced by add().
{ std::ostringstream ss; if( printDebug ) { ss << "activeFedsFromCabling:" << std::endl; std::copy(activeFedsFromCabling.begin(), activeFedsFromCabling.end(), std::ostream_iterator<uint16_t>(ss, " ")); ss << std::endl; ss << "activeFedsFromRunInfo:" << std::endl; std::copy(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(), std::ostream_iterator<int>(ss, " ")); ss << std::endl; } if( differentFeds.size() != 440 ) { ss << "differentFeds : " << std::endl; std::copy(differentFeds.begin(), differentFeds.end(), std::ostream_iterator<int>(ss, " ")); ss << std::endl; } else { ss << "There are 440 feds (all) active for Cabling but off for RunInfo. Tracker was probably not in this run" << std::endl; } edm::LogInfo("SiStripQuality") << ss.str() << std::endl; }
void SiStripQuality::printDetInfo | ( | const uint32_t & | detId, |
const uint32_t & | apvPairNumber, | ||
std::stringstream & | ss | ||
) | [private] |
Prints debug output for a given detId.
Definition at line 681 of file SiStripQuality.cc.
References cond::rpcobgas::detid, TIBDetId::layer(), TOBDetId::layer(), DetId::rawId(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, and TECDetId::wheel().
Referenced by turnOffFeds().
{ int layer = 0; int stereo = 0; std::string subDetName; DetId detid(detId); switch (detid.subdetId()) { case StripSubdetector::TIB: { TIBDetId theTIBDetId(detid.rawId()); layer = theTIBDetId.layer(); stereo = theTIBDetId.stereo(); subDetName = "TIB"; break; } case StripSubdetector::TOB: { TOBDetId theTOBDetId(detid.rawId()); layer = theTOBDetId.layer(); stereo = theTOBDetId.stereo(); subDetName = "TOB"; break; } case StripSubdetector::TEC: { TECDetId theTECDetId(detid.rawId()); // is this module in TEC+ or TEC-? layer = theTECDetId.wheel(); stereo = theTECDetId.stereo(); subDetName = "TEC"; break; } case StripSubdetector::TID: { TECDetId theTIDDetId(detid.rawId()); // is this module in TID+ or TID-? layer = theTIDDetId.wheel(); stereo = theTIDDetId.stereo(); subDetName = "TID"; break; } } ss << detId << " and apv = " << apvPairNumber << " of subDet = " << subDetName << ", layer = " << layer << " stereo = " << stereo << std::endl; }
bool SiStripQuality::put_replace | ( | const uint32_t & | DetId, |
Range | input | ||
) | [private] |
Definition at line 335 of file SiStripQuality.cc.
References SiStripBadStrip::DetRegistry::detid, SiStripBadStrip::DetRegistry::ibegin, SiStripBadStrip::DetRegistry::iend, SiStripBadStrip::indexes, LogTrace, AlCaHLTBitMon_ParallelJobs::p, sd, toCleanUp, and SiStripBadStrip::v_badstrips.
Referenced by add(), and operator-=().
{ // put in SiStripQuality::v_badstrips of DetId Registry::iterator p = std::lower_bound(indexes.begin(),indexes.end(),DetId,SiStripBadStrip::StrictWeakOrdering()); size_t sd= input.second-input.first; DetRegistry detregistry; detregistry.detid=DetId; detregistry.ibegin=v_badstrips.size(); detregistry.iend=v_badstrips.size()+sd; v_badstrips.insert(v_badstrips.end(),input.first,input.second); if (p!=indexes.end() && p->detid==DetId){ LogTrace("SiStripQuality") << "[SiStripQuality::put_replace] Replacing SiStripQuality for already stored DetID " << DetId << std::endl; toCleanUp=true; *p=detregistry; } else { indexes.insert(p,detregistry); } return true; }
void SiStripQuality::ReduceGranularity | ( | double | threshold | ) |
Definition at line 365 of file SiStripQuality.cc.
References add(), SiStripBadStrip::decode(), cond::rpcobgas::detid, SiStripBadStrip::encode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), i, LogTrace, max(), min, and SiStripBadStrip::data::range.
{ SiStripBadStrip::RegistryIterator rp = getRegistryVectorBegin(); SiStripBadStrip::RegistryIterator rend = getRegistryVectorEnd(); SiStripBadStrip::data data_; uint16_t BadStripPerApv[6], ipos; std::vector<unsigned int> vect; for (; rp != rend; ++rp) { uint32_t detid=rp->detid; BadStripPerApv[0]=0; BadStripPerApv[1]=0; BadStripPerApv[2]=0; BadStripPerApv[3]=0; BadStripPerApv[4]=0; BadStripPerApv[5]=0; ipos=0; SiStripBadStrip::Range sqrange = SiStripBadStrip::Range( getDataVectorBegin()+rp->ibegin , getDataVectorBegin()+rp->iend ); for(int it=0;it<sqrange.second-sqrange.first;it++){ data_=decode( *(sqrange.first+it) ); LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] detid " << detid << " first strip " << data_.firstStrip << " lastStrip " << data_.firstStrip+data_.range-1 << " range " << data_.range; ipos= data_.firstStrip/128; while (ipos<=(data_.firstStrip+data_.range-1)/128){ BadStripPerApv[ipos]+=std::min(data_.firstStrip+data_.range,(ipos+1)*128)-std::max(data_.firstStrip*1,ipos*128); 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); ipos++; } } LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] Total for detid " << detid << " values " << BadStripPerApv[0] << " " << BadStripPerApv[1] << " " << BadStripPerApv[2] << " " <<BadStripPerApv[3] << " " <<BadStripPerApv[4] << " " << BadStripPerApv[5]; vect.clear(); for(size_t i=0;i<6;++i){ if (BadStripPerApv[i]>=threshold*128){ vect.push_back(encode(i*128,128)); } } if(!vect.empty()){ SiStripBadStrip::Range Range(vect.begin(),vect.end()); add(detid,Range); } } }
void SiStripQuality::setPrintDebugOutput | ( | const bool | printDebug | ) | [inline] |
Definition at line 125 of file SiStripQuality.h.
References SiStripBadStrip::printDebug(), and printDebug_.
{ printDebug_ = printDebug; }
void SiStripQuality::setUseEmptyRunInfo | ( | const bool | useEmptyRunInfo | ) | [inline] |
Definition at line 126 of file SiStripQuality.h.
References useEmptyRunInfo_.
{ useEmptyRunInfo_ = useEmptyRunInfo; }
void SiStripQuality::subtract | ( | std::vector< unsigned int > & | A, |
const std::vector< unsigned int > & | B | ||
) | [private] |
Definition at line 449 of file SiStripQuality.cc.
References subtraction().
Referenced by operator-=().
{ ContainerIterator it=B.begin(); ContainerIterator itend=B.end(); for(;it!=itend;++it){ subtraction(A,*it); } }
void SiStripQuality::subtraction | ( | std::vector< unsigned int > & | A, |
const unsigned int & | B | ||
) | [private] |
Definition at line 458 of file SiStripQuality.cc.
References SiStripBadStrip::decode(), SiStripBadStrip::encode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, and tmp.
Referenced by subtract().
{ SiStripBadStrip::data fs_A, fs_B, fs_m, fs_M; std::vector<unsigned int> tmp; fs_B=decode(B); ContainerIterator jt=A.begin(); ContainerIterator jtend=A.end(); for(;jt!=jtend;++jt){ fs_A=decode(*jt); if (B<*jt){ fs_m=fs_B; fs_M=fs_A; }else{ fs_m=fs_A; fs_M=fs_B; } //A) Verify the range to be subtracted crosses the new range if (fs_m.firstStrip+fs_m.range>fs_M.firstStrip){ if (*jt<B){ tmp.push_back(encode(fs_A.firstStrip,fs_B.firstStrip-fs_A.firstStrip)); } if (fs_A.firstStrip+fs_A.range>fs_B.firstStrip+fs_B.range){ tmp.push_back(encode(fs_B.firstStrip+fs_B.range,fs_A.firstStrip+fs_A.range-(fs_B.firstStrip+fs_B.range))); } }else{ tmp.push_back(*jt); } } A=tmp; }
void SiStripQuality::turnOffFeds | ( | const std::vector< int > & | fedsList, |
const bool | turnOffStrips, | ||
const bool | printDebug | ||
) | [private] |
Loop on all the fedIds, take the fedChannels and then the detId. Depending on the value of a bool turn off or not the strips in the list.
Definition at line 752 of file SiStripQuality.cc.
References add(), SiStripFedCabling::connections(), SiStripBadStrip::encode(), SiStripDetCabling::fedCabling(), LogTrace, printDetInfo(), and SiStripDetCabling_.
Referenced by add().
{ std::stringstream ss; if( printDebug ) { ss << "associated to detIds : " << std::endl; } std::vector<int>::const_iterator fedIdIt = fedsList.begin(); for( ; fedIdIt != fedsList.end(); ++fedIdIt ) { std::vector<FedChannelConnection>::const_iterator fedChIt = SiStripDetCabling_->fedCabling()->connections( *fedIdIt ).begin(); for( ; fedChIt != SiStripDetCabling_->fedCabling()->connections( *fedIdIt ).end(); ++fedChIt ) { uint32_t detId = fedChIt->detId(); if (detId == 0 || detId == 0xFFFFFFFF) continue; uint16_t apvPairNumber = fedChIt->apvPairNumber(); if( printDebug ) { printDetInfo(detId, apvPairNumber, ss); } if( turnOffStrips ) { // apvPairNumber == i it means that the i*256 strips are to be set off std::vector<unsigned int> vect; vect.push_back(encode(apvPairNumber*256,256)); SiStripBadStrip::Range Range(vect.begin(), vect.end()); add(detId,Range); LogTrace("SiStripQuality") << "[addOffForRunInfo] adding apvPairNumber "<<apvPairNumber<<" for detId "<<detId<<" off according to RunInfo" << std::endl; } } } if( printDebug ) { edm::LogInfo("SiStripQuality") << ss.str() << std::endl; } }
std::vector<BadComponent> SiStripQuality::BadComponentVect [private] |
Definition at line 153 of file SiStripQuality.h.
Referenced by clear(), fillBadComponents(), getBadApvs(), getBadComponentList(), getBadFibers(), IsApvBad(), IsFiberBad(), IsModuleBad(), IsModuleUsable(), and SiStripQuality().
edm::FileInPath SiStripQuality::FileInPath_ [private] |
Definition at line 150 of file SiStripQuality.h.
Referenced by getFileInPath(), and SiStripQuality().
bool SiStripQuality::printDebug_ [private] |
Definition at line 156 of file SiStripQuality.h.
Referenced by add(), setPrintDebugOutput(), and SiStripQuality().
SiStripDetInfoFileReader* SiStripQuality::reader [private] |
Definition at line 151 of file SiStripQuality.h.
Referenced by add(), addNotConnectedConnectionFromCabling(), compact(), fillBadComponents(), operator-=(), SiStripQuality(), and ~SiStripQuality().
const SiStripDetCabling* SiStripQuality::SiStripDetCabling_ [private] |
Definition at line 155 of file SiStripQuality.h.
Referenced by add(), addInvalidConnectionFromCabling(), addNotConnectedConnectionFromCabling(), IsModuleUsable(), SiStripQuality(), and turnOffFeds().
bool SiStripQuality::toCleanUp [private] |
Definition at line 149 of file SiStripQuality.h.
Referenced by cleanUp(), clear(), put_replace(), and SiStripQuality().
bool SiStripQuality::useEmptyRunInfo_ [private] |
Definition at line 157 of file SiStripQuality.h.
Referenced by add(), setUseEmptyRunInfo(), and SiStripQuality().