From: cvetan Date: Thu, 20 Mar 2008 09:04:15 +0000 (+0000) Subject: From v4-11-Release: fixes in rec.C for the cosmic data + new dialog based shell scrip... X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=21d4a8d15d73f222ad4aba7cffa316925e0c6e60 From v4-11-Release: fixes in rec.C for the cosmic data + new dialog based shell script to process raw-data chunk from a given run (Marco) --- diff --git a/test/cosmic/rec.C b/test/cosmic/rec.C index 124bc78f8d4..c66a10f6d29 100644 --- a/test/cosmic/rec.C +++ b/test/cosmic/rec.C @@ -1,57 +1,5 @@ -void rec(Int_t runNumber = 0, const char* year = "08", const char *localFileName = NULL) +void rec(const char *filename="raw.root") { - // Offline shifter reconstruction macro - - TString filename; - - if (!localFileName) { - - cout << "Going to run the reconstruction for run: " << runNumber << endl; - - // connect to the grid - TGrid * grid = 0x0 ; - grid = TGrid::Connect("alien://") ; - - // make the file name pattern year and run number - TString pattern; - pattern.Form("%9d",runNumber); - pattern.ReplaceAll(" ", "0") ; - pattern.Prepend(year); - pattern.Append("*0.root"); - - // find the files associated to this run - // get the list of files from AliEn directly - TString baseDir; - baseDir.Form("/alice/data/20%s/",year); - - cout << "Looking for raw-data files with pattern " << pattern << " in folder " << baseDir << endl; - - TGridResult *result = grid->Query(baseDir, pattern); - - TList *fileList = result->GetFileInfoList(); - - cout << fileList->GetEntries() << " raw-data files found" << endl; - if ( fileList->GetEntries() == 0) { - cout << "Exiting..." << endl; - return; - } - - // Take the first (or last?) file... - TFileInfo *fi = (TFileInfo *)fileList->At(0); - // TFileInfo *fi = (TFileInfo *)fileList->At(fileList->GetEntries()-1); - - cout << "Getting the file:" << fi->GetCurrentUrl()->GetUrl() << endl; - fi->Dump(); - - filename = fi->GetCurrentUrl()->GetUrl(); - } - else { - // In case of local raw-data file... - filename = localFileName; - } - - AliLog::Flush(); - ///////////////////////////////////////////////////////////////////////////////////////// // // First version of the reconstruction @@ -132,7 +80,7 @@ void rec(Int_t runNumber = 0, const char* year = "08", const char *localFileName rec.SetUniformFieldTracking(kFALSE); rec.SetWriteESDfriend(kTRUE); rec.SetWriteAlignmentData(); - rec.SetInput(filename.Data()); + rec.SetInput(filename); rec.SetRunReconstruction("ALL"); rec.SetUseTrackingErrorsForAlignment("ITS"); diff --git a/test/cosmic/rec.sh b/test/cosmic/rec.sh new file mode 100755 index 00000000000..d235ec62196 --- /dev/null +++ b/test/cosmic/rec.sh @@ -0,0 +1,69 @@ +#!/bin/sh +############################################################################# +# rec.sh. Front-end script to run reconstruction from the grid chunks +# Usage: +# ./rec.sh +############################################################################# +# +# 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