CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
pat::helper::AnythingToValueMap< Adaptor, Collection, value_type > Class Template Reference

#include <AnythingToValueMap.h>

Inheritance diagram for pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >:
edm::stream::EDProducer<>

Public Types

typedef edm::ValueMap< value_type > Map
 
typedef Map::Filler MapFiller
 
- Public Types inherited from edm::stream::EDProducer<>
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
 

Public Member Functions

 AnythingToValueMap (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~AnythingToValueMap () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 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
 

Private Attributes

Adaptor adaptor_
 
bool failSilently_
 
edm::EDGetTokenT< Collection > src_
 

Detailed Description

template<class Adaptor, class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
class pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >

Definition at line 19 of file AnythingToValueMap.h.

Member Typedef Documentation

◆ Map

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
typedef edm::ValueMap<value_type> pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::Map

Definition at line 21 of file AnythingToValueMap.h.

◆ MapFiller

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
typedef Map::Filler pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::MapFiller

Definition at line 22 of file AnythingToValueMap.h.

Constructor & Destructor Documentation

◆ AnythingToValueMap()

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::AnythingToValueMap ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 23 of file AnythingToValueMap.h.

References pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::adaptor_.

24  : failSilently_(iConfig.getUntrackedParameter<bool>("failSilently", false)),
25  src_(consumes<Collection>(iConfig.getParameter<edm::InputTag>("src"))),
26  adaptor_(iConfig, consumesCollector()) {
27  produces<Map>(adaptor_.label());
28  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< Collection > src_

◆ ~AnythingToValueMap()

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::~AnythingToValueMap ( )
inlineoverride

Definition at line 29 of file AnythingToValueMap.h.

29 {}

Member Function Documentation

◆ produce()

template<class Adaptor , class Collection , typename value_type >
void pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 40 of file AnythingToValueMap.h.

References trigObjTnPSource_cfi::filler, patZpeak::handle, iEvent, genParticles_cff::map, eostools::move(), and runTheMatrix::ret.

41  {
43  iEvent.getByToken(src_, handle);
44  if (handle.failedToGet() && failSilently_)
45  return;
46 
47  bool adaptorOk = adaptor_.init(iEvent);
48  if ((!adaptorOk) && failSilently_)
49  return;
50 
51  std::vector<value_type> ret;
52  ret.reserve(handle->size());
53 
54  adaptor_.run(*handle, ret);
55 
56  auto map = std::make_unique<Map>();
58  filler.insert(handle, ret.begin(), ret.end());
59  filler.fill();
60  iEvent.put(std::move(map), adaptor_.label());
61  }
ret
prodAgent to be discontinued
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< Collection > src_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ adaptor_

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
Adaptor pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::adaptor_
private

◆ failSilently_

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
bool pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::failSilently_
private

Definition at line 34 of file AnythingToValueMap.h.

◆ src_

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
edm::EDGetTokenT<Collection> pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::src_
private

Definition at line 35 of file AnythingToValueMap.h.