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 Member Functions | Private Attributes
HtrXmlPatternWriter Class Reference

#include <HtrXmlPatternWriter.h>

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, and fileCollector::now.

11  {
12  // set the timestamp!
13  time_t now1=time(0);
14  struct tm* now=localtime(&now1);
15 
16  char buffer[1024];
17  strftime(buffer,1024,"%Y-%m-%d %H:%M:%S",now);
18 
19  m_stamp=buffer;
20 }

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

59  {
60  w1=0x3;
61  w1|=(capid&0x3)<<3;
62  w1|=(capid&0x3)<<5;
63  w1|=(capid&0x3)<<7;
64  w1|=adc2<<9;
65  w1|=0x10000; // data valid
66  w2=adc1<<1;
67  w2|=adc0<<9;
68  w2|=0x10000; // data valid
69 }
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
void HtrXmlPatternWriter::setTagName ( std::string  tn)
inline

Definition at line 10 of file HtrXmlPatternWriter.h.

References m_tagName.

Referenced by HtrXmlPatternTool::HtrXmlPatternTool().

10 { 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 TauDecayModes::dec, 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.

Referenced by HtrXmlPatternTool::writeXML().

22  {
23 
24  os << tabbing(level) << "<CFGBrick>" << std::endl;
25  os << tabbing(level+1) << "<Parameter name='DCC' type='int'>" << std::dec << spigotData->getDCC() << "</Parameter>" << std::endl;
26  os << tabbing(level+1) << "<Parameter name='SPIGOT' type='int'>" << std::dec << spigotData->getSpigot() << "</Parameter>" << std::endl;
27  os << tabbing(level+1) << "<Parameter name='CRATE' type='int'>" << std::dec << spigotData->getCrate() << "</Parameter>" << std::endl;
28  os << tabbing(level+1) << "<Parameter name='SLOT' type='int'>" << spigotData->getSlot() << "</Parameter>" << std::endl;
29  os << tabbing(level+1) << "<Parameter name='TOPBOTTOM' type='int'>" << spigotData->getTB() << "</Parameter>" << std::endl;
30  os << tabbing(level+1) << "<Parameter name='FIBER' type='int'>" << fiber << "</Parameter>" << std::endl;
31 
32  int genIndex=fiber+(spigotData->getTB()*10)+(spigotData->getSlot()*100)+(spigotData->getCrate()*10000);
33  os << tabbing(level+1) << "<Parameter name='GENERALIZEDINDEX' type='int'>" << std::dec << genIndex << "</Parameter>" << std::endl;
34  os << tabbing(level+1) << "<Parameter name='CREATIONTAG' type='string'>" << m_tagName << "</Parameter>" << std::endl;
35  os << tabbing(level+1) << "<Parameter name='CREATIONSTAMP' type='string'>" << m_stamp << "</Parameter>" << std::endl;
36  os << tabbing(level+1) << "<Parameter name='PATTERN_SPEC_NAME' type='string'>" << m_tagName << "</Parameter>" << std::endl;
37 
38 
39  // CREATIONTAG, CREATIONSTAMP, PATTERN_SPEC_NAME
40 
41  os << tabbing(level+1) << "<Data elements='1024' encoding='hex'>" << std::endl;
42 
43  ChannelPattern* p1=spigotData->getPattern((fiber-1)*3+1);
44  ChannelPattern* p2=spigotData->getPattern((fiber-1)*3+2);
45  ChannelPattern* p3=spigotData->getPattern((fiber-1)*3+3);
46 
47 
48  unsigned int w1,w2;
49  for (int i=0; i<512; i++) {
50  packWordsStd(p1->getCoded(i),p2->getCoded(i),p3->getCoded(i),i%4,w1,w2);
51  os << std::hex << w1 << ' ' << std::hex << w2 << ' ';
52  }
53 
54  os << std::endl << tabbing(level+1) << "</Data>" << std::endl;
55 
56  os << tabbing(level) << "</CFGBrick>" << std::endl;
57 }
int i
Definition: DBlmapReader.cc:9
int getCoded(int bc) const
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
static const char * tabbing(int level)
int getTB() const
int getSpigot() const
void packWordsStd(int adc0, int adc1, int adc2, int capid, unsigned int &w1, unsigned int &w2)
ChannelPattern * getPattern(int chan)
int getDCC() const
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
tuple level
Definition: testEve_cfg.py:34
int getSlot() const
int getCrate() const
double p3[4]
Definition: TauolaWrapper.h:91

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