10 #ifndef LARCOREOBJ_SIMPLETYPESANDCONSTANTS_GEO_TYPES_FHICL_H
11 #define LARCOREOBJ_SIMPLETYPESANDCONSTANTS_GEO_TYPES_FHICL_H
18 #include "fhiclcpp/types/OptionalTable.h"
19 #include "fhiclcpp/types/Table.h"
20 #include "fhiclcpp/types/OptionalSequence.h"
21 #include "fhiclcpp/types/Sequence.h"
22 #include "fhiclcpp/types/OptionalAtom.h"
23 #include "fhiclcpp/types/Atom.h"
32 namespace geo::fhicl {
212 template <
typename IDparam>
218 template <
typename IDparam>
229 ::fhicl::Comment(
"whether the ID is valid"),
239 template <
typename IDtype>
243 template <
typename IDtype>
247 template <
typename IDtype>
251 template <
typename IDtype>
255 template <
typename IDtype>
267 ::fhicl::Atom<geo::CryostatID::CryostatID_t> C {
269 ::fhicl::Comment(
"cryostat number"),
270 [
this](){
return valid(); }
274 operator ID_t()
const {
return ID(); }
299 ::fhicl::Atom<geo::TPCID::TPCID_t> T {
301 ::fhicl::Comment(
"TPC number within the cryostat"),
302 [
this](){
return valid(); }
307 operator ID_t()
const {
return ID(); }
331 ::fhicl::Atom<geo::OpDetID::OpDetID_t>
O {
333 ::fhicl::Comment(
"Optical detector number within the cryostat"),
334 [
this](){
return valid(); }
339 operator ID_t()
const {
return ID(); }
363 ::fhicl::Atom<geo::PlaneID::PlaneID_t> P {
365 ::fhicl::Comment(
"Plane number within the TPC"),
366 [
this](){
return valid(); }
371 operator ID_t()
const {
return ID(); }
395 ::fhicl::Atom<geo::WireID::WireID_t> W {
397 ::fhicl::Comment(
"Wire number within the plane"),
398 [
this](){
return valid(); }
403 operator ID_t()
const {
return ID(); }
469 template <
typename SrcID,
typename ID = SrcID>
472 template <
typename SrcID,
typename ID = SrcID>
474 {
return readID<SrcID, ID>(atom); }
515 template <
typename SrcID,
typename ID = SrcID>
518 template <
typename SrcID,
typename ID = SrcID>
520 {
return readOptionalID<SrcID, ID>(atom); }
562 template <
typename SrcID,
typename ID = SrcID>
563 ID
readOptionalID(OptionalID<SrcID>
const& atom, ID
const& defValue);
565 template <
typename SrcID,
typename ID = SrcID>
568 template <
typename SrcID,
typename ID = SrcID>
570 {
return readOptionalID<SrcID, ID>(atom, defValue); }
572 template <
typename SrcID,
typename ID = SrcID>
574 {
return readOptionalID<SrcID, ID>(atom, std::move(defValue)); }
613 template <
typename SrcID,
typename ID = SrcID>
616 template <
typename SrcID,
typename ID = SrcID>
618 {
return readIDsequence<SrcID, ID>(seq); }
675 template <
typename SrcID,
typename ID = SrcID>
677 (OptionalIDsequence<SrcID>
const& seq);
679 template <
typename SrcID,
typename ID = SrcID>
682 {
return readOptionalIDsequence<SrcID, ID>(seq); }
701 template <
typename SrcID,
typename ID = SrcID>
703 (OptionalIDsequence<SrcID>
const& seq, std::vector<ID>
const& defValue);
705 template <
typename SrcID,
typename ID = SrcID>
707 (OptionalIDsequence<SrcID>
const& seq, std::vector<ID>&& defValue);
709 template <
typename SrcID,
typename ID = SrcID>
712 {
return readOptionalIDsequence<SrcID, ID>(seq, defValue); }
714 template <
typename SrcID,
typename ID = SrcID>
717 {
return readOptionalIDsequence<SrcID, ID>(seq, std::move(defValue)); }
735 template <
typename ID>
742 static constexpr
bool isOptional =
false;
744 static constexpr
bool isAtom =
true;
746 static constexpr
bool isSequence =
false;
751 template <
typename ID>
756 static constexpr
bool isOptional =
true;
760 template <
typename ID>
765 static constexpr
bool isAtom =
false;
766 static constexpr
bool isSequence =
true;
770 template <
typename ID>
775 static constexpr
bool isOptional =
true;
780 template <
typename SrcID,
typename ID >
787 template <
typename SrcID,
typename ID >
792 return atom(cs)? std::make_optional<ID_t>(cs.ID()): std::nullopt;
797 template <
typename SrcID,
typename ID >
803 template <
typename SrcID,
typename ID >
809 template <
typename SrcID,
typename ID >
813 std::vector<ID_t> IDs;
814 std::size_t
const n = seq.size();
816 for (std::size_t i = 0; i <
n; ++i)
817 IDs.push_back(seq(i));
823 template <
typename SrcID,
typename ID >
827 using values_t = std::vector<ID>;
830 if (!seq(values))
return std::nullopt;
833 IDs.reserve(values.size());
834 std::copy(values.begin(), values.end(), std::back_inserter(IDs));
835 return { std::move(IDs) };
841 template <
typename SrcID,
typename ID >
847 return paramValue.value_or(defValue);
852 template <
typename SrcID,
typename ID >
863 #endif // LARCOREOBJ_SIMPLETYPESANDCONSTANTS_GEO_TYPES_FHICL_H
::fhicl::OptionalSequence< IDparameter< IDtype >> OptionalIDsequence
Member type of optional sequence of ID parameters.
::fhicl::OptionalTable< IDConfig< IDtype >> OptionalID
Member type of optional validated ID parameter.
IDparameter< geo::OpDetID > OpDetID
Member type of validated geo::OpDetID parameter.
IDparameter< geo::CryostatID > CryostatID
Member type of validated geo::CryostatID parameter.
std::vector< ID > readIDsequence(IDsequence< SrcID > const &seq)
Returns a vector of IDs extracted from the specified ID sequence.
OptionalIDsequence< geo::OpDetID > OptionalOpDetIDsequence
Member type of optional sequence of geo::OpDetID parameters.
Traits for ID parameter objects.
OptionalID< geo::OpDetID > OptionalOpDetID
Member type of optional validated geo::OpDetID parameter.
Helper class holding the ID validity flag.
IDsequence< geo::TPCID > TPCIDsequence
Member type of sequence of geo::TPCID parameters.
OptionalIDsequence< geo::CryostatID > OptionalCryostatIDsequence
Member type of optional sequence of geo::CryostatID parameters.
ID readID(IDparameter< SrcID > const &atom)
Returns an ID extracted from the specified ID atom.
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
IDsequence< geo::PlaneID > PlaneIDsequence
Member type of sequence of geo::PlaneID parameters.
OptionalID< geo::PlaneID > OptionalPlaneID
Member type of optional validated geo::PlaneID parameter.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::optional< ID > readOptionalID(OptionalID< SrcID > const &atom)
Returns an ID extracted from the specified optional ID atom.
std::optional< std::vector< ID > > readOptionalIDsequence(OptionalIDsequence< SrcID > const &seq)
Returns a vector of IDs extracted from the specified optional ID sequence.
BEGIN_PROLOG vertical distance to the surface Name
Type of ID configuration structure (requires specialization)
OptionalID< geo::WireID > OptionalWireID
Member type of optional validated geo::WireID parameter.
IDsequence< geo::CryostatID > CryostatIDsequence
Member type of sequence of geo::CryostatID parameters.
Definition of data types for geometry description.
::fhicl::Sequence< IDparameter< IDtype >> IDsequence
Member type of sequence of ID parameters.
typename type::ID_t ID_t
Type of ID read.
OptionalID< geo::CryostatID > OptionalCryostatID
Member type of optional validated geo::CryostatID parameter.
OptionalIDsequence< geo::PlaneID > OptionalPlaneIDsequence
Member type of optional sequence of geo::PlaneID parameters.
::fhicl::Table< IDConfig< IDtype >> IDparameter
Member type of validated ID parameter.
::fhicl::Atom< bool > isValid
IDsequence< geo::WireID > WireIDsequence
Member type of sequence of geo::WireID parameters.
OptionalIDsequence< geo::TPCID > OptionalTPCIDsequence
Member type of optional sequence of geo::TPCID parameters.
size_t ID_t
Index used to identify Flash_t/QPointCollection_t uniquely in an event.
IDsequence< geo::OpDetID > OpDetIDsequence
Member type of sequence of geo::OpDetID parameters.
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
OptionalIDsequence< geo::WireID > OptionalWireIDsequence
Member type of optional sequence of geo::WireID parameters.
ID readParameter(IDparameter< SrcID > const &atom)
typename IDparameterTraits< IDparam >::ID_t IDof
Type of ID of the specified ID FHiCL parameter object/.
OptionalID< geo::TPCID > OptionalTPCID
Member type of optional validated geo::TPCID parameter.
The data type to uniquely identify a cryostat.