Classes | Typedefs
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)
 
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)
 
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)
 
template<typename SrcID , typename ID = SrcID>
ID readParameter (OptionalID< SrcID > const &atom, ID const &defValue)
 
template<typename SrcID , typename ID = SrcID>
ID readParameter (OptionalID< SrcID > const &atom, ID &&defValue)
 
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)
 
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)
 
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)
 
template<typename SrcID , typename ID = SrcID>
std::vector< ID > readParameter (OptionalIDsequence< SrcID > const &seq, std::vector< ID > const &defValue)
 
template<typename SrcID , typename ID = SrcID>
std::vector< ID > readParameter (OptionalIDsequence< SrcID > const &seq, std::vector< ID > &&defValue)
 

Detailed Description

FHiCL objects representing geometry classes as configuration parameters.

Typedef Documentation

Member type of validated geo::CryostatID parameter.

Definition at line 279 of file geo_types_fhicl.h.

Member type of sequence of geo::CryostatID parameters.

Definition at line 285 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 219 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 244 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 252 of file geo_types_fhicl.h.

Member type of validated geo::OpDetID parameter.

Definition at line 343 of file geo_types_fhicl.h.

Member type of sequence of geo::OpDetID parameters.

Definition at line 349 of file geo_types_fhicl.h.

Member type of optional validated geo::CryostatID parameter.

Definition at line 282 of file geo_types_fhicl.h.

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

Definition at line 288 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 248 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 256 of file geo_types_fhicl.h.

Member type of optional validated geo::OpDetID parameter.

Definition at line 346 of file geo_types_fhicl.h.

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

Definition at line 352 of file geo_types_fhicl.h.

Member type of optional validated geo::PlaneID parameter.

Definition at line 378 of file geo_types_fhicl.h.

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

Definition at line 384 of file geo_types_fhicl.h.

Member type of optional validated geo::TPCID parameter.

Definition at line 314 of file geo_types_fhicl.h.

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

Definition at line 320 of file geo_types_fhicl.h.

Member type of optional validated geo::WireID parameter.

Definition at line 410 of file geo_types_fhicl.h.

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

Definition at line 416 of file geo_types_fhicl.h.

Member type of validated geo::PlaneID parameter.

Definition at line 375 of file geo_types_fhicl.h.

Member type of sequence of geo::PlaneID parameters.

Definition at line 381 of file geo_types_fhicl.h.

Member type of validated geo::TPCID parameter.

Definition at line 311 of file geo_types_fhicl.h.

Member type of sequence of geo::TPCID parameters.

Definition at line 317 of file geo_types_fhicl.h.

Member type of validated geo::WireID parameter.

Definition at line 407 of file geo_types_fhicl.h.

Member type of sequence of geo::WireID parameters.

Definition at line 413 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) {
// ...
}
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 781 of file geo_types_fhicl.h.

781  {
782  return atom(); // conversions happen as needed (if possible)
783 } // 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:

(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 810 of file geo_types_fhicl.h.

810  {
811  using ID_t = ID;
812 
813  std::vector<ID_t> IDs;
814  std::size_t const n = seq.size();
815  IDs.reserve(n);
816  for (std::size_t i = 0; i < n; ++i)
817  IDs.push_back(seq(i)); // seq(i) is TPCIDConfig
818  return IDs;
819 } // geo::fhicl::readIDsequence()
unsigned int ID
std::void_t< T > n
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:

(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 788 of file geo_types_fhicl.h.

788  {
789  using ID_t = ID;
790 
791  typename OptionalID<SrcID>::value_type cs;
792  return atom(cs)? std::make_optional<ID_t>(cs.ID()): std::nullopt;
793 } // geo::fhicl::readOptionalID()
unsigned int ID
const char * cs
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 798 of file geo_types_fhicl.h.

799  { return readOptionalID(atom).value_or(defValue); }
ID readOptionalID(OptionalID< SrcID > const &atom, ID &&defValue)
template<typename SrcID , typename ID = SrcID>
ID geo::fhicl::readOptionalID ( OptionalID< SrcID > const &  atom,
ID &&  defValue 
)

Definition at line 804 of file geo_types_fhicl.h.

805  { return readOptionalID(atom).value_or(std::move(defValue)); }
ID readOptionalID(OptionalID< SrcID > const &atom, ID &&defValue)
def move(depos, offset)
Definition: depos.py:107
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:

(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():

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 825 of file geo_types_fhicl.h.

826 {
827  using values_t = std::vector<ID>;
828 
829  typename OptionalIDsequence<SrcID>::value_type values;
830  if (!seq(values)) return std::nullopt;
831 
832  values_t IDs;
833  IDs.reserve(values.size());
834  std::copy(values.begin(), values.end(), std::back_inserter(IDs));
835  return { std::move(IDs) };
836 
837 } // geo::fhicl::readOptionalIDsequence()
def move(depos, offset)
Definition: depos.py:107
Q_UINT16 values[128]
T copy(T const &v)
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 843 of file geo_types_fhicl.h.

844 {
845  // making sure `paramValue` is not a r-value; not sure whether it is necessary
846  auto paramValue = readOptionalIDsequence(seq);
847  return paramValue.value_or(defValue);
848 } // geo::fhicl::readOptionalIDsequence(std::vector const&)
std::vector< ID > readOptionalIDsequence(OptionalIDsequence< SrcID > const &seq, std::vector< ID > &&defValue)
template<typename SrcID , typename ID = SrcID>
std::vector< ID > geo::fhicl::readOptionalIDsequence ( OptionalIDsequence< SrcID > const &  seq,
std::vector< ID > &&  defValue 
)

Definition at line 854 of file geo_types_fhicl.h.

855 {
856  return readOptionalIDsequence(seq).value_or(std::move(defValue));
857 } // geo::fhicl::readOptionalIDsequence(std::vector const&)
def move(depos, offset)
Definition: depos.py:107
std::vector< ID > readOptionalIDsequence(OptionalIDsequence< SrcID > const &seq, std::vector< ID > &&defValue)
template<typename SrcID , typename ID = SrcID>
ID geo::fhicl::readParameter ( IDparameter< SrcID > const &  atom)

Definition at line 473 of file geo_types_fhicl.h.

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

Definition at line 519 of file geo_types_fhicl.h.

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

Definition at line 569 of file geo_types_fhicl.h.

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

Definition at line 573 of file geo_types_fhicl.h.

574  { return readOptionalID<SrcID, ID>(atom, std::move(defValue)); }
def move(depos, offset)
Definition: depos.py:107
template<typename SrcID , typename ID = SrcID>
std::vector<ID> geo::fhicl::readParameter ( IDsequence< SrcID > const &  seq)

Definition at line 617 of file geo_types_fhicl.h.

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

Definition at line 681 of file geo_types_fhicl.h.

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

Definition at line 711 of file geo_types_fhicl.h.

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

Definition at line 716 of file geo_types_fhicl.h.

717  { return readOptionalIDsequence<SrcID, ID>(seq, std::move(defValue)); }
def move(depos, offset)
Definition: depos.py:107