CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 boost::shared_ptr
< DIPLumiDetail
ReturnDetailType
 
typedef boost::shared_ptr
< DIPLumiSummary
ReturnSummaryType
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey,
edm::propagate_const
< std::shared_ptr< DataProxy > > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 

Public Member Functions

 DIPLumiProducer (const edm::ParameterSet &)
 
ReturnDetailType produceDetail (const DIPLuminosityRcd &)
 
ReturnSummaryType produceSummary (const DIPLuminosityRcd &)
 
 ~DIPLumiProducer ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- 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 ()
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const
eventsetup::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder ()
 

Protected Member Functions

virtual void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 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,
boost::shared_ptr
< DIPLumiDetail > > 
m_detailcache
 
unsigned int m_detailcachedrun
 
boost::shared_ptr< DIPLumiDetailm_detailresult
 
bool m_isNullRun
 
const edm::IOVSyncValuem_pcurrentTime
 
std::map< unsigned int,
boost::shared_ptr
< DIPLumiSummary > > 
m_summarycache
 
unsigned int m_summarycachedrun
 
boost::shared_ptr< 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

Definition at line 27 of file DIPLumiProducer.h.

Definition at line 25 of file DIPLumiProducer.h.

Constructor & Destructor Documentation

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

Definition at line 64 of file DIPLumiProducer.cc.

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

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

Definition at line 348 of file DIPLumiProducer.cc.

348 {}

Member Function Documentation

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

Definition at line 270 of file DIPLumiProducer.cc.

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

Referenced by produceDetail().

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

Definition at line 147 of file DIPLumiProducer.cc.

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

Referenced by produceSummary().

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

References inputsource_file_cfi::myQuery, query::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by filldetailcache(), and fillsummarycache().

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

Definition at line 105 of file DIPLumiProducer.cc.

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

Referenced by DIPLumiProducer().

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

Definition at line 73 of file DIPLumiProducer.cc.

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

Referenced by DIPLumiProducer().

74 {
75  unsigned int currentrun=m_pcurrentTime->eventID().run();
76  unsigned int currentls=m_pcurrentTime->luminosityBlockNumber();
77  if(currentls==0||currentls==4294967295){
78  return boost::shared_ptr<DIPLumiSummary>(new DIPLumiSummary());
79  }
80  if(m_summarycachedrun!=currentrun){//i'm in a new run
81  fillsummarycache(currentrun,currentls);//starting ls
82  }else{ //i'm in an old run
83  if(m_summarycache.find(currentls)==m_summarycache.end()){//i'm not cached
84  fillsummarycache(currentrun,currentls);//
85  }
86  }
87  if(m_summarycache.empty()){
88  return boost::shared_ptr<DIPLumiSummary>(new DIPLumiSummary());
89  }
90  if(m_summarycache.find(currentls)==m_summarycache.end()){
91  std::vector<unsigned int> v;
92  for(std::map<unsigned int,boost::shared_ptr<DIPLumiSummary> >::iterator it=m_summarycache.begin();it!=m_summarycache.end();++it){
93  v.push_back(it->first);
94  }
96  }else{
98  }
99  if(m_summaryresult.get()==0){
100  return boost::shared_ptr<DIPLumiSummary>(new DIPLumiSummary());
101  }
102  return m_summaryresult;
103 }
RunNumber_t run() const
Definition: EventID.h:39
boost::shared_ptr< DIPLumiSummary > m_summaryresult
const EventID & eventID() const
Definition: IOVSyncValue.h:42
std::map< unsigned int, boost::shared_ptr< 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 
)
protectedvirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 138 of file DIPLumiProducer.cc.

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

140  {
141  m_pcurrentTime=&iTime;
142  oValidity.setFirst(iTime);
143  oValidity.setLast(iTime);
144 }
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,boost::shared_ptr<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().

boost::shared_ptr<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,boost::shared_ptr<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().

boost::shared_ptr<DIPLumiSummary> DIPLumiProducer::m_summaryresult
private

Definition at line 45 of file DIPLumiProducer.h.

Referenced by produceSummary().