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

Contents of /chewbacca/YodaProfiler/inc/GLTables.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Thu Sep 25 09:03:17 2008 UTC (16 years, 2 months ago) by mocchiut
Branch: MAIN
Changes since 1.1: +7 -1 lines
File MIME type: text/plain
More Makefiles tuning + new variables in GL_RUN*

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

  ViewVC Help
Powered by ViewVC 1.1.23