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 (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 (uint32_t detid, std::vector< unsigned int > &)
 
SiStripQuality difference (const SiStripQuality &) const
 
void fillBadComponents ()
 
short getBadApvs (uint32_t detid) const
 
const std::vector< BadComponent > & getBadComponentList () const
 
short getBadFibers (uint32_t detid) const
 
bool IsApvBad (uint32_t detid, short apvNb) const
 
bool IsFiberBad (uint32_t detid, short fiberNb) const
 
bool IsModuleBad (uint32_t detid) const
 
bool IsModuleUsable (uint32_t detid) const
 
bool IsStripBad (uint32_t detid, short strip) const
 
bool IsStripBad (const Range &range, short strip) const
 
int nBadStripsOnTheLeft (const Range &range, short strip) const
 
int nBadStripsOnTheRight (const Range &range, 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
 
data decodePhase2 (const unsigned int &value) const
 
unsigned int encode (const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
 
unsigned int encodePhase2 (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, uint32_t detId, uint32_t apvPairNumber, std::stringstream &ss)
 Prints debug output for a given detId. More...
 
bool put_replace (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, 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 32 of file SiStripQuality.h.

Constructor & Destructor Documentation

◆ SiStripQuality() [1/4]

SiStripQuality::SiStripQuality ( )
delete

◆ SiStripQuality() [2/4]

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(src, dest)
Definition: eostools.py:511

◆ SiStripQuality() [3/4]

SiStripQuality::SiStripQuality ( const SiStripQuality )
default

◆ SiStripQuality() [4/4]

SiStripQuality::SiStripQuality ( SiStripQuality &&  )
default

◆ ~SiStripQuality()

SiStripQuality::~SiStripQuality ( )
overridedefault

Member Function Documentation

◆ add() [1/5]

void SiStripQuality::add ( 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(), FastTimerService_cff::range, SiStripBadStrip::data::range, and createJobs::tmp.

Referenced by add(), addInvalidConnectionFromCabling(), addNotConnectedConnectionFromCabling(), ReduceGranularity(), counter.Counter::register(), SequenceTypes._TaskBase::remove(), SequenceTypes._TaskBase::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
const Range getRange(const uint32_t detID) const
#define LogTrace(id)
SiStripDetInfo info_
void compact(uint32_t detid, std::vector< unsigned int > &)
unsigned short firstStrip
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
bool put_replace(uint32_t detId, Range input)
std::pair< ContainerIterator, ContainerIterator > Range
data decode(const unsigned int &value) const
tmp
align.sh
Definition: createJobs.py:716

◆ add() [2/5]

void SiStripQuality::add ( const SiStripBadStrip base)

Definition at line 226 of file SiStripQuality.cc.

References add(), newFWLiteAna::base, and LogTrace.

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

226  {
227  SiStripBadStrip::RegistryIterator basebegin = base->getRegistryVectorBegin();
228  SiStripBadStrip::RegistryIterator baseend = base->getRegistryVectorEnd();
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 }
base
Main Program
Definition: newFWLiteAna.py:92
Registry::const_iterator RegistryIterator
void add(uint32_t, const SiStripBadStrip::Range &)
#define LogTrace(id)
std::pair< ContainerIterator, ContainerIterator > Range

◆ add() [3/5]

void SiStripQuality::add ( const SiStripDetCabling cab)

◆ add() [4/5]

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 FastTimerService_cff::range.

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::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 getDetIds(std::vector< uint32_t > &DetIds_) const
void add(uint32_t, const SiStripBadStrip::Range &)
#define LogTrace(id)
SiStripDetInfo info_
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)

◆ add() [5/5]

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 RPCNoise_example::check, SiStripDetCabling::fedCabling(), SiStripFedCabling::fedIds(), createfilelist::int, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, printDebug_, submitPVValidationJobs::runInfo, DBoxMetadataHelper::set_difference(), SiStripDetCabling_, jetUpdater_cfi::sort, contentValuesCheck::ss, turnOffFeds(), useEmptyRunInfo_, and x.

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::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) {
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 }
const SiStripFedCabling * fedCabling() const
const SiStripDetCabling * SiStripDetCabling_
Log< level::Info, false > LogInfo
void turnOffFeds(const std::vector< int > &fedsList, const bool turnOffStrips, const bool printDebug)
FedsConstIterRange fedIds() const
std::vector< std::string > set_difference(std::vector< std::string > const &v1, std::vector< std::string > const &v2)

◆ addInvalidConnectionFromCabling()

void SiStripQuality::addInvalidConnectionFromCabling ( )

Definition at line 182 of file SiStripQuality.cc.

References add(), SiStripDetCabling::addActiveDetectorsRawIds(), SiStripBadStrip::encode(), SiStripDetCabling::getConnections(), heavyIonCSV_trainingSettings::idx, sistrip::invalid_, LogTrace, SiStripDetCabling::nApvPairs(), FastTimerService_cff::range, SiStripDetCabling_, and testProducerWithPsetDescEmpty_cfi::x1.

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 }
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
void add(uint32_t, const SiStripBadStrip::Range &)
#define LogTrace(id)
const SiStripDetCabling * SiStripDetCabling_
static const uint16_t invalid_
Definition: Constants.h:16
std::pair< ContainerIterator, ContainerIterator > Range
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
const uint16_t nApvPairs(uint32_t det_id) const
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const

◆ addNotConnectedConnectionFromCabling()

void SiStripQuality::addNotConnectedConnectionFromCabling ( )

Definition at line 164 of file SiStripQuality.cc.

References add(), SiStripBadStrip::encode(), SiStripDetInfo::getAllData(), info_, SiStripDetCabling::IsConnected(), LogTrace, FastTimerService_cff::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 }
bool IsConnected(const uint32_t &det_id) const
void add(uint32_t, const SiStripBadStrip::Range &)
#define LogTrace(id)
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)

◆ cabling()

SiStripDetCabling const* SiStripQuality::cabling ( ) const
inline

Definition at line 121 of file SiStripQuality.h.

References SiStripDetCabling_.

121 { return SiStripDetCabling_; }
const SiStripDetCabling * SiStripDetCabling_

◆ cleanUp()

bool SiStripQuality::cleanUp ( bool  force = false)

Definition at line 458 of file SiStripQuality.cc.

References cmsStageWithFailover::force, SiStripBadStrip::indexes, LogTrace, SiStripBadStrip::put(), FastTimerService_cff::range, toCleanUp, and SiStripBadStrip::v_badstrips.

Referenced by difference().

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

◆ clear()

void SiStripQuality::clear ( void  )
inline

◆ compact() [1/2]

void SiStripQuality::compact ( uint32_t  detid,
std::vector< unsigned int > &  vect 
)

Definition at line 285 of file SiStripQuality.cc.

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

Referenced by add(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), SiStripHitResolFromCalibTree::makeSQLite(), 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(uint32_t detid, std::vector< unsigned int > &)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
tmp
align.sh
Definition: createJobs.py:716

◆ compact() [2/2]

void SiStripQuality::compact ( std::vector< unsigned int > &  tmp,
std::vector< unsigned int > &  vect,
unsigned short &  Nstrips 
)
private

Definition at line 380 of file SiStripQuality.cc.

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

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

◆ difference()

SiStripQuality SiStripQuality::difference ( const SiStripQuality other) const

Definition at line 24 of file SiStripQuality.cc.

References cleanUp(), SiStripBadStrip::decode(), fillBadComponents(), SiStripBadStrip::data::firstStrip, SiStripDetInfo::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRange(), info_, trackingPlots::other, put_replace(), FastTimerService_cff::range, SiStripBadStrip::data::range, and subtract().

24  {
25  SiStripBadStrip::RegistryIterator rbegin = other.getRegistryVectorBegin();
26  SiStripBadStrip::RegistryIterator rend = other.getRegistryVectorEnd();
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
SiStripDetInfo info_
unsigned short firstStrip
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
std::pair< ContainerIterator, ContainerIterator > Range
data decode(const unsigned int &value) const

◆ fillBadComponents()

void SiStripQuality::fillBadComponents ( )

Definition at line 489 of file SiStripQuality.cc.

References BadComponentVect, SiStripBadStrip::decode(), compareTotals::fs, SiStripDetInfo::getNumberOfApvsAndStripLength(), SiStripBadStrip::indexes, info_, FastTimerService_cff::range, mps_fire::result, and SiStripBadStrip::v_badstrips.

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

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

◆ getBadApvs()

short SiStripQuality::getBadApvs ( uint32_t  detid) const

◆ getBadComponentList()

const std::vector<BadComponent>& SiStripQuality::getBadComponentList ( ) const
inline

◆ getBadFibers()

short SiStripQuality::getBadFibers ( uint32_t  detid) const

◆ IsApvBad()

bool SiStripQuality::IsApvBad ( uint32_t  detid,
short  apvNb 
) const

◆ IsFiberBad()

bool SiStripQuality::IsFiberBad ( uint32_t  detid,
short  fiberNb 
) const

Definition at line 565 of file SiStripQuality.cc.

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

Referenced by SiStripClusterInfo::IsFiberBad().

565  {
566  std::vector<BadComponent>::const_iterator p = std::lower_bound(
568  if (p != BadComponentVect.end() && p->detid == detid)
569  return ((p->BadFibers >> fiberNb) & 0x1);
570  return false;
571 }
std::vector< BadComponent > BadComponentVect

◆ IsModuleBad()

bool SiStripQuality::IsModuleBad ( uint32_t  detid) const

◆ IsModuleUsable()

bool SiStripQuality::IsModuleUsable ( uint32_t  detid) const

Definition at line 543 of file SiStripQuality.cc.

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

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

543  {
544  std::vector<BadComponent>::const_iterator p = std::lower_bound(
546  if (p != BadComponentVect.end() && p->detid == detid)
547  if (p->BadModule)
548  return false;
549 
550  if (SiStripDetCabling_ != nullptr)
551  if (!SiStripDetCabling_->IsConnected(detid))
552  return false;
553 
554  return true;
555 }
bool IsConnected(const uint32_t &det_id) const
std::vector< BadComponent > BadComponentVect
const SiStripDetCabling * SiStripDetCabling_

◆ IsStripBad() [1/2]

bool SiStripQuality::IsStripBad ( uint32_t  detid,
short  strip 
) const

◆ IsStripBad() [2/2]

bool SiStripQuality::IsStripBad ( const Range range,
short  strip 
) const

Definition at line 586 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), compareTotals::fs, FastTimerService_cff::range, mps_fire::result, and digitizers_cfi::strip.

586  {
587  bool result = false;
589  for (SiStripBadStrip::ContainerIterator it = range.first; it != range.second; ++it) {
590  fs = decode(*it);
591  if ((fs.firstStrip <= strip) & (strip < fs.firstStrip + fs.range)) {
592  result = true;
593  break;
594  }
595  }
596  return result;
597 }
std::vector< unsigned int >::const_iterator ContainerIterator
data decode(const unsigned int &value) const

◆ nBadStripsOnTheLeft()

int SiStripQuality::nBadStripsOnTheLeft ( const Range range,
short  strip 
) const

Definition at line 599 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), compareTotals::fs, FastTimerService_cff::range, mps_fire::result, and digitizers_cfi::strip.

599  {
600  int result = 0;
602  for (SiStripBadStrip::ContainerIterator it = range.first; it != range.second; ++it) {
603  fs = decode(*it);
604  if (fs.firstStrip <= strip && strip < fs.firstStrip + fs.range) {
605  result = strip - fs.firstStrip + 1;
606  break;
607  }
608  }
609  return result;
610 }
std::vector< unsigned int >::const_iterator ContainerIterator
data decode(const unsigned int &value) const

◆ nBadStripsOnTheRight()

int SiStripQuality::nBadStripsOnTheRight ( const Range range,
short  strip 
) const

Definition at line 612 of file SiStripQuality.cc.

References SiStripBadStrip::decode(), compareTotals::fs, FastTimerService_cff::range, mps_fire::result, and digitizers_cfi::strip.

612  {
613  int result = 0;
615  for (SiStripBadStrip::ContainerIterator it = range.first; it != range.second; ++it) {
616  fs = decode(*it);
617  if (fs.firstStrip <= strip && strip < fs.firstStrip + fs.range) {
618  result = fs.firstStrip + fs.range - strip;
619  break;
620  }
621  }
622  return result;
623 }
std::vector< unsigned int >::const_iterator ContainerIterator
data decode(const unsigned int &value) const

◆ printActiveFedsInfo()

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 675 of file SiStripQuality.cc.

References filterCSVwithJSON::copy, SiStripBadStrip::printDebug(), and contentValuesCheck::ss.

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

◆ printDetInfo()

void SiStripQuality::printDetInfo ( const TrackerTopology *const  tTopo,
uint32_t  detId,
uint32_t  apvPairNumber,
std::stringstream &  ss 
)
private

Prints debug output for a given detId.

Definition at line 641 of file SiStripQuality.cc.

References pixelTopology::layer, TrackerTopology::layer(), contentValuesCheck::ss, 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().

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

◆ put_replace()

bool SiStripQuality::put_replace ( 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, input, LogTrace, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, 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:50
Definition: DetId.h:17
Container v_badstrips

◆ ReduceGranularity()

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, SiStripPI::min, SiStripBadStrip::data::range, and remoteMonitoring_LASER_era2018_cfg::threshold.

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 
341  SiStripBadStrip::Range sqrange =
342  SiStripBadStrip::Range(getDataVectorBegin() + rp->ibegin, getDataVectorBegin() + rp->iend);
343 
344  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
345  data_ = decode(*(sqrange.first + it));
346  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] detid " << detid << " first strip "
347  << data_.firstStrip << " lastStrip " << data_.firstStrip + data_.range - 1 << " range "
348  << data_.range;
349  ipos = data_.firstStrip / 128;
350  while (ipos <= (data_.firstStrip + data_.range - 1) / 128) {
351  BadStripPerApv[ipos] +=
352  std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) - std::max(data_.firstStrip * 1, ipos * 128);
353  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] ipos " << ipos << " Counter "
354  << BadStripPerApv[ipos] << " min "
355  << std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) << " max "
356  << std::max(data_.firstStrip * 1, ipos * 128) << " added "
357  << std::min(data_.firstStrip + data_.range, (ipos + 1) * 128) -
358  std::max(data_.firstStrip * 1, ipos * 128);
359  ipos++;
360  }
361  }
362 
363  LogTrace("SiStripQuality") << "[SiStripQuality::ReduceGranularity] Total for detid " << detid << " values "
364  << BadStripPerApv[0] << " " << BadStripPerApv[1] << " " << BadStripPerApv[2] << " "
365  << BadStripPerApv[3] << " " << BadStripPerApv[4] << " " << BadStripPerApv[5];
366 
367  vect.clear();
368  for (size_t i = 0; i < 6; ++i) {
369  if (BadStripPerApv[i] >= threshold * 128) {
370  vect.push_back(encode(i * 128, 128));
371  }
372  }
373  if (!vect.empty()) {
374  SiStripBadStrip::Range Range(vect.begin(), vect.end());
375  add(detid, Range);
376  }
377  }
378 }
unsigned short range
ContainerIterator getDataVectorBegin() const
Registry::const_iterator RegistryIterator
void add(uint32_t, const SiStripBadStrip::Range &)
#define LogTrace(id)
RegistryIterator getRegistryVectorEnd() const
unsigned short firstStrip
std::pair< ContainerIterator, ContainerIterator > Range
data decode(const unsigned int &value) const
RegistryIterator getRegistryVectorBegin() const
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)

◆ setPrintDebugOutput()

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

◆ setUseEmptyRunInfo()

void SiStripQuality::setUseEmptyRunInfo ( const bool  useEmptyRunInfo)
inline

Definition at line 119 of file SiStripQuality.h.

References useEmptyRunInfo_.

119 { useEmptyRunInfo_ = useEmptyRunInfo; }

◆ subtract()

void SiStripQuality::subtract ( std::vector< unsigned int > &  A,
const std::vector< unsigned int > &  B 
)
private

Definition at line 418 of file SiStripQuality.cc.

References A, B, and subtraction().

Referenced by difference().

418  {
419  ContainerIterator it = B.begin();
420  ContainerIterator itend = B.end();
421  for (; it != itend; ++it) {
422  subtraction(A, *it);
423  }
424 }
Definition: APVGainStruct.h:7
std::vector< unsigned int >::const_iterator ContainerIterator
void subtraction(std::vector< unsigned int > &, const unsigned int &)
Definition: APVGainStruct.h:7

◆ subtraction()

void SiStripQuality::subtraction ( std::vector< unsigned int > &  A,
const unsigned int &  B 
)
private

Definition at line 426 of file SiStripQuality.cc.

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

Referenced by subtract().

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

◆ turnOffFeds()

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 701 of file SiStripQuality.cc.

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

Referenced by add().

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

Member Data Documentation

◆ BadComponentVect

std::vector<BadComponent> SiStripQuality::BadComponentVect
private

◆ info_

SiStripDetInfo SiStripQuality::info_
private

◆ printDebug_

bool SiStripQuality::printDebug_
private

Definition at line 149 of file SiStripQuality.h.

Referenced by add(), and setPrintDebugOutput().

◆ SiStripDetCabling_

const SiStripDetCabling* SiStripQuality::SiStripDetCabling_
private

◆ toCleanUp

bool SiStripQuality::toCleanUp
private

Definition at line 145 of file SiStripQuality.h.

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

◆ useEmptyRunInfo_

bool SiStripQuality::useEmptyRunInfo_
private

Definition at line 150 of file SiStripQuality.h.

Referenced by add(), and setUseEmptyRunInfo().