6 #include "cetlib_except/exception.h" 51 bool UseDB = p.
get<
bool>(
"UseDB",
false);
52 bool UseFile = p.
get<
bool>(
"UseFile",
false);
62 std::cout <<
"Using default pedestal values\n";
63 float default_collmean = p.
get<
float>(
"DefaultCollMean", 400.0);
64 float default_collrms = p.
get<
float>(
"DefaultCollRms", 0.3);
65 float default_mean_err = p.
get<
float>(
"DefaultMeanErr", 0.0);
66 float default_rms_err = p.
get<
float>(
"DefaultRmsErr", 0.0);
67 float default_indmean = p.
get<
float>(
"DefaultIndMean", 2048.0);
68 float default_indrms = p.
get<
float>(
"DefaultIndRms", 0.3);
90 fData.AddOrReplaceRow(DefaultColl);
94 fData.AddOrReplaceRow(DefaultInd);
96 else throw IOVDataError(
"Wire type is not collection or induction!");
102 std::cout <<
"Using pedestals from local file: "<<abs_fp<<
"\n";
103 std::ifstream
file(abs_fp);
106 <<
"File "<<abs_fp<<
" is not found.";
111 while (std::getline(file, line)) {
112 size_t current_comma = line.find(
',');
114 float ped = std::stof( line.substr(current_comma+1, line.find(
',',current_comma+1)-(current_comma+1)) );
116 current_comma = line.find(
',',current_comma+1);
117 float rms = std::stof( line.substr(current_comma+1, line.find(
',',current_comma+1)-(current_comma+1)) );
119 current_comma = line.find(
',',current_comma+1);
120 float ped_err = std::stof( line.substr(current_comma+1, line.find(
',',current_comma+1)-(current_comma+1)) );
122 current_comma = line.find(
',',current_comma+1);
123 float rms_err = std::stof( line.substr(current_comma+1) );
130 fData.AddOrReplaceRow(dp);
134 std::cout <<
"Using pedestals from conditions database\n";
142 mf::LogInfo(
"DetPedestalRetrievalAlg") <<
"DetPedestalRetrievalAlg::UpdateTimeStamp called.";
168 mf::LogInfo(
"DetPedestalRetrievalAlg") <<
"DetPedestalRetrievalAlg::DBUpdate called with new timestamp.";
180 std::vector<DBChannelID_t>
channels;
181 fFolder->GetChannelList(channels);
182 for (
auto it = channels.begin(); it != channels.end(); ++it) {
184 double mean, mean_err,
rms, rms_err;
185 fFolder->GetNamedChannelData(*it,
"mean", mean);
186 fFolder->GetNamedChannelData(*it,
"mean_err", mean_err);
187 fFolder->GetNamedChannelData(*it,
"rms", rms);
188 fFolder->GetNamedChannelData(*it,
"rms_err", rms_err);
196 fData.AddOrReplaceRow(pd);
207 return fData.GetRow(ch);
DBTimeStamp_t fEventTimeStamp
std::unique_ptr< DBFolder > fFolder
virtual void Reconfigure(fhicl::ParameterSet const &p)
Configure using fhicl::ParameterSet.
void SetStamp(unsigned long stamp, unsigned int substamp=0)
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
float PedRmsErr(DBChannelID_t ch) const override
Base forward iterator browsing all wire IDs in the detector.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::uint32_t DBChannelID_t
std::uint64_t DBTimeStamp_t
Class def header for a class DetPedestalRetrievalAlg.
float PedRms(DBChannelID_t ch) const override
float PedMeanErr(DBChannelID_t ch) const override
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
void SetPedRms(float pedRms)
bool Update(DBTimeStamp_t ts)
Update Snapshot and inherited DBFolder if using database. Return true if updated. ...
art framework interface to geometry description
Class def header for a class IOVTimeStamp.
unsigned long SubStamp() const
const DetPedestal & Pedestal(DBChannelID_t ch) const
Retrieve pedestal information.
void SetPedRmsErr(float pedRmsErr)
bool UpdateFolder(DBTimeStamp_t ts)
Return true if fFolder is successfully updated.
void SetPedMeanErr(float pedMeanErr)
Signal from induction planes.
bool DBUpdate() const
Do actual database updates.
DataSource::ds fDataSource
T get(std::string const &key) const
Retrieves channel information: pedestal and RMS.
DetPedestalRetrievalAlg(const std::string &foldername, const std::string &url, const std::string &tag="")
Constructors.
Snapshot< DetPedestal > fData
void SetChannel(unsigned int ch)
wire_id_iterator end_wire_id() const
Returns an iterator pointing after the last wire ID in the detector.
const IOVTimeStamp & End() const
DBTimeStamp_t fCurrentTimeStamp
Definition of data types for geometry description.
Filters for channels, events, etc.
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
unsigned long Stamp() const
void SetPedMean(float pedMean)
void line(double t, double *p, double &x, double &y, double &z)
std::string find_file(std::string const &filename) const
Collection of exception classes for IOVData.
const IOVTimeStamp & Begin() const
Get Timestamp information.
Access the description of detector geometry.
wire_id_iterator begin_wire_id() const
Returns an iterator pointing to the first wire ID in the detector.
float PedMean(DBChannelID_t ch) const override
static IOVTimeStamp MaxTimeStamp()
auto const & get(AssnsNode< L, R, D > const &r)
LArSoft geometry interface.
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
void UpdateTimeStamp(DBTimeStamp_t ts)
Update event time stamp.
cet::coded_exception< error, detail::translate > exception
void Reconfigure(fhicl::ParameterSet const &p) override
Reconfigure function called by fhicl constructor.
Signal from collection planes.