]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/mini/AnalysisSetupSigmaStar.C
d5565110839d7f18536779db256fd1fa8650f8e5
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AnalysisSetupSigmaStar.C
1 // Created by Enrico Fragiacomo - 13/02/14
2 // Based on AnalysisSetupRsnMini
3 //
4 // This macro sets all those aspects of configuration of an Analysis Train run
5 // which are always the same for all kinds of analysis (local, PROOF, AliEn)
6 //
7 // Inputs:
8 //
9 //   - options        = a set of keywords which drive some configurations
10 //   - outputFileName = name of file produced by train
11 //   - configPath     = a path where all required config macros are stored
12 //
13 // Returns:
14 //   
15 //   - if successful: the name of the expected input TTre (esdTree or aodTree)
16 //   - if failed    : NULL
17 //
18
19 enum ERsnCollType_t { kPP=0,
20                       kPPb,
21                       kPbPb};
22
23 TString Setup
24 (
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    TString opt(options);
38    opt.ToUpper();
39    
40    Bool_t isMC      = opt.Contains("MC") || (!opt.Contains("DATA"));
41    Bool_t isESD     = opt.Contains("ESD");
42    Bool_t useTender = opt.Contains("Tender");
43    Bool_t noV0      = opt.Contains("NOV0");
44
45    Int_t collSyst;
46    if( opt.Contains("PP") && (!opt.Contains("PB")) ) collSyst=kPP;
47    else if( opt.Contains("PPB") ) collSyst=kPPb;
48    else collSyst=kPbPb;
49
50    //
51    // === LOAD LIBRARIES ===========================================================================
52    //
53
54    // load analysis libraries
55    gSystem->Load("libSTEERBase.so");
56    gSystem->Load("libESD.so");
57    gSystem->Load("libAOD.so");
58    gSystem->Load("libANALYSIS.so");
59    gSystem->Load("libANALYSISalice.so");
60    gSystem->Load("libEventMixing.so");
61    gSystem->Load("libCORRFW.so");
62    
63    // tender-related libraries
64    if (isESD && useTender) {
65       ::Info("AnalysisSetup", "Loading tender libraries");
66       gSystem->Load("libTender.so");
67       gSystem->Load("libTenderSupplies.so");
68    } else if (!isESD) {
69       useTender = kFALSE;
70    }
71    
72    // load development RSN library
73    if (!AliAnalysisAlien::SetupPar("PWGLFresonances.par")) return "";
74
75    //
76    // === CREATE ANALYSIS MANAGER ==================================================================
77    //
78
79    AliAnalysisManager *mgr = new AliAnalysisManager("RsnAnalysisManager");
80    mgr->SetCommonFileName(outputFileName);
81    ::Info("AnalysisSetup", "Common file name: %s", outputFileName);
82
83    //
84    // === INPUT / OUTPUT HANDLER CONFIGURATION =====================================================
85    //
86
87    if (isESD) {
88       out = "esdTree";
89       ::Info("AnalysisSetup", "Creating ESD handler");
90       AliESDInputHandler *esdHandler = new AliESDInputHandler();
91       mgr->SetInputEventHandler(esdHandler);
92       if (isMC) {
93          ::Info("AnalysisSetup", "Creating MC handler");
94          AliMCEventHandler *mcHandler  = new AliMCEventHandler();
95          mgr->SetMCtruthEventHandler(mcHandler);
96       }
97    } else {
98       out = "aodTree";
99       ::Info("AnalysisSetup", "Creating AOD handler");
100       AliAODInputHandler *aodHandler = new AliAODInputHandler();
101       mgr->SetInputEventHandler(aodHandler);
102    }
103    
104    //
105    // === Tender TASK (ESD only -- optional) =======================================================
106    //
107
108    if (isESD && useTender) {
109       ::Info("AnalysisSetup", "Adding tender (and then accepting V0 info)", options);
110       gROOT->LoadMacro(Form("%s/AddTaskTender.C", macroPath));
111       AddTaskTender();
112       noV0 = kFALSE;
113    }
114
115    //
116    // === PHYSICS SELECTION (ESD only) =============================================================
117    //
118
119    if (isESD) {
120       ::Info("AnalysisSetup", "Add physics selection by default on ESD analysis");
121       gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPhysicsSelection.C");
122       AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC);
123       if (noV0) {
124          ::Info("AnalysisSetup", "Skip of V0 info is required");
125          physSelTask->GetPhysicsSelection()->SetSkipV0(kTRUE);
126       }
127    }
128    
129    //
130    // === CENTRALITY/PLANE (ESD only) ==============================================================
131    //
132
133    if (isESD && !(collSyst==kPP) ) {
134      ::Info("AnalysisSetup", "Add centrality and event plane computation tasks");
135       gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskCentrality.C");
136       gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskEventplane.C");
137       AliCentralitySelectionTask* taskCentrality = (AliCentralitySelectionTask*)AddTaskCentrality();
138       if (isMC) {
139         ::Info("AnalysisSetup", "Setting centrality computation for MC");
140         taskCentrality->SetMCInput();
141       }
142       AddTaskEventplane();
143    }
144
145    //
146    // === PID RESPONSE =============================================================================
147    //
148    
149    gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDResponse.C");
150    AddTaskPIDResponse(isMC);
151       
152    //
153    // === MAIN TASK FOR THE SIGMASTAR ANALYSIS ==============================================================================
154    //
155    
156    gROOT->LoadMacro(Form("%s/AddTaskSigmaStar.C", macroPath));
157    if (!AddTaskSigmaStar(isMC, collSyst, 10.0 ,0, 0, 0, 5, 3.0, 3.0, 7.0, 0.01, 0.3, 0.97, 0.5, 70, 1.0, 10.0, 20.0, 68, "Sigma1385")) return ""; 
158
159    ::Info("AnalysisSetup", "Setup successful");
160    return out;
161 }