BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
UniRun.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------
2// UniRun header file
3// Generated 05-11-2015
4// ----------------------------------------------------------------------
5
6/** UniRun.h
7 ** Class for the table: run_
8 **/
9
10#ifndef UniRun_H
11#define UniRun_H 1
12
13#include "TDatime.h"
14#include "TObjArray.h"
15#include "TString.h"
16#include "UniConnection.h"
17#include "UniSearchCondition.h"
18#include "uni_db_structures.h"
19
20class UniRun
21{
22 private:
23 /* GENERATED PRIVATE MEMBERS (SHOULD NOT BE CHANGED MANUALLY) */
24 /// connection to the database
26
27 /// period number
29 /// run number
31 /// run type
33 /// start datetime
35 /// end datetime
37 /// beam particle
39 /// target particle
41 /// energy
42 double* d_energy;
43 /// field voltage
45 /// event count
47 /// run quality
49
50 // Constructor
51 UniRun(UniConnection* db_connect,
52 int period_number,
53 int run_number,
54 int run_type,
55 TDatime start_datetime,
56 TDatime* end_datetime,
57 TString beam_particle,
58 TString target_particle,
59 double* energy,
60 double* field_voltage,
61 int* event_count,
62 int run_quality);
63 /* END OF PRIVATE GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
64
65 public:
66 /* GENERATED PUBLIC MEMBERS (SHOULD NOT BE CHANGED MANUALLY) */
67 virtual ~UniRun(); // Destructor
68
69 // static class functions
70 /// add new run to the database
71 static UniRun* CreateRun(int period_number,
72 int run_number,
73 int run_type,
74 TDatime start_datetime,
75 TDatime* end_datetime,
76 TString beam_particle,
77 TString target_particle,
78 double* energy,
79 double* field_voltage,
80 int* event_count,
81 int run_quality);
82 /// get run from the database
83 static UniRun* GetRun(int period_number, int run_number);
84 /// check run exists in the database: 1- true, 0 - false, <0 - database operation error
85 static int CheckRunExists(int period_number, int run_number);
86 /// delete run from the database
87 static int DeleteRun(int period_number, int run_number);
88 /// print all runs
89 static int PrintAll();
90
91 // Getters
92 /// get period number of the current run
94 /// get run number of the current run
95 int GetRunNumber() { return i_run_number; }
96 /// get run type of the current run
97 int GetRunType() { return i_run_type; }
98 /// get start datetime of the current run
100 /// get end datetime of the current run
102 {
103 if (ts_end_datetime == nullptr)
104 return nullptr;
105 else
106 return new TDatime(*ts_end_datetime);
107 }
108 /// get beam particle of the current run
110 /// get target particle of the current run
112 /// get energy of the current run
113 double* GetEnergy()
114 {
115 if (d_energy == nullptr)
116 return nullptr;
117 else
118 return new double(*d_energy);
119 }
120 /// get field voltage of the current run
122 {
123 if (d_field_voltage == nullptr)
124 return nullptr;
125 else
126 return new double(*d_field_voltage);
127 }
128 /// get event count of the current run
130 {
131 if (i_event_count == nullptr)
132 return nullptr;
133 else
134 return new int(*i_event_count);
135 }
136 /// get run quality of the current run
137 int GetRunQuality() { return i_run_quality; }
138
139 // Setters
140 /// set period number of the current run
141 int SetPeriodNumber(int period_number);
142 /// set run number of the current run
143 int SetRunNumber(int run_number);
144 /// set run type of the current run
145 int SetRunType(int run_type);
146 /// set start datetime of the current run
147 int SetStartDatetime(TDatime start_datetime);
148 /// set end datetime of the current run
149 int SetEndDatetime(TDatime* end_datetime);
150 /// set beam particle of the current run
151 int SetBeamParticle(TString beam_particle);
152 /// set target particle of the current run
153 int SetTargetParticle(TString target_particle);
154 /// set energy of the current run
155 int SetEnergy(double* energy);
156 /// set field voltage of the current run
157 int SetFieldVoltage(double* field_voltage);
158 /// set event count of the current run
159 int SetEventCount(int* event_count);
160 /// set run quality of the current run
161 int SetRunQuality(int run_quality);
162
163 /// print information about current run
164 void Print();
165 /* END OF PUBLIC GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
166
167 /// get array of raw files (UniRawFile*) corresponding to the run (return nullptr if an error occured)
169
170 /// get numbers of runs stored in the Database for a selected range
171 /// \param[in] start_period start period number for selected run numbers' range
172 /// \param[in] start_run start run number for selected run numbers' range (default, 0 means "from the first run of
173 /// the start period")
174 /// \param[in] end_period end period number for selected run numbers' range (default, -1 means "end_period =
175 /// start_period")
176 /// \param[in] end_run end run number for selected run numbers' range (default, -1 means "up to the last run of the
177 /// end period")
178 /// \param[out] run_numbers pairs (period number+run numbers) of existing runs for a selected range (from start to
179 /// end)
180 /// \return size of 'run_numbers' array. if size < 0, return value corresponds to error number
181 static int GetRunNumbers(UniqueRunNumber*& run_numbers,
182 int start_period,
183 int start_run = 0,
184 int end_period = -1,
185 int end_run = -1);
186 /// get all numbers of stored runs in the Database
187 /// \param[out] run_numbers pairs (period number+run numbers) of all runs
188 /// \return size of 'run_numbers' array. if size < 0, return value corresponds to error number
189 static int GetRunNumbers(UniqueRunNumber*& run_numbers);
190
191 /// get field voltage value
192 /// if period_number > 0 and run_number > 0: from the closest previous run, below (period:run)
193 /// in another case: for the latest run in the database
194 /// ATTENTION: changes the input period and run numbers to the correspoding ones of the previous run with the field
195 /// voltage
196 static double FindPreviousFieldVoltage(int& period_number, int& run_number);
197
198 /// get runs corresponding to the specified single condition and set owner for search_condition to kTRUE
199 static TObjArray* Search(UniSearchCondition& search_condition);
200 /// get runs corresponding to the specified (vector) conditions and set owner for search_condition to kTRUE
201 static TObjArray* Search(TObjArray& search_conditions);
202
203 /// get run from the database with the given period and run numbers
204 /// if usePrevRunIfMissing is true then find and get the previous (existing) run in case the given run is absent
205 /// ATTENTION: changes the input period and run numbers to ones of the found run (if usePrevRunIfMissing is true)
206 static UniRun* GetRun(int& period_number, int& run_number, bool usePrevRunIfMissing);
207 /// get number of the closest run below the given one
208 /// or return the latest run in the database if period_number < 1 or run_number < 1
209 static int FindPreviousRun(int& period_number, int& run_number);
210
211 ClassDef(UniRun, 1);
212};
213
214#endif
#define ClassDef(name, id)
UniRun.h Class for the table: run_.
Definition UniRun.h:21
double * GetEnergy()
get energy of the current run
Definition UniRun.h:113
static int PrintAll()
print all runs
Definition UniRun.cxx:312
void Print()
print information about current run
Definition UniRun.cxx:781
int GetRunType()
get run type of the current run
Definition UniRun.h:97
int i_run_number
run number
Definition UniRun.h:30
static UniRun * GetRun(int period_number, int run_number)
get run from the database
Definition UniRun.cxx:161
int SetEndDatetime(TDatime *end_datetime)
set end datetime of the current run
Definition UniRun.cxx:517
int GetRunNumber()
get run number of the current run
Definition UniRun.h:95
static TObjArray * Search(UniSearchCondition &search_condition)
get runs corresponding to the specified single condition and set owner for search_condition to kTRUE
Definition UniRun.cxx:1155
double * d_energy
energy
Definition UniRun.h:42
int SetTargetParticle(TString target_particle)
set target particle of the current run
Definition UniRun.cxx:591
TObjArray * GetRawFiles()
get array of raw files (UniRawFile*) corresponding to the run (return nullptr if an error occured)
Definition UniRun.cxx:798
int GetPeriodNumber()
get period number of the current run
Definition UniRun.h:93
TString str_target_particle
target particle
Definition UniRun.h:40
TDatime * GetEndDatetime()
get end datetime of the current run
Definition UniRun.h:101
TDatime ts_start_datetime
start datetime
Definition UniRun.h:34
int SetRunType(int run_type)
set run type of the current run
Definition UniRun.cxx:451
TString GetBeamParticle()
get beam particle of the current run
Definition UniRun.h:109
static int DeleteRun(int period_number, int run_number)
delete run from the database
Definition UniRun.cxx:281
TDatime GetStartDatetime()
get start datetime of the current run
Definition UniRun.h:99
double * d_field_voltage
field voltage
Definition UniRun.h:44
double * GetFieldVoltage()
get field voltage of the current run
Definition UniRun.h:121
static int GetRunNumbers(UniqueRunNumber *&run_numbers, int start_period, int start_run=0, int end_period=-1, int end_run=-1)
get numbers of runs stored in the Database for a selected range
Definition UniRun.cxx:804
int SetPeriodNumber(int period_number)
set period number of the current run
Definition UniRun.cxx:385
int i_run_quality
run quality
Definition UniRun.h:48
TDatime * ts_end_datetime
end datetime
Definition UniRun.h:36
int i_run_type
run type
Definition UniRun.h:32
int GetRunQuality()
get run quality of the current run
Definition UniRun.h:137
UniRun(UniConnection *db_connect, int period_number, int run_number, int run_type, TDatime start_datetime, TDatime *end_datetime, TString beam_particle, TString target_particle, double *energy, double *field_voltage, int *event_count, int run_quality)
Definition UniRun.cxx:18
int * GetEventCount()
get event count of the current run
Definition UniRun.h:129
static UniRun * CreateRun(int period_number, int run_number, int run_type, TDatime start_datetime, TDatime *end_datetime, TString beam_particle, TString target_particle, double *energy, double *field_voltage, int *event_count, int run_quality)
add new run to the database
Definition UniRun.cxx:62
int SetEventCount(int *event_count)
set event count of the current run
Definition UniRun.cxx:706
int SetRunNumber(int run_number)
set run number of the current run
Definition UniRun.cxx:418
static double FindPreviousFieldVoltage(int &period_number, int &run_number)
get field voltage value if period_number > 0 and run_number > 0: from the closest previous run,...
Definition UniRun.cxx:908
static int FindPreviousRun(int &period_number, int &run_number)
get number of the closest run below the given one or return the latest run in the database if period_...
Definition UniRun.cxx:1187
int * i_event_count
event count
Definition UniRun.h:46
int SetFieldVoltage(double *field_voltage)
set field voltage of the current run
Definition UniRun.cxx:665
int i_period_number
period number
Definition UniRun.h:28
int SetEnergy(double *energy)
set energy of the current run
Definition UniRun.cxx:624
int SetRunQuality(int run_quality)
set run quality of the current run
Definition UniRun.cxx:747
TString str_beam_particle
beam particle
Definition UniRun.h:38
virtual ~UniRun()
Definition UniRun.cxx:47
UniConnection * connectionDB
connection to the database
Definition UniRun.h:25
int SetBeamParticle(TString beam_particle)
set beam particle of the current run
Definition UniRun.cxx:558
int SetStartDatetime(TDatime start_datetime)
set start datetime of the current run
Definition UniRun.cxx:484
static int CheckRunExists(int period_number, int run_number)
check run exists in the database: 1- true, 0 - false, <0 - database operation error
Definition UniRun.cxx:241
TString GetTargetParticle()
get target particle of the current run
Definition UniRun.h:111