test
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
pos::PixelTrimCommon Class Reference

This class implements.. More...

#include <PixelTrimCommon.h>

Inheritance diagram for pos::PixelTrimCommon:
pos::PixelTrimBase pos::PixelConfigBase

Public Member Functions

void generateConfiguration (PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, const PixelMaskBase &pixelMask) const
 
 PixelTrimCommon (std::string filename)
 
void writeASCII (std::string filename) const
 
void writeBinary (std::string filename) const
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) const
 
virtual void writeXML (std::ofstream *out) const
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
 
virtual void writeXMLTrailer (std::ofstream *out) const
 
- Public Member Functions inherited from pos::PixelTrimBase
virtual PixelROCTrimBits getTrimBits (int ROCId) const =0
 
virtual PixelROCTrimBitsgetTrimBits (PixelROCName name)=0
 
 PixelTrimBase (std::string description, std::string creator, std::string date)
 
void setOverride (PixelTrimOverrideBase *trimOverride)
 
virtual void writeXML (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual ~PixelTrimBase ()
 
- Public Member Functions inherited from pos::PixelConfigBase
std::string creator ()
 
std::string date ()
 
std::string description ()
 
std::string getAuthor () const
 
std::string getComment () const
 
 PixelConfigBase (std::string description, std::string creator, std::string date)
 
void setAuthor (std::string author)
 
void setComment (std::string comment)
 
virtual ~PixelConfigBase ()
 

Private Attributes

std::vector< PixelROCNamerocname_
 
std::vector< unsigned int > trimbits_
 

Detailed Description

This class implements..

" " " "

A longer explanation will be placed here later

Definition at line 30 of file PixelTrimCommon.h.

Constructor & Destructor Documentation

PixelTrimCommon::PixelTrimCommon ( std::string  filename)

Definition at line 19 of file PixelTrimCommon.cc.

References trackerHits::c, i, recoMuon::in, AlCaHLTBitMon_QueryRunRegistry::string, and trimbits_.

19  :
20  PixelTrimBase("","",""){
21 
22  if (filename[filename.size()-1]=='t'){
23 
24  std::ifstream in(filename.c_str());
25 
26  std::string s1;
27  in >> s1;
28 
29  trimbits_.clear();
30 
31 
32  while (!in.eof()){
33 
34  //std::cout << "PixelTrimCommon::PixelTrimCommon read s1:"<<s1<<std::endl;
35 
36  PixelROCName rocid(in);
37 
38  //std::cout << "PixelTrimCommon::PixelTrimCommon read rocid:"<<rocid<<std::endl;
39 
40  unsigned int trimbits;
41 
42  in >> trimbits;
43 
44  trimbits_.push_back(trimbits);
45 
46  in >> s1;
47 
48  }
49 
50  in.close();
51 
52  }
53  else{
54 
55  std::ifstream in(filename.c_str(),std::ios::binary);
56 
57  char nchar;
58 
59  in.read(&nchar,1);
60 
61  std::string s1;
62 
63  //wrote these lines of code without ref. needs to be fixed
64  for(int i=0;i< nchar; i++){
65  char c;
66  in >>c;
67  s1.push_back(c);
68  }
69 
70  //std::cout << "READ ROC name:"<<s1<<std::endl;
71 
72  trimbits_.clear();
73 
74 
75  while (!in.eof()){
76 
77  //std::cout << "PixelTrimCommon::PixelTrimCommon read s1:"<<s1<<std::endl;
78 
79  PixelROCName rocid(s1);
80 
81  //std::cout << "PixelTrimCommon::PixelTrimCommon read rocid:"<<rocid<<std::endl;
82 
83  unsigned int trimbits;
84 
85  in >> trimbits;
86 
87  trimbits_.push_back(trimbits);
88 
89 
90  in.read(&nchar,1);
91 
92  s1.clear();
93 
94  if (in.eof()) continue;
95 
96  //wrote these lines of code without ref. needs to be fixed
97  for(int i=0;i< nchar; i++){
98  char c;
99  in >>c;
100  s1.push_back(c);
101  }
102 
103 
104  }
105 
106  in.close();
107 
108 
109 
110  }
111 
112  //std::cout << "Read trimbits for "<<trimbits_.size()<<" ROCs"<<std::endl;
113 
114 }
std::vector< unsigned int > trimbits_
int i
Definition: DBlmapReader.cc:9
This class implements..
Definition: PixelROCName.h:23
tuple filename
Definition: lut2db_cfg.py:20
PixelTrimBase(std::string description, std::string creator, std::string date)

Member Function Documentation

void PixelTrimCommon::generateConfiguration ( PixelFECConfigInterface pixelFEC,
PixelNameTranslation trans,
const PixelMaskBase pixelMask 
) const
virtual

Implements pos::PixelTrimBase.

Definition at line 131 of file PixelTrimCommon.cc.

References cuy::col, pos::PixelNameTranslation::getHdwAddress(), pos::PixelMaskBase::getMaskBits(), i, pos::PixelROCMaskBits::mask(), rocname_, pos::PixelFECConfigInterface::setMaskAndTrimAll(), tmp, and trimbits_.

133  {
134 
135  for(unsigned int i=0;i<trimbits_.size();i++){
136 
137  std::vector<unsigned char> trimAndMasks(4160);
138 
139  const PixelROCMaskBits& maskbits=pixelMask.getMaskBits(i);
140 
141  for (unsigned int col=0;col<52;col++){
142  for (unsigned int row=0;row<80;row++){
143  unsigned char tmp=trimbits_[i];
144  if (maskbits.mask(col,row)!=0) tmp|=0x80;
145  trimAndMasks[col*80+row]=tmp;
146  }
147  }
148 
149  pixelFEC->setMaskAndTrimAll(*(trans->getHdwAddress(rocname_[i])),trimAndMasks);
150 
151  }
152 }
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
std::vector< unsigned int > trimbits_
int i
Definition: DBlmapReader.cc:9
virtual void setMaskAndTrimAll(const PixelHdwAddress &theROC, const std::vector< unsigned char > &allPixels, const bool buffermode=false)=0
std::vector< PixelROCName > rocname_
virtual const PixelROCMaskBits & getMaskBits(int ROCId) const =0
This class implements..
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
unsigned int mask(unsigned int col, unsigned int row) const
int col
Definition: cuy.py:1008
void PixelTrimCommon::writeASCII ( std::string  filename) const
virtual

Implements pos::PixelTrimBase.

Definition at line 168 of file PixelTrimCommon.cc.

References i, dbtoconf::out, and trimbits_.

168  {
169 
170  std::ofstream out(filename.c_str());
171 
172  for(unsigned int i=0;i<trimbits_.size();i++){
173  assert(0);
174  //trimbits_[i].writeASCII(out);
175  }
176 
177 
178 }
std::vector< unsigned int > trimbits_
int i
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20
void PixelTrimCommon::writeBinary ( std::string  filename) const
virtual

Implements pos::PixelTrimBase.

Definition at line 154 of file PixelTrimCommon.cc.

References i, dbtoconf::out, and trimbits_.

154  {
155 
156 
157  std::ofstream out(filename.c_str(),std::ios::binary);
158 
159  for(unsigned int i=0;i<trimbits_.size();i++){
160  assert(0);
161  //trimbits_[i].writeBinary(out);
162  }
163 
164 
165 }
std::vector< unsigned int > trimbits_
int i
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20
void pos::PixelTrimCommon::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlinevirtual

Reimplemented from pos::PixelTrimBase.

Definition at line 46 of file PixelTrimCommon.h.

46 {;}
virtual void pos::PixelTrimCommon::writeXML ( std::ofstream *  out) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 48 of file PixelTrimCommon.h.

48 {;}
virtual void pos::PixelTrimCommon::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out 
) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 47 of file PixelTrimCommon.h.

47 {;}
virtual void pos::PixelTrimCommon::writeXMLTrailer ( std::ofstream *  out) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 49 of file PixelTrimCommon.h.

49 {;}

Member Data Documentation

std::vector<PixelROCName> pos::PixelTrimCommon::rocname_
private

Definition at line 54 of file PixelTrimCommon.h.

Referenced by generateConfiguration().

std::vector<unsigned int> pos::PixelTrimCommon::trimbits_
private

Definition at line 55 of file PixelTrimCommon.h.

Referenced by generateConfiguration(), PixelTrimCommon(), writeASCII(), and writeBinary().