1 |
//============================================================================ |
//============================================================================ |
2 |
// $Id: PacketUser.h,v 1.4 2008-12-18 14:47:00 mocchiut Exp $ |
// $Id: PacketUser.h,v 1.5 2009/08/05 18:48:42 pam-fi Exp $ |
3 |
// Description : |
// Description : |
4 |
//============================================================================ |
//============================================================================ |
5 |
#ifndef PACKETUSER_H_ |
#ifndef PACKETUSER_H_ |
11 |
|
|
12 |
#include "TROOT.h" //ROOT version > 5.14 |
#include "TROOT.h" //ROOT version > 5.14 |
13 |
#include "TSystem.h" // EMI |
#include "TSystem.h" // EMI |
14 |
|
#include "TArrayI.h" // EMI |
15 |
|
|
16 |
|
#include <vector> |
17 |
|
|
18 |
using namespace pamela; |
using namespace pamela; |
19 |
using namespace pamela::techmodel; |
using namespace pamela::techmodel; |
20 |
|
|
21 |
namespace PamOffLineSW { |
namespace PamOffLineSW { |
22 |
|
|
23 |
|
|
24 |
|
/* class dbinfo{ */ |
25 |
|
/* public: */ |
26 |
|
/* dbinfo( */ |
27 |
|
/* char * v_folder_name, */ |
28 |
|
/* char* v_file_name, */ |
29 |
|
/* unsigned long int v_pkt_number_in, */ |
30 |
|
/* unsigned long int v_pkt_number_fin, */ |
31 |
|
/* unsigned long int v_obt_in, */ |
32 |
|
/* unsigned long int v_obt_fin, */ |
33 |
|
/* unsigned long int v_mboot_num, */ |
34 |
|
/* unsigned long int v_time_offset, */ |
35 |
|
/* int v_bad_pkt, */ |
36 |
|
/* int v_bad_pkt_read, */ |
37 |
|
/* int v_bad_pkt_CalRead, */ |
38 |
|
/* int v_num_PKT_Saved, */ |
39 |
|
/* char* v_nome_input, */ |
40 |
|
/* bool v__time_is_estimated */ |
41 |
|
/* ){ */ |
42 |
|
/* folder_name = strdup(v_folder_name); */ |
43 |
|
/* file_name = strdup(v_file_name); */ |
44 |
|
/* pkt_number_in = v_pkt_number_in; */ |
45 |
|
/* pkt_number_fin = v_pkt_number_fin; */ |
46 |
|
/* obt_in = v_obt_in; */ |
47 |
|
/* obt_fin = v_obt_fin; */ |
48 |
|
/* mboot_num = v_mboot_num; */ |
49 |
|
/* time_offset = v_time_offset; */ |
50 |
|
/* bad_pkt = v_bad_pkt; */ |
51 |
|
/* bad_pkt_read = v_bad_pkt_read; */ |
52 |
|
/* bad_pkt_CalRead = v_bad_pkt_CalRead; */ |
53 |
|
/* num_PKT_Saved = v_num_PKT_Saved; */ |
54 |
|
/* nome_input = v_nome_input; */ |
55 |
|
/* _time_is_estimated = v__time_is_estimated; */ |
56 |
|
/* } */ |
57 |
|
/* ~dbinfo(){ */ |
58 |
|
/* free(folder_name); */ |
59 |
|
/* free(file_name); */ |
60 |
|
/* } */ |
61 |
|
/* char* folder_name; */ |
62 |
|
/* char* file_name; */ |
63 |
|
/* unsigned long int pkt_number_in; */ |
64 |
|
/* unsigned long int pkt_number_fin; */ |
65 |
|
/* unsigned long int obt_in; */ |
66 |
|
/* unsigned long int obt_fin; */ |
67 |
|
/* unsigned long int mboot_num; */ |
68 |
|
/* unsigned long int time_offset; */ |
69 |
|
/* int bad_pkt; */ |
70 |
|
/* int bad_pkt_read; */ |
71 |
|
/* int bad_pkt_CalRead; */ |
72 |
|
/* int num_PKT_Saved; */ |
73 |
|
/* char* nome_input; */ |
74 |
|
/* bool _time_is_estimated; */ |
75 |
|
/* }; */ |
76 |
|
|
77 |
class PacketUser { |
class PacketUser { |
78 |
|
|
79 |
public: |
public: |
89 |
void FinishLastGroup(); |
void FinishLastGroup(); |
90 |
|
|
91 |
private: |
private: |
92 |
|
|
93 |
|
// store dbinfo when file is bad but num. packet more than 1000 |
94 |
|
// vector <dbinfo*> m_dbinfos; |
95 |
|
|
96 |
//the Event Reader handler |
//the Event Reader handler |
97 |
pamela::techmodel::EventReader* reader; |
pamela::techmodel::EventReader* reader; |
98 |
//the Pamela Run handler, one for ech ROOT file created |
//the Pamela Run handler, one for ech ROOT file created |
161 |
//the table name in our DB for MERGING |
//the table name in our DB for MERGING |
162 |
const char* Table_ROOT_Merging; |
const char* Table_ROOT_Merging; |
163 |
|
|
164 |
|
// |
165 |
|
Int_t recoverlimit; |
166 |
|
// list of ID in root_table_bad with more than XXX packets |
167 |
|
TArrayI *idtorecover; |
168 |
|
// |
169 |
|
Int_t arsize; |
170 |
|
// delete small files in root_table_bad from disk |
171 |
|
void CleanDisk(); |
172 |
|
|
173 |
//starts a new root file |
//starts a new root file |
174 |
void StartGroup(); |
void StartGroup(); |
175 |
//set the value of the counter and obt of the first packet of the group |
//set the value of the counter and obt of the first packet of the group |
184 |
void setBootNumber(char* packet, long int pktLenght, const PacketType* type); |
void setBootNumber(char* packet, long int pktLenght, const PacketType* type); |
185 |
//set real_time_init and real_time_last |
//set real_time_init and real_time_last |
186 |
void setReal_Time(); |
void setReal_Time(); |
187 |
// |
|
188 |
|
void setReal_TimeRECOVERY( |
189 |
|
unsigned long int & _real_time_init, |
190 |
|
unsigned long int & _real_time_last, |
191 |
|
unsigned long int _obt_init, |
192 |
|
unsigned long int _obt_last |
193 |
|
); |
194 |
|
|
195 |
|
// |
196 |
void recover_boot_number(); |
void recover_boot_number(); |
197 |
|
|
198 |
//retrieve the timeOffset from table=Table_GL_RESURS_OFFSET |
//retrieve the timeOffset from table=Table_GL_RESURS_OFFSET |
201 |
unsigned int select_maxIDN_DB(const char* table_name); |
unsigned int select_maxIDN_DB(const char* table_name); |
202 |
|
|
203 |
//function that saves informations in our DB |
//function that saves informations in our DB |
204 |
bool saveROOT_DB(const char* table_name, char* folder_name, char* file_name, unsigned long int pkt_number_in, |
bool saveROOT_DB(const char* table_name, const char* folder_name, const char* file_name, unsigned long int pkt_number_in, |
205 |
unsigned long int pkt_number_fin, unsigned long int obt_in, unsigned long int obt_fin, unsigned long int oT_sync, |
unsigned long int pkt_number_fin, unsigned long int obt_in, unsigned long int obt_fin, unsigned long int oT_sync, |
206 |
unsigned long int lT_sync_info, unsigned long int mtime_init, unsigned long int mtime_last, |
unsigned long int lT_sync_info, unsigned long int mtime_init, unsigned long int mtime_last, |
207 |
unsigned long int mboot_num, unsigned long int time_offset, int bad_pkt, int bad_pkt_read, int bad_pkt_CalRead, |
unsigned long int mboot_num, unsigned long int time_offset, int bad_pkt, int bad_pkt_read, int bad_pkt_CalRead, |
208 |
int num_PKT_Saved, char* nome_input, bool _time_is_estimated); |
int num_PKT_Saved, const char* nome_input, bool _time_is_estimated); |
209 |
|
|
210 |
///new part merging |
///new part merging |
211 |
|
|