Updates to the trigger study class
authormfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Aug 2011 13:49:37 +0000 (13:49 +0000)
committermfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Aug 2011 13:49:37 +0000 (13:49 +0000)
PWG0/multPbPb/AliAnalysisTaskMultPbTracks.cxx
PWG0/multPbPb/AliAnalysisTaskTriggerStudy.cxx
PWG0/multPbPb/AliAnalysisTaskTriggerStudy.h
PWG0/multPbPb/TriggerStudyResults.C
PWG0/multPbPb/run.C
PWG0/multPbPb/run.sh
PWG0/multPbPb/runTriggerStudy.C

index cf5c907..37627a2 100644 (file)
@@ -411,8 +411,16 @@ void AliAnalysisTaskMultPbTracks::UserExec(Option_t *)
   //  cout << acceptedTracks << endl;
   
   hNTracks[AliAnalysisMultPbTrackHistoManager::kHistoRec]  ->Fill(acceptedTracks);
-  Float_t v0;
-  fHistoManager->GetHistoV0vsNtracks(AliAnalysisMultPbTrackHistoManager::kHistoRec)->Fill(acceptedTracks, fCentrSelector->GetCorrV0(fESD,v0));
+
+  // FIXME: this used to be filled with rescaled V0. I'm using raw V0 to test some newer production here.
+  AliESDVZERO* esdV0 = fESD->GetVZEROData();
+  Float_t multV0A=esdV0->GetMTotV0A();
+  Float_t multV0C=esdV0->GetMTotV0C();
+  Float_t multV0 = multV0A+multV0C;
+  fHistoManager->GetHistoV0vsNtracks(AliAnalysisMultPbTrackHistoManager::kHistoRec)->Fill(acceptedTracks, multV0);
+  // FIXME: the old version:
+  // Float_t v0;
+  // fHistoManager->GetHistoV0vsNtracks(AliAnalysisMultPbTrackHistoManager::kHistoRec)->Fill(acceptedTracks, fCentrSelector->GetCorrV0(fESD,v0));
 
   // Fill <pt> analysis histos
   fHistoManager->GetHistoPtEvent(AliAnalysisMultPbTrackHistoManager::kHistoRec)->Scale(1,"width");// correct bin width
index 9c97af4..b8e40d3 100644 (file)
@@ -15,7 +15,7 @@
 #include "TH3D.h"
 #include "AliMCParticle.h"
 #include "AliGenEventHeader.h"
-#include "AliESDCentrality.h"
+#include "AliCentrality.h"
 
 #include <iostream>
 #include "AliTriggerAnalysis.h"
@@ -34,7 +34,7 @@ using namespace std;
 ClassImp(AliAnalysisTaskTriggerStudy)
 
 //const char * AliAnalysisTaskTriggerStudy::kVDNames[] = {"C0SM1","C0SM2","C0VBA","C0VBC","C0OM2"};       
-const char * AliAnalysisTaskTriggerStudy::kVDNames[] = {"V0AND online","V0AND offline","Physics Selection", "Rec Candle"};//,"C0OM2"};       
+const char * AliAnalysisTaskTriggerStudy::kVDNames[] = {"V0AND online","V0AND offline","Physics Selection", "Rec Candle", "Gen Canlde"};//,"C0OM2"};       
 
 AliAnalysisTaskTriggerStudy::AliAnalysisTaskTriggerStudy()
 : AliAnalysisTaskSE("TaskTriggerStudy"),
@@ -127,16 +127,19 @@ void AliAnalysisTaskTriggerStudy::UserExec(Option_t *)
   Float_t innerLayerSPD = mult->GetNumberOfITSClusters(0);  
   Float_t totalClusSPD = outerLayerSPD+innerLayerSPD;
 
-  if ( !fIsMC &&(!(fESD->IsTriggerClassFired("CMBS2A-B-NOPF-ALL")|| fESD->IsTriggerClassFired("CMBS2C-B-NOPF-ALL") || fESD->IsTriggerClassFired("CMBAC-B-NOPF-ALL")) )) return;
+  //  if ( !fIsMC &&(!(fESD->IsTriggerClassFired("CMBS2A-B-NOPF-ALL")|| fESD->IsTriggerClassFired("CMBS2C-B-NOPF-ALL") || fESD->IsTriggerClassFired("CMBAC-B-NOPF-ALL")) )) return;
+  //  if ( !fIsMC &&(!(fESD->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL")))) return;
+  if ( !fIsMC &&(!(fESD->IsTriggerClassFired("CINT1-B-NOPF-FASTNOTRD")))) return;
   GetHistoSPD1  ("All", "All events before any selection")->Fill(outerLayerSPD);
   GetHistoV0M   ("All", "All events before any selection")->Fill(multV0);
 
   // V0 triggers
   Bool_t c0v0A       = fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0A);
   Bool_t c0v0C       = fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0C);
-  Bool_t v0AHW     = (fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB);// should replay hw trigger
-  Bool_t v0CHW     = (fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB);// should replay hw trigger
-
+  // Bool_t v0AHW     = (fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB);// should replay hw trigger
+  // Bool_t v0CHW     = (fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB);// should replay hw trigger
+  Bool_t v0AHW = fTriggerAnalysis->EvaluateTrigger(fESD, AliTriggerAnalysis::kCTPV0A);
+  Bool_t v0CHW = fTriggerAnalysis->EvaluateTrigger(fESD, AliTriggerAnalysis::kCTPV0C);
   Bool_t v0ABG = fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0ABG);
   Bool_t v0CBG = fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0CBG);
   Bool_t v0BG  = v0ABG || v0CBG;
@@ -222,19 +225,20 @@ void AliAnalysisTaskTriggerStudy::UserExec(Option_t *)
 
 
 
+  // Physics selection
+  Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
+
   Bool_t vdArray[kNVDEntries];
-  vdArray[kVDV0ANDOnline]      = c0v0A && c0v0C;
-  vdArray[kVDV0ANDOffline]     = v0AHW && v0CHW;
-  vdArray[kVDRecCandle]        = atLeast1Track;
+  vdArray[kVDV0ANDOnline]      = v0AHW && v0CHW && !v0BG ;
+  vdArray[kVDV0ANDOffline]     = c0v0A && c0v0C && isSelected;
+  vdArray[kVDRecCandle]        = atLeast1TrackESD;
   vdArray[kVDPhysSel]          = isSelected;
-  //  vdArray[kVDNTRACKSESD]  = atLeast1TrackESD;
+  vdArray[kVDGenCandle]        = atLeast1Track;
 
   FillTriggerOverlaps("All", "All Events",vdArray);
   if(!isSD)   FillTriggerOverlaps("NSD", "NSD Events",vdArray);
 
 
-  // Physics selection
-  Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
   if(!isSelected) return;
 
 
index 6c8b25d..faaac45 100644 (file)
@@ -25,10 +25,11 @@ class AliAnalysisTaskTriggerStudy : public AliAnalysisTaskSE {
   //  enum {kVDC0MBS1,kVDC0MBS2,kVDC0VBA,kVDC0VBC,kVDC0OM2,kNVDEntries};
   //  enum {kVDC0MBS1,kVDC0MBS2,kVDC0VBA,kVDC0VBC,kNVDEntries};
   //  enum {kVDV0AND,kVDV0OR,kVDNTRACKS,kNVDEntries};// Venn diagram for Federico, 7 teV
-  enum {kVDV0ANDOnline,kVDV0ANDOffline,kVDPhysSel, kVDRecCandle,kNVDEntries};// Venn diagram for Federico, 7 teV
     
 public:
 
+  enum {kVDV0ANDOnline,kVDV0ANDOffline,kVDPhysSel, kVDRecCandle, kVDGenCandle, kNVDEntries};// Venn diagram for Federico, 7 teV
+
   AliAnalysisTaskTriggerStudy();
   AliAnalysisTaskTriggerStudy(const char * name);
   AliAnalysisTaskTriggerStudy(const AliAnalysisTaskTriggerStudy& obj) ;
index 644f9bc..3bb016d 100644 (file)
@@ -1,3 +1,7 @@
+//#include "AliAnalysisTaskTriggerStudy.h"
+
+Int_t GetNumberOfEventsWithBit(TH1 * hVenn, UInt_t bitMask, UInt_t excludeMask=0) ;
+
 void TriggerStudyResults(const char * filename = "outTrigger/collection_136854.xml/trigger_study.root", TString trigger = "C0SM1-A-NOPF-ALL") {
 
   TFile * f = new TFile (filename);
@@ -29,33 +33,63 @@ void TriggerStudyResults(const char * filename = "outTrigger/collection_136854.x
   pie->SetLabelFormat("");//#splitline{%val (%perc)}{%txt}");
   pie->SetFillColors(colors);
   //  pie->SetTextSize(0.01);
+  TCanvas * c = new TCanvas("c", "c", 1000,1000);
   pie->Draw("");
   
   pie->MakeLegend(0.224832, 0.66958, 0.833893, 0.97028, trigger.Data());
   cout << pie << endl;
   
   // Make a table of trigger efficiencies for all histos results
-  AliLatexTable table(2,"cc");
-  //  table.InsertCustomRow("\\multicolumn{c}{2}{Integrated efficiency}");
-  table.InsertCustomRow(Form("Trigger Name & Efficiency (%s)\\\\",trigger.Data()));
-  table.InsertHline();
-  TList * l = gDirectory->GetListOfKeys();
-  TIterator * iter = l->MakeIterator();
-  TKey * key = 0;
-  TH1F * hall = (TH1F*) gDirectory->Get("hTracklets_all"); // FIXME: get the normalization for a given trigger?
-  while (key = (TKey*) iter->Next()){
-    TString name = key->GetName();
-    if(!name.Contains("Tracklets")) continue;
-    if(!name.Contains(trigger)) continue;
-    if(name.Contains("all")) continue;
-    TH1F * h = (TH1F*) gDirectory->Get(name);
-    TString label = name(name.Index("_")+1, name.Index("_",name.Index("_")+1)-name.Index("_")-1);
-    table.SetNextCol(label);
-    table.SetNextCol(h->GetEntries()/hall->GetEntries());
-    table.InsertRow();
-  }
-  cout << "Integrated trigger efficiency" << endl;
+  // AliLatexTable table(2,"cc");
+  // //  table.InsertCustomRow("\\multicolumn{c}{2}{Integrated efficiency}");
+  // table.InsertCustomRow(Form("Trigger Name & Efficiency (%s)\\\\",trigger.Data()));
+  // table.InsertHline();
+  // TList * l = gDirectory->GetListOfKeys();
+  // TIterator * iter = l->MakeIterator();
+  // TKey * key = 0;
+  // TH1F * hall = (TH1F*) gDirectory->Get("hTracklets_all"); // FIXME: get the normalization for a given trigger?
+  // while (key = (TKey*) iter->Next()){
+  //   TString name = key->GetName();
+  //   if(!name.Contains("Tracklets")) continue;
+  //   if(!name.Contains(trigger)) continue;
+  //   if(name.Contains("all")) continue;
+  //   TH1F * h = (TH1F*) gDirectory->Get(name);
+  //   TString label = name(name.Index("_")+1, name.Index("_",name.Index("_")+1)-name.Index("_")-1);
+  //   table.SetNextCol(label);
+  //   table.SetNextCol(h->GetEntries()/hall->GetEntries());
+  //   table.InsertRow();
+  // }
+  // cout << "Integrated trigger efficiency" << endl;
+  // table.PrintTable("ASCII");
+
+  Int_t v0ANDOnline  = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDV0ANDOnline) ;
+  Int_t v0ANDOffline = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDV0ANDOffline | 0x1 << AliAnalysisTaskTriggerStudy::kVDPhysSel);
+  Int_t recCandle    = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDRecCandle | 0x1 << AliAnalysisTaskTriggerStudy::kVDPhysSel| 0x1 << AliAnalysisTaskTriggerStudy::kVDV0ANDOffline)  ;
+  //  Int_t recCandlePS  = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDRecCandle, 0x1 << AliAnalysisTaskTriggerStudy::kVDPhysSel)  ;
+  Int_t genCandle         = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDGenCandle)  ;
+  Int_t genCandleAndV0    = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDGenCandle | 0x1 << AliAnalysisTaskTriggerStudy::kVDV0ANDOffline)  ;
+  
+  Int_t physSel      = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDPhysSel)     ;
+
+  cout << "V0AND Online     " << v0ANDOnline   << endl;
+  cout << "V0AND Offline    " << v0ANDOffline  << endl;
+  cout << "REC CANDLE       " << recCandle     <<endl;
+  cout << "GEN CANDLE       " << genCandle      << endl;
+  cout << "REC/GEN CANDLE   " << (genCandle>0 ? Float_t(recCandle)/genCandle : genCandle)      << endl;
+  cout << "REC/GEN CANDLEV0 " << (genCandleAndV0>0 ? Float_t(recCandle)/genCandleAndV0 : genCandleAndV0)      << endl;
+  cout << "Phys Sel CINT1B  " << physSel       << endl;
+  //  cout << "Dummy " << GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDRecCandle, 0x1 << AliAnalysisTaskTriggerStudy::kVDV0ANDOffline)  << endl;
+  
+  AliLatexTable table(5,"cc");
+  table.InsertCustomRow("V0AND online/offline &        V0AND offline / after PS & V0AND online / after PS & candle / after PS & Candle / v0AND offline\\\\");
+  table.SetNextCol(Float_t(v0ANDOnline)/v0ANDOffline,-3);
+  table.SetNextCol(Float_t(v0ANDOffline)/physSel    ,-3);
+  table.SetNextCol(Float_t(v0ANDOnline)/physSel     ,-3);
+  table.SetNextCol(Float_t(recCandle)/physSel       ,-3);
+  table.SetNextCol(Float_t(recCandle)/v0ANDOffline  ,-3);
+  table.InsertRow();
   table.PrintTable("ASCII");
+
 }
 
 LoadLibs() {
@@ -66,34 +100,37 @@ LoadLibs() {
   gSystem->Load("libVMC");
   gSystem->Load("libTree");
   gSystem->Load("libProof");
+  gSystem->Load("libMatrix");
   gSystem->Load("libSTEERBase");
   gSystem->Load("libESD");
   gSystem->Load("libAOD");
   gSystem->Load("libANALYSIS");
+  gSystem->Load("libOADB");
   gSystem->Load("libANALYSISalice");
+  gSystem->Load("libTENDER");
   gSystem->Load("libCORRFW");
+  gSystem->Load("libPWG0base");
   gSystem->Load("libMinuit");
-  gSystem->Load("libPWG2Spectra");
-  gSystem->Load("libPWG0base"); 
-   
+  gSystem->Load("libPWG2spectra");
+
   gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG0/multPbPb"));
   gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG1/background"));
   // Load helper classes
   // TODO: replace this by a list of TOBJStrings
-  TString taskName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisTaskMultPbTracks.cxx+");
+  TString taskName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisTaskTriggerStudy.cxx+");
   TString histoManName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbTrackHistoManager.cxx+");
   TString centrName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbCentralitySelector.cxx+");
   TString listName("$ALICE_ROOT/PWG1/background/AliHistoListWrapper.cxx+");
 
   gSystem->ExpandPathName(taskName);
-  gSystem->ExpandPathName(histoManName);
-  gSystem->ExpandPathName(centrName);
-  gSystem->ExpandPathName(listName);
+  // gSystem->ExpandPathName(histoManName);
+  // gSystem->ExpandPathName(centrName);
+  // gSystem->ExpandPathName(listName);
 
   Bool_t debug=0;
-  gROOT->LoadMacro(listName    +(debug?"+g":""));   
-  gROOT->LoadMacro(histoManName+(debug?"+g":""));
-  gROOT->LoadMacro(centrName   +(debug?"+g":""));   
+  //  gROOT->LoadMacro(listName    +(debug?"+g":""));   
+  // gROOT->LoadMacro(histoManName+(debug?"+g":""));
+  // gROOT->LoadMacro(centrName   +(debug?"+g":""));   
   gROOT->LoadMacro(taskName    +(debug?"+g":""));   
 
   // Histo fitter
@@ -102,3 +139,30 @@ LoadLibs() {
 
 
 }
+
+Int_t GetNumberOfEventsWithBit(TH1 * hVenn, UInt_t bitMask, UInt_t excludeMask) {
+  // If more than 1 bit is on in bitMask, they are used in and 
+  Int_t nbins = hVenn->GetNbinsX();
+  //  cout << "bitMask " << hex << bitMask << endl;
+  
+  Int_t nev = 0;
+  for(Int_t ibins = 1; ibins <= nbins; ibins++){
+    Int_t x = Int_t(hVenn->GetBinCenter(ibins));
+    Bool_t useBin = x&bitMask;
+    //    printf("Bood 0x%x 0x%x %d\n", x, bitMask, useBin);
+    for (Int_t i = 0; i < 4*sizeof(bitMask) ; i++){
+      UInt_t localMask = bitMask & (0x1 << i);
+      //      cout << "localMask " << localMask << endl;
+      
+      if(localMask &&  !(x & localMask))   useBin = kFALSE;
+    }
+    //    cout << hex << x << " " << bitMask << endl;
+    
+    if (useBin && !(x&excludeMask)) {      
+      nev += hVenn->GetBinContent(ibins);
+      //  cout << "Using " << hVenn->GetXaxis()->GetBinLabel(ibins)  << " " << hVenn->GetBinContent(ibins) << endl;      
+    }
+  }
+
+  return nev;
+}
index 34c8a81..39d38d3 100644 (file)
@@ -289,7 +289,7 @@ void InitAndLoadLibs(Int_t runMode=kMyRunModeLocal, Int_t workers=0,Bool_t debug
       cout << "Init in CAF mode" << endl;
     
       //gEnv->SetValue("XSec.GSI.DelegProxy", "2");
-      TProof * p = TProof::Open("alice-caf.cern.ch", workers>0 ? Form("workers=%d",workers) : "");
+      TProof * p = TProof::Open("alice-caf.cern.ch", workers>0 ? Form("workers=%d",workers) : "1x");
       //      TProof * p = TProof::Open("skaf.saske.sk", workers>0 ? Form("workers=%d",workers) : "");    
       p->Exec("TObject *o = gEnv->GetTable()->FindObject(\"Proof.UseMergers\"); gEnv->GetTable()->Remove(o);", kTRUE);
 
index 0b21e63..5ed0014 100755 (executable)
@@ -49,7 +49,7 @@ Available options:
                                ./output/ is added automatically in front of the folder names
   -s                           Run the trigger study task (by default it runs the multiplicity analysis)
  Proof settings
-  -w nworkers                  Set the number of worker nodes
+  -w nworkers                  Set the number of worker nodes (0 == 1 worker per node)
   -n <nev>                     Number of events to be analized 
  Misc
   -d <dataset>                 Dataset or data collection (according to run mode) [default=$dataset]
index ab8c28b..c062ee5 100644 (file)
@@ -1,5 +1,5 @@
 enum { kMyRunModeLocal = 0, kMyRunModeCAF, kMyRunModeGRID};
-
+//#define TENDER
 TChain * GetAnalysisChain(const char * incollection);
 
 void runTriggerStudy(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kFALSE, Int_t runMode = 0, Bool_t isMC = 0, Int_t ntrackletsKine = 100, Bool_t rejectBGV0Trigger = kFALSE, const char* option = "", Int_t workers = -1)
@@ -8,10 +8,11 @@ void runTriggerStudy(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_
   //
   // 0 local 
   // 1 proof
-
+#ifdef TENDER
+  TGrid::Connect("alien://");
+#endif
   if (nev < 0)
     nev = 1234567890;
-
   InitAndLoadLibs(runMode,workers,debug);
 
   // Create the analysis manager
@@ -41,9 +42,25 @@ void runTriggerStudy(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_
     mgr->SetGridHandler(alienHandler);  
   }
 
+  // Add tender
+#ifdef TENDER
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C");
+  AliAnalysisTask* tender=0x0;
+  if(!isMC)
+    {
+      tender = AddTaskTender(kTRUE);
+      // tender->SetDebugLevel(10);
+    }
+  else
+    {
+      tender = AddTaskTender(kFALSE);
+      // tender->SetDebugLevel(10);
+    }
+#endif
+  
   // Add physics selection
   gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
-  physicsSelectionTask = AddTaskPhysicsSelection(isMC,0);//FIXME
+  physicsSelectionTask = AddTaskPhysicsSelection(isMC,1,!isMC);//FIXME
   physicsSelectionTask->GetPhysicsSelection()->SetSkipZDCTime(1);// Skip ZDC - applyied later
 
 
@@ -113,6 +130,7 @@ void MoveOutput(const char * data, const char * suffix = ""){
   TString fileName = "trigger_study.root";
   gSystem->mkdir(path, kTRUE);
   gSystem->Rename(fileName, path + "/" + fileName);
+  gSystem->Rename("event_stat.root", path + "/" + "event_stat.root");
   Printf(">>>>> Moved files to %s", path.Data());
 }  
 
@@ -156,25 +174,54 @@ void InitAndLoadLibs(Int_t runMode=kMyRunModeLocal, Int_t workers=0,Bool_t debug
     cout << "Init in CAF mode" << endl;
     
     gEnv->SetValue("XSec.GSI.DelegProxy", "2");
-    TProof * p = TProof::Open("alice-caf.cern.ch", workers>0 ? Form("workers=%d",workers) : "");
+    // cout << workers>0 ? Form("workers=%d",workers) : "workers=1x" << endl;
+    // exit(1);
+    TProof * p = TProof::Open("alice-caf.cern.ch", workers>0 ? Form("workers=%d",workers) : "workers=1x");
     p->Exec("TObject *o = gEnv->GetTable()->FindObject(\"Proof.UseMergers\"); gEnv->GetTable()->Remove(o);", kTRUE);
     //TProof::Open("skaf.saske.sk", workers>0 ? Form("workers=%d",workers) : "");
     
-    // Enable the needed package
-    gProof->UploadPackage("$ALICE_ROOT/STEERBase");
-    gProof->EnablePackage("$ALICE_ROOT/STEERBase");
-    gProof->UploadPackage("$ALICE_ROOT/ESD");
-    gProof->EnablePackage("$ALICE_ROOT/ESD");
-    gProof->UploadPackage("$ALICE_ROOT/AOD");
-    gProof->EnablePackage("$ALICE_ROOT/AOD");
-    gProof->UploadPackage("$ALICE_ROOT/ANALYSIS");
-    gProof->EnablePackage("$ALICE_ROOT/ANALYSIS");
-    gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice");
-    gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice");
-    gProof->UploadPackage("$ALICE_ROOT/PWG0base");
-    gProof->EnablePackage("$ALICE_ROOT/PWG0base");
+    // Enable the needed package (par fileS)
+    // gProof->UploadPackage("$ALICE_ROOT/obj/STEERBase");
+    // gProof->EnablePackage("$ALICE_ROOT/obj/STEERBase");
+    // gProof->UploadPackage("$ALICE_ROOT/obj/ESD");
+    // gProof->EnablePackage("$ALICE_ROOT/obj/ESD");
+    // gProof->UploadPackage("$ALICE_ROOT/obj/AOD");
+    // gProof->EnablePackage("$ALICE_ROOT/obj/AOD");
+    // gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSIS");
+    // gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSIS");
+    // gProof->UploadPackage("$ALICE_ROOT/obj/OADB");
+    // gProof->EnablePackage("$ALICE_ROOT/obj/OADB");
+    // gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSISalice");
+    // gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSISalice");
+    // gProof->UploadPackage("$ALICE_ROOT/PWG0base");
+    // gProof->EnablePackage("$ALICE_ROOT/PWG0base");
     gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG0/multPb"));
     gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG1/background"));
+    gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/include "));
+    gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/TOF "));
+
+    // Use a precompiled tag
+    TString alirootMode="";    // STEERBase,ESD,AOD,ANALYSIS,ANALYSISalice (default aliroot mode)
+    //alirootMode="ALIROOT";     // $ALICE_ROOT/macros/loadlibs.C
+    //  alirootMode="REC";     // $ALICE_ROOT/macros/loadlibsrec.C
+    //  alirootMode="SIM";     // $ALICE_ROOT/macros/loadlibssim.C
+    //  alirootMode="TRAIN";   // $ALICE_ROOT/macros/loadlibstrain.C (not working yet)
+    //  alirootMode="CUSTOM";  // nothing is loaded, but aliroot variables are set (not working yet)
+    TString extraLibs;
+    extraLibs= ""; // not needed in default aliroot mode
+    extraLibs+="CDB:RAWDatabase:STEER:TENDER:TRDbase:STAT:TRDrec:VZERObase:VZEROsim:VZEROrec:RAWDatarec:TPCbase:TPCrec:TPCcalib:TENDERSupplies:RAWDatabase:RAWDatarec:RAWDatasim:TOFbase:TOFrec";
+    TList *list = new TList();
+    // sets $ALIROOT_MODE on each worker to let proof to know to run in special mode
+    list->Add(new TNamed("ALIROOT_MODE", alirootMode.Data()));
+    // sets $ALIROOT_EXTRA_LIBS on each worker to let proof to know to load extra libs
+    list->Add(new TNamed("ALIROOT_EXTRA_LIBS", extraLibs.Data()));
+#ifdef TENDER
+    list->Add(new TNamed("ALIROOT_ENABLE_ALIEN", "1"));
+#endif
+    // connect to proof
+    gProof->EnablePackage("VO_ALICE@AliRoot::v4-21-22-AN", list);
+    //    gProof->Exec("TGrid::Connect(\"alien://\");");
   }
   else
   {
@@ -191,6 +238,7 @@ void InitAndLoadLibs(Int_t runMode=kMyRunModeLocal, Int_t workers=0,Bool_t debug
     gSystem->Load("libESD");
     gSystem->Load("libAOD");
     gSystem->Load("libANALYSIS");
+    gSystem->Load("libOADB");
     gSystem->Load("libANALYSISalice");
     gSystem->Load("libPWG0base");