--- chewbacca/PamOffLineSW/PamOffLineSW_Main.cpp 2008/09/23 07:20:14 1.1 +++ chewbacca/PamOffLineSW/PamOffLineSW_Main.cpp 2008/12/18 12:58:37 1.4 @@ -1,5 +1,5 @@ //============================================================================ -// $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 $ // Description : Pamela Off-Line Software //============================================================================ @@ -48,12 +48,9 @@ int db_port = 0; char* db_name = ""; char conn[100]=""; -//char* connection = NULL; -//char* db_user = "yoda_user"; -//char* db_pwd = "yoda_pwd"; LogUtil::logLevel loglevel=LogUtil::LOGERROR; -char* logfilename = "pamofflinesw.log"; +char* logfilename = "chewbacca.log"; //current route int route = 999; //previous route @@ -79,8 +76,8 @@ // char *outDir = "."; char *outDir = ""; - char * nome_output="yoda"; - bool multiFile = 0; + char * nome_output="chewbacca"; + bool multiFile = 0; unsigned long int step_pkt_number=0; unsigned long int step_pkt_obt=0; LogUtil* mainLogUtil = NULL; @@ -99,6 +96,8 @@ //TODO: now it is unused unsigned long int delta_Time=0;//in seconds +#define TAGVALUELEN 4 + char tag_value[TAGVALUELEN]; } // main: @@ -161,28 +160,28 @@ cout << "\t (-help | --help | -h) print this help and exit \n"; cout << "\t -simu if the input file contains simulated data instead of real data\n"; cout << "\t -vrl if you want to perform the vrl check\n"; - cout << "\t -filelog set the log filename. [default: pamofflinesw.log]\n"; + cout << "\t -filelog set the log filename. [default: chewbacca.log]\n"; cout << "\t -loglevel set the log level. Values: [0,3] (error,warning,info,all) [default:0]\n"; cout << "\t -c set the compression level for the generated ROOT file(s). Values: [0,9] [default = 3]\n"; - 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"; cout << "\t -outDir set the output directory for the generated root file(s). [default = .]\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"; 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 -db_host set the host-name of the DataBase. [default = localhost]\n"; cout << "\t -db_port set the port of the DataBase. [default = 3306]\n"; - cout << "\t -db_name set the name of the DataBase. [default = yoda_db]\n"; - cout << "\t -db_user set the user of the DataBase. [default = yoda_user]\n"; - cout << "\t -db_pwd set the user of the DataBase. [default = yoda_pwd]\n"; + cout << "\t -db_name set the name of the DataBase. [default = chewbacca_db]\n"; + cout << "\t -db_user set the user of the DataBase. [default = chewbacca_user]\n"; + cout << "\t -db_pwd set the user of the DataBase. [default = chewbacca_pwd]\n"; 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_obt Maximum value for Packet OBT, after this value it is resetted. [default = 2^32 - 1]\n"; cout << "\t -orbit_number Value of the orbital number. If 0 this is retrieved from the input file name. [default = 0]\n"; cout << "\t -session_number Value of the session number. If 0 this is retrieved from the input file name. [default = 0]\n"; cout << "\t -time_Offset Value of the timeOffset. If 0 this is retrieved using the orbital number. [default = 0]\n"; cout << "\t -tryMerge if you want to try to Merge ROOT files\n"; - //marco_new_01 + //marco_new_01 cout << "\t -single_connection if you want to open only one connection to DB.\n"; - // cout << "\t -delta_Time set the allowed difference (seconds) in the Real Time between two root file. [default = 0]\n"; - + cout << "\t -tag if you want add the 'The owner of the file' - the tag lenght is 4 char\n"; + // cout << "\t -delta_Time set the allowed difference (seconds) in the Real Time between two root file. [default = 0]\n"; //cout << "\t -multi generate multiple root files \n"; exit(1); } @@ -491,7 +490,18 @@ db_pwd = argv[i]; continue; } - + if (!strcmp(argv[i], "-tag")){ + if (++i >= argc){ + cerr << "-tag needs arguments. \n"; + cout << "Try '-help' for more information. \n"; + exit(1); + } + int len=strlen(argv[i])>TAGVALUELEN?TAGVALUELEN:strlen(argv[i]); + strncpy(tag_value,argv[i],len); + tag_value[len]=0; + continue; + } + //TODO: check that multiFile is always 0 // if (!strcmp(argv[i], "-multi")){multiFile = 1; cout<<"debug: multi= "<logError(msg); - //non mi fido del contatore del route - + //non mi fido del contatore del route stringstream oss1; oss1<<"Route number unused = "<logAll(msg); } // is_new_route will be reset to false in PacketUser after the packet is used and stored - + + //main processing of the data, searching for Pamela Packets for(int i=0; ireadInput(ccData[i]); - iByte_tot++; - if(exitdbg==true){cout<<"**** DBG EXIT FOR****"<readInput(ccData[i]); + iByte_tot++; + if(exitdbg==true){cout<<"**** DBG EXIT FOR****"<