9 #ifndef SIOVCHANNELSTATUSPROVIDER_CXX 10 #define SIOVCHANNELSTATUSPROVIDER_CXX 1 19 #include "larevt/CalibrationDBI/IOVData/IOVDataConstants.h" 38 bool UseDB = pset.
get<
bool>(
"UseDB",
false);
39 bool UseFile = pset.
get<
bool>(
"UseFile",
false);
40 std::string fileName = pset.
get<std::string>(
"FileName",
"");
49 std::cout <<
"Using default channel status value: "<<kGOOD<<
"\n";
53 cet::search_path sp(
"FW_SEARCH_PATH");
54 std::string abs_fp = sp.find_file(fileName);
55 std::cout <<
"Using channel statuses from local file: "<<abs_fp<<
"\n";
56 std::ifstream
file(abs_fp);
59 <<
"File "<<abs_fp<<
" is not found.";
64 while (std::getline(file, line)) {
65 DBChannelID_t ch = (DBChannelID_t)std::stoi(line.substr(0, line.find(
',')));
66 int status = std::stoi(line.substr(line.find(
',')+1));
69 cs.SetStatus( ChannelStatus::GetStatusFromInt(status) );
70 fData.AddOrReplaceRow(cs);
74 std::cout <<
"Using channel statuses from conditions database\n";
81 if (
fDataSource != DataSource::Database)
return false;
88 std::vector<DBChannelID_t> channels;
89 fFolder->GetChannelList(channels);
90 for (
auto it = channels.begin(); it != channels.end(); ++it) {
93 fFolder->GetNamedChannelData(*it,
"status", status);
95 ChannelStatus cs(*it);
96 cs.SetStatus( ChannelStatus::GetStatusFromInt((
int)status) );
98 fData.AddOrReplaceRow(cs);
120 SIOVChannelStatusProvider::ChannelSet_t
128 std::vector<DBChannelID_t> chs;
129 for (DBChannelID_t ch=0; ch != maxChannel; ++ch) {
132 retSet.insert(chs.begin(), chs.end());
136 std::vector<DBChannelID_t> chs;
137 for (DBChannelID_t ch=0; ch != maxChannel; ++ch) {
141 retSet.insert(chs.begin(), chs.end());
148 SIOVChannelStatusProvider::ChannelSet_t
155 SIOVChannelStatusProvider::ChannelSet_t
159 dead.insert(ln.begin(),ln.end());
165 SIOVChannelStatusProvider::ChannelSet_t
178 ChannelStatus cs(dbch);
179 cs.SetStatus(kNOISY);
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.
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.
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.
T get(std::string const &key) const
const IOVTimeStamp & End() const
Filters for channels, events, etc.
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.
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.
Collection of exception classes for WebDBI.
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception