LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 48 of file SimpleChannelStatus.h.

Member Typedef Documentation

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

Definition at line 50 of file SimpleChannelStatus.h.

Constructor & Destructor Documentation

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

Configuration.

Definition at line 27 of file SimpleChannelStatus.cpp.

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

29  {
30  using chan_vect_t = std::vector<raw::ChannelID_t>;
31 
32  // Read the bad channels as a vector, then convert it into a set
33  auto BadChannels = pset.get<chan_vect_t>("BadChannels", {});
34  cet::copy_all(BadChannels, std::inserter(fBadChannels, fBadChannels.begin()));
35 
36  // Read the noise channels as a vector, then convert it into a set
37  auto NoisyChannels = pset.get<chan_vect_t>("NoisyChannels", {});
38  cet::copy_all(NoisyChannels, std::inserter(fNoisyChannels, fNoisyChannels.begin()));
39 
40  } // 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 89 of file SimpleChannelStatus.h.

Referenced by SimpleChannelStatus().

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

Fills the collection of good channels.

Definition at line 72 of file SimpleChannelStatus.cpp.

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

Referenced by GoodChannels().

73  {
74 
75  if (!fGoodChannels) fGoodChannels.reset(new ChannelSet_t);
76 
78  GoodChannels.clear();
79 
80  std::vector<std::pair<ChannelSet_t::const_iterator, ChannelSet_t::const_iterator>> VetoedIDs;
81 
82  VetoedIDs.emplace_back(fBadChannels.cbegin(), fBadChannels.cend());
83  VetoedIDs.emplace_back(fNoisyChannels.cbegin(), fNoisyChannels.cend());
84 
85  // go for the first (lowest) channel ID...
86  raw::ChannelID_t channel = 0;
87  while (!raw::isValidChannelID(channel))
88  ++channel;
89 
90  // ... to the last present one
91  raw::ChannelID_t last_channel = fMaxChannel;
93  last_channel = fMaxPresentChannel;
94 
95  // if we don't know how many channels
96  if (!raw::isValidChannelID(last_channel)) {
97  // this exception means that the Setup() function was not called
98  // or it was called with an invalid value
99  throw cet::exception("SimpleChannelStatus")
100  << "Can't fill good channel list since no largest channel was set up\n";
101  } // if
102 
103  // add the channels to the set one by one
104  while (channel <= last_channel) {
105  bool bGood = true;
106 
107  // check if this channel is in any of the vetoed lists
108  for (auto iter : VetoedIDs) {
109 
110  // check all the remaining vetoed channels in this list
111  while (iter.first != iter.second) {
112  // if the first vetoed channel is larger than the tested channel,
113  // we are done with this list
114  if (*(iter.first) > channel) break;
115 
116  if (*(iter.first) == channel) { // vetoed!
117  bGood = false;
118  ++(iter.first); // we have found this already
119  break;
120  }
121 
122  // the last vetoed channel is smaller than the tested channel;
123  // maybe the next vetoed channel will be it!
124  ++(iter.first);
125  } // while
126 
127  if (!bGood) break; // already known bad, we are done
128  } // for
129 
130  // add the channel
131  if (bGood) GoodChannels.insert(channel);
132  ++channel;
133  } // while
134 
135  } // 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
ChannelSet_t fBadChannels
set of bad channels
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:35
lariov::ChannelStatusProvider::ChannelSet_t ChannelSet_t
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
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 63 of file SimpleChannelStatus.cpp.

References fGoodChannels, and FillGoodChannels().

Referenced by FillGoodChannels().

64  {
65 
67  return *fGoodChannels;
68 
69  } // 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 71 of file SimpleChannelStatus.h.

72  {
73  return fBadChannels.count(channel) > 0;
74  }
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 65 of file SimpleChannelStatus.h.

66  {
67  return IsPresent(channel) && !IsBad(channel) && !IsNoisy(channel);
68  }
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 77 of file SimpleChannelStatus.h.

78  {
79  return fNoisyChannels.count(channel) > 0;
80  }
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 55 of file SimpleChannelStatus.cpp.

References fMaxPresentChannel, and raw::isValidChannelID().

56  {
58  raw::isValidChannelID(channel) && (channel <= fMaxPresentChannel) :
59  true;
60  } // SimpleChannelStatus::isPresent()
raw::ChannelID_t fMaxPresentChannel
largest ID among present channels
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:35
raw::ChannelID_t lariov::SimpleChannelStatus::MaxChannel ( ) const
inline

Returns the ID of the largest known channel.

Definition at line 100 of file SimpleChannelStatus.h.

Referenced by Setup().

100 { 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 103 of file SimpleChannelStatus.h.

103 { 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 92 of file SimpleChannelStatus.h.

Referenced by SimpleChannelStatus().

92 { 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 43 of file SimpleChannelStatus.cpp.

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

Referenced by lariov::SimpleChannelStatusService::SimpleChannelStatusService().

44  {
45 
47  fMaxPresentChannel = MaxGoodChannel;
48 
49  // clear the caches, if any
50  fGoodChannels.reset();
51 
52  } // 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 126 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 137 of file SimpleChannelStatus.h.

Referenced by FillGoodChannels(), and SimpleChannelStatus().

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

cached set of good channels (lazy evaluation)

Definition at line 144 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 140 of file SimpleChannelStatus.h.

Referenced by FillGoodChannels(), and Setup().

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

largest ID among present channels

Definition at line 141 of file SimpleChannelStatus.h.

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

ChannelSet_t lariov::SimpleChannelStatus::fNoisyChannels
protected

set of noisy channels

Definition at line 138 of file SimpleChannelStatus.h.

Referenced by FillGoodChannels(), and SimpleChannelStatus().


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