removed startTime selection
[u/mrichter/AliRoot.git] / ANALYSIS / macros / runCalibTrain.C
1 /*
2   Template of calibration/filtering  macro using ESD
3
4   .L $ALICE_ROOT/ANALYSIS/macros/runCalibTrain.C
5   runCalibTrain(105160);
6
7 */
8
9 #if !defined(__CINT__) || defined(__MAKECINT__)
10 #include <TChain.h>
11 #include <TSystem.h>
12 #include "AliAnalysisManager.h"
13 #include "AliESDInputHandler.h"
14 #include "AliAnalysisTaskESDfilter.h"
15 #include "AliAnalysisDataContainer.h"
16 #endif
17
18 void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root",
19                    const char *outFileName = "AliESDs_v1.root")
20 {
21
22     gSystem->Load("libTree");
23     gSystem->Load("libGeom");
24     gSystem->Load("libPhysics");
25     gSystem->Load("libVMC");
26     gSystem->Load("libSTEERBase");
27     gSystem->Load("libESD");
28     gSystem->Load("libAOD");
29
30     gSystem->Load("libANALYSIS");
31     gSystem->Load("libANALYSISalice");
32     gSystem->Load("libANALYSIScalib");
33     gSystem->Load("libCORRFW");
34     gSystem->Load("libPWGmuon");
35     gROOT->LoadMacro("ConfigCalibTrain.C");
36     gROOT->LoadMacro("AddTaskCopyESD.C");
37     gROOT->LoadMacro("AddTaskFilterFriend.C");
38     gROOT->LoadMacro("AddTaskFilterFriendSecond.C");
39     gROOT->LoadMacro("AddTaskAddObject.C");
40
41     // detector tasks
42
43     gROOT->LoadMacro("AddTaskTPCCalib.C");
44
45     AliLog::SetClassDebugLevel("AliESDEvent",19);
46     TChain *chain = new TChain("esdTree");
47
48     // Steering input chain
49
50     chain->Add(inFileName);
51     Int_t runNumber = runNumberString.Atoi();
52     printf("runNumber from runCalibTrain = %d\n",runNumber);
53     ConfigCalibTrain(runNumber, "raw://");
54
55     AliAnalysisManager *mgr  = new AliAnalysisManager("ESD to ESD", "Analysis Manager");
56     // mgr->SetDebugLevel(3);
57
58     // Input
59
60     AliESDInputHandler* inpHandler = new AliESDInputHandler();
61     inpHandler->SetActiveBranches("ESDfriend*");
62     mgr->SetInputEventHandler  (inpHandler);
63
64     // Output
65
66     AliESDHandler* esdHandler   = new AliESDHandler();
67     esdHandler->SetOutputFileName(outFileName);
68     mgr->SetOutputEventHandler(esdHandler);
69
70     // Steering Tasks
71
72     AliAnalysisTaskCopyESD *copy = AddTaskCopyESD();
73     AliAnalysisTaskFilterFriend* filter = AddTaskFilterFriend();
74     AliAnalysisTaskFilterFriendSecond* filter2 = AddTaskFilterFriendSecond();
75     AliAnalysisTaskAddObject* add = AddTaskAddObject();
76
77     // Detector Tasks
78
79    AliAnalysisTask* tTPC = AddTaskTPCCalib(runNumber);
80
81     // Run the analysis
82
83     if (!mgr->InitAnalysis()) {
84             printf("Analysis cannot be started, returning\n");
85             return;
86     }
87
88     mgr->PrintStatus();
89     mgr->StartAnalysis("local", chain);
90
91     return;
92 }