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