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 137 of file TestInterProcessProd.cc.

Constructor & Destructor Documentation

◆ TestInterProcessProd()

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

Definition at line 185 of file TestInterProcessProd.cc.

186  : token_{produces<edmtest::ThingCollection>()},
187  brToken_{produces<edmtest::ThingCollection, edm::Transition::BeginRun>("beginRun")},
188  erToken_{produces<edmtest::ThingCollection, edm::Transition::EndRun>("endRun")},
189  blToken_{produces<edmtest::ThingCollection, edm::Transition::BeginLuminosityBlock>("beginLumi")},
190  elToken_{produces<edmtest::ThingCollection, edm::Transition::EndLuminosityBlock>("endLumi")},
191  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 193 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().

193  {
194  auto const label = moduleDescription().moduleLabel();
195 
196  using namespace std::string_literals;
197 
198  std::string config = R"_(from FWCore.TestProcessor.TestProcess import *
199 process = TestProcess()
200 )_";
201  config += "process."s + label + "=" + config_ + "\n";
202  config += "process.moduleToTest(process."s + label + ")\n";
203  config += R"_(
204 process.add_(cms.Service("InitRootHandlers", UnloadRootSigHandler=cms.untracked.bool(True)))
205  )_";
206 
207  auto cache = std::make_unique<testinter::StreamCache>(config, iID.value());
208  if (iID.value() == 0) {
209  stream0Cache_ = cache.get();
210 
212  }
213 
214  return cache;
215 }
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 258 of file TestInterProcessProd.cc.

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

◆ globalBeginLuminosityBlockProduce()

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

Definition at line 247 of file TestInterProcessProd.cc.

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

248  {
249  while (not availableForBeginLumi_.load()) {
250  }
251 
252  auto v = availableForBeginLumi_.load()->beginLumiProduce(iLuminosityBlock.run());
253  iLuminosityBlock.emplace(blToken_, v);
254 
255  lastLumiIndex_.store(iLuminosityBlock.index());
256 }
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 226 of file TestInterProcessProd.cc.

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

◆ globalBeginRunProduce()

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

Definition at line 222 of file TestInterProcessProd.cc.

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

222  {
223  auto v = stream0Cache_->beginRunProduce(iRun.run());
224  iRun.emplace(brToken_, v);
225 }
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 162 of file TestInterProcessProd.cc.

162 {}

◆ globalEndLuminosityBlockProduce()

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

Definition at line 291 of file TestInterProcessProd.cc.

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

292  {
293  iLuminosityBlock.emplace(elToken_, std::move(luminosityBlockCache(iLuminosityBlock.index())->thingCollection_));
294 }
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 154 of file TestInterProcessProd.cc.

154 {}

◆ globalEndRunProduce()

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

Definition at line 243 of file TestInterProcessProd.cc.

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

243  {
244  iRun.emplace(erToken_, std::move(runCache(iRun.index())->thingCollection_));
245 }
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 217 of file TestInterProcessProd.cc.

References iEvent, and token_.

217  {
218  auto value = streamCache(iID)->produce(iEvent.id().event());
219  iEvent.emplace(token_, value);
220 }
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 263 of file TestInterProcessProd.cc.

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

265  {
266  auto cache = streamCache(iID);
267  if (cache != availableForBeginLumi_.load()) {
268  (void)cache->beginLumiProduce(iLuminosityBlock.run());
269  } else {
270  availableForBeginLumi_ = nullptr;
271  }
272 }
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 231 of file TestInterProcessProd.cc.

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

231  {
232  if (iID.value() != 0) {
233  (void)streamCache(iID)->beginRunProduce(iRun.run());
234  }
235 }
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 274 of file TestInterProcessProd.cc.

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

276  {
277  if (iID.value() == 0) {
278  luminosityBlockCache(iLuminosityBlock.index())->thingCollection_ =
279  streamCache(iID)->endLumiProduce(iLuminosityBlock.run());
280  } else {
281  (void)streamCache(iID)->endLumiProduce(iLuminosityBlock.run());
282  }
283 
284  if (lastLumiIndex_ == iLuminosityBlock.index()) {
285  testinter::StreamCache* expected = nullptr;
286 
287  availableForBeginLumi_.compare_exchange_strong(expected, streamCache(iID));
288  }
289 }
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 236 of file TestInterProcessProd.cc.

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

236  {
237  if (iID.value() == 0) {
238  runCache(iRun.index())->thingCollection_ = streamCache(iID)->endRunProduce(iRun.run());
239  } else {
240  (void)streamCache(iID)->endRunProduce(iRun.run());
241  }
242 }
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 169 of file TestInterProcessProd.cc.

Referenced by globalBeginLuminosityBlockProduce().

◆ brToken_

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

Definition at line 167 of file TestInterProcessProd.cc.

Referenced by globalBeginRunProduce().

◆ config_

std::string TestInterProcessProd::config_
private

Definition at line 172 of file TestInterProcessProd.cc.

Referenced by beginStream().

◆ elToken_

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

Definition at line 170 of file TestInterProcessProd.cc.

Referenced by globalEndLuminosityBlockProduce().

◆ erToken_

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

Definition at line 168 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 176 of file TestInterProcessProd.cc.

Referenced by beginStream(), and globalBeginRunProduce().

◆ token_

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

Definition at line 166 of file TestInterProcessProd.cc.

Referenced by produce().