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::ifstream &in)
 
int read (const PixelROCName &rocid, std::istringstream &in)
 
int read (const PixelROCName &rocid, std::string 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.

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 }

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

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

◆ name()

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

Definition at line 45 of file PixelROCMaskBits.h.

45 { return rocid_; }

References rocid_.

Referenced by config.CFG::__str__(), validation.Sample::digest(), and VIDSelectorBase.VIDSelectorBase::initialize().

◆ read() [1/3]

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

Definition at line 45 of file PixelROCMaskBits.cc.

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 }

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

◆ read() [2/3]

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

Definition at line 82 of file PixelROCMaskBits.cc.

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 }

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

◆ read() [3/3]

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

Definition at line 36 of file PixelROCMaskBits.cc.

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 }

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

◆ readBinary()

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

Definition at line 108 of file PixelROCMaskBits.cc.

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

References bits_, recoMuon::in, and rocid_.

◆ setMask()

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

Definition at line 155 of file PixelROCMaskBits.cc.

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 }

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

◆ setROCMaskBits()

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

Definition at line 21 of file PixelROCMaskBits.cc.

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 }

References bits_, mps_fire::i, rocid_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ writeASCII()

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

Definition at line 127 of file PixelROCMaskBits.cc.

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 }

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

◆ writeBinary()

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

Definition at line 117 of file PixelROCMaskBits.cc.

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 }

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

◆ writeXML()

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

Definition at line 189 of file PixelROCMaskBits.cc.

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 }

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

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

◆ rocid_

PixelROCName pos::PixelROCMaskBits::rocid_
private
pos::PixelROCName::rocname
std::string rocname() const
Definition: PixelROCName.cc:235
mps_fire.i
i
Definition: mps_fire.py:428
cuy.col
col
Definition: cuy.py:1010
cms::cuda::assert
assert(be >=bs)
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
recoMuon::in
Definition: RecoMuonEnumerators.h:6
createfilelist.int
int
Definition: createfilelist.py:10
pos::PixelROCMaskBits::mask
unsigned int mask(unsigned int col, unsigned int row) const
Definition: PixelROCMaskBits.cc:143
base64_encode
std::string base64_encode(unsigned char const *, unsigned int len)
Definition: PixelBase64.cc:38
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
pos::PixelROCMaskBits::bits_
unsigned char bits_[520]
Definition: PixelROCMaskBits.h:51
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
pos::PixelROCMaskBits::rocid_
PixelROCName rocid_
Definition: PixelROCMaskBits.h:50
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66