--- chewbacca/PamOffLineSW/PamOffLineSW_Main.cpp 2010/02/12 04:46:53 1.11 +++ chewbacca/PamOffLineSW/PamOffLineSW_Main.cpp 2010/02/16 14:02:38 1.15 @@ -1,5 +1,5 @@ //============================================================================ -// $Id: PamOffLineSW_Main.cpp,v 1.10 2010/02/11 09:02:10 mocchiut Exp $ +// $Id: PamOffLineSW_Main.cpp,v 1.14 2010/02/16 13:38:13 mocchiut Exp $ // Description : Pamela Off-Line Software //============================================================================ @@ -45,7 +45,9 @@ bool simulated_data = false; //bool do_vrl_check = false; //EMI bool do_vrl_check = true; //EMI - +int cclung = 0; + Bool_t headok = true; + Bool_t crcok = true; const char* db_host = ""; int db_port = 0; @@ -62,6 +64,7 @@ Long64_t filelength = 0LL; Long64_t streamposi = 0LL; Long64_t streamposisaved = 0LL; +Long64_t streamposiorig = 0LL; Int_t numposi = 10; Long64_t downcount = 1LL; TArrayL64 *dwin=new TArrayL64(12); @@ -254,7 +257,7 @@ continue; } - if (!strcmp(argv[i], "-time_Offset")){ + if (!strcmp(argv[i], "-time_Offset") || !strcmp(argv[i], "-time_offset") ){ if (++i >= argc){ cerr << "-time_Offset needs arguments. \n"; cout << "Try '-help' for more information. \n"; @@ -921,6 +924,8 @@ string sms = ss.str(); // mainLogUtil->logError(sms); // + headok = true; + crcok = true; if (!fin.good()) { //TODO: check here @@ -954,9 +959,19 @@ // // we completely missed more than 10 VRL packets // - if ( horrorcount > 10 && hc < 500 ){ - hc++; - //if ( horrorcount > 1 ){ + if ( hc == 1100 ){ + fin.seekg(streamposiorig); + stringstream os; + os<<" NEW (EM) UN-RECOVERABLE SYNC WITH VRL HEADERS, SIG! "; + os<<" new position in file, go back to "<logAll(ms); + hc++; + continue; + }; + if ( horrorcount > 10 && hc < 1100 ){ + hc++; + //if ( horrorcount > 1 ){ stringstream os; os<<" NEW (EM) THIS IS TOO MUCH, LOST SYNC WITH VRL HEADERS! try to recover horrorcount = "<logAll(msg); + crcok = false; route=old_route; } } + + // if ( !crcok && !headok ) skip_cadre = true; // useless + // if ( cclung != LENGTH_DATA_CADRE ) skip_cadre = true; // useless if(!skip_cadre) { @@ -1074,6 +1094,7 @@ //main processing of the data, searching for Pamela Packets +// printf(" cc lung %i lung def %i \n",cclung,LENGTH_DATA_CADRE); for(int i=0; ireadInput(ccData[i]); @@ -1158,8 +1179,10 @@ " This error occurred after byte: "<logAll(ms); + if ( !hc && !horrorcount ) streamposiorig = streamposi; horrorcount++; }; + headok = false; return false; }