35 static const char * _str =
"\
39 <EXTENSION_TABLE_NAME>HCAL_TRIGGER_KEY</EXTENSION_TABLE_NAME>\n\
40 <NAME>HCAL trigger key</NAME>\n\
42 <RUN mode='no-run' />\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\
51 <NAME_LABEL>CMS-HCAL-ROOT</NAME_LABEL>\n\
54 <!-- Tags secton -->\n\
56 <DATA_SET 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\
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\
70 <DATA_SET idref='-1' />\n\
76 const XMLByte * _template = (
const XMLByte *)_str;
77 _root =
new MemBufInputSource( _template, strlen( (
const char *)_template ),
"_root",
false );
79 static const char * _str2 =
"\
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\
86 const XMLByte * _template2 = (
const XMLByte *)_str2;
87 _data =
new MemBufInputSource( _template2, strlen( (
const char *)_template2 ),
"_data",
false );
96 data_block.
setTagValue(
"TRIGGER_KEY_CONFIG_TYPE",type);
97 data_block.
setTagValue(
"TRIGGER_KEY_CONFIG_VALUE",value);
99 DOMDocument * data_doc = data_block .
getDocument();
103 DOMNode * clone_data =
document -> importNode( data_doc -> getDocumentElement(),
true );
104 data_set_elem -> appendChild( clone_data );
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);
123 std::map<std::string, std::string> _key;
124 std::string _id, _type, _value;
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);
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));
140 std::cout << std::endl <<
"Creating the trigger key... done" << std::endl;
DOMDocument * getDocument(void)
int fill_key(std::string key_id, std::map< std::string, std::string > &key)
static XMLCh * _toXMLCh(std::string temp)
void parse(InputSource &_source)
MemBufInputSource * _data
int add_data(std::string id, std::string type, std::string value)
virtual ~HcalTriggerKey()
MemBufInputSource * _root
DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, DOMDocument *_document=NULL)
int compose_key_dialogue(void)