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
XERCES_CPP_NAMESPACE::DOMElement * add_element (XERCES_CPP_NAMESPACE::DOMElement *parent, XMLCh *tagname, XMLCh *value)
 
XERCES_CPP_NAMESPACE::DOMDocument * getDocument (void)
 
XERCES_CPP_NAMESPACE::DOMDocument * getDocumentConst (void) const
 
XERCES_CPP_NAMESPACE::DOMDocument * getNewDocument (std::string xmlFileName)
 
std::string & getString (void)
 
std::string & getString (XERCES_CPP_NAMESPACE::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, XERCES_CPP_NAMESPACE::DOMDocument *_document=NULL)
 
const char * getTagValue (const std::string &tagName, int _item, XERCES_CPP_NAMESPACE::DOMElement *_document)
 
std::string getTimestamp (time_t _time)
 
XMLDOMBlockoperator+= (const XMLDOMBlock &other)
 
void parse (XERCES_CPP_NAMESPACE::InputSource &_source)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute (XERCES_CPP_NAMESPACE::DOMElement *_elem, const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute (XERCES_CPP_NAMESPACE::DOMElement *_elem, const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagValue (const std::string &tagName, const std::string &tagValue, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=NULL)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagValue (XERCES_CPP_NAMESPACE::DOMElement *_elem, const std::string &tagName, const std::string &tagValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagValue (const std::string &tagName, const int &tagValue, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=NULL)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagValue (XERCES_CPP_NAMESPACE::DOMElement *_elem, const std::string &tagName, const int &tagValue, int _item=0)
 
int write (std::string target="stdout")
 
 XMLDOMBlock ()
 
 XMLDOMBlock (std::string xmlFileName)
 
 XMLDOMBlock (XERCES_CPP_NAMESPACE::InputSource &_source)
 
 XMLDOMBlock (std::string _root, int rootElementName)
 
virtual ~XMLDOMBlock ()
 

Protected Attributes

XERCES_CPP_NAMESPACE::MemBufInputSource * _data
 
XERCES_CPP_NAMESPACE::MemBufInputSource * _root
 
- Protected Attributes inherited from XMLDOMBlock
XERCES_CPP_NAMESPACE::DOMDocument * document
 
XERCES_CPP_NAMESPACE::ErrorHandler * errHandler
 
XERCES_CPP_NAMESPACE::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

XERCES_CPP_NAMESPACE_USE HcalTriggerKey::HcalTriggerKey ( void  )

Definition at line 19 of file HcalTriggerKey.cc.

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

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

Definition at line 28 of file HcalTriggerKey.cc.

References _data, and _root.

29 {
30  if( _root ) delete _root;
31  if( _data ) delete _data;
32 }
XERCES_CPP_NAMESPACE::MemBufInputSource * _data
XERCES_CPP_NAMESPACE::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 95 of file HcalTriggerKey.cc.

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

Referenced by fill_key().

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

Definition at line 124 of file HcalTriggerKey.cc.

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

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

Definition at line 114 of file HcalTriggerKey.cc.

References add_data().

Referenced by compose_key_dialogue().

114  {
115  int _c=0;
116  for(std::map<std::string,std::string>::const_iterator key_pair=key.begin(); key_pair!=key.end(); key_pair++){
117  add_data(key_id, key_pair->first, key_pair->second);
118  _c++;
119  }
120 
121  return _c;
122 }
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
int add_data(std::string id, std::string type, std::string value)
int HcalTriggerKey::init ( void  )

Definition at line 35 of file HcalTriggerKey.cc.

References _data, and _root.

Referenced by HcalTriggerKey().

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

Member Data Documentation

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