]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
From v4-11-Release: fixes in rec.C for the cosmic data + new dialog based shell scrip...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Mar 2008 09:04:15 +0000 (09:04 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Mar 2008 09:04:15 +0000 (09:04 +0000)
test/cosmic/rec.C
test/cosmic/rec.sh [new file with mode: 0755]

index 124bc78f8d459ea6c0f1f164662584a4c6de61e4..c66a10f6d2942107da2dd28199596c4443bde9da 100644 (file)
@@ -1,57 +1,5 @@
-void rec(Int_t runNumber = 0, const char* year = "08", const char *localFileName = NULL)\r
+void rec(const char *filename="raw.root")\r
 {\r
-  // Offline shifter reconstruction macro\r
-\r
-  TString filename;\r
-\r
-  if (!localFileName) {\r
-\r
-    cout << "Going to run the reconstruction for run: " << runNumber << endl;\r
-\r
-    // connect to the grid \r
-    TGrid * grid = 0x0 ; \r
-    grid = TGrid::Connect("alien://") ; \r
-               \r
-    // make the file name pattern year and run number\r
-    TString pattern;\r
-    pattern.Form("%9d",runNumber);\r
-    pattern.ReplaceAll(" ", "0") ; \r
-    pattern.Prepend(year);\r
-    pattern.Append("*0.root");\r
-\r
-    // find the files associated to this run\r
-    // get the list of files from AliEn directly \r
-    TString baseDir; \r
-    baseDir.Form("/alice/data/20%s/",year);\r
-\r
-    cout << "Looking for raw-data files with pattern " << pattern << " in folder " << baseDir << endl;\r
-\r
-    TGridResult *result = grid->Query(baseDir, pattern);\r
-\r
-    TList *fileList = result->GetFileInfoList();\r
-\r
-    cout << fileList->GetEntries() << " raw-data files found" << endl;\r
-    if ( fileList->GetEntries() == 0) {\r
-      cout << "Exiting..." << endl;\r
-      return;\r
-    }\r
-\r
-    // Take the first (or last?) file...\r
-    TFileInfo *fi =  (TFileInfo *)fileList->At(0); \r
-    //  TFileInfo *fi =  (TFileInfo *)fileList->At(fileList->GetEntries()-1); \r
-\r
-    cout << "Getting the file:" << fi->GetCurrentUrl()->GetUrl() << endl;\r
-    fi->Dump();\r
-\r
-    filename = fi->GetCurrentUrl()->GetUrl();\r
-  }\r
-  else {\r
-    // In case of local raw-data file...\r
-    filename = localFileName;\r
-  }\r
-\r
-  AliLog::Flush();\r
-\r
   /////////////////////////////////////////////////////////////////////////////////////////\r
   //\r
   // First version of the reconstruction\r
@@ -132,7 +80,7 @@ void rec(Int_t runNumber = 0, const char* year = "08", const char *localFileName
   rec.SetUniformFieldTracking(kFALSE);\r
   rec.SetWriteESDfriend(kTRUE);\r
   rec.SetWriteAlignmentData();\r
-  rec.SetInput(filename.Data());\r
+  rec.SetInput(filename);\r
   rec.SetRunReconstruction("ALL");\r
   rec.SetUseTrackingErrorsForAlignment("ITS");\r
 \r
diff --git a/test/cosmic/rec.sh b/test/cosmic/rec.sh
new file mode 100755 (executable)
index 0000000..d235ec6
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+#############################################################################
+# rec.sh. Front-end script to run reconstruction from the grid chunks
+# Usage:
+#    ./rec.sh <run_number>
+#############################################################################
+#
+# modification history
+# version 1.0  2008/03/04 02:12  Marco Meoni
+
+# SET THE FOLLOWING PARAMETERS IF NEEDED: 
+# ---------------------------------------
+YEAR=08
+ALIENBIN=$ALIEN_ROOT/bin
+DIALOG=${DIALOG=dialog}
+PATH=$PATH:$ALIEN_ROOT/api/bin
+#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/alien/api/lib
+# ---------------------------------------
+
+RUNNUM=$1
+
+if [ -z $RUNNUM ]; then
+   echo "Please provide a run number..."
+   exit
+fi
+
+[ -e $ALIENBIN/alien ] || { echo "Cannot find AliEn client: missing ALIEN_ROOT environment variable and/or AliEn installation..."; exit 1; }
+
+VERSION=1.0
+TITLE="Standalone reconstruction of Grid rawdata chunks. v$VERSION"
+ALIEN="$ALIENBIN/alien login -exec"
+
+# Retrieve the list of chunks from AliEn.......
+BASEDIR="/alice/data/20"$YEAR
+PATTERN=$YEAR"0000"$RUNNUM"*0.root"
+
+$ALIEN " find $BASEDIR $PATTERN" > collection.tmp
+[ $(stat -c%s collection.tmp) -eq 0 ] && { echo "No chunks found for the given run"; exit 1; }
+list=`cat collection.tmp | awk '{printf("%s %s %s ",$1,"  .","0");}'`
+rm -f collection.tmp
+
+totChunks=`echo $list | wc -w`; totChunks=`echo \($totChunks / 3\) | bc`
+
+tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
+trap "rm -f $tempfile" 0 1 2 5 15
+
+$DIALOG --clear --no-cancel --title "$TITLE" \
+        --ok-label OK --checklist "$totChunks chunks available. Select chunks for reconstruction" 18 74 10 \
+        $list 2> $tempfile
+
+CHUNKS=`cat $tempfile`" ."
+echo "Selected chunks:"
+echo $CHUNKS
+echo
+
+alien-token-init
+. /tmp/gclient_env_$UID
+
+echo $CHUNKS | while read -d " " filename; do 
+     filename=${filename//\"/} 
+     CHUNK=`echo $filename | cut -d "/" -f 8 | cut -d "." -f 1,2 | cut -c 12-14,16-`
+
+     echo "Running AliRoot reconstruction for chunk $filename. Outputs will be stored in "$RUNNUM"/"$CHUNK"."
+     rm -rf   $RUNNUM"/"$CHUNK
+     mkdir -p $RUNNUM"/"$CHUNK
+     cd       $RUNNUM"/"$CHUNK
+     aliroot -b -q ../../rec.C\(\"alien://$filename\"\) 2>&1 | tee rec.log
+     cd ../..
+done