--- chewbacca/YodaProfiler/src/YodaProfiler.cpp	2008/09/25 12:13:55	1.2
+++ chewbacca/YodaProfiler/src/YodaProfiler.cpp	2008/12/22 10:38:15	1.5
@@ -24,7 +24,9 @@
   printf(" -v | --verbose  be verbose [default]\n");
   printf(" -s | --silent   print nothing on STDOUT\n");
   printf(" -g | --debug    be very verbose [default: no]\n");
-  printf(" -p | --pedantic be strict in checks, exit with error if any problem is found [default: no]\n");
+  printf(" -p | --pedantic be strict in checks, exit with error if any problem is found [default: yes]\n");
+  printf(" -np | --no-pedantic do NOT be strict in checks, try to continue if any problem is found [default: no]\n");
+  printf(" -tag char       set the run tagging in _RUNID_GEN to \"char\" (four letters)[default = 'NONE']\n");
   printf(" -boot number    CPU boot number [default = taken from VarDump]\n");
   printf(" -autoboot       if no VarDump found try to determine the BOOT number\n");
   printf("                 looking at timesync [default]\n");
@@ -33,6 +35,9 @@
   printf(" -obt0 number    obt at timesync (ms) [default = taken from data]\n");
   printf(" -dworbit number number is the downlink orbit number (to be used with non-standard names)\n");
   printf(" -static         use static path inside the DB instead of symbolic names\n");
+  //  printf(" -keepenv        use environmental variables in the filenames\n");
+  printf(" -k | --keepenv  use environmental variables in the filenames [default]\n");
+  printf(" -nk | --no-keepenv  use PAM_L0 or standard filenames\n");
   //  printf(" -gpamela        shortcut to \"-clean 0 -obt0 1 -tsync 1 -no-autoboot -boot 1 -dworbit 1 -static\"\n");
   printf(" -gpamela        shortcut to \"-clean 0 -obt0 1 -no-autoboot -dworbit 1 -static\"\n");
   printf(" -clean number   number in seconds after which the fragment table\n");
@@ -81,6 +86,7 @@
   Bool_t runpieces = false;
   //
   //
+  TString tag = "NONE";
   TString filerawname  = "";
   TString filerootname = "";
   //
@@ -103,6 +109,7 @@
   //    
   Bool_t chewbacca = false;
   Bool_t staticp = false; 
+  Bool_t keepenv = true; 
   Bool_t beverbose = true;
   Bool_t debug = false;
   Bool_t autoboot = true;
@@ -123,7 +130,7 @@
   //
   Bool_t check = false;
   //
-  Bool_t pedantic = false;
+  Bool_t pedantic = true;
   //
   Int_t i = 0;
   //
@@ -145,7 +152,7 @@
 	};
 	filerawname = (TString)inps[i+1];		
       };
-      if ( !strcmp(inps[i],"-yodaFile") ) {
+      if ( !strcmp(inps[i],"-yodaFile") || !strcmp(inps[i],"-L0File") ) {
 	if ( numinp-1 < i+1 ){
 	  usage();
 	  exit(1);
@@ -172,6 +179,13 @@
 	fcleanfile = (TString)inps[i+1];	
 	forceclean = true;
       };
+     if ( !strcmp(inps[i],"-tag") ) {
+	if ( numinp-1 < i+1 ){
+	  usage();
+	  exit(1);
+	};
+	tag = (TString)inps[i+1];	
+      };
      if ( !strcmp(inps[i],"-validate") ) {
 	if ( numinp-1 < i+1 ){
 	  usage();
@@ -189,6 +203,12 @@
       if ( !strcmp(inps[i],"-static") ) {
 	staticp = true;
       };
+      if ( !strcmp(inps[i],"-k") || !strcmp(inps[i],"--keepenv") ) {
+	keepenv = true;
+      };
+      if ( !strcmp(inps[i],"-nk") || !strcmp(inps[i],"--no-keepenv") ) {
+	keepenv = false;
+      };
       if ( !strcmp(inps[i],"-autoboot") ) {
 	autoboot = true;
       };
@@ -285,6 +305,8 @@
       //
       if ( !strcmp(inps[i],"-p") || !strcmp(inps[i],"--pedantic") ) pedantic = true;
       //
+      if ( !strcmp(inps[i],"-np") || !strcmp(inps[i],"--no-pedantic") ) pedantic = false;
+      //
       if ( !strcmp(inps[i],"-nofrag") ) nofrag = true;
       //
       if ( !strcmp(inps[i],"-check") ) check = true;
@@ -387,10 +409,11 @@
     // Create pamDB object and open SQL connection
     //-------------------------------------------------------------------------------------------
     if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");
-    pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename,dwinput,staticp,gpamela);
+    pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename,dwinput,staticp,gpamela,keepenv);
     pamDB->CheckConnection();
     pamDB->LockTables();
     pamDB->OpenL0File(filerootname);
+    pamDB->SetTag(tag);
     //-------------------------------------------------------------------------------------------
     //
     //
@@ -601,6 +624,8 @@
     case -89: message += " PEDANTIC: CANNOT FIND PKT/OBT SEQUENCE IN THE POINTED FILE"; break;
     case -90: message += " No PhysEndRun tree in the file"; break;
     case -91: message += " PEDANTIC: Repetition of PhysEndRun data"; break;
+    case -92: message += " CHEWBACCA: cannot find Resurs time zero used by chewbacca in the GL_RESURS_OFFSET table"; break;
+    case -100: message += " Cannot open calibration files to check repeated calibration"; break;
     default: message += " Unidentified error"; break;
     };
     printf("\n");