]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/QA/tasks/macros/compare-HLT-offline-local.C
TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / HLT / QA / tasks / macros / compare-HLT-offline-local.C
index 72db168ebd7d5e84c03d18ac745cce95c42de84b..4e88a1157826de5cf839884c65eb46f05f9fc384 100644 (file)
@@ -3,10 +3,12 @@
  * Example macro to run locally an analysis task for comparing the offline
  * with the HLT esd tree.
  *
- * The output is a root file containing the histograms defined in the
- * analysis task. There is one output file per detector.
+ * The output is a root file containing the objects defined in the
+ * analysis task. These could be histograms or THnSparse objects.
+ * There is one output file per task containing a TList of TH1 or THnSparse objects. 
  *
- * Run without arguments to get a few examples how to use the macro.
+ * Run without arguments to get a few examples how to use the macro
+ * and which tasks are available in svn.
  * 
  * The arguments are:
  * - the input file or txt file containing a list of ESDs to be processed (CreateESDChain takes 20 files as a default argument)
  * If alien:// is placed before the input filename, then the macro connects to the grid to access the file.
  * 
  * In case you want to run over many ESD files, then prepare a list of them in a .txt file and they will be chained for the analysis.
- * The .txt file takes the place of the first argument in that case.
+ * The .txt file takes the place of the first argument in that case. The chain can take up to 200 files at the moment. The user
+ * can modify this in the call CreateESDChain(file.Data(),200); 
+ *
+ * If the files are not sitting locally but on the GRID, then their location should be designated like:
+ * alien:///alice/data/2011/LHC11a/000146018/ESDs/pass1/11000146018023.20/AliESDs.root in the *txt file.
+ * The macro takes care of connecting to the GRID, as soon as the first file is found that begins with alien://
  *
  * @ingroup alihlt_qa
  * @author Kalliopi.Kanaki@ift.uib.no, Hege.Erdal@student.uib.no
@@ -42,34 +49,34 @@ void compare_HLT_offline_local( TString file
   TStopwatch timer;
   timer.Start();
 
-  gSystem->Load("libTree.so");
-  gSystem->Load("libGeom.so");
-  gSystem->Load("libVMC.so");
-  gSystem->Load("libPhysics.so");
+  gSystem->Load("libTree");
+  gSystem->Load("libGeom");
+  gSystem->Load("libVMC");
+  gSystem->Load("libPhysics");
  
   //----------- Loading the required libraries ---------//
 
-  gSystem->Load("libSTEERBase.so");
-  gSystem->Load("libESD.so");
-  gSystem->Load("libAOD.so");
-  gSystem->Load("libANALYSIS.so");
-  gSystem->Load("libANALYSISalice.so");
-  gSystem->Load("libHLTbase.so");
+  gSystem->Load("libSTEERBase");
+  gSystem->Load("libESD");
+  gSystem->Load("libAOD");
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISalice");
+  gSystem->Load("libHLTbase");
  
-  gSystem->AddIncludePath("-I$ALICE_ROOT/HLT/BASE -I$ALICE_ROOT/PWG1/TPC -I. -I$ALICE_ROOT/STEER -I$ALICE_ROOT/ANALYSIS");
+  gSystem->AddIncludePath("-I$ALICE_ROOT/HLT/BASE -I$ALICE_ROOT/PWGPP/TPC -I. -I$ALICE_ROOT/STEER -I$ALICE_ROOT/ANALYSIS");
   
-  gSystem->Load("libTPCcalib.so");
-  gSystem->Load("libTRDbase.so");
-  gSystem->Load("libTRDrec.so");
-  gSystem->Load("libITSbase.so");
-  gSystem->Load("libITSrec.so");
-  gSystem->Load("libTENDER.so");
-  gSystem->Load("libPWG1.so");
+  gSystem->Load("libTPCcalib");
+  gSystem->Load("libTRDbase");
+  gSystem->Load("libTRDrec");
+  gSystem->Load("libITSbase");
+  gSystem->Load("libITSrec");
+  gSystem->Load("libTender");
+  gSystem->Load("libPWGPP");
  
   gROOT->ProcessLine(".include $ALICE_ROOT/include");
   //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
     
-  Bool_t bPHOS = kFALSE, bGLOBAL = kFALSE, bEMCAL = kFALSE, bPWG1 = kFALSE, bD0 = kFALSE, bCB = kFALSE;
+  Bool_t bPHOS = kFALSE, bGLOBAL = kFALSE, bEMCAL = kFALSE, bPWGPP = kFALSE, bD0 = kFALSE, bCB = kFALSE;
  
   TString allArgs = detectorTask;
   TString argument;
@@ -92,8 +99,8 @@ void compare_HLT_offline_local( TString file
        bGLOBAL = kTRUE;
        continue;
       }      
-      if(argument.CompareTo("pwg1", TString::kIgnoreCase)==0){
-       bPWG1 = kTRUE;
+      if(argument.CompareTo("pwgpp", TString::kIgnoreCase)==0){
+       bPWGPP = kTRUE;
        continue;
       }
       if(argument.CompareTo("D0", TString::kIgnoreCase)==0){
@@ -149,20 +156,34 @@ void compare_HLT_offline_local( TString file
     cout << "\n========= You are loading the following task --> "<< (taskFolder+strTask).Chop()  << endl;
   }
   
-  if(bPWG1) gROOT->LoadMacro("$ALICE_ROOT/HLT/QA/tasks/macros/AddTaskPerformance.C");
+  if(bPWGPP) gROOT->LoadMacro("$ALICE_ROOT/HLT/QA/tasks/macros/AddTaskPerformance.C");
    
-  if(file.Contains("alien")) TGrid::Connect("alien://");
+  if(file.BeginsWith("alien://")) TGrid::Connect("alien://");
     
   if(file.Contains("AliESDs.root")){
     TChain *chain = new TChain("esdTree"); 
     chain->Add(file);
   }
   
-  //Constructs chain from filenames in *.txt
-  //on the form $DIR/AliESDs.root
+  // Constructs chain from filenames in *.txt
+  // in the form $DIR/AliESDs.root  
   else if(file.Contains(".txt")){
     gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
-    chain=CreateESDChain(file.Data(),200);
+    chain = CreateESDChain(file.Data(),200); 
+    // chain can contain up to 200 files, value can be modified to 
+    // include a subset of what the *txt file contains
+    
+    TObjArray *fileElements = chain->GetListOfFiles();
+    TIter next(fileElements);
+    TChainElement *chEl = 0;
+    bool alienList = kFALSE;
+    while(( chEl = (TChainElement*)next() )){
+    // loop over the list of files in the *txt and as soon as one is found that starts with alien://, 
+    // the boolean alienList turns to kTRUE, which allows the TGrid::Connect call outside the loop.
+            TString tmp = chEl->GetTitle();        
+            if(tmp.BeginsWith("alien://")) alienList = kTRUE;           
+    }
+    if(alienList==kTRUE) TGrid::Connect("alien://");
   }
   
   else if(!file){
@@ -180,8 +201,8 @@ void compare_HLT_offline_local( TString file
   AliAnalysisManager *mgr  = new AliAnalysisManager("TestManager");
   AliESDInputHandler *esdH = new AliESDInputHandler;
 
-  //For the PWG1 task, setting HLT is handled inside AliPerformanceTask.C
-  if(!bPWG1)  esdH->SetReadHLT();
+  //For the PWGPP task, setting HLT is handled inside AliPerformanceTask.C
+  if(!bPWGPP)  esdH->SetReadHLT();
   esdH->SetReadFriends(kFALSE);
   mgr->SetInputEventHandler(esdH);  
   mgr->SetNSysInfo(1000);
@@ -217,7 +238,7 @@ void compare_HLT_offline_local( TString file
   }
   
   if(bGLOBAL){
-    AliAnalysisTaskHLT *taskGLOBAL = new AliAnalysisTaskHLT("offhlt_comparison_GLOBAL");
+    AliAnalysisTaskHLT *taskGLOBAL = new AliAnalysisTaskHLT("offhlt_comparison_GLOBAL",0.9,0.3,7,7,20); // eta, pt, DCAr, DCAz, vertexZ
     taskGLOBAL->SetUseHLTTriggerDecision(fUseHLTTrigger);
     taskGLOBAL->SetBeamType(beamType);
     mgr->AddTask(taskGLOBAL);
@@ -236,7 +257,7 @@ void compare_HLT_offline_local( TString file
     mgr->ConnectOutput(taskGLOBAL,1,coutputGLOBAL);
   }
 
-  if(bPWG1){
+  if(bPWGPP){
     Bool_t hasMC=kFALSE;  
     // -- Add Task for HLT and Offline
     AliPerformanceTask *HLTtpcQA = AddTaskPerformance(hasMC,kFALSE,kTRUE);
@@ -279,7 +300,10 @@ void compare_HLT_offline_local( TString file
 }
 
 void compare_HLT_offline_local(){
-  cout << " " << endl;
+  cout << "\n The following tasks and respective plotting macros are available and maintained in $ALICE_ROOT/HLT/QA/tasks/ :\n"<< endl;
+  cout << " AliAnalysisTaskHLTCentralBarrel (macros/drawTHnSparse.C)\n AliAnalysisTaskHLT.cxx (macros/drawGlobalESDHistograms.C)" << endl;
+  cout << " AliAnalysisTaskHLTCalo (EMCAL+PHOS) (macros/drawCaloHistograms.C) \n AliAnalysisTaskD0Trigger (no plotting macro committed)\n" << endl;
+  
   cout << " Usage examples:" << endl;
   cout << "    compare-HLT-offline-local.C'(file, taskOption, taskFolder, beamType, options, fUseHLTTrigger, nEvents)' 2>&1 | tee log" << endl;
   cout << "    compare-HLT-offline-local.C'(\"AliESDs.root\",\"global\")' 2>&1 | tee log" << endl;