]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/EBYE/NetParticle/macros/AddTaskNetParticle.C
Added directory PWGLF/STRANGENESS/Correlations to CMakelibPWGLFSTRANGENESS.pkg
[u/mrichter/AliRoot.git] / PWGCF / EBYE / NetParticle / macros / AddTaskNetParticle.C
CommitLineData
cb68eb1d 1/* *********************************************************************************
2 * File : AddTaskNetParticle.C
3 * Author : Jochen Thaeder <jochen@thaeder.de>
4 * *********************************************************************************
5 * Configuring NetParticle Task:
6 * - ARGUMENTS :
7 * name -> Name of the task, containing partcile type :
8 * Currently : Proton, Pion, Kaon
9 * isModeDist -> Fill Distributions
10 * isModeEff -> Fill Efficiency/Contamination ThnSparse
11 * isModeDCA -> Fill DCA ThnSparse
12 * useQAThnSparse -> Fill QA ThnSparse
13 * isCreateCSC -> Prepare for CrossSectionCorrection
14 * - requires isModeEff to be set
15 * - Proton only
16 *
17 * - OUTPUT CONTAINER : #N = 5
18 * (1) - Standard Output, Distributions
19 * (2) - Efficiency ThnSparse
20 * (3) - Contamination ThnSparse
21 * (4) - DCA ThnSparse
22 * (5) - QA ThnSparse
23 *
24 ********************************************************************************* */
25
26AliAnalysisTask *AddTaskNetParticle(const Char_t * name = "jthaeder_NetProton",
27 Bool_t isModeDist, Bool_t isModeEff, Bool_t isModeDCA, Bool_t useQAThnSparse = kFALSE,
28 Bool_t isCreateCSC = kFALSE) {
29
30 TString sName(name);
31
32 if (isCreateCSC && !isModeEff) {
33 Error("AddTaskNetParticle", "Creating CrossSectionCorrection needs 'isModeEff' to be set.");
34 return NULL;
35 }
36
37 // ----------------------------------------------
38 // -- Get the current analysis manager
39 // ----------------------------------------------
40 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
41 if (!mgr) {
42 Error("AddTaskNetParticle", "No analysis manager found.");
43 return NULL;
44 }
45
46 // ----------------------------------------------
47 // -- Check for MC
48 // ----------------------------------------------
49 Bool_t isMC = (mgr->GetMCtruthEventHandler() != NULL);
50 if (isMC)
51 Info("AddTaskNetParticle", "This task has MC.");
52
53 // ----------------------------------------------
54 // -- Create task configure it
55 // ----------------------------------------------
56 AliAnalysisTaskNetParticle *task = new AliAnalysisTaskNetParticle("AliAnalysisTaskNetParticle");
57 if (!task) {
58 Error("AddTaskNetParticle", "Task could not be created.");
59 return NULL;
60 }
61
62 if (isMC)
63 task->SetIsMC();
64
65 // -- Set particle type
66 // ----------------------------------------------
67 Float_t minPt, maxPt, minPtEff, maxPtEff, minPtForTOF;
68
69 if (sName.Contains("Proton")) {
70 task->SetParticleSpecies(AliPID::kProton);
71 task->SetControlParticleSpecies(3122, kTRUE, "Lambda");
72 minPt = 0.4; maxPt = 2.2;
73 minPtEff = 0.2; maxPtEff = 2.6;
74 minPtForTOF = 0.8;
75 if (isCreateCSC) {
76 minPtForTOF = maxPtEff;
77 }
78 }
79 else if (sName.Contains("Pion")) {
80 task->SetParticleSpecies(AliPID::kPion);
81 task->SetControlParticleSpecies(3122, kTRUE, "Lambda"); /// maybe something else ...
82 minPt = 0.3; maxPt = 0.9;
83 minPtEff = 0.2; maxPtEff = 1.2;
84 minPtForTOF = 0.8;
85 }
86 else if (sName.Contains("Kaon")) {
87 task->SetParticleSpecies(AliPID::kKaon);
88 task->SetControlParticleSpecies(3122, kTRUE, "Lambda"); /// maybe something else ...
89 minPt = 0.2; maxPt = 0.4;
90 minPtEff = 0.1; maxPtEff = 0.8;
91 minPtForTOF = 0.8;
92 }
93 else {
94 Error("AddTaskNetParticle", "Unknown Particle type.");
95 return NULL;
96 }
97
98 // -- Configure flags
99 // ----------------------------------------------
100 if (isModeEff)
101 task->SetModeEffCreation(1); // => 1 = on | 0 = off (default)
102 if (isModeDCA)
103 task->SetModeDCACreation(1); // => 1 = on | 0 = off (default)
104 if (isModeDist)
105 task->SetModeDistCreation(1); // => 1 = on | 0 = off (default)
106
107 // -- Enable QA plots
108 if (useQAThnSparse)
109 task->SetUseQATHnSparse(kTRUE);
110
111 // -- Configure cuts
112 // ----------------------------------------------
113
114 // -- Set cut flags ...
115 task->SetESDTrackCutMode(0); // => 0 = clean | 1 = dirty
116
117 // -- Set standard event cuts
118 task->SetVertexZMax(10.);
119 task->SetCentralityBinMax(7);
120
121 // -- Set track event cuts
122 task->SetRapidityMax(0.5);
123 task->SetMinTrackLengthMC(70.);
124 task->SetNSigmaMaxCdd(3.);
125 task->SetNSigmaMaxCzz(3.);
126
127 task->SetNSigmaMaxTPC(2.5);
128 task->SetNSigmaMaxTOF(2.5);
129 task->SetMinPtForTOFRequired(minPtForTOF);
130
131 // -- Set analysis ranges
132 task->SetEtaMax(0.9);
133 task->SetPtRange(minPt, maxPt); // pt cut range for the analysis
134 task->SetPtRangeEff(minPtEff, maxPtEff); // pt cut range for the correction / efficiency / contamination creation
135
136 // ----------------------------------------------
137 // -- Initialize and add task to the ANALYSIS manager
138 // ----------------------------------------------
139 if (!task->Initialize())
140 mgr->AddTask(task);
141 else {
142 Error("Initialize failed, not adding AliAnalysistaskNetParticle !!!");
143 delete task;
144 return NULL;
145 }
146
147 // ----------------------------------------------
148 // -- data containers - input
149 // ----------------------------------------------
150 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
151
152 // ----------------------------------------------
153 // -- data containers - output
154 // ----------------------------------------------
155 AliAnalysisDataContainer *coutput = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name));
156 AliAnalysisDataContainer *coutputEff = mgr->CreateContainer(Form("%s_eff", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name));
157 AliAnalysisDataContainer *coutputCont = mgr->CreateContainer(Form("%s_cont", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name));
158 AliAnalysisDataContainer *coutputDca = mgr->CreateContainer(Form("%s_dca", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name));
159
160 AliAnalysisDataContainer *coutputQA = mgr->CreateContainer(Form("%sQA", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%sQA.root", name));
161
162 mgr->ConnectInput (task, 0, cinput );
163 mgr->ConnectOutput (task, 1, coutput);
164 mgr->ConnectOutput (task, 2, coutputEff);
165 mgr->ConnectOutput (task, 3, coutputCont);
166 mgr->ConnectOutput (task, 4, coutputDca);
167 mgr->ConnectOutput (task, 5, coutputQA);
168
169 return task;
170}