LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Collection of functions to transform photon mapping data. More...
#include "IPhotonMappingTransformations.h"
Public Types | |
using | OpDetID_t = int |
Type describing a optical detector ID. More... | |
using | LibraryIndex_t = OpDetID_t |
Type describing a library index. FIXME former LibraryOpDetID_t. More... | |
using | LibraryIndexToOpDetMap = std::vector< OpDetID_t > |
Type describing the mapping of optical detectors into library indices. More... | |
using | OpDetToLibraryIndexMap = std::vector< LibraryIndex_t > |
Type describing the mapping of library indices into optical detectors. More... | |
template<typename LibDataColl > | |
using | MappedOpDetData_t = phot::OpDetVisibilityData< util::collection_reference_t< LibDataColl >, util::collection_reference_t< OpDetToLibraryIndexMap const >> |
Type of optical detector data collection. More... | |
Public Member Functions | |
virtual | ~IPhotonMappingTransformations ()=default |
template<typename Coll > | |
auto | applyOpDetMapping (OpDetToLibraryIndexMap const &opDetToLibraryMap, Coll &&source, util::collection_value_t< Coll > defaultValue) const -> MappedOpDetData_t< Coll > |
Geometry mapping interface | |
virtual geo::Point_t | detectorToLibrary (geo::Point_t const &location) const =0 |
Returns the representation within the library of a detector location. More... | |
Optical detector mapping interface | |
Here the mapping is provided between optical detectors ( Terms and roles of the various concepts involved in the mapping may be confusing: see the glossary in | |
virtual LibraryIndex_t | opDetToLibraryIndex (geo::Point_t const &location, OpDetID_t opDetID) const =0 |
Returns the library index for the specified optical detector. More... | |
virtual OpDetID_t | libraryIndexToOpDet (geo::Point_t const &location, LibraryIndex_t libIndex) const =0 |
Returns the optical detector ID for the specified library index. More... | |
virtual OpDetToLibraryIndexMap const & | opDetsToLibraryIndices (geo::Point_t const &location) const =0 |
Returns a map of library indices as function of optical detectors. More... | |
virtual std::size_t | opDetMappingSize () const =0 |
Expected number of mappings of optical detector into library index. More... | |
virtual LibraryIndexToOpDetMap const & | libraryIndicesToOpDets (geo::Point_t const &location) const =0 |
Returns a map of optical detectors identifiers, one for each library index. More... | |
virtual std::size_t | libraryMappingSize (geo::Point_t const &location) const =0 |
Expected size of the mapping from library to optical detectors. More... | |
Utility methods | |
template<typename Coll > | |
MappedOpDetData_t< Coll > | applyOpDetMapping (OpDetToLibraryIndexMap const &opDetToLibraryMap, Coll &&source, util::collection_value_t< Coll > defaultValue={}) const |
Remaps a collection indexed by library index into one indexed by optical detector IDs. More... | |
template<typename Coll > | |
auto | applyOpDetMapping (geo::Point_t const &location, Coll &&source, util::collection_value_t< Coll > defaultValue={}) const |
Remaps a collection indexed by library index into one indexed by optical detector IDs according to the mapping at location . More... | |
Static Public Attributes | |
static constexpr OpDetID_t | InvalidOpDetID = std::numeric_limits<OpDetID_t>::max() |
Value used to identify an invalid optical detector. More... | |
static constexpr LibraryIndex_t | InvalidLibraryIndex |
Value used for an invalid library index. More... | |
Collection of functions to transform photon mapping data.
If the optical detectors of an experiment sport some symmetry, it may be convenient to exploit that symmetry to reduce the actual size of the internal mapping to a basic volume, and using the symmetry rules to convert between that basic volume and the world volume where the entire detector is represented. It is common that the symmetries require also a logic rearrangement of the actual optical detectors: a hook for that type of mapping is also provided, bidirectional.
This interface expresses the following transformations:
detectorToLibrary()
transform a point in the detector space to a point in the library spaceopDetToLibraryIndex()
transforms a optical detector ID into the corresponding library indexlibraryIndexToOpDet()
transforms a library index into the corresponding global optical detector IDIn this class and its documentation the following terms are in use:
geo::GeometryCore
) works in this spaceLibraryIndex_t
to represent it in the codegeo::OpDetID
; this concept is also used, e.g., as argument of geo::GeometryCore::OpDetGeoFromOpDet()
. This mapping class uses the concept and the single unique number representation to identify the optical detector, and uses the local type OpDetID_t
to represent it in the code;geo::GeometryCore::OpDetGeoFromOpDet()
)Currently the mapping is expressed with a specific type. If more flexibility is needed, the mapping might use run time polymorphism. This case is not supported right now. If need arose, something might be designed on top of what is here now.
Definition at line 115 of file IPhotonMappingTransformations.h.
Type describing a library index. FIXME former LibraryOpDetID_t.
Definition at line 124 of file IPhotonMappingTransformations.h.
using phot::IPhotonMappingTransformations::LibraryIndexToOpDetMap = std::vector<OpDetID_t> |
Type describing the mapping of optical detectors into library indices.
This type of mapping allows querying data values by optical detector ID, fetching them from library data source.
This type guarantees:
operator[](OpDetID_t)
to fetch the library index associated to the specified optical detectorsize()
to report how many optical detectors are supported Definition at line 139 of file IPhotonMappingTransformations.h.
using phot::IPhotonMappingTransformations::MappedOpDetData_t = phot::OpDetVisibilityData<util::collection_reference_t<LibDataColl>, util::collection_reference_t<OpDetToLibraryIndexMap const>> |
Type of optical detector data collection.
LibDataColl | type of the original library data container |
This type behaves like a random access collection with as index the optical detector ID and as value the data corresponding to that optical detector.
Definition at line 170 of file IPhotonMappingTransformations.h.
using phot::IPhotonMappingTransformations::OpDetID_t = int |
Type describing a optical detector ID.
Definition at line 121 of file IPhotonMappingTransformations.h.
using phot::IPhotonMappingTransformations::OpDetToLibraryIndexMap = std::vector<LibraryIndex_t> |
Type describing the mapping of library indices into optical detectors.
This type of mapping allows querying data values by library index, fetching them from an optical-detector-based data source.
This type guarantees:
operator[](LibraryIndex_t)
to access the optical detector ID of the specified library indexsize()
to report how many library optical detectors are supportedbool
, response to empty()
or to std::size()
to determine if the contained data is valid (actually, just response to phot::isValidLibraryData()
) Definition at line 157 of file IPhotonMappingTransformations.h.
|
virtualdefault |
MappedOpDetData_t<Coll> phot::IPhotonMappingTransformations::applyOpDetMapping | ( | OpDetToLibraryIndexMap const & | opDetToLibraryMap, |
Coll && | source, | ||
util::collection_value_t< Coll > | defaultValue = {} |
||
) | const |
Remaps a collection indexed by library index into one indexed by optical detector IDs.
Coll | type of collection of data from the library, to be mapped |
opDetToLibraryMap | the mapping to be applied |
source | collection of library data to be mapped |
defaultValue | value returned for unmapped optical detector IDs |
This method returns a collection proxy that dynamically applies the specified mapping. The original data is not copied.
The format of the map (opDetMap
) is an object with a indexing operator where the index is the one in the destination collection (i.e. the optical detector ID) and the mapped value is the index in the source collection (the libary index). Each valid optical detector ID must be mapped. If the library index mapped to an optical detector is InvalidLibraryIndex
, that optical detector is not mapped anywhere and its entry in the mapped collection is assigned the value defaultValue
. Otherwise, the library index must be valid (which means, up to the result of libraryMappingSize()
applied to the location where opDetMap
is valid).
Referenced by applyOpDetMapping().
|
inline |
Remaps a collection indexed by library index into one indexed by optical detector IDs according to the mapping at location
.
Coll | type of collection of data from the library, to be mapped |
location | a world reference point to provide global context |
source | collection of library data to be mapped |
defaultValue | value returned for unmapped optical detector IDs |
applyOpDetMapping()
This method applies a mapping (see applyOpDetMapping(OpDetToLibraryIndexMap const&, Coll&&, util::collection_value_t<Coll>)
) that is obtained via libraryIndicesToOpDets()
.
Definition at line 391 of file IPhotonMappingTransformations.h.
References applyOpDetMapping(), and opDetsToLibraryIndices().
auto phot::IPhotonMappingTransformations::applyOpDetMapping | ( | OpDetToLibraryIndexMap const & | opDetToLibraryMap, |
Coll && | source, | ||
util::collection_value_t< Coll > | defaultValue | ||
) | const -> MappedOpDetData_t<Coll> |
Definition at line 410 of file IPhotonMappingTransformations.h.
References util::make_collection_reference(), n, and util::size().
|
pure virtual |
Returns the representation within the library of a detector location.
location | position in world coordinates [cm] |
location
in the library space std::domain_error | if the function can't handle location |
The units and meaning of the returned location are library-dependent.
Example: assuming that fVoxelDef
contains the description of the voxelization of the library, the ID of the voxel at location
can be obtained from a mapping
as:
where mapping
points to an object implementing the phot::IPhotonMappingTransformations
interface. Note that the caller here has no business with the translated location, beside propagating it to the library: caller simply is not explained the meaning of that translated location.
Implemented in phot::PhotonMappingIdentityTransformations, and phot::PhotonMappingXMirrorTransformations.
|
pure virtual |
Returns the optical detector ID for the specified library index.
location | a point in detector space to provide global context |
libIndex | library index to be mapped |
libIndex
, or InvalidOpDetID
std::out_of_range | if input index can't be handled |
std::domain_error | if location can't be handled |
The library index libIndex
is converted into a optical detector ID. If the library does not include information for this optical detector, the value InvalidLibraryIndex
is returned instead.
The specified location
is used to inform the conversion, and it is usually pointing to the source of scintillation.
Implemented in phot::PhotonMappingIdentityTransformations.
|
pure virtual |
Returns a map of optical detectors identifiers, one for each library index.
location | a world reference point to provide global context |
std::domain_error | if location can't be handled |
The returned value is a mapping object (see LibraryIndexToOpDetMap
documentation for the interface). If a library index does not map to any optical detector in the library at location
(which is unusual!), the optical detector ID corresponding to it is InvalidOpDetID
.
The specified location
is used to provide context in a similar fashion as detectorToLibrary()
does. It can be used to choose the correct mapping among the available ones.
Implemented in phot::PhotonMappingIdentityTransformations.
|
pure virtual |
Expected size of the mapping from library to optical detectors.
location | a world reference point to provide global context |
std::domain_error | if location can't be handled |
libraryIndicesToOpDets()
This is effectively the size of the mapping returned by libraryIndicesToOpDets()
. It represents how many library indices are provided by the library for the specified location
. For example, in an implementation exploiting the modularity of a detector with N channels and made of M modules, this value might be N / M.
Implemented in phot::PhotonMappingIdentityTransformations.
|
pure virtual |
Expected number of mappings of optical detector into library index.
opDetsToLibraryIndices()
This is effectively the number of available optical detectors, as well as the size of the mapping as returned by opDetsToLibraryIndices()
.
Implemented in phot::PhotonMappingIdentityTransformations.
|
pure virtual |
Returns a map of library indices as function of optical detectors.
location | a world reference point to provide global context |
std::domain_error | if location can't be handled |
The returned value is a mapping object (see OpDetToLibraryIndexMap
documentation for the interface). If an optical detector has no representation in the library at location
, the index value corresponding to it is InvalidLibraryIndex
.
The specified location
is used to inform the conversion, and it is usually pointing to the source of scintillation. It may be left unused.
Implemented in phot::PhotonMappingIdentityTransformations.
Referenced by applyOpDetMapping().
|
pure virtual |
Returns the library index for the specified optical detector.
location | a point in detector space to provide global context |
opDetID | optical detector identifier |
opDetID
, or InvalidLibraryIndex
std::out_of_range | if input optical detector can't be handled |
std::domain_error | if location can't be handled |
The specified global identifier opDetID
of an optical detector is converted into an index for the library.
If the library does not include information for this optical detector, the value InvalidLibraryIndex
is returned instead.
The specified location
is used to inform the conversion, and it is usually pointing to the source of scintillation.
Implemented in phot::PhotonMappingIdentityTransformations.
|
static |
Value used for an invalid library index.
It may be used as value of the detector-to-library mapping.
Definition at line 186 of file IPhotonMappingTransformations.h.
|
static |
Value used to identify an invalid optical detector.
It may be used as value of the library-to-detector mapping.
Definition at line 179 of file IPhotonMappingTransformations.h.