6 |
#include <TSQLServer.h> |
#include <TSQLServer.h> |
7 |
#include <TSQLRow.h> |
#include <TSQLRow.h> |
8 |
#include <TSQLResult.h> |
#include <TSQLResult.h> |
9 |
|
#include <TSystem.h> |
10 |
#include <GLTablesStruct.h> |
#include <GLTablesStruct.h> |
11 |
#include <EventHeader.h> |
#include <EventHeader.h> |
12 |
#include <PscuHeader.h> |
#include <PscuHeader.h> |
13 |
#include <RunHeaderEvent.h> |
#include <RunHeaderEvent.h> |
14 |
#include <RunTrailerEvent.h> |
#include <RunTrailerEvent.h> |
15 |
|
#include <sgp4.h> |
16 |
|
// |
17 |
|
|
18 |
using namespace pamela; |
using namespace pamela; |
19 |
|
// |
20 |
|
|
21 |
|
static const TString *fHost; |
22 |
|
static const TString *fUser; |
23 |
|
static const TString *fPsw; |
24 |
|
static UInt_t fNquery; |
25 |
|
static Bool_t fSet; |
26 |
|
|
27 |
// ================================================================== |
// ================================================================== |
28 |
/** |
/** |
29 |
* \brief Class to store GL_RUN data |
* \brief Class to store GL_RUN data |
30 |
*/ |
*/ |
31 |
class GL_RUN : public TObject { |
class GL_TABLES : public TObject { |
32 |
|
private: |
33 |
|
|
34 |
|
public: |
35 |
|
// |
36 |
|
GL_TABLES(); |
37 |
|
GL_TABLES(TString, TString, TString); |
38 |
|
// |
39 |
|
void Set(TString, TString, TString); |
40 |
|
// |
41 |
|
Bool_t IsConnected(TSQLServer *); |
42 |
|
// |
43 |
|
void ResetCounters(); |
44 |
|
void AddQ(); |
45 |
|
// |
46 |
|
const TString* GetHost(){return(fHost);}; |
47 |
|
const TString* GetUser(){return(fUser);}; |
48 |
|
const TString* GetPsw(){return(fPsw);}; |
49 |
|
UInt_t GetfNquery(){return(fNquery);}; |
50 |
|
UInt_t GetNqueries(); |
51 |
|
Bool_t IsSet(){return(fSet);}; |
52 |
|
// |
53 |
|
GL_TABLES *GetGLTABLES(){return this;}; |
54 |
|
// |
55 |
|
ClassDef(GL_TABLES,1); |
56 |
|
}; |
57 |
|
|
58 |
|
// ================================================================== |
59 |
|
/** |
60 |
|
* \brief Class to store GL_RUN data |
61 |
|
*/ |
62 |
|
//class GL_RUN : public TObject { |
63 |
|
class GL_RUN : public GL_TABLES { |
64 |
private: |
private: |
65 |
|
|
66 |
public: |
public: |
106 |
Int_t Fill_GL_RUN(TSQLServer*); |
Int_t Fill_GL_RUN(TSQLServer*); |
107 |
Int_t Query_GL_RUN_FRAGMENTS(TString, TSQLServer*); |
Int_t Query_GL_RUN_FRAGMENTS(TString, TSQLServer*); |
108 |
Int_t Fill_GL_RUN_FRAGMENTS(TSQLServer*); |
Int_t Fill_GL_RUN_FRAGMENTS(TSQLServer*); |
109 |
|
Int_t DeleteRun(TSQLServer*, UInt_t, TString); |
110 |
|
Int_t RestoreRun(TSQLServer*, UInt_t, TString); |
111 |
void Clear(); |
void Clear(); |
112 |
// |
// |
113 |
// SETTERS |
// SETTERS |
116 |
void Set_GL_RUNH(RunHeaderEvent *runt, PscuHeader *pht); |
void Set_GL_RUNH(RunHeaderEvent *runt, PscuHeader *pht); |
117 |
void Set_GL_RUNT0(); |
void Set_GL_RUNT0(); |
118 |
void Set_GL_RUNH0(); |
void Set_GL_RUNH0(); |
119 |
|
// |
120 |
|
void Set_GL_RUN(TSQLRow *row); |
121 |
|
// |
122 |
void SetRUNHEADER_TIME(UInt_t abst); |
void SetRUNHEADER_TIME(UInt_t abst); |
123 |
void SetRUNTRAILER_TIME(UInt_t abst); |
void SetRUNTRAILER_TIME(UInt_t abst); |
124 |
void SetRUNHEADER_PKT(UInt_t abst); |
void SetRUNHEADER_PKT(UInt_t abst); |
153 |
// GETTERS |
// GETTERS |
154 |
// |
// |
155 |
void GetLevel2Struct(cGLRun *l2) const; |
void GetLevel2Struct(cGLRun *l2) const; |
156 |
|
UInt_t GetID(){return(ID);}; |
157 |
UInt_t GetRUNHEADER_PKT(){return(RUNHEADER_PKT);}; |
UInt_t GetRUNHEADER_PKT(){return(RUNHEADER_PKT);}; |
158 |
UInt_t GetRUNTRAILER_PKT(){return(RUNTRAILER_PKT);}; |
UInt_t GetRUNTRAILER_PKT(){return(RUNTRAILER_PKT);}; |
159 |
UInt_t GetRUNHEADER_TIME(){return(RUNHEADER_TIME);}; |
UInt_t GetRUNHEADER_TIME(){return(RUNHEADER_TIME);}; |
161 |
UInt_t GetRUNHEADER_OBT(){return(RUNHEADER_OBT);}; |
UInt_t GetRUNHEADER_OBT(){return(RUNHEADER_OBT);}; |
162 |
UInt_t GetRUNTRAILER_OBT(){return(RUNTRAILER_OBT);}; |
UInt_t GetRUNTRAILER_OBT(){return(RUNTRAILER_OBT);}; |
163 |
UInt_t GetNEVENTS(){return(NEVENTS);}; |
UInt_t GetNEVENTS(){return(NEVENTS);}; |
164 |
|
UInt_t GetBOOT_NUMBER(){return(BOOT_NUMBER);}; |
165 |
UInt_t GetTRK_CALIB(){return(TRK_CALIB_USED);}; |
UInt_t GetTRK_CALIB(){return(TRK_CALIB_USED);}; |
166 |
UInt_t GetPKT_COUNTER(){return(PKT_COUNTER);}; |
UInt_t GetPKT_COUNTER(){return(PKT_COUNTER);}; |
167 |
UInt_t GetLAST_TIMESYNC(){return(LAST_TIMESYNC);}; |
UInt_t GetLAST_TIMESYNC(){return(LAST_TIMESYNC);}; |
187 |
/** |
/** |
188 |
* \brief Class to store GL_ROOT |
* \brief Class to store GL_ROOT |
189 |
*/ |
*/ |
190 |
class GL_ROOT : public TObject{ |
class GL_ROOT : public GL_TABLES { |
191 |
|
//class GL_ROOT : public TObject{ |
192 |
private: |
private: |
193 |
|
|
194 |
public: |
public: |
209 |
/** |
/** |
210 |
* \brief Class to store GL_PARAM data |
* \brief Class to store GL_PARAM data |
211 |
*/ |
*/ |
212 |
class GL_PARAM : public TObject{ |
class GL_PARAM : public GL_TABLES { |
213 |
|
//class GL_PARAM : public TObject{ |
214 |
private: |
private: |
215 |
|
|
216 |
public: |
public: |
233 |
/** |
/** |
234 |
* \brief Class to store GL_TRK_CALIB data |
* \brief Class to store GL_TRK_CALIB data |
235 |
*/ |
*/ |
236 |
class GL_TRK_CALIB : public TObject{ |
//class GL_TRK_CALIB : public TObject{ |
237 |
|
class GL_TRK_CALIB : public GL_TABLES { |
238 |
private: |
private: |
239 |
|
|
240 |
public: |
public: |
249 |
UInt_t OBT2; |
UInt_t OBT2; |
250 |
UInt_t PKT1; |
UInt_t PKT1; |
251 |
UInt_t PKT2; |
UInt_t PKT2; |
252 |
|
UInt_t BOOT_NUMBER; |
253 |
|
UInt_t VALIDATION; |
254 |
|
|
255 |
GL_TRK_CALIB(); |
GL_TRK_CALIB(); |
256 |
|
|
263 |
/** |
/** |
264 |
* \brief Class to store GL_CALO_CALIB data |
* \brief Class to store GL_CALO_CALIB data |
265 |
*/ |
*/ |
266 |
class GL_CALO_CALIB : public TObject{ |
class GL_CALO_CALIB : public GL_TABLES { |
267 |
|
//class GL_CALO_CALIB : public TObject{ |
268 |
private: |
private: |
269 |
|
|
270 |
public: |
public: |
278 |
|
|
279 |
GL_CALO_CALIB(); |
GL_CALO_CALIB(); |
280 |
|
|
281 |
Int_t Query_GL_CALO_CALIB(UInt_t time, UInt_t section, TSQLServer *dbc); |
Int_t Query_GL_CALO_CALIB(UInt_t time, UInt_t &uptime, UInt_t section, TSQLServer *dbc); |
282 |
|
|
283 |
ClassDef(GL_CALO_CALIB,1); |
ClassDef(GL_CALO_CALIB,1); |
284 |
}; |
}; |
286 |
/** |
/** |
287 |
* \brief Class to store GL_S4_CALIB data |
* \brief Class to store GL_S4_CALIB data |
288 |
*/ |
*/ |
289 |
class GL_S4_CALIB : public TObject{ |
class GL_S4_CALIB : public GL_TABLES { |
290 |
|
//class GL_S4_CALIB : public TObject{ |
291 |
private: |
private: |
292 |
|
|
293 |
public: |
public: |
311 |
/** |
/** |
312 |
* \brief Class to store TIMESYNC data |
* \brief Class to store TIMESYNC data |
313 |
*/ |
*/ |
314 |
class GL_TIMESYNC : public TObject{ |
class GL_TIMESYNC : public GL_TABLES { |
315 |
|
//class GL_TIMESYNC : public TObject{ |
316 |
private: |
private: |
317 |
UInt_t obtfirst; |
UInt_t obtfirst; |
318 |
UInt_t pktfirst; |
UInt_t pktfirst; |
319 |
UInt_t toffset; |
UInt_t toffset; |
320 |
// |
// |
321 |
UInt_t ID; |
// UInt_t ID; |
322 |
UInt_t ID_RAW; |
// UInt_t ID_RAW; |
323 |
UInt_t OBT0; |
UInt_t OBT0; |
324 |
UInt_t TIMESYNC; |
UInt_t TIMESYNC; |
325 |
UInt_t TYPE; |
UInt_t TYPE; |
326 |
|
UInt_t T0; |
327 |
|
|
328 |
public: |
public: |
329 |
// |
// |
331 |
GL_TIMESYNC(UInt_t ID, TString TYPE, TSQLServer *dbc); |
GL_TIMESYNC(UInt_t ID, TString TYPE, TSQLServer *dbc); |
332 |
// |
// |
333 |
UInt_t DBabsTime(UInt_t OBT); |
UInt_t DBabsTime(UInt_t OBT); |
334 |
|
UInt_t ResursTime(UInt_t OBT); |
335 |
|
// |
336 |
|
Long64_t DBpkt(UInt_t PKT); |
337 |
|
Long64_t DBobt(UInt_t OBT); |
338 |
|
// |
339 |
|
TString ConvertTime(TString &tzone, UInt_t dbt); |
340 |
|
TString UnConvertTime(TString &tzone, UInt_t dbt); |
341 |
// |
// |
342 |
UInt_t DBpkt(UInt_t PKT); |
UInt_t GetTimesync() { return TIMESYNC; }; |
343 |
ULong64_t DBobt(UInt_t OBT); |
UInt_t GetObt0() { return OBT0; }; |
344 |
|
UInt_t GetT0() { return T0; }; |
345 |
|
UInt_t GetType() { return TYPE; }; |
346 |
// |
// |
347 |
|
ClassDef(GL_TIMESYNC,2); |
348 |
|
}; |
349 |
|
|
350 |
|
|
351 |
|
/* |
352 |
|
* Class to query a TLE from the db. |
353 |
|
* |
354 |
|
* Two non default constructor are avaiable. It is the same to call |
355 |
|
* the Query method. |
356 |
|
* |
357 |
|
* The class looks for a TLE in the GL_TLE table using the connection |
358 |
|
* dbc. You need to pass an UTC date in SQL datetime format or in |
359 |
|
* unix time (UTC) and it will look for the tle with the nearest and |
360 |
|
* previous date. Then it initialize tle to a cTle object, |
361 |
|
* tleFromTime to the UTC unix time of the tle and tleToTime to the |
362 |
|
* UTC unix time of the next avaible tle. |
363 |
|
*/ |
364 |
|
class GL_TLE : public GL_TABLES { |
365 |
|
//class GL_TLE : public TObject{ |
366 |
|
private: |
367 |
|
Int_t DoQuery(TString query, TSQLServer *dbc); |
368 |
|
cTle* GiveTle(TSQLRow*); |
369 |
|
|
370 |
|
cTle *tle; // the requested tle |
371 |
|
UInt_t tleFromTime; // unix time (UTC) of the tle |
372 |
|
UInt_t tleToTime; // unix time (UTC) of the next tle |
373 |
|
|
374 |
ClassDef(GL_TIMESYNC,1); |
public: |
375 |
|
GL_TLE(){ |
376 |
|
tle = NULL; |
377 |
|
tleFromTime = 0; |
378 |
|
tleToTime = 0; |
379 |
|
}; |
380 |
|
|
381 |
|
GL_TLE(UInt_t unixtime, TSQLServer *dbc) { |
382 |
|
Query(unixtime, dbc); |
383 |
|
}; |
384 |
|
|
385 |
|
GL_TLE(TString date, TSQLServer *dbc) { |
386 |
|
Query(date, dbc); |
387 |
|
}; |
388 |
|
|
389 |
|
Int_t Query(UInt_t unixtime, TSQLServer *dbc); |
390 |
|
Int_t Query(TString date, TSQLServer *dbc); |
391 |
|
|
392 |
|
cTle* GetTle() const { return tle; } |
393 |
|
UInt_t GetFromTime() const { return tleFromTime; } |
394 |
|
UInt_t GetToTime() const { return tleToTime; } |
395 |
|
|
396 |
|
ClassDef(GL_TLE,1); |
397 |
}; |
}; |
398 |
|
|
399 |
#endif |
#endif |
400 |
|
|