]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/macros/mini/AnalysisSetupRsnMini.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[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");
46 Bool_t useTender = opt.Contains("TENDER");
47 Bool_t noV0 = opt.Contains("NOV0");
48
49 //
50 // === LOAD LIBRARIES ===========================================================================
51 //
52
53 // load analysis libraries
54 gSystem->Load("libSTEERBase.so");
55 gSystem->Load("libESD.so");
56 gSystem->Load("libAOD.so");
57 gSystem->Load("libANALYSIS.so");
58 gSystem->Load("libANALYSISalice.so");
59 gSystem->Load("libEventMixing.so");
60 gSystem->Load("libCORRFW.so");
61
62 // tender-related libraries
caef2e3c 63 if (isESD && useTender) {
03d23846 64 ::Info("AnalysisSetup", "Loading tender libraries");
65 gSystem->Load("libTENDER.so");
66 gSystem->Load("libTENDERSupplies.so");
caef2e3c 67 } else if (!isESD) {
68 useTender = kFALSE;
03d23846 69 }
70
71 // load development RSN library
72 if (!AliAnalysisAlien::SetupPar("PWG2resonances.par")) return "";
73
74 //
75 // === CREATE ANALYSIS MANAGER ==================================================================
76 //
77
78 AliAnalysisManager *mgr = new AliAnalysisManager("RsnAnalysisManager");
79 mgr->SetCommonFileName(outputFileName);
80 ::Info("AnalysisSetup", "Common file name: %s", outputFileName);
81
82 //
83 // === INPUT / OUTPUT HANDLER CONFIGURATION =====================================================
84 //
85
03d23846 86 if (isESD) {
87 out = "esdTree";
88 ::Info("AnalysisSetup", "Creating ESD handler");
89 AliESDInputHandler *esdHandler = new AliESDInputHandler();
90 mgr->SetInputEventHandler(esdHandler);
91 if (isMC) {
92 ::Info("AnalysisSetup", "Creating MC handler");
93 AliMCEventHandler *mcHandler = new AliMCEventHandler();
94 mgr->SetMCtruthEventHandler(mcHandler);
95 }
96 } else {
97 out = "aodTree";
98 ::Info("AnalysisSetup", "Creating AOD handler");
99 AliAODInputHandler *aodHandler = new AliAODInputHandler();
100 mgr->SetInputEventHandler(aodHandler);
101 }
102
103 //
104 // === TENDER TASK (ESD only -- optional) =======================================================
105 //
106
107 if (isESD && useTender) {
108 ::Info("AnalysisSetup", "Adding tender (and then accepting V0 info)", options);
109 gROOT->LoadMacro(Form("%s/AddTaskTender.C", macroPath));
110 AddTaskTender();
111 noV0 = kFALSE;
112 }
113
114 //
115 // === PHYSICS SELECTION (ESD only) =============================================================
116 //
117
118 if (isESD) {
03d23846 119 ::Info("AnalysisSetup", "Add physics selection by default on ESD analysis");
120 gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPhysicsSelection.C");
121 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC);
122 if (noV0) {
123 ::Info("AnalysisSetup", "Skip of V0 info is required");
124 physSelTask->GetPhysicsSelection()->SetSkipV0(kTRUE);
125 }
126 }
127
caef2e3c 128 //
129 // === CENTRALITY/PLANE (ESD only) ==============================================================
130 //
caef2e3c 131 if (isESD && !isPP) {
45497260 132 ::Info("AnalysisSetup", "Add centrality and event plane computation tasks");
caef2e3c 133 gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskCentrality.C");
134 gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskEventplane.C");
45497260 135 AliCentralitySelectionTask* taskCentrality = (AliCentralitySelectionTask*)AddTaskCentrality();
136 if (isMC) {
137 ::Info("AnalysisSetup", "Setting centrality computation for MC");
138 taskCentrality->SetMCInput();
139 }
caef2e3c 140 AddTaskEventplane();
141 }
03d23846 142 //
143 // === PID RESPONSE =============================================================================
144 //
145
146 gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDResponse.C");
147 AddTaskPIDResponse(isMC);
148
caef2e3c 149 //gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDqa.C ");
150 //AddTaskPIDqa();
151
03d23846 152 //
153 // === OTHER TASKS ==============================================================================
154 //
155
156 // add RSN task
8082e538 157 gROOT->LoadMacro(Form("%s/AddAnalysisTaskRsnMiniTest.C", macroPath));
158 if (!AddAnalysisTaskRsnMiniTest(isMC, isPP, macroPath, nmix)) return "";
03d23846 159
160 ::Info("AnalysisSetup", "Setup successful");
161 return out;
162}