13 #include "art/Framework/Services/Registry/ServiceHandle.h"
14 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
30 , fCurrentTimeStamp(0)
34 bool UseDB = pset.get<
bool>(
"UseDB",
false);
35 bool UseFile = pset.get<
bool>(
"UseFile",
false);
36 std::string
fileName = pset.get<std::string>(
"FileName",
"");
49 cet::search_path sp(
"FW_SEARCH_PATH");
50 std::string abs_fp = sp.find_file(fileName);
51 std::cout <<
"Using channel statuses from local file: "<<abs_fp<<
"\n";
52 std::ifstream
file(abs_fp);
54 throw cet::exception(
"SIOVChannelStatusProvider")
55 <<
"File "<<abs_fp<<
" is not found.";
60 while (std::getline(file, line)) {
62 int status = std::stoi(line.substr(line.find(
',')+1));
66 fData.AddOrReplaceRow(cs);
70 std::cout <<
"Using channel statuses from conditions database\n";
77 mf::LogInfo(
"SIOVChannelStatusProvider") <<
"SIOVChannelStatusProvider::UpdateTimeStamp called.";
105 mf::LogInfo(
"SIOVChannelStatusProvider") <<
"SIOVChannelStatusProvider::DBUpdate called with new timestamp.";
117 std::vector<DBChannelID_t> channels;
118 fFolder->GetChannelList(channels);
119 for (
auto it = channels.begin(); it != channels.end(); ++it) {
122 fFolder->GetNamedChannelData(*it,
"status", status);
127 fData.AddOrReplaceRow(cs);
156 DBChannelID_t maxChannel = art::ServiceHandle<geo::Geometry const>()->Nchannels() - 1;
159 std::vector<DBChannelID_t> chs;
163 retSet.insert(chs.begin(), chs.end());
167 std::vector<DBChannelID_t> chs;
172 retSet.insert(chs.begin(), chs.end());
190 dead.insert(ln.begin(),ln.end());
ChannelSet_t GoodChannels() const override
Returns a copy of set of good channel IDs for the current run.
std::unique_ptr< DBFolder > fFolder
std::set< raw::ChannelID_t > ChannelSet_t
Type of set of channel IDs.
DataSource::ds fDataSource
static DBChannelID_t rawToDBChannel(raw::ChannelID_t channel)
Converts LArSoft channel ID in the one proper for the DB.
DBTimeStamp_t fEventTimeStamp
std::uint32_t DBChannelID_t
ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.
std::uint64_t DBTimeStamp_t
void UpdateTimeStamp(DBTimeStamp_t ts)
Update event time stamp.
Class providing information about the quality of channels.
static chStatus GetStatusFromInt(int status)
Snapshot< ChannelStatus > fData
bool UpdateFolder(DBTimeStamp_t ts)
Return true if fFolder is successfully updated.
DBTimeStamp_t fCurrentTimeStamp
void SetChannel(unsigned int ch)
const IOVTimeStamp & End() const
ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
bool IsBad(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
ChannelSet_t GetChannelsWithStatus(chStatus status) const
services TFileService fileName
const ChannelStatus & GetChannelStatus(raw::ChannelID_t channel) const
Returns Channel Status.
Snapshot< ChannelStatus > fNewNoisy
Channel quality provider with information from configuration file.
const IOVTimeStamp & Begin() const
Get Timestamp information.
bool Update(DBTimeStamp_t)
bool DBUpdate() const
Do actual database updates.
SIOVChannelStatusProvider(fhicl::ParameterSet const &pset)
Constructor.
void AddNoisyChannel(raw::ChannelID_t ch)
Allows a service to add to the list of noisy channels.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
bool IsPresent(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and connected to wire.
art framework interface to geometry description
BEGIN_PROLOG could also be cout
void SetStatus(chStatus status)