Adding example macros how to use Comparison analysis task locally and on PROOF
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Mar 2008 13:08:17 +0000 (13:08 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Mar 2008 13:08:17 +0000 (13:08 +0000)
(Jacek Otwinowski)

PWG1/Macros/LoadMyLibs.C [new file with mode: 0644]
PWG1/Macros/RunGSI.C [new file with mode: 0644]

diff --git a/PWG1/Macros/LoadMyLibs.C b/PWG1/Macros/LoadMyLibs.C
new file mode 100644 (file)
index 0000000..80c2d97
--- /dev/null
@@ -0,0 +1,29 @@
+void LoadMyLibs() {
+
+  // Load some ROOT libraries
+  CheckLoadLibrary("libEG");
+  CheckLoadLibrary("libGeom");
+  CheckLoadLibrary("libVMC");
+  CheckLoadLibrary("libTree");
+  CheckLoadLibrary("libGui");
+  
+  // Load AliRoot libraries
+  
+  CheckLoadLibrary("libSTEERBase");
+  CheckLoadLibrary("libCDB");
+  CheckLoadLibrary("libRAWDatabase");
+  CheckLoadLibrary("libRAWDatarec");
+  CheckLoadLibrary("libESD");
+  CheckLoadLibrary("libSTEER");
+  CheckLoadLibrary("libANALYSIS");
+  CheckLoadLibrary("libPWG0base");
+  CheckLoadLibrary("libPWG0dep");
+  CheckLoadLibrary("libPWG1");
+}
+
+Int_t CheckLoadLibrary(const char* library) {
+  // checks if a library is already loaded, if not loads the library
+  if (strlen(gSystem->GetLibraries(Form("%s.so", library), "", kFALSE)) > 0)
+    return 1;
+  return gSystem->Load(library);
+}
diff --git a/PWG1/Macros/RunGSI.C b/PWG1/Macros/RunGSI.C
new file mode 100644 (file)
index 0000000..2ed8313
--- /dev/null
@@ -0,0 +1,115 @@
+// ---------------------------------------------------------------------
+// Example of macro to run AliComparisonTask (PWG1 library). 
+// The task can be run locally or on the Proof (aProof == kTRUE).
+// 
+// To run AliComparisonTask on Proof user must set the enviroment variables 
+// and load AliRoot libraries using e.g. LoadMyLibs.C macro.
+//
+// As the input the AliComparisonTask needs a chain of root files with ESDcmpTracks
+// tree inside.
+// The output file (Output.root) contains MC vs Reconstruction comparison objects
+// filled under conditions set in RunAliComparisonTask.C
+//
+//----------------------------------------------------------------------
+//
+// 1. Example (run locally):
+//
+// -- Load toolkit
+// gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
+// gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
+// AliXRDPROOFtoolkit tool;
+//
+// -- Make chain 
+// TChain * chain = tool.MakeChain("cmpESDTracks.txt","ESDcmpTracks","",1000,0); 
+// 
+// -- Run AliComparisonTask task
+// gROOT->LoadMacro("RunAliComparisonTask.C");
+// RunAliComparisonTask(chain, kFALSE);
+// 
+// ----------------------------------------------------------------------
+//
+// 2. Example (run on Proof/GSI):
+//
+// -- Load libXrdClient.so e.g.
+// gSystem->Load("/usr/local/grid/XRootd/GSI/lib64/libXrdClient.so");
+// 
+// -- Connect to Proof as USER_NAME
+// TProof::Open("USER_NAME@gsiaf.gsi.de");
+// 
+// -- Set Proof ROOT version (e.g. 5.18/00a)
+// gProof->GetManager()->SetROOTVersion("5.18/00a");
+//
+// -- Load AliRoot Libraries
+// gProof->Exec(Form("TString str(gSystem->ExpandPathName(\"%s\")); gSystem->Setenv(\"ALICE_ROOT\", str);", gSystem->ExpandPathName("$ALICE_ROOT")), kTRUE);
+// gProof->AddDynamicPath(Form("%s/lib/tgt_linuxx8664gcc", gSystem->ExpandPathName("$ALICE_ROOT")));
+// gProof->Exec(Form("gROOT->Macro(\"%s/PWG1/Macros/LoadMyLibs.C\")",gSystem->ExpandPathName("$ALICE_ROOT")),kTRUE);
+//
+// -- Load toolkit
+// gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
+// gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
+// AliXRDPROOFtoolkit tool;
+//
+// -- Make chain
+// TChain * chain = tool.MakeChain("cmpESDTracks.txt","ESDcmpTracks","",1000,0); 
+//
+// -- Run AliComparisonTask task
+// gROOT->LoadMacro("RunAliComparisonTask.C");
+// RunAliComparisonTask(chain, kTRUE);
+//
+//-----------------------------------------------------------------------------
+
+void RunGSI(Bool_t aProof=kTRUE) {
+
+  // -- RUN  LOCALLY
+  if(aProof == kFALSE) 
+  {
+    // -- Load toolkit
+    gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
+    gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
+    AliXRDPROOFtoolkit tool;
+    
+    // -- Make chain
+    TChain * chain = tool.MakeChain("cmpESDTracks.txt","ESDcmpTracks","",1000,0);
+    
+    // -- Run AliComparisonTask task
+    gROOT->LoadMacro("RunAliComparisonTask.C");
+    if(chain) {
+      RunAliComparisonTask(chain, kFALSE);
+       } else {
+      AliDebug(AliLog::kError, "ERROR: Cannot get chain");
+       }
+  }
+  //-- RUN ON PROOF
+  else 
+  {
+    // -- Load libXrdClient.so e.g.
+    gSystem->Load("/usr/local/grid/XRootd/GSI/lib64/libXrdClient.so");
+     
+    // -- Connect to Proof as USER_NAME
+    TProof::Open("jacek@gsiaf.gsi.de");
+     
+    // -- Set Proof ROOT version (e.g. 5.18/00a)
+    gProof->GetManager()->SetROOTVersion("5.18/00a");
+    
+    // -- Load AliRoot Libraries
+    gProof->Exec(Form("TString str(gSystem->ExpandPathName(\"%s\"));gSystem->Setenv(\"ALICE_ROOT\",str);",gSystem->ExpandPathName("$ALICE_ROOT")),kTRUE);
+    gProof->AddDynamicPath(Form("%s/lib/tgt_linuxx8664gcc", gSystem->ExpandPathName("$ALICE_ROOT")));
+    gProof->Exec(Form("gROOT->Macro(\"%s/PWG1/Macros/LoadMyLibs.C\")",gSystem->ExpandPathName("$ALICE_ROOT")),kTRUE);
+    
+    // -- Load toolkit
+    gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
+    gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
+    AliXRDPROOFtoolkit tool;
+    
+    // -- Make chain
+    TChain * chain = tool.MakeChain("cmpESDTracks.txt","ESDcmpTracks","",1000,0);
+    
+    // -- Run AliComparisonTask task
+    gROOT->LoadMacro("RunAliComparisonTask.C");
+    if(chain) {
+      RunAliComparisonTask(chain, kTRUE);
+       } else {
+      AliDebug(AliLog::kError, "ERROR: Cannot get chain");
+       }
+  }
+}