29 , fCurrentTimeStamp(0)
33 bool UseDB = pset.
get<
bool>(
"UseDB",
false);
34 bool UseFile = pset.
get<
bool>(
"UseFile",
false);
35 std::string fileName = pset.
get<std::string>(
"FileName",
"");
47 std::cout <<
"Using default channel status value: " <<
kGOOD <<
"\n";
51 cet::search_path sp(
"FW_SEARCH_PATH");
52 std::string abs_fp = sp.find_file(fileName);
53 std::cout <<
"Using channel statuses from local file: " << abs_fp <<
"\n";
54 std::ifstream
file(abs_fp);
56 throw cet::exception(
"SIOVChannelStatusProvider") <<
"File " << abs_fp <<
" is not found.";
61 while (std::getline(file, line)) {
62 DBChannelID_t ch = (DBChannelID_t)std::stoi(line.substr(0, line.find(
',')));
63 int status = std::stoi(line.substr(line.find(
',') + 1));
67 fData.AddOrReplaceRow(cs);
71 std::cout <<
"Using channel statuses from conditions database\n";
80 <<
"SIOVChannelStatusProvider::UpdateTimeStamp called.";
109 static std::mutex mutex;
110 std::lock_guard<std::mutex> lock(mutex);
116 <<
"SIOVChannelStatusProvider::DBUpdate called with new timestamp.";
128 std::vector<DBChannelID_t> channels;
129 fFolder->GetChannelList(channels);
130 for (
auto it = channels.begin(); it != channels.end(); ++it) {
133 fFolder->GetNamedChannelData(*it,
"status", status);
138 fData.AddOrReplaceRow(cs);
166 std::vector<DBChannelID_t> chs;
167 for (DBChannelID_t ch = 0; ch != maxChannel; ++ch) {
170 retSet.insert(chs.begin(), chs.end());
174 std::vector<DBChannelID_t> chs;
175 for (DBChannelID_t ch = 0; ch != maxChannel; ++ch) {
179 retSet.insert(chs.begin(), chs.end());
195 dead.insert(ln.begin(), ln.end());
std::unique_ptr< DBFolder > fFolder
bool IsPresent(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
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
ChannelSet_t GoodChannels() const override
Returns a copy of set of bad channel IDs for the current run.
ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
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.
bool IsBad(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
DBTimeStamp_t fCurrentTimeStamp
T get(std::string const &key) const
void SetChannel(unsigned int ch)
const IOVTimeStamp & End() const
Filters for channels, events, etc.
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
ChannelSet_t GetChannelsWithStatus(chStatus status) const
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)
Allows a service to add to the list of noisy channels.
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.
ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
void SetStatus(chStatus status)