1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
// -*- C++ -*-
//
// Package: FWCore/Integration
// Class : RunLumiESSource
//
// Implementation:
// ESSource used for tests of Framework support for
// the EventSetup system in run and lumi transitions
//
// Original Author: W. David Dagenhart
// Created: 18 April 2019
#include "DataFormats/Provenance/interface/EventID.h"
#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/IOVSyncValue.h"
#include "FWCore/Framework/interface/SourceFactory.h"
#include "FWCore/Framework/interface/ValidityInterval.h"
#include "FWCore/Integration/interface/ESTestRecords.h"
#include "FWCore/Integration/interface/IOVTestInfo.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include <memory>
namespace edmtest {
class RunLumiESSource : public edm::EventSetupRecordIntervalFinder, public edm::ESProducer {
public:
RunLumiESSource(edm::ParameterSet const&);
std::unique_ptr<IOVTestInfo> produce(ESTestRecordC const&);
std::unique_ptr<IOVTestInfo> produceNonEmptyLabel(ESTestRecordC const&);
static void fillDescriptions(edm::ConfigurationDescriptions&);
private:
void setIntervalFor(edm::eventsetup::EventSetupRecordKey const&,
edm::IOVSyncValue const&,
edm::ValidityInterval&) override;
bool isConcurrentFinder() const override { return true; }
};
RunLumiESSource::RunLumiESSource(edm::ParameterSet const&) {
findingRecord<ESTestRecordC>();
setWhatProduced(this);
setWhatProduced(this, &edmtest::RunLumiESSource::produceNonEmptyLabel, edm::es::Label("nonEmptyLabel"));
}
std::unique_ptr<IOVTestInfo> RunLumiESSource::produce(ESTestRecordC const& record) {
auto data = std::make_unique<IOVTestInfo>();
edm::ValidityInterval iov = record.validityInterval();
edm::LogAbsolute("RunLumiESSource") << "RunLumiESSource::produce startIOV = " << iov.first().eventID().run() << ":"
<< iov.first().luminosityBlockNumber()
<< " endIOV = " << iov.last().eventID().run() << ":"
<< iov.last().luminosityBlockNumber() << " IOV index = " << record.iovIndex()
<< " cache identifier = " << record.cacheIdentifier();
data->iovStartRun_ = iov.first().eventID().run();
data->iovStartLumi_ = iov.first().luminosityBlockNumber();
data->iovEndRun_ = iov.last().eventID().run();
data->iovEndLumi_ = iov.last().luminosityBlockNumber();
data->iovIndex_ = record.iovIndex();
data->cacheIdentifier_ = record.cacheIdentifier();
return data;
}
std::unique_ptr<IOVTestInfo> RunLumiESSource::produceNonEmptyLabel(ESTestRecordC const& record) {
auto data = std::make_unique<IOVTestInfo>();
edm::ValidityInterval iov = record.validityInterval();
edm::LogAbsolute("RunLumiESSource") << "RunLumiESSource::produceNonEmptyLabel startIOV = "
<< iov.first().eventID().run() << ":" << iov.first().luminosityBlockNumber()
<< " endIOV = " << iov.last().eventID().run() << ":"
<< iov.last().luminosityBlockNumber() << " IOV index = " << record.iovIndex()
<< " cache identifier = " << record.cacheIdentifier();
data->iovStartRun_ = iov.first().eventID().run();
data->iovStartLumi_ = iov.first().luminosityBlockNumber();
data->iovEndRun_ = iov.last().eventID().run();
data->iovEndLumi_ = iov.last().luminosityBlockNumber();
data->iovIndex_ = record.iovIndex();
data->cacheIdentifier_ = record.cacheIdentifier();
return data;
}
void RunLumiESSource::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
descriptions.addDefault(desc);
}
void RunLumiESSource::setIntervalFor(edm::eventsetup::EventSetupRecordKey const&,
edm::IOVSyncValue const& syncValue,
edm::ValidityInterval& interval) {
interval = edm::ValidityInterval(syncValue, syncValue);
}
} // namespace edmtest
using namespace edmtest;
DEFINE_FWK_EVENTSETUP_SOURCE(RunLumiESSource);
|