20 #include <CoralBase/Attribute.h>
21 #include <CoralBase/AttributeList.h>
23 #include "RelationalAccess/SchemaException.h"
24 #include "RelationalAccess/ITransaction.h"
25 #include "RelationalAccess/ITable.h"
26 #include "RelationalAccess/ISchema.h"
27 #include "RelationalAccess/ICursor.h"
28 #include "RelationalAccess/IQuery.h"
38 msg() <<
"LutCamLoader started loading data via ID. ID = " << lTarget.
id() << std::endl;
41 msg() <<
"Loading LutCam " << lTarget.
id() << std::endl;
43 coral::ITable&
table =
m_session.nominalSchema().tableHandle(
"L1_CTP_FILES");
45 query->setRowCacheSize( 5 );
47 std::string
condition=
"L1CF_ID = :l1cfid";
50 boundvars.extend<
int>(
"l1cfid");
51 boundvars[0].data<
int>() = lTarget.
id();
55 query->addToOutputList(
"L1CF_NAME" );
56 query->addToOutputList(
"L1CF_VERSION" );
57 query->addToOutputList(
"L1CF_LUT" );
58 query->addToOutputList(
"L1CF_CAM" );
63 msg() <<
"LutCamLoader >> No such L1_CTP_Files exists " << lTarget.
id() << std::endl;
66 throw std::runtime_error(
"LutCamLoader >> LutCam not available" );
71 std::string
name =
"";
72 name =
row[
"L1CF_NAME"].data<std::string>();
75 std::string lut_str =
"";
76 lut_str =
row[
"L1CF_LUT"].data<std::string>();
77 std::string cam_str =
"";
78 cam_str =
row[
"L1CF_CAM"].data<std::string>();
81 msg() <<
"LutCamLoader >> More than one LutCam exists " << lTarget.
id() << std::endl;
84 throw std::runtime_error(
"LutCamLoader >> LutCam not available" );
90 u_int significantBits = 8;
93 u_int wordsize = (preFix + significantBits + postFix);
103 if(!convert_hex_string<u_int>(tmp_data, lut_str.substr(
i*wordsize+preFix,significantBits))) {
104 msg() <<
"LutCamLoader>> Conversion of LUT no" <<
i <<
" failed! Read string " << lut_str.substr(
i*wordsize+preFix,significantBits) << std::endl;
105 msg() <<
"TEST: substr(0,24): " << lut_str.substr(0,24) <<
" - substr(14,8): " << lut_str.substr(14,8) <<
" cc : " << (
i*wordsize+preFix) << std::endl;
107 throw std::runtime_error(
"LutCamLoader >> LUT conversion failed." );
109 lut_int[
i] = tmp_data;
118 if(!convert_hex_string<u_int>(tmp_data, cam_str.substr(
i*wordsize+preFix,significantBits))) {
119 msg() <<
"LutCamLoader>> Conversion of CAM no" <<
i <<
" failed!" << std::endl;
121 throw std::runtime_error(
"LutCamLoader >> CAM conversion failed." );
136 catch(
const coral::SchemaException&
e )
138 msg() <<
"LutCamLoader >> SchemaException: "
139 <<
e.what() << std::endl;
145 msg() <<
"LutCamLoader >> Standard C++ exception: " <<
e.what() << std::endl;
151 msg() <<
"LutCamLoader >> unknown C++ exception" << std::endl;