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

Annotation of /YodaProfiler/inc/PamelaDBOperations.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations) (download)
Wed Feb 14 10:54:57 2007 UTC (17 years, 9 months ago) by mocchiut
Branch: MAIN
Changes since 1.13: +2 -0 lines
File MIME type: text/plain
Do not throw away calibration if at the beginning of file

1 mocchiut 1.1 #ifndef PAMELA_DB_OPERATIONS_H
2     #define PAMELA_DB_OPERATIONS_H
3    
4     #include <iostream>
5     #include <list>
6 mocchiut 1.6
7 mocchiut 1.1 #include <TSQLServer.h>
8     #include <EventHeader.h>
9     #include <PscuHeader.h>
10     #include <mcmd/McmdEvent.h>
11     #include <mcmd/McmdRecord.h>
12     #include <RunHeaderEvent.h>
13     #include <RunTrailerEvent.h>
14     #include <CalibCalPedEvent.h>
15     #include <CalibS4Event.h>
16     #include <CalibTrk1Event.h>
17     #include <CalibTrk2Event.h>
18     #include <varDump/VarDumpEvent.h>
19     #include <varDump/VarDumpRecord.h>
20     #include <physics/S4/S4Event.h>
21 mocchiut 1.6
22 mocchiut 1.1 #include <GLTables.h>
23    
24 mocchiut 1.8 #include <sgp4.h>
25 mocchiut 1.6
26 mocchiut 1.1 using namespace pamela;
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 mocchiut 1.7 // Long64_t olderthan;
53     UInt_t dworbit;
54 mocchiut 1.2 //
55 mocchiut 1.1 UInt_t BOOTNO;
56     UInt_t obt0;
57     UInt_t id;
58     UInt_t idroot;
59     UInt_t pktfirst;
60 mocchiut 1.10 UInt_t obtfirst;
61 mocchiut 1.14 UInt_t ppktfirst;
62     UInt_t pobtfirst;
63 mocchiut 1.10 Long64_t upperobt;
64     Long64_t upperpkt;
65 mocchiut 1.1 UInt_t upperentry;
66     Int_t rtev;
67     Int_t rhev;
68     //
69     // calibration variables
70     //
71     Int_t t1;
72     Int_t t2;
73     UInt_t fromtime;
74     UInt_t obt1;
75     UInt_t pkt1;
76     UInt_t obt2;
77     UInt_t pkt2;
78     UInt_t valid;
79     //
80     //
81     Bool_t NOBOOT;
82     Bool_t debug;
83 mocchiut 1.6
84     // Path to tle file
85     TString tlefilename;
86 pam-fi 1.4
87 mocchiut 1.7 // flag to control profiler actions
88     Bool_t INSERT_RAW;
89     Bool_t INSERT_ROOT;
90     Bool_t VALIDATE;
91 mocchiut 1.9 Bool_t NOFRAG;
92 mocchiut 1.10 Bool_t AUTOBOOT;
93 mocchiut 1.7
94     TDatime *clean_time;
95    
96 mocchiut 1.1 //
97     typedef std::list<const char*> pcksList;
98     static void getPacketsNames(pcksList &pcksNames){
99     pcksNames.push_back("PhysEndRun");
100     pcksNames.push_back("CalibCalPulse1");
101     pcksNames.push_back("CalibCalPulse2");
102     pcksNames.push_back("Physics");
103     pcksNames.push_back("CalibTrkBoth");
104     pcksNames.push_back("CalibTrk1");
105     pcksNames.push_back("CalibTrk2");
106     pcksNames.push_back("CalibTof");
107     pcksNames.push_back("CalibS4");
108     pcksNames.push_back("CalibCalPed");
109     pcksNames.push_back("Calib1_Ac1");
110     pcksNames.push_back("Calib2_Ac1");
111     pcksNames.push_back("Calib1_Ac2");
112     pcksNames.push_back("Calib2_Ac2");
113     pcksNames.push_back("CalibCal");
114     pcksNames.push_back("RunHeader");
115     pcksNames.push_back("RunTrailer");
116     pcksNames.push_back("CalibHeader");
117     pcksNames.push_back("CalibTrailer");
118     pcksNames.push_back("InitHeader");
119     pcksNames.push_back("InitTrailer");
120     pcksNames.push_back("EventTrk");
121     pcksNames.push_back("Log");
122     pcksNames.push_back("VarDump");
123     pcksNames.push_back("ArrDump");
124     pcksNames.push_back("TabDump");
125     pcksNames.push_back("Tmtc");
126     pcksNames.push_back("Mcmd");
127     pcksNames.push_back("ForcedFECmd");
128     pcksNames.push_back("Ac1Init");
129     pcksNames.push_back("CalInit");
130     pcksNames.push_back("TrkInit");
131     pcksNames.push_back("TofInit");
132     pcksNames.push_back("TrgInit");
133     pcksNames.push_back("NdInit");
134     pcksNames.push_back("S4Init");
135     pcksNames.push_back("Ac2Init");
136     pcksNames.push_back("CalAlarm");
137     pcksNames.push_back("Ac1Alarm");
138     pcksNames.push_back("TrkAlarm");
139     pcksNames.push_back("TrgAlarm");
140     pcksNames.push_back("TofAlarm");
141     pcksNames.push_back("S4Alarm");
142     pcksNames.push_back("Ac2Alarm");
143     pcksNames.push_back("TsbT");
144     pcksNames.push_back("TsbB");
145     };
146     //
147     // Functions
148     //
149     void HandleRun();
150     void HandleRunFragments(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
151     void HandleMissingHoT(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
152     void HandleSuspiciousRun();
153     void FillClass();
154     void FillClass(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
155     void HandleTRK_CALIB(Bool_t pk1, Bool_t pk2);
156     //
157 mocchiut 1.9 void RemoveCALIBS();
158     void ValidationOFF();
159     void ReArrangeRUNS();
160     void RemoveRUNS();
161     void RemoveFILES();
162     //
163 mocchiut 1.1 Bool_t IsDebug(){return(debug);};
164     Bool_t IsRunAlreadyInserted();
165     Bool_t IsRunConsistent(Bool_t mishead, Bool_t mistrail, UInt_t &firstev, UInt_t &lastev);
166 mocchiut 1.10 Bool_t AutoBoot(){return(AUTOBOOT);};
167 mocchiut 1.5 //
168     Bool_t MissingTRK_CALIB(UInt_t t1,UInt_t t2);
169     //
170 mocchiut 1.10 Long64_t PKT(UInt_t pkt_num);
171 mocchiut 1.1 //
172 mocchiut 1.10 Long64_t OBT(UInt_t obt);
173 mocchiut 1.1 //
174 mocchiut 1.7 UInt_t AssignRunID();
175 mocchiut 1.1
176 mocchiut 1.6 // GL_TLE related functions
177     int insertTle(cTle*);
178     bool isTlePresent(cTle*);
179    
180 mocchiut 1.1 public:
181     //
182 mocchiut 1.13 PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug, TString tlefilename,UInt_t dwinput); // constructor
183 mocchiut 1.1 //
184     void Close(); // destructor
185     //
186     //
187     // Setters
188     //
189     void SetConnection(TString host, TString user, TString password);
190     void SetBOOTnumber(UInt_t boot);
191     void SetRawName(TString str);
192     void SetRootName(TString str);
193     void SetDebugFlag(Bool_t debug);
194     void SetID_RAW(UInt_t idr);
195     void SetID_ROOT(UInt_t idr);
196     void SetTsync(UInt_t ts);
197     void SetObt0(UInt_t ts);
198     void SetCommonGLRUN(UInt_t absth, UInt_t abstt);
199     void SetNOBOOT(Bool_t noboot);
200 mocchiut 1.2 void SetOlderThan(Long64_t oldthan);
201 mocchiut 1.6 void SetTLEPath(TString str);
202 mocchiut 1.13 void SetOrbitNo(UInt_t dwinput);
203 mocchiut 1.9 void SetNoFrag(Bool_t nf);
204 mocchiut 1.10 void SetAutoBoot(Bool_t nf);
205 mocchiut 1.1 //
206     Bool_t SetID_RAW();
207     //
208     Int_t SetUpperLimits();
209     //
210     // Getters
211     //
212     Bool_t GetNOBOOT(){return(NOBOOT);};
213     //
214     UInt_t GetID_RAW(){return(id);};
215     UInt_t GetID_ROOT(){return(idroot);};
216     UInt_t GetBOOTnumber(){return(BOOTNO);};
217     //
218     UInt_t GetAbsTime(UInt_t obt);
219     UInt_t GetTsync(){return(tsync);};
220     //
221     const PacketType* GetPacketType(const char* type);
222     //
223     TString GetRawFile(){return((TString)gSystem->BaseName(filerawname.Data()));};
224     TString GetRawPath(){return((TString)gSystem->DirName(filerawname.Data())+'/');};
225     TString GetRootFile(){return((TString)gSystem->BaseName(filerootname.Data()));};
226     TString GetRootPath(){return((TString)gSystem->DirName(filerootname.Data())+'/');};
227     TString GetRootName(){return(filerootname);};
228     TString GetRawName(){return(filerawname);};
229 pam-fi 1.4
230 mocchiut 1.9 const char* GetCleanTime(){return clean_time->AsSQLString();};
231 mocchiut 1.1 //
232     // Functions
233     //
234     Int_t assignBOOT_NUMBER();
235     Int_t insertPamelaRootFile();
236     Int_t insertPamelaRawFile();
237     Int_t insertPamelaGL_TIMESYNC();
238     Int_t insertPamelaRUN();
239     Int_t insertCALO_CALIB();
240     Int_t insertTRK_CALIB();
241     Int_t insertS4_CALIB();
242 mocchiut 1.2 Int_t CleanGL_RUN_FRAGMENTS();
243 mocchiut 1.9 Int_t CleanGL_RUN_FRAGMENTS(TString fcleanfile);
244 mocchiut 1.2 Int_t ValidateRuns();
245 mocchiut 1.9 Int_t ValidateRuns(TString valfile);
246 mocchiut 1.5 Int_t assignVALIDATION(UInt_t ,Bool_t );
247 mocchiut 1.9 Int_t removeFile(TString rootfilename);
248 mocchiut 1.5 //
249     // void OpenFile();
250     void CheckValidate(Long64_t olderthan);
251 pam-fi 1.4 void CheckConnection();
252 mocchiut 1.5 void CheckFile();
253 mocchiut 1.1 //
254 pam-fi 1.4
255 mocchiut 1.9 Bool_t NoFrag(){return(NOFRAG);};
256 mocchiut 1.6 Bool_t InsertRoot(){return(INSERT_ROOT);};
257     Bool_t InsertRaw(){return(INSERT_RAW);};
258     Bool_t Validate(){return(VALIDATE);};
259    
260     // Functions for TLE
261     Int_t populateTLE();
262 pam-fi 1.11
263     UInt_t ValidateTrkCalib( CalibTrk1Event* calibtrk , EventHeader* h);
264     UInt_t ValidateTrkCalib( CalibTrk2Event* calibtrk , EventHeader* h){return ValidateTrkCalib((CalibTrk1Event*)calibtrk,h); };
265 mocchiut 1.12
266     UInt_t Check();
267 pam-fi 1.4
268 mocchiut 1.1 };
269     #endif /* PAMELA_DB_OPERATIONS_H */

  ViewVC Help
Powered by ViewVC 1.1.23