KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVDBRun.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * This program is free software; you can redistribute it and/or modify *
4  * it under the terms of the GNU General Public License as published by *
5  * the Free Software Foundation; either version 2 of the License, or *
6  * (at your option) any later version. *
7  * *
8  ***************************************************************************/
9 #ifndef KV_DB_RUN_H
10 #define KV_DB_RUN_H
11 
12 #include "KVDBRecord.h"
13 #include "KVDBSystem.h"
14 #include "KVTarget.h"
15 #include "KVString.h"
16 #include "TDatime.h"
17 #include "KVNameValueList.h"
18 #include <RQ_OBJECT.h>
19 
20 #define KV__GET_INT(__param) return (fParameters.HasIntParameter(__param) ? fParameters.GetIntValue(__param) : 0);
21 #define KV__GET_ULONG(__param) return (fParameters.HasValue64bit(__param) ? fParameters.GetValue64bit(__param) : 0);
22 #define KV__GET_DBL(__param) return (fParameters.HasDoubleParameter(__param) ? fParameters.GetDoubleValue(__param) : 0.);
23 #define KV__GET_STR(__param) return (fParameters.HasStringParameter(__param) ? fParameters.GetStringValue(__param) : "");
24 #define KV__SET_INT(__param,__val) fParameters.SetValue(__param,__val);
25 #define KV__SET_ULONG(__param,__val) fParameters.SetValue64bit(__param,__val);
26 #define KV__SET_DBL(__param,__val) fParameters.SetValue(__param,__val);
27 #define KV__SET_STR(__param,__val) fParameters.SetValue(__param,__val);
28 
35 class KVDBRun: public KVDBRecord {
36 
37  RQ_OBJECT("KVDBRun")
39 
40 protected:
41 
46 
47 public:
48 
49  void SetKVVersion(const Char_t* V)
50  {
51  fKVVersion = V;
52  };
53  const Char_t* GetKVVersion() const
54  {
55  return fKVVersion.Data();
56  };
57  void SetUserName(const Char_t* U)
58  {
59  fUserName = U;
60  };
61  const Char_t* GetUserName() const
62  {
63  return fUserName.Data();
64  };
65 
66  void Modified() // *SIGNAL*
67  {
69  if (!fBlockSignals) Emit("Modified()");
70  };
71  void BlockSignals(Bool_t yes = kTRUE)
72  {
75  fBlockSignals = yes;
76  };
77 
80  Bool_t Has(const Char_t* param, Bool_t check_whitespace = kTRUE) const
81  {
82  if (check_whitespace && fParameters.HasStringParameter(param)) {
83  return !(fParameters.GetTStringValue(param).IsWhitespace());
84  }
86  };
87 
88  KVDBRun();
89  KVDBRun(Int_t number, const Char_t* title);
90  virtual ~ KVDBRun();
91 
92  void SetNumber(Int_t n)
93  {
95  Modified();
96  }
97 
98  void SetTrigger(Int_t trig)
99  {
100  SetScaler("Trigger multiplicity", trig);
101  };
102 
104  {
105  return GetScaler("Trigger multiplicity");
106  };
107  const Char_t* GetTriggerString() const
108  {
109  if (GetTrigger() > 0) return Form("M>=%d", GetTrigger());
110  else return Form("xxx");
111  };
112 
113  const TDatime& GetDatime() const
114  {
115  return fDatime;
116  };
118  {
119  return fDatime.AsString();
120  };
121  void SetDatime(TDatime& dat)
122  {
123  dat.Copy(fDatime);
124  Modified();
125  };
126 
127  KVDBSystem* GetSystem() const;
128  const Char_t* GetSystemName() const
129  {
130  return (GetSystem() ? GetSystem()->GetName() : "");
131  };
132 
134  {
135  return GetScaler64("Events");
136  };
138  {
139  return Get("Length (min.)");
140  };
142  {
143  return Get("Size (MB)");
144  };
145 
146  const Char_t* GetComments() const
147  {
148  return GetString("Comments");
149  };
150  const Char_t* GetStartDate() const
151  {
152  return GetString("Start Date");
153  };
154  const Char_t* GetDate() const
155  {
156  return GetStartDate();
157  };
158  const Char_t* GetEndDate() const
159  {
160  return GetString("End Date");
161  };
162 
165  {
166  return (GetSystem() ? GetSystem()->GetTarget() : 0);
167  };
168 
169  void SetEvents(ULong64_t evt_number)
170  {
171  SetScaler64("Events", evt_number);
172  };
173  void SetTime(Double_t time)
174  {
175  Set("Length (min.)", time);
176  };
178  {
179  Set("Size (MB)", s);
180  };
181  void SetComments(const KVString& comments)
182  {
183  Set("Comments", comments);
184  };
185  void SetStartDate(const KVString& date)
186  {
187  Set("Start Date", date);
188  };
189  void SetDate(const KVString& d)
190  {
191  SetStartDate(d);
192  };
193  void SetEndDate(const KVString& d)
194  {
195  Set("End Date", d);
196  };
197 
198  virtual void SetSystem(KVDBSystem* system);
199  virtual void UnsetSystem();
200 
201  virtual void Print(Option_t* option = "") const;
202 
203  virtual void WriteRunListLine(std::ostream&, Char_t delim = '|') const;
204  virtual void ReadRunListLine(const KVString&);
205  virtual void WriteRunListHeader(std::ostream&, Char_t delim = '|') const;
206 
208  virtual void SetScaler(const Char_t* name, Int_t val)
209  {
210  KV__SET_INT(name, val)
211  Modified();
212  };
214  virtual Int_t GetScaler(const Char_t* name) const
215  {
216  KV__GET_INT(name)
217  };
219  virtual void SetScaler64(const Char_t* name, ULong64_t val)
220  {
221  KV__SET_ULONG(name, val)
222  Modified();
223  };
225  virtual ULong64_t GetScaler64(const Char_t* name) const
226  {
227  KV__GET_ULONG(name)
228  };
230  void Set(const Char_t* param, Double_t val)
231  {
232  KV__SET_DBL(param, val)
233  Modified();
234  };
236  Double_t Get(const Char_t* param) const
237  {
238  KV__GET_DBL(param)
239  };
241  void Set(const Char_t* param, const KVString& val)
242  {
243  KV__SET_STR(param, val)
244  Modified();
245  };
247  const Char_t* GetString(const Char_t* param) const
248  {
249  KV__GET_STR(param)
250  };
251 
252  ClassDef(KVDBRun, 10) //Base class for an experiment run
253 };
254 #endif
int Int_t
#define KV__SET_ULONG(__param, __val)
Definition: KVDBRun.h:25
#define KV__GET_DBL(__param)
Definition: KVDBRun.h:22
#define KV__GET_INT(__param)
Definition: KVDBRun.h:20
#define KV__SET_STR(__param, __val)
Definition: KVDBRun.h:27
#define KV__GET_ULONG(__param)
Definition: KVDBRun.h:21
#define KV__SET_INT(__param, __val)
Definition: KVDBRun.h:24
#define KV__SET_DBL(__param, __val)
Definition: KVDBRun.h:26
#define KV__GET_STR(__param)
Definition: KVDBRun.h:23
#define RQ_OBJECT(sender_class)
#define d(i)
char Char_t
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
char * Form(const char *fmt,...)
Record folder for the database.
Definition: KVDBRecord.h:42
virtual void SetNumber(Int_t n)
Definition: KVDBRecord.h:76
Description of an experimental run in database ,.
Definition: KVDBRun.h:35
void SetEvents(ULong64_t evt_number)
Definition: KVDBRun.h:169
virtual void SetSystem(KVDBSystem *system)
Set system for run. Any previous system is unassociated (run will be removed from system's list)
Definition: KVDBRun.cpp:256
TDatime fDatime
set dynamically with date&time of ROOT file corresponding to run
Definition: KVDBRun.h:43
void SetDatime(TDatime &dat)
Definition: KVDBRun.h:121
virtual void SetScaler64(const Char_t *name, ULong64_t val)
Set value for 64-bit scaler with the given name for this run.
Definition: KVDBRun.h:219
void SetTime(Double_t time)
Definition: KVDBRun.h:173
KVNameValueList fParameters
list of named parameters for run
Definition: KVDBRun.h:42
ULong64_t GetEvents() const
Definition: KVDBRun.h:133
void SetUserName(const Char_t *U)
Definition: KVDBRun.h:57
TString fKVVersion
set dynamically with KaliVeda version used to generate ROOT file corresponding to run
Definition: KVDBRun.h:44
void SetSize(Double_t s)
Definition: KVDBRun.h:177
virtual ULong64_t GetScaler64(const Char_t *name) const
Get value of 64-bit scaler with the given name for this run.
Definition: KVDBRun.h:225
void SetKVVersion(const Char_t *V)
Definition: KVDBRun.h:49
const Char_t * GetSystemName() const
Definition: KVDBRun.h:128
KVTarget * GetTarget() const
Return target used for this run (actually target of KVDBSystem associated to run)
Definition: KVDBRun.h:164
void SetComments(const KVString &comments)
Definition: KVDBRun.h:181
KVDBSystem * GetSystem() const
Definition: KVDBRun.cpp:242
virtual void WriteRunListLine(std::ostream &, Char_t delim='|') const
Definition: KVDBRun.cpp:96
const Char_t * GetEndDate() const
Definition: KVDBRun.h:158
const TDatime & GetDatime() const
Definition: KVDBRun.h:113
Bool_t Has(const Char_t *param, Bool_t check_whitespace=kTRUE) const
Definition: KVDBRun.h:80
void SetStartDate(const KVString &date)
Definition: KVDBRun.h:185
Bool_t fBlockSignals
Definition: KVDBRun.h:38
const Char_t * GetKVVersion() const
Definition: KVDBRun.h:53
void Set(const Char_t *param, Double_t val)
Set numerical (non-scaler) characteristic of run.
Definition: KVDBRun.h:230
virtual void Print(Option_t *option="") const
Definition: KVDBRun.cpp:69
void SetEndDate(const KVString &d)
Definition: KVDBRun.h:193
TString fUserName
set dynamically with name of user who generated ROOT file corresponding to run
Definition: KVDBRun.h:45
Double_t Get(const Char_t *param) const
Get numerical (non-scaler) characteristic of run.
Definition: KVDBRun.h:236
const Char_t * GetTriggerString() const
Definition: KVDBRun.h:107
Int_t GetTrigger() const
Definition: KVDBRun.h:103
Double_t GetSize() const
Definition: KVDBRun.h:141
void BlockSignals(Bool_t yes=kTRUE)
Definition: KVDBRun.h:71
const Char_t * GetStartDate() const
Definition: KVDBRun.h:150
void SetTrigger(Int_t trig)
Definition: KVDBRun.h:98
void SetDate(const KVString &d)
Definition: KVDBRun.h:189
virtual void ReadRunListLine(const KVString &)
Definition: KVDBRun.cpp:143
void Modified()
Definition: KVDBRun.h:66
void Set(const Char_t *param, const KVString &val)
Set characteristic of run.
Definition: KVDBRun.h:241
virtual void UnsetSystem()
Definition: KVDBRun.cpp:225
virtual Int_t GetScaler(const Char_t *name) const
Get value of scaler with the given name for this run.
Definition: KVDBRun.h:214
virtual ~ KVDBRun()
const Char_t * GetDate() const
Definition: KVDBRun.h:154
const Char_t * GetString(const Char_t *param) const
Get characteristic of run.
Definition: KVDBRun.h:247
KVDBRun()
default ctor
Definition: KVDBRun.cpp:33
const Char_t * GetComments() const
Definition: KVDBRun.h:146
const Char_t * GetDatimeString()
Definition: KVDBRun.h:117
Double_t GetTime() const
Definition: KVDBRun.h:137
virtual void SetScaler(const Char_t *name, Int_t val)
Set value for the scaler with the given name for this run.
Definition: KVDBRun.h:208
void SetNumber(Int_t n)
Definition: KVDBRun.h:92
virtual void WriteRunListHeader(std::ostream &, Char_t delim='|') const
Write the version flag.
Definition: KVDBRun.cpp:211
const Char_t * GetUserName() const
Definition: KVDBRun.h:61
Database class used to store information on different colliding systems studied during an experiment.
Definition: KVDBSystem.h:51
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Bool_t HasStringParameter(const Char_t *name) const
Bool_t HasIntParameter(const Char_t *name) const
Bool_t HasDoubleParameter(const Char_t *name) const
TString GetTStringValue(const Char_t *name) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
Calculation/correction of energy losses of particles through an experimental target.
Definition: KVTarget.h:126
void Copy(TDatime &datime) const
const char * AsString() const
virtual const char * GetName() const
const char * Data() const
Bool_t IsWhitespace() const
unsigned long long ULong64_t
const Int_t n
const long double s
Definition: KVUnits.h:94