CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DIPLumiProducer Class Reference

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

Inheritance diagram for DIPLumiProducer:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef std::shared_ptr< const DIPLumiDetailReturnDetailType
 
typedef std::shared_ptr< const DIPLumiSummaryReturnSummaryType
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 

Public Member Functions

 DIPLumiProducer (const edm::ParameterSet &)
 
ReturnDetailType produceDetail (const DIPLuminosityRcd &)
 
ReturnSummaryType produceSummary (const DIPLuminosityRcd &)
 
 ~DIPLumiProducer () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Protected Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollector setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Private Member Functions

void filldetailcache (unsigned int runnumber, unsigned int startlsnum)
 
void fillsummarycache (unsigned int runnumber, unsigned int startlsnum)
 
unsigned int maxavailableLSforRun (coral::ISchema &schema, const std::string &tablename, unsigned int runnumber)
 

Private Attributes

unsigned int m_cachesize
 
std::string m_connectStr
 
std::map< unsigned int, std::shared_ptr< const DIPLumiDetail > > m_detailcache
 
unsigned int m_detailcachedrun
 
std::shared_ptr< const DIPLumiDetailm_detailresult
 
bool m_isNullRun
 
const edm::IOVSyncValuem_pcurrentTime
 
std::map< unsigned int, std::shared_ptr< const DIPLumiSummary > > m_summarycache
 
unsigned int m_summarycachedrun
 
std::shared_ptr< const DIPLumiSummarym_summaryresult
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

HF Luminosity numbers from DIP. Only exist if stable beam. No data available for other beam status

Description: A essource/esproducer for lumi values from DIP via runtime logger DB

Definition at line 22 of file DIPLumiProducer.h.

Member Typedef Documentation

typedef std::shared_ptr<const DIPLumiDetail> DIPLumiProducer::ReturnDetailType

Definition at line 27 of file DIPLumiProducer.h.

typedef std::shared_ptr<const DIPLumiSummary> DIPLumiProducer::ReturnSummaryType

Definition at line 25 of file DIPLumiProducer.h.

Constructor & Destructor Documentation

DIPLumiProducer::DIPLumiProducer ( const edm::ParameterSet iConfig)

Definition at line 62 of file DIPLumiProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_cachesize, m_connectStr, produceDetail(), produceSummary(), edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

65  findingRecord<DIPLuminosityRcd>();
66  m_connectStr=iConfig.getParameter<std::string>("connect");
67  m_cachesize=iConfig.getUntrackedParameter<unsigned int>("ncacheEntries",3);
68 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:116
T getUntrackedParameter(std::string const &, T const &) const
unsigned int m_detailcachedrun
std::string m_connectStr
ReturnDetailType produceDetail(const DIPLuminosityRcd &)
unsigned int m_summarycachedrun
unsigned int m_cachesize
ReturnSummaryType produceSummary(const DIPLuminosityRcd &)
DIPLumiProducer::~DIPLumiProducer ( )
override

Definition at line 346 of file DIPLumiProducer.cc.

References DEFINE_FWK_EVENTSETUP_SOURCE.

346 {}

Member Function Documentation

void DIPLumiProducer::filldetailcache ( unsigned int  runnumber,
unsigned int  startlsnum 
)
private

Definition at line 266 of file DIPLumiProducer.cc.

References lumi::service::DBService::connectReadOnly(), Exception, edm::Service< T >::isAvailable(), m_cachesize, m_connectStr, m_detailcache, m_detailcachedrun, m_summarycachedrun, maxavailableLSforRun(), eostools::move(), cond::runnumber, dataDML::schema, dataDML::session, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produceDetail().

266  {
267  m_detailcache.clear();
269 
270  std::map< unsigned int,std::unique_ptr<DIPLumiDetail> > detailcache;
271  //
272  //queries once per cache refill
273  //
274  //select lumisection,bunch,bunchlumi from cms_runtime_logger.bunch_lumi_sections where lumisection>=:lsmin and lumisection<:lsmax and runnumber=:runnumber ;
275  //
277  if( !mydbservice.isAvailable() ){
278  throw cms::Exception("Non existing service lumi::service::DBService");
279  }
280  auto session=mydbservice->connectReadOnly(m_connectStr);
281  coral::ITypeConverter& tconverter=session->typeConverter();
282  tconverter.setCppTypeForSqlType(std::string("float"),std::string("FLOAT(63)"));
283  tconverter.setCppTypeForSqlType(std::string("unsigned int"),std::string("NUMBER(10)"));
284  unsigned int lsmin=1;
285  unsigned int lsmax=currentlsnum;
286  try{
287  session->transaction().start(true);
288  coral::ISchema& schema=session->nominalSchema();
289  unsigned int maxavailableLS=maxavailableLSforRun(schema,std::string("BUNCH_LUMI_SECTIONS"),m_summarycachedrun);
290  if(maxavailableLS!=0 &&maxavailableLS<currentlsnum ){
291  lsmax=maxavailableLS;
292  }else if(maxavailableLS==0){
293  //this run not existing (yet)
294  session->transaction().commit();
295  return;
296  }
297  if(m_cachesize!=0){
298  lsmin=(lsmax-m_cachesize)>0 ? (lsmax-m_cachesize+1) : 1;
299  }
300  coral::AttributeList lumidetailBindVariables;
301  lumidetailBindVariables.extend("lsmin",typeid(unsigned int));
302  lumidetailBindVariables.extend("lsmax",typeid(unsigned int));
303  lumidetailBindVariables.extend("runnumber",typeid(unsigned int));
304  lumidetailBindVariables["runnumber"].data<unsigned int>()=m_detailcachedrun;
305  lumidetailBindVariables["lsmin"].data<unsigned int>()=lsmin;
306  lumidetailBindVariables["lsmax"].data<unsigned int>()=lsmax;
307  std::string conditionStr("RUNNUMBER=:runnumber AND LUMISECTION>=:lsmin AND LUMISECTION<=:lsmax AND BUNCHLUMI>0 ");
308  coral::AttributeList lumidetailOutput;
309  lumidetailOutput.extend("LUMISECTION",typeid(unsigned int));
310  lumidetailOutput.extend("BUNCH",typeid(unsigned int));
311  lumidetailOutput.extend("BUNCHLUMI",typeid(float));
312  coral::IQuery* lumidetailQuery=schema.newQuery();
313  lumidetailQuery->addToTableList(std::string("BUNCH_LUMI_SECTIONS"));
314  lumidetailQuery->addToOutputList("LUMISECTION");
315  lumidetailQuery->addToOutputList("BUNCH");
316  lumidetailQuery->addToOutputList("BUNCHLUMI");
317  lumidetailQuery->setCondition(conditionStr,lumidetailBindVariables);
318  lumidetailQuery->defineOutput(lumidetailOutput);
319  coral::ICursor& lumidetailcursor=lumidetailQuery->execute();
320  while( lumidetailcursor.next() ){
321  const coral::AttributeList& row=lumidetailcursor.currentRow();
322  unsigned int lsnum=row["LUMISECTION"].data<unsigned int>();
323  if(detailcache.find(lsnum)==detailcache.end()){
324  detailcache.insert(std::make_pair(lsnum,std::make_unique<DIPLumiDetail>()));
325  detailcache[lsnum]->setOrigin(m_detailcachedrun,lsnum);
326  }
327  if(!row["BUNCH"].isNull()){
328  unsigned int bxidx=row["BUNCH"].data<unsigned int>();
329  float bxlumi=0.0;
330  if(!row["BUNCHLUMI"].isNull()){
331  bxlumi=row["BUNCHLUMI"].data<float>();//Hz/ub
332  }
333  detailcache[lsnum]->fillbxdata(bxidx,bxlumi);
334  }
335  }
336  for(auto & item : detailcache) {
337  m_detailcache[item.first] = std::move(item.second);
338  }
339  delete lumidetailQuery;
340  session->transaction().commit();
341  }catch(const coral::Exception& er){
342  session->transaction().rollback();
343  throw cms::Exception("DatabaseError ")<<er.what();
344  }
345 }
unsigned int m_detailcachedrun
ISessionProxyPtr connectReadOnly(const std::string &connectstring)
Definition: DBService.cc:22
std::string m_connectStr
bool isAvailable() const
Definition: Service.h:46
unsigned int m_summarycachedrun
std::map< unsigned int, std::shared_ptr< const DIPLumiDetail > > m_detailcache
unsigned int m_cachesize
unsigned int maxavailableLSforRun(coral::ISchema &schema, const std::string &tablename, unsigned int runnumber)
def move(src, dest)
Definition: eostools.py:511
void DIPLumiProducer::fillsummarycache ( unsigned int  runnumber,
unsigned int  startlsnum 
)
private

Definition at line 145 of file DIPLumiProducer.cc.

References lumi::service::DBService::connectReadOnly(), Exception, edm::Service< T >::isAvailable(), m_cachesize, m_connectStr, m_summarycache, m_summarycachedrun, maxavailableLSforRun(), eostools::move(), cond::runnumber, dataDML::schema, dataDML::session, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produceSummary().

145  {
146  m_summarycache.clear();
148  //
149  // queries once per cache refill
150  //
151  // select max(lumi_sections) as maxavailable from cms_runtime_logger.lumi_sections where runnumber=:runnumber;
152  //
153  // if maxavailable<currentls: get lsmax=maxavailable ; else: get lsmax=currentls
154  // lsmin=lsmax-cachesize
155  // select runnumber,lumisection,instlumi,delivlumi,livelumi from cms_runtime_logger.lumi_sections where lumisection>=:lsmin and lumisection<=:lsmax and runnumber=:runnumber;
156  //
158  if( !mydbservice.isAvailable() ){
159  throw cms::Exception("Non existing service lumi::service::DBService");
160  }
161  auto session=mydbservice->connectReadOnly(m_connectStr);
162  coral::ITypeConverter& tconverter=session->typeConverter();
163  tconverter.setCppTypeForSqlType(std::string("float"),std::string("FLOAT(63)"));
164  tconverter.setCppTypeForSqlType(std::string("unsigned int"),std::string("NUMBER(10)"));
165  tconverter.setCppTypeForSqlType(std::string("unsigned short"),std::string("NUMBER(1)"));
166  unsigned int lsmin=1;
167  unsigned int lsmax=currentlsnum;
168  try{
169  session->transaction().start(true);
170  coral::ISchema& schema=session->nominalSchema();
171  unsigned int maxavailableLS=maxavailableLSforRun(schema,std::string("LUMI_SECTIONS"),m_summarycachedrun);
172  if(maxavailableLS!=0 && maxavailableLS<currentlsnum){
173  lsmax=maxavailableLS;
174  }else if(maxavailableLS==0){
175  //this run not existing (yet)
176  session->transaction().commit();
177  return;
178  }
179  if(m_cachesize!=0){
180  lsmin=(lsmax-m_cachesize)>0 ? (lsmax-m_cachesize+1) : 1;
181  }
182  //std::cout<<"lsmin "<<lsmin<<" lsmax "<<lsmax<<std::endl;
183  coral::AttributeList lumisummaryBindVariables;
184  lumisummaryBindVariables.extend("lsmin",typeid(unsigned int));
185  lumisummaryBindVariables.extend("lsmax",typeid(unsigned int));
186  lumisummaryBindVariables.extend("runnumber",typeid(unsigned int));
187  lumisummaryBindVariables["runnumber"].data<unsigned int>()=m_summarycachedrun;
188  lumisummaryBindVariables["lsmin"].data<unsigned int>()=lsmin;
189  lumisummaryBindVariables["lsmax"].data<unsigned int>()=lsmax;
190  std::string conditionStr("RUNNUMBER=:runnumber AND LUMISECTION>=:lsmin AND LUMISECTION<=:lsmax");
191  coral::AttributeList lumisummaryOutput;
192  lumisummaryOutput.extend("LUMISECTION",typeid(unsigned int));
193  lumisummaryOutput.extend("INSTLUMI",typeid(float));
194  lumisummaryOutput.extend("DELIVLUMISECTION",typeid(float));
195  lumisummaryOutput.extend("LIVELUMISECTION",typeid(float));
196  lumisummaryOutput.extend("CMS_ACTIVE",typeid(unsigned short));
197  coral::IQuery* lumisummaryQuery=schema.newQuery();
198  lumisummaryQuery->addToTableList(std::string("LUMI_SECTIONS"));
199  lumisummaryQuery->addToOutputList("LUMISECTION");
200  lumisummaryQuery->addToOutputList("INSTLUMI");
201  lumisummaryQuery->addToOutputList("DELIVLUMISECTION");
202  lumisummaryQuery->addToOutputList("LIVELUMISECTION");
203  lumisummaryQuery->addToOutputList("CMS_ACTIVE");
204  lumisummaryQuery->setCondition(conditionStr,lumisummaryBindVariables);
205  lumisummaryQuery->defineOutput(lumisummaryOutput);
206  coral::ICursor& lumisummarycursor=lumisummaryQuery->execute();
207  while( lumisummarycursor.next() ){
208  const coral::AttributeList& row=lumisummarycursor.currentRow();
209  unsigned int lsnum=row["LUMISECTION"].data<unsigned int>();
210  float instlumi=0.0;
211  if(!row["INSTLUMI"].isNull()){
212  instlumi=row["INSTLUMI"].data<float>();//Hz/ub
213  }
214  float intgdellumi=0.0;
215  if(!row["DELIVLUMISECTION"].isNull()){
216  intgdellumi=row["DELIVLUMISECTION"].data<float>()*1000.0;//convert to /ub
217  }
218  float intgreclumi=0.0;
219  if(!row["LIVELUMISECTION"].isNull()){
220  intgreclumi=row["LIVELUMISECTION"].data<float>()*1000.0;//convert to /ub
221  }
222  unsigned short cmsalive=0;
223  if(!row["CMS_ACTIVE"].isNull()){
224  cmsalive=row["CMS_ACTIVE"].data<unsigned short>();
225  }
226  auto tmpls = std::make_unique<DIPLumiSummary>(instlumi,intgdellumi,intgreclumi,cmsalive);
227  tmpls->setOrigin(m_summarycachedrun,lsnum);
228  //std::cout<<"filling "<<lsnum<<std::endl;
229  std::shared_ptr<const DIPLumiSummary> const_tmpls = std::move(tmpls);
230  m_summarycache.insert(std::make_pair(lsnum,const_tmpls));
231  }
232  delete lumisummaryQuery;
233  session->transaction().commit();
234  }catch(const coral::Exception& er){
235  session->transaction().rollback();
236  throw cms::Exception("DatabaseError ")<<er.what();
237  }
238 }
ISessionProxyPtr connectReadOnly(const std::string &connectstring)
Definition: DBService.cc:22
std::string m_connectStr
std::map< unsigned int, std::shared_ptr< const DIPLumiSummary > > m_summarycache
bool isAvailable() const
Definition: Service.h:46
unsigned int m_summarycachedrun
unsigned int m_cachesize
unsigned int maxavailableLSforRun(coral::ISchema &schema, const std::string &tablename, unsigned int runnumber)
def move(src, dest)
Definition: eostools.py:511
unsigned int DIPLumiProducer::maxavailableLSforRun ( coral::ISchema &  schema,
const std::string &  tablename,
unsigned int  runnumber 
)
private

select max(lumisection) as maxavailable from cms_runtime_logger.lumi_sections where runnumber=:runnumber;

Definition at line 240 of file DIPLumiProducer.cc.

References mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by filldetailcache(), and fillsummarycache().

240  {
244  unsigned int result=0;
245  coral::AttributeList bindVariables;
246  bindVariables.extend("runnumber",typeid(unsigned int));
247  bindVariables["runnumber"].data<unsigned int>()=runnumber;
248  std::string conditionStr("RUNNUMBER=:runnumber");
249  coral::AttributeList MyOutput;
250  MyOutput.extend("maxavailablels",typeid(unsigned int));
251  coral::IQuery* myQuery=schema.newQuery();
252  myQuery->addToTableList(tablename);
253  myQuery->addToOutputList("max(LUMISECTION)","maxavailablels");
254  myQuery->setCondition(conditionStr,bindVariables);
255  myQuery->defineOutput(MyOutput);
256  coral::ICursor& mycursor=myQuery->execute();
257  while( mycursor.next() ){
258  const coral::AttributeList& row=mycursor.currentRow();
259  if(!row["maxavailablels"].isNull()){
260  result=row["maxavailablels"].data<unsigned int>();
261  }
262  }
263  return result;
264 }
DIPLumiProducer::ReturnDetailType DIPLumiProducer::produceDetail ( const DIPLuminosityRcd )

Definition at line 103 of file DIPLumiProducer.cc.

References edm::IOVSyncValue::eventID(), filldetailcache(), edm::IOVSyncValue::luminosityBlockNumber(), m_detailcache, m_detailcachedrun, m_detailresult, m_pcurrentTime, genParticles_cff::map, edm::EventID::run(), and findQualityFiles::v.

Referenced by DIPLumiProducer().

104 {
105  unsigned int currentrun=m_pcurrentTime->eventID().run();
106  unsigned int currentls=m_pcurrentTime->luminosityBlockNumber();
107  if(currentls==0||currentls==4294967295){
108  return std::make_shared<const DIPLumiDetail>();
109  }
110  if(m_detailcachedrun!=currentrun){//i'm in a new run
111  filldetailcache(currentrun,currentls);//starting ls
112  }else{ //i'm in an known run
113  if(m_detailcache.find(currentls)==m_detailcache.end()){//i'm in a unknown ls
114  filldetailcache(currentrun,currentls);//cache all ls>=currentls
115  }
116  }
117  if(m_detailcache.empty()){
118  return std::make_shared<const DIPLumiDetail>();
119  }
120  if(m_detailcache.find(currentls)==m_detailcache.end()){
121  std::vector<unsigned int> v;
122  for(std::map<unsigned int,std::shared_ptr<const DIPLumiDetail> >::iterator it=m_detailcache.begin();it!=m_detailcache.end();++it){
123  v.push_back(it->first);
124  }
125  m_detailresult=m_detailcache[v.back()];
126  }else{
127  m_detailresult=m_detailcache[currentls];
128  }
129  if(m_detailresult.get()==nullptr){
130  return std::make_shared<const DIPLumiDetail>();
131  }
132  return m_detailresult;
133 }
RunNumber_t run() const
Definition: EventID.h:39
unsigned int m_detailcachedrun
const EventID & eventID() const
Definition: IOVSyncValue.h:42
LuminosityBlockNumber_t luminosityBlockNumber() const
Definition: IOVSyncValue.h:43
std::map< unsigned int, std::shared_ptr< const DIPLumiDetail > > m_detailcache
void filldetailcache(unsigned int runnumber, unsigned int startlsnum)
const edm::IOVSyncValue * m_pcurrentTime
std::shared_ptr< const DIPLumiDetail > m_detailresult
DIPLumiProducer::ReturnSummaryType DIPLumiProducer::produceSummary ( const DIPLuminosityRcd )

Definition at line 71 of file DIPLumiProducer.cc.

References edm::IOVSyncValue::eventID(), fillsummarycache(), edm::IOVSyncValue::luminosityBlockNumber(), m_pcurrentTime, m_summarycache, m_summarycachedrun, m_summaryresult, genParticles_cff::map, edm::EventID::run(), and findQualityFiles::v.

Referenced by DIPLumiProducer().

72 {
73  unsigned int currentrun=m_pcurrentTime->eventID().run();
74  unsigned int currentls=m_pcurrentTime->luminosityBlockNumber();
75  if(currentls==0||currentls==4294967295){
76  return std::make_shared<const DIPLumiSummary>();
77  }
78  if(m_summarycachedrun!=currentrun){//i'm in a new run
79  fillsummarycache(currentrun,currentls);//starting ls
80  }else{ //i'm in an old run
81  if(m_summarycache.find(currentls)==m_summarycache.end()){//i'm not cached
82  fillsummarycache(currentrun,currentls);//
83  }
84  }
85  if(m_summarycache.empty()){
86  return std::make_shared<const DIPLumiSummary>();
87  }
88  if(m_summarycache.find(currentls)==m_summarycache.end()){
89  std::vector<unsigned int> v;
90  for(std::map<unsigned int,std::shared_ptr<const DIPLumiSummary> >::iterator it=m_summarycache.begin();it!=m_summarycache.end();++it){
91  v.push_back(it->first);
92  }
94  }else{
96  }
97  if(m_summaryresult.get()==nullptr){
98  return std::make_shared<const DIPLumiSummary>();
99  }
100  return m_summaryresult;
101 }
RunNumber_t run() const
Definition: EventID.h:39
const EventID & eventID() const
Definition: IOVSyncValue.h:42
std::shared_ptr< const DIPLumiSummary > m_summaryresult
std::map< unsigned int, std::shared_ptr< const DIPLumiSummary > > m_summarycache
LuminosityBlockNumber_t luminosityBlockNumber() const
Definition: IOVSyncValue.h:43
unsigned int m_summarycachedrun
const edm::IOVSyncValue * m_pcurrentTime
void fillsummarycache(unsigned int runnumber, unsigned int startlsnum)
void DIPLumiProducer::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey iKey,
const edm::IOVSyncValue iTime,
edm::ValidityInterval oValidity 
)
overrideprotectedvirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 136 of file DIPLumiProducer.cc.

References m_pcurrentTime, edm::ValidityInterval::setFirst(), and edm::ValidityInterval::setLast().

138  {
139  m_pcurrentTime=&iTime;
140  oValidity.setFirst(iTime);
141  oValidity.setLast(iTime);
142 }
void setFirst(const IOVSyncValue &iTime)
void setLast(const IOVSyncValue &iTime)
const edm::IOVSyncValue * m_pcurrentTime

Member Data Documentation

unsigned int DIPLumiProducer::m_cachesize
private

Definition at line 44 of file DIPLumiProducer.h.

Referenced by DIPLumiProducer(), filldetailcache(), and fillsummarycache().

std::string DIPLumiProducer::m_connectStr
private

Definition at line 38 of file DIPLumiProducer.h.

Referenced by DIPLumiProducer(), filldetailcache(), and fillsummarycache().

std::map< unsigned int,std::shared_ptr<const DIPLumiDetail> > DIPLumiProducer::m_detailcache
private

Definition at line 40 of file DIPLumiProducer.h.

Referenced by filldetailcache(), and produceDetail().

unsigned int DIPLumiProducer::m_detailcachedrun
private

Definition at line 43 of file DIPLumiProducer.h.

Referenced by filldetailcache(), and produceDetail().

std::shared_ptr<const DIPLumiDetail> DIPLumiProducer::m_detailresult
private

Definition at line 46 of file DIPLumiProducer.h.

Referenced by produceDetail().

bool DIPLumiProducer::m_isNullRun
private

Definition at line 41 of file DIPLumiProducer.h.

const edm::IOVSyncValue* DIPLumiProducer::m_pcurrentTime
private

Definition at line 47 of file DIPLumiProducer.h.

Referenced by produceDetail(), produceSummary(), and setIntervalFor().

std::map< unsigned int,std::shared_ptr<const DIPLumiSummary> > DIPLumiProducer::m_summarycache
private

Definition at line 39 of file DIPLumiProducer.h.

Referenced by fillsummarycache(), and produceSummary().

unsigned int DIPLumiProducer::m_summarycachedrun
private

Definition at line 42 of file DIPLumiProducer.h.

Referenced by filldetailcache(), fillsummarycache(), and produceSummary().

std::shared_ptr<const DIPLumiSummary> DIPLumiProducer::m_summaryresult
private

Definition at line 45 of file DIPLumiProducer.h.

Referenced by produceSummary().