36 #include "CoralBase/Exception.h"
37 #include "CoralBase/AttributeList.h"
38 #include "CoralBase/Attribute.h"
39 #include "CoralBase/AttributeSpecification.h"
40 #include "CoralBase/Exception.h"
41 #include "CoralBase/Blob.h"
42 #include "RelationalAccess/ISessionProxy.h"
43 #include "RelationalAccess/ITransaction.h"
44 #include "RelationalAccess/AccessMode.h"
45 #include "RelationalAccess/ITypeConverter.h"
46 #include "RelationalAccess/IQuery.h"
47 #include "RelationalAccess/ICursor.h"
48 #include "RelationalAccess/ISchema.h"
49 #include "RelationalAccess/ITable.h"
65 #include <boost/foreach.hpp>
66 #include <boost/tokenizer.hpp>
67 #include <xercesc/dom/DOM.hpp>
68 #include <xercesc/parsers/XercesDOMParser.hpp>
69 #include <xercesc/util/PlatformUtils.hpp>
70 #include <xercesc/util/XMLString.hpp>
72 #include "boost/filesystem/path.hpp"
73 #include "boost/filesystem/operations.hpp"
83 edm::BeginLuminosityBlockProducer,
84 edm::EndRunProducer> {
135 edm::
EventSetup const& iSetup) override final;
145 std::
string x2s(const XMLCh*
input)const;
146 XMLCh*
s2x(const std::
string&
input)const;
147 std::
string toParentString(const xercesc::DOMNode &nodeToConvert)const;
148 unsigned long long getLumiDataId(const coral::ISchema& schema,
unsigned int runnumber);
149 unsigned long long getTrgDataId(const coral::ISchema& schema,
unsigned int runnumber);
150 unsigned long long getHltDataId(const coral::ISchema& schema,
unsigned int runnumber);
177 XMLCh* buff = xercesc::XMLString::transcode(temp.c_str());
183 std::ostringstream oss;
184 xercesc::DOMNodeList *childList = nodeToConvert.getChildNodes();
186 unsigned int numNodes = childList->getLength ();
187 for (
unsigned int i = 0;
i < numNodes; ++
i){
188 xercesc::DOMNode *childNode = childList->item(
i);
189 if (childNode->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
191 xercesc::DOMElement *
child = static_cast < xercesc::DOMElement *> (childNode);
192 xercesc::DOMNamedNodeMap *
attributes = child->getAttributes();
193 unsigned int numAttributes = attributes->getLength ();
194 for (
unsigned int j = 0;
j < numAttributes; ++
j){
195 xercesc::DOMNode *attributeNode = attributes->item(
j);
196 if (attributeNode->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
198 xercesc::DOMAttr *attribute = static_cast <xercesc::DOMAttr *> (attributeNode);
200 oss <<
"(" <<
x2s(child->getTagName()) <<
201 x2s(attribute->getName()) <<
"=" <<
202 x2s(attribute->getValue()) <<
")";
212 xercesc::XMLPlatformUtils::Initialize();
213 std::auto_ptr< xercesc::XercesDOMParser >
parser(
new xercesc::XercesDOMParser);
215 parser->setValidationScheme(xercesc::XercesDOMParser::Val_Auto);
216 parser->setDoNamespaces(
false);
218 xercesc::DOMDocument*
doc=parser->getDocument();
223 xercesc::DOMNodeList *frontierConnectList=doc->getElementsByTagName(
s2x(
"frontier-connect"));
224 if (frontierConnectList->getLength()>0){
225 xercesc::DOMElement *frontierConnectElement=static_cast < xercesc::DOMElement *> (frontierConnectList->item (0));
233 while ((serverurl=frontierConnect.find(
"(serverurl=", nextparen)) != std::string::npos){
234 realconnect.append(frontierConnect, nextparen, serverurl - nextparen);
235 nextparen=frontierConnect.find(
')', serverurl);
236 lastslash=frontierConnect.rfind(
'/', nextparen);
237 realconnect.append(frontierConnect,serverurl,lastslash-serverurl+1);
238 realconnect.append(servlet);
240 realconnect.append(frontierConnect, nextparen,frontierConnect.length()-nextparen);
241 }
catch(xercesc::DOMException &
e){
250 produces<LumiSummaryRunHeader, edm::InRun>();
251 produces<LumiSummary, edm::InLumi>();
252 produces<LumiDetails, edm::InLumi>();
259 if(connectStr.substr(0,fproto.length())==fproto){
262 if(endservlet==std::string::npos){
263 endservlet=connectStr.rfind(
'/',connectStr.length());
265 std::string servlet=connectStr.substr(startservlet,endservlet-startservlet);
266 if( (servlet !=
"")&& (servlet.find_first_of(
":/)[]")==std::string::npos)){
267 if(servlet==
"cms_conditions_data") servlet=
"";
270 if(siteconfpath.length()==0){
272 char *
tmp = getenv (
"CMS_PATH");
308 unsigned long long lumidataid=0;
309 coral::AttributeList bindVariables;
310 bindVariables.extend(
"runnum",
typeid(
unsigned int));
311 bindVariables[
"runnum"].data<
unsigned int>()=runnumber;
312 coral::AttributeList lumiidOutput;
313 lumiidOutput.extend(
"lumidataid",
typeid(
unsigned long long));
314 coral::IQuery* lumiQuery=schema.newQuery();
316 lumiQuery->addToOutputList(
"MAX(DATA_ID)",
"lumidataid");
317 lumiQuery->setCondition(
"RUNNUM=:runnum",bindVariables);
318 lumiQuery->defineOutput(lumiidOutput);
319 coral::ICursor& lumicursor=lumiQuery->execute();
320 while( lumicursor.next() ){
321 const coral::AttributeList& row=lumicursor.currentRow();
322 if(!row[
"lumidataid"].isNull()){
323 lumidataid=row[
"lumidataid"].data<
unsigned long long>();
334 unsigned long long trgdataid=0;
335 coral::AttributeList bindVariables;
336 bindVariables.extend(
"runnum",
typeid(
unsigned int));
337 bindVariables[
"runnum"].data<
unsigned int>()=runnumber;
338 coral::AttributeList trgidOutput;
339 trgidOutput.extend(
"trgdataid",
typeid(
unsigned long long));
340 coral::IQuery* trgQuery=schema.newQuery();
342 trgQuery->addToOutputList(
"MAX(DATA_ID)",
"trgdataid");
343 trgQuery->setCondition(
"RUNNUM=:runnum",bindVariables);
344 trgQuery->defineOutput(trgidOutput);
345 coral::ICursor& trgcursor=trgQuery->execute();
346 while( trgcursor.next() ){
347 const coral::AttributeList& row=trgcursor.currentRow();
348 if(!row[
"trgdataid"].isNull()){
349 trgdataid=row[
"trgdataid"].data<
unsigned long long>();
360 unsigned long long hltdataid=0;
361 coral::AttributeList bindVariables;
362 bindVariables.extend(
"runnum",
typeid(
unsigned int));
363 bindVariables[
"runnum"].data<
unsigned int>()=runnumber;
364 coral::AttributeList hltidOutput;
365 hltidOutput.extend(
"hltdataid",
typeid(
unsigned long long));
366 coral::IQuery* hltQuery=schema.newQuery();
368 hltQuery->addToOutputList(
"MAX(DATA_ID)",
"hltdataid");
369 hltQuery->setCondition(
"RUNNUM=:runnum",bindVariables);
370 hltQuery->defineOutput(hltidOutput);
371 coral::ICursor& hltcursor=hltQuery->execute();
372 while( hltcursor.next() ){
373 const coral::AttributeList& row=hltcursor.currentRow();
374 if(!row[
"hltdataid"].isNull()){
375 hltdataid=row[
"hltdataid"].data<
unsigned long long>();
386 std::map<unsigned long long,std::string>
alltags;
387 coral::IQuery* tagQuery=schema.newQuery();
389 tagQuery->addToOutputList(
"TAGID");
390 tagQuery->addToOutputList(
"TAGNAME");
391 coral::AttributeList tagoutput;
392 tagoutput.extend(
"TAGID",
typeid(
unsigned long long));
394 tagQuery->defineOutput(tagoutput);
395 coral::ICursor& tagcursor=tagQuery->execute();
396 while( tagcursor.next() ){
397 const coral::AttributeList& row=tagcursor.currentRow();
398 unsigned long long tagid=row[
"TAGID"].data<
unsigned long long>();
400 alltags.insert(std::make_pair(tagid,tagname));
403 unsigned long long maxid=0;
404 for(std::map<unsigned long long,std::string>::iterator it = alltags.begin(); it !=alltags.end(); ++it) {
405 if( it->first > maxid){
409 result=alltags[maxid];
422 throw cms::Exception(
"Non existing service lumi::service::DBService");
426 session->transaction().start(
true);
435 session->transaction().commit();
437 session->transaction().rollback();
453 std::auto_ptr<LumiSummary> pOut1;
454 std::auto_ptr<LumiDetails> pOut2;
485 if(m_lumiversion.empty()){
488 std::cout<<
"lumi tag version 2 "<<m_lumiversion<<std::endl;
490 coral::AttributeList trgBindVariables;
491 trgBindVariables.extend(
"trgdataid",
typeid(
unsigned long long));
494 coral::AttributeList trgOutput;
495 trgOutput.extend(
"bitzeroname",
typeid(
std::string));
496 trgOutput.extend(
"bitnameclob",
typeid(
std::string));
497 coral::IQuery* trgQuery=schema.newQuery();
499 trgQuery->addToOutputList(
"BITZERONAME");
500 trgQuery->addToOutputList(
"BITNAMECLOB");
501 trgQuery->setCondition(
"DATA_ID=:trgdataid",trgBindVariables);
502 trgQuery->defineOutput(trgOutput);
503 coral::ICursor& trgcursor=trgQuery->execute();
504 while( trgcursor.next() ){
505 const coral::AttributeList& row=trgcursor.currentRow();
509 boost::char_separator<char> sep(
",");
510 boost::tokenizer<boost::char_separator<char> > tokens(bitnames,sep);
511 for(
boost::tokenizer<boost::char_separator<char> >::iterator tok_it=tokens.begin();tok_it!=tokens.end();++tok_it){
524 coral::AttributeList hltBindVariables;
525 hltBindVariables.extend(
"hltdataid",
typeid(
unsigned long long));
527 coral::AttributeList hltOutput;
528 hltOutput.extend(
"PATHNAMECLOB",
typeid(
std::string));
529 coral::IQuery* hltQuery=schema.newQuery();
531 hltQuery->addToOutputList(
"PATHNAMECLOB");
532 hltQuery->setCondition(
"DATA_ID=:hltdataid",hltBindVariables);
533 hltQuery->defineOutput(hltOutput);
534 coral::ICursor& hltcursor=hltQuery->execute();
535 while( hltcursor.next() ){
536 const coral::AttributeList& row=hltcursor.currentRow();
538 boost::char_separator<char> sep(
",");
539 boost::tokenizer<boost::char_separator<char> > tokens(pathnames,sep);
540 for(
boost::tokenizer<boost::char_separator<char> >::iterator tok_it=tokens.begin();tok_it!=tokens.end();++tok_it){
572 throw cms::Exception(
"Non existing service lumi::service::DBService");
576 session->transaction().start(
true);
577 coral::ISchema&
schema=session->nominalSchema();
578 coral::AttributeList lumisummaryBindVariables;
579 lumisummaryBindVariables.extend(
"lsmin",
typeid(
unsigned int));
580 lumisummaryBindVariables.extend(
"lsmax",
typeid(
unsigned int));
581 lumisummaryBindVariables.extend(
"lumidataid",
typeid(
unsigned long long));
583 lumisummaryBindVariables[
"lsmin"].data<
unsigned int>()=luminum;
584 lumisummaryBindVariables[
"lsmax"].data<
unsigned int>()=luminum+m_cachesize;
585 coral::AttributeList lumisummaryOutput;
586 lumisummaryOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
587 lumisummaryOutput.extend(
"INSTLUMI",
typeid(
float));
588 lumisummaryOutput.extend(
"STARTORBIT",
typeid(
unsigned int));
589 lumisummaryOutput.extend(
"NUMORBIT",
typeid(
unsigned int));
590 lumisummaryOutput.extend(
"CMSBXINDEXBLOB",
typeid(coral::Blob));
591 lumisummaryOutput.extend(
"BEAMINTENSITYBLOB_1",
typeid(coral::Blob));
592 lumisummaryOutput.extend(
"BEAMINTENSITYBLOB_2",
typeid(coral::Blob));
593 lumisummaryOutput.extend(
"BXLUMIVALUE_OCC1",
typeid(coral::Blob));
594 lumisummaryOutput.extend(
"BXLUMIVALUE_OCC2",
typeid(coral::Blob));
595 lumisummaryOutput.extend(
"BXLUMIVALUE_ET",
typeid(coral::Blob));
596 coral::IQuery* lumisummaryQuery=schema.newQuery();
598 lumisummaryQuery->addToOutputList(
"CMSLSNUM");
599 lumisummaryQuery->addToOutputList(
"INSTLUMI");
600 lumisummaryQuery->addToOutputList(
"STARTORBIT");
601 lumisummaryQuery->addToOutputList(
"NUMORBIT");
602 lumisummaryQuery->addToOutputList(
"CMSBXINDEXBLOB");
603 lumisummaryQuery->addToOutputList(
"BEAMINTENSITYBLOB_1");
604 lumisummaryQuery->addToOutputList(
"BEAMINTENSITYBLOB_2");
605 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_OCC1");
606 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_OCC2");
607 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_ET");
608 lumisummaryQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:lumidataid",lumisummaryBindVariables);
609 lumisummaryQuery->defineOutput(lumisummaryOutput);
610 coral::ICursor& lumisummarycursor=lumisummaryQuery->execute();
611 unsigned int rowcounter=0;
612 while( lumisummarycursor.next() ){
613 const coral::AttributeList& row=lumisummarycursor.currentRow();
614 unsigned int cmslsnum=row[
"CMSLSNUM"].data<
unsigned int>();
617 lsdata.lumivalue=row[
"INSTLUMI"].data<
float>();
618 lsdata.lumierror=0.0;
619 lsdata.lumiquality=0;
620 lsdata.startorbit=row[
"STARTORBIT"].data<
unsigned int>();
621 lsdata.numorbit=row[
"NUMORBIT"].data<
unsigned int>();
623 if(!row[
"CMSBXINDEXBLOB"].isNull() && !row[
"BXLUMIVALUE_OCC1"].isNull() ){
624 const coral::Blob& bxindexBlob=row[
"CMSBXINDEXBLOB"].data<coral::Blob>();
625 const void* bxindex_StartAddress=bxindexBlob.startingAddress();
626 short* bxindex=(
short*)::malloc(bxindexBlob.size());
627 const coral::Blob& beam1intensityBlob=row[
"BEAMINTENSITYBLOB_1"].data<coral::Blob>();
628 const void* beam1intensityBlob_StartAddress=beam1intensityBlob.startingAddress();
629 float* beam1intensity=(
float*)::malloc(beam1intensityBlob.size());
630 const coral::Blob& beam2intensityBlob=row[
"BEAMINTENSITYBLOB_2"].data<coral::Blob>();
631 const void* beam2intensityBlob_StartAddress=beam2intensityBlob.startingAddress();
632 float* beam2intensity=(
float*)::malloc(beam2intensityBlob.size());
633 std::memmove(bxindex,bxindex_StartAddress,bxindexBlob.size());
634 std::memmove(beam1intensity,beam1intensityBlob_StartAddress,beam1intensityBlob.size());
635 std::memmove(beam2intensity,beam2intensityBlob_StartAddress,beam2intensityBlob.size());
637 unsigned int iMax = bxindexBlob.size()/
sizeof(short);
638 unsigned int lsb1Max = lsdata.beam1intensity.size();
639 unsigned int lsb2Max = lsdata.beam2intensity.size();
640 unsigned int ib1Max = beam1intensityBlob.size()/
sizeof(float);
641 unsigned int ib2Max = beam2intensityBlob.size()/
sizeof(float);
642 for(
unsigned int i=0;
i<iMax;++
i){
643 unsigned int idx=bxindex[
i];
644 if(ib1Max>
i && lsb1Max>idx){
645 lsdata.beam1intensity.at(idx)=beam1intensity[
i];
647 if(ib2Max>
i && lsb2Max>idx){
648 lsdata.beam2intensity.at(idx)=beam2intensity[
i];
652 ::free(beam1intensity);
653 ::free(beam2intensity);
655 const coral::Blob& bxlumivalBlob_occ1=row[
"BXLUMIVALUE_OCC1"].data<coral::Blob>();
656 const void* bxlumival_occ1_StartAddress=bxlumivalBlob_occ1.startingAddress();
657 float* bxlumival_occ1=(
float*)::malloc(bxlumivalBlob_occ1.size());
658 std::memmove(bxlumival_occ1,bxlumival_occ1_StartAddress,bxlumivalBlob_occ1.size());
659 std::vector<float> bxlumivalVec_occ1(bxlumival_occ1,bxlumival_occ1+bxlumivalBlob_occ1.size()/
sizeof(float));
660 ::free(bxlumival_occ1);
661 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"OCC1"),bxlumivalVec_occ1));
662 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"OCC1"),std::vector<float>(3564)));
663 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"OCC1"),std::vector<short>(3564)));
664 const coral::Blob& bxlumivalBlob_occ2=row[
"BXLUMIVALUE_OCC2"].data<coral::Blob>();
665 const void* bxlumival_occ2_StartAddress=bxlumivalBlob_occ2.startingAddress();
666 float* bxlumival_occ2=(
float*)::malloc(bxlumivalBlob_occ2.size());
667 std::memmove(bxlumival_occ2,bxlumival_occ2_StartAddress,bxlumivalBlob_occ2.size());
668 std::vector<float> bxlumivalVec_occ2(bxlumival_occ2,bxlumival_occ2+bxlumivalBlob_occ1.size()/
sizeof(float));
669 ::free(bxlumival_occ2);
670 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"OCC2"),bxlumivalVec_occ2));
671 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"OCC2"),std::vector<float>(3564)));
672 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"OCC2"),std::vector<short>(3564)));
674 const coral::Blob& bxlumivalBlob_et=row[
"BXLUMIVALUE_ET"].data<coral::Blob>();
675 const void* bxlumival_et_StartAddress=bxlumivalBlob_et.startingAddress();
676 float* bxlumival_et=(
float*)::malloc(bxlumivalBlob_et.size());
677 std::memmove(bxlumival_et,bxlumival_et_StartAddress,bxlumivalBlob_et.size());
678 std::vector<float> bxlumivalVec_et(bxlumival_et,bxlumival_et+bxlumivalBlob_et.size()/
sizeof(float));
679 ::free(bxlumival_et);
680 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"ET"),bxlumivalVec_et));
681 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"ET"),std::vector<float>(3564)));
682 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"ET"),std::vector<short>(3564)));
690 delete lumisummaryQuery;
695 coral::AttributeList trgBindVariables;
696 trgBindVariables.extend(
"lsmin",
typeid(
unsigned int));
697 trgBindVariables.extend(
"lsmax",
typeid(
unsigned int));
698 trgBindVariables.extend(
"trgdataid",
typeid(
unsigned long long));
699 trgBindVariables[
"lsmin"].data<
unsigned int>()=luminum;
700 trgBindVariables[
"lsmax"].data<
unsigned int>()=luminum+m_cachesize;
702 coral::AttributeList trgOutput;
703 trgOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
704 trgOutput.extend(
"DEADTIMECOUNT",
typeid(
unsigned long long));
705 trgOutput.extend(
"BITZEROCOUNT",
typeid(
unsigned int));
706 trgOutput.extend(
"BITZEROPRESCALE",
typeid(
unsigned int));
707 trgOutput.extend(
"PRESCALEBLOB",
typeid(coral::Blob));
708 trgOutput.extend(
"TRGCOUNTBLOB",
typeid(coral::Blob));
710 coral::IQuery* trgQuery=schema.newQuery();
712 trgQuery->addToOutputList(
"CMSLSNUM");
713 trgQuery->addToOutputList(
"DEADTIMECOUNT");
714 trgQuery->addToOutputList(
"BITZEROCOUNT");
715 trgQuery->addToOutputList(
"BITZEROPRESCALE");
716 trgQuery->addToOutputList(
"PRESCALEBLOB");
717 trgQuery->addToOutputList(
"TRGCOUNTBLOB");
718 trgQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:trgdataid",trgBindVariables);
719 trgQuery->defineOutput(trgOutput);
720 coral::ICursor& trgcursor=trgQuery->execute();
721 while( trgcursor.next() ){
722 const coral::AttributeList& row=trgcursor.currentRow();
723 unsigned int cmslsnum=row[
"CMSLSNUM"].data<
unsigned int>();
725 lsdata.deadcount=row[
"DEADTIMECOUNT"].data<
unsigned long long>();
726 lsdata.bitzerocount=row[
"BITZEROCOUNT"].data<
unsigned int>();
727 lsdata.bitzeroprescale=row[
"BITZEROPRESCALE"].data<
unsigned int>();
728 if(!row[
"PRESCALEBLOB"].isNull()){
729 const coral::Blob& prescaleblob=row[
"PRESCALEBLOB"].data<coral::Blob>();
730 const void* prescaleblob_StartAddress=prescaleblob.startingAddress();
731 unsigned int*
prescales=(
unsigned int*)::malloc(prescaleblob.size());
732 std::memmove(prescales,prescaleblob_StartAddress,prescaleblob.size());
733 const coral::Blob& trgcountblob=row[
"TRGCOUNTBLOB"].data<coral::Blob>();
734 const void* trgcountblob_StartAddress=trgcountblob.startingAddress();
735 unsigned int* trgcounts=(
unsigned int*)::malloc(trgcountblob.size());
736 std::memmove(trgcounts,trgcountblob_StartAddress,trgcountblob.size());
737 for(
unsigned int i=0;
i<
sizeof(trgcounts)/
sizeof(
unsigned int);++
i){
742 lsdata.l1data.push_back(l1tmp);
752 coral::AttributeList hltBindVariables;
753 hltBindVariables.extend(
"lsmin",
typeid(
unsigned int));
754 hltBindVariables.extend(
"lsmax",
typeid(
unsigned int));
755 hltBindVariables.extend(
"hltdataid",
typeid(
unsigned long long));
756 hltBindVariables[
"lsmin"].data<
unsigned int>()=luminum;
757 hltBindVariables[
"lsmax"].data<
unsigned int>()=luminum+m_cachesize;
759 coral::AttributeList hltOutput;
760 hltOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
761 hltOutput.extend(
"HLTCOUNTBLOB",
typeid(coral::Blob));
762 hltOutput.extend(
"HLTACCEPTBLOB",
typeid(coral::Blob));
763 hltOutput.extend(
"PRESCALEBLOB",
typeid(coral::Blob));
764 coral::IQuery* hltQuery=schema.newQuery();
766 hltQuery->addToOutputList(
"CMSLSNUM");
767 hltQuery->addToOutputList(
"HLTCOUNTBLOB");
768 hltQuery->addToOutputList(
"HLTACCEPTBLOB");
769 hltQuery->addToOutputList(
"PRESCALEBLOB");
770 hltQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:hltdataid",hltBindVariables);
771 hltQuery->defineOutput(hltOutput);
772 coral::ICursor& hltcursor=hltQuery->execute();
773 while( hltcursor.next() ){
774 const coral::AttributeList& row=hltcursor.currentRow();
775 unsigned int cmslsnum=row[
"CMSLSNUM"].data<
unsigned int>();
777 if(!row[
"PRESCALEBLOB"].isNull()){
778 const coral::Blob& hltprescaleblob=row[
"PRESCALEBLOB"].data<coral::Blob>();
779 const void* hltprescaleblob_StartAddress=hltprescaleblob.startingAddress();
780 unsigned int* hltprescales=(
unsigned int*)::malloc(hltprescaleblob.size());
781 std::memmove(hltprescales,hltprescaleblob_StartAddress,hltprescaleblob.size());
782 const coral::Blob& hltcountblob=row[
"HLTCOUNTBLOB"].data<coral::Blob>();
783 const void* hltcountblob_StartAddress=hltcountblob.startingAddress();
784 unsigned int* hltcounts=(
unsigned int*)::malloc(hltcountblob.size());
785 std::memmove(hltcounts,hltcountblob_StartAddress,hltcountblob.size());
786 const coral::Blob& hltacceptblob=row[
"HLTACCEPTBLOB"].data<coral::Blob>();
787 const void* hltacceptblob_StartAddress=hltacceptblob.startingAddress();
788 unsigned int* hltaccepts=(
unsigned int*)::malloc(hltacceptblob.size());
789 std::memmove(hltaccepts,hltacceptblob_StartAddress,hltacceptblob.size());
790 unsigned int nhltaccepts =
sizeof(hltaccepts)/
sizeof(
unsigned int);
793 <<
" hltaccepts, but the run chache is empty. hltdata will not be written";
797 for(
unsigned int i=0;
i<
sizeof(hltaccepts)/
sizeof(
unsigned int);++
i){
803 lsdata.hltdata.push_back(hlttmp);
805 ::free(hltprescales);
811 session->transaction().commit();
813 session->transaction().rollback();
822 std::auto_ptr<LumiSummary> pOut1;
823 std::auto_ptr<LumiDetails> pOut2;
838 if(!lsdata.
l1data.empty()){
846 std::vector<LumiSummary::L1> l1temp;
847 for(std::vector< L1Data >::iterator it=lsdata.
l1data.begin();it!=lsdata.
l1data.end();++it){
851 l1temp.push_back(trgtmp);
853 std::vector<LumiSummary::HLT> hlttemp;
854 for(std::vector< HLTData >::iterator it=lsdata.
hltdata.begin();it!=lsdata.
hltdata.end();++it){
858 hlttemp.push_back(hlttmp);
866 if(algoname==
"OCC1"){
868 }
else if(algoname==
"OCC2"){
870 }
else if(algoname==
"ET"){
872 }
else if(algoname==
"PLT"){
void writeProductsForEntry(edm::LuminosityBlock &iLBlock, unsigned int runnumber, unsigned int luminum)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::pair< std::string, std::vector< float > > > bunchlumivalue
static const std::string trgdataTableName()
unsigned int bitzeroprescale
virtual void endRun(edm::Run const &, edm::EventSetup const &) overridefinal
std::vector< float > beam1intensity
#define DEFINE_FWK_MODULE(type)
static const std::string lshltTableName()
unsigned long long m_cachedhltdataid
LumiProducer(const edm::ParameterSet &)
void swapHLTData(std::vector< HLT > &hltdata)
std::string x2s(const XMLCh *input) const
XMLCh * s2x(const std::string &input) const
boost::tokenizer< boost::char_separator< char > > tokenizer
unsigned long long getLumiDataId(const coral::ISchema &schema, unsigned int runnumber)
static const std::string lstrgTableName()
LuminosityBlockNumber_t luminosityBlock() const
void setLumiVersion(std::string const &lumiVersion)
static const std::string hltdataTableName()
void setlsnumber(unsigned int lsnumber)
virtual void beginLuminosityBlockProduce(edm::LuminosityBlock &iLBlock, edm::EventSetup const &iSetup) overridefinal
std::map< std::string, unsigned int > HLTPathNameToIndex
unsigned long long getHltDataId(const coral::ISchema &schema, unsigned int runnumber)
virtual void endRunProduce(edm::Run &, edm::EventSetup const &) overridefinal
void setOrbitData(unsigned int startorbit, unsigned int numorbit)
std::string toParentString(const xercesc::DOMNode &nodeToConvert) const
std::vector< std::pair< std::string, std::vector< float > > > bunchlumierror
void fill(AlgoType algo, std::vector< float > const &values, std::vector< float > const &errors, std::vector< short > const &qualities)
void fillLSCache(unsigned int luminum)
std::vector< HLTData > hltdata
static const std::string tagsTableName()
unsigned long long m_cachedtrgdataid
void disconnect(coral::ISessionProxy *session)
unsigned long long m_cachedlumidataid
unsigned int bitzerocount
void setLumiVersion(const std::string &lumiversion)
static const std::string lumidataTableName()
void setLumiData(float instlumi, float instlumierr, short lumiquality)
void setBitZeroCount(unsigned long long bitzerocount)
unsigned long long getTrgDataId(const coral::ISchema &schema, unsigned int runnumber)
std::string m_siteconfpath
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
std::map< unsigned int, PerLSData > m_lscache
std::vector< L1Data > l1data
void setDeadCount(unsigned long long deadcount)
std::vector< std::string > TRGBitNames
static const std::string lumisummaryv2TableName()
void swapL1Data(std::vector< L1 > &l1data)
unsigned long long deadcount
std::vector< std::vector< double > > tmp
void fillBeamIntensities(std::vector< float > const &beam1Intensities, std::vector< float > const &beam2Intensities)
std::string m_lumiversion
std::string getCurrentDataTag(const coral::ISchema &schema)
bool fillLumi(edm::LuminosityBlock &iLBlock)
coral::ISessionProxy * connectReadOnly(const std::string &connectstring)
void put(std::auto_ptr< PROD > product)
Put a new product.
void fillRunCache(const coral::ISchema &schema, unsigned int runnumber)
virtual void produce(edm::Event &, const edm::EventSetup &) overridefinal
const std::string servletTranslation(const std::string &servlet) const
std::vector< std::string > HLTPathNames
std::vector< std::pair< std::string, std::vector< short > > > bunchlumiquality
std::map< std::string, unsigned int > TRGBitNameToIndex
virtual void beginRun(edm::Run const &, edm::EventSetup const &) overridefinal
std::vector< float > beam2intensity
void put(std::auto_ptr< PROD > product)
Put a new product.