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

Annotation of /YodaProfiler/inc/PamelaDBOperations.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Fri Sep 8 14:42:48 2006 UTC (18 years, 2 months ago) by pam-fi
Branch: MAIN
Changes since 1.2: +5 -2 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 mocchiut 1.2 Long64_t olderthan;
53     //
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     //
81     typedef std::list<const char*> pcksList;
82     static void getPacketsNames(pcksList &pcksNames){
83     pcksNames.push_back("PhysEndRun");
84     pcksNames.push_back("CalibCalPulse1");
85     pcksNames.push_back("CalibCalPulse2");
86     pcksNames.push_back("Physics");
87     pcksNames.push_back("CalibTrkBoth");
88     pcksNames.push_back("CalibTrk1");
89     pcksNames.push_back("CalibTrk2");
90     pcksNames.push_back("CalibTof");
91     pcksNames.push_back("CalibS4");
92     pcksNames.push_back("CalibCalPed");
93     pcksNames.push_back("Calib1_Ac1");
94     pcksNames.push_back("Calib2_Ac1");
95     pcksNames.push_back("Calib1_Ac2");
96     pcksNames.push_back("Calib2_Ac2");
97     pcksNames.push_back("CalibCal");
98     pcksNames.push_back("RunHeader");
99     pcksNames.push_back("RunTrailer");
100     pcksNames.push_back("CalibHeader");
101     pcksNames.push_back("CalibTrailer");
102     pcksNames.push_back("InitHeader");
103     pcksNames.push_back("InitTrailer");
104     pcksNames.push_back("EventTrk");
105     pcksNames.push_back("Log");
106     pcksNames.push_back("VarDump");
107     pcksNames.push_back("ArrDump");
108     pcksNames.push_back("TabDump");
109     pcksNames.push_back("Tmtc");
110     pcksNames.push_back("Mcmd");
111     pcksNames.push_back("ForcedFECmd");
112     pcksNames.push_back("Ac1Init");
113     pcksNames.push_back("CalInit");
114     pcksNames.push_back("TrkInit");
115     pcksNames.push_back("TofInit");
116     pcksNames.push_back("TrgInit");
117     pcksNames.push_back("NdInit");
118     pcksNames.push_back("S4Init");
119     pcksNames.push_back("Ac2Init");
120     pcksNames.push_back("CalAlarm");
121     pcksNames.push_back("Ac1Alarm");
122     pcksNames.push_back("TrkAlarm");
123     pcksNames.push_back("TrgAlarm");
124     pcksNames.push_back("TofAlarm");
125     pcksNames.push_back("S4Alarm");
126     pcksNames.push_back("Ac2Alarm");
127     pcksNames.push_back("TsbT");
128     pcksNames.push_back("TsbB");
129     };
130     //
131     // Functions
132     //
133     void HandleRun();
134     void HandleRunFragments(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
135     void HandleMissingHoT(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
136     void HandleSuspiciousRun();
137     void FillClass();
138     void FillClass(Bool_t mishead, Bool_t mistrail, UInt_t firstev, UInt_t lastev);
139     void HandleTRK_CALIB(Bool_t pk1, Bool_t pk2);
140     //
141     Bool_t IsDebug(){return(debug);};
142     Bool_t IsRunAlreadyInserted();
143     Bool_t IsRunConsistent(Bool_t mishead, Bool_t mistrail, UInt_t &firstev, UInt_t &lastev);
144 pam-fi 1.3 //
145     Bool_t MissingTRK_CALIB(UInt_t t1,UInt_t t2);
146     //
147 mocchiut 1.1 UInt_t PKT(UInt_t pkt_num);
148     //
149     ULong64_t OBT(UInt_t obt);
150     //
151    
152     public:
153     //
154     PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug); // constructor
155     //
156     void Close(); // destructor
157     //
158     //
159     // Setters
160     //
161     void SetConnection(TString host, TString user, TString password);
162     void SetBOOTnumber(UInt_t boot);
163     void SetRawName(TString str);
164     void SetRootName(TString str);
165     void SetDebugFlag(Bool_t debug);
166     void SetID_RAW(UInt_t idr);
167     void SetID_ROOT(UInt_t idr);
168     void SetTsync(UInt_t ts);
169     void SetObt0(UInt_t ts);
170     void SetCommonGLRUN(UInt_t absth, UInt_t abstt);
171     void SetNOBOOT(Bool_t noboot);
172 mocchiut 1.2 void SetOlderThan(Long64_t oldthan);
173 mocchiut 1.1 //
174     Bool_t SetID_RAW();
175     //
176     Int_t SetUpperLimits();
177     //
178     // Getters
179     //
180     Bool_t GetNOBOOT(){return(NOBOOT);};
181     //
182     UInt_t GetID_RAW(){return(id);};
183     UInt_t GetID_ROOT(){return(idroot);};
184     UInt_t GetBOOTnumber(){return(BOOTNO);};
185     //
186     UInt_t GetAbsTime(UInt_t obt);
187     UInt_t GetTsync(){return(tsync);};
188     //
189     const PacketType* GetPacketType(const char* type);
190     //
191     TString GetRawFile(){return((TString)gSystem->BaseName(filerawname.Data()));};
192     TString GetRawPath(){return((TString)gSystem->DirName(filerawname.Data())+'/');};
193     TString GetRootFile(){return((TString)gSystem->BaseName(filerootname.Data()));};
194     TString GetRootPath(){return((TString)gSystem->DirName(filerootname.Data())+'/');};
195     TString GetRootName(){return(filerootname);};
196     TString GetRawName(){return(filerawname);};
197     //
198     // Functions
199     //
200     Int_t assignBOOT_NUMBER();
201     Int_t insertPamelaRootFile();
202     Int_t insertPamelaRawFile();
203     Int_t insertPamelaGL_TIMESYNC();
204     Int_t insertPamelaRUN();
205     Int_t insertCALO_CALIB();
206     Int_t insertTRK_CALIB();
207     Int_t insertS4_CALIB();
208 mocchiut 1.2 Int_t CleanGL_RUN_FRAGMENTS();
209     Int_t ValidateRuns();
210 pam-fi 1.3 Int_t assignVALIDATION(UInt_t ,Bool_t );
211     //
212 mocchiut 1.1 void OpenFile();
213     void CheckFile();
214     //
215     };
216     #endif /* PAMELA_DB_OPERATIONS_H */

  ViewVC Help
Powered by ViewVC 1.1.23