22 void checkFirstLumiForRuns(std::vector<edm::LuminosityBlockID>
const& iFirstLumis) {
23 if (iFirstLumis.empty())
26 auto previous = iFirstLumis[0].luminosityBlock();
27 for (
auto it = iFirstLumis.begin() + 1; it != iFirstLumis.end(); ++it) {
28 if (not(it->luminosityBlock() > previous)) {
30 <<
"Incorrect ordering of LuminosityBlock numbers in parameter 'firstLuminosityBlockForEachRun'";
40 template <
typename BASE>
47 numberEventsInRun_(pset.getUntrackedParameter<unsigned
int>(
"numberEventsInRun", BASE::remainingEvents())),
49 pset.getUntrackedParameter<unsigned
int>(
"numberEventsInLuminosityBlock", BASE::remainingEvents())),
50 presentTime_(pset.getUntrackedParameter<unsigned long long>(
"firstTime", 1ULL)),
51 origTime_(presentTime_),
53 pset.getUntrackedParameter<unsigned long long>(
"timeBetweenEvents", kNanoSecPerSec / kAveEventPerSec)),
54 eventCreationDelay_(pset.getUntrackedParameter<unsigned
int>(
"eventCreationDelay", 0)),
55 numberEventsInThisRun_(0),
56 numberEventsInThisLumi_(0),
57 zerothEvent_(pset.existsAs<unsigned
int>(
"firstEvent",
false)
58 ? pset.getUntrackedParameter<unsigned
int>(
"firstEvent", 1) - 1
59 : pset.getUntrackedParameter<unsigned long long>(
"firstEvent", 1) - 1),
60 eventID_(pset.getUntrackedParameter<unsigned
int>(
"firstRun", 1),
61 pset.getUntrackedParameter<unsigned
int>(
"firstLuminosityBlock", 1),
63 origEventID_(eventID_),
64 isRealData_(realData),
74 template <
typename BASE>
77 template <
typename BASE>
84 template <
typename BASE>
87 return std::shared_ptr<LuminosityBlockAuxiliary>();
90 return std::make_shared<LuminosityBlockAuxiliary>(
94 template <
typename BASE>
97 for (; offset < 0; ++
offset) {
100 for (; offset > 0; --
offset) {
114 template <
typename BASE>
122 template <
typename BASE>
125 template <
typename BASE>
135 template <
typename BASE>
137 if (BASE::state() == BASE::IsInvalid) {
138 return noFiles() ? BASE::IsStop : BASE::IsFile;
140 if (BASE::newRun()) {
143 if (BASE::newLumi()) {
146 if (BASE::eventCached()) {
147 return BASE::IsEvent;
160 BASE::setEventCached();
165 return newFile ? BASE::IsFile : BASE::IsRun;
168 return newFile ? BASE::IsFile : BASE::IsRun;
171 return newFile ? BASE::IsFile : BASE::IsLumi;
177 return newFile ? BASE::IsFile : BASE::IsLumi;
179 return newFile ? BASE::IsFile : BASE::IsEvent;
182 template <
typename BASE>
193 if (
run != eventID.
run()) {
213 template <
typename BASE>
215 if (numberEventsInRun_ < 1 || numberEventsInThisRun_ > 0) {
219 if (!(numberEventsInLumi_ < 1 || numberEventsInThisLumi_ > 0)) {
226 if (
run != eventID.
run()) {
246 template <
typename BASE>
249 return iV.luminosityBlock() <= iLumi;
258 template <
typename BASE>
263 template <
typename BASE>
268 template <
typename BASE>
271 ->setComment(
"Number of events to generate in each run.");
273 ->setComment(
"Number of events to generate in each lumi.");
274 desc.
addUntracked<
unsigned long long>(
"firstTime", 1)->setComment(
"Time before first event (ns) (for timestamp).");
276 ->setComment(
"Time between consecutive events (ns) (for timestamp).");
277 desc.
addUntracked<
unsigned int>(
"eventCreationDelay", 0)
278 ->setComment(
"Real time delay between generation of consecutive events (ms).");
283 "'firstEvent' is an XOR group because it can have type uint32 or uint64, default:1\n" 284 "Event number of first event to generate.");
286 desc.
addUntracked<
unsigned int>(
"firstLuminosityBlock", 1)
287 ->setComment(
"Luminosity block number of first lumi to generate.");
288 desc.
addUntracked<
unsigned int>(
"firstRun", 1)->setComment(
"Run number of first run to generate.");
289 desc.
addUntracked<std::vector<edm::LuminosityBlockID>>(
"firstLuminosityBlockForEachRun", {})
291 "When the source makes a new LuminosityBlock, this list is checked to see what Run number should be used. " 292 "The LuminosityBlock numbers are required to be in ascending order.");
293 BASE::fillDescription(desc);
virtual void initialize(EventID &id, TimeValue_t &time, TimeValue_t &interval)
EventNumber_t event() const
void setComment(std::string const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
static Timestamp invalidTimestamp()
virtual size_t fileIndex() const
IDGeneratorSourceBase(ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
unsigned int numberEventsInLumi_
BASE::ItemType getNextItemType() final
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
virtual bool noFiles() const
unsigned int numberEventsInThisRun_
LuminosityBlockNumber_t luminosityBlock() const
unsigned int LuminosityBlockNumber_t
EventID previous(LuminosityBlockNumber_t const &lumi) const
virtual bool setRunAndEventInfo(EventID &id, TimeValue_t &time, EventAuxiliary::ExperimentType &etype)=0
static unsigned long long kAveEventPerSec
EventID next(LuminosityBlockNumber_t const &lumi) const
EventNumber_t const zerothEvent_
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
~IDGeneratorSourceBase()(false) override
void retreatToPrevious(EventID &eventID, TimeValue_t &time)
EventID const & eventID() const
static unsigned long long kNanoSecPerSec
RunNumber_t runForLumi(LuminosityBlockNumber_t) const
unsigned long long TimeValue_t
std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
unsigned int numberEventsInRun_
static void fillDescription(ParameterSetDescription &desc)
void advanceToNext(EventID &eventID, TimeValue_t &time)
std::vector< edm::LuminosityBlockID > firstLumiForRuns_
EventID nextRunFirstEvent(LuminosityBlockNumber_t const &lumi) const
void skip(int offset) override
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
unsigned int numberEventsInThisLumi_
TimeValue_t timeBetweenEvents_
unsigned int eventCreationDelay_
EventID previousRunLastEvent(LuminosityBlockNumber_t const &lumi) const
EventAuxiliary::ExperimentType eType_