LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lariov::SimpleChannelStatus Class Reference

Class providing information about the quality of channels. More...

#include "SimpleChannelStatus.h"

Inheritance diagram for lariov::SimpleChannelStatus:

Public Types

using ChannelSet_t = lariov::ChannelStatusProvider::ChannelSet_t
 

Public Member Functions

 SimpleChannelStatus (fhicl::ParameterSet const &pset)
 Configuration. More...
 
raw::ChannelID_t MaxChannel () const
 Returns the ID of the largest known channel. More...
 
raw::ChannelID_t MaxChannelPresent () const
 Returns the ID of the largest present channel. More...
 
Single channel queries

Returns whether the specified channel is physical and connected to wire

virtual bool IsPresent (raw::ChannelID_t channel) const override
 Returns whether the specified channel is physical and good. More...
 
virtual bool IsGood (raw::ChannelID_t channel) const override
 Returns whether the specified channel is physical and good. More...
 
virtual bool IsBad (raw::ChannelID_t channel) const override
 Returns whether the specified channel is bad in the current run. More...
 
virtual bool IsNoisy (raw::ChannelID_t channel) const override
 Returns whether the specified channel is noisy in the current run. More...
 
Global channel queries

Returns a copy of set of good channel IDs for the current run

virtual ChannelSet_t GoodChannels () const override
 Returns a copy of set of bad channel IDs for the current run. More...
 
virtual ChannelSet_t BadChannels () const override
 Returns a copy of set of bad channel IDs for the current run. More...
 
virtual ChannelSet_t NoisyChannels () const override
 Returns a copy of set of noisy channel IDs for the current run. More...
 
Configuration functions
void Setup (raw::ChannelID_t MaxChannel, raw::ChannelID_t MaxGoodChannel)
 Sets the service provider up. More...
 
void Setup (raw::ChannelID_t MaxChannel)
 Sets the service provider up. More...
 

Protected Member Functions

void FillGoodChannels () const
 Fills the collection of good channels. More...
 

Protected Attributes

ChannelSet_t fBadChannels
 set of bad channels More...
 
ChannelSet_t fNoisyChannels
 set of noisy channels More...
 
raw::ChannelID_t fMaxChannel
 largest ID among existing channels More...
 
raw::ChannelID_t fMaxPresentChannel
 largest ID among present channels More...
 
std::unique_ptr< ChannelSet_tfGoodChannels
 cached set of good channels (lazy evaluation) More...
 

Detailed Description

Class providing information about the quality of channels.


This class serves information read from a FHiCL configuration file. Time-dependent (or, run-dependent) information is not supported.

All and only the channels up to the one specified in the Setup() call (that one included) are considered present. If no valid ID is specified, all channels are supposed present.

LArSoft interface to this class is through the service SimpleChannelStatusService.

Configuration parameters

  • BadChannels (list of integers, default: empty) list of ID of bad channels
  • NoisyChannels (list of integers, default: empty) list of ID of noisy channels

Definition at line 49 of file SimpleChannelStatus.h.

Member Typedef Documentation

using lariov::SimpleChannelStatus::ChannelSet_t = lariov::ChannelStatusProvider::ChannelSet_t

Definition at line 51 of file SimpleChannelStatus.h.

Constructor & Destructor Documentation

lariov::SimpleChannelStatus::SimpleChannelStatus ( fhicl::ParameterSet const &  pset)
explicit

Configuration.

Definition at line 30 of file SimpleChannelStatus.cpp.

References BadChannels(), fBadChannels, fNoisyChannels, fhicl::ParameterSet::get(), NoisyChannels(), and Setup().

33  {
34 
35  using chan_vect_t = std::vector<raw::ChannelID_t>;
36 
37  // Read the bad channels as a vector, then convert it into a set
38  chan_vect_t BadChannels
39  = pset.get<chan_vect_t>("BadChannels", chan_vect_t());
40  std::copy(
41  BadChannels.begin(), BadChannels.end(),
42  std::inserter(fBadChannels, fBadChannels.begin())
43  );
44 
45  // Read the noise channels as a vector, then convert it into a set
46  chan_vect_t NoisyChannels
47  = pset.get<chan_vect_t>("NoisyChannels", chan_vect_t());
48  std::copy(
49  NoisyChannels.begin(), NoisyChannels.end(),
50  std::inserter(fNoisyChannels, fNoisyChannels.begin())
51  );
52 
53  } // SimpleChannelStatus::SimpleChannelStatus()
ChannelSet_t fNoisyChannels
set of noisy channels
raw::ChannelID_t fMaxPresentChannel
largest ID among present channels
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
ChannelSet_t fBadChannels
set of bad channels
virtual ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.
virtual ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
raw::ChannelID_t fMaxChannel
largest ID among existing channels

Member Function Documentation

virtual ChannelSet_t lariov::SimpleChannelStatus::BadChannels ( ) const
inlineoverridevirtual

Returns a copy of set of bad channel IDs for the current run.

Definition at line 85 of file SimpleChannelStatus.h.

References fBadChannels.

Referenced by SimpleChannelStatus().

86  { return fBadChannels; }
ChannelSet_t fBadChannels
set of bad channels
void lariov::SimpleChannelStatus::FillGoodChannels ( ) const
protected

Fills the collection of good channels.

Definition at line 88 of file SimpleChannelStatus.cpp.

References fBadChannels, fGoodChannels, fMaxChannel, fMaxPresentChannel, fNoisyChannels, GoodChannels(), raw::isValidChannelID(), and lar::dump::vector().

Referenced by GoodChannels().

88  {
89 
90  if (!fGoodChannels) fGoodChannels.reset(new ChannelSet_t);
91 
93  GoodChannels.clear();
94 
96  <std::pair<ChannelSet_t::const_iterator, ChannelSet_t::const_iterator>>
97  VetoedIDs;
98 
99  VetoedIDs.emplace_back(fBadChannels.cbegin(), fBadChannels.cend());
100  VetoedIDs.emplace_back(fNoisyChannels.cbegin(), fNoisyChannels.cend());
101 
102  // go for the first (lowest) channel ID...
103  raw::ChannelID_t channel = 0;
104  while (!raw::isValidChannelID(channel)) ++channel;
105 
106  // ... to the last present one
107  raw::ChannelID_t last_channel = fMaxChannel;
109  && (fMaxPresentChannel < last_channel))
110  last_channel = fMaxPresentChannel;
111 
112  // if we don't know how many channels
113  if (!raw::isValidChannelID(last_channel)) {
114  // this exception means that the Setup() function was not called
115  // or it was called with an invalid value
116  throw cet::exception("SimpleChannelStatus")
117  << "Can't fill good channel list since no largest channel was set up\n";
118  } // if
119 
120  // add the channels to the set one by one
121  while (channel <= last_channel) {
122  bool bGood = true;
123 
124  // check if this channel is in any of the vetoed lists
125  for (auto iter: VetoedIDs) {
126 
127  // check all the remaining vetoed channels in this list
128  while (iter.first != iter.second) {
129  // if the first vetoed channel is larger than the tested channel,
130  // we are done with this list
131  if (*(iter.first) > channel) break;
132 
133  if (*(iter.first) == channel) { // vetoed!
134  bGood = false;
135  ++(iter.first); // we have found this already
136  break;
137  }
138 
139  // the last vetoed channel is smaller than the tested channel;
140  // maybe the next vetoed channel will be it!
141  ++(iter.first);
142  } // while
143 
144  if (!bGood) break; // already known bad, we are done
145  } // for
146 
147  // add the channel
148  if (bGood) GoodChannels.insert(channel);
149  ++channel;
150  } // while
151 
152  } // SimpleChannelStatus::GoodChannels()
ChannelSet_t fNoisyChannels
set of noisy channels
std::unique_ptr< ChannelSet_t > fGoodChannels
cached set of good channels (lazy evaluation)
raw::ChannelID_t fMaxPresentChannel
largest ID among present channels
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
ChannelSet_t fBadChannels
set of bad channels
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:36
lariov::ChannelStatusProvider::ChannelSet_t ChannelSet_t
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
virtual ChannelSet_t GoodChannels() const override
Returns a copy of set of bad channel IDs for the current run.
raw::ChannelID_t fMaxChannel
largest ID among existing channels
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
SimpleChannelStatus::ChannelSet_t lariov::SimpleChannelStatus::GoodChannels ( ) const
overridevirtual

Returns a copy of set of bad channel IDs for the current run.

Definition at line 79 of file SimpleChannelStatus.cpp.

References fGoodChannels, and FillGoodChannels().

Referenced by FillGoodChannels(), and IsNoisy().

79  {
80 
82  return *fGoodChannels;
83 
84  } // SimpleChannelStatus::GoodChannels()
std::unique_ptr< ChannelSet_t > fGoodChannels
cached set of good channels (lazy evaluation)
void FillGoodChannels() const
Fills the collection of good channels.
virtual bool lariov::SimpleChannelStatus::IsBad ( raw::ChannelID_t  channel) const
inlineoverridevirtual

Returns whether the specified channel is bad in the current run.

Definition at line 70 of file SimpleChannelStatus.h.

References fBadChannels.

Referenced by IsGood().

71  { return fBadChannels.count(channel) > 0; }
ChannelSet_t fBadChannels
set of bad channels
virtual bool lariov::SimpleChannelStatus::IsGood ( raw::ChannelID_t  channel) const
inlineoverridevirtual

Returns whether the specified channel is physical and good.

Definition at line 66 of file SimpleChannelStatus.h.

References IsBad(), IsNoisy(), and IsPresent().

67  { return IsPresent(channel) && !IsBad(channel) && !IsNoisy(channel); }
virtual bool IsBad(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
virtual bool IsPresent(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and good.
virtual bool IsNoisy(raw::ChannelID_t channel) const override
Returns whether the specified channel is noisy in the current run.
virtual bool lariov::SimpleChannelStatus::IsNoisy ( raw::ChannelID_t  channel) const
inlineoverridevirtual

Returns whether the specified channel is noisy in the current run.

Definition at line 74 of file SimpleChannelStatus.h.

References fNoisyChannels, and GoodChannels().

Referenced by IsGood().

75  { return fNoisyChannels.count(channel) > 0; }
ChannelSet_t fNoisyChannels
set of noisy channels
bool lariov::SimpleChannelStatus::IsPresent ( raw::ChannelID_t  channel) const
overridevirtual

Returns whether the specified channel is physical and good.

Definition at line 71 of file SimpleChannelStatus.cpp.

References fMaxPresentChannel, and raw::isValidChannelID().

Referenced by IsGood().

71  {
73  ? raw::isValidChannelID(channel) && (channel <= fMaxPresentChannel)
74  : true;
75  } // SimpleChannelStatus::isPresent()
raw::ChannelID_t fMaxPresentChannel
largest ID among present channels
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:36
raw::ChannelID_t lariov::SimpleChannelStatus::MaxChannel ( ) const
inline

Returns the ID of the largest known channel.

Definition at line 99 of file SimpleChannelStatus.h.

References fMaxChannel.

Referenced by MaxChannelPresent(), and Setup().

99 { return fMaxChannel; }
raw::ChannelID_t fMaxChannel
largest ID among existing channels
raw::ChannelID_t lariov::SimpleChannelStatus::MaxChannelPresent ( ) const
inline

Returns the ID of the largest present channel.

Definition at line 102 of file SimpleChannelStatus.h.

References fMaxPresentChannel, MaxChannel(), and Setup().

102 { return fMaxPresentChannel; }
raw::ChannelID_t fMaxPresentChannel
largest ID among present channels
virtual ChannelSet_t lariov::SimpleChannelStatus::NoisyChannels ( ) const
inlineoverridevirtual

Returns a copy of set of noisy channel IDs for the current run.

Definition at line 89 of file SimpleChannelStatus.h.

References fNoisyChannels.

Referenced by SimpleChannelStatus().

90  { return fNoisyChannels; }
ChannelSet_t fNoisyChannels
set of noisy channels
void lariov::SimpleChannelStatus::Setup ( raw::ChannelID_t  MaxChannel,
raw::ChannelID_t  MaxGoodChannel 
)

Sets the service provider up.

Parameters
MaxChannelID of the last channel
MaxGoodChannelID of the last good channel

Sets the largest ID of a physically present channel. All valid IDs smaller than this one are also considered present. If MaxGoodChannel is invalid, all channels are considered present.

Definition at line 58 of file SimpleChannelStatus.cpp.

References fGoodChannels, fMaxChannel, fMaxPresentChannel, and MaxChannel().

Referenced by MaxChannelPresent(), SimpleChannelStatus(), and lariov::SimpleChannelStatusService::SimpleChannelStatusService().

59  {
60 
62  fMaxPresentChannel = MaxGoodChannel;
63 
64  // clear the caches, if any
65  fGoodChannels.reset();
66 
67  } // SimpleChannelStatus::Setup()
std::unique_ptr< ChannelSet_t > fGoodChannels
cached set of good channels (lazy evaluation)
raw::ChannelID_t MaxChannel() const
Returns the ID of the largest known channel.
raw::ChannelID_t fMaxPresentChannel
largest ID among present channels
raw::ChannelID_t fMaxChannel
largest ID among existing channels
void lariov::SimpleChannelStatus::Setup ( raw::ChannelID_t  MaxChannel)
inline

Sets the service provider up.

Parameters
MaxChannelID of the last channel

As Setup(raw::ChannelID_t, raw::ChannelID_t), but assumes all channels to be present.

Definition at line 127 of file SimpleChannelStatus.h.

References Setup().

Referenced by Setup().

void Setup(raw::ChannelID_t MaxChannel, raw::ChannelID_t MaxGoodChannel)
Sets the service provider up.
raw::ChannelID_t MaxChannel() const
Returns the ID of the largest known channel.

Member Data Documentation

ChannelSet_t lariov::SimpleChannelStatus::fBadChannels
protected

set of bad channels

Definition at line 139 of file SimpleChannelStatus.h.

Referenced by BadChannels(), FillGoodChannels(), IsBad(), and SimpleChannelStatus().

std::unique_ptr<ChannelSet_t> lariov::SimpleChannelStatus::fGoodChannels
mutableprotected

cached set of good channels (lazy evaluation)

Definition at line 146 of file SimpleChannelStatus.h.

Referenced by FillGoodChannels(), GoodChannels(), and Setup().

raw::ChannelID_t lariov::SimpleChannelStatus::fMaxChannel
protected

largest ID among existing channels

Definition at line 142 of file SimpleChannelStatus.h.

Referenced by FillGoodChannels(), MaxChannel(), and Setup().

raw::ChannelID_t lariov::SimpleChannelStatus::fMaxPresentChannel
protected

largest ID among present channels

Definition at line 143 of file SimpleChannelStatus.h.

Referenced by FillGoodChannels(), IsPresent(), MaxChannelPresent(), and Setup().

ChannelSet_t lariov::SimpleChannelStatus::fNoisyChannels
protected

set of noisy channels

Definition at line 140 of file SimpleChannelStatus.h.

Referenced by FillGoodChannels(), IsNoisy(), NoisyChannels(), and SimpleChannelStatus().


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