ParameterSet Creation » History » Version 5

« Previous - Version 5/9 (diff) - Next » - Current version
Walter E Brown, 03/06/2012 02:23 PM

ParameterSet Creation

This page is under construction

From a FHiCL document

A ParameterSet object can be obtained directly from a FHiCL document by calling a function, make_ParameterSet. The call takes one of two forms, depending on how the document is represented.

  • Given a FHiCL document represented by a variable doc of type std::string:
    #include "fhiclcpp/make_ParameterSet.h" 
    fhicl::ParameterSet pset;
    fhicl::make_ParameterSet(doc, pset);
  • Given a FHiCL document contained in an external text file, there is the slight complication of finding the correct file. This is handled by appealing to functionality found in the external cetlib library. Given (a) the file's name as a variable fname of type std::string and (b) a variable maker of static type cet::filepath_maker:
    #include "fhiclcpp/make_ParameterSet.h" 
    fhicl::ParameterSet pset;
    fhicl::make_ParameterSet(fname, maker, pset);

From multiple sources

In practice, it is often the case that a FHiCL document is not the sole source for obtaining a ParameterSet. Additional information may come from command-line arguments, for example, and may be used to augment or otherwise adjust a ParameterSet before it is considered finalized.

While it is possible to update a ParameterSet directly (e.g., via its put and erase member functions), such an approach is not generally recommended, as the design of the ParameterSet class is strongly biased in favor of inspection and retrieval operations and against modifications. This is the reason for the earlier recommendation that a ParameterSet be generally treated as immutable.

For this reason, the fhiclcpp library provides a type, intermediate_table, that can capture information presented by a FHiCL document, can be readily updated, and can be used to obtain a ParameterSet. As detailed below, an intermediate_table has some characteristics reminiscent of a ParameterSet, some characteristics reminiscent of a FHiCL document, and some characteristics of its own. We first discuss two other types, value_tag and extended_value, that provide support for intermediate_table.