-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
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
--- /dev/null
+#!/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