Classes | Public Member Functions | Private Attributes | List of all members
geo::dune::vd::ChannelToWireMap Class Reference

#include <ColdBoxChannelMapAlg.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 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...
 
void addROP (readout::ROPID const &rid, raw::ChannelID_t firstROPchannel, unsigned int nChannels)
 

Private Attributes

std::map< raw::ChannelID_t, ChannelsInROPStructfROPfirstChannel
 
raw::ChannelID_t fEndChannel = 0
 

Detailed Description

Definition at line 48 of file ColdBoxChannelMapAlg.h.

Member Function Documentation

void geo::dune::vd::ChannelToWireMap::addROP ( readout::ROPID const &  rid,
raw::ChannelID_t  firstROPchannel,
unsigned int  nChannels 
)
inline

Definition at line 105 of file ColdBoxChannelMapAlg.h.

107  {
108  assert( fROPfirstChannel.find( firstROPchannel ) != fROPfirstChannel.end() );
109  fROPfirstChannel[ firstROPchannel ] = {firstROPchannel, nChannels, rid};
110  }
unsigned int nChannels() const
Returns the number of mapped channels.
std::map< raw::ChannelID_t, ChannelsInROPStruct > fROPfirstChannel
void geo::dune::vd::ChannelToWireMap::clear ( )
inline

Resets the data of the map to like just constructed.

Definition at line 100 of file ColdBoxChannelMapAlg.h.

100  {
101  fROPfirstChannel.clear();
103  }
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::map< raw::ChannelID_t, ChannelsInROPStruct > fROPfirstChannel
raw::ChannelID_t geo::dune::vd::ChannelToWireMap::endChannel ( ) const
inline

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

Definition at line 90 of file ColdBoxChannelMapAlg.h.

90 { return fEndChannel; }
ChannelsInROPStruct const* geo::dune::vd::ChannelToWireMap::find ( raw::ChannelID_t  channel) const
inline

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

Definition at line 69 of file ColdBoxChannelMapAlg.h.

70  {
71  auto const dend = fROPfirstChannel.end();
72  auto const iNextData = fROPfirstChannel.upper_bound( channel );
73  assert(iNextData != fROPfirstChannel.begin());
74  return ((iNextData == dend) && (channel >= endChannel()))
75  ? nullptr: &(std::prev(iNextData)->second);
76  }
raw::ChannelID_t endChannel() const
Returns the ID of the first invalid channel (the last channel, plus 1).
uint8_t channel
Definition: CRTFragment.hh:201
std::map< raw::ChannelID_t, ChannelsInROPStruct > fROPfirstChannel
ChannelsInROPStruct const* geo::dune::vd::ChannelToWireMap::find ( readout::ROPID const &  ropid) const
inline

Returns data of the ROP ropid, nullptr if none.

Definition at line 80 of file ColdBoxChannelMapAlg.h.

81  {
82  auto const dbegin = fROPfirstChannel.begin(), dend = fROPfirstChannel.end();
83  for( auto it = dbegin; it != dend; ++it ){
84  if (it->second.ropid == ropid) return &(it->second);
85  }
86  return nullptr;
87  }
std::map< raw::ChannelID_t, ChannelsInROPStruct > fROPfirstChannel
unsigned int geo::dune::vd::ChannelToWireMap::nChannels ( ) const
inline

Returns the number of mapped channels.

Definition at line 93 of file ColdBoxChannelMapAlg.h.

94  { return endChannel(); }
raw::ChannelID_t endChannel() const
Returns the ID of the first invalid channel (the last channel, plus 1).
void geo::dune::vd::ChannelToWireMap::setEndChannel ( raw::ChannelID_t  channel)
inline

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

Definition at line 97 of file ColdBoxChannelMapAlg.h.

97 { fEndChannel = channel; }
uint8_t channel
Definition: CRTFragment.hh:201

Member Data Documentation

raw::ChannelID_t geo::dune::vd::ChannelToWireMap::fEndChannel = 0
private

Definition at line 115 of file ColdBoxChannelMapAlg.h.

std::map<raw::ChannelID_t, ChannelsInROPStruct> geo::dune::vd::ChannelToWireMap::fROPfirstChannel
private

Definition at line 114 of file ColdBoxChannelMapAlg.h.


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