#include <RecoLuminosity/LumiProducer/src/LumiProducer.cc>
Classes | |
struct | HLTData |
struct | L1Data |
struct | PerLSData |
struct | PerRunData |
Public Member Functions | |
LumiProducer (const edm::ParameterSet &) | |
~LumiProducer () | |
Private Member Functions | |
virtual void | beginLuminosityBlock (edm::LuminosityBlock &iLBlock, edm::EventSetup const &iSetup) |
virtual void | beginRun (edm::Run &, edm::EventSetup const &) |
virtual void | endLuminosityBlock (edm::LuminosityBlock &lumiBlock, edm::EventSetup const &c) |
void | fillLSCache (unsigned int luminum) |
bool | fillLumi (edm::LuminosityBlock &iLBlock) |
void | fillRunCache (unsigned int runnumber) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
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 int | m_cachedrun |
unsigned int | m_cachesize |
std::string | m_connectStr |
bool | m_isNullRun |
std::map< unsigned int, PerLSData > | m_lscache |
std::string | m_lumiversion |
PerRunData | m_runcache |
std::string | m_siteconfpath |
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 75 of file LumiProducer.cc.
LumiProducer::LumiProducer | ( | const edm::ParameterSet & | ) | [explicit] |
LumiProducer::~LumiProducer | ( | ) |
Definition at line 271 of file LumiProducer.cc.
{ }
void LumiProducer::beginLuminosityBlock | ( | edm::LuminosityBlock & | iLBlock, |
edm::EventSetup const & | iSetup | ||
) | [private, virtual] |
void LumiProducer::beginRun | ( | edm::Run & | run, |
edm::EventSetup const & | iSetup | ||
) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 278 of file LumiProducer.cc.
References fillRunCache(), m_cachedrun, edm::RunBase::run(), and cond::runnumber.
{ unsigned int runnumber=run.run(); m_cachedrun=runnumber; fillRunCache(runnumber); }
void LumiProducer::endLuminosityBlock | ( | edm::LuminosityBlock & | lumiBlock, |
edm::EventSetup const & | c | ||
) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 285 of file LumiProducer.cc.
References fillLSCache(), edm::LuminosityBlockBase::luminosityBlock(), m_isNullRun, m_lscache, edm::LuminosityBlock::put(), edm::LuminosityBlockBase::run(), cond::runnumber, and writeProductsForEntry().
{ unsigned int runnumber=iLBlock.run(); unsigned int luminum=iLBlock.luminosityBlock(); //if is null run, fill empty values and return if(m_isNullRun){ std::auto_ptr<LumiSummary> pOut1; std::auto_ptr<LumiDetails> pOut2; LumiSummary* pIn1=new LumiSummary; LumiDetails* pIn2=new LumiDetails; pOut1.reset(pIn1); iLBlock.put(pOut1); pOut2.reset(pIn2); iLBlock.put(pOut2); return; } if(m_lscache.find(luminum)==m_lscache.end()){ //if runnumber is cached but LS is not, this is the first LS, fill LS cache to full capacity fillLSCache(luminum); } //here the presence of ls is guaranteed writeProductsForEntry(iLBlock,runnumber,luminum); }
void LumiProducer::fillLSCache | ( | unsigned int | luminum | ) | [private] |
Definition at line 393 of file LumiProducer.cc.
References LumiProducer::HLTData::acceptcount, LumiProducer::PerLSData::beam1intensity, LumiProducer::PerLSData::beam2intensity, LumiProducer::L1Data::bitnum, LumiProducer::PerLSData::bunchlumierror, LumiProducer::PerLSData::bunchlumiquality, LumiProducer::PerLSData::bunchlumivalue, Exception, LumiProducer::PerLSData::hltdata, LumiProducer::PerRunData::HLTPathNames, lumi::LumiNames::hltTableName(), i, edm::Service< T >::isAvailable(), prof2calltree::l, LumiProducer::PerLSData::l1data, LumiProducer::HLTData::l1passcount, lumiCalc::lsdata, lumi::LumiNames::lumidetailTableName(), lumi::LumiNames::lumisummaryTableName(), m_cachedrun, m_cachesize, m_connectStr, m_isNullRun, m_lscache, m_runcache, n, LumiProducer::HLTData::pathnum, LumiProducer::HLTData::prescale, python::IdGenerator::schema, python::CommonUtils::session, and lumi::LumiNames::trgTableName().
Referenced by endLuminosityBlock().
{ //std::cout<<"in fillLSCache "<<luminum<<std::endl; //initialize cache if(m_isNullRun) return; m_lscache.clear(); for(unsigned int n=luminum;n<luminum+m_cachesize;++n){ PerLSData l; l.hltdata.reserve(250); l.l1data.reserve(192); l.bunchlumivalue.reserve(5); l.bunchlumierror.reserve(5); l.bunchlumiquality.reserve(5); l.beam1intensity.resize(3564,0.0); l.beam2intensity.resize(3564,0.0); m_lscache.insert(std::make_pair(n,l)); } //queries once per cache refill // //select cmslsnum,instlumi,instlumierror,lumiquality,startorbit,numorbit,bxindex,beam1intensity,beam2intensity from lumisummary where cmslsnum>=:lsmin and cmslsnum<:lsmax and runnum=:runnumber ; // edm::Service<lumi::service::DBService> mydbservice; if( !mydbservice.isAvailable() ){ throw cms::Exception("Non existing service lumi::service::DBService"); } coral::ISessionProxy* session=mydbservice->connectReadOnly(m_connectStr); try{ session->transaction().start(true); coral::ISchema& schema=session->nominalSchema(); coral::AttributeList lumisummaryBindVariables; lumisummaryBindVariables.extend("runnum",typeid(unsigned int)); lumisummaryBindVariables.extend("lsmin",typeid(unsigned int)); lumisummaryBindVariables.extend("lsmax",typeid(unsigned int)); lumisummaryBindVariables["runnum"].data<unsigned int>()=m_cachedrun; lumisummaryBindVariables["lsmin"].data<unsigned int>()=luminum; lumisummaryBindVariables["lsmax"].data<unsigned int>()=luminum+m_cachesize; coral::AttributeList lumisummaryOutput; lumisummaryOutput.extend("cmslsnum",typeid(unsigned int)); lumisummaryOutput.extend("instlumi",typeid(float)); lumisummaryOutput.extend("instlumierror",typeid(float)); lumisummaryOutput.extend("instlumiquality",typeid(short)); lumisummaryOutput.extend("startorbit",typeid(unsigned int)); lumisummaryOutput.extend("numorbit",typeid(unsigned int)); lumisummaryOutput.extend("bxindexBlob",typeid(coral::Blob)); lumisummaryOutput.extend("beam1intensityBlob",typeid(coral::Blob)); lumisummaryOutput.extend("beam2intensityBlob",typeid(coral::Blob)); coral::IQuery* lumisummaryQuery=schema.newQuery(); lumisummaryQuery->addToTableList(lumi::LumiNames::lumisummaryTableName()); lumisummaryQuery->addToOutputList("CMSLSNUM","cmslsnum"); lumisummaryQuery->addToOutputList("INSTLUMI","instlumi"); lumisummaryQuery->addToOutputList("INSTLUMIERROR","instlumierror"); lumisummaryQuery->addToOutputList("INSTLUMIQUALITY","instlumiquality"); lumisummaryQuery->addToOutputList("STARTORBIT","startorbit"); lumisummaryQuery->addToOutputList("NUMORBIT","numorbit"); lumisummaryQuery->addToOutputList("CMSBXINDEXBLOB","bxindexBlob"); lumisummaryQuery->addToOutputList("BEAMINTENSITYBLOB_1","beam1intensityBlob"); lumisummaryQuery->addToOutputList("BEAMINTENSITYBLOB_2","beam2intensityBlob"); lumisummaryQuery->setCondition("RUNNUM=:runnum AND CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax",lumisummaryBindVariables); lumisummaryQuery->defineOutput(lumisummaryOutput); coral::ICursor& lumisummarycursor=lumisummaryQuery->execute(); unsigned int rowcounter=0; while( lumisummarycursor.next() ){ const coral::AttributeList& row=lumisummarycursor.currentRow(); unsigned int cmslsnum=row["cmslsnum"].data<unsigned int>(); //std::cout<<"cmslsnum "<<cmslsnum<<std::endl; PerLSData& lsdata=m_lscache[cmslsnum]; lsdata.lumivalue=row["instlumi"].data<float>(); lsdata.lumierror=row["instlumierror"].data<float>(); lsdata.lumiquality=row["instlumiquality"].data<short>(); lsdata.startorbit=row["startorbit"].data<unsigned int>(); lsdata.numorbit=row["numorbit"].data<unsigned int>(); if(!row["bxindexBlob"].isNull()){ const coral::Blob& bxindexBlob=row["bxindexBlob"].data<coral::Blob>(); const void* bxindex_StartAddress=bxindexBlob.startingAddress(); short* bxindex=(short*)::malloc(bxindexBlob.size()); const coral::Blob& beam1intensityBlob=row["beam1intensityBlob"].data<coral::Blob>(); const void* beam1intensityBlob_StartAddress=beam1intensityBlob.startingAddress(); float* beam1intensity=(float*)::malloc(beam1intensityBlob.size()); const coral::Blob& beam2intensityBlob=row["beam2intensityBlob"].data<coral::Blob>(); const void* beam2intensityBlob_StartAddress=beam2intensityBlob.startingAddress(); float* beam2intensity=(float*)::malloc(beam2intensityBlob.size()); std::memmove(bxindex,bxindex_StartAddress,bxindexBlob.size()); std::memmove(beam1intensity,beam1intensityBlob_StartAddress,beam1intensityBlob.size()); std::memmove(beam2intensity,beam2intensityBlob_StartAddress,beam2intensityBlob.size()); //std::cout<<"lsnum,pos,bxidx,beam1intensity,beam2intensity "<<std::endl; for(unsigned int i=0;i<bxindexBlob.size()/sizeof(short);++i){ unsigned int idx=bxindex[i]; lsdata.beam1intensity.at(idx)=beam1intensity[i]; lsdata.beam2intensity.at(idx)=beam2intensity[i]; //std::cout<<cmslsnum<<","<<i<<","<<idx<<","<<beam1intensity[i]<<","<<beam2intensity[i]<<std::endl; } ::free(bxindex); ::free(beam1intensity); ::free(beam2intensity); } ++rowcounter; } if (rowcounter==0){ m_isNullRun=true; return; } delete lumisummaryQuery; // //select lumisummary.cmslsnum,lumidetail.bxlumivalue,lumidetail.bxlumierror,lumidetail.bxlumiquality,lumidetail.algoname from lumisummary,lumidetail where lumisummary.lumisummary_id=lumidetail.lumisummary_id and lumisummary.runnum=:runnum and lumisummary.cmslsnum>=:luminum and lumisummary.cmslsnum<:luminum+cachesize order by lumidetail.algoname,lumisummary.cmslsnum // coral::AttributeList lumidetailBindVariables; lumidetailBindVariables.extend("runnum",typeid(unsigned int)); lumidetailBindVariables.extend("lsmin",typeid(unsigned int)); lumidetailBindVariables.extend("lsmax",typeid(unsigned int)); lumidetailBindVariables["runnum"].data<unsigned int>()=m_cachedrun; lumidetailBindVariables["lsmin"].data<unsigned int>()=luminum; lumidetailBindVariables["lsmax"].data<unsigned int>()=luminum+m_cachesize; coral::AttributeList lumidetailOutput; lumidetailOutput.extend("cmslsnum",typeid(unsigned int)); lumidetailOutput.extend("bxlumivalue",typeid(coral::Blob)); lumidetailOutput.extend("bxlumierror",typeid(coral::Blob)); lumidetailOutput.extend("bxlumiquality",typeid(coral::Blob)); lumidetailOutput.extend("algoname",typeid(std::string)); coral::IQuery* lumidetailQuery=schema.newQuery(); lumidetailQuery->addToTableList(lumi::LumiNames::lumisummaryTableName()); lumidetailQuery->addToTableList(lumi::LumiNames::lumidetailTableName()); lumidetailQuery->addToOutputList(lumi::LumiNames::lumisummaryTableName()+".CMSLSNUM","cmslsnum"); lumidetailQuery->addToOutputList(lumi::LumiNames::lumidetailTableName()+".BXLUMIVALUE","bxlumivalue"); lumidetailQuery->addToOutputList(lumi::LumiNames::lumidetailTableName()+".BXLUMIERROR","bxlumierror"); lumidetailQuery->addToOutputList(lumi::LumiNames::lumidetailTableName()+".BXLUMIQUALITY","instlumiquality"); lumidetailQuery->addToOutputList(lumi::LumiNames::lumidetailTableName()+".ALGONAME","algoname"); lumidetailQuery->setCondition(lumi::LumiNames::lumisummaryTableName()+".LUMISUMMARY_ID="+lumi::LumiNames::lumidetailTableName()+".LUMISUMMARY_ID AND "+lumi::LumiNames::lumisummaryTableName()+".RUNNUM=:runnum AND "+lumi::LumiNames::lumisummaryTableName()+".CMSLSNUM>=:lsmin AND "+lumi::LumiNames::lumisummaryTableName()+".CMSLSNUM<:lsmax",lumidetailBindVariables); lumidetailQuery->addToOrderList(lumi::LumiNames::lumidetailTableName()+".ALGONAME"); lumidetailQuery->addToOrderList(lumi::LumiNames::lumisummaryTableName()+".CMSLSNUM"); lumidetailQuery->defineOutput(lumidetailOutput); coral::ICursor& lumidetailcursor=lumidetailQuery->execute(); while( lumidetailcursor.next() ){ const coral::AttributeList& row=lumidetailcursor.currentRow(); unsigned int cmslsnum=row["cmslsnum"].data<unsigned int>(); std::string algoname=row["algoname"].data<std::string>(); //std::cout<<"cmslsnum "<<cmslsnum<<" "<<algoname<<std::endl; PerLSData& lsdata=m_lscache[cmslsnum]; if( !row["bxlumivalue"].isNull() && !row["bxlumierror"].isNull() && !row["bxlumiquality"].isNull() ){ const coral::Blob& bxlumivalueBlob=row["bxlumivalue"].data<coral::Blob>(); const coral::Blob& bxlumierrorBlob=row["bxlumierror"].data<coral::Blob>(); const coral::Blob& bxlumiqualityBlob=row["bxlumiquality"].data<coral::Blob>(); const void* bxlumivalueBlob_StartAddress=bxlumivalueBlob.startingAddress(); const void* bxlumierrorBlob_StartAddress=bxlumierrorBlob.startingAddress(); const void* bxlumiqualityBlob_StartAddress=bxlumiqualityBlob.startingAddress(); float* bxlumivalue=(float*)::malloc(bxlumivalueBlob.size()); float* bxlumierror=(float*)::malloc(bxlumierrorBlob.size()); short* bxlumiquality=(short*)::malloc(bxlumiqualityBlob.size()); std::memmove(bxlumivalue,bxlumivalueBlob_StartAddress,bxlumivalueBlob.size()); std::memmove(bxlumierror,bxlumierrorBlob_StartAddress,bxlumierrorBlob.size()); std::memmove(bxlumiquality,bxlumiqualityBlob_StartAddress,bxlumiqualityBlob.size()); std::vector<float> bxlumivalueVec(bxlumivalue,bxlumivalue+bxlumivalueBlob.size()/sizeof(float)); ::free(bxlumivalue); lsdata.bunchlumivalue.push_back(std::make_pair(algoname,bxlumivalueVec)); std::vector<float> bxlumierrorVec(bxlumierror,bxlumierror+bxlumierrorBlob.size()/sizeof(float)); ::free(bxlumierror); lsdata.bunchlumierror.push_back(std::make_pair(algoname,bxlumierrorVec)); std::vector<short> bxlumiqualityVec(bxlumiquality,bxlumiquality+bxlumiqualityBlob.size()/sizeof(short)); lsdata.bunchlumiquality.push_back(std::make_pair(algoname,bxlumiqualityVec)); ::free(bxlumiquality); } } delete lumidetailQuery; // //select cmslsnum,bitnum,deadtime,prescale,trgcount from trg where cmslsnum >=:luminum and cmslsnum<:luminum+cachesize AND runnum=:runnum order by cmslsnum,bitnum // coral::AttributeList trgBindVariables; trgBindVariables.extend("runnum",typeid(unsigned int)); trgBindVariables.extend("lsmin",typeid(unsigned int)); trgBindVariables.extend("lsmax",typeid(unsigned int)); trgBindVariables["runnum"].data<unsigned int>()=m_cachedrun; trgBindVariables["lsmin"].data<unsigned int>()=luminum; trgBindVariables["lsmax"].data<unsigned int>()=luminum+m_cachesize; coral::AttributeList trgOutput; trgOutput.extend("cmslsnum",typeid(unsigned int)); trgOutput.extend("bitnum",typeid(unsigned int)); trgOutput.extend("deadtime",typeid(unsigned long long)); trgOutput.extend("prescale",typeid(unsigned int)); trgOutput.extend("trgcount",typeid(unsigned int)); coral::IQuery* trgQuery=schema.newQuery(); trgQuery->addToTableList(lumi::LumiNames::trgTableName()); trgQuery->addToOutputList("CMSLSNUM","cmslsnum"); trgQuery->addToOutputList("BITNUM","bitnum"); trgQuery->addToOutputList("DEADTIME","deadtime"); trgQuery->addToOutputList("PRESCALE","prescale"); trgQuery->addToOutputList("TRGCOUNT","trgcount"); trgQuery->setCondition("CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND RUNNUM=:runnum ",trgBindVariables); trgQuery->addToOrderList("CMSLSNUM"); trgQuery->addToOrderList("BITNUM"); trgQuery->defineOutput(trgOutput); coral::ICursor& trgcursor=trgQuery->execute(); while( trgcursor.next() ){ const coral::AttributeList& row=trgcursor.currentRow(); unsigned int cmslsnum=row["cmslsnum"].data<unsigned int>(); PerLSData& lsdata=m_lscache[cmslsnum]; lsdata.deadcount=row["deadtime"].data<unsigned long long>(); L1Data l1tmp; l1tmp.bitnum=row["bitnum"].data<unsigned int>(); l1tmp.prescale=row["prescale"].data<unsigned int>(); l1tmp.ratecount=row["trgcount"].data<unsigned int>(); lsdata.l1data.push_back(l1tmp); } delete trgQuery; // //select cmslsnum,inputcount,acceptcount,prescale from hlt where cmslsnum >=:luminum and cmslsnum<=:luminum+cachesize and runnum=:runnumber order by cmslsum,pathname // coral::AttributeList hltBindVariables; hltBindVariables.extend("runnum",typeid(unsigned int)); hltBindVariables.extend("lsmin",typeid(unsigned int)); hltBindVariables.extend("lsmax",typeid(unsigned int)); hltBindVariables["runnum"].data<unsigned int>()=m_cachedrun; hltBindVariables["lsmin"].data<unsigned int>()=luminum; hltBindVariables["lsmax"].data<unsigned int>()=luminum+m_cachesize; coral::AttributeList hltOutput; hltOutput.extend("cmslsnum",typeid(unsigned int)); hltOutput.extend("inputcount",typeid(unsigned int)); hltOutput.extend("acceptcount",typeid(unsigned int)); hltOutput.extend("prescale",typeid(unsigned int)); coral::IQuery* hltQuery=schema.newQuery(); hltQuery->addToTableList(lumi::LumiNames::hltTableName()); hltQuery->addToOutputList("CMSLSNUM","cmslsnum"); hltQuery->addToOutputList("INPUTCOUNT","inputcount"); hltQuery->addToOutputList("ACCEPTCOUNT","acceptcount"); hltQuery->addToOutputList("PRESCALE","prescale"); hltQuery->setCondition("CMSLSNUM>=:lsmin AND CMSLSNUM<:lsmax AND RUNNUM=:runnum",hltBindVariables); hltQuery->addToOrderList("CMSLSNUM"); hltQuery->addToOrderList("PATHNAME"); hltQuery->defineOutput(hltOutput); coral::ICursor& hltcursor=hltQuery->execute(); unsigned int npaths=m_runcache.HLTPathNames.size(); unsigned int pathcount=0; while( hltcursor.next() ){ const coral::AttributeList& row=hltcursor.currentRow(); unsigned int cmslsnum=row["cmslsnum"].data<unsigned int>(); PerLSData& lsdata=m_lscache[cmslsnum]; HLTData hlttmp; hlttmp.pathnum=pathcount; hlttmp.prescale=row["prescale"].data<unsigned int>(); hlttmp.l1passcount=row["inputcount"].data<unsigned int>(); hlttmp.acceptcount=row["acceptcount"].data<unsigned int>(); lsdata.hltdata.push_back(hlttmp); if(pathcount!=npaths){ ++pathcount; }else{ pathcount=0; } } delete hltQuery; session->transaction().commit(); }catch(const coral::Exception& er){ session->transaction().rollback(); mydbservice->disconnect(session); throw cms::Exception("DatabaseError ")<<er.what(); } mydbservice->disconnect(session); }
bool LumiProducer::fillLumi | ( | edm::LuminosityBlock & | iLBlock | ) | [private] |
void LumiProducer::fillRunCache | ( | unsigned int | runnumber | ) | [private] |
Definition at line 308 of file LumiProducer.cc.
References Exception, LumiProducer::PerRunData::HLTPathNames, lumi::LumiNames::hltTableName(), edm::Service< T >::isAvailable(), m_cachedrun, m_connectStr, m_isNullRun, m_runcache, cond::runnumber, python::IdGenerator::schema, python::CommonUtils::session, LumiProducer::PerRunData::TRGBitNames, and lumi::LumiNames::trgTableName().
Referenced by beginRun().
{ //queries once per run edm::Service<lumi::service::DBService> mydbservice; if( !mydbservice.isAvailable() ){ throw cms::Exception("Non existing service lumi::service::DBService"); } //std::cout<<"in fillRunCache "<<runnumber<<std::endl; coral::ISessionProxy* session=mydbservice->connectReadOnly(m_connectStr); try{ session->transaction().start(true); coral::ISchema& schema=session->nominalSchema(); // //select bitnum,bitname from trg where runnum=:runnum and cmslsnum=:1 order by bitnum; // //std::cout<<"got schema handle "<<std::endl; m_cachedrun=runnumber; coral::AttributeList trgBindVariables; trgBindVariables.extend("runnum",typeid(unsigned int)); trgBindVariables.extend("cmslsnum",typeid(unsigned int)); trgBindVariables["runnum"].data<unsigned int>()=runnumber; trgBindVariables["cmslsnum"].data<unsigned int>()=1; coral::AttributeList trgOutput; trgOutput.extend("bitnum",typeid(unsigned int)); trgOutput.extend("bitname",typeid(std::string)); coral::IQuery* trgQuery=schema.newQuery(); trgQuery->addToTableList(lumi::LumiNames::trgTableName()); trgQuery->addToOutputList("BITNUM"); trgQuery->addToOutputList("BITNAME"); trgQuery->setCondition("RUNNUM=:runnum AND CMSLSNUM=:cmslsnum",trgBindVariables); trgQuery->defineOutput(trgOutput); coral::ICursor& trgcursor=trgQuery->execute(); unsigned int rowcounter=0; while( trgcursor.next() ){ const coral::AttributeList& row=trgcursor.currentRow(); m_runcache.TRGBitNames.insert(std::make_pair(row["bitnum"].data<unsigned int>(),row["bitname"].data<std::string>())); ++rowcounter; } delete trgQuery; if (rowcounter==0){ m_isNullRun=true; session->transaction().commit(); mydbservice->disconnect(session); return; } // //select pathname from from hlt where runnum=:runnum and cmslsnum=:1 order by pathname; // coral::AttributeList hltBindVariables; hltBindVariables.extend("runnum",typeid(unsigned int)); hltBindVariables.extend("cmslsnum",typeid(unsigned int)); hltBindVariables["runnum"].data<unsigned int>()=runnumber; hltBindVariables["cmslsnum"].data<unsigned int>()=1; coral::AttributeList hltOutput; hltOutput.extend("pathname",typeid(std::string)); coral::IQuery* hltQuery=schema.newQuery(); hltQuery->addToTableList(lumi::LumiNames::hltTableName()); hltQuery->addToOutputList("PATHNAME"); hltQuery->setCondition("RUNNUM=:runnum AND CMSLSNUM=:cmslsnum",hltBindVariables); hltQuery->addToOrderList("PATHNAME"); hltQuery->defineOutput(hltOutput); coral::ICursor& hltcursor=hltQuery->execute(); rowcounter=0; unsigned int pathcount=0; while( hltcursor.next() ){ const coral::AttributeList& row=hltcursor.currentRow(); m_runcache.HLTPathNames.insert(std::make_pair(pathcount,row["pathname"].data<std::string>())); ++pathcount; ++rowcounter; } delete hltQuery; if (rowcounter==0){ m_isNullRun=true; session->transaction().commit(); mydbservice->disconnect(session); return; } session->transaction().commit(); }catch(const coral::Exception& er){ session->transaction().rollback(); mydbservice->disconnect(session); throw cms::Exception("DatabaseError ")<<er.what(); } mydbservice->disconnect(session); }
void LumiProducer::produce | ( | edm::Event & | e, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
XMLCh * LumiProducer::s2x | ( | const std::string & | input | ) | const [private] |
Definition at line 155 of file LumiProducer.cc.
Referenced by servletTranslation().
{ XMLCh* buff = xercesc::XMLString::transcode(temp.c_str()); return buff; }
const std::string LumiProducer::servletTranslation | ( | const std::string & | servlet | ) | const [private] |
Definition at line 188 of file LumiProducer.cc.
References asciidump::doc, m_siteconfpath, geometryXMLtoCSV::parser, s2x(), and toParentString().
{ std::string frontierConnect; std::string realconnect; xercesc::XMLPlatformUtils::Initialize(); std::auto_ptr< xercesc::XercesDOMParser > parser(new xercesc::XercesDOMParser); try{ parser->setValidationScheme(xercesc::XercesDOMParser::Val_Auto); parser->setDoNamespaces(false); parser->parse(m_siteconfpath.c_str()); xercesc::DOMDocument* doc=parser->getDocument(); if(!doc){ return ""; } xercesc::DOMNodeList *frontierConnectList=doc->getElementsByTagName(s2x("frontier-connect")); if (frontierConnectList->getLength()>0){ xercesc::DOMElement *frontierConnectElement=static_cast < xercesc::DOMElement *> (frontierConnectList->item (0)); frontierConnect = toParentString(*frontierConnectElement); } // Replace the last component of every "serverurl=" piece (up to the // next close-paren) with the servlet std::string::size_type nextparen = 0; std::string::size_type serverurl, lastslash; std::string complexstr = ""; while ((serverurl=frontierConnect.find("(serverurl=", nextparen)) != std::string::npos){ realconnect.append(frontierConnect, nextparen, serverurl - nextparen); nextparen=frontierConnect.find(')', serverurl); lastslash=frontierConnect.rfind('/', nextparen); realconnect.append(frontierConnect,serverurl,lastslash-serverurl+1); realconnect.append(servlet); } realconnect.append(frontierConnect, nextparen,frontierConnect.length()-nextparen); }catch(xercesc::DOMException &e){ } return realconnect; }
std::string LumiProducer::toParentString | ( | const xercesc::DOMNode & | nodeToConvert | ) | const [private] |
Definition at line 161 of file LumiProducer.cc.
References asciidump::attributes, i, j, and x2s().
Referenced by servletTranslation().
{ std::ostringstream oss; xercesc::DOMNodeList *childList = nodeToConvert.getChildNodes(); unsigned int numNodes = childList->getLength (); for (unsigned int i = 0; i < numNodes; ++i){ xercesc::DOMNode *childNode = childList->item(i); if (childNode->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) continue; xercesc::DOMElement *child = static_cast < xercesc::DOMElement *> (childNode); xercesc::DOMNamedNodeMap *attributes = child->getAttributes(); unsigned int numAttributes = attributes->getLength (); for (unsigned int j = 0; j < numAttributes; ++j){ xercesc::DOMNode *attributeNode = attributes->item(j); if (attributeNode->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) continue; xercesc::DOMAttr *attribute = static_cast <xercesc::DOMAttr *> (attributeNode); oss << "(" << x2s(child->getTagName()) << x2s(attribute->getName()) << "=" << x2s(attribute->getValue()) << ")"; } } return oss.str(); }
void LumiProducer::writeProductsForEntry | ( | edm::LuminosityBlock & | iLBlock, |
unsigned int | runnumber, | ||
unsigned int | luminum | ||
) | [private] |
Definition at line 656 of file LumiProducer.cc.
References LumiProducer::PerLSData::beam1intensity, LumiProducer::PerLSData::beam2intensity, LumiProducer::PerLSData::bunchlumierror, LumiProducer::PerLSData::bunchlumiquality, LumiProducer::PerLSData::bunchlumivalue, LumiProducer::PerLSData::deadcount, LumiDetails::fill(), LumiDetails::fillBeamIntensities(), LumiProducer::PerLSData::hltdata, LumiProducer::PerRunData::HLTPathNames, i, LumiSummary::HLT::inputcount, LumiDetails::kET, LumiDetails::kOCC1, LumiDetails::kOCC2, LumiDetails::kPLT, LumiProducer::PerLSData::l1data, lumiCalc::lsdata, LumiProducer::PerLSData::lumierror, LumiProducer::PerLSData::lumiquality, LumiProducer::PerLSData::lumivalue, m_isNullRun, m_lscache, m_runcache, LumiProducer::PerLSData::numorbit, LumiSummary::HLT::pathname, LumiSummary::L1::prescale, LumiSummary::HLT::prescale, edm::LuminosityBlock::put(), LumiSummary::HLT::ratecount, LumiSummary::L1::ratecount, LumiSummary::setDeadtime(), LumiSummary::setlsnumber(), LumiSummary::setLumiData(), LumiDetails::setLumiVersion(), LumiSummary::setLumiVersion(), LumiSummary::setOrbitData(), LumiProducer::PerLSData::startorbit, LumiSummary::swapHLTData(), LumiSummary::swapL1Data(), LumiProducer::PerRunData::TRGBitNames, and LumiSummary::L1::triggername.
Referenced by endLuminosityBlock().
{ std::auto_ptr<LumiSummary> pOut1; std::auto_ptr<LumiDetails> pOut2; LumiSummary* pIn1=new LumiSummary; LumiDetails* pIn2=new LumiDetails; if(m_isNullRun){ pIn1->setLumiVersion("-1"); pIn2->setLumiVersion("-1"); pOut1.reset(pIn1); iLBlock.put(pOut1); pOut2.reset(pIn2); iLBlock.put(pOut2); return; } PerLSData& lsdata=m_lscache[luminum]; pIn1->setLumiData(lsdata.lumivalue,lsdata.lumierror,lsdata.lumiquality); pIn1->setDeadtime(lsdata.deadcount); pIn1->setlsnumber(luminum); pIn1->setOrbitData(lsdata.startorbit,lsdata.numorbit); std::vector<LumiSummary::L1> l1temp; for(std::vector< L1Data >::iterator it=lsdata.l1data.begin();it!=lsdata.l1data.end();++it){ LumiSummary::L1 trgtmp; trgtmp.prescale=it->prescale; trgtmp.ratecount=it->ratecount; trgtmp.triggername=m_runcache.TRGBitNames[it->bitnum]; l1temp.push_back(trgtmp); } std::vector<LumiSummary::HLT> hlttemp; for(std::vector< HLTData >::iterator it=lsdata.hltdata.begin();it!=lsdata.hltdata.end();++it){ LumiSummary::HLT hlttmp; hlttmp.prescale=it->prescale; hlttmp.ratecount=it->acceptcount; hlttmp.inputcount=it->l1passcount; hlttmp.pathname=m_runcache.HLTPathNames[it->pathnum]; hlttemp.push_back(hlttmp); } pIn1->swapL1Data(l1temp); pIn1->swapHLTData(hlttemp); pIn1->setLumiVersion(m_lumiversion); pIn2->fillBeamIntensities(lsdata.beam1intensity,lsdata.beam2intensity); for(unsigned int i=0;i<lsdata.bunchlumivalue.size();++i){ std::string algoname=lsdata.bunchlumivalue[i].first; if(algoname=="OCC1"){ pIn2->fill(LumiDetails::kOCC1,lsdata.bunchlumivalue[i].second,lsdata.bunchlumierror[i].second,lsdata.bunchlumiquality[i].second); }else if(algoname=="OCC2"){ pIn2->fill(LumiDetails::kOCC2,lsdata.bunchlumivalue[i].second,lsdata.bunchlumierror[i].second,lsdata.bunchlumiquality[i].second); }else if(algoname=="ET"){ pIn2->fill(LumiDetails::kET,lsdata.bunchlumivalue[i].second,lsdata.bunchlumierror[i].second,lsdata.bunchlumiquality[i].second); }else if(algoname=="PLT"){ pIn2->fill(LumiDetails::kPLT,lsdata.bunchlumivalue[i].second,lsdata.bunchlumierror[i].second,lsdata.bunchlumiquality[i].second); } } pIn2->setLumiVersion(m_lumiversion); pOut1.reset(pIn1); iLBlock.put(pOut1); pOut2.reset(pIn2); iLBlock.put(pOut2); }
std::string LumiProducer::x2s | ( | const XMLCh * | input | ) | const [private] |
unsigned int LumiProducer::m_cachedrun [private] |
Definition at line 137 of file LumiProducer.cc.
Referenced by beginRun(), fillLSCache(), and fillRunCache().
unsigned int LumiProducer::m_cachesize [private] |
Definition at line 141 of file LumiProducer.cc.
Referenced by fillLSCache().
std::string LumiProducer::m_connectStr [private] |
Definition at line 134 of file LumiProducer.cc.
Referenced by fillLSCache(), and fillRunCache().
bool LumiProducer::m_isNullRun [private] |
Definition at line 140 of file LumiProducer.cc.
Referenced by endLuminosityBlock(), fillLSCache(), fillRunCache(), and writeProductsForEntry().
std::map< unsigned int,PerLSData > LumiProducer::m_lscache [private] |
Definition at line 139 of file LumiProducer.cc.
Referenced by endLuminosityBlock(), fillLSCache(), and writeProductsForEntry().
std::string LumiProducer::m_lumiversion [private] |
Definition at line 135 of file LumiProducer.cc.
PerRunData LumiProducer::m_runcache [private] |
Definition at line 138 of file LumiProducer.cc.
Referenced by fillLSCache(), fillRunCache(), and writeProductsForEntry().
std::string LumiProducer::m_siteconfpath [private] |
Definition at line 136 of file LumiProducer.cc.
Referenced by servletTranslation().