runinfo.hh
Go to the documentation of this file.00001
00006 #ifndef RUNINFO_h
00007 #define RUNINFO_h
00008
00009
00010 #include "Rtypes.h"
00011 #ifndef __CINT__
00012 #include "ParameterList.hh"
00013 #endif
00014
00015
00016 #include <vector>
00017 #include <map>
00018 #include <string>
00019 #include <set>
00020 #include <sstream>
00021 #include <time.h>
00022
00023 class TMacro;
00024
00029 #ifndef __CINT__
00030 class runinfo : public ParameterList{
00031 #else
00032 class runinfo{
00033 #endif
00034 public:
00036 runinfo(long id=-1);
00038 virtual ~runinfo() {}
00040 void Init(bool reset=false);
00042 void InitializeParameterList();
00043
00045 void ResetRunStats();
00046
00048 int LoadSavedInfo(TMacro* mac);
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 long runid;
00062 time_t starttime;
00063 time_t endtime;
00064 long triggers;
00065 long events;
00066
00067
00068 public:
00069 typedef std::set<std::string> stringset;
00070 typedef std::vector<std::string> stringvec;
00071 typedef std::map<std::string, std::string> stringmap;
00072
00077 #ifndef __CINT__
00078 class DialogField : public ParameterList{
00079 public:
00080 DialogField(const std::string& field_="", const std::string& desc = "",
00081 bool required_=true, const std::string& default_="");
00082 virtual ~DialogField() {}
00083 bool IsValueValid(const std::string& val) const;
00084 std::string fieldname;
00085 std::string description;
00086 std::vector<std::string> allowed_values;
00087 bool required;
00088 std::string defaultvalue;
00089 };
00090
00091 typedef std::vector<DialogField> FieldList;
00092 #endif
00093
00094 private:
00095
00097 stringmap metadata;
00098
00099 #ifndef __CINT__
00100
00102 FieldList prerun_dialog_fields;
00104 FieldList postrun_dialog_fields;
00105 #endif
00106
00108 bool force_prerun_dialog;
00110 bool force_postrun_dialog;
00111
00113 std::map<int, stringmap > channel_metadata;
00114
00115
00116 public:
00117
00118 enum FILLTIME {RUNSTART, RUNEND};
00120 int FillDataForRun(FILLTIME when=RUNSTART);
00121
00123 std::string GetMetadata(const std::string& key)
00124 { stringmap::iterator it = metadata.find(key);
00125 return it == metadata.end() ? std::string("") : it->second ; }
00127 void SetMetadata(const std::string& key, const std::string& val)
00128 { metadata[key] = val; }
00129
00131 template<class T> void SetMetadata(const std::string& key, const T& val){
00132 std::stringstream s;
00133 s<<val;
00134 metadata[key] = s.str();
00135 }
00136
00137
00138 private:
00139 ClassDef(runinfo,1);
00140 };
00141
00142
00143 #endif