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

Diff of /YodaProfiler/inc/GLTables.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by mocchiut, Tue Sep 19 09:18:43 2006 UTC revision 1.18 by mocchiut, Fri Sep 7 21:10:56 2007 UTC
# Line 6  Line 6 
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
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   * \brief Class to store GL_RUN data
61   */   */
62  class GL_RUN : public TObject {  //class GL_RUN : public TObject {
63    class GL_RUN : public GL_TABLES {
64   private:   private:
65            
66   public:   public:
# Line 63  class GL_RUN : public TObject { Line 106  class GL_RUN : public TObject {
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
# Line 71  class GL_RUN : public TObject { Line 116  class GL_RUN : public TObject {
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);      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);
# Line 108  class GL_RUN : public TObject { Line 153  class GL_RUN : public TObject {
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);};
# Line 132  class GL_RUN : public TObject { Line 178  class GL_RUN : public TObject {
178      UInt_t GetRM_ACQ_SETTING_MODE(){return(RM_ACQ_SETTING_MODE);};      UInt_t GetRM_ACQ_SETTING_MODE(){return(RM_ACQ_SETTING_MODE);};
179      UInt_t GetTRK_CALIB_USED(){return(TRK_CALIB_USED);};      UInt_t GetTRK_CALIB_USED(){return(TRK_CALIB_USED);};
180      UInt_t GetCAL_DSP_MASK(){return(CAL_DSP_MASK);};      UInt_t GetCAL_DSP_MASK(){return(CAL_DSP_MASK);};
181        //
182        GL_RUN* GetGL_RUN(){return this;};
183      //      //
184      ClassDef(GL_RUN,1);      ClassDef(GL_RUN,1);
185  };  };
# Line 141  class GL_RUN : public TObject { Line 188  class GL_RUN : public TObject {
188  /**  /**
189   * \brief Class to store GL_ROOT   * \brief Class to store GL_ROOT
190   */   */
191  class GL_ROOT : public TObject{  class GL_ROOT : public GL_TABLES {
192        //class GL_ROOT : public TObject{
193   private:   private:
194            
195   public:   public:
# Line 162  class GL_ROOT : public TObject{ Line 210  class GL_ROOT : public TObject{
210  /**  /**
211   * \brief Class to store GL_PARAM data   * \brief Class to store GL_PARAM data
212   */   */
213  class GL_PARAM : public TObject{  class GL_PARAM : public GL_TABLES {
214        //class GL_PARAM : public TObject{
215   private:   private:
216            
217   public:   public:
# Line 185  class GL_PARAM : public TObject{ Line 234  class GL_PARAM : public TObject{
234  /**  /**
235   * \brief Class to store GL_TRK_CALIB data   * \brief Class to store GL_TRK_CALIB data
236   */   */
237  class GL_TRK_CALIB : public TObject{  //class GL_TRK_CALIB : public TObject{
238    class GL_TRK_CALIB : public GL_TABLES {
239   private:   private:
240            
241   public:   public:
# Line 214  class GL_TRK_CALIB : public TObject{ Line 264  class GL_TRK_CALIB : public TObject{
264  /**  /**
265   * \brief Class to store GL_CALO_CALIB data   * \brief Class to store GL_CALO_CALIB data
266   */   */
267  class GL_CALO_CALIB : public TObject{  class GL_CALO_CALIB : public GL_TABLES {
268        //class GL_CALO_CALIB : public TObject{
269   private:   private:
270            
271   public:   public:
# Line 236  class GL_CALO_CALIB : public TObject{ Line 287  class GL_CALO_CALIB : public TObject{
287  /**  /**
288   * \brief Class to store GL_S4_CALIB data   * \brief Class to store GL_S4_CALIB data
289   */   */
290  class GL_S4_CALIB : public TObject{  class GL_S4_CALIB : public GL_TABLES {
291        //class GL_S4_CALIB : public TObject{
292   private:   private:
293            
294   public:   public:
# Line 260  class GL_S4_CALIB : public TObject{ Line 312  class GL_S4_CALIB : public TObject{
312  /**  /**
313   * \brief Class to store TIMESYNC data   * \brief Class to store TIMESYNC data
314   */   */
315  class GL_TIMESYNC : public TObject{  class GL_TIMESYNC : public GL_TABLES {
316        //class GL_TIMESYNC : public TObject{
317   private:   private:
318      UInt_t obtfirst;      UInt_t obtfirst;
319      UInt_t pktfirst;      UInt_t pktfirst;
320      UInt_t toffset;      UInt_t toffset;
321      //      //
322      UInt_t ID;      //    UInt_t ID;
323      UInt_t ID_RAW;      //    UInt_t ID_RAW;
324      UInt_t OBT0;      UInt_t OBT0;
325      UInt_t TIMESYNC;      UInt_t TIMESYNC;
326      UInt_t TYPE;      UInt_t TYPE;
327        UInt_t T0;
328            
329   public:   public:
330      //      //
# Line 278  class GL_TIMESYNC : public TObject{ Line 332  class GL_TIMESYNC : public TObject{
332      GL_TIMESYNC(UInt_t ID, TString TYPE, TSQLServer *dbc);      GL_TIMESYNC(UInt_t ID, TString TYPE, TSQLServer *dbc);
333      //      //
334      UInt_t DBabsTime(UInt_t OBT);      UInt_t DBabsTime(UInt_t OBT);
335        UInt_t ResursTime(UInt_t OBT);
336      //      //
337      UInt_t DBpkt(UInt_t PKT);      Long64_t DBpkt(UInt_t PKT);
338      ULong64_t DBobt(UInt_t OBT);      Long64_t DBobt(UInt_t OBT);
339      //      //
340      TString ConvertTime(TString &tzone, UInt_t dbt);      TString ConvertTime(TString &tzone, UInt_t dbt);
341      TString UnConvertTime(TString &tzone, UInt_t dbt);      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_TIMESYNC,1);    ClassDef(GL_TLE,1);
398  };  };
399    
400  #endif  #endif
401    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.23