1 |
mocchiut |
1.1 |
#ifndef gltables_h |
2 |
|
|
#define gltables_h |
3 |
|
|
|
4 |
|
|
#include <TString.h> |
5 |
|
|
#include <TObject.h> |
6 |
|
|
#include <TSQLServer.h> |
7 |
|
|
#include <TSQLRow.h> |
8 |
|
|
#include <TSQLResult.h> |
9 |
|
|
#include <GLTablesStruct.h> |
10 |
|
|
#include <EventHeader.h> |
11 |
|
|
#include <PscuHeader.h> |
12 |
|
|
#include <RunHeaderEvent.h> |
13 |
|
|
#include <RunTrailerEvent.h> |
14 |
mocchiut |
1.10 |
#include <sgp4.h> |
15 |
mocchiut |
1.1 |
|
16 |
|
|
using namespace pamela; |
17 |
|
|
// ================================================================== |
18 |
|
|
/** |
19 |
|
|
* \brief Class to store GL_RUN data |
20 |
|
|
*/ |
21 |
|
|
class GL_RUN : public TObject { |
22 |
|
|
private: |
23 |
|
|
|
24 |
|
|
public: |
25 |
|
|
// |
26 |
|
|
UInt_t ID; |
27 |
|
|
UInt_t ID_RUN_FRAG; |
28 |
|
|
UInt_t ID_ROOT_L0; |
29 |
|
|
UInt_t ID_ROOT_L2; |
30 |
|
|
UInt_t RUNHEADER_TIME; |
31 |
|
|
UInt_t RUNTRAILER_TIME; |
32 |
|
|
UInt_t RUNHEADER_OBT; |
33 |
|
|
UInt_t RUNTRAILER_OBT; |
34 |
|
|
UInt_t RUNHEADER_PKT; |
35 |
|
|
UInt_t RUNTRAILER_PKT; |
36 |
|
|
UInt_t BOOT_NUMBER; |
37 |
|
|
UInt_t EV_FROM; |
38 |
|
|
UInt_t EV_TO; |
39 |
|
|
UInt_t NEVENTS; |
40 |
|
|
UInt_t PKT_COUNTER; |
41 |
|
|
UInt_t PKT_READY_COUNTER; |
42 |
|
|
UInt_t COMPILATIONTIMESTAMP; |
43 |
|
|
UInt_t FAV_WRK_SCHEDULE; |
44 |
|
|
UInt_t EFF_WRK_SCHEDULE; |
45 |
|
|
UInt_t PRH_VAR_TRG_MODE_A; |
46 |
|
|
UInt_t PRH_VAR_TRG_MODE_B; |
47 |
|
|
UInt_t ACQ_BUILD_INFO; |
48 |
|
|
UInt_t ACQ_VAR_INFO; |
49 |
|
|
UInt_t RM_ACQ_AFTER_CALIB; |
50 |
|
|
UInt_t RM_ACQ_SETTING_MODE; |
51 |
|
|
UInt_t TRK_CALIB_USED; |
52 |
|
|
UInt_t CAL_DSP_MASK; |
53 |
|
|
UInt_t LAST_TIMESYNC; |
54 |
|
|
UInt_t OBT_TIMESYNC; |
55 |
|
|
UInt_t VALIDATION; |
56 |
|
|
// |
57 |
|
|
// |
58 |
|
|
// |
59 |
|
|
GL_RUN(); |
60 |
|
|
// |
61 |
|
|
// functions |
62 |
|
|
// |
63 |
|
|
Int_t Query_GL_RUN(UInt_t, TSQLServer*); |
64 |
|
|
Int_t Fill_GL_RUN(TSQLServer*); |
65 |
|
|
Int_t Query_GL_RUN_FRAGMENTS(TString, TSQLServer*); |
66 |
|
|
Int_t Fill_GL_RUN_FRAGMENTS(TSQLServer*); |
67 |
mocchiut |
1.11 |
Int_t DeleteRun(TSQLServer*, UInt_t, TString); |
68 |
|
|
Int_t RestoreRun(TSQLServer*, UInt_t, TString); |
69 |
mocchiut |
1.1 |
void Clear(); |
70 |
|
|
// |
71 |
|
|
// SETTERS |
72 |
|
|
// |
73 |
|
|
void Set_GL_RUNT(RunTrailerEvent *runt, PscuHeader *pht); |
74 |
|
|
void Set_GL_RUNH(RunHeaderEvent *runt, PscuHeader *pht); |
75 |
|
|
void Set_GL_RUNT0(); |
76 |
|
|
void Set_GL_RUNH0(); |
77 |
mocchiut |
1.9 |
// |
78 |
|
|
void Set_GL_RUN(TSQLRow *row); |
79 |
|
|
// |
80 |
mocchiut |
1.1 |
void SetRUNHEADER_TIME(UInt_t abst); |
81 |
|
|
void SetRUNTRAILER_TIME(UInt_t abst); |
82 |
|
|
void SetRUNHEADER_PKT(UInt_t abst); |
83 |
|
|
void SetRUNTRAILER_PKT(UInt_t abst); |
84 |
|
|
void SetRUNHEADER_OBT(UInt_t abst); |
85 |
|
|
void SetRUNTRAILER_OBT(UInt_t abst); |
86 |
|
|
void SetBOOTNUMBER(UInt_t abst); |
87 |
|
|
void SetID(UInt_t); |
88 |
|
|
void SetID_ROOT_L2(UInt_t L2); |
89 |
|
|
void SetID_ROOT_L0(UInt_t L0); |
90 |
|
|
void SetID_RUN_FRAG(UInt_t RUN); |
91 |
|
|
void SetVALIDATION(UInt_t valid); |
92 |
|
|
void SetEV_FROM(UInt_t evfrom); |
93 |
|
|
void SetEV_TO(UInt_t evto); |
94 |
|
|
void SetNEVENTS(UInt_t nev); |
95 |
|
|
void SetLAST_TIMESYNC(UInt_t ts); |
96 |
|
|
void SetOBT_TIMESYNC(UInt_t ts); |
97 |
|
|
void SetPKT_COUNTER(UInt_t); |
98 |
|
|
void SetPKT_READY_COUNTER(UInt_t); |
99 |
|
|
void SetCOMPILATIONTIMESTAMP(UInt_t); |
100 |
|
|
void SetFAV_WRK_SCHEDULE(UInt_t); |
101 |
|
|
void SetEFF_WRK_SCHEDULE(UInt_t); |
102 |
|
|
void SetPRH_VAR_TRG_MODE_A(UInt_t); |
103 |
|
|
void SetPRH_VAR_TRG_MODE_B(UInt_t); |
104 |
|
|
void SetACQ_BUILD_INFO(UInt_t); |
105 |
|
|
void SetACQ_VAR_INFO(UInt_t); |
106 |
|
|
void SetRM_ACQ_AFTER_CALIB(UInt_t); |
107 |
|
|
void SetRM_ACQ_SETTING_MODE(UInt_t); |
108 |
|
|
void SetTRK_CALIB_USED(UInt_t); |
109 |
|
|
void SetCAL_DSP_MASK(UInt_t); |
110 |
|
|
// |
111 |
|
|
// GETTERS |
112 |
|
|
// |
113 |
|
|
void GetLevel2Struct(cGLRun *l2) const; |
114 |
mocchiut |
1.9 |
UInt_t GetID(){return(ID);}; |
115 |
mocchiut |
1.1 |
UInt_t GetRUNHEADER_PKT(){return(RUNHEADER_PKT);}; |
116 |
|
|
UInt_t GetRUNTRAILER_PKT(){return(RUNTRAILER_PKT);}; |
117 |
|
|
UInt_t GetRUNHEADER_TIME(){return(RUNHEADER_TIME);}; |
118 |
|
|
UInt_t GetRUNTRAILER_TIME(){return(RUNTRAILER_TIME);}; |
119 |
|
|
UInt_t GetRUNHEADER_OBT(){return(RUNHEADER_OBT);}; |
120 |
|
|
UInt_t GetRUNTRAILER_OBT(){return(RUNTRAILER_OBT);}; |
121 |
|
|
UInt_t GetNEVENTS(){return(NEVENTS);}; |
122 |
mocchiut |
1.2 |
UInt_t GetBOOT_NUMBER(){return(BOOT_NUMBER);}; |
123 |
mocchiut |
1.1 |
UInt_t GetTRK_CALIB(){return(TRK_CALIB_USED);}; |
124 |
|
|
UInt_t GetPKT_COUNTER(){return(PKT_COUNTER);}; |
125 |
|
|
UInt_t GetLAST_TIMESYNC(){return(LAST_TIMESYNC);}; |
126 |
|
|
UInt_t GetOBT_TIMESYNC(){return(OBT_TIMESYNC);}; |
127 |
|
|
UInt_t GetPKT_READY_COUNTER(){return(PKT_READY_COUNTER);}; |
128 |
|
|
UInt_t GetCOMPILATIONTIMESTAMP(){return(COMPILATIONTIMESTAMP);}; |
129 |
|
|
UInt_t GetFAV_WRK_SCHEDULE(){return(FAV_WRK_SCHEDULE);}; |
130 |
|
|
UInt_t GetEFF_WRK_SCHEDULE(){return(EFF_WRK_SCHEDULE);}; |
131 |
|
|
UInt_t GetPRH_VAR_TRG_MODE_A(){return(PRH_VAR_TRG_MODE_A);}; |
132 |
|
|
UInt_t GetPRH_VAR_TRG_MODE_B(){return(PRH_VAR_TRG_MODE_B);}; |
133 |
|
|
UInt_t GetACQ_BUILD_INFO(){return(ACQ_BUILD_INFO);}; |
134 |
|
|
UInt_t GetACQ_VAR_INFO(){return(ACQ_VAR_INFO);}; |
135 |
|
|
UInt_t GetRM_ACQ_AFTER_CALIB(){return(RM_ACQ_AFTER_CALIB);}; |
136 |
|
|
UInt_t GetRM_ACQ_SETTING_MODE(){return(RM_ACQ_SETTING_MODE);}; |
137 |
|
|
UInt_t GetTRK_CALIB_USED(){return(TRK_CALIB_USED);}; |
138 |
|
|
UInt_t GetCAL_DSP_MASK(){return(CAL_DSP_MASK);}; |
139 |
|
|
|
140 |
|
|
// |
141 |
|
|
ClassDef(GL_RUN,1); |
142 |
|
|
}; |
143 |
|
|
|
144 |
|
|
// ================================================================== |
145 |
|
|
/** |
146 |
|
|
* \brief Class to store GL_ROOT |
147 |
|
|
*/ |
148 |
|
|
class GL_ROOT : public TObject{ |
149 |
|
|
private: |
150 |
|
|
|
151 |
|
|
public: |
152 |
|
|
// |
153 |
|
|
UInt_t ID; |
154 |
|
|
UInt_t ID_RAW; |
155 |
|
|
UInt_t ID_TIMESYNC; |
156 |
|
|
TString PATH; |
157 |
|
|
TString NAME; |
158 |
|
|
|
159 |
|
|
GL_ROOT(); |
160 |
|
|
|
161 |
|
|
Int_t Query_GL_ROOT(UInt_t id, TSQLServer *dbc); |
162 |
|
|
|
163 |
|
|
ClassDef(GL_ROOT,1); |
164 |
|
|
}; |
165 |
|
|
// ================================================================== |
166 |
|
|
/** |
167 |
|
|
* \brief Class to store GL_PARAM data |
168 |
|
|
*/ |
169 |
|
|
class GL_PARAM : public TObject{ |
170 |
|
|
private: |
171 |
|
|
|
172 |
|
|
public: |
173 |
|
|
// |
174 |
|
|
UInt_t ID; |
175 |
|
|
TString PATH; |
176 |
|
|
TString NAME; |
177 |
|
|
UInt_t FROM_TIME; |
178 |
|
|
UInt_t TO_TIME; |
179 |
|
|
UInt_t TYPE; |
180 |
|
|
TString DESCR; |
181 |
|
|
|
182 |
|
|
GL_PARAM(); |
183 |
|
|
|
184 |
|
|
Int_t Query_GL_PARAM(UInt_t time, UInt_t type, TSQLServer *dbc); |
185 |
|
|
|
186 |
|
|
ClassDef(GL_PARAM,1); |
187 |
|
|
}; |
188 |
|
|
// ================================================================== |
189 |
|
|
/** |
190 |
|
|
* \brief Class to store GL_TRK_CALIB data |
191 |
|
|
*/ |
192 |
|
|
class GL_TRK_CALIB : public TObject{ |
193 |
|
|
private: |
194 |
|
|
|
195 |
|
|
public: |
196 |
|
|
// |
197 |
|
|
UInt_t ID; |
198 |
|
|
UInt_t ID_ROOT_L0; |
199 |
|
|
UInt_t EV_ROOT_CALIBTRK1 ; |
200 |
|
|
UInt_t EV_ROOT_CALIBTRK2 ; |
201 |
|
|
UInt_t FROM_TIME; |
202 |
|
|
UInt_t TO_TIME; |
203 |
|
|
UInt_t OBT1; |
204 |
|
|
UInt_t OBT2; |
205 |
|
|
UInt_t PKT1; |
206 |
|
|
UInt_t PKT2; |
207 |
pam-fi |
1.6 |
UInt_t BOOT_NUMBER; |
208 |
|
|
UInt_t VALIDATION; |
209 |
mocchiut |
1.1 |
|
210 |
|
|
GL_TRK_CALIB(); |
211 |
|
|
|
212 |
|
|
Int_t Query_GL_TRK_CALIB(UInt_t time, TSQLServer *dbc); |
213 |
|
|
|
214 |
|
|
ClassDef(GL_TRK_CALIB,1); |
215 |
|
|
}; |
216 |
|
|
|
217 |
|
|
// ================================================================== |
218 |
|
|
/** |
219 |
|
|
* \brief Class to store GL_CALO_CALIB data |
220 |
|
|
*/ |
221 |
|
|
class GL_CALO_CALIB : public TObject{ |
222 |
|
|
private: |
223 |
|
|
|
224 |
|
|
public: |
225 |
|
|
// |
226 |
|
|
UInt_t ID; |
227 |
|
|
UInt_t ID_ROOT_L0; |
228 |
|
|
UInt_t EV_ROOT; |
229 |
|
|
UInt_t FROM_TIME; |
230 |
|
|
UInt_t TO_TIME; |
231 |
|
|
UInt_t SECTION; |
232 |
|
|
|
233 |
|
|
GL_CALO_CALIB(); |
234 |
|
|
|
235 |
mocchiut |
1.5 |
Int_t Query_GL_CALO_CALIB(UInt_t time, UInt_t &uptime, UInt_t section, TSQLServer *dbc); |
236 |
mocchiut |
1.1 |
|
237 |
|
|
ClassDef(GL_CALO_CALIB,1); |
238 |
|
|
}; |
239 |
|
|
// ================================================================== |
240 |
|
|
/** |
241 |
|
|
* \brief Class to store GL_S4_CALIB data |
242 |
|
|
*/ |
243 |
|
|
class GL_S4_CALIB : public TObject{ |
244 |
|
|
private: |
245 |
|
|
|
246 |
|
|
public: |
247 |
|
|
// |
248 |
|
|
UInt_t ID; |
249 |
|
|
UInt_t ID_ROOT_L0; |
250 |
|
|
UInt_t EV_ROOT; |
251 |
|
|
UInt_t FROM_TIME; |
252 |
|
|
UInt_t TO_TIME; |
253 |
|
|
Float_t PARAM_FIT0; |
254 |
|
|
Float_t PARAM_FIT1; |
255 |
|
|
|
256 |
|
|
GL_S4_CALIB(); |
257 |
|
|
|
258 |
|
|
Int_t Query_GL_S4_CALIB(UInt_t time, TSQLServer *dbc); |
259 |
|
|
|
260 |
|
|
ClassDef(GL_S4_CALIB,1); |
261 |
|
|
}; |
262 |
|
|
|
263 |
|
|
// ================================================================== |
264 |
|
|
/** |
265 |
|
|
* \brief Class to store TIMESYNC data |
266 |
|
|
*/ |
267 |
|
|
class GL_TIMESYNC : public TObject{ |
268 |
|
|
private: |
269 |
|
|
UInt_t obtfirst; |
270 |
|
|
UInt_t pktfirst; |
271 |
|
|
UInt_t toffset; |
272 |
|
|
// |
273 |
mocchiut |
1.12 |
// UInt_t ID; |
274 |
|
|
// UInt_t ID_RAW; |
275 |
mocchiut |
1.1 |
UInt_t OBT0; |
276 |
|
|
UInt_t TIMESYNC; |
277 |
|
|
UInt_t TYPE; |
278 |
mocchiut |
1.12 |
UInt_t T0; |
279 |
mocchiut |
1.1 |
|
280 |
|
|
public: |
281 |
|
|
// |
282 |
|
|
GL_TIMESYNC(); |
283 |
|
|
GL_TIMESYNC(UInt_t ID, TString TYPE, TSQLServer *dbc); |
284 |
|
|
// |
285 |
|
|
UInt_t DBabsTime(UInt_t OBT); |
286 |
mocchiut |
1.12 |
UInt_t ResursTime(UInt_t OBT); |
287 |
mocchiut |
1.1 |
// |
288 |
mocchiut |
1.13 |
Long64_t DBpkt(UInt_t PKT); |
289 |
|
|
Long64_t DBobt(UInt_t OBT); |
290 |
mocchiut |
1.1 |
// |
291 |
mocchiut |
1.7 |
TString ConvertTime(TString &tzone, UInt_t dbt); |
292 |
|
|
TString UnConvertTime(TString &tzone, UInt_t dbt); |
293 |
mocchiut |
1.12 |
// |
294 |
|
|
UInt_t GetTimesync() { return TIMESYNC; }; |
295 |
|
|
UInt_t GetObt0() { return OBT0; }; |
296 |
|
|
UInt_t GetT0() { return T0; }; |
297 |
|
|
UInt_t GetType() { return TYPE; }; |
298 |
|
|
// |
299 |
|
|
ClassDef(GL_TIMESYNC,2); |
300 |
mocchiut |
1.8 |
}; |
301 |
|
|
|
302 |
mocchiut |
1.14 |
|
303 |
|
|
/* |
304 |
|
|
* Class to query a TLE from the db. |
305 |
mocchiut |
1.8 |
* |
306 |
mocchiut |
1.14 |
* Two non default constructor are avaiable. It is the same to call |
307 |
|
|
* the Query method. |
308 |
|
|
* |
309 |
|
|
* The class looks for a TLE in the GL_TLE table using the connection |
310 |
|
|
* dbc. You need to pass an UTC date in SQL datetime format or in |
311 |
|
|
* unix time (UTC) and it will look for the tle with the nearest and |
312 |
|
|
* previous date. Then it initialize tle to a cTle object, |
313 |
|
|
* tleFromTime to the UTC unix time of the tle and tleToTime to the |
314 |
|
|
* UTC unix time of the next avaible tle. |
315 |
mocchiut |
1.8 |
*/ |
316 |
|
|
class GL_TLE : public TObject{ |
317 |
|
|
private: |
318 |
mocchiut |
1.14 |
Int_t DoQuery(TString query, TSQLServer *dbc); |
319 |
|
|
cTle* GiveTle(TSQLRow*); |
320 |
|
|
|
321 |
|
|
cTle *tle; // the requested tle |
322 |
|
|
UInt_t tleFromTime; // unix time (UTC) of the tle |
323 |
|
|
UInt_t tleToTime; // unix time (UTC) of the next tle |
324 |
mocchiut |
1.1 |
|
325 |
mocchiut |
1.8 |
public: |
326 |
mocchiut |
1.14 |
GL_TLE(){ |
327 |
|
|
tle = NULL; |
328 |
|
|
tleFromTime = 0; |
329 |
|
|
tleToTime = 0; |
330 |
|
|
}; |
331 |
|
|
|
332 |
|
|
GL_TLE(UInt_t unixtime, TSQLServer *dbc) { |
333 |
|
|
Query(unixtime, dbc); |
334 |
|
|
}; |
335 |
|
|
|
336 |
|
|
GL_TLE(TString date, TSQLServer *dbc) { |
337 |
|
|
Query(date, dbc); |
338 |
|
|
}; |
339 |
|
|
|
340 |
|
|
Int_t Query(UInt_t unixtime, TSQLServer *dbc); |
341 |
|
|
Int_t Query(TString date, TSQLServer *dbc); |
342 |
mocchiut |
1.8 |
|
343 |
mocchiut |
1.14 |
cTle* GetTle() const { return tle; } |
344 |
|
|
UInt_t GetFromTime() const { return tleFromTime; } |
345 |
|
|
UInt_t GetToTime() const { return tleToTime; } |
346 |
mocchiut |
1.8 |
|
347 |
|
|
ClassDef(GL_TLE,1); |
348 |
mocchiut |
1.1 |
}; |
349 |
|
|
|
350 |
|
|
#endif |
351 |
mocchiut |
1.8 |
|