11 (
const std::string& ParameterName,
12 dqm_core::test::DummyAlgorithmConfig &
config,
13 const std::string& algorithmname,
14 const std::string& histogramname,
15 const std::string& reffilename,
16 const std::string& refhistogramname,
18 const std::string& regionname) :
19 m_ParameterName(ParameterName),
21 m_regionname(regionname),
22 m_algorithmname(algorithmname),
23 m_histogramname(histogramname),
24 m_refhistogramname(refhistogramname),
25 m_reffilename(reffilename),
35 m_myfile<<
"<obj class=\"DQRegion\" id=\""+m_regionname+
"\">\n";
36 m_myfile<<
"<attr name=\"InputDataSource\" type=\"string\">\"\"</attr>\n";
37 m_myfile<<
"<attr name=\"Weight\" type=\"float\">1</attr>\n";
38 m_myfile<<
"<attr name=\"Action\" type=\"string\">\"\"</attr>\n";
39 m_myfile<<
"<rel name=\"Algorithm\">\"DQAlgorithm\" \"SimpleSummary\"</rel>\n";
40 m_myfile<<
"<rel name=\"AlgorithmParameters\" num=\"0\"></rel>\n";
41 m_myfile<<
"<rel name=\"References\" num=\"0\"></rel>\n";
42 m_myfile<<
"<rel name=\"GreenThresholds\" num=\"0\"></rel>\n";
43 m_myfile<<
"<rel name=\"RedThresholds\" num=\"0\"></rel>\n";
44 m_myfile<<
"<rel name=\"DQRegions\" num=\"0\"></rel>\n";
45 m_myfile<<
"<rel name=\"DQParameters\" num=\"1\">\n";
46 m_myfile<<
" \"DQParameter\" \""+m_ParameterName+
"\"\n";
48 m_myfile<<
"</obj>\n\n";
54 m_myfile<<
"<obj class=\"DQAgent\" id=\""+m_regionname+
"\">\n";
55 m_myfile<<
"<attr name=\"Parameters\" type=\"string\">\"-n "+m_regionname+
" -p ${TDAQ_PARTITION}\"</attr>\n";
56 m_myfile<<
"<attr name=\"RestartParameters\" type=\"string\">\"-n "+m_regionname+
" -p ${TDAQ_PARTITION}\"</attr>\n";
57 m_myfile<<
"<attr name=\"ControlledByOnline\" type=\"bool\">1</attr>\n";
58 m_myfile<<
"<attr name=\"IfDies\" type=\"enum\">\"Restart\"</attr>\n";
59 m_myfile<<
"<attr name=\"IfFailed\" type=\"enum\">\"Restart\"</attr>\n";
60 m_myfile<<
"<attr name=\"StartAt\" type=\"enum\">\"Boot\"</attr>\n";
61 m_myfile<<
"<attr name=\"StopAt\" type=\"enum\">\"Shutdown\"</attr>\n";
62 m_myfile<<
"<attr name=\"InitTimeout\" type=\"u32\">0</attr>\n";
63 m_myfile<<
"<attr name=\"StartIn\" type=\"string\">\"\"</attr>\n";
64 m_myfile<<
"<attr name=\"InputDevice\" type=\"string\">\"\"</attr>\n";
65 m_myfile<<
"<attr name=\"Logging\" type=\"bool\">1</attr>\n";
66 m_myfile<<
"<rel name=\"InitializationDependsFrom\" num=\"0\">\n";
68 m_myfile<<
"<rel name=\"ShutdownDependsFrom\" num=\"0\"></rel>\n";
69 m_myfile<<
"<rel name=\"Program\">\"Binary\" \"dqmf_agent\"</rel>\n";
70 m_myfile<<
"<rel name=\"ExplicitTag\">\"\" \"\"</rel>\n";
71 m_myfile<<
"<rel name=\"Uses\" num=\"0\"></rel>\n";
72 m_myfile<<
"<rel name=\"ProcessEnvironment\" num=\"0\">\n";
74 m_myfile<<
"<rel name=\"RunsOn\">\"\" \"\"</rel>\n";
75 m_myfile<<
"<rel name=\"DQRegions\" num=\"1\">\n";
76 m_myfile<<
" \"DQRegion\" \""+m_regionname+
"\"\n";
86 int objsize=
object.size();
88 sprintf(
line,
"<rel name=\"%sThresholds\" num=\"%d\">\n",
Name.c_str(),objsize);
90 std::map<std::string,double>::const_iterator iter;
92 for (iter=
object.
begin();iter!=
object.end();++iter){
94 m_red_id.push_back(
Name+
"Thresh_"+ParameterName+
"_"+iter->first);
96 m_green_id.push_back(
Name+
"Thresh_"+ParameterName+
"_"+iter->first);
99 m_myfile <<
" \"DQThreshold\" \""+
Name+
"Thresh_"+ParameterName+
"_"+iter->first+
"\"\n";
102 m_myfile<<
"</rel>\n";
112 std::map<std::string,double>
thresh;
113 std::vector<std::string>
id;
114 for (
int i=0;
i<2;++
i){
124 m_myfile<<
"<obj class=\"DQThreshold\" id=\""+
id[
count]+
"\">\n";
125 m_myfile<<
" <attr name=\"Name\" type=\"string\">\""+iter->first+
"\"</attr>\n";
126 sprintf(
line,
" <attr name=\"Value\" type=\"double\">%4.2f</attr>\n</obj>\n\n",iter->second);
141 for (
auto& param : m_params ) {
142 m_myfile<<
"<obj class=\"DQAlgorithmParameter\" id=\""+m_param_id[
count]+
"\">\n";
143 m_myfile<<
" <attr name=\"Name\" type=\"string\">\""+param.first+
"\"</attr>\n";
144 sprintf(pline,
" <attr name=\"Value\" type=\"double\" num=\"1\">%4.2f</attr>\n</obj>\n\n",param.second);
149 for (
auto& param : m_strParams ) {
150 m_myfile<<
"<obj class=\"DQAlgorithmParameter\" id=\""+m_param_id[
count]+
"\">\n";
151 m_myfile<<
" <attr name=\"Name\" type=\"string\">\""+param.first+
"\"</attr>\n";
152 m_myfile<<
" <attr name=\"Value\" type=\"string\" num=\"1\">"+param.second+
"</attr>\n";
153 m_myfile<<
"</obj>\n\n";
170 is.open (
"../share/oks-xml-header.txt", ios::in );
188 if (m_regionname !=
""){
195 m_myfile <<
"<obj class=\"DQParameter\" id=\""+m_ParameterName+
"\">\n";
196 m_myfile <<
"<attr name=\"InputDataSource\" type=\"string\">\"Histogramming.PT."+m_histogramname+
"\"</attr>\n";
198 char weightline [500];
199 sprintf(weightline,
"<attr name=\"Weight\" type=\"float\">%f</attr>\n", m_weight);
200 m_myfile<<weightline;
201 m_myfile <<
"<rel name=\"Algorithm\"> \"DQAlgorithm\" \""+m_algorithmname+
"\"</rel>\n";
202 m_myfile <<
"<attr name=\"Action\" type=\"string\">\"\"</attr>\n";
205 m_params=m_config.getParameters();
206 int paramsize=m_params.size();
207 m_strParams=m_config.getGenericParameters();
208 paramsize+=m_strParams.size();
210 char paramsline [500];
211 sprintf(paramsline,
"<rel name=\"AlgorithmParameters\" num=\"%d\">\n", paramsize);
212 m_myfile <<paramsline;
214 std::map<std::string,double>::const_iterator iter;
215 for (
auto& param : m_params ) {
216 m_myfile <<
" \"DQAlgorithmParameter\" \"Params_"+m_ParameterName+
"_"+param.first+
"\"\n";
217 m_param_id.push_back(
"Params_"+m_ParameterName+
"_"+param.first);
219 for (
auto& param : m_strParams ) {
220 m_myfile <<
" \"DQAlgorithmParameter\" \"Params_"+m_ParameterName+
"_"+param.first+
"\"\n";
221 m_param_id.push_back(
"Params_"+m_ParameterName+
"_"+param.first);
223 m_myfile<<
"</rel>\n";
226 if (m_refhistogramname ==
"" && m_reffilename==
"") {
227 m_myfile<<
"<rel name=\"References\" num=\"0\"> </rel>\n";
229 m_myfile<<
"<rel name=\"References\" num=\"1\">\"DQReference\" \"ref_"+m_ParameterName+
"\"</rel>\n";
233 m_gthresh=m_config.getGreenThresholds();
234 WriteThresholdFromMap(m_gthresh,m_ParameterName,
"Green");
237 m_rthresh=m_config.getRedThresholds();
240 m_myfile<<
"</obj>\n\n\n";
243 if (m_refhistogramname !=
"" && m_reffilename !=
"") {
244 m_myfile<<
"<obj class=\"DQReference\" id=\"ref_"+m_ParameterName+
"\">\n";
245 m_myfile<<
"<attr name=\"Reference\" type=\"string\">\""+m_reffilename+
":"+m_refhistogramname+
"\"</attr>\n";
246 m_myfile<<
"<attr name=\"ExternalConditionName\" type=\"string\">\"\"</attr>\n";
247 m_myfile<<
"<attr name=\"ExternalConditionValue\" type=\"double\">0</attr>\n";
248 m_myfile<<
"</obj>\n\n";
255 m_myfile<<
"</oks-data>";