CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edmtest::TestFindProduct Class Reference
Inheritance diagram for edmtest::TestFindProduct:
edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::WatchProcessBlock, edm::InputProcessBlockCache< int, long long int > > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void accessInputProcessBlock (edm::ProcessBlock const &) override
 
void analyze (edm::Event const &e, edm::EventSetup const &es) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void beginProcessBlock (edm::ProcessBlock const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endProcessBlock (edm::ProcessBlock const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
 TestFindProduct (edm::ParameterSet const &pset)
 
 ~TestFindProduct () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::WatchProcessBlock, edm::InputProcessBlockCache< int, long long int > >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
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
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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)
 

Private Attributes

int expectedCache_
 
int expectedSum_
 
bool getByTokenFirst_
 
edm::GetterOfProducts< IntProduct > getterOfProducts_
 
std::vector< edm::InputTaginputTags_
 
std::vector< edm::InputTaginputTagsBeginProcessBlock_
 
std::vector< edm::InputTaginputTagsEndLumi_
 
std::vector< edm::InputTaginputTagsEndProcessBlock2_
 
std::vector< edm::InputTaginputTagsEndProcessBlock3_
 
std::vector< edm::InputTaginputTagsEndProcessBlock4_
 
std::vector< edm::InputTaginputTagsEndProcessBlock_
 
std::vector< edm::InputTaginputTagsEndRun_
 
std::vector< edm::InputTaginputTagsInputProcessBlock_
 
std::vector< edm::InputTaginputTagsNotFound_
 
std::vector< edm::InputTaginputTagsUInt64_
 
std::vector< edm::InputTaginputTagsView_
 
bool runProducerParameterCheck_
 
int sum_
 
bool testGetterOfProducts_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokens_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokensBeginProcessBlock_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndLumi_
 
std::vector< edm::EDGetTokentokensEndProcessBlock2_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock3_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock4_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndRun_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokensInputProcessBlock_
 
std::vector< edm::EDGetTokenT< IntProduct > > tokensNotFound_
 
std::vector< edm::EDGetTokenT< UInt64Product > > tokensUInt64_
 
std::vector< edm::EDGetTokenT< edm::View< int > > > tokensView_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Definition at line 42 of file TestFindProduct.cc.

Constructor & Destructor Documentation

◆ TestFindProduct()

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

Definition at line 102 of file TestFindProduct.cc.

References edm::one::EDAnalyzerBase::callWhenNewProductsRegistered(), edm::EDConsumerBase::consumes(), getterOfProducts_, inputTags_, inputTagsBeginProcessBlock_, inputTagsEndLumi_, inputTagsEndProcessBlock2_, inputTagsEndProcessBlock3_, inputTagsEndProcessBlock4_, inputTagsEndProcessBlock_, inputTagsEndRun_, inputTagsInputProcessBlock_, inputTagsNotFound_, inputTagsUInt64_, inputTagsView_, muonDTDigis_cfi::pset, makeGlobalPositionRcd_cfg::tag, testGetterOfProducts_, unpackBuffers-CaloStage2::token, tokens_, tokensBeginProcessBlock_, tokensEndLumi_, tokensEndProcessBlock2_, tokensEndProcessBlock3_, tokensEndProcessBlock4_, tokensEndProcessBlock_, tokensEndRun_, tokensInputProcessBlock_, tokensNotFound_, tokensUInt64_, and tokensView_.

103  : inputTags_(pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTags")),
104  expectedSum_(pset.getUntrackedParameter<int>("expectedSum", 0)),
105  expectedCache_(pset.getUntrackedParameter<int>("expectedCache", 0)),
106  sum_(0),
108  getByTokenFirst_(pset.getUntrackedParameter<bool>("getByTokenFirst", false)),
109  inputTagsView_(),
110  runProducerParameterCheck_(pset.getUntrackedParameter<bool>("runProducerParameterCheck", false)),
111  testGetterOfProducts_(pset.getUntrackedParameter<bool>("testGetterOfProducts", false)),
113  if (testGetterOfProducts_) {
115  }
116  std::vector<edm::InputTag> emptyTagVector;
117  inputTagsNotFound_ = pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsNotFound", emptyTagVector);
118  inputTagsView_ = pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsView", emptyTagVector);
119  inputTagsUInt64_ = pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsUInt64", emptyTagVector);
120  inputTagsEndLumi_ = pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsEndLumi", emptyTagVector);
121  inputTagsEndRun_ = pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsEndRun", emptyTagVector);
123  pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsBeginProcessBlock", emptyTagVector);
125  pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsInputProcessBlock", emptyTagVector);
127  pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsEndProcessBlock", emptyTagVector);
129  pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsEndProcessBlock2", emptyTagVector);
131  pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsEndProcessBlock3", emptyTagVector);
133  pset.getUntrackedParameter<std::vector<edm::InputTag>>("inputTagsEndProcessBlock4", emptyTagVector);
134 
135  for (auto const& tag : inputTags_) {
136  tokens_.push_back(consumes<IntProduct>(tag));
137  }
138  for (auto const& tag : inputTagsNotFound_) {
139  tokensNotFound_.push_back(consumes<IntProduct>(tag));
140  }
141  for (auto const& tag : inputTagsView_) {
142  tokensView_.push_back(consumes<edm::View<int>>(tag));
143  }
144  for (auto const& tag : inputTagsUInt64_) {
145  tokensUInt64_.push_back(consumes<UInt64Product>(tag));
146  }
147  for (auto const& tag : inputTagsEndLumi_) {
148  tokensEndLumi_.push_back(consumes<IntProduct, edm::InLumi>(tag));
149  }
150  for (auto const& tag : inputTagsEndRun_) {
151  tokensEndRun_.push_back(consumes<IntProduct, edm::InRun>(tag));
152  }
153  for (auto const& tag : inputTagsBeginProcessBlock_) {
154  tokensBeginProcessBlock_.push_back(consumes<IntProduct, edm::InProcess>(tag));
155  }
156  for (auto const& tag : inputTagsInputProcessBlock_) {
157  tokensInputProcessBlock_.push_back(consumes<IntProduct, edm::InProcess>(tag));
158  }
159  for (auto const& tag : inputTagsEndProcessBlock_) {
160  tokensEndProcessBlock_.push_back(consumes<IntProduct, edm::InProcess>(tag));
161  }
162  for (auto const& tag : inputTagsEndProcessBlock2_) {
163  tokensEndProcessBlock2_.push_back(consumes<IntProduct, edm::InProcess>(tag));
164  }
165  for (auto const& tag : inputTagsEndProcessBlock3_) {
166  tokensEndProcessBlock3_.push_back(consumes<IntProduct, edm::InProcess>(tag));
167  }
168  for (auto const& tag : inputTagsEndProcessBlock4_) {
169  tokensEndProcessBlock4_.push_back(consumes<IntProduct, edm::InProcess>(tag));
170  }
171 
172  if (!tokensInputProcessBlock_.empty()) {
173  registerProcessBlockCacheFiller<int>(
175  [this](edm::ProcessBlock const& processBlock, std::shared_ptr<int> const& previousCache) {
176  auto returnValue = std::make_shared<int>(0);
177  for (auto const& token : tokensInputProcessBlock_) {
178  *returnValue += processBlock.get(token).value;
179  }
180  return returnValue;
181  });
182  registerProcessBlockCacheFiller<1>(
184  [this](edm::ProcessBlock const& processBlock, std::shared_ptr<long long int> const& previousCache) {
185  auto returnValue = std::make_shared<long long int>(0);
186  for (auto const& token : tokensInputProcessBlock_) {
187  *returnValue += processBlock.get(token).value;
188  }
189  return returnValue;
190  });
191  }
192  }
std::vector< edm::InputTag > inputTagsUInt64_
std::vector< edm::InputTag > inputTagsEndProcessBlock2_
std::vector< edm::EDGetToken > tokensEndProcessBlock2_
std::vector< edm::InputTag > inputTagsEndProcessBlock_
std::vector< edm::EDGetTokenT< UInt64Product > > tokensUInt64_
std::vector< edm::EDGetTokenT< IntProduct > > tokensBeginProcessBlock_
std::vector< edm::EDGetTokenT< IntProduct > > tokensNotFound_
std::vector< edm::InputTag > inputTagsView_
std::vector< edm::EDGetTokenT< IntProduct > > tokens_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< edm::InputTag > inputTagsEndLumi_
edm::GetterOfProducts< IntProduct > getterOfProducts_
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndRun_
std::vector< edm::EDGetTokenT< IntProduct > > tokensInputProcessBlock_
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock4_
std::vector< edm::InputTag > inputTagsInputProcessBlock_
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
std::vector< edm::InputTag > inputTags_
std::vector< edm::EDGetTokenT< edm::View< int > > > tokensView_
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock_
std::vector< edm::InputTag > inputTagsEndProcessBlock4_
std::vector< edm::InputTag > inputTagsEndProcessBlock3_
std::vector< edm::InputTag > inputTagsNotFound_
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock3_
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndLumi_
std::vector< edm::InputTag > inputTagsEndRun_
std::vector< edm::InputTag > inputTagsBeginProcessBlock_

◆ ~TestFindProduct()

edmtest::TestFindProduct::~TestFindProduct ( )
override

Definition at line 194 of file TestFindProduct.cc.

194 {}

Member Function Documentation

◆ accessInputProcessBlock()

void edmtest::TestFindProduct::accessInputProcessBlock ( edm::ProcessBlock const &  processBlock)
override

Definition at line 336 of file TestFindProduct.cc.

References edm::ProcessBlock::get(), sum_, unpackBuffers-CaloStage2::token, tokensInputProcessBlock_, and relativeConstraints::value.

336  {
337  for (auto const& token : tokensInputProcessBlock_) {
338  int value = processBlock.get(token).value;
339  sum_ += value;
340  }
341  }
std::vector< edm::EDGetTokenT< IntProduct > > tokensInputProcessBlock_
Definition: value.py:1

◆ analyze()

void edmtest::TestFindProduct::analyze ( edm::Event const &  e,
edm::EventSetup const &  es 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 196 of file TestFindProduct.cc.

References Exception, expectedCache_, getByTokenFirst_, edm::ParameterSet::getParameter(), edm::getProducerParameterSet(), h, inputTags_, inputTagsNotFound_, inputTagsView_, edm::HandleBase::isValid(), edm::HandleBase::provenance(), runProducerParameterCheck_, sum_, unpackBuffers-CaloStage2::token, tokens_, tokensNotFound_, tokensUInt64_, and tokensView_.

196  {
200  edm::Handle<edm::View<int>> hViewToken;
201 
202  std::vector<edm::EDGetTokenT<IntProduct>>::const_iterator iToken = tokens_.begin();
203  for (std::vector<edm::InputTag>::const_iterator iter = inputTags_.begin(), iEnd = inputTags_.end(); iter != iEnd;
204  ++iter, ++iToken) {
205  if (getByTokenFirst_) {
206  event.getByToken(*iToken, hToken);
207  *hToken;
208  }
209 
210  event.getByLabel(*iter, h);
211  sum_ += h->value;
212 
213  event.getByToken(*iToken, hToken);
214  if (h->value != hToken->value) {
215  throw cms::Exception("TestFail")
216  << "TestFindProduct::analyze getByLabel and getByToken return inconsistent results";
217  }
218 
220  edm::ParameterSet const* producerPset =
221  edm::getProducerParameterSet(*hToken.provenance(), event.processHistory());
222  int par = producerPset->getParameter<int>("ivalue");
223  // These expected values are just from knowing the values in the
224  // configuration files for this test.
225  int expectedParameterValue = 3;
226  if (!iter->process().empty()) {
227  if (event.run() == 1) {
228  expectedParameterValue = 1;
229  } else {
230  expectedParameterValue = 2;
231  }
232  }
233  if (par != expectedParameterValue) {
234  throw cms::Exception("TestFail") << "TestFindProduct::analyze unexpected value from producer parameter set";
235  }
236  }
237  }
238  iToken = tokensNotFound_.begin();
239  for (std::vector<edm::InputTag>::const_iterator iter = inputTagsNotFound_.begin(), iEnd = inputTagsNotFound_.end();
240  iter != iEnd;
241  ++iter, ++iToken) {
242  event.getByLabel(*iter, h);
243  if (h.isValid()) {
244  throw cms::Exception("TestFail")
245  << "TestFindProduct::analyze: getByLabel found a product that should not be found "
246  << h.provenance()->moduleLabel();
247  }
248 
249  event.getByToken(*iToken, hToken);
250  if (hToken.isValid()) {
251  throw cms::Exception("TestFail")
252  << "TestFindProduct::analyze: getByToken found a product that should not be found "
253  << hToken.provenance()->moduleLabel();
254  }
255  }
256  std::vector<edm::EDGetTokenT<edm::View<int>>>::const_iterator iTokenView = tokensView_.begin();
257  for (std::vector<edm::InputTag>::const_iterator iter = inputTagsView_.begin(), iEnd = inputTagsView_.end();
258  iter != iEnd;
259  ++iter, ++iTokenView) {
260  if (getByTokenFirst_) {
261  event.getByToken(*iTokenView, hViewToken);
262  *hViewToken;
263  }
264 
265  event.getByLabel(*iter, hView);
266  sum_ += hView->at(0);
267 
268  event.getByToken(*iTokenView, hViewToken);
269  if (hView->at(0) != hViewToken->at(0)) {
270  throw cms::Exception("TestFail")
271  << "TestFindProduct::analyze getByLabel and getByToken return inconsistent results";
272  }
273  }
274 
275  // Get these also and add them into the sum
277  for (auto const& token : tokensUInt64_) {
278  event.getByToken(token, h64);
279  sum_ += h64->value;
280  }
281 
282  if (expectedCache_ != 0) {
283  std::tuple<edm::CacheHandle<int>, edm::CacheHandle<long long int>> valueTuple = processBlockCaches(event);
284  {
285  edm::CacheHandle<int> value = std::get<0>(valueTuple);
286  if (*value != expectedCache_) {
287  throw cms::Exception("TestFail") << "TestFindProduct::analyze 0 ProcessBlock cache has unexpected value "
288  << *value << " expected = " << expectedCache_;
289  }
290  }
291  {
292  edm::CacheHandle<long long int> value = std::get<1>(valueTuple);
293  if (*value != expectedCache_) {
294  throw cms::Exception("TestFail") << "TestFindProduct::analyze 1 ProcessBlock cache has unexpected value "
295  << *value << " expected = " << expectedCache_;
296  }
297  }
298  }
299  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< edm::EDGetTokenT< UInt64Product > > tokensUInt64_
Provenance const * provenance() const
Definition: HandleBase.h:74
std::vector< edm::EDGetTokenT< IntProduct > > tokensNotFound_
std::vector< edm::InputTag > inputTagsView_
std::vector< edm::EDGetTokenT< IntProduct > > tokens_
Definition: value.py:1
ParameterSet const * getProducerParameterSet(Provenance const &provenance, ProcessHistory const &)
std::vector< edm::InputTag > inputTags_
std::vector< edm::EDGetTokenT< edm::View< int > > > tokensView_
bool isValid() const
Definition: HandleBase.h:70
std::vector< edm::InputTag > inputTagsNotFound_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Definition: event.py:1

◆ beginLuminosityBlock()

void edmtest::TestFindProduct::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
override

Definition at line 301 of file TestFindProduct.cc.

301 {}

◆ beginProcessBlock()

void edmtest::TestFindProduct::beginProcessBlock ( edm::ProcessBlock const &  processBlock)
override

Definition at line 323 of file TestFindProduct.cc.

References edm::GetterOfProducts< T >::fillHandles(), edm::ProcessBlock::get(), getterOfProducts_, sum_, testGetterOfProducts_, unpackBuffers-CaloStage2::token, and tokensBeginProcessBlock_.

323  {
324  for (auto const& token : tokensBeginProcessBlock_) {
325  sum_ += processBlock.get(token).value;
326  }
327  if (testGetterOfProducts_) {
328  std::vector<edm::Handle<IntProduct>> handles;
329  getterOfProducts_.fillHandles(processBlock, handles);
330  for (auto const& intHandle : handles) {
331  sum_ += intHandle->value;
332  }
333  }
334  }
std::vector< edm::EDGetTokenT< IntProduct > > tokensBeginProcessBlock_
edm::GetterOfProducts< IntProduct > getterOfProducts_
std::vector< BaseVolumeHandle * > handles
void fillHandles(ProductContainer const &productContainer, std::vector< edm::Handle< T >> &handles) const

◆ beginRun()

void edmtest::TestFindProduct::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 312 of file TestFindProduct.cc.

312 {}

◆ endJob()

void edmtest::TestFindProduct::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 382 of file TestFindProduct.cc.

References gather_cfg::cout, Exception, expectedSum_, and sum_.

382  {
383  std::cout << "TestFindProduct sum = " << sum_ << std::endl;
384  if (expectedSum_ != 0 && sum_ != expectedSum_) {
385  throw cms::Exception("TestFail")
386  << "TestFindProduct::endJob - Sum of test object values does not equal expected value";
387  }
388  }

◆ endLuminosityBlock()

void edmtest::TestFindProduct::endLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &   
)
override

Definition at line 303 of file TestFindProduct.cc.

References edm::LuminosityBlock::getByToken(), h, sum_, unpackBuffers-CaloStage2::token, and tokensEndLumi_.

303  {
304  // Get these also and add them into the sum
306  for (auto const& token : tokensEndLumi_) {
307  lb.getByToken(token, h);
308  sum_ += h->value;
309  }
310  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndLumi_

◆ endProcessBlock()

void edmtest::TestFindProduct::endProcessBlock ( edm::ProcessBlock const &  processBlock)
override

Definition at line 343 of file TestFindProduct.cc.

References Exception, edm::GetterOfProducts< T >::fillHandles(), edm::ProcessBlock::get(), edm::ProcessBlock::getByToken(), edm::ProcessBlock::getHandle(), getterOfProducts_, h, mps_fire::i, sum_, testGetterOfProducts_, unpackBuffers-CaloStage2::token, tokensEndProcessBlock2_, tokensEndProcessBlock3_, tokensEndProcessBlock4_, tokensEndProcessBlock_, heppy_batch::val, relativeConstraints::value, and contentValuesCheck::values.

343  {
344  std::vector<int> values;
345  for (auto const& token : tokensEndProcessBlock_) {
346  int value = processBlock.get(token).value;
347  values.push_back(value);
348  sum_ += value;
349  }
351  unsigned int i = 0;
352  for (auto val : values) {
353  if (i < tokensEndProcessBlock2_.size()) {
354  processBlock.getByToken(tokensEndProcessBlock2_[i], h);
355  if (h->value != val + 2) {
356  throw cms::Exception("TestFail") << "TestFindProduct::endProcessBlock 2, received unexpected value";
357  }
358  }
359  if (i < tokensEndProcessBlock3_.size()) {
360  processBlock.getByToken(tokensEndProcessBlock3_[i], h);
361  if (h->value != val + 3) {
362  throw cms::Exception("TestFail") << "TestFindProduct::endProcessBlock 3, received unexpected value";
363  }
364  }
365  if (i < tokensEndProcessBlock4_.size()) {
366  h = processBlock.getHandle(tokensEndProcessBlock4_[i]);
367  if (h->value != val + 4) {
368  throw cms::Exception("TestFail") << "TestFindProduct::endProcessBlock 4, received unexpected value";
369  }
370  }
371  ++i;
372  }
373  if (testGetterOfProducts_) {
374  std::vector<edm::Handle<IntProduct>> handles;
375  getterOfProducts_.fillHandles(processBlock, handles);
376  for (auto const& intHandle : handles) {
377  sum_ += intHandle->value;
378  }
379  }
380  }
std::vector< edm::EDGetToken > tokensEndProcessBlock2_
edm::GetterOfProducts< IntProduct > getterOfProducts_
std::vector< BaseVolumeHandle * > handles
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock4_
Definition: value.py:1
void fillHandles(ProductContainer const &productContainer, std::vector< edm::Handle< T >> &handles) const
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndProcessBlock3_

◆ endRun()

void edmtest::TestFindProduct::endRun ( edm::Run const &  run,
edm::EventSetup const &   
)
override

Definition at line 314 of file TestFindProduct.cc.

References h, writedatasetfile::run, sum_, unpackBuffers-CaloStage2::token, and tokensEndRun_.

314  {
315  // Get these also and add them into the sum
317  for (auto const& token : tokensEndRun_) {
318  run.getByToken(token, h);
319  sum_ += h->value;
320  }
321  }
std::vector< edm::EDGetTokenT< IntProduct > > tokensEndRun_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

Member Data Documentation

◆ expectedCache_

int edmtest::TestFindProduct::expectedCache_
private

Definition at line 63 of file TestFindProduct.cc.

Referenced by analyze().

◆ expectedSum_

int edmtest::TestFindProduct::expectedSum_
private

Definition at line 62 of file TestFindProduct.cc.

Referenced by endJob().

◆ getByTokenFirst_

bool edmtest::TestFindProduct::getByTokenFirst_
private

Definition at line 66 of file TestFindProduct.cc.

Referenced by analyze().

◆ getterOfProducts_

edm::GetterOfProducts<IntProduct> edmtest::TestFindProduct::getterOfProducts_
private

Definition at line 94 of file TestFindProduct.cc.

Referenced by beginProcessBlock(), endProcessBlock(), and TestFindProduct().

◆ inputTags_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTags_
private

Definition at line 61 of file TestFindProduct.cc.

Referenced by analyze(), and TestFindProduct().

◆ inputTagsBeginProcessBlock_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsBeginProcessBlock_
private

Definition at line 74 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsEndLumi_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsEndLumi_
private

Definition at line 72 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsEndProcessBlock2_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsEndProcessBlock2_
private

Definition at line 77 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsEndProcessBlock3_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsEndProcessBlock3_
private

Definition at line 78 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsEndProcessBlock4_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsEndProcessBlock4_
private

Definition at line 79 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsEndProcessBlock_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsEndProcessBlock_
private

Definition at line 76 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsEndRun_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsEndRun_
private

Definition at line 73 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsInputProcessBlock_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsInputProcessBlock_
private

Definition at line 75 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsNotFound_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsNotFound_
private

Definition at line 65 of file TestFindProduct.cc.

Referenced by analyze(), and TestFindProduct().

◆ inputTagsUInt64_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsUInt64_
private

Definition at line 71 of file TestFindProduct.cc.

Referenced by TestFindProduct().

◆ inputTagsView_

std::vector<edm::InputTag> edmtest::TestFindProduct::inputTagsView_
private

Definition at line 67 of file TestFindProduct.cc.

Referenced by analyze(), and TestFindProduct().

◆ runProducerParameterCheck_

bool edmtest::TestFindProduct::runProducerParameterCheck_
private

Definition at line 68 of file TestFindProduct.cc.

Referenced by analyze().

◆ sum_

int edmtest::TestFindProduct::sum_
private

◆ testGetterOfProducts_

bool edmtest::TestFindProduct::testGetterOfProducts_
private

Definition at line 69 of file TestFindProduct.cc.

Referenced by beginProcessBlock(), endProcessBlock(), and TestFindProduct().

◆ tokens_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokens_
private

Definition at line 81 of file TestFindProduct.cc.

Referenced by analyze(), and TestFindProduct().

◆ tokensBeginProcessBlock_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokensBeginProcessBlock_
private

Definition at line 87 of file TestFindProduct.cc.

Referenced by beginProcessBlock(), and TestFindProduct().

◆ tokensEndLumi_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokensEndLumi_
private

Definition at line 85 of file TestFindProduct.cc.

Referenced by endLuminosityBlock(), and TestFindProduct().

◆ tokensEndProcessBlock2_

std::vector<edm::EDGetToken> edmtest::TestFindProduct::tokensEndProcessBlock2_
private

Definition at line 90 of file TestFindProduct.cc.

Referenced by endProcessBlock(), and TestFindProduct().

◆ tokensEndProcessBlock3_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokensEndProcessBlock3_
private

Definition at line 91 of file TestFindProduct.cc.

Referenced by endProcessBlock(), and TestFindProduct().

◆ tokensEndProcessBlock4_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokensEndProcessBlock4_
private

Definition at line 92 of file TestFindProduct.cc.

Referenced by endProcessBlock(), and TestFindProduct().

◆ tokensEndProcessBlock_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokensEndProcessBlock_
private

Definition at line 89 of file TestFindProduct.cc.

Referenced by endProcessBlock(), and TestFindProduct().

◆ tokensEndRun_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokensEndRun_
private

Definition at line 86 of file TestFindProduct.cc.

Referenced by endRun(), and TestFindProduct().

◆ tokensInputProcessBlock_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokensInputProcessBlock_
private

Definition at line 88 of file TestFindProduct.cc.

Referenced by accessInputProcessBlock(), and TestFindProduct().

◆ tokensNotFound_

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::TestFindProduct::tokensNotFound_
private

Definition at line 82 of file TestFindProduct.cc.

Referenced by analyze(), and TestFindProduct().

◆ tokensUInt64_

std::vector<edm::EDGetTokenT<UInt64Product> > edmtest::TestFindProduct::tokensUInt64_
private

Definition at line 84 of file TestFindProduct.cc.

Referenced by analyze(), and TestFindProduct().

◆ tokensView_

std::vector<edm::EDGetTokenT<edm::View<int> > > edmtest::TestFindProduct::tokensView_
private

Definition at line 83 of file TestFindProduct.cc.

Referenced by analyze(), and TestFindProduct().