CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
edmtest::ConcurrentIOVAnalyzer Class Reference
Inheritance diagram for edmtest::ConcurrentIOVAnalyzer:
edm::global::EDAnalyzer<> edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
 
 ConcurrentIOVAnalyzer (edm::ParameterSet const &)
 
- Public Member Functions inherited from edm::global::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool checkExpectedValues_
 
edm::ESGetToken< ESTestDataI, ESTestRecordIesTokenFromAcquireIntESProducer_
 
edm::ESGetToken< IOVTestInfo, ESTestRecordI > const esTokenFromESProducer_
 
edm::ESGetToken< IOVTestInfo, ESTestRecordI > const esTokenFromESSource_
 
edm::ESGetToken< ESTestDataI, ESTestRecordIesTokenLambdaOptionalTestValue_
 
edm::ESGetToken< ESTestDataI, ESTestRecordIesTokenLambdaUniquePtrTestValue_
 
edm::ESGetToken< ESTestDataI, ESTestRecordIesTokenOptionalTestValue_
 
edm::ESGetToken< ESTestDataI, ESTestRecordIesTokenUniquePtrTestValue_
 
std::vector< int > expectedESAcquireTestResults_
 
int expectedOptionalTestValue_
 
int expectedUniquePtrTestValue_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: Used in tests of the concurrent IOV features of the EventSetup system

Definition at line 34 of file ConcurrentIOVAnalyzer.cc.

Constructor & Destructor Documentation

◆ ConcurrentIOVAnalyzer()

edmtest::ConcurrentIOVAnalyzer::ConcurrentIOVAnalyzer ( edm::ParameterSet const &  pset)
explicit

Definition at line 56 of file ConcurrentIOVAnalyzer.cc.

References muonDTDigis_cfi::pset.

57  : checkExpectedValues_{pset.getUntrackedParameter<bool>("checkExpectedValues")},
58  esTokenFromESSource_{esConsumes(pset.getUntrackedParameter<edm::ESInputTag>("fromSource"))},
59  esTokenFromESProducer_{esConsumes(edm::ESInputTag("", "fromESProducer"))},
60  expectedESAcquireTestResults_{pset.getUntrackedParameter<std::vector<int>>("expectedESAcquireTestResults")},
61  expectedUniquePtrTestValue_{pset.getUntrackedParameter<int>("expectedUniquePtrTestValue")},
62  expectedOptionalTestValue_{pset.getUntrackedParameter<int>("expectedOptionalTestValue")} {
63  if (!expectedESAcquireTestResults_.empty()) {
64  esTokenFromAcquireIntESProducer_ = esConsumes(edm::ESInputTag("", "fromAcquireIntESProducer"));
65  }
66  if (expectedUniquePtrTestValue_ != 0) {
69  }
70  if (expectedOptionalTestValue_ != 0) {
73  }
74  }
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenLambdaUniquePtrTestValue_
edm::ESGetToken< IOVTestInfo, ESTestRecordI > const esTokenFromESProducer_
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenLambdaOptionalTestValue_
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenOptionalTestValue_
edm::ESGetToken< IOVTestInfo, ESTestRecordI > const esTokenFromESSource_
std::vector< int > expectedESAcquireTestResults_
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenUniquePtrTestValue_
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenFromAcquireIntESProducer_

Member Function Documentation

◆ analyze()

void edmtest::ConcurrentIOVAnalyzer::analyze ( edm::StreamID  ,
edm::Event const &  event,
edm::EventSetup const &  eventSetup 
) const
overridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 76 of file ConcurrentIOVAnalyzer.cc.

References edm::eventsetup::EventSetupRecord::cacheIdentifier(), edmtest::IOVTestInfo::cacheIdentifier_, checkExpectedValues_, esTokenFromAcquireIntESProducer_, esTokenFromESProducer_, esTokenFromESSource_, esTokenLambdaOptionalTestValue_, esTokenLambdaUniquePtrTestValue_, esTokenOptionalTestValue_, esTokenUniquePtrTestValue_, options_cfi::eventSetup, Exception, expectedESAcquireTestResults_, expectedOptionalTestValue_, expectedUniquePtrTestValue_, edmtest::IOVTestInfo::iovEndLumi_, edm::eventsetup::EventSetupRecord::iovIndex(), edmtest::IOVTestInfo::iovIndex_, edmtest::IOVTestInfo::iovStartLumi_, and edm::eventsetup::EventSetupRecord::validityInterval().

76  {
77  auto lumiNumber = event.eventAuxiliary().luminosityBlock();
78 
79  edm::ESHandle<IOVTestInfo> iovTestInfoFromESSource = eventSetup.getHandle(esTokenFromESSource_);
80  edm::ESHandle<IOVTestInfo> iovTestInfoFromESProducer = eventSetup.getHandle(esTokenFromESProducer_);
81 
82  ESTestRecordI esTestRecordI = eventSetup.get<ESTestRecordI>();
83  edm::ValidityInterval iov = esTestRecordI.validityInterval();
84 
85  if (iovTestInfoFromESSource->iovStartLumi_ != iov.first().luminosityBlockNumber() ||
86  iovTestInfoFromESSource->iovEndLumi_ != iov.last().luminosityBlockNumber() ||
87  iovTestInfoFromESSource->iovIndex_ != esTestRecordI.iovIndex() ||
88  iovTestInfoFromESSource->cacheIdentifier_ != esTestRecordI.cacheIdentifier()) {
89  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
90  << " values read from ESSource do not agree with record";
91  }
92 
93  if (iovTestInfoFromESProducer->iovStartLumi_ != iov.first().luminosityBlockNumber() ||
94  iovTestInfoFromESProducer->iovEndLumi_ != iov.last().luminosityBlockNumber() ||
95  iovTestInfoFromESProducer->iovIndex_ != esTestRecordI.iovIndex() ||
96  iovTestInfoFromESProducer->cacheIdentifier_ != esTestRecordI.cacheIdentifier()) {
97  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
98  << " values read from ESProducer do not agree with record";
99  }
100 
101  // First cacheIdentifier in the test is actually 3 (0, 1, and 2 just are ignored)
102  unsigned int cacheIdentifier = esTestRecordI.cacheIdentifier();
103  if (cacheIdentifier < expectedESAcquireTestResults_.size()) {
104  int testResult = eventSetup.getData(esTokenFromAcquireIntESProducer_).value();
105  if (testResult != expectedESAcquireTestResults_[cacheIdentifier]) {
106  throw cms::Exception("TestFailure")
107  << "ConcurrentIOVAnalyzer::analyze,"
108  << " unexpected value for EventSetup acquire test.\n"
109  << "Expected = " << expectedESAcquireTestResults_[cacheIdentifier] << " result = " << testResult
110  << " cacheIdentifier = " << cacheIdentifier << "\n";
111  }
112  }
113 
114  if (expectedUniquePtrTestValue_ != 0) {
116  throw cms::Exception("TestFailure")
117  << "ConcurrentIOVAnalyzer::analyze,"
118  << " value for unique_ptr test from EventSetup does not match expected value";
119  }
121  throw cms::Exception("TestFailure")
122  << "ConcurrentIOVAnalyzer::analyze,"
123  << " value for lambda unique_ptr test from EventSetup does not match expected value";
124  }
125  }
126 
127  if (expectedOptionalTestValue_ != 0) {
129  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
130  << " value for optional test from EventSetup does not match expected value";
131  }
133  throw cms::Exception("TestFailure")
134  << "ConcurrentIOVAnalyzer::analyze,"
135  << " value for lambda optional test from EventSetup does not match expected value";
136  }
137  }
138 
139  if (!checkExpectedValues_) {
140  return;
141  }
142 
143  // cacheIdentifier starts at 2 for beginRun and 3 is next here for the first lumi
144  if (lumiNumber == 1) {
145  if (iovTestInfoFromESProducer->iovStartLumi_ != 1 || iovTestInfoFromESProducer->iovEndLumi_ != 3 ||
146  iovTestInfoFromESProducer->cacheIdentifier_ != 3) {
147  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
148  << " values read from ESProducer do not agree with expected values";
149  }
150  }
151  if (lumiNumber == 2) {
152  if (iovTestInfoFromESProducer->iovStartLumi_ != 1 || iovTestInfoFromESProducer->iovEndLumi_ != 3 ||
153  iovTestInfoFromESProducer->cacheIdentifier_ != 3) {
154  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
155  << " values read from ESProducer do not agree with expected values";
156  }
157  }
158  if (lumiNumber == 3) {
159  if (iovTestInfoFromESProducer->iovStartLumi_ != 1 || iovTestInfoFromESProducer->iovEndLumi_ != 3 ||
160  iovTestInfoFromESProducer->cacheIdentifier_ != 3) {
161  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
162  << " values read from ESProducer do not agree with expected values";
163  }
164  }
165  if (lumiNumber == 4) {
166  if (iovTestInfoFromESProducer->iovStartLumi_ != 4 || iovTestInfoFromESProducer->iovEndLumi_ != 5 ||
167  iovTestInfoFromESProducer->cacheIdentifier_ != 4) {
168  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
169  << " values read from ESProducer do not agree with expected values";
170  }
171  }
172  if (lumiNumber == 5) {
173  if (iovTestInfoFromESProducer->iovStartLumi_ != 4 || iovTestInfoFromESProducer->iovEndLumi_ != 5 ||
174  iovTestInfoFromESProducer->cacheIdentifier_ != 4) {
175  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
176  << " values read from ESProducer do not agree with expected values";
177  }
178  }
179  if (lumiNumber == 6) {
180  if (iovTestInfoFromESProducer->iovStartLumi_ != 6 || iovTestInfoFromESProducer->iovEndLumi_ != 6 ||
181  iovTestInfoFromESProducer->cacheIdentifier_ != 5) {
182  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
183  << " values read from ESProducer do not agree with expected values";
184  }
185  }
186  if (lumiNumber == 7) {
187  if (iovTestInfoFromESProducer->iovStartLumi_ != 7 || iovTestInfoFromESProducer->iovEndLumi_ != 7 ||
188  iovTestInfoFromESProducer->cacheIdentifier_ != 6) {
189  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
190  << " values read from ESProducer do not agree with expected values";
191  }
192  }
193  if (lumiNumber == 8) {
194  if (iovTestInfoFromESProducer->iovStartLumi_ != 8 || iovTestInfoFromESProducer->iovEndLumi_ != 8 ||
195  iovTestInfoFromESProducer->cacheIdentifier_ != 7) {
196  throw cms::Exception("TestFailure") << "ConcurrentIOVAnalyzer::analyze,"
197  << " values read from ESProducer do not agree with expected values";
198  }
199  }
200  }
unsigned int iovEndLumi_
Definition: IOVTestInfo.h:24
unsigned int iovIndex_
Definition: IOVTestInfo.h:25
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenLambdaUniquePtrTestValue_
edm::ESGetToken< IOVTestInfo, ESTestRecordI > const esTokenFromESProducer_
unsigned long long cacheIdentifier() const
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenLambdaOptionalTestValue_
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenOptionalTestValue_
edm::ESGetToken< IOVTestInfo, ESTestRecordI > const esTokenFromESSource_
unsigned int iovStartLumi_
Definition: IOVTestInfo.h:22
std::vector< int > expectedESAcquireTestResults_
unsigned long long cacheIdentifier_
Definition: IOVTestInfo.h:26
ValidityInterval validityInterval() const
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenUniquePtrTestValue_
edm::ESGetToken< ESTestDataI, ESTestRecordI > esTokenFromAcquireIntESProducer_

◆ fillDescriptions()

void edmtest::ConcurrentIOVAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 202 of file ConcurrentIOVAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

202  {
204  desc.addUntracked<bool>("checkExpectedValues", true);
205  desc.addUntracked<edm::ESInputTag>("fromSource", edm::ESInputTag("", ""));
206  desc.addUntracked<std::vector<int>>("expectedESAcquireTestResults", std::vector<int>());
207  desc.addUntracked<int>("expectedUniquePtrTestValue", 0);
208  desc.addUntracked<int>("expectedOptionalTestValue", 0);
209  descriptions.addDefault(desc);
210  }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ checkExpectedValues_

bool edmtest::ConcurrentIOVAnalyzer::checkExpectedValues_
private

Definition at line 43 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ esTokenFromAcquireIntESProducer_

edm::ESGetToken<ESTestDataI, ESTestRecordI> edmtest::ConcurrentIOVAnalyzer::esTokenFromAcquireIntESProducer_
private

Definition at line 46 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ esTokenFromESProducer_

edm::ESGetToken<IOVTestInfo, ESTestRecordI> const edmtest::ConcurrentIOVAnalyzer::esTokenFromESProducer_
private

Definition at line 45 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ esTokenFromESSource_

edm::ESGetToken<IOVTestInfo, ESTestRecordI> const edmtest::ConcurrentIOVAnalyzer::esTokenFromESSource_
private

Definition at line 44 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ esTokenLambdaOptionalTestValue_

edm::ESGetToken<ESTestDataI, ESTestRecordI> edmtest::ConcurrentIOVAnalyzer::esTokenLambdaOptionalTestValue_
private

Definition at line 52 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ esTokenLambdaUniquePtrTestValue_

edm::ESGetToken<ESTestDataI, ESTestRecordI> edmtest::ConcurrentIOVAnalyzer::esTokenLambdaUniquePtrTestValue_
private

Definition at line 49 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ esTokenOptionalTestValue_

edm::ESGetToken<ESTestDataI, ESTestRecordI> edmtest::ConcurrentIOVAnalyzer::esTokenOptionalTestValue_
private

Definition at line 51 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ esTokenUniquePtrTestValue_

edm::ESGetToken<ESTestDataI, ESTestRecordI> edmtest::ConcurrentIOVAnalyzer::esTokenUniquePtrTestValue_
private

Definition at line 48 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ expectedESAcquireTestResults_

std::vector<int> edmtest::ConcurrentIOVAnalyzer::expectedESAcquireTestResults_
private

Definition at line 47 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ expectedOptionalTestValue_

int edmtest::ConcurrentIOVAnalyzer::expectedOptionalTestValue_
private

Definition at line 53 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().

◆ expectedUniquePtrTestValue_

int edmtest::ConcurrentIOVAnalyzer::expectedUniquePtrTestValue_
private

Definition at line 50 of file ConcurrentIOVAnalyzer.cc.

Referenced by analyze().