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" 66 #include <boost/tokenizer.hpp> 67 #include <xercesc/dom/DOM.hpp> 68 #include <xercesc/parsers/XercesDOMParser.hpp> 70 #include <xercesc/util/XMLString.hpp> 80 :
public edm::one::EDProducer<edm::one::WatchRuns, edm::BeginLuminosityBlockProducer, edm::EndRunProducer> {
167 XMLCh* buff = xercesc::XMLString::transcode(
temp.c_str());
172 std::ostringstream oss;
173 xercesc::DOMNodeList* childList = nodeToConvert.getChildNodes();
175 unsigned int numNodes = childList->getLength();
176 for (
unsigned int i = 0;
i < numNodes; ++
i) {
177 xercesc::DOMNode* childNode = childList->item(
i);
178 if (childNode->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
180 xercesc::DOMElement*
child =
static_cast<xercesc::DOMElement*
>(childNode);
181 xercesc::DOMNamedNodeMap* attributes =
child->getAttributes();
182 unsigned int numAttributes = attributes->getLength();
183 for (
unsigned int j = 0;
j < numAttributes; ++
j) {
184 xercesc::DOMNode* attributeNode = attributes->item(
j);
185 if (attributeNode->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
187 xercesc::DOMAttr* attribute =
static_cast<xercesc::DOMAttr*
>(attributeNode);
189 oss <<
"(" <<
x2s(
child->getTagName()) <<
x2s(attribute->getName()) <<
"=" <<
x2s(attribute->getValue()) <<
")";
199 std::unique_ptr<xercesc::XercesDOMParser>
parser(
new xercesc::XercesDOMParser);
201 parser->setValidationScheme(xercesc::XercesDOMParser::Val_Auto);
202 parser->setDoNamespaces(
false);
204 xercesc::DOMDocument*
doc =
parser->getDocument();
209 xercesc::DOMNodeList* frontierConnectList =
doc->getElementsByTagName(
s2x(
"frontier-connect"));
210 if (frontierConnectList->getLength() > 0) {
211 xercesc::DOMElement* frontierConnectElement =
static_cast<xercesc::DOMElement*
>(frontierConnectList->item(0));
219 while ((serverurl = frontierConnect.find(
"(serverurl=", nextparen)) != std::string::npos) {
220 realconnect.append(frontierConnect, nextparen, serverurl - nextparen);
221 nextparen = frontierConnect.find(
')', serverurl);
222 lastslash = frontierConnect.rfind(
'/', nextparen);
223 realconnect.append(frontierConnect, serverurl, lastslash - serverurl + 1);
224 realconnect.append(servlet);
226 realconnect.append(frontierConnect, nextparen, frontierConnect.length() - nextparen);
227 }
catch (xercesc::DOMException&
e) {
233 : m_cachedrun(0), m_isNullRun(
false), m_cachesize(0) {
235 produces<LumiSummaryRunHeader, edm::Transition::EndRun>();
236 produces<LumiSummary, edm::Transition::BeginLuminosityBlock>();
237 produces<LumiDetails, edm::Transition::BeginLuminosityBlock>();
244 if (connectStr.substr(0, fproto.length()) == fproto) {
247 if (endservlet == std::string::npos) {
248 endservlet = connectStr.rfind(
'/', connectStr.length());
250 std::string servlet = connectStr.substr(startservlet, endservlet - startservlet);
251 if ((!servlet.empty()) && (servlet.find_first_of(
":/)[]") == std::string::npos)) {
252 if (servlet ==
"cms_conditions_data")
256 if (siteconfpath.length() == 0) {
260 char*
tmp = std::getenv(
"CMS_PATH");
293 unsigned long long lumidataid = 0;
294 coral::AttributeList bindVariables;
295 bindVariables.extend(
"runnum",
typeid(
unsigned int));
296 bindVariables[
"runnum"].data<
unsigned int>() =
runnumber;
297 coral::AttributeList lumiidOutput;
298 lumiidOutput.extend(
"lumidataid",
typeid(
unsigned long long));
299 coral::IQuery* lumiQuery = schema.newQuery();
301 lumiQuery->addToOutputList(
"MAX(DATA_ID)",
"lumidataid");
302 lumiQuery->setCondition(
"RUNNUM=:runnum", bindVariables);
303 lumiQuery->defineOutput(lumiidOutput);
304 coral::ICursor& lumicursor = lumiQuery->execute();
305 while (lumicursor.next()) {
306 const coral::AttributeList& row = lumicursor.currentRow();
307 if (!row[
"lumidataid"].isNull()) {
308 lumidataid = row[
"lumidataid"].data<
unsigned long long>();
318 unsigned long long trgdataid = 0;
319 coral::AttributeList bindVariables;
320 bindVariables.extend(
"runnum",
typeid(
unsigned int));
321 bindVariables[
"runnum"].data<
unsigned int>() =
runnumber;
322 coral::AttributeList trgidOutput;
323 trgidOutput.extend(
"trgdataid",
typeid(
unsigned long long));
324 coral::IQuery* trgQuery = schema.newQuery();
326 trgQuery->addToOutputList(
"MAX(DATA_ID)",
"trgdataid");
327 trgQuery->setCondition(
"RUNNUM=:runnum", bindVariables);
328 trgQuery->defineOutput(trgidOutput);
329 coral::ICursor& trgcursor = trgQuery->execute();
330 while (trgcursor.next()) {
331 const coral::AttributeList& row = trgcursor.currentRow();
332 if (!row[
"trgdataid"].isNull()) {
333 trgdataid = row[
"trgdataid"].data<
unsigned long long>();
343 unsigned long long hltdataid = 0;
344 coral::AttributeList bindVariables;
345 bindVariables.extend(
"runnum",
typeid(
unsigned int));
346 bindVariables[
"runnum"].data<
unsigned int>() =
runnumber;
347 coral::AttributeList hltidOutput;
348 hltidOutput.extend(
"hltdataid",
typeid(
unsigned long long));
349 coral::IQuery* hltQuery = schema.newQuery();
351 hltQuery->addToOutputList(
"MAX(DATA_ID)",
"hltdataid");
352 hltQuery->setCondition(
"RUNNUM=:runnum", bindVariables);
353 hltQuery->defineOutput(hltidOutput);
354 coral::ICursor& hltcursor = hltQuery->execute();
355 while (hltcursor.next()) {
356 const coral::AttributeList& row = hltcursor.currentRow();
357 if (!row[
"hltdataid"].isNull()) {
358 hltdataid = row[
"hltdataid"].data<
unsigned long long>();
368 std::map<unsigned long long, std::string> alltags;
369 coral::IQuery* tagQuery = schema.newQuery();
371 tagQuery->addToOutputList(
"TAGID");
372 tagQuery->addToOutputList(
"TAGNAME");
373 coral::AttributeList tagoutput;
374 tagoutput.extend(
"TAGID",
typeid(
unsigned long long));
376 tagQuery->defineOutput(tagoutput);
377 coral::ICursor& tagcursor = tagQuery->execute();
378 while (tagcursor.next()) {
379 const coral::AttributeList& row = tagcursor.currentRow();
380 unsigned long long tagid = row[
"TAGID"].data<
unsigned long long>();
382 alltags.insert(std::make_pair(tagid,
tagname));
385 unsigned long long maxid = 0;
386 for (std::map<unsigned long long, std::string>::iterator it = alltags.begin(); it != alltags.end(); ++it) {
387 if (it->first > maxid) {
402 throw cms::Exception(
"Non existing service lumi::service::DBService");
406 session->transaction().start(
true);
415 session->transaction().commit();
417 session->transaction().rollback();
430 iLBlock.
put(std::make_unique<LumiSummary>());
431 iLBlock.
put(std::make_unique<LumiDetails>());
443 auto lsrh = std::make_unique<LumiSummaryRunHeader>();
456 coral::AttributeList trgBindVariables;
457 trgBindVariables.extend(
"trgdataid",
typeid(
unsigned long long));
460 coral::AttributeList trgOutput;
461 trgOutput.extend(
"bitzeroname",
typeid(
std::string));
462 trgOutput.extend(
"bitnameclob",
typeid(
std::string));
463 coral::IQuery* trgQuery = schema.newQuery();
465 trgQuery->addToOutputList(
"BITZERONAME");
466 trgQuery->addToOutputList(
"BITNAMECLOB");
467 trgQuery->setCondition(
"DATA_ID=:trgdataid", trgBindVariables);
468 trgQuery->defineOutput(trgOutput);
469 coral::ICursor& trgcursor = trgQuery->execute();
470 while (trgcursor.next()) {
471 const coral::AttributeList& row = trgcursor.currentRow();
475 boost::char_separator<char> sep(
",");
476 boost::tokenizer<boost::char_separator<char> > tokens(bitnames, sep);
477 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_it = tokens.begin(); tok_it != tokens.end();
491 coral::AttributeList hltBindVariables;
492 hltBindVariables.extend(
"hltdataid",
typeid(
unsigned long long));
494 coral::AttributeList hltOutput;
495 hltOutput.extend(
"PATHNAMECLOB",
typeid(
std::string));
496 coral::IQuery* hltQuery = schema.newQuery();
498 hltQuery->addToOutputList(
"PATHNAMECLOB");
499 hltQuery->setCondition(
"DATA_ID=:hltdataid", hltBindVariables);
500 hltQuery->defineOutput(hltOutput);
501 coral::ICursor& hltcursor = hltQuery->execute();
502 while (hltcursor.next()) {
503 const coral::AttributeList& row = hltcursor.currentRow();
505 boost::char_separator<char> sep(
",");
506 boost::tokenizer<boost::char_separator<char> > tokens(pathnames, sep);
507 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_it = tokens.begin(); tok_it != tokens.end();
525 l.hltdata.reserve(250);
526 l.l1data.reserve(192);
527 l.bunchlumivalue.reserve(5);
528 l.bunchlumierror.reserve(5);
529 l.bunchlumiquality.reserve(5);
530 l.beam1intensity.resize(3564, 0.0);
531 l.beam2intensity.resize(3564, 0.0);
540 throw cms::Exception(
"Non existing service lumi::service::DBService");
544 session->transaction().start(
true);
545 coral::ISchema& schema = session->nominalSchema();
546 coral::AttributeList lumisummaryBindVariables;
547 lumisummaryBindVariables.extend(
"lsmin",
typeid(
unsigned int));
548 lumisummaryBindVariables.extend(
"lsmax",
typeid(
unsigned int));
549 lumisummaryBindVariables.extend(
"lumidataid",
typeid(
unsigned long long));
550 lumisummaryBindVariables[
"lumidataid"].data<
unsigned long long>() =
m_cachedlumidataid;
551 lumisummaryBindVariables[
"lsmin"].data<
unsigned int>() = luminum;
552 lumisummaryBindVariables[
"lsmax"].data<
unsigned int>() = luminum +
m_cachesize;
553 coral::AttributeList lumisummaryOutput;
554 lumisummaryOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
555 lumisummaryOutput.extend(
"INSTLUMI",
typeid(
float));
556 lumisummaryOutput.extend(
"STARTORBIT",
typeid(
unsigned int));
557 lumisummaryOutput.extend(
"NUMORBIT",
typeid(
unsigned int));
558 lumisummaryOutput.extend(
"CMSBXINDEXBLOB",
typeid(coral::Blob));
559 lumisummaryOutput.extend(
"BEAMINTENSITYBLOB_1",
typeid(coral::Blob));
560 lumisummaryOutput.extend(
"BEAMINTENSITYBLOB_2",
typeid(coral::Blob));
561 lumisummaryOutput.extend(
"BXLUMIVALUE_OCC1",
typeid(coral::Blob));
562 lumisummaryOutput.extend(
"BXLUMIVALUE_OCC2",
typeid(coral::Blob));
563 lumisummaryOutput.extend(
"BXLUMIVALUE_ET",
typeid(coral::Blob));
564 coral::IQuery* lumisummaryQuery = schema.newQuery();
566 lumisummaryQuery->addToOutputList(
"CMSLSNUM");
567 lumisummaryQuery->addToOutputList(
"INSTLUMI");
568 lumisummaryQuery->addToOutputList(
"STARTORBIT");
569 lumisummaryQuery->addToOutputList(
"NUMORBIT");
570 lumisummaryQuery->addToOutputList(
"CMSBXINDEXBLOB");
571 lumisummaryQuery->addToOutputList(
"BEAMINTENSITYBLOB_1");
572 lumisummaryQuery->addToOutputList(
"BEAMINTENSITYBLOB_2");
573 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_OCC1");
574 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_OCC2");
575 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_ET");
576 lumisummaryQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:lumidataid",
577 lumisummaryBindVariables);
578 lumisummaryQuery->defineOutput(lumisummaryOutput);
579 coral::ICursor& lumisummarycursor = lumisummaryQuery->execute();
580 unsigned int rowcounter = 0;
581 while (lumisummarycursor.next()) {
582 const coral::AttributeList& row = lumisummarycursor.currentRow();
583 unsigned int cmslsnum = row[
"CMSLSNUM"].data<
unsigned int>();
586 lsdata.lumivalue = row[
"INSTLUMI"].data<
float>();
587 lsdata.lumierror = 0.0;
588 lsdata.lumiquality = 0;
589 lsdata.startorbit = row[
"STARTORBIT"].data<
unsigned int>();
590 lsdata.numorbit = row[
"NUMORBIT"].data<
unsigned int>();
592 if (!row[
"CMSBXINDEXBLOB"].isNull() && !row[
"BXLUMIVALUE_OCC1"].isNull()) {
593 const coral::Blob& bxindexBlob = row[
"CMSBXINDEXBLOB"].data<coral::Blob>();
594 const void* bxindex_StartAddress = bxindexBlob.startingAddress();
595 short* bxindex = (
short*)::
malloc(bxindexBlob.size());
596 const coral::Blob& beam1intensityBlob = row[
"BEAMINTENSITYBLOB_1"].data<coral::Blob>();
597 const void* beam1intensityBlob_StartAddress = beam1intensityBlob.startingAddress();
598 float* beam1intensity = (
float*)::
malloc(beam1intensityBlob.size());
599 const coral::Blob& beam2intensityBlob = row[
"BEAMINTENSITYBLOB_2"].data<coral::Blob>();
600 const void* beam2intensityBlob_StartAddress = beam2intensityBlob.startingAddress();
601 float* beam2intensity = (
float*)::
malloc(beam2intensityBlob.size());
602 std::memmove(bxindex, bxindex_StartAddress, bxindexBlob.size());
603 std::memmove(beam1intensity, beam1intensityBlob_StartAddress, beam1intensityBlob.size());
604 std::memmove(beam2intensity, beam2intensityBlob_StartAddress, beam2intensityBlob.size());
606 unsigned int iMax = bxindexBlob.size() /
sizeof(short);
607 unsigned int lsb1Max = lsdata.beam1intensity.size();
608 unsigned int lsb2Max = lsdata.beam2intensity.size();
609 unsigned int ib1Max = beam1intensityBlob.size() /
sizeof(
float);
610 unsigned int ib2Max = beam2intensityBlob.size() /
sizeof(
float);
611 for (
unsigned int i = 0;
i < iMax; ++
i) {
612 unsigned int idx = bxindex[
i];
613 if (ib1Max >
i && lsb1Max >
idx) {
614 lsdata.beam1intensity.at(
idx) = beam1intensity[
i];
616 if (ib2Max >
i && lsb2Max >
idx) {
617 lsdata.beam2intensity.at(
idx) = beam2intensity[
i];
624 const coral::Blob& bxlumivalBlob_occ1 = row[
"BXLUMIVALUE_OCC1"].data<coral::Blob>();
625 const void* bxlumival_occ1_StartAddress = bxlumivalBlob_occ1.startingAddress();
626 float* bxlumival_occ1 = (
float*)::
malloc(bxlumivalBlob_occ1.size());
627 std::memmove(bxlumival_occ1, bxlumival_occ1_StartAddress, bxlumivalBlob_occ1.size());
628 std::vector<float> bxlumivalVec_occ1(bxlumival_occ1,
629 bxlumival_occ1 + bxlumivalBlob_occ1.size() /
sizeof(
float));
631 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"OCC1"), bxlumivalVec_occ1));
632 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"OCC1"), std::vector<float>(3564)));
633 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"OCC1"), std::vector<short>(3564)));
634 const coral::Blob& bxlumivalBlob_occ2 = row[
"BXLUMIVALUE_OCC2"].data<coral::Blob>();
635 const void* bxlumival_occ2_StartAddress = bxlumivalBlob_occ2.startingAddress();
636 float* bxlumival_occ2 = (
float*)::
malloc(bxlumivalBlob_occ2.size());
637 std::memmove(bxlumival_occ2, bxlumival_occ2_StartAddress, bxlumivalBlob_occ2.size());
638 std::vector<float> bxlumivalVec_occ2(bxlumival_occ2,
639 bxlumival_occ2 + bxlumivalBlob_occ1.size() /
sizeof(
float));
641 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"OCC2"), bxlumivalVec_occ2));
642 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"OCC2"), std::vector<float>(3564)));
643 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"OCC2"), std::vector<short>(3564)));
645 const coral::Blob& bxlumivalBlob_et = row[
"BXLUMIVALUE_ET"].data<coral::Blob>();
646 const void* bxlumival_et_StartAddress = bxlumivalBlob_et.startingAddress();
647 float* bxlumival_et = (
float*)::
malloc(bxlumivalBlob_et.size());
648 std::memmove(bxlumival_et, bxlumival_et_StartAddress, bxlumivalBlob_et.size());
649 std::vector<float> bxlumivalVec_et(bxlumival_et, bxlumival_et + bxlumivalBlob_et.size() /
sizeof(
float));
651 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"ET"), bxlumivalVec_et));
652 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"ET"), std::vector<float>(3564)));
653 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"ET"), std::vector<short>(3564)));
657 if (rowcounter == 0) {
661 delete lumisummaryQuery;
666 coral::AttributeList trgBindVariables;
667 trgBindVariables.extend(
"lsmin",
typeid(
unsigned int));
668 trgBindVariables.extend(
"lsmax",
typeid(
unsigned int));
669 trgBindVariables.extend(
"trgdataid",
typeid(
unsigned long long));
670 trgBindVariables[
"lsmin"].data<
unsigned int>() = luminum;
671 trgBindVariables[
"lsmax"].data<
unsigned int>() = luminum +
m_cachesize;
673 coral::AttributeList trgOutput;
674 trgOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
675 trgOutput.extend(
"DEADTIMECOUNT",
typeid(
unsigned long long));
676 trgOutput.extend(
"BITZEROCOUNT",
typeid(
unsigned int));
677 trgOutput.extend(
"BITZEROPRESCALE",
typeid(
unsigned int));
678 trgOutput.extend(
"PRESCALEBLOB",
typeid(coral::Blob));
679 trgOutput.extend(
"TRGCOUNTBLOB",
typeid(coral::Blob));
681 coral::IQuery* trgQuery = schema.newQuery();
683 trgQuery->addToOutputList(
"CMSLSNUM");
684 trgQuery->addToOutputList(
"DEADTIMECOUNT");
685 trgQuery->addToOutputList(
"BITZEROCOUNT");
686 trgQuery->addToOutputList(
"BITZEROPRESCALE");
687 trgQuery->addToOutputList(
"PRESCALEBLOB");
688 trgQuery->addToOutputList(
"TRGCOUNTBLOB");
689 trgQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:trgdataid", trgBindVariables);
690 trgQuery->defineOutput(trgOutput);
691 coral::ICursor& trgcursor = trgQuery->execute();
692 while (trgcursor.next()) {
693 const coral::AttributeList& row = trgcursor.currentRow();
694 unsigned int cmslsnum = row[
"CMSLSNUM"].data<
unsigned int>();
696 lsdata.deadcount = row[
"DEADTIMECOUNT"].data<
unsigned long long>();
697 lsdata.bitzerocount = row[
"BITZEROCOUNT"].data<
unsigned int>();
698 lsdata.bitzeroprescale = row[
"BITZEROPRESCALE"].data<
unsigned int>();
699 if (!row[
"PRESCALEBLOB"].isNull()) {
700 const coral::Blob& prescaleblob = row[
"PRESCALEBLOB"].data<coral::Blob>();
701 const void* prescaleblob_StartAddress = prescaleblob.startingAddress();
702 unsigned int*
prescales = (
unsigned int*)::
malloc(prescaleblob.size());
703 std::memmove(
prescales, prescaleblob_StartAddress, prescaleblob.size());
704 const coral::Blob& trgcountblob = row[
"TRGCOUNTBLOB"].data<coral::Blob>();
705 const void* trgcountblob_StartAddress = trgcountblob.startingAddress();
706 unsigned int* trgcounts = (
unsigned int*)::
malloc(trgcountblob.size());
707 std::memmove(trgcounts, trgcountblob_StartAddress, trgcountblob.size());
708 for (
unsigned int i = 0;
i < trgcountblob.size() /
sizeof(
unsigned int); ++
i) {
713 lsdata.l1data.push_back(l1tmp);
723 coral::AttributeList hltBindVariables;
724 hltBindVariables.extend(
"lsmin",
typeid(
unsigned int));
725 hltBindVariables.extend(
"lsmax",
typeid(
unsigned int));
726 hltBindVariables.extend(
"hltdataid",
typeid(
unsigned long long));
727 hltBindVariables[
"lsmin"].data<
unsigned int>() = luminum;
728 hltBindVariables[
"lsmax"].data<
unsigned int>() = luminum +
m_cachesize;
730 coral::AttributeList hltOutput;
731 hltOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
732 hltOutput.extend(
"HLTCOUNTBLOB",
typeid(coral::Blob));
733 hltOutput.extend(
"HLTACCEPTBLOB",
typeid(coral::Blob));
734 hltOutput.extend(
"PRESCALEBLOB",
typeid(coral::Blob));
735 coral::IQuery* hltQuery = schema.newQuery();
737 hltQuery->addToOutputList(
"CMSLSNUM");
738 hltQuery->addToOutputList(
"HLTCOUNTBLOB");
739 hltQuery->addToOutputList(
"HLTACCEPTBLOB");
740 hltQuery->addToOutputList(
"PRESCALEBLOB");
741 hltQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:hltdataid", hltBindVariables);
742 hltQuery->defineOutput(hltOutput);
743 coral::ICursor& hltcursor = hltQuery->execute();
744 while (hltcursor.next()) {
745 const coral::AttributeList& row = hltcursor.currentRow();
746 unsigned int cmslsnum = row[
"CMSLSNUM"].data<
unsigned int>();
748 if (!row[
"PRESCALEBLOB"].isNull()) {
749 const coral::Blob& hltprescaleblob = row[
"PRESCALEBLOB"].data<coral::Blob>();
750 const void* hltprescaleblob_StartAddress = hltprescaleblob.startingAddress();
751 unsigned int* hltprescales = (
unsigned int*)::
malloc(hltprescaleblob.size());
752 std::memmove(hltprescales, hltprescaleblob_StartAddress, hltprescaleblob.size());
753 const coral::Blob& hltcountblob = row[
"HLTCOUNTBLOB"].data<coral::Blob>();
754 const void* hltcountblob_StartAddress = hltcountblob.startingAddress();
755 unsigned int* hltcounts = (
unsigned int*)::
malloc(hltcountblob.size());
756 std::memmove(hltcounts, hltcountblob_StartAddress, hltcountblob.size());
757 const coral::Blob& hltacceptblob = row[
"HLTACCEPTBLOB"].data<coral::Blob>();
758 const void* hltacceptblob_StartAddress = hltacceptblob.startingAddress();
759 unsigned int* hltaccepts = (
unsigned int*)::
malloc(hltacceptblob.size());
760 std::memmove(hltaccepts, hltacceptblob_StartAddress, hltacceptblob.size());
761 unsigned int nhltaccepts = hltacceptblob.size() /
sizeof(
unsigned int);
764 <<
"Got " << nhltaccepts <<
" hltaccepts, but the run chache is empty. hltdata will not be written";
768 for (
unsigned int i = 0;
i < hltacceptblob.size() /
sizeof(
unsigned int); ++
i) {
774 lsdata.hltdata.push_back(hlttmp);
782 session->transaction().commit();
784 session->transaction().rollback();
790 auto pIn1 = std::make_unique<LumiSummary>();
791 auto pIn2 = std::make_unique<LumiDetails>();
793 pIn1->setLumiVersion(
"-1");
794 pIn2->setLumiVersion(
"-1");
802 if (!lsdata.
l1data.empty()) {
808 pIn1->setlsnumber(luminum);
810 std::vector<LumiSummary::L1> l1temp;
811 for (std::vector<L1Data>::iterator it = lsdata.
l1data.begin(); it != lsdata.
l1data.end(); ++it) {
815 l1temp.push_back(trgtmp);
817 std::vector<LumiSummary::HLT> hlttemp;
818 for (std::vector<HLTData>::iterator it = lsdata.
hltdata.begin(); it != lsdata.
hltdata.end(); ++it) {
823 hlttemp.push_back(hlttmp);
825 pIn1->swapL1Data(l1temp);
826 pIn1->swapHLTData(hlttemp);
831 if (algoname ==
"OCC1") {
836 }
else if (algoname ==
"OCC2") {
841 }
else if (algoname ==
"ET") {
846 }
else if (algoname ==
"PLT") {
void writeProductsForEntry(edm::LuminosityBlock &iLBlock, unsigned int runnumber, unsigned int luminum)
T getParameter(std::string const &) const
static const std::string trgdataTableName()
unsigned int bitzeroprescale
std::vector< std::pair< std::string, std::vector< float > > > bunchlumivalue
std::string x2s(const XMLCh *input) const
std::vector< float > beam1intensity
void produce(edm::Event &, const edm::EventSetup &) final
static const std::string lshltTableName()
unsigned long long m_cachedhltdataid
LumiProducer(const edm::ParameterSet &)
unsigned long long getLumiDataId(const coral::ISchema &schema, unsigned int runnumber)
ISessionProxyPtr connectReadOnly(const std::string &connectstring)
void beginLuminosityBlockProduce(edm::LuminosityBlock &iLBlock, edm::EventSetup const &iSetup) final
static const std::string lstrgTableName()
static std::string const input
T getUntrackedParameter(std::string const &, T const &) const
static const std::string hltdataTableName()
void free(void *ptr) noexcept
std::map< std::string, unsigned int > HLTPathNameToIndex
unsigned long long getHltDataId(const coral::ISchema &schema, unsigned int runnumber)
void beginRun(edm::Run const &, edm::EventSetup const &) final
void endRun(edm::Run const &, edm::EventSetup const &) final
void put(std::unique_ptr< PROD > product)
Put a new product.
void fillLSCache(unsigned int luminum)
static const std::string tagsTableName()
#define DEFINE_FWK_MODULE(type)
unsigned long long m_cachedtrgdataid
unsigned long long m_cachedlumidataid
unsigned int bitzerocount
static const std::string lumidataTableName()
void * malloc(size_t size) noexcept
unsigned long long getTrgDataId(const coral::ISchema &schema, unsigned int runnumber)
std::string m_siteconfpath
std::vector< HLTData > hltdata
std::vector< std::string > TRGBitNames
static const std::string lumisummaryv2TableName()
unsigned long long deadcount
std::vector< std::pair< std::string, std::vector< short > > > bunchlumiquality
std::vector< L1Data > l1data
std::string m_lumiversion
std::string getCurrentDataTag(const coral::ISchema &schema)
bool fillLumi(edm::LuminosityBlock &iLBlock)
std::string toParentString(const xercesc::DOMNode &nodeToConvert) const
void fillRunCache(const coral::ISchema &schema, unsigned int runnumber)
std::map< unsigned int, PerLSData > m_lscache
Log< level::Warning, false > LogWarning
std::vector< std::string > HLTPathNames
LuminosityBlockNumber_t luminosityBlock() const
const std::string servletTranslation(const std::string &servlet) const
std::map< std::string, unsigned int > TRGBitNameToIndex
void endRunProduce(edm::Run &, edm::EventSetup const &) final
std::vector< float > beam2intensity
std::vector< std::pair< std::string, std::vector< float > > > bunchlumierror
XMLCh * s2x(const std::string &input) const