]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes for task:
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 1 Jul 2012 12:23:37 +0000 (12:23 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 1 Jul 2012 12:23:37 +0000 (12:23 +0000)
[task #27425] CPass0/CPass1/VPass calibration readiness for 2012 data taking

Pass0/makeOCDB.C
          typo fix (member access operator)
CPass0/runCPass0.sh
          dont use run numer as string, use int, print to be executed commands to stdout
CPass0/mergeMakeOCDB.byComponent.sh
          download files in parallel to merging
CPass0/mergeMakeOCDB.sh
          remove obsolete code, fix string quotes to be more readable
CPass0/makeSyswatchCPass0.C
          add workaround for root bug in reading text files into TTree
CPass0/runCalibTrain.C
          run number now an int instead of string
CPass1/makeOCDB.C
          small bugfix in member access operator
CPass1/runCPass1.sh
          remove run number as string, use int
CPass1/mergeMakeOCDB.byComponent.sh
          downloading files in parallel to merging
CPass1/mergeMakeOCDB.sh
          feature sync with CPass0 equivalent
CPass1/runCalibTrain.C
          run number as int instead of string

Changes test
(Mikolaj)

PWGPP/CalibMacros/CPass0/makeOCDB.C
PWGPP/CalibMacros/CPass0/makeSyswatchCPass0.C
PWGPP/CalibMacros/CPass0/mergeMakeOCDB.byComponent.sh
PWGPP/CalibMacros/CPass0/mergeMakeOCDB.sh
PWGPP/CalibMacros/CPass0/runCPass0.sh
PWGPP/CalibMacros/CPass0/runCalibTrain.C
PWGPP/CalibMacros/CPass1/makeOCDB.C
PWGPP/CalibMacros/CPass1/mergeMakeOCDB.byComponent.sh
PWGPP/CalibMacros/CPass1/mergeMakeOCDB.sh
PWGPP/CalibMacros/CPass1/runCPass1.sh
PWGPP/CalibMacros/CPass1/runCalibTrain.C

index a41fdd65305a41202c58127bd72b44fe450d0346..06a3f5fc04b8a47f73bbd14884233438a5b98178 100644 (file)
@@ -127,7 +127,7 @@ void makeOCDB(Int_t runNumber, TString  ocdbStorage="", TString defaultOCDBstora
   Int_t trdStatus = (procesTRD) ?  procesTRD->GetStatus():0;
   Int_t tofStatus = (procesTOF) ?  procesTOF->GetStatus():0;
   Int_t t0Status  = (procesT0)  ?  procesT0->GetStatus():0;
-  Int_t tpcStatus = (procesTPC) ? ((procesTPC.ValidateTimeDrift() || procesTPC.ValidateTimeGain())==kFALSE):0;
+  Int_t tpcStatus = (procesTPC) ? ((procesTPC->ValidateTimeDrift() || procesTPC->ValidateTimeGain())==kFALSE):0;
   //
   printf("\n\n\n\n");
   printf("CPass0 calibration status\n");
index a83776b9e829b6488f9ef9818de96d1a32add3d4..702ab6f6a15b694d27453c4880d7bc28b9199c7d 100644 (file)
@@ -5,6 +5,7 @@ void makeSyswatchCPass0(const char * fname){
   //
   //
   //
+  gSystem->Exec("sed -i 's|\t| |g;s|[[:space:]]*$||' syswatch*.log");
   TFile * fout= new TFile(fname,"update");
   TTree * treeRec = AliSysInfo::MakeTree("syswatch_rec.log");
   TTree * treeCalib = AliSysInfo::MakeTree("syswatch_calib.log");
index ca973cd77ca6d8c17b42d9d06c6cc0bcec856522..5a47ecdd1e8b93e0ee7168c50a167e3bf022e9dc 100755 (executable)
@@ -41,6 +41,15 @@ partialLocalFileListPrefix=${localFileList}_
 partialAlienFileListPrefix=${alienFileList}_
 runningMergeByComponentLockFile="runningMergeByComponent.lock"
 
+makeAbsolutePathsInList()
+{
+  #make sure the files in the list have absolute paths
+  rm -f $2
+  while read file; do
+    readlink -f $file >> $2
+  done < $1
+}
+
 mergeByComponent()
 {
   # process by component
@@ -50,49 +59,92 @@ mergeByComponent()
   #lock
   touch $runningMergeByComponentLockFile
 
+  # run inside a dedicated running directory
+  # whic means copy the file list to process and prefic each line with ../
+  # since the file names have no absolute paths!
+  runningDirectory="${runningMergeByComponentLockFile}.${1}.dir"
+  parentDirectory=$PWD
+  fileList="$1.local"
+  mkdir -p $runningDirectory
+  makeAbsolutePathsInList $1 $runningDirectory/$fileList
+  cd $runningDirectory
+
+  #copy the macro from $parentDirectory 
+  [[ -f $parentDirectory/mergeByComponent.C ]] && cp $parentDirectory/mergeByComponent.C $PWD
+
   previousResults=PREVIOUS_ITERATION_CalibObjects.root
-  if [[ -f CalibObjects.root ]]; then
-    mv CalibObjects.root $previousResults
-    echo "$previousResults" >> $1
+  if [[ -f $parentDirectory/CalibObjects.root ]]; then
+    mv -f $parentDirectory/CalibObjects.root $previousResults
+    echo "$previousResults" >> $fileList
   fi
 
-  echo "####DEBUG" | tee -a merge.log
-  echo "####processed list $1" | tee -a merge.log
-  cat $1
-
   for det in $components; do
     # merge
-    echo "***********************" 2>&1 | tee -a merge.log
-    echo merging $det data 2>&1 | tee -a merge.log
-    echo "***********************" 2>&1 | tee -a merge.log
-    echo aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"$det\", \"$1\")" 2>&1 | tee -a merge.log
-    aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"$det\", \"$1\")" 2>&1 | tee -a merge.log
+    echo "***********************" 
+    echo merging $det data
+    echo "***********************"
+    echo aliroot -b -q "mergeByComponent.C(\"$det\", \"$fileList\")"
+    aliroot -b -q "mergeByComponent.C(\"$det\", \"$fileList\")"
     mv syswatch.log syswatch_merge_$det.log
     mv CalibObjects.root CalibObjects_$det.root
   done
   
-  rm -f $previousResults
-  
   # global merge
-  echo "***********************" 2>&1 | tee -a merge.log
-  echo merging ALL data 2>&1 | tee -a merge.log
-  echo "***********************" 2>&1 | tee -a merge.log
+  echo "***********************"
+  echo merging ALL data
+  echo "***********************"
   partialCalibObjectsList="objects.list.${1}"
   ls -1 CalibObjects_*.root > $partialCalibObjectsList
-  aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")" 2>&1 | tee -a merge.log
+  echo aliroot -b -q "mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")"
+  aliroot -b -q "mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")"
   mv syswatch.log syswatch_ALL.log
+  rm $partialCalibObjectsList
   
-  #cleanup
+  #cleanup of the merged files
   if [[ "$2" == "doCleanup" ]]; then
     while read filename; do
-      echo rm -f $filename | tee -a merge.log
+      echo rm -f $filename 
       rm -f $filename
-    done < $1
+    done < $fileList
   fi
+  rm -f $fileList
   rm -f CalibObjects_*.root
 
+  #move stuff back to the parent dir and clean up
+  #merge the syswatch logs
+  for x in syswatch*log; do
+    if [[ -f $parentDirectory/$x ]]
+    then 
+      echo "sed '1d' $x  >> $parentDirectory/$x"
+      sed '1d' $x >> $parentDirectory/$x
+      rm -f $x
+    else 
+      echo mv -f $x $parentDirectory/$x
+      mv -f $x $parentDirectory/$x
+    fi
+  done
+  #merge the other logs
+  for x in *.log; do
+    if [[ -f $parentDirectory/$x ]]
+    then
+      echo "cat $x >> $parentDirectory/$x"
+      cat $x >> $parentDirectory/$x
+    else
+      echo mv -f $x $parentDirectory/$x
+      mv -f $x $parentDirectory/$x
+    fi
+  done
+  #move the CalibObjects
+  echo mv -f CalibObjects.root $parentDirectory
+  mv -f CalibObjects.root $parentDirectory
+
+  #final cleanup
+  cd $parentDirectory
+  rm -rf $runningDirectory
+
   #unlock
   rm -f $runningMergeByComponentLockFile
+  echo "***mergeByComponent() DONE"
 }
 
 waitIfLocked()
@@ -103,29 +155,51 @@ waitIfLocked()
   done
 }
 
+copyScripts()
+{
+    [[ ! -f mergeByComponent.C ]] && \
+      cp -f $ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C $PWD && \
+      echo "taking the default scripts from $ALICE_ROOT"
+    [[ ! -f makeOCDB.C ]] && \
+      cp -f $ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C $PWD && \
+      echo "taking the default scripts from $ALICE_ROOT"
+}
+
 if [ $isLocal -eq 0 ]; then
+    #first, make sure we have the scripts
+    copyScripts | tee -a copy.log
+    ls
     #with alien files copy them first to local
-    echo "***********************" 2>&1 | tee -a merge.log
-    echo copying files for run $run 2>&1 | tee -a merge.log
-    echo from $path 2>&1 | tee -a merge.log
-    echo "***********************" 2>&1 | tee -a merge.log
-    aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a merge.log
-    split --numeric-suffixes --suffix-length=4 --lines=100 ${alienFileList} ${partialAlienFileListPrefix}
-    counter=0
+    echo "***********************" 2>&1 | tee -a copy.log
+    echo copying files for run $run 2>&1 | tee -a copy.log
+    echo from $path 2>&1 | tee -a copy.log
+    echo "***********************" 2>&1 | tee -a copy.log
+    echo aliroot -b -q "mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a copy.log
+    aliroot -b -q "mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a copy.log
+    echo split --numeric-suffixes --suffix-length=4 --lines=20 ${alienFileList} ${partialAlienFileListPrefix} | tee -a copy.log
+    split --numeric-suffixes --suffix-length=4 --lines=20 ${alienFileList} ${partialAlienFileListPrefix}
     rm -f $runningMergeByComponentLockFile
     for partialAlienFileList in ${partialAlienFileListPrefix}*
     do
       #copy the alien files to local
       partialAlienFileListPostfix=${partialAlienFileList#$partialAlienFileListPrefix}
       partialLocalFileList=${partialLocalFileListPrefix}${partialAlienFileListPostfix}
-      aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a merge.log
-      [[ $counter -ne 0 ]] && sed -i '1d' syswatch.log && $(( $counter++ ))
-      cat syswatch.log >> syswatch_copy.log
-      rm syswatch.log
+      echo aliroot -b -q "mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a copy.log
+      aliroot -b -q "mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a copy.log
+      
+      #handle syswatch
+      if [[ -f syswatch_copy.log ]]
+      then
+        sed '1d' syswatch.log >> syswatch_copy.log
+        rm -f syswatch.log
+      else 
+        mv syswatch.log syswatch_copy.log
+      fi
 
       #merge in parallel, use a simple lockfile
+      echo "waitIfLocked $runningMergeByComponentLockFile" | tee -a merge.log
       waitIfLocked $runningMergeByComponentLockFile
-      mergeByComponent $partialLocalFileList "doCleanup" &
+      mergeByComponent $partialLocalFileList "doCleanup" 2>&1 | tee -a merge.log &
     done
 else
   #locally just use the list directly
@@ -133,7 +207,6 @@ else
 fi;
 
 #cleanup
-cat ${partialAlienFileListPrefix}* >> ${localFileList}
 rm -f ${partialAlienFileListPrefix}*
 rm -f ${partialLocalFileListPrefix}*
 
@@ -141,7 +214,8 @@ rm -f ${partialLocalFileListPrefix}*
 echo "***********************" 2>&1 | tee -a ocdb.log
 echo making $det OCDB 2>&1 | tee -a ocdb.log
 echo "***********************" 2>&1 | tee -a ocdb.log
-aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
+echo aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
+aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
 mv syswatch.log syswatch_makeOCDB.log
 
 # summary
index 0c1e9d51e684a3b94917ebf1d975faa6e5f0967b..db77c407fb700bc665a69df05023363f02e0d402 100755 (executable)
@@ -23,19 +23,15 @@ outputOCDB=$3
 defaultOCDB="raw://"
 [[ -n $4 ]] && defaultOCDB=$4
 
-# if fifth argument given it is a runnuber, otherwise guess from path (when ran on alien)
-runNumber=$(echo $1 | cut -d "/" -f 6 | sed 's/^0*//')
-[[ -n $5 ]] && runNumber=$5
-
 if [ -f Run0_999999999_v3_s0.root ]; then
     mkdir -p TPC/Calib/Correction
     mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
 fi
 
 echo ">>>>>>> Running AliRoot to merge calib objects found in $path with pattern AliESDfriends_v1.root"
-aliroot -l -b -q merge.C\(\"$path\",\"AliESDfriends_v1.root\"\) 2>&1 | tee merge.log
+aliroot -l -b -q "merge.C(\"$path\",\"AliESDfriends_v1.root\")" 2>&1 | tee merge.log
 mv syswatch.log syswatch_merge.log
 
 echo ">>>>>>> Extract OCDB entries for run = $runNumber, to be stored in $outputOCDB"
-aliroot -l -b -q makeOCDB.C\($runNumber,\"$outputOCDB\",\"$defaultOCDB\"\) 2>&1 | tee ocdb.log
+aliroot -l -b -q "makeOCDB.C($runNumber,\"$outputOCDB\",\"$defaultOCDB\")" 2>&1 | tee ocdb.log
 mv syswatch.log syswatch_makeOCDB.log
index df85b81cd044ceee285682069cfffd5913f44e98..2b2e1111c6f3e0485d6f65a417d6de34e1ed69e7 100644 (file)
@@ -71,9 +71,12 @@ echo ">>>>>>> Running AliRoot to reconstruct $1. Run number is $runNum..."
 
 aliroot -l -b -q "recCPass0.C(\"$fileName\", $nEvents, \"$ocdbPath\", \"$triggerOption\")" 2>&1 | tee rec.log
 mv syswatch.log syswatch_rec.log
+echo "directory contents:"
+ls
 
 echo ">>>>>>> Running AliRoot to make calibration..."
-aliroot -l -b -q runCalibTrain.C\(\""$runNum\",\"AliESDs.root\",\"$ocdbPath"\"\)   2>&1 | tee calib.log
+echo "aliroot -l -b -q runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")"
+aliroot -l -b -q "runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")"   2>&1 | tee calib.log
 mv syswatch.log syswatch_calib.log
 
 echo ">>>>>>> Extracting system information..."
index 7e15892a253517b5d9ca57a8237d0fdc0e2afd6c..8ca7e21c02ccd801f6e89604ed5049fb605d3a2f 100644 (file)
@@ -11,7 +11,7 @@
   runCalibTrain("104892");
 */
 
-void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
+void runCalibTrain(Int_t runNumber, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
 {
   //
   // macro to run TPC calibration train 
@@ -37,7 +37,6 @@ void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.ro
 
   // config calibration train
   // setting geometry and B-field from GRP
-  Int_t runNumber = runNumberString.Atoi();
   printf("runNumber from runCalibTrain = %d\n",runNumber);
   printf("ocdb from runCalibTrain = %s\n",ocdb);
   ConfigCalibTrain(runNumber, ocdb);
index 8376d76d65af94d30e1f22f2bf99ba1c5f0f266c..b75b009aca7e0848c5943e7a98239dddf7d3bc77 100644 (file)
@@ -131,7 +131,7 @@ void makeOCDB(Int_t runNumber, TString  ocdbStorage="", TString defaultOCDBstora
   Int_t trdStatus = (procesTRD) ?  procesTRD->GetStatus():0;
   Int_t tofStatus = (procesTOF) ?  procesTOF->GetStatus():0;
   Int_t t0Status  = (procesT0)  ?  procesT0->GetStatus():0;
-  Int_t tpcStatus = (procesTPC) ? ((procesTPC.ValidateTimeDrift() || procesTPC.ValidateTimeGain())==kFALSE):0;
+  Int_t tpcStatus = (procesTPC) ? ((procesTPC->ValidateTimeDrift() || procesTPC->ValidateTimeGain())==kFALSE):0;
   //
   printf("\n\n\n\n");
   printf("CPass1 calibration status\n");
index ca973cd77ca6d8c17b42d9d06c6cc0bcec856522..e62d8447b627bce8970ac2c61036f1d5cc54b45d 100755 (executable)
@@ -41,6 +41,15 @@ partialLocalFileListPrefix=${localFileList}_
 partialAlienFileListPrefix=${alienFileList}_
 runningMergeByComponentLockFile="runningMergeByComponent.lock"
 
+makeAbsolutePathsInList()
+{
+  #make sure the files in the list have absolute paths
+  rm -f $2
+  while read file; do
+    readlink -f $file >> $2
+  done < $1
+}
+
 mergeByComponent()
 {
   # process by component
@@ -50,23 +59,33 @@ mergeByComponent()
   #lock
   touch $runningMergeByComponentLockFile
 
+  # run inside a dedicated running directory
+  # whic means copy the file list to process and prefic each line with ../
+  # since the file names have no absolute paths!
+  runningDirectory="${runningMergeByComponentLockFile}.${1}.dir"
+  parentDirectory=$PWD
+  fileList="$1.local"
+  mkdir -p $runningDirectory
+  makeAbsolutePathsInList $1 $runningDirectory/$fileList
+  cd $runningDirectory
+
   previousResults=PREVIOUS_ITERATION_CalibObjects.root
-  if [[ -f CalibObjects.root ]]; then
-    mv CalibObjects.root $previousResults
-    echo "$previousResults" >> $1
+  if [[ -f $parentDirectory/CalibObjects.root ]]; then
+    mv $parentDirectory/CalibObjects.root $previousResults
+    echo "$previousResults" >> $fileList
   fi
 
   echo "####DEBUG" | tee -a merge.log
-  echo "####processed list $1" | tee -a merge.log
-  cat $1
+  echo "####processed list $fileList" | tee -a merge.log
+  cat $fileList | tee -a merge.log
 
   for det in $components; do
     # merge
     echo "***********************" 2>&1 | tee -a merge.log
     echo merging $det data 2>&1 | tee -a merge.log
     echo "***********************" 2>&1 | tee -a merge.log
-    echo aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"$det\", \"$1\")" 2>&1 | tee -a merge.log
-    aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"$det\", \"$1\")" 2>&1 | tee -a merge.log
+    echo aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"$det\", \"$fileList\")" 2>&1 | tee -a merge.log
+    aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"$det\", \"$fileList\")" 2>&1 | tee -a merge.log
     mv syswatch.log syswatch_merge_$det.log
     mv CalibObjects.root CalibObjects_$det.root
   done
@@ -79,7 +98,7 @@ mergeByComponent()
   echo "***********************" 2>&1 | tee -a merge.log
   partialCalibObjectsList="objects.list.${1}"
   ls -1 CalibObjects_*.root > $partialCalibObjectsList
-  aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")" 2>&1 | tee -a merge.log
+  aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")" 2>&1 | tee -a merge.log
   mv syswatch.log syswatch_ALL.log
   
   #cleanup
@@ -87,9 +106,25 @@ mergeByComponent()
     while read filename; do
       echo rm -f $filename | tee -a merge.log
       rm -f $filename
-    done < $1
+    done < $fileList
   fi
   rm -f CalibObjects_*.root
+  rm -f $fileList
+
+  #move stuff back to the parent dir and clean up
+  #merge the syswatch logs
+  for x in syswatch*log; do
+    if [[ -f $parentDirectory/$x ]]
+    then 
+      sed '1d' >> $parentDirectory/$x
+      rm -f $x
+    else 
+      mv $x $parentDirectory/$x
+    fi
+  done
+  mv * $parentDirectory
+  cd $parentDirectory
+  rm -rf $runningDirectory
 
   #unlock
   rm -f $runningMergeByComponentLockFile
@@ -109,19 +144,24 @@ if [ $isLocal -eq 0 ]; then
     echo copying files for run $run 2>&1 | tee -a merge.log
     echo from $path 2>&1 | tee -a merge.log
     echo "***********************" 2>&1 | tee -a merge.log
-    aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a merge.log
-    split --numeric-suffixes --suffix-length=4 --lines=100 ${alienFileList} ${partialAlienFileListPrefix}
-    counter=0
+    aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a merge.log
+    split --numeric-suffixes --suffix-length=4 --lines=20 ${alienFileList} ${partialAlienFileListPrefix}
     rm -f $runningMergeByComponentLockFile
     for partialAlienFileList in ${partialAlienFileListPrefix}*
     do
       #copy the alien files to local
       partialAlienFileListPostfix=${partialAlienFileList#$partialAlienFileListPrefix}
       partialLocalFileList=${partialLocalFileListPrefix}${partialAlienFileListPostfix}
-      aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a merge.log
-      [[ $counter -ne 0 ]] && sed -i '1d' syswatch.log && $(( $counter++ ))
-      cat syswatch.log >> syswatch_copy.log
-      rm syswatch.log
+      aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a merge.log
+      
+      #handle syswatch
+      if [[ -f syswatch_copy.log ]]
+      then
+        sed '1d' syswatch.log >> syswatch_copy.log
+        rm -f syswatch.log
+      else 
+        mv syswatch.log syswatch_copy.log
+      fi
 
       #merge in parallel, use a simple lockfile
       waitIfLocked $runningMergeByComponentLockFile
@@ -141,7 +181,7 @@ rm -f ${partialLocalFileListPrefix}*
 echo "***********************" 2>&1 | tee -a ocdb.log
 echo making $det OCDB 2>&1 | tee -a ocdb.log
 echo "***********************" 2>&1 | tee -a ocdb.log
-aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
+aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
 mv syswatch.log syswatch_makeOCDB.log
 
 # summary
index fd5dcc9c66d0d641b104088cd0ca7ebad8b97284..db77c407fb700bc665a69df05023363f02e0d402 100755 (executable)
@@ -3,26 +3,35 @@
 # Script to merge objects coming out of the calibration train:
 # Arguments:
 #    1 - directory on which to look for the files to be merged 
-#    2 - pattern
+#    2 - runNumber
 #    3 - OCDB output path
+#    [4 - default OCDB]
 
 # example:
-# mergeMakeOCDB.sh /alice/cern.ch/user/a/aliprod/CPass1/output/ 000120691 alien://folder=/alice/cern.ch/user/a/aliprod/CPass0/output
+# mergeMakeOCDB.sh /alice/cern.ch/user/a/aliprod/CPass0/output/ 120691 alien://folder=/alice/cern.ch/user/a/aliprod/CPass0/output
 
 #ALIEN setting
 # $1 = directory where to perform the find 
-# $2 = pattern
+# $2 = runNumber
 # $3 = OCDB path
 
+path=$1
+runNumber=$2
+outputOCDB=$3
+
+# if fourth argument given, its the default OCDB, otherwise use the default raw://
+defaultOCDB="raw://"
+[[ -n $4 ]] && defaultOCDB=$4
+
 if [ -f Run0_999999999_v3_s0.root ]; then
     mkdir -p TPC/Calib/Correction
     mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
 fi
 
-echo ">>>>>>> Running AliRoot to merge calib objects found in $1 with pattern AliESDfriends_v1.root"
-aliroot -l -b -q merge.C\(\"$1\",\"AliESDfriends_v1.root\"\) 2>&1 | tee merge.log
+echo ">>>>>>> Running AliRoot to merge calib objects found in $path with pattern AliESDfriends_v1.root"
+aliroot -l -b -q "merge.C(\"$path\",\"AliESDfriends_v1.root\")" 2>&1 | tee merge.log
 mv syswatch.log syswatch_merge.log
 
-echo ">>>>>>> Extract OCDB entries for run = $2, to be stored in $3"
-aliroot -l -b -q makeOCDB.C\(\"$2\",\"$3\"\) 2>&1 | tee ocdb.log
+echo ">>>>>>> Extract OCDB entries for run = $runNumber, to be stored in $outputOCDB"
+aliroot -l -b -q "makeOCDB.C($runNumber,\"$outputOCDB\",\"$defaultOCDB\")" 2>&1 | tee ocdb.log
 mv syswatch.log syswatch_makeOCDB.log
index 0f43d884c85dce16c31d673747fe59d3dbec7fa0..d3b4a89ff0a3d914d6f7b25eeee80261440929e6 100755 (executable)
@@ -78,7 +78,7 @@ time aliroot -l -b -q "../recCPass1.C(\"$fileName\", $nEvents, \"$ocdbPath\", \"
 mv syswatch.log syswatch_rec_Barrel.log
 
 echo ">>>>>>> Running AliRoot to make calibration..."
-time aliroot -l -b -q ../runCalibTrain.C\(\""$runNum\",\"AliESDs.root\",\"$ocdbPath"\"\)   2>&1 | tee calib.log
+time aliroot -l -b -q "../runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")"   2>&1 | tee calib.log
 mv syswatch.log syswatch_calib.log
 echo ">>>>>>> Doing ls -l"
 ls -l
index bbed8e4e08fd980f942475cfa0e95e4c10a436dc..e325cbd05d8bdc9300aed6180bb213908dd75b3e 100644 (file)
@@ -11,7 +11,7 @@
   runCalibTrain("104892");
 */
 
-void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
+void runCalibTrain(Int_t runNumber, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
 {
   //
   // macro to run TPC calibration train 
@@ -37,7 +37,6 @@ void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.ro
 
   // config calibration train
   // setting geometry and B-field from GRP
-  Int_t runNumber = runNumberString.Atoi();
   printf("runNumber from runCalibTrain = %d\n",runNumber);
   printf("ocdb from runCalibTrain = %s\n",ocdb);
   ConfigCalibTrain(runNumber, ocdb);