CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TestInterProcessProd Class Reference
Inheritance diagram for TestInterProcessProd:
edm::global::EDProducer< edm::StreamCache< testinter::StreamCache >, edm::RunCache< testinter::RunCache >, edm::BeginRunProducer, edm::EndRunProducer, edm::LuminosityBlockCache< testinter::LumiCache >, edm::BeginLuminosityBlockProducer, edm::EndLuminosityBlockProducer > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

std::unique_ptr< testinter::StreamCachebeginStream (edm::StreamID) const final
 
std::shared_ptr< testinter::LumiCacheglobalBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) const final
 
void globalBeginLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) const final
 
std::shared_ptr< testinter::RunCacheglobalBeginRun (edm::Run const &, edm::EventSetup const &) const final
 
void globalBeginRunProduce (edm::Run &, edm::EventSetup const &) const final
 
void globalEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) const final
 
void globalEndLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) const final
 
void globalEndRun (edm::Run const &, edm::EventSetup const &) const final
 
void globalEndRunProduce (edm::Run &, edm::EventSetup const &) const final
 
void produce (edm::StreamID, edm::Event &, edm::EventSetup const &) const final
 
void streamBeginLuminosityBlock (edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const final
 
void streamBeginRun (edm::StreamID, edm::Run const &, edm::EventSetup const &) const final
 
void streamEndLuminosityBlock (edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const final
 
void streamEndRun (edm::StreamID, edm::Run const &, edm::EventSetup const &) const final
 
 TestInterProcessProd (edm::ParameterSet const &)
 
- Public Member Functions inherited from edm::global::EDProducer< edm::StreamCache< testinter::StreamCache >, edm::RunCache< testinter::RunCache >, edm::BeginRunProducer, edm::EndRunProducer, edm::LuminosityBlockCache< testinter::LumiCache >, edm::BeginLuminosityBlockProducer, edm::EndLuminosityBlockProducer >
 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
 
EDProduceroperator= (const EDProducer &)=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::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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

std::atomic< testinter::StreamCache * > availableForBeginLumi_
 
edm::EDPutTokenT< edmtest::ThingCollection > const blToken_
 
edm::EDPutTokenT< edmtest::ThingCollection > const brToken_
 
std::string config_
 
edm::EDPutTokenT< edmtest::ThingCollection > const elToken_
 
edm::EDPutTokenT< edmtest::ThingCollection > const erToken_
 
std::atomic< unsigned int > lastLumiIndex_ = 0
 
testinter::StreamCachestream0Cache_ = nullptr
 
edm::EDPutTokenT< edmtest::ThingCollection > const token_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- 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 138 of file TestInterProcessProd.cc.

Constructor & Destructor Documentation

◆ TestInterProcessProd()

TestInterProcessProd::TestInterProcessProd ( edm::ParameterSet const &  iPSet)

Definition at line 186 of file TestInterProcessProd.cc.

187  : token_{produces<edmtest::ThingCollection>()},
188  brToken_{produces<edmtest::ThingCollection, edm::Transition::BeginRun>("beginRun")},
189  erToken_{produces<edmtest::ThingCollection, edm::Transition::EndRun>("endRun")},
190  blToken_{produces<edmtest::ThingCollection, edm::Transition::BeginLuminosityBlock>("beginLumi")},
191  elToken_{produces<edmtest::ThingCollection, edm::Transition::EndLuminosityBlock>("endLumi")},
192  config_{iPSet.getUntrackedParameter<std::string>("@python_config")} {}
edm::EDPutTokenT< edmtest::ThingCollection > const blToken_
edm::EDPutTokenT< edmtest::ThingCollection > const elToken_
edm::EDPutTokenT< edmtest::ThingCollection > const token_
edm::EDPutTokenT< edmtest::ThingCollection > const erToken_
edm::EDPutTokenT< edmtest::ThingCollection > const brToken_

Member Function Documentation

◆ beginStream()

std::unique_ptr< testinter::StreamCache > TestInterProcessProd::beginStream ( edm::StreamID  iID) const
final

Definition at line 194 of file TestInterProcessProd.cc.

References availableForBeginLumi_, utilities::cache(), DiMuonV_cfg::config, config_, label, edm::global::EDProducerBase::moduleDescription(), edm::ModuleDescription::moduleLabel(), alignCSCRings::s, stream0Cache_, AlCaHLTBitMon_QueryRunRegistry::string, and edm::StreamID::value().

194  {
195  auto const label = moduleDescription().moduleLabel();
196 
197  using namespace std::string_literals;
198 
199  std::string config = R"_(from FWCore.TestProcessor.TestProcess import *
200 process = TestProcess()
201 )_";
202  config += "process."s + label + "=" + config_ + "\n";
203  config += "process.moduleToTest(process."s + label + ")\n";
204  config += R"_(
205 process.add_(cms.Service("InitRootHandlers", UnloadRootSigHandler=cms.untracked.bool(True)))
206  )_";
207 
208  auto cache = std::make_unique<testinter::StreamCache>(config, iID.value());
209  if (iID.value() == 0) {
210  stream0Cache_ = cache.get();
211 
213  }
214 
215  return cache;
216 }
testinter::StreamCache * stream0Cache_
Definition: config.py:1
char const * label
ModuleDescription const & moduleDescription() const
std::atomic< testinter::StreamCache * > availableForBeginLumi_
def cache(function)
Definition: utilities.py:3
dictionary config
Read in AllInOne config in JSON format.
Definition: DiMuonV_cfg.py:30
unsigned int value() const
Definition: StreamID.h:43
std::string const & moduleLabel() const

◆ globalBeginLuminosityBlock()

std::shared_ptr< testinter::LumiCache > TestInterProcessProd::globalBeginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) const
final

Definition at line 259 of file TestInterProcessProd.cc.

260  {
261  return std::make_shared<testinter::LumiCache>();
262 }

◆ globalBeginLuminosityBlockProduce()

void TestInterProcessProd::globalBeginLuminosityBlockProduce ( edm::LuminosityBlock iLuminosityBlock,
edm::EventSetup const &   
) const
final

Definition at line 248 of file TestInterProcessProd.cc.

References availableForBeginLumi_, blToken_, edm::LuminosityBlock::emplace(), edm::LuminosityBlock::index(), lastLumiIndex_, edm::LuminosityBlockBase::run(), and findQualityFiles::v.

249  {
250  while (not availableForBeginLumi_.load()) {
251  }
252 
253  auto v = availableForBeginLumi_.load()->beginLumiProduce(iLuminosityBlock.run());
254  iLuminosityBlock.emplace(blToken_, v);
255 
256  lastLumiIndex_.store(iLuminosityBlock.index());
257 }
edm::EDPutTokenT< edmtest::ThingCollection > const blToken_
std::atomic< unsigned int > lastLumiIndex_
std::atomic< testinter::StreamCache * > availableForBeginLumi_
void emplace(EDPutTokenT< PROD > token, Args &&... args)
puts a new product
LuminosityBlockIndex index() const

◆ globalBeginRun()

std::shared_ptr< testinter::RunCache > TestInterProcessProd::globalBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
) const
final

Definition at line 227 of file TestInterProcessProd.cc.

228  {
229  return std::make_shared<testinter::RunCache>();
230 }

◆ globalBeginRunProduce()

void TestInterProcessProd::globalBeginRunProduce ( edm::Run iRun,
edm::EventSetup const &   
) const
final

Definition at line 223 of file TestInterProcessProd.cc.

References testinter::StreamCache::beginRunProduce(), brToken_, edm::Run::emplace(), edm::RunBase::run(), stream0Cache_, and findQualityFiles::v.

223  {
224  auto v = stream0Cache_->beginRunProduce(iRun.run());
225  iRun.emplace(brToken_, v);
226 }
edmtest::ThingCollection beginRunProduce(unsigned long long iTransitionID)
testinter::StreamCache * stream0Cache_
void emplace(EDPutTokenT< PROD > token, Args &&... args)
puts a new product
Definition: Run.h:244
RunNumber_t run() const
Definition: RunBase.h:40
edm::EDPutTokenT< edmtest::ThingCollection > const brToken_

◆ globalEndLuminosityBlock()

void TestInterProcessProd::globalEndLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) const
inlinefinal

Definition at line 163 of file TestInterProcessProd.cc.

163 {}

◆ globalEndLuminosityBlockProduce()

void TestInterProcessProd::globalEndLuminosityBlockProduce ( edm::LuminosityBlock iLuminosityBlock,
edm::EventSetup const &   
) const
final

Definition at line 292 of file TestInterProcessProd.cc.

References elToken_, edm::LuminosityBlock::emplace(), edm::LuminosityBlock::index(), and eostools::move().

293  {
294  iLuminosityBlock.emplace(elToken_, std::move(luminosityBlockCache(iLuminosityBlock.index())->thingCollection_));
295 }
edm::EDPutTokenT< edmtest::ThingCollection > const elToken_
void emplace(EDPutTokenT< PROD > token, Args &&... args)
puts a new product
LuminosityBlockIndex index() const
def move(src, dest)
Definition: eostools.py:511

◆ globalEndRun()

void TestInterProcessProd::globalEndRun ( edm::Run const &  ,
edm::EventSetup const &   
) const
inlinefinal

Definition at line 155 of file TestInterProcessProd.cc.

155 {}

◆ globalEndRunProduce()

void TestInterProcessProd::globalEndRunProduce ( edm::Run iRun,
edm::EventSetup const &   
) const
final

Definition at line 244 of file TestInterProcessProd.cc.

References edm::Run::emplace(), erToken_, edm::Run::index(), and eostools::move().

244  {
245  iRun.emplace(erToken_, std::move(runCache(iRun.index())->thingCollection_));
246 }
void emplace(EDPutTokenT< PROD > token, Args &&... args)
puts a new product
Definition: Run.h:244
edm::EDPutTokenT< edmtest::ThingCollection > const erToken_
RunIndex index() const
Definition: Run.cc:28
def move(src, dest)
Definition: eostools.py:511

◆ produce()

void TestInterProcessProd::produce ( edm::StreamID  iID,
edm::Event iEvent,
edm::EventSetup const &   
) const
finalvirtual

Implements edm::global::EDProducerBase.

Definition at line 218 of file TestInterProcessProd.cc.

References iEvent, and token_.

218  {
219  auto value = streamCache(iID)->produce(iEvent.id().event());
220  iEvent.emplace(token_, value);
221 }
int iEvent
Definition: GenABIO.cc:224
edm::EDPutTokenT< edmtest::ThingCollection > const token_
Definition: value.py:1

◆ streamBeginLuminosityBlock()

void TestInterProcessProd::streamBeginLuminosityBlock ( edm::StreamID  iID,
edm::LuminosityBlock const &  iLuminosityBlock,
edm::EventSetup const &   
) const
final

Definition at line 264 of file TestInterProcessProd.cc.

References availableForBeginLumi_, utilities::cache(), edm::LuminosityBlockBase::run(), and funct::void.

266  {
267  auto cache = streamCache(iID);
268  if (cache != availableForBeginLumi_.load()) {
269  (void)cache->beginLumiProduce(iLuminosityBlock.run());
270  } else {
271  availableForBeginLumi_ = nullptr;
272  }
273 }
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
std::atomic< testinter::StreamCache * > availableForBeginLumi_
def cache(function)
Definition: utilities.py:3

◆ streamBeginRun()

void TestInterProcessProd::streamBeginRun ( edm::StreamID  iID,
edm::Run const &  iRun,
edm::EventSetup const &   
) const
final

Definition at line 232 of file TestInterProcessProd.cc.

References edm::RunBase::run(), edm::StreamID::value(), and funct::void.

232  {
233  if (iID.value() != 0) {
234  (void)streamCache(iID)->beginRunProduce(iRun.run());
235  }
236 }
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
unsigned int value() const
Definition: StreamID.h:43

◆ streamEndLuminosityBlock()

void TestInterProcessProd::streamEndLuminosityBlock ( edm::StreamID  iID,
edm::LuminosityBlock const &  iLuminosityBlock,
edm::EventSetup const &   
) const
final

Definition at line 275 of file TestInterProcessProd.cc.

References availableForBeginLumi_, edm::LuminosityBlock::index(), lastLumiIndex_, edm::LuminosityBlockBase::run(), edm::StreamID::value(), and funct::void.

277  {
278  if (iID.value() == 0) {
279  luminosityBlockCache(iLuminosityBlock.index())->thingCollection_ =
280  streamCache(iID)->endLumiProduce(iLuminosityBlock.run());
281  } else {
282  (void)streamCache(iID)->endLumiProduce(iLuminosityBlock.run());
283  }
284 
285  if (lastLumiIndex_ == iLuminosityBlock.index()) {
286  testinter::StreamCache* expected = nullptr;
287 
288  availableForBeginLumi_.compare_exchange_strong(expected, streamCache(iID));
289  }
290 }
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
std::atomic< unsigned int > lastLumiIndex_
std::atomic< testinter::StreamCache * > availableForBeginLumi_
unsigned int value() const
Definition: StreamID.h:43

◆ streamEndRun()

void TestInterProcessProd::streamEndRun ( edm::StreamID  iID,
edm::Run const &  iRun,
edm::EventSetup const &   
) const
final

Definition at line 237 of file TestInterProcessProd.cc.

References edm::Run::index(), edm::RunBase::run(), edm::StreamID::value(), and funct::void.

237  {
238  if (iID.value() == 0) {
239  runCache(iRun.index())->thingCollection_ = streamCache(iID)->endRunProduce(iRun.run());
240  } else {
241  (void)streamCache(iID)->endRunProduce(iRun.run());
242  }
243 }
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
unsigned int value() const
Definition: StreamID.h:43

Member Data Documentation

◆ availableForBeginLumi_

std::atomic<testinter::StreamCache*> TestInterProcessProd::availableForBeginLumi_
mutableprivate

◆ blToken_

edm::EDPutTokenT<edmtest::ThingCollection> const TestInterProcessProd::blToken_
private

Definition at line 170 of file TestInterProcessProd.cc.

Referenced by globalBeginLuminosityBlockProduce().

◆ brToken_

edm::EDPutTokenT<edmtest::ThingCollection> const TestInterProcessProd::brToken_
private

Definition at line 168 of file TestInterProcessProd.cc.

Referenced by globalBeginRunProduce().

◆ config_

std::string TestInterProcessProd::config_
private

Definition at line 173 of file TestInterProcessProd.cc.

Referenced by beginStream().

◆ elToken_

edm::EDPutTokenT<edmtest::ThingCollection> const TestInterProcessProd::elToken_
private

Definition at line 171 of file TestInterProcessProd.cc.

Referenced by globalEndLuminosityBlockProduce().

◆ erToken_

edm::EDPutTokenT<edmtest::ThingCollection> const TestInterProcessProd::erToken_
private

Definition at line 169 of file TestInterProcessProd.cc.

Referenced by globalEndRunProduce().

◆ lastLumiIndex_

std::atomic<unsigned int> TestInterProcessProd::lastLumiIndex_ = 0
mutableprivate

◆ stream0Cache_

testinter::StreamCache* TestInterProcessProd::stream0Cache_ = nullptr
mutableprivate

Definition at line 177 of file TestInterProcessProd.cc.

Referenced by beginStream(), and globalBeginRunProduce().

◆ token_

edm::EDPutTokenT<edmtest::ThingCollection> const TestInterProcessProd::token_
private

Definition at line 167 of file TestInterProcessProd.cc.

Referenced by produce().