CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
pat::ModifiedObjectProducer< T > Class Template Reference
Inheritance diagram for pat::ModifiedObjectProducer< T >:
edm::stream::EDProducer<>

Public Types

typedef std::vector< TCollection
 
typedef pat::ObjectModifier< TModifier
 
- 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

 ModifiedObjectProducer (const edm::ParameterSet &conf)
 
void produce (edm::Event &evt, const edm::EventSetup &evs) final
 
 ~ModifiedObjectProducer () 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

std::unique_ptr< Modifiermodifier_
 
edm::EDGetTokenT< edm::View< T > > src_
 

Detailed Description

template<class T>
class pat::ModifiedObjectProducer< T >

Definition at line 19 of file ModifiedObjectProducer.cc.

Member Typedef Documentation

◆ Collection

template<class T >
typedef std::vector<T> pat::ModifiedObjectProducer< T >::Collection

Definition at line 21 of file ModifiedObjectProducer.cc.

◆ Modifier

template<class T >
typedef pat::ObjectModifier<T> pat::ModifiedObjectProducer< T >::Modifier

Definition at line 22 of file ModifiedObjectProducer.cc.

Constructor & Destructor Documentation

◆ ModifiedObjectProducer()

template<class T >
pat::ModifiedObjectProducer< T >::ModifiedObjectProducer ( const edm::ParameterSet conf)
inline

Definition at line 24 of file ModifiedObjectProducer.cc.

References edm::ParameterSet::getParameter(), pat::ModifiedObjectProducer< T >::modifier_, and pat::ModifiedObjectProducer< T >::src_.

24  {
25  //set our input source
26  src_ = consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("src"));
27  //setup modifier
28  const edm::ParameterSet& mod_config = conf.getParameter<edm::ParameterSet>("modifierConfig");
29  modifier_ = std::make_unique<Modifier>(mod_config, consumesCollector());
30  //declare products
31  produces<Collection>();
32  }
std::unique_ptr< Modifier > modifier_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::View< T > > src_

◆ ~ModifiedObjectProducer()

template<class T >
pat::ModifiedObjectProducer< T >::~ModifiedObjectProducer ( )
inlineoverride

Definition at line 33 of file ModifiedObjectProducer.cc.

33 {}

Member Function Documentation

◆ produce()

template<class T >
void pat::ModifiedObjectProducer< T >::produce ( edm::Event evt,
const edm::EventSetup evs 
)
inlinefinal

Definition at line 35 of file ModifiedObjectProducer.cc.

References input, pat::ModifiedObjectProducer< T >::modifier_, eostools::move(), getGTfromDQMFile::obj, convertSQLitetoXML_cfg::output, and pat::ModifiedObjectProducer< T >::src_.

35  {
36  modifier_->setEventContent(evs);
37 
38  auto output = std::make_unique<Collection>();
39 
40  auto input = evt.getHandle(src_);
41  output->reserve(input->size());
42 
43  modifier_->setEvent(evt);
44 
45  for (auto const& itr : *input) {
46  output->push_back(itr);
47  T& obj = output->back();
48  modifier_->modify(obj);
49  }
50 
51  evt.put(std::move(output));
52  }
std::unique_ptr< Modifier > modifier_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
static std::string const input
Definition: EdmProvDump.cc:50
edm::EDGetTokenT< edm::View< T > > src_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:560
long double T
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ modifier_

template<class T >
std::unique_ptr<Modifier> pat::ModifiedObjectProducer< T >::modifier_
private

◆ src_

template<class T >
edm::EDGetTokenT<edm::View<T> > pat::ModifiedObjectProducer< T >::src_
private