BmnRoot
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
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) */
25 UniConnection* connectionDB;
26
28 int i_period_number;
30 int i_run_number;
32 int i_run_type;
34 TDatime ts_start_datetime;
36 TDatime* ts_end_datetime;
38 TString str_beam_particle;
40 TString str_target_particle;
42 double* d_energy;
44 double* d_field_voltage;
46 int* i_event_count;
48 int* i_geometry_id;
50 int i_run_quality;
51
52 // Constructor
53 UniRun(UniConnection* db_connect,
54 int period_number,
55 int run_number,
56 int run_type,
57 TDatime start_datetime,
58 TDatime* end_datetime,
59 TString beam_particle,
60 TString target_particle,
61 double* energy,
62 double* field_voltage,
63 int* event_count,
64 int* geometry_id,
65 int run_quality);
66 /* END OF PRIVATE GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
67
68 public:
69 /* GENERATED PUBLIC MEMBERS (SHOULD NOT BE CHANGED MANUALLY) */
70 virtual ~UniRun(); // Destructor
71
72 // static class functions
74 static UniRun* CreateRun(int period_number,
75 int run_number,
76 int run_type,
77 TDatime start_datetime,
78 TDatime* end_datetime,
79 TString beam_particle,
80 TString target_particle,
81 double* energy,
82 double* field_voltage,
83 int* event_count,
84 int* geometry_id,
85 int run_quality);
87 static UniRun* GetRun(int period_number, int run_number);
89 static int CheckRunExists(int period_number, int run_number);
91 static int DeleteRun(int period_number, int run_number);
93 static int PrintAll();
94
95 // Getters
97 int GetPeriodNumber() { return i_period_number; }
99 int GetRunNumber() { return i_run_number; }
101 int GetRunType() { return i_run_type; }
103 TDatime GetStartDatetime() { return ts_start_datetime; }
105 TDatime* GetEndDatetime()
106 {
107 if (ts_end_datetime == nullptr)
108 return nullptr;
109 else
110 return new TDatime(*ts_end_datetime);
111 }
113 TString GetBeamParticle() { return str_beam_particle; }
115 TString GetTargetParticle() { return str_target_particle; }
117 double* GetEnergy()
118 {
119 if (d_energy == nullptr)
120 return nullptr;
121 else
122 return new double(*d_energy);
123 }
126 {
127 if (d_field_voltage == nullptr)
128 return nullptr;
129 else
130 return new double(*d_field_voltage);
131 }
134 {
135 if (i_event_count == nullptr)
136 return nullptr;
137 else
138 return new int(*i_event_count);
139 }
142 {
143 if (i_geometry_id == nullptr)
144 return nullptr;
145 else
146 return new int(*i_geometry_id);
147 }
149 int GetRunQuality() { return i_run_quality; }
150
151 // Setters
153 int SetPeriodNumber(int period_number);
155 int SetRunNumber(int run_number);
157 int SetRunType(int run_type);
159 int SetStartDatetime(TDatime start_datetime);
161 int SetEndDatetime(TDatime* end_datetime);
163 int SetBeamParticle(TString beam_particle);
165 int SetTargetParticle(TString target_particle);
167 int SetEnergy(double* energy);
169 int SetFieldVoltage(double* field_voltage);
171 int SetEventCount(int* event_count);
173 int SetGeometryId(int* geometry_id);
175 int SetRunQuality(int run_quality);
176
178 void Print();
179 /* END OF PUBLIC GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
180
182 TObjArray* GetRawFiles();
183
194 static int GetRunNumbers(UniqueRunNumber*& run_numbers,
195 int start_period,
196 int start_run = 0,
197 int end_period = -1,
198 int end_run = -1);
202 static int GetRunNumbers(UniqueRunNumber*& run_numbers);
203
205 static int SetRootGeometry(int start_period,
206 int start_run,
207 int end_period,
208 int end_run,
209 unsigned char* root_geometry,
210 Long_t size_root_geometry);
212 static int GetRootGeometry(int period_number,
213 int run_number,
214 unsigned char*& root_geometry,
215 Long_t& size_root_geometry);
217 static int WriteGeometryFile(int start_period,
218 int start_run,
219 int end_period,
220 int end_run,
221 const char* geo_file_path);
224 static int ReadGeometryFile(int period_number,
225 int run_number,
226 char* geo_file_path,
227 bool usePrevGeometryIfMissing = false);
232 static int ReadPreviousGeometryFile(int& period_number, int& run_number, char* geo_file_path);
233
239 static double FindPreviousFieldVoltage(int& period_number, int& run_number);
240
242 static TObjArray* Search(UniSearchCondition& search_condition);
244 static TObjArray* Search(TObjArray& search_conditions);
245
249 static UniRun* GetRun(int& period_number, int& run_number, bool usePrevRunIfMissing);
252 static int FindPreviousRun(int& period_number, int& run_number);
253
255};
256
257#endif
double * GetEnergy()
get energy of the current run
Definition UniRun.h:117
void Print()
print information about current run
virtual ~UniRun()
int GetRunType()
get run type of the current run
Definition UniRun.h:101
static int ReadPreviousGeometryFile(int &period_number, int &run_number, char *geo_file_path)
static int ReadGeometryFile(int period_number, int run_number, char *geo_file_path, bool usePrevGeometryIfMissing=false)
int SetEndDatetime(TDatime *end_datetime)
set end datetime of the current run
int GetRunNumber()
get run number of the current run
Definition UniRun.h:99
static UniRun * GetRun(int &period_number, int &run_number, bool usePrevRunIfMissing)
int SetGeometryId(int *geometry_id)
set geometry id of the current run
int SetTargetParticle(TString target_particle)
set target particle of the current run
static int DeleteRun(int period_number, int run_number)
delete run from the database
TObjArray * GetRawFiles()
get array of raw files (UniRawFile*) corresponding to the run (return nullptr if an error occured)
int GetPeriodNumber()
get period number of the current run
Definition UniRun.h:97
TDatime * GetEndDatetime()
get end datetime of the current run
Definition UniRun.h:105
int SetRunType(int run_type)
set run type of the current run
TString GetBeamParticle()
get beam particle of the current run
Definition UniRun.h:113
static int SetRootGeometry(int start_period, int start_run, int end_period, int end_run, unsigned char *root_geometry, Long_t size_root_geometry)
set geometry binary data (geometry file's data) for runs from start_run_number to end_run_number
static int GetRunNumbers(UniqueRunNumber *&run_numbers, int start_period, int start_run=0, int end_period=-1, int end_run=-1)
TDatime GetStartDatetime()
get start datetime of the current run
Definition UniRun.h:103
int * GetGeometryId()
get geometry id of the current run
Definition UniRun.h:141
double * GetFieldVoltage()
get field voltage of the current run
Definition UniRun.h:125
int SetPeriodNumber(int period_number)
set period number of the current run
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 *geometry_id, int run_quality)
add new run to the database
int GetRunQuality()
get run quality of the current run
Definition UniRun.h:149
static int PrintAll()
print all runs
static UniRun * GetRun(int period_number, int run_number)
get run from the database
static int WriteGeometryFile(int start_period, int start_run, int end_period, int end_run, const char *geo_file_path)
write geometry file for runs from start_run_number to end_run_number to the database
static double FindPreviousFieldVoltage(int &period_number, int &run_number)
int * GetEventCount()
get event count of the current run
Definition UniRun.h:133
int SetEventCount(int *event_count)
set event count of the current run
static TObjArray * Search(TObjArray &search_conditions)
get runs corresponding to the specified (vector) conditions and set owner for search_condition to kTR...
int SetRunNumber(int run_number)
set run number of the current run
static int FindPreviousRun(int &period_number, int &run_number)
static int CheckRunExists(int period_number, int run_number)
check run exists in the database: 1- true, 0 - false, <0 - database operation error
static int GetRunNumbers(UniqueRunNumber *&run_numbers)
int SetFieldVoltage(double *field_voltage)
set field voltage of the current run
ClassDef(UniRun, 1)
int SetEnergy(double *energy)
set energy of the current run
static int GetRootGeometry(int period_number, int run_number, unsigned char *&root_geometry, Long_t &size_root_geometry)
get geometry binary data (geometry file's data) for selected run number
int SetRunQuality(int run_quality)
set run quality of the current run
int SetBeamParticle(TString beam_particle)
set beam particle of the current run
int SetStartDatetime(TDatime start_datetime)
set start datetime of the current run
TString GetTargetParticle()
get target particle of the current run
Definition UniRun.h:115
static TObjArray * Search(UniSearchCondition &search_condition)
get runs corresponding to the specified single condition and set owner for search_condition to kTRUE