Adding config for acr caf
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 31 Oct 2009 14:12:58 +0000 (14:12 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 31 Oct 2009 14:12:58 +0000 (14:12 +0000)
prod/acrcaf/rec.sh [new file with mode: 0755]
prod/acrcaf/reco/prepareAlienCollection.sh [new file with mode: 0755]
prod/acrcaf/reco/rec.C [new file with mode: 0644]
prod/acrcaf/reco/run.C [new file with mode: 0644]

diff --git a/prod/acrcaf/rec.sh b/prod/acrcaf/rec.sh
new file mode 100755 (executable)
index 0000000..5bce4c7
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+
+if [ "$1" == "-local" ] && [ ! -z $2 ]
+then
+    
+  nev=${3:-10000}
+  fev=${4:-0}
+
+  cd reco/local
+  mkdir -p run$2
+  rm -f run$2/*
+  cd run$2
+  
+  echo "Reconstructing into reco/local/run$2 and redirecting output to the file reco/local/run$2/stdout"
+
+  unbuffer aliroot -q ../../rec.C\($2,$nev,$fev\) 2>&1 | tee stdout
+
+else
+
+  if [ "$1" != "-force" ]
+  then
+    pgrep aliroot > /dev/null
+    if [ "$?" -eq "0" ]
+    then
+      echo "Error: You can only start one rec.sh at a time. Please wait for the other session to terminate or close it."
+      exit
+    fi
+  else
+    shift
+  fi
+
+  [ -z $1 ] && { echo "Usage: rec.sh [-local] <run_number>"; exit 1; }
+
+  nev=${2:-10000}
+  fev=${3:-0}
+
+  cd reco
+  aliroot -q run.C\($1,$nev,$fev\)
+
+fi
diff --git a/prod/acrcaf/reco/prepareAlienCollection.sh b/prod/acrcaf/reco/prepareAlienCollection.sh
new file mode 100755 (executable)
index 0000000..23e82dc
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+#############################################################################
+# prepareCollection.sh. Script to prepare a raw-data chunks collection
+# for a given run
+# Usage:
+#    ./prepareCollection.sh <run_number> <collection_file>
+#############################################################################
+#
+# modification history
+# version 1.0  2008/09/12 Cvetan Cheshkov
+
+# SET THE FOLLOWING PARAMETERS IF NEEDED: 
+# ---------------------------------------
+YEAR=09
+# ---------------------------------------
+
+RUNNUM=$1
+
+[ -z $RUNNUM ] && { echo "Please provide a run number..."; exit 1; }
+
+OUTFILE=$2
+
+[ -z $OUTFILE ] && { echo "Please provide an output filename..."; exit 1; }
+
+[ ! -e "$HOME/.globus/usercert.pem" ] && { echo "FAILED: There is no certificate in $HOME/.globus"; exit 1; }
+
+[ -e "/tmp/gclient_env_$UID" ] && { source /tmp/gclient_env_$UID; }
+alien-token-init 
+
+[ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; }
+
+# Retrieve the list of chunks from AliEn.......
+BASEDIR="/alice/data/20"$YEAR
+PATTERN="/raw/"$YEAR"0000"$RUNNUM"*0.root"
+rm -f collection.tmp
+gbbox find $BASEDIR $PATTERN | grep -v found | head --lines=-1 > collection.tmp
+
+[ $(stat -c%s collection.tmp) -eq 0 ] && { echo "No chunks found for the given run"; exit 1; }
+
+rm -f $OUTFILE
+for ifile in `cat collection.tmp` ; do echo "alien://$ifile" >> $OUTFILE 2>&1; done
+rm -f collection.tmp
+
+echo `cat $OUTFILE | wc -l`" raw-data chunks are found and added to the collection file "$OUTFILE;
+
diff --git a/prod/acrcaf/reco/rec.C b/prod/acrcaf/reco/rec.C
new file mode 100644 (file)
index 0000000..ecaec08
--- /dev/null
@@ -0,0 +1,38 @@
+void rec(Int_t runNumber, Int_t nev=10000, Int_t firstev=0)\r
+{\r
+  gSystem->Load("libRAliEn.so");\r
+  gSystem->Load("libNet.so");\r
+\r
+  // Set the CDB storage location\r
+  AliCDBManager * man = AliCDBManager::Instance();\r
+  man->SetDefaultStorage("raw://");\r
+  \r
+  // Reconstruction settings\r
+  AliReconstruction rec;\r
+\r
+  // QA options\r
+  rec.SetRunQA(":") ;\r
+  rec.SetRunGlobalQA(kFALSE);\r
+  rec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;\r
+\r
+  // AliReconstruction settings\r
+  rec.SetWriteESDfriend(kTRUE);\r
+  rec.SetWriteAlignmentData();\r
+  rec.SetInput(Form("raw://run%d",runNumber));\r
+//  rec.SetRunReconstruction("ALL -HLT -PMD -MUON -PHOS");\r
+  rec.SetRunReconstruction("ALL");\r
+  rec.SetUseTrackingErrorsForAlignment("ITS");\r
+\r
+  Int_t lastev=nev+firstev-1;\r
+  rec.SetEventRange(0,lastev);\r
+\r
+  // high flux settings (for injection test runs)\r
+  // rec.SetRecoParam("ITS", AliITSRecoParam::GetHighFluxParam());\r
+\r
+  // switch off cleanESD\r
+  rec.SetCleanESD(kFALSE);\r
+\r
+  rec.SetOutput(Form("root_archive.zip#AliESDs.root:AliESDs.root,AliESDfriends.root@dataset://run%d",runNumber));\r
+\r
+  rec.Run();\r
+}\r
diff --git a/prod/acrcaf/reco/run.C b/prod/acrcaf/reco/run.C
new file mode 100644 (file)
index 0000000..b43a8ef
--- /dev/null
@@ -0,0 +1,59 @@
+void run(Int_t runNumber,Int_t nev=10000, Int_t firstev=0)
+{
+  gEnv->SetValue("XSec.GSI.DelegProxy","2");
+  // Select ROOT version
+  TProof::Mgr("aliprod@alicecaf")->SetROOTVersion("v5-24-00b-caf");
+  // Login to CAF
+  TProof::Open("aliprod@alicecaf");
+
+  // Enable AliRoot
+  gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-17-Release.rec/AF-v4-17-rec.par");
+  gProof->EnablePackage("AF-v4-17-rec.par");
+
+  gSystem->Load("libMonaLisa.so");
+  TMonaLisaWriter monalisa("pcalishuttle02.cern.ch",
+                          "SHIFTER_RECO_CAF");
+  SendMonaLisaData(&monalisa,runNumber,"Started",0);
+
+  // Temporary fix in order to avoid timeouts on the master
+  gProof->SetParameter("PROOF_PacketAsAFraction",20);
+
+  // Run reconstruction
+  gROOT->LoadMacro("rec.C");
+  gROOT->ProcessLine(Form("rec(%d,%d,%d);",runNumber,nev,firstev));
+
+  TProof::Mgr("aliprod@alicecaf")->GetSessionLogs()->Save("*",Form("log/run%d.log",runNumber));
+
+  // Check the produced dataset
+  TFileCollection *coll = gProof->GetDataSet(Form("run%d",runNumber));
+  if (coll) {
+    Int_t nEvents = coll->GetTotalEntries("/esdTree");
+    if (nEvents > 0) {
+      cout << "===========================================================================" << endl;
+      cout << nEvents << " events reconstructed and stored in the dataset run" << runNumber << endl;
+      cout << "===========================================================================" << endl;
+      cout << "The dataset is:" << endl;
+      coll->Print();
+      cout << "===========================================================================" << endl;
+      SendMonaLisaData(&monalisa,runNumber,"Done",nEvents);
+    }
+    else {
+      SendMonaLisaData(&monalisa,runNumber,"No_Events",nEvents);
+    }
+  }
+  else {
+      SendMonaLisaData(&monalisa,runNumber,"Failure",0);
+  }
+}
+
+void SendMonaLisaData(TMonaLisaWriter *monalisa, Int_t runNumber, const char* status, Int_t nEvents)
+{
+  TMonaLisaText mlStatus("Status",status);
+  TMonaLisaValue mlEventCount("Event_count",nEvents);
+  TList mlList;
+  mlList.Add(&mlStatus);
+  mlList.Add(&mlEventCount);
+  TString mlID;
+  mlID.Form("%d",runNumber);
+  monalisa->SendParameters(&mlList, mlID.Data());
+}