]>
Commit | Line | Data |
---|---|---|
70da6c5a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
27de2dfb | 15 | |
16 | /* $Id$ */ | |
17 | ||
70da6c5a | 18 | // |
19 | // The analysis task: | |
20 | // impact parameter resolution and pull study | |
21 | // for tracks which survivied the particle cuts | |
22 | // | |
23 | // | |
24 | // Authors: | |
25 | // Hongyan Yang <hongyan@physi.uni-heidelberg.de> | |
26 | // Carlo Bombonati <carlo.bombonati@cern.ch> | |
27 | // | |
6555e2ad | 28 | #include <Riostream.h> |
70da6c5a | 29 | #include <TChain.h> |
30 | #include <TFile.h> | |
31 | #include <TH1F.h> | |
32 | #include <TH1I.h> | |
33 | #include <TList.h> | |
34 | #include <TMath.h> | |
35 | #include <TObjArray.h> | |
36 | #include <TParticle.h> | |
37 | #include <TString.h> | |
38 | ||
39 | #include <TCanvas.h> | |
40 | ||
faee3b18 | 41 | #include "AliAnalysisManager.h" |
42 | ||
70da6c5a | 43 | #include "AliCFManager.h" |
faee3b18 | 44 | |
70da6c5a | 45 | #include "AliESDInputHandler.h" |
46 | #include "AliESDtrack.h" | |
faee3b18 | 47 | #include "AliVertexerTracks.h" |
48 | #include "AliESDVertex.h" | |
49 | ||
70da6c5a | 50 | #include "AliMCEventHandler.h" |
faee3b18 | 51 | #include "AliMCEvent.h" |
70da6c5a | 52 | #include "AliMCParticle.h" |
53 | ||
faee3b18 | 54 | #include "AliESDpid.h" |
55 | #include "AliHFEpid.h" | |
70da6c5a | 56 | #include "AliHFEcuts.h" |
57 | #include "AliHFEdca.h" | |
6555e2ad | 58 | #include "AliHFEtools.h" |
70da6c5a | 59 | |
60 | #include "AliAnalysisTaskDCA.h" | |
61 | ||
62 | ||
63 | //____________________________________________________________ | |
64 | AliAnalysisTaskDCA::AliAnalysisTaskDCA(): | |
faee3b18 | 65 | AliAnalysisTaskSE("Impact Parameter Resolution and Pull Analysis") |
70da6c5a | 66 | , fPlugins(0) |
70da6c5a | 67 | , fCuts(0x0) |
faee3b18 | 68 | , fDefaultPID(0x0) |
69 | , fHFEpid(0x0) | |
70 | , fPIDdetectors("") | |
71 | , fPIDstrategy(0) | |
70da6c5a | 72 | , fCFM(0x0) |
73 | , fDCA(0x0) | |
70da6c5a | 74 | , fNclustersITS(0x0) |
faee3b18 | 75 | , fMinNprimVtxContrbutor(0x0) |
70da6c5a | 76 | , fNEvents(0x0) |
77 | , fResidualList(0x0) | |
78 | , fPullList(0x0) | |
faee3b18 | 79 | , fDcaList(0x0) |
80 | , fKfDcaList(0x0) | |
81 | , fMcVertexList(0x0) | |
82 | , fDataDcaList(0x0) | |
83 | , fDataVertexList(0x0) | |
84 | , fDataPullList(0x0) | |
85 | , fMcPidList(0x0) | |
86 | , fDataPidList(0x0) | |
87 | , fHfeDcaList(0x0) | |
88 | , fHfeDataDcaList(0x0) | |
70da6c5a | 89 | , fOutput(0x0) |
90 | { | |
91 | // | |
92 | // Dummy constructor | |
93 | // | |
94 | DefineInput(0, TChain::Class()); | |
faee3b18 | 95 | DefineOutput(1, TH1I::Class()); |
96 | DefineOutput(2, TList::Class()); | |
70da6c5a | 97 | |
bf892a6a | 98 | //printf(" ---> Dummy constructor used!\n"); |
6555e2ad | 99 | AliInfo("Dummy constructor used!"); |
100 | fDefaultPID = new AliESDpid(); | |
101 | fHFEpid = new AliHFEpid("dummyPID"); | |
70da6c5a | 102 | |
103 | } | |
104 | ||
105 | //____________________________________________________________ | |
106 | AliAnalysisTaskDCA::AliAnalysisTaskDCA(const char * name): | |
faee3b18 | 107 | AliAnalysisTaskSE(name) |
70da6c5a | 108 | , fPlugins(0) |
70da6c5a | 109 | , fCuts(0x0) |
faee3b18 | 110 | , fDefaultPID(0x0) |
111 | , fHFEpid(0x0) | |
112 | , fPIDdetectors("") | |
113 | , fPIDstrategy(0) | |
70da6c5a | 114 | , fCFM(0x0) |
115 | , fDCA(0x0) | |
70da6c5a | 116 | , fNclustersITS(0x0) |
faee3b18 | 117 | , fMinNprimVtxContrbutor(0x0) |
70da6c5a | 118 | , fNEvents(0x0) |
119 | , fResidualList(0x0) | |
120 | , fPullList(0x0) | |
faee3b18 | 121 | , fDcaList(0x0) |
122 | , fKfDcaList(0x0) | |
123 | , fMcVertexList(0x0) | |
124 | , fDataDcaList(0x0) | |
125 | , fDataVertexList(0x0) | |
126 | , fDataPullList(0x0) | |
127 | , fMcPidList(0x0) | |
128 | , fDataPidList(0x0) | |
129 | , fHfeDcaList(0x0) | |
130 | , fHfeDataDcaList(0x0) | |
70da6c5a | 131 | , fOutput(0x0) |
132 | { | |
133 | // | |
134 | // Default constructor | |
135 | // | |
136 | DefineInput(0, TChain::Class()); | |
faee3b18 | 137 | DefineOutput(1, TH1I::Class()); |
138 | DefineOutput(2, TList::Class()); | |
6555e2ad | 139 | |
140 | ||
141 | //-CUTS SETTING-// | |
142 | Int_t nMinTPCcluster = 100; | |
143 | Float_t maxDcaXY = 0.5; | |
144 | Float_t maxDcaZ = 1.0; | |
145 | //--------------// | |
146 | AliHFEcuts *hfecuts = new AliHFEcuts; | |
147 | hfecuts->CreateStandardCuts(); | |
148 | hfecuts->SetMinNClustersTPC(nMinTPCcluster); | |
149 | hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst); | |
150 | hfecuts->SetCheckITSLayerStatus(kFALSE); | |
151 | hfecuts->SetMaxImpactParam(maxDcaXY, maxDcaZ); | |
152 | SetHFECuts(hfecuts); | |
bf892a6a | 153 | |
6555e2ad | 154 | fDefaultPID = new AliESDpid(); |
e3fc062d | 155 | fHFEpid = new AliHFEpid("PIDforDCAanalysis"); |
70da6c5a | 156 | |
70da6c5a | 157 | } |
158 | ||
159 | //____________________________________________________________ | |
160 | AliAnalysisTaskDCA::AliAnalysisTaskDCA(const AliAnalysisTaskDCA &ref): | |
faee3b18 | 161 | AliAnalysisTaskSE(ref) |
70da6c5a | 162 | , fPlugins(ref.fPlugins) |
faee3b18 | 163 | , fCuts(ref.fCuts) |
164 | , fDefaultPID(ref.fDefaultPID) | |
165 | , fHFEpid(ref.fHFEpid) | |
166 | , fPIDdetectors(ref.fPIDdetectors) | |
167 | , fPIDstrategy(ref.fPIDstrategy) | |
70da6c5a | 168 | , fCFM(ref.fCFM) |
169 | , fDCA(ref.fDCA) | |
70da6c5a | 170 | , fNclustersITS(ref.fNclustersITS) |
faee3b18 | 171 | , fMinNprimVtxContrbutor(ref.fMinNprimVtxContrbutor) |
70da6c5a | 172 | , fNEvents(ref.fNEvents) |
173 | , fResidualList(ref.fResidualList) | |
174 | , fPullList(ref.fPullList) | |
faee3b18 | 175 | , fDcaList(ref.fDcaList) |
176 | , fKfDcaList(ref.fKfDcaList) | |
177 | , fMcVertexList(ref.fMcVertexList) | |
178 | , fDataDcaList(ref.fDataDcaList) | |
179 | , fDataVertexList(ref.fDataVertexList) | |
180 | , fDataPullList(ref.fDataPullList) | |
181 | , fMcPidList(ref.fMcPidList) | |
182 | , fDataPidList(ref.fDataPidList) | |
183 | , fHfeDcaList(ref.fHfeDcaList) | |
184 | , fHfeDataDcaList(ref.fHfeDataDcaList) | |
70da6c5a | 185 | , fOutput(ref.fOutput) |
186 | { | |
187 | // | |
188 | // Copy Constructor | |
189 | // | |
6555e2ad | 190 | AliInfo("Copy Constructor"); |
faee3b18 | 191 | ref.Copy(*this); |
70da6c5a | 192 | } |
193 | ||
194 | //____________________________________________________________ | |
195 | AliAnalysisTaskDCA &AliAnalysisTaskDCA::operator=(const AliAnalysisTaskDCA &ref){ | |
196 | // | |
197 | // Assignment operator | |
198 | // | |
199 | if(this == &ref) return *this; | |
faee3b18 | 200 | AliAnalysisTaskSE::operator=(ref); |
70da6c5a | 201 | fPlugins = ref.fPlugins; |
70da6c5a | 202 | fCuts = ref.fCuts; |
faee3b18 | 203 | fDefaultPID = ref.fDefaultPID; |
204 | fHFEpid = ref.fHFEpid; | |
205 | fPIDdetectors = ref.fPIDdetectors; | |
206 | fPIDstrategy = ref.fPIDstrategy; | |
70da6c5a | 207 | fCFM = ref.fCFM; |
208 | fDCA = ref.fDCA; | |
70da6c5a | 209 | fNclustersITS = ref.fNclustersITS; |
faee3b18 | 210 | fMinNprimVtxContrbutor = ref.fMinNprimVtxContrbutor; |
70da6c5a | 211 | fNEvents = ref.fNEvents; |
70da6c5a | 212 | fResidualList = ref.fResidualList; |
213 | fPullList = ref.fPullList; | |
faee3b18 | 214 | fDcaList = ref.fDcaList; |
215 | fKfDcaList = ref.fKfDcaList; | |
216 | fMcVertexList = ref.fMcVertexList; | |
217 | fDataDcaList = ref.fDataDcaList; | |
218 | fDataVertexList = ref.fDataVertexList; | |
219 | fDataPullList = ref.fDataPullList; | |
220 | fMcPidList = ref.fMcPidList; | |
221 | fDataPidList = ref.fDataPidList; | |
222 | fHfeDcaList = ref.fHfeDcaList; | |
223 | fHfeDataDcaList = ref.fHfeDataDcaList; | |
224 | fOutput = ref.fOutput; | |
70da6c5a | 225 | |
226 | return *this; | |
227 | } | |
228 | ||
229 | //____________________________________________________________ | |
230 | AliAnalysisTaskDCA::~AliAnalysisTaskDCA(){ | |
231 | // | |
232 | // Destructor | |
233 | // | |
234 | ||
faee3b18 | 235 | if(fDefaultPID) delete fDefaultPID; |
236 | if(fHFEpid) delete fHFEpid; | |
70da6c5a | 237 | if(fCFM) delete fCFM; |
70da6c5a | 238 | if(fDCA) delete fDCA; |
faee3b18 | 239 | if(fNEvents) delete fNEvents; |
70da6c5a | 240 | if(fResidualList){ |
241 | fResidualList->Clear(); | |
242 | delete fResidualList; | |
243 | } | |
244 | ||
245 | if(fPullList){ | |
246 | fPullList->Clear(); | |
247 | delete fPullList; | |
248 | } | |
249 | ||
faee3b18 | 250 | if(fDcaList){ |
251 | fDcaList->Clear(); | |
252 | delete fDcaList; | |
253 | } | |
254 | if(fKfDcaList){ | |
255 | fKfDcaList->Clear(); | |
256 | delete fKfDcaList; | |
257 | } | |
70da6c5a | 258 | |
faee3b18 | 259 | if(fMcVertexList){ |
260 | fMcVertexList->Clear(); | |
261 | delete fMcVertexList; | |
70da6c5a | 262 | } |
faee3b18 | 263 | |
264 | if(fDataDcaList){ | |
265 | fDataDcaList->Clear(); | |
266 | delete fDataDcaList; | |
267 | } | |
268 | ||
269 | if(fDataVertexList){ | |
270 | fDataVertexList->Clear(); | |
271 | delete fDataVertexList; | |
272 | } | |
273 | if(fDataPullList){ | |
274 | fDataPullList->Clear(); | |
275 | delete fDataPullList; | |
276 | } | |
277 | ||
278 | if(fMcPidList){ | |
279 | fMcPidList -> Clear(); | |
280 | delete fMcPidList; | |
281 | } | |
282 | if(fDataPidList){ | |
283 | fDataPidList -> Clear(); | |
284 | delete fDataPidList; | |
285 | } | |
286 | ||
287 | if(fHfeDcaList) { | |
288 | fHfeDcaList->Clear(); | |
289 | delete fHfeDcaList; | |
290 | } | |
291 | ||
292 | if(fHfeDataDcaList) { | |
293 | fHfeDataDcaList->Clear(); | |
294 | delete fHfeDataDcaList; | |
295 | } | |
296 | ||
297 | if(fOutput){ | |
298 | fOutput->Clear(); | |
299 | delete fOutput; | |
70da6c5a | 300 | } |
faee3b18 | 301 | |
70da6c5a | 302 | } |
303 | ||
304 | //____________________________________________________________ | |
faee3b18 | 305 | void AliAnalysisTaskDCA::UserCreateOutputObjects(){ |
70da6c5a | 306 | // create output objects |
307 | // fNEvents | |
308 | // residual and pull | |
bf892a6a | 309 | //printf("\n=====UserCreateOutputObjects=====\n"); |
faee3b18 | 310 | |
311 | // Automatic determination of the analysis mode | |
312 | AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
69ac0e6f | 313 | if(!inputHandler){ |
314 | AliError("NoEvent Handler available"); | |
315 | return; | |
316 | } | |
317 | ||
faee3b18 | 318 | if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){ |
319 | SetAODAnalysis(); | |
320 | } else { | |
321 | SetESDAnalysis(); | |
322 | if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()) | |
323 | SetHasMCData(); | |
324 | } | |
325 | ||
70da6c5a | 326 | |
faee3b18 | 327 | fNEvents = new TH1I("nEvents", "Number of Events in the Analysis", 5, -0.5, 4.5); // Number of Events neccessary for the analysis and not a QA histogram |
70da6c5a | 328 | if(!fOutput) fOutput = new TList; |
329 | // Initialize correction Framework and Cuts | |
330 | fCFM = new AliCFManager; | |
331 | MakeParticleContainer(); | |
332 | // Temporary fix: Initialize particle cuts with 0x0 | |
333 | for(Int_t istep = 0; istep < fCFM->GetParticleContainer()->GetNStep(); istep++) | |
334 | fCFM->SetParticleCutsList(istep, 0x0); | |
335 | if(!fCuts){ | |
336 | AliWarning("Cuts not available. Default cuts will be used"); | |
337 | fCuts = new AliHFEcuts; | |
338 | fCuts->CreateStandardCuts(); | |
339 | } | |
340 | ||
70da6c5a | 341 | fCuts->Initialize(fCFM); |
342 | ||
6555e2ad | 343 | if(!fHFEpid) AliWarning("Hello, fHFEpid is not available"); |
344 | cout<<" Hello this is a cout "<<endl<<endl; | |
345 | ||
bf892a6a | 346 | if(GetPlugin(kHFEpid)) { |
faee3b18 | 347 | fHFEpid->SetHasMCData(HasMCData()); |
6555e2ad | 348 | fHFEpid->AddDetector("TOF", 0); |
349 | fHFEpid->AddDetector("TPC", 1); | |
350 | cout<<endl<<" ---> TPC and TOF added to the PID"<<endl; | |
351 | fHFEpid->ConfigureTPCrejection(); | |
3a72645a | 352 | fHFEpid->InitializePID(); |
faee3b18 | 353 | } |
70da6c5a | 354 | |
355 | // dca study---------------------------------- | |
faee3b18 | 356 | |
357 | ||
70da6c5a | 358 | if(!fDCA) fDCA = new AliHFEdca; |
359 | if(!fResidualList) fResidualList = new TList(); | |
360 | if(!fPullList) fPullList = new TList(); | |
faee3b18 | 361 | if(!fDcaList) fDcaList = new TList(); |
362 | if(!fKfDcaList) fKfDcaList = new TList(); | |
363 | if(!fMcVertexList) fMcVertexList = new TList(); | |
364 | if(!fDataDcaList) fDataDcaList = new TList(); | |
365 | if(!fDataVertexList) fDataVertexList = new TList(); | |
366 | if(!fDataPullList) fDataPullList = new TList(); | |
367 | if(!fMcPidList) fMcPidList = new TList(); | |
368 | if(!fDataPidList) fDataPidList = new TList(); | |
70da6c5a | 369 | |
faee3b18 | 370 | if(!fHfeDcaList) fHfeDcaList = new TList(); |
371 | if(!fHfeDataDcaList) fHfeDataDcaList = new TList(); | |
372 | ||
373 | if(HasMCData()) { | |
374 | if(GetPlugin(kImpactPar) ) { | |
375 | fDCA->CreateHistogramsResidual(fResidualList); | |
376 | fDCA->CreateHistogramsPull(fPullList); | |
377 | fDCA->CreateHistogramsDca(fDcaList); | |
378 | fOutput->AddAt(fResidualList,0); | |
379 | fOutput->AddAt(fPullList,1); | |
380 | fOutput->AddAt(fDcaList,2); | |
381 | } | |
382 | if(GetPlugin(kKFdca)){ | |
383 | fDCA->CreateHistogramsKfDca(fKfDcaList); | |
384 | fOutput->AddAt(fDcaList,3); | |
385 | } | |
6555e2ad | 386 | if(GetPlugin(kPrimVtx)){//<--- |
faee3b18 | 387 | fDCA->CreateHistogramsVertex(fMcVertexList); |
388 | fOutput->AddAt(fMcVertexList,4); | |
389 | } | |
6555e2ad | 390 | if(GetPlugin(kCombinedPid)){//<--- |
faee3b18 | 391 | fDCA->CreateHistogramsPid(fMcPidList); |
392 | fOutput->AddAt(fMcPidList, 5); | |
393 | } | |
6555e2ad | 394 | if(GetPlugin(kHFEpid)){//<--- |
faee3b18 | 395 | fDCA->CreateHistogramsHfeDca(fHfeDcaList); |
396 | fOutput->AddAt(fHfeDcaList, 6); | |
397 | } | |
398 | } // mc case | |
399 | ||
400 | if(!HasMCData()) { | |
401 | ||
402 | if(GetPlugin(kPrimVtx)){ | |
403 | fDCA->CreateHistogramsDataVertex(fDataVertexList); | |
404 | fOutput->AddAt(fDataVertexList,0); | |
405 | } | |
406 | ||
407 | if(GetPlugin(kCombinedPid)){ | |
408 | fDCA->CreateHistogramsDataDca(fDataDcaList); | |
409 | fDCA->CreateHistogramsDataPull(fDataPullList); | |
410 | fDCA->CreateHistogramsDataPid(fDataPidList); | |
411 | fOutput->AddAt(fDataDcaList,1); | |
412 | fOutput->AddAt(fDataPullList,2); | |
413 | fOutput->AddAt(fDataPidList, 3); | |
414 | } | |
415 | if(GetPlugin(kHFEpid)){ | |
416 | fDCA->CreateHistogramsHfeDataDca(fHfeDataDcaList); | |
417 | fOutput->AddAt(fHfeDataDcaList, 4); | |
418 | } | |
419 | ||
70da6c5a | 420 | |
faee3b18 | 421 | |
422 | } // data case | |
423 | ||
70da6c5a | 424 | } |
425 | ||
426 | //____________________________________________________________ | |
faee3b18 | 427 | void AliAnalysisTaskDCA::UserExec(Option_t *){ |
70da6c5a | 428 | // |
429 | // Run the analysis | |
430 | // | |
bf892a6a | 431 | //printf("\n=====UserExec=====\n"); |
6555e2ad | 432 | if(HasMCData()) printf("WITH MC!\n"); |
70da6c5a | 433 | |
434 | AliDebug(3, "Processing ESD events"); | |
435 | ||
faee3b18 | 436 | if(!fInputEvent){ |
437 | AliError("Reconstructed Event not available"); | |
70da6c5a | 438 | return; |
439 | } | |
faee3b18 | 440 | if(HasMCData()){ |
441 | AliDebug(4, Form("MC Event: %p", fMCEvent)); | |
442 | if(!fMCEvent){ | |
443 | AliError("No MC Event, but MC Data required"); | |
444 | return; | |
445 | } | |
70da6c5a | 446 | } |
faee3b18 | 447 | |
70da6c5a | 448 | if(!fCuts){ |
449 | AliError("HFE cuts not available"); | |
450 | return; | |
451 | } | |
faee3b18 | 452 | |
453 | ||
454 | // protection | |
455 | if(IsESDanalysis() && HasMCData()){ | |
456 | // Protect against missing MC trees | |
457 | AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
69ac0e6f | 458 | if(!mcH){ |
459 | AliError("No MC Event Handler available"); | |
460 | return; | |
461 | } | |
faee3b18 | 462 | if(!mcH->InitOk()) return; |
463 | if(!mcH->TreeK()) return; | |
464 | if(!mcH->TreeTR()) return; | |
465 | } | |
466 | ||
467 | if(!IsAODanalysis()) { | |
468 | AliESDInputHandler *inH = dynamic_cast<AliESDInputHandler *>(fInputHandler); | |
69ac0e6f | 469 | if(!inH){ |
470 | AliError("No ESD Event Handler available"); | |
471 | return; | |
472 | } | |
faee3b18 | 473 | AliESDpid *workingPID = inH->GetESDpid(); |
474 | if(workingPID){ | |
475 | AliDebug(1, "Using ESD PID from the input handler"); | |
476 | fHFEpid->SetESDpid(workingPID); | |
477 | } else { | |
478 | AliDebug(1, "Using default ESD PID"); | |
6555e2ad | 479 | fHFEpid->SetESDpid(AliHFEtools::GetDefaultPID(HasMCData())); |
faee3b18 | 480 | } |
481 | ProcessDcaAnalysis(); | |
482 | } | |
483 | ||
484 | ||
485 | PostData(1, fNEvents); | |
486 | PostData(2, fOutput); | |
487 | } | |
488 | //____________________________________________________________ | |
489 | void AliAnalysisTaskDCA::ProcessDcaAnalysis(){ | |
70da6c5a | 490 | |
bf892a6a | 491 | //printf("\n=====ProcessDcaAnalysis=====\n"); |
6555e2ad | 492 | |
70da6c5a | 493 | // |
494 | // Loop ESD | |
495 | // | |
69ac0e6f | 496 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); |
faee3b18 | 497 | if(!fESD){ |
69ac0e6f | 498 | AliError("ESD Event required for ESD Analysis"); |
499 | return; | |
500 | } | |
501 | ||
bf892a6a | 502 | AliMCEvent *fMC = 0x0; |
69ac0e6f | 503 | if(HasMCData()){ |
504 | fMC = dynamic_cast<AliMCEvent*>(fMCEvent); | |
505 | if(!fMC){ | |
506 | AliError("MC Event required for Analysis"); | |
faee3b18 | 507 | return; |
69ac0e6f | 508 | } |
faee3b18 | 509 | } |
510 | ||
511 | fNEvents->Fill(1); // original event number before cut | |
512 | fDCA->ApplyExtraCuts(fESD,fMinNprimVtxContrbutor); // cut on primVtx contributors | |
513 | fNEvents->Fill(3); // events number after cut | |
70da6c5a | 514 | fCFM->SetRecEventInfo(fESD); |
faee3b18 | 515 | |
70da6c5a | 516 | // event cut level |
517 | if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fESD)) return; | |
518 | ||
bf892a6a | 519 | AliESDtrack *track = 0x0; |
520 | AliMCParticle *mctrack = 0x0; | |
521 | AliESDVertex *vtxESDSkip = 0x0; | |
522 | AliHFEpidObject hfetrack; | |
523 | ||
70da6c5a | 524 | for(Int_t itrack = 0; itrack < fESD->GetNumberOfTracks(); itrack++){ |
faee3b18 | 525 | |
70da6c5a | 526 | track = fESD->GetTrack(itrack); |
bf892a6a | 527 | if(HasMCData()) mctrack = dynamic_cast<AliMCParticle *>(fMC->GetTrack(TMath::Abs(track->GetLabel()))); |
70da6c5a | 528 | |
529 | // RecPrim: primary cuts | |
3a72645a | 530 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutStepsMCTrack, track)) continue; |
70da6c5a | 531 | // RecKine: ITSTPC cuts |
3a72645a | 532 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC + AliHFEcuts::kNcutStepsMCTrack, track)) continue; |
70da6c5a | 533 | // HFEcuts: ITS layers cuts |
3a72645a | 534 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS + AliHFEcuts::kNcutStepsMCTrack, track)) continue; |
70da6c5a | 535 | |
faee3b18 | 536 | if(track->GetITSclusters(0)<=fNclustersITS) continue; // require number of ITS clusters |
70da6c5a | 537 | |
faee3b18 | 538 | // track accepted, do PID |
3a72645a | 539 | hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); |
540 | hfetrack.SetRecTrack(track); | |
541 | if(HasMCData()) hfetrack.SetMCTrack(mctrack); | |
faee3b18 | 542 | |
bf892a6a | 543 | //printf("Track %d passed all the cuts!\n",itrack); |
544 | ||
faee3b18 | 545 | if(HasMCData()){ |
546 | if(GetPlugin(kPrimVtx)) | |
547 | fDCA->FillHistogramsVtx(fESD, fMC); | |
548 | if(GetPlugin(kImpactPar)) | |
549 | fDCA->FillHistogramsDca(fESD, track, fMC); | |
550 | if(GetPlugin(kKFdca)) | |
551 | fDCA->FillHistogramsKfDca(fESD, track, fMC); | |
552 | if(GetPlugin(kCombinedPid)) | |
553 | fDCA->FillHistogramsPid(track, fMC); | |
6555e2ad | 554 | if(GetPlugin(kHFEpid)) { // data-like |
bf892a6a | 555 | if(fHFEpid->IsSelected(&hfetrack)){ |
556 | ||
6555e2ad | 557 | // printf("Found an electron in p+p collision! from HFE pid \n"); |
558 | if(!vtxESDSkip){ | |
559 | // method from Andrea D 28.05.2010 | |
560 | AliVertexerTracks *vertexer = new AliVertexerTracks(fESD->GetMagneticField()); | |
561 | vertexer->SetITSMode(); | |
562 | vertexer->SetMinClusters(fNclustersITS); | |
563 | Int_t skipped[2]; | |
564 | skipped[0] = (Int_t)track->GetID(); | |
565 | vertexer->SetSkipTracks(1,skipped); | |
566 | vtxESDSkip = (AliESDVertex*)vertexer->FindPrimaryVertex(fESD); | |
567 | delete vertexer; vertexer = NULL; | |
568 | if(vtxESDSkip->GetNContributors()<fMinNprimVtxContrbutor) continue; | |
569 | } | |
bf892a6a | 570 | //printf("\n[ABOUT TO FILL HFE DCA: MC!]\n"); |
571 | fDCA->FillHistogramsHfeDataDca(fESD, track, vtxESDSkip); | |
572 | } | |
faee3b18 | 573 | } // plugin for hfepid |
574 | } // MC | |
575 | ||
576 | if(!HasMCData()){ | |
577 | if(GetPlugin(kPrimVtx)) | |
578 | fDCA->FillHistogramsDataVtx(fESD); | |
579 | if(GetPlugin(kCombinedPid)) { | |
580 | ||
581 | // method from Andrea D 28.05.2010 | |
582 | AliVertexerTracks *vertexer = new AliVertexerTracks(fESD->GetMagneticField()); | |
583 | vertexer->SetITSMode(); | |
584 | vertexer->SetMinClusters(fNclustersITS); | |
585 | Int_t skipped[2]; | |
586 | skipped[0] = (Int_t)track->GetID(); | |
587 | vertexer->SetSkipTracks(1,skipped); | |
6555e2ad | 588 | vtxESDSkip = (AliESDVertex*)vertexer->FindPrimaryVertex(fESD); |
faee3b18 | 589 | delete vertexer; vertexer = NULL; |
590 | if(vtxESDSkip->GetNContributors()<fMinNprimVtxContrbutor) continue; | |
591 | ||
592 | fDCA->FillHistogramsDataDca(fESD, track, vtxESDSkip); | |
593 | fDCA->FillHistogramsDataPid(track); | |
594 | } | |
595 | if(GetPlugin(kHFEpid)) { | |
596 | if(fHFEpid->IsSelected(&hfetrack)) { | |
597 | // printf("Found an electron in p+p collision! from HFE pid \n"); | |
6555e2ad | 598 | if(!vtxESDSkip){ |
599 | // method from Andrea D 28.05.2010 | |
600 | AliVertexerTracks *vertexer = new AliVertexerTracks(fESD->GetMagneticField()); | |
601 | vertexer->SetITSMode(); | |
602 | vertexer->SetMinClusters(fNclustersITS); | |
603 | Int_t skipped[2]; | |
604 | skipped[0] = (Int_t)track->GetID(); | |
605 | vertexer->SetSkipTracks(1,skipped); | |
606 | vtxESDSkip = (AliESDVertex*)vertexer->FindPrimaryVertex(fESD); | |
607 | delete vertexer; vertexer = NULL; | |
608 | if(vtxESDSkip->GetNContributors()<fMinNprimVtxContrbutor) continue; | |
609 | } | |
bf892a6a | 610 | printf("\n[ABOUT TO FILL HFE DCA: DATA!]\n"); |
6555e2ad | 611 | fDCA->FillHistogramsHfeDataDca(fESD, track,vtxESDSkip); |
faee3b18 | 612 | } |
613 | } // plugin for hfepid | |
614 | } // data case | |
615 | ||
616 | } // track loop | |
617 | ||
70da6c5a | 618 | } |
619 | ||
faee3b18 | 620 | |
70da6c5a | 621 | //____________________________________________________________ |
622 | void AliAnalysisTaskDCA::Terminate(Option_t *){ | |
623 | // | |
624 | // Terminate not implemented at the moment | |
625 | // | |
bf892a6a | 626 | //printf("\n=====Terminate=====\n"); |
70da6c5a | 627 | |
628 | if(GetPlugin(kPostProcess)){ | |
629 | fOutput = dynamic_cast<TList *>(GetOutputData(1)); | |
630 | if(!fOutput){ | |
631 | AliError("Results not available"); | |
632 | return; | |
633 | } | |
634 | PostProcess(); | |
635 | } | |
636 | ||
637 | } | |
638 | ||
639 | ||
640 | //____________________________________________________________ | |
641 | void AliAnalysisTaskDCA::Load(TString filename){ | |
6555e2ad | 642 | |
bf892a6a | 643 | //printf("\n=====Load=====\n"); |
6555e2ad | 644 | |
70da6c5a | 645 | // no need for postprocessing for the moment |
646 | TFile *input = TFile::Open(filename.Data()); | |
647 | if(!input || input->IsZombie()){ | |
648 | AliError("Cannot read file"); | |
649 | return; | |
650 | } | |
651 | ||
70da6c5a | 652 | input->Close(); |
653 | delete input; | |
654 | ||
655 | ||
656 | } | |
657 | ||
658 | //____________________________________________________________ | |
659 | void AliAnalysisTaskDCA::PostProcess(){ | |
660 | // do post processing | |
661 | // should do fitting here for dca resolution | |
662 | // moved to an external macro to do the job | |
663 | ||
bf892a6a | 664 | //printf("\n=====PostProcess=====\n"); |
faee3b18 | 665 | Load("HFEdca.root"); |
70da6c5a | 666 | TCanvas *c1 = new TCanvas("c1", "number of analyzed events", 300, 400); |
667 | fNEvents->Draw(); | |
668 | c1->SaveAs("temp.png"); | |
669 | ||
670 | } | |
671 | ||
672 | ||
673 | ||
674 | ||
675 | //____________________________________________________________ | |
676 | void AliAnalysisTaskDCA::PrintStatus() const { | |
677 | ||
678 | // | |
679 | // Print Analysis status | |
680 | // | |
681 | printf("\n\tAnalysis Settings\n\t========================================\n"); | |
faee3b18 | 682 | printf("\t Running on %s\n", !HasMCData()?"p+p collision data":"MC sample"); |
683 | printf("\t Cuts: %s\n", (fCuts != NULL) ? "YES" : "NO"); | |
684 | printf("\t Impact parameter analysis is %s\n", GetPlugin(kImpactPar)?"ON":"OFF"); | |
685 | printf("\t Using AliKFParticle for analysis? %s\n", GetPlugin(kKFdca)?"ON":"OFF"); | |
686 | printf("\t Primary vertex analysis is %s\n", GetPlugin(kPrimVtx)?"ON":"OFF"); | |
687 | printf("\t Combined pid analysis is %s\n", GetPlugin(kCombinedPid)?"ON":"OFF"); | |
688 | printf("\t HFE pid analysis is %s\n", GetPlugin(kHFEpid)?"ON":"OFF"); | |
689 | printf("\t Post process analysis is %s\n", GetPlugin(kPostProcess)?"ON":"OFF"); | |
70da6c5a | 690 | printf("\t "); |
691 | printf("\n"); | |
692 | } | |
693 | ||
694 | //__________________________________________ | |
695 | void AliAnalysisTaskDCA::SwitchOnPlugin(Int_t plug){ | |
696 | // | |
697 | // Switch on Plugin | |
698 | // Available: | |
699 | // - analyze impact parameter | |
6555e2ad | 700 | // - Post Processing |
701 | ||
702 | AliDebug(2,Form("SwitchOnPlugin %d",plug)); | |
703 | ||
70da6c5a | 704 | switch(plug){ |
faee3b18 | 705 | case kPostProcess: |
706 | SETBIT(fPlugins, plug); | |
707 | break; | |
70da6c5a | 708 | case kImpactPar: |
709 | SETBIT(fPlugins, plug); | |
710 | break; | |
faee3b18 | 711 | case kPrimVtx: |
712 | SETBIT(fPlugins, plug); | |
713 | break; | |
714 | case kCombinedPid: | |
715 | SETBIT(fPlugins, plug); | |
716 | break; | |
717 | case kHFEpid: | |
718 | SETBIT(fPlugins, plug); | |
719 | break; | |
720 | case kKFdca: | |
70da6c5a | 721 | SETBIT(fPlugins, plug); |
722 | break; | |
723 | default: | |
724 | AliError("Unknown Plugin"); | |
725 | }; | |
726 | } | |
727 | ||
728 | ||
729 | //____________________________________________________________ | |
730 | void AliAnalysisTaskDCA::MakeParticleContainer(){ | |
6555e2ad | 731 | |
bf892a6a | 732 | //printf("\n=====MakeParticleContainer=====\n"); |
70da6c5a | 733 | // |
734 | // Create the particle container (borrowed from AliAnalysisTaskHFE) | |
735 | // | |
736 | const Int_t kNvar = 3 ; //number of variables on the grid:pt,eta, phi | |
737 | const Double_t kPtmin = 0.1, kPtmax = 10.; | |
738 | const Double_t kEtamin = -0.9, kEtamax = 0.9; | |
739 | const Double_t kPhimin = 0., kPhimax = 2. * TMath::Pi(); | |
740 | ||
741 | //arrays for the number of bins in each dimension | |
742 | Int_t iBin[kNvar]; | |
743 | iBin[0] = 40; //bins in pt | |
744 | iBin[1] = 8; //bins in eta | |
745 | iBin[2] = 18; // bins in phi | |
746 | ||
747 | //arrays for lower bounds : | |
748 | Double_t* binEdges[kNvar]; | |
749 | for(Int_t ivar = 0; ivar < kNvar; ivar++) | |
750 | binEdges[ivar] = new Double_t[iBin[ivar] + 1]; | |
751 | ||
752 | //values for bin lower bounds | |
753 | for(Int_t i=0; i<=iBin[0]; i++) binEdges[0][i]=(Double_t)TMath::Power(10,TMath::Log10(kPtmin) + (TMath::Log10(kPtmax)-TMath::Log10(kPtmin))/iBin[0]*(Double_t)i); | |
754 | for(Int_t i=0; i<=iBin[1]; i++) binEdges[1][i]=(Double_t)kEtamin + (kEtamax-kEtamin)/iBin[1]*(Double_t)i; | |
755 | for(Int_t i=0; i<=iBin[2]; i++) binEdges[2][i]=(Double_t)kPhimin + (kPhimax-kPhimin)/iBin[2]*(Double_t)i; | |
756 | ||
757 | //one "container" for MC | |
3a72645a | 758 | const Int_t kNcutStepsESDtrack = AliHFEcuts::kNcutStepsRecTrack + 1; |
759 | const Int_t kNcutStepsTrack = AliHFEcuts::kNcutStepsMCTrack + kNcutStepsESDtrack; | |
760 | AliCFContainer* container = new AliCFContainer("container","container for tracks", (kNcutStepsTrack + 1 + 2*(kNcutStepsESDtrack + 1)), kNvar, iBin); | |
70da6c5a | 761 | |
762 | //setting the bin limits | |
763 | for(Int_t ivar = 0; ivar < kNvar; ivar++) | |
764 | container -> SetBinLimits(ivar, binEdges[ivar]); | |
765 | fCFM->SetParticleContainer(container); | |
766 | ||
767 | //create correlation matrix for unfolding | |
768 | Int_t thnDim[2*kNvar]; | |
769 | for (int k=0; k<kNvar; k++) { | |
770 | //first half : reconstructed | |
771 | //second half : MC | |
772 | thnDim[k] = iBin[k]; | |
773 | thnDim[k+kNvar] = iBin[k]; | |
774 | } | |
775 | ||
776 | ||
faee3b18 | 777 | } |
70da6c5a | 778 | |
faee3b18 | 779 | //____________________________________________________________ |
780 | void AliAnalysisTaskDCA::AddPIDdetector(TString detector){ | |
781 | ||
782 | // | |
783 | // Adding PID detector to the task | |
784 | // | |
bf892a6a | 785 | //printf("\n=====AddPIDdetector=====\n"); |
faee3b18 | 786 | |
787 | if(!fPIDdetectors.Length()) | |
788 | fPIDdetectors = detector; | |
789 | else | |
790 | fPIDdetectors += ":" + detector; | |
70da6c5a | 791 | } |
faee3b18 | 792 |