CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 20 of file PixelROCMaskBits.h.

Constructor & Destructor Documentation

PixelROCMaskBits::PixelROCMaskBits ( )

Definition at line 18 of file PixelROCMaskBits.cc.

18  {
19 }

Member Function Documentation

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

Definition at line 173 of file PixelROCMaskBits.cc.

References bits_, and tmp.

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

173  {
174 
175  unsigned int tmp=bits_[col*10+row/8];
176 // std::cout << "c = " << col << "\tr = " << row << "\tbits_[" << (col*10+row/8) << "]=" << bits_[col*10+row/8] << std::endl ;
177 // std::cout << "[PixelROCMaskBits::mask()] tmp iniziale " << tmp << std::endl ;
178  tmp=tmp>>(row%8);
179 // std::cout << "[PixelROCMaskBits::mask()] tmp finale " << tmp << std::endl ;
180 // unsigned int res = tmp&0x01 ;
181 // std::cout << "[PixelROCMaskBits::mask()] return value " << res << std::endl ;
182  return tmp&0x01;
183 
184 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
unsigned char bits_[520]
int col
Definition: cuy.py:1008
PixelROCName pos::PixelROCMaskBits::name ( ) const
inline
int PixelROCMaskBits::read ( const PixelROCName rocid,
std::string  in 
)
int PixelROCMaskBits::read ( const PixelROCName rocid,
std::ifstream &  in 
)

Definition at line 57 of file PixelROCMaskBits.cc.

References bits_, AlCaHLTBitMon_QueryRunRegistry::data, i, j, rocid_, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by edmIntegrityCheck.PublishToFileSystem::get(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

57  {
58 
59  rocid_=rocid;
60 
62 
63  for (int i=0;i<52;i++){
64 
65  in >> tag;
66 
67  //std::cout << "Now reading col:"<<tag<<std::endl;
68 
70 
71  in >> data;
72 
73  //std::cout <<"data.size()" <<data.size()<<std::endl;
74 
75  unsigned char byte=0;
76 
77  for(int j=0;j<80;j++){
78 
79  if (data[j]=='1') byte+=128;
80 
81  if ((j+1)%8==0) {
82  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
83  bits_[i*10+(j+1)/8-1]=byte;
84  byte=0;
85  }
86  else{
87  byte/=2;
88  }
89 
90 
91  }
92 
93  }
94 
95  return 1;
96 
97 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
unsigned char bits_[520]
int PixelROCMaskBits::read ( const PixelROCName rocid,
std::istringstream &  in 
)

Definition at line 101 of file PixelROCMaskBits.cc.

References bits_, AlCaHLTBitMon_QueryRunRegistry::data, i, j, rocid_, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by edmIntegrityCheck.PublishToFileSystem::get(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

102 {
103  rocid_=rocid;
105  for (int i=0;i<52;i++)
106  {
107  in >> tag;
108  //std::cout << "Now reading col:"<<tag<<std::endl;
110  in >> data;
111  //std::cout <<"data.size()" <<data.size()<<std::endl;
112  unsigned char byte=0;
113  for(int j=0;j<80;j++)
114  {
115  if (data[j]=='1') byte+=128;
116  if ((j+1)%8==0)
117  {
118  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
119  bits_[i*10+(j+1)/8-1]=byte;
120  byte=0;
121  }
122  else
123  {
124  byte/=2;
125  }
126  }
127  }
128  return 1;
129 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
unsigned char bits_[520]
int PixelROCMaskBits::readBinary ( const PixelROCName rocid,
std::ifstream &  in 
)

Definition at line 132 of file PixelROCMaskBits.cc.

References bits_, and rocid_.

Referenced by pos::PixelMaskAllPixels::PixelMaskAllPixels().

132  {
133 
134  rocid_=rocid;
135 
136 
137  in.read((char*)bits_,520);
138 
139 
140  return 1;
141 }
unsigned char bits_[520]
void PixelROCMaskBits::setMask ( unsigned int  col,
unsigned int  row,
unsigned int  mask 
)

Definition at line 187 of file PixelROCMaskBits.cc.

References assert(), and bits_.

187  {
188 
189  assert(mask==0||mask==1);
190 
191  unsigned int bit=1<<(row%8);
192  if (mask) bits_[col*10+row/8]=bits_[col*10+row/8]|bit;
193  if (!mask) bits_[col*10+row/8]=bits_[col*10+row/8]&(0xff^bit);
194 
195 }
assert(m_qm.get())
unsigned char bits_[520]
unsigned int mask(unsigned int col, unsigned int row) const
int col
Definition: cuy.py:1008
void PixelROCMaskBits::setROCMaskBits ( PixelROCName rocid,
std::string  bits 
)

Definition at line 23 of file PixelROCMaskBits.cc.

References bits_, hitfit::char, gather_cfg::cout, i, rocid_, and AlCaHLTBitMon_QueryRunRegistry::string.

24 {
25  std::string mthn = "[PixelROCMaskBits::setROCMaskBits()]\t\t\t " ;
26 try
27  {
28  rocid_=rocid;
29  char cpt[520] ;
30  bits.copy( cpt , 520);
31  for(unsigned int i = 0 ; i < bits.size(); i++)
32  {
33  bits_[i] = (unsigned char)cpt[i];
34  // std::cout<< "bits_[" << i << "]\t" << bits_[i] <<std::endl;
35  // std::cout<<rocid_<<std::endl;
36  // std::cout.flags(std::ios::hex)
37  }
38  }
39  catch(std::bad_cast)
40  {
41  std::cout << __LINE__ << "]\t" << mthn << "Error casting variable." << std::endl;
42  }
43 }
int i
Definition: DBlmapReader.cc:9
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
unsigned char bits_[520]
tuple cout
Definition: gather_cfg.py:145
void PixelROCMaskBits::writeASCII ( std::ofstream &  out) const

Definition at line 156 of file PixelROCMaskBits.cc.

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

156  {
157 
158  out << "ROC: "<<rocid_.rocname()<<std::endl;
159 
160  for(unsigned int col=0;col<52;col++){
161  out << "col";
162  if (col<10) out << "0";
163  out <<col<<": ";
164  for (int row=0;row<80;row++){
165  out << mask(col,row);
166  }
167  out << std::endl;
168  }
169 
170 }
std::string rocname() const
unsigned int mask(unsigned int col, unsigned int row) const
int col
Definition: cuy.py:1008
void PixelROCMaskBits::writeBinary ( std::ofstream &  out) const

Definition at line 144 of file PixelROCMaskBits.cc.

References bits_, hitfit::char, i, rocid_, and pos::PixelROCName::rocname().

144  {
145 
146  out << (char)rocid_.rocname().size();
147  out.write(rocid_.rocname().c_str(),rocid_.rocname().size());
148 
149  for(unsigned int i=0;i<520;i++){
150  out << bits_[i];
151  }
152 
153 }
int i
Definition: DBlmapReader.cc:9
std::string rocname() const
unsigned char bits_[520]
void PixelROCMaskBits::writeXML ( std::ofstream *  out) const

Definition at line 225 of file PixelROCMaskBits.cc.

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

226 {
227  std::string mthn = "[PixelROCMaskBits::writeXML()]\t\t\t\t" ;
228 
229  std::string encoded = base64_encode(bits_, sizeof(bits_));
230 
231  *out << " <DATA>" << std::endl ;
232  *out << " <ROC_NAME>" << rocid_.rocname() << "</ROC_NAME>" << std::endl ;
233  *out << " <KILL_MASK>" << encoded << "</KILL_MASK>" << std::endl ;
234  *out << " </DATA>" << std::endl ;
235  *out << " " << std::endl ;
236 
237 }
std::string rocname() const
std::string base64_encode(unsigned char const *, unsigned int len)
Definition: PixelBase64.cc:41
unsigned char bits_[520]

Friends And Related Function Documentation

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

Member Data Documentation

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

Definition at line 50 of file PixelROCMaskBits.h.

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

PixelROCName pos::PixelROCMaskBits::rocid_
private