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