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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 81 of file LumiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 292 of file LumiProducer.cc.

292  {
293 }

Member Function Documentation

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

Definition at line 445 of file LumiProducer.cc.

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

446 {
447  unsigned int runnumber=iLBlock.run();
448  unsigned int luminum=iLBlock.luminosityBlock();
449  //std::cout<<"beg of beginLuminosityBlock "<<luminum<<std::endl;
450  //if is null run, fill empty values and return
451  if(m_isNullRun){
452  std::auto_ptr<LumiSummary> pOut1;
453  std::auto_ptr<LumiDetails> pOut2;
454  LumiSummary* pIn1=new LumiSummary;
455  LumiDetails* pIn2=new LumiDetails;
456  pOut1.reset(pIn1);
457  iLBlock.put(pOut1);
458  pOut2.reset(pIn2);
459  iLBlock.put(pOut2);
460  return;
461  }
462  if(m_lscache.find(luminum)==m_lscache.end()){
463  //if runnumber is cached but LS is not, this is the first LS, fill LS cache to full capacity
464  fillLSCache(luminum);
465  }
466  //here the presence of ls is guaranteed
467  writeProductsForEntry(iLBlock,runnumber,luminum);
468 }
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 413 of file LumiProducer.cc.

References lumi::service::DBService::connectReadOnly(), lumi::service::DBService::disconnect(), 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 models::session.

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

Definition at line 470 of file LumiProducer.cc.

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

Definition at line 473 of file LumiProducer.cc.

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

474 {
475  std::auto_ptr<LumiSummaryRunHeader> lsrh(new LumiSummaryRunHeader());
476  lsrh->swapL1Names(m_runcache.TRGBitNames);
477  lsrh->swapHLTNames(m_runcache.HLTPathNames);
478  run.put(lsrh);
481 }
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:112
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 550 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(), Exception, LumiProducer::PerLSData::hltdata, LumiProducer::PerRunData::HLTPathNames, i, customizeTrackingMonitorSeedNumber::idx, edm::Service< T >::isAvailable(), cmsLHEtoEOSManager::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, gen::n, LumiProducer::HLTData::pathname, LumiProducer::HLTData::prescale, LumiProducer::L1Data::prescale, makeHLTPrescaleTable::prescales, LumiProducer::L1Data::ratecount, dataDML::schema, models::session, AlCaHLTBitMon_QueryRunRegistry::string, and LumiProducer::PerRunData::TRGBitNames.

Referenced by beginLuminosityBlockProduce().

550  {
551  //initialize cache
552  if(m_isNullRun) return;
553  m_lscache.clear();
554  for(unsigned int n=luminum;n<luminum+m_cachesize;++n){
555  PerLSData l;
556  l.hltdata.reserve(250);
557  l.l1data.reserve(192);
558  l.bunchlumivalue.reserve(5);
559  l.bunchlumierror.reserve(5);
560  l.bunchlumiquality.reserve(5);
561  l.beam1intensity.resize(3564,0.0);
562  l.beam2intensity.resize(3564,0.0);
563  m_lscache.insert(std::make_pair(n,l));
564  }
565  //queries once per cache refill
566  //
567  //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;
568  //
570  if( !mydbservice.isAvailable() ){
571  throw cms::Exception("Non existing service lumi::service::DBService");
572  }
573  coral::ISessionProxy* session=mydbservice->connectReadOnly(m_connectStr);
574  try{
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));
581  lumisummaryBindVariables["lumidataid"].data<unsigned long long>()=m_cachedlumidataid;
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();
596  lumisummaryQuery->addToTableList(lumi::LumiNames::lumisummaryv2TableName());
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>();
614  //std::cout<<"cmslsnum "<<cmslsnum<<std::endl;
615  PerLSData& lsdata=m_lscache[cmslsnum];
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>();
621 
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());
635 
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];
645  }
646  if(ib2Max>i && lsb2Max>idx){
647  lsdata.beam2intensity.at(idx)=beam2intensity[i];
648  }
649  }
650  ::free(bxindex);
651  ::free(beam1intensity);
652  ::free(beam2intensity);
653 
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)));
672 
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)));
682  }
683  ++rowcounter;
684  }
685  if (rowcounter==0){
686  m_isNullRun=true;
687  return;
688  }
689  delete lumisummaryQuery;
690 
691  //
692  //select cmslsnum,deadtimecount,bitzerocount,bitzeroprescale,prescaleblob,trgcountblob from lstrg where cmslsnum >=:luminum and cmslsnum<:luminum+cachesize AND data_id=:trgdataid;
693  //
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;
700  trgBindVariables["trgdataid"].data<unsigned long long>()=m_cachedtrgdataid;
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));
708 
709  coral::IQuery* trgQuery=schema.newQuery();
710  trgQuery->addToTableList(lumi::LumiNames::lstrgTableName());
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>();
723  PerLSData& lsdata=m_lscache[cmslsnum];
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){
737  L1Data l1tmp;
738  l1tmp.bitname=m_runcache.TRGBitNames[i];
739  l1tmp.prescale=prescales[i];
740  l1tmp.ratecount=trgcounts[i];
741  lsdata.l1data.push_back(l1tmp);
742  }
743  ::free(prescales);
744  ::free(trgcounts);
745  }
746  }
747  delete trgQuery;
748  //
749  //select cmslsnum,hltcountblob,hltacceptblob,prescaleblob from hlt where cmslsnum >=:luminum and cmslsnum<=:luminum+cachesize and data_id=:hltdataid
750  //
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;
757  hltBindVariables["hltdataid"].data<unsigned long long>()=m_cachedhltdataid;
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();
764  hltQuery->addToTableList(lumi::LumiNames::lshltTableName());
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>();
775  PerLSData& lsdata=m_lscache[cmslsnum];
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);
790  if(nhltaccepts > 0 && m_runcache.HLTPathNames.size() == 0){
791  edm::LogWarning("CorruptOrMissingHLTData")<<"Got "<<nhltaccepts
792 <<" hltaccepts, but the run chache is empty. hltdata will not be written";
793  break;
794  }
795 
796  for(unsigned int i=0;i<sizeof(hltaccepts)/sizeof(unsigned int);++i){
797  HLTData hlttmp;
798  hlttmp.pathname=m_runcache.HLTPathNames[i];
799  hlttmp.prescale=hltprescales[i];
800  hlttmp.l1passcount=hltcounts[i];
801  hlttmp.acceptcount=hltaccepts[i];
802  lsdata.hltdata.push_back(hlttmp);
803  }
804  ::free(hltprescales);
805  ::free(hltcounts);
806  ::free(hltaccepts);
807  }
808  }
809  delete hltQuery;
810  session->transaction().commit();
811  }catch(const coral::Exception& er){
812  session->transaction().rollback();
813  mydbservice->disconnect(session);
814  throw cms::Exception("DatabaseError ")<<er.what();
815  }
816  mydbservice->disconnect(session);
817 }
int i
Definition: DBlmapReader.cc:9
tuple schema
Definition: dataDML.py:2334
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:46
unsigned long long m_cachedtrgdataid
void disconnect(coral::ISessionProxy *session)
Definition: DBService.cc:27
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:23
session
Definition: models.py:201
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 483 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, cmsHarvester::sep, AlCaHLTBitMon_QueryRunRegistry::string, LumiProducer::PerRunData::TRGBitNames, LumiProducer::PerRunData::TRGBitNameToIndex, and lumi::LumiNames::trgdataTableName().

Referenced by beginRun().

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

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

Referenced by fillRunCache().

382  {
383  //select tagid,tagname from tags
385  std::map<unsigned long long,std::string> alltags;
386  coral::IQuery* tagQuery=schema.newQuery();
387  tagQuery->addToTableList(lumi::LumiNames::tagsTableName());
388  tagQuery->addToOutputList("TAGID");
389  tagQuery->addToOutputList("TAGNAME");
390  coral::AttributeList tagoutput;
391  tagoutput.extend("TAGID",typeid(unsigned long long));
392  tagoutput.extend("TAGNAME",typeid(std::string));
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>();
398  const std::string tagname=row["TAGNAME"].data<std::string>();
399  alltags.insert(std::make_pair(tagid,tagname));
400  }
401  delete tagQuery;
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){
405  maxid=it->first;
406  }
407  }
408  result=alltags[maxid];
409  return result;
410 }
tuple schema
Definition: dataDML.py:2334
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 355 of file LumiProducer.cc.

References lumi::LumiNames::hltdataTableName().

Referenced by beginRun().

355  {
356  //
357  //select max(data_id) from hltdata where runnum=:runnum
358  //
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();
366  hltQuery->addToTableList(lumi::LumiNames::hltdataTableName());
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>();
375  }
376  }
377  delete hltQuery;
378  return hltdataid;
379 }
tuple schema
Definition: dataDML.py:2334
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 302 of file LumiProducer.cc.

References lumi::LumiNames::lumidataTableName().

Referenced by beginRun().

302  {
303  //
304  //select max(data_id) from lumidata where runnum=:runnum
305  //
306  //std::count<<"entering getLumiDataId "<<std::endl;
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();
314  lumiQuery->addToTableList(lumi::LumiNames::lumidataTableName());
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>();
323  }
324  }
325  delete lumiQuery;
326  return lumidataid;
327 }
tuple schema
Definition: dataDML.py:2334
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 329 of file LumiProducer.cc.

References lumi::LumiNames::trgdataTableName().

Referenced by beginRun().

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

Implements edm::one::EDProducerBase.

Definition at line 298 of file LumiProducer.cc.

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

Definition at line 175 of file LumiProducer.cc.

References XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by servletTranslation().

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

Definition at line 208 of file LumiProducer.cc.

References alignCSCRings::e, m_siteconfpath, geometryXMLtoCSV::parser, s2x(), AlCaHLTBitMon_QueryRunRegistry::string, toParentString(), and cms::concurrency::xercesInitialize().

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

Definition at line 181 of file LumiProducer.cc.

References i, j, and x2s().

Referenced by servletTranslation().

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

Definition at line 819 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().

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

Definition at line 169 of file LumiProducer.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, tmp, and XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by toParentString().

169  {
171  return tmp;
172 }
XMLCh * transcode(const T &fInput)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Data Documentation

unsigned long long LumiProducer::m_cachedhltdataid
private

Definition at line 157 of file LumiProducer.cc.

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

unsigned long long LumiProducer::m_cachedlumidataid
private

Definition at line 155 of file LumiProducer.cc.

Referenced by beginRun(), and fillLSCache().

unsigned int LumiProducer::m_cachedrun
private

Definition at line 154 of file LumiProducer.cc.

Referenced by beginRun().

unsigned long long LumiProducer::m_cachedtrgdataid
private

Definition at line 156 of file LumiProducer.cc.

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

unsigned int LumiProducer::m_cachesize
private

Definition at line 161 of file LumiProducer.cc.

Referenced by fillLSCache().

std::string LumiProducer::m_connectStr
private

Definition at line 151 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 152 of file LumiProducer.cc.

PerRunData LumiProducer::m_runcache
private

Definition at line 158 of file LumiProducer.cc.

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

std::string LumiProducer::m_siteconfpath
private

Definition at line 153 of file LumiProducer.cc.

Referenced by servletTranslation().