CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 > &)
 
SiStripQuality difference (const SiStripQuality &) const
 
void fillBadComponents ()
 
short getBadApvs (const uint32_t &detid) const
 
const std::vector< BadComponent > & getBadComponentList () const
 
short getBadFibers (const uint32_t &detid) 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
 
void ReduceGranularity (double)
 
void setPrintDebugOutput (const bool printDebug)
 
void setUseEmptyRunInfo (const bool useEmptyRunInfo)
 
 SiStripQuality ()=delete
 
 SiStripQuality (SiStripDetInfo)
 
 SiStripQuality (const SiStripQuality &)=default
 
 SiStripQuality (SiStripQuality &&)=default
 
 ~SiStripQuality () override=default
 
- 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
 
SiStripDetInfo info_
 
bool printDebug_
 
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 32 of file SiStripQuality.h.

Constructor & Destructor Documentation

SiStripQuality::SiStripQuality ( )
delete
SiStripQuality::SiStripQuality ( SiStripDetInfo  iInfo)
explicit

Definition at line 17 of file SiStripQuality.cc.

18  : info_(std::move(iInfo)),
19  toCleanUp(false),
20  SiStripDetCabling_(nullptr),
21  printDebug_(false),
22  useEmptyRunInfo_(false) {}
SiStripDetInfo info_
const SiStripDetCabling * SiStripDetCabling_
def move
Definition: eostools.py:511
SiStripQuality::SiStripQuality ( const SiStripQuality )
default
SiStripQuality::SiStripQuality ( SiStripQuality &&  )
default
SiStripQuality::~SiStripQuality ( )
overridedefault

Member Function Documentation

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

Definition at line 243 of file SiStripQuality.cc.

References compact(), SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::flag, SiStripDetInfo::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRange(), info_, LogTrace, put_replace(), SiStripBadStrip::data::range, sistrip::SpyUtilities::range(), and createJobs::tmp.

Referenced by add(), addInvalidConnectionFromCabling(), addNotConnectedConnectionFromCabling(), ReduceGranularity(), counter.Counter::register(), SequenceTypes.Task::remove(), SequenceTypes.Task::replace(), and turnOffFeds().

243  {
244  std::vector<unsigned int> vect, tmp;
245 
246  unsigned short Nstrips = info_.getNumberOfApvsAndStripLength(detid).first * 128;
247 
248  // Is this detid already in the collections owned by this class?
250 
251  // Append bad strips
252  tmp.clear();
253  if (range.first == range.second) {
254  LogTrace("SiStripQuality") << "new detid" << std::endl;
255  // It's a new detid
256  tmp.insert(tmp.end(), baserange.first, baserange.second);
257  std::stable_sort(tmp.begin(), tmp.end());
258  LogTrace("SiStripQuality") << "ordered" << std::endl;
259  } else {
260  LogTrace("SiStripQuality") << "already exists" << std::endl;
261  // alredy existing detid
262 
263  // if full det is bad go to next detid
264  SiStripBadStrip::data data_ = decode(*(range.first));
265  if (range.second - range.first == 1 && data_.firstStrip == 0 && data_.range >= Nstrips) {
266  LogTrace("SiStripQuality") << "full det is bad.. " << range.second - range.first << " "
267  << decode(*(range.first)).firstStrip << " " << decode(*(range.first)).range << " "
268  << decode(*(range.first)).flag << "\n"
269  << std::endl;
270  return;
271  }
272 
273  tmp.insert(tmp.end(), baserange.first, baserange.second);
274  tmp.insert(tmp.end(), range.first, range.second);
275  std::stable_sort(tmp.begin(), tmp.end());
276  LogTrace("SiStripQuality") << "ordered" << std::endl;
277  }
278  // Compact data
279  compact(tmp, vect, Nstrips);
280  SiStripBadStrip::Range newrange(vect.begin(), vect.end());
281  if (!put_replace(detid, newrange))
282  edm::LogError("SiStripQuality") << "[" << __PRETTY_FUNCTION__ << "] " << std::endl;
283 }
unsigned short range
#define LogTrace(id)
const uint16_t range(const Frame &aFrame)
SiStripDetInfo info_
void compact(unsigned int &, std::vector< unsigned int > &)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
bool put_replace(const uint32_t &DetId, Range input)
unsigned short firstStrip
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
tmp
align.sh
Definition: createJobs.py:716
data decode(const unsigned int &value) const
void SiStripQuality::add ( const SiStripBadStrip base)

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

226  {
229 
230  // the Registry already contains data
231  // Loop on detids
232  for (SiStripBadStrip::RegistryIterator basep = basebegin; basep != baseend; ++basep) {
233  uint32_t detid = basep->detid;
234  LogTrace("SiStripQuality") << "add detid " << detid << std::endl;
235 
236  SiStripBadStrip::Range baserange =
237  SiStripBadStrip::Range(base->getDataVectorBegin() + basep->ibegin, base->getDataVectorBegin() + basep->iend);
238 
239  add(detid, baserange);
240  }
241 }
void add(const uint32_t &, const SiStripBadStrip::Range &)
Registry::const_iterator RegistryIterator
#define LogTrace(id)
RegistryIterator getRegistryVectorEnd() const
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 63 of file SiStripQuality.cc.

References add(), SiStripBadStrip::encode(), SiStripDetVOff::getDetIds(), SiStripDetInfo::getNumberOfApvsAndStripLength(), info_, LogTrace, and sistrip::SpyUtilities::range().

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

63  {
64  std::vector<unsigned int> vect;
65  short firstStrip = 0;
66  short range = 0;
67 
68  // Get vector of Voff dets
69  std::vector<uint32_t> vdets;
70  Voff->getDetIds(vdets);
71  std::vector<uint32_t>::const_iterator iter = vdets.begin();
72  std::vector<uint32_t>::const_iterator iterEnd = vdets.end();
73 
74  for (; iter != iterEnd; ++iter) {
75  vect.clear();
76  range = (short)(info_.getNumberOfApvsAndStripLength(*iter).first * 128.);
77  LogTrace("SiStripQuality") << "[add Voff] add detid " << *iter << " first strip " << firstStrip << " range "
78  << range << std::endl;
79  vect.push_back(encode(firstStrip, range));
80  SiStripBadStrip::Range Range(vect.begin(), vect.end());
81  add(*iter, Range);
82  }
83 }
void add(const uint32_t &, const SiStripBadStrip::Range &)
#define LogTrace(id)
const uint16_t range(const Frame &aFrame)
SiStripDetInfo info_
void getDetIds(std::vector< uint32_t > &DetIds_) const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
std::pair< ContainerIterator, ContainerIterator > Range
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 85 of file SiStripQuality.cc.

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

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

85  {
86  bool allFedsEmpty = runInfo->m_fed_in.empty();
87  if (allFedsEmpty) {
88  std::stringstream ss;
89  ss << "WARNING: the full list of feds in RunInfo is empty. ";
90  if (useEmptyRunInfo_) {
91  ss << " SiStripQuality will still use it and all tracker will be off." << std::endl;
92  } else {
93  ss << " SiStripQuality will not use it." << std::endl;
94  }
95  edm::LogInfo("SiStripQuality") << ss.str();
96  }
97 
98  if (!allFedsEmpty || useEmptyRunInfo_) {
99  // Take the list of active feds from fedCabling
100  auto ids = SiStripDetCabling_->fedCabling()->fedIds();
101 
102  std::vector<uint16_t> activeFedsFromCabling(ids.begin(), ids.end());
103  // Take the list of active feds from RunInfo
104  std::vector<int> activeFedsFromRunInfo;
105  // Take only Tracker feds (remove all non Tracker)
106  std::remove_copy_if(
107  runInfo->m_fed_in.begin(), runInfo->m_fed_in.end(), std::back_inserter(activeFedsFromRunInfo), [&](int x) {
108  return !((x >= int(FEDNumbering::MINSiStripFEDID)) && (x <= int(FEDNumbering::MAXSiStripFEDID)));
109  });
110 
111  // Compare the two. If a fedId from RunInfo is not present in the fedCabling
112  // we need to get all the corresponding fedChannels and then the single apv
113  // pairs and use them to turn off the corresponding strips (apvNumber*256).
114  // set_difference returns the set of elements that are in the first and not
115  // in the second
116  std::sort(activeFedsFromCabling.begin(), activeFedsFromCabling.end());
117  std::sort(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end());
118  std::vector<int> differentFeds;
119  // Take the feds active for cabling but not for runInfo
120  std::set_difference(activeFedsFromCabling.begin(),
121  activeFedsFromCabling.end(),
122  activeFedsFromRunInfo.begin(),
123  activeFedsFromRunInfo.end(),
124  std::back_inserter(differentFeds));
125 
126  // IGNORE for time being.
127  // printActiveFedsInfo(activeFedsFromCabling, activeFedsFromRunInfo,
128  // differentFeds, printDebug_);
129 
130  // Feds in the differentFeds vector are now to be turned off as they are off
131  // according to RunInfo but were not off in cabling and thus are still
132  // active for the SiStripQuality. The "true" means that the strips are to be
133  // set as bad.
134  turnOffFeds(differentFeds, true, printDebug_);
135 
136  // Consistency check
137  // -----------------
138  std::vector<int> check;
139  std::set_difference(activeFedsFromRunInfo.begin(),
140  activeFedsFromRunInfo.end(),
141  activeFedsFromCabling.begin(),
142  activeFedsFromCabling.end(),
143  std::back_inserter(check));
144  // This must not happen
145  if (!check.empty()) {
146  // throw cms::Exception("LogicError")
147  edm::LogInfo("SiStripQuality") << "The cabling should always include the active feds in runInfo and "
148  "possibly have some more"
149  << "there are instead " << check.size() << " feds only active in runInfo";
150  // The "false" means that we are only printing the output, but not setting
151  // the strips as bad. The second bool means that we always want the debug
152  // output in this case.
153  turnOffFeds(check, false, true);
154  }
155  }
156 }
std::vector< int > m_fed_in
Definition: RunInfo.h:25
FedsConstIterRange fedIds() const
const SiStripDetCabling * SiStripDetCabling_
const SiStripFedCabling * fedCabling() const
Log< level::Info, false > LogInfo
void turnOffFeds(const std::vector< int > &fedsList, const bool turnOffStrips, const bool printDebug)
std::vector< std::string > set_difference(std::vector< std::string > const &v1, std::vector< std::string > const &v2)
void SiStripQuality::addInvalidConnectionFromCabling ( )

Definition at line 182 of file SiStripQuality.cc.

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

Referenced by add().

182  {
183  std::vector<uint32_t> connected_detids;
184  SiStripDetCabling_->addActiveDetectorsRawIds(connected_detids);
185  std::vector<uint32_t>::const_iterator itdet = connected_detids.begin();
186  std::vector<uint32_t>::const_iterator itdetEnd = connected_detids.end();
187  for (; itdet != itdetEnd; ++itdet) {
188  // LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] looking
189  // at detid " <<*itdet << std::endl;
190  const std::vector<const FedChannelConnection *> &fedconns = SiStripDetCabling_->getConnections(*itdet);
191  std::vector<const FedChannelConnection *>::const_iterator itconns = fedconns.begin();
192  std::vector<const FedChannelConnection *>::const_iterator itconnsEnd = fedconns.end();
193 
194  unsigned short nApvPairs = SiStripDetCabling_->nApvPairs(*itdet);
195  short ngoodConn = 0, goodConn = 0;
196  for (; itconns != itconnsEnd; ++itconns) {
197  // LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling]
198  // apvpair " << (*itconns)->apvPairNumber() << " napvpair " <<
199  // (*itconns)->nApvPairs()<< " detid " << (*itconns)->detId() <<
200  // std::endl;
201  if ((*itconns == nullptr) || ((*itconns)->nApvPairs() == sistrip::invalid_))
202  continue;
203  ngoodConn++;
204  goodConn = goodConn | (0x1 << (*itconns)->apvPairNumber());
205  }
206 
207  if (ngoodConn != nApvPairs) {
208  std::vector<unsigned int> vect;
209  for (size_t idx = 0; idx < nApvPairs; ++idx) {
210  if (!(goodConn & (0x1 << idx))) {
211  short firstStrip = idx * 256;
212  short range = 256;
213  LogTrace("SiStripQuality") << "[addInvalidConnectionFromCabling] add detid " << *itdet << "firstStrip "
214  << firstStrip << std::endl;
215  vect.push_back(encode(firstStrip, range));
216  }
217  }
218  if (!vect.empty()) {
219  SiStripBadStrip::Range Range(vect.begin(), vect.end());
220  add(*itdet, Range);
221  }
222  }
223  }
224 }
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
void add(const uint32_t &, const SiStripBadStrip::Range &)
#define LogTrace(id)
const uint16_t range(const Frame &aFrame)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
const SiStripDetCabling * SiStripDetCabling_
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 164 of file SiStripQuality.cc.

References add(), SiStripBadStrip::encode(), SiStripDetInfo::getAllData(), info_, SiStripDetCabling::IsConnected(), LogTrace, sistrip::SpyUtilities::range(), and SiStripDetCabling_.

Referenced by add().

164  {
165  auto allData = info_.getAllData();
166  auto iter = allData.begin();
167  auto iterEnd = allData.end();
168  std::vector<unsigned int> vect;
169  short firstStrip = 0;
170  short range = 0;
171  for (; iter != iterEnd; ++iter)
172  if (!SiStripDetCabling_->IsConnected(iter->first)) {
173  vect.clear();
174  range = iter->second.nApvs * 128;
175  LogTrace("SiStripQuality") << "[addNotConnectedConnectionFromCabling] add detid " << iter->first << std::endl;
176  vect.push_back(encode(firstStrip, range));
177  SiStripBadStrip::Range Range(vect.begin(), vect.end());
178  add(iter->first, Range);
179  }
180 }
void add(const uint32_t &, const SiStripBadStrip::Range &)
bool IsConnected(const uint32_t &det_id) const
#define LogTrace(id)
const uint16_t range(const Frame &aFrame)
SiStripDetInfo info_
const SiStripDetCabling * SiStripDetCabling_
const std::map< uint32_t, DetInfo > & getAllData() const noexcept
std::pair< ContainerIterator, ContainerIterator > Range
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 121 of file SiStripQuality.h.

References SiStripDetCabling_.

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

Definition at line 459 of file SiStripQuality.cc.

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

Referenced by difference().

459  {
460  if (!toCleanUp && !force)
461  return false;
462 
463  toCleanUp = false;
464 
465  std::vector<unsigned int> v_badstrips_tmp = v_badstrips;
466  std::vector<DetRegistry> indexes_tmp = indexes;
467 
468  LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] before cleanUp v_badstrips.size()= " << v_badstrips.size()
469  << " indexes.size()=" << indexes.size() << std::endl;
470 
471  v_badstrips.clear();
472  indexes.clear();
473 
474  SiStripBadStrip::RegistryIterator basebegin = indexes_tmp.begin();
475  SiStripBadStrip::RegistryIterator baseend = indexes_tmp.end();
476 
477  for (SiStripBadStrip::RegistryIterator basep = basebegin; basep != baseend; ++basep) {
478  if (basep->ibegin != basep->iend) {
479  SiStripBadStrip::Range range(v_badstrips_tmp.begin() + basep->ibegin, v_badstrips_tmp.begin() + basep->iend);
480  if (!put(basep->detid, range))
481  edm::LogError("SiStripQuality") << "[" << __PRETTY_FUNCTION__ << "] " << std::endl;
482  }
483  }
484 
485  LogTrace("SiStripQuality") << "[SiStripQuality::cleanUp] after cleanUp v_badstrips.size()= " << v_badstrips.size()
486  << " indexes.size()=" << indexes.size() << std::endl;
487  return true;
488 }
Registry::const_iterator RegistryIterator
#define LogTrace(id)
const uint16_t range(const Frame &aFrame)
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 285 of file SiStripQuality.cc.

References SiStripDetInfo::getNumberOfApvsAndStripLength(), info_, and createJobs::tmp.

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

285  {
286  std::vector<unsigned int> tmp = vect;
287  vect.clear();
288  std::stable_sort(tmp.begin(), tmp.end());
289  unsigned short Nstrips = info_.getNumberOfApvsAndStripLength(detid).first * 128;
290  compact(tmp, vect, Nstrips);
291 }
SiStripDetInfo info_
void compact(unsigned int &, std::vector< unsigned int > &)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
tmp
align.sh
Definition: createJobs.py:716
void SiStripQuality::compact ( std::vector< unsigned int > &  tmp,
std::vector< unsigned int > &  vect,
unsigned short &  Nstrips 
)
private

Definition at line 381 of file SiStripQuality.cc.

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

381  {
382  SiStripBadStrip::data fs_0, fs_1;
383  vect.clear();
384 
385  ContainerIterator it = tmp.begin();
386  fs_0 = decode(*it);
387 
388  // Check if at the module end
389  if (fs_0.firstStrip + fs_0.range >= Nstrips) {
390  vect.push_back(encode(fs_0.firstStrip, Nstrips - fs_0.firstStrip));
391  return;
392  }
393 
394  ++it;
395  for (; it != tmp.end(); ++it) {
396  fs_1 = decode(*it);
397 
398  if (fs_0.firstStrip + fs_0.range >= fs_1.firstStrip + fs_1.range) {
399  // fs_0 includes fs_1, go ahead
400  } else if (fs_0.firstStrip + fs_0.range >= fs_1.firstStrip) {
401  // contiguous or superimposed intervals
402  // Check if at the module end
403  if (fs_1.firstStrip + fs_1.range >= Nstrips) {
404  vect.push_back(encode(fs_0.firstStrip, Nstrips - fs_0.firstStrip));
405  return;
406  } else {
407  // create new fs_0
408  fs_0.range = fs_1.firstStrip + fs_1.range - fs_0.firstStrip;
409  }
410  } else {
411  // separated intervals
412  vect.push_back(encode(fs_0.firstStrip, fs_0.range));
413  fs_0 = fs_1;
414  }
415  }
416  vect.push_back(encode(fs_0.firstStrip, fs_0.range));
417 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
unsigned short firstStrip
tmp
align.sh
Definition: createJobs.py:716
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
data decode(const unsigned int &value) const
SiStripQuality SiStripQuality::difference ( const SiStripQuality other) const

Definition at line 24 of file SiStripQuality.cc.

References cleanUp(), SiStripBadStrip::decode(), fillBadComponents(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::getDataVectorBegin(), SiStripDetInfo::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRange(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), info_, put_replace(), SiStripBadStrip::data::range, sistrip::SpyUtilities::range(), and subtract().

24  {
27  std::vector<unsigned int> ovect, vect;
28  uint32_t detid;
29  unsigned short Nstrips;
30 
31  SiStripQuality retValue(*this);
32  for (SiStripBadStrip::RegistryIterator rp = rbegin; rp != rend; ++rp) {
33  detid = rp->detid;
34  Nstrips = info_.getNumberOfApvsAndStripLength(detid).first * 128;
35 
36  SiStripBadStrip::Range orange =
37  SiStripBadStrip::Range(other.getDataVectorBegin() + rp->ibegin, other.getDataVectorBegin() + rp->iend);
38 
39  // Is this detid already in the collections owned by this class?
40  SiStripBadStrip::Range range = retValue.getRange(detid);
41  if (range.first != range.second) { // yes, it is
42 
43  vect.clear();
44  ovect.clear();
45 
46  // if other full det is bad, remove det from this
47  SiStripBadStrip::data data_ = decode(*(orange.first));
48  if (orange.second - orange.first != 1 || data_.firstStrip != 0 || data_.range < Nstrips) {
49  ovect.insert(ovect.end(), orange.first, orange.second);
50  vect.insert(vect.end(), range.first, range.second);
51  retValue.subtract(vect, ovect);
52  }
53  SiStripBadStrip::Range newrange(vect.begin(), vect.end());
54  if (!retValue.put_replace(detid, newrange))
55  edm::LogError("SiStripQuality") << "[" << __PRETTY_FUNCTION__ << "] " << std::endl;
56  }
57  }
58  retValue.cleanUp();
59  retValue.fillBadComponents();
60  return retValue;
61 }
unsigned short range
Registry::const_iterator RegistryIterator
const uint16_t range(const Frame &aFrame)
SiStripDetInfo info_
RegistryIterator getRegistryVectorEnd() const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
ContainerIterator getDataVectorBegin() const
unsigned short firstStrip
RegistryIterator getRegistryVectorBegin() const
std::pair< ContainerIterator, ContainerIterator > Range
data decode(const unsigned int &value) const
void SiStripQuality::fillBadComponents ( )

Definition at line 490 of file SiStripQuality.cc.

References SiStripQuality::BadComponent::BadApvs, BadComponentVect, SiStripQuality::BadComponent::BadFibers, SiStripQuality::BadComponent::BadModule, SiStripBadStrip::decode(), SiStripQuality::BadComponent::detid, SiStripBadStrip::data::firstStrip, SiStripDetInfo::getNumberOfApvsAndStripLength(), SiStripBadStrip::indexes, info_, SiStripBadStrip::data::range, sistrip::SpyUtilities::range(), mps_fire::result, and SiStripBadStrip::v_badstrips.

Referenced by difference(), SiStripBadAPVAlgorithmFromClusterOccupancy::extractBadAPVs(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVSandStrips(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), and SiStripHitEffFromCalibTree::makeSQLite().

490  {
491  BadComponentVect.clear();
492 
493  for (SiStripBadStrip::RegistryIterator basep = indexes.begin(); basep != indexes.end(); ++basep) {
494  SiStripBadStrip::Range range(v_badstrips.begin() + basep->ibegin, v_badstrips.begin() + basep->iend);
495 
496  // Fill BadModules, BadFibers, BadApvs vectors
497  unsigned short resultA = 0, resultF = 0;
498  BadComponent result;
499 
501  unsigned short Nstrips = info_.getNumberOfApvsAndStripLength(basep->detid).first * 128;
502 
503  // BadModules
504  fs = decode(*(range.first));
505  if (basep->iend - basep->ibegin == 1 && fs.firstStrip == 0 && fs.range == Nstrips) {
506  result.detid = basep->detid;
507  result.BadModule = true;
508  result.BadFibers = (1 << (Nstrips / 256)) - 1;
509  result.BadApvs = (1 << (Nstrips / 128)) - 1;
510 
511  BadComponentVect.push_back(result);
512 
513  } else {
514  // Bad Fibers and Apvs
515  for (SiStripBadStrip::ContainerIterator it = range.first; it != range.second; ++it) {
516  fs = decode(*it);
517 
518  // BadApvs
519  for (short apvNb = 0; apvNb < 6; ++apvNb) {
520  if (fs.firstStrip <= apvNb * 128 && (apvNb + 1) * 128 <= fs.firstStrip + fs.range) {
521  resultA = resultA | (1 << apvNb);
522  }
523  }
524  // BadFibers
525  for (short fiberNb = 0; fiberNb < 3; ++fiberNb) {
526  if (fs.firstStrip <= fiberNb * 256 && (fiberNb + 1) * 256 <= fs.firstStrip + fs.range) {
527  resultF = resultF | (1 << fiberNb);
528  }
529  }
530  }
531  if (resultA != 0) {
532  result.detid = basep->detid;
533  result.BadModule = false;
534  result.BadFibers = resultF;
535  result.BadApvs = resultA;
536  BadComponentVect.push_back(result);
537  }
538  }
539  }
540 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
Registry::const_iterator RegistryIterator
std::vector< BadComponent > BadComponentVect
const uint16_t range(const Frame &aFrame)
tuple result
Definition: mps_fire.py:311
SiStripDetInfo info_
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
unsigned short firstStrip
Container v_badstrips
std::pair< ContainerIterator, ContainerIterator > Range
data decode(const unsigned int &value) const
short SiStripQuality::getBadApvs ( const uint32_t &  detid) const

Definition at line 626 of file SiStripQuality.cc.

References BadComponentVect, cuda_std::lower_bound(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by SiStripRecHitConverterAlgorithm::fillBad128StripBlocks(), and MeasurementTrackerImpl::initializeStripStatus().

626  {
627  std::vector<BadComponent>::const_iterator p = std::lower_bound(
629  if (p != BadComponentVect.end() && p->detid == detid)
630  return p->BadApvs;
631  return 0;
632 }
std::vector< BadComponent > BadComponentVect
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
const std::vector<BadComponent>& SiStripQuality::getBadComponentList ( ) const
inline
short SiStripQuality::getBadFibers ( const uint32_t &  detid) const

Definition at line 634 of file SiStripQuality.cc.

References BadComponentVect, cuda_std::lower_bound(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by SiStripRecHitConverterAlgorithm::fillBad128StripBlocks(), and MeasurementTrackerImpl::initializeStripStatus().

634  {
635  std::vector<BadComponent>::const_iterator p = std::lower_bound(
637  if (p != BadComponentVect.end() && p->detid == detid)
638  return p->BadFibers;
639  return 0;
640 }
std::vector< BadComponent > BadComponentVect
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
bool SiStripQuality::IsApvBad ( const uint32_t &  detid,
const short &  apvNb 
) const

Definition at line 574 of file SiStripQuality.cc.

References BadComponentVect, cuda_std::lower_bound(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by SiStripBadAPVAlgorithmFromClusterOccupancy::AnalyzeOccupancy(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::AnalyzeOccupancy(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), SiStripAPVRestorer::inspect(), and SiStripClusterInfo::IsApvBad().

574  {
575  std::vector<BadComponent>::const_iterator p = std::lower_bound(
577  if (p != BadComponentVect.end() && p->detid == detid)
578  return ((p->BadApvs >> apvNb) & 0x1);
579  return false;
580 }
std::vector< BadComponent > BadComponentVect
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
bool SiStripQuality::IsFiberBad ( const uint32_t &  detid,
const short &  fiberNb 
) const

Definition at line 566 of file SiStripQuality.cc.

References BadComponentVect, cuda_std::lower_bound(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by SiStripClusterInfo::IsFiberBad().

566  {
567  std::vector<BadComponent>::const_iterator p = std::lower_bound(
569  if (p != BadComponentVect.end() && p->detid == detid)
570  return ((p->BadFibers >> fiberNb) & 0x1);
571  return false;
572 }
std::vector< BadComponent > BadComponentVect
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
bool SiStripQuality::IsModuleBad ( const uint32_t &  detid) const

Definition at line 558 of file SiStripQuality.cc.

References BadComponentVect, cuda_std::lower_bound(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by MCMisalignmentScaler::analyze(), TrackerGeometryCompare::fillTree(), LargeEvents< T >::filter(), SingleMultiplicity< T >::getEvent(), SiStripClusterizerConditions::isModuleBad(), SiStripClusterInfo::IsModuleBad(), and SiStripTrackerMapCreator::setTkMapFromAlarm().

558  {
559  std::vector<BadComponent>::const_iterator p = std::lower_bound(
561  if (p != BadComponentVect.end() && p->detid == detid)
562  return p->BadModule;
563  return false;
564 }
std::vector< BadComponent > BadComponentVect
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
bool SiStripQuality::IsModuleUsable ( const uint32_t &  detid) const

Definition at line 544 of file SiStripQuality.cc.

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

Referenced by MeasurementTrackerImpl::initializeStripStatus(), SiStripClusterizerConditions::isModuleUsable(), SiStripClusterInfo::IsModuleUsable(), SiStripQualityStatistics::updateAndSave(), and SiStripRecHitConverterAlgorithm::useModule().

544  {
545  std::vector<BadComponent>::const_iterator p = std::lower_bound(
547  if (p != BadComponentVect.end() && p->detid == detid)
548  if (p->BadModule)
549  return false;
550 
551  if (SiStripDetCabling_ != nullptr)
552  if (!SiStripDetCabling_->IsConnected(detid))
553  return false;
554 
555  return true;
556 }
bool IsConnected(const uint32_t &det_id) const
std::vector< BadComponent > BadComponentVect
const SiStripDetCabling * SiStripDetCabling_
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
bool SiStripQuality::IsStripBad ( const uint32_t &  detid,
const short &  strip 
) const
bool SiStripQuality::IsStripBad ( const Range range,
const short &  strip 
) const

Definition at line 587 of file SiStripQuality.cc.

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

587  {
588  bool result = false;
590  for (SiStripBadStrip::ContainerIterator it = range.first; it != range.second; ++it) {
591  fs = decode(*it);
592  if ((fs.firstStrip <= strip) & (strip < fs.firstStrip + fs.range)) {
593  result = true;
594  break;
595  }
596  }
597  return result;
598 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
const uint16_t range(const Frame &aFrame)
tuple result
Definition: mps_fire.py:311
unsigned short firstStrip
data decode(const unsigned int &value) const
int SiStripQuality::nBadStripsOnTheLeft ( const Range range,
const short &  strip 
) const

Definition at line 600 of file SiStripQuality.cc.

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

600  {
601  int result = 0;
603  for (SiStripBadStrip::ContainerIterator it = range.first; it != range.second; ++it) {
604  fs = decode(*it);
605  if (fs.firstStrip <= strip && strip < fs.firstStrip + fs.range) {
606  result = strip - fs.firstStrip + 1;
607  break;
608  }
609  }
610  return result;
611 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
const uint16_t range(const Frame &aFrame)
tuple result
Definition: mps_fire.py:311
unsigned short firstStrip
data decode(const unsigned int &value) const
int SiStripQuality::nBadStripsOnTheRight ( const Range range,
const short &  strip 
) const

Definition at line 613 of file SiStripQuality.cc.

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

613  {
614  int result = 0;
616  for (SiStripBadStrip::ContainerIterator it = range.first; it != range.second; ++it) {
617  fs = decode(*it);
618  if (fs.firstStrip <= strip && strip < fs.firstStrip + fs.range) {
619  result = fs.firstStrip + fs.range - strip;
620  break;
621  }
622  }
623  return result;
624 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
const uint16_t range(const Frame &aFrame)
tuple result
Definition: mps_fire.py:311
unsigned short firstStrip
data decode(const unsigned int &value) const
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 676 of file SiStripQuality.cc.

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

679  {
680  std::ostringstream ss;
681 
682  if (printDebug) {
683  ss << "activeFedsFromCabling:" << std::endl;
684  std::copy(activeFedsFromCabling.begin(), activeFedsFromCabling.end(), std::ostream_iterator<uint16_t>(ss, " "));
685  ss << std::endl;
686  ss << "activeFedsFromRunInfo:" << std::endl;
687  std::copy(activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(), std::ostream_iterator<int>(ss, " "));
688  ss << std::endl;
689  }
690  if (differentFeds.size() != 440) {
691  ss << "differentFeds : " << std::endl;
692  std::copy(differentFeds.begin(), differentFeds.end(), std::ostream_iterator<int>(ss, " "));
693  ss << std::endl;
694  } else {
695  ss << "There are 440 feds (all) active for Cabling but off for RunInfo. "
696  "Tracker was probably not in this run"
697  << std::endl;
698  }
699  edm::LogInfo("SiStripQuality") << ss.str() << std::endl;
700 }
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Log< level::Info, false > LogInfo
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 642 of file SiStripQuality.cc.

References phase1PixelTopology::layer, 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 turnOffFeds().

645  {
646  std::string subDetName;
647  DetId detid(detId);
648  int layer = tTopo->layer(detid);
649  int stereo = 0;
650  switch (detid.subdetId()) {
651  case StripSubdetector::TIB: {
652  stereo = tTopo->tibIsStereo(detid);
653  subDetName = "TIB";
654  break;
655  }
656  case StripSubdetector::TOB: {
657  stereo = tTopo->tobIsStereo(detid);
658  subDetName = "TOB";
659  break;
660  }
661  case StripSubdetector::TEC: {
662  stereo = tTopo->tecIsStereo(detid);
663  subDetName = "TEC";
664  break;
665  }
666  case StripSubdetector::TID: {
667  stereo = tTopo->tidIsStereo(detid);
668  subDetName = "TID";
669  break;
670  }
671  }
672  ss << detId << " and apv = " << apvPairNumber << " of subDet = " << subDetName << ", layer = " << layer
673  << " stereo = " << stereo << std::endl;
674 }
static constexpr auto TEC
bool tobIsStereo(const DetId &id) const
bool tidIsStereo(const DetId &id) const
constexpr std::array< uint8_t, layerIndexSize > layer
bool tecIsStereo(const DetId &id) const
static constexpr auto TOB
Definition: DetId.h:17
static constexpr auto TIB
bool tibIsStereo(const DetId &id) const
unsigned int layer(const DetId &id) const
static constexpr auto TID
bool SiStripQuality::put_replace ( const uint32_t &  DetId,
Range  input 
)
private

Definition at line 293 of file SiStripQuality.cc.

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

Referenced by add(), and difference().

293  {
294  // put in SiStripQuality::v_badstrips of DetId
295  Registry::iterator p = std::lower_bound(indexes.begin(), indexes.end(), DetId, SiStripBadStrip::StrictWeakOrdering());
296 
297  size_t sd = input.second - input.first;
298  DetRegistry detregistry;
299  detregistry.detid = DetId;
300  detregistry.ibegin = v_badstrips.size();
301  detregistry.iend = v_badstrips.size() + sd;
302 
303  v_badstrips.insert(v_badstrips.end(), input.first, input.second);
304 
305  if (p != indexes.end() && p->detid == DetId) {
306  LogTrace("SiStripQuality") << "[SiStripQuality::put_replace] Replacing "
307  "SiStripQuality for already stored DetID "
308  << DetId << std::endl;
309  toCleanUp = true;
310  *p = detregistry;
311  } else {
312  indexes.insert(p, detregistry);
313  }
314 
315  return true;
316 }
#define LogTrace(id)
static std::string const input
Definition: EdmProvDump.cc:47
Definition: DetId.h:17
Container v_badstrips
double sd
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
void SiStripQuality::ReduceGranularity ( double  threshold)

Definition at line 324 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.

324  {
327  SiStripBadStrip::data data_;
328  uint16_t BadStripPerApv[6], ipos;
329  std::vector<unsigned int> vect;
330 
331  for (; rp != rend; ++rp) {
332  uint32_t detid = rp->detid;
333 
334  BadStripPerApv[0] = 0;
335  BadStripPerApv[1] = 0;
336  BadStripPerApv[2] = 0;
337  BadStripPerApv[3] = 0;
338  BadStripPerApv[4] = 0;
339  BadStripPerApv[5] = 0;
340  ipos = 0;
341 
342  SiStripBadStrip::Range sqrange =
343  SiStripBadStrip::Range(getDataVectorBegin() + rp->ibegin, getDataVectorBegin() + rp->iend);
344 
345  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
346  data_ = decode(*(sqrange.first + it));
347  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] detid " << detid << " first strip "
348  << data_.firstStrip << " lastStrip " << data_.firstStrip + data_.range - 1 << " range "
349  << data_.range;
350  ipos = data_.firstStrip / 128;
351  while (ipos <= (data_.firstStrip + data_.range - 1) / 128) {
352  BadStripPerApv[ipos] +=
353  std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) - std::max(data_.firstStrip * 1, ipos * 128);
354  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] ipos " << ipos << " Counter "
355  << BadStripPerApv[ipos] << " min "
356  << std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) << " max "
357  << std::max(data_.firstStrip * 1, ipos * 128) << " added "
358  << std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) -
359  std::max(data_.firstStrip * 1, ipos * 128);
360  ipos++;
361  }
362  }
363 
364  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] Total for detid " << detid << " values "
365  << BadStripPerApv[0] << " " << BadStripPerApv[1] << " " << BadStripPerApv[2] << " "
366  << BadStripPerApv[3] << " " << BadStripPerApv[4] << " " << BadStripPerApv[5];
367 
368  vect.clear();
369  for (size_t i = 0; i < 6; ++i) {
370  if (BadStripPerApv[i] >= threshold * 128) {
371  vect.push_back(encode(i * 128, 128));
372  }
373  }
374  if (!vect.empty()) {
375  SiStripBadStrip::Range Range(vect.begin(), vect.end());
376  add(detid, Range);
377  }
378  }
379 }
unsigned short range
void add(const uint32_t &, const SiStripBadStrip::Range &)
Registry::const_iterator RegistryIterator
#define LogTrace(id)
RegistryIterator getRegistryVectorEnd() const
T min(T a, T b)
Definition: MathUtil.h:58
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 118 of file SiStripQuality.h.

References SiStripBadStrip::printDebug(), and printDebug_.

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

Definition at line 119 of file SiStripQuality.h.

References useEmptyRunInfo_.

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

Definition at line 419 of file SiStripQuality.cc.

References subtraction().

Referenced by difference().

419  {
420  ContainerIterator it = B.begin();
421  ContainerIterator itend = B.end();
422  for (; it != itend; ++it) {
423  subtraction(A, *it);
424  }
425 }
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 427 of file SiStripQuality.cc.

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

Referenced by subtract().

427  {
428  SiStripBadStrip::data fs_A, fs_B, fs_m, fs_M;
429  std::vector<unsigned int> tmp;
430 
431  fs_B = decode(B);
432  ContainerIterator jt = A.begin();
433  ContainerIterator jtend = A.end();
434  for (; jt != jtend; ++jt) {
435  fs_A = decode(*jt);
436  if (B < *jt) {
437  fs_m = fs_B;
438  fs_M = fs_A;
439  } else {
440  fs_m = fs_A;
441  fs_M = fs_B;
442  }
443  // A) Verify the range to be subtracted crosses the new range
444  if (fs_m.firstStrip + fs_m.range > fs_M.firstStrip) {
445  if (*jt < B) {
446  tmp.push_back(encode(fs_A.firstStrip, fs_B.firstStrip - fs_A.firstStrip));
447  }
448  if (fs_A.firstStrip + fs_A.range > fs_B.firstStrip + fs_B.range) {
449  tmp.push_back(
450  encode(fs_B.firstStrip + fs_B.range, fs_A.firstStrip + fs_A.range - (fs_B.firstStrip + fs_B.range)));
451  }
452  } else {
453  tmp.push_back(*jt);
454  }
455  }
456  A = tmp;
457 }
unsigned short range
std::vector< unsigned int >::const_iterator ContainerIterator
static const std::string B
unsigned short firstStrip
tmp
align.sh
Definition: createJobs.py:716
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 702 of file SiStripQuality.cc.

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

Referenced by add().

702  {
703  std::stringstream ss;
704  if (printDebug) {
705  ss << "associated to detIds : " << std::endl;
706  }
707 
708  std::vector<int>::const_iterator fedIdIt = fedsList.begin();
709  for (; fedIdIt != fedsList.end(); ++fedIdIt) {
710  std::vector<FedChannelConnection>::const_iterator fedChIt =
711  SiStripDetCabling_->fedCabling()->fedConnections(*fedIdIt).begin();
712  for (; fedChIt != SiStripDetCabling_->fedCabling()->fedConnections(*fedIdIt).end(); ++fedChIt) {
713  uint32_t detId = fedChIt->detId();
714  if (detId == 0 || detId == 0xFFFFFFFF)
715  continue;
716  uint16_t apvPairNumber = fedChIt->apvPairNumber();
717 
718  if (printDebug) {
719  printDetInfo(SiStripDetCabling_->trackerTopology(), detId, apvPairNumber, ss);
720  }
721 
722  if (turnOffStrips) {
723  // apvPairNumber == i it means that the i*256 strips are to be set off
724  std::vector<unsigned int> vect;
725  vect.push_back(encode(apvPairNumber * 256, 256));
726  SiStripBadStrip::Range Range(vect.begin(), vect.end());
727  add(detId, Range);
728  LogTrace("SiStripQuality") << "[addOffForRunInfo] adding apvPairNumber " << apvPairNumber << " for detId "
729  << detId << " off according to RunInfo" << std::endl;
730  }
731  }
732  }
733  if (printDebug) {
734  edm::LogInfo("SiStripQuality") << ss.str() << std::endl;
735  }
736 }
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.
#define LogTrace(id)
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
const SiStripDetCabling * SiStripDetCabling_
const SiStripFedCabling * fedCabling() const
Log< level::Info, false > LogInfo
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
SiStripDetInfo SiStripQuality::info_
private
bool SiStripQuality::printDebug_
private

Definition at line 152 of file SiStripQuality.h.

Referenced by add(), and setPrintDebugOutput().

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

Definition at line 148 of file SiStripQuality.h.

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

bool SiStripQuality::useEmptyRunInfo_
private

Definition at line 153 of file SiStripQuality.h.

Referenced by add(), and setUseEmptyRunInfo().