CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HtrXmlPatternWriter Class Reference

#include <HtrXmlPatternWriter.h>

List of all members.

Public Member Functions

 HtrXmlPatternWriter ()
void setTagName (std::string tn)
void writePattern (HalfHtrData *spigotData, int fiber, std::ostream &os, int level=0)

Private Member Functions

void packWordsStd (int adc0, int adc1, int adc2, int capid, unsigned int &w1, unsigned int &w2)

Private Attributes

std::string m_stamp
std::string m_tagName

Detailed Description

Definition at line 7 of file HtrXmlPatternWriter.h.


Constructor & Destructor Documentation

HtrXmlPatternWriter::HtrXmlPatternWriter ( )

Definition at line 11 of file HtrXmlPatternWriter.cc.

References m_stamp, cmsPerfSuiteHarvest::now, and cond::rpcobgas::time.

                                         {
  // set the timestamp!
  time_t now1=time(0);
  struct tm* now=localtime(&now1);

  char buffer[1024];
  strftime(buffer,1024,"%Y-%m-%d %H:%M:%S",now);

  m_stamp=buffer;
}

Member Function Documentation

void HtrXmlPatternWriter::packWordsStd ( int  adc0,
int  adc1,
int  adc2,
int  capid,
unsigned int &  w1,
unsigned int &  w2 
) [private]

Definition at line 59 of file HtrXmlPatternWriter.cc.

Referenced by writePattern().

                                                                                                                  {
  w1=0x3;
  w1|=(capid&0x3)<<3;
  w1|=(capid&0x3)<<5;
  w1|=(capid&0x3)<<7;
  w1|=adc2<<9;
  w1|=0x10000; // data valid
  w2=adc1<<1;
  w2|=adc0<<9;
  w2|=0x10000; // data valid
}
void HtrXmlPatternWriter::setTagName ( std::string  tn) [inline]

Definition at line 10 of file HtrXmlPatternWriter.h.

References m_tagName.

Referenced by HtrXmlPatternTool::HtrXmlPatternTool().

{ m_tagName=tn; }
void HtrXmlPatternWriter::writePattern ( HalfHtrData spigotData,
int  fiber,
std::ostream &  os,
int  level = 0 
)

Definition at line 22 of file HtrXmlPatternWriter.cc.

References ChannelPattern::getCoded(), HalfHtrData::getCrate(), HalfHtrData::getDCC(), HalfHtrData::getPattern(), HalfHtrData::getSlot(), HalfHtrData::getSpigot(), HalfHtrData::getTB(), i, m_stamp, m_tagName, p1, p2, p3, packWordsStd(), tabbing(), and w2.

                                                                                                    {

  os << tabbing(level) << "<CFGBrick>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='DCC' type='int'>" << std::dec << spigotData->getDCC() << "</Parameter>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='SPIGOT' type='int'>" << std::dec << spigotData->getSpigot() << "</Parameter>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='CRATE' type='int'>" << std::dec << spigotData->getCrate() << "</Parameter>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='SLOT' type='int'>" << spigotData->getSlot() << "</Parameter>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='TOPBOTTOM' type='int'>" << spigotData->getTB() << "</Parameter>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='FIBER' type='int'>" << fiber << "</Parameter>" << std::endl;
  
  int genIndex=fiber+(spigotData->getTB()*10)+(spigotData->getSlot()*100)+(spigotData->getCrate()*10000);
  os << tabbing(level+1) << "<Parameter name='GENERALIZEDINDEX' type='int'>" << std::dec << genIndex << "</Parameter>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='CREATIONTAG' type='string'>" << m_tagName << "</Parameter>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='CREATIONSTAMP' type='string'>" << m_stamp << "</Parameter>" << std::endl;
  os << tabbing(level+1) << "<Parameter name='PATTERN_SPEC_NAME' type='string'>" << m_tagName << "</Parameter>" << std::endl;
  

  // CREATIONTAG, CREATIONSTAMP, PATTERN_SPEC_NAME
  
  os << tabbing(level+1) << "<Data elements='1024' encoding='hex'>" << std::endl;
  
  ChannelPattern* p1=spigotData->getPattern((fiber-1)*3+1);
  ChannelPattern* p2=spigotData->getPattern((fiber-1)*3+2);
  ChannelPattern* p3=spigotData->getPattern((fiber-1)*3+3);


  unsigned int w1,w2;
  for (int i=0; i<512; i++) {
    packWordsStd(p1->getCoded(i),p2->getCoded(i),p3->getCoded(i),i%4,w1,w2);
    os << std::hex << w1 << ' ' << std::hex << w2 << ' ';
  }

  os << std::endl << tabbing(level+1) << "</Data>" << std::endl;
  
  os << tabbing(level) << "</CFGBrick>" << std::endl;
}

Member Data Documentation

std::string HtrXmlPatternWriter::m_stamp [private]

Definition at line 14 of file HtrXmlPatternWriter.h.

Referenced by HtrXmlPatternWriter(), and writePattern().

std::string HtrXmlPatternWriter::m_tagName [private]

Definition at line 14 of file HtrXmlPatternWriter.h.

Referenced by setTagName(), and writePattern().