CMS 3D CMS Logo

EmptyIOVSource.cc
Go to the documentation of this file.
5 #include <string>
6 namespace cond {
8  public:
10  ~EmptyIOVSource() override;
11  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
12  private:
13  void produce(edm::Event & e) override;
15  void initialize(edm::EventID& id, edm::TimeValue_t& time, edm::TimeValue_t& interval) override;
16  private:
22  };
23 }
24 
28 //#include "DataFormats/Provenance/interface/EventID.h"
29 //#include <iostream>
30 namespace cond{
31  //allowed parameters: firstRun, firstTime, lastRun, lastTime,
32  //common paras: timetype,interval
34  edm::InputSourceDescription const& desc):
35  edm::ProducerSourceBase(pset,desc,true),
36  m_timeType( time::timeTypeFromName( pset.getParameter<std::string>("timetype"))),
37  m_firstValid(pset.getParameter<unsigned long long>("firstValue")),
38  m_lastValid(pset.getParameter<unsigned long long>("lastValue")),
39  m_interval(pset.getParameter<unsigned long long>("interval")){
41  }
43  }
45  }
48  if( m_timeType == cond::runnumber ){
49  id = edm::EventID(m_current, id.luminosityBlock(), 1);
50  }else if( m_timeType == cond::timestamp ){
51  time = m_current;
52  }else if( m_timeType == cond::lumiid ){
54  id = edm::EventID(l.run(), l.luminosityBlock(), 1);
55  //std::cout<<"run "<<l.run()<<std::endl;
56  //std::cout<<"luminosityBlock "<<l.luminosityBlock()<<std::endl;
57  }
58  }
59  bool ok = !(m_lastValid<m_current);
61  return ok;
62  }
66  interval = 0LL;
67  }else if( m_timeType == cond::timestamp ){
68  time = m_firstValid;
69  interval = m_interval;
70  }else if( m_timeType == cond::lumiid ){
72  id = edm::EventID(l.run(), l.luminosityBlock(), 1);
73  interval = 0LL;
74  }
75  }
76 
77  void
80  desc.setComment("Creates runs, lumis and events containing no products.");
81  ProducerSourceBase::fillDescription(desc);
82 
83  desc.add<std::string>("timetype");
84  desc.add<unsigned long long>("firstValue")->setComment("The first run number to use or the first time");
85  desc.add<unsigned long long>("lastValue")->setComment("The last run number to use or the last time");
86  desc.add<unsigned long long>("interval");
87 
88  descriptions.add("source", desc);
89  }
90 
91 
92 }//ns cond
93 
96 
bool setRunAndEventInfo(edm::EventID &id, edm::TimeValue_t &time, edm::EventAuxiliary::ExperimentType &eType) override
void produce(edm::Event &e) override
void initialize(edm::EventID &id, edm::TimeValue_t &time, edm::TimeValue_t &interval) override
TimeType
Definition: Time.h:21
#define DEFINE_FWK_INPUT_SOURCE(type)
void setComment(std::string const &value)
unsigned long long Time_t
Definition: Time.h:16
TimeType timeTypeFromName(const std::string &name)
Definition: Time.cc:24
ProducerSourceBase(ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
RunNumber_t run() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned long long TimeValue_t
Definition: Timestamp.h:28
~EmptyIOVSource() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
LuminosityBlockNumber_t luminosityBlock() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
EmptyIOVSource(edm::ParameterSet const &, edm::InputSourceDescription const &)
Definition: plugin.cc:24
HLT enums.
LuminosityBlockNumber_t luminosityBlock() const