HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoRunConfig.h
Go to the documentation of this file.
1 #ifndef HARPORUNCONFIG_H
2 #define HARPORUNCONFIG_H
3 
5 //
6 // HarpoRunConfig
7 //
8 // Get Run Configuration info by run number
9 //
10 
11 #include "TObject.h"
12 #include "TObjString.h"
13 #include "TString.h"
14 #include "map"
15 
16 class dbField : public TObject{
17 public:
18  TString fval;
19  TString ftype;
20  ClassDef(dbField,1)
21 
22 };
23 
24 typedef std::map<TString,dbField> dbFields;
25 
26 class HarpoRunConfig : public TObject {
27 
28  public:
29 
30  HarpoRunConfig() : run(0), rec_found(false) {}
31 
32  virtual ~HarpoRunConfig() {}
33 
40  Bool_t GetRunConfig(Long_t nrun, const TString *dbUrl=NULL);
41 
44  Bool_t UpdateRunConfig();
45 
47  void print();
48 
50  void list();
51 
53  Bool_t Lookup(const TString field);
55  Bool_t Lookup(const char * field);
56 
58  Bool_t GetVal(const TString field, TString &val);
60  Bool_t GetVal(const char * field, TString &val);
61 
63  Bool_t GetType(const TString field, TString &type);
65  Bool_t GetType(const char * field, TString &type);
66 
68  Long_t GetNrun() { return run; }
69 
70 
71  private:
72 
73  Long_t run;
74  Bool_t rec_found;
75 
77 
78  /*
80  enum FTYPE { INT, FLOAT, STRING, DATE };
81 
83  struct dbField { const char * name; FTYPE type; void * ptr;};
84 
86  struct dbField const dbFields[] = {
87  { "run", INT, &run },
88  { "electron energy", FLOAT, &electron_energy },
89  { "date", DATE, &date },
90  { "nevt", INT, &nevt },
91  { "TPCPosition", STRING, &TPCPosition },
92  { "Trigger", STRING, &Trigger },
93  { "Beam", STRING, &Beam },
94  { "energy", FLOAT, &energy },
95  { "polarisation", INT, &polarisation },
96  { "Pressure", FLOAT, &Pressure },
97  { "Temperature", FLOAT, &Temperature },
98  { "VmicroMegas", FLOAT, &VmicroMegas },
99  { "Vgembb", FLOAT, &Vgembb },
100  { "Vgembt", FLOAT, &Vgembt },
101  { "Vgemtb", FLOAT, &Vgemtb },
102  { "Vgemtt", FLOAT, &Vgemtt },
103  { "Vring", FLOAT, &Vring },
104  { "Vdrift", FLOAT, &Vdrift },
105  { "nSamplingF", INT, &nSamplingF },
106  { "Delay", FLOAT, &Delay },
107  { "PeakingTime", FLOAT, &PeakingTime },
108  { "GainAFTER", FLOAT, &GainAFTER },
109  { "Goal", STRING, &Goal },
110  { "Result", STRING, &Result },
111  { "Comment", STRING, &Comment },
112  { "angle", INT, &angle },
113  };
114  */
115 
116  ClassDef(HarpoRunConfig,1)
117 };
118 
119 #endif
120 // Local Variables:
121 // mode: c++
122 // End:
void list()
list all filds found which his types
Bool_t GetRunConfig(Long_t nrun, const TString *dbUrl=NULL)
Query Db for given run Only this function in class interact wich DataBase. Must be called in HarpoRaw...
Get Run Configuration info by run number. The class query MySQL databe use GetRunConfig Method Only t...
TString ftype
void print()
Print values of all founded fields.
static int type
Bool_t Lookup(const TString field)
Lookup filed exist.
Bool_t GetVal(const TString field, TString &val)
Return value of existing field in Tstring.
Bool_t GetType(const TString field, TString &type)
Return Type of field in Tstring.
Bool_t UpdateRunConfig()
TString fval
Long_t GetNrun()
Get method for run number of this record.
std::map< TString, TString > dbFields
Definition: HarpoDB.h:16
virtual ~HarpoRunConfig()
std::map< TString, dbField > dbFields