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 
66 
67  /// Reconfigure function called by fhicl constructor
68  void Reconfigure(fhicl::ParameterSet const& p) override;
69 
70  /// Update event time stamp.
71  void UpdateTimeStamp(DBTimeStamp_t ts);
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::string string
Definition: nybbler.cc:12
std::uint32_t DBChannelID_t
Class def header for a class Snapshot.
std::uint64_t DBTimeStamp_t
Class def header for a class DetPedestal.
Retrieves channel information: pedestal and RMS.
p
Definition: test.py:223
Class def header for a class DatabaseRetrievalAlg.
Filters for channels, events, etc.
bool Update(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1056