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

Definition at line 46 of file PixelROCTrimBits.h.

46 { return rocid_; }

References rocid_.

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

◆ read() [1/3]

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

Definition at line 38 of file PixelROCTrimBits.cc.

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 }

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

◆ read() [2/3]

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

Definition at line 79 of file PixelROCTrimBits.cc.

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 }

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

◆ read() [3/3]

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

Definition at line 30 of file PixelROCTrimBits.cc.

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 }

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

◆ readBinary()

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

Definition at line 108 of file PixelROCTrimBits.cc.

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

References bits_, recoMuon::in, and rocid_.

◆ setROCTrimBits()

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

Definition at line 20 of file PixelROCTrimBits.cc.

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 }

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

◆ setTrim()

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

Definition at line 155 of file PixelROCTrimBits.cc.

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 }

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

◆ trim()

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

Definition at line 148 of file PixelROCTrimBits.cc.

148  {
149  unsigned int tmp = bits_[col * 40 + row / 2];
150  if (row % 2 == 0)
151  tmp /= 16;
152  return tmp & 0x0F;
153 }

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

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

◆ writeASCII()

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

Definition at line 128 of file PixelROCTrimBits.cc.

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 }

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

◆ writeBinary()

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

Definition at line 116 of file PixelROCTrimBits.cc.

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 }

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

◆ writeXML()

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

Definition at line 189 of file PixelROCTrimBits.cc.

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 }

References base64_decode, 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 PixelROCTrimBits trimbits 
)
friend

Member Data Documentation

◆ bits_

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

◆ rocid_

PixelROCName pos::PixelROCTrimBits::rocid_
private
pos::PixelROCName::rocname
std::string rocname() const
Definition: PixelROCName.cc:235
mps_fire.i
i
Definition: mps_fire.py:355
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
bits
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
Definition: EventSelector-behavior.doc:35
pos::PixelROCTrimBits::trim
unsigned int trim(unsigned int col, unsigned int row) const
Definition: PixelROCTrimBits.cc:148
pos::PixelROCTrimBits::bits_
unsigned char bits_[2080]
Definition: PixelROCTrimBits.h:49
base64_decode
#define base64_decode(in, inlen, out, outlen)
Definition: base64.h:52
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
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
pos::PixelROCTrimBits::rocid_
PixelROCName rocid_
Definition: PixelROCTrimBits.h:50