]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/mini/AnalysisSetupRsnMini.C
Classes for 'mini' subpackage for RSN analysis framework
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / mini / AnalysisSetupRsnMini.C
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 //
22 TString 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"));
44    Bool_t isESD     = opt.Contains("ESD");
45    Bool_t useTender = opt.Contains("TENDER");
46    Bool_t noV0      = opt.Contains("NOV0");
47    
48    //
49    // === LOAD LIBRARIES ===========================================================================
50    //
51
52    // load analysis libraries
53    gSystem->Load("libSTEERBase.so");
54    gSystem->Load("libESD.so");
55    gSystem->Load("libAOD.so");
56    gSystem->Load("libANALYSIS.so");
57    gSystem->Load("libANALYSISalice.so");
58    gSystem->Load("libEventMixing.so");
59    gSystem->Load("libCORRFW.so");
60    
61    // tender-related libraries
62    if (useTender) {
63       ::Info("AnalysisSetup", "Loading tender libraries");
64       gSystem->Load("libTENDER.so");
65       gSystem->Load("libTENDERSupplies.so");
66    }
67    
68    // load development RSN library
69    if (!AliAnalysisAlien::SetupPar("PWG2resonances.par")) return "";
70
71    //
72    // === CREATE ANALYSIS MANAGER ==================================================================
73    //
74
75    AliAnalysisManager *mgr = new AliAnalysisManager("RsnAnalysisManager");
76    mgr->SetCommonFileName(outputFileName);
77    ::Info("AnalysisSetup", "Common file name: %s", outputFileName);
78
79    //
80    // === INPUT / OUTPUT HANDLER CONFIGURATION =====================================================
81    //
82
83    // create multi input event handler
84    AliMultiInputEventHandler *multiHandler = new AliMultiInputEventHandler();
85
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) {
119       // setup physics selection
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    // === PID RESPONSE =============================================================================
131    //
132    
133    gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDResponse.C");
134    AddTaskPIDResponse(isMC);
135    
136    //
137    // === OTHER TASKS ==============================================================================
138    //
139    
140    // add RSN task
141    gROOT->LoadMacro(Form("%s/AddAnalysisTaskRsnMini.C", macroPath));
142    if (!AddAnalysisTaskRsnMini(isMC, macroPath, nmix)) return kFALSE;
143    
144    ::Info("AnalysisSetup", "Setup successful");
145    return out;
146 }