35 #include "CoralBase/Exception.h"
36 #include "CoralBase/AttributeList.h"
37 #include "CoralBase/Attribute.h"
38 #include "CoralBase/AttributeSpecification.h"
39 #include "CoralBase/Exception.h"
40 #include "CoralBase/Blob.h"
41 #include "RelationalAccess/ISessionProxy.h"
42 #include "RelationalAccess/ITransaction.h"
43 #include "RelationalAccess/AccessMode.h"
44 #include "RelationalAccess/ITypeConverter.h"
45 #include "RelationalAccess/IQuery.h"
46 #include "RelationalAccess/ICursor.h"
47 #include "RelationalAccess/ISchema.h"
48 #include "RelationalAccess/ITable.h"
64 #include <boost/tokenizer.hpp>
65 #include <xercesc/dom/DOM.hpp>
66 #include <xercesc/parsers/XercesDOMParser.hpp>
68 #include <xercesc/util/XMLString.hpp>
70 #include "boost/filesystem/path.hpp"
71 #include "boost/filesystem/operations.hpp"
81 :
public edm::one::EDProducer<edm::one::WatchRuns, edm::BeginLuminosityBlockProducer, edm::EndRunProducer> {
168 XMLCh* buff = xercesc::XMLString::transcode(
temp.c_str());
173 std::ostringstream oss;
174 xercesc::DOMNodeList* childList = nodeToConvert.getChildNodes();
176 unsigned int numNodes = childList->getLength();
177 for (
unsigned int i = 0;
i < numNodes; ++
i) {
178 xercesc::DOMNode* childNode = childList->item(
i);
179 if (childNode->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
181 xercesc::DOMElement*
child = static_cast<xercesc::DOMElement*>(childNode);
182 xercesc::DOMNamedNodeMap* attributes =
child->getAttributes();
183 unsigned int numAttributes = attributes->getLength();
184 for (
unsigned int j = 0;
j < numAttributes; ++
j) {
185 xercesc::DOMNode* attributeNode = attributes->item(
j);
186 if (attributeNode->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
188 xercesc::DOMAttr* attribute = static_cast<xercesc::DOMAttr*>(attributeNode);
190 oss <<
"(" <<
x2s(
child->getTagName()) <<
x2s(attribute->getName()) <<
"=" <<
x2s(attribute->getValue()) <<
")";
200 std::unique_ptr<xercesc::XercesDOMParser>
parser(
new xercesc::XercesDOMParser);
202 parser->setValidationScheme(xercesc::XercesDOMParser::Val_Auto);
203 parser->setDoNamespaces(
false);
205 xercesc::DOMDocument*
doc =
parser->getDocument();
210 xercesc::DOMNodeList* frontierConnectList =
doc->getElementsByTagName(
s2x(
"frontier-connect"));
211 if (frontierConnectList->getLength() > 0) {
212 xercesc::DOMElement* frontierConnectElement = static_cast<xercesc::DOMElement*>(frontierConnectList->item(0));
220 while ((serverurl = frontierConnect.find(
"(serverurl=", nextparen)) != std::string::npos) {
221 realconnect.append(frontierConnect, nextparen, serverurl - nextparen);
222 nextparen = frontierConnect.find(
')', serverurl);
223 lastslash = frontierConnect.rfind(
'/', nextparen);
224 realconnect.append(frontierConnect, serverurl, lastslash - serverurl + 1);
225 realconnect.append(servlet);
227 realconnect.append(frontierConnect, nextparen, frontierConnect.length() - nextparen);
228 }
catch (xercesc::DOMException&
e) {
234 : m_cachedrun(0), m_isNullRun(
false), m_cachesize(0) {
236 produces<LumiSummaryRunHeader, edm::Transition::EndRun>();
237 produces<LumiSummary, edm::Transition::BeginLuminosityBlock>();
238 produces<LumiDetails, edm::Transition::BeginLuminosityBlock>();
245 if (connectStr.substr(0, fproto.length()) == fproto) {
248 if (endservlet == std::string::npos) {
249 endservlet = connectStr.rfind(
'/', connectStr.length());
251 std::string servlet = connectStr.substr(startservlet, endservlet - startservlet);
252 if ((!servlet.empty()) && (servlet.find_first_of(
":/)[]") == std::string::npos)) {
253 if (servlet ==
"cms_conditions_data")
257 if (siteconfpath.length() == 0) {
261 char*
tmp = std::getenv(
"CMS_PATH");
294 unsigned long long lumidataid = 0;
295 coral::AttributeList bindVariables;
296 bindVariables.extend(
"runnum",
typeid(
unsigned int));
297 bindVariables[
"runnum"].data<
unsigned int>() =
runnumber;
298 coral::AttributeList lumiidOutput;
299 lumiidOutput.extend(
"lumidataid",
typeid(
unsigned long long));
300 coral::IQuery* lumiQuery = schema.newQuery();
302 lumiQuery->addToOutputList(
"MAX(DATA_ID)",
"lumidataid");
303 lumiQuery->setCondition(
"RUNNUM=:runnum", bindVariables);
304 lumiQuery->defineOutput(lumiidOutput);
305 coral::ICursor& lumicursor = lumiQuery->execute();
306 while (lumicursor.next()) {
307 const coral::AttributeList& row = lumicursor.currentRow();
308 if (!row[
"lumidataid"].isNull()) {
309 lumidataid = row[
"lumidataid"].data<
unsigned long long>();
319 unsigned long long trgdataid = 0;
320 coral::AttributeList bindVariables;
321 bindVariables.extend(
"runnum",
typeid(
unsigned int));
322 bindVariables[
"runnum"].data<
unsigned int>() =
runnumber;
323 coral::AttributeList trgidOutput;
324 trgidOutput.extend(
"trgdataid",
typeid(
unsigned long long));
325 coral::IQuery* trgQuery = schema.newQuery();
327 trgQuery->addToOutputList(
"MAX(DATA_ID)",
"trgdataid");
328 trgQuery->setCondition(
"RUNNUM=:runnum", bindVariables);
329 trgQuery->defineOutput(trgidOutput);
330 coral::ICursor& trgcursor = trgQuery->execute();
331 while (trgcursor.next()) {
332 const coral::AttributeList& row = trgcursor.currentRow();
333 if (!row[
"trgdataid"].isNull()) {
334 trgdataid = row[
"trgdataid"].data<
unsigned long long>();
344 unsigned long long hltdataid = 0;
345 coral::AttributeList bindVariables;
346 bindVariables.extend(
"runnum",
typeid(
unsigned int));
347 bindVariables[
"runnum"].data<
unsigned int>() =
runnumber;
348 coral::AttributeList hltidOutput;
349 hltidOutput.extend(
"hltdataid",
typeid(
unsigned long long));
350 coral::IQuery* hltQuery = schema.newQuery();
352 hltQuery->addToOutputList(
"MAX(DATA_ID)",
"hltdataid");
353 hltQuery->setCondition(
"RUNNUM=:runnum", bindVariables);
354 hltQuery->defineOutput(hltidOutput);
355 coral::ICursor& hltcursor = hltQuery->execute();
356 while (hltcursor.next()) {
357 const coral::AttributeList& row = hltcursor.currentRow();
358 if (!row[
"hltdataid"].isNull()) {
359 hltdataid = row[
"hltdataid"].data<
unsigned long long>();
369 std::map<unsigned long long, std::string> alltags;
370 coral::IQuery* tagQuery = schema.newQuery();
372 tagQuery->addToOutputList(
"TAGID");
373 tagQuery->addToOutputList(
"TAGNAME");
374 coral::AttributeList tagoutput;
375 tagoutput.extend(
"TAGID",
typeid(
unsigned long long));
377 tagQuery->defineOutput(tagoutput);
378 coral::ICursor& tagcursor = tagQuery->execute();
379 while (tagcursor.next()) {
380 const coral::AttributeList& row = tagcursor.currentRow();
381 unsigned long long tagid = row[
"TAGID"].data<
unsigned long long>();
383 alltags.insert(std::make_pair(tagid,
tagname));
386 unsigned long long maxid = 0;
387 for (std::map<unsigned long long, std::string>::iterator it = alltags.begin(); it != alltags.end(); ++it) {
388 if (it->first > maxid) {
403 throw cms::Exception(
"Non existing service lumi::service::DBService");
407 session->transaction().start(
true);
416 session->transaction().commit();
418 session->transaction().rollback();
431 iLBlock.
put(std::make_unique<LumiSummary>());
432 iLBlock.
put(std::make_unique<LumiDetails>());
444 auto lsrh = std::make_unique<LumiSummaryRunHeader>();
457 coral::AttributeList trgBindVariables;
458 trgBindVariables.extend(
"trgdataid",
typeid(
unsigned long long));
461 coral::AttributeList trgOutput;
462 trgOutput.extend(
"bitzeroname",
typeid(
std::string));
463 trgOutput.extend(
"bitnameclob",
typeid(
std::string));
464 coral::IQuery* trgQuery = schema.newQuery();
466 trgQuery->addToOutputList(
"BITZERONAME");
467 trgQuery->addToOutputList(
"BITNAMECLOB");
468 trgQuery->setCondition(
"DATA_ID=:trgdataid", trgBindVariables);
469 trgQuery->defineOutput(trgOutput);
470 coral::ICursor& trgcursor = trgQuery->execute();
471 while (trgcursor.next()) {
472 const coral::AttributeList& row = trgcursor.currentRow();
476 boost::char_separator<char> sep(
",");
477 boost::tokenizer<boost::char_separator<char> > tokens(bitnames, sep);
478 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_it = tokens.begin(); tok_it != tokens.end();
492 coral::AttributeList hltBindVariables;
493 hltBindVariables.extend(
"hltdataid",
typeid(
unsigned long long));
495 coral::AttributeList hltOutput;
496 hltOutput.extend(
"PATHNAMECLOB",
typeid(
std::string));
497 coral::IQuery* hltQuery = schema.newQuery();
499 hltQuery->addToOutputList(
"PATHNAMECLOB");
500 hltQuery->setCondition(
"DATA_ID=:hltdataid", hltBindVariables);
501 hltQuery->defineOutput(hltOutput);
502 coral::ICursor& hltcursor = hltQuery->execute();
503 while (hltcursor.next()) {
504 const coral::AttributeList& row = hltcursor.currentRow();
506 boost::char_separator<char> sep(
",");
507 boost::tokenizer<boost::char_separator<char> > tokens(pathnames, sep);
508 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_it = tokens.begin(); tok_it != tokens.end();
526 l.hltdata.reserve(250);
527 l.l1data.reserve(192);
528 l.bunchlumivalue.reserve(5);
529 l.bunchlumierror.reserve(5);
530 l.bunchlumiquality.reserve(5);
531 l.beam1intensity.resize(3564, 0.0);
532 l.beam2intensity.resize(3564, 0.0);
541 throw cms::Exception(
"Non existing service lumi::service::DBService");
545 session->transaction().start(
true);
546 coral::ISchema& schema = session->nominalSchema();
547 coral::AttributeList lumisummaryBindVariables;
548 lumisummaryBindVariables.extend(
"lsmin",
typeid(
unsigned int));
549 lumisummaryBindVariables.extend(
"lsmax",
typeid(
unsigned int));
550 lumisummaryBindVariables.extend(
"lumidataid",
typeid(
unsigned long long));
551 lumisummaryBindVariables[
"lumidataid"].data<
unsigned long long>() =
m_cachedlumidataid;
552 lumisummaryBindVariables[
"lsmin"].data<
unsigned int>() = luminum;
553 lumisummaryBindVariables[
"lsmax"].data<
unsigned int>() = luminum +
m_cachesize;
554 coral::AttributeList lumisummaryOutput;
555 lumisummaryOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
556 lumisummaryOutput.extend(
"INSTLUMI",
typeid(
float));
557 lumisummaryOutput.extend(
"STARTORBIT",
typeid(
unsigned int));
558 lumisummaryOutput.extend(
"NUMORBIT",
typeid(
unsigned int));
559 lumisummaryOutput.extend(
"CMSBXINDEXBLOB",
typeid(coral::Blob));
560 lumisummaryOutput.extend(
"BEAMINTENSITYBLOB_1",
typeid(coral::Blob));
561 lumisummaryOutput.extend(
"BEAMINTENSITYBLOB_2",
typeid(coral::Blob));
562 lumisummaryOutput.extend(
"BXLUMIVALUE_OCC1",
typeid(coral::Blob));
563 lumisummaryOutput.extend(
"BXLUMIVALUE_OCC2",
typeid(coral::Blob));
564 lumisummaryOutput.extend(
"BXLUMIVALUE_ET",
typeid(coral::Blob));
565 coral::IQuery* lumisummaryQuery = schema.newQuery();
567 lumisummaryQuery->addToOutputList(
"CMSLSNUM");
568 lumisummaryQuery->addToOutputList(
"INSTLUMI");
569 lumisummaryQuery->addToOutputList(
"STARTORBIT");
570 lumisummaryQuery->addToOutputList(
"NUMORBIT");
571 lumisummaryQuery->addToOutputList(
"CMSBXINDEXBLOB");
572 lumisummaryQuery->addToOutputList(
"BEAMINTENSITYBLOB_1");
573 lumisummaryQuery->addToOutputList(
"BEAMINTENSITYBLOB_2");
574 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_OCC1");
575 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_OCC2");
576 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_ET");
577 lumisummaryQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:lumidataid",
578 lumisummaryBindVariables);
579 lumisummaryQuery->defineOutput(lumisummaryOutput);
580 coral::ICursor& lumisummarycursor = lumisummaryQuery->execute();
581 unsigned int rowcounter = 0;
582 while (lumisummarycursor.next()) {
583 const coral::AttributeList& row = lumisummarycursor.currentRow();
584 unsigned int cmslsnum = row[
"CMSLSNUM"].data<
unsigned int>();
587 lsdata.lumivalue = row[
"INSTLUMI"].data<
float>();
588 lsdata.lumierror = 0.0;
589 lsdata.lumiquality = 0;
590 lsdata.startorbit = row[
"STARTORBIT"].data<
unsigned int>();
591 lsdata.numorbit = row[
"NUMORBIT"].data<
unsigned int>();
593 if (!row[
"CMSBXINDEXBLOB"].isNull() && !row[
"BXLUMIVALUE_OCC1"].isNull()) {
594 const coral::Blob& bxindexBlob = row[
"CMSBXINDEXBLOB"].data<coral::Blob>();
595 const void* bxindex_StartAddress = bxindexBlob.startingAddress();
596 short* bxindex = (
short*)::malloc(bxindexBlob.size());
597 const coral::Blob& beam1intensityBlob = row[
"BEAMINTENSITYBLOB_1"].data<coral::Blob>();
598 const void* beam1intensityBlob_StartAddress = beam1intensityBlob.startingAddress();
599 float* beam1intensity = (
float*)::malloc(beam1intensityBlob.size());
600 const coral::Blob& beam2intensityBlob = row[
"BEAMINTENSITYBLOB_2"].data<coral::Blob>();
601 const void* beam2intensityBlob_StartAddress = beam2intensityBlob.startingAddress();
602 float* beam2intensity = (
float*)::malloc(beam2intensityBlob.size());
603 std::memmove(bxindex, bxindex_StartAddress, bxindexBlob.size());
604 std::memmove(beam1intensity, beam1intensityBlob_StartAddress, beam1intensityBlob.size());
605 std::memmove(beam2intensity, beam2intensityBlob_StartAddress, beam2intensityBlob.size());
607 unsigned int iMax = bxindexBlob.size() /
sizeof(short);
608 unsigned int lsb1Max = lsdata.beam1intensity.size();
609 unsigned int lsb2Max = lsdata.beam2intensity.size();
610 unsigned int ib1Max = beam1intensityBlob.size() /
sizeof(
float);
611 unsigned int ib2Max = beam2intensityBlob.size() /
sizeof(
float);
612 for (
unsigned int i = 0;
i < iMax; ++
i) {
613 unsigned int idx = bxindex[
i];
614 if (ib1Max >
i && lsb1Max >
idx) {
615 lsdata.beam1intensity.at(
idx) = beam1intensity[
i];
617 if (ib2Max >
i && lsb2Max >
idx) {
618 lsdata.beam2intensity.at(
idx) = beam2intensity[
i];
622 ::free(beam1intensity);
623 ::free(beam2intensity);
625 const coral::Blob& bxlumivalBlob_occ1 = row[
"BXLUMIVALUE_OCC1"].data<coral::Blob>();
626 const void* bxlumival_occ1_StartAddress = bxlumivalBlob_occ1.startingAddress();
627 float* bxlumival_occ1 = (
float*)::malloc(bxlumivalBlob_occ1.size());
628 std::memmove(bxlumival_occ1, bxlumival_occ1_StartAddress, bxlumivalBlob_occ1.size());
629 std::vector<float> bxlumivalVec_occ1(bxlumival_occ1,
630 bxlumival_occ1 + bxlumivalBlob_occ1.size() /
sizeof(
float));
631 ::free(bxlumival_occ1);
632 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"OCC1"), bxlumivalVec_occ1));
633 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"OCC1"), std::vector<float>(3564)));
634 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"OCC1"), std::vector<short>(3564)));
635 const coral::Blob& bxlumivalBlob_occ2 = row[
"BXLUMIVALUE_OCC2"].data<coral::Blob>();
636 const void* bxlumival_occ2_StartAddress = bxlumivalBlob_occ2.startingAddress();
637 float* bxlumival_occ2 = (
float*)::malloc(bxlumivalBlob_occ2.size());
638 std::memmove(bxlumival_occ2, bxlumival_occ2_StartAddress, bxlumivalBlob_occ2.size());
639 std::vector<float> bxlumivalVec_occ2(bxlumival_occ2,
640 bxlumival_occ2 + bxlumivalBlob_occ1.size() /
sizeof(
float));
641 ::free(bxlumival_occ2);
642 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"OCC2"), bxlumivalVec_occ2));
643 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"OCC2"), std::vector<float>(3564)));
644 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"OCC2"), std::vector<short>(3564)));
646 const coral::Blob& bxlumivalBlob_et = row[
"BXLUMIVALUE_ET"].data<coral::Blob>();
647 const void* bxlumival_et_StartAddress = bxlumivalBlob_et.startingAddress();
648 float* bxlumival_et = (
float*)::malloc(bxlumivalBlob_et.size());
649 std::memmove(bxlumival_et, bxlumival_et_StartAddress, bxlumivalBlob_et.size());
650 std::vector<float> bxlumivalVec_et(bxlumival_et, bxlumival_et + bxlumivalBlob_et.size() /
sizeof(
float));
651 ::free(bxlumival_et);
652 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"ET"), bxlumivalVec_et));
653 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"ET"), std::vector<float>(3564)));
654 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"ET"), std::vector<short>(3564)));
658 if (rowcounter == 0) {
662 delete lumisummaryQuery;
667 coral::AttributeList trgBindVariables;
668 trgBindVariables.extend(
"lsmin",
typeid(
unsigned int));
669 trgBindVariables.extend(
"lsmax",
typeid(
unsigned int));
670 trgBindVariables.extend(
"trgdataid",
typeid(
unsigned long long));
671 trgBindVariables[
"lsmin"].data<
unsigned int>() = luminum;
672 trgBindVariables[
"lsmax"].data<
unsigned int>() = luminum +
m_cachesize;
674 coral::AttributeList trgOutput;
675 trgOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
676 trgOutput.extend(
"DEADTIMECOUNT",
typeid(
unsigned long long));
677 trgOutput.extend(
"BITZEROCOUNT",
typeid(
unsigned int));
678 trgOutput.extend(
"BITZEROPRESCALE",
typeid(
unsigned int));
679 trgOutput.extend(
"PRESCALEBLOB",
typeid(coral::Blob));
680 trgOutput.extend(
"TRGCOUNTBLOB",
typeid(coral::Blob));
682 coral::IQuery* trgQuery = schema.newQuery();
684 trgQuery->addToOutputList(
"CMSLSNUM");
685 trgQuery->addToOutputList(
"DEADTIMECOUNT");
686 trgQuery->addToOutputList(
"BITZEROCOUNT");
687 trgQuery->addToOutputList(
"BITZEROPRESCALE");
688 trgQuery->addToOutputList(
"PRESCALEBLOB");
689 trgQuery->addToOutputList(
"TRGCOUNTBLOB");
690 trgQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:trgdataid", trgBindVariables);
691 trgQuery->defineOutput(trgOutput);
692 coral::ICursor& trgcursor = trgQuery->execute();
693 while (trgcursor.next()) {
694 const coral::AttributeList& row = trgcursor.currentRow();
695 unsigned int cmslsnum = row[
"CMSLSNUM"].data<
unsigned int>();
697 lsdata.deadcount = row[
"DEADTIMECOUNT"].data<
unsigned long long>();
698 lsdata.bitzerocount = row[
"BITZEROCOUNT"].data<
unsigned int>();
699 lsdata.bitzeroprescale = row[
"BITZEROPRESCALE"].data<
unsigned int>();
700 if (!row[
"PRESCALEBLOB"].isNull()) {
701 const coral::Blob& prescaleblob = row[
"PRESCALEBLOB"].data<coral::Blob>();
702 const void* prescaleblob_StartAddress = prescaleblob.startingAddress();
703 unsigned int*
prescales = (
unsigned int*)::malloc(prescaleblob.size());
704 std::memmove(
prescales, prescaleblob_StartAddress, prescaleblob.size());
705 const coral::Blob& trgcountblob = row[
"TRGCOUNTBLOB"].data<coral::Blob>();
706 const void* trgcountblob_StartAddress = trgcountblob.startingAddress();
707 unsigned int* trgcounts = (
unsigned int*)::malloc(trgcountblob.size());
708 std::memmove(trgcounts, trgcountblob_StartAddress, trgcountblob.size());
709 for (
unsigned int i = 0;
i < trgcountblob.size() /
sizeof(
unsigned int); ++
i) {
714 lsdata.l1data.push_back(l1tmp);
724 coral::AttributeList hltBindVariables;
725 hltBindVariables.extend(
"lsmin",
typeid(
unsigned int));
726 hltBindVariables.extend(
"lsmax",
typeid(
unsigned int));
727 hltBindVariables.extend(
"hltdataid",
typeid(
unsigned long long));
728 hltBindVariables[
"lsmin"].data<
unsigned int>() = luminum;
729 hltBindVariables[
"lsmax"].data<
unsigned int>() = luminum +
m_cachesize;
731 coral::AttributeList hltOutput;
732 hltOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
733 hltOutput.extend(
"HLTCOUNTBLOB",
typeid(coral::Blob));
734 hltOutput.extend(
"HLTACCEPTBLOB",
typeid(coral::Blob));
735 hltOutput.extend(
"PRESCALEBLOB",
typeid(coral::Blob));
736 coral::IQuery* hltQuery = schema.newQuery();
738 hltQuery->addToOutputList(
"CMSLSNUM");
739 hltQuery->addToOutputList(
"HLTCOUNTBLOB");
740 hltQuery->addToOutputList(
"HLTACCEPTBLOB");
741 hltQuery->addToOutputList(
"PRESCALEBLOB");
742 hltQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:hltdataid", hltBindVariables);
743 hltQuery->defineOutput(hltOutput);
744 coral::ICursor& hltcursor = hltQuery->execute();
745 while (hltcursor.next()) {
746 const coral::AttributeList& row = hltcursor.currentRow();
747 unsigned int cmslsnum = row[
"CMSLSNUM"].data<
unsigned int>();
749 if (!row[
"PRESCALEBLOB"].isNull()) {
750 const coral::Blob& hltprescaleblob = row[
"PRESCALEBLOB"].data<coral::Blob>();
751 const void* hltprescaleblob_StartAddress = hltprescaleblob.startingAddress();
752 unsigned int* hltprescales = (
unsigned int*)::malloc(hltprescaleblob.size());
753 std::memmove(hltprescales, hltprescaleblob_StartAddress, hltprescaleblob.size());
754 const coral::Blob& hltcountblob = row[
"HLTCOUNTBLOB"].data<coral::Blob>();
755 const void* hltcountblob_StartAddress = hltcountblob.startingAddress();
756 unsigned int* hltcounts = (
unsigned int*)::malloc(hltcountblob.size());
757 std::memmove(hltcounts, hltcountblob_StartAddress, hltcountblob.size());
758 const coral::Blob& hltacceptblob = row[
"HLTACCEPTBLOB"].data<coral::Blob>();
759 const void* hltacceptblob_StartAddress = hltacceptblob.startingAddress();
760 unsigned int* hltaccepts = (
unsigned int*)::malloc(hltacceptblob.size());
761 std::memmove(hltaccepts, hltacceptblob_StartAddress, hltacceptblob.size());
762 unsigned int nhltaccepts = hltacceptblob.size() /
sizeof(
unsigned int);
765 <<
"Got " << nhltaccepts <<
" hltaccepts, but the run chache is empty. hltdata will not be written";
769 for (
unsigned int i = 0;
i < hltacceptblob.size() /
sizeof(
unsigned int); ++
i) {
775 lsdata.hltdata.push_back(hlttmp);
777 ::free(hltprescales);
783 session->transaction().commit();
785 session->transaction().rollback();
791 auto pIn1 = std::make_unique<LumiSummary>();
792 auto pIn2 = std::make_unique<LumiDetails>();
794 pIn1->setLumiVersion(
"-1");
795 pIn2->setLumiVersion(
"-1");
803 if (!lsdata.
l1data.empty()) {
809 pIn1->setlsnumber(luminum);
811 std::vector<LumiSummary::L1> l1temp;
812 for (std::vector<L1Data>::iterator it = lsdata.
l1data.begin(); it != lsdata.
l1data.end(); ++it) {
816 l1temp.push_back(trgtmp);
818 std::vector<LumiSummary::HLT> hlttemp;
819 for (std::vector<HLTData>::iterator it = lsdata.
hltdata.begin(); it != lsdata.
hltdata.end(); ++it) {
824 hlttemp.push_back(hlttmp);
826 pIn1->swapL1Data(l1temp);
827 pIn1->swapHLTData(hlttemp);
832 if (algoname ==
"OCC1") {
837 }
else if (algoname ==
"OCC2") {
842 }
else if (algoname ==
"ET") {
847 }
else if (algoname ==
"PLT") {