Split: fix refs to AddTaskPhysicsSelection.C
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AnalysisSetupRsnMini.C
CommitLineData
03d23846 1//
2// This macro sets all the aspects of configuration of an Analysis Train run
3// which are always the same for all kinds of analysis (local, PROOF, AliEn)
4//
5// Inputs:
6//
7// - nmix = number of mixings to do (if > 0, initialize mixing stuff)
8// - options = a set of keywords which drive some configurations
9// - outputFileName = name of file produced by train
10// - configPath = a path where all required config macros are stored
11//
12// Notes:
13//
14// - in case the source is an ESD, and if inputs are a MC production
15// the MC input handler is created by default
16//
17// Returns:
18//
19// - if successful: the name of the expected input TTre (esdTree or aodTree)
20// - if failed : NULL
21//
22TString Setup
23(
24 Int_t nmix,
25 const char *options,
26 const char *outputFileName,
27 const char *macroPath = "."
28)
29{
30 // prepare output
31 TString out("");
32
33 //
34 // === EXAMINE OPTIONS ==========================================================================
35 //
36
37 // this is done using the utility 'RsnOptions.C'
38 // which provides a unique way to interpret them
39
40 TString opt(options);
41 opt.ToUpper();
42
43 Bool_t isMC = opt.Contains("MC") || (!opt.Contains("DATA"));
caef2e3c 44 Bool_t isPP = opt.Contains("PP") || (!opt.Contains("PBPB"));
03d23846 45 Bool_t isESD = opt.Contains("ESD");
af472fff 46 Bool_t useTender = opt.Contains("Tender");
03d23846 47 Bool_t noV0 = opt.Contains("NOV0");
48
49 //
50 // === LOAD LIBRARIES ===========================================================================
51 //
52
53 // load analysis libraries
4070f709 54 gSystem->Load("libSTEERBase");
55 gSystem->Load("libESD");
56 gSystem->Load("libAOD");
57 gSystem->Load("libANALYSIS");
58 gSystem->Load("libANALYSISalice");
59 gSystem->Load("libEventMixing");
60 gSystem->Load("libCORRFW");
03d23846 61
62 // tender-related libraries
caef2e3c 63 if (isESD && useTender) {
03d23846 64 ::Info("AnalysisSetup", "Loading tender libraries");
4070f709 65 gSystem->Load("libTender");
66 gSystem->Load("libTenderSupplies");
caef2e3c 67 } else if (!isESD) {
68 useTender = kFALSE;
03d23846 69 }
70
4070f709 71 gSystem->Load("libPWGLFresonances");
f96dd450 72
73// // load development RSN library
74// if (!AliAnalysisAlien::SetupPar("PWG2resonances.par")) return "";
03d23846 75
76 //
77 // === CREATE ANALYSIS MANAGER ==================================================================
78 //
79
80 AliAnalysisManager *mgr = new AliAnalysisManager("RsnAnalysisManager");
81 mgr->SetCommonFileName(outputFileName);
82 ::Info("AnalysisSetup", "Common file name: %s", outputFileName);
83
84 //
85 // === INPUT / OUTPUT HANDLER CONFIGURATION =====================================================
86 //
87
03d23846 88 if (isESD) {
89 out = "esdTree";
90 ::Info("AnalysisSetup", "Creating ESD handler");
91 AliESDInputHandler *esdHandler = new AliESDInputHandler();
92 mgr->SetInputEventHandler(esdHandler);
93 if (isMC) {
94 ::Info("AnalysisSetup", "Creating MC handler");
95 AliMCEventHandler *mcHandler = new AliMCEventHandler();
96 mgr->SetMCtruthEventHandler(mcHandler);
97 }
98 } else {
99 out = "aodTree";
100 ::Info("AnalysisSetup", "Creating AOD handler");
101 AliAODInputHandler *aodHandler = new AliAODInputHandler();
102 mgr->SetInputEventHandler(aodHandler);
103 }
f96dd450 104
105 //
106 // === PID RESPONSE =============================================================================
107 //
108
109 gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDResponse.C");
110 AddTaskPIDResponse(isMC);
03d23846 111
f96dd450 112 gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDqa.C ");
113 AddTaskPIDqa();
114
115
03d23846 116 //
af472fff 117 // === Tender TASK (ESD only -- optional) =======================================================
03d23846 118 //
119
120 if (isESD && useTender) {
121 ::Info("AnalysisSetup", "Adding tender (and then accepting V0 info)", options);
f96dd450 122// gROOT->LoadMacro(Form("%s/AddTaskTender.C", macroPath)); //for developers usage
123// gROOT->LoadMacro(Form("$(ALICE_ROOT)/PWGLF/RESONANCES/macros/mini/AddTaskTender.C")); //deprecated
6a637a06 124 gROOT->LoadMacro(Form("$(ALICE_ROOT)/TENDER/TenderSupplies/AddTaskTender.C"));
03d23846 125 AddTaskTender();
126 noV0 = kFALSE;
127 }
128
129 //
130 // === PHYSICS SELECTION (ESD only) =============================================================
131 //
132
133 if (isESD) {
03d23846 134 ::Info("AnalysisSetup", "Add physics selection by default on ESD analysis");
63b6cbd0 135 gROOT->LoadMacro("$(ALICE_ROOT)/OADB/macros/AddTaskPhysicsSelection.C");
03d23846 136 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC);
137 if (noV0) {
138 ::Info("AnalysisSetup", "Skip of V0 info is required");
139 physSelTask->GetPhysicsSelection()->SetSkipV0(kTRUE);
140 }
141 }
142
143 //
caef2e3c 144 // === CENTRALITY/PLANE (ESD only) ==============================================================
145 //
caef2e3c 146 if (isESD && !isPP) {
45497260 147 ::Info("AnalysisSetup", "Add centrality and event plane computation tasks");
1c06a186 148 gROOT->LoadMacro("$(ALICE_ROOT)/OADB/macros/AddTaskCentrality.C");
caef2e3c 149 gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskEventplane.C");
45497260 150 AliCentralitySelectionTask* taskCentrality = (AliCentralitySelectionTask*)AddTaskCentrality();
151 if (isMC) {
152 ::Info("AnalysisSetup", "Setting centrality computation for MC");
153 taskCentrality->SetMCInput();
154 }
caef2e3c 155 AddTaskEventplane();
156 }
f96dd450 157// //
158// // === PID RESPONSE =============================================================================
159// //
160//
161// gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDResponse.C");
162// AddTaskPIDResponse(isMC);
163//
164// //gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDqa.C ");
165// //AddTaskPIDqa();
caef2e3c 166
03d23846 167 //
168 // === OTHER TASKS ==============================================================================
169 //
170
171 // add RSN task
f96dd450 172 gROOT->LoadMacro(Form("%s/AddAnalysisTaskRsnMini.C", macroPath));
173 if (!AddAnalysisTaskRsnMini(isMC, isPP, macroPath, nmix)) return "";
03d23846 174
175 ::Info("AnalysisSetup", "Setup successful");
176 return out;
177}