CMS 3D CMS Logo

DoodadESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Integration
4 // Class : DoodadESSource
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Fri Jun 24 14:39:39 EDT 2005
11 //
12 
13 // system include files
14 
15 // user include files
21 
22 #include "GadgetRcd.h"
23 #include "Doodad.h"
25 
26 namespace edmtest {
28  public:
30 
31  std::unique_ptr<Doodad> produce(const GadgetRcd&);
32 
33  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
34 
35  protected:
37  const edm::IOVSyncValue& iTime,
38  edm::ValidityInterval& iInterval) override;
39 
40  private:
41  DoodadESSource(const DoodadESSource&) = delete; // stop default
42 
43  const DoodadESSource& operator=(const DoodadESSource&) = delete; // stop default
44 
45  // ---------- member data --------------------------------
46  unsigned int nCalls_;
47  };
48 
49  //
50  // constants, enums and typedefs
51  //
52 
53  //
54  // static data member definitions
55  //
56 
57  //
58  // constructors and destructor
59  //
61  if (pset.getUntrackedParameter<bool>("test", true)) {
62  throw edm::Exception(edm::errors::Configuration, "Something is wrong with ESSource validation\n")
63  << "Or the test configuration parameter was set true (it should never be true unless you want this "
64  "exception)\n";
65  }
66 
67  this->findingRecord<GadgetRcd>();
68  setWhatProduced(this);
69  }
70 
71  //DoodadESSource::~DoodadESSource()
72  //{
73  //}
74 
75  //
76  // member functions
77  //
78 
79  std::unique_ptr<Doodad> DoodadESSource::produce(const GadgetRcd&) {
80  auto data = std::make_unique<Doodad>();
81  data->a = nCalls_;
82  ++nCalls_;
83  return data;
84  }
85 
88  desc.addOptional<std::string>("appendToDataLabel");
89  desc.addOptionalUntracked<std::string>("test2");
90  desc.addUntracked<bool>("test", false)
91  ->setComment("This parameter exists only to test the parameter set validation for ESSources");
92  descriptions.add("DoodadESSource", desc);
93  }
94 
96  const edm::IOVSyncValue& iTime,
97  edm::ValidityInterval& iInterval) {
98  //Be valid for 3 runs
99  edm::EventID newTime = edm::EventID((iTime.eventID().run() - 1) - ((iTime.eventID().run() - 1) % 3) + 1, 1, 1);
103  }
104 
105  //
106  // const member functions
107  //
108 
109  //
110  // static member functions
111  //
112 } // namespace edmtest
113 using namespace edmtest;
114 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94
DoodadESSource(edm::ParameterSet const &pset)
RunNumber_t run() const
Definition: EventID.h:38
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
EventID nextRun(LuminosityBlockNumber_t const &lumi) const
Definition: EventID.h:49
std::unique_ptr< Doodad > produce(const GadgetRcd &)
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iTime, edm::ValidityInterval &iInterval) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
EventID previousRunLastEvent(LuminosityBlockNumber_t const &lumi) const
Definition: EventID.h:51
const EventID & eventID() const
Definition: IOVSyncValue.h:40
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const DoodadESSource & operator=(const DoodadESSource &)=delete
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)