Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:15

0001 #ifndef CDFRunInfo_hh_included
0002 #define CDFRunInfo_hh_included 1
0003 
0004 #include <map>
0005 #include <string>
0006 #include <TFile.h>
0007 
0008 /** \brief Per-run or per-file information
0009 
0010     This class allows access to per-run or per-file information as opposed
0011     to per-event information such as CDFEventInfo.  The information is
0012     stored in the form of string -> string pairs.  There are utility
0013     methods for decoding string values as integers and doubles.
0014 */
0015 class CDFRunInfo {
0016 public:
0017   CDFRunInfo();
0018   CDFRunInfo(TFile* fromFile);
0019 
0020   /// Get some run info by name
0021   const char* get(const char* key) const;
0022   /// Get a run info item by name and convert it to an integer
0023   int getInt(const char* key) const;
0024   /// Get a run info item by name and convert it to a double
0025   double getDouble(const char* key) const;
0026   /// get the number of items
0027   inline int getSize() const { return m_mapData.size(); }
0028   /// fill the given array with key name pointers
0029   int getKeys(const char** buffer, int nbufs);
0030   /// test for thr presence of given key
0031   bool hasKey(const char* key) const;
0032 
0033   /// add some information to the run info
0034   void setInfo(const char* key, const char* value);
0035   /// print all information to the terminal
0036   void print() const;
0037 
0038   void store(TFile* toFile);
0039 
0040 private:
0041   bool load(TFile* fromFile);
0042   static const char* RootVariableName;
0043   std::map<std::string, std::string> m_mapData;
0044 };
0045 
0046 #endif  // CDFRunInfo_hh_included