11 #include "fhiclcpp/ParameterSet.h"
12 #include "messagefacility/MessageLogger/MessageLogger.h"
13 #include "art/Framework/Core/ModuleMacros.h"
14 #include "art/Framework/Core/EDAnalyzer.h"
15 #include "art/Framework/Services/Registry/ServiceHandle.h"
16 #include "art/Framework/Principal/Run.h"
24 namespace art {
class Event; }
45 virtual void analyze(art::Event
const&)
override {}
46 virtual void beginRun(art::Run
const& run)
override;
53 template <
typename Obj>
54 unsigned int testObject(Obj
const* pChStatus)
const;
72 (fhicl::ParameterSet
const& 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))
81 mf::LogInfo log(
"SimpleChannelStatusTest");
83 log <<
"Channels known as good: " << KnownGoodChannels.size();
84 if (!KnownGoodChannels.empty()) {
86 for (
unsigned int chId: KnownGoodChannels) log <<
" " << chId;
90 log <<
"\nChannels known as noisy: " << KnownNoisyChannels.size();
91 if (!KnownNoisyChannels.empty()) {
93 for (
unsigned int chId: KnownNoisyChannels) log <<
" " << chId;
97 log <<
"\nChannels known as bad: " << KnownBadChannels.size();
98 if (!KnownBadChannels.empty()) {
100 for (
unsigned int chId: KnownBadChannels) log <<
" " << chId;
110 mf::LogInfo(
"SimpleChannelStatusTest") <<
"New run: " << run.run();
115 mf::LogVerbatim(
"SimpleChannelStatusTest")
116 <<
"\nTesting service interface...";
117 art::ServiceHandle<lariov::ChannelStatusService const> StatusSrvHandle;
129 mf::LogVerbatim(
"SimpleChannelStatusTest")
130 <<
"\nTesting base interface...";
132 = StatusSrvHandle->GetProviderPtr();
135 throw art::Exception(art::errors::LogicError)
136 << nErrors <<
" errors while testing ChannelStatusProvider!";
143 template <
typename Obj>
148 mf::LogInfo log(
"SimpleChannelStatusTest");
153 auto BadChannels = pChStatus->BadChannels();
154 log <<
"\nChannels marked as bad: " << BadChannels.size();
155 if (!BadChannels.empty()) {
157 for (
unsigned int chId: BadChannels) log <<
" " << chId;
162 log <<
"\nChannels marked as noisy: " <<
NoisyChannels.size();
173 if (!pChStatus->IsBad(chId)) {
174 mf::LogError(
"SimpleChannelStatusTest")
175 <<
"channel #" << chId <<
" is not bad as it should";
181 if (!pChStatus->IsNoisy(chId)) {
182 mf::LogError(
"SimpleChannelStatusTest")
183 <<
"channel #" << chId <<
" is not noisy as it should";
189 if (pChStatus->IsBad(chId)) {
190 mf::LogError(
"SimpleChannelStatusTest")
191 <<
"channel #" << chId <<
" is bad, while it should not";
194 if (pChStatus->IsNoisy(chId)) {
195 mf::LogError(
"SimpleChannelStatusTest")
196 <<
"channel #" << chId <<
" is noisy, while it should not";
virtual void beginRun(art::Run const &run) override
SimpleChannelStatusTest(fhicl::ParameterSet const &pset)
static const std::vector< unsigned int > EmptyVect
for initializations
virtual void analyze(art::Event const &) override
std::vector< unsigned int > KnownGoodChannels
Tests an instanciation of the ChannelStatusService.
Class providing information about the quality of channels.
BEGIN_PROLOG NoisyChannels
std::vector< unsigned int > KnownNoisyChannels
Interface for experiment-specific channel quality info provider.
unsigned int testObject(Obj const *pChStatus) const
std::vector< unsigned int > KnownBadChannels
Interface for experiment-specific service for channel quality info.