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 |
|
TString mh; |
37 |
|
TString mp; |
38 |
|
TString mu; |
39 |
|
GL_TABLES(); |
40 |
|
GL_TABLES(TString, TString, TString); |
41 |
|
// |
42 |
|
void Set(TString, TString, TString); |
43 |
|
// |
44 |
|
Bool_t IsConnected(TSQLServer *&); |
45 |
|
// |
46 |
|
void ResetCounters(); |
47 |
|
void AddQ(); |
48 |
|
// |
49 |
|
const TString* GetHost(){return(fHost);}; |
50 |
|
const TString* GetUser(){return(fUser);}; |
51 |
|
const TString* GetPsw(){return(fPsw);}; |
52 |
|
TString CGetHost(){return(mh);}; |
53 |
|
TString CGetUser(){return(mu);}; |
54 |
|
TString CGetPsw(){return(mp);}; |
55 |
|
UInt_t GetfNquery(){return(fNquery);}; |
56 |
|
UInt_t GetNqueries(); |
57 |
|
Bool_t IsSet(){return(fSet);}; |
58 |
|
// |
59 |
|
GL_TABLES *GetGLTABLES(){return this;}; |
60 |
|
// |
61 |
|
ClassDef(GL_TABLES,2); |
62 |
|
}; |
63 |
|
|
64 |
|
// ================================================================== |
65 |
|
/** |
66 |
|
* \brief Class to store GL_RUN data |
67 |
|
*/ |
68 |
|
//class GL_RUN : public TObject { |
69 |
|
class GL_RUN : public GL_TABLES { |
70 |
private: |
private: |
71 |
|
|
72 |
public: |
public: |
112 |
Int_t Fill_GL_RUN(TSQLServer*); |
Int_t Fill_GL_RUN(TSQLServer*); |
113 |
Int_t Query_GL_RUN_FRAGMENTS(TString, TSQLServer*); |
Int_t Query_GL_RUN_FRAGMENTS(TString, TSQLServer*); |
114 |
Int_t Fill_GL_RUN_FRAGMENTS(TSQLServer*); |
Int_t Fill_GL_RUN_FRAGMENTS(TSQLServer*); |
115 |
|
Int_t DeleteRun(TSQLServer*, UInt_t, TString); |
116 |
|
Int_t RestoreRun(TSQLServer*, UInt_t, TString); |
117 |
void Clear(); |
void Clear(); |
118 |
// |
// |
119 |
// SETTERS |
// SETTERS |
122 |
void Set_GL_RUNH(RunHeaderEvent *runt, PscuHeader *pht); |
void Set_GL_RUNH(RunHeaderEvent *runt, PscuHeader *pht); |
123 |
void Set_GL_RUNT0(); |
void Set_GL_RUNT0(); |
124 |
void Set_GL_RUNH0(); |
void Set_GL_RUNH0(); |
125 |
|
// |
126 |
|
void Set_GL_RUN(TSQLRow *row); |
127 |
|
// |
128 |
void SetRUNHEADER_TIME(UInt_t abst); |
void SetRUNHEADER_TIME(UInt_t abst); |
129 |
void SetRUNTRAILER_TIME(UInt_t abst); |
void SetRUNTRAILER_TIME(UInt_t abst); |
130 |
void SetRUNHEADER_PKT(UInt_t abst); |
void SetRUNHEADER_PKT(UInt_t abst); |
159 |
// GETTERS |
// GETTERS |
160 |
// |
// |
161 |
void GetLevel2Struct(cGLRun *l2) const; |
void GetLevel2Struct(cGLRun *l2) const; |
162 |
|
UInt_t GetID(){return(ID);}; |
163 |
UInt_t GetRUNHEADER_PKT(){return(RUNHEADER_PKT);}; |
UInt_t GetRUNHEADER_PKT(){return(RUNHEADER_PKT);}; |
164 |
UInt_t GetRUNTRAILER_PKT(){return(RUNTRAILER_PKT);}; |
UInt_t GetRUNTRAILER_PKT(){return(RUNTRAILER_PKT);}; |
165 |
UInt_t GetRUNHEADER_TIME(){return(RUNHEADER_TIME);}; |
UInt_t GetRUNHEADER_TIME(){return(RUNHEADER_TIME);}; |
167 |
UInt_t GetRUNHEADER_OBT(){return(RUNHEADER_OBT);}; |
UInt_t GetRUNHEADER_OBT(){return(RUNHEADER_OBT);}; |
168 |
UInt_t GetRUNTRAILER_OBT(){return(RUNTRAILER_OBT);}; |
UInt_t GetRUNTRAILER_OBT(){return(RUNTRAILER_OBT);}; |
169 |
UInt_t GetNEVENTS(){return(NEVENTS);}; |
UInt_t GetNEVENTS(){return(NEVENTS);}; |
170 |
|
UInt_t GetBOOT_NUMBER(){return(BOOT_NUMBER);}; |
171 |
UInt_t GetTRK_CALIB(){return(TRK_CALIB_USED);}; |
UInt_t GetTRK_CALIB(){return(TRK_CALIB_USED);}; |
172 |
UInt_t GetPKT_COUNTER(){return(PKT_COUNTER);}; |
UInt_t GetPKT_COUNTER(){return(PKT_COUNTER);}; |
173 |
UInt_t GetLAST_TIMESYNC(){return(LAST_TIMESYNC);}; |
UInt_t GetLAST_TIMESYNC(){return(LAST_TIMESYNC);}; |
184 |
UInt_t GetRM_ACQ_SETTING_MODE(){return(RM_ACQ_SETTING_MODE);}; |
UInt_t GetRM_ACQ_SETTING_MODE(){return(RM_ACQ_SETTING_MODE);}; |
185 |
UInt_t GetTRK_CALIB_USED(){return(TRK_CALIB_USED);}; |
UInt_t GetTRK_CALIB_USED(){return(TRK_CALIB_USED);}; |
186 |
UInt_t GetCAL_DSP_MASK(){return(CAL_DSP_MASK);}; |
UInt_t GetCAL_DSP_MASK(){return(CAL_DSP_MASK);}; |
187 |
|
// |
188 |
|
GL_RUN* GetGL_RUN(){return this;}; |
189 |
// |
// |
190 |
ClassDef(GL_RUN,1); |
ClassDef(GL_RUN,1); |
191 |
}; |
}; |
194 |
/** |
/** |
195 |
* \brief Class to store GL_ROOT |
* \brief Class to store GL_ROOT |
196 |
*/ |
*/ |
197 |
class GL_ROOT : public TObject{ |
class GL_ROOT : public GL_TABLES { |
198 |
|
//class GL_ROOT : public TObject{ |
199 |
private: |
private: |
200 |
|
|
201 |
public: |
public: |
216 |
/** |
/** |
217 |
* \brief Class to store GL_PARAM data |
* \brief Class to store GL_PARAM data |
218 |
*/ |
*/ |
219 |
class GL_PARAM : public TObject{ |
class GL_PARAM : public GL_TABLES { |
220 |
|
//class GL_PARAM : public TObject{ |
221 |
private: |
private: |
222 |
|
|
223 |
public: |
public: |
240 |
/** |
/** |
241 |
* \brief Class to store GL_TRK_CALIB data |
* \brief Class to store GL_TRK_CALIB data |
242 |
*/ |
*/ |
243 |
class GL_TRK_CALIB : public TObject{ |
//class GL_TRK_CALIB : public TObject{ |
244 |
|
class GL_TRK_CALIB : public GL_TABLES { |
245 |
private: |
private: |
246 |
|
|
247 |
public: |
public: |
256 |
UInt_t OBT2; |
UInt_t OBT2; |
257 |
UInt_t PKT1; |
UInt_t PKT1; |
258 |
UInt_t PKT2; |
UInt_t PKT2; |
259 |
|
UInt_t BOOT_NUMBER; |
260 |
|
UInt_t VALIDATION; |
261 |
|
|
262 |
GL_TRK_CALIB(); |
GL_TRK_CALIB(); |
263 |
|
|
270 |
/** |
/** |
271 |
* \brief Class to store GL_CALO_CALIB data |
* \brief Class to store GL_CALO_CALIB data |
272 |
*/ |
*/ |
273 |
class GL_CALO_CALIB : public TObject{ |
class GL_CALO_CALIB : public GL_TABLES { |
274 |
|
//class GL_CALO_CALIB : public TObject{ |
275 |
private: |
private: |
276 |
|
|
277 |
public: |
public: |
285 |
|
|
286 |
GL_CALO_CALIB(); |
GL_CALO_CALIB(); |
287 |
|
|
288 |
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); |
289 |
|
|
290 |
ClassDef(GL_CALO_CALIB,1); |
ClassDef(GL_CALO_CALIB,1); |
291 |
}; |
}; |
293 |
/** |
/** |
294 |
* \brief Class to store GL_S4_CALIB data |
* \brief Class to store GL_S4_CALIB data |
295 |
*/ |
*/ |
296 |
class GL_S4_CALIB : public TObject{ |
class GL_S4_CALIB : public GL_TABLES { |
297 |
|
//class GL_S4_CALIB : public TObject{ |
298 |
private: |
private: |
299 |
|
|
300 |
public: |
public: |
318 |
/** |
/** |
319 |
* \brief Class to store TIMESYNC data |
* \brief Class to store TIMESYNC data |
320 |
*/ |
*/ |
321 |
class GL_TIMESYNC : public TObject{ |
class GL_TIMESYNC : public GL_TABLES { |
322 |
|
//class GL_TIMESYNC : public TObject{ |
323 |
private: |
private: |
324 |
UInt_t obtfirst; |
UInt_t obtfirst; |
325 |
UInt_t pktfirst; |
UInt_t pktfirst; |
326 |
UInt_t toffset; |
UInt_t toffset; |
327 |
// |
// |
328 |
UInt_t ID; |
// UInt_t ID; |
329 |
UInt_t ID_RAW; |
// UInt_t ID_RAW; |
330 |
UInt_t OBT0; |
UInt_t OBT0; |
331 |
UInt_t TIMESYNC; |
UInt_t TIMESYNC; |
332 |
UInt_t TYPE; |
UInt_t TYPE; |
333 |
|
UInt_t T0; |
334 |
|
|
335 |
public: |
public: |
336 |
// |
// |
338 |
GL_TIMESYNC(UInt_t ID, TString TYPE, TSQLServer *dbc); |
GL_TIMESYNC(UInt_t ID, TString TYPE, TSQLServer *dbc); |
339 |
// |
// |
340 |
UInt_t DBabsTime(UInt_t OBT); |
UInt_t DBabsTime(UInt_t OBT); |
341 |
|
UInt_t ResursTime(UInt_t OBT); |
342 |
|
// |
343 |
|
Long64_t DBpkt(UInt_t PKT); |
344 |
|
Long64_t DBobt(UInt_t OBT); |
345 |
|
// |
346 |
|
TString ConvertTime(TString &tzone, UInt_t dbt); |
347 |
|
TString UnConvertTime(TString &tzone, UInt_t dbt); |
348 |
// |
// |
349 |
UInt_t DBpkt(UInt_t PKT); |
UInt_t GetTimesync() { return TIMESYNC; }; |
350 |
ULong64_t DBobt(UInt_t OBT); |
UInt_t GetObt0() { return OBT0; }; |
351 |
|
UInt_t GetT0() { return T0; }; |
352 |
|
UInt_t GetType() { return TYPE; }; |
353 |
// |
// |
354 |
|
ClassDef(GL_TIMESYNC,2); |
355 |
|
}; |
356 |
|
|
357 |
|
|
358 |
|
/* |
359 |
|
* Class to query a TLE from the db. |
360 |
|
* |
361 |
|
* Two non default constructor are avaiable. It is the same to call |
362 |
|
* the Query method. |
363 |
|
* |
364 |
|
* The class looks for a TLE in the GL_TLE table using the connection |
365 |
|
* dbc. You need to pass an UTC date in SQL datetime format or in |
366 |
|
* unix time (UTC) and it will look for the tle with the nearest and |
367 |
|
* previous date. Then it initialize tle to a cTle object, |
368 |
|
* tleFromTime to the UTC unix time of the tle and tleToTime to the |
369 |
|
* UTC unix time of the next avaible tle. |
370 |
|
*/ |
371 |
|
class GL_TLE : public GL_TABLES { |
372 |
|
//class GL_TLE : public TObject{ |
373 |
|
private: |
374 |
|
Int_t DoQuery(TString query, TSQLServer *dbc); |
375 |
|
cTle* GiveTle(TSQLRow*); |
376 |
|
|
377 |
|
cTle *tle; // the requested tle |
378 |
|
UInt_t tleFromTime; // unix time (UTC) of the tle |
379 |
|
UInt_t tleToTime; // unix time (UTC) of the next tle |
380 |
|
|
381 |
ClassDef(GL_TIMESYNC,1); |
public: |
382 |
|
GL_TLE(){ |
383 |
|
tle = NULL; |
384 |
|
tleFromTime = 0; |
385 |
|
tleToTime = 0; |
386 |
|
}; |
387 |
|
|
388 |
|
GL_TLE(UInt_t unixtime, TSQLServer *dbc) { |
389 |
|
Query(unixtime, dbc); |
390 |
|
}; |
391 |
|
|
392 |
|
GL_TLE(TString date, TSQLServer *dbc) { |
393 |
|
Query(date, dbc); |
394 |
|
}; |
395 |
|
|
396 |
|
Int_t Query(UInt_t unixtime, TSQLServer *dbc); |
397 |
|
Int_t Query(TString date, TSQLServer *dbc); |
398 |
|
|
399 |
|
cTle* GetTle() const { return tle; } |
400 |
|
UInt_t GetFromTime() const { return tleFromTime; } |
401 |
|
UInt_t GetToTime() const { return tleToTime; } |
402 |
|
|
403 |
|
ClassDef(GL_TLE,1); |
404 |
}; |
}; |
405 |
|
|
406 |
#endif |
#endif |
407 |
|
|