CMS 3D CMS Logo

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

#include <SiStripQuality.cc>

Inheritance diagram for SiStripQuality:
SiStripBadStrip

Classes

struct  BadComponent
 
class  BadComponentStrictWeakOrdering
 

Public Member Functions

void add (const uint32_t &, const SiStripBadStrip::Range &)
 
void add (const SiStripBadStrip *)
 
void add (const SiStripDetCabling *)
 
void add (const SiStripDetVOff *)
 
void add (const RunInfo *)
 
void addInvalidConnectionFromCabling ()
 
void addNotConnectedConnectionFromCabling ()
 
SiStripDetCabling const * cabling () const
 
bool cleanUp (bool force=false)
 
void clear ()
 
void compact (unsigned int &, std::vector< unsigned int > &)
 
void fillBadComponents ()
 
short getBadApvs (const uint32_t &detid) const
 
const std::vector< BadComponent > & getBadComponentList () const
 
short getBadFibers (const uint32_t &detid) const
 
edm::FileInPath getFileInPath () const
 
bool IsApvBad (const uint32_t &detid, const short &apvNb) const
 
bool IsFiberBad (const uint32_t &detid, const short &fiberNb) const
 
bool IsModuleBad (const uint32_t &detid) const
 
bool IsModuleUsable (const uint32_t &detid) const
 
bool IsStripBad (const uint32_t &detid, const short &strip) const
 
bool IsStripBad (const Range &range, const short &strip) const
 
int nBadStripsOnTheLeft (const Range &range, const short &strip) const
 
int nBadStripsOnTheRight (const Range &range, const short &strip) const
 
bool operator!= (const SiStripQuality &) const
 
SiStripQualityoperator+= (const SiStripQuality &)
 
const SiStripQuality operator- (const SiStripQuality &) const
 
SiStripQualityoperator-= (const SiStripQuality &)
 
bool operator== (const SiStripQuality &) const
 
void ReduceGranularity (double)
 
void setPrintDebugOutput (const bool printDebug)
 
void setUseEmptyRunInfo (const bool useEmptyRunInfo)
 
 SiStripQuality ()
 
 SiStripQuality (edm::FileInPath &)
 
 SiStripQuality (const SiStripQuality &)
 
 ~SiStripQuality ()
 
- Public Member Functions inherited from SiStripBadStrip
data decode (const unsigned int &value) const
 
unsigned int encode (const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
 
ContainerIterator getDataVectorBegin () const
 
ContainerIterator getDataVectorEnd () const
 
void getDetIds (std::vector< uint32_t > &DetIds_) const
 
const Range getRange (const uint32_t detID) const
 
Range getRangeByPos (unsigned short pos) const
 
RegistryIterator getRegistryVectorBegin () const
 
RegistryIterator getRegistryVectorEnd () const
 
void printDebug (std::stringstream &ss) const
 
void printSummary (std::stringstream &ss) const
 
bool put (const uint32_t &detID, const InputVector &vect)
 
bool put (const uint32_t &detID, Range input)
 
 SiStripBadStrip ()
 
 SiStripBadStrip (const SiStripBadStrip &orig)
 
virtual ~SiStripBadStrip ()
 

Private Member Functions

void compact (std::vector< unsigned int > &, std::vector< unsigned int > &, unsigned short &)
 
void printActiveFedsInfo (const std::vector< uint16_t > &activeFedsFromCabling, const std::vector< int > &activeFedsFromRunInfo, const std::vector< int > &differentFeds, const bool printDebug)
 Prints debug output for the active feds comparing the list in RunInfo and FedCabling. More...
 
void printDetInfo (const TrackerTopology *const tTopo, const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
 Prints debug output for a given detId. More...
 
bool put_replace (const uint32_t &DetId, Range input)
 
void subtract (std::vector< unsigned int > &, const std::vector< unsigned int > &)
 
void subtraction (std::vector< unsigned int > &, const unsigned int &)
 
void turnOffFeds (const std::vector< int > &fedsList, const bool turnOffStrips, const bool printDebug)
 

Private Attributes

std::vector< BadComponentBadComponentVect
 
edm::FileInPath FileInPath_
 
bool printDebug_
 
SiStripDetInfoFileReaderreader
 
const SiStripDetCablingSiStripDetCabling_
 
bool toCleanUp
 
bool useEmptyRunInfo_
 

Additional Inherited Members

- Public Types inherited from SiStripBadStrip
typedef std::vector< unsigned int > Container
 
typedef std::vector< unsigned
int >::const_iterator 
ContainerIterator
 
typedef Container InputVector
 
typedef std::pair
< ContainerIterator,
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 35 of file SiStripQuality.h.

Constructor & Destructor Documentation

SiStripQuality::SiStripQuality ( )

Definition at line 21 of file SiStripQuality.cc.

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

Referenced by operator-().

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

Definition at line 31 of file SiStripQuality.cc.

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

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

Definition at line 36 of file SiStripQuality.cc.

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

37 {
40  toCleanUp=other.toCleanUp;
41  indexes=other.indexes;
47 }
std::vector< BadComponent > BadComponentVect
const SiStripDetCabling * SiStripDetCabling_
Container v_badstrips
SiStripDetInfoFileReader * reader
edm::FileInPath FileInPath_
SiStripQuality::~SiStripQuality ( )

Definition at line 49 of file SiStripQuality.cc.

References LogTrace, and reader.

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

Member Function Documentation

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

Definition at line 292 of file SiStripQuality.cc.

References compact(), SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::flag, SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRange(), LogTrace, put_replace(), SiStripBadStrip::data::range, reader, and tmp.

Referenced by add(), addInvalidConnectionFromCabling(), addNotConnectedConnectionFromCabling(), operator+=(), ReduceGranularity(), counter.Counter::register(), and turnOffFeds().

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

Definition at line 275 of file SiStripQuality.cc.

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

Referenced by counter.Counter::register().

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

Definition at line 209 of file SiStripQuality.cc.

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

Referenced by counter.Counter::register().

210 {
211  SiStripDetCabling_=cab;
214 }
void addInvalidConnectionFromCabling()
const SiStripDetCabling * SiStripDetCabling_
void addNotConnectedConnectionFromCabling()
void SiStripQuality::add ( const SiStripDetVOff Voff)

Definition at line 118 of file SiStripQuality.cc.

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

Referenced by counter.Counter::register().

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

Used to get the cabling from RunInfo.
It compares the feds from cabling with those from runInfo and it turns off all the strips associated to feds that are off for the RunInfo but not for FedCabling.

Definition at line 140 of file SiStripQuality.cc.

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

Referenced by counter.Counter::register().

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

Definition at line 235 of file SiStripQuality.cc.

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

Referenced by add().

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

Definition at line 216 of file SiStripQuality.cc.

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

Referenced by add().

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

Definition at line 128 of file SiStripQuality.h.

References SiStripDetCabling_.

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

Definition at line 498 of file SiStripQuality.cc.

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

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

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

Definition at line 334 of file SiStripQuality.cc.

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

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

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

Definition at line 418 of file SiStripQuality.cc.

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

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

Definition at line 528 of file SiStripQuality.cc.

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

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

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

Definition at line 673 of file SiStripQuality.cc.

References BadComponentVect, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by MeasurementTrackerImpl::initializeStripStatus().

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

Definition at line 120 of file SiStripQuality.h.

References BadComponentVect.

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

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

Definition at line 681 of file SiStripQuality.cc.

References BadComponentVect, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by MeasurementTrackerImpl::initializeStripStatus().

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

Definition at line 90 of file SiStripQuality.h.

References FileInPath_.

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

Definition at line 617 of file SiStripQuality.cc.

References BadComponentVect, and AlCaHLTBitMon_ParallelJobs::p.

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

Definition at line 609 of file SiStripQuality.cc.

References BadComponentVect, and AlCaHLTBitMon_ParallelJobs::p.

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

Definition at line 601 of file SiStripQuality.cc.

References BadComponentVect, and AlCaHLTBitMon_ParallelJobs::p.

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

Definition at line 587 of file SiStripQuality.cc.

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

Referenced by MeasurementTrackerImpl::initializeStripStatus().

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

Definition at line 625 of file SiStripQuality.cc.

References SiStripBadStrip::getRange().

Referenced by StripClusterizerAlgorithm::Det::bad().

626 {
627  SiStripBadStrip::Range range=getRange(detid);
628  return IsStripBad(range,strip);
629 }
bool IsStripBad(const uint32_t &detid, const short &strip) const
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
bool SiStripQuality::IsStripBad ( const Range range,
const short &  strip 
) const

Definition at line 631 of file SiStripQuality.cc.

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

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

Definition at line 645 of file SiStripQuality.cc.

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

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

Definition at line 659 of file SiStripQuality.cc.

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

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

Definition at line 116 of file SiStripQuality.cc.

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

Definition at line 55 of file SiStripQuality.cc.

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

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

Definition at line 105 of file SiStripQuality.cc.

References SiStripQuality().

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

Definition at line 63 of file SiStripQuality.cc.

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

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

Definition at line 110 of file SiStripQuality.cc.

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

111 {
112  SiStripQuality a = (*this) - other ;
114 }
RegistryIterator getRegistryVectorEnd() const
RegistryIterator getRegistryVectorBegin() const
double a
Definition: hdecay.h:121
void SiStripQuality::printActiveFedsInfo ( const std::vector< uint16_t > &  activeFedsFromCabling,
const std::vector< int > &  activeFedsFromRunInfo,
const std::vector< int > &  differentFeds,
const bool  printDebug 
)
private

Prints debug output for the active feds comparing the list in RunInfo and FedCabling.

Definition at line 724 of file SiStripQuality.cc.

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

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

Prints debug output for a given detId.

Definition at line 689 of file SiStripQuality.cc.

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

Referenced by turnOffFeds().

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

Definition at line 343 of file SiStripQuality.cc.

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

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

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

Definition at line 373 of file SiStripQuality.cc.

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

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

Definition at line 124 of file SiStripQuality.h.

References SiStripBadStrip::printDebug(), and printDebug_.

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

Definition at line 125 of file SiStripQuality.h.

References useEmptyRunInfo_.

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

Definition at line 457 of file SiStripQuality.cc.

References subtraction().

Referenced by operator-=().

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

Definition at line 466 of file SiStripQuality.cc.

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

Referenced by subtract().

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

Loop on all the fedIds, take the fedChannels and then the detId. Depending on the value of a bool turn off or not the strips in the list.

Definition at line 750 of file SiStripQuality.cc.

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

Referenced by add().

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

Member Data Documentation

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

Definition at line 153 of file SiStripQuality.h.

Referenced by getFileInPath(), and SiStripQuality().

bool SiStripQuality::printDebug_
private

Definition at line 159 of file SiStripQuality.h.

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

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

Definition at line 152 of file SiStripQuality.h.

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

bool SiStripQuality::useEmptyRunInfo_
private

Definition at line 160 of file SiStripQuality.h.

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