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/foreach.hpp>
65 #include <boost/tokenizer.hpp>
66 #include <xercesc/dom/DOM.hpp>
67 #include <xercesc/parsers/XercesDOMParser.hpp>
69 #include <xercesc/util/XMLString.hpp>
71 #include "boost/filesystem/path.hpp"
72 #include "boost/filesystem/operations.hpp"
82 edm::BeginLuminosityBlockProducer,
83 edm::EndRunProducer> {
134 edm::
EventSetup const& iSetup) override final;
144 std::
string x2s(const XMLCh*
input)const;
145 XMLCh*
s2x(const std::
string&
input)const;
146 std::
string toParentString(const xercesc::DOMNode &nodeToConvert)const;
147 unsigned long long getLumiDataId(const coral::ISchema& schema,
unsigned int runnumber);
148 unsigned long long getTrgDataId(const coral::ISchema& schema,
unsigned int runnumber);
149 unsigned long long getHltDataId(const coral::ISchema& schema,
unsigned int runnumber);
176 XMLCh* buff = xercesc::XMLString::transcode(temp.c_str());
182 std::ostringstream oss;
183 xercesc::DOMNodeList *childList = nodeToConvert.getChildNodes();
185 unsigned int numNodes = childList->getLength ();
186 for (
unsigned int i = 0;
i < numNodes; ++
i){
187 xercesc::DOMNode *childNode = childList->item(
i);
188 if (childNode->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
190 xercesc::DOMElement *
child = static_cast < xercesc::DOMElement *> (childNode);
191 xercesc::DOMNamedNodeMap *
attributes = child->getAttributes();
192 unsigned int numAttributes = attributes->getLength ();
193 for (
unsigned int j = 0;
j < numAttributes; ++
j){
194 xercesc::DOMNode *attributeNode = attributes->item(
j);
195 if (attributeNode->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
197 xercesc::DOMAttr *attribute = static_cast <xercesc::DOMAttr *> (attributeNode);
199 oss <<
"(" <<
x2s(child->getTagName()) <<
200 x2s(attribute->getName()) <<
"=" <<
201 x2s(attribute->getValue()) <<
")";
212 std::auto_ptr< xercesc::XercesDOMParser >
parser(
new xercesc::XercesDOMParser);
214 parser->setValidationScheme(xercesc::XercesDOMParser::Val_Auto);
215 parser->setDoNamespaces(
false);
217 xercesc::DOMDocument*
doc=parser->getDocument();
222 xercesc::DOMNodeList *frontierConnectList=doc->getElementsByTagName(
s2x(
"frontier-connect"));
223 if (frontierConnectList->getLength()>0){
224 xercesc::DOMElement *frontierConnectElement=static_cast < xercesc::DOMElement *> (frontierConnectList->item (0));
232 while ((serverurl=frontierConnect.find(
"(serverurl=", nextparen)) != std::string::npos){
233 realconnect.append(frontierConnect, nextparen, serverurl - nextparen);
234 nextparen=frontierConnect.find(
')', serverurl);
235 lastslash=frontierConnect.rfind(
'/', nextparen);
236 realconnect.append(frontierConnect,serverurl,lastslash-serverurl+1);
237 realconnect.append(servlet);
239 realconnect.append(frontierConnect, nextparen,frontierConnect.length()-nextparen);
240 }
catch(xercesc::DOMException &
e){
249 produces<LumiSummaryRunHeader, edm::InRun>();
250 produces<LumiSummary, edm::InLumi>();
251 produces<LumiDetails, edm::InLumi>();
258 if(connectStr.substr(0,fproto.length())==fproto){
261 if(endservlet==std::string::npos){
262 endservlet=connectStr.rfind(
'/',connectStr.length());
264 std::string servlet=connectStr.substr(startservlet,endservlet-startservlet);
265 if( (servlet !=
"")&& (servlet.find_first_of(
":/)[]")==std::string::npos)){
266 if(servlet==
"cms_conditions_data") servlet=
"";
269 if(siteconfpath.length()==0){
271 char *
tmp = getenv (
"CMS_PATH");
307 unsigned long long lumidataid=0;
308 coral::AttributeList bindVariables;
309 bindVariables.extend(
"runnum",
typeid(
unsigned int));
310 bindVariables[
"runnum"].data<
unsigned int>()=runnumber;
311 coral::AttributeList lumiidOutput;
312 lumiidOutput.extend(
"lumidataid",
typeid(
unsigned long long));
313 coral::IQuery* lumiQuery=schema.newQuery();
315 lumiQuery->addToOutputList(
"MAX(DATA_ID)",
"lumidataid");
316 lumiQuery->setCondition(
"RUNNUM=:runnum",bindVariables);
317 lumiQuery->defineOutput(lumiidOutput);
318 coral::ICursor& lumicursor=lumiQuery->execute();
319 while( lumicursor.next() ){
320 const coral::AttributeList& row=lumicursor.currentRow();
321 if(!row[
"lumidataid"].isNull()){
322 lumidataid=row[
"lumidataid"].data<
unsigned long long>();
333 unsigned long long trgdataid=0;
334 coral::AttributeList bindVariables;
335 bindVariables.extend(
"runnum",
typeid(
unsigned int));
336 bindVariables[
"runnum"].data<
unsigned int>()=runnumber;
337 coral::AttributeList trgidOutput;
338 trgidOutput.extend(
"trgdataid",
typeid(
unsigned long long));
339 coral::IQuery* trgQuery=schema.newQuery();
341 trgQuery->addToOutputList(
"MAX(DATA_ID)",
"trgdataid");
342 trgQuery->setCondition(
"RUNNUM=:runnum",bindVariables);
343 trgQuery->defineOutput(trgidOutput);
344 coral::ICursor& trgcursor=trgQuery->execute();
345 while( trgcursor.next() ){
346 const coral::AttributeList& row=trgcursor.currentRow();
347 if(!row[
"trgdataid"].isNull()){
348 trgdataid=row[
"trgdataid"].data<
unsigned long long>();
359 unsigned long long hltdataid=0;
360 coral::AttributeList bindVariables;
361 bindVariables.extend(
"runnum",
typeid(
unsigned int));
362 bindVariables[
"runnum"].data<
unsigned int>()=runnumber;
363 coral::AttributeList hltidOutput;
364 hltidOutput.extend(
"hltdataid",
typeid(
unsigned long long));
365 coral::IQuery* hltQuery=schema.newQuery();
367 hltQuery->addToOutputList(
"MAX(DATA_ID)",
"hltdataid");
368 hltQuery->setCondition(
"RUNNUM=:runnum",bindVariables);
369 hltQuery->defineOutput(hltidOutput);
370 coral::ICursor& hltcursor=hltQuery->execute();
371 while( hltcursor.next() ){
372 const coral::AttributeList& row=hltcursor.currentRow();
373 if(!row[
"hltdataid"].isNull()){
374 hltdataid=row[
"hltdataid"].data<
unsigned long long>();
385 std::map<unsigned long long,std::string>
alltags;
386 coral::IQuery* tagQuery=schema.newQuery();
388 tagQuery->addToOutputList(
"TAGID");
389 tagQuery->addToOutputList(
"TAGNAME");
390 coral::AttributeList tagoutput;
391 tagoutput.extend(
"TAGID",
typeid(
unsigned long long));
393 tagQuery->defineOutput(tagoutput);
394 coral::ICursor& tagcursor=tagQuery->execute();
395 while( tagcursor.next() ){
396 const coral::AttributeList& row=tagcursor.currentRow();
397 unsigned long long tagid=row[
"TAGID"].data<
unsigned long long>();
399 alltags.insert(std::make_pair(tagid,tagname));
402 unsigned long long maxid=0;
403 for(std::map<unsigned long long,std::string>::iterator it = alltags.begin(); it !=alltags.end(); ++it) {
404 if( it->first > maxid){
408 result=alltags[maxid];
421 throw cms::Exception(
"Non existing service lumi::service::DBService");
425 session->transaction().start(
true);
434 session->transaction().commit();
436 session->transaction().rollback();
452 std::auto_ptr<LumiSummary> pOut1;
453 std::auto_ptr<LumiDetails> pOut2;
484 if(m_lumiversion.empty()){
487 std::cout<<
"lumi tag version 2 "<<m_lumiversion<<std::endl;
489 coral::AttributeList trgBindVariables;
490 trgBindVariables.extend(
"trgdataid",
typeid(
unsigned long long));
493 coral::AttributeList trgOutput;
494 trgOutput.extend(
"bitzeroname",
typeid(
std::string));
495 trgOutput.extend(
"bitnameclob",
typeid(
std::string));
496 coral::IQuery* trgQuery=schema.newQuery();
498 trgQuery->addToOutputList(
"BITZERONAME");
499 trgQuery->addToOutputList(
"BITNAMECLOB");
500 trgQuery->setCondition(
"DATA_ID=:trgdataid",trgBindVariables);
501 trgQuery->defineOutput(trgOutput);
502 coral::ICursor& trgcursor=trgQuery->execute();
503 while( trgcursor.next() ){
504 const coral::AttributeList& row=trgcursor.currentRow();
508 boost::char_separator<char> sep(
",");
509 boost::tokenizer<boost::char_separator<char> > tokens(bitnames,sep);
510 for(boost::tokenizer<boost::char_separator<char> >::iterator tok_it=tokens.begin();tok_it!=tokens.end();++tok_it){
523 coral::AttributeList hltBindVariables;
524 hltBindVariables.extend(
"hltdataid",
typeid(
unsigned long long));
526 coral::AttributeList hltOutput;
527 hltOutput.extend(
"PATHNAMECLOB",
typeid(
std::string));
528 coral::IQuery* hltQuery=schema.newQuery();
530 hltQuery->addToOutputList(
"PATHNAMECLOB");
531 hltQuery->setCondition(
"DATA_ID=:hltdataid",hltBindVariables);
532 hltQuery->defineOutput(hltOutput);
533 coral::ICursor& hltcursor=hltQuery->execute();
534 while( hltcursor.next() ){
535 const coral::AttributeList& row=hltcursor.currentRow();
537 boost::char_separator<char> sep(
",");
538 boost::tokenizer<boost::char_separator<char> > tokens(pathnames,sep);
539 for(boost::tokenizer<boost::char_separator<char> >::iterator tok_it=tokens.begin();tok_it!=tokens.end();++tok_it){
571 throw cms::Exception(
"Non existing service lumi::service::DBService");
575 session->transaction().start(
true);
576 coral::ISchema&
schema=session->nominalSchema();
577 coral::AttributeList lumisummaryBindVariables;
578 lumisummaryBindVariables.extend(
"lsmin",
typeid(
unsigned int));
579 lumisummaryBindVariables.extend(
"lsmax",
typeid(
unsigned int));
580 lumisummaryBindVariables.extend(
"lumidataid",
typeid(
unsigned long long));
582 lumisummaryBindVariables[
"lsmin"].data<
unsigned int>()=luminum;
583 lumisummaryBindVariables[
"lsmax"].data<
unsigned int>()=luminum+m_cachesize;
584 coral::AttributeList lumisummaryOutput;
585 lumisummaryOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
586 lumisummaryOutput.extend(
"INSTLUMI",
typeid(
float));
587 lumisummaryOutput.extend(
"STARTORBIT",
typeid(
unsigned int));
588 lumisummaryOutput.extend(
"NUMORBIT",
typeid(
unsigned int));
589 lumisummaryOutput.extend(
"CMSBXINDEXBLOB",
typeid(coral::Blob));
590 lumisummaryOutput.extend(
"BEAMINTENSITYBLOB_1",
typeid(coral::Blob));
591 lumisummaryOutput.extend(
"BEAMINTENSITYBLOB_2",
typeid(coral::Blob));
592 lumisummaryOutput.extend(
"BXLUMIVALUE_OCC1",
typeid(coral::Blob));
593 lumisummaryOutput.extend(
"BXLUMIVALUE_OCC2",
typeid(coral::Blob));
594 lumisummaryOutput.extend(
"BXLUMIVALUE_ET",
typeid(coral::Blob));
595 coral::IQuery* lumisummaryQuery=schema.newQuery();
597 lumisummaryQuery->addToOutputList(
"CMSLSNUM");
598 lumisummaryQuery->addToOutputList(
"INSTLUMI");
599 lumisummaryQuery->addToOutputList(
"STARTORBIT");
600 lumisummaryQuery->addToOutputList(
"NUMORBIT");
601 lumisummaryQuery->addToOutputList(
"CMSBXINDEXBLOB");
602 lumisummaryQuery->addToOutputList(
"BEAMINTENSITYBLOB_1");
603 lumisummaryQuery->addToOutputList(
"BEAMINTENSITYBLOB_2");
604 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_OCC1");
605 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_OCC2");
606 lumisummaryQuery->addToOutputList(
"BXLUMIVALUE_ET");
607 lumisummaryQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:lumidataid",lumisummaryBindVariables);
608 lumisummaryQuery->defineOutput(lumisummaryOutput);
609 coral::ICursor& lumisummarycursor=lumisummaryQuery->execute();
610 unsigned int rowcounter=0;
611 while( lumisummarycursor.next() ){
612 const coral::AttributeList& row=lumisummarycursor.currentRow();
613 unsigned int cmslsnum=row[
"CMSLSNUM"].data<
unsigned int>();
616 lsdata.lumivalue=row[
"INSTLUMI"].data<
float>();
617 lsdata.lumierror=0.0;
618 lsdata.lumiquality=0;
619 lsdata.startorbit=row[
"STARTORBIT"].data<
unsigned int>();
620 lsdata.numorbit=row[
"NUMORBIT"].data<
unsigned int>();
622 if(!row[
"CMSBXINDEXBLOB"].isNull() && !row[
"BXLUMIVALUE_OCC1"].isNull() ){
623 const coral::Blob& bxindexBlob=row[
"CMSBXINDEXBLOB"].data<coral::Blob>();
624 const void* bxindex_StartAddress=bxindexBlob.startingAddress();
625 short* bxindex=(
short*)::malloc(bxindexBlob.size());
626 const coral::Blob& beam1intensityBlob=row[
"BEAMINTENSITYBLOB_1"].data<coral::Blob>();
627 const void* beam1intensityBlob_StartAddress=beam1intensityBlob.startingAddress();
628 float* beam1intensity=(
float*)::malloc(beam1intensityBlob.size());
629 const coral::Blob& beam2intensityBlob=row[
"BEAMINTENSITYBLOB_2"].data<coral::Blob>();
630 const void* beam2intensityBlob_StartAddress=beam2intensityBlob.startingAddress();
631 float* beam2intensity=(
float*)::malloc(beam2intensityBlob.size());
632 std::memmove(bxindex,bxindex_StartAddress,bxindexBlob.size());
633 std::memmove(beam1intensity,beam1intensityBlob_StartAddress,beam1intensityBlob.size());
634 std::memmove(beam2intensity,beam2intensityBlob_StartAddress,beam2intensityBlob.size());
636 unsigned int iMax = bxindexBlob.size()/
sizeof(short);
637 unsigned int lsb1Max = lsdata.beam1intensity.size();
638 unsigned int lsb2Max = lsdata.beam2intensity.size();
639 unsigned int ib1Max = beam1intensityBlob.size()/
sizeof(float);
640 unsigned int ib2Max = beam2intensityBlob.size()/
sizeof(float);
641 for(
unsigned int i=0;
i<iMax;++
i){
642 unsigned int idx=bxindex[
i];
643 if(ib1Max>
i && lsb1Max>idx){
644 lsdata.beam1intensity.at(idx)=beam1intensity[
i];
646 if(ib2Max>
i && lsb2Max>idx){
647 lsdata.beam2intensity.at(idx)=beam2intensity[
i];
651 ::free(beam1intensity);
652 ::free(beam2intensity);
654 const coral::Blob& bxlumivalBlob_occ1=row[
"BXLUMIVALUE_OCC1"].data<coral::Blob>();
655 const void* bxlumival_occ1_StartAddress=bxlumivalBlob_occ1.startingAddress();
656 float* bxlumival_occ1=(
float*)::malloc(bxlumivalBlob_occ1.size());
657 std::memmove(bxlumival_occ1,bxlumival_occ1_StartAddress,bxlumivalBlob_occ1.size());
658 std::vector<float> bxlumivalVec_occ1(bxlumival_occ1,bxlumival_occ1+bxlumivalBlob_occ1.size()/
sizeof(float));
659 ::free(bxlumival_occ1);
660 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"OCC1"),bxlumivalVec_occ1));
661 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"OCC1"),std::vector<float>(3564)));
662 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"OCC1"),std::vector<short>(3564)));
663 const coral::Blob& bxlumivalBlob_occ2=row[
"BXLUMIVALUE_OCC2"].data<coral::Blob>();
664 const void* bxlumival_occ2_StartAddress=bxlumivalBlob_occ2.startingAddress();
665 float* bxlumival_occ2=(
float*)::malloc(bxlumivalBlob_occ2.size());
666 std::memmove(bxlumival_occ2,bxlumival_occ2_StartAddress,bxlumivalBlob_occ2.size());
667 std::vector<float> bxlumivalVec_occ2(bxlumival_occ2,bxlumival_occ2+bxlumivalBlob_occ1.size()/
sizeof(float));
668 ::free(bxlumival_occ2);
669 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"OCC2"),bxlumivalVec_occ2));
670 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"OCC2"),std::vector<float>(3564)));
671 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"OCC2"),std::vector<short>(3564)));
673 const coral::Blob& bxlumivalBlob_et=row[
"BXLUMIVALUE_ET"].data<coral::Blob>();
674 const void* bxlumival_et_StartAddress=bxlumivalBlob_et.startingAddress();
675 float* bxlumival_et=(
float*)::malloc(bxlumivalBlob_et.size());
676 std::memmove(bxlumival_et,bxlumival_et_StartAddress,bxlumivalBlob_et.size());
677 std::vector<float> bxlumivalVec_et(bxlumival_et,bxlumival_et+bxlumivalBlob_et.size()/
sizeof(float));
678 ::free(bxlumival_et);
679 lsdata.bunchlumivalue.push_back(std::make_pair(
std::string(
"ET"),bxlumivalVec_et));
680 lsdata.bunchlumierror.push_back(std::make_pair(
std::string(
"ET"),std::vector<float>(3564)));
681 lsdata.bunchlumiquality.push_back(std::make_pair(
std::string(
"ET"),std::vector<short>(3564)));
689 delete lumisummaryQuery;
694 coral::AttributeList trgBindVariables;
695 trgBindVariables.extend(
"lsmin",
typeid(
unsigned int));
696 trgBindVariables.extend(
"lsmax",
typeid(
unsigned int));
697 trgBindVariables.extend(
"trgdataid",
typeid(
unsigned long long));
698 trgBindVariables[
"lsmin"].data<
unsigned int>()=luminum;
699 trgBindVariables[
"lsmax"].data<
unsigned int>()=luminum+m_cachesize;
701 coral::AttributeList trgOutput;
702 trgOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
703 trgOutput.extend(
"DEADTIMECOUNT",
typeid(
unsigned long long));
704 trgOutput.extend(
"BITZEROCOUNT",
typeid(
unsigned int));
705 trgOutput.extend(
"BITZEROPRESCALE",
typeid(
unsigned int));
706 trgOutput.extend(
"PRESCALEBLOB",
typeid(coral::Blob));
707 trgOutput.extend(
"TRGCOUNTBLOB",
typeid(coral::Blob));
709 coral::IQuery* trgQuery=schema.newQuery();
711 trgQuery->addToOutputList(
"CMSLSNUM");
712 trgQuery->addToOutputList(
"DEADTIMECOUNT");
713 trgQuery->addToOutputList(
"BITZEROCOUNT");
714 trgQuery->addToOutputList(
"BITZEROPRESCALE");
715 trgQuery->addToOutputList(
"PRESCALEBLOB");
716 trgQuery->addToOutputList(
"TRGCOUNTBLOB");
717 trgQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:trgdataid",trgBindVariables);
718 trgQuery->defineOutput(trgOutput);
719 coral::ICursor& trgcursor=trgQuery->execute();
720 while( trgcursor.next() ){
721 const coral::AttributeList& row=trgcursor.currentRow();
722 unsigned int cmslsnum=row[
"CMSLSNUM"].data<
unsigned int>();
724 lsdata.deadcount=row[
"DEADTIMECOUNT"].data<
unsigned long long>();
725 lsdata.bitzerocount=row[
"BITZEROCOUNT"].data<
unsigned int>();
726 lsdata.bitzeroprescale=row[
"BITZEROPRESCALE"].data<
unsigned int>();
727 if(!row[
"PRESCALEBLOB"].isNull()){
728 const coral::Blob& prescaleblob=row[
"PRESCALEBLOB"].data<coral::Blob>();
729 const void* prescaleblob_StartAddress=prescaleblob.startingAddress();
730 unsigned int*
prescales=(
unsigned int*)::malloc(prescaleblob.size());
731 std::memmove(prescales,prescaleblob_StartAddress,prescaleblob.size());
732 const coral::Blob& trgcountblob=row[
"TRGCOUNTBLOB"].data<coral::Blob>();
733 const void* trgcountblob_StartAddress=trgcountblob.startingAddress();
734 unsigned int* trgcounts=(
unsigned int*)::malloc(trgcountblob.size());
735 std::memmove(trgcounts,trgcountblob_StartAddress,trgcountblob.size());
736 for(
unsigned int i=0;
i<
sizeof(trgcounts)/
sizeof(
unsigned int);++
i){
741 lsdata.l1data.push_back(l1tmp);
751 coral::AttributeList hltBindVariables;
752 hltBindVariables.extend(
"lsmin",
typeid(
unsigned int));
753 hltBindVariables.extend(
"lsmax",
typeid(
unsigned int));
754 hltBindVariables.extend(
"hltdataid",
typeid(
unsigned long long));
755 hltBindVariables[
"lsmin"].data<
unsigned int>()=luminum;
756 hltBindVariables[
"lsmax"].data<
unsigned int>()=luminum+m_cachesize;
758 coral::AttributeList hltOutput;
759 hltOutput.extend(
"CMSLSNUM",
typeid(
unsigned int));
760 hltOutput.extend(
"HLTCOUNTBLOB",
typeid(coral::Blob));
761 hltOutput.extend(
"HLTACCEPTBLOB",
typeid(coral::Blob));
762 hltOutput.extend(
"PRESCALEBLOB",
typeid(coral::Blob));
763 coral::IQuery* hltQuery=schema.newQuery();
765 hltQuery->addToOutputList(
"CMSLSNUM");
766 hltQuery->addToOutputList(
"HLTCOUNTBLOB");
767 hltQuery->addToOutputList(
"HLTACCEPTBLOB");
768 hltQuery->addToOutputList(
"PRESCALEBLOB");
769 hltQuery->setCondition(
"CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND DATA_ID=:hltdataid",hltBindVariables);
770 hltQuery->defineOutput(hltOutput);
771 coral::ICursor& hltcursor=hltQuery->execute();
772 while( hltcursor.next() ){
773 const coral::AttributeList& row=hltcursor.currentRow();
774 unsigned int cmslsnum=row[
"CMSLSNUM"].data<
unsigned int>();
776 if(!row[
"PRESCALEBLOB"].isNull()){
777 const coral::Blob& hltprescaleblob=row[
"PRESCALEBLOB"].data<coral::Blob>();
778 const void* hltprescaleblob_StartAddress=hltprescaleblob.startingAddress();
779 unsigned int* hltprescales=(
unsigned int*)::malloc(hltprescaleblob.size());
780 std::memmove(hltprescales,hltprescaleblob_StartAddress,hltprescaleblob.size());
781 const coral::Blob& hltcountblob=row[
"HLTCOUNTBLOB"].data<coral::Blob>();
782 const void* hltcountblob_StartAddress=hltcountblob.startingAddress();
783 unsigned int* hltcounts=(
unsigned int*)::malloc(hltcountblob.size());
784 std::memmove(hltcounts,hltcountblob_StartAddress,hltcountblob.size());
785 const coral::Blob& hltacceptblob=row[
"HLTACCEPTBLOB"].data<coral::Blob>();
786 const void* hltacceptblob_StartAddress=hltacceptblob.startingAddress();
787 unsigned int* hltaccepts=(
unsigned int*)::malloc(hltacceptblob.size());
788 std::memmove(hltaccepts,hltacceptblob_StartAddress,hltacceptblob.size());
789 unsigned int nhltaccepts =
sizeof(hltaccepts)/
sizeof(
unsigned int);
792 <<
" hltaccepts, but the run chache is empty. hltdata will not be written";
796 for(
unsigned int i=0;
i<
sizeof(hltaccepts)/
sizeof(
unsigned int);++
i){
802 lsdata.hltdata.push_back(hlttmp);
804 ::free(hltprescales);
810 session->transaction().commit();
812 session->transaction().rollback();
821 std::auto_ptr<LumiSummary> pOut1;
822 std::auto_ptr<LumiDetails> pOut2;
837 if(!lsdata.
l1data.empty()){
845 std::vector<LumiSummary::L1> l1temp;
846 for(std::vector< L1Data >::iterator it=lsdata.
l1data.begin();it!=lsdata.
l1data.end();++it){
850 l1temp.push_back(trgtmp);
852 std::vector<LumiSummary::HLT> hlttemp;
853 for(std::vector< HLTData >::iterator it=lsdata.
hltdata.begin();it!=lsdata.
hltdata.end();++it){
857 hlttemp.push_back(hlttmp);
865 if(algoname==
"OCC1"){
867 }
else if(algoname==
"OCC2"){
869 }
else if(algoname==
"ET"){
871 }
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
unsigned long long getLumiDataId(const coral::ISchema &schema, unsigned int runnumber)
static const std::string lstrgTableName()
static std::string const input
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
volatile std::atomic< bool > shutdown_flag false
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.