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.

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

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 }

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.

References w2.

Referenced by writePattern().

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 }
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1

◆ setTagName()

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

◆ writePattern()

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

Definition at line 22 of file HtrXmlPatternWriter.cc.

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

Referenced by HtrXmlPatternTool::writeXML().

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 }
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
static const char * tabbing(int level)
int getCrate() const
int getSpigot() const
int getSlot() const
void packWordsStd(int adc0, int adc1, int adc2, int capid, unsigned int &w1, unsigned int &w2)
ChannelPattern * getPattern(int chan)
int getTB() const
int getDCC() const

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