]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/macros/train/AddAnalysisTaskRsn.C
Migration of PWG2/RESONANCES -> PWGLF/RESONANCES
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / train / AddAnalysisTaskRsn.C
CommitLineData
00163883 1//
2// General macro to configure the RSN analysis task.
3// It calls all configs desired by the user, by means
4// of the boolean switches defined in the first lines.
5// ---
6// Inputs:
7// 1) flag to know if running on MC or data
8// 2) path where all configs are stored
9// ---
10// Returns:
11// kTRUE --> initialization successful
12// kFALSE --> initialization failed (some config gave errors)
13//
14
15Bool_t useEvent = 1;
16Bool_t useTest = 0;
17Bool_t useKaonMonitor = 1;
18Bool_t usePhiTPC = 1;
19Bool_t useKStarTPC = 0;
20
21Bool_t AddAnalysisTaskRsn
22(
23 Bool_t isMC,
24 Bool_t useCentrality,
25 Bool_t checkPileUp,
26 const char *path = "$(HOME)/code/resonances/alice-rsn-package/PWG2resonances/RESONANCES/macros/test/pulvir"
27)
28{
29 //
30 // -- INITIALIZATION ----------------------------------------------------------------------------
31 //
32
33 // retrieve analysis manager
34 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
35
36 // create the task and connect with physics selection
37 AliRsnAnalysisTask *task = new AliRsnAnalysisTask("RSN");
38 task->SelectCollisionCandidates();
39 mgr->AddTask(task);
40
41 //
42 // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
43 //
44
45 // cut on primary vertex:
46 // - 2nd argument --> |Vz| range
47 // - 3rd argument --> minimum required number of contributors
48 // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
49 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
50
51 // set the check for pileup
52 ::Info("AddAnalysisTaskRsn", "Check of pile-up from SPD is %s", (checkPileUp ? "active" : "disabled"));
53 cutVertex->SetCheckPileUp(checkPileUp);
54
55 // define and fill cut set
56 AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
57 eventCuts->AddCut(cutVertex);
58 eventCuts->SetCutScheme(cutVertex->GetName());
59
60 //
61 // -- CONFIGS -----------------------------------------------------------------------------------
62 //
63
64 // add configs and count how many are added
65 // will return kFALSE if none is added
66
67 Int_t added = 0;
68
69 if (useTest) {
70 // NOTE: this is a test and will had its own definition of event cuts
71 // ----> will not use those defined above
72 gROOT->LoadMacro(Form("%s/RsnConfigTest.C", path));
73 if (!RsnConfigTest(task, isMC)) return kFALSE;
74 added++;
75 }
76
77 if (useEvent) {
78 gROOT->LoadMacro(Form("%s/RsnConfigEvent.C", path));
79 if (!RsnConfigEvent(task, isMC, useCentrality, eventCuts)) return kFALSE;
80 added++;
81 }
82
83 if (useKaonMonitor) {
84 gROOT->LoadMacro(Form("%s/RsnConfigMonitorTPC.C", path));
85 if (!RsnConfigMonitorTPC(task, isMC, useCentrality, eventCuts)) return kFALSE;
86 added++;
87 }
88
89 if (usePhiTPC) {
90 gROOT->LoadMacro(Form("%s/RsnConfigPhiTPC.C", path));
91 if (!RsnConfigPhiTPC(task, isMC, useCentrality, eventCuts)) return kFALSE;
92 added++;
93 }
94
95 if (useKStarTPC) {
96 gROOT->LoadMacro(Form("%s/RsnConfigKStarTPC.C", path));
97 if (!RsnConfigKStarTPC(task, isMC, useCentrality, eventCuts)) return kFALSE;
98 added++;
99 }
100
101 ::Info("AddAnalysisTaskRsn.C", "Added %d configs", added);
102 if (!added) {
103 ::Error("AddAnalysisTaskRsn.C", "Cannot process an empty task!");
104 return kFALSE;
105 }
106
107 //
108 // -- CONTAINERS --------------------------------------------------------------------------------
109 //
110
111 const char *file = AliAnalysisManager::GetCommonFileName();
112 AliAnalysisDataContainer *output = mgr->CreateContainer("RsnOut", TList::Class(), AliAnalysisManager::kOutputContainer, file);
113 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
114 mgr->ConnectOutput(task, 1, output);
115
116 return kTRUE;
117}