CMS 3D CMS Logo

pos::PixelTrimCommon Class Reference
["Trim Objects""Configuration Objects"]

This class implements.. More...

#include <CalibFormats/SiPixelObjects/interface/PixelTrimCommon.h>

Inheritance diagram for pos::PixelTrimCommon:

pos::PixelTrimBase pos::PixelConfigBase

List of all members.

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
virtual void writeXML (std::ofstream *out) const
void writeXML (pos::PixelConfigKey key, int version, std::string path) const
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
virtual void writeXMLTrailer (std::ofstream *out) const

Private Attributes

std::vector< PixelROCNamerocname_
std::vector< unsigned inttrimbits_


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 c, i, in, s1, and trimbits_.

00019                                                   :
00020   PixelTrimBase("","",""){
00021 
00022     if (filename[filename.size()-1]=='t'){
00023 
00024         std::ifstream in(filename.c_str());
00025         
00026         std::string s1;
00027         in >> s1;
00028 
00029         trimbits_.clear();
00030 
00031 
00032         while (!in.eof()){
00033 
00034             //std::cout << "PixelTrimCommon::PixelTrimCommon read s1:"<<s1<<std::endl;
00035 
00036             PixelROCName rocid(in);
00037 
00038             //std::cout << "PixelTrimCommon::PixelTrimCommon read rocid:"<<rocid<<std::endl;
00039             
00040             unsigned int trimbits;
00041       
00042             in >> trimbits;
00043 
00044             trimbits_.push_back(trimbits);
00045 
00046             in >> s1;
00047 
00048         }
00049 
00050         in.close();
00051 
00052     }
00053     else{
00054 
00055         std::ifstream in(filename.c_str(),std::ios::binary);
00056 
00057         char nchar;
00058 
00059         in.read(&nchar,1);
00060 
00061         std::string s1;
00062 
00063         //wrote these lines of code without ref. needs to be fixed
00064         for(int i=0;i< nchar; i++){
00065             char c;
00066             in >>c;
00067             s1.push_back(c);
00068         }
00069 
00070         //std::cout << "READ ROC name:"<<s1<<std::endl;
00071 
00072         trimbits_.clear();
00073 
00074 
00075         while (!in.eof()){
00076 
00077             //std::cout << "PixelTrimCommon::PixelTrimCommon read s1:"<<s1<<std::endl;
00078 
00079             PixelROCName rocid(s1);
00080 
00081             //std::cout << "PixelTrimCommon::PixelTrimCommon read rocid:"<<rocid<<std::endl;
00082             
00083             unsigned int trimbits;
00084       
00085             in >> trimbits;
00086 
00087             trimbits_.push_back(trimbits);
00088 
00089 
00090             in.read(&nchar,1);
00091 
00092             s1.clear();
00093 
00094             if (in.eof()) continue;
00095 
00096             //wrote these lines of code without ref. needs to be fixed
00097             for(int i=0;i< nchar; i++){
00098                 char c;
00099                 in >>c;
00100                 s1.push_back(c);
00101             }
00102 
00103 
00104         }
00105 
00106         in.close();
00107 
00108 
00109 
00110     }
00111 
00112     //std::cout << "Read trimbits for "<<trimbits_.size()<<" ROCs"<<std::endl;
00113 
00114 }


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 parsecf::pyparsing::col(), pos::PixelNameTranslation::getHdwAddress(), pos::PixelMaskBase::getMaskBits(), i, pos::PixelROCMaskBits::mask(), rocname_, row, pos::PixelFECConfigInterface::setMaskAndTrimAll(), tmp, and trimbits_.

00133                                                                                     {
00134 
00135     for(unsigned int i=0;i<trimbits_.size();i++){
00136 
00137         std::vector<unsigned char> trimAndMasks(4160);
00138 
00139         const PixelROCMaskBits& maskbits=pixelMask.getMaskBits(i);
00140 
00141         for (unsigned int col=0;col<52;col++){
00142             for (unsigned int row=0;row<80;row++){
00143                 unsigned char tmp=trimbits_[i];
00144                 if (maskbits.mask(col,row)!=0) tmp|=0x80;
00145                 trimAndMasks[col*80+row]=tmp;
00146             }
00147         }
00148 
00149         pixelFEC->setMaskAndTrimAll(*(trans->getHdwAddress(rocname_[i])),trimAndMasks);
00150 
00151     }
00152 }

void PixelTrimCommon::writeASCII ( std::string  filename  )  const [virtual]

Implements pos::PixelTrimBase.

Definition at line 168 of file PixelTrimCommon.cc.

References i, out, and trimbits_.

00168                                                         {
00169 
00170     std::ofstream out(filename.c_str());
00171 
00172     for(unsigned int i=0;i<trimbits_.size();i++){
00173         assert(0);
00174         //trimbits_[i].writeASCII(out);
00175     }
00176 
00177 
00178 }

void PixelTrimCommon::writeBinary ( std::string  filename  )  const [virtual]

Implements pos::PixelTrimBase.

Definition at line 154 of file PixelTrimCommon.cc.

References i, out, and trimbits_.

00154                                                          {
00155 
00156   
00157     std::ofstream out(filename.c_str(),std::ios::binary);
00158 
00159     for(unsigned int i=0;i<trimbits_.size();i++){
00160         assert(0);
00161         //trimbits_[i].writeBinary(out);
00162     }
00163 
00164 
00165 }

virtual void pos::PixelTrimCommon::writeXML ( std::ofstream *  out  )  const [inline, virtual]

Reimplemented from pos::PixelTrimBase.

Definition at line 48 of file PixelTrimCommon.h.

00048 {;}

void pos::PixelTrimCommon::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const [inline, virtual]

Reimplemented from pos::PixelTrimBase.

Definition at line 46 of file PixelTrimCommon.h.

00046 {;}

virtual void pos::PixelTrimCommon::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out 
) const [inline, virtual]

Reimplemented from pos::PixelTrimBase.

Definition at line 47 of file PixelTrimCommon.h.

00047 {;}

virtual void pos::PixelTrimCommon::writeXMLTrailer ( std::ofstream *  out  )  const [inline, virtual]

Reimplemented from pos::PixelTrimBase.

Definition at line 49 of file PixelTrimCommon.h.

00049 {;}


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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:50:38 2009 for CMSSW by  doxygen 1.5.4