1 |
//============================================================================ |
//============================================================================ |
2 |
// $Id: PamOffLineSW_Main.cpp,v 1.51 2008-09-05 14:33:48 messineo Exp $ |
// $Id: PamOffLineSW_Main.cpp,v 1.52 2008-09-12 14:03:55 messineo Exp $ |
3 |
// Description : Pamela Off-Line Software |
// Description : Pamela Off-Line Software |
4 |
//============================================================================ |
//============================================================================ |
5 |
|
|
48 |
int db_port = 0; |
int db_port = 0; |
49 |
char* db_name = ""; |
char* db_name = ""; |
50 |
char conn[100]=""; |
char conn[100]=""; |
|
//char* connection = NULL; |
|
|
//char* db_user = "yoda_user"; |
|
|
//char* db_pwd = "yoda_pwd"; |
|
51 |
|
|
52 |
LogUtil::logLevel loglevel=LogUtil::LOGERROR; |
LogUtil::logLevel loglevel=LogUtil::LOGERROR; |
53 |
char* logfilename = "pamofflinesw.log"; |
char* logfilename = "chewbacca.log"; |
54 |
//current route |
//current route |
55 |
int route = 999; |
int route = 999; |
56 |
//previous route |
//previous route |
76 |
// char *outDir = "."; |
// char *outDir = "."; |
77 |
char *outDir = ""; |
char *outDir = ""; |
78 |
|
|
79 |
char * nome_output="yoda"; |
char * nome_output="chewbacca"; |
80 |
bool multiFile = 0; |
bool multiFile = 0; |
81 |
unsigned long int step_pkt_number=0; |
unsigned long int step_pkt_number=0; |
82 |
unsigned long int step_pkt_obt=0; |
unsigned long int step_pkt_obt=0; |
158 |
cout << "\t (-help | --help | -h) print this help and exit \n"; |
cout << "\t (-help | --help | -h) print this help and exit \n"; |
159 |
cout << "\t -simu if the input file contains simulated data instead of real data\n"; |
cout << "\t -simu if the input file contains simulated data instead of real data\n"; |
160 |
cout << "\t -vrl if you want to perform the vrl check\n"; |
cout << "\t -vrl if you want to perform the vrl check\n"; |
161 |
cout << "\t -filelog set the log filename. [default: pamofflinesw.log]\n"; |
cout << "\t -filelog set the log filename. [default: chewbacca.log]\n"; |
162 |
cout << "\t -loglevel set the log level. Values: [0,3] (error,warning,info,all) [default:0]\n"; |
cout << "\t -loglevel set the log level. Values: [0,3] (error,warning,info,all) [default:0]\n"; |
163 |
cout << "\t -c set the compression level for the generated ROOT file(s). Values: [0,9] [default = 3]\n"; |
cout << "\t -c set the compression level for the generated ROOT file(s). Values: [0,9] [default = 3]\n"; |
164 |
cout << "\t -root_name set the root-name for the generated ROOT file(s). [default = yoda]\n"; |
cout << "\t -root_name set the root-name for the generated ROOT file(s). [default = chewbacca]\n"; |
165 |
cout << "\t -outDir set the output directory for the generated root file(s). [default = .]\n"; |
cout << "\t -outDir set the output directory for the generated root file(s). [default = .]\n"; |
166 |
cout << "\t -delta_counter set the allowed difference in the Packet Counter between two continuos packets. If 0 all packets are considered continuos. [default = 0]\n"; |
cout << "\t -delta_counter set the allowed difference in the Packet Counter between two continuos packets. If 0 all packets are considered continuos. [default = 0]\n"; |
167 |
cout << "\t -delta_obt set the allowed difference (ms) in the Packet Orbital Time between two continuos packets. If 0 all packets are considered continuos. [default = 0]\n"; |
cout << "\t -delta_obt set the allowed difference (ms) in the Packet Orbital Time between two continuos packets. If 0 all packets are considered continuos. [default = 0]\n"; |
168 |
cout << "\t -db_host set the host-name of the DataBase. [default = localhost]\n"; |
cout << "\t -db_host set the host-name of the DataBase. [default = localhost]\n"; |
169 |
cout << "\t -db_port set the port of the DataBase. [default = 3306]\n"; |
cout << "\t -db_port set the port of the DataBase. [default = 3306]\n"; |
170 |
cout << "\t -db_name set the name of the DataBase. [default = yoda_db]\n"; |
cout << "\t -db_name set the name of the DataBase. [default = chewbacca_db]\n"; |
171 |
cout << "\t -db_user set the user of the DataBase. [default = yoda_user]\n"; |
cout << "\t -db_user set the user of the DataBase. [default = chewbacca_user]\n"; |
172 |
cout << "\t -db_pwd set the user of the DataBase. [default = yoda_pwd]\n"; |
cout << "\t -db_pwd set the user of the DataBase. [default = chewbacca_pwd]\n"; |
173 |
cout << "\t -max_pkt_number Maximum value for Packet Counter, after this value it is resetted. [default = 2^24 - 1]\n"; |
cout << "\t -max_pkt_number Maximum value for Packet Counter, after this value it is resetted. [default = 2^24 - 1]\n"; |
174 |
cout << "\t -max_pkt_obt Maximum value for Packet OBT, after this value it is resetted. [default = 2^32 - 1]\n"; |
cout << "\t -max_pkt_obt Maximum value for Packet OBT, after this value it is resetted. [default = 2^32 - 1]\n"; |
175 |
cout << "\t -orbit_number Value of the orbital number. If 0 this is retrieved from the input file name. [default = 0]\n"; |
cout << "\t -orbit_number Value of the orbital number. If 0 this is retrieved from the input file name. [default = 0]\n"; |
587 |
|
|
588 |
if (!strcmp(db_name,"")) |
if (!strcmp(db_name,"")) |
589 |
{ |
{ |
590 |
db_name="yoda_db"; |
db_name="chewbacca_db"; |
591 |
} |
} |
592 |
sprintf(conn,"mysql://%s:%d/%s",db_host,db_port,db_name); |
sprintf(conn,"mysql://%s:%d/%s",db_host,db_port,db_name); |
593 |
connection=conn; |
connection=conn; |
607 |
} |
} |
608 |
else |
else |
609 |
{ |
{ |
610 |
db_user="yoda_user"; |
db_user="chewbacca_user"; |
611 |
} |
} |
612 |
|
|
613 |
} |
} |
621 |
} |
} |
622 |
else |
else |
623 |
{ |
{ |
624 |
db_pwd="yoda_pwd"; |
db_pwd="chewbacca_pwd"; |
625 |
} |
} |
626 |
} |
} |
627 |
|
|
815 |
if(do_vrl_check){isCadreGood=false;} |
if(do_vrl_check){isCadreGood=false;} |
816 |
break; |
break; |
817 |
} |
} |
818 |
|
skip_cadre = false; |
819 |
//check of the VRL header e setta route number |
//check of the VRL header e setta route number |
820 |
if(!VRL_Header_Check(ccHeader_VRL,LENGTH_HEADER_VRL)) |
if(!VRL_Header_Check(ccHeader_VRL,LENGTH_HEADER_VRL)) |
821 |
{ |
{ |
894 |
string msg = oss.str(); |
string msg = oss.str(); |
895 |
mainLogUtil->logError(msg); |
mainLogUtil->logError(msg); |
896 |
|
|
897 |
//non mi fido del contatore del route |
//non mi fido del contatore del route |
|
|
|
898 |
stringstream oss1; |
stringstream oss1; |
899 |
oss1<<"Route number unused = "<<route<<" Resetting ROUTE to old value = "<<old_route<<" (download="<<download<<")"; |
oss1<<"Route number unused = "<<route<<" Resetting ROUTE to old value = "<<old_route<<" (download="<<download<<")"; |
900 |
msg = oss1.str(); |
msg = oss1.str(); |
917 |
mainLogUtil->logAll(msg); |
mainLogUtil->logAll(msg); |
918 |
} |
} |
919 |
// is_new_route will be reset to false in PacketUser after the packet is used and stored |
// is_new_route will be reset to false in PacketUser after the packet is used and stored |
920 |
|
|
921 |
|
|
922 |
//main processing of the data, searching for Pamela Packets |
//main processing of the data, searching for Pamela Packets |
923 |
for(int i=0; i<LENGTH_DATA_CADRE; i++) |
for(int i=0; i<LENGTH_DATA_CADRE; i++) |
924 |
{ |
{ |
925 |
StateManager::getInstance().getCurrentState()->readInput(ccData[i]); |
StateManager::getInstance().getCurrentState()->readInput(ccData[i]); |
926 |
iByte_tot++; |
iByte_tot++; |
927 |
if(exitdbg==true){cout<<"**** DBG EXIT FOR****"<<endl; break;} |
if(exitdbg==true){cout<<"**** DBG EXIT FOR****"<<endl; break;} |
928 |
} |
} |
929 |
} |
} |
930 |
else{ |
else{ |
931 |
iByte_tot+=LENGTH_DATA_CADRE; |
iByte_tot+=LENGTH_DATA_CADRE; |
964 |
//function that check the header VRL |
//function that check the header VRL |
965 |
bool VRL_Header_Check(char* headVRL, int length) |
bool VRL_Header_Check(char* headVRL, int length) |
966 |
{ |
{ |
967 |
|
|
|
|
|
968 |
/* stringstream oss; |
/* stringstream oss; |
969 |
oss<<"Pippooooooo: at byte+ "<<iByte_tot<<" cadre ... route number = "<<(int)headVRL[3]; |
oss<<"Pippooooooo: at byte+ "<<iByte_tot<<" cadre ... route number = "<<(int)headVRL[3]; |
970 |
string msg = oss.str(); |
string msg = oss.str(); |