CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
SiStripQuality Class Reference

#include <SiStripQuality.cc>

Inheritance diagram for SiStripQuality:
SiStripBadStrip

Classes

struct  BadComponent
 
class  BadComponentStrictWeakOrdering
 

Public Member Functions

void add (const uint32_t &, const SiStripBadStrip::Range &)
 
void add (const SiStripBadStrip *)
 
void add (const SiStripDetCabling *)
 
void add (const SiStripDetVOff *)
 
void add (const RunInfo *)
 
void addInvalidConnectionFromCabling ()
 
void addNotConnectedConnectionFromCabling ()
 
SiStripDetCabling const * cabling () const
 
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 uint32_t &detid, const short &strip) const
 
bool IsStripBad (const Range &range, 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
 
SiStripQualityoperator+= (const SiStripQuality &)
 
const SiStripQuality operator- (const SiStripQuality &) const
 
SiStripQualityoperator-= (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 ()
 
- Public Member Functions inherited from SiStripBadStrip
data decode (const unsigned int &value) const
 
unsigned int encode (const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
 
ContainerIterator getDataVectorBegin () const
 
ContainerIterator getDataVectorEnd () const
 
void getDetIds (std::vector< uint32_t > &DetIds_) const
 
const Range getRange (const uint32_t detID) const
 
Range getRangeByPos (unsigned short pos) const
 
RegistryIterator getRegistryVectorBegin () const
 
RegistryIterator getRegistryVectorEnd () const
 
void printDebug (std::stringstream &ss) const
 
void printSummary (std::stringstream &ss) const
 
bool put (const uint32_t &detID, const InputVector &vect)
 
bool put (const uint32_t &detID, Range input)
 
 SiStripBadStrip ()
 
 SiStripBadStrip (const SiStripBadStrip &orig)
 
virtual ~SiStripBadStrip ()
 

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. More...
 
void printDetInfo (const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
 Prints debug output for a given detId. More...
 
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< BadComponentBadComponentVect
 
edm::FileInPath FileInPath_
 
bool printDebug_
 
SiStripDetInfoFileReaderreader
 
const SiStripDetCablingSiStripDetCabling_
 
bool toCleanUp
 
bool useEmptyRunInfo_
 

Additional Inherited Members

- Public Types inherited from SiStripBadStrip
typedef std::vector< unsigned int > Container
 
typedef std::vector< unsigned
int >::const_iterator 
ContainerIterator
 
typedef Container InputVector
 
typedef std::pair
< ContainerIterator,
ContainerIterator
Range
 
typedef std::vector< DetRegistryRegistry
 
typedef Registry::const_iterator RegistryIterator
 
- Protected Attributes inherited from SiStripBadStrip
Registry indexes
 
Container v_badstrips
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 34 of file SiStripQuality.h.

Constructor & Destructor Documentation

SiStripQuality::SiStripQuality ( )

Definition at line 23 of file SiStripQuality.cc.

References FileInPath_, edm::FileInPath::fullPath(), reader, and OfflineSiStripConfigDb_cff::SiStripDetInfoFileReader.

Referenced by operator-().

23  :
24  toCleanUp(false),
25  FileInPath_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"),
27  printDebug_(false),
28  useEmptyRunInfo_(false)
29 {
31 }
#define NULL
Definition: scimark2.h:8
const SiStripDetCabling * SiStripDetCabling_
SiStripDetInfoFileReader * reader
edm::FileInPath FileInPath_
std::string fullPath() const
Definition: FileInPath.cc:165
SiStripQuality::SiStripQuality ( edm::FileInPath file)

Definition at line 33 of file SiStripQuality.cc.

References FileInPath_, edm::FileInPath::fullPath(), reader, and OfflineSiStripConfigDb_cff::SiStripDetInfoFileReader.

34 {
36 }
#define NULL
Definition: scimark2.h:8
const SiStripDetCabling * SiStripDetCabling_
SiStripDetInfoFileReader * reader
edm::FileInPath FileInPath_
std::string fullPath() const
Definition: FileInPath.cc:165
SiStripQuality::SiStripQuality ( const SiStripQuality other)

Definition at line 38 of file SiStripQuality.cc.

References BadComponentVect, FileInPath_, SiStripBadStrip::indexes, printDebug_, reader, SiStripDetCabling_, OfflineSiStripConfigDb_cff::SiStripDetInfoFileReader, toCleanUp, useEmptyRunInfo_, and SiStripBadStrip::v_badstrips.

39 {
42  toCleanUp=other.toCleanUp;
43  indexes=other.indexes;
49 }
std::vector< BadComponent > BadComponentVect
const SiStripDetCabling * SiStripDetCabling_
Container v_badstrips
SiStripDetInfoFileReader * reader
edm::FileInPath FileInPath_
SiStripQuality::~SiStripQuality ( )

Definition at line 51 of file SiStripQuality.cc.

References LogTrace, and reader.

51  {
52  LogTrace("SiStripQuality") << "SiStripQuality destructor" << std::endl;
53  delete reader;
54 }
#define LogTrace(id)
SiStripDetInfoFileReader * reader

Member Function Documentation

void SiStripQuality::add ( const uint32_t &  detid,
const SiStripBadStrip::Range baserange 
)

Definition at line 294 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().

295 {
296  std::vector<unsigned int> vect, tmp;
297 
298  unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128;
299 
300  //Is this detid already in the collections owned by this class?
302 
303  //Append bad strips
304  tmp.clear();
305  if (range.first==range.second){
306  LogTrace("SiStripQuality") << "new detid" << std::endl;
307  //It's a new detid
308  tmp.insert(tmp.end(),baserange.first,baserange.second);
309  std::stable_sort(tmp.begin(),tmp.end());
310  LogTrace("SiStripQuality") << "ordered" << std::endl;
311  } else {
312  LogTrace("SiStripQuality") << "already exists" << std::endl;
313  //alredy existing detid
314 
315  //if full det is bad go to next detid
316  SiStripBadStrip::data data_=decode(*(range.first));
317  if(range.second-range.first==1
318  && data_.firstStrip==0
319  && data_.range>=Nstrips){
320  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;
321  return;
322  }
323 
324  tmp.insert(tmp.end(),baserange.first,baserange.second);
325  tmp.insert(tmp.end(),range.first,range.second);
326  std::stable_sort(tmp.begin(),tmp.end());
327  LogTrace("SiStripQuality") << "ordered" << std::endl;
328  }
329  //Compact data
330  compact(tmp,vect,Nstrips);
331  SiStripBadStrip::Range newrange(vect.begin(),vect.end());
332  if ( ! put_replace(detid,newrange) )
333  edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl;
334 }
unsigned short range
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void compact(unsigned int &, std::vector< unsigned int > &)
#define LogTrace(id)
bool put_replace(const uint32_t &DetId, Range input)
unsigned short firstStrip
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
SiStripDetInfoFileReader * reader
data decode(const unsigned int &value) const
void SiStripQuality::add ( const SiStripBadStrip base)

Definition at line 277 of file SiStripQuality.cc.

References add(), cond::rpcobgas::detid, SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), and LogTrace.

278 {
281 
282  //the Registry already contains data
283  //Loop on detids
284  for (SiStripBadStrip::RegistryIterator basep=basebegin; basep != baseend; ++basep) {
285  uint32_t detid=basep->detid;
286  LogTrace("SiStripQuality") << "add detid " <<detid << std::endl;
287 
288  SiStripBadStrip::Range baserange = SiStripBadStrip::Range( base->getDataVectorBegin()+basep->ibegin , base->getDataVectorBegin()+basep->iend );
289 
290  add(detid,baserange);
291  }
292 }
void add(const uint32_t &, const SiStripBadStrip::Range &)
Registry::const_iterator RegistryIterator
RegistryIterator getRegistryVectorEnd() const
#define LogTrace(id)
ContainerIterator getDataVectorBegin() const
RegistryIterator getRegistryVectorBegin() const
std::pair< ContainerIterator, ContainerIterator > Range
void SiStripQuality::add ( const SiStripDetCabling cab)

Definition at line 211 of file SiStripQuality.cc.

References addInvalidConnectionFromCabling(), addNotConnectedConnectionFromCabling(), and SiStripDetCabling_.

212 {
213  SiStripDetCabling_=cab;
216 }
void addInvalidConnectionFromCabling()
const SiStripDetCabling * SiStripDetCabling_
void addNotConnectedConnectionFromCabling()
void SiStripQuality::add ( const SiStripDetVOff Voff)

Definition at line 120 of file SiStripQuality.cc.

References add(), SiStripBadStrip::encode(), SiStripDetVOff::getDetIds(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), getDQMSummary::iter, LogTrace, and reader.

121 {
122  std::vector<unsigned int> vect;
123  short firstStrip=0;
124  short range=0;
125 
126  //Get vector of Voff dets
127  std::vector<uint32_t> vdets;
128  Voff->getDetIds(vdets);
129  std::vector<uint32_t>::const_iterator iter=vdets.begin();
130  std::vector<uint32_t>::const_iterator iterEnd=vdets.end();
131 
132  for(;iter!=iterEnd;++iter){
133  vect.clear();
134  range = (short) (reader->getNumberOfApvsAndStripLength(*iter).first*128.);
135  LogTrace("SiStripQuality") << "[add Voff] add detid " << *iter << " first strip " << firstStrip << " range " << range << std::endl;
136  vect.push_back(encode(firstStrip,range));
137  SiStripBadStrip::Range Range(vect.begin(),vect.end());
138  add(*iter,Range);
139  }
140 }
void add(const uint32_t &, const SiStripBadStrip::Range &)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void getDetIds(std::vector< uint32_t > &DetIds_) const
#define LogTrace(id)
std::pair< ContainerIterator, ContainerIterator > Range
SiStripDetInfoFileReader * reader
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
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 142 of file SiStripQuality.cc.

References CastorDataFrameFilter_impl::check(), SiStripDetCabling::fedCabling(), SiStripFedCabling::fedIds(), RunInfo::m_fed_in, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, printDebug_, SiStripDetCabling_, python.multivaluedict::sort(), contentValuesCheck::ss, turnOffFeds(), and useEmptyRunInfo_.

143 {
144  bool allFedsEmpty = runInfo->m_fed_in.empty();
145  if( allFedsEmpty ) {
146  std::stringstream ss;
147  ss << "WARNING: the full list of feds in RunInfo is empty. ";
148  if( useEmptyRunInfo_ ) {
149  ss << " SiStripQuality will still use it and all tracker will be off." << std::endl;
150  }
151  else {
152  ss << " SiStripQuality will not use it." << std::endl;
153  }
154  edm::LogInfo("SiStripQuality") << ss.str();
155  }
156 
157  if( !allFedsEmpty || useEmptyRunInfo_ ) {
158  // Take the list of active feds from fedCabling
159  auto ids = SiStripDetCabling_->fedCabling()->fedIds();
160 
161  std::vector<uint16_t> activeFedsFromCabling(ids.begin(), ids.end());
162  // Take the list of active feds from RunInfo
163  std::vector<int> activeFedsFromRunInfo;
164  // Take only Tracker feds (remove all non Tracker)
165  std::remove_copy_if( runInfo->m_fed_in.begin(),
166  runInfo->m_fed_in.end(),
167  std::back_inserter(activeFedsFromRunInfo),
168  !boost::bind(std::logical_and<bool>(),
169  boost::bind(std::greater_equal<int>(), _1, int(FEDNumbering::MINSiStripFEDID)),
170  boost::bind(std::less_equal<int>(), _1, int(FEDNumbering::MAXSiStripFEDID))) );
171 
172  // Compare the two. If a fedId from RunInfo is not present in the fedCabling we need to
173  // get all the corresponding fedChannels and then the single apv pairs and use them to
174  // turn off the corresponding strips (apvNumber*256).
175  // set_difference returns the set of elements that are in the first and not in the second
176  std::sort(activeFedsFromCabling.begin(), activeFedsFromCabling.end());
177  std::sort(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end());
178  std::vector<int> differentFeds;
179  // Take the feds active for cabling but not for runInfo
180  std::set_difference(activeFedsFromCabling.begin(), activeFedsFromCabling.end(),
181  activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(),
182  std::back_inserter(differentFeds));
183 
184  // IGNORE for time being.
185  //printActiveFedsInfo(activeFedsFromCabling, activeFedsFromRunInfo, differentFeds, printDebug_);
186 
187  // Feds in the differentFeds vector are now to be turned off as they are off according to RunInfo
188  // but were not off in cabling and thus are still active for the SiStripQuality.
189  // The "true" means that the strips are to be set as bad.
190  turnOffFeds(differentFeds, true, printDebug_);
191 
192  // Consistency check
193  // -----------------
194  std::vector<int> check;
195  std::set_difference(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(),
196  activeFedsFromCabling.begin(), activeFedsFromCabling.end(),
197  std::back_inserter(check));
198  // This must not happen
199  if( !check.empty() ) {
200  // throw cms::Exception("LogicError")
201  edm::LogWarning("SiStripQuality")
202  << "The cabling should always include the active feds in runInfo and possibly have some more"
203  << "there are instead " << check.size() << " feds only active in runInfo";
204  // The "false" means that we are only printing the output, but not setting the strips as bad.
205  // The second bool means that we always want the debug output in this case.
206  turnOffFeds(check, false, true);
207  }
208  }
209 }
std::vector< int > m_fed_in
Definition: RunInfo.h:26
FedsConstIterRange fedIds() const
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
const SiStripDetCabling * SiStripDetCabling_
const SiStripFedCabling * fedCabling() const
void turnOffFeds(const std::vector< int > &fedsList, const bool turnOffStrips, const bool printDebug)
void SiStripQuality::addInvalidConnectionFromCabling ( )

Definition at line 237 of file SiStripQuality.cc.

References add(), SiStripDetCabling::addActiveDetectorsRawIds(), SiStripBadStrip::encode(), SiStripDetCabling::getConnections(), customizeTrackingMonitorSeedNumber::idx, sistrip::invalid_, LogTrace, SiStripDetCabling::nApvPairs(), and SiStripDetCabling_.

Referenced by add().

238 {
239  std::vector<uint32_t> connected_detids;
240  SiStripDetCabling_->addActiveDetectorsRawIds(connected_detids);
241  std::vector<uint32_t>::const_iterator itdet = connected_detids.begin();
242  std::vector<uint32_t>::const_iterator itdetEnd = connected_detids.end();
243  for(;itdet!=itdetEnd;++itdet){
244  //LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] looking at detid " <<*itdet << std::endl;
245  const std::vector<const FedChannelConnection *>& fedconns=SiStripDetCabling_->getConnections(*itdet);
246  std::vector<const FedChannelConnection *>::const_iterator itconns=fedconns.begin();
247  std::vector<const FedChannelConnection *>::const_iterator itconnsEnd=fedconns.end();
248 
249  unsigned short nApvPairs=SiStripDetCabling_->nApvPairs(*itdet);
250  short ngoodConn=0, goodConn=0;
251  for(;itconns!=itconnsEnd;++itconns){
252  //LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] apvpair " << (*itconns)->apvPairNumber() << " napvpair " << (*itconns)->nApvPairs()<< " detid " << (*itconns)->detId() << std::endl;
253  if( (*itconns == 0) || ((*itconns)->nApvPairs()==sistrip::invalid_) )
254  continue;
255  ngoodConn++;
256  goodConn = goodConn | ( 0x1 << (*itconns)->apvPairNumber() );
257  }
258 
259  if (ngoodConn!=nApvPairs){
260  std::vector<unsigned int> vect;
261  for (size_t idx=0;idx<nApvPairs;++idx){
262  if( !(goodConn & ( 0x1 << idx)) ) {
263  short firstStrip=idx*256;
264  short range=256;
265  LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] add detid " <<*itdet << "firstStrip " << firstStrip<< std::endl;
266  vect.push_back(encode(firstStrip,range));
267  }
268  }
269  if(!vect.empty()){
270  SiStripBadStrip::Range Range(vect.begin(),vect.end());
271  add(*itdet,Range);
272  }
273  }
274  }
275 }
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
void add(const uint32_t &, const SiStripBadStrip::Range &)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
const SiStripDetCabling * SiStripDetCabling_
#define LogTrace(id)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static const uint16_t invalid_
Definition: Constants.h:16
const uint16_t nApvPairs(uint32_t det_id) const
std::pair< ContainerIterator, ContainerIterator > Range
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
void SiStripQuality::addNotConnectedConnectionFromCabling ( )

Definition at line 218 of file SiStripQuality.cc.

References add(), SiStripBadStrip::encode(), SiStripDetInfoFileReader::getAllData(), SiStripDetCabling::IsConnected(), getDQMSummary::iter, LogTrace, reader, and SiStripDetCabling_.

Referenced by add().

219 {
220  std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > allData = reader->getAllData();
221  std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator iter=allData.begin();
222  std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator iterEnd=allData.end();
223  std::vector<unsigned int> vect;
224  short firstStrip=0;
225  short range=0;
226  for(;iter!=iterEnd;++iter)
227  if (!SiStripDetCabling_->IsConnected(iter->first)){
228  vect.clear();
229  range=iter->second.nApvs*128;
230  LogTrace("SiStripQuality") << "[addNotConnectedConnectionFromCabling] add detid " << iter->first << std::endl;
231  vect.push_back(encode(firstStrip,range));
232  SiStripBadStrip::Range Range(vect.begin(),vect.end());
233  add(iter->first,Range);
234  }
235 }
void add(const uint32_t &, const SiStripBadStrip::Range &)
bool IsConnected(const uint32_t &det_id) const
const std::map< uint32_t, DetInfo > & getAllData() const
const SiStripDetCabling * SiStripDetCabling_
#define LogTrace(id)
std::pair< ContainerIterator, ContainerIterator > Range
SiStripDetInfoFileReader * reader
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
SiStripDetCabling const* SiStripQuality::cabling ( ) const
inline

Definition at line 127 of file SiStripQuality.h.

References SiStripDetCabling_.

127 { return SiStripDetCabling_;}
const SiStripDetCabling * SiStripDetCabling_
bool SiStripQuality::cleanUp ( bool  force = false)

Definition at line 500 of file SiStripQuality.cc.

References SiStripBadStrip::indexes, LogTrace, SiStripBadStrip::put(), toCleanUp, and SiStripBadStrip::v_badstrips.

Referenced by SiStripBadModuleGenerator::createObject(), operator+=(), and operator-=().

501 {
502  if (!toCleanUp && !force)
503  return false;
504 
505  toCleanUp=false;
506 
507  std::vector<unsigned int> v_badstrips_tmp=v_badstrips;
508  std::vector<DetRegistry> indexes_tmp=indexes;
509 
510  LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] before cleanUp v_badstrips.size()= " << v_badstrips.size() << " indexes.size()=" << indexes.size() << std::endl;
511 
512  v_badstrips.clear();
513  indexes.clear();
514 
515  SiStripBadStrip::RegistryIterator basebegin = indexes_tmp.begin();
516  SiStripBadStrip::RegistryIterator baseend = indexes_tmp.end();
517 
518  for (SiStripBadStrip::RegistryIterator basep=basebegin; basep != baseend; ++basep) {
519  if(basep->ibegin!=basep->iend){
520  SiStripBadStrip::Range range( v_badstrips_tmp.begin()+basep->ibegin, v_badstrips_tmp.begin()+basep->iend );
521  if ( ! put(basep->detid,range) )
522  edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl;
523  }
524  }
525 
526  LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] after cleanUp v_badstrips.size()= " << v_badstrips.size() << " indexes.size()=" << indexes.size() << std::endl;
527  return true;
528 }
Registry::const_iterator RegistryIterator
#define LogTrace(id)
Container v_badstrips
std::pair< ContainerIterator, ContainerIterator > Range
bool put(const uint32_t &detID, const InputVector &vect)
void SiStripQuality::clear ( void  )
inline
void SiStripQuality::compact ( unsigned int &  detid,
std::vector< unsigned int > &  vect 
)

Definition at line 336 of file SiStripQuality.cc.

References SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), reader, and tmp.

Referenced by add(), SiStripBadAPVAlgorithmFromClusterOccupancy::AnalyzeOccupancy(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::AnalyzeOccupancy(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), SiStripHitEffFromCalibTree::makeSQLite(), and SiStripCondObjBuilderFromDb::storeQuality().

337 {
338  std::vector<unsigned int> tmp=vect;
339  vect.clear();
340  std::stable_sort(tmp.begin(),tmp.end());
341  unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128;
342  compact(tmp,vect,Nstrips);
343 }
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void compact(unsigned int &, std::vector< unsigned int > &)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
SiStripDetInfoFileReader * reader
void SiStripQuality::compact ( std::vector< unsigned int > &  tmp,
std::vector< unsigned int > &  vect,
unsigned short &  Nstrips 
)
private

Definition at line 420 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), SiStripBadStrip::encode(), SiStripBadStrip::data::firstStrip, and SiStripBadStrip::data::range.

421 {
422  SiStripBadStrip::data fs_0, fs_1;
423  vect.clear();
424 
425  ContainerIterator it=tmp.begin();
426  fs_0=decode(*it);
427 
428  //Check if at the module end
429  if (fs_0.firstStrip+fs_0.range>=Nstrips){
430  vect.push_back(encode(fs_0.firstStrip,Nstrips-fs_0.firstStrip));
431  return;
432  }
433 
434  ++it;
435  for(;it!=tmp.end();++it){
436  fs_1=decode(*it);
437 
438  if (fs_0.firstStrip+fs_0.range>=fs_1.firstStrip+fs_1.range){
439  //fs_0 includes fs_1, go ahead
440  } else if (fs_0.firstStrip+fs_0.range>=fs_1.firstStrip){
441  // contiguous or superimposed intervals
442  //Check if at the module end
443  if (fs_1.firstStrip+fs_1.range>=Nstrips){
444  vect.push_back(encode(fs_0.firstStrip,Nstrips-fs_0.firstStrip));
445  return;
446  }else{
447  //create new fs_0
448  fs_0.range=fs_1.firstStrip+fs_1.range-fs_0.firstStrip;
449  }
450  } else{
451  //separated intervals
452  vect.push_back(encode(fs_0.firstStrip,fs_0.range));
453  fs_0=fs_1;
454  }
455  }
456  vect.push_back(encode(fs_0.firstStrip,fs_0.range));
457 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
unsigned short firstStrip
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
data decode(const unsigned int &value) const
void SiStripQuality::fillBadComponents ( )

Definition at line 530 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-=().

531 {
532  BadComponentVect.clear();
533 
534  for (SiStripBadStrip::RegistryIterator basep=indexes.begin(); basep != indexes.end(); ++basep) {
535 
536  SiStripBadStrip::Range range( v_badstrips.begin()+basep->ibegin, v_badstrips.begin()+basep->iend );
537 
538  //Fill BadModules, BadFibers, BadApvs vectors
539  unsigned short resultA=0, resultF=0;
540  BadComponent result;
541 
543  unsigned short Nstrips=reader->getNumberOfApvsAndStripLength(basep->detid).first*128;
544 
545  //BadModules
546  fs=decode(*(range.first));
547  if (basep->iend - basep->ibegin == 1 &&
548  fs.firstStrip==0 &&
549  fs.range==Nstrips ){
550  result.detid=basep->detid;
551  result.BadModule=true;
552  result.BadFibers=(1<< (Nstrips/256))-1;
553  result.BadApvs=(1<< (Nstrips/128))-1;
554 
555  BadComponentVect.push_back(result);
556 
557  } else {
558 
559  //Bad Fibers and Apvs
560  for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){
561  fs=decode(*it);
562 
563  //BadApvs
564  for(short apvNb=0;apvNb<6;++apvNb){
565  if ( fs.firstStrip<=apvNb*128 && (apvNb+1)*128<=fs.firstStrip+fs.range ){
566  resultA=resultA | (1<<apvNb);
567  }
568  }
569  //BadFibers
570  for(short fiberNb=0;fiberNb<3;++fiberNb){
571  if ( fs.firstStrip<=fiberNb*256 && (fiberNb+1)*256<=fs.firstStrip+fs.range ){
572  resultF=resultF | (1<<fiberNb);
573  }
574  }
575  }
576  if (resultA!=0){
577  result.detid=basep->detid;
578  result.BadModule=false;
579  result.BadFibers=resultF;
580  result.BadApvs=resultA;
581  BadComponentVect.push_back(result);
582  }
583  }
584  }
585 }
unsigned short range
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
std::vector< unsigned int >::const_iterator ContainerIterator
Registry::const_iterator RegistryIterator
std::vector< BadComponent > BadComponentVect
tuple result
Definition: query.py:137
unsigned short firstStrip
Container v_badstrips
std::pair< ContainerIterator, ContainerIterator > Range
SiStripDetInfoFileReader * reader
data decode(const unsigned int &value) const
short SiStripQuality::getBadApvs ( const uint32_t &  detid) const

Definition at line 675 of file SiStripQuality.cc.

References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by MeasurementTrackerImpl::initializeStripStatus().

676 {
677  std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
678  if (p!=BadComponentVect.end() && p->detid==detid)
679  return p->BadApvs;
680  return 0;
681 }
std::vector< BadComponent > BadComponentVect
const std::vector<BadComponent>& SiStripQuality::getBadComponentList ( ) const
inline

Definition at line 119 of file SiStripQuality.h.

References BadComponentVect.

Referenced by SiStripHitEffFromCalibTree::algoAnalyze(), and SiStripBadModuleGenerator::createObject().

119 { return BadComponentVect; }
std::vector< BadComponent > BadComponentVect
short SiStripQuality::getBadFibers ( const uint32_t &  detid) const

Definition at line 683 of file SiStripQuality.cc.

References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by MeasurementTrackerImpl::initializeStripStatus().

684 {
685  std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
686  if (p!=BadComponentVect.end() && p->detid==detid)
687  return p->BadFibers;
688  return 0;
689 }
std::vector< BadComponent > BadComponentVect
edm::FileInPath SiStripQuality::getFileInPath ( ) const
inline

Definition at line 89 of file SiStripQuality.h.

References FileInPath_.

89 {return FileInPath_;}
edm::FileInPath FileInPath_
bool SiStripQuality::IsApvBad ( const uint32_t &  detid,
const short &  apvNb 
) const

Definition at line 619 of file SiStripQuality.cc.

References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.

620 {
621  std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
622  if (p!=BadComponentVect.end() && p->detid==detid)
623  return ((p->BadApvs>>apvNb)&0x1);
624  return false;
625 }
std::vector< BadComponent > BadComponentVect
bool SiStripQuality::IsFiberBad ( const uint32_t &  detid,
const short &  fiberNb 
) const

Definition at line 611 of file SiStripQuality.cc.

References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.

612 {
613  std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
614  if (p!=BadComponentVect.end() && p->detid==detid)
615  return ((p->BadFibers>>fiberNb)&0x1);
616  return false;
617 }
std::vector< BadComponent > BadComponentVect
bool SiStripQuality::IsModuleBad ( const uint32_t &  detid) const

Definition at line 603 of file SiStripQuality.cc.

References BadComponentVect, cond::rpcobgas::detid, and AlCaHLTBitMon_ParallelJobs::p.

604 {
605  std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
606  if (p!=BadComponentVect.end() && p->detid==detid)
607  return p->BadModule;
608  return false;
609 }
std::vector< BadComponent > BadComponentVect
bool SiStripQuality::IsModuleUsable ( const uint32_t &  detid) const

Definition at line 589 of file SiStripQuality.cc.

References BadComponentVect, cond::rpcobgas::detid, SiStripDetCabling::IsConnected(), NULL, AlCaHLTBitMon_ParallelJobs::p, and SiStripDetCabling_.

Referenced by MeasurementTrackerImpl::initializeStripStatus().

590 {
591  std::vector<BadComponent>::const_iterator p = std::lower_bound(BadComponentVect.begin(),BadComponentVect.end(),detid,SiStripQuality::BadComponentStrictWeakOrdering());
592  if (p!=BadComponentVect.end() && p->detid==detid)
593  if(p->BadModule)
594  return false;
595 
598  return false;
599 
600  return true;
601 }
#define NULL
Definition: scimark2.h:8
bool IsConnected(const uint32_t &det_id) const
std::vector< BadComponent > BadComponentVect
const SiStripDetCabling * SiStripDetCabling_
bool SiStripQuality::IsStripBad ( const uint32_t &  detid,
const short &  strip 
) const

Definition at line 627 of file SiStripQuality.cc.

References SiStripBadStrip::getRange().

628 {
630  return IsStripBad(range,strip);
631 }
bool IsStripBad(const uint32_t &detid, const short &strip) const
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
bool SiStripQuality::IsStripBad ( const Range range,
const short &  strip 
) const

Definition at line 633 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, and query::result.

634 {
635  bool result=false;
637  for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){
638  fs=decode(*it);
639  if ( (fs.firstStrip<=strip) & (strip<fs.firstStrip+fs.range) ){
640  result=true;
641  break;
642  }
643  }
644  return result;
645 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
tuple result
Definition: query.py:137
unsigned short firstStrip
data decode(const unsigned int &value) const
int SiStripQuality::nBadStripsOnTheLeft ( const Range range,
const short &  strip 
) const

Definition at line 647 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, and query::result.

648 {
649  int result=0;
651  for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){
652  fs=decode(*it);
653  if ( fs.firstStrip<=strip && strip<fs.firstStrip+fs.range ){
654  result=strip-fs.firstStrip+1;
655  break;
656  }
657  }
658  return result;
659 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
tuple result
Definition: query.py:137
unsigned short firstStrip
data decode(const unsigned int &value) const
int SiStripQuality::nBadStripsOnTheRight ( const Range range,
const short &  strip 
) const

Definition at line 661 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, and query::result.

662 {
663  int result=0;
665  for(SiStripBadStrip::ContainerIterator it=range.first;it!=range.second;++it){
666  fs=decode(*it);
667  if ( fs.firstStrip<=strip && strip<fs.firstStrip+fs.range ){
668  result=fs.firstStrip+fs.range-strip;
669  break;
670  }
671  }
672  return result;
673 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
tuple result
Definition: query.py:137
unsigned short firstStrip
data decode(const unsigned int &value) const
bool SiStripQuality::operator!= ( const SiStripQuality other) const

Definition at line 118 of file SiStripQuality.cc.

118 { return !(*this == other) ; }
SiStripQuality & SiStripQuality::operator+= ( const SiStripQuality other)

Definition at line 57 of file SiStripQuality.cc.

References add(), cleanUp(), and fillBadComponents().

58 {
59  this->add(&other);
60  this->cleanUp();
61  this->fillBadComponents();
62  return *this;
63 }
bool cleanUp(bool force=false)
void add(const uint32_t &, const SiStripBadStrip::Range &)
void fillBadComponents()
const SiStripQuality SiStripQuality::operator- ( const SiStripQuality other) const

Definition at line 107 of file SiStripQuality.cc.

References SiStripQuality().

108 {
109  return SiStripQuality(*this) -= other;
110 }
SiStripQuality & SiStripQuality::operator-= ( const SiStripQuality other)

Definition at line 65 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().

66 {
69  std::vector<unsigned int> ovect,vect;
70  uint32_t detid;
71  unsigned short Nstrips;
72 
73  for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
74 
75  detid=rp->detid;
76  Nstrips=reader->getNumberOfApvsAndStripLength(detid).first*128;
77 
78  SiStripBadStrip::Range orange = SiStripBadStrip::Range( other.getDataVectorBegin()+rp->ibegin , other.getDataVectorBegin()+rp->iend );
79 
80  //Is this detid already in the collections owned by this class?
81  SiStripBadStrip::Range range = getRange(detid);
82  if (range.first!=range.second){ //yes, it is
83 
84  vect.clear();
85  ovect.clear();
86 
87  //if other full det is bad, remove det from this
88  SiStripBadStrip::data data_=decode(*(orange.first));
89  if(orange.second-orange.first!=1
90  || data_.firstStrip!=0
91  || data_.range<Nstrips){
92 
93  ovect.insert(ovect.end(),orange.first,orange.second);
94  vect.insert(vect.end(),range.first,range.second);
95  subtract(vect,ovect);
96  }
97  SiStripBadStrip::Range newrange(vect.begin(),vect.end());
98  if ( ! put_replace(detid,newrange) )
99  edm::LogError("SiStripQuality")<<"[" << __PRETTY_FUNCTION__ << "] " << std::endl;
100  }
101  }
102  cleanUp();
104  return *this;
105 }
unsigned short range
bool cleanUp(bool force=false)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
Registry::const_iterator RegistryIterator
void subtract(std::vector< unsigned int > &, const std::vector< unsigned int > &)
RegistryIterator getRegistryVectorEnd() const
void fillBadComponents()
bool put_replace(const uint32_t &DetId, Range input)
ContainerIterator getDataVectorBegin() const
unsigned short firstStrip
RegistryIterator getRegistryVectorBegin() const
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
SiStripDetInfoFileReader * reader
data decode(const unsigned int &value) const
bool SiStripQuality::operator== ( const SiStripQuality other) const

Definition at line 112 of file SiStripQuality.cc.

References a, SiStripBadStrip::getRegistryVectorBegin(), and SiStripBadStrip::getRegistryVectorEnd().

113 {
114  SiStripQuality a = (*this) - other ;
116 }
RegistryIterator getRegistryVectorEnd() const
RegistryIterator getRegistryVectorBegin() const
double a
Definition: hdecay.h:121
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 736 of file SiStripQuality.cc.

References filterCSVwithJSON::copy, and contentValuesCheck::ss.

740 {
741  std::ostringstream ss;
742 
743  if( printDebug ) {
744  ss << "activeFedsFromCabling:" << std::endl;
745  std::copy(activeFedsFromCabling.begin(), activeFedsFromCabling.end(), std::ostream_iterator<uint16_t>(ss, " "));
746  ss << std::endl;
747  ss << "activeFedsFromRunInfo:" << std::endl;
748  std::copy(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(), std::ostream_iterator<int>(ss, " "));
749  ss << std::endl;
750  }
751  if( differentFeds.size() != 440 ) {
752  ss << "differentFeds : " << std::endl;
753  std::copy(differentFeds.begin(), differentFeds.end(), std::ostream_iterator<int>(ss, " "));
754  ss << std::endl;
755  }
756  else {
757  ss << "There are 440 feds (all) active for Cabling but off for RunInfo. Tracker was probably not in this run" << std::endl;
758  }
759  edm::LogInfo("SiStripQuality") << ss.str() << std::endl;
760 }
void printDebug(std::stringstream &ss) const
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 691 of file SiStripQuality.cc.

References cond::rpcobgas::detid, TOBDetId::layer(), TIBDetId::layer(), DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, and TECDetId::wheel().

Referenced by turnOffFeds().

692 {
693  int layer = 0;
694  int stereo = 0;
695  std::string subDetName;
696  DetId detid(detId);
697  switch (detid.subdetId()) {
699  {
700  TIBDetId theTIBDetId(detid.rawId());
701  layer = theTIBDetId.layer();
702  stereo = theTIBDetId.stereo();
703  subDetName = "TIB";
704  break;
705  }
707  {
708  TOBDetId theTOBDetId(detid.rawId());
709  layer = theTOBDetId.layer();
710  stereo = theTOBDetId.stereo();
711  subDetName = "TOB";
712  break;
713  }
715  {
716  TECDetId theTECDetId(detid.rawId());
717  // is this module in TEC+ or TEC-?
718  layer = theTECDetId.wheel();
719  stereo = theTECDetId.stereo();
720  subDetName = "TEC";
721  break;
722  }
724  {
725  TECDetId theTIDDetId(detid.rawId());
726  // is this module in TID+ or TID-?
727  layer = theTIDDetId.wheel();
728  stereo = theTIDDetId.stereo();
729  subDetName = "TID";
730  break;
731  }
732  }
733  ss << detId << " and apv = " << apvPairNumber << " of subDet = " << subDetName << ", layer = " << layer << " stereo = " << stereo << std::endl;
734 }
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
Definition: DetId.h:18
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
bool SiStripQuality::put_replace ( const uint32_t &  DetId,
Range  input 
)
private

Definition at line 345 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-=().

346 {
347  // put in SiStripQuality::v_badstrips of DetId
348  Registry::iterator p = std::lower_bound(indexes.begin(),indexes.end(),DetId,SiStripBadStrip::StrictWeakOrdering());
349 
350  size_t sd= input.second-input.first;
351  DetRegistry detregistry;
352  detregistry.detid=DetId;
353  detregistry.ibegin=v_badstrips.size();
354  detregistry.iend=v_badstrips.size()+sd;
355 
356  v_badstrips.insert(v_badstrips.end(),input.first,input.second);
357 
358  if (p!=indexes.end() && p->detid==DetId){
359  LogTrace("SiStripQuality") << "[SiStripQuality::put_replace] Replacing SiStripQuality for already stored DetID " << DetId << std::endl;
360  toCleanUp=true;
361  *p=detregistry;
362  } else {
363  indexes.insert(p,detregistry);
364  }
365 
366  return true;
367 }
static std::string const input
Definition: EdmProvDump.cc:44
#define LogTrace(id)
Definition: DetId.h:18
Container v_badstrips
double sd
void SiStripQuality::ReduceGranularity ( double  threshold)

Definition at line 375 of file SiStripQuality.cc.

References add(), SiStripBadStrip::decode(), cond::rpcobgas::detid, SiStripBadStrip::encode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), i, LogTrace, bookConverter::max, min(), and SiStripBadStrip::data::range.

376 {
379  SiStripBadStrip::data data_;
380  uint16_t BadStripPerApv[6], ipos;
381  std::vector<unsigned int> vect;
382 
383  for (; rp != rend; ++rp) {
384  uint32_t detid=rp->detid;
385 
386  BadStripPerApv[0]=0; BadStripPerApv[1]=0; BadStripPerApv[2]=0; BadStripPerApv[3]=0; BadStripPerApv[4]=0; BadStripPerApv[5]=0;
387  ipos=0;
388 
390 
391  for(int it=0;it<sqrange.second-sqrange.first;it++){
392 
393  data_=decode( *(sqrange.first+it) );
394  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] detid " << detid << " first strip " << data_.firstStrip << " lastStrip " << data_.firstStrip+data_.range-1 << " range " << data_.range;
395  ipos= data_.firstStrip/128;
396  while (ipos<=(data_.firstStrip+data_.range-1)/128){
397  BadStripPerApv[ipos]+=std::min(data_.firstStrip+data_.range,(ipos+1)*128)-std::max(data_.firstStrip*1,ipos*128);
398  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);
399  ipos++;
400  }
401  }
402 
403  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] Total for detid " << detid << " values " << BadStripPerApv[0] << " " << BadStripPerApv[1] << " " << BadStripPerApv[2] << " " <<BadStripPerApv[3] << " " <<BadStripPerApv[4] << " " << BadStripPerApv[5];
404 
405 
406  vect.clear();
407  for(size_t i=0;i<6;++i){
408  if (BadStripPerApv[i]>=threshold*128){
409  vect.push_back(encode(i*128,128));
410  }
411  }
412  if(!vect.empty()){
413  SiStripBadStrip::Range Range(vect.begin(),vect.end());
414  add(detid,Range);
415  }
416  }
417 }
unsigned short range
int i
Definition: DBlmapReader.cc:9
void add(const uint32_t &, const SiStripBadStrip::Range &)
Registry::const_iterator RegistryIterator
RegistryIterator getRegistryVectorEnd() const
T min(T a, T b)
Definition: MathUtil.h:58
#define LogTrace(id)
ContainerIterator getDataVectorBegin() const
unsigned short firstStrip
RegistryIterator getRegistryVectorBegin() const
std::pair< ContainerIterator, ContainerIterator > Range
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
data decode(const unsigned int &value) const
void SiStripQuality::setPrintDebugOutput ( const bool  printDebug)
inline

Definition at line 123 of file SiStripQuality.h.

References SiStripBadStrip::printDebug(), and printDebug_.

123 { printDebug_ = printDebug; }
void printDebug(std::stringstream &ss) const
void SiStripQuality::setUseEmptyRunInfo ( const bool  useEmptyRunInfo)
inline

Definition at line 124 of file SiStripQuality.h.

References useEmptyRunInfo_.

124 { useEmptyRunInfo_ = useEmptyRunInfo; }
void SiStripQuality::subtract ( std::vector< unsigned int > &  A,
const std::vector< unsigned int > &  B 
)
private

Definition at line 459 of file SiStripQuality.cc.

References subtraction().

Referenced by operator-=().

460 {
461  ContainerIterator it=B.begin();
462  ContainerIterator itend=B.end();
463  for(;it!=itend;++it){
464  subtraction(A,*it);
465  }
466 }
std::vector< unsigned int >::const_iterator ContainerIterator
void subtraction(std::vector< unsigned int > &, const unsigned int &)
void SiStripQuality::subtraction ( std::vector< unsigned int > &  A,
const unsigned int &  B 
)
private

Definition at line 468 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), SiStripBadStrip::encode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, and tmp.

Referenced by subtract().

469 {
470  SiStripBadStrip::data fs_A, fs_B, fs_m, fs_M;
471  std::vector<unsigned int> tmp;
472 
473  fs_B=decode(B);
474  ContainerIterator jt=A.begin();
475  ContainerIterator jtend=A.end();
476  for(;jt!=jtend;++jt){
477  fs_A=decode(*jt);
478  if (B<*jt){
479  fs_m=fs_B;
480  fs_M=fs_A;
481  }else{
482  fs_m=fs_A;
483  fs_M=fs_B;
484  }
485  //A) Verify the range to be subtracted crosses the new range
486  if (fs_m.firstStrip+fs_m.range>fs_M.firstStrip){
487  if (*jt<B){
488  tmp.push_back(encode(fs_A.firstStrip,fs_B.firstStrip-fs_A.firstStrip));
489  }
490  if (fs_A.firstStrip+fs_A.range>fs_B.firstStrip+fs_B.range){
491  tmp.push_back(encode(fs_B.firstStrip+fs_B.range,fs_A.firstStrip+fs_A.range-(fs_B.firstStrip+fs_B.range)));
492  }
493  }else{
494  tmp.push_back(*jt);
495  }
496  }
497  A=tmp;
498 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
unsigned short firstStrip
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
data decode(const unsigned int &value) const
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 762 of file SiStripQuality.cc.

References add(), SiStripBadStrip::encode(), SiStripDetCabling::fedCabling(), SiStripFedCabling::fedConnections(), LogTrace, printDetInfo(), SiStripDetCabling_, and contentValuesCheck::ss.

Referenced by add().

763 {
764 
765  std::stringstream ss;
766  if( printDebug ) {
767  ss << "associated to detIds : " << std::endl;
768  }
769 
770  std::vector<int>::const_iterator fedIdIt = fedsList.begin();
771  for( ; fedIdIt != fedsList.end(); ++fedIdIt ) {
772  std::vector<FedChannelConnection>::const_iterator fedChIt = SiStripDetCabling_->fedCabling()->fedConnections( *fedIdIt ).begin();
773  for( ; fedChIt != SiStripDetCabling_->fedCabling()->fedConnections( *fedIdIt ).end(); ++fedChIt ) {
774  uint32_t detId = fedChIt->detId();
775  if (detId == 0 || detId == 0xFFFFFFFF) continue;
776  uint16_t apvPairNumber = fedChIt->apvPairNumber();
777 
778  if( printDebug ) {
779  printDetInfo(detId, apvPairNumber, ss);
780  }
781 
782  if( turnOffStrips ) {
783  // apvPairNumber == i it means that the i*256 strips are to be set off
784  std::vector<unsigned int> vect;
785  vect.push_back(encode(apvPairNumber*256,256));
786  SiStripBadStrip::Range Range(vect.begin(), vect.end());
787  add(detId,Range);
788  LogTrace("SiStripQuality") << "[addOffForRunInfo] adding apvPairNumber "<<apvPairNumber<<" for detId "<<detId<<" off according to RunInfo" << std::endl;
789  }
790  }
791  }
792  if( printDebug ) {
793  edm::LogInfo("SiStripQuality") << ss.str() << std::endl;
794  }
795 }
void printDetInfo(const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
Prints debug output for a given detId.
void add(const uint32_t &, const SiStripBadStrip::Range &)
const SiStripDetCabling * SiStripDetCabling_
void printDebug(std::stringstream &ss) const
#define LogTrace(id)
const SiStripFedCabling * fedCabling() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const
std::pair< ContainerIterator, ContainerIterator > Range
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)

Member Data Documentation

std::vector<BadComponent> SiStripQuality::BadComponentVect
private
edm::FileInPath SiStripQuality::FileInPath_
private

Definition at line 152 of file SiStripQuality.h.

Referenced by getFileInPath(), and SiStripQuality().

bool SiStripQuality::printDebug_
private

Definition at line 158 of file SiStripQuality.h.

Referenced by add(), setPrintDebugOutput(), and SiStripQuality().

SiStripDetInfoFileReader* SiStripQuality::reader
private
const SiStripDetCabling* SiStripQuality::SiStripDetCabling_
private
bool SiStripQuality::toCleanUp
private

Definition at line 151 of file SiStripQuality.h.

Referenced by cleanUp(), clear(), put_replace(), and SiStripQuality().

bool SiStripQuality::useEmptyRunInfo_
private

Definition at line 159 of file SiStripQuality.h.

Referenced by add(), setUseEmptyRunInfo(), and SiStripQuality().