CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
13  private:
14  void produce(edm::Event& e) override;
16  edm::TimeValue_t& time,
17  edm::EventAuxiliary::ExperimentType& eType) override;
19 
20  private:
26  };
27 } // namespace cond
28 
32 //#include "DataFormats/Provenance/interface/EventID.h"
33 //#include <iostream>
34 namespace cond {
35  //allowed parameters: firstRun, firstTime, lastRun, lastTime,
36  //common paras: timetype,interval
38  : edm::ProducerSourceBase(pset, desc, true),
39  m_timeType(time::timeTypeFromName(pset.getParameter<std::string>("timetype"))),
40  m_firstValid(pset.getParameter<unsigned long long>("firstValue")),
41  m_lastValid(pset.getParameter<unsigned long long>("lastValue")),
42  m_interval(pset.getParameter<unsigned long long>("interval")) {
44  }
48  edm::TimeValue_t& time,
50  if (m_current <= m_lastValid) {
51  if (m_timeType == cond::runnumber) {
52  id = edm::EventID(m_current, id.luminosityBlock(), 1);
53  } else if (m_timeType == cond::timestamp) {
54  time = m_current;
55  } else if (m_timeType == cond::lumiid) {
57  id = edm::EventID(l.run(), l.luminosityBlock(), 1);
58  //std::cout<<"run "<<l.run()<<std::endl;
59  //std::cout<<"luminosityBlock "<<l.luminosityBlock()<<std::endl;
60  }
61  }
62  bool ok = !(m_lastValid < m_current);
64  return ok;
65  }
67  if (m_timeType == cond::runnumber) {
69  interval = 0LL;
70  } else if (m_timeType == cond::timestamp) {
71  time = m_firstValid;
72  interval = m_interval;
73  } else if (m_timeType == cond::lumiid) {
75  id = edm::EventID(l.run(), l.luminosityBlock(), 1);
76  interval = 0LL;
77  }
78  }
79 
82  desc.setComment("Creates runs, lumis and events containing no products.");
83  ProducerSourceBase::fillDescription(desc);
84 
85  desc.add<std::string>("timetype");
86  desc.add<unsigned long long>("firstValue")->setComment("The first run number to use or the first time");
87  desc.add<unsigned long long>("lastValue")->setComment("The last run number to use or the last time");
88  desc.add<unsigned long long>("interval");
89 
90  descriptions.add("source", desc);
91  }
92 
93 } // namespace cond
94 
97 
bool setRunAndEventInfo(edm::EventID &id, edm::TimeValue_t &time, edm::EventAuxiliary::ExperimentType &eType) override
tuple interval
Definition: MergeJob_cfg.py:20
void produce(edm::Event &e) override
void initialize(edm::EventID &id, edm::TimeValue_t &time, edm::TimeValue_t &interval) override
TimeType
Definition: Time.h:19
void setComment(std::string const &value)
unsigned long long Time_t
Definition: Time.h:14
#define DEFINE_FWK_INPUT_SOURCE(type)
TimeType timeTypeFromName(const std::string &name)
Definition: Time.cc:25
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 &)