File indexing completed on 2024-04-06 12:03:16
0001
0002
0003
0004
0005
0006
0007
0008 #include "CondTools/RPC/interface/RPCFw.h"
0009 #include "RelationalAccess/ISession.h"
0010 #include "RelationalAccess/ITransaction.h"
0011 #include "RelationalAccess/ISchema.h"
0012 #include "RelationalAccess/ITable.h"
0013 #include "RelationalAccess/ITableDataEditor.h"
0014 #include "RelationalAccess/TableDescription.h"
0015 #include "RelationalAccess/IQuery.h"
0016 #include "RelationalAccess/ICursor.h"
0017
0018 #include "CoralBase/AttributeList.h"
0019 #include "CoralBase/Attribute.h"
0020 #include "CoralBase/AttributeSpecification.h"
0021 #include <iostream>
0022 #include <stdexcept>
0023 #include <vector>
0024 #include <cmath>
0025 #include <iostream>
0026 #include <sstream>
0027 #include <ctime>
0028 #include "CondFormats/RPCObjects/interface/RPCObFebmap.h"
0029
0030 RPCFw::RPCFw(const std::string& connectionString, const std::string& userName, const std::string& password)
0031 : RPCDBCom(), m_connectionString(connectionString), m_userName(userName), m_password(password) {}
0032
0033 RPCFw::~RPCFw() {}
0034
0035 void RPCFw::run() {}
0036
0037
0038 std::vector<RPCObImon::I_Item> RPCFw::createIMON(long long since, long long till) {
0039 tMIN = UTtoT(since);
0040 std::cout << ">> Processing since: " << tMIN.day() << "/" << tMIN.month() << "/" << tMIN.year() << " " << tMIN.hour()
0041 << ":" << tMIN.minute() << "." << tMIN.second() << std::endl;
0042
0043 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
0044 session->transaction().start(true);
0045 coral::ISchema& schema = session->nominalSchema();
0046 coral::IQuery* queryI = schema.newQuery();
0047 queryI->addToTableList("FWCAENCHANNEL");
0048 queryI->addToOutputList("FWCAENCHANNEL.DPID", "DPID");
0049 queryI->addToOutputList("FWCAENCHANNEL.CHANGE_DATE", "TSTAMP");
0050 queryI->addToOutputList("FWCAENCHANNEL.ACTUAL_IMON", "IMON");
0051
0052 RPCObImon::I_Item Itemp;
0053 std::vector<RPCObImon::I_Item> imonarray;
0054 coral::TimeStamp tlast = tMIN;
0055 if (till > since) {
0056 tMAX = UTtoT(till);
0057 std::cout << ">> Processing till: " << tMAX.day() << "/" << tMAX.month() << "/" << tMAX.year() << " " << tMAX.hour()
0058 << ":" << tMAX.minute() << "." << tMAX.second() << std::endl;
0059 std::cout << ">> creating IMON object..." << std::endl;
0060 coral::AttributeList conditionData;
0061 conditionData.extend<coral::TimeStamp>("tmin");
0062 conditionData.extend<coral::TimeStamp>("tmax");
0063 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0064 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0065 std::string condition = "FWCAENCHANNEL.ACTUAL_IMON IS NOT NULL AND CHANGE_DATE >:tmin AND CHANGE_DATE <:tmax";
0066 queryI->setCondition(condition, conditionData);
0067 coral::ICursor& cursorI = queryI->execute();
0068 while (cursorI.next()) {
0069 const coral::AttributeList& row = cursorI.currentRow();
0070 float idoub = row["DPID"].data<float>();
0071 int id = static_cast<int>(idoub);
0072 float val = row["IMON"].data<float>();
0073 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0074 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0075 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0076 Itemp.dpid = id;
0077 Itemp.value = val;
0078 Itemp.day = ndate;
0079 Itemp.time = ntime;
0080 imonarray.push_back(Itemp);
0081 }
0082 } else {
0083 std::cout << ">> creating IMON object..." << std::endl;
0084 coral::AttributeList conditionData;
0085 conditionData.extend<coral::TimeStamp>("tmin");
0086 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0087 std::string condition = "FWCAENCHANNEL.ACTUAL_IMON IS NOT NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin";
0088 queryI->setCondition(condition, conditionData);
0089 coral::ICursor& cursorI = queryI->execute();
0090 while (cursorI.next()) {
0091 const coral::AttributeList& row = cursorI.currentRow();
0092 float idoub = row["DPID"].data<float>();
0093 int id = static_cast<int>(idoub);
0094 float val = row["IMON"].data<float>();
0095 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0096 if (isMajor(ts, tlast))
0097 tlast = ts;
0098 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0099 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0100 Itemp.dpid = id;
0101 Itemp.value = val;
0102 Itemp.day = ndate;
0103 Itemp.time = ntime;
0104 imonarray.push_back(Itemp);
0105 }
0106 }
0107 N_IOV = TtoUT(tlast);
0108 if (till > since)
0109 N_IOV = till;
0110 std::cout << ">> Imon array --> size: " << imonarray.size() << " >> done." << std::endl;
0111 delete queryI;
0112 session->transaction().commit();
0113 delete session;
0114 return imonarray;
0115 }
0116
0117
0118 std::vector<RPCObVmon::V_Item> RPCFw::createVMON(long long since, long long till) {
0119 tMIN = UTtoT(since);
0120 std::cout << ">> Processing since: " << tMIN.day() << "/" << tMIN.month() << "/" << tMIN.year() << " " << tMIN.hour()
0121 << ":" << tMIN.minute() << "." << tMIN.second() << std::endl;
0122
0123 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
0124 session->transaction().start(true);
0125 coral::ISchema& schema = session->nominalSchema();
0126 coral::IQuery* queryV = schema.newQuery();
0127 queryV->addToTableList("FWCAENCHANNEL");
0128 queryV->addToOutputList("FWCAENCHANNEL.DPID", "DPID");
0129 queryV->addToOutputList("FWCAENCHANNEL.CHANGE_DATE", "TSTAMP");
0130 queryV->addToOutputList("FWCAENCHANNEL.ACTUAL_VMON", "VMON");
0131 RPCObVmon::V_Item Vtemp;
0132 std::vector<RPCObVmon::V_Item> vmonarray;
0133 coral::TimeStamp tlast = tMIN;
0134 if (till > since) {
0135 tMAX = UTtoT(till);
0136 std::cout << ">> Processing till: " << tMAX.day() << "/" << tMAX.month() << "/" << tMAX.year() << " " << tMAX.hour()
0137 << ":" << tMAX.minute() << "." << tMAX.second() << std::endl;
0138 std::cout << ">> creating VMON object..." << std::endl;
0139 coral::AttributeList conditionData;
0140 conditionData.extend<coral::TimeStamp>("tmin");
0141 conditionData.extend<coral::TimeStamp>("tmax");
0142 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0143 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0144 std::string condition =
0145 " NOT FWCAENCHANNEL.ACTUAL_VMON IS NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin AND FWCAENCHANNEL.CHANGE_DATE "
0146 "<:tmax";
0147 queryV->setCondition(condition, conditionData);
0148 coral::ICursor& cursorV = queryV->execute();
0149 while (cursorV.next()) {
0150 const coral::AttributeList& row = cursorV.currentRow();
0151 float idoub = row["DPID"].data<float>();
0152 int id = static_cast<int>(idoub);
0153 float val = row["VMON"].data<float>();
0154 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0155 if (isMajor(ts, tlast))
0156 tlast = ts;
0157 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0158 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0159 Vtemp.dpid = id;
0160 Vtemp.value = val;
0161 Vtemp.day = ndate;
0162 Vtemp.time = ntime;
0163 vmonarray.push_back(Vtemp);
0164 }
0165 } else {
0166 std::cout << ">> creating VMON object..." << std::endl;
0167 coral::AttributeList conditionData;
0168 conditionData.extend<coral::TimeStamp>("tmin");
0169 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0170 std::string condition = " NOT FWCAENCHANNEL.ACTUAL_VMON IS NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin";
0171 queryV->setCondition(condition, conditionData);
0172 coral::ICursor& cursorV = queryV->execute();
0173 while (cursorV.next()) {
0174 const coral::AttributeList& row = cursorV.currentRow();
0175 float idoub = row["DPID"].data<float>();
0176 int id = static_cast<int>(idoub);
0177 float val = row["VMON"].data<float>();
0178 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0179 if (isMajor(ts, tlast))
0180 tlast = ts;
0181 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0182 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0183 Vtemp.dpid = id;
0184 Vtemp.value = val;
0185 Vtemp.day = ndate;
0186 Vtemp.time = ntime;
0187 vmonarray.push_back(Vtemp);
0188 }
0189 }
0190
0191 std::cout << ">> Vmon array --> size: " << vmonarray.size() << " >> done." << std::endl;
0192 delete queryV;
0193 session->transaction().commit();
0194 delete session;
0195 return vmonarray;
0196 }
0197
0198
0199 std::vector<RPCObStatus::S_Item> RPCFw::createSTATUS(long long since, long long till) {
0200 tMIN = UTtoT(since);
0201 std::cout << ">> Processing since: " << tMIN.day() << "/" << tMIN.month() << "/" << tMIN.year() << " " << tMIN.hour()
0202 << ":" << tMIN.minute() << "." << tMIN.second() << std::endl;
0203
0204 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
0205 session->transaction().start(true);
0206 coral::ISchema& schema = session->nominalSchema();
0207 std::cout << ">> creating STATUS object..." << std::endl;
0208 coral::IQuery* queryS = schema.newQuery();
0209 queryS->addToTableList("FWCAENCHANNEL");
0210 queryS->addToOutputList("FWCAENCHANNEL.DPID", "DPID");
0211 queryS->addToOutputList("FWCAENCHANNEL.CHANGE_DATE", "TSTAMP");
0212 queryS->addToOutputList("FWCAENCHANNEL.ACTUAL_STATUS", "STATUS");
0213 RPCObStatus::S_Item Stemp;
0214 std::vector<RPCObStatus::S_Item> statusarray;
0215 coral::TimeStamp tlast = tMIN;
0216 if (till > since) {
0217 tMAX = UTtoT(till);
0218 std::cout << ">> Processing till: " << tMAX.day() << "/" << tMAX.month() << "/" << tMAX.year() << " " << tMAX.hour()
0219 << ":" << tMAX.minute() << "." << tMAX.second() << std::endl;
0220 std::cout << ">> creating STATUS object..." << std::endl;
0221 coral::AttributeList conditionData;
0222 conditionData.extend<coral::TimeStamp>("tmin");
0223 conditionData.extend<coral::TimeStamp>("tmax");
0224 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0225 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0226 std::string condition =
0227 " NOT FWCAENCHANNEL.ACTUAL_STATUS IS NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin AND FWCAENCHANNEL.CHANGE_DATE "
0228 "<:tmax";
0229 queryS->setCondition(condition, conditionData);
0230 coral::ICursor& cursorS = queryS->execute();
0231 while (cursorS.next()) {
0232 const coral::AttributeList& row = cursorS.currentRow();
0233 float idoub = row["DPID"].data<float>();
0234 int id = static_cast<int>(idoub);
0235 float val = row["STATUS"].data<float>();
0236 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0237 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0238 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0239 Stemp.dpid = id;
0240 Stemp.value = val;
0241 Stemp.day = ndate;
0242 Stemp.time = ntime;
0243 statusarray.push_back(Stemp);
0244 }
0245 } else {
0246 std::cout << ">> creating STATUS object..." << std::endl;
0247 coral::AttributeList conditionData;
0248 conditionData.extend<coral::TimeStamp>("tmin");
0249 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0250 std::string condition = " NOT FWCAENCHANNEL.ACTUAL_STATUS IS NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin";
0251 queryS->setCondition(condition, conditionData);
0252 coral::ICursor& cursorS = queryS->execute();
0253 while (cursorS.next()) {
0254 const coral::AttributeList& row = cursorS.currentRow();
0255 float idoub = row["DPID"].data<float>();
0256 int id = static_cast<int>(idoub);
0257 float val = row["STATUS"].data<float>();
0258 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0259 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0260 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0261 Stemp.dpid = id;
0262 Stemp.value = val;
0263 Stemp.day = ndate;
0264 Stemp.time = ntime;
0265 statusarray.push_back(Stemp);
0266 }
0267 }
0268 std::cout << ">> Staus array --> size: " << statusarray.size() << " >> done." << std::endl << std::endl << std::endl;
0269
0270 delete queryS;
0271 session->transaction().commit();
0272 delete session;
0273
0274 return statusarray;
0275 }
0276
0277
0278 std::vector<RPCObGas::Item> RPCFw::createGAS(long long since, long long till) {
0279 tMIN = UTtoT(since);
0280 std::cout << ">> Processing since: " << tMIN.day() << "/" << tMIN.month() << "/" << tMIN.year() << " " << tMIN.hour()
0281 << ":" << tMIN.minute() << "." << tMIN.second() << std::endl;
0282
0283 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
0284 session->transaction().start(true);
0285 coral::ISchema& schema = session->nominalSchema();
0286
0287 coral::TimeStamp tlast = tMIN;
0288
0289
0290 coral::IQuery* querySIN = schema.newQuery();
0291 querySIN->addToTableList("RPCGASCHANNEL");
0292 querySIN->addToOutputList("RPCGASCHANNEL.DPID", "DPID");
0293 querySIN->addToOutputList("RPCGASCHANNEL.CHANGE_DATE", "TSTAMP");
0294 querySIN->addToOutputList("RPCGASCHANNEL.FLOWIN", "FLOWIN");
0295
0296
0297 coral::IQuery* querySOUT = schema.newQuery();
0298 querySOUT->addToTableList("RPCGASCHANNEL");
0299 querySOUT->addToOutputList("RPCGASCHANNEL.DPID", "DPID");
0300 querySOUT->addToOutputList("RPCGASCHANNEL.CHANGE_DATE", "TSTAMP");
0301 querySOUT->addToOutputList("RPCGASCHANNEL.FLOWOUT", "FLOWOUT");
0302
0303 RPCObGas::Item gastemp;
0304 std::vector<RPCObGas::Item> gasarray;
0305
0306 if (till > since) {
0307 tMAX = UTtoT(till);
0308 std::cout << ">> Processing till: " << tMAX.day() << "/" << tMAX.month() << "/" << tMAX.year() << " " << tMAX.hour()
0309 << ":" << tMAX.minute() << "." << tMAX.second() << std::endl;
0310 std::cout << ">> creating GAS object..." << std::endl;
0311 std::cout << ">> processing FLOWIN..." << std::endl;
0312 coral::AttributeList conditionData;
0313 conditionData.extend<coral::TimeStamp>("tmin");
0314 conditionData.extend<coral::TimeStamp>("tmax");
0315 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0316 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0317 std::string conditionIN = "RPCGASCHANNEL.FLOWIN IS NOT NULL AND CHANGE_DATE >:tmin AND CHANGE_DATE <:tmax";
0318
0319 querySIN->setCondition(conditionIN, conditionData);
0320 coral::ICursor& cursorSIN = querySIN->execute();
0321 while (cursorSIN.next()) {
0322 gastemp.dpid = 0;
0323 gastemp.flowin = 0;
0324 gastemp.flowout = 0;
0325 gastemp.day = 0;
0326 gastemp.time = 0;
0327 const coral::AttributeList& row = cursorSIN.currentRow();
0328 float idoub = row["DPID"].data<float>();
0329 int id = static_cast<int>(idoub);
0330 float val = row["FLOWIN"].data<float>();
0331 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0332 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0333 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0334 gastemp.dpid = id;
0335 gastemp.flowin = val;
0336 gastemp.day = ndate;
0337 gastemp.time = ntime;
0338 gasarray.push_back(gastemp);
0339 }
0340 } else {
0341 std::cout << ">> creating GAS object..." << std::endl;
0342 std::cout << ">> processing FLOWIN..." << std::endl;
0343 coral::AttributeList conditionData;
0344 conditionData.extend<coral::TimeStamp>("tmin");
0345 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0346 std::string conditionIN = "RPCGASCHANNEL.FLOWIN IS NOT NULL AND CHANGE_DATE >:tmin";
0347 std::cout << "processing FLOWIN..." << std::endl;
0348 querySIN->setCondition(conditionIN, conditionData);
0349 coral::ICursor& cursorSIN = querySIN->execute();
0350 while (cursorSIN.next()) {
0351 gastemp.dpid = 0;
0352 gastemp.flowin = 0;
0353 gastemp.flowout = 0;
0354 gastemp.day = 0;
0355 gastemp.time = 0;
0356 const coral::AttributeList& row = cursorSIN.currentRow();
0357 float idoub = row["DPID"].data<float>();
0358 int id = static_cast<int>(idoub);
0359 float val = row["FLOWIN"].data<float>();
0360 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0361 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0362 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0363 gastemp.dpid = id;
0364 gastemp.flowin = val;
0365 gastemp.day = ndate;
0366 gastemp.time = ntime;
0367 gasarray.push_back(gastemp);
0368 }
0369 }
0370
0371 if (till > since) {
0372 tMAX = UTtoT(till);
0373
0374 std::cout << ">> processing FLOWOUT..." << std::endl;
0375 coral::AttributeList conditionData;
0376 conditionData.extend<coral::TimeStamp>("tmin");
0377 conditionData.extend<coral::TimeStamp>("tmax");
0378 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0379 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0380 std::string conditionOUT = "RPCGASCHANNEL.FLOWOUT IS NOT NULL AND CHANGE_DATE >:tmin AND CHANGE_DATE <:tmax";
0381
0382 querySOUT->setCondition(conditionOUT, conditionData);
0383 coral::ICursor& cursorSOUT = querySOUT->execute();
0384 while (cursorSOUT.next()) {
0385 gastemp.dpid = 0;
0386 gastemp.flowin = 0;
0387 gastemp.flowout = 0;
0388 gastemp.day = 0;
0389 gastemp.time = 0;
0390 const coral::AttributeList& row = cursorSOUT.currentRow();
0391 float idoub = row["DPID"].data<float>();
0392 int id = static_cast<int>(idoub);
0393 float val = row["FLOWOUT"].data<float>();
0394 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0395 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0396 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0397 gastemp.dpid = id;
0398 gastemp.flowout = val;
0399 gastemp.day = ndate;
0400 gastemp.time = ntime;
0401 gasarray.push_back(gastemp);
0402 }
0403 } else {
0404 std::cout << ">> processing FLOWOUT..." << std::endl;
0405 coral::AttributeList conditionData;
0406 conditionData.extend<coral::TimeStamp>("tmin");
0407 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0408 std::string conditionOUT = "RPCGASCHANNEL.FLOWOUT IS NOT NULL AND CHANGE_DATE >:tmin";
0409 querySOUT->setCondition(conditionOUT, conditionData);
0410 coral::ICursor& cursorSOUT = querySOUT->execute();
0411 while (cursorSOUT.next()) {
0412 gastemp.dpid = 0;
0413 gastemp.flowin = 0;
0414 gastemp.flowout = 0;
0415 gastemp.day = 0;
0416 gastemp.time = 0;
0417 const coral::AttributeList& row = cursorSOUT.currentRow();
0418 float idoub = row["DPID"].data<float>();
0419 int id = static_cast<int>(idoub);
0420 float val = row["FLOWOUT"].data<float>();
0421 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0422 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0423 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0424 gastemp.dpid = id;
0425 gastemp.flowout = val;
0426 gastemp.day = ndate;
0427 gastemp.time = ntime;
0428 gasarray.push_back(gastemp);
0429 }
0430 }
0431
0432 N_IOV = TtoUT(tlast);
0433 if (till > since)
0434 N_IOV = till;
0435 std::cout << ">> Gas array --> size: " << gasarray.size() << " >> done." << std::endl << std::endl << std::endl;
0436
0437 delete querySIN;
0438 delete querySOUT;
0439 session->transaction().commit();
0440 delete session;
0441
0442 return gasarray;
0443 }
0444
0445
0446 std::vector<RPCObTemp::T_Item> RPCFw::createT(long long since, long long till) {
0447 tMIN = UTtoT(since);
0448 std::cout << ">> Processing since: " << tMIN.day() << "/" << tMIN.month() << "/" << tMIN.year() << " " << tMIN.hour()
0449 << ":" << tMIN.minute() << "." << tMIN.second() << std::endl;
0450
0451 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
0452 session->transaction().start(true);
0453 coral::ISchema& schema = session->nominalSchema();
0454 coral::IQuery* queryS = schema.newQuery();
0455 queryS->addToTableList("FWCAENCHANNELADC");
0456 queryS->addToOutputList("FWCAENCHANNELADC.DPID", "DPID");
0457 queryS->addToOutputList("FWCAENCHANNELADC.CHANGE_DATE", "TSTAMP");
0458 queryS->addToOutputList("FWCAENCHANNELADC.ACTUAL_TEMPERATURE", "TEMPERATURE");
0459 RPCObTemp::T_Item Ttemp;
0460 std::vector<RPCObTemp::T_Item> temparray;
0461 coral::TimeStamp tlast = tMIN;
0462 if (till > since) {
0463 tMAX = UTtoT(till);
0464 std::cout << ">> Processing till: " << tMAX.day() << "/" << tMAX.month() << "/" << tMAX.year() << " " << tMAX.hour()
0465 << ":" << tMAX.minute() << "." << tMAX.second() << std::endl;
0466 std::cout << ">> creating TEMPERATURE object..." << std::endl;
0467 coral::AttributeList conditionData;
0468 conditionData.extend<coral::TimeStamp>("tmin");
0469 conditionData.extend<coral::TimeStamp>("tmax");
0470 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0471 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0472 std::string condition =
0473 "FWCAENCHANNELADC.ACTUAL_TEMPERATURE IS NOT NULL AND CHANGE_DATE >:tmin AND CHANGE_DATE <:tmax";
0474 queryS->setCondition(condition, conditionData);
0475 coral::ICursor& cursorS = queryS->execute();
0476 while (cursorS.next()) {
0477 const coral::AttributeList& row = cursorS.currentRow();
0478 float idoub = row["DPID"].data<float>();
0479 int id = static_cast<int>(idoub);
0480 float val = row["TEMPERATURE"].data<float>();
0481 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0482 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0483 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0484
0485 Ttemp.dpid = id;
0486 Ttemp.value = val;
0487 Ttemp.day = ndate;
0488 Ttemp.time = ntime;
0489 temparray.push_back(Ttemp);
0490 }
0491 } else {
0492 std::cout << ">> creating TEMPERATURE object..." << std::endl;
0493 coral::AttributeList conditionData;
0494 conditionData.extend<coral::TimeStamp>("tmin");
0495 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0496 std::string condition = "FWCAENCHANNELADC.ACTUAL_TEMPERATURE IS NOT NULL AND CHANGE_DATE >:tmin";
0497 queryS->setCondition(condition, conditionData);
0498 coral::ICursor& cursorS = queryS->execute();
0499 while (cursorS.next()) {
0500 const coral::AttributeList& row = cursorS.currentRow();
0501 float idoub = row["DPID"].data<float>();
0502 int id = static_cast<int>(idoub);
0503 float val = row["TEMPERATURE"].data<float>();
0504 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0505 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0506 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0507
0508 Ttemp.dpid = id;
0509 Ttemp.value = val;
0510 Ttemp.day = ndate;
0511 Ttemp.time = ntime;
0512 temparray.push_back(Ttemp);
0513 }
0514 }
0515 N_IOV = TtoUT(tlast);
0516 if (till > since)
0517 N_IOV = till;
0518 std::cout << ">> Temperature array --> size: " << temparray.size() << " >> done." << std::endl
0519 << std::endl
0520 << std::endl;
0521
0522 delete queryS;
0523 session->transaction().commit();
0524 delete session;
0525
0526 return temparray;
0527 }
0528
0529
0530 std::vector<RPCObPVSSmap::Item> RPCFw::createIDMAP() {
0531
0532 std::cout << ">> Processing data..." << std::endl;
0533
0534 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
0535 session->transaction().start(true);
0536 coral::ISchema& schema = session->nominalSchema();
0537 std::cout << ">> creating IDMAP object..." << std::endl;
0538 coral::IQuery* queryM = schema.newQuery();
0539 queryM->addToTableList("RPCPVSSDETID");
0540 queryM->addToOutputList("RPCPVSSDETID.SINCE", "SINCE");
0541 queryM->addToOutputList("RPCPVSSDETID.PVSS_ID", "PVSS_ID");
0542 queryM->addToOutputList("RPCPVSSDETID.REGION", "REGION");
0543 queryM->addToOutputList("RPCPVSSDETID.RING", "RING");
0544 queryM->addToOutputList("RPCPVSSDETID.STATION", "STATION");
0545 queryM->addToOutputList("RPCPVSSDETID.SECTOR", "SECTOR");
0546 queryM->addToOutputList("RPCPVSSDETID.LAYER", "LAYER");
0547 queryM->addToOutputList("RPCPVSSDETID.SUBSECTOR", "SUBSECTOR");
0548 queryM->addToOutputList("RPCPVSSDETID.SUPPLYTYPE", "SUPPLYTYPE");
0549
0550 std::string condM = "RPCPVSSDETID.PVSS_ID is not NULL";
0551
0552
0553 coral::ICursor& cursorM = queryM->execute();
0554
0555 RPCObPVSSmap::Item Itemp;
0556 std::vector<RPCObPVSSmap::Item> idmaparray;
0557 while (cursorM.next()) {
0558 const coral::AttributeList& row = cursorM.currentRow();
0559 int id = row["PVSS_ID"].data<int>();
0560 std::string reg_s = row["REGION"].data<std::string>();
0561 std::string rin_s = row["RING"].data<std::string>();
0562 std::string sta_s = row["STATION"].data<std::string>();
0563 std::string sec_s = row["SECTOR"].data<std::string>();
0564 std::string lay_s = row["LAYER"].data<std::string>();
0565 std::string sub_s = row["SUBSECTOR"].data<std::string>();
0566 std::string sup_s = row["SUPPLYTYPE"].data<std::string>();
0567
0568 int reg = atoi(reg_s.c_str());
0569 int rin = atoi(rin_s.c_str());
0570 int sta = atoi(sta_s.c_str());
0571 int sec = atoi(sec_s.c_str());
0572 int lay = atoi(lay_s.c_str());
0573 int sub = atoi(sub_s.c_str());
0574 int sup = 5;
0575
0576 if (sup_s == "HV")
0577 sup = 0;
0578 if (sup_s == "LVA")
0579 sup = 1;
0580 if (sup_s == "LVD")
0581 sup = 2;
0582 if (sup_s == "LB")
0583 sup = 3;
0584 if (sup_s == "T")
0585 sup = 4;
0586
0587 coral::TimeStamp ts = row["SINCE"].data<coral::TimeStamp>();
0588
0589 std::ostringstream dday;
0590 std::ostringstream dmon;
0591 std::ostringstream dyea;
0592 dday << ts.day();
0593 dmon << ts.month();
0594 dyea << ts.year();
0595 std::string date = dday.str() + "-" + dmon.str() + "-" + dyea.str();
0596
0597 Itemp.since = atoi(date.c_str());
0598 Itemp.dpid = id;
0599 Itemp.region = reg;
0600 Itemp.ring = rin;
0601 Itemp.station = sta;
0602 Itemp.sector = sec;
0603 Itemp.layer = lay;
0604 Itemp.subsector = sub;
0605 Itemp.suptype = sup;
0606
0607 idmaparray.push_back(Itemp);
0608 }
0609
0610 std::cout << ">> IDMAP array --> size: " << idmaparray.size() << " >> done." << std::endl;
0611 delete queryM;
0612 session->transaction().commit();
0613 delete session;
0614 return idmaparray;
0615 }
0616
0617
0618 std::vector<RPCObFebmap::Feb_Item> RPCFw::createFEB(long long since, long long till) {
0619 tMIN = UTtoT(since);
0620 std::cout << ">> Processing since: " << tMIN.day() << "/" << tMIN.month() << "/" << tMIN.year() << " " << tMIN.hour()
0621 << ":" << tMIN.minute() << "." << tMIN.second() << std::endl;
0622
0623 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
0624 session->transaction().start(true);
0625 coral::ISchema& schema = session->nominalSchema();
0626 std::cout << ">> creating FEB object..." << std::endl;
0627
0628
0629 coral::IQuery* queryFVTH1 = schema.newQuery();
0630 queryFVTH1->addToTableList("RPCFEB");
0631 queryFVTH1->addToOutputList("RPCFEB.DPID", "DPID");
0632 queryFVTH1->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0633 queryFVTH1->addToOutputList("RPCFEB.VTH1", "VTH1");
0634
0635
0636 coral::IQuery* queryFVTH2 = schema.newQuery();
0637 queryFVTH2->addToTableList("RPCFEB");
0638 queryFVTH2->addToOutputList("RPCFEB.DPID", "DPID");
0639 queryFVTH2->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0640 queryFVTH2->addToOutputList("RPCFEB.VTH2", "VTH2");
0641
0642
0643 coral::IQuery* queryFVTH3 = schema.newQuery();
0644 queryFVTH3->addToTableList("RPCFEB");
0645 queryFVTH3->addToOutputList("RPCFEB.DPID", "DPID");
0646 queryFVTH3->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0647 queryFVTH3->addToOutputList("RPCFEB.VTH3", "VTH3");
0648
0649
0650 coral::IQuery* queryFVTH4 = schema.newQuery();
0651 queryFVTH4->addToTableList("RPCFEB");
0652 queryFVTH4->addToOutputList("RPCFEB.DPID", "DPID");
0653 queryFVTH4->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0654 queryFVTH4->addToOutputList("RPCFEB.VTH4", "VTH4");
0655
0656
0657 coral::IQuery* queryFVMON1 = schema.newQuery();
0658 queryFVMON1->addToTableList("RPCFEB");
0659 queryFVMON1->addToOutputList("RPCFEB.DPID", "DPID");
0660 queryFVMON1->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0661 queryFVMON1->addToOutputList("RPCFEB.VMON1", "VMON1");
0662
0663
0664 coral::IQuery* queryFVMON2 = schema.newQuery();
0665 queryFVMON2->addToTableList("RPCFEB");
0666 queryFVMON2->addToOutputList("RPCFEB.DPID", "DPID");
0667 queryFVMON2->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0668 queryFVMON2->addToOutputList("RPCFEB.VMON2", "VMON2");
0669
0670
0671 coral::IQuery* queryFVMON3 = schema.newQuery();
0672 queryFVMON3->addToTableList("RPCFEB");
0673 queryFVMON3->addToOutputList("RPCFEB.DPID", "DPID");
0674 queryFVMON3->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0675 queryFVMON3->addToOutputList("RPCFEB.VMON3", "VMON3");
0676
0677
0678 coral::IQuery* queryFVMON4 = schema.newQuery();
0679 queryFVMON4->addToTableList("RPCFEB");
0680 queryFVMON4->addToOutputList("RPCFEB.DPID", "DPID");
0681 queryFVMON4->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0682 queryFVMON4->addToOutputList("RPCFEB.VMON4", "VMON4");
0683
0684
0685 coral::IQuery* queryFTEMP1 = schema.newQuery();
0686 queryFTEMP1->addToTableList("RPCFEB");
0687 queryFTEMP1->addToOutputList("RPCFEB.DPID", "DPID");
0688 queryFTEMP1->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0689 queryFTEMP1->addToOutputList("RPCFEB.TEMPERATURE1", "TEMP1");
0690
0691
0692 coral::IQuery* queryFTEMP2 = schema.newQuery();
0693 queryFTEMP2->addToTableList("RPCFEB");
0694 queryFTEMP2->addToOutputList("RPCFEB.DPID", "DPID");
0695 queryFTEMP2->addToOutputList("RPCFEB.CHANGE_DATE", "TSTAMP");
0696 queryFTEMP2->addToOutputList("RPCFEB.TEMPERATURE2", "TEMP2");
0697
0698 RPCObFebmap::Feb_Item Itemp;
0699 std::vector<RPCObFebmap::Feb_Item> febarray;
0700 coral::TimeStamp tlast = tMIN;
0701 if (till > since) {
0702 tMAX = UTtoT(till);
0703 std::cout << ">> Processing till: " << tMAX.day() << "/" << tMAX.month() << "/" << tMAX.year() << " " << tMAX.hour()
0704 << ":" << tMAX.minute() << "." << tMAX.second() << std::endl;
0705 std::cout << "Processing VTH1..." << std::endl;
0706 coral::AttributeList conditionData;
0707 conditionData.extend<coral::TimeStamp>("tmin");
0708 conditionData.extend<coral::TimeStamp>("tmax");
0709 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0710 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0711 std::string conditionVTH1 = "RPCFEB.VTH1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
0712 queryFVTH1->setCondition(conditionVTH1, conditionData);
0713 coral::ICursor& cursorFVTH1 = queryFVTH1->execute();
0714 while (cursorFVTH1.next()) {
0715 Itemp.thr1 = 0;
0716 Itemp.thr2 = 0;
0717 Itemp.thr3 = 0;
0718 Itemp.thr4 = 0;
0719 Itemp.vmon1 = 0;
0720 Itemp.vmon2 = 0;
0721 Itemp.vmon3 = 0;
0722 Itemp.vmon4 = 0;
0723 Itemp.temp1 = 0;
0724 Itemp.temp2 = 0;
0725 Itemp.noise1 = 0;
0726 Itemp.noise2 = 0;
0727 Itemp.noise3 = 0;
0728 Itemp.noise4 = 0;
0729 const coral::AttributeList& row = cursorFVTH1.currentRow();
0730 float idoub = row["DPID"].data<float>();
0731 int id = static_cast<int>(idoub);
0732 float vth1 = row["VTH1"].data<float>();
0733 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0734 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0735 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0736 Itemp.dpid = id;
0737 Itemp.thr1 = vth1;
0738 Itemp.day = ndate;
0739 Itemp.time = ntime;
0740 febarray.push_back(Itemp);
0741 }
0742 } else {
0743 std::cout << ">> Processing VTH1..." << std::endl;
0744 coral::AttributeList conditionData;
0745 conditionData.extend<coral::TimeStamp>("tmin");
0746 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0747 std::string conditionVTH1 = "RPCFEB.VTH1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
0748 queryFVTH1->setCondition(conditionVTH1, conditionData);
0749 coral::ICursor& cursorFVTH1 = queryFVTH1->execute();
0750 while (cursorFVTH1.next()) {
0751 Itemp.thr1 = 0;
0752 Itemp.thr2 = 0;
0753 Itemp.thr3 = 0;
0754 Itemp.thr4 = 0;
0755 Itemp.vmon1 = 0;
0756 Itemp.vmon2 = 0;
0757 Itemp.vmon3 = 0;
0758 Itemp.vmon4 = 0;
0759 Itemp.temp1 = 0;
0760 Itemp.temp2 = 0;
0761 Itemp.noise1 = 0;
0762 Itemp.noise2 = 0;
0763 Itemp.noise3 = 0;
0764 Itemp.noise4 = 0;
0765 const coral::AttributeList& row = cursorFVTH1.currentRow();
0766 float idoub = row["DPID"].data<float>();
0767 int id = static_cast<int>(idoub);
0768 float vth1 = row["VTH1"].data<float>();
0769 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0770 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0771 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0772 Itemp.dpid = id;
0773 Itemp.thr1 = vth1;
0774 Itemp.day = ndate;
0775 Itemp.time = ntime;
0776 febarray.push_back(Itemp);
0777 }
0778 }
0779
0780 if (till > since) {
0781 tMAX = UTtoT(till);
0782 std::cout << "Processing VTH2..." << std::endl;
0783 coral::AttributeList conditionData;
0784 conditionData.extend<coral::TimeStamp>("tmin");
0785 conditionData.extend<coral::TimeStamp>("tmax");
0786 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0787 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0788 std::string conditionVTH2 = "RPCFEB.VTH2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
0789 queryFVTH2->setCondition(conditionVTH2, conditionData);
0790 coral::ICursor& cursorFVTH2 = queryFVTH2->execute();
0791 while (cursorFVTH2.next()) {
0792 Itemp.thr1 = 0;
0793 Itemp.thr2 = 0;
0794 Itemp.thr3 = 0;
0795 Itemp.thr4 = 0;
0796 Itemp.vmon1 = 0;
0797 Itemp.vmon2 = 0;
0798 Itemp.vmon3 = 0;
0799 Itemp.vmon4 = 0;
0800 Itemp.temp1 = 0;
0801 Itemp.temp2 = 0;
0802 Itemp.noise1 = 0;
0803 Itemp.noise2 = 0;
0804 Itemp.noise3 = 0;
0805 Itemp.noise4 = 0;
0806 const coral::AttributeList& row = cursorFVTH2.currentRow();
0807 float idoub = row["DPID"].data<float>();
0808 int id = static_cast<int>(idoub);
0809 float vth2 = row["VTH2"].data<float>();
0810 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0811 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0812 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0813 Itemp.dpid = id;
0814 Itemp.thr2 = vth2;
0815 Itemp.day = ndate;
0816 Itemp.time = ntime;
0817 febarray.push_back(Itemp);
0818 }
0819 } else {
0820 std::cout << ">> Processing VTH2..." << std::endl;
0821 coral::AttributeList conditionData;
0822 conditionData.extend<coral::TimeStamp>("tmin");
0823 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0824 std::string conditionVTH2 = "RPCFEB.VTH2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
0825 queryFVTH2->setCondition(conditionVTH2, conditionData);
0826 coral::ICursor& cursorFVTH2 = queryFVTH2->execute();
0827 while (cursorFVTH2.next()) {
0828 Itemp.thr1 = 0;
0829 Itemp.thr2 = 0;
0830 Itemp.thr3 = 0;
0831 Itemp.thr4 = 0;
0832 Itemp.vmon1 = 0;
0833 Itemp.vmon2 = 0;
0834 Itemp.vmon3 = 0;
0835 Itemp.vmon4 = 0;
0836 Itemp.temp1 = 0;
0837 Itemp.temp2 = 0;
0838 Itemp.noise1 = 0;
0839 Itemp.noise2 = 0;
0840 Itemp.noise3 = 0;
0841 Itemp.noise4 = 0;
0842 const coral::AttributeList& row = cursorFVTH2.currentRow();
0843 float idoub = row["DPID"].data<float>();
0844 int id = static_cast<int>(idoub);
0845 float vth2 = row["VTH2"].data<float>();
0846 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0847 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0848 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0849 Itemp.dpid = id;
0850 Itemp.thr2 = vth2;
0851 Itemp.day = ndate;
0852 Itemp.time = ntime;
0853 febarray.push_back(Itemp);
0854 }
0855 }
0856
0857 if (till > since) {
0858 tMAX = UTtoT(till);
0859 std::cout << "Processing VTH3..." << std::endl;
0860 coral::AttributeList conditionData;
0861 conditionData.extend<coral::TimeStamp>("tmin");
0862 conditionData.extend<coral::TimeStamp>("tmax");
0863 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0864 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0865 std::string conditionVTH3 = "RPCFEB.VTH3 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
0866 queryFVTH3->setCondition(conditionVTH3, conditionData);
0867 coral::ICursor& cursorFVTH3 = queryFVTH3->execute();
0868 while (cursorFVTH3.next()) {
0869 Itemp.thr1 = 0;
0870 Itemp.thr2 = 0;
0871 Itemp.thr3 = 0;
0872 Itemp.thr4 = 0;
0873 Itemp.vmon1 = 0;
0874 Itemp.vmon2 = 0;
0875 Itemp.vmon3 = 0;
0876 Itemp.vmon4 = 0;
0877 Itemp.temp1 = 0;
0878 Itemp.temp2 = 0;
0879 Itemp.noise1 = 0;
0880 Itemp.noise2 = 0;
0881 Itemp.noise3 = 0;
0882 Itemp.noise4 = 0;
0883 const coral::AttributeList& row = cursorFVTH3.currentRow();
0884 float idoub = row["DPID"].data<float>();
0885 int id = static_cast<int>(idoub);
0886 float vth3 = row["VTH3"].data<float>();
0887 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0888 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0889 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0890 Itemp.dpid = id;
0891 Itemp.thr3 = vth3;
0892 Itemp.day = ndate;
0893 Itemp.time = ntime;
0894 febarray.push_back(Itemp);
0895 }
0896 } else {
0897 std::cout << ">> Processing VTH3..." << std::endl;
0898 coral::AttributeList conditionData;
0899 conditionData.extend<coral::TimeStamp>("tmin");
0900 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0901 std::string conditionVTH3 = "RPCFEB.VTH3 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
0902 queryFVTH3->setCondition(conditionVTH3, conditionData);
0903 coral::ICursor& cursorFVTH3 = queryFVTH3->execute();
0904 while (cursorFVTH3.next()) {
0905 Itemp.thr1 = 0;
0906 Itemp.thr2 = 0;
0907 Itemp.thr3 = 0;
0908 Itemp.thr4 = 0;
0909 Itemp.vmon1 = 0;
0910 Itemp.vmon2 = 0;
0911 Itemp.vmon3 = 0;
0912 Itemp.vmon4 = 0;
0913 Itemp.temp1 = 0;
0914 Itemp.temp2 = 0;
0915 Itemp.noise1 = 0;
0916 Itemp.noise2 = 0;
0917 Itemp.noise3 = 0;
0918 Itemp.noise4 = 0;
0919 const coral::AttributeList& row = cursorFVTH3.currentRow();
0920 float idoub = row["DPID"].data<float>();
0921 int id = static_cast<int>(idoub);
0922 float vth3 = row["VTH3"].data<float>();
0923 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0924 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0925 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0926 Itemp.dpid = id;
0927 Itemp.thr3 = vth3;
0928 Itemp.day = ndate;
0929 Itemp.time = ntime;
0930 febarray.push_back(Itemp);
0931 }
0932 }
0933
0934 if (till > since) {
0935 tMAX = UTtoT(till);
0936 std::cout << "Processing VTH4..." << std::endl;
0937 coral::AttributeList conditionData;
0938 conditionData.extend<coral::TimeStamp>("tmin");
0939 conditionData.extend<coral::TimeStamp>("tmax");
0940 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0941 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
0942 std::string conditionVTH4 = "RPCFEB.VTH4 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
0943 queryFVTH4->setCondition(conditionVTH4, conditionData);
0944 coral::ICursor& cursorFVTH4 = queryFVTH4->execute();
0945 while (cursorFVTH4.next()) {
0946 Itemp.thr1 = 0;
0947 Itemp.thr2 = 0;
0948 Itemp.thr3 = 0;
0949 Itemp.thr4 = 0;
0950 Itemp.vmon1 = 0;
0951 Itemp.vmon2 = 0;
0952 Itemp.vmon3 = 0;
0953 Itemp.vmon4 = 0;
0954 Itemp.temp1 = 0;
0955 Itemp.temp2 = 0;
0956 Itemp.noise1 = 0;
0957 Itemp.noise2 = 0;
0958 Itemp.noise3 = 0;
0959 Itemp.noise4 = 0;
0960 const coral::AttributeList& row = cursorFVTH4.currentRow();
0961 float idoub = row["DPID"].data<float>();
0962 int id = static_cast<int>(idoub);
0963 float vth4 = row["VTH4"].data<float>();
0964 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
0965 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
0966 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
0967 Itemp.dpid = id;
0968 Itemp.thr4 = vth4;
0969 Itemp.day = ndate;
0970 Itemp.time = ntime;
0971 febarray.push_back(Itemp);
0972 }
0973 } else {
0974 std::cout << ">> Processing VTH4..." << std::endl;
0975 coral::AttributeList conditionData;
0976 conditionData.extend<coral::TimeStamp>("tmin");
0977 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
0978 std::string conditionVTH4 = "RPCFEB.VTH4 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
0979 queryFVTH4->setCondition(conditionVTH4, conditionData);
0980 coral::ICursor& cursorFVTH4 = queryFVTH4->execute();
0981 while (cursorFVTH4.next()) {
0982 Itemp.thr1 = 0;
0983 Itemp.thr2 = 0;
0984 Itemp.thr3 = 0;
0985 Itemp.thr4 = 0;
0986 Itemp.vmon1 = 0;
0987 Itemp.vmon2 = 0;
0988 Itemp.vmon3 = 0;
0989 Itemp.vmon4 = 0;
0990 Itemp.temp1 = 0;
0991 Itemp.temp2 = 0;
0992 Itemp.noise1 = 0;
0993 Itemp.noise2 = 0;
0994 Itemp.noise3 = 0;
0995 Itemp.noise4 = 0;
0996 const coral::AttributeList& row = cursorFVTH4.currentRow();
0997 float idoub = row["DPID"].data<float>();
0998 int id = static_cast<int>(idoub);
0999 float vth4 = row["VTH4"].data<float>();
1000 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1001 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1002 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1003 Itemp.dpid = id;
1004 Itemp.thr4 = vth4;
1005 Itemp.day = ndate;
1006 Itemp.time = ntime;
1007 febarray.push_back(Itemp);
1008 }
1009 }
1010
1011 if (till > since) {
1012 tMAX = UTtoT(till);
1013 std::cout << "Processing VMON1..." << std::endl;
1014 coral::AttributeList conditionData;
1015 conditionData.extend<coral::TimeStamp>("tmin");
1016 conditionData.extend<coral::TimeStamp>("tmax");
1017 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1018 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1019 std::string conditionVMON1 = "RPCFEB.VMON1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1020 queryFVMON1->setCondition(conditionVMON1, conditionData);
1021 coral::ICursor& cursorFVMON1 = queryFVMON1->execute();
1022 while (cursorFVMON1.next()) {
1023 Itemp.thr1 = 0;
1024 Itemp.thr2 = 0;
1025 Itemp.thr3 = 0;
1026 Itemp.thr4 = 0;
1027 Itemp.vmon1 = 0;
1028 Itemp.vmon2 = 0;
1029 Itemp.vmon3 = 0;
1030 Itemp.vmon4 = 0;
1031 Itemp.temp1 = 0;
1032 Itemp.temp2 = 0;
1033 Itemp.noise1 = 0;
1034 Itemp.noise2 = 0;
1035 Itemp.noise3 = 0;
1036 Itemp.noise4 = 0;
1037 const coral::AttributeList& row = cursorFVMON1.currentRow();
1038 float idoub = row["DPID"].data<float>();
1039 int id = static_cast<int>(idoub);
1040 float vmon1 = row["VMON1"].data<float>();
1041 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1042 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1043 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1044 Itemp.dpid = id;
1045 Itemp.vmon1 = vmon1;
1046 Itemp.day = ndate;
1047 Itemp.time = ntime;
1048 febarray.push_back(Itemp);
1049 }
1050 } else {
1051 std::cout << ">> Processing VMON1..." << std::endl;
1052 coral::AttributeList conditionData;
1053 conditionData.extend<coral::TimeStamp>("tmin");
1054 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1055 std::string conditionVMON1 = "RPCFEB.VMON1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1056 queryFVMON1->setCondition(conditionVMON1, conditionData);
1057 coral::ICursor& cursorFVMON1 = queryFVMON1->execute();
1058 while (cursorFVMON1.next()) {
1059 Itemp.thr1 = 0;
1060 Itemp.thr2 = 0;
1061 Itemp.thr3 = 0;
1062 Itemp.thr4 = 0;
1063 Itemp.vmon1 = 0;
1064 Itemp.vmon2 = 0;
1065 Itemp.vmon3 = 0;
1066 Itemp.vmon4 = 0;
1067 Itemp.temp1 = 0;
1068 Itemp.temp2 = 0;
1069 Itemp.noise1 = 0;
1070 Itemp.noise2 = 0;
1071 Itemp.noise3 = 0;
1072 Itemp.noise4 = 0;
1073 const coral::AttributeList& row = cursorFVMON1.currentRow();
1074 float idoub = row["DPID"].data<float>();
1075 int id = static_cast<int>(idoub);
1076 float vmon1 = row["VMON1"].data<float>();
1077 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1078 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1079 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1080 Itemp.dpid = id;
1081 Itemp.vmon1 = vmon1;
1082 Itemp.day = ndate;
1083 Itemp.time = ntime;
1084 febarray.push_back(Itemp);
1085 }
1086 }
1087
1088 if (till > since) {
1089 tMAX = UTtoT(till);
1090 std::cout << "Processing VMON2..." << std::endl;
1091 coral::AttributeList conditionData;
1092 conditionData.extend<coral::TimeStamp>("tmin");
1093 conditionData.extend<coral::TimeStamp>("tmax");
1094 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1095 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1096 std::string conditionVMON2 = "RPCFEB.VMON2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1097 queryFVMON2->setCondition(conditionVMON2, conditionData);
1098 coral::ICursor& cursorFVMON2 = queryFVMON2->execute();
1099 while (cursorFVMON2.next()) {
1100 Itemp.thr1 = 0;
1101 Itemp.thr2 = 0;
1102 Itemp.thr3 = 0;
1103 Itemp.thr4 = 0;
1104 Itemp.vmon1 = 0;
1105 Itemp.vmon2 = 0;
1106 Itemp.vmon3 = 0;
1107 Itemp.vmon4 = 0;
1108 Itemp.temp1 = 0;
1109 Itemp.temp2 = 0;
1110 Itemp.noise1 = 0;
1111 Itemp.noise2 = 0;
1112 Itemp.noise3 = 0;
1113 Itemp.noise4 = 0;
1114 const coral::AttributeList& row = cursorFVMON2.currentRow();
1115 float idoub = row["DPID"].data<float>();
1116 int id = static_cast<int>(idoub);
1117 float vmon2 = row["VMON2"].data<float>();
1118 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1119 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1120 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1121 Itemp.dpid = id;
1122 Itemp.vmon2 = vmon2;
1123 Itemp.day = ndate;
1124 Itemp.time = ntime;
1125 febarray.push_back(Itemp);
1126 }
1127 } else {
1128 std::cout << ">> Processing VMON2..." << std::endl;
1129 coral::AttributeList conditionData;
1130 conditionData.extend<coral::TimeStamp>("tmin");
1131 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1132 std::string conditionVMON2 = "RPCFEB.VMON2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1133 queryFVMON2->setCondition(conditionVMON2, conditionData);
1134 coral::ICursor& cursorFVMON2 = queryFVMON2->execute();
1135 while (cursorFVMON2.next()) {
1136 Itemp.thr1 = 0;
1137 Itemp.thr2 = 0;
1138 Itemp.thr3 = 0;
1139 Itemp.thr4 = 0;
1140 Itemp.vmon1 = 0;
1141 Itemp.vmon2 = 0;
1142 Itemp.vmon3 = 0;
1143 Itemp.vmon4 = 0;
1144 Itemp.temp1 = 0;
1145 Itemp.temp2 = 0;
1146 Itemp.noise1 = 0;
1147 Itemp.noise2 = 0;
1148 Itemp.noise3 = 0;
1149 Itemp.noise4 = 0;
1150 const coral::AttributeList& row = cursorFVMON2.currentRow();
1151 float idoub = row["DPID"].data<float>();
1152 int id = static_cast<int>(idoub);
1153 float vmon2 = row["VMON2"].data<float>();
1154 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1155 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1156 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1157 Itemp.dpid = id;
1158 Itemp.vmon2 = vmon2;
1159 Itemp.day = ndate;
1160 Itemp.time = ntime;
1161 febarray.push_back(Itemp);
1162 }
1163 }
1164
1165 if (till > since) {
1166 tMAX = UTtoT(till);
1167 std::cout << "Processing VMON3..." << std::endl;
1168 coral::AttributeList conditionData;
1169 conditionData.extend<coral::TimeStamp>("tmin");
1170 conditionData.extend<coral::TimeStamp>("tmax");
1171 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1172 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1173 std::string conditionVMON3 = "RPCFEB.VMON3 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1174 queryFVMON3->setCondition(conditionVMON3, conditionData);
1175 coral::ICursor& cursorFVMON3 = queryFVMON3->execute();
1176 while (cursorFVMON3.next()) {
1177 Itemp.thr1 = 0;
1178 Itemp.thr2 = 0;
1179 Itemp.thr3 = 0;
1180 Itemp.thr4 = 0;
1181 Itemp.vmon1 = 0;
1182 Itemp.vmon2 = 0;
1183 Itemp.vmon3 = 0;
1184 Itemp.vmon4 = 0;
1185 Itemp.temp1 = 0;
1186 Itemp.temp2 = 0;
1187 Itemp.noise1 = 0;
1188 Itemp.noise2 = 0;
1189 Itemp.noise3 = 0;
1190 Itemp.noise4 = 0;
1191 const coral::AttributeList& row = cursorFVMON3.currentRow();
1192 float idoub = row["DPID"].data<float>();
1193 int id = static_cast<int>(idoub);
1194 float vmon3 = row["VMON3"].data<float>();
1195 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1196 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1197 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1198 Itemp.dpid = id;
1199 Itemp.vmon3 = vmon3;
1200 Itemp.day = ndate;
1201 Itemp.time = ntime;
1202 febarray.push_back(Itemp);
1203 }
1204 } else {
1205 std::cout << ">> Processing VMON3..." << std::endl;
1206 coral::AttributeList conditionData;
1207 conditionData.extend<coral::TimeStamp>("tmin");
1208 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1209 std::string conditionVMON3 = "RPCFEB.VMON3 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1210 queryFVMON3->setCondition(conditionVMON3, conditionData);
1211 coral::ICursor& cursorFVMON3 = queryFVMON3->execute();
1212 while (cursorFVMON3.next()) {
1213 Itemp.thr1 = 0;
1214 Itemp.thr2 = 0;
1215 Itemp.thr3 = 0;
1216 Itemp.thr4 = 0;
1217 Itemp.vmon1 = 0;
1218 Itemp.vmon2 = 0;
1219 Itemp.vmon3 = 0;
1220 Itemp.vmon4 = 0;
1221 Itemp.temp1 = 0;
1222 Itemp.temp2 = 0;
1223 Itemp.noise1 = 0;
1224 Itemp.noise2 = 0;
1225 Itemp.noise3 = 0;
1226 Itemp.noise4 = 0;
1227 const coral::AttributeList& row = cursorFVMON3.currentRow();
1228 float idoub = row["DPID"].data<float>();
1229 int id = static_cast<int>(idoub);
1230 float vmon3 = row["VMON3"].data<float>();
1231 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1232 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1233 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1234 Itemp.dpid = id;
1235 Itemp.vmon3 = vmon3;
1236 Itemp.day = ndate;
1237 Itemp.time = ntime;
1238 febarray.push_back(Itemp);
1239 }
1240 }
1241
1242 if (till > since) {
1243 tMAX = UTtoT(till);
1244 std::cout << "Processing VMON4..." << std::endl;
1245 coral::AttributeList conditionData;
1246 conditionData.extend<coral::TimeStamp>("tmin");
1247 conditionData.extend<coral::TimeStamp>("tmax");
1248 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1249 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1250 std::string conditionVMON4 = "RPCFEB.VMON4 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1251 queryFVMON4->setCondition(conditionVMON4, conditionData);
1252 coral::ICursor& cursorFVMON4 = queryFVMON4->execute();
1253 while (cursorFVMON4.next()) {
1254 Itemp.thr1 = 0;
1255 Itemp.thr2 = 0;
1256 Itemp.thr3 = 0;
1257 Itemp.thr4 = 0;
1258 Itemp.vmon1 = 0;
1259 Itemp.vmon2 = 0;
1260 Itemp.vmon3 = 0;
1261 Itemp.vmon4 = 0;
1262 Itemp.temp1 = 0;
1263 Itemp.temp2 = 0;
1264 Itemp.noise1 = 0;
1265 Itemp.noise2 = 0;
1266 Itemp.noise3 = 0;
1267 Itemp.noise4 = 0;
1268 const coral::AttributeList& row = cursorFVMON4.currentRow();
1269 float idoub = row["DPID"].data<float>();
1270 int id = static_cast<int>(idoub);
1271 float vmon4 = row["VMON4"].data<float>();
1272 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1273 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1274 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1275 Itemp.dpid = id;
1276 Itemp.vmon4 = vmon4;
1277 Itemp.day = ndate;
1278 Itemp.time = ntime;
1279 febarray.push_back(Itemp);
1280 }
1281 } else {
1282 std::cout << ">> Processing VMON4..." << std::endl;
1283 coral::AttributeList conditionData;
1284 conditionData.extend<coral::TimeStamp>("tmin");
1285 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1286 std::string conditionVMON4 = "RPCFEB.VMON4 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1287 queryFVMON4->setCondition(conditionVMON4, conditionData);
1288 coral::ICursor& cursorFVMON4 = queryFVMON4->execute();
1289 while (cursorFVMON4.next()) {
1290 Itemp.thr1 = 0;
1291 Itemp.thr2 = 0;
1292 Itemp.thr3 = 0;
1293 Itemp.thr4 = 0;
1294 Itemp.vmon1 = 0;
1295 Itemp.vmon2 = 0;
1296 Itemp.vmon3 = 0;
1297 Itemp.vmon4 = 0;
1298 Itemp.temp1 = 0;
1299 Itemp.temp2 = 0;
1300 Itemp.noise1 = 0;
1301 Itemp.noise2 = 0;
1302 Itemp.noise3 = 0;
1303 Itemp.noise4 = 0;
1304 const coral::AttributeList& row = cursorFVMON4.currentRow();
1305 float idoub = row["DPID"].data<float>();
1306 int id = static_cast<int>(idoub);
1307 float vmon4 = row["VMON4"].data<float>();
1308 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1309 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1310 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1311 Itemp.dpid = id;
1312 Itemp.vmon4 = vmon4;
1313 Itemp.day = ndate;
1314 Itemp.time = ntime;
1315 febarray.push_back(Itemp);
1316 }
1317 }
1318
1319 if (till > since) {
1320 tMAX = UTtoT(till);
1321 std::cout << "Processing TEMP1..." << std::endl;
1322 coral::AttributeList conditionData;
1323 conditionData.extend<coral::TimeStamp>("tmin");
1324 conditionData.extend<coral::TimeStamp>("tmax");
1325 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1326 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1327 std::string conditionTEMP1 =
1328 "RPCFEB.TEMPERATURE1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1329 queryFTEMP1->setCondition(conditionTEMP1, conditionData);
1330 coral::ICursor& cursorFTEMP1 = queryFTEMP1->execute();
1331 while (cursorFTEMP1.next()) {
1332 Itemp.thr1 = 0;
1333 Itemp.thr2 = 0;
1334 Itemp.thr3 = 0;
1335 Itemp.thr4 = 0;
1336 Itemp.vmon1 = 0;
1337 Itemp.vmon2 = 0;
1338 Itemp.vmon3 = 0;
1339 Itemp.vmon4 = 0;
1340 Itemp.temp1 = 0;
1341 Itemp.temp2 = 0;
1342 Itemp.noise1 = 0;
1343 Itemp.noise2 = 0;
1344 Itemp.noise3 = 0;
1345 Itemp.noise4 = 0;
1346 const coral::AttributeList& row = cursorFTEMP1.currentRow();
1347 float idoub = row["DPID"].data<float>();
1348 int id = static_cast<int>(idoub);
1349 float temp1 = row["TEMP1"].data<float>();
1350 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1351 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1352 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1353 Itemp.dpid = id;
1354 Itemp.temp1 = temp1;
1355 Itemp.day = ndate;
1356 Itemp.time = ntime;
1357 febarray.push_back(Itemp);
1358 }
1359 } else {
1360 std::cout << ">> Processing TEMP1..." << std::endl;
1361 coral::AttributeList conditionData;
1362 conditionData.extend<coral::TimeStamp>("tmin");
1363 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1364 std::string conditionTEMP1 = "RPCFEB.TEMPERATURE1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1365 queryFTEMP1->setCondition(conditionTEMP1, conditionData);
1366 coral::ICursor& cursorFTEMP1 = queryFTEMP1->execute();
1367 while (cursorFTEMP1.next()) {
1368 Itemp.thr1 = 0;
1369 Itemp.thr2 = 0;
1370 Itemp.thr3 = 0;
1371 Itemp.thr4 = 0;
1372 Itemp.vmon1 = 0;
1373 Itemp.vmon2 = 0;
1374 Itemp.vmon3 = 0;
1375 Itemp.vmon4 = 0;
1376 Itemp.temp1 = 0;
1377 Itemp.temp2 = 0;
1378 Itemp.noise1 = 0;
1379 Itemp.noise2 = 0;
1380 Itemp.noise3 = 0;
1381 Itemp.noise4 = 0;
1382 const coral::AttributeList& row = cursorFTEMP1.currentRow();
1383 float idoub = row["DPID"].data<float>();
1384 int id = static_cast<int>(idoub);
1385 float temp1 = row["TEMP1"].data<float>();
1386 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1387 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1388 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1389 Itemp.dpid = id;
1390 Itemp.temp1 = temp1;
1391 Itemp.day = ndate;
1392 Itemp.time = ntime;
1393 febarray.push_back(Itemp);
1394 }
1395 }
1396
1397 if (till > since) {
1398 tMAX = UTtoT(till);
1399 std::cout << "Processing TEMP2..." << std::endl;
1400 coral::AttributeList conditionData;
1401 conditionData.extend<coral::TimeStamp>("tmin");
1402 conditionData.extend<coral::TimeStamp>("tmax");
1403 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1404 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1405 std::string conditionTEMP2 =
1406 "RPCFEB.TEMPERATURE2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1407 queryFTEMP2->setCondition(conditionTEMP2, conditionData);
1408 coral::ICursor& cursorFTEMP2 = queryFTEMP2->execute();
1409 while (cursorFTEMP2.next()) {
1410 Itemp.thr1 = 0;
1411 Itemp.thr2 = 0;
1412 Itemp.thr3 = 0;
1413 Itemp.thr4 = 0;
1414 Itemp.vmon1 = 0;
1415 Itemp.vmon2 = 0;
1416 Itemp.vmon3 = 0;
1417 Itemp.vmon4 = 0;
1418 Itemp.temp1 = 0;
1419 Itemp.temp2 = 0;
1420 Itemp.noise1 = 0;
1421 Itemp.noise2 = 0;
1422 Itemp.noise3 = 0;
1423 Itemp.noise4 = 0;
1424 const coral::AttributeList& row = cursorFTEMP2.currentRow();
1425 float idoub = row["DPID"].data<float>();
1426 int id = static_cast<int>(idoub);
1427 float temp2 = row["TEMP2"].data<float>();
1428 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1429 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1430 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1431 Itemp.dpid = id;
1432 Itemp.temp2 = temp2;
1433 Itemp.day = ndate;
1434 Itemp.time = ntime;
1435 febarray.push_back(Itemp);
1436 }
1437 } else {
1438 std::cout << ">> Processing TEMP2..." << std::endl;
1439 coral::AttributeList conditionData;
1440 conditionData.extend<coral::TimeStamp>("tmin");
1441 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1442 std::string conditionTEMP2 = "RPCFEB.TEMPERATURE2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1443 queryFTEMP2->setCondition(conditionTEMP2, conditionData);
1444 coral::ICursor& cursorFTEMP2 = queryFTEMP2->execute();
1445 while (cursorFTEMP2.next()) {
1446 Itemp.thr1 = 0;
1447 Itemp.thr2 = 0;
1448 Itemp.thr3 = 0;
1449 Itemp.thr4 = 0;
1450 Itemp.vmon1 = 0;
1451 Itemp.vmon2 = 0;
1452 Itemp.vmon3 = 0;
1453 Itemp.vmon4 = 0;
1454 Itemp.temp1 = 0;
1455 Itemp.temp2 = 0;
1456 Itemp.noise1 = 0;
1457 Itemp.noise2 = 0;
1458 Itemp.noise3 = 0;
1459 Itemp.noise4 = 0;
1460 const coral::AttributeList& row = cursorFTEMP2.currentRow();
1461 float idoub = row["DPID"].data<float>();
1462 int id = static_cast<int>(idoub);
1463 float temp2 = row["TEMP2"].data<float>();
1464 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1465 int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year() - 2000);
1466 int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1467 Itemp.dpid = id;
1468 Itemp.temp2 = temp2;
1469 Itemp.day = ndate;
1470 Itemp.time = ntime;
1471 febarray.push_back(Itemp);
1472 }
1473 }
1474
1475 std::cout << ">> FEB array --> size: " << febarray.size() << " >> done." << std::endl;
1476 delete queryFVTH1;
1477 delete queryFVTH2;
1478 delete queryFVTH3;
1479 delete queryFVTH4;
1480 delete queryFTEMP1;
1481 session->transaction().commit();
1482 delete session;
1483 return febarray;
1484 }
1485
1486
1487 std::vector<RPCObUXC::Item> RPCFw::createUXC(long long since, long long till) {
1488 tMIN = UTtoT(since);
1489 std::cout << ">> Processing since: " << tMIN.day() << "/" << tMIN.month() << "/" << tMIN.year() << " " << tMIN.hour()
1490 << ":" << tMIN.minute() << "." << tMIN.second() << std::endl;
1491
1492 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
1493 session->transaction().start(true);
1494 coral::ISchema& schema = session->nominalSchema();
1495 std::cout << ">> creating UXC object..." << std::endl;
1496
1497
1498 coral::IQuery* queryUXCP = schema.newQuery();
1499 queryUXCP->addToTableList("RPCGASPARAMETERS");
1500 queryUXCP->addToTableList("DP_NAME2ID");
1501 queryUXCP->addToOutputList("DP_NAME2ID.DPNAME", "DPNAME");
1502 queryUXCP->addToOutputList("DP_NAME2ID.ID", "ID");
1503 queryUXCP->addToOutputList("RPCGASPARAMETERS.DPID", "DPID");
1504 queryUXCP->addToOutputList("RPCGASPARAMETERS.CHANGE_DATE", "TSTAMP");
1505 queryUXCP->addToOutputList("RPCGASPARAMETERS.VALUE", "VALUE");
1506 coral::IQuery* queryUXCT = schema.newQuery();
1507 queryUXCT->addToTableList("RPCCOOLING");
1508 queryUXCT->addToTableList("DP_NAME2ID");
1509 queryUXCT->addToOutputList("DP_NAME2ID.DPNAME", "DPNAME");
1510 queryUXCT->addToOutputList("DP_NAME2ID.ID", "ID");
1511 queryUXCT->addToOutputList("RPCCOOLING.DPID", "DPID");
1512 queryUXCT->addToOutputList("RPCCOOLING.CHANGE_DATE", "TSTAMP");
1513 queryUXCT->addToOutputList("RPCCOOLING.VALUE", "VALUE");
1514 coral::IQuery* queryUXCH = schema.newQuery();
1515 queryUXCH->addToTableList("RPCCOOLING");
1516 queryUXCH->addToTableList("DP_NAME2ID");
1517 queryUXCH->addToOutputList("DP_NAME2ID.DPNAME", "DPNAME");
1518 queryUXCH->addToOutputList("DP_NAME2ID.ID", "ID");
1519 queryUXCH->addToOutputList("RPCCOOLING.DPID", "DPID");
1520 queryUXCH->addToOutputList("RPCCOOLING.CHANGE_DATE", "TSTAMP");
1521 queryUXCH->addToOutputList("RPCCOOLING.VALUE", "VALUE");
1522
1523 RPCObUXC::Item Itemp;
1524 std::vector<RPCObUXC::Item> uxcarray;
1525 coral::TimeStamp tlast = tMIN;
1526 if (till > since) {
1527 tMAX = UTtoT(till);
1528 std::cout << ">> Processing till: " << tMAX.day() << "/" << tMAX.month() << "/" << tMAX.year() << " " << tMAX.hour()
1529 << ":" << tMAX.minute() << "." << tMAX.second() << std::endl;
1530 std::cout << "Processing UXC..." << std::endl;
1531 coral::AttributeList conditionData;
1532 conditionData.extend<coral::TimeStamp>("tmin");
1533 conditionData.extend<coral::TimeStamp>("tmax");
1534 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1535 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1536 std::string conditionUXCP =
1537 "RPCGASPARAMETERS.DPID = DP_NAME2ID.ID AND RPCGASPARAMETERS.CHANGE_DATE >:tmin AND "
1538 "RPCGASPARAMETERS.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%UXCPressure%')";
1539 queryUXCP->setCondition(conditionUXCP, conditionData);
1540 coral::ICursor& cursorUXCP = queryUXCP->execute();
1541 while (cursorUXCP.next()) {
1542 Itemp.temperature = 0;
1543 Itemp.pressure = 0;
1544 Itemp.dewpoint = 0;
1545 const coral::AttributeList& row = cursorUXCP.currentRow();
1546 float value = row["VALUE"].data<float>();
1547 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1548 unsigned long long ut_time = TtoUT(ts);
1549 Itemp.pressure = value;
1550 Itemp.unixtime = ut_time;
1551 uxcarray.push_back(Itemp);
1552 }
1553 std::string conditionUXCT =
1554 "RPCCOOLING.DPID = DP_NAME2ID.ID AND RPCCOOLING.CHANGE_DATE >:tmin AND RPCCOOLING.CHANGE_DATE <:tmax AND "
1555 "(DP_NAME2ID.DPNAME like '%TempUXC%')";
1556 queryUXCT->setCondition(conditionUXCT, conditionData);
1557 coral::ICursor& cursorUXCT = queryUXCT->execute();
1558 while (cursorUXCT.next()) {
1559 Itemp.temperature = 0;
1560 Itemp.pressure = 0;
1561 Itemp.dewpoint = 0;
1562 const coral::AttributeList& row = cursorUXCT.currentRow();
1563 float value = row["VALUE"].data<float>();
1564 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1565 unsigned long long ut_time = TtoUT(ts);
1566 Itemp.temperature = value;
1567 Itemp.unixtime = ut_time;
1568 uxcarray.push_back(Itemp);
1569 }
1570 std::string conditionUXCH =
1571 "RPCCOOLING.DPID = DP_NAME2ID.ID AND RPCCOOLING.CHANGE_DATE >:tmin AND RPCCOOLING.CHANGE_DATE <:tmax AND "
1572 "(DP_NAME2ID.DPNAME like '%DewpointUXC%')";
1573 queryUXCH->setCondition(conditionUXCH, conditionData);
1574 coral::ICursor& cursorUXCH = queryUXCH->execute();
1575 while (cursorUXCH.next()) {
1576 Itemp.temperature = 0;
1577 Itemp.pressure = 0;
1578 Itemp.dewpoint = 0;
1579 const coral::AttributeList& row = cursorUXCH.currentRow();
1580 float value = row["VALUE"].data<float>();
1581 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1582 unsigned long long ut_time = TtoUT(ts);
1583 Itemp.dewpoint = value;
1584 Itemp.unixtime = ut_time;
1585 uxcarray.push_back(Itemp);
1586 }
1587 } else {
1588 std::cout << "This objects cannot be copied in this mode. Use RANGE mode!" << std::endl;
1589 }
1590
1591 std::cout << ">> UXC array --> size: " << uxcarray.size() << " >> done." << std::endl;
1592 delete queryUXCT;
1593 delete queryUXCP;
1594 delete queryUXCH;
1595 session->transaction().commit();
1596 delete session;
1597 return uxcarray;
1598 }
1599
1600
1601 std::vector<RPCObGasMix::Item> RPCFw::createMix(long long since, long long till) {
1602 tMIN = UTtoT(since);
1603 std::cout << ">> Processing since: " << tMIN.day() << "/" << tMIN.month() << "/" << tMIN.year() << " " << tMIN.hour()
1604 << ":" << tMIN.minute() << "." << tMIN.second() << std::endl;
1605
1606 coral::ISession* session = this->connect(m_connectionString, m_userName, m_password);
1607 session->transaction().start(true);
1608 coral::ISchema& schema = session->nominalSchema();
1609 std::cout << ">> creating UXC object..." << std::endl;
1610
1611 coral::IQuery* queryMix = schema.newQuery();
1612 queryMix->addToTableList("RPCGASPARAMETERS");
1613 queryMix->addToTableList("DP_NAME2ID");
1614 queryMix->addToOutputList("DP_NAME2ID.DPNAME", "DPNAME");
1615 queryMix->addToOutputList("DP_NAME2ID.ID", "ID");
1616 queryMix->addToOutputList("RPCGASPARAMETERS.DPID", "DPID");
1617 queryMix->addToOutputList("RPCGASPARAMETERS.CHANGE_DATE", "TSTAMP");
1618 queryMix->addToOutputList("RPCGASPARAMETERS.VALUE", "VALUE");
1619
1620 coral::IQuery* queryMix2 = schema.newQuery();
1621 queryMix2->addToTableList("RPCGASPARAMETERS");
1622 queryMix2->addToTableList("DP_NAME2ID");
1623 queryMix2->addToOutputList("DP_NAME2ID.DPNAME", "DPNAME");
1624 queryMix2->addToOutputList("DP_NAME2ID.ID", "ID");
1625 queryMix2->addToOutputList("RPCGASPARAMETERS.DPID", "DPID");
1626 queryMix2->addToOutputList("RPCGASPARAMETERS.CHANGE_DATE", "TSTAMP");
1627 queryMix2->addToOutputList("RPCGASPARAMETERS.VALUE", "VALUE");
1628
1629 coral::IQuery* queryMix3 = schema.newQuery();
1630 queryMix3->addToTableList("RPCGASPARAMETERS");
1631 queryMix3->addToTableList("DP_NAME2ID");
1632 queryMix3->addToOutputList("DP_NAME2ID.DPNAME", "DPNAME");
1633 queryMix3->addToOutputList("DP_NAME2ID.ID", "ID");
1634 queryMix3->addToOutputList("RPCGASPARAMETERS.DPID", "DPID");
1635 queryMix3->addToOutputList("RPCGASPARAMETERS.CHANGE_DATE", "TSTAMP");
1636 queryMix3->addToOutputList("RPCGASPARAMETERS.VALUE", "VALUE");
1637
1638 RPCObGasMix::Item Mtemp;
1639 std::vector<RPCObGasMix::Item> marray;
1640 coral::TimeStamp tlast = tMIN;
1641 if (till > since) {
1642 tMAX = UTtoT(till);
1643 std::cout << ">> Processing till: " << tMAX.day() << "/" << tMAX.month() << "/" << tMAX.year() << " " << tMAX.hour()
1644 << ":" << tMAX.minute() << "." << tMAX.second() << std::endl;
1645 std::cout << "Processing UXC..." << std::endl;
1646 coral::AttributeList conditionData;
1647 conditionData.extend<coral::TimeStamp>("tmin");
1648 conditionData.extend<coral::TimeStamp>("tmax");
1649 conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1650 conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1651 std::string conditionM1 =
1652 "RPCGASPARAMETERS.DPID = DP_NAME2ID.ID AND RPCGASPARAMETERS.CHANGE_DATE >:tmin AND "
1653 "RPCGASPARAMETERS.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%IC4H10Ratio%')";
1654 queryMix->setCondition(conditionM1, conditionData);
1655 coral::ICursor& cursorMix = queryMix->execute();
1656 while (cursorMix.next()) {
1657 Mtemp.gas1 = 0;
1658 Mtemp.gas2 = 0;
1659 Mtemp.gas3 = 0;
1660 const coral::AttributeList& row = cursorMix.currentRow();
1661 float value = row["VALUE"].data<float>();
1662 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1663 unsigned long long ut_time = TtoUT(ts);
1664 Mtemp.gas1 = value;
1665 Mtemp.unixtime = ut_time;
1666 marray.push_back(Mtemp);
1667 }
1668 std::string conditionM2 =
1669 "RPCGASPARAMETERS.DPID = DP_NAME2ID.ID AND RPCGASPARAMETERS.CHANGE_DATE >:tmin AND "
1670 "RPCGASPARAMETERS.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%C2H2F4Ratio%')";
1671 queryMix2->setCondition(conditionM2, conditionData);
1672 coral::ICursor& cursorMix2 = queryMix2->execute();
1673 while (cursorMix2.next()) {
1674 Mtemp.gas1 = 0;
1675 Mtemp.gas2 = 0;
1676 Mtemp.gas3 = 0;
1677 const coral::AttributeList& row = cursorMix2.currentRow();
1678 float value = row["VALUE"].data<float>();
1679 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1680 unsigned long long ut_time = TtoUT(ts);
1681 Mtemp.gas2 = value;
1682 Mtemp.unixtime = ut_time;
1683 marray.push_back(Mtemp);
1684 }
1685 std::string conditionM3 =
1686 "RPCGASPARAMETERS.DPID = DP_NAME2ID.ID AND RPCGASPARAMETERS.CHANGE_DATE >:tmin AND "
1687 "RPCGASPARAMETERS.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%SF6Ratio%')";
1688 queryMix3->setCondition(conditionM3, conditionData);
1689 coral::ICursor& cursorMix3 = queryMix3->execute();
1690 while (cursorMix3.next()) {
1691 Mtemp.gas1 = 0;
1692 Mtemp.gas2 = 0;
1693 Mtemp.gas3 = 0;
1694 const coral::AttributeList& row = cursorMix3.currentRow();
1695 float value = row["VALUE"].data<float>();
1696 coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1697 unsigned long long ut_time = TtoUT(ts);
1698 Mtemp.gas3 = value;
1699 Mtemp.unixtime = ut_time;
1700 marray.push_back(Mtemp);
1701 }
1702 } else {
1703 std::cout << "This objects cannot be copied in this mode. Use RANGE mode!" << std::endl;
1704 }
1705
1706 std::cout << ">> GasMix array --> size: " << marray.size() << " >> done." << std::endl;
1707 delete queryMix;
1708 session->transaction().commit();
1709 delete session;
1710 return marray;
1711 }
1712
1713
1714 coral::TimeStamp RPCFw::UTtoT(long long utime) {
1715 int yea = static_cast<int>(trunc(utime / 31536000) + 1970);
1716 int yes = (yea - 1970) * 31536000;
1717 int cony = ((yea - 1972) % 4) + 1;
1718 if (cony == 0)
1719 yes = yes + (yea - 1972) / 4 * 86400;
1720 else
1721 yes = yes + static_cast<int>(trunc((yea - 1972) / 4)) * 86400;
1722 int day = static_cast<int>(trunc((utime - yes) / 86400));
1723 int rest = static_cast<int>(utime - yes - day * 86400);
1724 int mon = 0;
1725
1726 if (cony == 0) {
1727 day = day + 1;
1728 if (day < 32) {
1729 mon = 1;
1730 day = day - 0;
1731 }
1732 if (day >= 32 && day < 61) {
1733 mon = 2;
1734 day = day - 31;
1735 }
1736 if (day >= 61 && day < 92) {
1737 mon = 3;
1738 day = day - 60;
1739 }
1740 if (day >= 92 && day < 122) {
1741 mon = 4;
1742 day = day - 91;
1743 }
1744 if (day >= 122 && day < 153) {
1745 mon = 5;
1746 day = day - 121;
1747 }
1748 if (day >= 153 && day < 183) {
1749 mon = 6;
1750 day = day - 152;
1751 }
1752 if (day >= 183 && day < 214) {
1753 mon = 7;
1754 day = day - 182;
1755 }
1756 if (day >= 214 && day < 245) {
1757 mon = 8;
1758 day = day - 213;
1759 }
1760 if (day >= 245 && day < 275) {
1761 mon = 9;
1762 day = day - 244;
1763 }
1764 if (day >= 275 && day < 306) {
1765 mon = 10;
1766 day = day - 274;
1767 }
1768 if (day >= 306 && day < 336) {
1769 mon = 11;
1770 day = day - 305;
1771 }
1772 if (day >= 336) {
1773 mon = 12;
1774 day = day - 335;
1775 }
1776 }
1777
1778 else {
1779 if (day < 32) {
1780 mon = 1;
1781 day = day - 0;
1782 }
1783 if (day >= 32 && day < 60) {
1784 mon = 2;
1785 day = day - 31;
1786 }
1787 if (day >= 60 && day < 91) {
1788 mon = 3;
1789 day = day - 59;
1790 }
1791 if (day >= 91 && day < 121) {
1792 mon = 4;
1793 day = day - 90;
1794 }
1795 if (day >= 121 && day < 152) {
1796 mon = 5;
1797 day = day - 120;
1798 }
1799 if (day >= 152 && day < 182) {
1800 mon = 6;
1801 day = day - 151;
1802 }
1803 if (day >= 182 && day < 213) {
1804 mon = 7;
1805 day = day - 181;
1806 }
1807 if (day >= 213 && day < 244) {
1808 mon = 8;
1809 day = day - 212;
1810 }
1811 if (day >= 244 && day < 274) {
1812 mon = 9;
1813 day = day - 243;
1814 }
1815 if (day >= 274 && day < 305) {
1816 mon = 10;
1817 day = day - 273;
1818 }
1819 if (day >= 305 && day < 335) {
1820 mon = 11;
1821 day = day - 304;
1822 }
1823 if (day >= 335) {
1824 mon = 12;
1825 day = day - 334;
1826 }
1827 }
1828
1829 int hou = static_cast<int>(trunc(rest / 3600));
1830 rest = rest - hou * 3600;
1831 int min = static_cast<int>(trunc(rest / 60));
1832 rest = rest - min * 60;
1833 int sec = rest;
1834 int nan = 0;
1835
1836
1837
1838 coral::TimeStamp Tthr;
1839
1840 Tthr = coral::TimeStamp(yea, mon, day, hou, min, sec, nan);
1841 return Tthr;
1842 }
1843
1844
1845 unsigned long long RPCFw::TtoUT(const coral::TimeStamp& time) {
1846 long long utime = (time.year() - 1970) * 31536000 + static_cast<int>(trunc((time.year() - 1972) / 4)) * 86400 +
1847 (((time.month() - 1) * 31) * 86400) + ((time.day() - 1) * 86400) + time.hour() * 3600 +
1848 time.minute() * 60 + time.second();
1849
1850 if (time.month() == 3)
1851 utime = utime - 3 * 86400;
1852 if (time.month() == 4)
1853 utime = utime - 3 * 86400;
1854 if (time.month() == 5)
1855 utime = utime - 4 * 86400;
1856 if (time.month() == 6)
1857 utime = utime - 4 * 86400;
1858 if (time.month() == 7)
1859 utime = utime - 5 * 86400;
1860 if (time.month() == 8)
1861 utime = utime - 5 * 86400;
1862 if (time.month() == 9)
1863 utime = utime - 5 * 86400;
1864 if (time.month() == 10)
1865 utime = utime - 6 * 86400;
1866 if (time.month() == 11)
1867 utime = utime - 6 * 86400;
1868 if (time.month() == 12)
1869 utime = utime - 7 * 86400;
1870
1871 return utime;
1872 }
1873
1874 bool RPCFw::isMajor(const coral::TimeStamp& fir, const coral::TimeStamp& sec) {
1875 double first =
1876 fir.year() * 1e10 + fir.month() + 1e8 + fir.day() * 1e6 + fir.hour() * 1e4 + fir.minute() * 1e2 + fir.second();
1877 double second =
1878 sec.year() * 1e10 + sec.month() + 1e8 + sec.day() * 1e6 + sec.hour() * 1e4 + sec.minute() * 1e2 + sec.second();
1879
1880 if (first > second)
1881 return true;
1882
1883 return false;
1884 }