CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
pat::ModifiedObjectProducer< T > Class Template Reference

#include <ModifiedObjectProducer.h>

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Public Member Functions

void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &evs) final
 
 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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

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

Detailed Description

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

Definition at line 17 of file ModifiedObjectProducer.h.

Member Typedef Documentation

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

Definition at line 19 of file ModifiedObjectProducer.h.

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

Definition at line 20 of file ModifiedObjectProducer.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file ModifiedObjectProducer.h.

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

22  {
23  //set our input source
24  src_ = consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("src"));
25  //setup modifier
26  edm::ConsumesCollector sumes(consumesCollector());
27  const edm::ParameterSet& mod_config =
28  conf.getParameter<edm::ParameterSet>("modifierConfig");
29  modifier_.reset( new Modifier(mod_config) );
30  modifier_->setConsumes(sumes);
31  //declare products
32  produces<Collection>();
33  }
T getParameter(std::string const &) const
std::unique_ptr< Modifier > modifier_
edm::EDGetTokenT< edm::View< T > > src_
pat::ObjectModifier< T > Modifier
template<class T >
pat::ModifiedObjectProducer< T >::~ModifiedObjectProducer ( )
inlineoverride

Definition at line 34 of file ModifiedObjectProducer.h.

34 {}

Member Function Documentation

template<class T >
void pat::ModifiedObjectProducer< T >::beginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup evs 
)
inlinefinal

Definition at line 36 of file ModifiedObjectProducer.h.

References pat::ModifiedObjectProducer< T >::modifier_.

36  {
37  modifier_->setEventContent(evs);
38  }
std::unique_ptr< Modifier > modifier_
template<class T >
void pat::ModifiedObjectProducer< T >::produce ( edm::Event evt,
const edm::EventSetup evs 
)
inlinefinal

Definition at line 40 of file ModifiedObjectProducer.h.

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

40  {
42  auto output = std::make_unique<Collection>();
43 
44  evt.getByToken(src_,input);
45  output->reserve(input->size());
46 
47  modifier_->setEvent(evt);
48 
49  for( auto itr = input->begin(); itr != input->end(); ++itr ) {
50  output->push_back(*itr);
51  T& obj = output->back();
52  modifier_->modify(obj);
53  }
54 
55  evt.put(std::move(output));
56  }
std::unique_ptr< Modifier > modifier_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
static std::string const input
Definition: EdmProvDump.cc:44
edm::EDGetTokenT< edm::View< T > > src_
long double T
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<class T >
std::unique_ptr<Modifier> pat::ModifiedObjectProducer< T >::modifier_
private
template<class T >
edm::EDGetTokenT<edm::View<T> > pat::ModifiedObjectProducer< T >::src_
private