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, boost::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 65 of file DIPLumiProducer.cc.

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

68  findingRecord<DIPLuminosityRcd>();
69  m_connectStr=iConfig.getParameter<std::string>("connect");
70  m_cachesize=iConfig.getUntrackedParameter<unsigned int>("ncacheEntries",3);
71 }
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 349 of file DIPLumiProducer.cc.

349 {}

Member Function Documentation

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

Definition at line 271 of file DIPLumiProducer.cc.

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

Referenced by produceDetail().

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

Definition at line 148 of file DIPLumiProducer.cc.

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

Referenced by produceSummary().

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

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

Referenced by filldetailcache(), and fillsummarycache().

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

Definition at line 106 of file DIPLumiProducer.cc.

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

Referenced by DIPLumiProducer().

107 {
108  unsigned int currentrun=m_pcurrentTime->eventID().run();
109  unsigned int currentls=m_pcurrentTime->luminosityBlockNumber();
110  if(currentls==0||currentls==4294967295){
111  return boost::shared_ptr<DIPLumiDetail>(new DIPLumiDetail());
112  }
113  if(m_detailcachedrun!=currentrun){//i'm in a new run
114  filldetailcache(currentrun,currentls);//starting ls
115  }else{ //i'm in an known run
116  if(m_detailcache.find(currentls)==m_detailcache.end()){//i'm in a unknown ls
117  filldetailcache(currentrun,currentls);//cache all ls>=currentls
118  }
119  }
120  if(m_detailcache.empty()){
121  return boost::shared_ptr<DIPLumiDetail>(new DIPLumiDetail());
122  }
123  if(m_detailcache.find(currentls)==m_detailcache.end()){
124  std::vector<unsigned int> v;
125  for(std::map<unsigned int,boost::shared_ptr<DIPLumiDetail> >::iterator it=m_detailcache.begin();it!=m_detailcache.end();++it){
126  v.push_back(it->first);
127  }
128  m_detailresult=m_detailcache[v.back()];
129  }else{
130  m_detailresult=m_detailcache[currentls];
131  }
132  if(m_detailresult.get()==0){
133  return boost::shared_ptr<DIPLumiDetail>(new DIPLumiDetail());
134  }
135  return m_detailresult;
136 }
RunNumber_t run() const
Definition: EventID.h:42
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
dictionary map
Definition: Association.py:205
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 74 of file DIPLumiProducer.cc.

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

Referenced by DIPLumiProducer().

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

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

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