]>
Commit | Line | Data |
---|---|---|
043062fe | 1 | /************************************************************************** |
2 | * Copyright(c) 2007-2011, 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 | ||
7b45817b | 16 | /* $Id$ */ |
043062fe | 17 | |
18 | /////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Class to compute variables for correction framework // | |
21 | // for 3-body decays of D mesons (D+, Ds, Lc) // | |
22 | // in bins of cut variables // | |
23 | // Origin: Francesco Prino (prino@to.infn.it) // | |
24 | // Renu Bala (bala@to.infn.it) // | |
25 | // // | |
26 | /////////////////////////////////////////////////////////////////// | |
27 | ||
28 | #include "AliAODMCParticle.h" | |
29 | #include "AliAODEvent.h" | |
30 | #include "TClonesArray.h" | |
31 | #include "AliCFVertexingHF.h" | |
32 | #include "AliESDtrack.h" | |
33 | #include "TDatabasePDG.h" | |
34 | ||
35 | #include "AliCFVertexingHF3Prong.h" | |
36 | #include "AliCFContainer.h" | |
37 | ||
38 | ClassImp(AliCFVertexingHF3Prong) | |
39 | ||
40 | ||
41 | //_________________________________________ | |
42 | AliCFVertexingHF3Prong::AliCFVertexingHF3Prong(Int_t decay): | |
43 | AliCFVertexingHF(), | |
44 | fDecay(decay) | |
45 | { | |
46 | // | |
47 | SetNProngs(3); | |
48 | } | |
49 | //_________________________________________ | |
50 | AliCFVertexingHF3Prong::AliCFVertexingHF3Prong(TClonesArray *mcArray, UShort_t originDselection, Int_t decay): | |
51 | AliCFVertexingHF(mcArray, originDselection), | |
52 | fDecay(decay) | |
53 | ||
54 | { | |
55 | // | |
56 | SetNProngs(3); | |
57 | } | |
58 | ||
59 | ||
60 | //_____________________________________ | |
61 | AliCFVertexingHF3Prong& AliCFVertexingHF3Prong::operator=(const AliCFVertexingHF3Prong& c){ | |
62 | // | |
63 | if (this != &c) { | |
64 | ||
65 | AliCFVertexingHF::operator=(c); | |
66 | ||
67 | } | |
68 | return *this; | |
69 | } | |
70 | ||
71 | //__________________________________________ | |
72 | Bool_t AliCFVertexingHF3Prong::SetRecoCandidateParam(AliAODRecoDecayHF *recoCand){ | |
73 | // Checks if candidate is signal and D meson is present in MC array | |
74 | ||
75 | Bool_t bSignAssoc = kFALSE; | |
76 | fRecoCandidate = recoCand; | |
77 | ||
78 | if (!fRecoCandidate) { | |
79 | AliError("fRecoCandidate not found, problem in assignement\n"); | |
80 | return bSignAssoc; | |
81 | } | |
82 | ||
83 | Int_t pdgCand = -1; | |
84 | Int_t pdgDaughter[3]={-1,-1,-1}; | |
85 | if(fDecay==kDplustoKpipi){ | |
86 | pdgCand=411; | |
87 | pdgDaughter[0]=321; | |
88 | pdgDaughter[1]=211; | |
89 | pdgDaughter[2]=211; | |
90 | }else if(fDecay==kDstoKKpi){ | |
91 | pdgCand=431; | |
92 | pdgDaughter[0]=321; | |
93 | pdgDaughter[1]=321; | |
94 | pdgDaughter[2]=211; | |
95 | }else if(fDecay==kLctopKpi){ | |
96 | AliError("LambdaC not yet implemented"); | |
97 | return bSignAssoc; | |
98 | }else{ | |
99 | AliError("WRONG DECAY SETTING"); | |
100 | return bSignAssoc; | |
101 | } | |
102 | ||
103 | Int_t mcLabel = fRecoCandidate->MatchToMC(pdgCand,fmcArray,3,pdgDaughter); | |
104 | if (mcLabel == -1) return bSignAssoc; | |
105 | SetMCLabel(mcLabel); | |
106 | fmcPartCandidate = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fmcLabel)); | |
107 | ||
108 | if (!fmcPartCandidate){ | |
109 | AliDebug(3,"No part candidate"); | |
110 | return bSignAssoc; | |
111 | } | |
112 | ||
113 | bSignAssoc = kTRUE; | |
114 | return bSignAssoc; | |
115 | } | |
116 | ||
117 | //______________________________________________ | |
118 | Bool_t AliCFVertexingHF3Prong::GetGeneratedValuesFromMCParticle(Double_t* vectorMC) { | |
119 | // | |
120 | // collecting all the necessary info from MC particle and fill vectorMC: 12 variables | |
121 | // pt_D | |
122 | // y_D | |
123 | // phi_D | |
124 | // ctau | |
125 | // cos point | |
126 | // pt_1 | |
127 | // pt_2 | |
128 | // pt_3 | |
129 | // d0_1 | |
130 | // d0_2 | |
131 | // d0_3 | |
132 | // zPrimVert | |
b7af2639 | 133 | // centrality |
043062fe | 134 | |
135 | Bool_t bGenValues = kFALSE; | |
136 | ||
137 | Int_t pdgCand = -1; | |
138 | if(fDecay==kDplustoKpipi){ | |
139 | pdgCand=411; | |
140 | }else if(fDecay==kDstoKKpi){ | |
141 | pdgCand=431; | |
142 | }else if(fDecay==kLctopKpi){ | |
143 | AliError("LambdaC not yet implemented"); | |
144 | return bGenValues; | |
145 | }else{ | |
146 | AliError("WRONG DECAY SETTING"); | |
147 | return bGenValues; | |
148 | } | |
149 | ||
150 | Double_t vertD[3] = {0,0,0}; // D origin | |
151 | fmcPartCandidate->XvYvZv(vertD); // cm | |
152 | ||
153 | Int_t nprongs = 3; | |
154 | Int_t daughter[3]; | |
155 | Short_t charge = fmcPartCandidate->Charge(); | |
156 | ||
157 | // order the daughters as LS,OS,LS, e.g. D+ -> pi+ K- pi+ | |
158 | // the 2 LS are ordered so that in pos. 0 there is the one with lower label value | |
159 | Int_t index=0; | |
160 | Int_t nDauLS=0; | |
161 | Int_t nDauOS=0; | |
162 | ||
163 | ||
164 | Int_t nDau=fmcPartCandidate->GetNDaughters(); | |
165 | Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0); | |
166 | if(nDau==3){ | |
167 | for(Int_t iDau=0; iDau<3; iDau++){ | |
168 | Int_t ind = labelFirstDau+iDau; | |
169 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind)); | |
968b84b9 | 170 | if(!part){ |
171 | AliError("Daughter particle not found in MC array"); | |
172 | return bGenValues; | |
173 | } | |
043062fe | 174 | Short_t signDau=part->Charge(); |
175 | if(signDau==charge){ | |
176 | nDauLS++; | |
177 | daughter[index] = ind; | |
178 | index=2; | |
179 | }else{ | |
180 | daughter[1] = ind; | |
181 | nDauOS++; | |
182 | } | |
183 | } | |
184 | }else if(nDau==2){ | |
185 | for(Int_t iDau=0; iDau<2; iDau++){ | |
186 | Int_t ind = labelFirstDau+iDau; | |
187 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind)); | |
968b84b9 | 188 | if(!part){ |
189 | AliError("Daughter particle not found in MC array"); | |
190 | return bGenValues; | |
191 | } | |
043062fe | 192 | Int_t pdgCode=TMath::Abs(part->GetPdgCode()); |
193 | if(pdgCode==211 || pdgCode==321 || pdgCode==2212){ | |
194 | Short_t signDau=part->Charge(); | |
195 | if(signDau==charge){ | |
196 | nDauLS++; | |
197 | daughter[index] = ind; | |
198 | index=2; | |
199 | }else{ | |
200 | daughter[1] = ind; | |
201 | nDauOS++; | |
202 | } | |
203 | }else{ | |
204 | Int_t nDauRes=part->GetNDaughters(); | |
205 | if(nDauRes!=2){ | |
206 | AliError("Wrong resonant decay"); | |
207 | return bGenValues; | |
208 | } | |
209 | Int_t labelFirstDauRes = part->GetDaughter(0); | |
210 | for(Int_t iDauRes=0; iDauRes<2; iDauRes++){ | |
211 | Int_t indDR = labelFirstDauRes+iDauRes; | |
212 | AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(fmcArray->At(indDR)); | |
968b84b9 | 213 | if(!partDR){ |
214 | AliError("Daughter particle not found in MC array"); | |
215 | return bGenValues; | |
216 | } | |
043062fe | 217 | Short_t signDau=partDR->Charge(); |
218 | if(signDau==charge){ | |
219 | nDauLS++; | |
220 | daughter[index] = ind; | |
221 | index=2; | |
222 | }else{ | |
223 | daughter[1] = ind; | |
224 | nDauOS++; | |
225 | } | |
226 | } | |
227 | } | |
228 | } | |
229 | }else{ | |
230 | AliError(Form("Wrong number of daughters %d",nDau)); | |
231 | return bGenValues; | |
232 | } | |
233 | ||
234 | if(nDauLS!=2 || nDauOS!=1){ | |
235 | AliError(Form("Wrong decay channel: LS and OS daughters not OK: %d %d",nDauLS,nDauOS)); | |
236 | return bGenValues; | |
237 | } | |
238 | if(daughter[0]>daughter[2]){ | |
239 | Int_t tmp=daughter[0]; | |
240 | daughter[0]=daughter[2]; | |
241 | daughter[2]=tmp; | |
242 | } | |
243 | ||
244 | // getting the momentum from the daughters and decay vertex | |
245 | Double_t px[3],py[3],pz[3],pt[3]; | |
246 | Double_t vertDec[3] = {0,0,0}; // decay vertex | |
247 | for(Int_t iDau=0; iDau<3; iDau++){ | |
248 | AliAODMCParticle* part=dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter[iDau])); | |
968b84b9 | 249 | if(!part){ |
250 | AliError("Daughter particle not found in MC array"); | |
251 | return bGenValues; | |
252 | } | |
043062fe | 253 | px[iDau]=part->Px(); |
254 | py[iDau]=part->Py(); | |
255 | pz[iDau]=part->Pz(); | |
256 | pt[iDau]=part->Pt(); | |
257 | if(iDau==0) part->XvYvZv(vertDec); | |
258 | } | |
259 | ||
260 | Double_t d0[3] = {0.,0.,0.}; // dummy values!!!! | |
261 | ||
262 | AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vertD,vertDec,nprongs,charge,px,py,pz,d0); | |
263 | Double_t cT = decay->Ct(pdgCand); | |
264 | ||
265 | vectorMC[0] = fmcPartCandidate->Pt(); | |
266 | vectorMC[1] = fmcPartCandidate->Y() ; | |
267 | vectorMC[2] = fmcPartCandidate->Phi(); | |
268 | vectorMC[3] = cT*1.E4 ; // in micron | |
269 | vectorMC[4] = 1.01; // cos pointing angle, dummy value, meaningless in MC | |
270 | vectorMC[5] = pt[0]; | |
271 | vectorMC[6] = pt[1]; | |
272 | vectorMC[7] = pt[2]; | |
273 | vectorMC[8] = 0.; // imppar0, dummy value, meaningless in MC | |
274 | vectorMC[9] = 0.; // imppar1, dummy value, meaningless in MC, in micron | |
275 | vectorMC[10] = 0.; // imppar2, dummy value, meaningless in MC, in micron | |
276 | vectorMC[11] = fzMCVertex; // z of reconstructed of primary vertex | |
b7af2639 | 277 | vectorMC[12] = fCentValue; // reconstructed centrality value |
278 | ||
043062fe | 279 | |
280 | bGenValues = kTRUE; | |
281 | return bGenValues; | |
282 | } | |
283 | ||
284 | ||
285 | //____________________________________________ | |
286 | Bool_t AliCFVertexingHF3Prong::GetRecoValuesFromCandidate(Double_t *vectorReco) const | |
287 | { | |
288 | // Fill vector (see above) with reconstructed quantities | |
289 | Bool_t bFillRecoValues=kFALSE; | |
290 | ||
291 | Int_t pdgCand = -1; | |
292 | if(fDecay==kDplustoKpipi){ | |
293 | pdgCand=411; | |
294 | }else if(fDecay==kDstoKKpi){ | |
295 | pdgCand=431; | |
296 | }else if(fDecay==kLctopKpi){ | |
297 | AliError("LambdaC not yet implemented"); | |
298 | return bFillRecoValues; | |
299 | }else{ | |
300 | AliError("WRONG DECAY SETTING"); | |
301 | return bFillRecoValues; | |
302 | } | |
303 | ||
304 | AliAODRecoDecayHF3Prong *decay3 = (AliAODRecoDecayHF3Prong*)fRecoCandidate; | |
305 | Short_t charge=decay3->Charge(); | |
306 | Double_t rapidity=decay3->Y(pdgCand); | |
307 | Double_t cT=decay3->Ct(pdgCand); | |
308 | Double_t pt = decay3->Pt(); | |
309 | Double_t cosPointingAngle = decay3->CosPointingAngle(); | |
310 | Double_t phi = decay3->Phi(); | |
311 | ||
312 | Int_t daughtSorted[3]; | |
313 | Int_t tmpIndex=0; | |
314 | Int_t nDauLS=0; | |
315 | Int_t nDauOS=0; | |
316 | for(Int_t iDau=0; iDau<3; iDau++){ | |
317 | AliAODTrack *trk = (AliAODTrack*)decay3->GetDaughter(iDau); | |
b7af2639 | 318 | Int_t label = TMath::Abs(trk->GetLabel()); |
043062fe | 319 | Short_t chargedau=trk->Charge(); |
320 | if(chargedau==charge){ | |
321 | daughtSorted[tmpIndex]=label; | |
322 | tmpIndex=2; | |
323 | nDauLS++; | |
324 | }else{ | |
325 | daughtSorted[1]=label; | |
326 | nDauOS++; | |
327 | } | |
328 | } | |
329 | ||
330 | if(nDauLS!=2 || nDauOS!=1){ | |
331 | AliError("Wrong decay channel: number of OS and LS tracks not OK"); | |
332 | return bFillRecoValues; | |
333 | } | |
334 | ||
335 | if(daughtSorted[0]>daughtSorted[2]){ | |
336 | Int_t tmp=daughtSorted[0]; | |
337 | daughtSorted[0]=daughtSorted[2]; | |
338 | daughtSorted[2]=tmp; | |
339 | } | |
340 | ||
341 | ||
342 | vectorReco[0] = pt; | |
343 | vectorReco[1] = rapidity; | |
344 | vectorReco[2] = phi; | |
345 | vectorReco[3] = cT*1.E4; // in micron | |
346 | vectorReco[4] = cosPointingAngle; // in micron | |
347 | vectorReco[5] = decay3->PtProng(daughtSorted[0]); | |
348 | vectorReco[6] = decay3->PtProng(daughtSorted[1]); | |
349 | vectorReco[7] = decay3->PtProng(daughtSorted[2]); | |
350 | vectorReco[8] = decay3->Getd0Prong(daughtSorted[0]); | |
351 | vectorReco[9] = decay3->Getd0Prong(daughtSorted[1]); | |
352 | vectorReco[10] = decay3->Getd0Prong(daughtSorted[2]); | |
353 | vectorReco[11] = fzPrimVertex; // z of reconstructed of primary vertex | |
b7af2639 | 354 | vectorReco[12] = fCentValue; //reconstructed centrality value |
355 | ||
356 | ||
043062fe | 357 | bFillRecoValues = kTRUE; |
358 | return bFillRecoValues; | |
359 | } | |
360 | ||
361 | ||
362 | //_____________________________________________________________ | |
363 | Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const | |
364 | { | |
365 | // Check the pdg codes of the daughters | |
366 | Bool_t checkCD = kFALSE; | |
367 | ||
368 | Int_t pdgCand = -1; | |
369 | Int_t pdgDaughter[3]={-1,-1,-1}; | |
370 | if(fDecay==kDplustoKpipi){ | |
371 | pdgCand=411; | |
372 | pdgDaughter[0]=321; | |
373 | pdgDaughter[1]=211; | |
374 | pdgDaughter[2]=211; | |
375 | }else if(fDecay==kDstoKKpi){ | |
376 | pdgCand=431; | |
377 | pdgDaughter[0]=321; | |
378 | pdgDaughter[1]=321; | |
379 | pdgDaughter[2]=211; | |
380 | }else if(fDecay==kLctopKpi){ | |
381 | AliError("LambdaC not yet implemented"); | |
382 | return checkCD; | |
383 | }else{ | |
384 | AliError("WRONG DECAY SETTING"); | |
385 | return checkCD; | |
386 | } | |
387 | ||
388 | ||
389 | Int_t daughter[3]; | |
390 | ||
391 | Int_t nDau=fmcPartCandidate->GetNDaughters(); | |
392 | Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0); | |
393 | if(nDau==3){ | |
394 | for(Int_t iDau=0; iDau<3; iDau++){ | |
395 | Int_t ind = labelFirstDau+iDau; | |
396 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind)); | |
968b84b9 | 397 | if(!part){ |
398 | AliError("Daughter particle not found in MC array"); | |
399 | return checkCD; | |
400 | } | |
043062fe | 401 | daughter[iDau]=TMath::Abs(part->GetPdgCode()); |
402 | } | |
403 | }else if(nDau==2){ | |
404 | Int_t nDauFound=0; | |
405 | for(Int_t iDau=0; iDau<2; iDau++){ | |
406 | Int_t ind = labelFirstDau+iDau; | |
407 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind)); | |
968b84b9 | 408 | if(!part){ |
409 | AliError("Daughter particle not found in MC array"); | |
410 | return checkCD; | |
411 | } | |
043062fe | 412 | Int_t pdgCode=TMath::Abs(part->GetPdgCode()); |
413 | if(pdgCode==211 || pdgCode==321 || pdgCode==2212){ | |
414 | if(nDauFound>=3) return checkCD; | |
415 | daughter[nDauFound]=pdgCode; | |
416 | nDauFound++; | |
417 | }else{ | |
418 | Int_t nDauRes=part->GetNDaughters(); | |
419 | if(nDauRes!=2) return checkCD; | |
420 | Int_t labelFirstDauRes = part->GetDaughter(0); | |
421 | for(Int_t iDauRes=0; iDauRes<2; iDauRes++){ | |
422 | Int_t indDR = labelFirstDauRes+iDauRes; | |
423 | AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(fmcArray->At(indDR)); | |
968b84b9 | 424 | if(!partDR){ |
425 | AliError("Daughter particle not found in MC array"); | |
426 | return checkCD; | |
427 | } | |
043062fe | 428 | Int_t pdgCodeDR=TMath::Abs(partDR->GetPdgCode()); |
429 | if(nDauFound>=3) return checkCD; | |
430 | daughter[nDauFound]=pdgCodeDR; | |
431 | nDauFound++; | |
432 | } | |
433 | } | |
434 | } | |
435 | }else{ | |
436 | return checkCD; | |
437 | } | |
438 | for(Int_t iDau1=0; iDau1<3; iDau1++){ | |
439 | for(Int_t iDau2=iDau1; iDau2<3; iDau2++){ | |
440 | if(daughter[iDau1]<daughter[iDau2]){ | |
441 | Int_t tmp=daughter[iDau1]; | |
442 | daughter[iDau1]=daughter[iDau2]; | |
443 | daughter[iDau2]=tmp; | |
444 | } | |
445 | } | |
446 | } | |
447 | for(Int_t iDau=0; iDau<3; iDau++){ | |
448 | if(daughter[iDau]!=pdgDaughter[iDau]){ | |
449 | AliDebug(2, "Wrong decay channel from MC, skipping!!"); | |
450 | return checkCD; | |
451 | } | |
452 | } | |
453 | ||
454 | checkCD = kTRUE; | |
455 | return checkCD; | |
456 | ||
457 | } | |
458 |