45 coral::ConnectionService* svc =
new coral::ConnectionService;
50 coral::ISessionProxy* session = svc->connect(
m_dest, coral::Update);
51 coral::ITypeConverter& tpc = session->typeConverter();
52 tpc.setCppTypeForSqlType(
"unsigned int",
"NUMBER(10)");
54 unsigned int totallumils = 35;
55 unsigned int totalcmsls = 32;
56 session->transaction().start(
false);
57 coral::ISchema& schema = session->nominalSchema();
61 coral::AttributeList summaryData;
62 summaryData.extend(
"LUMISUMMARY_ID",
typeid(
unsigned long long));
63 summaryData.extend(
"RUNNUM",
typeid(
unsigned int));
64 summaryData.extend(
"CMSLSNUM",
typeid(
unsigned int));
65 summaryData.extend(
"LUMILSNUM",
typeid(
unsigned int));
66 summaryData.extend(
"LUMIVERSION",
typeid(
std::string));
67 summaryData.extend(
"DTNORM",
typeid(
float));
68 summaryData.extend(
"LHCNORM",
typeid(
float));
69 summaryData.extend(
"INSTLUMI",
typeid(
float));
70 summaryData.extend(
"INSTLUMIERROR",
typeid(
float));
71 summaryData.extend(
"INSTLUMIQUALITY",
typeid(
short));
72 summaryData.extend(
"LUMISECTIONQUALITY",
typeid(
short));
73 summaryData.extend(
"CMSALIVE",
typeid(
short));
74 summaryData.extend(
"STARTORBIT",
typeid(
unsigned int));
75 summaryData.extend(
"NUMORBIT",
typeid(
unsigned int));
76 summaryData.extend(
"BEAMENERGY",
typeid(
float));
77 summaryData.extend(
"BEAMSTATUS",
typeid(
std::string));
79 coral::IBulkOperation* summaryInserter = summarytable.dataEditor().bulkInsert(summaryData, totallumils);
80 coral::AttributeList detailData;
81 detailData.extend(
"LUMIDETAIL_ID",
typeid(
unsigned long long));
82 detailData.extend(
"LUMISUMMARY_ID",
typeid(
unsigned long long));
83 detailData.extend(
"BXLUMIVALUE",
typeid(coral::Blob));
84 detailData.extend(
"BXLUMIERROR",
typeid(coral::Blob));
85 detailData.extend(
"BXLUMIQUALITY",
typeid(coral::Blob));
87 coral::IBulkOperation* detailInserter = detailtable.dataEditor().bulkInsert(detailData, totallumils *
N_LUMIALGO);
89 unsigned long long& lumisummary_id = summaryData[
"LUMISUMMARY_ID"].data<
unsigned long long>();
90 unsigned int& lumirunnum = summaryData[
"RUNNUM"].data<
unsigned int>();
91 unsigned int& cmslsnum = summaryData[
"CMSLSNUM"].data<
unsigned int>();
92 unsigned int& lumilsnum = summaryData[
"LUMILSNUM"].data<
unsigned int>();
94 float& dtnorm = summaryData[
"DTNORM"].data<
float>();
95 float& lhcnorm = summaryData[
"LHCNORM"].data<
float>();
96 float& instlumi = summaryData[
"INSTLUMI"].data<
float>();
97 float& instlumierror = summaryData[
"INSTLUMIERROR"].data<
float>();
98 short& instlumiquality = summaryData[
"INSTLUMIQUALITY"].data<
short>();
99 short& lumisectionquality = summaryData[
"LUMISECTIONQUALITY"].data<
short>();
100 short& cmsalive = summaryData[
"CMSALIVE"].data<
short>();
101 unsigned int& startorbit = summaryData[
"STARTORBIT"].data<
unsigned int>();
102 unsigned int& numorbit = summaryData[
"NUMORBIT"].data<
unsigned int>();
103 float& beamenergy = summaryData[
"BEAMENERGY"].data<
float>();
106 unsigned long long& lumidetail_id = detailData[
"LUMIDETAIL_ID"].data<
unsigned long long>();
107 unsigned long long& d2lumisummary_id = detailData[
"LUMISUMMARY_ID"].data<
unsigned long long>();
108 coral::Blob& bxlumivalue = detailData[
"BXLUMIVALUE"].data<coral::Blob>();
109 coral::Blob& bxlumierror = detailData[
"BXLUMIERROR"].data<coral::Blob>();
110 coral::Blob& bxlumiquality = detailData[
"BXLUMIQUALITY"].data<coral::Blob>();
112 for (
unsigned int i = 1;
i <= totallumils; ++
i) {
120 instlumierror = 0.01;
122 lumisectionquality = 16;
124 short iscmsalive = 0;
125 if (
i <= totalcmsls) {
129 cmsalive = iscmsalive;
130 startorbit = 2837495;
133 beamstatus =
"stable";
136 summaryInserter->processNextIteration();
137 summaryInserter->flush();
138 d2lumisummary_id =
i;
147 float lumivalue[
N_BX];
148 std::memset((
void*)&lumivalue, 0,
sizeof(
float) *
N_BX);
149 float lumierror[
N_BX];
150 std::memset((
void*)&lumierror, 0,
sizeof(
float) *
N_BX);
151 short lumiquality[
N_BX];
152 std::memset((
void*)&lumiquality, 0,
sizeof(
short) *
N_BX);
153 bxlumivalue.resize(
sizeof(
float) *
N_BX);
154 bxlumierror.resize(
sizeof(
float) *
N_BX);
155 bxlumiquality.resize(
sizeof(
short) *
N_BX);
156 void* bxlumivalueStartAddress = bxlumivalue.startingAddress();
157 void* bxlumierrorStartAddress = bxlumierror.startingAddress();
158 void* bxlumiqualityStartAddress = bxlumiquality.startingAddress();
159 for (
unsigned int k = 0;
k <
N_BX; ++
k) {
164 std::memmove(bxlumivalueStartAddress, lumivalue,
sizeof(
float) *
N_BX);
165 std::memmove(bxlumierrorStartAddress, lumierror,
sizeof(
float) *
N_BX);
166 std::memmove(bxlumiqualityStartAddress, lumiquality,
sizeof(
short) *
N_BX);
167 detailInserter->processNextIteration();
170 detailInserter->flush();
171 delete summaryInserter;
172 delete detailInserter;
174 session->transaction().rollback();
180 session->transaction().commit();
const unsigned int N_LUMIALGO
static const std::string lumisummaryTableName()
static const std::string lumidetailTableName()