9 #ifndef SIOVCHANNELSTATUSPROVIDER_CXX 10 #define SIOVCHANNELSTATUSPROVIDER_CXX 1 19 #include "larevt/CalibrationDBI/IOVData/IOVDataConstants.h" 37 , fCurrentTimeStamp(0)
41 bool UseDB = pset.
get<
bool>(
"UseDB",
false);
42 bool UseFile = pset.
get<
bool>(
"UseFile",
false);
43 std::string fileName = pset.
get<std::string>(
"FileName",
"");
52 std::cout <<
"Using default channel status value: "<<kGOOD<<
"\n";
56 cet::search_path sp(
"FW_SEARCH_PATH");
57 std::string abs_fp = sp.find_file(fileName);
58 std::cout <<
"Using channel statuses from local file: "<<abs_fp<<
"\n";
59 std::ifstream
file(abs_fp);
62 <<
"File "<<abs_fp<<
" is not found.";
67 while (std::getline(file, line)) {
68 DBChannelID_t ch = (DBChannelID_t)std::stoi(line.substr(0, line.find(
',')));
69 int status = std::stoi(line.substr(line.find(
',')+1));
72 cs.SetStatus( ChannelStatus::GetStatusFromInt(status) );
73 fData.AddOrReplaceRow(cs);
77 std::cout <<
"Using channel statuses from conditions database\n";
84 mf::LogInfo(
"SIOVChannelStatusProvider") <<
"SIOVChannelStatusProvider::UpdateTimeStamp called.";
112 mf::LogInfo(
"SIOVChannelStatusProvider") <<
"SIOVChannelStatusProvider::DBUpdate called with new timestamp.";
124 std::vector<DBChannelID_t> channels;
125 fFolder->GetChannelList(channels);
126 for (
auto it = channels.begin(); it != channels.end(); ++it) {
129 fFolder->GetNamedChannelData(*it,
"status", status);
131 ChannelStatus cs(*it);
132 cs.SetStatus( ChannelStatus::GetStatusFromInt((
int)status) );
134 fData.AddOrReplaceRow(cs);
158 SIOVChannelStatusProvider::ChannelSet_t
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());
186 SIOVChannelStatusProvider::ChannelSet_t
193 SIOVChannelStatusProvider::ChannelSet_t
197 dead.insert(ln.begin(),ln.end());
203 SIOVChannelStatusProvider::ChannelSet_t
216 ChannelStatus cs(dbch);
217 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.
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.
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
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.
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.
Collection of exception classes for WebDBI.
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception