]>
Commit | Line | Data |
---|---|---|
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 | |
8c6128b7 | 16 | * isModeAOD -> Use AOD input |
cb68eb1d | 17 | * |
18 | * - OUTPUT CONTAINER : #N = 5 | |
19 | * (1) - Standard Output, Distributions | |
20 | * (2) - Efficiency ThnSparse | |
21 | * (3) - Contamination ThnSparse | |
22 | * (4) - DCA ThnSparse | |
23 | * (5) - QA ThnSparse | |
24 | * | |
25 | ********************************************************************************* */ | |
26 | ||
27 | AliAnalysisTask *AddTaskNetParticle(const Char_t * name = "jthaeder_NetProton", | |
28 | Bool_t isModeDist, Bool_t isModeEff, Bool_t isModeDCA, Bool_t useQAThnSparse = kFALSE, | |
9be43c8e | 29 | Bool_t isCreateCSC = kFALSE, Bool_t isModeAOD = kFALSE) { |
cb68eb1d | 30 | |
31 | TString sName(name); | |
32 | ||
33 | if (isCreateCSC && !isModeEff) { | |
34 | Error("AddTaskNetParticle", "Creating CrossSectionCorrection needs 'isModeEff' to be set."); | |
35 | return NULL; | |
36 | } | |
37 | ||
38 | // ---------------------------------------------- | |
39 | // -- Get the current analysis manager | |
40 | // ---------------------------------------------- | |
41 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
42 | if (!mgr) { | |
43 | Error("AddTaskNetParticle", "No analysis manager found."); | |
44 | return NULL; | |
45 | } | |
46 | ||
47 | // ---------------------------------------------- | |
48 | // -- Check for MC | |
49 | // ---------------------------------------------- | |
50 | Bool_t isMC = (mgr->GetMCtruthEventHandler() != NULL); | |
51 | if (isMC) | |
52 | Info("AddTaskNetParticle", "This task has MC."); | |
53 | ||
54 | // ---------------------------------------------- | |
478c95cf | 55 | // -- Create task |
cb68eb1d | 56 | // ---------------------------------------------- |
57 | AliAnalysisTaskNetParticle *task = new AliAnalysisTaskNetParticle("AliAnalysisTaskNetParticle"); | |
58 | if (!task) { | |
59 | Error("AddTaskNetParticle", "Task could not be created."); | |
60 | return NULL; | |
61 | } | |
62 | ||
478c95cf | 63 | // ---------------------------------------------- |
64 | // -- Configure flags | |
65 | // ---------------------------------------------- | |
66 | ||
67 | // -- Enable QA plots | |
68 | Int_t isModeQA = 0; | |
69 | ||
cb68eb1d | 70 | if (isMC) |
71 | task->SetIsMC(); | |
478c95cf | 72 | if (isModeEff) |
73 | task->SetModeEffCreation(1); // => 1 = on | 0 = off (default) | |
74 | if (isModeDCA) | |
75 | task->SetModeDCACreation(1); // => 1 = on | 0 = off (default) | |
76 | if (isModeDist) | |
77 | task->SetModeDistCreation(1); // => 1 = on | 0 = off (default) | |
78 | if (isModeAOD) { | |
79 | task->SetIsAOD(1); // => 1 = AOD | 0 = ESD (default) | |
80 | task->SetTrackFilterBit(1024); // 1024 = RAA cuts | |
81 | } | |
82 | if (isModeQA) | |
83 | task->SetModeQACreation(1); // => 1 = on | 0 = off (default) | |
cb68eb1d | 84 | |
478c95cf | 85 | // ---------------------------------------------- |
86 | // -- Create helper class | |
87 | // ---------------------------------------------- | |
88 | AliAnalysisNetParticleHelper *helper = new AliAnalysisNetParticleHelper; | |
89 | if (!helper) { | |
90 | Error("AddTaskNetParticle", "Helper could not be created."); | |
91 | delete task; | |
92 | return NULL; | |
93 | } | |
94 | ||
95 | task->SetNetParticleHelper(helper); | |
96 | ||
97 | // ---------------------------------------------- | |
cb68eb1d | 98 | // -- Set particle type |
99 | // ---------------------------------------------- | |
478c95cf | 100 | Float_t minPt, maxPt, minPtEff, maxPtEff, minPtForTOF, nSigmaTPC, nSigmaTOF; |
cb68eb1d | 101 | |
102 | if (sName.Contains("Proton")) { | |
478c95cf | 103 | helper->SetParticleSpecies(AliPID::kProton); |
104 | helper->SetControlParticleSpecies(3122, kTRUE, "Lambda"); | |
8c6128b7 | 105 | minPt = 0.4; maxPt = 0.8; |
cb68eb1d | 106 | minPtEff = 0.2; maxPtEff = 2.6; |
107 | minPtForTOF = 0.8; | |
478c95cf | 108 | nSigmaTPC = 2.5; nSigmaTOF = 2.5; |
cb68eb1d | 109 | if (isCreateCSC) { |
110 | minPtForTOF = maxPtEff; | |
111 | } | |
112 | } | |
113 | else if (sName.Contains("Pion")) { | |
478c95cf | 114 | helper->SetParticleSpecies(AliPID::kPion); |
8c6128b7 | 115 | minPt = 0.25; maxPt = 0.7; |
cb68eb1d | 116 | minPtEff = 0.2; maxPtEff = 1.2; |
117 | minPtForTOF = 0.8; | |
478c95cf | 118 | nSigmaTPC = 2.5; nSigmaTOF = 2.5; |
cb68eb1d | 119 | } |
120 | else if (sName.Contains("Kaon")) { | |
478c95cf | 121 | helper->SetParticleSpecies(AliPID::kKaon); |
8c6128b7 | 122 | minPt = 0.5; maxPt = 1.4; |
9be43c8e | 123 | minPtEff = 0.1; maxPtEff = 2.5; |
e45ea6db | 124 | minPtForTOF = 0.5; |
478c95cf | 125 | nSigmaTPC = 2.5; nSigmaTOF = 2.5; |
126 | } | |
127 | else if (sName.Contains("Charge")) { | |
128 | helper->SetUsePID(kFALSE); | |
8c6128b7 | 129 | minPt = 0.3; maxPt = 2.5; |
478c95cf | 130 | minPtEff = 0.1; maxPtEff = 3.0; |
131 | minPtForTOF = -1.; | |
132 | nSigmaTPC = -1.; nSigmaTOF = -1.; | |
cb68eb1d | 133 | } |
134 | else { | |
135 | Error("AddTaskNetParticle", "Unknown Particle type."); | |
478c95cf | 136 | delete task; |
cb68eb1d | 137 | return NULL; |
138 | } | |
139 | ||
cb68eb1d | 140 | // ---------------------------------------------- |
cb68eb1d | 141 | // -- Configure cuts |
142 | // ---------------------------------------------- | |
143 | ||
144 | // -- Set cut flags ... | |
8c6128b7 | 145 | task->SetESDTrackCutMode(0); // => 0 = clean | 1 = dirty |
cb68eb1d | 146 | |
cb68eb1d | 147 | // -- Set analysis ranges |
8c6128b7 | 148 | task->SetEtaMax(0.8); // eta cut |
149 | task->SetEtaMaxEff(0.9); // eta cut for efficiency | |
cb68eb1d | 150 | task->SetPtRange(minPt, maxPt); // pt cut range for the analysis |
151 | task->SetPtRangeEff(minPtEff, maxPtEff); // pt cut range for the correction / efficiency / contamination creation | |
478c95cf | 152 | |
153 | // ---------------------------------------------- | |
154 | // -- Configure cuts - helper class | |
155 | // ---------------------------------------------- | |
156 | ||
157 | // -- Set standard event cuts | |
158 | helper->SetVertexZMax(10.); | |
159 | helper->SetCentralityBinMax(7); | |
160 | ||
161 | // -- Set track event cuts | |
162 | helper->SetRapidityMax(0.5); | |
163 | helper->SetMinTrackLengthMC(70.); | |
164 | helper->SetNSigmaMaxCdd(3.); | |
165 | helper->SetNSigmaMaxCzz(3.); | |
166 | ||
167 | // -- Set pid cuts | |
168 | helper->SetNSigmaMaxTPC(nSigmaTPC); | |
169 | helper->SetNSigmaMaxTOF(nSigmaTOF); | |
170 | helper->SetMinPtForTOFRequired(minPtForTOF); | |
cb68eb1d | 171 | |
172 | // ---------------------------------------------- | |
478c95cf | 173 | // -- Add task to the ANALYSIS manager |
cb68eb1d | 174 | // ---------------------------------------------- |
478c95cf | 175 | mgr->AddTask(task); |
cb68eb1d | 176 | |
177 | // ---------------------------------------------- | |
178 | // -- data containers - input | |
179 | // ---------------------------------------------- | |
180 | AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); | |
181 | ||
182 | // ---------------------------------------------- | |
183 | // -- data containers - output | |
184 | // ---------------------------------------------- | |
185 | AliAnalysisDataContainer *coutput = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name)); | |
186 | AliAnalysisDataContainer *coutputEff = mgr->CreateContainer(Form("%s_eff", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name)); | |
187 | AliAnalysisDataContainer *coutputCont = mgr->CreateContainer(Form("%s_cont", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name)); | |
188 | AliAnalysisDataContainer *coutputDca = mgr->CreateContainer(Form("%s_dca", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name)); | |
189 | ||
190 | AliAnalysisDataContainer *coutputQA = mgr->CreateContainer(Form("%sQA", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%sQA.root", name)); | |
191 | ||
192 | mgr->ConnectInput (task, 0, cinput ); | |
193 | mgr->ConnectOutput (task, 1, coutput); | |
194 | mgr->ConnectOutput (task, 2, coutputEff); | |
195 | mgr->ConnectOutput (task, 3, coutputCont); | |
196 | mgr->ConnectOutput (task, 4, coutputDca); | |
197 | mgr->ConnectOutput (task, 5, coutputQA); | |
198 | ||
199 | return task; | |
200 | } |