LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::fhicl Namespace Reference

FHiCL objects representing geometry classes as configuration parameters. More...

Classes

struct  IDConfig
 Type of ID configuration structure (requires specialization) More...
 
struct  IDConfig< geo::CryostatID >
 Configuration structure for validated geo::CryostatID parameter. More...
 
struct  IDConfig< geo::OpDetID >
 Configuration structure for validated geo::OpDetID parameter. More...
 
struct  IDConfig< geo::PlaneID >
 Configuration structure for validated geo::PlaneID parameter. More...
 
struct  IDConfig< geo::TPCID >
 Configuration structure for validated geo::TPCID parameter. More...
 
struct  IDConfig< geo::WireID >
 Configuration structure for validated geo::PlaneID parameter. More...
 
struct  IDConfig< readout::ROPID >
 Configuration structure for validated readout::ROPID parameter. More...
 
struct  IDConfig< readout::TPCsetID >
 Configuration structure for validated readout::TPCsetID parameter. More...
 
struct  IDparameterTraits
 Traits for ID parameter objects. More...
 
struct  IDparameterTraits< geo::fhicl::IDparameter< ID > >
 
struct  IDparameterTraits< geo::fhicl::IDsequence< ID > >
 
struct  IDparameterTraits< geo::fhicl::OptionalID< ID > >
 
struct  IDparameterTraits< geo::fhicl::OptionalIDsequence< ID > >
 
struct  ValidIDConfig
 Helper class holding the ID validity flag. More...
 

Typedefs

template<typename IDtype >
using IDparameter = ::fhicl::Table< IDConfig< IDtype >>
 Member type of validated ID parameter. More...
 
template<typename IDtype >
using OptionalID = ::fhicl::OptionalTable< IDConfig< IDtype >>
 Member type of optional validated ID parameter. More...
 
template<typename IDtype >
using IDsequence = ::fhicl::Sequence< IDparameter< IDtype >>
 Member type of sequence of ID parameters. More...
 
template<typename IDtype >
using OptionalIDsequence = ::fhicl::OptionalSequence< IDparameter< IDtype >>
 Member type of optional sequence of ID parameters. More...
 
using CryostatID = IDparameter< geo::CryostatID >
 Member type of validated geo::CryostatID parameter. More...
 
using OptionalCryostatID = OptionalID< geo::CryostatID >
 Member type of optional validated geo::CryostatID parameter. More...
 
using CryostatIDsequence = IDsequence< geo::CryostatID >
 Member type of sequence of geo::CryostatID parameters. More...
 
using OptionalCryostatIDsequence = OptionalIDsequence< geo::CryostatID >
 Member type of optional sequence of geo::CryostatID parameters. More...
 
using TPCID = IDparameter< geo::TPCID >
 Member type of validated geo::TPCID parameter. More...
 
using OptionalTPCID = OptionalID< geo::TPCID >
 Member type of optional validated geo::TPCID parameter. More...
 
using TPCIDsequence = IDsequence< geo::TPCID >
 Member type of sequence of geo::TPCID parameters. More...
 
using OptionalTPCIDsequence = OptionalIDsequence< geo::TPCID >
 Member type of optional sequence of geo::TPCID parameters. More...
 
using OpDetID = IDparameter< geo::OpDetID >
 Member type of validated geo::OpDetID parameter. More...
 
using OptionalOpDetID = OptionalID< geo::OpDetID >
 Member type of optional validated geo::OpDetID parameter. More...
 
using OpDetIDsequence = IDsequence< geo::OpDetID >
 Member type of sequence of geo::OpDetID parameters. More...
 
using OptionalOpDetIDsequence = OptionalIDsequence< geo::OpDetID >
 Member type of optional sequence of geo::OpDetID parameters. More...
 
using PlaneID = IDparameter< geo::PlaneID >
 Member type of validated geo::PlaneID parameter. More...
 
using OptionalPlaneID = OptionalID< geo::PlaneID >
 Member type of optional validated geo::PlaneID parameter. More...
 
using PlaneIDsequence = IDsequence< geo::PlaneID >
 Member type of sequence of geo::PlaneID parameters. More...
 
using OptionalPlaneIDsequence = OptionalIDsequence< geo::PlaneID >
 Member type of optional sequence of geo::PlaneID parameters. More...
 
using WireID = IDparameter< geo::WireID >
 Member type of validated geo::WireID parameter. More...
 
using OptionalWireID = OptionalID< geo::WireID >
 Member type of optional validated geo::WireID parameter. More...
 
using WireIDsequence = IDsequence< geo::WireID >
 Member type of sequence of geo::WireID parameters. More...
 
using OptionalWireIDsequence = OptionalIDsequence< geo::WireID >
 Member type of optional sequence of geo::WireID parameters. More...
 
template<typename IDparam >
using IDof = typename IDparameterTraits< IDparam >::ID_t
 Type of ID of the specified ID FHiCL parameter object/. More...
 

Functions

template<typename SrcID , typename ID = SrcID>
ID readID (IDparameter< SrcID > const &atom)
 Returns an ID extracted from the specified ID atom. More...
 
template<typename SrcID , typename ID = SrcID>
ID readParameter (IDparameter< SrcID > const &atom)
 Returns an ID extracted from the specified ID atom. More...
 
template<typename SrcID , typename ID = SrcID>
std::optional< ID > readOptionalID (OptionalID< SrcID > const &atom)
 Returns an ID extracted from the specified optional ID atom. More...
 
template<typename SrcID , typename ID = SrcID>
std::optional< ID > readParameter (OptionalID< SrcID > const &atom)
 Returns an ID extracted from the specified optional ID atom. More...
 
template<typename SrcID , typename ID = SrcID>
ID readOptionalID (OptionalID< SrcID > const &atom, ID const &defValue)
 Returns an ID extracted from the specified optional ID atom. More...
 
template<typename SrcID , typename ID = SrcID>
ID readOptionalID (OptionalID< SrcID > const &atom, ID &&defValue)
 Returns an ID extracted from the specified optional ID atom. More...
 
template<typename SrcID , typename ID = SrcID>
ID readParameter (OptionalID< SrcID > const &atom, ID const &defValue)
 Returns an ID extracted from the specified optional ID atom. More...
 
template<typename SrcID , typename ID = SrcID>
ID readParameter (OptionalID< SrcID > const &atom, ID &&defValue)
 Returns an ID extracted from the specified optional ID atom. More...
 
template<typename SrcID , typename ID = SrcID>
std::vector< ID > readIDsequence (IDsequence< SrcID > const &seq)
 Returns a vector of IDs extracted from the specified ID sequence. More...
 
template<typename SrcID , typename ID = SrcID>
std::vector< ID > readParameter (IDsequence< SrcID > const &seq)
 Returns a vector of IDs extracted from the specified ID sequence. More...
 
template<typename SrcID , typename ID = SrcID>
std::optional< std::vector< ID > > readOptionalIDsequence (OptionalIDsequence< SrcID > const &seq)
 Returns a vector of IDs extracted from the specified optional ID sequence. More...
 
template<typename SrcID , typename ID = SrcID>
std::optional< std::vector< ID > > readParameter (OptionalIDsequence< SrcID > const &seq)
 Returns a vector of IDs extracted from the specified optional ID sequence. More...
 
template<typename SrcID , typename ID = SrcID>
std::vector< ID > readOptionalIDsequence (OptionalIDsequence< SrcID > const &seq, std::vector< ID > const &defValue)
 Returns a vector of IDs extracted from the specified optional ID sequence, or a default value. More...
 
template<typename SrcID , typename ID = SrcID>
std::vector< ID > readOptionalIDsequence (OptionalIDsequence< SrcID > const &seq, std::vector< ID > &&defValue)
 Returns a vector of IDs extracted from the specified optional ID sequence, or a default value. More...
 
template<typename SrcID , typename ID = SrcID>
std::vector< ID > readParameter (OptionalIDsequence< SrcID > const &seq, std::vector< ID > const &defValue)
 Returns a vector of IDs extracted from the specified optional ID sequence, or a default value. More...
 
template<typename SrcID , typename ID = SrcID>
std::vector< ID > readParameter (OptionalIDsequence< SrcID > const &seq, std::vector< ID > &&defValue)
 Returns a vector of IDs extracted from the specified optional ID sequence, or a default value. More...
 

Detailed Description

FHiCL objects representing geometry classes as configuration parameters.

Typedef Documentation

Member type of validated geo::CryostatID parameter.

Definition at line 270 of file geo_types_fhicl.h.

Member type of sequence of geo::CryostatID parameters.

Definition at line 276 of file geo_types_fhicl.h.

template<typename IDparam >
using geo::fhicl::IDof = typedef typename IDparameterTraits<IDparam>::ID_t

Type of ID of the specified ID FHiCL parameter object/.

Definition at line 217 of file geo_types_fhicl.h.

template<typename IDtype >
using geo::fhicl::IDparameter = typedef ::fhicl::Table<IDConfig<IDtype>>

Member type of validated ID parameter.

Definition at line 238 of file geo_types_fhicl.h.

template<typename IDtype >
using geo::fhicl::IDsequence = typedef ::fhicl::Sequence<IDparameter<IDtype>>

Member type of sequence of ID parameters.

Definition at line 246 of file geo_types_fhicl.h.

Member type of validated geo::OpDetID parameter.

Definition at line 327 of file geo_types_fhicl.h.

Member type of sequence of geo::OpDetID parameters.

Definition at line 333 of file geo_types_fhicl.h.

Member type of optional validated geo::CryostatID parameter.

Definition at line 273 of file geo_types_fhicl.h.

Member type of optional sequence of geo::CryostatID parameters.

Definition at line 279 of file geo_types_fhicl.h.

template<typename IDtype >
using geo::fhicl::OptionalID = typedef ::fhicl::OptionalTable<IDConfig<IDtype>>

Member type of optional validated ID parameter.

Definition at line 242 of file geo_types_fhicl.h.

template<typename IDtype >
using geo::fhicl::OptionalIDsequence = typedef ::fhicl::OptionalSequence<IDparameter<IDtype>>

Member type of optional sequence of ID parameters.

Definition at line 250 of file geo_types_fhicl.h.

Member type of optional validated geo::OpDetID parameter.

Definition at line 330 of file geo_types_fhicl.h.

Member type of optional sequence of geo::OpDetID parameters.

Definition at line 336 of file geo_types_fhicl.h.

Member type of optional validated geo::PlaneID parameter.

Definition at line 358 of file geo_types_fhicl.h.

Member type of optional sequence of geo::PlaneID parameters.

Definition at line 364 of file geo_types_fhicl.h.

Member type of optional validated geo::TPCID parameter.

Definition at line 301 of file geo_types_fhicl.h.

Member type of optional sequence of geo::TPCID parameters.

Definition at line 307 of file geo_types_fhicl.h.

Member type of optional validated geo::WireID parameter.

Definition at line 386 of file geo_types_fhicl.h.

Member type of optional sequence of geo::WireID parameters.

Definition at line 392 of file geo_types_fhicl.h.

Member type of validated geo::PlaneID parameter.

Definition at line 355 of file geo_types_fhicl.h.

Member type of sequence of geo::PlaneID parameters.

Definition at line 361 of file geo_types_fhicl.h.

Member type of validated geo::TPCID parameter.

Definition at line 298 of file geo_types_fhicl.h.

Member type of sequence of geo::TPCID parameters.

Definition at line 304 of file geo_types_fhicl.h.

Member type of validated geo::WireID parameter.

Definition at line 383 of file geo_types_fhicl.h.

Member type of sequence of geo::WireID parameters.

Definition at line 389 of file geo_types_fhicl.h.

Function Documentation

template<typename SrcID , typename ID = SrcID>
ID geo::fhicl::readID ( IDparameter< SrcID > const &  atom)

Returns an ID extracted from the specified ID atom.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
atomthe ID atom parameter to convert
Returns
an ID object converted from atom

This function is trivial and provided mostly for uniformity of interface. In the standard usage is equivalent to using the atom directly:

struct Config {
};
void newInterface(art::EDProducer::Table<Config> const& config) {
geo::TPCID const tpcid = geo::fhicl::readID(config().TPC);
// ...
}
void classicInterface(art::EDProducer::Table<Config> const& config) {
geo::TPCID const tpcid = config().TPC();
// ...
}

has newInterface() and classicInterface() completely equivalent. Note however that because of inplementation details, config().TPC() (classic interface) does not return a geo::TPCID object, but a different, implementation dependent object that is converted upon assignment. This implies that the following variables may have different types, and the new interface is the one guaranteeing the right type:

auto tpcidNew = geo::fhicl::readID(config().TPC); // type is geo::TPCID
auto tpcidClassic = config().TPC(); // type is implementation dependent
Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 757 of file geo_types_fhicl.h.

758 {
759  return atom(); // conversions happen as needed (if possible)
760 } // geo::fhicl::readID()
template<typename SrcID , typename ID = SrcID>
std::vector< ID > geo::fhicl::readIDsequence ( IDsequence< SrcID > const &  seq)

Returns a vector of IDs extracted from the specified ID sequence.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
seqthe sequence of ID parameters to convert
Returns
a STL vector of ID objects converted from seq parameter values

This function returns the value of the specified FHiCL sequence object (fhicl::Sequence). It supports both fixed and variable size sequences, but it always returns a STL vector as a result.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("TPCs"), fhicl::Comment("selected TPCs") };
};
std::vector<geo::TPCID> fTPCs;

The constructor of that class should have an entry in the initializer list like:

fTPCs(geo::fhicl::readIDsequence(config().TPCs))

(note that the argument is just config().TPCs, not config().TPCs()).

Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 788 of file geo_types_fhicl.h.

References n, and fhicl::detail::SequenceBase::size().

Referenced by readParameter().

789 {
790  using ID_t = ID;
791 
792  std::vector<ID_t> IDs;
793  std::size_t const n = seq.size();
794  IDs.reserve(n);
795  for (std::size_t i = 0; i < n; ++i)
796  IDs.push_back(seq(i)); // seq(i) is TPCIDConfig
797  return IDs;
798 } // geo::fhicl::readIDsequence()
Char_t n[5]
template<typename SrcID , typename ID = SrcID>
std::optional< ID > geo::fhicl::readOptionalID ( OptionalID< SrcID > const &  atom)

Returns an ID extracted from the specified optional ID atom.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
atomthe optional ID atom parameter to convert
Returns
an ID object converted from atom, or no value if omitted

The return type of this function is of type std::optional. This function returns the value of the specified FHiCL optional atom (fhicl::OptionalAtom). If the parameter was omitted, no value is returned.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("refTPC"), fhicl::Comment("reference TPC") };
};
std::optional<geo::TPCID> fRefTPC;

The constructor of that class should have an entry in the initializer list like:

fRefTPC(geo::fhicl::readOptionalID(config().RefTPC))

(note that the argument is just config().RefTPC, not config().RefTPC()).

Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 764 of file geo_types_fhicl.h.

Referenced by readOptionalID(), and readParameter().

765 {
766  using ID_t = ID;
767 
768  typename OptionalID<SrcID>::value_type cs;
769  return atom(cs) ? std::make_optional<ID_t>(cs.ID()) : std::nullopt;
770 } // geo::fhicl::readOptionalID()
template<typename SrcID , typename ID = SrcID>
ID geo::fhicl::readOptionalID ( OptionalID< SrcID > const &  atom,
ID const &  defValue 
)

Returns an ID extracted from the specified optional ID atom.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
atomthe optional ID atom parameter to convert
defValuea value to use if the parameter was omitted
Returns
an ID object converted from atom, or defValue if omitted

This function returns the value of the specified FHiCL optional atom (fhicl::OptionalAtom). If the parameter was omitted, the defValue is copied or moved depending on the function.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("refTPC"), fhicl::Comment("reference TPC") };
};
std::optional<geo::TPCID> fRefTPC;

The constructor of that class should have an entry in the initializer list like:

fRefTPC(geo::fhicl::readOptionalID(config().RefTPC, { 0U, 0U }))

will set fRefTPC to C:0 T:0 TPC ID if refTPC was omitted from the configuration (note that the argument is just config().RefTPC, not config().RefTPC()).

Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 774 of file geo_types_fhicl.h.

References readOptionalID().

775 {
776  return readOptionalID(atom).value_or(defValue);
777 }
ID readOptionalID(OptionalID< SrcID > const &atom, ID &&defValue)
Returns an ID extracted from the specified optional ID atom.
template<typename SrcID , typename ID = SrcID>
ID geo::fhicl::readOptionalID ( OptionalID< SrcID > const &  atom,
ID &&  defValue 
)

Returns an ID extracted from the specified optional ID atom.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
atomthe optional ID atom parameter to convert
defValuea value to use if the parameter was omitted
Returns
an ID object converted from atom, or defValue if omitted

This function returns the value of the specified FHiCL optional atom (fhicl::OptionalAtom). If the parameter was omitted, the defValue is copied or moved depending on the function.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("refTPC"), fhicl::Comment("reference TPC") };
};
std::optional<geo::TPCID> fRefTPC;

The constructor of that class should have an entry in the initializer list like:

fRefTPC(geo::fhicl::readOptionalID(config().RefTPC, { 0U, 0U }))

will set fRefTPC to C:0 T:0 TPC ID if refTPC was omitted from the configuration (note that the argument is just config().RefTPC, not config().RefTPC()).

Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 781 of file geo_types_fhicl.h.

References readOptionalID().

782 {
783  return readOptionalID(atom).value_or(std::move(defValue));
784 }
ID readOptionalID(OptionalID< SrcID > const &atom, ID &&defValue)
Returns an ID extracted from the specified optional ID atom.
template<typename SrcID , typename ID = SrcID>
std::optional< std::vector< ID > > geo::fhicl::readOptionalIDsequence ( OptionalIDsequence< SrcID > const &  seq)

Returns a vector of IDs extracted from the specified optional ID sequence.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
seqthe optional sequence of ID parameters to convert
Returns
an optional collection containing a STL vector of ID objects converted from seq parameter values, or no value if the parameter was omitted

This function returns the value of the specified FHiCL optional sequence object (fhicl::OptionalSequence). It supports both fixed and variable size optional sequences, but it always returns an optional STL vector as a result.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("TPCs"), fhicl::Comment("selected TPCs") };
};
std::optional<std::vector<geo::TPCID>> fTPCs;

The constructor of that class should have an entry in the initializer list like:

fTPCs(geo::fhicl::readIDsequence(config().TPCs))

(note that the argument is just config().TPCs, not config().TPCs()). If instead a "default value" needs to be provided, the data member is simply:

std::vector<geo::TPCID> fTPCs;

and the value can be assigned via the standard std::optional interface:

fTPCs(geo::fhicl::readIDsequence(config().TPCs).value_or(std::vector<geo::TPCID>{}))

(in this case the default value is an empty collection of TPC IDs) or using a different overload of readOptionalIDsequence():

fTPCs(geo::fhicl::readIDsequence(config().TPCs, {}))
Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 802 of file geo_types_fhicl.h.

References fhicl::detail::SequenceBase::size(), and util::values().

Referenced by readOptionalIDsequence(), and readParameter().

804 {
805  using values_t = std::vector<ID>;
806 
807  typename OptionalIDsequence<SrcID>::value_type values;
808  if (!seq(values)) return std::nullopt;
809 
810  values_t IDs;
811  IDs.reserve(values.size());
812  std::copy(values.begin(), values.end(), std::back_inserter(IDs));
813  return {std::move(IDs)};
814 
815 } // geo::fhicl::readOptionalIDsequence()
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
template<typename SrcID , typename ID = SrcID>
std::vector< ID > geo::fhicl::readOptionalIDsequence ( OptionalIDsequence< SrcID > const &  seq,
std::vector< ID > const &  defValue 
)

Returns a vector of IDs extracted from the specified optional ID sequence, or a default value.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
seqthe optional sequence of ID parameters to convert
defValuevalue to be returned if the optional parameter was omitted
Returns
a collection containing a STL vector of ID objects converted either from seq parameter values or from defValue

This function is based on readOptionalIDsequence(IDsequence const&). The operating mode is the same, but if the value is not available from the parameters, a copy of defValue is returned, or defValue content is moved into the returned value.

Definition at line 819 of file geo_types_fhicl.h.

References readOptionalIDsequence().

821 {
822  // making sure `paramValue` is not a r-value; not sure whether it is necessary
823  auto paramValue = readOptionalIDsequence(seq);
824  return paramValue.value_or(defValue);
825 } // geo::fhicl::readOptionalIDsequence(std::vector const&)
std::vector< ID > readOptionalIDsequence(OptionalIDsequence< SrcID > const &seq, std::vector< ID > &&defValue)
Returns a vector of IDs extracted from the specified optional ID sequence, or a default value...
template<typename SrcID , typename ID = SrcID>
std::vector< ID > geo::fhicl::readOptionalIDsequence ( OptionalIDsequence< SrcID > const &  seq,
std::vector< ID > &&  defValue 
)

Returns a vector of IDs extracted from the specified optional ID sequence, or a default value.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
seqthe optional sequence of ID parameters to convert
defValuevalue to be returned if the optional parameter was omitted
Returns
a collection containing a STL vector of ID objects converted either from seq parameter values or from defValue

This function is based on readOptionalIDsequence(IDsequence const&). The operating mode is the same, but if the value is not available from the parameters, a copy of defValue is returned, or defValue content is moved into the returned value.

Definition at line 829 of file geo_types_fhicl.h.

References readOptionalIDsequence().

831 {
832  return readOptionalIDsequence(seq).value_or(std::move(defValue));
833 } // geo::fhicl::readOptionalIDsequence(std::vector const&)
std::vector< ID > readOptionalIDsequence(OptionalIDsequence< SrcID > const &seq, std::vector< ID > &&defValue)
Returns a vector of IDs extracted from the specified optional ID sequence, or a default value...
template<typename SrcID , typename ID = SrcID>
ID geo::fhicl::readParameter ( IDparameter< SrcID > const &  atom)

Returns an ID extracted from the specified ID atom.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
atomthe ID atom parameter to convert
Returns
an ID object converted from atom

This function is trivial and provided mostly for uniformity of interface. In the standard usage is equivalent to using the atom directly:

struct Config {
};
void newInterface(art::EDProducer::Table<Config> const& config) {
geo::TPCID const tpcid = geo::fhicl::readID(config().TPC);
// ...
}
void classicInterface(art::EDProducer::Table<Config> const& config) {
geo::TPCID const tpcid = config().TPC();
// ...
}

has newInterface() and classicInterface() completely equivalent. Note however that because of inplementation details, config().TPC() (classic interface) does not return a geo::TPCID object, but a different, implementation dependent object that is converted upon assignment. This implies that the following variables may have different types, and the new interface is the one guaranteeing the right type:

auto tpcidNew = geo::fhicl::readID(config().TPC); // type is geo::TPCID
auto tpcidClassic = config().TPC(); // type is implementation dependent
Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 448 of file geo_types_fhicl.h.

References readOptionalID().

449  {
450  return readID<SrcID, ID>(atom);
451  }
template<typename SrcID , typename ID = SrcID>
std::optional<ID> geo::fhicl::readParameter ( OptionalID< SrcID > const &  atom)

Returns an ID extracted from the specified optional ID atom.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
atomthe optional ID atom parameter to convert
Returns
an ID object converted from atom, or no value if omitted

The return type of this function is of type std::optional. This function returns the value of the specified FHiCL optional atom (fhicl::OptionalAtom). If the parameter was omitted, no value is returned.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("refTPC"), fhicl::Comment("reference TPC") };
};
std::optional<geo::TPCID> fRefTPC;

The constructor of that class should have an entry in the initializer list like:

fRefTPC(geo::fhicl::readOptionalID(config().RefTPC))

(note that the argument is just config().RefTPC, not config().RefTPC()).

Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 495 of file geo_types_fhicl.h.

References readOptionalID().

496  {
497  return readOptionalID<SrcID, ID>(atom);
498  }
template<typename SrcID , typename ID = SrcID>
ID geo::fhicl::readParameter ( OptionalID< SrcID > const &  atom,
ID const &  defValue 
)

Returns an ID extracted from the specified optional ID atom.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
atomthe optional ID atom parameter to convert
defValuea value to use if the parameter was omitted
Returns
an ID object converted from atom, or defValue if omitted

This function returns the value of the specified FHiCL optional atom (fhicl::OptionalAtom). If the parameter was omitted, the defValue is copied or moved depending on the function.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("refTPC"), fhicl::Comment("reference TPC") };
};
std::optional<geo::TPCID> fRefTPC;

The constructor of that class should have an entry in the initializer list like:

fRefTPC(geo::fhicl::readOptionalID(config().RefTPC, { 0U, 0U }))

will set fRefTPC to C:0 T:0 TPC ID if refTPC was omitted from the configuration (note that the argument is just config().RefTPC, not config().RefTPC()).

Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 546 of file geo_types_fhicl.h.

547  {
548  return readOptionalID<SrcID, ID>(atom, defValue);
549  }
template<typename SrcID , typename ID = SrcID>
ID geo::fhicl::readParameter ( OptionalID< SrcID > const &  atom,
ID &&  defValue 
)

Returns an ID extracted from the specified optional ID atom.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
atomthe optional ID atom parameter to convert
defValuea value to use if the parameter was omitted
Returns
an ID object converted from atom, or defValue if omitted

This function returns the value of the specified FHiCL optional atom (fhicl::OptionalAtom). If the parameter was omitted, the defValue is copied or moved depending on the function.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("refTPC"), fhicl::Comment("reference TPC") };
};
std::optional<geo::TPCID> fRefTPC;

The constructor of that class should have an entry in the initializer list like:

fRefTPC(geo::fhicl::readOptionalID(config().RefTPC, { 0U, 0U }))

will set fRefTPC to C:0 T:0 TPC ID if refTPC was omitted from the configuration (note that the argument is just config().RefTPC, not config().RefTPC()).

Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 552 of file geo_types_fhicl.h.

References readIDsequence().

553  {
554  return readOptionalID<SrcID, ID>(atom, std::move(defValue));
555  }
template<typename SrcID , typename ID = SrcID>
std::vector<ID> geo::fhicl::readParameter ( IDsequence< SrcID > const &  seq)

Returns a vector of IDs extracted from the specified ID sequence.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
seqthe sequence of ID parameters to convert
Returns
a STL vector of ID objects converted from seq parameter values

This function returns the value of the specified FHiCL sequence object (fhicl::Sequence). It supports both fixed and variable size sequences, but it always returns a STL vector as a result.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("TPCs"), fhicl::Comment("selected TPCs") };
};
std::vector<geo::TPCID> fTPCs;

The constructor of that class should have an entry in the initializer list like:

fTPCs(geo::fhicl::readIDsequence(config().TPCs))

(note that the argument is just config().TPCs, not config().TPCs()).

Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 597 of file geo_types_fhicl.h.

References readOptionalIDsequence().

598  {
599  return readIDsequence<SrcID, ID>(seq);
600  }
template<typename SrcID , typename ID = SrcID>
std::optional<std::vector<ID> > geo::fhicl::readParameter ( OptionalIDsequence< SrcID > const &  seq)

Returns a vector of IDs extracted from the specified optional ID sequence.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
seqthe optional sequence of ID parameters to convert
Returns
an optional collection containing a STL vector of ID objects converted from seq parameter values, or no value if the parameter was omitted

This function returns the value of the specified FHiCL optional sequence object (fhicl::OptionalSequence). It supports both fixed and variable size optional sequences, but it always returns an optional STL vector as a result.

Example of usage: the configuration object Config and the data member to store the configuration parameter value are defined in a class as:

struct Config {
{ fhicl::Name("TPCs"), fhicl::Comment("selected TPCs") };
};
std::optional<std::vector<geo::TPCID>> fTPCs;

The constructor of that class should have an entry in the initializer list like:

fTPCs(geo::fhicl::readIDsequence(config().TPCs))

(note that the argument is just config().TPCs, not config().TPCs()). If instead a "default value" needs to be provided, the data member is simply:

std::vector<geo::TPCID> fTPCs;

and the value can be assigned via the standard std::optional interface:

fTPCs(geo::fhicl::readIDsequence(config().TPCs).value_or(std::vector<geo::TPCID>{}))

(in this case the default value is an empty collection of TPC IDs) or using a different overload of readOptionalIDsequence():

fTPCs(geo::fhicl::readIDsequence(config().TPCs, {}))
Note
The additional template parameter ID is provided as an added bonus to choose which type to convert the configuration parameters into, and it's not enforced to be a ID type at all.

Definition at line 661 of file geo_types_fhicl.h.

References readOptionalIDsequence().

662  {
663  return readOptionalIDsequence<SrcID, ID>(seq);
664  }
template<typename SrcID , typename ID = SrcID>
std::vector<ID> geo::fhicl::readParameter ( OptionalIDsequence< SrcID > const &  seq,
std::vector< ID > const &  defValue 
)

Returns a vector of IDs extracted from the specified optional ID sequence, or a default value.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
seqthe optional sequence of ID parameters to convert
defValuevalue to be returned if the optional parameter was omitted
Returns
a collection containing a STL vector of ID objects converted either from seq parameter values or from defValue

This function is based on readOptionalIDsequence(IDsequence const&). The operating mode is the same, but if the value is not available from the parameters, a copy of defValue is returned, or defValue content is moved into the returned value.

Definition at line 692 of file geo_types_fhicl.h.

694  {
695  return readOptionalIDsequence<SrcID, ID>(seq, defValue);
696  }
template<typename SrcID , typename ID = SrcID>
std::vector<ID> geo::fhicl::readParameter ( OptionalIDsequence< SrcID > const &  seq,
std::vector< ID > &&  defValue 
)

Returns a vector of IDs extracted from the specified optional ID sequence, or a default value.

Template Parameters
SrcIDtype of the ID read by the FHiCL parameter
IDtype of the returned ID (default: same as SrcID)
Parameters
seqthe optional sequence of ID parameters to convert
defValuevalue to be returned if the optional parameter was omitted
Returns
a collection containing a STL vector of ID objects converted either from seq parameter values or from defValue

This function is based on readOptionalIDsequence(IDsequence const&). The operating mode is the same, but if the value is not available from the parameters, a copy of defValue is returned, or defValue content is moved into the returned value.

Definition at line 699 of file geo_types_fhicl.h.

700  {
701  return readOptionalIDsequence<SrcID, ID>(seq, std::move(defValue));
702  }