| 1 |
//============================================================================ |
//============================================================================ |
| 2 |
// $Id: PacketUser.h,v 1.38 2008-06-10 08:49:18 messineo Exp $ |
// $Id: PacketUser.h,v 1.3 2008/12/18 12:58:37 mocchiut Exp $ |
| 3 |
// Description : |
// Description : |
| 4 |
//============================================================================ |
//============================================================================ |
| 5 |
#ifndef PACKETUSER_H_ |
#ifndef PACKETUSER_H_ |
| 10 |
#include "EventReader.h" |
#include "EventReader.h" |
| 11 |
|
|
| 12 |
#include "TROOT.h" //ROOT version > 5.14 |
#include "TROOT.h" //ROOT version > 5.14 |
| 13 |
|
#include "TSystem.h" // EMI |
| 14 |
|
|
| 15 |
using namespace pamela; |
using namespace pamela; |
| 16 |
using namespace pamela::techmodel; |
using namespace pamela::techmodel; |
| 65 |
//tymesync and OBT informations |
//tymesync and OBT informations |
| 66 |
unsigned long int obt_time_sync; |
unsigned long int obt_time_sync; |
| 67 |
unsigned long int last_time_sync_info; |
unsigned long int last_time_sync_info; |
| 68 |
|
// (tassa) keep previous value of time_sync |
| 69 |
|
unsigned long int obt_time_sync_prevvalue; |
| 70 |
|
unsigned long int last_time_sync_info_prevvalue; |
| 71 |
|
bool time_is_estimated; |
| 72 |
//TimeOffset used to obtain absolute time |
//TimeOffset used to obtain absolute time |
| 73 |
unsigned long int timeOffset; |
unsigned long int timeOffset; |
| 74 |
//part of the ROOT filename used to retrieve timeOffset for special files |
//part of the ROOT filename used to retrieve timeOffset for special files |
| 75 |
char nnnn_mmm_ppp[80]; |
char nnnn_mmm_ppp[80]; |
| 76 |
//BOOT Number |
//boot number |
| 77 |
unsigned long int boot_number; |
unsigned long int boot_number; |
| 78 |
|
unsigned long int boot_number_prevvalue; |
| 79 |
|
//(tassa) |
| 80 |
|
unsigned int id_to_recover[1000]; |
| 81 |
|
int id_to_recover_index; |
| 82 |
//number of packets with problems( in general CRC problems) detected in EventReader: |
//number of packets with problems( in general CRC problems) detected in EventReader: |
| 83 |
int bad_pkt_EventReader; |
int bad_pkt_EventReader; |
| 84 |
//num ber of Calibration packets with problems( in general CRC problems) detected in EventReader: |
//num ber of Calibration packets with problems( in general CRC problems) detected in EventReader: |
| 90 |
//the ID of the current ROOT file in table Table_ROOT_Good |
//the ID of the current ROOT file in table Table_ROOT_Good |
| 91 |
unsigned int my_id; |
unsigned int my_id; |
| 92 |
|
|
| 93 |
//number of good Calibration packets in the ROOT files |
//number of good Calibration packets in the ROOT files |
| 94 |
// int good_pkt_Calib;//maybe I will remove this in future |
// int good_pkt_Calib;//maybe I will use this in future |
| 95 |
|
|
| 96 |
//the table name in our DB for the ROOT files |
//the table name in our DB for the ROOT files |
| 97 |
char* Table_ROOT_Good; |
char* Table_ROOT_Good; |
| 116 |
void setBootNumber(char* packet, long int pktLenght, const PacketType* type); |
void setBootNumber(char* packet, long int pktLenght, const PacketType* type); |
| 117 |
//set real_time_init and real_time_last |
//set real_time_init and real_time_last |
| 118 |
void setReal_Time(); |
void setReal_Time(); |
| 119 |
|
// |
| 120 |
|
void recover_boot_number(); |
| 121 |
|
|
| 122 |
//retrieve the timeOffset from table=Table_GL_RESURS_OFFSET |
//retrieve the timeOffset from table=Table_GL_RESURS_OFFSET |
| 123 |
unsigned long int retrieveTimeOffset(char * table); |
unsigned long int retrieveTimeOffset(char * table); |
| 124 |
|
|
| 133 |
unsigned long int mboot_num, |
unsigned long int mboot_num, |
| 134 |
unsigned long int time_offset, |
unsigned long int time_offset, |
| 135 |
int bad_pkt, int bad_pkt_read, int bad_pkt_CalRead, int num_PKT_Saved, |
int bad_pkt, int bad_pkt_read, int bad_pkt_CalRead, int num_PKT_Saved, |
| 136 |
char* nome_input); |
char* nome_input,bool _time_is_estimated); |
| 137 |
|
|
| 138 |
///new part merging |
///new part merging |
| 139 |
|
|
| 140 |
//tipi di relazioni che il ROOT file puo' avere con un ROOT gia salvatto in DB |
//tipi di relazioni che il ROOT file puo' avere con un ROOT gia salvatto in DB |
| 141 |
|
//0 =AFTER se c'e' una sovrapposizione temporale parziale, inizia dopo l'inizio di quello associato e finisce dopo la sua fine |
| 142 |
|
//1 =BEFORE se c'e' una sovrapposizione temporale parziale, ossia finisce prima della fine di quello associato ma inizia prima |
| 143 |
|
//2 =SMALLER se c'e' una sovrapposizione temporale parziale: e' contenuto nel ROOT file associato |
| 144 |
|
//3 =BIGGER se c'e' una sovrapposizione temporale parziale: contiene il ROOT file associato |
| 145 |
enum type_Rel_ROOT{ |
enum type_Rel_ROOT{ |
| 146 |
AFTER, //se inizia dentro e finisce fuori |
AFTER, //se inizia dentro e finisce fuori |
| 147 |
BEFORE, //inizia prima ma finisce dentro |
BEFORE, //inizia prima ma finisce dentro |
| 149 |
BIGGER //se inizia prima e finisce dopo |
BIGGER //se inizia prima e finisce dopo |
| 150 |
}; |
}; |
| 151 |
|
|
| 152 |
/* |
|
|
0 =AFTER se c'e' una sovrapposizione temporale parziale, inizia dopo l'inizio di quello associato e finisce dopo la sua fine |
|
|
1 =BEFORE se c'e' una sovrapposizione temporale parziale, ossia finisce prima della fine di quello associato ma inizia prima |
|
|
2 =SMALLER se c'e' una sovrapposizione temporale parziale: e' contenuto nel ROOT file associato |
|
|
3 =BIGGER se c'e' una sovrapposizione temporale parziale: contiene il ROOT file associato |
|
|
*/ |
|
| 153 |
|
|
| 154 |
|
|
| 155 |
bool merge_ROOTfiles(); |
bool merge_ROOTfiles(); |
| 173 |
double bad_perc, |
double bad_perc, |
| 174 |
unsigned int ID_record, type_Rel_ROOT type_rel); |
unsigned int ID_record, type_Rel_ROOT type_rel); |
| 175 |
|
|
| 176 |
//unsigned int Return_IDN_merging(char* table_name, unsigned long int mtime_init, unsigned long int mtime_last, type_Rel_ROOT type_rel); |
//search in DB if there are ROOT files in the temporal range of interest and with the given relation |
| 177 |
TSQLResult* Select_merging(char* table_name, unsigned long int mtime_init, unsigned long int mtime_last, type_Rel_ROOT type_rel); |
TSQLResult* Select_merging(char* table_name, unsigned long int mtime_init, unsigned long int mtime_last, type_Rel_ROOT type_rel); |
| 178 |
|
|
| 179 |
//Lock the tableTobeLocked table or all the tables I know if par=NULL |
//Lock the tableTobeLocked table or all the tables I know if par=NULL |
| 180 |
int LockTables(char* tableTobeLocked); |
int LockTables(char* tableTobeLocked); |