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 50 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().

50  {
51 
53 
54  //std::cout << "PixelROCTrimBits::read rocid:"<<rocid<<std::endl;
55 
56  rocid_=rocid;
57 
58  //std::cout << "PixelROCTrimBits::read rocid_:"<<rocid_<<std::endl;
59 
60  for (int i=0;i<52;i++){
61 
62  in >> tag;
63 
64  //std::cout << "Now reading col:"<<tag<<std::endl;
65 
67 
68  in >> data;
69 
70  //std::cout <<"data.size()" <<data.size()<<std::endl;
71 
72  unsigned char byte=0;
73 
74  for(int j=0;j<80;j++){
75 
76  unsigned char tmp=toupper(data[j])-48;
77  if (tmp>9) tmp-=7; //FIXME this is so ugly
78 
79  byte+=tmp;
80 
81  if ((j+1)%2==0) {
82  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
83  bits_[i*40+(j+1)/2-1]=byte;
84  byte=0;
85  }
86  else{
87  byte*=16;
88  }
89 
90 
91  }
92 
93  }
94  return 1;
95 
96 }
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 98 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().

99 {
101  //std::cout << "PixelROCTrimBits::read rocid:"<<rocid<<std::endl;
102  rocid_=rocid;
103  //std::cout << "PixelROCTrimBits::read rocid_:"<<rocid_<<std::endl;
104  for (int i=0;i<52;i++)
105  {
106  in >> tag;
107 // std::cout << "Now reading col:"<<tag<<std::endl;
109  in >> data;
110 // std::cout <<" data: " <<data<<std::endl;
111  unsigned char byte=0;
112  for(int j=0;j<80;j++)
113  {
114  unsigned char tmp=toupper(data[j])-48;
115  if (tmp>9) tmp-=7; //FIXME this is so ugly
116  byte+=tmp;
117  if ((j+1)%2==0)
118  {
119  //std::cout << "Writing byte:"<<(int)byte<<std::endl;
120  bits_[i*40+(j+1)/2-1]=byte;
121  byte=0;
122  }
123  else
124  {
125  byte*=16;
126  }
127  }
128  }
129  return 1;
130 }
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 134 of file PixelROCTrimBits.cc.

References bits_, and rocid_.

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

134  {
135 
136  rocid_=rocid;
137 
138  in.read((char*)bits_,2080);
139 
140  return 1;
141 
142 }
unsigned char bits_[2080]
void PixelROCTrimBits::setROCTrimBits ( PixelROCName  rocid,
std::string  bits 
)

Definition at line 22 of file PixelROCTrimBits.cc.

References bits_, gather_cfg::cout, mps_fire::i, and rocid_.

23 {
24 
25 try{
26  rocid_=rocid;
27  char cpt[2080] ;
28  bits.copy( cpt , 2080);
29  for(unsigned int i = 0 ; i < bits.size(); i++)
30  bits_[i] = (unsigned char)cpt[i];
31 }catch(std::bad_cast){
32 
33 std::cout << "Error casting variable." << std::endl;
34 
35 }
36 
37 }
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 189 of file PixelROCTrimBits.cc.

References bits_, RecoTauDiscriminantConfiguration::mask, and tmp.

189  {
190 
191  assert(trim<16);
192 
193  unsigned int mask=0xf0;
194  if (row%2==0) {
195  trim<<=4;
196  mask>>=4;
197  }
198  unsigned int tmp=bits_[col*40+row/2];
199  bits_[col*40+row/2]=(tmp&mask)|trim;
200 
201 }
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:1008
unsigned int PixelROCTrimBits::trim ( unsigned int  col,
unsigned int  row 
) const

Definition at line 181 of file PixelROCTrimBits.cc.

References bits_, and tmp.

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

181  {
182 
183  unsigned int tmp=bits_[col*40+row/2];
184  if (row%2==0) tmp/=16;
185  return tmp&0x0F;
186 
187 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
unsigned char bits_[2080]
col
Definition: cuy.py:1008
void PixelROCTrimBits::writeASCII ( std::ofstream &  out) const

Definition at line 159 of file PixelROCTrimBits.cc.

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

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

Definition at line 145 of file PixelROCTrimBits.cc.

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

145  {
146 
147  out << (char)rocid_.rocname().size();
148  out.write(rocid_.rocname().c_str(),rocid_.rocname().size());
149 
150  //std::cout << "PixelROCTrimBits::writeBinary:"<<rocid_.rocname().size()
151  // << " " <<rocid_.rocname()<<std::endl;
152 
153  for(unsigned int i=0;i<2080;i++){
154  out << bits_[i];
155  }
156 
157 }
std::string rocname() const
unsigned char bits_[2080]
void PixelROCTrimBits::writeXML ( std::ofstream *  out) const

Definition at line 230 of file PixelROCTrimBits.cc.

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

231 {
232  std::string mthn = "[PixelROCTrimBits::writeXML()]\t\t\t\t" ;
233 
234  std::string encoded = base64_encode(bits_, sizeof(bits_));
235  std::string decoded = base64_decode(encoded);
236 
237  *out << " <DATA>" << std::endl ;
238  *out << " <ROC_NAME>" << rocid_.rocname() << "</ROC_NAME>" << std::endl ;
239  *out << " <TRIM_BITS>" << encoded << "</TRIM_BITS>" << std::endl ;
240  *out << " </DATA>" << std::endl ;
241  *out << " " << std::endl ;
242 
243 }
#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