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

Annotation of /YodaProfiler/inc/PamelaDBOperations.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Mon Sep 11 16:38:18 2006 UTC (18 years, 2 months ago) by pam-fi
Branch: MAIN
Changes since 1.3: +19 -4 lines
File MIME type: text/plain
implemented run validation

1 mocchiut 1.1 #ifndef PAMELA_DB_OPERATIONS_H
2     #define PAMELA_DB_OPERATIONS_H
3    
4     #include <iostream>
5     #include <list>
6     //
7     #include <TSQLServer.h>
8     //
9     #include <EventHeader.h>
10     #include <PscuHeader.h>
11     #include <mcmd/McmdEvent.h>
12     #include <mcmd/McmdRecord.h>
13     #include <RunHeaderEvent.h>
14     #include <RunTrailerEvent.h>
15     #include <CalibCalPedEvent.h>
16     #include <CalibS4Event.h>
17     #include <CalibTrk1Event.h>
18     #include <CalibTrk2Event.h>
19     #include <varDump/VarDumpEvent.h>
20     #include <varDump/VarDumpRecord.h>
21     #include <physics/S4/S4Event.h>
22     //
23     #include <GLTables.h>
24    
25     using namespace pamela;
26    
27    
28     /**
29     * Collections of Pamela specific operations over a database
30     */
31     class PamelaDBOperations {
32    
33     private:
34     TSQLServer *conn;
35     TFile *file;
36     //
37     RunHeaderEvent *runh;
38     EventHeader *ehh;
39     PscuHeader *phh;
40     RunTrailerEvent *runt;
41     EventHeader *eht;
42     PscuHeader *pht;
43     //
44     GL_RUN *glrun;
45     //
46     TString filerawname;
47     TString filerootname;
48     //
49     UInt_t tsync;
50     UInt_t toffset;
51     //
52 pam-fi 1.4 // Long64_t olderthan;
53 mocchiut 1.2 //
54 mocchiut 1.1 UInt_t BOOTNO;
55     UInt_t obt0;
56     UInt_t id;
57     UInt_t idroot;
58     UInt_t pktfirst;
59     ULong64_t obtfirst;
60     ULong64_t upperobt;
61     UInt_t upperpkt;
62     UInt_t upperentry;
63     Int_t rtev;
64     Int_t rhev;
65     //
66     // calibration variables
67     //
68     Int_t t1;
69     Int_t t2;
70     UInt_t fromtime;
71     UInt_t obt1;
72     UInt_t pkt1;
73     UInt_t obt2;
74     UInt_t pkt2;
75     UInt_t valid;
76     //
77     //
78     Bool_t NOBOOT;
79     Bool_t debug;
80 pam-fi 1.4
81     // flag to control profiler actions
82     Bool_t INSERT_RAW;
83     Bool_t INSERT_ROOT;
84     Bool_t VALIDATE;
85    
86     TDatime *clean_time;
87    
88 mocchiut 1.1 //
89     typedef std::list<const char*> pcksList;
90     static void getPacketsNames(pcksList &pcksNames){
91     pcksNames.push_back("PhysEndRun");
92     pcksNames.push_back("CalibCalPulse1");
93     pcksNames.push_back("CalibCalPulse2");
94     pcksNames.push_back("Physics");
95     pcksNames.push_back("CalibTrkBoth");
96     pcksNames.push_back("CalibTrk1");
97     pcksNames.push_back("CalibTrk2");
98     pcksNames.push_back("CalibTof");
99     pcksNames.push_back("CalibS4");
100     pcksNames.push_back("CalibCalPed");
101     pcksNames.push_back("Calib1_Ac1");
102     pcksNames.push_back("Calib2_Ac1");
103     pcksNames.push_back("Calib1_Ac2");
104     pcksNames.push_back("Calib2_Ac2");
105     pcksNames.push_back("CalibCal");
106     pcksNames.push_back("RunHeader");
107     pcksNames.push_back("RunTrailer");
108     pcksNames.push_back("CalibHeader");
109     pcksNames.push_back("CalibTrailer");
110     pcksNames.push_back("InitHeader");
111     pcksNames.push_back("InitTrailer");
112     pcksNames.push_back("EventTrk");
113     pcksNames.push_back("Log");
114     pcksNames.push_back("VarDump");
115     pcksNames.push_back("ArrDump");
116     pcksNames.push_back("TabDump");
117     pcksNames.push_back("Tmtc");
118     pcksNames.push_back("Mcmd");
119     pcksNames.push_back("ForcedFECmd");
120     pcksNames.push_back("Ac1Init");
121     pcksNames.push_back("CalInit");
122     pcksNames.push_back("TrkInit");
123     pcksNames.push_back("TofInit");
124     pcksNames.push_back("TrgInit");
125     pcksNames.push_back("NdInit");
126     pcksNames.push_back("S4Init");
127     pcksNames.push_back("Ac2Init");
128     pcksNames.push_back("CalAlarm");
129     pcksNames.push_back("Ac1Alarm");
130     pcksNames.push_back("TrkAlarm");
131     pcksNames.push_back("TrgAlarm");
132     pcksNames.push_back("TofAlarm");
133     pcksNames.push_back("S4Alarm");
134     pcksNames.push_back("Ac2Alarm");
135     pcksNames.push_back("TsbT");
136     pcksNames.push_back("TsbB");
137     };
138     //
139     // Functions
140     //
141     void HandleRun();
142     void HandleRunFragments(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
143     void HandleMissingHoT(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
144     void HandleSuspiciousRun();
145     void FillClass();
146     void FillClass(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
147     void HandleTRK_CALIB(Bool_t pk1, Bool_t pk2);
148     //
149     Bool_t IsDebug(){return(debug);};
150     Bool_t IsRunAlreadyInserted();
151     Bool_t IsRunConsistent(Bool_t mishead, Bool_t mistrail, UInt_t &firstev, UInt_t &lastev);
152 pam-fi 1.3 //
153     Bool_t MissingTRK_CALIB(UInt_t t1,UInt_t t2);
154     //
155 mocchiut 1.1 UInt_t PKT(UInt_t pkt_num);
156     //
157     ULong64_t OBT(UInt_t obt);
158     //
159    
160     public:
161     //
162 pam-fi 1.4 PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug, Long64_t olderthan); // constructor
163 mocchiut 1.1 //
164     void Close(); // destructor
165     //
166     //
167     // Setters
168     //
169     void SetConnection(TString host, TString user, TString password);
170     void SetBOOTnumber(UInt_t boot);
171     void SetRawName(TString str);
172     void SetRootName(TString str);
173     void SetDebugFlag(Bool_t debug);
174     void SetID_RAW(UInt_t idr);
175     void SetID_ROOT(UInt_t idr);
176     void SetTsync(UInt_t ts);
177     void SetObt0(UInt_t ts);
178     void SetCommonGLRUN(UInt_t absth, UInt_t abstt);
179     void SetNOBOOT(Bool_t noboot);
180 mocchiut 1.2 void SetOlderThan(Long64_t oldthan);
181 mocchiut 1.1 //
182     Bool_t SetID_RAW();
183     //
184     Int_t SetUpperLimits();
185     //
186     // Getters
187     //
188     Bool_t GetNOBOOT(){return(NOBOOT);};
189     //
190     UInt_t GetID_RAW(){return(id);};
191     UInt_t GetID_ROOT(){return(idroot);};
192     UInt_t GetBOOTnumber(){return(BOOTNO);};
193     //
194     UInt_t GetAbsTime(UInt_t obt);
195     UInt_t GetTsync(){return(tsync);};
196     //
197     const PacketType* GetPacketType(const char* type);
198     //
199     TString GetRawFile(){return((TString)gSystem->BaseName(filerawname.Data()));};
200     TString GetRawPath(){return((TString)gSystem->DirName(filerawname.Data())+'/');};
201     TString GetRootFile(){return((TString)gSystem->BaseName(filerootname.Data()));};
202     TString GetRootPath(){return((TString)gSystem->DirName(filerootname.Data())+'/');};
203     TString GetRootName(){return(filerootname);};
204     TString GetRawName(){return(filerawname);};
205 pam-fi 1.4
206     const char* GetCleanTime(){return clean_time->AsSQLString();};
207 mocchiut 1.1 //
208     // Functions
209     //
210     Int_t assignBOOT_NUMBER();
211     Int_t insertPamelaRootFile();
212     Int_t insertPamelaRawFile();
213     Int_t insertPamelaGL_TIMESYNC();
214     Int_t insertPamelaRUN();
215     Int_t insertCALO_CALIB();
216     Int_t insertTRK_CALIB();
217     Int_t insertS4_CALIB();
218 mocchiut 1.2 Int_t CleanGL_RUN_FRAGMENTS();
219     Int_t ValidateRuns();
220 pam-fi 1.3 Int_t assignVALIDATION(UInt_t ,Bool_t );
221     //
222 pam-fi 1.4 // void OpenFile();
223     void CheckConnection();
224 mocchiut 1.1 //
225 pam-fi 1.4
226     Bool_t InsertRoot(){return(INSERT_ROOT);};
227     Bool_t InsertRaw(){return(INSERT_RAW);};
228     Bool_t Validate(){return(VALIDATE);};
229    
230 mocchiut 1.1 };
231     #endif /* PAMELA_DB_OPERATIONS_H */

  ViewVC Help
Powered by ViewVC 1.1.23