All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetPedestalRetrievalAlg.h
Go to the documentation of this file.
1 /**
2  * \file DetPedestalRetrievalAlg.h
3  *
4  * \ingroup WebDBI
5  *
6  * \brief Class def header for a class DetPedestalRetrievalAlg
7  *
8  * @author eberly@slac.stanford.edu
9  */
10 
11 /** \addtogroup WebDBI
12 
13  @{*/
14 #ifndef WEBDBI_DETPEDESTALRETRIEVALALG_H
15 #define WEBDBI_DETPEDESTALRETRIEVALALG_H
16 
17 // C/C++ standard libraries
18 #include <string>
19 
20 // LArSoft libraries
27 
28 namespace fhicl { class ParameterSet; }
29 
30 namespace lariov {
31 
32  /**
33  * @brief Retrieves channel information: pedestal and RMS
34  *
35  * Configuration parameters
36  * =========================
37  *
38  * - *DatabaseRetrievalAlg* (parameter set, mandatory): configuration for the
39  * database; see lariov::DatabaseRetrievalAlg
40  * - *UseDB* (boolean, default: false): retrieve information from the database
41  * - *UseFile* (boolean, default: false): retrieve information from a file;
42  * not implemented yet
43  * - *DefaultCollMean* (real, default: 400.0): pedestal value returned for
44  * collection plane channels when /UseDB/ and /UseFile/ parameters are false
45  * - *DefaultIndMean* (real, default: 2048.0): pedestal value returned for
46  * induction plane channels when /UseDB/ and /UseFile/ parameters are false
47  * - *DefaultCollRms* (real, default: 0.3): pedestal RMS value returned for
48  * collection plane channels when /UseDB/ and /UseFile/ parameters are false
49  * - *DefaultIndRms* (real, default: 0.3): pedestal RMS value returned for
50  * induction plane channels when /UseDB/ and /UseFile/ parameters are false
51  * - *DefaultMeanErr* (real, default: 0.0): error on the pedestal value
52  * for all channels returned when /UseDB/ and /UseFile/ parameters are false
53  * - *DefaultRmsErr* (real, default: 0.0): error on the RMS value
54  * for all channels returned when /UseDB/ and /UseFile/ parameters are false
55  */
57 
58  public:
59 
60  /// Constructors
61  DetPedestalRetrievalAlg(const std::string& foldername,
62  const std::string& url,
63  const std::string& tag="");
64 
65  DetPedestalRetrievalAlg(fhicl::ParameterSet const& p);
66 
67  /// Reconfigure function called by fhicl constructor
68  void Reconfigure(fhicl::ParameterSet const& p) override;
69 
70  /// Update event time stamp.
72 
73  /// Update Snapshot and inherited DBFolder if using database. Return true if updated
74  bool Update(DBTimeStamp_t ts);
75 
76  /// Retrieve pedestal information
77  const DetPedestal& Pedestal(DBChannelID_t ch) const;
78  float PedMean(DBChannelID_t ch) const override;
79  float PedRms(DBChannelID_t ch) const override;
80  float PedMeanErr(DBChannelID_t ch) const override;
81  float PedRmsErr(DBChannelID_t ch) const override;
82 
83  //hardcoded information about database folder - useful for debugging cross checks
84  static constexpr unsigned int NCOLUMNS = 5;
85  static constexpr const char* FIELD_NAMES[NCOLUMNS]
86  = {"channel", "mean", "mean_err", "rms", "rms_err"};
87  static constexpr const char* FIELD_TYPES[NCOLUMNS]
88  = {"unsigned int", "float", "float", "float", "float"};
89 
90  private:
91 
92  /// Do actual database updates.
93 
94  bool DBUpdate() const; // Uses current event time.
95  bool DBUpdate(DBTimeStamp_t ts) const;
96 
97  // Time stamps.
98 
99  DBTimeStamp_t fEventTimeStamp; // Most recently seen time stamp.
100  mutable DBTimeStamp_t fCurrentTimeStamp; // Time stamp of cached data.
101 
104  };
105 }//end namespace lariov
106 
107 #endif
108  /** @} */ // end of doxygen group
std::uint32_t DBChannelID_t
Class def header for a class Snapshot.
pdgs p
Definition: selectors.fcl:22
float PedMeanErr(DBChannelID_t ch) const override
std::uint64_t DBTimeStamp_t
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
Class def header for a class DetPedestal.
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.
float PedRmsErr(DBChannelID_t ch) const override
float PedMean(DBChannelID_t ch) const override
float PedRms(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.