Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
lariov::SimpleChannelStatusTest Class Reference

Tests an instanciation of the ChannelStatusService. More...

Inheritance diagram for lariov::SimpleChannelStatusTest:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 SimpleChannelStatusTest (fhicl::ParameterSet const &pset)
 
virtual void analyze (art::Event const &) override
 
virtual void beginRun (art::Run const &run) override
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

template<typename Obj >
unsigned int testObject (Obj const *pChStatus) const
 

Private Attributes

std::vector< unsigned int > KnownGoodChannels
 
std::vector< unsigned int > KnownNoisyChannels
 
std::vector< unsigned int > KnownBadChannels
 

Static Private Attributes

static const std::vector< unsigned int > EmptyVect
 for initializations More...
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Tests an instanciation of the ChannelStatusService.

Configuration parameters

Definition at line 41 of file SimpleChannelStatusTest_module.cc.

Constructor & Destructor Documentation

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

Definition at line 72 of file SimpleChannelStatusTest_module.cc.

73  : EDAnalyzer(pset)
75  (pset.get<std::vector<unsigned int>>("TestGoodChannels", EmptyVect))
77  (pset.get<std::vector<unsigned int>>("TestNoisyChannels", EmptyVect))
79  (pset.get<std::vector<unsigned int>>("TestBadChannels", EmptyVect))
80  {
81  mf::LogInfo log("SimpleChannelStatusTest");
82 
83  log << "Channels known as good: " << KnownGoodChannels.size();
84  if (!KnownGoodChannels.empty()) {
85  log << " (";
86  for (unsigned int chId: KnownGoodChannels) log << " " << chId;
87  log << ")";
88  } // if known good channels
89 
90  log << "\nChannels known as noisy: " << KnownNoisyChannels.size();
91  if (!KnownNoisyChannels.empty()) {
92  log << " (";
93  for (unsigned int chId: KnownNoisyChannels) log << " " << chId;
94  log << ")";
95  } // if known noisy channels
96 
97  log << "\nChannels known as bad: " << KnownBadChannels.size();
98  if (!KnownBadChannels.empty()) {
99  log << " (";
100  for (unsigned int chId: KnownBadChannels) log << " " << chId;
101  log << ")";
102  } // if known bad channels
103 
104  } // SimpleChannelStatusTest::SimpleChannelStatusTest()
static const std::vector< unsigned int > EmptyVect
for initializations
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::vector< unsigned int > KnownNoisyChannels

Member Function Documentation

virtual void lariov::SimpleChannelStatusTest::analyze ( art::Event const &  )
inlineoverridevirtual

Implements art::EDAnalyzer.

Definition at line 45 of file SimpleChannelStatusTest_module.cc.

45 {}
void lariov::SimpleChannelStatusTest::beginRun ( art::Run const &  run)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 108 of file SimpleChannelStatusTest_module.cc.

108  {
109 
110  mf::LogInfo("SimpleChannelStatusTest") << "New run: " << run.run();
111 
112  unsigned int nErrors = 0;
113 
114  //---
115  mf::LogVerbatim("SimpleChannelStatusTest")
116  << "\nTesting service interface...";
118  /* // since the service does not share the interface of the provider,
119  // this test can't be
120  const lariov::ChannelStatusService* pStatusSrv = &*StatusSrvHandle;
121  nErrors = testObject(pStatusSrv);
122  if (nErrors > 0) {
123  throw art::Exception(art::errors::LogicError)
124  << nErrors << " errors while testing ChannelStatusService!";
125  } // if errors
126  */
127 
128  //---
129  mf::LogVerbatim("SimpleChannelStatusTest")
130  << "\nTesting base interface...";
131  lariov::ChannelStatusProvider const* pChStatus
132  = StatusSrvHandle->GetProviderPtr();
133  nErrors = testObject(pChStatus);
134  if (nErrors > 0) {
136  << nErrors << " errors while testing ChannelStatusProvider!";
137  } // if errors
138 
139  } // SimpleChannelStatusTest::beginRun()
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Class providing information about the quality of channels.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
unsigned int testObject(Obj const *pChStatus) const
ChannelStatusProvider const * GetProviderPtr() const
Returns a pointer to the service provider.
template<typename Obj >
unsigned int lariov::SimpleChannelStatusTest::testObject ( Obj const *  pChStatus) const
private

Definition at line 144 of file SimpleChannelStatusTest_module.cc.

145  {
146  // 1. print all the channels marked non-good
147  {
148  mf::LogInfo log("SimpleChannelStatusTest");
149 
150 
151  // this is a copy of the list;
152  // to avoid creating temporary objects, check channels one by one
153  auto BadChannels = pChStatus->BadChannels();
154  log << "\nChannels marked as bad: " << BadChannels.size();
155  if (!BadChannels.empty()) {
156  log << " (";
157  for (unsigned int chId: BadChannels) log << " " << chId;
158  log << ")";
159  } // if bad channels
160 
161  auto NoisyChannels = pChStatus->NoisyChannels();
162  log << "\nChannels marked as noisy: " << NoisyChannels.size();
163  if (!NoisyChannels.empty()) {
164  log << " (";
165  for (unsigned int chId: NoisyChannels) log << " " << chId;
166  log << ")";
167  } // if noisy channels
168  } // print test
169 
170  // 2. test the channels as in the configuration
171  unsigned int nErrors = 0;
172  for (const auto chId: KnownBadChannels) {
173  if (!pChStatus->IsBad(chId)) {
174  mf::LogError("SimpleChannelStatusTest")
175  << "channel #" << chId << " is not bad as it should";
176  ++nErrors;
177  }
178  } // for knwon bad channels
179 
180  for (const auto chId: KnownNoisyChannels) {
181  if (!pChStatus->IsNoisy(chId)) {
182  mf::LogError("SimpleChannelStatusTest")
183  << "channel #" << chId << " is not noisy as it should";
184  ++nErrors;
185  }
186  } // for knwon noisy channels
187 
188  for (const auto chId: KnownGoodChannels) {
189  if (pChStatus->IsBad(chId)) {
190  mf::LogError("SimpleChannelStatusTest")
191  << "channel #" << chId << " is bad, while it should not";
192  ++nErrors;
193  }
194  if (pChStatus->IsNoisy(chId)) {
195  mf::LogError("SimpleChannelStatusTest")
196  << "channel #" << chId << " is noisy, while it should not";
197  ++nErrors;
198  }
199  } // for knwon good channels
200 
201  return nErrors;
202  } // SimpleChannelStatusTest::testObject()
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::vector< unsigned int > KnownNoisyChannels

Member Data Documentation

const std::vector< unsigned int > lariov::SimpleChannelStatusTest::EmptyVect
staticprivate

for initializations

Definition at line 57 of file SimpleChannelStatusTest_module.cc.

std::vector<unsigned int> lariov::SimpleChannelStatusTest::KnownBadChannels
private

Definition at line 51 of file SimpleChannelStatusTest_module.cc.

std::vector<unsigned int> lariov::SimpleChannelStatusTest::KnownGoodChannels
private

Definition at line 49 of file SimpleChannelStatusTest_module.cc.

std::vector<unsigned int> lariov::SimpleChannelStatusTest::KnownNoisyChannels
private

Definition at line 50 of file SimpleChannelStatusTest_module.cc.


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