Data product declarations

A data product can be produced by any module that inherits from art::EDProducer or art::EDFilter. To enable product insertion, the 'produces' function must be called in the constructor of the module. Some examples of use are (e.g.):

MyProducer::MyProducer(Parameters const&)
  // Declare Event-level products
  produces<double>();             // product of type 'double' and empty instance name ("")
  produces<int>("myInstance1");   // product of type 'int' and instance name "myInstance1" 
  produces<int, art::InEvent>();  // product of type 'int' and empty instance name ("")
  produces<int, art::InEvent>("myInstance2"); // product of type 'int' and instance name "myInstance2" 

  // Declare SubRun-level products
  produces<int, art::InSubRun>(); // product of type 'int' and empty instance name ("")

  // Declare Run-level products
  produces<string, art::InRun>(); // product of type 'int' and empty instance name ("")

Note that if it is desired to create an event-level product, art::InEvent need not be specified as a second template argument to 'produces'. For declaring products for SubRuns and Runs, the art::InSubRun and art::InRun template arguments, respectively, must be specified.

Specifying non-persistable products (as of art 2.10)

There may be situations where it is helpful to create a product, but to not allow it to be persisted to disk. To declare a non-persistable product, an extra argument to the 'produces' function should be specified:

produces<MyProduct1>("", art::Persistable::No);  // Empty instance label
produces<MyProduct2>("myInstance", art::Persistable::No);

If an empty instance label is desired in combination with the art::Persistable::No specification, the empty string ("") must be specified as the instance name.

Products that are declared with the art::Persistable::No enumerator do not participate in the 'keep' and 'drop' commands supported by output modules. If it is desired to make the persistability configurable, then the author of the module must provide the configuration (e.g.):

MyProducer::MyProducer(Parameters const& p)
  : is_persistable_{p().is_persistable() ? art::Persistable::Yes : art::Persistable::No}
  produces<MyProduct>("myInstance", is_persistable_);

where is_persistable_ is of the type art::Persistable. Note that the default art::Persistable value is 'Yes' (e.g.):

produces<MyProduct>("myInstance"); // is equivalent to
produces<MyProduct>("myInstance", art::Persistable::Yes);