]>
Commit | Line | Data |
---|---|---|
f5ec6c30 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2009, 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 | //----------------------------------------------------------------------- | |
17 | // Class for HF corrections as a function of many variables | |
18 | // 6 Steps introduced: MC, MC Acc, Reco, Reco Acc, Reco Acc + ITS Cl, | |
19 | // Reco Acc + ITS Cl + PPR cuts | |
20 | // 11 variables used: pt, y, cosThetaStar, ptPi, ptK, ct, | |
21 | // dca, d0Pi, d0K, d0Pixd0K, cosPointingAngle | |
22 | // | |
23 | //----------------------------------------------------------------------- | |
24 | // Author : C. Zampolli, CERN | |
25 | //----------------------------------------------------------------------- | |
26 | ||
27 | #include <TCanvas.h> | |
28 | #include <TParticle.h> | |
c180f65d | 29 | #include <TDatabasePDG.h> |
f5ec6c30 | 30 | #include <TH1I.h> |
31 | #include <TStyle.h> | |
844d235c | 32 | #include <TFile.h> |
f5ec6c30 | 33 | |
34 | #include "AliCFHeavyFlavourTaskMultiVarMultiStep.h" | |
35 | #include "AliStack.h" | |
36 | #include "AliMCEvent.h" | |
37 | #include "AliCFManager.h" | |
38 | #include "AliCFContainer.h" | |
39 | #include "AliLog.h" | |
40 | #include "AliAODEvent.h" | |
41 | #include "AliAODRecoDecay.h" | |
42 | #include "AliAODRecoDecayHF.h" | |
43 | #include "AliAODRecoDecayHF2Prong.h" | |
44 | #include "AliAODMCParticle.h" | |
45 | ||
46 | //__________________________________________________________________________ | |
47 | AliCFHeavyFlavourTaskMultiVarMultiStep::AliCFHeavyFlavourTaskMultiVarMultiStep() : | |
48 | AliAnalysisTaskSE(), | |
49 | fPDG(0), | |
50 | fCFManager(0x0), | |
51 | fHistEventsProcessed(0x0), | |
52 | fCountMC(0), | |
53 | fCountAcc(0), | |
54 | fCountReco(0), | |
55 | fCountRecoAcc(0), | |
56 | fCountRecoITSClusters(0), | |
57 | fCountRecoPPR(0), | |
58 | fEvents(0), | |
59 | fFillFromGenerated(kFALSE), | |
60 | fMinITSClusters(5) | |
61 | { | |
62 | // | |
63 | //Default ctor | |
64 | // | |
65 | } | |
66 | //___________________________________________________________________________ | |
67 | AliCFHeavyFlavourTaskMultiVarMultiStep::AliCFHeavyFlavourTaskMultiVarMultiStep(const Char_t* name) : | |
68 | AliAnalysisTaskSE(name), | |
69 | fPDG(0), | |
70 | fCFManager(0x0), | |
71 | fHistEventsProcessed(0x0), | |
72 | fCountMC(0), | |
73 | fCountAcc(0), | |
74 | fCountReco(0), | |
75 | fCountRecoAcc(0), | |
76 | fCountRecoITSClusters(0), | |
77 | fCountRecoPPR(0), | |
78 | fEvents(0), | |
79 | fFillFromGenerated(kFALSE), | |
80 | fMinITSClusters(5) | |
81 | { | |
82 | // | |
83 | // Constructor. Initialization of Inputs and Outputs | |
84 | // | |
85 | Info("AliCFHeavyFlavourTaskMultiVarMultiStep","Calling Constructor"); | |
86 | /* | |
87 | DefineInput(0) and DefineOutput(0) | |
88 | are taken care of by AliAnalysisTaskSE constructor | |
89 | */ | |
90 | DefineOutput(1,TH1I::Class()); | |
91 | DefineOutput(2,AliCFContainer::Class()); | |
92 | } | |
93 | ||
94 | //___________________________________________________________________________ | |
95 | AliCFHeavyFlavourTaskMultiVarMultiStep& AliCFHeavyFlavourTaskMultiVarMultiStep::operator=(const AliCFHeavyFlavourTaskMultiVarMultiStep& c) | |
96 | { | |
97 | // | |
98 | // Assignment operator | |
99 | // | |
100 | if (this!=&c) { | |
101 | AliAnalysisTaskSE::operator=(c) ; | |
102 | fPDG = c.fPDG; | |
103 | fCFManager = c.fCFManager; | |
104 | fHistEventsProcessed = c.fHistEventsProcessed; | |
105 | } | |
106 | return *this; | |
107 | } | |
108 | ||
109 | //___________________________________________________________________________ | |
110 | AliCFHeavyFlavourTaskMultiVarMultiStep::AliCFHeavyFlavourTaskMultiVarMultiStep(const AliCFHeavyFlavourTaskMultiVarMultiStep& c) : | |
111 | AliAnalysisTaskSE(c), | |
112 | fPDG(c.fPDG), | |
113 | fCFManager(c.fCFManager), | |
114 | fHistEventsProcessed(c.fHistEventsProcessed), | |
115 | fCountMC(c.fCountMC), | |
116 | fCountAcc(c.fCountAcc), | |
117 | fCountReco(c.fCountReco), | |
118 | fCountRecoAcc(c.fCountRecoAcc), | |
119 | fCountRecoITSClusters(c.fCountRecoITSClusters), | |
120 | fCountRecoPPR(c.fCountRecoPPR), | |
121 | fEvents(c.fEvents), | |
122 | fFillFromGenerated(c.fFillFromGenerated), | |
123 | fMinITSClusters(c.fMinITSClusters) | |
124 | { | |
125 | // | |
126 | // Copy Constructor | |
127 | // | |
128 | } | |
129 | ||
130 | //___________________________________________________________________________ | |
131 | AliCFHeavyFlavourTaskMultiVarMultiStep::~AliCFHeavyFlavourTaskMultiVarMultiStep() { | |
132 | // | |
133 | //destructor | |
134 | // | |
135 | if (fCFManager) delete fCFManager ; | |
136 | if (fHistEventsProcessed) delete fHistEventsProcessed ; | |
137 | } | |
138 | ||
139 | //_________________________________________________ | |
140 | void AliCFHeavyFlavourTaskMultiVarMultiStep::UserExec(Option_t *) | |
141 | { | |
142 | // | |
143 | // Main loop function | |
144 | // | |
145 | ||
146 | if (fFillFromGenerated){ | |
147 | AliWarning("Flag to fill container with generated value ON ---> dca, d0pi, d0K, d0xd0, cosPointingAngle will be set as dummy!"); | |
148 | } | |
149 | ||
150 | if (!fInputEvent) { | |
151 | Error("UserExec","NO EVENT FOUND!"); | |
152 | return; | |
153 | } | |
154 | ||
155 | fEvents++; | |
156 | if (fEvents%10000 ==0) AliInfo(Form("Event %d",fEvents)); | |
157 | AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent); | |
158 | fCFManager->SetEventInfo(aodEvent); | |
159 | ||
160 | // MC-event selection | |
161 | Double_t containerInput[11] ; | |
162 | ||
163 | //loop on the MC event | |
164 | ||
165 | TClonesArray* mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName())); | |
166 | if (!mcArray) AliError("Could not find Monte-Carlo in AOD"); | |
167 | Int_t icountMC = 0; | |
168 | Int_t icountAcc = 0; | |
169 | Int_t icountReco = 0; | |
170 | Int_t icountRecoAcc = 0; | |
171 | Int_t icountRecoITSClusters = 0; | |
172 | Int_t icountRecoPPR = 0; | |
173 | ||
174 | for (Int_t iPart=0; iPart<mcArray->GetEntriesFast(); iPart++) { | |
175 | AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(mcArray->At(iPart)); | |
176 | if (!mcPart) { | |
177 | AliWarning("Particle not found in tree, skipping"); | |
178 | continue; | |
179 | } | |
180 | ||
181 | // check the MC-level cuts | |
182 | if (!fCFManager->CheckParticleCuts(0, mcPart)) continue; // 0 stands for MC level | |
183 | ||
184 | // fill the container for Gen-level selection | |
185 | Double_t vectorMC[6] = {9999.,9999.,9999.,9999.,9999.,9999.}; | |
186 | if (GetGeneratedValuesFromMCParticle(mcPart, mcArray, vectorMC)){ | |
187 | containerInput[0] = vectorMC[0]; | |
188 | containerInput[1] = vectorMC[1] ; | |
189 | containerInput[2] = vectorMC[2] ; | |
190 | containerInput[3] = vectorMC[3] ; | |
191 | containerInput[4] = vectorMC[4] ; | |
192 | containerInput[5] = vectorMC[5] ; // in micron | |
193 | containerInput[6] = 0.; // dummy value, meaningless in MC, in micron | |
194 | containerInput[7] = 0.; // dummy value, meaningless in MC, in micron | |
195 | containerInput[8] = 0.; // dummy value, meaningless in MC, in micron | |
196 | containerInput[9] = -100000.; // dummy value, meaningless in MC, in micron^2 | |
197 | containerInput[10] = 1.01; // dummy value, meaningless in MC | |
198 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepGenerated); | |
199 | icountMC++; | |
200 | ||
201 | // check the MC-Acceptance level cuts | |
202 | // since standard CF functions are not applicable, using Kine Cuts on daughters | |
203 | ||
204 | Int_t daughter0 = mcPart->GetDaughter(0); | |
205 | Int_t daughter1 = mcPart->GetDaughter(1); | |
206 | AliDebug(2, Form("daughter0 = %d and daughter1 = %d",daughter0,daughter1)); | |
207 | if (daughter0 == 0 || daughter1 == 0) { | |
208 | AliDebug(2, "Error! the D0 MC doesn't have correct daughters!! But it should have, this check was already done..."); | |
209 | } | |
210 | if (TMath::Abs(daughter1 - daughter0 != 1)) { | |
211 | AliDebug(2, "The D0 MC doesn't come from a 2-prong decay, but it should be, this check was already done..."); | |
212 | } | |
213 | AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughter0)); | |
214 | AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughter1)); | |
215 | if (!mcPartDaughter0 || !mcPartDaughter1) { | |
216 | AliWarning("At least one Daughter Particle not found in tree, but it should be, this check was already done..."); | |
217 | } | |
218 | Double_t eta0 = mcPartDaughter0->Eta(); | |
219 | Double_t eta1 = mcPartDaughter1->Eta(); | |
220 | Double_t y0 = mcPartDaughter0->Y(); | |
221 | Double_t y1 = mcPartDaughter1->Y(); | |
222 | Double_t pt0 = mcPartDaughter0->Pt(); | |
223 | Double_t pt1 = mcPartDaughter1->Pt(); | |
224 | AliDebug(2, Form("Daughter 0: eta = %f, y = %f, pt = %f", eta0, y0, pt0)); | |
225 | AliDebug(2, Form("Daughter 1: eta = %f, y = %f, pt = %f", eta1, y1, pt1)); | |
226 | Bool_t daught0inAcceptance = (TMath::Abs(eta0) < 0.9 && pt0 > 0.1); | |
227 | Bool_t daught1inAcceptance = (TMath::Abs(eta1) < 0.9 && pt1 > 0.1); | |
228 | if (daught0inAcceptance && daught1inAcceptance) { | |
229 | // checking whether the cuts implemented in the CF are equivalent - simply a cross-check | |
230 | AliDebug(2, "Daughter particles in acceptance"); | |
231 | if (!fCFManager->CheckParticleCuts(1, mcPartDaughter0)) { | |
232 | AliInfo("Inconsistency with CF cut for daughter 0!"); | |
233 | } | |
234 | if (!fCFManager->CheckParticleCuts(1, mcPartDaughter1)) { | |
235 | AliInfo("Inconsistency with CF cut for daughter 1!"); | |
236 | } | |
237 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepAcceptance); | |
238 | icountAcc++; | |
239 | } | |
240 | } | |
241 | else { | |
242 | AliDebug(3,"Problems in filling the container"); | |
243 | continue; | |
244 | } | |
245 | } | |
246 | ||
247 | AliDebug(2, Form("Found %i MC particles that are D0!!",icountMC)); | |
248 | AliDebug(2, Form("Found %i MC particles that are D0 and satisfy Acc cuts!!",icountAcc)); | |
249 | ||
250 | // Now go to rec level | |
251 | fCountMC += icountMC; | |
252 | fCountAcc += icountAcc; | |
253 | ||
1e090d47 | 254 | // AOD primary vertex |
255 | AliAODVertex *vtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex(); | |
256 | ||
f5ec6c30 | 257 | // load heavy flavour vertices |
1e090d47 | 258 | TClonesArray *arrayD0toKpi = (TClonesArray*)((aodEvent->GetList())->FindObject("D0toKpi")); |
259 | if (!arrayD0toKpi) AliError("Could not find array of HF vertices"); | |
260 | AliDebug(2, Form("Found %d vertices",arrayD0toKpi->GetEntriesFast())); | |
f5ec6c30 | 261 | |
1e090d47 | 262 | for (Int_t iD0toKpi = 0; iD0toKpi<arrayD0toKpi->GetEntriesFast(); iD0toKpi++) { |
f5ec6c30 | 263 | |
1e090d47 | 264 | AliAODRecoDecayHF2Prong* d0tokpi = (AliAODRecoDecayHF2Prong*)arrayD0toKpi->At(iD0toKpi); |
265 | Bool_t unsetvtx=kFALSE; | |
266 | if(!d0tokpi->GetOwnPrimaryVtx()) { | |
267 | d0tokpi->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
268 | unsetvtx=kTRUE; | |
269 | } | |
270 | ||
f5ec6c30 | 271 | // find associated MC particle |
1e090d47 | 272 | Int_t mcLabel = d0tokpi->MatchToMC(421, mcArray) ; |
f5ec6c30 | 273 | if (mcLabel == -1) |
274 | { | |
275 | AliDebug(2,"No MC particle found"); | |
276 | } | |
277 | else { | |
278 | AliAODMCParticle* mcVtxHF = (AliAODMCParticle*)mcArray->At(mcLabel); | |
279 | if (!mcVtxHF) { | |
280 | AliWarning("Could not find associated MC in AOD MC tree"); | |
281 | continue; | |
282 | } | |
283 | ||
284 | // check if associated MC v0 passes the cuts | |
285 | if (!fCFManager->CheckParticleCuts(0 ,mcVtxHF)) { // 0 stands for MC | |
286 | AliDebug(2, "Skipping the particles due to cuts"); | |
287 | continue; | |
288 | } | |
289 | ||
290 | ||
291 | // fill the container... | |
1e090d47 | 292 | Double_t pt = d0tokpi->Pt(); |
293 | Double_t rapidity = d0tokpi->YD0(); | |
f5ec6c30 | 294 | |
295 | Double_t cosThetaStar = 9999.; | |
296 | Double_t pTpi = 0.; | |
297 | Double_t pTK = 0.; | |
1e090d47 | 298 | Double_t dca = d0tokpi->GetDCA(); |
f5ec6c30 | 299 | Double_t d0pi = 0.; |
300 | Double_t d0K = 0.; | |
1e090d47 | 301 | Double_t d0xd0 = d0tokpi->Prodd0d0(); |
302 | Double_t cosPointingAngle = d0tokpi->CosPointingAngle(); | |
f5ec6c30 | 303 | Int_t pdgCode = mcVtxHF->GetPdgCode(); |
304 | if (pdgCode > 0){ | |
1e090d47 | 305 | cosThetaStar = d0tokpi->CosThetaStarD0(); |
306 | pTpi = d0tokpi->PtProng(0); | |
307 | pTK = d0tokpi->PtProng(1); | |
308 | d0pi = d0tokpi->Getd0Prong(0); | |
309 | d0K = d0tokpi->Getd0Prong(1); | |
f5ec6c30 | 310 | } |
311 | else { | |
1e090d47 | 312 | cosThetaStar = d0tokpi->CosThetaStarD0bar(); |
313 | pTpi = d0tokpi->PtProng(1); | |
314 | pTK = d0tokpi->PtProng(0); | |
315 | d0pi = d0tokpi->Getd0Prong(1); | |
316 | d0K = d0tokpi->Getd0Prong(0); | |
f5ec6c30 | 317 | } |
318 | ||
1e090d47 | 319 | Double_t cT = d0tokpi->CtD0(); |
f5ec6c30 | 320 | |
321 | if (!fFillFromGenerated){ | |
322 | // ...either with reconstructed values.... | |
323 | containerInput[0] = pt; | |
324 | containerInput[1] = rapidity; | |
325 | containerInput[2] = cosThetaStar; | |
326 | containerInput[3] = pTpi; | |
327 | containerInput[4] = pTK; | |
328 | containerInput[5] = cT*1.E4; // in micron | |
329 | containerInput[6] = dca*1.E4; // in micron | |
330 | containerInput[7] = d0pi*1.E4; // in micron | |
331 | containerInput[8] = d0K*1.E4; // in micron | |
332 | containerInput[9] = d0xd0*1.E8; // in micron^2 | |
333 | containerInput[10] = cosPointingAngle; // in micron | |
334 | } | |
335 | else { | |
336 | // ... or with generated values | |
337 | Double_t vectorMC[6] = {9999.,9999.,9999.,9999.,9999.,9999.}; | |
338 | if (GetGeneratedValuesFromMCParticle(mcVtxHF, mcArray, vectorMC)){ | |
339 | containerInput[0] = vectorMC[0]; | |
340 | containerInput[1] = vectorMC[1] ; | |
341 | containerInput[2] = vectorMC[2] ; | |
342 | containerInput[3] = vectorMC[3] ; | |
343 | containerInput[4] = vectorMC[4] ; | |
344 | containerInput[5] = vectorMC[5] ; // in micron | |
345 | containerInput[6] = 0.; // dummy value, meaningless in MC, in micron | |
346 | containerInput[7] = 0.; // dummy value, meaningless in MC, in micron | |
347 | containerInput[8] = 0.; // dummy value, meaningless in MC, in micron | |
348 | containerInput[9] = 100000.; // dummy value, meaningless in MC, in micron^2 | |
349 | containerInput[10] = 1.01; // dummy value, meaningless in MC | |
350 | } | |
351 | else { | |
352 | AliDebug(3,"Problems in filling the container"); | |
353 | continue; | |
354 | } | |
355 | } | |
356 | AliDebug(2, Form("Filling the container with pt = %f, rapidity = %f, cosThetaStar = %f, pTpi = %f, pTK = %f, cT = %f", containerInput[0], containerInput[1], containerInput[2], containerInput[3], containerInput[4], containerInput[5])); | |
357 | icountReco++; | |
358 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed) ; | |
359 | ||
360 | // cut in acceptance | |
1e090d47 | 361 | Bool_t acceptanceProng0 = (TMath::Abs(d0tokpi->EtaProng(0))< 0.9 && d0tokpi->PtProng(0) > 0.1); |
362 | Bool_t acceptanceProng1 = (TMath::Abs(d0tokpi->EtaProng(1))< 0.9 && d0tokpi->PtProng(1) > 0.1); | |
f5ec6c30 | 363 | if (acceptanceProng0 && acceptanceProng1) { |
364 | AliDebug(2,"D0 reco daughters in acceptance"); | |
365 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoAcceptance) ; | |
366 | icountRecoAcc++; | |
367 | ||
368 | // cut on the min n. of clusters in ITS | |
369 | Int_t ncls0=0; | |
1e090d47 | 370 | for(Int_t l=0;l<6;l++) if(TESTBIT(d0tokpi->GetITSClusterMap(),l)) ncls0++; |
f5ec6c30 | 371 | AliDebug(2, Form("n clusters = %d", ncls0)); |
372 | if (ncls0 >= fMinITSClusters){ | |
373 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoITSClusters) ; | |
374 | icountRecoITSClusters++; | |
375 | AliDebug(2,Form("pT = %f, dca = %f, cosThetaStar = %f, pTpi = %f, pTK = %f, d0pi = %f, d0K = %f, d0xd0 = %f, cosPointingAngle = %f", pt, dca, cosThetaStar,pTpi, pTK, d0pi*1E4, d0K*1E4, d0xd0*1E8, cosPointingAngle)); | |
376 | ||
377 | // PPR cuts | |
844d235c | 378 | Double_t cuts[6] = {9999999., 1.1, 0., 9999999., 9999999., 0.}; |
f5ec6c30 | 379 | if (pt <= 1){ |
380 | cuts[0] = 400; | |
381 | cuts[1] = 0.8; | |
382 | cuts[2] = 0.5; | |
383 | cuts[3] = 500; | |
384 | cuts[4] = -20000; | |
385 | cuts[5] = 0.5; | |
386 | } | |
387 | else if (pt > 1 && pt <= 2){ | |
388 | cuts[0] = 300; | |
389 | cuts[1] = 0.8; | |
390 | cuts[2] = 0.6; | |
391 | cuts[3] = 500; | |
392 | cuts[4] = -20000; | |
393 | cuts[5] = 0.6; | |
394 | } | |
395 | else if (pt > 2 && pt <= 3){ | |
396 | cuts[0] = 200; | |
397 | cuts[1] = 0.8; | |
398 | cuts[2] = 0.7; | |
399 | cuts[3] = 500; | |
400 | cuts[4] = -20000; | |
401 | cuts[5] = 0.8; | |
402 | } | |
403 | else if (pt > 3 && pt <= 5){ | |
404 | cuts[0] = 200; | |
405 | cuts[1] = 0.8; | |
406 | cuts[2] = 0.7; | |
407 | cuts[3] = 500; | |
408 | cuts[4] = -10000; | |
409 | cuts[5] = 0.8; | |
410 | } | |
411 | else if (pt > 5){ | |
412 | cuts[0] = 200; | |
413 | cuts[1] = 0.8; | |
414 | cuts[2] = 0.7; | |
415 | cuts[3] = 500; | |
416 | cuts[4] = -5000; | |
417 | cuts[5] = 0.8; | |
418 | } | |
419 | if (dca*1E4 < cuts[0] | |
420 | && TMath::Abs(cosThetaStar) < cuts[1] | |
421 | && pTpi > cuts[2] | |
422 | && pTK > cuts[2] | |
423 | && TMath::Abs(d0pi*1E4) < cuts[3] | |
424 | && TMath::Abs(d0K*1E4) < cuts[3] | |
425 | && d0xd0*1E8 < cuts[4] | |
426 | && cosPointingAngle > cuts[5] | |
427 | ){ | |
428 | ||
429 | AliDebug(2,"Particle passed PPR cuts"); | |
430 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoPPR) ; | |
431 | icountRecoPPR++; | |
432 | } | |
433 | else{ | |
434 | AliDebug(2,"Particle skipped due to PPR cuts"); | |
435 | if (dca*1E4 > cuts[0]){ | |
436 | AliDebug(2,"Problems with dca"); | |
437 | } | |
438 | if ( TMath::Abs(cosThetaStar) > cuts[1]){ | |
439 | AliDebug(2,"Problems with cosThetaStar"); | |
440 | } | |
441 | if (pTpi < cuts[2]){ | |
442 | AliDebug(2,"Problems with pTpi"); | |
443 | } | |
444 | if (pTK < cuts[2]){ | |
445 | AliDebug(2,"Problems with pTK"); | |
446 | } | |
447 | if (TMath::Abs(d0pi*1E4) > cuts[3]){ | |
448 | AliDebug(2,"Problems with d0pi"); | |
449 | } | |
450 | if (TMath::Abs(d0K*1E4) > cuts[3]){ | |
451 | AliDebug(2,"Problems with d0K"); | |
452 | } | |
453 | if (d0xd0*1E8 > cuts[4]){ | |
454 | AliDebug(2,"Problems with d0xd0"); | |
455 | } | |
456 | if (cosPointingAngle < cuts[5]){ | |
457 | AliDebug(2,"Problems with cosPointingAngle"); | |
458 | } | |
459 | } | |
460 | } | |
461 | } | |
462 | } | |
1e090d47 | 463 | if(unsetvtx) d0tokpi->UnsetOwnPrimaryVtx(); |
464 | } // end loop on D0->Kpi | |
f5ec6c30 | 465 | |
466 | AliDebug(2, Form("Found %i Reco particles that are D0!!",icountReco)); | |
467 | ||
468 | fCountReco+= icountReco; | |
469 | fCountRecoAcc+= icountRecoAcc; | |
470 | fCountRecoITSClusters+= icountRecoITSClusters; | |
471 | fCountRecoPPR+= icountRecoPPR; | |
472 | ||
473 | fHistEventsProcessed->Fill(0); | |
474 | /* PostData(0) is taken care of by AliAnalysisTaskSE */ | |
475 | PostData(1,fHistEventsProcessed) ; | |
476 | PostData(2,fCFManager->GetParticleContainer()) ; | |
477 | } | |
478 | ||
479 | ||
480 | //___________________________________________________________________________ | |
481 | void AliCFHeavyFlavourTaskMultiVarMultiStep::Terminate(Option_t*) | |
482 | { | |
483 | // The Terminate() function is the last function to be called during | |
484 | // a query. It always runs on the client, it can be used to present | |
485 | // the results graphically or save the results to file. | |
486 | ||
487 | Info("Terminate",""); | |
488 | AliAnalysisTaskSE::Terminate(); | |
489 | ||
490 | AliInfo(Form("Found %i MC particles that are D0 in MC, in %d events",fCountMC,fEvents)); | |
491 | AliInfo(Form("Found %i MC particles that are D0 in MC and satisfy Acc cuts, in %d events",fCountAcc,fEvents)); | |
492 | AliInfo(Form("Found %i reco D0 that are decaying in K+pi, in %d events",fCountReco,fEvents)); | |
493 | AliInfo(Form("Among the above, found %i reco D0 that are decaying in K+pi and are in the requested acceptance, in %d events",fCountRecoAcc,fEvents)); | |
494 | AliInfo(Form("Among the above, found %i reco D0 that are decaying in K+pi and have at least %d clusters in ITS, in %d events",fCountRecoITSClusters,fMinITSClusters,fEvents)); | |
495 | AliInfo(Form("Among the above, found %i reco D0 that are decaying in K+pi and satisfy PPR cuts, in %d events",fCountRecoPPR,fEvents)); | |
496 | ||
497 | // draw some example plots.... | |
498 | ||
499 | AliCFContainer *cont= dynamic_cast<AliCFContainer*> (GetOutputData(2)); | |
500 | ||
501 | // projecting the containers to obtain histograms | |
502 | // first argument = variable, second argument = step | |
503 | ||
504 | // MC-level | |
505 | TH1D* h00 = cont->ShowProjection(0,0) ; // pt | |
506 | TH1D* h10 = cont->ShowProjection(1,0) ; // rapidity | |
507 | TH1D* h20 = cont->ShowProjection(2,0) ; // cosThetaStar | |
508 | TH1D* h30 = cont->ShowProjection(3,0) ; // pTpi | |
509 | TH1D* h40 = cont->ShowProjection(4,0) ; // pTK | |
510 | TH1D* h50 = cont->ShowProjection(5,0) ; // cT | |
511 | TH1D* h60 = cont->ShowProjection(6,0) ; // dca | |
512 | TH1D* h70 = cont->ShowProjection(7,0) ; // d0pi | |
513 | TH1D* h80 = cont->ShowProjection(8,0) ; // d0K | |
514 | TH1D* h90 = cont->ShowProjection(9,0) ; // d0xd0 | |
515 | TH1D* h100 = cont->ShowProjection(10,0) ; // cosPointingAngle | |
516 | ||
517 | // MC-Acceptance level | |
518 | TH1D* h01 = cont->ShowProjection(0,1) ; // pt | |
519 | TH1D* h11 = cont->ShowProjection(1,1) ; // rapidity | |
520 | TH1D* h21 = cont->ShowProjection(2,1) ; // cosThetaStar | |
521 | TH1D* h31 = cont->ShowProjection(3,1) ; // pTpi | |
522 | TH1D* h41 = cont->ShowProjection(4,1) ; // pTK | |
523 | TH1D* h51 = cont->ShowProjection(5,1) ; // cT | |
524 | TH1D* h61 = cont->ShowProjection(6,1) ; // dca | |
525 | TH1D* h71 = cont->ShowProjection(7,1) ; // d0pi | |
526 | TH1D* h81 = cont->ShowProjection(8,1) ; // d0K | |
527 | TH1D* h91 = cont->ShowProjection(9,1) ; // d0xd0 | |
528 | TH1D* h101 = cont->ShowProjection(10,1) ; // cosPointingAngle | |
529 | ||
530 | // Reco-level | |
531 | TH1D* h02 = cont->ShowProjection(0,2) ; // pt | |
532 | TH1D* h12 = cont->ShowProjection(1,2) ; // rapidity | |
533 | TH1D* h22 = cont->ShowProjection(2,2) ; // cosThetaStar | |
534 | TH1D* h32 = cont->ShowProjection(3,2) ; // pTpi | |
535 | TH1D* h42 = cont->ShowProjection(4,2) ; // pTK | |
536 | TH1D* h52 = cont->ShowProjection(5,2) ; // cT | |
537 | TH1D* h62 = cont->ShowProjection(6,2) ; // dca | |
538 | TH1D* h72 = cont->ShowProjection(7,2) ; // d0pi | |
539 | TH1D* h82 = cont->ShowProjection(8,2) ; // d0K | |
540 | TH1D* h92 = cont->ShowProjection(9,2) ; // d0xd0 | |
541 | TH1D* h102 = cont->ShowProjection(10,2) ; // cosPointingAngle | |
542 | ||
543 | h00->SetTitle("pT_D0 (GeV/c)"); | |
544 | h10->SetTitle("rapidity"); | |
545 | h20->SetTitle("cosThetaStar"); | |
546 | h30->SetTitle("pT_pi (GeV/c)"); | |
547 | h40->SetTitle("pT_K (Gev/c)"); | |
548 | h50->SetTitle("cT (#mum)"); | |
549 | h60->SetTitle("dca (#mum)"); | |
550 | h70->SetTitle("d0_pi (#mum)"); | |
551 | h80->SetTitle("d0_K (#mum)"); | |
552 | h90->SetTitle("d0xd0 (#mum^2)"); | |
553 | h100->SetTitle("cosPointingAngle"); | |
554 | ||
555 | h00->GetXaxis()->SetTitle("pT_D0 (GeV/c)"); | |
556 | h10->GetXaxis()->SetTitle("rapidity"); | |
557 | h20->GetXaxis()->SetTitle("cosThetaStar"); | |
558 | h30->GetXaxis()->SetTitle("pT_pi (GeV/c)"); | |
559 | h40->GetXaxis()->SetTitle("pT_K (Gev/c)"); | |
560 | h50->GetXaxis()->SetTitle("cT (#mum)"); | |
561 | h60->GetXaxis()->SetTitle("dca (#mum)"); | |
562 | h70->GetXaxis()->SetTitle("d0_pi (#mum)"); | |
563 | h80->GetXaxis()->SetTitle("d0_K (#mum)"); | |
564 | h90->GetXaxis()->SetTitle("d0xd0 (#mum^2)"); | |
565 | h100->GetXaxis()->SetTitle("cosPointingAngle"); | |
566 | ||
567 | h01->SetTitle("pT_D0 (GeV/c)"); | |
568 | h11->SetTitle("rapidity"); | |
569 | h21->SetTitle("cosThetaStar"); | |
570 | h31->SetTitle("pT_pi (GeV/c)"); | |
571 | h41->SetTitle("pT_K (Gev/c)"); | |
572 | h51->SetTitle("cT (#mum)"); | |
573 | h61->SetTitle("dca (#mum)"); | |
574 | h71->SetTitle("d0_pi (#mum)"); | |
575 | h81->SetTitle("d0_K (#mum)"); | |
576 | h91->SetTitle("d0xd0 (#mum^2)"); | |
577 | h101->SetTitle("cosPointingAngle"); | |
578 | ||
579 | h01->GetXaxis()->SetTitle("pT_D0 (GeV/c)"); | |
580 | h11->GetXaxis()->SetTitle("rapidity"); | |
581 | h21->GetXaxis()->SetTitle("cosThetaStar"); | |
582 | h31->GetXaxis()->SetTitle("pT_pi (GeV/c)"); | |
583 | h41->GetXaxis()->SetTitle("pT_K (Gev/c)"); | |
584 | h51->GetXaxis()->SetTitle("cT (#mum)"); | |
585 | h61->GetXaxis()->SetTitle("dca (#mum)"); | |
586 | h71->GetXaxis()->SetTitle("d0_pi (#mum)"); | |
587 | h81->GetXaxis()->SetTitle("d0_K (#mum)"); | |
588 | h91->GetXaxis()->SetTitle("d0xd0 (#mum^2)"); | |
589 | h101->GetXaxis()->SetTitle("cosPointingAngle"); | |
590 | ||
591 | h02->SetTitle("pT_D0 (GeV/c)"); | |
592 | h12->SetTitle("rapidity"); | |
593 | h22->SetTitle("cosThetaStar"); | |
594 | h32->SetTitle("pT_pi (GeV/c)"); | |
595 | h42->SetTitle("pT_K (Gev/c)"); | |
596 | h52->SetTitle("cT (#mum)"); | |
597 | h62->SetTitle("dca (#mum)"); | |
598 | h72->SetTitle("d0_pi (#mum)"); | |
599 | h82->SetTitle("d0_K (#mum)"); | |
600 | h92->SetTitle("d0xd0 (#mum^2)"); | |
601 | h102->SetTitle("cosPointingAngle"); | |
602 | ||
603 | h02->GetXaxis()->SetTitle("pT_D0 (GeV/c)"); | |
604 | h12->GetXaxis()->SetTitle("rapidity"); | |
605 | h22->GetXaxis()->SetTitle("cosThetaStar"); | |
606 | h32->GetXaxis()->SetTitle("pT_pi (GeV/c)"); | |
607 | h42->GetXaxis()->SetTitle("pT_K (Gev/c)"); | |
608 | h52->GetXaxis()->SetTitle("cT (#mum)"); | |
609 | h62->GetXaxis()->SetTitle("dca (#mum)"); | |
610 | h72->GetXaxis()->SetTitle("d0_pi (#mum)"); | |
611 | h82->GetXaxis()->SetTitle("d0_K (#mum)"); | |
612 | h92->GetXaxis()->SetTitle("d0xd0 (#mum^2)"); | |
613 | h102->GetXaxis()->SetTitle("cosPointingAngle"); | |
614 | ||
615 | Double_t max0 = h00->GetMaximum(); | |
616 | Double_t max1 = h10->GetMaximum(); | |
617 | Double_t max2 = h20->GetMaximum(); | |
618 | Double_t max3 = h30->GetMaximum(); | |
619 | Double_t max4 = h40->GetMaximum(); | |
620 | Double_t max5 = h50->GetMaximum(); | |
621 | Double_t max6 = h60->GetMaximum(); | |
622 | Double_t max7 = h70->GetMaximum(); | |
623 | Double_t max8 = h80->GetMaximum(); | |
624 | Double_t max9 = h90->GetMaximum(); | |
625 | Double_t max10 = h100->GetMaximum(); | |
626 | ||
627 | h00->GetYaxis()->SetRangeUser(0,max0*1.2); | |
628 | h10->GetYaxis()->SetRangeUser(0,max1*1.2); | |
629 | h20->GetYaxis()->SetRangeUser(0,max2*1.2); | |
630 | h30->GetYaxis()->SetRangeUser(0,max3*1.2); | |
631 | h40->GetYaxis()->SetRangeUser(0,max4*1.2); | |
632 | h50->GetYaxis()->SetRangeUser(0,max5*1.2); | |
633 | h60->GetYaxis()->SetRangeUser(0,max6*1.2); | |
634 | h70->GetYaxis()->SetRangeUser(0,max7*1.2); | |
635 | h80->GetYaxis()->SetRangeUser(0,max8*1.2); | |
636 | h90->GetYaxis()->SetRangeUser(0,max9*1.2); | |
637 | h100->GetYaxis()->SetRangeUser(0,max10*1.2); | |
638 | ||
639 | h01->GetYaxis()->SetRangeUser(0,max0*1.2); | |
640 | h11->GetYaxis()->SetRangeUser(0,max1*1.2); | |
641 | h21->GetYaxis()->SetRangeUser(0,max2*1.2); | |
642 | h31->GetYaxis()->SetRangeUser(0,max3*1.2); | |
643 | h41->GetYaxis()->SetRangeUser(0,max4*1.2); | |
644 | h51->GetYaxis()->SetRangeUser(0,max5*1.2); | |
645 | h61->GetYaxis()->SetRangeUser(0,max6*1.2); | |
646 | h71->GetYaxis()->SetRangeUser(0,max7*1.2); | |
647 | h81->GetYaxis()->SetRangeUser(0,max8*1.2); | |
648 | h91->GetYaxis()->SetRangeUser(0,max9*1.2); | |
649 | h101->GetYaxis()->SetRangeUser(0,max10*1.2); | |
650 | ||
651 | h00->SetMarkerStyle(20); | |
652 | h10->SetMarkerStyle(24); | |
653 | h20->SetMarkerStyle(21); | |
654 | h30->SetMarkerStyle(25); | |
655 | h40->SetMarkerStyle(27); | |
656 | h50->SetMarkerStyle(28); | |
657 | h60->SetMarkerStyle(20); | |
658 | h70->SetMarkerStyle(24); | |
659 | h80->SetMarkerStyle(21); | |
660 | h90->SetMarkerStyle(25); | |
661 | h100->SetMarkerStyle(27); | |
662 | ||
663 | h00->SetMarkerColor(2); | |
664 | h10->SetMarkerColor(2); | |
665 | h20->SetMarkerColor(2); | |
666 | h30->SetMarkerColor(2); | |
667 | h40->SetMarkerColor(2); | |
668 | h50->SetMarkerColor(2); | |
669 | h60->SetMarkerColor(2); | |
670 | h70->SetMarkerColor(2); | |
671 | h80->SetMarkerColor(2); | |
672 | h90->SetMarkerColor(2); | |
673 | h100->SetMarkerColor(2); | |
674 | ||
675 | h01->SetMarkerStyle(20) ; | |
676 | h11->SetMarkerStyle(24) ; | |
677 | h21->SetMarkerStyle(21) ; | |
678 | h31->SetMarkerStyle(25) ; | |
679 | h41->SetMarkerStyle(27) ; | |
680 | h51->SetMarkerStyle(28) ; | |
681 | h61->SetMarkerStyle(20); | |
682 | h71->SetMarkerStyle(24); | |
683 | h81->SetMarkerStyle(21); | |
684 | h91->SetMarkerStyle(25); | |
685 | h101->SetMarkerStyle(27); | |
686 | ||
687 | h01->SetMarkerColor(8); | |
688 | h11->SetMarkerColor(8); | |
689 | h21->SetMarkerColor(8); | |
690 | h31->SetMarkerColor(8); | |
691 | h41->SetMarkerColor(8); | |
692 | h51->SetMarkerColor(8); | |
693 | h61->SetMarkerColor(8); | |
694 | h71->SetMarkerColor(8); | |
695 | h81->SetMarkerColor(8); | |
696 | h91->SetMarkerColor(8); | |
697 | h101->SetMarkerColor(8); | |
698 | ||
699 | h02->SetMarkerStyle(20) ; | |
700 | h12->SetMarkerStyle(24) ; | |
701 | h22->SetMarkerStyle(21) ; | |
702 | h32->SetMarkerStyle(25) ; | |
703 | h42->SetMarkerStyle(27) ; | |
704 | h52->SetMarkerStyle(28) ; | |
705 | h62->SetMarkerStyle(20); | |
706 | h72->SetMarkerStyle(24); | |
707 | h82->SetMarkerStyle(21); | |
708 | h92->SetMarkerStyle(25); | |
709 | h102->SetMarkerStyle(27); | |
710 | ||
711 | h02->SetMarkerColor(4); | |
712 | h12->SetMarkerColor(4); | |
713 | h22->SetMarkerColor(4); | |
714 | h32->SetMarkerColor(4); | |
715 | h42->SetMarkerColor(4); | |
716 | h52->SetMarkerColor(4); | |
717 | h62->SetMarkerColor(4); | |
718 | h72->SetMarkerColor(4); | |
719 | h82->SetMarkerColor(4); | |
720 | h92->SetMarkerColor(4); | |
721 | h102->SetMarkerColor(4); | |
722 | ||
723 | gStyle->SetCanvasColor(0); | |
724 | gStyle->SetFrameFillColor(0); | |
725 | gStyle->SetTitleFillColor(0); | |
726 | gStyle->SetStatColor(0); | |
727 | ||
728 | // drawing in 2 separate canvas for a matter of clearity | |
729 | TCanvas * c1 =new TCanvas("c1","pT, rapidiy, cosThetaStar",1100,1600); | |
730 | c1->Divide(3,3); | |
731 | ||
732 | c1->cd(1); | |
733 | h00->Draw("p"); | |
734 | c1->cd(1); | |
735 | c1->cd(2); | |
736 | h01->Draw("p"); | |
737 | c1->cd(2); | |
738 | c1->cd(3); | |
739 | h02->Draw("p"); | |
740 | c1->cd(3); | |
741 | c1->cd(4); | |
742 | h10->Draw("p"); | |
743 | c1->cd(4); | |
744 | c1->cd(5); | |
745 | h11->Draw("p"); | |
746 | c1->cd(5); | |
747 | c1->cd(6); | |
748 | h12->Draw("p"); | |
749 | c1->cd(6); | |
750 | c1->cd(7); | |
751 | h20->Draw("p"); | |
752 | c1->cd(7); | |
753 | c1->cd(8); | |
754 | h21->Draw("p"); | |
755 | c1->cd(8); | |
756 | c1->cd(9); | |
757 | h22->Draw("p"); | |
758 | c1->cd(9); | |
759 | c1->cd(); | |
760 | ||
761 | TCanvas * c2 =new TCanvas("c2","pTpi, pTK, cT",1100,1600); | |
762 | c2->Divide(3,3); | |
763 | c2->cd(1); | |
764 | h30->Draw("p"); | |
765 | c2->cd(1); | |
766 | c2->cd(2); | |
767 | h31->Draw("p"); | |
768 | c2->cd(2); | |
769 | c2->cd(3); | |
770 | h32->Draw("p"); | |
771 | c2->cd(3); | |
772 | c2->cd(4); | |
773 | h40->Draw("p"); | |
774 | c2->cd(4); | |
775 | c2->cd(5); | |
776 | h41->Draw("p"); | |
777 | c2->cd(5); | |
778 | c2->cd(6); | |
779 | h42->Draw("p"); | |
780 | c2->cd(6); | |
781 | c2->cd(7); | |
782 | h50->Draw("p"); | |
783 | c2->cd(7); | |
784 | c2->cd(8); | |
785 | h51->Draw("p"); | |
786 | c2->cd(8); | |
787 | c2->cd(9); | |
788 | h52->Draw("p"); | |
789 | c2->cd(9); | |
790 | c2->cd(); | |
791 | ||
792 | TCanvas * c3 =new TCanvas("c3","dca, d0pi, d0K",1100,1600); | |
793 | c3->Divide(3,3); | |
794 | c3->cd(1); | |
795 | h60->Draw("p"); | |
796 | c3->cd(1); | |
797 | c3->cd(2); | |
798 | h61->Draw("p"); | |
799 | c3->cd(2); | |
800 | c3->cd(3); | |
801 | h62->Draw("p"); | |
802 | c3->cd(3); | |
803 | c3->cd(4); | |
804 | h70->Draw("p"); | |
805 | c3->cd(4); | |
806 | c3->cd(5); | |
807 | h71->Draw("p"); | |
808 | c3->cd(5); | |
809 | c3->cd(6); | |
810 | h72->Draw("p"); | |
811 | c3->cd(6); | |
812 | c3->cd(7); | |
813 | h80->Draw("p"); | |
814 | c3->cd(7); | |
815 | c3->cd(8); | |
816 | h81->Draw("p"); | |
817 | c3->cd(8); | |
818 | c3->cd(9); | |
819 | h82->Draw("p"); | |
820 | c3->cd(9); | |
821 | c3->cd(); | |
822 | ||
823 | TCanvas * c4 =new TCanvas("c4","d0xd0, cosPointingAngle",1100,770); | |
824 | c4->Divide(3,2); | |
825 | c4->cd(1); | |
826 | h90->Draw("p"); | |
827 | c4->cd(1); | |
828 | c4->cd(2); | |
829 | h91->Draw("p"); | |
830 | c4->cd(2); | |
831 | c4->cd(3); | |
832 | h92->Draw("p"); | |
833 | c4->cd(3); | |
834 | c4->cd(4); | |
835 | h100->Draw("p"); | |
836 | c4->cd(4); | |
837 | c4->cd(5); | |
838 | h101->Draw("p"); | |
839 | c4->cd(5); | |
840 | c4->cd(6); | |
841 | h102->Draw("p"); | |
842 | c4->cd(6); | |
843 | c4->cd(); | |
844 | ||
844d235c | 845 | TFile* file_projection = new TFile("file_projection.root","RECREATE"); |
846 | h00->Write("pT_D0_step0"); | |
847 | h10->Write("rapidity_step0"); | |
848 | h20->Write("cosThetaStar_step0"); | |
849 | h30->Write("pT_pi_step0"); | |
850 | h40->Write("pT_K_step0"); | |
851 | h50->Write("cT_step0"); | |
852 | h60->Write("dca_step0"); | |
853 | h70->Write("d0_pi_step0"); | |
854 | h80->Write("d0_K_step0"); | |
855 | h90->Write("d0xd0_step0"); | |
856 | h100->Write("cosPointingAngle_step0"); | |
857 | ||
858 | h01->Write("pT_D0_step1"); | |
859 | h11->Write("rapidity_step1"); | |
860 | h21->Write("cosThetaStar_step1"); | |
861 | h31->Write("pT_pi_step1"); | |
862 | h41->Write("pT_K_step1"); | |
863 | h51->Write("cT_step1"); | |
864 | h61->Write("dca_step1"); | |
865 | h71->Write("d0_pi_step1"); | |
866 | h81->Write("d0_K_step1"); | |
867 | h91->Write("d0xd0_step1"); | |
868 | h101->Write("cosPointingAngle_step1"); | |
869 | ||
870 | h02->Write("pT_D0_step2"); | |
871 | h12->Write("rapidity_step2"); | |
872 | h22->Write("cosThetaStar_step2"); | |
873 | h32->Write("pT_pi_step2"); | |
874 | h42->Write("pT_K_step2"); | |
875 | h52->Write("cT_step2"); | |
876 | h62->Write("dca_step2"); | |
877 | h72->Write("d0_pi_step2"); | |
878 | h80->Write("d0_K_step2"); | |
879 | h92->Write("d0xd0_step2"); | |
880 | h102->Write("cosPointingAngle_step2"); | |
881 | ||
882 | file_projection->Close(); | |
883 | ||
f5ec6c30 | 884 | /* |
885 | c1->SaveAs("Plots/pT_rapidity_cosThetaStar.eps"); | |
886 | c2->SaveAs("Plots/pTpi_pTK_cT.eps"); | |
887 | c3->SaveAs("Plots/dca_d0pi_d0TK.eps"); | |
888 | c4->SaveAs("Plots/d0xd0_cosPointingAngle.eps"); | |
889 | ||
890 | c1->SaveAs("Plots/pT_rapidity_cosThetaStar.gif"); | |
891 | c2->SaveAs("Plots/pTpi_pTK_cT.gif"); | |
892 | c3->SaveAs("Plots/dca_d0pi_d0TK.gif"); | |
893 | c4->SaveAs("Plots/d0xd0_cosPointingAngle.gif"); | |
894 | */ | |
895 | } | |
896 | ||
897 | //___________________________________________________________________________ | |
898 | void AliCFHeavyFlavourTaskMultiVarMultiStep::UserCreateOutputObjects() { | |
899 | //HERE ONE CAN CREATE OUTPUT OBJECTS, IN PARTICULAR IF THE OBJECT PARAMETERS DON'T NEED | |
900 | //TO BE SET BEFORE THE EXECUTION OF THE TASK | |
901 | // | |
902 | Info("UserCreateOutputObjects","CreateOutputObjects of task %s\n", GetName()); | |
903 | ||
904 | //slot #1 | |
905 | OpenFile(1); | |
906 | fHistEventsProcessed = new TH1I("fHistEventsProcessed","",1,0,1) ; | |
907 | } | |
908 | ||
909 | //___________________________________________________________________________ | |
910 | Double_t AliCFHeavyFlavourTaskMultiVarMultiStep::CosThetaStar(AliAODMCParticle* mcPart, AliAODMCParticle* mcPartDaughter0, AliAODMCParticle* mcPartDaughter1) const { | |
911 | ||
912 | // | |
913 | // to calculate cos(ThetaStar) for generated particle | |
914 | // using the K, since mcPartDaughter0 and mcPartDaughter1 always correspond to K and pi respectively | |
915 | // (see where the function is called) | |
916 | // | |
917 | ||
918 | Int_t pdgvtx = mcPart->GetPdgCode(); | |
919 | /* if (pdgvtx > 0) { // setting as the first daughter always the kaon, to be used to calculate cos(ThetaStar) | |
920 | Int_t pdgprong0 = TMath::Abs(mcPartDaughter0->GetPdgCode()); | |
921 | Int_t pdgprong1 = TMath::Abs(mcPartDaughter1->GetPdgCode()); | |
922 | AliInfo(Form("D0, with pdgprong0 = %d, pdgprong1 = %d",pdgprong0,pdgprong1)); | |
923 | AliDebug(2,"This is a D0"); | |
924 | AliAODMCParticle* mcPartdummy = mcPartDaughter0; | |
925 | mcPartDaughter0 = mcPartDaughter1; | |
926 | mcPartDaughter1 = mcPartdummy; | |
927 | } | |
928 | else{ | |
929 | AliInfo("D0bar"); | |
930 | } | |
931 | */ | |
932 | Int_t pdgprong0 = TMath::Abs(mcPartDaughter0->GetPdgCode()); | |
933 | Int_t pdgprong1 = TMath::Abs(mcPartDaughter1->GetPdgCode()); | |
934 | if (pdgvtx > 0) { // setting as the first daughter always the kaon, to be used to calculate cos(ThetaStar) | |
935 | AliDebug(2,"D0"); | |
936 | } | |
937 | else{ | |
938 | AliDebug(2,"D0bar"); | |
939 | } | |
940 | if (pdgprong0 == 211){ | |
941 | AliDebug(2,Form("pdgprong0 = %d, pdgprong1 = %d, switching...",pdgprong0,pdgprong1)); | |
942 | AliAODMCParticle* mcPartdummy = mcPartDaughter0; | |
943 | mcPartDaughter0 = mcPartDaughter1; | |
944 | mcPartDaughter1 = mcPartdummy; | |
945 | pdgprong0 = TMath::Abs(mcPartDaughter0->GetPdgCode()); | |
946 | pdgprong1 = TMath::Abs(mcPartDaughter1->GetPdgCode()); | |
947 | } | |
948 | ||
949 | AliDebug(2,Form("After checking, pdgprong0 = %d, pdgprong1 = %d",pdgprong0,pdgprong1)); | |
950 | Double_t massvtx = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdgvtx))->Mass(); | |
951 | Double_t massp[2]; | |
952 | massp[0] = TDatabasePDG::Instance()->GetParticle(pdgprong0)->Mass(); | |
953 | massp[1] = TDatabasePDG::Instance()->GetParticle(pdgprong1)->Mass(); | |
954 | ||
955 | Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)-4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx); | |
956 | ||
957 | Double_t px = mcPartDaughter0->Px()+mcPartDaughter1->Px(); | |
958 | Double_t py = mcPartDaughter0->Py()+mcPartDaughter1->Py(); | |
959 | Double_t pz = mcPartDaughter0->Pz()+mcPartDaughter1->Pz(); | |
960 | Double_t p = TMath::Sqrt(px*px+py*py+pz*pz); | |
961 | Double_t e = TMath::Sqrt(massvtx*massvtx+p*p); | |
962 | Double_t beta = p/e; | |
963 | Double_t gamma = e/massvtx; | |
964 | TVector3 mom(mcPartDaughter0->Px(),mcPartDaughter0->Py(),mcPartDaughter0->Pz()); | |
965 | TVector3 momTot(mcPartDaughter0->Px()+mcPartDaughter1->Px(),mcPartDaughter0->Py()+mcPartDaughter1->Py(),mcPartDaughter0->Pz()+mcPartDaughter1->Pz()); | |
966 | ||
967 | Double_t qlprong = mom.Dot(momTot)/momTot.Mag(); // analog to AliAODRecoDecay::QlProng(0) | |
968 | ||
969 | AliDebug(2,Form("pStar = %f, beta = %f, gamma = %f, qlprong = %f, massp[0] = %f", pStar, beta, gamma, qlprong, massp[0])); | |
970 | Double_t cts = (qlprong/gamma-beta*TMath::Sqrt(pStar*pStar+massp[0]*massp[0]))/pStar; | |
971 | AliDebug(2,Form("cts = %f", cts)); | |
972 | return cts; | |
973 | } | |
974 | //___________________________________________________________________________ | |
975 | Double_t AliCFHeavyFlavourTaskMultiVarMultiStep::CT(AliAODMCParticle* mcPart, AliAODMCParticle* mcPartDaughter0, AliAODMCParticle* mcPartDaughter1) const { | |
976 | ||
977 | // | |
978 | // to calculate cT for generated particle | |
979 | // | |
980 | ||
981 | Double_t xmcPart[3] = {0,0,0}; | |
982 | Double_t xdaughter0[3] = {0,0,0}; | |
983 | Double_t xdaughter1[3] = {0,0,0}; | |
984 | mcPart->XvYvZv(xmcPart); // cm | |
985 | mcPartDaughter0->XvYvZv(xdaughter0); // cm | |
986 | mcPartDaughter1->XvYvZv(xdaughter1); //cm | |
987 | Double_t prodVtxD0 = TMath::Sqrt(xmcPart[0]*xmcPart[0]+ | |
988 | xmcPart[1]*xmcPart[1]+ | |
989 | xmcPart[2]*xmcPart[2]); | |
990 | Double_t prodVtxDaughter0 = TMath::Sqrt(xdaughter0[0]*xdaughter0[0]+ | |
991 | xdaughter0[1]*xdaughter0[1]+ | |
992 | xdaughter0[2]*xdaughter0[2]); | |
993 | Double_t prodVtxDaughter1 = TMath::Sqrt(xdaughter1[0]*xdaughter1[0]+ | |
994 | xdaughter1[1]*xdaughter1[1]+ | |
995 | xdaughter1[2]*xdaughter1[2]); | |
996 | ||
997 | AliDebug(2, Form("D0: x = %f, y = %f, z = %f, production vertex distance = %f (cm), %f (micron)", xmcPart[0], xmcPart[1], xmcPart[2], prodVtxD0, prodVtxD0*1.E4)); | |
998 | AliDebug(2, Form("Daughter0: x = %f, y = %f, z = %f, production vertex distance = %f (cm) %f (micron)", xdaughter0[0], xdaughter0[1], xdaughter0[2], prodVtxDaughter0, prodVtxDaughter0*1E4)); | |
999 | AliDebug(2, Form("Daughter1: x = %f, y = %f, z = %f, production vertex distance = %f (cm) %f (micron)", xdaughter1[0], xdaughter1[1], xdaughter1[2], prodVtxDaughter1, prodVtxDaughter1*1.E4)); | |
1000 | ||
1001 | Double_t cT0 = TMath::Sqrt((xdaughter0[0]-xmcPart[0])*(xdaughter0[0]-xmcPart[0])+ | |
1002 | (xdaughter0[1]-xmcPart[1])*(xdaughter0[1]-xmcPart[1])+ | |
1003 | (xdaughter0[2]-xmcPart[2])*(xdaughter0[2]-xmcPart[2])); | |
1004 | ||
1005 | Double_t cT1 = TMath::Sqrt((xdaughter1[0]-xmcPart[0])*(xdaughter1[0]-xmcPart[0])+ | |
1006 | (xdaughter1[1]-xmcPart[1])*(xdaughter1[1]-xmcPart[1])+ | |
1007 | (xdaughter1[2]-xmcPart[2])*(xdaughter1[2]-xmcPart[2])); | |
1008 | ||
1009 | if (cT0 != cT1) { | |
1010 | AliWarning("cT from daughter 0 different from cT from daughter 1! Using cT from daughter 0, but PLEASE, CHECK...."); | |
1011 | } | |
1012 | ||
1013 | // calculating cT from cT0 | |
1014 | ||
1015 | Double_t mass = TDatabasePDG::Instance()->GetParticle(mcPart->GetPdgCode())->Mass(); // mcPart->GetPdgCode() should return +/- 421 for the D0/D0bar | |
1016 | Double_t p = mcPart-> P(); | |
1017 | Double_t cT = cT0*mass/p; | |
1018 | AliDebug(2, Form("cT from daughter 0 = %f (micron)", cT0*1E4)); | |
1019 | AliDebug(2, Form("cT from daughter 1 = %f (micron)", cT1*1E4)); | |
1020 | AliDebug(2, Form("cT (with mass = %f and p = %f) = %f (micron)", mass, p, cT*1E4)); | |
1021 | return cT; | |
1022 | } | |
1023 | //________________________________________________________________________________ | |
1024 | Bool_t AliCFHeavyFlavourTaskMultiVarMultiStep::GetGeneratedValuesFromMCParticle(AliAODMCParticle* mcPart, TClonesArray* mcArray, Double_t* vectorMC) const { | |
1025 | ||
1026 | // | |
1027 | // collecting all the necessary info (pt, y, cosThetaStar, ptPi, ptKa, cT) from MC particle | |
1028 | // | |
1029 | ||
1030 | Bool_t isOk = kFALSE; | |
1031 | ||
1032 | // check whether the D0 decays in pi+K | |
1033 | // to be added!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1034 | // could use a cut in the CF, but not clear how to define a TDecayChannel | |
1035 | // implemented for the time being as a cut on the number of daughters - see later when | |
1036 | // getting the daughters | |
1037 | ||
1038 | // getting the daughters | |
1039 | Int_t daughter0 = mcPart->GetDaughter(0); | |
1040 | Int_t daughter1 = mcPart->GetDaughter(1); | |
1041 | AliDebug(2, Form("daughter0 = %d and daughter1 = %d",daughter0,daughter1)); | |
1042 | if (daughter0 == 0 || daughter1 == 0) { | |
1043 | AliDebug(2, "Error! the D0 MC doesn't have correct daughters!!"); | |
1044 | return isOk; | |
1045 | } | |
1046 | if (TMath::Abs(daughter1 - daughter0 != 1)) { | |
1047 | AliDebug(2, "The D0 MC doesn't come from a 2-prong decay, skipping!!"); | |
1048 | return isOk; | |
1049 | } | |
1050 | AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughter0)); | |
1051 | AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughter1)); | |
1052 | if (!mcPartDaughter0 || !mcPartDaughter1) { | |
1053 | AliWarning("At least one Daughter Particle not found in tree, skipping"); | |
1054 | return isOk; | |
1055 | } | |
1056 | ||
1057 | Double_t vtx1[3] = {0,0,0}; // primary vertex | |
1058 | Double_t vtx2daughter0[3] = {0,0,0}; // secondary vertex from daughter 0 | |
1059 | Double_t vtx2daughter1[3] = {0,0,0}; // secondary vertex from daughter 1 | |
1060 | mcPart->XvYvZv(vtx1); // cm | |
1061 | // getting vertex from daughters | |
1062 | mcPartDaughter0->XvYvZv(vtx2daughter0); // cm | |
1063 | mcPartDaughter1->XvYvZv(vtx2daughter1); //cm | |
1064 | if (vtx2daughter0[0] != vtx2daughter1[0] && vtx2daughter0[1] != vtx2daughter1[1] && vtx2daughter0[2] != vtx2daughter1[2]) { | |
1065 | AliError("Daughters have different secondary vertex, skipping the track"); | |
1066 | return isOk; | |
1067 | } | |
1068 | Int_t nprongs = 2; | |
1069 | Short_t charge = 0; | |
1070 | // always instantiate the AliAODRecoDecay with the positive daughter first, the negative second | |
1071 | AliAODMCParticle* positiveDaugh = mcPartDaughter0; | |
1072 | AliAODMCParticle* negativeDaugh = mcPartDaughter1; | |
1073 | if (mcPartDaughter0->GetPdgCode()<0 && mcPartDaughter1->GetPdgCode()>0){ | |
1074 | // inverting in case the positive daughter is the second one | |
1075 | positiveDaugh = mcPartDaughter1; | |
1076 | negativeDaugh = mcPartDaughter0; | |
1077 | } | |
1078 | // getting the momentum from the daughters | |
1079 | Double_t px[2] = {positiveDaugh->Px(), negativeDaugh->Px()}; | |
1080 | Double_t py[2] = {positiveDaugh->Py(), negativeDaugh->Py()}; | |
1081 | Double_t pz[2] = {positiveDaugh->Pz(), negativeDaugh->Pz()}; | |
1082 | ||
1083 | Double_t d0[2] = {0.,0.}; | |
1084 | ||
1085 | AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vtx1,vtx2daughter0,nprongs,charge,px,py,pz,d0); | |
1086 | ||
1087 | Double_t cosThetaStar = 0.; | |
1088 | Double_t cosThetaStarD0 = 0.; | |
1089 | Double_t cosThetaStarD0bar = 0.; | |
1090 | cosThetaStarD0 = decay->CosThetaStar(1,421,211,321); | |
1091 | cosThetaStarD0bar = decay->CosThetaStar(0,421,321,211); | |
1092 | if (mcPart->GetPdgCode() == 421){ // D0 | |
1093 | AliDebug(3, Form("D0, with pdgprong0 = %d, pdgprong1 = %d",mcPartDaughter0->GetPdgCode(),mcPartDaughter1->GetPdgCode())); | |
1094 | cosThetaStar = cosThetaStarD0; | |
1095 | } | |
1096 | else if (mcPart->GetPdgCode() == -421){ // D0bar{ | |
1097 | AliDebug(3, Form("D0bar, with pdgprong0 = %d, pdgprong1 = %d",mcPartDaughter0->GetPdgCode(),mcPartDaughter1->GetPdgCode())); | |
1098 | cosThetaStar = cosThetaStarD0bar; | |
1099 | } | |
1100 | else{ | |
1101 | AliWarning("There are problems!! particle was expected to be either a D0 or a D0bar, check..."); | |
1102 | return vectorMC; | |
1103 | } | |
1104 | if (cosThetaStar < -1 || cosThetaStar > 1) { | |
1105 | AliWarning("Invalid value for cosine Theta star, returning"); | |
1106 | return isOk; | |
1107 | } | |
1108 | ||
1109 | // calculate cos(Theta*) according to the method implemented herein | |
1110 | ||
1111 | Double_t cts = 9999.; | |
1112 | cts = CosThetaStar(mcPart, mcPartDaughter0, mcPartDaughter1); | |
1113 | if (cts < -1 || cts > 1) { | |
1114 | AliWarning("Invalid value for cosine Theta star from AliCFHeavyFlavourTaskMultiVarMultiStep method"); | |
1115 | } | |
1116 | if (TMath::Abs(cts - cosThetaStar)>0.001) { | |
1117 | AliError(Form("cosThetaStar automatically calculated different from that manually calculated!!! cosThetaStar = %f, cosThetaStar = %f", cosThetaStar,cts)); | |
1118 | } | |
1119 | ||
1120 | Double_t cT = decay->Ct(421); | |
1121 | ||
1122 | // calculate cT from the method implemented herein | |
1123 | Double_t cT1 = 0.; | |
1124 | cT1 = CT(mcPart, mcPartDaughter0, mcPartDaughter1); | |
1125 | ||
1126 | if (TMath::Abs(cT1 - cT)>0.001) { | |
1127 | AliError(Form("cT automatically calculated different from that manually calculated!!! cT = %f, cT1 = %f",cT,cT1)); | |
1128 | } | |
1129 | ||
1130 | // get the pT of the daughters | |
1131 | ||
1132 | Double_t pTpi = 0.; | |
1133 | Double_t pTK = 0.; | |
1134 | ||
1135 | if (TMath::Abs(mcPartDaughter0->GetPdgCode()) == 211) { | |
1136 | pTpi = mcPartDaughter0->Pt(); | |
1137 | pTK = mcPartDaughter1->Pt(); | |
1138 | } | |
1139 | else { | |
1140 | pTpi = mcPartDaughter1->Pt(); | |
1141 | pTK = mcPartDaughter0->Pt(); | |
1142 | } | |
1143 | ||
1144 | vectorMC[0] = mcPart->Pt(); | |
1145 | vectorMC[1] = mcPart->Y() ; | |
1146 | vectorMC[2] = cosThetaStar ; | |
1147 | vectorMC[3] = pTpi ; | |
1148 | vectorMC[4] = pTK ; | |
1149 | vectorMC[5] = cT*1.E4 ; // in micron | |
1150 | isOk = kTRUE; | |
1151 | return isOk; | |
1152 | } | |
1153 |