CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends
SiStripDetVOff Class Reference

#include <SiStripDetVOff.h>

Public Types

typedef std::vector< int >::const_iterator constVboolIterator
 
typedef std::vector< uint32_t >::const_iterator constVoffIterator
 
typedef std::vector< uint32_t >::iterator vOffIterator
 

Public Member Functions

void getDetIds (std::vector< uint32_t > &DetIds_) const
 
int getHVoffCounts () const
 Returns the total number of modules with HV off. More...
 
int getLVoffCounts () const
 Returns the total number of modules with LV off. More...
 
void getVoff (std::vector< uint32_t > &vOff_) const
 Needed by the copy constructor. More...
 
bool IsModuleHVOff (const uint32_t DetID) const
 
bool IsModuleLVOff (const uint32_t DetID) const
 
bool IsModuleVOff (const uint32_t DetID) const
 Returns true if either HV or LV are off. More...
 
bool operator== (const SiStripDetVOff &d) const
 
void printDebug (std::stringstream &ss, const TrackerTopology *) const
 
void printSummary (std::stringstream &ss, const TrackerTopology *) const
 
bool put (const uint32_t DetId, const int HVoff, const int LVoff)
 Insert information for a single detId. More...
 
bool put (std::vector< uint32_t > &DetId, std::vector< int > &HVoff, std::vector< int > &LVoff)
 Insert information for a vector of detIds. More...
 
void setBits (uint32_t &enDetId, const int HVoff, const int LVoff)
 Changes the bits in the stored value according to on/off voltages. More...
 
 SiStripDetVOff ()
 
 SiStripDetVOff (const SiStripDetVOff &toCopy)
 
 ~SiStripDetVOff ()
 

Static Public Attributes

static const unsigned int allOnMask = 0x03
 
static const short bitShift = 2
 
static const unsigned int eightBitMask = 0xFFFFFFFF
 
static const short HVmask = 0x2
 
static const unsigned int HVonMask = 0xFFFFFFFD
 
static const short LVmask = 0x1
 
static const unsigned int LVonMask = 0xFFFFFFFE
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

std::vector< uint32_t > v_Voff
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

This class stores the information if the HV or LV of a detId were off.
Internally it uses two bits to store the information about HV and LV. It saves a uint32_t containing the detId number and these additional bits, which are stored in the first position. This is realized by the put method using a bit shift so that the actual number written in the database is: detId|HV|LV.
The getDetIds method builds and returns a vector with detIds, removing the additional bits. It has three methods to extract the information:

The printSummary method uses SiStripDetSummary to print both LV off and HV off summaries. See description of the SiStripDetSummary class therein.
The printDebug method prints the status of HV and LV for all DetIds that have at least one of the two off.

Definition at line 31 of file SiStripDetVOff.h.

Member Typedef Documentation

◆ constVboolIterator

typedef std::vector<int>::const_iterator SiStripDetVOff::constVboolIterator

Definition at line 35 of file SiStripDetVOff.h.

◆ constVoffIterator

typedef std::vector<uint32_t>::const_iterator SiStripDetVOff::constVoffIterator

Definition at line 34 of file SiStripDetVOff.h.

◆ vOffIterator

typedef std::vector<uint32_t>::iterator SiStripDetVOff::vOffIterator

Definition at line 33 of file SiStripDetVOff.h.

Constructor & Destructor Documentation

◆ SiStripDetVOff() [1/2]

SiStripDetVOff::SiStripDetVOff ( )
inline

Definition at line 46 of file SiStripDetVOff.h.

46 {}

◆ ~SiStripDetVOff()

SiStripDetVOff::~SiStripDetVOff ( )
inline

Definition at line 47 of file SiStripDetVOff.h.

47 {}

◆ SiStripDetVOff() [2/2]

SiStripDetVOff::SiStripDetVOff ( const SiStripDetVOff toCopy)
inline

Definition at line 48 of file SiStripDetVOff.h.

48 { toCopy.getVoff(v_Voff); }

References getVoff(), and v_Voff.

Member Function Documentation

◆ getDetIds()

void SiStripDetVOff::getDetIds ( std::vector< uint32_t > &  DetIds_) const

Definition at line 64 of file SiStripDetVOff.cc.

64  {
65  // returns vector of DetIds in map
66  DetIds_.clear();
67  // Extract the detId from the bitSet and fill the vector
68  constVoffIterator bitSetIt = v_Voff.begin();
69  constVoffIterator bitSetItEnd = v_Voff.end();
70  for (; bitSetIt != bitSetItEnd; ++bitSetIt) {
71  DetIds_.push_back((*bitSetIt) >> bitShift);
72  }
73 }

References bitShift, and v_Voff.

Referenced by SiStripQuality::add(), SiPixelQuality::add(), SiStripDetVOffBuilder::BuildDetVOffObj(), getHVoffCounts(), getLVoffCounts(), printDebug(), printSummary(), and SiStripDcsInfo::readStatus().

◆ getHVoffCounts()

int SiStripDetVOff::getHVoffCounts ( ) const

Returns the total number of modules with HV off.

Definition at line 123 of file SiStripDetVOff.cc.

123  {
124  std::vector<uint32_t> detIds;
125  getDetIds(detIds);
126  return std::count_if(std::begin(detIds), std::end(detIds), [this](uint32_t id) -> bool { return IsModuleHVOff(id); });
127 }

References mps_fire::end, getDetIds(), and IsModuleHVOff().

◆ getLVoffCounts()

int SiStripDetVOff::getLVoffCounts ( ) const

Returns the total number of modules with LV off.

Definition at line 117 of file SiStripDetVOff.cc.

117  {
118  std::vector<uint32_t> detIds;
119  getDetIds(detIds);
120  return std::count_if(std::begin(detIds), std::end(detIds), [this](uint32_t id) -> bool { return IsModuleLVOff(id); });
121 }

References mps_fire::end, getDetIds(), and IsModuleLVOff().

◆ getVoff()

void SiStripDetVOff::getVoff ( std::vector< uint32_t > &  vOff_) const
inline

Needed by the copy constructor.

Definition at line 51 of file SiStripDetVOff.h.

51 { vOff_ = v_Voff; }

References v_Voff.

Referenced by SiStripDetVOff().

◆ IsModuleHVOff()

bool SiStripDetVOff::IsModuleHVOff ( const uint32_t  DetID) const

Definition at line 91 of file SiStripDetVOff.cc.

91  {
92  uint32_t enDetId = (DetId << bitShift) & eightBitMask;
93  constVoffIterator p = std::lower_bound(v_Voff.begin(), v_Voff.end(), enDetId);
94  if (p != v_Voff.end() && (*p >> bitShift) == DetId && (*p & HVmask))
95  return true;
96  return false;
97 }

References bitShift, eightBitMask, HVmask, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, and v_Voff.

Referenced by getHVoffCounts(), printDebug(), and printSummary().

◆ IsModuleLVOff()

bool SiStripDetVOff::IsModuleLVOff ( const uint32_t  DetID) const

Definition at line 83 of file SiStripDetVOff.cc.

83  {
84  uint32_t enDetId = (DetId << bitShift) & eightBitMask;
85  constVoffIterator p = std::lower_bound(v_Voff.begin(), v_Voff.end(), enDetId);
86  if (p != v_Voff.end() && (*p >> bitShift) == DetId && (*p & LVmask))
87  return true;
88  return false;
89 }

References bitShift, eightBitMask, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, LVmask, AlCaHLTBitMon_ParallelJobs::p, and v_Voff.

Referenced by getLVoffCounts(), printDebug(), and printSummary().

◆ IsModuleVOff()

bool SiStripDetVOff::IsModuleVOff ( const uint32_t  DetID) const

Returns true if either HV or LV are off.

Definition at line 75 of file SiStripDetVOff.cc.

75  {
76  uint32_t enDetId = (DetId << bitShift) & eightBitMask;
77  constVoffIterator p = std::lower_bound(v_Voff.begin(), v_Voff.end(), enDetId);
78  if (p != v_Voff.end() && (*p >> bitShift) == DetId)
79  return true;
80  return false;
81 }

References bitShift, eightBitMask, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, and v_Voff.

◆ operator==()

bool SiStripDetVOff::operator== ( const SiStripDetVOff d) const
inline

Definition at line 59 of file SiStripDetVOff.h.

59 { return d.v_Voff == v_Voff; }

References ztail::d, and v_Voff.

◆ printDebug()

void SiStripDetVOff::printDebug ( std::stringstream &  ss,
const TrackerTopology  
) const

Definition at line 99 of file SiStripDetVOff.cc.

99  {
100  std::vector<uint32_t> detIds;
101  getDetIds(detIds);
102  constVoffIterator it = detIds.begin();
103  ss << "DetId \t HV \t LV" << std::endl;
104  for (; it != detIds.end(); ++it) {
105  ss << *it << "\t";
106  if (IsModuleHVOff(*it))
107  ss << "OFF\t";
108  else
109  ss << "ON \t";
110  if (IsModuleLVOff(*it))
111  ss << "OFF" << std::endl;
112  else
113  ss << "ON" << std::endl;
114  }
115 }

References getDetIds(), IsModuleHVOff(), IsModuleLVOff(), and contentValuesCheck::ss.

◆ printSummary()

void SiStripDetVOff::printSummary ( std::stringstream &  ss,
const TrackerTopology trackerTopo 
) const

Definition at line 129 of file SiStripDetVOff.cc.

129  {
130  SiStripDetSummary summaryHV{trackerTopo};
131  SiStripDetSummary summaryLV{trackerTopo};
132  std::vector<uint32_t> detIds;
133  getDetIds(detIds);
134  constVoffIterator it = detIds.begin();
135  for (; it != detIds.end(); ++it) {
136  if (IsModuleHVOff(*it))
137  summaryHV.add(*it);
138  if (IsModuleLVOff(*it))
139  summaryLV.add(*it);
140  }
141  ss << "Summary of detectors with HV off:" << std::endl;
142  summaryHV.print(ss, false);
143  ss << "Summary of detectors with LV off:" << std::endl;
144  summaryLV.print(ss, false);
145 }

References getDetIds(), IsModuleHVOff(), IsModuleLVOff(), and contentValuesCheck::ss.

◆ put() [1/2]

bool SiStripDetVOff::put ( const uint32_t  DetId,
const int  HVoff,
const int  LVoff 
)

Insert information for a single detId.

Definition at line 24 of file SiStripDetVOff.cc.

24  {
25  // Shift the DetId number of 2 bits to the left to have it in the final format with
26  // the two additional bits used for HV and LV.
27  uint32_t enDetId = (DetId << bitShift) & eightBitMask;
28 
29  // Binary search to determine if the element is already in the vector
30  vOffIterator p = std::lower_bound(v_Voff.begin(), v_Voff.end(), enDetId);
31  if (p != v_Voff.end() && (*p >> bitShift) == DetId) {
32  // Found a matching entry, insert the HV and LV information.
33  setBits(*p, HVoff, LVoff);
34  // Check if the detector has all on, in that case remove it from the list.
35  if ((~(*p) & allOnMask) == allOnMask)
36  v_Voff.erase(p);
37  } else {
38  // Not found, insert a new entry only if it is not all on
39  setBits(enDetId, HVoff, LVoff);
40  if ((~enDetId & allOnMask) != allOnMask)
41  v_Voff.insert(p, enDetId);
42  }
43  return true;
44 }

References allOnMask, bitShift, eightBitMask, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, setBits(), and v_Voff.

Referenced by SiStripDetVOffFakeBuilder::analyze(), SiStripDetVOffBuilder::BuildDetVOffObj(), and put().

◆ put() [2/2]

bool SiStripDetVOff::put ( std::vector< uint32_t > &  DetId,
std::vector< int > &  HVoff,
std::vector< int > &  LVoff 
)

Insert information for a vector of detIds.

Definition at line 46 of file SiStripDetVOff.cc.

46  {
47  if (DetId.size() == HVoff.size() && DetId.size() == LVoff.size()) {
48  constVoffIterator detIdIt = DetId.begin();
49  constVoffIterator detIdItEnd = DetId.end();
50  constVboolIterator HVoffIt = HVoff.begin();
51  constVboolIterator LVoffIt = LVoff.begin();
52  for (; detIdIt != detIdItEnd; ++detIdIt, ++HVoffIt, ++LVoffIt) {
53  put(*detIdIt, *HVoffIt, *LVoffIt);
54  }
55  } else {
56  std::cout << "Error: inconsistent sizes of vectors:" << std::endl;
57  std::cout << "DetId size = " << DetId.size() << ", HVoff size = " << HVoff.size()
58  << ", LVoff size = " << LVoff.size() << std::endl;
59  return false;
60  }
61  return true;
62 }

References gather_cfg::cout, and put().

◆ serialize()

template<class Archive >
void SiStripDetVOff::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setBits()

void SiStripDetVOff::setBits ( uint32_t &  enDetId,
const int  HVoff,
const int  LVoff 
)

Changes the bits in the stored value according to on/off voltages.

Definition at line 7 of file SiStripDetVOff.cc.

7  {
8  if (LVoff != -1) {
9  // LVonMask has all bits equal to 1 apart from the last one.
10  if (LVoff == 0)
11  enDetId &= LVonMask;
12  if (LVoff == 1)
13  enDetId |= LVmask;
14  }
15  if (HVoff != -1) {
16  // HVonMask has all bits equal to 1 apart from the next to last one.
17  if (HVoff == 0)
18  enDetId &= HVonMask;
19  if (HVoff == 1)
20  enDetId |= HVmask;
21  }
22 }

References HVmask, HVonMask, LVmask, and LVonMask.

Referenced by put().

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 84 of file SiStripDetVOff.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 84 of file SiStripDetVOff.h.

Member Data Documentation

◆ allOnMask

const unsigned int SiStripDetVOff::allOnMask = 0x03
static

Definition at line 42 of file SiStripDetVOff.h.

Referenced by put().

◆ bitShift

const short SiStripDetVOff::bitShift = 2
static

Definition at line 44 of file SiStripDetVOff.h.

Referenced by getDetIds(), IsModuleHVOff(), IsModuleLVOff(), IsModuleVOff(), and put().

◆ eightBitMask

const unsigned int SiStripDetVOff::eightBitMask = 0xFFFFFFFF
static

Definition at line 43 of file SiStripDetVOff.h.

Referenced by IsModuleHVOff(), IsModuleLVOff(), IsModuleVOff(), and put().

◆ HVmask

const short SiStripDetVOff::HVmask = 0x2
static

Definition at line 40 of file SiStripDetVOff.h.

Referenced by IsModuleHVOff(), and setBits().

◆ HVonMask

const unsigned int SiStripDetVOff::HVonMask = 0xFFFFFFFD
static

Definition at line 41 of file SiStripDetVOff.h.

Referenced by setBits().

◆ LVmask

const short SiStripDetVOff::LVmask = 0x1
static

Definition at line 38 of file SiStripDetVOff.h.

Referenced by IsModuleLVOff(), and setBits().

◆ LVonMask

const unsigned int SiStripDetVOff::LVonMask = 0xFFFFFFFE
static

Definition at line 39 of file SiStripDetVOff.h.

Referenced by setBits().

◆ v_Voff

std::vector<uint32_t> SiStripDetVOff::v_Voff
private
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripDetVOff::setBits
void setBits(uint32_t &enDetId, const int HVoff, const int LVoff)
Changes the bits in the stored value according to on/off voltages.
Definition: SiStripDetVOff.cc:7
SiStripDetVOff::HVmask
static const short HVmask
Definition: SiStripDetVOff.h:40
SiStripDetVOff::IsModuleHVOff
bool IsModuleHVOff(const uint32_t DetID) const
Definition: SiStripDetVOff.cc:91
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
SiStripDetVOff::v_Voff
std::vector< uint32_t > v_Voff
Definition: SiStripDetVOff.h:82
SiStripDetVOff::getVoff
void getVoff(std::vector< uint32_t > &vOff_) const
Needed by the copy constructor.
Definition: SiStripDetVOff.h:51
mps_fire.end
end
Definition: mps_fire.py:242
SiStripDetVOff::vOffIterator
std::vector< uint32_t >::iterator vOffIterator
Definition: SiStripDetVOff.h:33
SiStripDetVOff::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiStripDetVOff.cc:64
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
SiStripDetVOff::LVmask
static const short LVmask
Definition: SiStripDetVOff.h:38
SiStripDetVOff::constVoffIterator
std::vector< uint32_t >::const_iterator constVoffIterator
Definition: SiStripDetVOff.h:34
SiStripDetVOff::put
bool put(const uint32_t DetId, const int HVoff, const int LVoff)
Insert information for a single detId.
Definition: SiStripDetVOff.cc:24
SiStripDetVOff::constVboolIterator
std::vector< int >::const_iterator constVboolIterator
Definition: SiStripDetVOff.h:35
SiStripDetVOff::LVonMask
static const unsigned int LVonMask
Definition: SiStripDetVOff.h:39
SiStripDetSummary
Definition: SiStripDetSummary.h:28
ztail.d
d
Definition: ztail.py:151
SiStripDetVOff::allOnMask
static const unsigned int allOnMask
Definition: SiStripDetVOff.h:42
SiStripDetVOff::eightBitMask
static const unsigned int eightBitMask
Definition: SiStripDetVOff.h:43
SiStripDetVOff::bitShift
static const short bitShift
Definition: SiStripDetVOff.h:44
SiStripDetVOff::HVonMask
static const unsigned int HVonMask
Definition: SiStripDetVOff.h:41
SiStripDetVOff::IsModuleLVOff
bool IsModuleLVOff(const uint32_t DetID) const
Definition: SiStripDetVOff.cc:83