LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
phot::PhotonMappingIdentityTransformations Class Reference

Trivial photon mapping transformation. More...

#include "PhotonMappingIdentityTransformations.h"

Inheritance diagram for phot::PhotonMappingIdentityTransformations:
phot::IPhotonMappingTransformations phot::PhotonMappingXMirrorTransformations

Classes

struct  Config
 

Public Types

using Parameters = art::ToolConfigTable< Config >
 
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

 PhotonMappingIdentityTransformations (Config const &)
 Constructor: ignores the configuration. More...
 
 PhotonMappingIdentityTransformations (Parameters const &config)
 Constructor: ignores the configuration. More...
 
template<typename Coll >
auto applyOpDetMapping (OpDetToLibraryIndexMap const &opDetToLibraryMap, Coll &&source, util::collection_value_t< Coll > defaultValue) const -> MappedOpDetData_t< Coll >
 
Geometry mapping interface
geo::Point_t detectorToLibrary (geo::Point_t const &location) const override
 Returns the representation within the library of a detector location. More...
 
Optical detector mapping interface
LibraryIndex_t opDetToLibraryIndex (geo::Point_t const &location, OpDetID_t opDetID) const override
 Maps an optical detector with its library index. More...
 
OpDetID_t libraryIndexToOpDet (geo::Point_t const &location, LibraryIndex_t libIndex) const override
 Maps a library index with an optical detector. More...
 
OpDetToLibraryIndexMap const & opDetsToLibraryIndices (geo::Point_t const &location) const override
 Returns a map of library indices as function of optical detectors. More...
 
std::size_t opDetMappingSize () const override
 Expected number of mappings of optical detector into library index. More...
 
LibraryIndexToOpDetMap const & libraryIndicesToOpDets (geo::Point_t const &location) const override
 Returns a map of optical detectors identifiers, one for each library index. More...
 
std::size_t libraryMappingSize (geo::Point_t const &location) const override
 Size of the mapping of library 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...
 

Protected Member Functions

LibraryIndexToOpDetMap makeLibraryIndicesToOpDetsMap () const
 Return a trivial global optical detector identifier mapping. More...
 
OpDetToLibraryIndexMap makeOpDetsToLibraryIndicesMap () const
 Return a trivial library index mapping. More...
 

Protected Attributes

geo::GeometryCore const * fGeom = nullptr
 Detector geometry service provider. More...
 
OpDetToLibraryIndexMap fOpDetsToLibraryIndicesMap
 Complete optical detector identifier mapping world-to-library. More...
 
LibraryIndexToOpDetMap fLibraryIndicesToOpDetsMap
 Complete optical detector identifier mapping library-to-world. More...
 

Detailed Description

Trivial photon mapping transformation.

This implementation of phot::IPhotonMappingTransformations interface uses the identity mapping to have the library space matching the world one.

This is the most generic case when there are no symmetries to be exploited: neither locations nor the optical detectors are changed by the mapping.

Note
The documentation of this class describes the details of this implementation of phot::IPhotonMappingTransformations interface. For information about how to use it, see the documentation of that interface.

Definition at line 42 of file PhotonMappingIdentityTransformations.h.

Member Typedef Documentation

Type describing a library index. FIXME former LibraryOpDetID_t.

Definition at line 124 of file IPhotonMappingTransformations.h.

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 detector
  • size() to report how many optical detectors are supported

Definition at line 139 of file IPhotonMappingTransformations.h.

Type of optical detector data collection.

Template Parameters
LibDataColltype 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.

Type describing a optical detector ID.

Definition at line 121 of file IPhotonMappingTransformations.h.

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 index
  • size() to report how many library optical detectors are supported
  • either conversion to bool, 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.

Constructor & Destructor Documentation

phot::PhotonMappingIdentityTransformations::PhotonMappingIdentityTransformations ( Config const &  )
inline

Constructor: ignores the configuration.

Definition at line 57 of file PhotonMappingIdentityTransformations.h.

58  : fGeom(lar::providerFrom<geo::Geometry>())
61  {}
OpDetToLibraryIndexMap makeOpDetsToLibraryIndicesMap() const
Return a trivial library index mapping.
LibraryIndexToOpDetMap fLibraryIndicesToOpDetsMap
Complete optical detector identifier mapping library-to-world.
geo::GeometryCore const * fGeom
Detector geometry service provider.
LibraryIndexToOpDetMap makeLibraryIndicesToOpDetsMap() const
Return a trivial global optical detector identifier mapping.
OpDetToLibraryIndexMap fOpDetsToLibraryIndicesMap
Complete optical detector identifier mapping world-to-library.
phot::PhotonMappingIdentityTransformations::PhotonMappingIdentityTransformations ( Parameters const &  config)
inline

Constructor: ignores the configuration.

Definition at line 64 of file PhotonMappingIdentityTransformations.h.

66  {}
PhotonMappingIdentityTransformations(Config const &)
Constructor: ignores the configuration.

Member Function Documentation

template<typename Coll >
MappedOpDetData_t<Coll> phot::IPhotonMappingTransformations::applyOpDetMapping ( OpDetToLibraryIndexMap const &  opDetToLibraryMap,
Coll &&  source,
util::collection_value_t< Coll >  defaultValue = {} 
) const
inherited

Remaps a collection indexed by library index into one indexed by optical detector IDs.

Template Parameters
Colltype of collection of data from the library, to be mapped
Parameters
opDetToLibraryMapthe mapping to be applied
sourcecollection of library data to be mapped
defaultValuevalue returned for unmapped optical detector IDs
Returns
a random access collection providing data by optical detector ID

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 phot::IPhotonMappingTransformations::applyOpDetMapping().

template<typename Coll >
auto phot::IPhotonMappingTransformations::applyOpDetMapping ( geo::Point_t const &  location,
Coll &&  source,
util::collection_value_t< Coll >  defaultValue = {} 
) const
inlineinherited

Remaps a collection indexed by library index into one indexed by optical detector IDs according to the mapping at location.

Template Parameters
Colltype of collection of data from the library, to be mapped
Parameters
locationa world reference point to provide global context
sourcecollection of library data to be mapped
defaultValuevalue returned for unmapped optical detector IDs
Returns
a random access collection providing data by optical detector ID
See also
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 phot::IPhotonMappingTransformations::applyOpDetMapping(), and phot::IPhotonMappingTransformations::opDetsToLibraryIndices().

393  {}) const
394  {
395  return applyOpDetMapping(
396  opDetsToLibraryIndices(location), std::forward<Coll>(source), defaultValue);
397  }
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...
virtual OpDetToLibraryIndexMap const & opDetsToLibraryIndices(geo::Point_t const &location) const =0
Returns a map of library indices as function of optical detectors.
template<typename Coll >
auto phot::IPhotonMappingTransformations::applyOpDetMapping ( OpDetToLibraryIndexMap const &  opDetToLibraryMap,
Coll &&  source,
util::collection_value_t< Coll >  defaultValue 
) const -> MappedOpDetData_t<Coll>
inherited

Definition at line 410 of file IPhotonMappingTransformations.h.

References util::make_collection_reference(), n, and util::size().

415 {
416 
417  using std::size;
418 
419  // number of available destination slots (i.e. how many optical detectors)
420  auto const n = size(opDetToLibraryMap);
421 
422  return MappedOpDetData_t<Coll>{util::make_collection_reference(std::forward<Coll>(source)),
423  std::cref(opDetToLibraryMap) // mapping is referenced
424  ,
425  n // size
426  ,
427  defaultValue};
428 
429 } // phot::IPhotonMappingTransformations::applyOpDetMapping()
auto make_collection_reference(Coll &&coll)
Returns an object referencing to the data contained in coll.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
Char_t n[5]
geo::Point_t phot::PhotonMappingIdentityTransformations::detectorToLibrary ( geo::Point_t const &  location) const
inlineoverridevirtual

Returns the representation within the library of a detector location.

Parameters
locationposition in world coordinates [cm]
Returns
a vector expressing location in the library space

The returned vector is an exact copy of location.

No exception is ever thrown.

Implements phot::IPhotonMappingTransformations.

Reimplemented in phot::PhotonMappingXMirrorTransformations.

Definition at line 82 of file PhotonMappingIdentityTransformations.h.

82 { return location; }
OpDetID_t phot::PhotonMappingIdentityTransformations::libraryIndexToOpDet ( geo::Point_t const &  location,
LibraryIndex_t  libIndex 
) const
inlineoverridevirtual

Maps a library index with an optical detector.

Parameters
locationworld reference point _(unused)_
libIndexthe library index to be mapped
Returns
optical detector ID (as used, e.g., in geo::GeometryCore::OpDetGeoFromOpDet())
See also
opDetToLibraryIndex(), libraryIndicesToOpDets()

The mapping is trivial: each library index has the same value as the ID of the optical detector it corresponds to.

Implements phot::IPhotonMappingTransformations.

Definition at line 119 of file PhotonMappingIdentityTransformations.h.

121  {
122  return OpDetID_t{libIndex};
123  }
int OpDetID_t
Type describing a optical detector ID.
LibraryIndexToOpDetMap const& phot::PhotonMappingIdentityTransformations::libraryIndicesToOpDets ( geo::Point_t const &  location) const
inlineoverridevirtual

Returns a map of optical detectors identifiers, one for each library index.

Parameters
locationa world reference point _(unused)_
Returns
optical detector identifiers for all library indices
See also
opDetsToLibraryIndices(), libraryIndexToOpDet()

The mapping is trivial, as each library index has the same value as the ID of the optical detector it corresponds to. This mapping is global and does not depend on any location.

Implements phot::IPhotonMappingTransformations.

Definition at line 163 of file PhotonMappingIdentityTransformations.h.

165  {
167  }
LibraryIndexToOpDetMap fLibraryIndicesToOpDetsMap
Complete optical detector identifier mapping library-to-world.
std::size_t phot::PhotonMappingIdentityTransformations::libraryMappingSize ( geo::Point_t const &  location) const
inlineoverridevirtual

Size of the mapping of library optical detectors.

Parameters
locationa world reference point _(unused)_
Returns
the expected size of the mapping of library optical detectors
See also
opDetsFromLibrary()

This is also the number of optical detectors.

Implements phot::IPhotonMappingTransformations.

Definition at line 177 of file PhotonMappingIdentityTransformations.h.

178  {
179  return fLibraryIndicesToOpDetsMap.size();
180  }
LibraryIndexToOpDetMap fLibraryIndicesToOpDetsMap
Complete optical detector identifier mapping library-to-world.
phot::IPhotonMappingTransformations::LibraryIndexToOpDetMap phot::PhotonMappingIdentityTransformations::makeLibraryIndicesToOpDetsMap ( ) const
protected

Return a trivial global optical detector identifier mapping.

Definition at line 18 of file PhotonMappingIdentityTransformations.cxx.

References fGeom, and geo::GeometryCore::NOpDets().

19 {
20 
21  auto const nOpDets = fGeom->NOpDets();
22 
23  LibraryIndexToOpDetMap map(nOpDets);
24  std::iota(map.begin(), map.end(), 0);
25 
26  return map;
27 } // phot::PhotonMappingIdentityTransformations::makeLibraryIndicesToOpDetsMap()
geo::GeometryCore const * fGeom
Detector geometry service provider.
std::vector< OpDetID_t > LibraryIndexToOpDetMap
Type describing the mapping of optical detectors into library indices.
unsigned int NOpDets() const
Number of OpDets in the whole detector.
phot::IPhotonMappingTransformations::OpDetToLibraryIndexMap phot::PhotonMappingIdentityTransformations::makeOpDetsToLibraryIndicesMap ( ) const
protected

Return a trivial library index mapping.

Definition at line 31 of file PhotonMappingIdentityTransformations.cxx.

References fGeom, and geo::GeometryCore::NOpDets().

32 {
33 
34  auto const nOpDets = fGeom->NOpDets();
35 
36  OpDetToLibraryIndexMap map(nOpDets);
37  std::iota(map.begin(), map.end(), 0);
38 
39  return map;
40 } // phot::PhotonMappingIdentityTransformations::makeOpDetsToLibraryIndicesMap()
geo::GeometryCore const * fGeom
Detector geometry service provider.
unsigned int NOpDets() const
Number of OpDets in the whole detector.
std::vector< LibraryIndex_t > OpDetToLibraryIndexMap
Type describing the mapping of library indices into optical detectors.
std::size_t phot::PhotonMappingIdentityTransformations::opDetMappingSize ( ) const
inlineoverridevirtual

Expected number of mappings of optical detector into library index.

Returns
the expected size of the mapping of optical detectors
See also
opDetsToLibraryIndices()

This is effectively the number of available optical detectors, as well as the size of the mapping as returned by opDetsToLibraryIndices().

Implements phot::IPhotonMappingTransformations.

Definition at line 150 of file PhotonMappingIdentityTransformations.h.

150 { return fOpDetsToLibraryIndicesMap.size(); }
OpDetToLibraryIndexMap fOpDetsToLibraryIndicesMap
Complete optical detector identifier mapping world-to-library.
OpDetToLibraryIndexMap const& phot::PhotonMappingIdentityTransformations::opDetsToLibraryIndices ( geo::Point_t const &  location) const
inlineoverridevirtual

Returns a map of library indices as function of optical detectors.

Parameters
locationworld reference point _(unused)_
Returns
library indices for all optical detectors
See also
opDetToLibraryIndex(), opDetsToLibraryIndices()

The mapping is trivial, as each library index has the same value as the ID of the optical detector it corresponds to. This mapping is global and does not depend on any location.

Implements phot::IPhotonMappingTransformations.

Definition at line 135 of file PhotonMappingIdentityTransformations.h.

137  {
139  }
OpDetToLibraryIndexMap fOpDetsToLibraryIndicesMap
Complete optical detector identifier mapping world-to-library.
LibraryIndex_t phot::PhotonMappingIdentityTransformations::opDetToLibraryIndex ( geo::Point_t const &  location,
OpDetID_t  opDetID 
) const
inlineoverridevirtual

Maps an optical detector with its library index.

Parameters
location_(unused)_ world reference point
opDetIDID of the optical detector to be mapped (as used, e.g., in geo::GeometryCore::OpDetGeoFromOpDet())
Returns
library index corresponding to the specified optical detector
See also
libraryIndexToOpDet(), opDetsToLibraryIndices()

The mapping is trivial: each library index has the same value as the ID of the optical detector it corresponds to.

Implements phot::IPhotonMappingTransformations.

Definition at line 102 of file PhotonMappingIdentityTransformations.h.

104  {
105  return LibraryIndex_t{opDetID};
106  }
OpDetID_t LibraryIndex_t
Type describing a library index. FIXME former LibraryOpDetID_t.

Member Data Documentation

geo::GeometryCore const* phot::PhotonMappingIdentityTransformations::fGeom = nullptr
protected

Detector geometry service provider.

Definition at line 187 of file PhotonMappingIdentityTransformations.h.

Referenced by makeLibraryIndicesToOpDetsMap(), and makeOpDetsToLibraryIndicesMap().

LibraryIndexToOpDetMap phot::PhotonMappingIdentityTransformations::fLibraryIndicesToOpDetsMap
protected

Complete optical detector identifier mapping library-to-world.

Definition at line 193 of file PhotonMappingIdentityTransformations.h.

OpDetToLibraryIndexMap phot::PhotonMappingIdentityTransformations::fOpDetsToLibraryIndicesMap
protected

Complete optical detector identifier mapping world-to-library.

Definition at line 190 of file PhotonMappingIdentityTransformations.h.

constexpr LibraryIndex_t phot::IPhotonMappingTransformations::InvalidLibraryIndex
staticinherited
Initial value:
=
std::numeric_limits<LibraryIndex_t>::max()

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.

constexpr OpDetID_t phot::IPhotonMappingTransformations::InvalidOpDetID = std::numeric_limits<OpDetID_t>::max()
staticinherited

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.


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