CMS 3D CMS Logo

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

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
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

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, and trimbits_.

                                                  :
  PixelTrimBase("","",""){

    if (filename[filename.size()-1]=='t'){

        std::ifstream in(filename.c_str());
        
        std::string s1;
        in >> s1;

        trimbits_.clear();


        while (!in.eof()){

            //std::cout << "PixelTrimCommon::PixelTrimCommon read s1:"<<s1<<std::endl;

            PixelROCName rocid(in);

            //std::cout << "PixelTrimCommon::PixelTrimCommon read rocid:"<<rocid<<std::endl;
            
            unsigned int trimbits;
      
            in >> trimbits;

            trimbits_.push_back(trimbits);

            in >> s1;

        }

        in.close();

    }
    else{

        std::ifstream in(filename.c_str(),std::ios::binary);

        char nchar;

        in.read(&nchar,1);

        std::string s1;

        //wrote these lines of code without ref. needs to be fixed
        for(int i=0;i< nchar; i++){
            char c;
            in >>c;
            s1.push_back(c);
        }

        //std::cout << "READ ROC name:"<<s1<<std::endl;

        trimbits_.clear();


        while (!in.eof()){

            //std::cout << "PixelTrimCommon::PixelTrimCommon read s1:"<<s1<<std::endl;

            PixelROCName rocid(s1);

            //std::cout << "PixelTrimCommon::PixelTrimCommon read rocid:"<<rocid<<std::endl;
            
            unsigned int trimbits;
      
            in >> trimbits;

            trimbits_.push_back(trimbits);


            in.read(&nchar,1);

            s1.clear();

            if (in.eof()) continue;

            //wrote these lines of code without ref. needs to be fixed
            for(int i=0;i< nchar; i++){
                char c;
                in >>c;
                s1.push_back(c);
            }


        }

        in.close();



    }

    //std::cout << "Read trimbits for "<<trimbits_.size()<<" ROCs"<<std::endl;

}

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

                                                                                    {

    for(unsigned int i=0;i<trimbits_.size();i++){

        std::vector<unsigned char> trimAndMasks(4160);

        const PixelROCMaskBits& maskbits=pixelMask.getMaskBits(i);

        for (unsigned int col=0;col<52;col++){
            for (unsigned int row=0;row<80;row++){
                unsigned char tmp=trimbits_[i];
                if (maskbits.mask(col,row)!=0) tmp|=0x80;
                trimAndMasks[col*80+row]=tmp;
            }
        }

        pixelFEC->setMaskAndTrimAll(*(trans->getHdwAddress(rocname_[i])),trimAndMasks);

    }
}
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_.

                                                        {

    std::ofstream out(filename.c_str());

    for(unsigned int i=0;i<trimbits_.size();i++){
        assert(0);
        //trimbits_[i].writeASCII(out);
    }


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

Implements pos::PixelTrimBase.

Definition at line 228 of file PixelROCDACSettings.cc.

{
    out << (char)rocid_.rocname().size();
    out.write(rocid_.rocname().c_str(),rocid_.rocname().size());

    out << Vdd_;
    out << Vana_;
    out << Vsf_;
    out << Vcomp_;
    out << Vleak_;
    out << VrgPr_;
    out << VwllPr_;
    out << VrgSh_;
    out << VwllSh_;
    out << VHldDel_;
    out << Vtrim_;
    out << VcThr_;
    out << VIbias_bus_;
    out << VIbias_sf_;
    out << VOffsetOp_;
    out << VbiasOp_;
    out << VOffsetRO_;
    out << VIon_;
    out << VIbias_PH_;
    out << VIbias_DAC_;
    out << VIbias_roc_;
    out << VIColOr_;
    out << Vnpix_;
    out << VsumCol_;
    out << Vcal_;
    out << CalDel_;
    out << TempRange_;
    out << WBC_;
    out << ChipContReg_;        
}
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.

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

Reimplemented from pos::PixelConfigBase.

Definition at line 48 of file PixelTrimCommon.h.

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

Reimplemented from pos::PixelConfigBase.

Definition at line 47 of file PixelTrimCommon.h.

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

Reimplemented from pos::PixelConfigBase.

Definition at line 49 of file PixelTrimCommon.h.

{;}

Member Data Documentation

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(), and writeASCII().