All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PhotonMappingIdentityTransformations.h
Go to the documentation of this file.
1 /**
2  * @file larsim/PhotonPropagation/LibraryMappingTools/PhotonMappingIdentityTransformations.h
3  * @brief A photon mapping identity transformation.
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date March 20, 2019
6  * @see `larsim/PhotonPropagation/LibraryMappingTools/PhotonMappingIdentityTransformations_tool.cc`
7  *
8  */
9 
10 #ifndef LARSIM_PHOTONPROPAGATION_LIBRARYMAPPINGTOOLS_PHOTONMAPPINGIDENTITYTRANSFORMATIONS_H
11 #define LARSIM_PHOTONPROPAGATION_LIBRARYMAPPINGTOOLS_PHOTONMAPPINGIDENTITYTRANSFORMATIONS_H
12 
13 // LArSoft libraries
16 #include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
18 
19 // framework libraries
20 #include "art/Utilities/ToolConfigTable.h"
21 
22 namespace geo { class GeometryCore; }
23 
24 namespace phot {
25 
26  /**
27  * @brief Trivial photon mapping transformation.
28  *
29  * This implementation of `phot::IPhotonMappingTransformations` interface
30  * uses the identity mapping to have the library space matching the world one.
31  *
32  * This is the most generic case when there are no symmetries to be exploited:
33  * neither locations nor the optical detectors are changed by the mapping.
34  *
35  * @note The documentation of this class describes the details of this
36  * implementation of `phot::IPhotonMappingTransformations` interface.
37  * For information about how to _use it_, see the documentation of that
38  * interface.
39  */
42  {
43 
44  public:
45  struct Config {
46 
47  // using Name = fhicl::Name;
48  // using Comment = fhicl::Comment;
49 
50  // no configuration required
51 
52  }; // struct Config
53 
54  using Parameters = art::ToolConfigTable<Config>;
55 
56 
57  /// Constructor: ignores the configuration.
59  : fGeom(lar::providerFrom<geo::Geometry>())
62  {}
63 
64  /// Constructor: ignores the configuration.
67  {}
68 
69 
70  // --- BEGIN Geometry mapping interface ------------------------------------
71  /// @name Geometry mapping interface
72  /// @{
73 
74  /**
75  * @brief Returns the representation within the library of a detector
76  * location.
77  * @param location position in world coordinates [cm]
78  * @return a vector expressing `location` in the library space
79  *
80  * The returned vector is an exact copy of `location`.
81  *
82  * No exception is ever thrown.
83  */
85  (geo::Point_t const& location) const override
86  { return location; }
87 
88  /// @}
89  // --- END Geometry mapping interface --------------------------------------
90 
91 
92  // --- BEGIN Optical detector mapping interface ----------------------------
93  /// @name Optical detector mapping interface
94  /// @{
95 
96  /**
97  * @brief Maps an optical detector with its library index.
98  * @param location _(unused)_ world reference point
99  * @param opDetID ID of the optical detector to be mapped
100  * (as used, e.g., in `geo::GeometryCore::OpDetGeoFromOpDet()`)
101  * @return library index corresponding to the specified optical detector
102  * @see `libraryIndexToOpDet()`, `opDetsToLibraryIndices()`
103  *
104  * The mapping is trivial: each library index has the same value as the
105  * ID of the optical detector it corresponds to.
106  */
108  (geo::Point_t const& location, OpDetID_t opDetID) const override
109  { return LibraryIndex_t{ opDetID }; }
110 
111  /**
112  * @brief Maps a library index with an optical detector.
113  * @param location world reference point _(unused)_
114  * @param libIndex the library index to be mapped
115  * @return optical detector ID
116  * (as used, e.g., in `geo::GeometryCore::OpDetGeoFromOpDet()`)
117  * @see `opDetToLibraryIndex()`, `libraryIndicesToOpDets()`
118  *
119  * The mapping is trivial: each library index has the same value as the
120  * ID of the optical detector it corresponds to.
121  */
123  (geo::Point_t const& location, LibraryIndex_t libIndex) const override
124  { return OpDetID_t{ libIndex }; }
125 
126 
127  /**
128  * @brief Returns a map of library indices as function of optical detectors.
129  * @param location world reference point _(unused)_
130  * @return library indices for all optical detectors
131  * @see `opDetToLibraryIndex()`, `opDetsToLibraryIndices()`
132  *
133  * The mapping is trivial, as each library index has the same value as the
134  * ID of the optical detector it corresponds to.
135  * This mapping is global and does not depend on any location.
136  */
138  (geo::Point_t const& location) const override
139  { return fOpDetsToLibraryIndicesMap; }
140 
141  /**
142  * @brief Expected number of mappings of optical detector into library
143  * index.
144  * @return the expected size of the mapping of optical detectors
145  * @see `opDetsToLibraryIndices()`
146  *
147  * This is effectively the number of available optical detectors, as well
148  * as the size of the mapping as returned by `opDetsToLibraryIndices()`.
149  */
150  std::size_t opDetMappingSize() const override
151  { return fOpDetsToLibraryIndicesMap.size(); }
152 
153 
154  /**
155  * @brief Returns a map of optical detectors identifiers, one for each
156  * library index.
157  * @param location a world reference point _(unused)_
158  * @return optical detector identifiers for all library indices
159  * @see `opDetsToLibraryIndices()`, `libraryIndexToOpDet()`
160  *
161  * The mapping is trivial, as each library index has the same value as the
162  * ID of the optical detector it corresponds to.
163  * This mapping is global and does not depend on any location.
164  */
166  (geo::Point_t const& location) const override
167  { return fLibraryIndicesToOpDetsMap; }
168 
169  /**
170  * @brief Size of the mapping of library optical detectors.
171  * @param location a world reference point _(unused)_
172  * @return the expected size of the mapping of library optical detectors
173  * @see `opDetsFromLibrary()`
174  *
175  * This is also the number of optical detectors.
176  */
177  std::size_t libraryMappingSize
178  (geo::Point_t const& location) const override
179  { return fLibraryIndicesToOpDetsMap.size(); }
180 
181 
182  /// @}
183  // --- END Optical detector identifier mapping interface -------------------
184 
185 
186  protected:
187 
188  /// Detector geometry service provider.
189  geo::GeometryCore const* fGeom = nullptr;
190 
191  /// Complete optical detector identifier mapping world-to-library.
193 
194  /// Complete optical detector identifier mapping library-to-world.
196 
197 
198  /// Return a trivial global optical detector identifier mapping.
200 
201  /// Return a trivial library index mapping.
203 
204  }; // class PhotonMappingIdentityTransformations
205 
206 
207 } // namespace phot
208 
209 
210 #endif // LARSIM_PHOTONPROPAGATION_LIBRARYMAPPINGTOOLS_PHOTONMAPPINGIDENTITYTRANSFORMATIONS_H
Interface for transformation of photon visibility maps.
OpDetToLibraryIndexMap makeOpDetsToLibraryIndicesMap() const
Return a trivial library index mapping.
Utilities related to art service access.
OpDetToLibraryIndexMap const & opDetsToLibraryIndices(geo::Point_t const &location) const override
Returns a map of library indices as function of optical detectors.
T::provider_type const * providerFrom()
Returns a constant pointer to the provider of specified service.
Definition: ServiceUtil.h:77
std::size_t libraryMappingSize(geo::Point_t const &location) const override
Size of the mapping of library optical detectors.
OpDetID_t LibraryIndex_t
Type describing a library index. FIXME former LibraryOpDetID_t.
LibraryIndex_t opDetToLibraryIndex(geo::Point_t const &location, OpDetID_t opDetID) const override
Maps an optical detector with its library index.
LibraryIndexToOpDetMap fLibraryIndicesToOpDetsMap
Complete optical detector identifier mapping library-to-world.
Collection of functions to transform photon mapping data.
Definitions of geometry vector data types.
geo::GeometryCore const * fGeom
Detector geometry service provider.
LibraryIndexToOpDetMap makeLibraryIndicesToOpDetsMap() const
Return a trivial global optical detector identifier mapping.
phot::IPhotonMappingTransformations::OpDetID_t OpDetID_t
Type of (global) optical detector ID.
PhotonMappingIdentityTransformations(Config const &)
Constructor: ignores the configuration.
std::vector< OpDetID_t > LibraryIndexToOpDetMap
Type describing the mapping of optical detectors into library indices.
Description of geometry of one entire detector.
PhotonMappingIdentityTransformations(Parameters const &config)
Constructor: ignores the configuration.
int OpDetID_t
Type describing a optical detector ID.
geo::Point_t detectorToLibrary(geo::Point_t const &location) const override
Returns the representation within the library of a detector location.
OpDetID_t libraryIndexToOpDet(geo::Point_t const &location, LibraryIndex_t libIndex) const override
Maps a library index with an optical detector.
std::size_t opDetMappingSize() const override
Expected number of mappings of optical detector into library index.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
OpDetToLibraryIndexMap fOpDetsToLibraryIndicesMap
Complete optical detector identifier mapping world-to-library.
LibraryIndexToOpDetMap const & libraryIndicesToOpDets(geo::Point_t const &location) const override
Returns a map of optical detectors identifiers, one for each library index.
art framework interface to geometry description
std::vector< LibraryIndex_t > OpDetToLibraryIndexMap
Type describing the mapping of library indices into optical detectors.