CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes
edmtest::TransformAsyncIntStreamProducer Class Reference
Inheritance diagram for edmtest::TransformAsyncIntStreamProducer:
edm::stream::EDProducer< edm::Transformer >

Classes

struct  WorkCache
 

Public Member Functions

void produce (edm::Event &iEvent, edm::EventSetup const &) override
 
 TransformAsyncIntStreamProducer (edm::ParameterSet const &iPSet)
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::Transformer >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &desc)
 

Private Attributes

const edm::EDGetTokenT< IntProduct > getToken_
 
const unsigned int offset_
 
edm::EDPutTokenT< IntProduct > putToken_
 
const unsigned int transformOffset_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::Transformer >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 10 of file TransformAsyncIntStreamProducer.cc.

Constructor & Destructor Documentation

◆ TransformAsyncIntStreamProducer()

edmtest::TransformAsyncIntStreamProducer::TransformAsyncIntStreamProducer ( edm::ParameterSet const &  iPSet)
inline

Definition at line 17 of file TransformAsyncIntStreamProducer.cc.

References RPCNoise_example::check, Exception, edm::ParameterSet::getUntrackedParameter(), HLT_IsoTrack_cff::offset, putToken_, runTheMatrix::ret, and transformOffset_.

18  : getToken_(consumes(iPSet.getParameter<edm::InputTag>("get"))),
19  offset_(iPSet.getParameter<unsigned int>("offset")),
20  transformOffset_(iPSet.getParameter<unsigned int>("transformOffset")) {
21  putToken_ = produces<IntProduct>();
22  bool check = iPSet.getUntrackedParameter<bool>("checkTransformNotCalled");
23  registerTransformAsync(
24  putToken_,
25  [offset = transformOffset_, check](auto const& iFrom, auto iTask) {
26  if (check) {
27  throw cms::Exception("TransformShouldNotBeCalled");
28  }
29  WorkCache ret;
30  using namespace std::chrono_literals;
31  ret.thread_ = std::make_shared<std::thread>([iTask] { std::this_thread::sleep_for(100ms); });
32  ret.value_ = IntProduct(iFrom.value + offset);
33  return ret;
34  },
35  [](auto const& iFrom) {
36  iFrom.thread_->join();
37  return iFrom.value_;
38  },
39  "transform");
40  }
ret
prodAgent to be discontinued

Member Function Documentation

◆ fillDescriptions()

static void edmtest::TransformAsyncIntStreamProducer::fillDescriptions ( edm::ConfigurationDescriptions desc)
inlinestatic

Definition at line 45 of file TransformAsyncIntStreamProducer.cc.

References submitPVResolutionJobs::desc, and muonDTDigis_cfi::pset.

45  {
47  pset.add<edm::InputTag>("get");
48  pset.add<unsigned int>("offset", 0);
49  pset.add<unsigned int>("transformOffset", 1);
50  pset.addUntracked<bool>("checkTransformNotCalled", false);
51 
52  desc.addDefault(pset);
53  }

◆ produce()

void edmtest::TransformAsyncIntStreamProducer::produce ( edm::Event iEvent,
edm::EventSetup const &   
)
inlineoverride

Definition at line 42 of file TransformAsyncIntStreamProducer.cc.

References getToken_, iEvent, offset_, and putToken_.

42  {
43  iEvent.emplace(putToken_, iEvent.get(getToken_).value + offset_);
44  }
int iEvent
Definition: GenABIO.cc:224

Member Data Documentation

◆ getToken_

const edm::EDGetTokenT<IntProduct> edmtest::TransformAsyncIntStreamProducer::getToken_
private

Definition at line 56 of file TransformAsyncIntStreamProducer.cc.

Referenced by produce().

◆ offset_

const unsigned int edmtest::TransformAsyncIntStreamProducer::offset_
private

Definition at line 58 of file TransformAsyncIntStreamProducer.cc.

Referenced by produce().

◆ putToken_

edm::EDPutTokenT<IntProduct> edmtest::TransformAsyncIntStreamProducer::putToken_
private

Definition at line 57 of file TransformAsyncIntStreamProducer.cc.

Referenced by produce(), and TransformAsyncIntStreamProducer().

◆ transformOffset_

const unsigned int edmtest::TransformAsyncIntStreamProducer::transformOffset_
private

Definition at line 59 of file TransformAsyncIntStreamProducer.cc.

Referenced by TransformAsyncIntStreamProducer().