CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
CollectionAdder< C > Class Template Reference

#include <CollectionAdder.h>

Inheritance diagram for CollectionAdder< C >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef C collection
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 CollectionAdder (const edm::ParameterSet &cfg)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void produce (edm::Event &evt, const edm::EventSetup &) override
 

Private Attributes

std::vector< edm::EDGetTokenT
< collection > > 
srcTokens_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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<typename C>
class CollectionAdder< C >

Definition at line 17 of file CollectionAdder.h.

Member Typedef Documentation

template<typename C >
typedef C CollectionAdder< C >::collection

Definition at line 19 of file CollectionAdder.h.

Constructor & Destructor Documentation

template<typename C >
CollectionAdder< C >::CollectionAdder ( const edm::ParameterSet cfg)
inline

Definition at line 20 of file CollectionAdder.h.

20  :
21  srcTokens_(edm::vector_transform(cfg.template getParameter<std::vector<edm::InputTag> >("src"), [this](edm::InputTag const & tag){return consumes<collection>(tag);})) {
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
std::vector< edm::EDGetTokenT< collection > > srcTokens_

Member Function Documentation

template<typename C >
void CollectionAdder< C >::produce ( edm::Event evt,
const edm::EventSetup  
)
inlineoverrideprivatevirtual

Implements edm::EDProducer.

Definition at line 26 of file CollectionAdder.h.

References edm::Event::getByToken(), i, edm::Event::put(), alcazmumu_cfi::src, and CollectionAdder< C >::srcTokens_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

26  {
27  std::auto_ptr<collection> coll(new collection);
28  typename collection::Filler filler(*coll);
29  for(size_t i = 0; i < srcTokens_.size(); ++i ) {
31  evt.getByToken(srcTokens_[i], src);
32  *coll += *src;
33  }
34  evt.put(coll);
35  }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< edm::EDGetTokenT< collection > > srcTokens_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116

Member Data Documentation

template<typename C >
std::vector<edm::EDGetTokenT<collection> > CollectionAdder< C >::srcTokens_
private
Initial value:
{
produces<collection>()

Definition at line 21 of file CollectionAdder.h.

Referenced by CollectionAdder< C >::produce().