LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
DetPedestalRetrievalAlg.h
Go to the documentation of this file.
1 
14 #ifndef WEBDBI_DETPEDESTALRETRIEVALALG_H
15 #define WEBDBI_DETPEDESTALRETRIEVALALG_H
16 
17 // C/C++ standard libraries
18 #include <string>
19 #include <array>
20 
21 // LArSoft libraries
22 #include "larevt/CalibrationDBI/IOVData/DetPedestal.h"
23 #include "larevt/CalibrationDBI/IOVData/Snapshot.h"
24 #include "larevt/CalibrationDBI/IOVData/IOVDataConstants.h"
25 #include "larevt/CalibrationDBI/Interface/DetPedestalProvider.h"
27 
28 namespace lariov {
29 
54  class DetPedestalRetrievalAlg : public DatabaseRetrievalAlg, public DetPedestalProvider {
55 
56  public:
57 
59  DetPedestalRetrievalAlg(const std::string& foldername,
60  const std::string& url,
61  const std::string& tag="");
62 
64 
66  void Reconfigure(fhicl::ParameterSet const& p) override;
67 
69  void UpdateTimeStamp(DBTimeStamp_t ts);
70 
72  bool Update(DBTimeStamp_t ts);
73 
75  const DetPedestal& Pedestal(DBChannelID_t ch) const;
76  float PedMean(DBChannelID_t ch) const override;
77  float PedRms(DBChannelID_t ch) const override;
78  float PedMeanErr(DBChannelID_t ch) const override;
79  float PedRmsErr(DBChannelID_t ch) const override;
80 
81  //hardcoded information about database folder - useful for debugging cross checks
82  static constexpr unsigned int NCOLUMNS = 5;
83  static constexpr const char* FIELD_NAMES[NCOLUMNS]
84  = {"channel", "mean", "mean_err", "rms", "rms_err"};
85  static constexpr const char* FIELD_TYPES[NCOLUMNS]
86  = {"unsigned int", "float", "float", "float", "float"};
87 
88  private:
89 
91 
92  bool DBUpdate() const; // Uses current event time.
93  bool DBUpdate(DBTimeStamp_t ts) const;
94 
95  // Time stamps.
96 
97  DBTimeStamp_t fEventTimeStamp; // Most recently seen time stamp.
98  mutable DBTimeStamp_t fCurrentTimeStamp; // Time stamp of cached data.
99 
100  DataSource::ds fDataSource;
101  mutable Snapshot<DetPedestal> fData;
102  };
103 }//end namespace lariov
104 
105 #endif
106  // end of doxygen group
float PedRmsErr(DBChannelID_t ch) const override
float PedRms(DBChannelID_t ch) const override
float PedMeanErr(DBChannelID_t ch) const override
bool Update(DBTimeStamp_t ts)
Update Snapshot and inherited DBFolder if using database. Return true if updated. ...
const DetPedestal & Pedestal(DBChannelID_t ch) const
Retrieve pedestal information.
static constexpr const char * FIELD_NAMES[NCOLUMNS]
bool DBUpdate() const
Do actual database updates.
static constexpr unsigned int NCOLUMNS
Retrieves channel information: pedestal and RMS.
DetPedestalRetrievalAlg(const std::string &foldername, const std::string &url, const std::string &tag="")
Constructors.
Class def header for a class DatabaseRetrievalAlg.
Filters for channels, events, etc.
float PedMean(DBChannelID_t ch) const override
static constexpr const char * FIELD_TYPES[NCOLUMNS]
void UpdateTimeStamp(DBTimeStamp_t ts)
Update event time stamp.
void Reconfigure(fhicl::ParameterSet const &p) override
Reconfigure function called by fhicl constructor.