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 24 of file PixelROCTrimBits.h.

Constructor & Destructor Documentation

PixelROCTrimBits::PixelROCTrimBits ( )

Definition at line 18 of file PixelROCTrimBits.cc.

19 {
20 }

Member Function Documentation

PixelROCName pos::PixelROCTrimBits::name ( ) const
inline
int PixelROCTrimBits::read ( PixelROCName  rocid,
std::string  in 
)
int PixelROCTrimBits::read ( PixelROCName  rocid,
std::ifstream &  in 
)

Definition at line 44 of file PixelROCTrimBits.cc.

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

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

44  {
45 
47 
48  //std::cout << "PixelROCTrimBits::read rocid:"<<rocid<<std::endl;
49 
50  rocid_=rocid;
51 
52  //std::cout << "PixelROCTrimBits::read rocid_:"<<rocid_<<std::endl;
53 
54  for (int i=0;i<52;i++){
55 
56  in >> tag;
57 
58  //std::cout << "Now reading col:"<<tag<<std::endl;
59 
61 
62  in >> data;
63 
64  //std::cout <<"data.size()" <<data.size()<<std::endl;
65 
66  unsigned char byte=0;
67 
68  for(int j=0;j<80;j++){
69 
70  unsigned char tmp=toupper(data[j])-48;
71  if (tmp>9) tmp-=7; //FIXME this is so ugly
72 
73  byte+=tmp;
74 
75  if ((j+1)%2==0) {
76  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
77  bits_[i*40+(j+1)/2-1]=byte;
78  byte=0;
79  }
80  else{
81  byte*=16;
82  }
83 
84 
85  }
86 
87  }
88  return 1;
89 
90 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
unsigned char bits_[2080]
int PixelROCTrimBits::read ( PixelROCName  rocid,
std::istringstream &  in 
)

Definition at line 92 of file PixelROCTrimBits.cc.

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

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

93 {
95  //std::cout << "PixelROCTrimBits::read rocid:"<<rocid<<std::endl;
96  rocid_=rocid;
97  //std::cout << "PixelROCTrimBits::read rocid_:"<<rocid_<<std::endl;
98  for (int i=0;i<52;i++)
99  {
100  in >> tag;
101 // std::cout << "Now reading col:"<<tag<<std::endl;
103  in >> data;
104 // std::cout <<" data: " <<data<<std::endl;
105  unsigned char byte=0;
106  for(int j=0;j<80;j++)
107  {
108  unsigned char tmp=toupper(data[j])-48;
109  if (tmp>9) tmp-=7; //FIXME this is so ugly
110  byte+=tmp;
111  if ((j+1)%2==0)
112  {
113  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
114  bits_[i*40+(j+1)/2-1]=byte;
115  byte=0;
116  }
117  else
118  {
119  byte*=16;
120  }
121  }
122  }
123  return 1;
124 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
unsigned char bits_[2080]
int PixelROCTrimBits::readBinary ( PixelROCName  rocid,
std::ifstream &  in 
)

Definition at line 128 of file PixelROCTrimBits.cc.

References bits_, and rocid_.

Referenced by pos::PixelTrimAllPixels::PixelTrimAllPixels().

128  {
129 
130  rocid_=rocid;
131 
132  in.read((char*)bits_,2080);
133 
134  return 1;
135 
136 }
unsigned char bits_[2080]
void PixelROCTrimBits::setROCTrimBits ( PixelROCName  rocid,
std::string  bits 
)

Definition at line 22 of file PixelROCTrimBits.cc.

References bits_, mps_fire::i, and rocid_.

23 {
24 
25  rocid_=rocid;
26  char cpt[2080] ;
27  bits.copy( cpt , 2080);
28  for(unsigned int i = 0 ; i < bits.size(); i++)
29  bits_[i] = static_cast<unsigned char>(cpt[i]);
30 
31 }
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_[2080]
void PixelROCTrimBits::setTrim ( unsigned int  col,
unsigned int  row,
unsigned int  trim 
)

Definition at line 183 of file PixelROCTrimBits.cc.

References bits_, RecoTauDiscriminantConfiguration::mask, and tmp.

183  {
184 
185  assert(trim<16);
186 
187  unsigned int mask=0xf0;
188  if (row%2==0) {
189  trim<<=4;
190  mask>>=4;
191  }
192  unsigned int tmp=bits_[col*40+row/2];
193  bits_[col*40+row/2]=(tmp&mask)|trim;
194 
195 }
unsigned int trim(unsigned int col, unsigned int row) const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
unsigned char bits_[2080]
col
Definition: cuy.py:1009
unsigned int PixelROCTrimBits::trim ( unsigned int  col,
unsigned int  row 
) const

Definition at line 175 of file PixelROCTrimBits.cc.

References bits_, and tmp.

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

175  {
176 
177  unsigned int tmp=bits_[col*40+row/2];
178  if (row%2==0) tmp/=16;
179  return tmp&0x0F;
180 
181 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
unsigned char bits_[2080]
col
Definition: cuy.py:1009
void PixelROCTrimBits::writeASCII ( std::ofstream &  out) const

Definition at line 153 of file PixelROCTrimBits.cc.

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

153  {
154 
155  //std::cout << " PixelROCTrimBits::writeASCII rocid_.rocname():"<<rocid_.rocname()<<std::endl;
156 
157 
158  out << "ROC: "<<rocid_.rocname()<<std::endl;
159 
160  //std::cout << "PixelROCTrimBits::writeBinary:"<<rocid_.rocname().size()
161  // << " " <<rocid_.rocname()<<std::endl;
162 
163  for(unsigned int col=0;col<52;col++){
164  out << "col";
165  if (col<10) out << "0";
166  out <<col<<": ";
167  for (int row=0;row<80;row++){
168  out << std::hex<<std::uppercase<<trim(col,row)<<std::dec;
169  }
170  out << std::endl;
171  }
172 
173 }
unsigned int trim(unsigned int col, unsigned int row) const
std::string rocname() const
col
Definition: cuy.py:1009
void PixelROCTrimBits::writeBinary ( std::ofstream &  out) const

Definition at line 139 of file PixelROCTrimBits.cc.

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

139  {
140 
141  out << (char)rocid_.rocname().size();
142  out.write(rocid_.rocname().c_str(),rocid_.rocname().size());
143 
144  //std::cout << "PixelROCTrimBits::writeBinary:"<<rocid_.rocname().size()
145  // << " " <<rocid_.rocname()<<std::endl;
146 
147  for(unsigned int i=0;i<2080;i++){
148  out << bits_[i];
149  }
150 
151 }
std::string rocname() const
unsigned char bits_[2080]
void PixelROCTrimBits::writeXML ( std::ofstream *  out) const

Definition at line 224 of file PixelROCTrimBits.cc.

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

225 {
226  std::string mthn = "[PixelROCTrimBits::writeXML()]\t\t\t\t" ;
227 
228  std::string encoded = base64_encode(bits_, sizeof(bits_));
229  std::string decoded = base64_decode(encoded);
230 
231  *out << " <DATA>" << std::endl ;
232  *out << " <ROC_NAME>" << rocid_.rocname() << "</ROC_NAME>" << std::endl ;
233  *out << " <TRIM_BITS>" << encoded << "</TRIM_BITS>" << std::endl ;
234  *out << " </DATA>" << std::endl ;
235  *out << " " << std::endl ;
236 
237 }
#define base64_decode(in, inlen, out, outlen)
Definition: base64.h:57
std::string rocname() const
std::string base64_encode(unsigned char const *, unsigned int len)
Definition: PixelBase64.cc:41
unsigned char bits_[2080]

Friends And Related Function Documentation

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

Member Data Documentation

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