CMS 3D CMS Logo

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::HtrXmlPatternWriter ( )

Definition at line 11 of file HtrXmlPatternWriter.cc.

11  {
12  // set the timestamp!
13  time_t now1 = time(nullptr);
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 }

References edmScanValgrind::buffer, m_stamp, submitPVValidationJobs::now, and ntuplemaker::time.

Member Function Documentation

◆ packWordsStd()

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

Definition at line 65 of file HtrXmlPatternWriter.cc.

65  {
66  w1 = 0x3;
67  w1 |= (capid & 0x3) << 3;
68  w1 |= (capid & 0x3) << 5;
69  w1 |= (capid & 0x3) << 7;
70  w1 |= adc2 << 9;
71  w1 |= 0x10000; // data valid
72  w2 = adc1 << 1;
73  w2 |= adc0 << 9;
74  w2 |= 0x10000; // data valid
75 }

References w2.

Referenced by writePattern().

◆ setTagName()

void HtrXmlPatternWriter::setTagName ( std::string  tn)
inline

Definition at line 10 of file HtrXmlPatternWriter.h.

10 { m_tagName = tn; }

References m_tagName.

Referenced by HtrXmlPatternTool::HtrXmlPatternTool().

◆ writePattern()

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

Definition at line 22 of file HtrXmlPatternWriter.cc.

22  {
23  os << tabbing(level) << "<CFGBrick>" << std::endl;
24  os << tabbing(level + 1) << "<Parameter name='DCC' type='int'>" << std::dec << spigotData->getDCC() << "</Parameter>"
25  << std::endl;
26  os << tabbing(level + 1) << "<Parameter name='SPIGOT' type='int'>" << std::dec << spigotData->getSpigot()
27  << "</Parameter>" << std::endl;
28  os << tabbing(level + 1) << "<Parameter name='CRATE' type='int'>" << std::dec << spigotData->getCrate()
29  << "</Parameter>" << std::endl;
30  os << tabbing(level + 1) << "<Parameter name='SLOT' type='int'>" << spigotData->getSlot() << "</Parameter>"
31  << std::endl;
32  os << tabbing(level + 1) << "<Parameter name='TOPBOTTOM' type='int'>" << spigotData->getTB() << "</Parameter>"
33  << std::endl;
34  os << tabbing(level + 1) << "<Parameter name='FIBER' type='int'>" << fiber << "</Parameter>" << std::endl;
35 
36  int genIndex = fiber + (spigotData->getTB() * 10) + (spigotData->getSlot() * 100) + (spigotData->getCrate() * 10000);
37  os << tabbing(level + 1) << "<Parameter name='GENERALIZEDINDEX' type='int'>" << std::dec << genIndex << "</Parameter>"
38  << std::endl;
39  os << tabbing(level + 1) << "<Parameter name='CREATIONTAG' type='string'>" << m_tagName << "</Parameter>"
40  << std::endl;
41  os << tabbing(level + 1) << "<Parameter name='CREATIONSTAMP' type='string'>" << m_stamp << "</Parameter>"
42  << std::endl;
43  os << tabbing(level + 1) << "<Parameter name='PATTERN_SPEC_NAME' type='string'>" << m_tagName << "</Parameter>"
44  << std::endl;
45 
46  // CREATIONTAG, CREATIONSTAMP, PATTERN_SPEC_NAME
47 
48  os << tabbing(level + 1) << "<Data elements='1024' encoding='hex'>" << std::endl;
49 
50  ChannelPattern* p1 = spigotData->getPattern((fiber - 1) * 3 + 1);
51  ChannelPattern* p2 = spigotData->getPattern((fiber - 1) * 3 + 2);
52  ChannelPattern* p3 = spigotData->getPattern((fiber - 1) * 3 + 3);
53 
54  unsigned int w1, w2;
55  for (int i = 0; i < 512; i++) {
56  packWordsStd(p1->getCoded(i), p2->getCoded(i), p3->getCoded(i), i % 4, w1, w2);
57  os << std::hex << w1 << ' ' << std::hex << w2 << ' ';
58  }
59 
60  os << std::endl << tabbing(level + 1) << "</Data>" << std::endl;
61 
62  os << tabbing(level) << "</CFGBrick>" << std::endl;
63 }

References TauDecayModes::dec, HalfHtrData::getCrate(), HalfHtrData::getDCC(), HalfHtrData::getPattern(), HalfHtrData::getSlot(), HalfHtrData::getSpigot(), HalfHtrData::getTB(), mps_fire::i, personalPlayback::level, m_stamp, m_tagName, p1, p2, p3, packWordsStd(), tabbing(), and w2.

Referenced by HtrXmlPatternTool::writeXML().

Member Data Documentation

◆ m_stamp

std::string HtrXmlPatternWriter::m_stamp
private

Definition at line 15 of file HtrXmlPatternWriter.h.

Referenced by HtrXmlPatternWriter(), and writePattern().

◆ m_tagName

std::string HtrXmlPatternWriter::m_tagName
private

Definition at line 15 of file HtrXmlPatternWriter.h.

Referenced by setTagName(), and writePattern().

personalPlayback.level
level
Definition: personalPlayback.py:22
HalfHtrData::getDCC
int getDCC() const
Definition: HtrXmlPatternSet.h:52
w2
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
mps_fire.i
i
Definition: mps_fire.py:428
ChannelPattern
Definition: HtrXmlPatternSet.h:8
submitPVValidationJobs.now
now
Definition: submitPVValidationJobs.py:639
HtrXmlPatternWriter::packWordsStd
void packWordsStd(int adc0, int adc1, int adc2, int capid, unsigned int &w1, unsigned int &w2)
Definition: HtrXmlPatternWriter.cc:65
HalfHtrData::getSlot
int getSlot() const
Definition: HtrXmlPatternSet.h:49
tabbing
static const char * tabbing(int level)
Definition: HtrXmlPatternWriter.cc:3
HalfHtrData::getCrate
int getCrate() const
Definition: HtrXmlPatternSet.h:48
HalfHtrData::getPattern
ChannelPattern * getPattern(int chan)
Definition: HtrXmlPatternSet.h:47
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
HalfHtrData::getSpigot
int getSpigot() const
Definition: HtrXmlPatternSet.h:51
p2
double p2[4]
Definition: TauolaWrapper.h:90
HtrXmlPatternWriter::m_tagName
std::string m_tagName
Definition: HtrXmlPatternWriter.h:15
p1
double p1[4]
Definition: TauolaWrapper.h:89
HtrXmlPatternWriter::m_stamp
std::string m_stamp
Definition: HtrXmlPatternWriter.h:15
HalfHtrData::getTB
int getTB() const
Definition: HtrXmlPatternSet.h:50
p3
double p3[4]
Definition: TauolaWrapper.h:91
ntuplemaker.time
time
Definition: ntuplemaker.py:310
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143