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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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 Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &evs) override final
 
 ModifiedObjectProducer (const edm::ParameterSet &conf)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &evs) override final
 
 ~ModifiedObjectProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

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::EDConsumerBase::consumesCollector(), 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
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_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
pat::ObjectModifier< T > Modifier
template<class T >
pat::ModifiedObjectProducer< T >::~ModifiedObjectProducer ( )
inline

Definition at line 34 of file ModifiedObjectProducer.h.

34 {}

Member Function Documentation

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

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 >
virtual void pat::ModifiedObjectProducer< T >::produce ( edm::Event evt,
const edm::EventSetup evs 
)
inlinefinaloverridevirtual

Definition at line 40 of file ModifiedObjectProducer.h.

References input, pat::ModifiedObjectProducer< T >::modifier_, eostools::move(), MuonAssociatorByHits_cfi::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:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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