Updated macros from Martin. Ready for the shifter.
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Sep 2010 14:29:01 +0000 (14:29 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Sep 2010 14:29:01 +0000 (14:29 +0000)
prod/acrcaf/rec.sh
prod/acrcaf/reco/rec.C
prod/acrcaf/reco/run.C [deleted file]
prod/acrcaf/reco/runProof.C [new file with mode: 0644]

index d70f5f2..fc61d47 100755 (executable)
@@ -1,25 +1,5 @@
 #!/bin/bash
 
-[ -d reco/local ] || mkdir reco/local
-[ -d reco/log   ] || mkdir reco/log
-
-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
@@ -32,45 +12,21 @@ else
     shift
   fi
 
-  CAFROOT=v5-24-00b-caf
-  BASE=
-  
-  if [ "$1" == "-ALICE_pro" ]
-  then
-    shift
-    CAFROOT=ALICE_pro
-    BASE=/afs/cern.ch/alice/library/afs_volumes/vol12
-  fi
+  [ -z $1 ] && { echo "Usage: rec.sh <run_number> <aaf_cluster> <num_events> <num_events_skip> <num_workers>"; exit 1; }
 
-  if [ "$1" == "-ALICE_new" ]
-  then
-    shift
-    CAFROOT=ALICE_new
-    BASE=/afs/cern.ch/alice/library/afs_volumes/vol02
+  PROOF="alice-caf.cern.ch"
+  if [ ! -z $2 ]; then
+    PROOF="$2"
   fi
 
-  if [ ! -z $BASE ]
-  then
-    echo "Setting ROOT and AliRoot to $CAFROOT"    
-
-    export ROOTSYS=$BASE/root
-    export PATH=$ROOTSYS/bin:$PATH
-    export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
-
-    export ALICE_ROOT=$BASE/AliRoot
-    export ALICE_TARGET=`root-config --arch`
-    export LD_LIBRARY_PATH=$ALICE_ROOT/lib/tgt_${ALICE_TARGET}:$LD_LIBRARY_PATH
-    export PATH=$ALICE_ROOT/bin/tgt_${ALICE_TARGET}:$PATH
-  fi 
-
-  [ -z $1 ] && { echo "Usage: rec.sh [-local] <run_number>"; exit 1; }
+  PROOFWK=""
+  if [ ! -z $5 ]; then
+    PROOFWK="$5"
+  fi
 
-  nev=${2:-10000}
-  fev=${3:-0}
+  nev=${3:-1000}
+  fev=${4:-0}
 
   cd reco
-  aliroot -q run.C\($1,$nev,$fev,\"$CAFROOT\"\)
-
-fi
+#   aliroot -q runProofLite.C\($1,$nev,$fev,\"VO_ALICE@AliRoot::$ALICE_LEVEL\"\)
+  aliroot -q runProof.C\($1,$nev,$fev,\"aliprod@$PROOF\",\"$PROOFWK\"\)
index 5150654..27b9dce 100644 (file)
@@ -1,4 +1,4 @@
-void rec(Int_t runNumber, Int_t nev=10000, Int_t firstev=0)\r
+void rec(Int_t runNumber, Int_t nev=30000, Int_t firstev=0)\r
 {\r
   gSystem->Load("libRAliEn.so");\r
   gSystem->Load("libNet.so");\r
@@ -6,7 +6,6 @@ void rec(Int_t runNumber, Int_t nev=10000, Int_t firstev=0)
   // Set the CDB storage location\r
   AliCDBManager * man = AliCDBManager::Instance();\r
   man->SetDefaultStorage("raw://");\r
-  \r
   // Reconstruction settings\r
   AliReconstruction rec;\r
 \r
@@ -20,20 +19,22 @@ void rec(Int_t runNumber, Int_t nev=10000, Int_t firstev=0)
   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.SetRunReconstruction("ALL -EMCAL -HLT -PMD");\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
+  //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
+  rec.SetOutput(Form("root://localhost/aaf_data/alishift/run%d/root_archive.zip#AliESDs.root:AliESDs.root,AliESDfriends.root,ITS.RecPoints.root,TPC.RecPoints.root,TRD.RecPoints.root,TOF.RecPoints.root,galice.root@dataset://run%d",runNumber,runNumber));\r
+  //rec.SetOutput(Form("root_archive.zip#AliESDs.root:AliESDs.root,AliESDfriends.root@dataset://run%d",runNumber));\r
+  // rec.SetOutput(Form("root_archive.zip#AliESDs.root:AliESDs.root,AliESDfriends.root,*.RecPoints.root,galice.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
deleted file mode 100644 (file)
index cc4fa8c..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-void run(Int_t runNumber, Int_t nev = 10000, Int_t firstev = 0, const char* rootVersion = 0)
-{
-  gEnv->SetValue("XSec.GSI.DelegProxy","2");
-  // Select ROOT version
-  if (rootVersion) 
-    TProof::Mgr("aliprod@alicecaf")->SetROOTVersion(rootVersion);
-    
-  // 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());
-}
diff --git a/prod/acrcaf/reco/runProof.C b/prod/acrcaf/reco/runProof.C
new file mode 100644 (file)
index 0000000..f2221df
--- /dev/null
@@ -0,0 +1,89 @@
+void runProof(Int_t runNumber, Int_t nev = 10000, Int_t firstev = 0,TString proofCluster="aliprod@alice-caf.cern.ch",TString workers="")
+{
+  gEnv->SetValue("XSec.GSI.DelegProxy","2");
+
+  // Select ROOT version
+  TProof::Mgr(proofCluster.Data())->SetROOTVersion(Form("VO_ALICE@ROOT::%s",gSystem->GetFromPipe("echo $ROOTSYS | awk -F/ '{print $NF}'").Data()));
+
+  // set ALIROOT mode to REC
+  TList * list = new TList();
+  list->Add(new TNamed("ALIROOT_MODE", "REC"));    
+  list->Add(new TNamed("ALIROOT_ENABLE_ALIEN", "1"));
+  // Login to CAF
+
+  TString workersStr;
+  if (!workers.IsNull()) workersStr=Form("workers=%s",workers.Data());
+  
+  // connecting to proof cluster
+  TProof::Open(proofCluster.Data(),workersStr.Data());
+
+  // seting up aliroot version
+  TString alirootVer = Form("VO_ALICE@AliRoot::%s",gSystem->GetFromPipe("echo $ALICE_ROOT | awk -F/ '{print $NF}'").Data());
+  
+  // Enable AliRoot
+  Printf("Setting aliroot version on caf to %s ...",alirootVer.Data());
+  if (gProof->EnablePackage(alirootVer.Data(), list)) {
+    Error("run.C",Form("Error enabling proof package %s !!!!",alirootVer.Data()));
+    return;
+  }
+
+
+  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
+  Int_t numWorkers = gProof->GetParallel();
+  gProof->SetParameter("PROOF_PacketizerStrategy", (Int_t)0);
+  gProof->SetParameter("PROOF_PacketAsAFraction", (Int_t) nev/numWorkers);
+//  gProof->SetParameter("PROOF_MinPacketTime", 8);
+//  gProof->SetParameter("PROOF_MaxPacketTime", 5);
+
+  // Set some verbosity
+  // gProof->SetLogLevel(3); 
+
+
+  // Run reconstruction
+  gROOT->LoadMacro("rec.C");
+  gROOT->ProcessLine(Form("rec(%d,%d,%d);",runNumber,nev,firstev));
+
+  TProof::Mgr(proofCluster.Data())->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());
+}
+
+void LoadRecMacroOnClient() {
+  gSystem->AddIncludePath(Form("-I\"%s/include\"", gSystem->Getenv("ALICE_ROOT")));
+  gROOT->Macro("$ALICE_ROOT/macros/loadlibsrec.C");
+}