CMS 3D CMS Logo

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

This class implements.. More...

#include "interface/PixelROCTrimBits.h"

Public Member Functions

PixelROCName name () const
 
 PixelROCTrimBits ()
 
int read (PixelROCName rocid, std::string in)
 
int read (PixelROCName rocid, std::ifstream &in)
 
int read (PixelROCName rocid, std::istringstream &in)
 
int readBinary (PixelROCName rocid, std::ifstream &in)
 
void setROCTrimBits (PixelROCName rocid, std::string bits)
 
void setTrim (unsigned int col, unsigned int row, unsigned int trim)
 
unsigned int trim (unsigned int col, unsigned int row) const
 
void writeASCII (std::ofstream &out) const
 
void writeBinary (std::ofstream &out) const
 
void writeXML (std::ofstream *out) const
 

Private Attributes

unsigned char bits_ [2080]
 
PixelROCName rocid_
 

Friends

std::ostream & operator<< (std::ostream &s, const PixelROCTrimBits &trimbits)
 

Detailed Description

This class implements..

A longer explanation will be placed here later

Definition at line 23 of file PixelROCTrimBits.h.

Constructor & Destructor Documentation

◆ PixelROCTrimBits()

PixelROCTrimBits::PixelROCTrimBits ( )

Definition at line 18 of file PixelROCTrimBits.cc.

18 {}

Member Function Documentation

◆ name()

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

◆ read() [1/3]

int PixelROCTrimBits::read ( PixelROCName  rocid,
std::string  in 
)

Definition at line 30 of file PixelROCTrimBits.cc.

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

30  {
31  rocid_ = rocid;
32  for (int i = 0; i < (int)sizeof(bits_); i++) {
33  bits_[i] = in.at(i);
34  }
35  return 1;
36 }
unsigned char bits_[2080]

◆ read() [2/3]

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

Definition at line 38 of file PixelROCTrimBits.cc.

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

38  {
40 
41  //std::cout << "PixelROCTrimBits::read rocid:"<<rocid<<std::endl;
42 
43  rocid_ = rocid;
44 
45  //std::cout << "PixelROCTrimBits::read rocid_:"<<rocid_<<std::endl;
46 
47  for (int i = 0; i < 52; i++) {
48  in >> tag;
49 
50  //std::cout << "Now reading col:"<<tag<<std::endl;
51 
53 
54  in >> data;
55 
56  //std::cout <<"data.size()" <<data.size()<<std::endl;
57 
58  unsigned char byte = 0;
59 
60  for (int j = 0; j < 80; j++) {
61  unsigned char tmp = toupper(data[j]) - 48;
62  if (tmp > 9)
63  tmp -= 7; //FIXME this is so ugly
64 
65  byte += tmp;
66 
67  if ((j + 1) % 2 == 0) {
68  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
69  bits_[i * 40 + (j + 1) / 2 - 1] = byte;
70  byte = 0;
71  } else {
72  byte *= 16;
73  }
74  }
75  }
76  return 1;
77 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
unsigned char bits_[2080]
tmp
align.sh
Definition: createJobs.py:716

◆ read() [3/3]

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

Definition at line 79 of file PixelROCTrimBits.cc.

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

79  {
81  //std::cout << "PixelROCTrimBits::read rocid:"<<rocid<<std::endl;
82  rocid_ = rocid;
83  //std::cout << "PixelROCTrimBits::read rocid_:"<<rocid_<<std::endl;
84  for (int i = 0; i < 52; i++) {
85  in >> tag;
86  // std::cout << "Now reading col:"<<tag<<std::endl;
88  in >> data;
89  // std::cout <<" data: " <<data<<std::endl;
90  unsigned char byte = 0;
91  for (int j = 0; j < 80; j++) {
92  unsigned char tmp = toupper(data[j]) - 48;
93  if (tmp > 9)
94  tmp -= 7; //FIXME this is so ugly
95  byte += tmp;
96  if ((j + 1) % 2 == 0) {
97  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
98  bits_[i * 40 + (j + 1) / 2 - 1] = byte;
99  byte = 0;
100  } else {
101  byte *= 16;
102  }
103  }
104  }
105  return 1;
106 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
unsigned char bits_[2080]
tmp
align.sh
Definition: createJobs.py:716

◆ readBinary()

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

Definition at line 108 of file PixelROCTrimBits.cc.

References bits_, recoMuon::in, and rocid_.

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

◆ setROCTrimBits()

void PixelROCTrimBits::setROCTrimBits ( PixelROCName  rocid,
std::string  bits 
)

Definition at line 20 of file PixelROCTrimBits.cc.

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

20  {
21  rocid_ = rocid;
22  char cpt[2080];
23  bits.copy(cpt, 2080);
24  for (unsigned int i = 0; i < bits.size(); i++)
25  bits_[i] = static_cast<unsigned char>(cpt[i]);
26 }
constexpr uint32_t bits
Definition: gpuClustering.h:25
unsigned char bits_[2080]

◆ setTrim()

void PixelROCTrimBits::setTrim ( unsigned int  col,
unsigned int  row,
unsigned int  trim 
)

Definition at line 155 of file PixelROCTrimBits.cc.

References cms::cuda::assert(), bits_, cuy::col, gpuClustering::pixelStatus::mask, createJobs::tmp, and trim().

155  {
156  assert(trim < 16);
157 
158  unsigned int mask = 0xf0;
159  if (row % 2 == 0) {
160  trim <<= 4;
161  mask >>= 4;
162  }
163  unsigned int tmp = bits_[col * 40 + row / 2];
164  bits_[col * 40 + row / 2] = (tmp & mask) | trim;
165 }
assert(be >=bs)
constexpr uint32_t mask
Definition: gpuClustering.h:26
unsigned char bits_[2080]
col
Definition: cuy.py:1009
unsigned int trim(unsigned int col, unsigned int row) const
tmp
align.sh
Definition: createJobs.py:716

◆ trim()

unsigned int PixelROCTrimBits::trim ( unsigned int  col,
unsigned int  row 
) const

Definition at line 148 of file PixelROCTrimBits.cc.

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

Referenced by pos::PixelCalibConfiguration::disablePixels(), pos::PixelCalibConfiguration::enablePixels(), setTrim(), and writeASCII().

148  {
149  unsigned int tmp = bits_[col * 40 + row / 2];
150  if (row % 2 == 0)
151  tmp /= 16;
152  return tmp & 0x0F;
153 }
unsigned char bits_[2080]
col
Definition: cuy.py:1009
tmp
align.sh
Definition: createJobs.py:716

◆ writeASCII()

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

Definition at line 128 of file PixelROCTrimBits.cc.

References cuy::col, TauDecayModes::dec, MillePedeFileConverter_cfg::out, rocid_, pos::PixelROCName::rocname(), and trim().

128  {
129  //std::cout << " PixelROCTrimBits::writeASCII rocid_.rocname():"<<rocid_.rocname()<<std::endl;
130 
131  out << "ROC: " << rocid_.rocname() << std::endl;
132 
133  //std::cout << "PixelROCTrimBits::writeBinary:"<<rocid_.rocname().size()
134  // << " " <<rocid_.rocname()<<std::endl;
135 
136  for (unsigned int col = 0; col < 52; col++) {
137  out << "col";
138  if (col < 10)
139  out << "0";
140  out << col << ": ";
141  for (int row = 0; row < 80; row++) {
142  out << std::hex << std::uppercase << trim(col, row) << std::dec;
143  }
144  out << std::endl;
145  }
146 }
std::string rocname() const
col
Definition: cuy.py:1009
unsigned int trim(unsigned int col, unsigned int row) const

◆ writeBinary()

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

Definition at line 116 of file PixelROCTrimBits.cc.

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

116  {
117  out << (char)rocid_.rocname().size();
118  out.write(rocid_.rocname().c_str(), rocid_.rocname().size());
119 
120  //std::cout << "PixelROCTrimBits::writeBinary:"<<rocid_.rocname().size()
121  // << " " <<rocid_.rocname()<<std::endl;
122 
123  for (unsigned int i = 0; i < 2080; i++) {
124  out << bits_[i];
125  }
126 }
std::string rocname() const
unsigned char bits_[2080]

◆ writeXML()

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

Definition at line 189 of file PixelROCTrimBits.cc.

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

189  {
190  std::string mthn = "[PixelROCTrimBits::writeXML()]\t\t\t\t";
191 
192  std::string encoded = base64_encode(bits_, sizeof(bits_));
193  std::string decoded = base64_decode(encoded);
194 
195  *out << " <DATA>" << std::endl;
196  *out << " <ROC_NAME>" << rocid_.rocname() << "</ROC_NAME>" << std::endl;
197  *out << " <TRIM_BITS>" << encoded << "</TRIM_BITS>" << std::endl;
198  *out << " </DATA>" << std::endl;
199  *out << " " << std::endl;
200 }
#define base64_decode(in, inlen, out, outlen)
Definition: base64.h:52
std::string base64_encode(unsigned char const *, unsigned int len)
Definition: PixelBase64.cc:38
std::string rocname() const
unsigned char bits_[2080]

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const PixelROCTrimBits trimbits 
)
friend

Member Data Documentation

◆ bits_

unsigned char pos::PixelROCTrimBits::bits_[2080]
private

Definition at line 49 of file PixelROCTrimBits.h.

Referenced by read(), readBinary(), setROCTrimBits(), setTrim(), trim(), writeBinary(), and writeXML().

◆ rocid_

PixelROCName pos::PixelROCTrimBits::rocid_
private