CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
SiStripQuality Class Referencefinal

#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 () override
 
- 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 TrackerTopology *trackerTopo) const
 
void printSummary (std::stringstream &ss, const TrackerTopology *trackerTopo) 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)
 
void printDetInfo (const TrackerTopology *const tTopo, 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, ContainerIteratorRange
 
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 20 of file SiStripQuality.cc.

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

Referenced by SiStripQuality::BadComponentStrictWeakOrdering::operator()(), and operator-().

21  : toCleanUp(false),
22  FileInPath_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"),
23  SiStripDetCabling_(nullptr),
24  printDebug_(false),
25  useEmptyRunInfo_(false) {
27 }
const SiStripDetCabling * SiStripDetCabling_
std::string fullPath() const
Definition: FileInPath.cc:163
SiStripDetInfoFileReader * reader
edm::FileInPath FileInPath_
SiStripQuality::SiStripQuality ( edm::FileInPath file)

Definition at line 29 of file SiStripQuality.cc.

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

30  : toCleanUp(false), FileInPath_(file), SiStripDetCabling_(nullptr), printDebug_(false), useEmptyRunInfo_(false) {
32 }
const SiStripDetCabling * SiStripDetCabling_
std::string fullPath() const
Definition: FileInPath.cc:163
SiStripDetInfoFileReader * reader
edm::FileInPath FileInPath_
SiStripQuality::SiStripQuality ( const SiStripQuality other)

Definition at line 34 of file SiStripQuality.cc.

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

34  {
35  FileInPath_ = other.FileInPath_;
36  reader = new SiStripDetInfoFileReader(*(other.reader));
37  toCleanUp = other.toCleanUp;
38  indexes = other.indexes;
39  v_badstrips = other.v_badstrips;
42  printDebug_ = other.printDebug_;
44 }
std::vector< BadComponent > BadComponentVect
const SiStripDetCabling * SiStripDetCabling_
Container v_badstrips
SiStripDetInfoFileReader * reader
edm::FileInPath FileInPath_
SiStripQuality::~SiStripQuality ( )
override

Definition at line 46 of file SiStripQuality.cc.

References LogTrace, and reader.

Referenced by SiStripQuality::BadComponentStrictWeakOrdering::operator()().

46  {
47  LogTrace("SiStripQuality") << "SiStripQuality destructor" << std::endl;
48  delete reader;
49 }
#define LogTrace(id)
SiStripDetInfoFileReader * reader

Member Function Documentation

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

Definition at line 289 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(), clear(), operator+=(), ReduceGranularity(), counter.Counter::register(), SequenceTypes.Task::remove(), SequenceTypes.Task::replace(), and turnOffFeds().

289  {
290  std::vector<unsigned int> vect, tmp;
291 
292  unsigned short Nstrips = reader->getNumberOfApvsAndStripLength(detid).first * 128;
293 
294  // Is this detid already in the collections owned by this class?
295  SiStripBadStrip::Range range = getRange(detid);
296 
297  // Append bad strips
298  tmp.clear();
299  if (range.first == range.second) {
300  LogTrace("SiStripQuality") << "new detid" << std::endl;
301  // It's a new detid
302  tmp.insert(tmp.end(), baserange.first, baserange.second);
303  std::stable_sort(tmp.begin(), tmp.end());
304  LogTrace("SiStripQuality") << "ordered" << std::endl;
305  } else {
306  LogTrace("SiStripQuality") << "already exists" << std::endl;
307  // alredy existing detid
308 
309  // if full det is bad go to next detid
310  SiStripBadStrip::data data_ = decode(*(range.first));
311  if (range.second - range.first == 1 && data_.firstStrip == 0 && data_.range >= Nstrips) {
312  LogTrace("SiStripQuality") << "full det is bad.. " << range.second - range.first << " "
313  << decode(*(range.first)).firstStrip << " " << decode(*(range.first)).range << " "
314  << decode(*(range.first)).flag << "\n"
315  << std::endl;
316  return;
317  }
318 
319  tmp.insert(tmp.end(), baserange.first, baserange.second);
320  tmp.insert(tmp.end(), range.first, range.second);
321  std::stable_sort(tmp.begin(), tmp.end());
322  LogTrace("SiStripQuality") << "ordered" << std::endl;
323  }
324  // Compact data
325  compact(tmp, vect, Nstrips);
326  SiStripBadStrip::Range newrange(vect.begin(), vect.end());
327  if (!put_replace(detid, newrange))
328  edm::LogError("SiStripQuality") << "[" << __PRETTY_FUNCTION__ << "] " << std::endl;
329 }
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 272 of file SiStripQuality.cc.

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

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

272  {
275 
276  // the Registry already contains data
277  // Loop on detids
278  for (SiStripBadStrip::RegistryIterator basep = basebegin; basep != baseend; ++basep) {
279  uint32_t detid = basep->detid;
280  LogTrace("SiStripQuality") << "add detid " << detid << std::endl;
281 
282  SiStripBadStrip::Range baserange =
283  SiStripBadStrip::Range(base->getDataVectorBegin() + basep->ibegin, base->getDataVectorBegin() + basep->iend);
284 
285  add(detid, baserange);
286  }
287 }
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)
void SiStripQuality::add ( const SiStripDetVOff Voff)

Definition at line 107 of file SiStripQuality.cc.

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

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

107  {
108  std::vector<unsigned int> vect;
109  short firstStrip = 0;
110  short range = 0;
111 
112  // Get vector of Voff dets
113  std::vector<uint32_t> vdets;
114  Voff->getDetIds(vdets);
115  std::vector<uint32_t>::const_iterator iter = vdets.begin();
116  std::vector<uint32_t>::const_iterator iterEnd = vdets.end();
117 
118  for (; iter != iterEnd; ++iter) {
119  vect.clear();
120  range = (short)(reader->getNumberOfApvsAndStripLength(*iter).first * 128.);
121  LogTrace("SiStripQuality") << "[add Voff] add detid " << *iter << " first strip " << firstStrip << " range "
122  << range << std::endl;
123  vect.push_back(encode(firstStrip, range));
124  SiStripBadStrip::Range Range(vect.begin(), vect.end());
125  add(*iter, Range);
126  }
127 }
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 129 of file SiStripQuality.cc.

References trackerTree::check(), SiStripDetCabling::fedCabling(), SiStripFedCabling::fedIds(), RunInfo::m_fed_in, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, printDebug_, SiStripDetCabling_, turnOffFeds(), and useEmptyRunInfo_.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

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

Definition at line 228 of file SiStripQuality.cc.

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

Referenced by add(), and clear().

228  {
229  std::vector<uint32_t> connected_detids;
230  SiStripDetCabling_->addActiveDetectorsRawIds(connected_detids);
231  std::vector<uint32_t>::const_iterator itdet = connected_detids.begin();
232  std::vector<uint32_t>::const_iterator itdetEnd = connected_detids.end();
233  for (; itdet != itdetEnd; ++itdet) {
234  // LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] looking
235  // at detid " <<*itdet << std::endl;
236  const std::vector<const FedChannelConnection *> &fedconns = SiStripDetCabling_->getConnections(*itdet);
237  std::vector<const FedChannelConnection *>::const_iterator itconns = fedconns.begin();
238  std::vector<const FedChannelConnection *>::const_iterator itconnsEnd = fedconns.end();
239 
240  unsigned short nApvPairs = SiStripDetCabling_->nApvPairs(*itdet);
241  short ngoodConn = 0, goodConn = 0;
242  for (; itconns != itconnsEnd; ++itconns) {
243  // LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling]
244  // apvpair " << (*itconns)->apvPairNumber() << " napvpair " <<
245  // (*itconns)->nApvPairs()<< " detid " << (*itconns)->detId() <<
246  // std::endl;
247  if ((*itconns == nullptr) || ((*itconns)->nApvPairs() == sistrip::invalid_))
248  continue;
249  ngoodConn++;
250  goodConn = goodConn | (0x1 << (*itconns)->apvPairNumber());
251  }
252 
253  if (ngoodConn != nApvPairs) {
254  std::vector<unsigned int> vect;
255  for (size_t idx = 0; idx < nApvPairs; ++idx) {
256  if (!(goodConn & (0x1 << idx))) {
257  short firstStrip = idx * 256;
258  short range = 256;
259  LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] add detid " << *itdet << "firstStrip "
260  << firstStrip << std::endl;
261  vect.push_back(encode(firstStrip, range));
262  }
263  }
264  if (!vect.empty()) {
265  SiStripBadStrip::Range Range(vect.begin(), vect.end());
266  add(*itdet, Range);
267  }
268  }
269  }
270 }
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)
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 210 of file SiStripQuality.cc.

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

Referenced by add(), and clear().

210  {
211  std::map<uint32_t, SiStripDetInfoFileReader::DetInfo> allData = reader->getAllData();
212  std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator iter = allData.begin();
213  std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator iterEnd = allData.end();
214  std::vector<unsigned int> vect;
215  short firstStrip = 0;
216  short range = 0;
217  for (; iter != iterEnd; ++iter)
218  if (!SiStripDetCabling_->IsConnected(iter->first)) {
219  vect.clear();
220  range = iter->second.nApvs * 128;
221  LogTrace("SiStripQuality") << "[addNotConnectedConnectionFromCabling] add detid " << iter->first << std::endl;
222  vect.push_back(encode(firstStrip, range));
223  SiStripBadStrip::Range Range(vect.begin(), vect.end());
224  add(iter->first, Range);
225  }
226 }
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
bool SiStripQuality::cleanUp ( bool  force = false)

Definition at line 505 of file SiStripQuality.cc.

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

Referenced by clear(), operator+=(), and operator-=().

505  {
506  if (!toCleanUp && !force)
507  return false;
508 
509  toCleanUp = false;
510 
511  std::vector<unsigned int> v_badstrips_tmp = v_badstrips;
512  std::vector<DetRegistry> indexes_tmp = indexes;
513 
514  LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] before cleanUp v_badstrips.size()= " << v_badstrips.size()
515  << " indexes.size()=" << indexes.size() << std::endl;
516 
517  v_badstrips.clear();
518  indexes.clear();
519 
520  SiStripBadStrip::RegistryIterator basebegin = indexes_tmp.begin();
521  SiStripBadStrip::RegistryIterator baseend = indexes_tmp.end();
522 
523  for (SiStripBadStrip::RegistryIterator basep = basebegin; basep != baseend; ++basep) {
524  if (basep->ibegin != basep->iend) {
525  SiStripBadStrip::Range range(v_badstrips_tmp.begin() + basep->ibegin, v_badstrips_tmp.begin() + basep->iend);
526  if (!put(basep->detid, range))
527  edm::LogError("SiStripQuality") << "[" << __PRETTY_FUNCTION__ << "] " << std::endl;
528  }
529  }
530 
531  LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] after cleanUp v_badstrips.size()= " << v_badstrips.size()
532  << " indexes.size()=" << indexes.size() << std::endl;
533  return true;
534 }
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

Definition at line 54 of file SiStripQuality.h.

References add(), addInvalidConnectionFromCabling(), addNotConnectedConnectionFromCabling(), BadComponentVect, cleanUp(), fillBadComponents(), cmsStageWithFailover::force, SiStripBadStrip::indexes, operator!=(), operator+=(), operator-(), operator-=(), operator==(), ReduceGranularity(), toCleanUp, and SiStripBadStrip::v_badstrips.

Referenced by Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), SiStripBadAPVAlgorithmFromClusterOccupancy::extractBadAPVs(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVSandStrips(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), Vispa.Views.WidgetView.WidgetView::setDataObjects(), BeautifulSoup.Tag::setString(), Vispa.Views.TreeView.TreeView::updateContent(), Vispa.Views.TableView.TableView::updateContent(), Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and Vispa.Views.PropertyView.PropertyView::updateContent().

54  {
55  v_badstrips.clear();
56  indexes.clear();
57  BadComponentVect.clear();
58  toCleanUp = false;
59  }
std::vector< BadComponent > BadComponentVect
Container v_badstrips
void SiStripQuality::compact ( unsigned int &  detid,
std::vector< unsigned int > &  vect 
)

Definition at line 331 of file SiStripQuality.cc.

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

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

331  {
332  std::vector<unsigned int> tmp = vect;
333  vect.clear();
334  std::stable_sort(tmp.begin(), tmp.end());
335  unsigned short Nstrips = reader->getNumberOfApvsAndStripLength(detid).first * 128;
336  compact(tmp, vect, Nstrips);
337 }
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 427 of file SiStripQuality.cc.

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

427  {
428  SiStripBadStrip::data fs_0, fs_1;
429  vect.clear();
430 
431  ContainerIterator it = tmp.begin();
432  fs_0 = decode(*it);
433 
434  // Check if at the module end
435  if (fs_0.firstStrip + fs_0.range >= Nstrips) {
436  vect.push_back(encode(fs_0.firstStrip, Nstrips - fs_0.firstStrip));
437  return;
438  }
439 
440  ++it;
441  for (; it != tmp.end(); ++it) {
442  fs_1 = decode(*it);
443 
444  if (fs_0.firstStrip + fs_0.range >= fs_1.firstStrip + fs_1.range) {
445  // fs_0 includes fs_1, go ahead
446  } else if (fs_0.firstStrip + fs_0.range >= fs_1.firstStrip) {
447  // contiguous or superimposed intervals
448  // Check if at the module end
449  if (fs_1.firstStrip + fs_1.range >= Nstrips) {
450  vect.push_back(encode(fs_0.firstStrip, Nstrips - fs_0.firstStrip));
451  return;
452  } else {
453  // create new fs_0
454  fs_0.range = fs_1.firstStrip + fs_1.range - fs_0.firstStrip;
455  }
456  } else {
457  // separated intervals
458  vect.push_back(encode(fs_0.firstStrip, fs_0.range));
459  fs_0 = fs_1;
460  }
461  }
462  vect.push_back(encode(fs_0.firstStrip, fs_0.range));
463 }
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 536 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, mps_fire::result, and SiStripBadStrip::v_badstrips.

Referenced by clear(), SiStripBadAPVAlgorithmFromClusterOccupancy::extractBadAPVs(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVSandStrips(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), SiStripHitEffFromCalibTree::makeSQLite(), operator+=(), and operator-=().

536  {
537  BadComponentVect.clear();
538 
539  for (SiStripBadStrip::RegistryIterator basep = indexes.begin(); basep != indexes.end(); ++basep) {
540  SiStripBadStrip::Range range(v_badstrips.begin() + basep->ibegin, v_badstrips.begin() + basep->iend);
541 
542  // Fill BadModules, BadFibers, BadApvs vectors
543  unsigned short resultA = 0, resultF = 0;
544  BadComponent result;
545 
547  unsigned short Nstrips = reader->getNumberOfApvsAndStripLength(basep->detid).first * 128;
548 
549  // BadModules
550  fs = decode(*(range.first));
551  if (basep->iend - basep->ibegin == 1 && fs.firstStrip == 0 && fs.range == Nstrips) {
552  result.detid = basep->detid;
553  result.BadModule = true;
554  result.BadFibers = (1 << (Nstrips / 256)) - 1;
555  result.BadApvs = (1 << (Nstrips / 128)) - 1;
556 
557  BadComponentVect.push_back(result);
558 
559  } else {
560  // Bad Fibers and Apvs
561  for (SiStripBadStrip::ContainerIterator it = range.first; it != range.second; ++it) {
562  fs = decode(*it);
563 
564  // BadApvs
565  for (short apvNb = 0; apvNb < 6; ++apvNb) {
566  if (fs.firstStrip <= apvNb * 128 && (apvNb + 1) * 128 <= fs.firstStrip + fs.range) {
567  resultA = resultA | (1 << apvNb);
568  }
569  }
570  // BadFibers
571  for (short fiberNb = 0; fiberNb < 3; ++fiberNb) {
572  if (fs.firstStrip <= fiberNb * 256 && (fiberNb + 1) * 256 <= fs.firstStrip + fs.range) {
573  resultF = resultF | (1 << fiberNb);
574  }
575  }
576  }
577  if (resultA != 0) {
578  result.detid = basep->detid;
579  result.BadModule = false;
580  result.BadFibers = resultF;
581  result.BadApvs = resultA;
582  BadComponentVect.push_back(result);
583  }
584  }
585  }
586 }
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
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
const std::vector<BadComponent>& SiStripQuality::getBadComponentList ( ) const
inline
short SiStripQuality::getBadFibers ( const uint32_t &  detid) const
edm::FileInPath SiStripQuality::getFileInPath ( ) const
inline
bool SiStripQuality::IsApvBad ( const uint32_t &  detid,
const short &  apvNb 
) const
bool SiStripQuality::IsFiberBad ( const uint32_t &  detid,
const short &  fiberNb 
) const

Definition at line 612 of file SiStripQuality.cc.

References BadComponentVect, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by getFileInPath(), and SiStripClusterInfo::IsFiberBad().

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

Definition at line 590 of file SiStripQuality.cc.

References BadComponentVect, SiStripDetCabling::IsConnected(), pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, and SiStripDetCabling_.

Referenced by SiStripQualityStatistics::analyze(), SiStripQualityDQM::fillGrandSummaryMEs(), getFileInPath(), MeasurementTrackerImpl::initializeStripStatus(), SiStripClusterInfo::IsModuleUsable(), and SiStripRecHitConverterAlgorithm::useModule().

590  {
591  std::vector<BadComponent>::const_iterator p = std::lower_bound(
593  if (p != BadComponentVect.end() && p->detid == detid)
594  if (p->BadModule)
595  return false;
596 
597  if (SiStripDetCabling_ != nullptr)
598  if (!SiStripDetCabling_->IsConnected(detid))
599  return false;
600 
601  return true;
602 }
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
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 mps_fire::result.

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

Definition at line 646 of file SiStripQuality.cc.

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

Referenced by getFileInPath().

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

Definition at line 659 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::range, mps_fire::result, and digitizers_cfi::strip.

Referenced by getFileInPath().

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

Definition at line 105 of file SiStripQuality.cc.

References trackingPlots::other.

Referenced by clear().

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

Definition at line 51 of file SiStripQuality.cc.

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

Referenced by clear().

51  {
52  this->add(&other);
53  this->cleanUp();
54  this->fillBadComponents();
55  return *this;
56 }
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 96 of file SiStripQuality.cc.

References trackingPlots::other, and SiStripQuality().

Referenced by clear().

96  {
97  return SiStripQuality(*this) -= other;
98 }
SiStripQuality & SiStripQuality::operator-= ( const SiStripQuality other)

Definition at line 58 of file SiStripQuality.cc.

References cleanUp(), SiStripBadStrip::decode(), fillBadComponents(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::getDataVectorBegin(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRange(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), put_replace(), SiStripBadStrip::data::range, reader, and subtract().

Referenced by clear().

58  {
61  std::vector<unsigned int> ovect, vect;
62  uint32_t detid;
63  unsigned short Nstrips;
64 
65  for (SiStripBadStrip::RegistryIterator rp = rbegin; rp != rend; ++rp) {
66  detid = rp->detid;
67  Nstrips = reader->getNumberOfApvsAndStripLength(detid).first * 128;
68 
69  SiStripBadStrip::Range orange =
70  SiStripBadStrip::Range(other.getDataVectorBegin() + rp->ibegin, other.getDataVectorBegin() + rp->iend);
71 
72  // Is this detid already in the collections owned by this class?
73  SiStripBadStrip::Range range = getRange(detid);
74  if (range.first != range.second) { // yes, it is
75 
76  vect.clear();
77  ovect.clear();
78 
79  // if other full det is bad, remove det from this
80  SiStripBadStrip::data data_ = decode(*(orange.first));
81  if (orange.second - orange.first != 1 || data_.firstStrip != 0 || data_.range < Nstrips) {
82  ovect.insert(ovect.end(), orange.first, orange.second);
83  vect.insert(vect.end(), range.first, range.second);
84  subtract(vect, ovect);
85  }
86  SiStripBadStrip::Range newrange(vect.begin(), vect.end());
87  if (!put_replace(detid, newrange))
88  edm::LogError("SiStripQuality") << "[" << __PRETTY_FUNCTION__ << "] " << std::endl;
89  }
90  }
91  cleanUp();
93  return *this;
94 }
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 100 of file SiStripQuality.cc.

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

Referenced by clear().

100  {
101  SiStripQuality a = (*this) - other;
103 }
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 722 of file SiStripQuality.cc.

References popcon2dropbox::copy().

Referenced by cabling().

725  {
726  std::ostringstream ss;
727 
728  if (printDebug) {
729  ss << "activeFedsFromCabling:" << std::endl;
730  std::copy(activeFedsFromCabling.begin(), activeFedsFromCabling.end(), std::ostream_iterator<uint16_t>(ss, " "));
731  ss << std::endl;
732  ss << "activeFedsFromRunInfo:" << std::endl;
733  std::copy(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(), std::ostream_iterator<int>(ss, " "));
734  ss << std::endl;
735  }
736  if (differentFeds.size() != 440) {
737  ss << "differentFeds : " << std::endl;
738  std::copy(differentFeds.begin(), differentFeds.end(), std::ostream_iterator<int>(ss, " "));
739  ss << std::endl;
740  } else {
741  ss << "There are 440 feds (all) active for Cabling but off for RunInfo. "
742  "Tracker was probably not in this run"
743  << std::endl;
744  }
745  edm::LogInfo("SiStripQuality") << ss.str() << std::endl;
746 }
def copy(args, dbName)
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
void SiStripQuality::printDetInfo ( const TrackerTopology *const  tTopo,
const uint32_t &  detId,
const uint32_t &  apvPairNumber,
std::stringstream &  ss 
)
private

Prints debug output for a given detId.

Definition at line 688 of file SiStripQuality.cc.

References TrackerTopology::layer(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), StripSubdetector::TEC, TrackerTopology::tecIsStereo(), StripSubdetector::TIB, TrackerTopology::tibIsStereo(), StripSubdetector::TID, TrackerTopology::tidIsStereo(), StripSubdetector::TOB, and TrackerTopology::tobIsStereo().

Referenced by cabling(), and turnOffFeds().

691  {
692  std::string subDetName;
693  DetId detid(detId);
694  int layer = tTopo->layer(detid);
695  int stereo = 0;
696  switch (detid.subdetId()) {
697  case StripSubdetector::TIB: {
698  stereo = tTopo->tibIsStereo(detid);
699  subDetName = "TIB";
700  break;
701  }
702  case StripSubdetector::TOB: {
703  stereo = tTopo->tobIsStereo(detid);
704  subDetName = "TOB";
705  break;
706  }
707  case StripSubdetector::TEC: {
708  stereo = tTopo->tecIsStereo(detid);
709  subDetName = "TEC";
710  break;
711  }
712  case StripSubdetector::TID: {
713  stereo = tTopo->tidIsStereo(detid);
714  subDetName = "TID";
715  break;
716  }
717  }
718  ss << detId << " and apv = " << apvPairNumber << " of subDet = " << subDetName << ", layer = " << layer
719  << " stereo = " << stereo << std::endl;
720 }
bool tobIsStereo(const DetId &id) const
bool tidIsStereo(const DetId &id) const
bool tecIsStereo(const DetId &id) const
Definition: DetId.h:18
bool tibIsStereo(const DetId &id) const
unsigned int layer(const DetId &id) const
bool SiStripQuality::put_replace ( const uint32_t &  DetId,
Range  input 
)
private

Definition at line 339 of file SiStripQuality.cc.

References SiStripBadStrip::DetRegistry::detid, SiStripBadStrip::DetRegistry::ibegin, SiStripBadStrip::DetRegistry::iend, SiStripBadStrip::indexes, LogTrace, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, sd, toCleanUp, and SiStripBadStrip::v_badstrips.

Referenced by add(), cabling(), and operator-=().

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

Definition at line 370 of file SiStripQuality.cc.

References add(), SiStripBadStrip::decode(), SiStripBadStrip::encode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), mps_fire::i, LogTrace, SiStripPI::max, min(), and SiStripBadStrip::data::range.

Referenced by clear().

370  {
373  SiStripBadStrip::data data_;
374  uint16_t BadStripPerApv[6], ipos;
375  std::vector<unsigned int> vect;
376 
377  for (; rp != rend; ++rp) {
378  uint32_t detid = rp->detid;
379 
380  BadStripPerApv[0] = 0;
381  BadStripPerApv[1] = 0;
382  BadStripPerApv[2] = 0;
383  BadStripPerApv[3] = 0;
384  BadStripPerApv[4] = 0;
385  BadStripPerApv[5] = 0;
386  ipos = 0;
387 
388  SiStripBadStrip::Range sqrange =
389  SiStripBadStrip::Range(getDataVectorBegin() + rp->ibegin, getDataVectorBegin() + rp->iend);
390 
391  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
392  data_ = decode(*(sqrange.first + it));
393  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] detid " << detid << " first strip "
394  << data_.firstStrip << " lastStrip " << data_.firstStrip + data_.range - 1 << " range "
395  << data_.range;
396  ipos = data_.firstStrip / 128;
397  while (ipos <= (data_.firstStrip + data_.range - 1) / 128) {
398  BadStripPerApv[ipos] +=
399  std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) - std::max(data_.firstStrip * 1, ipos * 128);
400  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] ipos " << ipos << " Counter "
401  << BadStripPerApv[ipos] << " min "
402  << std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) << " max "
403  << std::max(data_.firstStrip * 1, ipos * 128) << " added "
404  << std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) -
405  std::max(data_.firstStrip * 1, ipos * 128);
406  ipos++;
407  }
408  }
409 
410  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] Total for detid " << detid << " values "
411  << BadStripPerApv[0] << " " << BadStripPerApv[1] << " " << BadStripPerApv[2] << " "
412  << BadStripPerApv[3] << " " << BadStripPerApv[4] << " " << BadStripPerApv[5];
413 
414  vect.clear();
415  for (size_t i = 0; i < 6; ++i) {
416  if (BadStripPerApv[i] >= threshold * 128) {
417  vect.push_back(encode(i * 128, 128));
418  }
419  }
420  if (!vect.empty()) {
421  SiStripBadStrip::Range Range(vect.begin(), vect.end());
422  add(detid, Range);
423  }
424  }
425 }
unsigned short range
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 125 of file SiStripQuality.h.

References SiStripBadStrip::printDebug(), and printDebug_.

125 { printDebug_ = printDebug; }
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
void SiStripQuality::setUseEmptyRunInfo ( const bool  useEmptyRunInfo)
inline

Definition at line 126 of file SiStripQuality.h.

References useEmptyRunInfo_.

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

Definition at line 465 of file SiStripQuality.cc.

References subtraction().

Referenced by cabling(), and operator-=().

465  {
466  ContainerIterator it = B.begin();
467  ContainerIterator itend = B.end();
468  for (; it != itend; ++it) {
469  subtraction(A, *it);
470  }
471 }
std::vector< unsigned int >::const_iterator ContainerIterator
static const std::string B
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 473 of file SiStripQuality.cc.

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

Referenced by cabling(), and subtract().

473  {
474  SiStripBadStrip::data fs_A, fs_B, fs_m, fs_M;
475  std::vector<unsigned int> tmp;
476 
477  fs_B = decode(B);
478  ContainerIterator jt = A.begin();
479  ContainerIterator jtend = A.end();
480  for (; jt != jtend; ++jt) {
481  fs_A = decode(*jt);
482  if (B < *jt) {
483  fs_m = fs_B;
484  fs_M = fs_A;
485  } else {
486  fs_m = fs_A;
487  fs_M = fs_B;
488  }
489  // A) Verify the range to be subtracted crosses the new range
490  if (fs_m.firstStrip + fs_m.range > fs_M.firstStrip) {
491  if (*jt < B) {
492  tmp.push_back(encode(fs_A.firstStrip, fs_B.firstStrip - fs_A.firstStrip));
493  }
494  if (fs_A.firstStrip + fs_A.range > fs_B.firstStrip + fs_B.range) {
495  tmp.push_back(
496  encode(fs_B.firstStrip + fs_B.range, fs_A.firstStrip + fs_A.range - (fs_B.firstStrip + fs_B.range)));
497  }
498  } else {
499  tmp.push_back(*jt);
500  }
501  }
502  A = tmp;
503 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
static const std::string B
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 748 of file SiStripQuality.cc.

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

Referenced by add(), and cabling().

748  {
749  std::stringstream ss;
750  if (printDebug) {
751  ss << "associated to detIds : " << std::endl;
752  }
753 
754  std::vector<int>::const_iterator fedIdIt = fedsList.begin();
755  for (; fedIdIt != fedsList.end(); ++fedIdIt) {
756  std::vector<FedChannelConnection>::const_iterator fedChIt =
757  SiStripDetCabling_->fedCabling()->fedConnections(*fedIdIt).begin();
758  for (; fedChIt != SiStripDetCabling_->fedCabling()->fedConnections(*fedIdIt).end(); ++fedChIt) {
759  uint32_t detId = fedChIt->detId();
760  if (detId == 0 || detId == 0xFFFFFFFF)
761  continue;
762  uint16_t apvPairNumber = fedChIt->apvPairNumber();
763 
764  if (printDebug) {
765  printDetInfo(SiStripDetCabling_->trackerTopology(), detId, apvPairNumber, ss);
766  }
767 
768  if (turnOffStrips) {
769  // apvPairNumber == i it means that the i*256 strips are to be set off
770  std::vector<unsigned int> vect;
771  vect.push_back(encode(apvPairNumber * 256, 256));
772  SiStripBadStrip::Range Range(vect.begin(), vect.end());
773  add(detId, Range);
774  LogTrace("SiStripQuality") << "[addOffForRunInfo] adding apvPairNumber " << apvPairNumber << " for detId "
775  << detId << " off according to RunInfo" << std::endl;
776  }
777  }
778  }
779  if (printDebug) {
780  edm::LogInfo("SiStripQuality") << ss.str() << std::endl;
781  }
782 }
void add(const uint32_t &, const SiStripBadStrip::Range &)
const TrackerTopology *const trackerTopology() const
void printDetInfo(const TrackerTopology *const tTopo, const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
Prints debug output for a given detId.
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
const SiStripDetCabling * SiStripDetCabling_
#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 155 of file SiStripQuality.h.

Referenced by getFileInPath(), and SiStripQuality().

bool SiStripQuality::printDebug_
private

Definition at line 161 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 154 of file SiStripQuality.h.

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

bool SiStripQuality::useEmptyRunInfo_
private

Definition at line 162 of file SiStripQuality.h.

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