CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Friends
pos::PixelROCMaskBits Class Reference

This class implements.. More...

#include "interface/PixelROCMaskBits.h"

Public Member Functions

unsigned int mask (unsigned int col, unsigned int row) const
 
PixelROCName name () const
 
 PixelROCMaskBits ()
 
int read (const PixelROCName &rocid, std::string in)
 
int read (const PixelROCName &rocid, std::ifstream &in)
 
int read (const PixelROCName &rocid, std::istringstream &in)
 
int readBinary (const PixelROCName &rocid, std::ifstream &in)
 
void setMask (unsigned int col, unsigned int row, unsigned int mask)
 
void setROCMaskBits (PixelROCName &rocid, std::string bits)
 
void writeASCII (std::ofstream &out) const
 
void writeBinary (std::ofstream &out) const
 
void writeXML (std::ofstream *out) const
 

Private Attributes

unsigned char bits_ [520]
 
PixelROCName rocid_
 

Friends

std::ostream & operator<< (std::ostream &s, const PixelROCMaskBits &maskbits)
 

Detailed Description

This class implements..

A longer explanation will be placed here later

Definition at line 24 of file PixelROCMaskBits.h.

Constructor & Destructor Documentation

◆ PixelROCMaskBits()

PixelROCMaskBits::PixelROCMaskBits ( )

Definition at line 18 of file PixelROCMaskBits.cc.

18 {}

Member Function Documentation

◆ mask()

unsigned int PixelROCMaskBits::mask ( unsigned int  col,
unsigned int  row 
) const

Definition at line 143 of file PixelROCMaskBits.cc.

References bits_, cuy::col, and createJobs::tmp.

Referenced by pos::PixelCalibConfiguration::enablePixels(), pos::PixelTrimCommon::generateConfiguration(), pos::PixelTrimAllPixels::generateConfiguration(), setMask(), and writeASCII().

143  {
144  unsigned int tmp = bits_[col * 10 + row / 8];
145  // std::cout << "c = " << col << "\tr = " << row << "\tbits_[" << (col*10+row/8) << "]=" << bits_[col*10+row/8] << std::endl ;
146  // std::cout << "[PixelROCMaskBits::mask()] tmp iniziale " << tmp << std::endl ;
147  tmp = tmp >> (row % 8);
148  // std::cout << "[PixelROCMaskBits::mask()] tmp finale " << tmp << std::endl ;
149  // unsigned int res = tmp&0x01 ;
150  // std::cout << "[PixelROCMaskBits::mask()] return value " << res << std::endl ;
151  return tmp & 0x01;
152 }
unsigned char bits_[520]
col
Definition: cuy.py:1009
tmp
align.sh
Definition: createJobs.py:716

◆ name()

PixelROCName pos::PixelROCMaskBits::name ( ) const
inline

◆ read() [1/3]

int PixelROCMaskBits::read ( const PixelROCName rocid,
std::string  in 
)

Definition at line 36 of file PixelROCMaskBits.cc.

References bits_, mps_fire::i, recoMuon::in, createfilelist::int, and rocid_.

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

36  {
37  rocid_ = rocid;
38  for (int i = 0; i < (int)sizeof(bits_); i++) {
39  bits_[i] = in.at(i);
40  }
41  return 1;
42 }
unsigned char bits_[520]

◆ read() [2/3]

int PixelROCMaskBits::read ( const PixelROCName rocid,
std::ifstream &  in 
)

Definition at line 45 of file PixelROCMaskBits.cc.

References bits_, data, mps_fire::i, recoMuon::in, dqmiolumiharvest::j, rocid_, AlCaHLTBitMon_QueryRunRegistry::string, and makeGlobalPositionRcd_cfg::tag.

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

45  {
46  rocid_ = rocid;
47 
49 
50  for (int i = 0; i < 52; i++) {
51  in >> tag;
52 
53  //std::cout << "Now reading col:"<<tag<<std::endl;
54 
56 
57  in >> data;
58 
59  //std::cout <<"data.size()" <<data.size()<<std::endl;
60 
61  unsigned char byte = 0;
62 
63  for (int j = 0; j < 80; j++) {
64  if (data[j] == '1')
65  byte += 128;
66 
67  if ((j + 1) % 8 == 0) {
68  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
69  bits_[i * 10 + (j + 1) / 8 - 1] = byte;
70  byte = 0;
71  } else {
72  byte /= 2;
73  }
74  }
75  }
76 
77  return 1;
78 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
unsigned char bits_[520]

◆ read() [3/3]

int PixelROCMaskBits::read ( const PixelROCName rocid,
std::istringstream &  in 
)

Definition at line 82 of file PixelROCMaskBits.cc.

References bits_, data, mps_fire::i, recoMuon::in, dqmiolumiharvest::j, rocid_, AlCaHLTBitMon_QueryRunRegistry::string, and makeGlobalPositionRcd_cfg::tag.

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

82  {
83  rocid_ = rocid;
85  for (int i = 0; i < 52; i++) {
86  in >> tag;
87  //std::cout << "Now reading col:"<<tag<<std::endl;
89  in >> data;
90  //std::cout <<"data.size()" <<data.size()<<std::endl;
91  unsigned char byte = 0;
92  for (int j = 0; j < 80; j++) {
93  if (data[j] == '1')
94  byte += 128;
95  if ((j + 1) % 8 == 0) {
96  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
97  bits_[i * 10 + (j + 1) / 8 - 1] = byte;
98  byte = 0;
99  } else {
100  byte /= 2;
101  }
102  }
103  }
104  return 1;
105 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
unsigned char bits_[520]

◆ readBinary()

int PixelROCMaskBits::readBinary ( const PixelROCName rocid,
std::ifstream &  in 
)

Definition at line 108 of file PixelROCMaskBits.cc.

References bits_, recoMuon::in, and rocid_.

108  {
109  rocid_ = rocid;
110 
111  in.read((char*)bits_, 520);
112 
113  return 1;
114 }
unsigned char bits_[520]

◆ setMask()

void PixelROCMaskBits::setMask ( unsigned int  col,
unsigned int  row,
unsigned int  mask 
)

Definition at line 155 of file PixelROCMaskBits.cc.

References cms::cuda::assert(), triggerObjects_cff::bit, bits_, cuy::col, and mask().

155  {
156  assert(mask == 0 || mask == 1);
157 
158  unsigned int bit = 1 << (row % 8);
159  if (mask)
160  bits_[col * 10 + row / 8] = bits_[col * 10 + row / 8] | bit;
161  if (!mask)
162  bits_[col * 10 + row / 8] = bits_[col * 10 + row / 8] & (0xff ^ bit);
163 }
assert(be >=bs)
unsigned char bits_[520]
col
Definition: cuy.py:1009
unsigned int mask(unsigned int col, unsigned int row) const

◆ setROCMaskBits()

void PixelROCMaskBits::setROCMaskBits ( PixelROCName rocid,
std::string  bits 
)

Definition at line 21 of file PixelROCMaskBits.cc.

References gpuClustering::pixelStatus::bits, bits_, mps_fire::i, rocid_, and AlCaHLTBitMon_QueryRunRegistry::string.

21  {
22  std::string mthn = "[PixelROCMaskBits::setROCMaskBits()]\t\t\t ";
23  rocid_ = rocid;
24  char cpt[520];
25  bits.copy(cpt, 520);
26  for (unsigned int i = 0; i < bits.size(); i++) {
27  bits_[i] = static_cast<unsigned char>(cpt[i]);
28  // std::cout<< "bits_[" << i << "]\t" << bits_[i] <<std::endl;
29  // std::cout<<rocid_<<std::endl;
30  // std::cout.flags(std::ios::hex)
31  }
32 }
constexpr uint32_t bits
Definition: gpuClustering.h:25
unsigned char bits_[520]

◆ writeASCII()

void PixelROCMaskBits::writeASCII ( std::ofstream &  out) const

Definition at line 127 of file PixelROCMaskBits.cc.

References cuy::col, mask(), MillePedeFileConverter_cfg::out, rocid_, and pos::PixelROCName::rocname().

127  {
128  out << "ROC: " << rocid_.rocname() << std::endl;
129 
130  for (unsigned int col = 0; col < 52; col++) {
131  out << "col";
132  if (col < 10)
133  out << "0";
134  out << col << ": ";
135  for (int row = 0; row < 80; row++) {
136  out << mask(col, row);
137  }
138  out << std::endl;
139  }
140 }
std::string rocname() const
col
Definition: cuy.py:1009
unsigned int mask(unsigned int col, unsigned int row) const

◆ writeBinary()

void PixelROCMaskBits::writeBinary ( std::ofstream &  out) const

Definition at line 117 of file PixelROCMaskBits.cc.

References bits_, mps_fire::i, MillePedeFileConverter_cfg::out, rocid_, and pos::PixelROCName::rocname().

117  {
118  out << (char)rocid_.rocname().size();
119  out.write(rocid_.rocname().c_str(), rocid_.rocname().size());
120 
121  for (unsigned int i = 0; i < 520; i++) {
122  out << bits_[i];
123  }
124 }
std::string rocname() const
unsigned char bits_[520]

◆ writeXML()

void PixelROCMaskBits::writeXML ( std::ofstream *  out) const

Definition at line 189 of file PixelROCMaskBits.cc.

References base64_encode(), bits_, MillePedeFileConverter_cfg::out, rocid_, pos::PixelROCName::rocname(), and AlCaHLTBitMon_QueryRunRegistry::string.

189  {
190  std::string mthn = "[PixelROCMaskBits::writeXML()]\t\t\t\t";
191 
192  std::string encoded = base64_encode(bits_, sizeof(bits_));
193 
194  *out << " <DATA>" << std::endl;
195  *out << " <ROC_NAME>" << rocid_.rocname() << "</ROC_NAME>" << std::endl;
196  *out << " <KILL_MASK>" << encoded << "</KILL_MASK>" << std::endl;
197  *out << " </DATA>" << std::endl;
198  *out << " " << std::endl;
199 }
std::string base64_encode(unsigned char const *, unsigned int len)
Definition: PixelBase64.cc:38
std::string rocname() const
unsigned char bits_[520]

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const PixelROCMaskBits maskbits 
)
friend

Member Data Documentation

◆ bits_

unsigned char pos::PixelROCMaskBits::bits_[520]
private

Definition at line 51 of file PixelROCMaskBits.h.

Referenced by mask(), read(), readBinary(), setMask(), setROCMaskBits(), writeBinary(), and writeXML().

◆ rocid_

PixelROCName pos::PixelROCMaskBits::rocid_
private