Fix bug in building local list of valid files.
[u/mrichter/AliRoot.git] / ANALYSIS / macros / AODtrain.C
index a5eec4e..1ff87a7 100644 (file)
@@ -2,7 +2,7 @@
 //==============================================================================
 Int_t       runOnData          = 1;       // Set to 1 if processing real data
 Int_t       iCollision         = 0;       // 0=pp, 1=Pb-Pb
-Int_t       run_flag           = 1100;    // year (2011 = 1100)
+Int_t       run_flag           = 1000;    // year (2010 pp)
 //==============================================================================
 Bool_t      doCDBconnect        =1;
 Bool_t      usePhysicsSelection = kTRUE; // use physics selection
@@ -15,19 +15,20 @@ Bool_t      useKFILTER          = kFALSE;  // use Kinematics filter
 Bool_t      useTR               = kFALSE;  // use track references
 Bool_t      useCORRFW           = kFALSE; // do not change
 Bool_t      useAODTAGS          = kFALSE; // use AOD tags
-Bool_t      useSysInfo          = kFALSE; // use sys info
+Bool_t      useSysInfo          = kTRUE; // use sys info
 
 // ### Analysis modules to be included. Some may not be yet fully implemented.
 //==============================================================================
 Int_t       iAODhandler        = 1;      // Analysis produces an AOD or dAOD's
 Int_t       iESDfilter         = 1;      // ESD to AOD filter (barrel + muon tracks)
 Int_t       iMUONcopyAOD       = 1;      // Task that copies only muon events in a separate AOD (PWG3)
-Int_t       iJETAN             = 1;      // Jet analysis (PWG4)
-Int_t       iJETANdelta        = 1;      // Jet delta AODs
+Int_t       iJETAN             = 0;      // Jet analysis (PWG4)
+Int_t       iJETANdelta        = 0;      // Jet delta AODs
 Int_t       iPWGHFvertexing     = 1;      // Vertexing HF task (PWG3)
 Int_t       iPWGDQJPSIfilter    = 0;      // JPSI filtering (PWG3)
 Int_t       iPWGHFd2h           = 1;      // D0->2 hadrons (PWG3)
 Int_t       iPWGPP               =1;      // high pt filter task
+Int_t       iPWGLFForward       = 1;      // Forward mult task (PWGLF)
 Bool_t doPIDResponse  = 1;
 Bool_t doPIDqa        = 1; //new
 
@@ -43,6 +44,8 @@ Bool_t LoadCommonLibraries();
 Bool_t LoadAnalysisLibraries();
 Bool_t LoadLibrary(const char *);
 TChain *CreateChain();
+const char *cdbPath = "raw://";
+Int_t run_number = 0;
 
 //______________________________________________________________________________
 void AODtrain(Int_t merge=0)
@@ -82,7 +85,11 @@ void AODtrain(Int_t merge=0)
     
    // Make the analysis manager and connect event handlers
    AliAnalysisManager *mgr  = new AliAnalysisManager("Analysis Train", "Production train");
-   if (useSysInfo) mgr->SetNSysInfo(100);
+    mgr->SetCacheSize(0);
+   if (useSysInfo) {
+ //     mgr->SetNSysInfo(100);
+      AliSysInfo::SetVerbose(kTRUE);
+   }   
    // Load analysis specific libraries
    if (!LoadAnalysisLibraries()) {
       ::Error("AnalysisTrain", "Could not load analysis libraries");
@@ -109,7 +116,7 @@ void AODtrain(Int_t merge=0)
    // Debugging if needed
    if (useDBG) mgr->SetDebugLevel(3);
 
-   AddAnalysisTasks();
+   AddAnalysisTasks(cdbPath);
    if (merge) {
       AODmerge();
       mgr->InitAnalysis();
@@ -133,7 +140,7 @@ void AODtrain(Int_t merge=0)
 }                                                                                                                                          
                                                                                                                                             
 //______________________________________________________________________________                                                           
-void AddAnalysisTasks(){                                                                                                                                          
+void AddAnalysisTasks(const char *cdb_location){                                                                                                                                          
   // Add all analysis task wagons to the train                                                                                               
    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();                                                                     
 
@@ -147,12 +154,22 @@ void AddAnalysisTasks(){
       AliAnalysisTaskSE *tender = AddTaskTender(useV0tender);
 //      tender->SetDebugLevel(2);
    }
+   
+   // Clean Geometry: Ruben
+  gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/commonMacros/CleanGeom.C++");
+  CleanGeom* clgmTask = new CleanGeom("cleanGeom");
+  mgr->AddTask(clgmTask);
+  AliAnalysisDataContainer *dummyInp = mgr->GetCommonInputContainer();
+  if (dummyInp) mgr->ConnectInput(clgmTask,0,dummyInp);  
+   
    //
   // PIDResponse(JENS)
   //
   if (doPIDResponse) {
     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); 
     AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse();
+     PIDResponse->SetUserDataRecoPass(1);
 //    PIDResponse->SelectCollisionCandidates(AliVEvent::kAny);
   }  
  
@@ -168,10 +185,10 @@ void AddAnalysisTasks(){
   //
   if (doCDBconnect && !useTender) {
     gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C");
-    AliTaskCDBconnect *taskCDB = AddTaskCDBconnect();
+    AliTaskCDBconnect *taskCDB = AddTaskCDBconnect(cdb_location, run_number);
     if (!taskCDB) return;
     AliCDBManager *cdb = AliCDBManager::Instance();
-    cdb->SetDefaultStorage("raw://");
+    cdb->SetDefaultStorage(cdb_location);
 //    taskCDB->SetRunNumber(run_number);
   }    
  
@@ -189,7 +206,7 @@ void AddAnalysisTasks(){
 //Jacek
    if (iPWGPP) {
       gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskFilteredTree.C");
-      AddTaskFilteredTree();
+      AddTaskFilteredTree("FilterEvents_Trees.root");
    }   
    
    // Centrality (only Pb-Pb)
@@ -198,18 +215,42 @@ void AddAnalysisTasks(){
       AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
       //taskCentrality->SelectCollisionCandidates(AliVEvent::kAny);
    }
+   
+// --- PWGLF - Forward (cholm@nbi.dk) -----------------------------
+   if (iPWGLFForward && usePhysicsSelection) { 
+        gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/AddTaskForwardMult.C");
+     UShort_t pwglfForwardSys = 0; // iCollision+1; // pp:1, PbPb:2, pPb:3
+     UShort_t pwglfSNN        = 0;            // GeV, 0==unknown
+     Short_t  pwglfField      = 0;
+     AddTaskForwardMult(useMC && useTR,        // Need track-refs 
+                       pwglfForwardSys,       // Collision system
+                       pwglfSNN, 
+                       pwglfField);
+        gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/AddTaskCentralMult.C");
+        AddTaskCentralMult(useMC, pwglfForwardSys, pwglfSNN, pwglfField);
+   }
+    
 
    if (iESDfilter) {
       //  ESD filter task configuration.
-      gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
+      gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C");
       if (iMUONcopyAOD) {
          printf("Registering delta AOD file\n");
          mgr->RegisterExtraFile("AliAOD.Muons.root");
-         mgr->RegisterExtraFile("AliAOD.Dimuons.root");
-         AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kTRUE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kFALSE,kFALSE,run_flag);
-      } else {
-          AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kFALSE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kFALSE,kFALSE,run_flag); // others
-      }   
+          mgr->RegisterExtraFile("AliAOD.Dimuons.root");
+      }
+      AliAnalysisTaskESDfilter *taskesdfilter = 
+                 AddTaskESDFilter(useKFILTER, 
+                                  iMUONcopyAOD,         // write Muon AOD
+                                  kFALSE,               // write dimuon AOD 
+                                  kFALSE,               // usePhysicsSelection 
+                                  kFALSE,               // centrality OBSOLETE
+                                  kTRUE,                // enable TPS only tracks
+                                  kFALSE,               // disable cascades
+                                  kFALSE,               // disable kinks
+                                  run_flag);            // run flag (YY00)
+        mgr->RegisterExtraFile("AliAOD.Dimuons.root");
    }   
 
 // ********** PWG3 wagons ******************************************************           
@@ -305,7 +346,6 @@ void AddAnalysisTasks(){
      } 
    }
 }
-
 //______________________________________________________________________________
 Bool_t LoadCommonLibraries()
 {
@@ -322,6 +362,7 @@ Bool_t LoadCommonLibraries()
    success &= LoadLibrary("libANALYSIS.so");
    success &= LoadLibrary("libOADB.so");
    success &= LoadLibrary("libANALYSISalice.so");
+     success &= LoadLibrary("libESDfilter.so");
    success &= LoadLibrary("libCORRFW.so");
    gROOT->ProcessLine(".include $ALICE_ROOT/include");
    if (success) {
@@ -361,11 +402,18 @@ Bool_t LoadAnalysisLibraries()
           !LoadLibrary("siscone") ||
           !LoadLibrary("SISConePlugin") ||
           !LoadLibrary("FASTJETAN")) return kFALSE;
-   }     
+   }  
+   // PWG2 FORWARD
+   if (iPWGLFForward) {
+      //if (!LoadLibrary("PWGLFforward", mode, kTRUE)) return kFALSE;
+     if (!LoadLibrary("PWGLFforward2")) return kFALSE;
+  }   
+   
    // PWG3 Vertexing HF
    if (iPWGHFvertexing || iPWGHFd2h) {
       if (!LoadLibrary("PWGflowBase") ||
           !LoadLibrary("PWGflowTasks") ||
+          !LoadLibrary("PWGTRD") ||
           !LoadLibrary("PWGHFvertexingHF")) return kFALSE;
    }    
  //    if (iPWGHFvertexing || iPWG3d2h) {