|
| 1 | +/** **************************************************************************** |
| 2 | + * @file ChannelROICreator.h |
| 3 | + * @brief Helper functions to create a wire |
| 4 | + * @date April 20,2025 |
| 5 | + * @author usher@slac.stanford.edu |
| 6 | + * @see ChannelROI.h ChannelROICreator.cxx |
| 7 | + * |
| 8 | + * ****************************************************************************/ |
| 9 | + |
| 10 | +#ifndef ChannelROICreator_H |
| 11 | +#define ChannelROICreator_H |
| 12 | + |
| 13 | +// C/C++ standard library |
| 14 | +#include <utility> // std::move() |
| 15 | + |
| 16 | +// LArSoft libraries |
| 17 | +#include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t |
| 18 | +#include "sbnobj/ICARUS/TPC/ChannelROI.h" |
| 19 | + |
| 20 | +namespace raw { class RawDigit; } |
| 21 | + |
| 22 | +/// Reconstruction base classes |
| 23 | +namespace recob { |
| 24 | + |
| 25 | + /** |
| 26 | + * @brief Class managing the creation of a new recob::Wire object |
| 27 | + * |
| 28 | + * As Gianluca Petrillo points out, the same considerations described in |
| 29 | + * `recob::WireCreator` apply here as well |
| 30 | + */ |
| 31 | + class ChannelROICreator { |
| 32 | + public: |
| 33 | + /// Alias for the type of regions of interest |
| 34 | + using RegionsOfInterest_t = ChannelROI::RegionsOfInterest_t; |
| 35 | + |
| 36 | + // destructor, copy and move constructor and assignment as default |
| 37 | + |
| 38 | + /** |
| 39 | + * @brief Constructor: uses specified signal in regions of interest |
| 40 | + * @param sigROIlist signal organized in regions of interest |
| 41 | + * @param rawdigit the raw digit this channel is associated to |
| 42 | + * |
| 43 | + * The information used from the raw digit are the channel ID and the |
| 44 | + * length in samples (TDC ticks) of the original readout window. |
| 45 | + */ |
| 46 | + ChannelROICreator |
| 47 | + (const RegionsOfInterest_t& sigROIlist, const raw::RawDigit& rawdigit); |
| 48 | + |
| 49 | + |
| 50 | + /** |
| 51 | + * @brief Constructor: uses specified signal in regions of interest |
| 52 | + * @param sigROIlist signal organized in regions of interest |
| 53 | + * @param rawdigit the raw digit this channel is associated to |
| 54 | + * |
| 55 | + * The information used from the raw digit are the channel ID and the |
| 56 | + * length in samples (TDC ticks) of the original readout window. |
| 57 | + * |
| 58 | + * Signal information is moved from sigROIlist, that becomes empty. |
| 59 | + */ |
| 60 | + ChannelROICreator |
| 61 | + (RegionsOfInterest_t&& sigROIlist, const raw::RawDigit& rawdigit); |
| 62 | + |
| 63 | + |
| 64 | + /** |
| 65 | + * @brief Constructor: uses specified signal in regions of interest |
| 66 | + * @param sigROIlist signal organized in regions of interest |
| 67 | + * @param channel the ID of the channel |
| 68 | + * @param adcScaleFactor the scaling used to preserve resolution |
| 69 | + * |
| 70 | + * The information used from the raw digit are the channel ID and the |
| 71 | + * length in samples (TDC ticks) of the original readout window. |
| 72 | + */ |
| 73 | + ChannelROICreator( |
| 74 | + RegionsOfInterest_t const& sigROIlist, |
| 75 | + raw::ChannelID_t channel, |
| 76 | + short int adcScaleFactor = recob::ChannelROI::defADCScaleFactor |
| 77 | + ); |
| 78 | + |
| 79 | + |
| 80 | + /** |
| 81 | + * @brief Constructor: uses specified signal in regions of interest |
| 82 | + * @param sigROIlist signal organized in regions of interest |
| 83 | + * @param channel the ID of the channel |
| 84 | + * @param adcScaleFactor the scaling used to preserve resolution |
| 85 | + * |
| 86 | + * The information used from the raw digit are the channel ID and the |
| 87 | + * length in samples (TDC ticks) of the original readout window. |
| 88 | + * |
| 89 | + * Signal information is moved from sigROIlist, that becomes empty. |
| 90 | + */ |
| 91 | + ChannelROICreator( |
| 92 | + RegionsOfInterest_t&& sigROIlist, |
| 93 | + raw::ChannelID_t channel, |
| 94 | + short int adcScaleFactor = recob::ChannelROI::defADCScaleFactor |
| 95 | + ); |
| 96 | + |
| 97 | + /** |
| 98 | + * @brief Prepares the constructed wire to be moved away |
| 99 | + * @return a right-value reference to the constructed wire |
| 100 | + * |
| 101 | + * Despite the name, no move happens in this function. |
| 102 | + * Move takes place in the caller code as proper; for example: |
| 103 | + * |
| 104 | + * // be wire a ChannelROICreator instance: |
| 105 | + * std::vector<recob::Wire> Wires; |
| 106 | + * wire.move(); // nothing happens |
| 107 | + * Wires.push_back(wire.move()); // here the copy happens |
| 108 | + * recob::Wire single_wire(wire.move()); // wrong! wire is empty now |
| 109 | + * |
| 110 | + */ |
| 111 | + ChannelROI&& move() { return std::move(channelROI); } |
| 112 | + |
| 113 | + |
| 114 | + /** |
| 115 | + * @brief Returns the constructed wire |
| 116 | + * @return a constant reference to the constructed wire |
| 117 | + * |
| 118 | + * Despite the name, no copy happens in this function. |
| 119 | + * Copy takes place in the caller code as proper; for example: |
| 120 | + * |
| 121 | + * // be wire a ChannelROICreator instance: |
| 122 | + * std::vector<recob::Wire> Wires; |
| 123 | + * wire.copy(); // nothing happens |
| 124 | + * Wires.push_back(wire.copy()); // here a copy happens |
| 125 | + * recob::Wire single_wire(wire.copy()); // wire is copied again |
| 126 | + * |
| 127 | + */ |
| 128 | + const ChannelROI& copy() const { return channelROI; } |
| 129 | + |
| 130 | + protected: |
| 131 | + |
| 132 | + ChannelROI channelROI; ///< local instance of the wire being constructed |
| 133 | + |
| 134 | + }; // class ChannelROICreator |
| 135 | + |
| 136 | +} // namespace recob |
| 137 | + |
| 138 | +#endif // ChannelROICreator_H |
0 commit comments