CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
LumiProducer Class Reference

#include <RecoLuminosity/LumiProducer/src/LumiProducer.cc>

Inheritance diagram for LumiProducer:
edm::one::EDProducer< edm::one::WatchRuns, edm::BeginLuminosityBlockProducer, edm::EndRunProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  HLTData
 
struct  L1Data
 
struct  PerLSData
 
struct  PerRunData
 

Public Member Functions

 LumiProducer (const edm::ParameterSet &)
 
 ~LumiProducer ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::BeginLuminosityBlockProducer, edm::EndRunProducer >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginLuminosityBlockProduce (edm::LuminosityBlock &iLBlock, edm::EventSetup const &iSetup) overridefinal
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) overridefinal
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) overridefinal
 
virtual void endRunProduce (edm::Run &, edm::EventSetup const &) overridefinal
 
void fillLSCache (unsigned int luminum)
 
bool fillLumi (edm::LuminosityBlock &iLBlock)
 
void fillRunCache (const coral::ISchema &schema, unsigned int runnumber)
 
std::string getCurrentDataTag (const coral::ISchema &schema)
 
unsigned long long getHltDataId (const coral::ISchema &schema, unsigned int runnumber)
 
unsigned long long getLumiDataId (const coral::ISchema &schema, unsigned int runnumber)
 
unsigned long long getTrgDataId (const coral::ISchema &schema, unsigned int runnumber)
 
virtual void produce (edm::Event &, const edm::EventSetup &) overridefinal
 
XMLCh * s2x (const std::string &input) const
 
const std::string servletTranslation (const std::string &servlet) const
 
std::string toParentString (const xercesc::DOMNode &nodeToConvert) const
 
void writeProductsForEntry (edm::LuminosityBlock &iLBlock, unsigned int runnumber, unsigned int luminum)
 
std::string x2s (const XMLCh *input) const
 

Private Attributes

unsigned long long m_cachedhltdataid
 
unsigned long long m_cachedlumidataid
 
unsigned int m_cachedrun
 
unsigned long long m_cachedtrgdataid
 
unsigned int m_cachesize
 
std::string m_connectStr
 
bool m_isNullRun
 
std::map< unsigned int, PerLSDatam_lscache
 
std::string m_lumiversion
 
PerRunData m_runcache
 
std::string m_siteconfpath
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
typedef WorkerT< EDProducerBaseWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::one::EDProducerBase
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: This class would load the luminosity object into a Luminosity Block

Implementation: The are two main steps, the first one retrieve the record of the luminosity data from the DB and the second loads the Luminosity Obj into the Lumi Block. (Actually in the initial implementation it is retrieving from the ParameterSet from the configuration file, the DB is not implemented yet)

Definition at line 82 of file LumiProducer.cc.

Constructor & Destructor Documentation

LumiProducer::LumiProducer ( const edm::ParameterSet )
explicit
LumiProducer::~LumiProducer ( )

Definition at line 293 of file LumiProducer.cc.

293  {
294 }

Member Function Documentation

void LumiProducer::beginLuminosityBlockProduce ( edm::LuminosityBlock iLBlock,
edm::EventSetup const &  iSetup 
)
finaloverrideprivatevirtual

Definition at line 446 of file LumiProducer.cc.

References fillLSCache(), edm::LuminosityBlockBase::luminosityBlock(), m_isNullRun, m_lscache, edm::LuminosityBlock::put(), edm::LuminosityBlockBase::run(), cond::runnumber, and writeProductsForEntry().

447 {
448  unsigned int runnumber=iLBlock.run();
449  unsigned int luminum=iLBlock.luminosityBlock();
450  //std::cout<<"beg of beginLuminosityBlock "<<luminum<<std::endl;
451  //if is null run, fill empty values and return
452  if(m_isNullRun){
453  std::auto_ptr<LumiSummary> pOut1;
454  std::auto_ptr<LumiDetails> pOut2;
455  LumiSummary* pIn1=new LumiSummary;
456  LumiDetails* pIn2=new LumiDetails;
457  pOut1.reset(pIn1);
458  iLBlock.put(pOut1);
459  pOut2.reset(pIn2);
460  iLBlock.put(pOut2);
461  return;
462  }
463  if(m_lscache.find(luminum)==m_lscache.end()){
464  //if runnumber is cached but LS is not, this is the first LS, fill LS cache to full capacity
465  fillLSCache(luminum);
466  }
467  //here the presence of ls is guaranteed
468  writeProductsForEntry(iLBlock,runnumber,luminum);
469 }
void writeProductsForEntry(edm::LuminosityBlock &iLBlock, unsigned int runnumber, unsigned int luminum)
LuminosityBlockNumber_t luminosityBlock() const
void fillLSCache(unsigned int luminum)
RunNumber_t run() const
std::map< unsigned int, PerLSData > m_lscache
void put(std::auto_ptr< PROD > product)
Put a new product.
void LumiProducer::beginRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
finaloverrideprivatevirtual

Definition at line 414 of file LumiProducer.cc.

References lumi::service::DBService::connectReadOnly(), lumi::service::DBService::disconnect(), edm::hlt::Exception, fillRunCache(), getHltDataId(), getLumiDataId(), getTrgDataId(), edm::Service< T >::isAvailable(), m_cachedhltdataid, m_cachedlumidataid, m_cachedrun, m_cachedtrgdataid, m_connectStr, m_isNullRun, edm::RunBase::run(), cond::runnumber, and python.CommonUtils::session.

415 {
416  unsigned int runnumber=run.run();
417  if(m_cachedrun!=runnumber){
418  //queries once per run
421  if( !mydbservice.isAvailable() ){
422  throw cms::Exception("Non existing service lumi::service::DBService");
423  }
424  coral::ISessionProxy* session=mydbservice->connectReadOnly(m_connectStr);
425  try{
426  session->transaction().start(true);
427  m_cachedlumidataid=getLumiDataId(session->nominalSchema(),runnumber);
428  if(m_cachedlumidataid!=0){//if no lumi, do not bother other info
429  m_cachedtrgdataid=getTrgDataId(session->nominalSchema(),runnumber);
430  m_cachedhltdataid=getHltDataId(session->nominalSchema(),runnumber);
431  fillRunCache(session->nominalSchema(),runnumber);
432  }else{
433  m_isNullRun=true;
434  }
435  session->transaction().commit();
436  }catch(const coral::Exception& er){
437  session->transaction().rollback();
438  mydbservice->disconnect(session);
439  throw cms::Exception("DatabaseError ")<<er.what();
440  }
441  mydbservice->disconnect(session);
442  }
443  //std::cout<<"end of beginRun "<<runnumber<<std::endl;
444 }
unsigned long long m_cachedhltdataid
unsigned long long getLumiDataId(const coral::ISchema &schema, unsigned int runnumber)
std::string m_connectStr
unsigned long long getHltDataId(const coral::ISchema &schema, unsigned int runnumber)
bool isAvailable() const
Definition: Service.h:47
unsigned int m_cachedrun
unsigned long long m_cachedtrgdataid
void disconnect(coral::ISessionProxy *session)
Definition: DBService.cc:46
unsigned long long m_cachedlumidataid
unsigned long long getTrgDataId(const coral::ISchema &schema, unsigned int runnumber)
coral::ISessionProxy * connectReadOnly(const std::string &connectstring)
Definition: DBService.cc:42
void fillRunCache(const coral::ISchema &schema, unsigned int runnumber)
void LumiProducer::endRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
finaloverrideprivatevirtual

Definition at line 471 of file LumiProducer.cc.

472 {}
void LumiProducer::endRunProduce ( edm::Run run,
edm::EventSetup const &  iSetup 
)
finaloverrideprivatevirtual

Definition at line 474 of file LumiProducer.cc.

References LumiProducer::PerRunData::HLTPathNames, LumiProducer::PerRunData::HLTPathNameToIndex, m_runcache, edm::Run::put(), LumiProducer::PerRunData::TRGBitNames, and LumiProducer::PerRunData::TRGBitNameToIndex.

475 {
476  std::auto_ptr<LumiSummaryRunHeader> lsrh(new LumiSummaryRunHeader());
477  lsrh->swapL1Names(m_runcache.TRGBitNames);
478  lsrh->swapHLTNames(m_runcache.HLTPathNames);
479  run.put(lsrh);
482 }
std::map< std::string, unsigned int > HLTPathNameToIndex
std::vector< std::string > TRGBitNames
void put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Run.h:86
std::vector< std::string > HLTPathNames
std::map< std::string, unsigned int > TRGBitNameToIndex
PerRunData m_runcache
void LumiProducer::fillLSCache ( unsigned int  luminum)
private

Definition at line 551 of file LumiProducer.cc.

References LumiProducer::HLTData::acceptcount, LumiProducer::PerLSData::beam1intensity, LumiProducer::PerLSData::beam2intensity, LumiProducer::L1Data::bitname, LumiProducer::PerLSData::bunchlumierror, LumiProducer::PerLSData::bunchlumiquality, LumiProducer::PerLSData::bunchlumivalue, estimatePileup2::cmslsnum, lumi::service::DBService::connectReadOnly(), lumi::service::DBService::disconnect(), edm::hlt::Exception, LumiProducer::PerLSData::hltdata, LumiProducer::PerRunData::HLTPathNames, i, customizeTrackingMonitorSeedNumber::idx, edm::Service< T >::isAvailable(), prof2calltree::l, LumiProducer::PerLSData::l1data, LumiProducer::HLTData::l1passcount, lumi::LumiNames::lshltTableName(), lumi::LumiNames::lstrgTableName(), lumi::LumiNames::lumisummaryv2TableName(), m_cachedhltdataid, m_cachedlumidataid, m_cachedtrgdataid, m_cachesize, m_connectStr, m_isNullRun, m_lscache, m_runcache, n, LumiProducer::HLTData::pathname, LumiProducer::HLTData::prescale, LumiProducer::L1Data::prescale, makeHLTPrescaleTable::prescales, LumiProducer::L1Data::ratecount, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, and LumiProducer::PerRunData::TRGBitNames.

Referenced by beginLuminosityBlockProduce().

551  {
552  //initialize cache
553  if(m_isNullRun) return;
554  m_lscache.clear();
555  for(unsigned int n=luminum;n<luminum+m_cachesize;++n){
556  PerLSData l;
557  l.hltdata.reserve(250);
558  l.l1data.reserve(192);
559  l.bunchlumivalue.reserve(5);
560  l.bunchlumierror.reserve(5);
561  l.bunchlumiquality.reserve(5);
562  l.beam1intensity.resize(3564,0.0);
563  l.beam2intensity.resize(3564,0.0);
564  m_lscache.insert(std::make_pair(n,l));
565  }
566  //queries once per cache refill
567  //
568  //select cmslsnum,instlumi,startorbit,numorbit,bxindex,beam1intensity,beam2intensity,bxlumivalue_occ1,bxlumivalue_occ2,bxlumivalue_et from lumisummaryv2 where cmslsnum>=:lsmin and cmslsnum<:lsmax and data_id=:lumidataid;
569  //
571  if( !mydbservice.isAvailable() ){
572  throw cms::Exception("Non existing service lumi::service::DBService");
573  }
574  coral::ISessionProxy* session=mydbservice->connectReadOnly(m_connectStr);
575  try{
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));
582  lumisummaryBindVariables["lumidataid"].data<unsigned long long>()=m_cachedlumidataid;
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();
597  lumisummaryQuery->addToTableList(lumi::LumiNames::lumisummaryv2TableName());
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>();
615  //std::cout<<"cmslsnum "<<cmslsnum<<std::endl;
616  PerLSData& lsdata=m_lscache[cmslsnum];
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>();
622 
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());
636 
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];
646  }
647  if(ib2Max>i && lsb2Max>idx){
648  lsdata.beam2intensity.at(idx)=beam2intensity[i];
649  }
650  }
651  ::free(bxindex);
652  ::free(beam1intensity);
653  ::free(beam2intensity);
654 
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)));
673 
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)));
683  }
684  ++rowcounter;
685  }
686  if (rowcounter==0){
687  m_isNullRun=true;
688  return;
689  }
690  delete lumisummaryQuery;
691 
692  //
693  //select cmslsnum,deadtimecount,bitzerocount,bitzeroprescale,prescaleblob,trgcountblob from lstrg where cmslsnum >=:luminum and cmslsnum<:luminum+cachesize AND data_id=:trgdataid;
694  //
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;
701  trgBindVariables["trgdataid"].data<unsigned long long>()=m_cachedtrgdataid;
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));
709 
710  coral::IQuery* trgQuery=schema.newQuery();
711  trgQuery->addToTableList(lumi::LumiNames::lstrgTableName());
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>();
724  PerLSData& lsdata=m_lscache[cmslsnum];
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){
738  L1Data l1tmp;
739  l1tmp.bitname=m_runcache.TRGBitNames[i];
740  l1tmp.prescale=prescales[i];
741  l1tmp.ratecount=trgcounts[i];
742  lsdata.l1data.push_back(l1tmp);
743  }
744  ::free(prescales);
745  ::free(trgcounts);
746  }
747  }
748  delete trgQuery;
749  //
750  //select cmslsnum,hltcountblob,hltacceptblob,prescaleblob from hlt where cmslsnum >=:luminum and cmslsnum<=:luminum+cachesize and data_id=:hltdataid
751  //
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;
758  hltBindVariables["hltdataid"].data<unsigned long long>()=m_cachedhltdataid;
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();
765  hltQuery->addToTableList(lumi::LumiNames::lshltTableName());
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>();
776  PerLSData& lsdata=m_lscache[cmslsnum];
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);
791  if(nhltaccepts > 0 && m_runcache.HLTPathNames.size() == 0){
792  edm::LogWarning("CorruptOrMissingHLTData")<<"Got "<<nhltaccepts
793 <<" hltaccepts, but the run chache is empty. hltdata will not be written";
794  break;
795  }
796 
797  for(unsigned int i=0;i<sizeof(hltaccepts)/sizeof(unsigned int);++i){
798  HLTData hlttmp;
799  hlttmp.pathname=m_runcache.HLTPathNames[i];
800  hlttmp.prescale=hltprescales[i];
801  hlttmp.l1passcount=hltcounts[i];
802  hlttmp.acceptcount=hltaccepts[i];
803  lsdata.hltdata.push_back(hlttmp);
804  }
805  ::free(hltprescales);
806  ::free(hltcounts);
807  ::free(hltaccepts);
808  }
809  }
810  delete hltQuery;
811  session->transaction().commit();
812  }catch(const coral::Exception& er){
813  session->transaction().rollback();
814  mydbservice->disconnect(session);
815  throw cms::Exception("DatabaseError ")<<er.what();
816  }
817  mydbservice->disconnect(session);
818 }
int i
Definition: DBlmapReader.cc:9
static const std::string lshltTableName()
Definition: LumiNames.cc:44
unsigned long long m_cachedhltdataid
static const std::string lstrgTableName()
Definition: LumiNames.cc:32
std::string m_connectStr
bool isAvailable() const
Definition: Service.h:47
unsigned long long m_cachedtrgdataid
void disconnect(coral::ISessionProxy *session)
Definition: DBService.cc:46
unsigned long long m_cachedlumidataid
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::map< unsigned int, PerLSData > m_lscache
std::vector< std::string > TRGBitNames
static const std::string lumisummaryv2TableName()
Definition: LumiNames.cc:14
unsigned int m_cachesize
coral::ISessionProxy * connectReadOnly(const std::string &connectstring)
Definition: DBService.cc:42
std::vector< std::string > HLTPathNames
PerRunData m_runcache
bool LumiProducer::fillLumi ( edm::LuminosityBlock iLBlock)
private
void LumiProducer::fillRunCache ( const coral::ISchema &  schema,
unsigned int  runnumber 
)
private

Definition at line 484 of file LumiProducer.cc.

References LumiProducer::PerRunData::bitzeroname, gather_cfg::cout, getCurrentDataTag(), lumi::LumiNames::hltdataTableName(), LumiProducer::PerRunData::HLTPathNames, LumiProducer::PerRunData::HLTPathNameToIndex, i, m_cachedhltdataid, m_cachedtrgdataid, m_runcache, lumiPlot::pathnames, AlCaHLTBitMon_QueryRunRegistry::string, LumiProducer::PerRunData::TRGBitNames, LumiProducer::PerRunData::TRGBitNameToIndex, and lumi::LumiNames::trgdataTableName().

Referenced by beginRun().

484  {
485  if(m_lumiversion.empty()){
487  }
488  std::cout<<"lumi tag version 2 "<<m_lumiversion<<std::endl;
489  if(m_cachedtrgdataid!=0){
490  coral::AttributeList trgBindVariables;
491  trgBindVariables.extend("trgdataid",typeid(unsigned long long));
492  trgBindVariables["trgdataid"].data<unsigned long long>()=m_cachedtrgdataid;
493  //std::cout<<"cached trgdataid "<<m_cachedtrgdataid<<std::endl;
494  coral::AttributeList trgOutput;
495  trgOutput.extend("bitzeroname",typeid(std::string));
496  trgOutput.extend("bitnameclob",typeid(std::string));
497  coral::IQuery* trgQuery=schema.newQuery();
498  trgQuery->addToTableList(lumi::LumiNames::trgdataTableName());
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();
506  m_runcache.bitzeroname=row["bitzeroname"].data<std::string>();
507  //std::cout<<"bitzeroname "<<m_runcache.bitzeroname<<std::endl;
508  std::string bitnames=row["bitnameclob"].data<std::string>();
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){
512  m_runcache.TRGBitNames.push_back(*tok_it);
513  }
514  for(unsigned int i=0;i<m_runcache.TRGBitNames.size();++i){
515  m_runcache.TRGBitNameToIndex.insert(std::make_pair(m_runcache.TRGBitNames.at(i),i) );
516  }
517  }
518  delete trgQuery;
519  }
520  if(m_cachedhltdataid!=0){
521  //
522  //select pathnameclob from hltdata where data_id=:hltdataid
523  //
524  coral::AttributeList hltBindVariables;
525  hltBindVariables.extend("hltdataid",typeid(unsigned long long));
526  hltBindVariables["hltdataid"].data<unsigned long long>()=m_cachedhltdataid;
527  coral::AttributeList hltOutput;
528  hltOutput.extend("PATHNAMECLOB",typeid(std::string));
529  coral::IQuery* hltQuery=schema.newQuery();
530  hltQuery->addToTableList(lumi::LumiNames::hltdataTableName());
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();
537  std::string pathnames=row["PATHNAMECLOB"].data<std::string>();
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){
541  m_runcache.HLTPathNames.push_back(*tok_it);
542  }
543  for(unsigned int i=0;i<m_runcache.HLTPathNames.size();++i){
544  m_runcache.HLTPathNameToIndex.insert(std::make_pair(m_runcache.HLTPathNames.at(i),i));
545  }
546  }
547  delete hltQuery;
548  }
549 }
int i
Definition: DBlmapReader.cc:9
static const std::string trgdataTableName()
Definition: LumiNames.cc:29
unsigned long long m_cachedhltdataid
boost::tokenizer< boost::char_separator< char > > tokenizer
static const std::string hltdataTableName()
Definition: LumiNames.cc:41
std::map< std::string, unsigned int > HLTPathNameToIndex
tuple pathnames
Definition: lumiPlot.py:411
unsigned long long m_cachedtrgdataid
std::vector< std::string > TRGBitNames
std::string m_lumiversion
std::string getCurrentDataTag(const coral::ISchema &schema)
tuple cout
Definition: gather_cfg.py:121
std::vector< std::string > HLTPathNames
std::map< std::string, unsigned int > TRGBitNameToIndex
PerRunData m_runcache
std::string LumiProducer::getCurrentDataTag ( const coral::ISchema &  schema)
private

Definition at line 383 of file LumiProducer.cc.

References lumiTag::alltags, query::result, AlCaHLTBitMon_QueryRunRegistry::string, createPayload::tagname, and lumi::LumiNames::tagsTableName().

Referenced by fillRunCache().

383  {
384  //select tagid,tagname from tags
386  std::map<unsigned long long,std::string> alltags;
387  coral::IQuery* tagQuery=schema.newQuery();
388  tagQuery->addToTableList(lumi::LumiNames::tagsTableName());
389  tagQuery->addToOutputList("TAGID");
390  tagQuery->addToOutputList("TAGNAME");
391  coral::AttributeList tagoutput;
392  tagoutput.extend("TAGID",typeid(unsigned long long));
393  tagoutput.extend("TAGNAME",typeid(std::string));
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>();
399  const std::string tagname=row["TAGNAME"].data<std::string>();
400  alltags.insert(std::make_pair(tagid,tagname));
401  }
402  delete tagQuery;
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){
406  maxid=it->first;
407  }
408  }
409  result=alltags[maxid];
410  return result;
411 }
tuple result
Definition: query.py:137
static const std::string tagsTableName()
Definition: LumiNames.cc:50
tuple alltags
Definition: lumiTag.py:77
unsigned long long LumiProducer::getHltDataId ( const coral::ISchema &  schema,
unsigned int  runnumber 
)
private

Definition at line 356 of file LumiProducer.cc.

References lumi::LumiNames::hltdataTableName().

Referenced by beginRun().

356  {
357  //
358  //select max(data_id) from hltdata where runnum=:runnum
359  //
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();
367  hltQuery->addToTableList(lumi::LumiNames::hltdataTableName());
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>();
376  }
377  }
378  delete hltQuery;
379  return hltdataid;
380 }
static const std::string hltdataTableName()
Definition: LumiNames.cc:41
unsigned long long LumiProducer::getLumiDataId ( const coral::ISchema &  schema,
unsigned int  runnumber 
)
private

Definition at line 303 of file LumiProducer.cc.

References lumi::LumiNames::lumidataTableName().

Referenced by beginRun().

303  {
304  //
305  //select max(data_id) from lumidata where runnum=:runnum
306  //
307  //std::count<<"entering getLumiDataId "<<std::endl;
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();
315  lumiQuery->addToTableList(lumi::LumiNames::lumidataTableName());
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>();
324  }
325  }
326  delete lumiQuery;
327  return lumidataid;
328 }
static const std::string lumidataTableName()
Definition: LumiNames.cc:5
unsigned long long LumiProducer::getTrgDataId ( const coral::ISchema &  schema,
unsigned int  runnumber 
)
private

Definition at line 330 of file LumiProducer.cc.

References lumi::LumiNames::trgdataTableName().

Referenced by beginRun().

330  {
331  //
332  //select max(data_id) from trgdata where runnum=:runnum
333  //
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();
341  trgQuery->addToTableList(lumi::LumiNames::trgdataTableName());
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>();
350  }
351  }
352  delete trgQuery;
353  return trgdataid;
354 }
static const std::string trgdataTableName()
Definition: LumiNames.cc:29
void LumiProducer::produce ( edm::Event e,
const edm::EventSetup iSetup 
)
finaloverrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 299 of file LumiProducer.cc.

300 {
301 }
XMLCh * LumiProducer::s2x ( const std::string &  input) const
private

Definition at line 176 of file LumiProducer.cc.

Referenced by servletTranslation().

176  {
177  XMLCh* buff = xercesc::XMLString::transcode(temp.c_str());
178  return buff;
179 }
const std::string LumiProducer::servletTranslation ( const std::string &  servlet) const
private

Definition at line 209 of file LumiProducer.cc.

References asciidump::doc, alignCSCRings::e, m_siteconfpath, geometryXMLtoCSV::parser, s2x(), AlCaHLTBitMon_QueryRunRegistry::string, and toParentString().

209  {
210  std::string frontierConnect;
211  std::string realconnect;
212  xercesc::XMLPlatformUtils::Initialize();
213  std::auto_ptr< xercesc::XercesDOMParser > parser(new xercesc::XercesDOMParser);
214  try{
215  parser->setValidationScheme(xercesc::XercesDOMParser::Val_Auto);
216  parser->setDoNamespaces(false);
217  parser->parse(m_siteconfpath.c_str());
218  xercesc::DOMDocument* doc=parser->getDocument();
219  if(!doc){
220  return "";
221  }
222 
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));
226  frontierConnect = toParentString(*frontierConnectElement);
227  }
228  // Replace the last component of every "serverurl=" piece (up to the
229  // next close-paren) with the servlet
230  std::string::size_type nextparen = 0;
231  std::string::size_type serverurl, lastslash;
232  std::string complexstr = "";
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);
239  }
240  realconnect.append(frontierConnect, nextparen,frontierConnect.length()-nextparen);
241  }catch(xercesc::DOMException &e){
242  }
243  return realconnect;
244 }
XMLCh * s2x(const std::string &input) const
uint16_t size_type
std::string toParentString(const xercesc::DOMNode &nodeToConvert) const
tuple doc
Definition: asciidump.py:381
std::string m_siteconfpath
std::string LumiProducer::toParentString ( const xercesc::DOMNode &  nodeToConvert) const
private

Definition at line 182 of file LumiProducer.cc.

References asciidump::attributes, i, j, and x2s().

Referenced by servletTranslation().

182  {
183  std::ostringstream oss;
184  xercesc::DOMNodeList *childList = nodeToConvert.getChildNodes();
185 
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)
190  continue;
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)
197  continue;
198  xercesc::DOMAttr *attribute = static_cast <xercesc::DOMAttr *> (attributeNode);
199 
200  oss << "(" << x2s(child->getTagName()) <<
201  x2s(attribute->getName()) << "=" <<
202  x2s(attribute->getValue()) << ")";
203  }
204  }
205  return oss.str();
206 }
int i
Definition: DBlmapReader.cc:9
std::string x2s(const XMLCh *input) const
list attributes
Definition: asciidump.py:415
int j
Definition: DBlmapReader.cc:9
void LumiProducer::writeProductsForEntry ( edm::LuminosityBlock iLBlock,
unsigned int  runnumber,
unsigned int  luminum 
)
private

Definition at line 820 of file LumiProducer.cc.

References LumiProducer::PerLSData::beam1intensity, LumiProducer::PerLSData::beam2intensity, LumiProducer::PerLSData::bitzerocount, LumiProducer::PerLSData::bitzeroprescale, LumiProducer::PerLSData::bunchlumierror, LumiProducer::PerLSData::bunchlumiquality, LumiProducer::PerLSData::bunchlumivalue, LumiProducer::PerLSData::deadcount, LumiDetails::fill(), LumiDetails::fillBeamIntensities(), LumiProducer::PerLSData::hltdata, LumiProducer::PerRunData::HLTPathNameToIndex, i, LumiDetails::kET, LumiDetails::kOCC1, LumiDetails::kOCC2, LumiDetails::kPLT, LumiProducer::PerLSData::l1data, LumiProducer::PerLSData::lumierror, LumiProducer::PerLSData::lumiquality, LumiProducer::PerLSData::lumivalue, m_isNullRun, m_lscache, m_runcache, LumiProducer::PerLSData::numorbit, LumiSummary::HLT::pathnameidx, LumiSummary::L1::prescale, LumiSummary::HLT::prescale, edm::LuminosityBlock::put(), LumiSummary::setBitZeroCount(), LumiSummary::setDeadCount(), LumiSummary::setlsnumber(), LumiSummary::setLumiData(), LumiDetails::setLumiVersion(), LumiSummary::setLumiVersion(), LumiSummary::setOrbitData(), LumiProducer::PerLSData::startorbit, AlCaHLTBitMon_QueryRunRegistry::string, LumiSummary::swapHLTData(), LumiSummary::swapL1Data(), LumiProducer::PerRunData::TRGBitNameToIndex, and LumiSummary::L1::triggernameidx.

Referenced by beginLuminosityBlockProduce().

820  {
821  //std::cout<<"writing runnumber,luminum "<<runnumber<<" "<<luminum<<std::endl;
822  std::auto_ptr<LumiSummary> pOut1;
823  std::auto_ptr<LumiDetails> pOut2;
824  LumiSummary* pIn1=new LumiSummary;
825  LumiDetails* pIn2=new LumiDetails;
826  if(m_isNullRun){
827  pIn1->setLumiVersion("-1");
828  pIn2->setLumiVersion("-1");
829  pOut1.reset(pIn1);
830  iLBlock.put(pOut1);
831  pOut2.reset(pIn2);
832  iLBlock.put(pOut2);
833  return;
834  }
835  PerLSData& lsdata=m_lscache[luminum];
836  pIn1->setLumiData(lsdata.lumivalue,lsdata.lumierror,lsdata.lumiquality);
837  pIn1->setDeadCount(lsdata.deadcount);
838  if(!lsdata.l1data.empty()){
839  //std::cout<<"bitzerocount "<<lsdata.bitzerocount<<std::endl;
840  //std::cout<<"bitzeroprescale "<<lsdata.bitzeroprescale<<std::endl;
841  //std::cout<<"product "<<lsdata.bitzerocount*lsdata.bitzeroprescale<<std::endl;
842  pIn1->setBitZeroCount(lsdata.bitzerocount*lsdata.bitzeroprescale);
843  }
844  pIn1->setlsnumber(luminum);
845  pIn1->setOrbitData(lsdata.startorbit,lsdata.numorbit);
846  std::vector<LumiSummary::L1> l1temp;
847  for(std::vector< L1Data >::iterator it=lsdata.l1data.begin();it!=lsdata.l1data.end();++it){
848  LumiSummary::L1 trgtmp;
849  trgtmp.triggernameidx=m_runcache.TRGBitNameToIndex[it->bitname];
850  trgtmp.prescale=it->prescale;
851  l1temp.push_back(trgtmp);
852  }
853  std::vector<LumiSummary::HLT> hlttemp;
854  for(std::vector< HLTData >::iterator it=lsdata.hltdata.begin();it!=lsdata.hltdata.end();++it){
855  LumiSummary::HLT hlttmp;
856  hlttmp.pathnameidx=m_runcache.HLTPathNameToIndex[it->pathname];;
857  hlttmp.prescale=it->prescale;
858  hlttemp.push_back(hlttmp);
859  }
860  pIn1->swapL1Data(l1temp);
861  pIn1->swapHLTData(hlttemp);
863  pIn2->fillBeamIntensities(lsdata.beam1intensity,lsdata.beam2intensity);
864  for(unsigned int i=0;i<lsdata.bunchlumivalue.size();++i){
865  std::string algoname=lsdata.bunchlumivalue[i].first;
866  if(algoname=="OCC1"){
867  pIn2->fill(LumiDetails::kOCC1,lsdata.bunchlumivalue[i].second,lsdata.bunchlumierror[i].second,lsdata.bunchlumiquality[i].second);
868  }else if(algoname=="OCC2"){
869  pIn2->fill(LumiDetails::kOCC2,lsdata.bunchlumivalue[i].second,lsdata.bunchlumierror[i].second,lsdata.bunchlumiquality[i].second);
870  }else if(algoname=="ET"){
871  pIn2->fill(LumiDetails::kET,lsdata.bunchlumivalue[i].second,lsdata.bunchlumierror[i].second,lsdata.bunchlumiquality[i].second);
872  }else if(algoname=="PLT"){
873  pIn2->fill(LumiDetails::kPLT,lsdata.bunchlumivalue[i].second,lsdata.bunchlumierror[i].second,lsdata.bunchlumiquality[i].second);
874  }
875  }
877  pOut1.reset(pIn1);
878  iLBlock.put(pOut1);
879  pOut2.reset(pIn2);
880  iLBlock.put(pOut2);
881 }
int i
Definition: DBlmapReader.cc:9
void swapHLTData(std::vector< HLT > &hltdata)
Definition: LumiSummary.cc:155
void setLumiVersion(std::string const &lumiVersion)
Definition: LumiDetails.cc:36
void setlsnumber(unsigned int lsnumber)
Definition: LumiSummary.cc:142
std::map< std::string, unsigned int > HLTPathNameToIndex
unsigned int prescale
Definition: LumiSummary.h:27
void setOrbitData(unsigned int startorbit, unsigned int numorbit)
Definition: LumiSummary.cc:146
void fill(AlgoType algo, std::vector< float > const &values, std::vector< float > const &errors, std::vector< short > const &qualities)
Definition: LumiDetails.cc:51
void setLumiVersion(const std::string &lumiversion)
Definition: LumiSummary.cc:124
void setLumiData(float instlumi, float instlumierr, short lumiquality)
Definition: LumiSummary.cc:128
void setBitZeroCount(unsigned long long bitzerocount)
Definition: LumiSummary.cc:138
std::map< unsigned int, PerLSData > m_lscache
void setDeadCount(unsigned long long deadcount)
Definition: LumiSummary.cc:134
void swapL1Data(std::vector< L1 > &l1data)
Definition: LumiSummary.cc:151
void fillBeamIntensities(std::vector< float > const &beam1Intensities, std::vector< float > const &beam2Intensities)
Definition: LumiDetails.cc:74
std::string m_lumiversion
std::map< std::string, unsigned int > TRGBitNameToIndex
PerRunData m_runcache
unsigned int prescale
Definition: LumiSummary.h:33
void put(std::auto_ptr< PROD > product)
Put a new product.
std::string LumiProducer::x2s ( const XMLCh *  input) const
private

Definition at line 170 of file LumiProducer.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

Referenced by toParentString().

170  {
171  std::string tmp(xercesc::XMLString::transcode(toTranscode));
172  return tmp;
173 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Data Documentation

unsigned long long LumiProducer::m_cachedhltdataid
private

Definition at line 158 of file LumiProducer.cc.

Referenced by beginRun(), fillLSCache(), and fillRunCache().

unsigned long long LumiProducer::m_cachedlumidataid
private

Definition at line 156 of file LumiProducer.cc.

Referenced by beginRun(), and fillLSCache().

unsigned int LumiProducer::m_cachedrun
private

Definition at line 155 of file LumiProducer.cc.

Referenced by beginRun().

unsigned long long LumiProducer::m_cachedtrgdataid
private

Definition at line 157 of file LumiProducer.cc.

Referenced by beginRun(), fillLSCache(), and fillRunCache().

unsigned int LumiProducer::m_cachesize
private

Definition at line 162 of file LumiProducer.cc.

Referenced by fillLSCache().

std::string LumiProducer::m_connectStr
private

Definition at line 152 of file LumiProducer.cc.

Referenced by beginRun(), and fillLSCache().

bool LumiProducer::m_isNullRun
private
std::map< unsigned int,PerLSData > LumiProducer::m_lscache
private
std::string LumiProducer::m_lumiversion
private

Definition at line 153 of file LumiProducer.cc.

PerRunData LumiProducer::m_runcache
private

Definition at line 159 of file LumiProducer.cc.

Referenced by endRunProduce(), fillLSCache(), fillRunCache(), and writeProductsForEntry().

std::string LumiProducer::m_siteconfpath
private

Definition at line 154 of file LumiProducer.cc.

Referenced by servletTranslation().