Public Types | Public Member Functions | Private Types | List of all members
readout::TPCsetDataContainer< T > Class Template Reference

Container with one element per readout TPC set. More...

#include <ReadoutDataContainers.h>

Inheritance diagram for readout::TPCsetDataContainer< T >:
geo::GeoIDdataContainer< T, readout::TPCsetIDmapper<> >

Public Types

using value_type = typename BaseContainer_t::value_type
 
- Public Types inherited from geo::GeoIDdataContainer< T, readout::TPCsetIDmapper<> >
using Mapper_t = readout::TPCsetIDmapper<>
 Type of mapper between IDs and index. More...
 
using ID_t = typename Mapper_t::ID_t
 Type used as ID for this container. More...
 
using value_type = typename Container_t::value_type
 
using reference = typename Container_t::reference
 
using const_reference = typename Container_t::const_reference
 
using pointer = typename Container_t::pointer
 
using const_pointer = typename Container_t::const_pointer
 
using iterator = details::GeoIDdataContainerIterator< Mapper_t, BaseIter_t >
 
using const_iterator = details::GeoIDdataContainerIterator< Mapper_t, BaseConstIter_t >
 
using difference_type = typename Container_t::difference_type
 
using size_type = typename Container_t::size_type
 
using item_iterator = details::GeoIDdataContainerItemIterator< iterator >
 Special iterator dereferencing to pairs ( ID, value ) (see items()). More...
 
using item_const_iterator = details::GeoIDdataContainerItemIterator< const_iterator >
 Special iterator dereferencing to pairs ( ID, value ) (see items()). More...
 

Public Member Functions

 TPCsetDataContainer ()=default
 Default constructor: empty container. More...
 
 TPCsetDataContainer (unsigned int nCryo, unsigned int nTPCsets)
 Prepares the container with default-constructed data. More...
 
 TPCsetDataContainer (unsigned int nCryo, unsigned int nTPCsets, value_type const &defValue)
 Prepares the container with copies of the specified default value. More...
 
Container modification
void resize (unsigned int nCryo, unsigned int nTPCsets)
 Prepares the container with default-constructed data. More...
 
void resize (unsigned int nCryo, unsigned int nTPCsets, T const &defValue)
 Prepares the container initializing all its data. More...
 
Container status query
bool hasCryostat (readout::CryostatID const &cryoid) const
 Returns whether this container hosts data for the specified cryostat. More...
 
bool hasTPCset (readout::TPCsetID const &tpcsetid) const
 Returns whether this container hosts data for the specified TPC set. More...
 
- Public Member Functions inherited from geo::GeoIDdataContainer< T, readout::TPCsetIDmapper<> >
 GeoIDdataContainer ()=default
 Default constructor: container has no room at all. More...
 
 GeoIDdataContainer (std::initializer_list< unsigned int > dims)
 Prepares the container with default-constructed data. More...
 
 GeoIDdataContainer (std::initializer_list< unsigned int > dims, value_type const &defValue)
 Prepares the container initializing all its data. More...
 
reference operator[] (ID_t const &id)
 Returns the element for the specified geometry element. More...
 
const_reference operator[] (ID_t const &id) const
 Returns the element for the specified geometry element (read-only). More...
 
reference at (ID_t const &id)
 
const_reference at (ID_t const &id) const
 
reference first ()
 Returns the element for the first ID (unchecked). More...
 
const_reference first () const
 Returns the element for the first ID (unchecked). More...
 
reference last ()
 Returns the element for the last ID (unchecked). More...
 
const_reference last () const
 Returns the element for the last ID (unchecked). More...
 
iterator begin ()
 Returns an iterator to the beginning of the data. More...
 
const_iterator begin () const
 Returns a constant iterator to the beginning of the data. More...
 
iterator end ()
 Returns an iterator to past the end of the data. More...
 
const_iterator end () const
 Returns a constant iterator to past the end of the data. More...
 
const_iterator cbegin () const
 Returns a constant iterator to the beginning of the data. More...
 
const_iterator cend () const
 Returns a constant iterator to past the end of the data. More...
 
item_iterator item_begin ()
 Returns an item iterator to the beginning of the data. More...
 
item_const_iterator item_begin () const
 Returns a item constant iterator to the beginning of the data. More...
 
item_iterator item_end ()
 Returns an item iterator to past the end of the data. More...
 
item_const_iterator item_end () const
 Returns a item constant iterator to past the end of the data. More...
 
item_const_iterator item_cbegin () const
 Returns a item constant iterator to the beginning of the data. More...
 
item_const_iterator item_cend () const
 Returns a item constant iterator to past the end of the data. More...
 
auto items ()
 Returns an object suitable for a range-for loop with item_iterator. More...
 
auto items () const
 Returns an object suitable for a range-for loop with item_const_iterator. More...
 
void fill (value_type value)
 Sets all elements to the specified value (copied). More...
 
void reset ()
 Sets all the elements to a default-constructed value_type. More...
 
Op apply (Op &&op)
 Applies an operation on all elements. More...
 
decltype(auto) apply (Op &&op) const
 Applies an operation on all elements. More...
 
void resize (std::initializer_list< unsigned int > dims)
 Prepares the container with default-constructed data. More...
 
void resize (std::initializer_list< unsigned int > dims, value_type const &defValue)
 Prepares the container initializing all its data. More...
 
void resizeAs (geo::GeoIDdataContainer< OT, Mapper_t > const &other)
 Prepares the container with default-constructed data. More...
 
void resizeAs (geo::GeoIDdataContainer< OT, Mapper_t > const &other, value_type const &defValue)
 Prepares the container initializing all its data. More...
 
void clear ()
 Makes the container empty, with no usable storage space. More...
 
size_type size () const
 Returns the number of elements in the container. More...
 
size_type capacity () const
 Returns the number of elements the container has memory for. More...
 
bool empty () const
 Returns whether the container has no elements (false by assumptions). More...
 
unsigned int dimSize () const
 Dimensions of the Level dimension of this container. More...
 
bool hasElement (GeoID const &id) const
 Returns whether this container hosts data for the specified ID. More...
 
GeoID firstID () const
 Returns the ID of the first element with GeoID type. More...
 
GeoID lastID () const
 Returns the ID of the last covered element with GeoID type. More...
 
Mapper_t const & mapper () const
 Returns the mapper object used to convert ID's and container positions. More...
 

Private Types

using BaseContainer_t = geo::GeoIDdataContainer< T, readout::TPCsetIDmapper<>>
 

Additional Inherited Members

- Static Public Member Functions inherited from geo::GeoIDdataContainer< T, readout::TPCsetIDmapper<> >
static constexpr unsigned int dimensions ()
 Dimensions of the ID of this container. More...
 

Detailed Description

template<typename T>
class readout::TPCsetDataContainer< T >

Container with one element per readout TPC set.

Template Parameters
Ttype of the contained datum
See also
geo::GeometryCore::makeTPCsetData

The container is of fixed size and can't be neither resized nor freed before destruction.

Assumptions

The following assumptions should be considered unchecked, and the behavior when they are violated undefined (but note that in debug mode some of them might be actually checked):

Definition at line 23 of file ReadoutDataContainers.h.

Member Typedef Documentation

Definition at line 63 of file ReadoutDataContainers.h.

template<typename T>
using readout::TPCsetDataContainer< T >::value_type = typename BaseContainer_t::value_type

Definition at line 67 of file ReadoutDataContainers.h.

Constructor & Destructor Documentation

template<typename T>
readout::TPCsetDataContainer< T >::TPCsetDataContainer ( )
default

Default constructor: empty container.

See also
resize()

The container starts with no room for any data. The only guarantee is that empty() is true and size() is 0. Use resize() before anything else.

template<typename T>
readout::TPCsetDataContainer< T >::TPCsetDataContainer ( unsigned int  nCryo,
unsigned int  nTPCsets 
)
inline

Prepares the container with default-constructed data.

Parameters
nCryonumber of cryostats
nTPCsetsnumber of TPC sets

The container is sized to host data for nCryo cryostats, each with nTPCsets TPC sets. Each element in the container is default-constructed.

Definition at line 87 of file ReadoutDataContainers.h.

88  : BaseContainer_t({ nCryo, nTPCsets })
89  {}
geo::GeoIDdataContainer< T, readout::TPCsetIDmapper<>> BaseContainer_t
template<typename T>
readout::TPCsetDataContainer< T >::TPCsetDataContainer ( unsigned int  nCryo,
unsigned int  nTPCsets,
value_type const &  defValue 
)
inline

Prepares the container with copies of the specified default value.

Parameters
nCryonumber of cryostats
nTPCsetsnumber of TPC sets
defValuethe value to be replicated

The container is sized to host data for nCryo cryostats, each with nTPCsets TPC sets. Each element in the container is a copy of defValue.

auto const* geom = lar::providerFrom<geo::GeometryCore>();
(geom->NCryostats(), geom->MaxTPCsets(), 3U);

Definition at line 106 of file ReadoutDataContainers.h.

107  : BaseContainer_t({ nCryo, nTPCsets }, defValue)
108  {}
geo::GeoIDdataContainer< T, readout::TPCsetIDmapper<>> BaseContainer_t

Member Function Documentation

template<typename T>
bool readout::TPCsetDataContainer< T >::hasCryostat ( readout::CryostatID const &  cryoid) const
inline

Returns whether this container hosts data for the specified cryostat.

Definition at line 159 of file ReadoutDataContainers.h.

160  { return BaseContainer_t::hasElement(cryoid); }
bool hasElement(GeoID const &id) const
Returns whether this container hosts data for the specified ID.
template<typename T>
bool readout::TPCsetDataContainer< T >::hasTPCset ( readout::TPCsetID const &  tpcsetid) const
inline

Returns whether this container hosts data for the specified TPC set.

Definition at line 163 of file ReadoutDataContainers.h.

164  { return BaseContainer_t::hasElement(tpcsetid); }
bool hasElement(GeoID const &id) const
Returns whether this container hosts data for the specified ID.
template<typename T>
void readout::TPCsetDataContainer< T >::resize ( unsigned int  nCryo,
unsigned int  nTPCsets 
)
inline

Prepares the container with default-constructed data.

Parameters
nCryonumber of cryostats
nTPCsetsnumber of TPC sets
See also
clear(), fill()

The container is sized to host data for nCryo cryostats, each with nTPCsets TPC sets. Each element in the container is default-constructed.

Existing data is not touched, but it may be rearranged in a non-straightforward way.

Definition at line 127 of file ReadoutDataContainers.h.

128  { BaseContainer_t::resize({ nCryo, nTPCsets }); }
void resize(std::initializer_list< unsigned int > dims)
Prepares the container with default-constructed data.
template<typename T>
void readout::TPCsetDataContainer< T >::resize ( unsigned int  nCryo,
unsigned int  nTPCsets,
T const &  defValue 
)
inline

Prepares the container initializing all its data.

Parameters
nCryonumber of cryostats
nTPCsetsnumber of TPC sets
defValuethe value copied to fill all entries in the container
See also
clear(), fill()

The container is sized to host data for nCryo cryostats, each with nTPCsets TPC sets. Each element in the container is a copy of defValue.

auto const* geom = lar::providerFrom<geo::GeometryCore>();
ROPsPerTPCset.resize(geom->NCryostats(), geom->MaxTPCsets(), 3U);

Existing data is not touched, but it may be rearranged in a non-straightforward way.

Definition at line 147 of file ReadoutDataContainers.h.

148  { BaseContainer_t::resize({ nCryo, nTPCsets }, defValue); }
void resize(std::initializer_list< unsigned int > dims)
Prepares the container with default-constructed data.

The documentation for this class was generated from the following file: