31 unsigned char* parameter_value,
32 Long_t size_parameter_value,
69 unsigned char* parameter_value,
70 Long_t size_parameter_value,
74 if (connDb ==
nullptr)
80 "start_run, end_period, end_run, value_key, parameter_value, expiry_date) "
81 "values ($1, $2, $3, $4, $5, $6, $7, $8, $9)");
86 stmt->
SetInt(1, parameter_id);
87 stmt->
SetInt(2, start_period);
88 stmt->
SetInt(3, start_run);
89 stmt->
SetInt(4, end_period);
91 stmt->
SetInt(6, value_key);
92 stmt->
SetBinary(7, parameter_value, size_parameter_value, 0x4000000);
93 if (expiry_date ==
nullptr)
100 cout <<
"ERROR: inserting new detector parameter to the Database has been failed" << endl;
111 db_server->
Statement(
"SELECT currval(pg_get_serial_sequence('detector_parameter','value_id'))");
120 cout <<
"ERROR: no last ID in DB!" << endl;
124 value_id = stmt_last->
GetInt(0);
128 cout <<
"ERROR: getting last ID has been failed!" << endl;
134 tmp_value_id = value_id;
136 tmp_detector_name = detector_name;
137 int tmp_parameter_id;
138 tmp_parameter_id = parameter_id;
139 int tmp_start_period;
140 tmp_start_period = start_period;
142 tmp_start_run = start_run;
144 tmp_end_period = end_period;
146 tmp_end_run = end_run;
148 tmp_value_key = value_key;
149 unsigned char* tmp_parameter_value;
150 Long_t tmp_sz_parameter_value = size_parameter_value;
151 tmp_parameter_value =
new unsigned char[tmp_sz_parameter_value];
152 memcpy(tmp_parameter_value, parameter_value, tmp_sz_parameter_value);
154 if (expiry_date ==
nullptr)
155 tmp_expiry_date =
nullptr;
157 tmp_expiry_date =
new TDatime(*expiry_date);
159 return new UniDetectorParameter(connDb, tmp_value_id, tmp_detector_name, tmp_parameter_id, tmp_start_period,
160 tmp_start_run, tmp_end_period, tmp_end_run, tmp_value_key, tmp_parameter_value,
161 tmp_sz_parameter_value, tmp_expiry_date);
168 if (connDb ==
nullptr)
173 TString sql =
TString::Format(
"select value_id, detector_name, parameter_id, start_period, start_run, end_period, "
174 "end_run, value_key, parameter_value, expiry_date "
175 "from detector_parameter "
176 "where value_id = %d",
182 cout <<
"ERROR: getting detector parameter from the database has been failed" << endl;
194 cout <<
"ERROR: detector parameter was not found in the database" << endl;
202 tmp_value_id = stmt->
GetInt(0);
205 int tmp_parameter_id;
206 tmp_parameter_id = stmt->
GetInt(2);
207 int tmp_start_period;
208 tmp_start_period = stmt->
GetInt(3);
210 tmp_start_run = stmt->
GetInt(4);
212 tmp_end_period = stmt->
GetInt(5);
214 tmp_end_run = stmt->
GetInt(6);
216 tmp_value_key = stmt->
GetInt(7);
217 unsigned char* tmp_parameter_value;
218 tmp_parameter_value =
nullptr;
219 Long_t tmp_sz_parameter_value = 0;
220 stmt->
GetBinary(8, (
void*&)tmp_parameter_value, tmp_sz_parameter_value);
223 tmp_expiry_date =
nullptr;
229 return new UniDetectorParameter(connDb, tmp_value_id, tmp_detector_name, tmp_parameter_id, tmp_start_period,
230 tmp_start_run, tmp_end_period, tmp_end_run, tmp_value_key, tmp_parameter_value,
231 tmp_sz_parameter_value, tmp_expiry_date);
238 if (connDb ==
nullptr)
244 "from detector_parameter "
245 "where value_id = %d",
251 cout <<
"ERROR: getting detector parameter from the database has been failed" << endl;
278 if (connDb ==
nullptr)
284 "where value_id = $1");
288 stmt->
SetInt(0, value_id);
292 cout <<
"ERROR: deleting detector parameter from the dataBase has been failed" << endl;
308 if (connDb ==
nullptr)
313 TString sql =
TString::Format(
"select value_id, detector_name, parameter_id, start_period, start_run, end_period, "
314 "end_run, value_key, parameter_value, expiry_date "
315 "from detector_parameter");
320 cout <<
"ERROR: getting all 'detector parameters' from the database has been failed" << endl;
331 cout <<
"Table 'detector_parameter':" << endl;
333 cout <<
"value_id: ";
334 cout << (stmt->
GetInt(0));
335 cout <<
", detector_name: ";
337 cout <<
", parameter_id: ";
338 cout << (stmt->
GetInt(2));
339 cout <<
", start_period: ";
340 cout << (stmt->
GetInt(3));
341 cout <<
", start_run: ";
342 cout << (stmt->
GetInt(4));
343 cout <<
", end_period: ";
344 cout << (stmt->
GetInt(5));
345 cout <<
", end_run: ";
346 cout << (stmt->
GetInt(6));
347 cout <<
", value_key: ";
348 cout << (stmt->
GetInt(7));
349 cout <<
", parameter_value: ";
350 unsigned char* tmp_parameter_value =
nullptr;
351 Long_t tmp_sz_parameter_value = 0;
352 stmt->
GetBinary(8, (
void*&)tmp_parameter_value, tmp_sz_parameter_value);
353 cout << (
void*)tmp_parameter_value <<
", binary size: " << tmp_sz_parameter_value;
354 cout <<
", expiry_date: ";
372 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
379 "set detector_name = $1 "
380 "where value_id = $2");
389 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
404 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
411 "set parameter_id = $1 "
412 "where value_id = $2");
416 stmt->
SetInt(0, parameter_id);
421 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
436 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
443 "set start_period = $1 "
444 "where value_id = $2");
448 stmt->
SetInt(0, start_period);
453 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
468 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
475 "set start_run = $1 "
476 "where value_id = $2");
480 stmt->
SetInt(0, start_run);
485 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
500 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
507 "set end_period = $1 "
508 "where value_id = $2");
512 stmt->
SetInt(0, end_period);
517 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
532 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
540 "where value_id = $2");
549 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
564 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
571 "set value_key = $1 "
572 "where value_id = $2");
576 stmt->
SetInt(0, value_key);
581 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
596 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
603 "set parameter_value = $1 "
604 "where value_id = $2");
608 stmt->
SetBinary(0, parameter_value, size_parameter_value, 0x4000000);
613 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
632 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
639 "set expiry_date = $1 "
640 "where value_id = $2");
644 if (expiry_date ==
nullptr)
652 cout <<
"ERROR: updating information about detector parameter has been failed" << endl;
660 if (expiry_date ==
nullptr)
672 cout <<
"Table 'detector_parameter'";
678 <<
". expiry_date: " << (
ts_expiry_date ==
nullptr ?
"nullptr" : (*ts_expiry_date).AsSQLString()) << endl;
687 if (enum_parameter_type > -1) {
689 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
698 "where parameter_id = %d",
704 cout <<
"CRITICAL ERROR: getting record with parameter from 'parameter_' table has been failed" << endl;
713 cout <<
"CRITICAL ERROR: the parameter with id '" <<
i_parameter_id <<
"' was not found" << endl;
719 int parameter_type = stmt->
GetInt(1);
722 if (parameter_type != enum_parameter_type) {
723 cout <<
"CRITICAL ERROR: the parameter with name '" << parameter_name
724 <<
"' is not corresponding the given type: "
726 << parameter_type <<
", but user type - " << enum_parameter_type << endl;
738 cout <<
"Connection object is null" << endl;
745 "set parameter_value = $1 "
746 "where detector_name = $2 and parameter_id = $3 and start_period = $4 and start_run "
747 "= $5 and end_period = $6 and end_run = $7 and value_key = $8");
752 stmt->
SetBinary(0, (
void*)p_parameter_value, size_parameter_value);
763 cout <<
"ERROR: updating the detector parameter has been failed" << endl;
784 unsigned char* p_parameter_value,
785 Long_t size_parameter_value,
789 if (((end_period < start_period) or ((end_period == start_period) and (end_run < start_run)))
790 or ((start_period > end_period) or ((start_period == end_period) and (start_run > end_run))))
792 cout <<
"ERROR: end run should be after or the same as start run" << endl;
797 if (connDb ==
nullptr)
802 int parameter_id = -1;
809 TString sql =
TString::Format(
"insert into detector_parameter(detector_name, parameter_id, start_period, "
810 "start_run, end_period, end_run, value_key, parameter_value) "
811 "values ($1, $2, $3, $4, $5, $6, $7, $8)");
820 stmt->
SetInt(1, parameter_id);
821 stmt->
SetInt(2, start_period);
822 stmt->
SetInt(3, start_run);
823 stmt->
SetInt(4, end_period);
825 stmt->
SetInt(6, value_key);
826 stmt->
SetBinary(7, (
void*)p_parameter_value, size_parameter_value);
830 cout <<
"ERROR: inserting new parameter value to the database has been failed" << endl;
842 db_server->
Statement(
"SELECT currval(pg_get_serial_sequence('detector_parameter','value_id'))");
850 cout <<
"ERROR: no last ID in the Database for the parameter value has been found!" << endl;
854 last_id = stmt_last->
GetInt(0);
858 cout <<
"ERROR: getting last ID for new parameter value has been failed!" << endl;
865 return new UniDetectorParameter(connDb, last_id, detector_name, parameter_id, start_period, start_run, end_period,
866 end_run, value_key, p_parameter_value, size_parameter_value,
nullptr);
876 vector<UniValue*> parameter_value,
879 if (parameter_value.size() < 1) {
880 cout <<
"ERROR: The length of the parameter array should be greater zero" << endl;
883 enumValueType parameter_type = parameter_value[0]->GetType();
886 size_t size_parameter_value = 0;
887 for (
size_t i = 0;
i < parameter_value.size();
i++) {
888 if (parameter_value[
i]->GetType() != parameter_type) {
889 cout <<
"ERROR: the type of the parameters in the array must be the same" << endl;
892 size_parameter_value += parameter_value[
i]->GetStorageSize();
896 unsigned char* p_parameter_value =
new unsigned char[size_parameter_value];
897 unsigned char* tmp_pointer = p_parameter_value;
898 for (
size_t i = 0;
i < parameter_value.size();
i++) {
899 parameter_value[
i]->WriteValue(tmp_pointer);
900 tmp_pointer += parameter_value[
i]->GetStorageSize();
906 start_run = first_run;
909 end_period = start_period;
917 detector_name, parameter_name, start_period, start_run, end_period, end_run, p_parameter_value,
918 size_parameter_value, parameter_type, value_key);
919 if (pDetectorParameter ==
nullptr)
920 delete[] p_parameter_value;
922 return pDetectorParameter;
935 if (parameter_value ==
nullptr) {
936 cout <<
"ERROR: the parameter value must not be nullptr" << endl;
943 unsigned char* p_parameter_value =
new unsigned char[size_parameter_value];
944 parameter_value->
WriteValue(p_parameter_value);
949 start_run = first_run;
952 end_period = start_period;
960 detector_name, parameter_name, start_period, start_run, end_period, end_run, p_parameter_value,
961 size_parameter_value, parameter_type, value_key);
962 if (pDetectorParameter ==
nullptr)
963 delete[] p_parameter_value;
965 return pDetectorParameter;
977 if (connDb ==
nullptr)
983 "end_period, end_run, parameter_value, expiry_date "
984 "from detector_parameter dp join parameter_ p on dp.parameter_id = p.parameter_id "
985 "where lower(detector_name) = lower('%s') and lower(parameter_name) = lower('%s') "
986 "and (not (((%d < start_period) or ((%d = start_period) and (%d < start_run))) or "
987 "((%d > end_period) or ((%d = end_period) and (%d > end_run))))) "
988 "and value_key = %d",
989 detector_name.
Data(), parameter_name.Data(), period_number, period_number, run_number,
990 period_number, period_number, run_number, value_key);
991 if (usage_time !=
nullptr)
992 sql +=
TString::Format(
" and ((expiry_date is null) or ('%s' < expiry_date)) order by expiry_date",
993 (*usage_time).AsSQLString());
995 sql +=
" and expiry_date is null";
1000 cout <<
"ERROR: getting record from the Database has been failed" << endl;
1011 cout <<
"ERROR: parameter value was not found in the Condition Database" << endl;
1018 tmp_value_id = stmt->
GetInt(0);
1021 int tmp_parameter_id;
1022 tmp_parameter_id = stmt->
GetInt(2);
1023 int tmp_start_period;
1024 tmp_start_period = stmt->
GetInt(3);
1026 tmp_start_run = stmt->
GetInt(4);
1028 tmp_end_period = stmt->
GetInt(5);
1030 tmp_end_run = stmt->
GetInt(6);
1031 unsigned char* tmp_parameter_value =
nullptr;
1032 Long_t tmp_sz_parameter_value = 0;
1033 stmt->
GetBinary(7, (
void*&)tmp_parameter_value, tmp_sz_parameter_value);
1036 tmp_expiry_date =
nullptr;
1042 return new UniDetectorParameter(connDb, tmp_value_id, tmp_detector_name, tmp_parameter_id, tmp_start_period,
1043 tmp_start_run, tmp_end_period, tmp_end_run, value_key, tmp_parameter_value,
1044 tmp_sz_parameter_value, tmp_expiry_date);
1058 if (connDb ==
nullptr)
1063 TString sql =
"delete from detector_parameter "
1064 "where lower(detector_name) = lower($1) and parameter_id IN (select parameter_id from parameter_ "
1065 "where lower(parameter_name) = lower($2)) and "
1066 "start_period = $3 and start_run = $4 and end_period = $5 and end_run = $6 and value_key = $7";
1067 if (usage_time ==
nullptr)
1068 sql +=
" and expiry_date is null";
1070 sql +=
" and expiry_date >= $8 and expiry_date < $9";
1076 stmt->
SetInt(2, start_period);
1077 stmt->
SetInt(3, start_run);
1078 stmt->
SetInt(4, end_period);
1079 stmt->
SetInt(5, end_run);
1080 stmt->
SetInt(6, value_key);
1081 if (usage_time !=
nullptr) {
1089 cout <<
"ERROR: deleting parameter value from the Database has been failed" << endl;
1097 cout <<
"WARNING: parameter value was not found in the Condition Database for deletion" << endl;
1111 unsigned char* p_parameter_value =
GetUNC();
1112 if (p_parameter_value ==
nullptr)
1116 while (full_size > 0) {
1119 pParameterValue->
ReadValue(p_parameter_value);
1122 parameter_value.push_back(pParameterValue);
1131 unsigned char* p_parameter_value =
GetUNC();
1132 if (p_parameter_value ==
nullptr)
1136 parameter_value->
ReadValue(p_parameter_value);
1138 return parameter_value;
1144 if (parameter_value.size() < 1) {
1145 cout <<
"ERROR: The length of the parameter array should be greater zero" << endl;
1150 size_t size_parameter_value = 0;
1151 for (
size_t i = 0;
i < parameter_value.size();
i++)
1152 size_parameter_value += parameter_value[
i]->GetStorageSize();
1153 unsigned char* p_parameter_value =
new unsigned char[size_parameter_value];
1156 unsigned char* tmp_pointer = p_parameter_value;
1157 for (
size_t i = 0;
i < parameter_value.size();
i++) {
1158 parameter_value[
i]->WriteValue(tmp_pointer);
1159 tmp_pointer += parameter_value[
i]->GetStorageSize();
1162 int res_code =
SetUNC(p_parameter_value, size_parameter_value);
1163 if (res_code != 0) {
1164 delete[] p_parameter_value;
1174 if (parameter_value ==
nullptr) {
1175 cout <<
"ERROR: the parameter value must not be nullptr" << endl;
1181 unsigned char* p_parameter_value =
new unsigned char[size_parameter_value];
1182 parameter_value->
WriteValue(p_parameter_value);
1184 int res_code =
SetUNC(p_parameter_value, size_parameter_value);
1185 if (res_code != 0) {
1186 delete[] p_parameter_value;
1195 const char* parameter_name,
1203 cout <<
"ERROR: object pointer is nullptr" << endl;
1214 cout <<
"ERROR: buffer for writing the given object is nullptr" << endl;
1223 detector_name, parameter_name, start_period, start_run, end_period, end_run, pValue);
1224 if (pParameterValue ==
nullptr) {
1230 delete pParameterValue;
1237 const char* parameter_name,
1244 if (!pDetectorParameter)
1263 const char* parameter_name,
1271 cout <<
"ERROR: object pointer is nullptr" << endl;
1280 json_value.
value = json::parse(json_str.
Data());
1282 detector_name, parameter_name, start_period, start_run, end_period, end_run, &json_value);
1283 if (pParameterValue ==
nullptr) {
1288 delete pParameterValue;
1295 const char* parameter_name,
1303 if (!pDetectorParameter)
1321 const char* parameter_name,
1326 const char* file_path)
1328 TString strFilePath(file_path);
1329 gSystem->ExpandPathName(strFilePath);
1331 FILE* cur_file = fopen(strFilePath.
Data(),
"rb");
1332 if (cur_file ==
nullptr) {
1333 cout <<
"ERROR: opening file: " << strFilePath <<
" was failed" << endl;
1337 fseek(cur_file, 0, SEEK_END);
1338 size_t file_size = ftell(cur_file);
1340 if (file_size <= 0) {
1341 cout <<
"ERROR: getting file size: " << strFilePath <<
" was failed" << endl;
1346 unsigned char* buffer =
new unsigned char[file_size];
1347 if (buffer ==
nullptr) {
1348 cout <<
"ERROR: getting memory from heap for file was failed" << endl;
1353 size_t bytes_read = fread(buffer, 1, file_size, cur_file);
1354 if (bytes_read != file_size) {
1355 cout <<
"ERROR: reading file: " << strFilePath <<
", got " << bytes_read <<
" bytes of " << file_size << endl;
1365 pValue->
size = file_size;
1366 pValue->
value = buffer;
1368 detector_name, parameter_name, start_period, start_run, end_period, end_run, pValue);
1369 if (pParameterValue ==
nullptr) {
1376 delete pParameterValue;
1384 const char* parameter_name,
1387 const char* file_path)
1391 if (pDetectorParameter ==
nullptr)
1395 FILE* cur_file = fopen(file_path,
"wb");
1396 if (cur_file ==
nullptr) {
1397 cout <<
"ERROR: creating file: " << file_path <<
" has been failed!" << endl;
1399 delete pDetectorParameter;
1403 unsigned char* buffer = pValue->
value;
1404 if (buffer ==
nullptr) {
1405 cout <<
"ERROR: getting binary parameter array" << endl;
1407 delete pDetectorParameter;
1411 size_t parameter_size = pValue->
size;
1413 size_t bytes_write = fwrite(buffer, 1, parameter_size, cur_file);
1414 delete pDetectorParameter;
1415 if (bytes_write != parameter_size) {
1416 cout <<
"ERROR: writing file: " << file_path <<
", put " << bytes_write <<
" bytes of " << parameter_size
1436 if (connDb ==
nullptr) {
1437 cout <<
"ERROR: the connection to the Unified Condition Database was failed" << endl;
1443 TString sql =
TString::Format(
"select value_id, detector_name, p.parameter_id, start_period, start_run, "
1444 "end_period, end_run, value_key, parameter_value, expiry_date "
1445 "from detector_parameter dp join parameter_ p on dp.parameter_id = p.parameter_id");
1448 bool isFirst =
true;
1449 TIter next(&search_conditions);
1456 strCondition +=
"lower(detector_name) ";
1459 strCondition +=
"lower(parameter_name) ";
1462 strCondition +=
"start_period ";
1465 strCondition +=
"start_run ";
1468 strCondition +=
"end_period ";
1471 strCondition +=
"end_run ";
1474 cout <<
"ERROR: the column in the search condition was not defined, the condition is skipped" << endl;
1480 strCondition +=
"< ";
1483 strCondition +=
"<= ";
1486 strCondition +=
"= ";
1489 strCondition +=
"<> ";
1492 strCondition +=
"> ";
1495 strCondition +=
">= ";
1498 strCondition +=
"like ";
1501 strCondition +=
"is null ";
1504 strCondition +=
"is not null ";
1507 cout <<
"ERROR: the comparison operator in the search condition was not defined, the condition is "
1535 cout <<
"ERROR: the value type in the search condition was not found, the condition is skipped" << endl;
1545 sql += strCondition;
1552 cout <<
"ERROR: getting runs from the Unified Condition Database has been failed" << endl;
1567 if (connPar ==
nullptr) {
1568 cout <<
"ERROR: the connection to the Unified Condition Database for the selected run was failed" << endl;
1573 tmp_value_id = stmt->
GetInt(0);
1576 int tmp_parameter_id;
1577 tmp_parameter_id = stmt->
GetInt(2);
1578 int tmp_start_period;
1579 tmp_start_period = stmt->
GetInt(3);
1581 tmp_start_run = stmt->
GetInt(4);
1583 tmp_end_period = stmt->
GetInt(5);
1585 tmp_end_run = stmt->
GetInt(6);
1587 tmp_value_key = stmt->
GetInt(7);
1588 unsigned char* tmp_parameter_value;
1589 tmp_parameter_value =
nullptr;
1590 Long_t tmp_sz_parameter_value = 0;
1591 stmt->
GetBinary(8, (
void*&)tmp_parameter_value, tmp_sz_parameter_value);
1594 tmp_expiry_date =
nullptr;
1599 connPar, tmp_value_id, tmp_detector_name, tmp_parameter_id, tmp_start_period, tmp_start_run, tmp_end_period,
1600 tmp_end_run, tmp_value_key, tmp_parameter_value, tmp_sz_parameter_value, tmp_expiry_date));
1612 search_conditions.
Add((
TObject*)&search_condition);
1614 return Search(search_conditions);
1621 if (pCurParameter ==
nullptr) {
1622 cout <<
"ERROR: parameter with current ID was not found" << endl;
1628 delete pCurParameter;
1636 if (pCurParameter ==
nullptr) {
1637 cout <<
"ERROR: parameter with current ID was not found" << endl;
1643 delete pCurParameter;
1669 cout <<
"ERROR: Connection object is null" << endl;
1676 "set start_period = $1, start_run = $2"
1677 "where value_id = $3");
1681 stmt->
SetInt(0, start_period);
1682 stmt->
SetInt(1, start_run);
1687 cout <<
"ERROR: updating the record has been failed" << endl;
1704 cout <<
"ERROR: Connection object is null" << endl;
1711 "set end_period = $1, end_run = $2"
1712 "where value_id = $3");
1716 stmt->
SetInt(0, end_period);
1717 stmt->
SetInt(1, end_run);
1722 cout <<
"ERROR: updating the record has been failed" << endl;
1739 if (connDb ==
nullptr)
1744 TString sql =
TString::Format(
"select value_id, detector_name, parameter_id, start_period, start_run, end_period, "
1745 "end_run, value_key, parameter_value, expiry_date "
1746 "from detector_parameter%s",
1747 isNonExpiredOnly ?
" where expiry_date is null" :
"");
1752 cout <<
"ERROR: getting all 'detector parameters' from the database has been failed" << endl;
1763 cout <<
"Table 'detector_parameter':" << endl;
1765 cout <<
"value_id: ";
1766 cout << (stmt->
GetInt(0));
1767 cout <<
", detector_name: ";
1769 cout <<
", parameter_id: ";
1770 cout << (stmt->
GetInt(2));
1771 cout <<
", start_period: ";
1772 cout << (stmt->
GetInt(3));
1773 cout <<
", start_run: ";
1774 cout << (stmt->
GetInt(4));
1775 cout <<
", end_period: ";
1776 cout << (stmt->
GetInt(5));
1777 cout <<
", end_run: ";
1778 cout << (stmt->
GetInt(6));
1779 cout <<
", value_key: ";
1780 cout << (stmt->
GetInt(7));
1781 cout <<
", parameter_value: ";
1782 unsigned char* tmp_parameter_value =
nullptr;
1783 Long_t tmp_sz_parameter_value = 0;
1784 stmt->
GetBinary(8, (
void*&)tmp_parameter_value, tmp_sz_parameter_value);
1785 cout << (
void*)tmp_parameter_value <<
", binary size: " << tmp_sz_parameter_value;
1786 if (!isNonExpiredOnly) {
1787 cout <<
", expiry_date: ";
1793 cout <<
"." << endl;
1804int UniDetectorParameter::ParseTxt(TString text_file, TString detector_name, TString parameter_name, int start_period,
1805int start_run, int end_period, int end_run, bool isSerialChannel)
1808 txtFile.open(text_file, ios::in);
1809 if (!txtFile.is_open())
1811 cout<<"Error: opening TXT file '"<<text_file<<"' was failed"<<endl;
1815 // open connection to database
1816 UniConnection* connDb = UniConnection::Open();
1817 if (connDb == nullptr)
1820 TSQLServer* db_server = connDb->GetSQLServer();
1823 while (getline(txtFile, cur_line))
1825 //remove duplicates of whitespaces and tabs
1826 TString reduce_line = reduce(cur_line);
1828 if (reduce_line[0] == '#')
1832 //ss.str(reduce_line);
1834 // get detector object from 'detector_' table
1835 TString sql = TString::Format(
1836 "select detector_name "
1838 "where lower(detector_name) = lower('%s'')", detector_name.Data());
1839 TSQLStatement* stmt = db_server->Statement(sql);
1841 // get table record from DB
1842 if (!stmt->Process())
1844 cout<<"Error: getting record with detector from 'detector_' table has been failed"<<endl;
1848 stmt->StoreResult();
1850 // check detector with the given name is exist
1851 if (!stmt->NextResultRow())
1853 cout<<"Error: the detector with name '"<<detector_name<<"' was not found"<<endl;
1858 detector_name = stmt->GetString(0);
1862 // get parameter object from 'parameter_' table
1863 sql = TString::Format(
1864 "select parameter_id, parameter_name, parameter_type "
1866 "where lower(parameter_name) = lower('%s')", parameter_name.Data());
1867 stmt = db_server->Statement(sql);
1869 // get table record from DB
1870 if (!stmt->Process())
1872 cout<<"Error: getting record with parameter from 'parameter_' table has been failed"<<endl;
1877 stmt->StoreResult();
1879 // extract row with parameter
1880 if (!stmt->NextResultRow())
1882 cout<<"Error: the parameter with name '"<<parameter_name<<"' was not found"<<endl;
1887 //int parameter_id = stmt->GetInt(0);
1888 parameter_name = stmt->GetString(1);
1889 int parameter_type = stmt->GetInt(2);
1893 TObjArray* tokens = reduce_line.Tokenize("\t ");
1895 int value_count = tokens->GetEntriesFast();
1897 UniDetectorParameter* pDetectorParameter = nullptr;
1898 // choose parsing method for parameter's value according it's type
1899 int serial_number = -1, channel_number = -1, cur_num_item = 0;
1900 switch (parameter_type)
1904 int count_required = 1;
1905 if (isSerialChannel) count_required++, count_required++;
1907 if (value_count != count_required)
1909 cout<<"Warning: the count of parameters is not equal 1 or 3 ([serial] [channel]
1910value)"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
1912 if (isSerialChannel)
1914 // get serial number
1915 item = (TObjString*) tokens->At(cur_num_item++);
1916 serial_number = item->GetString().Atoi();
1917 // get channel number
1918 item = (TObjString*) tokens->At(cur_num_item++);
1919 channel_number = item->GetString().Atoi();
1921 item = (TObjString*) tokens->At(cur_num_item++);
1924 bool value = (bool) item->GetString().Atoi();
1925 if (isSerialChannel)
1926 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
1927parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, value); else
1928 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
1929parameter_name,start_period, start_run, end_period, end_run, value);
1935 int count_required = 1;
1936 if (isSerialChannel) count_required++, count_required++;
1938 if (value_count != count_required)
1940 cout<<"Warning: the count of parameters is not equal 1 or 3 ([serial] [channel]
1941value)"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
1943 if (isSerialChannel)
1945 // get serial number
1946 item = (TObjString*) tokens->At(cur_num_item++);
1947 serial_number = item->GetString().Atoi();
1948 // get channel number
1949 item = (TObjString*) tokens->At(cur_num_item++);
1950 channel_number = item->GetString().Atoi();
1952 item = (TObjString*) tokens->At(cur_num_item++);
1955 int value = item->GetString().Atoi();
1958 if (!item->GetString().IsDigit())
1960 cout<<"Error: the parameter value is not integer: '"<<item<<"'"<<endl;
1965 if (isSerialChannel)
1966 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
1967parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, value); else
1968 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
1969parameter_name,start_period, start_run, end_period, end_run, value);
1975 int count_required = 1;
1976 if (isSerialChannel) count_required++, count_required++;
1978 if (value_count != count_required)
1980 cout<<"Warning: the count of parameters is not equal 1 or 3 ([serial] [channel]
1981value)"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
1983 if (isSerialChannel)
1985 // get serial number
1986 item = (TObjString*) tokens->At(cur_num_item++);
1987 serial_number = item->GetString().Atoi();
1988 // get channel number
1989 item = (TObjString*) tokens->At(cur_num_item++);
1990 channel_number = item->GetString().Atoi();
1992 item = (TObjString*) tokens->At(cur_num_item++);
1995 double value = item->GetString().Atof();
1996 if (isSerialChannel)
1997 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
1998parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, value); else
1999 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2000parameter_name,start_period, start_run, end_period, end_run, value);
2006 int count_required = 2, size_arr = value_count/2;
2007 if (isSerialChannel)
2009 count_required++, count_required++;
2013 if ((value_count < count_required) || ((value_count % 2) != 0))
2015 cout<<"Warning: the count of parameters should be greater 2 or 4 ([serial] [channel] values@2)
2016and should be even"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
2018 if (isSerialChannel)
2020 // get serial number
2021 item = (TObjString*) tokens->At(cur_num_item++);
2022 serial_number = item->GetString().Atoi();
2023 // get channel number
2024 item = (TObjString*) tokens->At(cur_num_item++);
2025 channel_number = item->GetString().Atoi();
2028 int iter = 0, num = count_required-2;
2029 IIStructure* pValues = new IIStructure[size_arr];
2030 for (; iter < size_arr; iter++)
2032 pValues[iter].int_1 = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2033 pValues[iter].int_2 = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2037 if (isSerialChannel)
2038 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2039parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, pValues, size_arr); else
2040 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2041parameter_name,start_period, start_run, end_period, end_run, pValues, size_arr);
2048 int count_required = 1, size_arr = value_count;
2049 if (isSerialChannel)
2051 count_required++, count_required++;
2052 size_arr--, size_arr--;
2055 if (value_count < count_required)
2057 cout<<"Warning: the count of parameters should be greater 1 or 3 ([serial] [channel] value1
2058value2...)"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
2060 if (isSerialChannel)
2062 // get serial number
2063 item = (TObjString*) tokens->At(cur_num_item++);
2064 serial_number = item->GetString().Atoi();
2065 // get channel number
2066 item = (TObjString*) tokens->At(cur_num_item++);
2067 channel_number = item->GetString().Atoi();
2071 int* pValues = new int[size_arr];
2072 for (int num = count_required-1; num < value_count; num++,iter++)
2073 pValues[iter] = ((TObjString*) tokens->At(num))->GetString().Atoi();
2076 if (isSerialChannel)
2077 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2078parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, pValues, size_arr); else
2079 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2080parameter_name,start_period, start_run, end_period, end_run, pValues, size_arr);
2085 case DoubleArrayType:
2087 int count_required = 1, size_arr = value_count;
2088 if (isSerialChannel)
2090 count_required++, count_required++;
2091 size_arr--, size_arr--;
2094 if (value_count < count_required)
2096 cout<<"Warning: the count of parameters should be greater 1 or 3 ([serial] [channel] value1
2097value2...)"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
2099 if (isSerialChannel)
2101 // get serial number
2102 item = (TObjString*) tokens->At(cur_num_item++);
2103 serial_number = item->GetString().Atoi();
2104 // get channel number
2105 item = (TObjString*) tokens->At(cur_num_item++);
2106 channel_number = item->GetString().Atoi();
2110 double* pValues = new double[size_arr];
2111 for (int num = count_required-1; num < value_count; num++, iter++)
2112 pValues[iter] = ((TObjString*) tokens->At(num))->GetString().Atof();
2115 if (isSerialChannel)
2116 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2117parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, pValues, size_arr); else
2118 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2119parameter_name,start_period, start_run, end_period, end_run, pValues, size_arr);
2126 int count_required = 1, size_arr = value_count;
2127 if (isSerialChannel)
2129 count_required++, count_required++;
2130 size_arr--, size_arr--;
2133 if (value_count < count_required)
2135 cout<<"Warning: the count of parameters should be greater 1 or 3 ([serial] [channel] value1
2136value2...)"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
2138 if (isSerialChannel)
2140 // get serial number
2141 item = (TObjString*) tokens->At(cur_num_item++);
2142 serial_number = item->GetString().Atoi();
2143 // get channel number
2144 item = (TObjString*) tokens->At(cur_num_item++);
2145 channel_number = item->GetString().Atoi();
2149 unsigned int* pValues = new unsigned int[size_arr];
2150 for (int num = count_required-1; num < value_count; num++, iter++)
2151 pValues[iter] = (unsigned int) ((TObjString*) tokens->At(num))->GetString().Atoll();
2154 if (isSerialChannel)
2155 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2156parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, pValues, size_arr); else
2157 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2158parameter_name,start_period, start_run, end_period, end_run, pValues, size_arr);
2163 case DchMapArrayType:
2165 int count_required = 6, size_arr = value_count/6;
2166 if (isSerialChannel)
2167 count_required++, count_required++;
2169 if ((value_count < count_required) || (((value_count-count_required+6) % 6) != 0))
2171 cout<<"Warning: the count of parameters should be greater 6 or 8 ([serial] [channel] values@6)
2172and must be divisible by 6"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
2174 if (isSerialChannel)
2176 // get serial number
2177 item = (TObjString*) tokens->At(cur_num_item++);
2178 serial_number = item->GetString().Atoi();
2179 // get channel number
2180 item = (TObjString*) tokens->At(cur_num_item++);
2181 channel_number = item->GetString().Atoi();
2184 int iter = 0, num = count_required-6;
2185 DchMapStructure* pValues = new DchMapStructure[size_arr];
2186 for (; iter < size_arr; iter++)
2188 pValues[iter].plane = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2189 pValues[iter].group = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2190 pValues[iter].crate = (unsigned int) ((TObjString*) tokens->At(num++))->GetString().Atoll();
2191 pValues[iter].slot = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2192 pValues[iter].channel_low = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2193 pValues[iter].channel_high = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2197 if (isSerialChannel)
2198 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2199parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, pValues, size_arr); else
2200 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2201parameter_name,start_period, start_run, end_period, end_run, pValues, size_arr);
2206 case GemMapArrayType:
2208 int count_required = 6, size_arr = value_count/6;
2209 if (isSerialChannel)
2210 count_required++, count_required++;
2212 if ((value_count < count_required) || (((value_count-count_required+6) % 6) != 0))
2214 cout<<"Warning: the count of parameters should be greater 6 or 8 ([serial] [channel] values@6)
2215and must be divisible by 6"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
2217 if (isSerialChannel)
2219 // get serial number
2220 item = (TObjString*) tokens->At(cur_num_item++);
2221 serial_number = item->GetString().Atoi();
2222 // get channel number
2223 item = (TObjString*) tokens->At(cur_num_item++);
2224 channel_number = item->GetString().Atoi();
2227 int iter = 0, num = count_required-6;
2228 GemMapStructure* pValues = new GemMapStructure[size_arr];
2229 for (; iter < size_arr; iter++)
2231 pValues[iter].serial = (unsigned int) ((TObjString*) tokens->At(num++))->GetString().Atoll();
2232 pValues[iter].id = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2233 pValues[iter].station = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2234 pValues[iter].channel_low = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2235 pValues[iter].channel_high = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2236 pValues[iter].hotZone = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2240 if (isSerialChannel)
2241 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2242parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, pValues, size_arr); else
2243 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2244parameter_name,start_period, start_run, end_period, end_run, pValues, size_arr);
2249 case GemPedestalArrayType:
2251 int count_required = 4, size_arr = value_count/4;
2252 if (isSerialChannel)
2253 count_required++, count_required++;
2255 if ((value_count < count_required) || (((value_count-count_required+4) % 4) != 0))
2257 cout<<"Warning: the count of parameters should be greater 4 or 6 ([serial] [channel] values@6)
2258and must be divisible by 4"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
2260 if (isSerialChannel)
2262 // get serial number
2263 item = (TObjString*) tokens->At(cur_num_item++);
2264 serial_number = item->GetString().Atoi();
2265 // get channel number
2266 item = (TObjString*) tokens->At(cur_num_item++);
2267 channel_number = item->GetString().Atoi();
2270 int iter = 0, num = count_required-4;
2271 GemPedestalStructure* pValues = new GemPedestalStructure[size_arr];
2272 for (; iter < size_arr; iter++)
2274 pValues[iter].serial = (unsigned int) ((TObjString*) tokens->At(num++))->GetString().Atoll();
2275 pValues[iter].channel = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2276 pValues[iter].pedestal = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2277 pValues[iter].noise = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2281 if (isSerialChannel)
2282 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2283parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, pValues, size_arr); else
2284 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2285parameter_name,start_period, start_run, end_period, end_run, pValues, size_arr);
2290 case TriggerMapArrayType:
2292 int count_required = 3, size_arr = value_count/3;
2293 if (isSerialChannel)
2294 count_required++, count_required++;
2296 if ((value_count < count_required) || (((value_count-count_required+3) % 3) != 0))
2298 cout<<"Warning: the count of parameters should be greater 3 or 5 ([serial] [channel] values@3)
2299and must be divisible by 3"<<endl<<"The current line will be skipped!"<<endl; tokens->Delete(); continue;
2301 if (isSerialChannel)
2303 // get serial number
2304 item = (TObjString*) tokens->At(cur_num_item++);
2305 serial_number = item->GetString().Atoi();
2306 // get channel number
2307 item = (TObjString*) tokens->At(cur_num_item++);
2308 channel_number = item->GetString().Atoi();
2311 int iter = 0, num = count_required-3;
2312 TriggerMapStructure* pValues = new TriggerMapStructure[size_arr];
2313 for (; iter < size_arr; iter++)
2315 pValues[iter].serial = (unsigned int) ((TObjString*) tokens->At(num++))->GetString().Atoll();
2316 pValues[iter].slot = (unsigned int) ((TObjString*) tokens->At(num++))->GetString().Atoll();
2317 pValues[iter].channel = ((TObjString*) tokens->At(num++))->GetString().Atoi();
2321 if (isSerialChannel)
2322 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2323parameter_name,start_period, start_run, end_period, end_run, serial_number, channel_number, pValues, size_arr); else
2324 pDetectorParameter = UniDetectorParameter::CreateDetectorParameter(detector_name,
2325parameter_name,start_period, start_run, end_period, end_run, pValues, size_arr);
2332 cout<<"Error: the type of parameter ("<<parameter_name<<") is not supported for parsing (txt)
2333now"<<endl; continue;
2335 }// switch (parameter_type)
2338 if (pDetectorParameter)
2339 delete pDetectorParameter;
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
TObject * ReadObject(const TClass *cl) override
Int_t WriteObject(const T *objptr, Bool_t cacheReuse=kTRUE)
static TObject * ConvertFromJSON(const char *str)
static TString ConvertToJSON(const TObject *obj, Int_t compact=0, const char *member_name=nullptr)
virtual void SetOwner(Bool_t enable=kTRUE)
const char * AsSQLString() const
UInt_t Convert(Bool_t toGMT=kFALSE) const
void Add(TObject *obj) override
virtual TSQLStatement * Statement(const char *, Int_t=100)
virtual const char * GetString(Int_t)
virtual Bool_t SetBinary(Int_t, void *, Long_t, Long_t=0x1000)
virtual Bool_t NextIteration()=0
virtual Bool_t NextResultRow()=0
virtual Int_t GetNumAffectedRows()
virtual Bool_t SetString(Int_t, const char *, Int_t=256)
Bool_t SetDatime(Int_t, const TDatime &)
virtual Int_t GetInt(Int_t)
virtual Bool_t IsNull(Int_t)
virtual Bool_t Process()=0
virtual Bool_t SetInt(Int_t, Int_t)
virtual Bool_t SetNull(Int_t)
virtual Bool_t StoreResult()=0
virtual Bool_t GetBinary(Int_t, void *&, Long_t &)
const char * Data() const
static TString Format(const char *fmt,...)
static UniConnection * Open()
TSQLServer * GetSQLServer()
int SetStart(int start_period, int start_run)
set start period and run of the current parameter value
int SetValue(vector< UniValue * > parameter_value)
set value to detector parameter presented by an array
static int WriteObjectBinary(const char *detector_name, const char *parameter_name, int start_period, int start_run, int end_period, int end_run, TObject *ptr_object)
write ROOT object as a binary parameter to the Database from start run to end one
static int WriteObjectJSON(const char *detector_name, const char *parameter_name, int start_period, int start_run, int end_period, int end_run, TObject *ptr_object)
write ROOT object as a JSON parameter to the Database from start run to end one
int i_end_period
end period
enumValueType GetParameterType()
get parameter type of the current parameter value
int SetValueKey(int value_key)
set value key of the current detector parameter
int SetDetectorName(TString detector_name)
set detector name of the current detector parameter
void GetStart(int &start_period, int &start_run)
get start period and run of the current parameter value
UniConnection * connectionDB
connection to the database
static int ReadObjectBinary(const char *detector_name, const char *parameter_name, int period_number, int run_number, TObject *&ptr_object)
read ROOT object as a binary parameter from from the Database for the selected run
Long_t sz_parameter_value
size of parameter value
int SetExpiryDate(TDatime *expiry_date)
set expiry date of the current detector parameter
TString GetParameterName()
get parameter name of the current parameter value
void GetEnd(int &end_period, int &end_run)
get end period and run of the current parameter value
UniValue * GetValue()
get value of detector parameter presented by a single value
int SetEnd(int end_period, int end_run)
set end period and run of the current parameter value
static int DeleteDetectorParameter(int value_id)
delete detector parameter from the database
unsigned char * blob_parameter_value
parameter value
int SetParameterId(int parameter_id)
set parameter id of the current detector parameter
static TObjArray * Search(UniSearchCondition &search_condition)
get parameters' values corresponding to the specified single condition and set owner for search_condi...
int GetValue(vector< UniValue * > ¶meter_value)
get value of detector parameter presented by an array
int SetEndPeriod(int end_period)
set end period of the current detector parameter
static int WriteFile(const char *detector_name, const char *parameter_name, int start_period, int start_run, int end_period, int end_run, const char *file_path)
write a whole file with parameter value (with given detector and parameter names) to the Database fro...
TString str_detector_name
detector name
int SetEndRun(int end_run)
set end run of the current detector parameter
int SetStartRun(int start_run)
set start run of the current detector parameter
void Print()
print information about current detector parameter
int SetUNC(unsigned char *p_parameter_value, Long_t size_parameter_value)
int i_parameter_id
parameter id
static int PrintAll()
print all detector parameters
UniDetectorParameter(UniConnection *db_connect, int value_id, TString detector_name, int parameter_id, int start_period, int start_run, int end_period, int end_run, int value_key, unsigned char *parameter_value, Long_t size_parameter_value, TDatime *expiry_date)
int SetStartPeriod(int start_period)
set start period of the current detector parameter
static UniDetectorParameter * GetDetectorParameter(int value_id)
get detector parameter from the database
static int CheckDetectorParameterExists(int value_id)
check detector parameter exists in the database: 1- true, 0 - false, <0 - database operation error
static int ReadFile(const char *detector_name, const char *parameter_name, int period_number, int run_number, const char *file_path)
read a whole file with parameter value (with given detector and parameter names) from the Database fo...
TDatime * ts_expiry_date
expiry date
virtual ~UniDetectorParameter()
static UniDetectorParameter * CreateDetectorParameter(TString detector_name, int parameter_id, int start_period, int start_run, int end_period, int end_run, int value_key, unsigned char *parameter_value, Long_t size_parameter_value, TDatime *expiry_date)
add new detector parameter to the database
int SetParameterValue(unsigned char *parameter_value, Long_t size_parameter_value)
set parameter value of the current detector parameter
unsigned char * GetUNC(enumValueType enum_parameter_type=UndefinedType)
Parse detector parameter's values and write them to the database: txtFile - path to the text file wit...
int i_start_period
start period
static int ReadObjectJSON(const char *detector_name, const char *parameter_name, int period_number, int run_number, TObject *&ptr_object)
read ROOT object as a JSON parameter from from the Database for the selected run
TString GetParameterName()
get parameter name of the current parameter
static bool CheckAndGetParameterID(TSQLServer *db_server, TString parameter_name, enumValueType enum_parameter_type, int ¶meter_id)
static UniParameter * GetParameter(int parameter_id)
get parameter from the database
int GetParameterType()
get parameter type of the current parameter
static int GetFirstRunNumber(int period_number)
get first run number for a selected period
static int GetLastRunNumber(int period_number)
get last run number for a selected period
enumConditions GetCondition()
@ conditionGreaterOrEqual
unsigned int GetUIntValue()
virtual enumValueType GetType()=0
virtual void ReadValue(unsigned char *source)=0
virtual void WriteValue(unsigned char *destination)=0
virtual size_t GetStorageSize()=0
UniValue * CreateParameterValue(enumValueType parameter_type)