/[PAMELA software]/YodaProfiler/inc/GLTables.h
ViewVC logotype

Contents of /YodaProfiler/inc/GLTables.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (show annotations) (download)
Fri Apr 27 10:46:59 2007 UTC (17 years, 7 months ago) by mocchiut
Branch: MAIN
CVS Tags: v3r04, v3r05, v3r03
Changes since 1.16: +2 -1 lines
File MIME type: text/plain
GetGL_RUN() method addded

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

  ViewVC Help
Powered by ViewVC 1.1.23