art series 3.03

Previous series release notes
Next series release notes

 New features

Produces and consumes collectors

Occasionally, users have the need to delegate 'produces' and 'consumes' calls to a helper class. Until this version of art, the only way to do this was by passing to the helper class a non-const reference or pointer to the module. To provide better encapsulation of module data, and to reduce dependencies, 'producesCollector()' and 'consumesCollector()' may be invoked to provide a proxy object to the helper:

MyModule::MyModule(ParameterSet const& pset) : EDProducer{pset}
  MyHelperClass helper{producesCollector(), 

MyHelperClass::MyHelperClass(art::ProducesCollector& produces_coll,
                             art::ConsumesCollector& consumes_coll)

The provided objects are "collectors", which are declared in the following locations:

#include "art/Framework/Core/ProducesCollector.h" 
#include "art/Framework/Core/ConsumesCollector.h" 

Note that including these headers is only necessary for non-module code that requires them.

Product token retrieval by type

Users can now retrieve product tokens that match a given type (with an optionally provided selector). These tokens correspond to products that would be retrieved via the 'getMany*' interface that art provides. By calling the 'getProductTokens' function, users are better able to control when the products are read from disk:

auto const tokens = event.getProductTokens<MyProduct>();
for (auto const& token : tokens) {
  auto const h = event.getValidHandle(token);  // I/O happens here

The 'getInputTags' function can also be used, but because the desired product type is not associated with the art::InputTag type, the product type must also be specified when calling getValidHandle:

auto const tags = event.getInputTags<MyProduct>();
for (auto const& tag : tags) {
  auto const h = event.getValidHandle<MyProduct>(tag);

(Resolves issue #22147.)

Time limit option for EmptyEvent source

To support environments that are largely governed by time limits, the 'maxTime' parameter is now provided. When specified, the EmptyEvent input source will continue to create new events until the user-provided time (in seconds) has been exceeded. This parameter is mutually incompatible with the maxEvents and maxSubRuns parameter. Type 'art --print-description EmptyEvent' for more information. (Resolves issue #22403.)

 Breaking changes

Some module interface now protected

To provide better data encapsulation of modules, the produces and consumes base-class member functions of modules are now protected. This means the following code will be a compile-time failure:

MyModule::MyModule(ParameterSet const& pset) : EDProducer{pset}
  MyHelperClass helper{*this};

MyHelperClass::MyHelperClass(art::EDProducer& prod)
  prod.produces<MyProduct>("instance1");      // Error! - accessing protected interface
  prod.consumes<MyOtherProduct>("instance2"); // Error! - "" 

Users should instead use the produces and consumes interface as described above.

GLOBAL service scope changed to SHARED

The GLOBAL services scope should be replaced with the SHARED scope. A migration script is provided that will make the required changes:

# After setting up art via UPS
$ART_DIR/tools/migration/art-3.03-migration -d <top-level directory> [--dry-run]


  • Configuration pruning is now enabled by default. Users who wish to disable it may provide the command-line argument '--prune-config=false'.
  • Guessing of long program options has been disabled--i.e. it is now illegal to invoke (e.g.) '--print-d' as an alias for '--print-description'. art's support of bash completions should make this change largely irrelevant.
  • The '--memcheck' program option is now deprecated as the memory information it used to provide is already printed to the terminal as part of the end-of-job summary. A warning will be emitted to STDERR if '--memcheck' has been specified for an art job. The '--memcheck-db' program option is still supported.

  art releases