All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Attributes | List of all members
icarus::details::ChannelToWireMap Class Reference

Mapping of ROP channels into wires. More...

#include <ChannelToWireMap.h>

Classes

struct  ChannelsInROPStruct
 

Public Member Functions

ChannelsInROPStruct const * find (raw::ChannelID_t channel) const
 Returns data of the ROP including channel, nullptr if none. More...
 
ChannelsInROPStruct const * find (readout::ROPID const &ropid) const
 Returns data of the ROP ropid, nullptr if none. More...
 
raw::ChannelID_t endChannel () const
 Returns the ID of the first invalid channel (the last channel, plus 1). More...
 
unsigned int nChannels () const
 Returns the number of mapped channels. More...
 
void addROP (readout::ROPID const &rid, raw::ChannelID_t firstROPchannel, unsigned int nChannels)
 
void setEndChannel (raw::ChannelID_t channel)
 Sets the ID of the channels after the last valid one. More...
 
void clear ()
 Resets the data of the map to like just constructed. More...
 

Private Attributes

std::vector< ChannelsInROPStructfROPfirstChannel
 Collection of channel ROP channel information, sorted by first channel. More...
 
raw::ChannelID_t fEndChannel = 0
 ID of the first invalid channel. More...
 

Detailed Description

Mapping of ROP channels into wires.

For each readout plane, we store its first channel (the last one can be found from the next ROP), and for all wire planes after the first one, the first channel that is shared (with the previous plane, that is) and the first channel on that plane that is not shared.

Definition at line 34 of file ChannelToWireMap.h.

Member Function Documentation

void icarus::details::ChannelToWireMap::addROP ( readout::ROPID const &  rid,
raw::ChannelID_t  firstROPchannel,
unsigned int  nChannels 
)
inline

Adds the next ROP with its first channel ID (must be larger than previous).

Definition at line 97 of file ChannelToWireMap.h.

101  {
102  assert(
103  fROPfirstChannel.empty()
104  || (firstROPchannel > fROPfirstChannel.back().firstChannel)
105  );
106  fROPfirstChannel.emplace_back(firstROPchannel, nChannels, rid);
107  }
unsigned int nChannels() const
Returns the number of mapped channels.
std::vector< ChannelsInROPStruct > fROPfirstChannel
Collection of channel ROP channel information, sorted by first channel.
void icarus::details::ChannelToWireMap::clear ( )

Resets the data of the map to like just constructed.

Definition at line 47 of file ChannelToWireMap.cxx.

47  {
48  fROPfirstChannel.clear();
50 } // icarus::details::ChannelToWireMap::clear()
raw::ChannelID_t fEndChannel
ID of the first invalid channel.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::vector< ChannelsInROPStruct > fROPfirstChannel
Collection of channel ROP channel information, sorted by first channel.
raw::ChannelID_t icarus::details::ChannelToWireMap::endChannel ( ) const
inline

Returns the ID of the first invalid channel (the last channel, plus 1).

Definition at line 89 of file ChannelToWireMap.h.

89 { return fEndChannel; }
raw::ChannelID_t fEndChannel
ID of the first invalid channel.
auto icarus::details::ChannelToWireMap::find ( raw::ChannelID_t  channel) const

Returns data of the ROP including channel, nullptr if none.

Definition at line 19 of file ChannelToWireMap.cxx.

20 {
21  // find the first element whose channel is _not_ included
22  auto const dbegin = fROPfirstChannel.begin(), dend = fROPfirstChannel.end();
23  auto const iNextData = std::upper_bound
24  (dbegin, dend, channel, ChannelsInROPStruct::Compare{});
25  assert(iNextData != dbegin);
26 
27  return ((iNextData == dend) && (channel >= endChannel()))
28  ? nullptr: &*std::prev(iNextData);
29 
30 } // icarus::details::ChannelToWireMap::find(raw::ChannelID_t)
bool Compare(const T &a, const T &b, const std::string &key)
Definition: diff_spectra.cc:93
raw::ChannelID_t endChannel() const
Returns the ID of the first invalid channel (the last channel, plus 1).
std::vector< ChannelsInROPStruct > fROPfirstChannel
Collection of channel ROP channel information, sorted by first channel.
auto icarus::details::ChannelToWireMap::find ( readout::ROPID const &  ropid) const

Returns data of the ROP ropid, nullptr if none.

Definition at line 34 of file ChannelToWireMap.cxx.

35 {
36  // find the first element whose channel is _not_ included
37  auto const dend = fROPfirstChannel.end();
38  auto const iData = std::find_if(
39  fROPfirstChannel.begin(), dend,
40  [&ropid](ChannelsInROPStruct const& data){ return data.ropid == ropid; }
41  );
42  return (iData == dend)? nullptr: &*iData;
43 } // icarus::details::ChannelToWireMap::find(readout::ROPID)
std::vector< ChannelsInROPStruct > fROPfirstChannel
Collection of channel ROP channel information, sorted by first channel.
unsigned int icarus::details::ChannelToWireMap::nChannels ( ) const
inline

Returns the number of mapped channels.

Definition at line 92 of file ChannelToWireMap.h.

93  { return endChannel() - raw::ChannelID_t{0}; }
raw::ChannelID_t endChannel() const
Returns the ID of the first invalid channel (the last channel, plus 1).
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void icarus::details::ChannelToWireMap::setEndChannel ( raw::ChannelID_t  channel)
inline

Sets the ID of the channels after the last valid one.

Definition at line 110 of file ChannelToWireMap.h.

110 { fEndChannel = channel; }
raw::ChannelID_t fEndChannel
ID of the first invalid channel.

Member Data Documentation

raw::ChannelID_t icarus::details::ChannelToWireMap::fEndChannel = 0
private

ID of the first invalid channel.

Definition at line 120 of file ChannelToWireMap.h.

std::vector<ChannelsInROPStruct> icarus::details::ChannelToWireMap::fROPfirstChannel
private

Collection of channel ROP channel information, sorted by first channel.

Definition at line 118 of file ChannelToWireMap.h.


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