CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
HcalTriggerKey Class Reference

#include <CaloOnlineTools/HcalOnlineDb/interface/HcalTriggerKey.h>

Inheritance diagram for HcalTriggerKey:
XMLDOMBlock

Public Member Functions

int add_data (std::string id, std::string type, std::string value)
 
int compose_key_dialogue (void)
 
int fill_key (std::string key_id, std::map< std::string, std::string > &key)
 
 HcalTriggerKey ()
 
int init (void)
 
virtual ~HcalTriggerKey ()
 
- Public Member Functions inherited from XMLDOMBlock
DOMElement * add_element (DOMElement *parent, XMLCh *tagname, XMLCh *value)
 
DOMDocument * getDocument (void)
 
DOMDocument * getDocumentConst (void) const
 
DOMDocument * getNewDocument (std::string xmlFileName)
 
std::string & getString (void)
 
std::string & getString (DOMNode *_node)
 
const char * getTagAttribute (const std::string &tagName, const std::string &attrName, int _item=0)
 
const char * getTagValue (const std::string &tagName, int _item=0, DOMDocument *_document=NULL)
 
const char * getTagValue (const std::string &tagName, int _item, DOMElement *_document)
 
std::string getTimestamp (time_t _time)
 
XMLDOMBlockoperator+= (const XMLDOMBlock &other)
 
void parse (InputSource &_source)
 
DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
DOMNode * setTagAttribute (DOMElement *_elem, const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
DOMNode * setTagAttribute (DOMElement *_elem, const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
DOMNode * setTagValue (const std::string &tagName, const std::string &tagValue, int _item=0, DOMDocument *_document=NULL)
 
DOMNode * setTagValue (DOMElement *_elem, const std::string &tagName, const std::string &tagValue, int _item=0)
 
DOMNode * setTagValue (const std::string &tagName, const int &tagValue, int _item=0, DOMDocument *_document=NULL)
 
DOMNode * setTagValue (DOMElement *_elem, const std::string &tagName, const int &tagValue, int _item=0)
 
int write (std::string target="stdout")
 
 XMLDOMBlock ()
 
 XMLDOMBlock (std::string xmlFileName)
 
 XMLDOMBlock (InputSource &_source)
 
 XMLDOMBlock (std::string _root, int rootElementName)
 
virtual ~XMLDOMBlock ()
 

Protected Attributes

MemBufInputSource * _data
 
MemBufInputSource * _root
 
- Protected Attributes inherited from XMLDOMBlock
DOMDocument * document
 
ErrorHandler * errHandler
 
XercesDOMParser * parser
 
std::string * the_string
 
std::string theFileName
 
XMLProcessortheProcessor
 

Private Member Functions

 HcalTriggerKey (const HcalTriggerKey &)
 
const HcalTriggerKeyoperator= (const HcalTriggerKey &)
 

Additional Inherited Members

- Protected Member Functions inherited from XMLDOMBlock
int init (std::string _root)
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 26 of file HcalTriggerKey.h.

Constructor & Destructor Documentation

HcalTriggerKey::HcalTriggerKey ( void  )

Definition at line 17 of file HcalTriggerKey.cc.

References _data, _root, init(), and XMLDOMBlock::parse().

18 {
19  _root = 0;
20  _data = 0;
21  init();
22  parse(*_root);
23 }
void parse(InputSource &_source)
Definition: XMLDOMBlock.cc:122
MemBufInputSource * _data
MemBufInputSource * _root
HcalTriggerKey::~HcalTriggerKey ( )
virtual

Definition at line 26 of file HcalTriggerKey.cc.

References _data, and _root.

27 {
28  if( _root ) delete _root;
29  if( _data ) delete _data;
30 }
MemBufInputSource * _data
MemBufInputSource * _root
HcalTriggerKey::HcalTriggerKey ( const HcalTriggerKey )
private

Member Function Documentation

int HcalTriggerKey::add_data ( std::string  id,
std::string  type,
std::string  value 
)

Definition at line 93 of file HcalTriggerKey.cc.

References _data, XMLProcessor::_toXMLCh(), XMLDOMBlock::document, XMLDOMBlock::getDocument(), and XMLDOMBlock::setTagValue().

Referenced by fill_key().

93  {
94  XMLDOMBlock data_block( *_data );
95  data_block.setTagValue("TRIGGER_KEY_ID",id);
96  data_block.setTagValue("TRIGGER_KEY_CONFIG_TYPE",type);
97  data_block.setTagValue("TRIGGER_KEY_CONFIG_VALUE",value);
98 
99  DOMDocument * data_doc = data_block . getDocument();
100 
101  DOMElement * data_set_elem = (DOMElement *)(document -> getElementsByTagName( XMLProcessor::_toXMLCh( "DATA_SET" ) ) -> item(0));
102 
103  DOMNode * clone_data = document -> importNode( data_doc -> getDocumentElement(), true );
104  data_set_elem -> appendChild( clone_data );
105 
106  //write("stdout");
107 
108  return 0;
109 }
type
Definition: HCALResponse.h:21
DOMDocument * document
Definition: XMLDOMBlock.h:97
DOMDocument * getDocument(void)
Definition: XMLDOMBlock.cc:312
static XMLCh * _toXMLCh(std::string temp)
Definition: XMLProcessor.h:184
MemBufInputSource * _data
int HcalTriggerKey::compose_key_dialogue ( void  )

Definition at line 122 of file HcalTriggerKey.cc.

References gather_cfg::cout, fill_key(), and AlCaHLTBitMon_QueryRunRegistry::string.

122  {
123  std::map<std::string, std::string> _key;
124  std::string _id, _type, _value;
125 
126  std::cout << std::endl << "Creating the trigger key..." << std::endl;
127  std::cout << std::endl << "Enter the key ID (or tag if you would): " << std::endl;
128  std::getline(std::cin, _id);
129  while(1){
130  std::cout << "Enter the next config type (or type exit if the trigger key is complete): " << std::endl;
131  std::getline(std::cin, _type);
132  if (_type.find("exit") != std::string::npos) break;
133  std::cout << "Enter the config value: " << std::endl;
134  std::getline(std::cin, _value);
135  _key.insert(std::pair<std::string, std::string>(_type, _value));
136  }
137 
138  fill_key(_id, _key);
139 
140  std::cout << std::endl << "Creating the trigger key... done" << std::endl;
141  return 0;
142 }
int fill_key(std::string key_id, std::map< std::string, std::string > &key)
tuple cout
Definition: gather_cfg.py:121
int HcalTriggerKey::fill_key ( std::string  key_id,
std::map< std::string, std::string > &  key 
)

Definition at line 112 of file HcalTriggerKey.cc.

References add_data().

Referenced by compose_key_dialogue().

112  {
113  int _c=0;
114  for(std::map<std::string,std::string>::const_iterator key_pair=key.begin(); key_pair!=key.end(); key_pair++){
115  add_data(key_id, key_pair->first, key_pair->second);
116  _c++;
117  }
118 
119  return _c;
120 }
list key
Definition: combine.py:13
int add_data(std::string id, std::string type, std::string value)
int HcalTriggerKey::init ( void  )

Definition at line 33 of file HcalTriggerKey.cc.

References _data, and _root.

Referenced by HcalTriggerKey().

34 {
35  static const char * _str = "\
36  <ROOT>\n\
37  <HEADER>\n\
38  <TYPE>\n\
39  <EXTENSION_TABLE_NAME>HCAL_TRIGGER_KEY</EXTENSION_TABLE_NAME>\n\
40  <NAME>HCAL trigger key</NAME>\n\
41  </TYPE>\n\
42  <RUN mode='no-run' />\n\
43  </HEADER>\n\
44  <DATA_SET>\n\
45  <VERSION>test_version</VERSION>\n\
46  <SUBVERSION>1</SUBVERSION>\n\
47  <CREATE_TIMESTAMP>2000-01-01 00:00:00.0</CREATE_TIMESTAMP>\n\
48  <CREATED_BY_USER>kukarzev</CREATED_BY_USER>\n\
49  <COMMENT_DESCRIPTION>test trigger key</COMMENT_DESCRIPTION>\n\
50  <PART>\n\
51  <NAME_LABEL>CMS-HCAL-ROOT</NAME_LABEL>\n\
52  </PART>\n\
53  </DATA_SET>\n\
54  <!-- Tags secton -->\n\
55  <ELEMENTS>\n\
56  <DATA_SET id='-1'/>\n\
57  <IOV id='1'>\n\
58  <INTERVAL_OF_VALIDITY_BEGIN>0</INTERVAL_OF_VALIDITY_BEGIN>\n\
59  <INTERVAL_OF_VALIDITY_END>1</INTERVAL_OF_VALIDITY_END>\n\
60  </IOV>\n\
61  <TAG id='2' mode='auto'>\n\
62  <TAG_NAME>trigger_key_tag</TAG_NAME>\n\
63  <DETECTOR_NAME>HCAL</DETECTOR_NAME>\n\
64  <COMMENT_DESCRIPTION>trigger_key_tag</COMMENT_DESCRIPTION>\n\
65  </TAG>\n\
66  </ELEMENTS>\n\
67  <MAPS>\n\
68  <TAG idref='2'>\n\
69  <IOV idref='1'>\n\
70  <DATA_SET idref='-1' />\n\
71  </IOV>\n\
72  </TAG>\n\
73  </MAPS>\n\
74  </ROOT>\n\
75  ";
76  const XMLByte * _template = (const XMLByte *)_str;
77  _root = new MemBufInputSource( _template, strlen( (const char *)_template ), "_root", false );
78 
79  static const char * _str2 = "\
80  <DATA>\n\
81  <TRIGGER_KEY_ID>TEST_trigger_key</TRIGGER_KEY_ID>\n\
82  <TRIGGER_KEY_CONFIG_TYPE>LUT_tag</TRIGGER_KEY_CONFIG_TYPE>\n\
83  <TRIGGER_KEY_CONFIG_VALUE>CRUZET_part4_physics_v3</TRIGGER_KEY_CONFIG_VALUE>\n\
84  </DATA>\n\
85  ";
86  const XMLByte * _template2 = (const XMLByte *)_str2;
87  _data = new MemBufInputSource( _template2, strlen( (const char *)_template2 ), "_data", false );
88 
89  return 0;
90 }
MemBufInputSource * _data
MemBufInputSource * _root
const HcalTriggerKey& HcalTriggerKey::operator= ( const HcalTriggerKey )
private

Member Data Documentation

MemBufInputSource* HcalTriggerKey::_data
protected
MemBufInputSource* HcalTriggerKey::_root
protected